@neuroverseos/nv-sim 0.1.7 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +375 -197
  2. package/connectors/nv_mirofish_wrapper.py +841 -0
  3. package/connectors/nv_scienceclaw_wrapper.py +453 -0
  4. package/dist/adapters/scienceclaw.js +52 -2
  5. package/dist/assets/index-B43_0HyO.css +1 -0
  6. package/dist/assets/index-CdghpsS8.js +595 -0
  7. package/dist/assets/{reportEngine-BVdQ2_nW.js → reportEngine-CYSZfooa.js} +1 -1
  8. package/dist/connectors/nv-scienceclaw-post.js +376 -0
  9. package/dist/engine/aiProvider.js +82 -3
  10. package/dist/engine/analyzer.js +12 -24
  11. package/dist/engine/chaosEngine.js +3 -9
  12. package/dist/engine/cli.js +123 -218
  13. package/dist/engine/dynamicsGovernance.js +4 -0
  14. package/dist/engine/fullGovernedLoop.js +16 -1
  15. package/dist/engine/goalEngine.js +3 -4
  16. package/dist/engine/governance.js +18 -0
  17. package/dist/engine/index.js +19 -29
  18. package/dist/engine/intentTranslator.js +281 -0
  19. package/dist/engine/liveAdapter.js +100 -18
  20. package/dist/engine/liveVisualizer.js +2656 -866
  21. package/dist/engine/narrativeInjection.js +78 -89
  22. package/dist/engine/policyEngine.js +171 -58
  23. package/dist/engine/primeRadiant.js +2 -8
  24. package/dist/engine/reasoningEngine.js +2 -7
  25. package/dist/engine/scenarioCapsule.js +77 -133
  26. package/dist/engine/scenarioLibrary.js +52 -131
  27. package/dist/engine/swarmSimulation.js +1 -9
  28. package/dist/engine/worldBridge.js +22 -8
  29. package/dist/engine/worldComparison.js +12 -25
  30. package/dist/index.html +2 -2
  31. package/dist/lib/reasoningEngine.js +17 -1
  32. package/dist/lib/simulationAdapter.js +11 -11
  33. package/dist/lib/swarmParser.js +1 -1
  34. package/dist/runtime/govern.js +160 -7
  35. package/dist/runtime/index.js +1 -4
  36. package/dist/runtime/types.js +91 -0
  37. package/package.json +23 -6
  38. package/dist/adapters/mirofish.js +0 -461
  39. package/dist/assets/index-CHmUN8s0.js +0 -532
  40. package/dist/assets/index-DWgMnB7I.css +0 -1
  41. package/dist/assets/mirotir-logo-DUexumBH.svg +0 -185
  42. package/dist/engine/mirofish.js +0 -295
@@ -0,0 +1,595 @@
1
+ var c1=Object.defineProperty;var zm=e=>{throw TypeError(e)};var d1=(e,t,n)=>t in e?c1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Kt=(e,t,n)=>d1(e,typeof t!="symbol"?t+"":t,n),Cc=(e,t,n)=>t.has(e)||zm("Cannot "+n);var O=(e,t,n)=>(Cc(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?zm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(Cc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Je=(e,t,n)=>(Cc(e,t,"access private method"),n);var Hi=(e,t,n,r)=>({set _(s){te(e,t,s,n)},get _(){return O(e,t,r)}});function u1(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function Eg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rg={exports:{}},Rl={},_g={exports:{}},ie={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Ei=Symbol.for("react.element"),f1=Symbol.for("react.portal"),m1=Symbol.for("react.fragment"),p1=Symbol.for("react.strict_mode"),h1=Symbol.for("react.profiler"),g1=Symbol.for("react.provider"),x1=Symbol.for("react.context"),v1=Symbol.for("react.forward_ref"),y1=Symbol.for("react.suspense"),b1=Symbol.for("react.memo"),w1=Symbol.for("react.lazy"),Bm=Symbol.iterator;function N1(e){return e===null||typeof e!="object"?null:(e=Bm&&e[Bm]||e["@@iterator"],typeof e=="function"?e:null)}var Pg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tg=Object.assign,Ag={};function go(e,t,n){this.props=e,this.context=t,this.refs=Ag,this.updater=n||Pg}go.prototype.isReactComponent={};go.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")};go.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ig(){}Ig.prototype=go.prototype;function qu(e,t,n){this.props=e,this.context=t,this.refs=Ag,this.updater=n||Pg}var Yu=qu.prototype=new Ig;Yu.constructor=qu;Tg(Yu,go.prototype);Yu.isPureReactComponent=!0;var Vm=Array.isArray,Mg=Object.prototype.hasOwnProperty,Qu={current:null},Og={key:!0,ref:!0,__self:!0,__source:!0};function Lg(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)Mg.call(t,r)&&!Og.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Ei,type:e,key:i,ref:a,props:s,_owner:Qu.current}}function S1(e,t){return{$$typeof:Ei,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Xu(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ei}function j1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Um=/\/+/g;function Ec(e,t){return typeof e=="object"&&e!==null&&e.key!=null?j1(""+e.key):t.toString(36)}function wa(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ei:case f1:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Ec(a,0):r,Vm(s)?(n="",e!=null&&(n=e.replace(Um,"$&/")+"/"),wa(s,t,n,"",function(d){return d})):s!=null&&(Xu(s)&&(s=S1(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(Um,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",Vm(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Ec(i,l);a+=wa(i,t,n,c,s)}else if(c=N1(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Ec(i,l++),a+=wa(i,t,n,c,s);else if(i==="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 a}function Gi(e,t,n){if(e==null)return e;var r=[],s=0;return wa(e,r,"","",function(i){return t.call(n,i,s++)}),r}function k1(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 ft={current:null},Na={transition:null},C1={ReactCurrentDispatcher:ft,ReactCurrentBatchConfig:Na,ReactCurrentOwner:Qu};function $g(){throw Error("act(...) is not supported in production builds of React.")}ie.Children={map:Gi,forEach:function(e,t,n){Gi(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gi(e,function(){t++}),t},toArray:function(e){return Gi(e,function(t){return t})||[]},only:function(e){if(!Xu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ie.Component=go;ie.Fragment=m1;ie.Profiler=h1;ie.PureComponent=qu;ie.StrictMode=p1;ie.Suspense=y1;ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C1;ie.act=$g;ie.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=Tg({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Qu.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Mg.call(t,c)&&!Og.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:Ei,type:e.type,key:s,ref:i,props:r,_owner:a}};ie.createContext=function(e){return e={$$typeof:x1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:g1,_context:e},e.Consumer=e};ie.createElement=Lg;ie.createFactory=function(e){var t=Lg.bind(null,e);return t.type=e,t};ie.createRef=function(){return{current:null}};ie.forwardRef=function(e){return{$$typeof:v1,render:e}};ie.isValidElement=Xu;ie.lazy=function(e){return{$$typeof:w1,_payload:{_status:-1,_result:e},_init:k1}};ie.memo=function(e,t){return{$$typeof:b1,type:e,compare:t===void 0?null:t}};ie.startTransition=function(e){var t=Na.transition;Na.transition={};try{e()}finally{Na.transition=t}};ie.unstable_act=$g;ie.useCallback=function(e,t){return ft.current.useCallback(e,t)};ie.useContext=function(e){return ft.current.useContext(e)};ie.useDebugValue=function(){};ie.useDeferredValue=function(e){return ft.current.useDeferredValue(e)};ie.useEffect=function(e,t){return ft.current.useEffect(e,t)};ie.useId=function(){return ft.current.useId()};ie.useImperativeHandle=function(e,t,n){return ft.current.useImperativeHandle(e,t,n)};ie.useInsertionEffect=function(e,t){return ft.current.useInsertionEffect(e,t)};ie.useLayoutEffect=function(e,t){return ft.current.useLayoutEffect(e,t)};ie.useMemo=function(e,t){return ft.current.useMemo(e,t)};ie.useReducer=function(e,t,n){return ft.current.useReducer(e,t,n)};ie.useRef=function(e){return ft.current.useRef(e)};ie.useState=function(e){return ft.current.useState(e)};ie.useSyncExternalStore=function(e,t,n){return ft.current.useSyncExternalStore(e,t,n)};ie.useTransition=function(){return ft.current.useTransition()};ie.version="18.3.1";_g.exports=ie;var h=_g.exports;const V=Eg(h),Zu=u1({__proto__:null,default:V},[h]);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var E1=h,R1=Symbol.for("react.element"),_1=Symbol.for("react.fragment"),P1=Object.prototype.hasOwnProperty,T1=E1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A1={key:!0,ref:!0,__self:!0,__source:!0};function Dg(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)P1.call(t,r)&&!A1.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:R1,type:e,key:i,ref:a,props:s,_owner:T1.current}}Rl.Fragment=_1;Rl.jsx=Dg;Rl.jsxs=Dg;Rg.exports=Rl;var o=Rg.exports,Fg={exports:{}},Pt={},zg={exports:{}},Bg={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(T,I){var D=T.length;T.push(I);e:for(;0<D;){var Q=D-1>>>1,G=T[Q];if(0<s(G,I))T[Q]=I,T[D]=G,D=Q;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var I=T[0],D=T.pop();if(D!==I){T[0]=D;e:for(var Q=0,G=T.length,J=G>>>1;Q<J;){var Z=2*(Q+1)-1,pe=T[Z],we=Z+1,W=T[we];if(0>s(pe,D))we<G&&0>s(W,pe)?(T[Q]=W,T[we]=D,Q=we):(T[Q]=pe,T[Z]=D,Q=Z);else if(we<G&&0>s(W,D))T[Q]=W,T[we]=D,Q=we;else break e}}return I}function s(T,I){var D=T.sortIndex-I.sortIndex;return D!==0?D:T.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],d=[],u=1,f=null,m=3,p=!1,v=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(T){for(var I=n(d);I!==null;){if(I.callback===null)r(d);else if(I.startTime<=T)r(d),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(d)}}function N(T){if(x=!1,y(T),!v)if(n(c)!==null)v=!0,$(S);else{var I=n(d);I!==null&&B(N,I.startTime-T)}}function S(T,I){v=!1,x&&(x=!1,g(E),E=-1),p=!0;var D=m;try{for(y(I),f=n(c);f!==null&&(!(f.expirationTime>I)||T&&!_());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,m=f.priorityLevel;var G=Q(f.expirationTime<=I);I=e.unstable_now(),typeof G=="function"?f.callback=G:f===n(c)&&r(c),y(I)}else r(c);f=n(c)}if(f!==null)var J=!0;else{var Z=n(d);Z!==null&&B(N,Z.startTime-I),J=!1}return J}finally{f=null,m=D,p=!1}}var C=!1,j=null,E=-1,R=5,P=-1;function _(){return!(e.unstable_now()-P<R)}function k(){if(j!==null){var T=e.unstable_now();P=T;var I=!0;try{I=j(!0,T)}finally{I?A():(C=!1,j=null)}}else C=!1}var A;if(typeof b=="function")A=function(){b(k)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,U=M.port2;M.port1.onmessage=k,A=function(){U.postMessage(null)}}else A=function(){w(k,0)};function $(T){j=T,C||(C=!0,A())}function B(T,I){E=w(function(){T(e.unstable_now())},I)}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(T){T.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,$(S))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(T){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var D=m;m=I;try{return T()}finally{m=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,I){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var D=m;m=T;try{return I()}finally{m=D}},e.unstable_scheduleCallback=function(T,I,D){var Q=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?Q+D:Q):D=Q,T){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=D+G,T={id:u++,callback:I,priorityLevel:T,startTime:D,expirationTime:G,sortIndex:-1},D>Q?(T.sortIndex=D,t(d,T),n(c)===null&&T===n(d)&&(x?(g(E),E=-1):x=!0,B(N,D-Q))):(T.sortIndex=G,t(c,T),v||p||(v=!0,$(S))),T},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(T){var I=m;return function(){var D=m;m=I;try{return T.apply(this,arguments)}finally{m=D}}}})(Bg);zg.exports=Bg;var I1=zg.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var M1=h,_t=I1;function z(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 Vg=new Set,ei={};function fs(e,t){ro(e,t),ro(e+"Capture",t)}function ro(e,t){for(ei[e]=t,e=0;e<t.length;e++)Vg.add(t[e])}var Fn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nd=Object.prototype.hasOwnProperty,O1=/^[: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]*$/,Wm={},Hm={};function L1(e){return Nd.call(Hm,e)?!0:Nd.call(Wm,e)?!1:O1.test(e)?Hm[e]=!0:(Wm[e]=!0,!1)}function $1(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 D1(e,t,n,r){if(t===null||typeof t>"u"||$1(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 mt(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Qe[e]=new mt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Qe[t]=new mt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Qe[e]=new mt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Qe[e]=new mt(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){Qe[e]=new mt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Qe[e]=new mt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Qe[e]=new mt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Qe[e]=new mt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Qe[e]=new mt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ju=/[\-:]([a-z])/g;function ef(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(Ju,ef);Qe[t]=new mt(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(Ju,ef);Qe[t]=new mt(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(Ju,ef);Qe[t]=new mt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Qe[e]=new mt(e,1,!1,e.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new mt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Qe[e]=new mt(e,1,!1,e.toLowerCase(),null,!0,!0)});function tf(e,t,n,r){var s=Qe.hasOwnProperty(t)?Qe[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(D1(t,n,s,r)&&(n=null),r||s===null?L1(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Gn=M1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ki=Symbol.for("react.element"),js=Symbol.for("react.portal"),ks=Symbol.for("react.fragment"),nf=Symbol.for("react.strict_mode"),Sd=Symbol.for("react.profiler"),Ug=Symbol.for("react.provider"),Wg=Symbol.for("react.context"),rf=Symbol.for("react.forward_ref"),jd=Symbol.for("react.suspense"),kd=Symbol.for("react.suspense_list"),sf=Symbol.for("react.memo"),rr=Symbol.for("react.lazy"),Hg=Symbol.for("react.offscreen"),Gm=Symbol.iterator;function jo(e){return e===null||typeof e!="object"?null:(e=Gm&&e[Gm]||e["@@iterator"],typeof e=="function"?e:null)}var Ie=Object.assign,Rc;function $o(e){if(Rc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rc=t&&t[1]||""}return`
34
+ `+Rc+e}var _c=!1;function Pc(e,t){if(!e||_c)return"";_c=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
35
+ `),i=r.stack.split(`
36
+ `),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
37
+ `+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{_c=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$o(e):""}function F1(e){switch(e.tag){case 5:return $o(e.type);case 16:return $o("Lazy");case 13:return $o("Suspense");case 19:return $o("SuspenseList");case 0:case 2:case 15:return e=Pc(e.type,!1),e;case 11:return e=Pc(e.type.render,!1),e;case 1:return e=Pc(e.type,!0),e;default:return""}}function Cd(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 ks:return"Fragment";case js:return"Portal";case Sd:return"Profiler";case nf:return"StrictMode";case jd:return"Suspense";case kd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Wg:return(e.displayName||"Context")+".Consumer";case Ug:return(e._context.displayName||"Context")+".Provider";case rf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sf:return t=e.displayName||null,t!==null?t:Cd(e.type)||"Memo";case rr:t=e._payload,e=e._init;try{return Cd(e(t))}catch{}}return null}function z1(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 Cd(t);case 8:return t===nf?"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 jr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function B1(e){var t=Gg(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 s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qi(e){e._valueTracker||(e._valueTracker=B1(e))}function Kg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function za(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 Ed(e,t){var n=t.checked;return Ie({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Km(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=jr(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 qg(e,t){t=t.checked,t!=null&&tf(e,"checked",t,!1)}function Rd(e,t){qg(e,t);var n=jr(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")?_d(e,t.type,n):t.hasOwnProperty("defaultValue")&&_d(e,t.type,jr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qm(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 _d(e,t,n){(t!=="number"||za(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Do=Array.isArray;function Ls(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+jr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Pd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(z(91));return Ie({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ym(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(z(92));if(Do(n)){if(1<n.length)throw Error(z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:jr(n)}}function Yg(e,t){var n=jr(t.value),r=jr(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 Qm(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Qg(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 Td(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Qg(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yi,Xg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yi=Yi||document.createElement("div"),Yi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ti(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Uo={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},V1=["Webkit","ms","Moz","O"];Object.keys(Uo).forEach(function(e){V1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Uo[t]=Uo[e]})});function Zg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Uo.hasOwnProperty(e)&&Uo[e]?(""+t).trim():t+"px"}function Jg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var U1=Ie({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 Ad(e,t){if(t){if(U1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(z(62))}}function Id(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 Md=null;function of(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Od=null,$s=null,Ds=null;function Xm(e){if(e=Pi(e)){if(typeof Od!="function")throw Error(z(280));var t=e.stateNode;t&&(t=Il(t),Od(e.stateNode,e.type,t))}}function ex(e){$s?Ds?Ds.push(e):Ds=[e]:$s=e}function tx(){if($s){var e=$s,t=Ds;if(Ds=$s=null,Xm(e),t)for(e=0;e<t.length;e++)Xm(t[e])}}function nx(e,t){return e(t)}function rx(){}var Tc=!1;function sx(e,t,n){if(Tc)return e(t,n);Tc=!0;try{return nx(e,t,n)}finally{Tc=!1,($s!==null||Ds!==null)&&(rx(),tx())}}function ni(e,t){var n=e.stateNode;if(n===null)return null;var r=Il(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(z(231,t,typeof n));return n}var Ld=!1;if(Fn)try{var ko={};Object.defineProperty(ko,"passive",{get:function(){Ld=!0}}),window.addEventListener("test",ko,ko),window.removeEventListener("test",ko,ko)}catch{Ld=!1}function W1(e,t,n,r,s,i,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var Wo=!1,Ba=null,Va=!1,$d=null,H1={onError:function(e){Wo=!0,Ba=e}};function G1(e,t,n,r,s,i,a,l,c){Wo=!1,Ba=null,W1.apply(H1,arguments)}function K1(e,t,n,r,s,i,a,l,c){if(G1.apply(this,arguments),Wo){if(Wo){var d=Ba;Wo=!1,Ba=null}else throw Error(z(198));Va||(Va=!0,$d=d)}}function ms(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 ox(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 Zm(e){if(ms(e)!==e)throw Error(z(188))}function q1(e){var t=e.alternate;if(!t){if(t=ms(e),t===null)throw Error(z(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Zm(s),e;if(i===r)return Zm(s),t;i=i.sibling}throw Error(z(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a)throw Error(z(189))}}if(n.alternate!==r)throw Error(z(190))}if(n.tag!==3)throw Error(z(188));return n.stateNode.current===n?e:t}function ix(e){return e=q1(e),e!==null?ax(e):null}function ax(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ax(e);if(t!==null)return t;e=e.sibling}return null}var lx=_t.unstable_scheduleCallback,Jm=_t.unstable_cancelCallback,Y1=_t.unstable_shouldYield,Q1=_t.unstable_requestPaint,Le=_t.unstable_now,X1=_t.unstable_getCurrentPriorityLevel,af=_t.unstable_ImmediatePriority,cx=_t.unstable_UserBlockingPriority,Ua=_t.unstable_NormalPriority,Z1=_t.unstable_LowPriority,dx=_t.unstable_IdlePriority,_l=null,Sn=null;function J1(e){if(Sn&&typeof Sn.onCommitFiberRoot=="function")try{Sn.onCommitFiberRoot(_l,e,void 0,(e.current.flags&128)===128)}catch{}}var rn=Math.clz32?Math.clz32:nN,eN=Math.log,tN=Math.LN2;function nN(e){return e>>>=0,e===0?32:31-(eN(e)/tN|0)|0}var Qi=64,Xi=4194304;function Fo(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 Wa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=Fo(l):(i&=a,i!==0&&(r=Fo(i)))}else a=n&~s,a!==0?r=Fo(a):i!==0&&(r=Fo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&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-rn(t),s=1<<n,r|=e[n],t&=~s;return r}function rN(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;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 sN(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-rn(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=rN(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Dd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ux(){var e=Qi;return Qi<<=1,!(Qi&4194240)&&(Qi=64),e}function Ac(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ri(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-rn(t),e[t]=n}function oN(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 s=31-rn(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function lf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-rn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var he=0;function fx(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var mx,cf,px,hx,gx,Fd=!1,Zi=[],hr=null,gr=null,xr=null,ri=new Map,si=new Map,or=[],iN="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 ep(e,t){switch(e){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":gr=null;break;case"mouseover":case"mouseout":xr=null;break;case"pointerover":case"pointerout":ri.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":si.delete(t.pointerId)}}function Co(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Pi(t),t!==null&&cf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function aN(e,t,n,r,s){switch(t){case"focusin":return hr=Co(hr,e,t,n,r,s),!0;case"dragenter":return gr=Co(gr,e,t,n,r,s),!0;case"mouseover":return xr=Co(xr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return ri.set(i,Co(ri.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,si.set(i,Co(si.get(i)||null,e,t,n,r,s)),!0}return!1}function xx(e){var t=zr(e.target);if(t!==null){var n=ms(t);if(n!==null){if(t=n.tag,t===13){if(t=ox(n),t!==null){e.blockedOn=t,gx(e.priority,function(){px(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 Sa(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Md=r,n.target.dispatchEvent(r),Md=null}else return t=Pi(n),t!==null&&cf(t),e.blockedOn=n,!1;t.shift()}return!0}function tp(e,t,n){Sa(e)&&n.delete(t)}function lN(){Fd=!1,hr!==null&&Sa(hr)&&(hr=null),gr!==null&&Sa(gr)&&(gr=null),xr!==null&&Sa(xr)&&(xr=null),ri.forEach(tp),si.forEach(tp)}function Eo(e,t){e.blockedOn===t&&(e.blockedOn=null,Fd||(Fd=!0,_t.unstable_scheduleCallback(_t.unstable_NormalPriority,lN)))}function oi(e){function t(s){return Eo(s,e)}if(0<Zi.length){Eo(Zi[0],e);for(var n=1;n<Zi.length;n++){var r=Zi[n];r.blockedOn===e&&(r.blockedOn=null)}}for(hr!==null&&Eo(hr,e),gr!==null&&Eo(gr,e),xr!==null&&Eo(xr,e),ri.forEach(t),si.forEach(t),n=0;n<or.length;n++)r=or[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<or.length&&(n=or[0],n.blockedOn===null);)xx(n),n.blockedOn===null&&or.shift()}var Fs=Gn.ReactCurrentBatchConfig,Ha=!0;function cN(e,t,n,r){var s=he,i=Fs.transition;Fs.transition=null;try{he=1,df(e,t,n,r)}finally{he=s,Fs.transition=i}}function dN(e,t,n,r){var s=he,i=Fs.transition;Fs.transition=null;try{he=4,df(e,t,n,r)}finally{he=s,Fs.transition=i}}function df(e,t,n,r){if(Ha){var s=zd(e,t,n,r);if(s===null)Vc(e,t,r,Ga,n),ep(e,r);else if(aN(s,e,t,n,r))r.stopPropagation();else if(ep(e,r),t&4&&-1<iN.indexOf(e)){for(;s!==null;){var i=Pi(s);if(i!==null&&mx(i),i=zd(e,t,n,r),i===null&&Vc(e,t,r,Ga,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Vc(e,t,r,null,n)}}var Ga=null;function zd(e,t,n,r){if(Ga=null,e=of(r),e=zr(e),e!==null)if(t=ms(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ox(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 Ga=e,null}function vx(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(X1()){case af:return 1;case cx:return 4;case Ua:case Z1:return 16;case dx:return 536870912;default:return 16}default:return 16}}var fr=null,uf=null,ja=null;function yx(){if(ja)return ja;var e,t=uf,n=t.length,r,s="value"in fr?fr.value:fr.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[i-r];r++);return ja=s.slice(e,1<r?1-r:void 0)}function ka(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 Ji(){return!0}function np(){return!1}function Tt(e){function t(n,r,s,i,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Ji:np,this.isPropagationStopped=np,this}return Ie(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=Ji)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ji)},persist:function(){},isPersistent:Ji}),t}var xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ff=Tt(xo),_i=Ie({},xo,{view:0,detail:0}),uN=Tt(_i),Ic,Mc,Ro,Pl=Ie({},_i,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mf,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!==Ro&&(Ro&&e.type==="mousemove"?(Ic=e.screenX-Ro.screenX,Mc=e.screenY-Ro.screenY):Mc=Ic=0,Ro=e),Ic)},movementY:function(e){return"movementY"in e?e.movementY:Mc}}),rp=Tt(Pl),fN=Ie({},Pl,{dataTransfer:0}),mN=Tt(fN),pN=Ie({},_i,{relatedTarget:0}),Oc=Tt(pN),hN=Ie({},xo,{animationName:0,elapsedTime:0,pseudoElement:0}),gN=Tt(hN),xN=Ie({},xo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vN=Tt(xN),yN=Ie({},xo,{data:0}),sp=Tt(yN),bN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wN={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"},NN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function SN(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=NN[e])?!!t[e]:!1}function mf(){return SN}var jN=Ie({},_i,{key:function(e){if(e.key){var t=bN[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ka(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mf,charCode:function(e){return e.type==="keypress"?ka(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ka(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kN=Tt(jN),CN=Ie({},Pl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),op=Tt(CN),EN=Ie({},_i,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mf}),RN=Tt(EN),_N=Ie({},xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),PN=Tt(_N),TN=Ie({},Pl,{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}),AN=Tt(TN),IN=[9,13,27,32],pf=Fn&&"CompositionEvent"in window,Ho=null;Fn&&"documentMode"in document&&(Ho=document.documentMode);var MN=Fn&&"TextEvent"in window&&!Ho,bx=Fn&&(!pf||Ho&&8<Ho&&11>=Ho),ip=" ",ap=!1;function wx(e,t){switch(e){case"keyup":return IN.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cs=!1;function ON(e,t){switch(e){case"compositionend":return Nx(t);case"keypress":return t.which!==32?null:(ap=!0,ip);case"textInput":return e=t.data,e===ip&&ap?null:e;default:return null}}function LN(e,t){if(Cs)return e==="compositionend"||!pf&&wx(e,t)?(e=yx(),ja=uf=fr=null,Cs=!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 bx&&t.locale!=="ko"?null:t.data;default:return null}}var $N={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 lp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$N[e.type]:t==="textarea"}function Sx(e,t,n,r){ex(r),t=Ka(t,"onChange"),0<t.length&&(n=new ff("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Go=null,ii=null;function DN(e){Mx(e,0)}function Tl(e){var t=_s(e);if(Kg(t))return e}function FN(e,t){if(e==="change")return t}var jx=!1;if(Fn){var Lc;if(Fn){var $c="oninput"in document;if(!$c){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),$c=typeof cp.oninput=="function"}Lc=$c}else Lc=!1;jx=Lc&&(!document.documentMode||9<document.documentMode)}function dp(){Go&&(Go.detachEvent("onpropertychange",kx),ii=Go=null)}function kx(e){if(e.propertyName==="value"&&Tl(ii)){var t=[];Sx(t,ii,e,of(e)),sx(DN,t)}}function zN(e,t,n){e==="focusin"?(dp(),Go=t,ii=n,Go.attachEvent("onpropertychange",kx)):e==="focusout"&&dp()}function BN(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tl(ii)}function VN(e,t){if(e==="click")return Tl(t)}function UN(e,t){if(e==="input"||e==="change")return Tl(t)}function WN(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var on=typeof Object.is=="function"?Object.is:WN;function ai(e,t){if(on(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 s=n[r];if(!Nd.call(t,s)||!on(e[s],t[s]))return!1}return!0}function up(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fp(e,t){var n=up(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=up(n)}}function Cx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ex(){for(var e=window,t=za();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=za(e.document)}return t}function hf(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 HN(e){var t=Ex(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Cx(n.ownerDocument.documentElement,n)){if(r!==null&&hf(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 s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=fp(n,i);var a=fp(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.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 GN=Fn&&"documentMode"in document&&11>=document.documentMode,Es=null,Bd=null,Ko=null,Vd=!1;function mp(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vd||Es==null||Es!==za(r)||(r=Es,"selectionStart"in r&&hf(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}),Ko&&ai(Ko,r)||(Ko=r,r=Ka(Bd,"onSelect"),0<r.length&&(t=new ff("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Es)))}function ea(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Rs={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionend:ea("Transition","TransitionEnd")},Dc={},Rx={};Fn&&(Rx=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function Al(e){if(Dc[e])return Dc[e];if(!Rs[e])return e;var t=Rs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rx)return Dc[e]=t[n];return e}var _x=Al("animationend"),Px=Al("animationiteration"),Tx=Al("animationstart"),Ax=Al("transitionend"),Ix=new Map,pp="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 _r(e,t){Ix.set(e,t),fs(t,[e])}for(var Fc=0;Fc<pp.length;Fc++){var zc=pp[Fc],KN=zc.toLowerCase(),qN=zc[0].toUpperCase()+zc.slice(1);_r(KN,"on"+qN)}_r(_x,"onAnimationEnd");_r(Px,"onAnimationIteration");_r(Tx,"onAnimationStart");_r("dblclick","onDoubleClick");_r("focusin","onFocus");_r("focusout","onBlur");_r(Ax,"onTransitionEnd");ro("onMouseEnter",["mouseout","mouseover"]);ro("onMouseLeave",["mouseout","mouseover"]);ro("onPointerEnter",["pointerout","pointerover"]);ro("onPointerLeave",["pointerout","pointerover"]);fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zo="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(" "),YN=new Set("cancel close invalid load scroll toggle".split(" ").concat(zo));function hp(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,K1(r,t,void 0,e),e.currentTarget=null}function Mx(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;hp(s,l,d),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;hp(s,l,d),i=c}}}if(Va)throw e=$d,Va=!1,$d=null,e}function ke(e,t){var n=t[Kd];n===void 0&&(n=t[Kd]=new Set);var r=e+"__bubble";n.has(r)||(Ox(t,e,2,!1),n.add(r))}function Bc(e,t,n){var r=0;t&&(r|=4),Ox(n,e,r,t)}var ta="_reactListening"+Math.random().toString(36).slice(2);function li(e){if(!e[ta]){e[ta]=!0,Vg.forEach(function(n){n!=="selectionchange"&&(YN.has(n)||Bc(n,!1,e),Bc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ta]||(t[ta]=!0,Bc("selectionchange",!1,t))}}function Ox(e,t,n,r){switch(vx(t)){case 1:var s=cN;break;case 4:s=dN;break;default:s=df}n=s.bind(null,t,n,e),s=void 0,!Ld||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Vc(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=zr(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}sx(function(){var d=i,u=of(n),f=[];e:{var m=Ix.get(e);if(m!==void 0){var p=ff,v=e;switch(e){case"keypress":if(ka(n)===0)break e;case"keydown":case"keyup":p=kN;break;case"focusin":v="focus",p=Oc;break;case"focusout":v="blur",p=Oc;break;case"beforeblur":case"afterblur":p=Oc;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":p=rp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=mN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=RN;break;case _x:case Px:case Tx:p=gN;break;case Ax:p=PN;break;case"scroll":p=uN;break;case"wheel":p=AN;break;case"copy":case"cut":case"paste":p=vN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=op}var x=(t&4)!==0,w=!x&&e==="scroll",g=x?m!==null?m+"Capture":null:m;x=[];for(var b=d,y;b!==null;){y=b;var N=y.stateNode;if(y.tag===5&&N!==null&&(y=N,g!==null&&(N=ni(b,g),N!=null&&x.push(ci(b,N,y)))),w)break;b=b.return}0<x.length&&(m=new p(m,v,null,n,u),f.push({event:m,listeners:x}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==Md&&(v=n.relatedTarget||n.fromElement)&&(zr(v)||v[zn]))break e;if((p||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,p?(v=n.relatedTarget||n.toElement,p=d,v=v?zr(v):null,v!==null&&(w=ms(v),v!==w||v.tag!==5&&v.tag!==6)&&(v=null)):(p=null,v=d),p!==v)){if(x=rp,N="onMouseLeave",g="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(x=op,N="onPointerLeave",g="onPointerEnter",b="pointer"),w=p==null?m:_s(p),y=v==null?m:_s(v),m=new x(N,b+"leave",p,n,u),m.target=w,m.relatedTarget=y,N=null,zr(u)===d&&(x=new x(g,b+"enter",v,n,u),x.target=y,x.relatedTarget=w,N=x),w=N,p&&v)t:{for(x=p,g=v,b=0,y=x;y;y=vs(y))b++;for(y=0,N=g;N;N=vs(N))y++;for(;0<b-y;)x=vs(x),b--;for(;0<y-b;)g=vs(g),y--;for(;b--;){if(x===g||g!==null&&x===g.alternate)break t;x=vs(x),g=vs(g)}x=null}else x=null;p!==null&&gp(f,m,p,x,!1),v!==null&&w!==null&&gp(f,w,v,x,!0)}}e:{if(m=d?_s(d):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var S=FN;else if(lp(m))if(jx)S=UN;else{S=BN;var C=zN}else(p=m.nodeName)&&p.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=VN);if(S&&(S=S(e,d))){Sx(f,S,n,u);break e}C&&C(e,m,d),e==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&_d(m,"number",m.value)}switch(C=d?_s(d):window,e){case"focusin":(lp(C)||C.contentEditable==="true")&&(Es=C,Bd=d,Ko=null);break;case"focusout":Ko=Bd=Es=null;break;case"mousedown":Vd=!0;break;case"contextmenu":case"mouseup":case"dragend":Vd=!1,mp(f,n,u);break;case"selectionchange":if(GN)break;case"keydown":case"keyup":mp(f,n,u)}var j;if(pf)e:{switch(e){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else Cs?wx(e,n)&&(E="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(bx&&n.locale!=="ko"&&(Cs||E!=="onCompositionStart"?E==="onCompositionEnd"&&Cs&&(j=yx()):(fr=u,uf="value"in fr?fr.value:fr.textContent,Cs=!0)),C=Ka(d,E),0<C.length&&(E=new sp(E,e,null,n,u),f.push({event:E,listeners:C}),j?E.data=j:(j=Nx(n),j!==null&&(E.data=j)))),(j=MN?ON(e,n):LN(e,n))&&(d=Ka(d,"onBeforeInput"),0<d.length&&(u=new sp("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=j))}Mx(f,t)})}function ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ka(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=ni(e,n),i!=null&&r.unshift(ci(e,i,s)),i=ni(e,t),i!=null&&r.push(ci(e,i,s))),e=e.return}return r}function vs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function gp(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=ni(n,i),c!=null&&a.unshift(ci(n,c,l))):s||(c=ni(n,i),c!=null&&a.push(ci(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var QN=/\r\n?/g,XN=/\u0000|\uFFFD/g;function xp(e){return(typeof e=="string"?e:""+e).replace(QN,`
38
+ `).replace(XN,"")}function na(e,t,n){if(t=xp(t),xp(e)!==t&&n)throw Error(z(425))}function qa(){}var Ud=null,Wd=null;function Hd(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 Gd=typeof setTimeout=="function"?setTimeout:void 0,ZN=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,JN=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(eS)}:Gd;function eS(e){setTimeout(function(){throw e})}function Uc(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),oi(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);oi(t)}function vr(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 yp(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 vo=Math.random().toString(36).slice(2),xn="__reactFiber$"+vo,di="__reactProps$"+vo,zn="__reactContainer$"+vo,Kd="__reactEvents$"+vo,tS="__reactListeners$"+vo,nS="__reactHandles$"+vo;function zr(e){var t=e[xn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[zn]||n[xn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yp(e);e!==null;){if(n=e[xn])return n;e=yp(e)}return t}e=n,n=e.parentNode}return null}function Pi(e){return e=e[xn]||e[zn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _s(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(z(33))}function Il(e){return e[di]||null}var qd=[],Ps=-1;function Pr(e){return{current:e}}function Ce(e){0>Ps||(e.current=qd[Ps],qd[Ps]=null,Ps--)}function Se(e,t){Ps++,qd[Ps]=e.current,e.current=t}var kr={},ot=Pr(kr),bt=Pr(!1),es=kr;function so(e,t){var n=e.type.contextTypes;if(!n)return kr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function wt(e){return e=e.childContextTypes,e!=null}function Ya(){Ce(bt),Ce(ot)}function bp(e,t,n){if(ot.current!==kr)throw Error(z(168));Se(ot,t),Se(bt,n)}function Lx(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(z(108,z1(e)||"Unknown",s));return Ie({},n,r)}function Qa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kr,es=ot.current,Se(ot,e),Se(bt,bt.current),!0}function wp(e,t,n){var r=e.stateNode;if(!r)throw Error(z(169));n?(e=Lx(e,t,es),r.__reactInternalMemoizedMergedChildContext=e,Ce(bt),Ce(ot),Se(ot,e)):Ce(bt),Se(bt,n)}var In=null,Ml=!1,Wc=!1;function $x(e){In===null?In=[e]:In.push(e)}function rS(e){Ml=!0,$x(e)}function Tr(){if(!Wc&&In!==null){Wc=!0;var e=0,t=he;try{var n=In;for(he=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}In=null,Ml=!1}catch(s){throw In!==null&&(In=In.slice(e+1)),lx(af,Tr),s}finally{he=t,Wc=!1}}return null}var Ts=[],As=0,Xa=null,Za=0,Mt=[],Ot=0,ts=null,On=1,Ln="";function Dr(e,t){Ts[As++]=Za,Ts[As++]=Xa,Xa=e,Za=t}function Dx(e,t,n){Mt[Ot++]=On,Mt[Ot++]=Ln,Mt[Ot++]=ts,ts=e;var r=On;e=Ln;var s=32-rn(r)-1;r&=~(1<<s),n+=1;var i=32-rn(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,On=1<<32-rn(t)+s|n<<s|r,Ln=i+e}else On=1<<i|n<<s|r,Ln=e}function gf(e){e.return!==null&&(Dr(e,1),Dx(e,1,0))}function xf(e){for(;e===Xa;)Xa=Ts[--As],Ts[As]=null,Za=Ts[--As],Ts[As]=null;for(;e===ts;)ts=Mt[--Ot],Mt[Ot]=null,Ln=Mt[--Ot],Mt[Ot]=null,On=Mt[--Ot],Mt[Ot]=null}var Et=null,Ct=null,Re=!1,nn=null;function Fx(e,t){var n=Lt(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 Np(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,Et=e,Ct=vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,Ct=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ts!==null?{id:On,overflow:Ln}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Lt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Et=e,Ct=null,!0):!1;default:return!1}}function Yd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Qd(e){if(Re){var t=Ct;if(t){var n=t;if(!Np(e,t)){if(Yd(e))throw Error(z(418));t=vr(n.nextSibling);var r=Et;t&&Np(e,t)?Fx(r,n):(e.flags=e.flags&-4097|2,Re=!1,Et=e)}}else{if(Yd(e))throw Error(z(418));e.flags=e.flags&-4097|2,Re=!1,Et=e}}}function Sp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Et=e}function ra(e){if(e!==Et)return!1;if(!Re)return Sp(e),Re=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Hd(e.type,e.memoizedProps)),t&&(t=Ct)){if(Yd(e))throw zx(),Error(z(418));for(;t;)Fx(e,t),t=vr(t.nextSibling)}if(Sp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ct=vr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ct=null}}else Ct=Et?vr(e.stateNode.nextSibling):null;return!0}function zx(){for(var e=Ct;e;)e=vr(e.nextSibling)}function oo(){Ct=Et=null,Re=!1}function vf(e){nn===null?nn=[e]:nn.push(e)}var sS=Gn.ReactCurrentBatchConfig;function _o(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(z(309));var r=n.stateNode}if(!r)throw Error(z(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(z(284));if(!n._owner)throw Error(z(290,e))}return e}function sa(e,t){throw e=Object.prototype.toString.call(t),Error(z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function jp(e){var t=e._init;return t(e._payload)}function Bx(e){function t(g,b){if(e){var y=g.deletions;y===null?(g.deletions=[b],g.flags|=16):y.push(b)}}function n(g,b){if(!e)return null;for(;b!==null;)t(g,b),b=b.sibling;return null}function r(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function s(g,b){return g=Nr(g,b),g.index=0,g.sibling=null,g}function i(g,b,y){return g.index=y,e?(y=g.alternate,y!==null?(y=y.index,y<b?(g.flags|=2,b):y):(g.flags|=2,b)):(g.flags|=1048576,b)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,b,y,N){return b===null||b.tag!==6?(b=Xc(y,g.mode,N),b.return=g,b):(b=s(b,y),b.return=g,b)}function c(g,b,y,N){var S=y.type;return S===ks?u(g,b,y.props.children,N,y.key):b!==null&&(b.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===rr&&jp(S)===b.type)?(N=s(b,y.props),N.ref=_o(g,b,y),N.return=g,N):(N=Aa(y.type,y.key,y.props,null,g.mode,N),N.ref=_o(g,b,y),N.return=g,N)}function d(g,b,y,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==y.containerInfo||b.stateNode.implementation!==y.implementation?(b=Zc(y,g.mode,N),b.return=g,b):(b=s(b,y.children||[]),b.return=g,b)}function u(g,b,y,N,S){return b===null||b.tag!==7?(b=Xr(y,g.mode,N,S),b.return=g,b):(b=s(b,y),b.return=g,b)}function f(g,b,y){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Xc(""+b,g.mode,y),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ki:return y=Aa(b.type,b.key,b.props,null,g.mode,y),y.ref=_o(g,null,b),y.return=g,y;case js:return b=Zc(b,g.mode,y),b.return=g,b;case rr:var N=b._init;return f(g,N(b._payload),y)}if(Do(b)||jo(b))return b=Xr(b,g.mode,y,null),b.return=g,b;sa(g,b)}return null}function m(g,b,y,N){var S=b!==null?b.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return S!==null?null:l(g,b,""+y,N);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ki:return y.key===S?c(g,b,y,N):null;case js:return y.key===S?d(g,b,y,N):null;case rr:return S=y._init,m(g,b,S(y._payload),N)}if(Do(y)||jo(y))return S!==null?null:u(g,b,y,N,null);sa(g,y)}return null}function p(g,b,y,N,S){if(typeof N=="string"&&N!==""||typeof N=="number")return g=g.get(y)||null,l(b,g,""+N,S);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Ki:return g=g.get(N.key===null?y:N.key)||null,c(b,g,N,S);case js:return g=g.get(N.key===null?y:N.key)||null,d(b,g,N,S);case rr:var C=N._init;return p(g,b,y,C(N._payload),S)}if(Do(N)||jo(N))return g=g.get(y)||null,u(b,g,N,S,null);sa(b,N)}return null}function v(g,b,y,N){for(var S=null,C=null,j=b,E=b=0,R=null;j!==null&&E<y.length;E++){j.index>E?(R=j,j=null):R=j.sibling;var P=m(g,j,y[E],N);if(P===null){j===null&&(j=R);break}e&&j&&P.alternate===null&&t(g,j),b=i(P,b,E),C===null?S=P:C.sibling=P,C=P,j=R}if(E===y.length)return n(g,j),Re&&Dr(g,E),S;if(j===null){for(;E<y.length;E++)j=f(g,y[E],N),j!==null&&(b=i(j,b,E),C===null?S=j:C.sibling=j,C=j);return Re&&Dr(g,E),S}for(j=r(g,j);E<y.length;E++)R=p(j,g,E,y[E],N),R!==null&&(e&&R.alternate!==null&&j.delete(R.key===null?E:R.key),b=i(R,b,E),C===null?S=R:C.sibling=R,C=R);return e&&j.forEach(function(_){return t(g,_)}),Re&&Dr(g,E),S}function x(g,b,y,N){var S=jo(y);if(typeof S!="function")throw Error(z(150));if(y=S.call(y),y==null)throw Error(z(151));for(var C=S=null,j=b,E=b=0,R=null,P=y.next();j!==null&&!P.done;E++,P=y.next()){j.index>E?(R=j,j=null):R=j.sibling;var _=m(g,j,P.value,N);if(_===null){j===null&&(j=R);break}e&&j&&_.alternate===null&&t(g,j),b=i(_,b,E),C===null?S=_:C.sibling=_,C=_,j=R}if(P.done)return n(g,j),Re&&Dr(g,E),S;if(j===null){for(;!P.done;E++,P=y.next())P=f(g,P.value,N),P!==null&&(b=i(P,b,E),C===null?S=P:C.sibling=P,C=P);return Re&&Dr(g,E),S}for(j=r(g,j);!P.done;E++,P=y.next())P=p(j,g,E,P.value,N),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?E:P.key),b=i(P,b,E),C===null?S=P:C.sibling=P,C=P);return e&&j.forEach(function(k){return t(g,k)}),Re&&Dr(g,E),S}function w(g,b,y,N){if(typeof y=="object"&&y!==null&&y.type===ks&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Ki:e:{for(var S=y.key,C=b;C!==null;){if(C.key===S){if(S=y.type,S===ks){if(C.tag===7){n(g,C.sibling),b=s(C,y.props.children),b.return=g,g=b;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===rr&&jp(S)===C.type){n(g,C.sibling),b=s(C,y.props),b.ref=_o(g,C,y),b.return=g,g=b;break e}n(g,C);break}else t(g,C);C=C.sibling}y.type===ks?(b=Xr(y.props.children,g.mode,N,y.key),b.return=g,g=b):(N=Aa(y.type,y.key,y.props,null,g.mode,N),N.ref=_o(g,b,y),N.return=g,g=N)}return a(g);case js:e:{for(C=y.key;b!==null;){if(b.key===C)if(b.tag===4&&b.stateNode.containerInfo===y.containerInfo&&b.stateNode.implementation===y.implementation){n(g,b.sibling),b=s(b,y.children||[]),b.return=g,g=b;break e}else{n(g,b);break}else t(g,b);b=b.sibling}b=Zc(y,g.mode,N),b.return=g,g=b}return a(g);case rr:return C=y._init,w(g,b,C(y._payload),N)}if(Do(y))return v(g,b,y,N);if(jo(y))return x(g,b,y,N);sa(g,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,b!==null&&b.tag===6?(n(g,b.sibling),b=s(b,y),b.return=g,g=b):(n(g,b),b=Xc(y,g.mode,N),b.return=g,g=b),a(g)):n(g,b)}return w}var io=Bx(!0),Vx=Bx(!1),Ja=Pr(null),el=null,Is=null,yf=null;function bf(){yf=Is=el=null}function wf(e){var t=Ja.current;Ce(Ja),e._currentValue=t}function Xd(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 zs(e,t){el=e,yf=Is=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(vt=!0),e.firstContext=null)}function Dt(e){var t=e._currentValue;if(yf!==e)if(e={context:e,memoizedValue:t,next:null},Is===null){if(el===null)throw Error(z(308));Is=e,el.dependencies={lanes:0,firstContext:e}}else Is=Is.next=e;return t}var Br=null;function Nf(e){Br===null?Br=[e]:Br.push(e)}function Ux(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Nf(t)):(n.next=s.next,s.next=n),t.interleaved=n,Bn(e,r)}function Bn(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 sr=!1;function Sf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wx(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 Dn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function yr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,fe&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Bn(e,n)}return s=r.interleaved,s===null?(t.next=t,Nf(r)):(t.next=s.next,s.next=t),r.interleaved=t,Bn(e,n)}function Ca(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,lf(e,n)}}function kp(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,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 tl(e,t,n,r){var s=e.updateQueue;sr=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?i=d:a.next=d,a=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==a&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,u=d=c=null,l=i;do{var m=l.lane,p=l.eventTime;if((r&m)===m){u!==null&&(u=u.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,x=l;switch(m=t,p=n,x.tag){case 1:if(v=x.payload,typeof v=="function"){f=v.call(p,f,m);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=x.payload,m=typeof v=="function"?v.call(p,f,m):v,m==null)break e;f=Ie({},f,m);break e;case 2:sr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else p={eventTime:p,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=p,c=f):u=u.next=p,a|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(u===null&&(c=f),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=u,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);rs|=a,e.lanes=a,e.memoizedState=f}}function Cp(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(z(191,s));s.call(r)}}}var Ti={},jn=Pr(Ti),ui=Pr(Ti),fi=Pr(Ti);function Vr(e){if(e===Ti)throw Error(z(174));return e}function jf(e,t){switch(Se(fi,t),Se(ui,e),Se(jn,Ti),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Td(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Td(t,e)}Ce(jn),Se(jn,t)}function ao(){Ce(jn),Ce(ui),Ce(fi)}function Hx(e){Vr(fi.current);var t=Vr(jn.current),n=Td(t,e.type);t!==n&&(Se(ui,e),Se(jn,n))}function kf(e){ui.current===e&&(Ce(jn),Ce(ui))}var _e=Pr(0);function nl(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 Hc=[];function Cf(){for(var e=0;e<Hc.length;e++)Hc[e]._workInProgressVersionPrimary=null;Hc.length=0}var Ea=Gn.ReactCurrentDispatcher,Gc=Gn.ReactCurrentBatchConfig,ns=0,Ae=null,ze=null,He=null,rl=!1,qo=!1,mi=0,oS=0;function et(){throw Error(z(321))}function Ef(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!on(e[n],t[n]))return!1;return!0}function Rf(e,t,n,r,s,i){if(ns=i,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ea.current=e===null||e.memoizedState===null?cS:dS,e=n(r,s),qo){i=0;do{if(qo=!1,mi=0,25<=i)throw Error(z(301));i+=1,He=ze=null,t.updateQueue=null,Ea.current=uS,e=n(r,s)}while(qo)}if(Ea.current=sl,t=ze!==null&&ze.next!==null,ns=0,He=ze=Ae=null,rl=!1,t)throw Error(z(300));return e}function _f(){var e=mi!==0;return mi=0,e}function fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return He===null?Ae.memoizedState=He=e:He=He.next=e,He}function Ft(){if(ze===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=ze.next;var t=He===null?Ae.memoizedState:He.next;if(t!==null)He=t,ze=e;else{if(e===null)throw Error(z(310));ze=e,e={memoizedState:ze.memoizedState,baseState:ze.baseState,baseQueue:ze.baseQueue,queue:ze.queue,next:null},He===null?Ae.memoizedState=He=e:He=He.next=e}return He}function pi(e,t){return typeof t=="function"?t(e):t}function Kc(e){var t=Ft(),n=t.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=e;var r=ze,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,d=i;do{var u=d.lane;if((ns&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,Ae.lanes|=u,rs|=u}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,on(r,t.memoizedState)||(vt=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Ae.lanes|=i,rs|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function qc(e){var t=Ft(),n=t.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);on(i,t.memoizedState)||(vt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Gx(){}function Kx(e,t){var n=Ae,r=Ft(),s=t(),i=!on(r.memoizedState,s);if(i&&(r.memoizedState=s,vt=!0),r=r.queue,Pf(Qx.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||He!==null&&He.memoizedState.tag&1){if(n.flags|=2048,hi(9,Yx.bind(null,n,r,s,t),void 0,null),Ge===null)throw Error(z(349));ns&30||qx(n,t,s)}return s}function qx(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 Yx(e,t,n,r){t.value=n,t.getSnapshot=r,Xx(t)&&Zx(e)}function Qx(e,t,n){return n(function(){Xx(t)&&Zx(e)})}function Xx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!on(e,n)}catch{return!0}}function Zx(e){var t=Bn(e,1);t!==null&&sn(t,e,1,-1)}function Ep(e){var t=fn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:pi,lastRenderedState:e},t.queue=e,e=e.dispatch=lS.bind(null,Ae,e),[t.memoizedState,e]}function hi(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 Jx(){return Ft().memoizedState}function Ra(e,t,n,r){var s=fn();Ae.flags|=e,s.memoizedState=hi(1|t,n,void 0,r===void 0?null:r)}function Ol(e,t,n,r){var s=Ft();r=r===void 0?null:r;var i=void 0;if(ze!==null){var a=ze.memoizedState;if(i=a.destroy,r!==null&&Ef(r,a.deps)){s.memoizedState=hi(t,n,i,r);return}}Ae.flags|=e,s.memoizedState=hi(1|t,n,i,r)}function Rp(e,t){return Ra(8390656,8,e,t)}function Pf(e,t){return Ol(2048,8,e,t)}function ev(e,t){return Ol(4,2,e,t)}function tv(e,t){return Ol(4,4,e,t)}function nv(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 rv(e,t,n){return n=n!=null?n.concat([e]):null,Ol(4,4,nv.bind(null,t,e),n)}function Tf(){}function sv(e,t){var n=Ft();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ef(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ov(e,t){var n=Ft();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ef(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function iv(e,t,n){return ns&21?(on(n,t)||(n=ux(),Ae.lanes|=n,rs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,vt=!0),e.memoizedState=n)}function iS(e,t){var n=he;he=n!==0&&4>n?n:4,e(!0);var r=Gc.transition;Gc.transition={};try{e(!1),t()}finally{he=n,Gc.transition=r}}function av(){return Ft().memoizedState}function aS(e,t,n){var r=wr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lv(e))cv(t,n);else if(n=Ux(e,t,n,r),n!==null){var s=ut();sn(n,e,r,s),dv(n,t,r)}}function lS(e,t,n){var r=wr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lv(e))cv(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,n);if(s.hasEagerState=!0,s.eagerState=l,on(l,a)){var c=t.interleaved;c===null?(s.next=s,Nf(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Ux(e,t,s,r),n!==null&&(s=ut(),sn(n,e,r,s),dv(n,t,r))}}function lv(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function cv(e,t){qo=rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lf(e,n)}}var sl={readContext:Dt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},cS={readContext:Dt,useCallback:function(e,t){return fn().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:Rp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ra(4194308,4,nv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ra(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ra(4,2,e,t)},useMemo:function(e,t){var n=fn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fn();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=aS.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=fn();return e={current:e},t.memoizedState=e},useState:Ep,useDebugValue:Tf,useDeferredValue:function(e){return fn().memoizedState=e},useTransition:function(){var e=Ep(!1),t=e[0];return e=iS.bind(null,e[1]),fn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ae,s=fn();if(Re){if(n===void 0)throw Error(z(407));n=n()}else{if(n=t(),Ge===null)throw Error(z(349));ns&30||qx(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Rp(Qx.bind(null,r,i,e),[e]),r.flags|=2048,hi(9,Yx.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=fn(),t=Ge.identifierPrefix;if(Re){var n=Ln,r=On;n=(r&~(1<<32-rn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=mi++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=oS++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},dS={readContext:Dt,useCallback:sv,useContext:Dt,useEffect:Pf,useImperativeHandle:rv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:ov,useReducer:Kc,useRef:Jx,useState:function(){return Kc(pi)},useDebugValue:Tf,useDeferredValue:function(e){var t=Ft();return iv(t,ze.memoizedState,e)},useTransition:function(){var e=Kc(pi)[0],t=Ft().memoizedState;return[e,t]},useMutableSource:Gx,useSyncExternalStore:Kx,useId:av,unstable_isNewReconciler:!1},uS={readContext:Dt,useCallback:sv,useContext:Dt,useEffect:Pf,useImperativeHandle:rv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:ov,useReducer:qc,useRef:Jx,useState:function(){return qc(pi)},useDebugValue:Tf,useDeferredValue:function(e){var t=Ft();return ze===null?t.memoizedState=e:iv(t,ze.memoizedState,e)},useTransition:function(){var e=qc(pi)[0],t=Ft().memoizedState;return[e,t]},useMutableSource:Gx,useSyncExternalStore:Kx,useId:av,unstable_isNewReconciler:!1};function Xt(e,t){if(e&&e.defaultProps){t=Ie({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Zd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ie({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ll={isMounted:function(e){return(e=e._reactInternals)?ms(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ut(),s=wr(e),i=Dn(r,s);i.payload=t,n!=null&&(i.callback=n),t=yr(e,i,s),t!==null&&(sn(t,e,s,r),Ca(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ut(),s=wr(e),i=Dn(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=yr(e,i,s),t!==null&&(sn(t,e,s,r),Ca(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ut(),r=wr(e),s=Dn(n,r);s.tag=2,t!=null&&(s.callback=t),t=yr(e,s,r),t!==null&&(sn(t,e,r,n),Ca(t,e,r))}};function _p(e,t,n,r,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!ai(n,r)||!ai(s,i):!0}function uv(e,t,n){var r=!1,s=kr,i=t.contextType;return typeof i=="object"&&i!==null?i=Dt(i):(s=wt(t)?es:ot.current,r=t.contextTypes,i=(r=r!=null)?so(e,s):kr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ll,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Pp(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&&Ll.enqueueReplaceState(t,t.state,null)}function Jd(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Sf(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Dt(i):(i=wt(t)?es:ot.current,s.context=so(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Zd(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Ll.enqueueReplaceState(s,s.state,null),tl(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function lo(e,t){try{var n="",r=t;do n+=F1(r),r=r.return;while(r);var s=n}catch(i){s=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:s,digest:null}}function Yc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function eu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var fS=typeof WeakMap=="function"?WeakMap:Map;function fv(e,t,n){n=Dn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){il||(il=!0,du=r),eu(e,t)},n}function mv(e,t,n){n=Dn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){eu(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){eu(e,t),typeof r!="function"&&(br===null?br=new Set([this]):br.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Tp(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new fS;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=CS.bind(null,e,t,n),t.then(e,e))}function Ap(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 Ip(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,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=Dn(-1,1),t.tag=2,yr(n,t,1))),n.lanes|=1),e)}var mS=Gn.ReactCurrentOwner,vt=!1;function lt(e,t,n,r){t.child=e===null?Vx(t,null,n,r):io(t,e.child,n,r)}function Mp(e,t,n,r,s){n=n.render;var i=t.ref;return zs(t,s),r=Rf(e,t,n,r,i,s),n=_f(),e!==null&&!vt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vn(e,t,s)):(Re&&n&&gf(t),t.flags|=1,lt(e,t,r,s),t.child)}function Op(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Ff(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,pv(e,t,i,r,s)):(e=Aa(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:ai,n(a,r)&&e.ref===t.ref)return Vn(e,t,s)}return t.flags|=1,e=Nr(i,r),e.ref=t.ref,e.return=t,t.child=e}function pv(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ai(i,r)&&e.ref===t.ref)if(vt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(vt=!0);else return t.lanes=e.lanes,Vn(e,t,s)}return tu(e,t,n,r,s)}function hv(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Se(Os,jt),jt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Se(Os,jt),jt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Se(Os,jt),jt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Se(Os,jt),jt|=r;return lt(e,t,s,n),t.child}function gv(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function tu(e,t,n,r,s){var i=wt(n)?es:ot.current;return i=so(t,i),zs(t,s),n=Rf(e,t,n,r,i,s),r=_f(),e!==null&&!vt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vn(e,t,s)):(Re&&r&&gf(t),t.flags|=1,lt(e,t,n,s),t.child)}function Lp(e,t,n,r,s){if(wt(n)){var i=!0;Qa(t)}else i=!1;if(zs(t,s),t.stateNode===null)_a(e,t),uv(t,n,r),Jd(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Dt(d):(d=wt(n)?es:ot.current,d=so(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&Pp(t,a,r,d),sr=!1;var m=t.memoizedState;a.state=m,tl(t,r,a,s),c=t.memoizedState,l!==r||m!==c||bt.current||sr?(typeof u=="function"&&(Zd(t,n,u,r),c=t.memoizedState),(l=sr||_p(t,n,l,r,m,c,d))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Wx(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Xt(t.type,l),a.props=d,f=t.pendingProps,m=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Dt(c):(c=wt(n)?es:ot.current,c=so(t,c));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||m!==c)&&Pp(t,a,r,c),sr=!1,m=t.memoizedState,a.state=m,tl(t,r,a,s);var v=t.memoizedState;l!==f||m!==v||bt.current||sr?(typeof p=="function"&&(Zd(t,n,p,r),v=t.memoizedState),(d=sr||_p(t,n,d,r,m,v,c)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,v,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=c,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return nu(e,t,n,r,i,s)}function nu(e,t,n,r,s,i){gv(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&wp(t,n,!1),Vn(e,t,i);r=t.stateNode,mS.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=io(t,e.child,null,i),t.child=io(t,null,l,i)):lt(e,t,l,i),t.memoizedState=r.state,s&&wp(t,n,!0),t.child}function xv(e){var t=e.stateNode;t.pendingContext?bp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&bp(e,t.context,!1),jf(e,t.containerInfo)}function $p(e,t,n,r,s){return oo(),vf(s),t.flags|=256,lt(e,t,n,r),t.child}var ru={dehydrated:null,treeContext:null,retryLane:0};function su(e){return{baseLanes:e,cachePool:null,transitions:null}}function vv(e,t,n){var r=t.pendingProps,s=_e.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Se(_e,s&1),e===null)return Qd(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):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Fl(a,r,0,null),e=Xr(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=su(n),t.memoizedState=ru,e):Af(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return pS(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Nr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Nr(l,i):(i=Xr(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?su(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=ru,r}return i=e.child,e=i.sibling,r=Nr(i,{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 Af(e,t){return t=Fl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function oa(e,t,n,r){return r!==null&&vf(r),io(t,e.child,null,n),e=Af(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pS(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Yc(Error(z(422))),oa(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Fl({mode:"visible",children:r.children},s,0,null),i=Xr(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&io(t,e.child,null,a),t.child.memoizedState=su(a),t.memoizedState=ru,i);if(!(t.mode&1))return oa(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(z(419)),r=Yc(i,r,void 0),oa(e,t,a,r)}if(l=(a&e.childLanes)!==0,vt||l){if(r=Ge,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Bn(e,s),sn(r,e,s,-1))}return Df(),r=Yc(Error(z(421))),oa(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=ES.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Ct=vr(s.nextSibling),Et=t,Re=!0,nn=null,e!==null&&(Mt[Ot++]=On,Mt[Ot++]=Ln,Mt[Ot++]=ts,On=e.id,Ln=e.overflow,ts=t),t=Af(t,r.children),t.flags|=4096,t)}function Dp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xd(e.return,t,n)}function Qc(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function yv(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(lt(e,t,r.children,n),r=_e.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&&Dp(e,n,t);else if(e.tag===19)Dp(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(Se(_e,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&nl(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Qc(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&nl(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Qc(t,!0,n,null,i);break;case"together":Qc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function _a(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(z(153));if(t.child!==null){for(e=t.child,n=Nr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Nr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function hS(e,t,n){switch(t.tag){case 3:xv(t),oo();break;case 5:Hx(t);break;case 1:wt(t.type)&&Qa(t);break;case 4:jf(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Se(Ja,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Se(_e,_e.current&1),t.flags|=128,null):n&t.child.childLanes?vv(e,t,n):(Se(_e,_e.current&1),e=Vn(e,t,n),e!==null?e.sibling:null);Se(_e,_e.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return yv(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Se(_e,_e.current),r)break;return null;case 22:case 23:return t.lanes=0,hv(e,t,n)}return Vn(e,t,n)}var bv,ou,wv,Nv;bv=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}};ou=function(){};wv=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Vr(jn.current);var i=null;switch(n){case"input":s=Ed(e,s),r=Ed(e,r),i=[];break;case"select":s=Ie({},s,{value:void 0}),r=Ie({},r,{value:void 0}),i=[];break;case"textarea":s=Pd(e,s),r=Pd(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=qa)}Ad(n,r);var a;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(ei.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(ei.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&ke("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};Nv=function(e,t,n,r){n!==r&&(t.flags|=4)};function Po(e,t){if(!Re)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 tt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gS(e,t,n){var r=t.pendingProps;switch(xf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(t),null;case 1:return wt(t.type)&&Ya(),tt(t),null;case 3:return r=t.stateNode,ao(),Ce(bt),Ce(ot),Cf(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ra(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,nn!==null&&(mu(nn),nn=null))),ou(e,t),tt(t),null;case 5:kf(t);var s=Vr(fi.current);if(n=t.type,e!==null&&t.stateNode!=null)wv(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(z(166));return tt(t),null}if(e=Vr(jn.current),ra(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[xn]=t,r[di]=i,e=(t.mode&1)!==0,n){case"dialog":ke("cancel",r),ke("close",r);break;case"iframe":case"object":case"embed":ke("load",r);break;case"video":case"audio":for(s=0;s<zo.length;s++)ke(zo[s],r);break;case"source":ke("error",r);break;case"img":case"image":case"link":ke("error",r),ke("load",r);break;case"details":ke("toggle",r);break;case"input":Km(r,i),ke("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ke("invalid",r);break;case"textarea":Ym(r,i),ke("invalid",r)}Ad(n,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&na(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&na(r.textContent,l,e),s=["children",""+l]):ei.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&ke("scroll",r)}switch(n){case"input":qi(r),qm(r,i,!0);break;case"textarea":qi(r),Qm(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=qa)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Qg(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[xn]=t,e[di]=r,bv(e,t,!1,!1),t.stateNode=e;e:{switch(a=Id(n,r),n){case"dialog":ke("cancel",e),ke("close",e),s=r;break;case"iframe":case"object":case"embed":ke("load",e),s=r;break;case"video":case"audio":for(s=0;s<zo.length;s++)ke(zo[s],e);s=r;break;case"source":ke("error",e),s=r;break;case"img":case"image":case"link":ke("error",e),ke("load",e),s=r;break;case"details":ke("toggle",e),s=r;break;case"input":Km(e,r),s=Ed(e,r),ke("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Ie({},r,{value:void 0}),ke("invalid",e);break;case"textarea":Ym(e,r),s=Pd(e,r),ke("invalid",e);break;default:s=r}Ad(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Jg(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Xg(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ti(e,c):typeof c=="number"&&ti(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ei.hasOwnProperty(i)?c!=null&&i==="onScroll"&&ke("scroll",e):c!=null&&tf(e,i,c,a))}switch(n){case"input":qi(e),qm(e,r,!1);break;case"textarea":qi(e),Qm(e);break;case"option":r.value!=null&&e.setAttribute("value",""+jr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ls(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ls(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=qa)}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 tt(t),null;case 6:if(e&&t.stateNode!=null)Nv(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(z(166));if(n=Vr(fi.current),Vr(jn.current),ra(t)){if(r=t.stateNode,n=t.memoizedProps,r[xn]=t,(i=r.nodeValue!==n)&&(e=Et,e!==null))switch(e.tag){case 3:na(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&na(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[xn]=t,t.stateNode=r}return tt(t),null;case 13:if(Ce(_e),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Re&&Ct!==null&&t.mode&1&&!(t.flags&128))zx(),oo(),t.flags|=98560,i=!1;else if(i=ra(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(z(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(z(317));i[xn]=t}else oo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;tt(t),i=!1}else nn!==null&&(mu(nn),nn=null),i=!0;if(!i)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||_e.current&1?Ve===0&&(Ve=3):Df())),t.updateQueue!==null&&(t.flags|=4),tt(t),null);case 4:return ao(),ou(e,t),e===null&&li(t.stateNode.containerInfo),tt(t),null;case 10:return wf(t.type._context),tt(t),null;case 17:return wt(t.type)&&Ya(),tt(t),null;case 19:if(Ce(_e),i=t.memoizedState,i===null)return tt(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Po(i,!1);else{if(Ve!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=nl(e),a!==null){for(t.flags|=128,Po(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Se(_e,_e.current&1|2),t.child}e=e.sibling}i.tail!==null&&Le()>co&&(t.flags|=128,r=!0,Po(i,!1),t.lanes=4194304)}else{if(!r)if(e=nl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Po(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Re)return tt(t),null}else 2*Le()-i.renderingStartTime>co&&n!==1073741824&&(t.flags|=128,r=!0,Po(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Le(),t.sibling=null,n=_e.current,Se(_e,r?n&1|2:n&1),t):(tt(t),null);case 22:case 23:return $f(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?jt&1073741824&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),null;case 24:return null;case 25:return null}throw Error(z(156,t.tag))}function xS(e,t){switch(xf(t),t.tag){case 1:return wt(t.type)&&Ya(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ao(),Ce(bt),Ce(ot),Cf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return kf(t),null;case 13:if(Ce(_e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(z(340));oo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(_e),null;case 4:return ao(),null;case 10:return wf(t.type._context),null;case 22:case 23:return $f(),null;case 24:return null;default:return null}}var ia=!1,rt=!1,vS=typeof WeakSet=="function"?WeakSet:Set,H=null;function Ms(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Oe(e,t,r)}else n.current=null}function iu(e,t,n){try{n()}catch(r){Oe(e,t,r)}}var Fp=!1;function yS(e,t){if(Ud=Ha,e=Ex(),hf(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 s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,d=0,u=0,f=e,m=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===e)break t;if(m===n&&++d===s&&(l=a),m===i&&++u===r&&(c=a),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wd={focusedElem:e,selectionRange:n},Ha=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,w=v.memoizedState,g=t.stateNode,b=g.getSnapshotBeforeUpdate(t.elementType===t.type?x:Xt(t.type,x),w);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(z(163))}}catch(N){Oe(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return v=Fp,Fp=!1,v}function Yo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&iu(t,n,i)}s=s.next}while(s!==r)}}function $l(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 au(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 Sv(e){var t=e.alternate;t!==null&&(e.alternate=null,Sv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xn],delete t[di],delete t[Kd],delete t[tS],delete t[nS])),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 jv(e){return e.tag===5||e.tag===3||e.tag===4}function zp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jv(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 lu(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=qa));else if(r!==4&&(e=e.child,e!==null))for(lu(e,t,n),e=e.sibling;e!==null;)lu(e,t,n),e=e.sibling}function cu(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(cu(e,t,n),e=e.sibling;e!==null;)cu(e,t,n),e=e.sibling}var qe=null,tn=!1;function Zn(e,t,n){for(n=n.child;n!==null;)kv(e,t,n),n=n.sibling}function kv(e,t,n){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(_l,n)}catch{}switch(n.tag){case 5:rt||Ms(n,t);case 6:var r=qe,s=tn;qe=null,Zn(e,t,n),qe=r,tn=s,qe!==null&&(tn?(e=qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):qe.removeChild(n.stateNode));break;case 18:qe!==null&&(tn?(e=qe,n=n.stateNode,e.nodeType===8?Uc(e.parentNode,n):e.nodeType===1&&Uc(e,n),oi(e)):Uc(qe,n.stateNode));break;case 4:r=qe,s=tn,qe=n.stateNode.containerInfo,tn=!0,Zn(e,t,n),qe=r,tn=s;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&iu(n,t,a),s=s.next}while(s!==r)}Zn(e,t,n);break;case 1:if(!rt&&(Ms(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Oe(n,t,l)}Zn(e,t,n);break;case 21:Zn(e,t,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,Zn(e,t,n),rt=r):Zn(e,t,n);break;default:Zn(e,t,n)}}function Bp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vS),t.forEach(function(r){var s=RS.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function qt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:qe=l.stateNode,tn=!1;break e;case 3:qe=l.stateNode.containerInfo,tn=!0;break e;case 4:qe=l.stateNode.containerInfo,tn=!0;break e}l=l.return}if(qe===null)throw Error(z(160));kv(i,a,s),qe=null,tn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Oe(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Cv(t,e),t=t.sibling}function Cv(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(qt(t,e),un(e),r&4){try{Yo(3,e,e.return),$l(3,e)}catch(x){Oe(e,e.return,x)}try{Yo(5,e,e.return)}catch(x){Oe(e,e.return,x)}}break;case 1:qt(t,e),un(e),r&512&&n!==null&&Ms(n,n.return);break;case 5:if(qt(t,e),un(e),r&512&&n!==null&&Ms(n,n.return),e.flags&32){var s=e.stateNode;try{ti(s,"")}catch(x){Oe(e,e.return,x)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&qg(s,i),Id(l,a);var d=Id(l,i);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?Jg(s,f):u==="dangerouslySetInnerHTML"?Xg(s,f):u==="children"?ti(s,f):tf(s,u,f,d)}switch(l){case"input":Rd(s,i);break;case"textarea":Yg(s,i);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Ls(s,!!i.multiple,p,!1):m!==!!i.multiple&&(i.defaultValue!=null?Ls(s,!!i.multiple,i.defaultValue,!0):Ls(s,!!i.multiple,i.multiple?[]:"",!1))}s[di]=i}catch(x){Oe(e,e.return,x)}}break;case 6:if(qt(t,e),un(e),r&4){if(e.stateNode===null)throw Error(z(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(x){Oe(e,e.return,x)}}break;case 3:if(qt(t,e),un(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{oi(t.containerInfo)}catch(x){Oe(e,e.return,x)}break;case 4:qt(t,e),un(e);break;case 13:qt(t,e),un(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Of=Le())),r&4&&Bp(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(rt=(d=rt)||u,qt(t,e),rt=d):qt(t,e),un(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(H=e,u=e.child;u!==null;){for(f=H=u;H!==null;){switch(m=H,p=m.child,m.tag){case 0:case 11:case 14:case 15:Yo(4,m,m.return);break;case 1:Ms(m,m.return);var v=m.stateNode;if(typeof v.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(x){Oe(r,n,x)}}break;case 5:Ms(m,m.return);break;case 22:if(m.memoizedState!==null){Up(f);continue}}p!==null?(p.return=m,H=p):Up(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{s=f.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Zg("display",a))}catch(x){Oe(e,e.return,x)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(x){Oe(e,e.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:qt(t,e),un(e),r&4&&Bp(e);break;case 21:break;default:qt(t,e),un(e)}}function un(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(jv(n)){var r=n;break e}n=n.return}throw Error(z(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(ti(s,""),r.flags&=-33);var i=zp(e);cu(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=zp(e);lu(e,l,a);break;default:throw Error(z(161))}}catch(c){Oe(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bS(e,t,n){H=e,Ev(e)}function Ev(e,t,n){for(var r=(e.mode&1)!==0;H!==null;){var s=H,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||ia;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||rt;l=ia;var d=rt;if(ia=a,(rt=c)&&!d)for(H=s;H!==null;)a=H,c=a.child,a.tag===22&&a.memoizedState!==null?Wp(s):c!==null?(c.return=a,H=c):Wp(s);for(;i!==null;)H=i,Ev(i),i=i.sibling;H=s,ia=l,rt=d}Vp(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,H=i):Vp(e)}}function Vp(e){for(;H!==null;){var t=H;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:rt||$l(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!rt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Xt(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Cp(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Cp(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&oi(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(z(163))}rt||t.flags&512&&au(t)}catch(m){Oe(t,t.return,m)}}if(t===e){H=null;break}if(n=t.sibling,n!==null){n.return=t.return,H=n;break}H=t.return}}function Up(e){for(;H!==null;){var t=H;if(t===e){H=null;break}var n=t.sibling;if(n!==null){n.return=t.return,H=n;break}H=t.return}}function Wp(e){for(;H!==null;){var t=H;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$l(4,t)}catch(c){Oe(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Oe(t,s,c)}}var i=t.return;try{au(t)}catch(c){Oe(t,i,c)}break;case 5:var a=t.return;try{au(t)}catch(c){Oe(t,a,c)}}}catch(c){Oe(t,t.return,c)}if(t===e){H=null;break}var l=t.sibling;if(l!==null){l.return=t.return,H=l;break}H=t.return}}var wS=Math.ceil,ol=Gn.ReactCurrentDispatcher,If=Gn.ReactCurrentOwner,$t=Gn.ReactCurrentBatchConfig,fe=0,Ge=null,De=null,Ye=0,jt=0,Os=Pr(0),Ve=0,gi=null,rs=0,Dl=0,Mf=0,Qo=null,xt=null,Of=0,co=1/0,Tn=null,il=!1,du=null,br=null,aa=!1,mr=null,al=0,Xo=0,uu=null,Pa=-1,Ta=0;function ut(){return fe&6?Le():Pa!==-1?Pa:Pa=Le()}function wr(e){return e.mode&1?fe&2&&Ye!==0?Ye&-Ye:sS.transition!==null?(Ta===0&&(Ta=ux()),Ta):(e=he,e!==0||(e=window.event,e=e===void 0?16:vx(e.type)),e):1}function sn(e,t,n,r){if(50<Xo)throw Xo=0,uu=null,Error(z(185));Ri(e,n,r),(!(fe&2)||e!==Ge)&&(e===Ge&&(!(fe&2)&&(Dl|=n),Ve===4&&ir(e,Ye)),Nt(e,r),n===1&&fe===0&&!(t.mode&1)&&(co=Le()+500,Ml&&Tr()))}function Nt(e,t){var n=e.callbackNode;sN(e,t);var r=Wa(e,e===Ge?Ye:0);if(r===0)n!==null&&Jm(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Jm(n),t===1)e.tag===0?rS(Hp.bind(null,e)):$x(Hp.bind(null,e)),JN(function(){!(fe&6)&&Tr()}),n=null;else{switch(fx(r)){case 1:n=af;break;case 4:n=cx;break;case 16:n=Ua;break;case 536870912:n=dx;break;default:n=Ua}n=Ov(n,Rv.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Rv(e,t){if(Pa=-1,Ta=0,fe&6)throw Error(z(327));var n=e.callbackNode;if(Bs()&&e.callbackNode!==n)return null;var r=Wa(e,e===Ge?Ye:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ll(e,r);else{t=r;var s=fe;fe|=2;var i=Pv();(Ge!==e||Ye!==t)&&(Tn=null,co=Le()+500,Qr(e,t));do try{jS();break}catch(l){_v(e,l)}while(!0);bf(),ol.current=i,fe=s,De!==null?t=0:(Ge=null,Ye=0,t=Ve)}if(t!==0){if(t===2&&(s=Dd(e),s!==0&&(r=s,t=fu(e,s))),t===1)throw n=gi,Qr(e,0),ir(e,r),Nt(e,Le()),n;if(t===6)ir(e,r);else{if(s=e.current.alternate,!(r&30)&&!NS(s)&&(t=ll(e,r),t===2&&(i=Dd(e),i!==0&&(r=i,t=fu(e,i))),t===1))throw n=gi,Qr(e,0),ir(e,r),Nt(e,Le()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(z(345));case 2:Fr(e,xt,Tn);break;case 3:if(ir(e,r),(r&130023424)===r&&(t=Of+500-Le(),10<t)){if(Wa(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ut(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Gd(Fr.bind(null,e,xt,Tn),t);break}Fr(e,xt,Tn);break;case 4:if(ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-rn(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wS(r/1960))-r,10<r){e.timeoutHandle=Gd(Fr.bind(null,e,xt,Tn),r);break}Fr(e,xt,Tn);break;case 5:Fr(e,xt,Tn);break;default:throw Error(z(329))}}}return Nt(e,Le()),e.callbackNode===n?Rv.bind(null,e):null}function fu(e,t){var n=Qo;return e.current.memoizedState.isDehydrated&&(Qr(e,t).flags|=256),e=ll(e,t),e!==2&&(t=xt,xt=n,t!==null&&mu(t)),e}function mu(e){xt===null?xt=e:xt.push.apply(xt,e)}function NS(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 s=n[r],i=s.getSnapshot;s=s.value;try{if(!on(i(),s))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 ir(e,t){for(t&=~Mf,t&=~Dl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-rn(t),r=1<<n;e[n]=-1,t&=~r}}function Hp(e){if(fe&6)throw Error(z(327));Bs();var t=Wa(e,0);if(!(t&1))return Nt(e,Le()),null;var n=ll(e,t);if(e.tag!==0&&n===2){var r=Dd(e);r!==0&&(t=r,n=fu(e,r))}if(n===1)throw n=gi,Qr(e,0),ir(e,t),Nt(e,Le()),n;if(n===6)throw Error(z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fr(e,xt,Tn),Nt(e,Le()),null}function Lf(e,t){var n=fe;fe|=1;try{return e(t)}finally{fe=n,fe===0&&(co=Le()+500,Ml&&Tr())}}function ss(e){mr!==null&&mr.tag===0&&!(fe&6)&&Bs();var t=fe;fe|=1;var n=$t.transition,r=he;try{if($t.transition=null,he=1,e)return e()}finally{he=r,$t.transition=n,fe=t,!(fe&6)&&Tr()}}function $f(){jt=Os.current,Ce(Os)}function Qr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ZN(n)),De!==null)for(n=De.return;n!==null;){var r=n;switch(xf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ya();break;case 3:ao(),Ce(bt),Ce(ot),Cf();break;case 5:kf(r);break;case 4:ao();break;case 13:Ce(_e);break;case 19:Ce(_e);break;case 10:wf(r.type._context);break;case 22:case 23:$f()}n=n.return}if(Ge=e,De=e=Nr(e.current,null),Ye=jt=t,Ve=0,gi=null,Mf=Dl=rs=0,xt=Qo=null,Br!==null){for(t=0;t<Br.length;t++)if(n=Br[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=s,r.next=a}n.pending=r}Br=null}return e}function _v(e,t){do{var n=De;try{if(bf(),Ea.current=sl,rl){for(var r=Ae.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}rl=!1}if(ns=0,He=ze=Ae=null,qo=!1,mi=0,If.current=null,n===null||n.return===null){Ve=1,gi=t,De=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=Ye,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Ap(a);if(p!==null){p.flags&=-257,Ip(p,a,l,i,t),p.mode&1&&Tp(i,d,t),t=p,c=d;var v=t.updateQueue;if(v===null){var x=new Set;x.add(c),t.updateQueue=x}else v.add(c);break e}else{if(!(t&1)){Tp(i,d,t),Df();break e}c=Error(z(426))}}else if(Re&&l.mode&1){var w=Ap(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Ip(w,a,l,i,t),vf(lo(c,l));break e}}i=c=lo(c,l),Ve!==4&&(Ve=2),Qo===null?Qo=[i]:Qo.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=fv(i,c,t);kp(i,g);break e;case 1:l=c;var b=i.type,y=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(br===null||!br.has(y)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=mv(i,l,t);kp(i,N);break e}}i=i.return}while(i!==null)}Av(n)}catch(S){t=S,De===n&&n!==null&&(De=n=n.return);continue}break}while(!0)}function Pv(){var e=ol.current;return ol.current=sl,e===null?sl:e}function Df(){(Ve===0||Ve===3||Ve===2)&&(Ve=4),Ge===null||!(rs&268435455)&&!(Dl&268435455)||ir(Ge,Ye)}function ll(e,t){var n=fe;fe|=2;var r=Pv();(Ge!==e||Ye!==t)&&(Tn=null,Qr(e,t));do try{SS();break}catch(s){_v(e,s)}while(!0);if(bf(),fe=n,ol.current=r,De!==null)throw Error(z(261));return Ge=null,Ye=0,Ve}function SS(){for(;De!==null;)Tv(De)}function jS(){for(;De!==null&&!Y1();)Tv(De)}function Tv(e){var t=Mv(e.alternate,e,jt);e.memoizedProps=e.pendingProps,t===null?Av(e):De=t,If.current=null}function Av(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=xS(n,t),n!==null){n.flags&=32767,De=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ve=6,De=null;return}}else if(n=gS(n,t,jt),n!==null){De=n;return}if(t=t.sibling,t!==null){De=t;return}De=t=e}while(t!==null);Ve===0&&(Ve=5)}function Fr(e,t,n){var r=he,s=$t.transition;try{$t.transition=null,he=1,kS(e,t,n,r)}finally{$t.transition=s,he=r}return null}function kS(e,t,n,r){do Bs();while(mr!==null);if(fe&6)throw Error(z(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(z(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(oN(e,i),e===Ge&&(De=Ge=null,Ye=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||aa||(aa=!0,Ov(Ua,function(){return Bs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=$t.transition,$t.transition=null;var a=he;he=1;var l=fe;fe|=4,If.current=null,yS(e,n),Cv(n,e),HN(Wd),Ha=!!Ud,Wd=Ud=null,e.current=n,bS(n),Q1(),fe=l,he=a,$t.transition=i}else e.current=n;if(aa&&(aa=!1,mr=e,al=s),i=e.pendingLanes,i===0&&(br=null),J1(n.stateNode),Nt(e,Le()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(il)throw il=!1,e=du,du=null,e;return al&1&&e.tag!==0&&Bs(),i=e.pendingLanes,i&1?e===uu?Xo++:(Xo=0,uu=e):Xo=0,Tr(),null}function Bs(){if(mr!==null){var e=fx(al),t=$t.transition,n=he;try{if($t.transition=null,he=16>e?16:e,mr===null)var r=!1;else{if(e=mr,mr=null,al=0,fe&6)throw Error(z(331));var s=fe;for(fe|=4,H=e.current;H!==null;){var i=H,a=i.child;if(H.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(H=d;H!==null;){var u=H;switch(u.tag){case 0:case 11:case 15:Yo(8,u,i)}var f=u.child;if(f!==null)f.return=u,H=f;else for(;H!==null;){u=H;var m=u.sibling,p=u.return;if(Sv(u),u===d){H=null;break}if(m!==null){m.return=p,H=m;break}H=p}}}var v=i.alternate;if(v!==null){var x=v.child;if(x!==null){v.child=null;do{var w=x.sibling;x.sibling=null,x=w}while(x!==null)}}H=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,H=a;else e:for(;H!==null;){if(i=H,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Yo(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,H=g;break e}H=i.return}}var b=e.current;for(H=b;H!==null;){a=H;var y=a.child;if(a.subtreeFlags&2064&&y!==null)y.return=a,H=y;else e:for(a=b;H!==null;){if(l=H,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$l(9,l)}}catch(S){Oe(l,l.return,S)}if(l===a){H=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,H=N;break e}H=l.return}}if(fe=s,Tr(),Sn&&typeof Sn.onPostCommitFiberRoot=="function")try{Sn.onPostCommitFiberRoot(_l,e)}catch{}r=!0}return r}finally{he=n,$t.transition=t}}return!1}function Gp(e,t,n){t=lo(n,t),t=fv(e,t,1),e=yr(e,t,1),t=ut(),e!==null&&(Ri(e,1,t),Nt(e,t))}function Oe(e,t,n){if(e.tag===3)Gp(e,e,n);else for(;t!==null;){if(t.tag===3){Gp(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(br===null||!br.has(r))){e=lo(n,e),e=mv(t,e,1),t=yr(t,e,1),e=ut(),t!==null&&(Ri(t,1,e),Nt(t,e));break}}t=t.return}}function CS(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ut(),e.pingedLanes|=e.suspendedLanes&n,Ge===e&&(Ye&n)===n&&(Ve===4||Ve===3&&(Ye&130023424)===Ye&&500>Le()-Of?Qr(e,0):Mf|=n),Nt(e,t)}function Iv(e,t){t===0&&(e.mode&1?(t=Xi,Xi<<=1,!(Xi&130023424)&&(Xi=4194304)):t=1);var n=ut();e=Bn(e,t),e!==null&&(Ri(e,t,n),Nt(e,n))}function ES(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Iv(e,n)}function RS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(z(314))}r!==null&&r.delete(t),Iv(e,n)}var Mv;Mv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||bt.current)vt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return vt=!1,hS(e,t,n);vt=!!(e.flags&131072)}else vt=!1,Re&&t.flags&1048576&&Dx(t,Za,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;_a(e,t),e=t.pendingProps;var s=so(t,ot.current);zs(t,n),s=Rf(null,t,r,e,s,n);var i=_f();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,wt(r)?(i=!0,Qa(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Sf(t),s.updater=Ll,t.stateNode=s,s._reactInternals=t,Jd(t,r,e,n),t=nu(null,t,r,!0,i,n)):(t.tag=0,Re&&i&&gf(t),lt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(_a(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=PS(r),e=Xt(r,e),s){case 0:t=tu(null,t,r,e,n);break e;case 1:t=Lp(null,t,r,e,n);break e;case 11:t=Mp(null,t,r,e,n);break e;case 14:t=Op(null,t,r,Xt(r.type,e),n);break e}throw Error(z(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xt(r,s),tu(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xt(r,s),Lp(e,t,r,s,n);case 3:e:{if(xv(t),e===null)throw Error(z(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Wx(e,t),tl(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=lo(Error(z(423)),t),t=$p(e,t,r,n,s);break e}else if(r!==s){s=lo(Error(z(424)),t),t=$p(e,t,r,n,s);break e}else for(Ct=vr(t.stateNode.containerInfo.firstChild),Et=t,Re=!0,nn=null,n=Vx(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(oo(),r===s){t=Vn(e,t,n);break e}lt(e,t,r,n)}t=t.child}return t;case 5:return Hx(t),e===null&&Qd(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Hd(r,s)?a=null:i!==null&&Hd(r,i)&&(t.flags|=32),gv(e,t),lt(e,t,a,n),t.child;case 6:return e===null&&Qd(t),null;case 13:return vv(e,t,n);case 4:return jf(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=io(t,null,r,n):lt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xt(r,s),Mp(e,t,r,s,n);case 7:return lt(e,t,t.pendingProps,n),t.child;case 8:return lt(e,t,t.pendingProps.children,n),t.child;case 12:return lt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,Se(Ja,r._currentValue),r._currentValue=a,i!==null)if(on(i.value,a)){if(i.children===s.children&&!bt.current){t=Vn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Dn(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Xd(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(z(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Xd(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}lt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,zs(t,n),s=Dt(s),r=r(s),t.flags|=1,lt(e,t,r,n),t.child;case 14:return r=t.type,s=Xt(r,t.pendingProps),s=Xt(r.type,s),Op(e,t,r,s,n);case 15:return pv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xt(r,s),_a(e,t),t.tag=1,wt(r)?(e=!0,Qa(t)):e=!1,zs(t,n),uv(t,r,s),Jd(t,r,s,n),nu(null,t,r,!0,e,n);case 19:return yv(e,t,n);case 22:return hv(e,t,n)}throw Error(z(156,t.tag))};function Ov(e,t){return lx(e,t)}function _S(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 Lt(e,t,n,r){return new _S(e,t,n,r)}function Ff(e){return e=e.prototype,!(!e||!e.isReactComponent)}function PS(e){if(typeof e=="function")return Ff(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rf)return 11;if(e===sf)return 14}return 2}function Nr(e,t){var n=e.alternate;return n===null?(n=Lt(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 Aa(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Ff(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case ks:return Xr(n.children,s,i,t);case nf:a=8,s|=8;break;case Sd:return e=Lt(12,n,t,s|2),e.elementType=Sd,e.lanes=i,e;case jd:return e=Lt(13,n,t,s),e.elementType=jd,e.lanes=i,e;case kd:return e=Lt(19,n,t,s),e.elementType=kd,e.lanes=i,e;case Hg:return Fl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ug:a=10;break e;case Wg:a=9;break e;case rf:a=11;break e;case sf:a=14;break e;case rr:a=16,r=null;break e}throw Error(z(130,e==null?e:typeof e,""))}return t=Lt(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Xr(e,t,n,r){return e=Lt(7,e,r,t),e.lanes=n,e}function Fl(e,t,n,r){return e=Lt(22,e,r,t),e.elementType=Hg,e.lanes=n,e.stateNode={isHidden:!1},e}function Xc(e,t,n){return e=Lt(6,e,null,t),e.lanes=n,e}function Zc(e,t,n){return t=Lt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function TS(e,t,n,r,s){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=Ac(0),this.expirationTimes=Ac(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ac(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function zf(e,t,n,r,s,i,a,l,c){return e=new TS(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Lt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sf(i),e}function AS(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:js,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Lv(e){if(!e)return kr;e=e._reactInternals;e:{if(ms(e)!==e||e.tag!==1)throw Error(z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(wt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(z(171))}if(e.tag===1){var n=e.type;if(wt(n))return Lx(e,n,t)}return t}function $v(e,t,n,r,s,i,a,l,c){return e=zf(n,r,!0,e,s,i,a,l,c),e.context=Lv(null),n=e.current,r=ut(),s=wr(n),i=Dn(r,s),i.callback=t??null,yr(n,i,s),e.current.lanes=s,Ri(e,s,r),Nt(e,r),e}function zl(e,t,n,r){var s=t.current,i=ut(),a=wr(s);return n=Lv(n),t.context===null?t.context=n:t.pendingContext=n,t=Dn(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=yr(s,t,a),e!==null&&(sn(e,s,a,i),Ca(e,s,a)),a}function cl(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 Kp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Bf(e,t){Kp(e,t),(e=e.alternate)&&Kp(e,t)}function IS(){return null}var Dv=typeof reportError=="function"?reportError:function(e){console.error(e)};function Vf(e){this._internalRoot=e}Bl.prototype.render=Vf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(z(409));zl(e,t,null,null)};Bl.prototype.unmount=Vf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ss(function(){zl(null,e,null,null)}),t[zn]=null}};function Bl(e){this._internalRoot=e}Bl.prototype.unstable_scheduleHydration=function(e){if(e){var t=hx();e={blockedOn:null,target:e,priority:t};for(var n=0;n<or.length&&t!==0&&t<or[n].priority;n++);or.splice(n,0,e),n===0&&xx(e)}};function Uf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qp(){}function MS(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=cl(a);i.call(d)}}var a=$v(t,r,e,0,null,!1,!1,"",qp);return e._reactRootContainer=a,e[zn]=a.current,li(e.nodeType===8?e.parentNode:e),ss(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=cl(c);l.call(d)}}var c=zf(e,0,!1,null,null,!1,!1,"",qp);return e._reactRootContainer=c,e[zn]=c.current,li(e.nodeType===8?e.parentNode:e),ss(function(){zl(t,c,n,r)}),c}function Ul(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=cl(a);l.call(c)}}zl(t,a,e,s)}else a=MS(n,t,e,s,r);return cl(a)}mx=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Fo(t.pendingLanes);n!==0&&(lf(t,n|1),Nt(t,Le()),!(fe&6)&&(co=Le()+500,Tr()))}break;case 13:ss(function(){var r=Bn(e,1);if(r!==null){var s=ut();sn(r,e,1,s)}}),Bf(e,1)}};cf=function(e){if(e.tag===13){var t=Bn(e,134217728);if(t!==null){var n=ut();sn(t,e,134217728,n)}Bf(e,134217728)}};px=function(e){if(e.tag===13){var t=wr(e),n=Bn(e,t);if(n!==null){var r=ut();sn(n,e,t,r)}Bf(e,t)}};hx=function(){return he};gx=function(e,t){var n=he;try{return he=e,t()}finally{he=n}};Od=function(e,t,n){switch(t){case"input":if(Rd(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 s=Il(r);if(!s)throw Error(z(90));Kg(r),Rd(r,s)}}}break;case"textarea":Yg(e,n);break;case"select":t=n.value,t!=null&&Ls(e,!!n.multiple,t,!1)}};nx=Lf;rx=ss;var OS={usingClientEntryPoint:!1,Events:[Pi,_s,Il,ex,tx,Lf]},To={findFiberByHostInstance:zr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},LS={bundleType:To.bundleType,version:To.version,rendererPackageName:To.rendererPackageName,rendererConfig:To.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Gn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ix(e),e===null?null:e.stateNode},findFiberByHostInstance:To.findFiberByHostInstance||IS,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 la=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!la.isDisabled&&la.supportsFiber)try{_l=la.inject(LS),Sn=la}catch{}}Pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=OS;Pt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Uf(t))throw Error(z(200));return AS(e,t,null,n)};Pt.createRoot=function(e,t){if(!Uf(e))throw Error(z(299));var n=!1,r="",s=Dv;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=zf(e,1,!1,null,null,n,!1,r,s),e[zn]=t.current,li(e.nodeType===8?e.parentNode:e),new Vf(t)};Pt.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(z(188)):(e=Object.keys(e).join(","),Error(z(268,e)));return e=ix(t),e=e===null?null:e.stateNode,e};Pt.flushSync=function(e){return ss(e)};Pt.hydrate=function(e,t,n){if(!Vl(t))throw Error(z(200));return Ul(null,e,t,!0,n)};Pt.hydrateRoot=function(e,t,n){if(!Uf(e))throw Error(z(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=Dv;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=$v(t,null,e,1,n??null,s,!1,i,a),e[zn]=t.current,li(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new Bl(t)};Pt.render=function(e,t,n){if(!Vl(t))throw Error(z(200));return Ul(null,e,t,!1,n)};Pt.unmountComponentAtNode=function(e){if(!Vl(e))throw Error(z(40));return e._reactRootContainer?(ss(function(){Ul(null,null,e,!1,function(){e._reactRootContainer=null,e[zn]=null})}),!0):!1};Pt.unstable_batchedUpdates=Lf;Pt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Vl(n))throw Error(z(200));if(e==null||e._reactInternals===void 0)throw Error(z(38));return Ul(e,t,n,!1,r)};Pt.version="18.3.1-next-f1338f8080-20240426";function Fv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fv)}catch(e){console.error(e)}}Fv(),Fg.exports=Pt;var ps=Fg.exports;const zv=Eg(ps);var Bv,Yp=ps;Bv=Yp.createRoot,Yp.hydrateRoot;var Wl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Hl=typeof window>"u"||"Deno"in globalThis;function Zt(){}function $S(e,t){return typeof e=="function"?e(t):e}function DS(e){return typeof e=="number"&&e>=0&&e!==1/0}function FS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pu(e,t){return typeof e=="function"?e(t):e}function zS(e,t){return typeof e=="function"?e(t):e}function Qp(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:l}=e;if(a){if(r){if(t.queryHash!==Wf(a,t.options))return!1}else if(!vi(t.queryKey,a))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function Xp(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(xi(t.options.mutationKey)!==xi(i))return!1}else if(!vi(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Wf(e,t){return((t==null?void 0:t.queryKeyHashFn)||xi)(e)}function xi(e){return JSON.stringify(e,(t,n)=>hu(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function vi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>vi(e[n],t[n])):!1}function Vv(e,t){if(e===t)return e;const n=Zp(e)&&Zp(t);if(n||hu(e)&&hu(t)){const r=n?e:Object.keys(e),s=r.length,i=n?t:Object.keys(t),a=i.length,l=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<a;u++){const f=n?u:i[u];(!n&&c.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,d++):(l[f]=Vv(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&d++)}return s===a&&d===s?e:l}return t}function Zp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hu(e){if(!Jp(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Jp(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Jp(e){return Object.prototype.toString.call(e)==="[object Object]"}function BS(e){return new Promise(t=>{setTimeout(t,e)})}function VS(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Vv(e,t):t}function US(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function WS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hf=Symbol();function Uv(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Hf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Wr,ar,Ys,yg,HS=(yg=class extends Wl{constructor(){super();me(this,Wr);me(this,ar);me(this,Ys);te(this,Ys,t=>{if(!Hl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,ar)||this.setEventListener(O(this,Ys))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,ar))==null||t.call(this),te(this,ar,void 0))}setEventListener(t){var n;te(this,Ys,t),(n=O(this,ar))==null||n.call(this),te(this,ar,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Wr)!==t&&(te(this,Wr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,Wr)=="boolean"?O(this,Wr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Wr=new WeakMap,ar=new WeakMap,Ys=new WeakMap,yg),Wv=new HS,Qs,lr,Xs,bg,GS=(bg=class extends Wl{constructor(){super();me(this,Qs,!0);me(this,lr);me(this,Xs);te(this,Xs,t=>{if(!Hl&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,lr)||this.setEventListener(O(this,Xs))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,lr))==null||t.call(this),te(this,lr,void 0))}setEventListener(t){var n;te(this,Xs,t),(n=O(this,lr))==null||n.call(this),te(this,lr,t(this.setOnline.bind(this)))}setOnline(t){O(this,Qs)!==t&&(te(this,Qs,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Qs)}},Qs=new WeakMap,lr=new WeakMap,Xs=new WeakMap,bg),dl=new GS;function KS(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function qS(e){return Math.min(1e3*2**e,3e4)}function Hv(e){return(e??"online")==="online"?dl.isOnline():!0}var Gv=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Jc(e){return e instanceof Gv}function Kv(e){let t=!1,n=0,r=!1,s;const i=KS(),a=x=>{var w;r||(m(new Gv(x)),(w=e.abort)==null||w.call(e))},l=()=>{t=!0},c=()=>{t=!1},d=()=>Wv.isFocused()&&(e.networkMode==="always"||dl.isOnline())&&e.canRun(),u=()=>Hv(e.networkMode)&&e.canRun(),f=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),s==null||s(),i.resolve(x))},m=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),s==null||s(),i.reject(x))},p=()=>new Promise(x=>{var w;s=g=>{(r||d())&&x(g)},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;s=void 0,r||(x=e.onContinue)==null||x.call(e)}),v=()=>{if(r)return;let x;const w=n===0?e.initialPromise:void 0;try{x=w??e.fn()}catch(g){x=Promise.reject(g)}Promise.resolve(x).then(f).catch(g=>{var C;if(r)return;const b=e.retry??(Hl?0:3),y=e.retryDelay??qS,N=typeof y=="function"?y(n,g):y,S=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,g);if(t||!S){m(g);return}n++,(C=e.onFail)==null||C.call(e,n,g),BS(N).then(()=>d()?void 0:p()).then(()=>{t?m(g):v()})})};return{promise:i,cancel:a,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?v():p().then(v),i)}}var YS=e=>setTimeout(e,0);function QS(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=YS;const i=l=>{t?e.push(l):s(()=>{n(l)})},a=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||a()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var ct=QS(),Hr,wg,qv=(wg=class{constructor(){me(this,Hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),DS(this.gcTime)&&te(this,Hr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hl?1/0:5*60*1e3))}clearGcTimeout(){O(this,Hr)&&(clearTimeout(O(this,Hr)),te(this,Hr,void 0))}},Hr=new WeakMap,wg),Zs,Gr,It,Kr,nt,ki,qr,Jt,Pn,Ng,XS=(Ng=class extends qv{constructor(t){super();me(this,Jt);me(this,Zs);me(this,Gr);me(this,It);me(this,Kr);me(this,nt);me(this,ki);me(this,qr);te(this,qr,!1),te(this,ki,t.defaultOptions),this.setOptions(t.options),this.observers=[],te(this,Kr,t.client),te(this,It,O(this,Kr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,te(this,Zs,JS(this.options)),this.state=t.state??O(this,Zs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,nt))==null?void 0:t.promise}setOptions(t){this.options={...O(this,ki),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,It).remove(this)}setData(t,n){const r=VS(this.state.data,t,this.options);return Je(this,Jt,Pn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Je(this,Jt,Pn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=O(this,nt))==null?void 0:r.promise;return(s=O(this,nt))==null||s.cancel(t),n?n.then(Zt).catch(Zt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Zs))}isActive(){return this.observers.some(t=>zS(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hf||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pu(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!FS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,nt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,nt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,It).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,nt)&&(O(this,qr)?O(this,nt).cancel({revert:!0}):O(this,nt).cancelRetry()),this.scheduleGc()),O(this,It).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Je(this,Jt,Pn).call(this,{type:"invalidate"})}fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,nt))return O(this,nt).continueRetry(),O(this,nt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(te(this,qr,!0),r.signal)})},i=()=>{const m=Uv(this.options,n),v=(()=>{const x={client:O(this,Kr),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return te(this,qr,!1),this.options.persister?this.options.persister(m,v,this):m(v)},l=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,Kr),state:this.state,fetchFn:i};return s(m),m})();(d=this.options.behavior)==null||d.onFetch(l,this),te(this,Gr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&Je(this,Jt,Pn).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=m=>{var p,v,x,w;Jc(m)&&m.silent||Je(this,Jt,Pn).call(this,{type:"error",error:m}),Jc(m)||((v=(p=O(this,It).config).onError)==null||v.call(p,m,this),(w=(x=O(this,It).config).onSettled)==null||w.call(x,this.state.data,m,this)),this.scheduleGc()};return te(this,nt,Kv({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var p,v,x,w;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(g){c(g);return}(v=(p=O(this,It).config).onSuccess)==null||v.call(p,m,this),(w=(x=O(this,It).config).onSettled)==null||w.call(x,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,p)=>{Je(this,Jt,Pn).call(this,{type:"failed",failureCount:m,error:p})},onPause:()=>{Je(this,Jt,Pn).call(this,{type:"pause"})},onContinue:()=>{Je(this,Jt,Pn).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),O(this,nt).start()}},Zs=new WeakMap,Gr=new WeakMap,It=new WeakMap,Kr=new WeakMap,nt=new WeakMap,ki=new WeakMap,qr=new WeakMap,Jt=new WeakSet,Pn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ZS(r.data,this.options),fetchMeta:t.meta??null};case"success":return te(this,Gr,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Jc(s)&&s.revert&&O(this,Gr)?{...O(this,Gr),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ct.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,It).notify({query:this,type:"updated",action:t})})},Ng);function ZS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Hv(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function JS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var mn,Sg,ej=(Sg=class extends Wl{constructor(t={}){super();me(this,mn);this.config=t,te(this,mn,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Wf(s,n);let a=this.get(i);return a||(a=new XS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(a)),a}add(t){O(this,mn).has(t.queryHash)||(O(this,mn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,mn).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,mn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,mn).get(t)}getAll(){return[...O(this,mn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Qp(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Qp(t,r)):n}notify(t){ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},mn=new WeakMap,Sg),pn,at,Yr,hn,tr,jg,tj=(jg=class extends qv{constructor(t){super();me(this,hn);me(this,pn);me(this,at);me(this,Yr);this.mutationId=t.mutationId,te(this,at,t.mutationCache),te(this,pn,[]),this.state=t.state||nj(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,pn).includes(t)||(O(this,pn).push(t),this.clearGcTimeout(),O(this,at).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){te(this,pn,O(this,pn).filter(n=>n!==t)),this.scheduleGc(),O(this,at).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,pn).length||(this.state.status==="pending"?this.scheduleGc():O(this,at).remove(this))}continue(){var t;return((t=O(this,Yr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,l,c,d,u,f,m,p,v,x,w,g,b,y,N,S,C,j,E;const n=()=>{Je(this,hn,tr).call(this,{type:"continue"})};te(this,Yr,Kv({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{Je(this,hn,tr).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{Je(this,hn,tr).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,at).canRun(this)}));const r=this.state.status==="pending",s=!O(this,Yr).canStart();try{if(r)n();else{Je(this,hn,tr).call(this,{type:"pending",variables:t,isPaused:s}),await((a=(i=O(this,at).config).onMutate)==null?void 0:a.call(i,t,this));const P=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));P!==this.state.context&&Je(this,hn,tr).call(this,{type:"pending",context:P,variables:t,isPaused:s})}const R=await O(this,Yr).start();return await((u=(d=O(this,at).config).onSuccess)==null?void 0:u.call(d,R,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,R,t,this.state.context)),await((v=(p=O(this,at).config).onSettled)==null?void 0:v.call(p,R,null,this.state.variables,this.state.context,this)),await((w=(x=this.options).onSettled)==null?void 0:w.call(x,R,null,t,this.state.context)),Je(this,hn,tr).call(this,{type:"success",data:R}),R}catch(R){try{throw await((b=(g=O(this,at).config).onError)==null?void 0:b.call(g,R,t,this.state.context,this)),await((N=(y=this.options).onError)==null?void 0:N.call(y,R,t,this.state.context)),await((C=(S=O(this,at).config).onSettled)==null?void 0:C.call(S,void 0,R,this.state.variables,this.state.context,this)),await((E=(j=this.options).onSettled)==null?void 0:E.call(j,void 0,R,t,this.state.context)),R}finally{Je(this,hn,tr).call(this,{type:"error",error:R})}}finally{O(this,at).runNext(this)}}},pn=new WeakMap,at=new WeakMap,Yr=new WeakMap,hn=new WeakSet,tr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ct.batch(()=>{O(this,pn).forEach(r=>{r.onMutationUpdate(t)}),O(this,at).notify({mutation:this,type:"updated",action:t})})},jg);function nj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mn,en,Ci,kg,rj=(kg=class extends Wl{constructor(t={}){super();me(this,Mn);me(this,en);me(this,Ci);this.config=t,te(this,Mn,new Set),te(this,en,new Map),te(this,Ci,0)}build(t,n,r){const s=new tj({mutationCache:this,mutationId:++Hi(this,Ci)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){O(this,Mn).add(t);const n=ca(t);if(typeof n=="string"){const r=O(this,en).get(n);r?r.push(t):O(this,en).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,Mn).delete(t)){const n=ca(t);if(typeof n=="string"){const r=O(this,en).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&O(this,en).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ca(t);if(typeof n=="string"){const r=O(this,en).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=ca(t);if(typeof n=="string"){const s=(r=O(this,en).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ct.batch(()=>{O(this,Mn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,Mn).clear(),O(this,en).clear()})}getAll(){return Array.from(O(this,Mn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xp(n,r))}findAll(t={}){return this.getAll().filter(n=>Xp(t,n))}notify(t){ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ct.batch(()=>Promise.all(t.map(n=>n.continue().catch(Zt))))}},Mn=new WeakMap,en=new WeakMap,Ci=new WeakMap,kg);function ca(e){var t;return(t=e.options.scope)==null?void 0:t.id}function eh(e){return{onFetch:(t,n)=>{var u,f,m,p,v;const r=t.options,s=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],a=((v=t.state.data)==null?void 0:v.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let x=!1;const w=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?x=!0:t.signal.addEventListener("abort",()=>{x=!0}),t.signal)})},g=Uv(t.options,t.fetchOptions),b=async(y,N,S)=>{if(x)return Promise.reject();if(N==null&&y.pages.length)return Promise.resolve(y);const j=(()=>{const _={client:t.client,queryKey:t.queryKey,pageParam:N,direction:S?"backward":"forward",meta:t.options.meta};return w(_),_})(),E=await g(j),{maxPages:R}=t.options,P=S?WS:US;return{pages:P(y.pages,E,R),pageParams:P(y.pageParams,N,R)}};if(s&&i.length){const y=s==="backward",N=y?sj:th,S={pages:i,pageParams:a},C=N(r,S);l=await b(S,C,y)}else{const y=e??i.length;do{const N=c===0?a[0]??r.initialPageParam:th(r,l);if(c>0&&N==null)break;l=await b(l,N),c++}while(c<y)}return l};t.options.persister?t.fetchFn=()=>{var x,w;return(w=(x=t.options).persister)==null?void 0:w.call(x,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function th(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function sj(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Me,cr,dr,Js,eo,ur,to,no,Cg,oj=(Cg=class{constructor(e={}){me(this,Me);me(this,cr);me(this,dr);me(this,Js);me(this,eo);me(this,ur);me(this,to);me(this,no);te(this,Me,e.queryCache||new ej),te(this,cr,e.mutationCache||new rj),te(this,dr,e.defaultOptions||{}),te(this,Js,new Map),te(this,eo,new Map),te(this,ur,0)}mount(){Hi(this,ur)._++,O(this,ur)===1&&(te(this,to,Wv.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onFocus())})),te(this,no,dl.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onOnline())})))}unmount(){var e,t;Hi(this,ur)._--,O(this,ur)===0&&((e=O(this,to))==null||e.call(this),te(this,to,void 0),(t=O(this,no))==null||t.call(this),te(this,no,void 0))}isFetching(e){return O(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,cr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Me).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=O(this,Me).get(r.queryHash),i=s==null?void 0:s.state.data,a=$S(t,i);if(a!==void 0)return O(this,Me).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ct.batch(()=>O(this,Me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Me);ct.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Me);return ct.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ct.batch(()=>O(this,Me).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Zt).catch(Zt)}invalidateQueries(e,t={}){return ct.batch(()=>(O(this,Me).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ct.batch(()=>O(this,Me).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Zt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Zt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Me).build(this,t);return n.isStaleByTime(pu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zt).catch(Zt)}fetchInfiniteQuery(e){return e.behavior=eh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zt).catch(Zt)}ensureInfiniteQueryData(e){return e.behavior=eh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dl.isOnline()?O(this,cr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Me)}getMutationCache(){return O(this,cr)}getDefaultOptions(){return O(this,dr)}setDefaultOptions(e){te(this,dr,e)}setQueryDefaults(e,t){O(this,Js).set(xi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Js).values()],n={};return t.forEach(r=>{vi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,eo).set(xi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,eo).values()],n={};return t.forEach(r=>{vi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,dr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Wf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Hf&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,dr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Me).clear(),O(this,cr).clear()}},Me=new WeakMap,cr=new WeakMap,dr=new WeakMap,Js=new WeakMap,eo=new WeakMap,ur=new WeakMap,to=new WeakMap,no=new WeakMap,Cg),ij=h.createContext(void 0),aj=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(ij.Provider,{value:e,children:t}));/**
41
+ * @remix-run/router v1.23.0
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function ul(){return ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ul.apply(this,arguments)}var pr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(pr||(pr={}));const nh="popstate";function lj(e){e===void 0&&(e={});function t(r,s){let{pathname:i,search:a,hash:l}=r.location;return gu("",{pathname:i,search:a,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:Qv(s)}return dj(t,n,null,e)}function St(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Yv(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function cj(){return Math.random().toString(36).substr(2,8)}function rh(e,t){return{usr:e.state,key:e.key,idx:t}}function gu(e,t,n,r){return n===void 0&&(n=null),ul({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Gl(t):t,{state:n,key:t&&t.key||r||cj()})}function Qv(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Gl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function dj(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,a=s.history,l=pr.Pop,c=null,d=u();d==null&&(d=0,a.replaceState(ul({},a.state,{idx:d}),""));function u(){return(a.state||{idx:null}).idx}function f(){l=pr.Pop;let w=u(),g=w==null?null:w-d;d=w,c&&c({action:l,location:x.location,delta:g})}function m(w,g){l=pr.Push;let b=gu(x.location,w,g);d=u()+1;let y=rh(b,d),N=x.createHref(b);try{a.pushState(y,"",N)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(N)}i&&c&&c({action:l,location:x.location,delta:1})}function p(w,g){l=pr.Replace;let b=gu(x.location,w,g);d=u();let y=rh(b,d),N=x.createHref(b);a.replaceState(y,"",N),i&&c&&c({action:l,location:x.location,delta:0})}function v(w){let g=s.location.origin!=="null"?s.location.origin:s.location.href,b=typeof w=="string"?w:Qv(w);return b=b.replace(/ $/,"%20"),St(g,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,g)}let x={get action(){return l},get location(){return e(s,a)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(nh,f),c=w,()=>{s.removeEventListener(nh,f),c=null}},createHref(w){return t(s,w)},createURL:v,encodeLocation(w){let g=v(w);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:m,replace:p,go(w){return a.go(w)}};return x}var sh;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(sh||(sh={}));function uj(e,t,n){return n===void 0&&(n="/"),fj(e,t,n,!1)}function fj(e,t,n,r){let s=typeof t=="string"?Gl(t):t,i=Jv(s.pathname||"/",n);if(i==null)return null;let a=Xv(e);mj(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let d=jj(i);l=Nj(a[c],d,r)}return l}function Xv(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,a,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};c.relativePath.startsWith("/")&&(St(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=Vs([r,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(St(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Xv(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:bj(d,i.index),routesMeta:u})};return e.forEach((i,a)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,a);else for(let c of Zv(i.path))s(i,a,c)}),t}function Zv(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let a=Zv(r.join("/")),l=[];return l.push(...a.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function mj(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:wj(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const pj=/^:[\w-]+$/,hj=3,gj=2,xj=1,vj=10,yj=-2,oh=e=>e==="*";function bj(e,t){let n=e.split("/"),r=n.length;return n.some(oh)&&(r+=yj),t&&(r+=gj),n.filter(s=>!oh(s)).reduce((s,i)=>s+(pj.test(i)?hj:i===""?xj:vj),r)}function wj(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function Nj(e,t,n){let{routesMeta:r}=e,s={},i="/",a=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=i==="/"?t:t.slice(i.length)||"/",f=ih({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),m=c.route;if(!f&&d&&n&&!r[r.length-1].route.index&&(f=ih({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!f)return null;Object.assign(s,f.params),a.push({params:s,pathname:Vs([i,f.pathname]),pathnameBase:kj(Vs([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=Vs([i,f.pathnameBase]))}return a}function ih(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Sj(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((d,u,f)=>{let{paramName:m,isOptional:p}=u;if(m==="*"){let x=l[f]||"";a=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const v=l[f];return p&&!v?d[m]=void 0:d[m]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:a,pattern:e}}function Sj(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Yv(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function jj(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Yv(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Jv(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const Vs=e=>e.join("/").replace(/\/\/+/g,"/"),kj=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");function Cj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const e0=["post","put","patch","delete"];new Set(e0);const Ej=["get",...e0];new Set(Ej);/**
50
+ * React Router v6.30.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function fl(){return fl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fl.apply(this,arguments)}const Rj=h.createContext(null),_j=h.createContext(null),t0=h.createContext(null),Kl=h.createContext(null),ql=h.createContext({outlet:null,matches:[],isDataRoute:!1}),n0=h.createContext(null);function Gf(){return h.useContext(Kl)!=null}function r0(){return Gf()||St(!1),h.useContext(Kl).location}function Pj(e,t){return Tj(e,t)}function Tj(e,t,n,r){Gf()||St(!1);let{navigator:s}=h.useContext(t0),{matches:i}=h.useContext(ql),a=i[i.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let d=r0(),u;if(t){var f;let w=typeof t=="string"?Gl(t):t;c==="/"||(f=w.pathname)!=null&&f.startsWith(c)||St(!1),u=w}else u=d;let m=u.pathname||"/",p=m;if(c!=="/"){let w=c.replace(/^\//,"").split("/");p="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=uj(e,{pathname:p}),x=Lj(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:Vs([c,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?c:Vs([c,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),i,n,r);return t&&x?h.createElement(Kl.Provider,{value:{location:fl({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:pr.Pop}},x):x}function Aj(){let e=zj(),t=Cj(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:s},n):null,null)}const Ij=h.createElement(Aj,null);class Mj extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(ql.Provider,{value:this.props.routeContext},h.createElement(n0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Oj(e){let{routeContext:t,match:n,children:r}=e,s=h.useContext(Rj);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(ql.Provider,{value:t},r)}function Lj(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let u=a.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||St(!1),a=a.slice(0,Math.min(a.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<a.length;u++){let f=a[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:m,errors:p}=n,v=f.route.loader&&m[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||v){c=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((u,f,m)=>{let p,v=!1,x=null,w=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,x=f.route.errorElement||Ij,c&&(d<0&&m===0?(v=!0,w=null):d===m&&(v=!0,w=f.route.hydrateFallbackElement||null)));let g=t.concat(a.slice(0,m+1)),b=()=>{let y;return p?y=x:v?y=w:f.route.Component?y=h.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=u,h.createElement(Oj,{match:f,routeContext:{outlet:u,matches:g,isDataRoute:n!=null},children:y})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?h.createElement(Mj,{location:n.location,revalidation:n.revalidation,component:x,error:p,children:b(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):b()},null)}var xu=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(xu||{});function $j(e){let t=h.useContext(_j);return t||St(!1),t}function Dj(e){let t=h.useContext(ql);return t||St(!1),t}function Fj(e){let t=Dj(),n=t.matches[t.matches.length-1];return n.route.id||St(!1),n.route.id}function zj(){var e;let t=h.useContext(n0),n=$j(xu.UseRouteError),r=Fj(xu.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Bj(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ia(e){St(!1)}function Vj(e){let{basename:t="/",children:n=null,location:r,navigationType:s=pr.Pop,navigator:i,static:a=!1,future:l}=e;Gf()&&St(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:i,static:a,future:fl({v7_relativeSplatPath:!1},l)}),[c,l,i,a]);typeof r=="string"&&(r=Gl(r));let{pathname:u="/",search:f="",hash:m="",state:p=null,key:v="default"}=r,x=h.useMemo(()=>{let w=Jv(u,c);return w==null?null:{location:{pathname:w,search:f,hash:m,state:p,key:v},navigationType:s}},[c,u,f,m,p,v,s]);return x==null?null:h.createElement(t0.Provider,{value:d},h.createElement(Kl.Provider,{children:n,value:x}))}function Uj(e){let{children:t,location:n}=e;return Pj(vu(t),n)}new Promise(()=>{});function vu(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(r,s)=>{if(!h.isValidElement(r))return;let i=[...t,s];if(r.type===h.Fragment){n.push.apply(n,vu(r.props.children,i));return}r.type!==Ia&&St(!1),!r.props.index||!r.props.children||St(!1);let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=vu(r.props.children,i)),n.push(a)}),n}/**
59
+ * React Router DOM v6.30.1
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */const Wj="6";try{window.__reactRouterVersion=Wj}catch{}const Hj="startTransition",ah=Zu[Hj];function Gj(e){let{basename:t,children:n,future:r,window:s}=e,i=h.useRef();i.current==null&&(i.current=lj({window:s,v5Compat:!0}));let a=i.current,[l,c]=h.useState({action:a.action,location:a.location}),{v7_startTransition:d}=r||{},u=h.useCallback(f=>{d&&ah?ah(()=>c(f)):c(f)},[c,d]);return h.useLayoutEffect(()=>a.listen(u),[a,u]),h.useEffect(()=>Bj(r),[r]),h.createElement(Vj,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:r})}var lh;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(lh||(lh={}));var ch;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ch||(ch={}));var dh=["light","dark"],Kj="(prefers-color-scheme: dark)",qj=h.createContext(void 0),Yj={setTheme:e=>{},themes:[]},Qj=()=>{var e;return(e=h.useContext(qj))!=null?e:Yj};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:a,attrs:l,nonce:c})=>{let d=i==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=s?dh.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(v,x=!1,w=!0)=>{let g=a?a[v]:v,b=x?v+"|| ''":`'${g}'`,y="";return s&&w&&!x&&dh.includes(v)&&(y+=`d.style.colorScheme = '${v}';`),n==="class"?x||g?y+=`c.add(${b})`:y+="null":g&&(y+=`d[s](n,${b})`),y},p=e?`!function(){${u}${m(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${Kj}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${m(a?"x[e]":"e",!0)}}${d?"":"else{"+m(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${m(a?"x[e]":"e",!0)}}else{${m(i,!1,!1)};}${f}}catch(t){}}();`;return h.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var Xj=e=>{switch(e){case"success":return ek;case"info":return nk;case"warning":return tk;case"error":return rk;default:return null}},Zj=Array(12).fill(0),Jj=({visible:e,className:t})=>V.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},V.createElement("div",{className:"sonner-spinner"},Zj.map((n,r)=>V.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),ek=V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),tk=V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},V.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),nk=V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),rk=V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sk=V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},V.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),V.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ok=()=>{let[e,t]=V.useState(document.hidden);return V.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yu=1,ik=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:yu++,i=this.toasts.find(l=>l.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:n}),{...l,...e,id:s,dismissible:a,title:n}):l):this.addToast({title:n,...r,dismissible:a,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,i,a=r.then(async c=>{if(i=["resolve",c],V.isValidElement(c))s=!1,this.create({id:n,type:"default",message:c});else if(lk(c)&&!c.ok){s=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:u})}else if(t.success!==void 0){s=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){s=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>a.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||yu++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},gt=new ik,ak=(e,t)=>{let n=(t==null?void 0:t.id)||yu++;return gt.addToast({title:e,...t,id:n}),n},lk=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",ck=ak,dk=()=>gt.toasts,uk=()=>gt.getActiveToasts();Object.assign(ck,{success:gt.success,info:gt.info,warning:gt.warning,error:gt.error,custom:gt.custom,message:gt.message,promise:gt.promise,dismiss:gt.dismiss,loading:gt.loading},{getHistory:dk,getToasts:uk});function fk(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}fk(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
68
+ `);function da(e){return e.label!==void 0}var mk=3,pk="32px",hk="16px",uh=4e3,gk=356,xk=14,vk=20,yk=200;function Yt(...e){return e.filter(Boolean).join(" ")}function bk(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var wk=e=>{var t,n,r,s,i,a,l,c,d,u,f;let{invert:m,toast:p,unstyled:v,interacting:x,setHeights:w,visibleToasts:g,heights:b,index:y,toasts:N,expanded:S,removeToast:C,defaultRichColors:j,closeButton:E,style:R,cancelButtonStyle:P,actionButtonStyle:_,className:k="",descriptionClassName:A="",duration:M,position:U,gap:$,loadingIcon:B,expandByDefault:T,classNames:I,icons:D,closeButtonAriaLabel:Q="Close toast",pauseWhenPageIsHidden:G}=e,[J,Z]=V.useState(null),[pe,we]=V.useState(null),[W,ue]=V.useState(!1),[ve,de]=V.useState(!1),[F,X]=V.useState(!1),[ge,ae]=V.useState(!1),[pt,Fe]=V.useState(!1),[We,Ut]=V.useState(0),[At,Vi]=V.useState(0),qn=V.useRef(p.duration||M||uh),Ui=V.useRef(null),$e=V.useRef(null),jc=y===0,se=y+1<=g,le=p.type,ce=p.dismissible!==!1,Ke=p.className||"",Or=p.descriptionClassName||"",it=V.useMemo(()=>b.findIndex(ee=>ee.toastId===p.id)||0,[b,p.id]),Ne=V.useMemo(()=>{var ee;return(ee=p.closeButton)!=null?ee:E},[p.closeButton,E]),Wi=V.useMemo(()=>p.duration||M||uh,[p.duration,M]),gs=V.useRef(0),ht=V.useRef(0),$m=V.useRef(0),xs=V.useRef(null),[o1,i1]=U.split("-"),Dm=V.useMemo(()=>b.reduce((ee,xe,Ee)=>Ee>=it?ee:ee+xe.height,0),[b,it]),Fm=ok(),a1=p.invert||m,kc=le==="loading";ht.current=V.useMemo(()=>it*$+Dm,[it,Dm]),V.useEffect(()=>{qn.current=Wi},[Wi]),V.useEffect(()=>{ue(!0)},[]),V.useEffect(()=>{let ee=$e.current;if(ee){let xe=ee.getBoundingClientRect().height;return Vi(xe),w(Ee=>[{toastId:p.id,height:xe,position:p.position},...Ee]),()=>w(Ee=>Ee.filter(Wt=>Wt.toastId!==p.id))}},[w,p.id]),V.useLayoutEffect(()=>{if(!W)return;let ee=$e.current,xe=ee.style.height;ee.style.height="auto";let Ee=ee.getBoundingClientRect().height;ee.style.height=xe,Vi(Ee),w(Wt=>Wt.find(Ht=>Ht.toastId===p.id)?Wt.map(Ht=>Ht.toastId===p.id?{...Ht,height:Ee}:Ht):[{toastId:p.id,height:Ee,position:p.position},...Wt])},[W,p.title,p.description,w,p.id]);let Yn=V.useCallback(()=>{de(!0),Ut(ht.current),w(ee=>ee.filter(xe=>xe.toastId!==p.id)),setTimeout(()=>{C(p)},yk)},[p,C,w,ht]);V.useEffect(()=>{if(p.promise&&le==="loading"||p.duration===1/0||p.type==="loading")return;let ee;return S||x||G&&Fm?(()=>{if($m.current<gs.current){let xe=new Date().getTime()-gs.current;qn.current=qn.current-xe}$m.current=new Date().getTime()})():qn.current!==1/0&&(gs.current=new Date().getTime(),ee=setTimeout(()=>{var xe;(xe=p.onAutoClose)==null||xe.call(p,p),Yn()},qn.current)),()=>clearTimeout(ee)},[S,x,p,le,G,Fm,Yn]),V.useEffect(()=>{p.delete&&Yn()},[Yn,p.delete]);function l1(){var ee,xe,Ee;return D!=null&&D.loading?V.createElement("div",{className:Yt(I==null?void 0:I.loader,(ee=p==null?void 0:p.classNames)==null?void 0:ee.loader,"sonner-loader"),"data-visible":le==="loading"},D.loading):B?V.createElement("div",{className:Yt(I==null?void 0:I.loader,(xe=p==null?void 0:p.classNames)==null?void 0:xe.loader,"sonner-loader"),"data-visible":le==="loading"},B):V.createElement(Jj,{className:Yt(I==null?void 0:I.loader,(Ee=p==null?void 0:p.classNames)==null?void 0:Ee.loader),visible:le==="loading"})}return V.createElement("li",{tabIndex:0,ref:$e,className:Yt(k,Ke,I==null?void 0:I.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,I==null?void 0:I.default,I==null?void 0:I[le],(n=p==null?void 0:p.classNames)==null?void 0:n[le]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:j,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":W,"data-promise":!!p.promise,"data-swiped":pt,"data-removed":ve,"data-visible":se,"data-y-position":o1,"data-x-position":i1,"data-index":y,"data-front":jc,"data-swiping":F,"data-dismissible":ce,"data-type":le,"data-invert":a1,"data-swipe-out":ge,"data-swipe-direction":pe,"data-expanded":!!(S||T&&W),style:{"--index":y,"--toasts-before":y,"--z-index":N.length-y,"--offset":`${ve?We:ht.current}px`,"--initial-height":T?"auto":`${At}px`,...R,...p.style},onDragEnd:()=>{X(!1),Z(null),xs.current=null},onPointerDown:ee=>{kc||!ce||(Ui.current=new Date,Ut(ht.current),ee.target.setPointerCapture(ee.pointerId),ee.target.tagName!=="BUTTON"&&(X(!0),xs.current={x:ee.clientX,y:ee.clientY}))},onPointerUp:()=>{var ee,xe,Ee,Wt;if(ge||!ce)return;xs.current=null;let Ht=Number(((ee=$e.current)==null?void 0:ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Qn=Number(((xe=$e.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Lr=new Date().getTime()-((Ee=Ui.current)==null?void 0:Ee.getTime()),Gt=J==="x"?Ht:Qn,Xn=Math.abs(Gt)/Lr;if(Math.abs(Gt)>=vk||Xn>.11){Ut(ht.current),(Wt=p.onDismiss)==null||Wt.call(p,p),we(J==="x"?Ht>0?"right":"left":Qn>0?"down":"up"),Yn(),ae(!0),Fe(!1);return}X(!1),Z(null)},onPointerMove:ee=>{var xe,Ee,Wt,Ht;if(!xs.current||!ce||((xe=window.getSelection())==null?void 0:xe.toString().length)>0)return;let Qn=ee.clientY-xs.current.y,Lr=ee.clientX-xs.current.x,Gt=(Ee=e.swipeDirections)!=null?Ee:bk(U);!J&&(Math.abs(Lr)>1||Math.abs(Qn)>1)&&Z(Math.abs(Lr)>Math.abs(Qn)?"x":"y");let Xn={x:0,y:0};J==="y"?(Gt.includes("top")||Gt.includes("bottom"))&&(Gt.includes("top")&&Qn<0||Gt.includes("bottom")&&Qn>0)&&(Xn.y=Qn):J==="x"&&(Gt.includes("left")||Gt.includes("right"))&&(Gt.includes("left")&&Lr<0||Gt.includes("right")&&Lr>0)&&(Xn.x=Lr),(Math.abs(Xn.x)>0||Math.abs(Xn.y)>0)&&Fe(!0),(Wt=$e.current)==null||Wt.style.setProperty("--swipe-amount-x",`${Xn.x}px`),(Ht=$e.current)==null||Ht.style.setProperty("--swipe-amount-y",`${Xn.y}px`)}},Ne&&!p.jsx?V.createElement("button",{"aria-label":Q,"data-disabled":kc,"data-close-button":!0,onClick:kc||!ce?()=>{}:()=>{var ee;Yn(),(ee=p.onDismiss)==null||ee.call(p,p)},className:Yt(I==null?void 0:I.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=D==null?void 0:D.close)!=null?i:sk):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:V.createElement(V.Fragment,null,le||p.icon||p.promise?V.createElement("div",{"data-icon":"",className:Yt(I==null?void 0:I.icon,(a=p==null?void 0:p.classNames)==null?void 0:a.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||l1():null,p.type!=="loading"?p.icon||(D==null?void 0:D[le])||Xj(le):null):null,V.createElement("div",{"data-content":"",className:Yt(I==null?void 0:I.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},V.createElement("div",{"data-title":"",className:Yt(I==null?void 0:I.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?V.createElement("div",{"data-description":"",className:Yt(A,Or,I==null?void 0:I.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),h.isValidElement(p.cancel)?p.cancel:p.cancel&&da(p.cancel)?V.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||P,onClick:ee=>{var xe,Ee;da(p.cancel)&&ce&&((Ee=(xe=p.cancel).onClick)==null||Ee.call(xe,ee),Yn())},className:Yt(I==null?void 0:I.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,h.isValidElement(p.action)?p.action:p.action&&da(p.action)?V.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||_,onClick:ee=>{var xe,Ee;da(p.action)&&((Ee=(xe=p.action).onClick)==null||Ee.call(xe,ee),!ee.defaultPrevented&&Yn())},className:Yt(I==null?void 0:I.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function fh(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Nk(e,t){let n={};return[e,t].forEach((r,s)=>{let i=s===1,a=i?"--mobile-offset":"--offset",l=i?hk:pk;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${a}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${a}-${d}`]=l:n[`${a}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}var Sk=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:a,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:v=mk,toastOptions:x,dir:w=fh(),gap:g=xk,loadingIcon:b,icons:y,containerAriaLabel:N="Notifications",pauseWhenPageIsHidden:S}=e,[C,j]=V.useState([]),E=V.useMemo(()=>Array.from(new Set([r].concat(C.filter(G=>G.position).map(G=>G.position)))),[C,r]),[R,P]=V.useState([]),[_,k]=V.useState(!1),[A,M]=V.useState(!1),[U,$]=V.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=V.useRef(null),T=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),I=V.useRef(null),D=V.useRef(!1),Q=V.useCallback(G=>{j(J=>{var Z;return(Z=J.find(pe=>pe.id===G.id))!=null&&Z.delete||gt.dismiss(G.id),J.filter(({id:pe})=>pe!==G.id)})},[]);return V.useEffect(()=>gt.subscribe(G=>{if(G.dismiss){j(J=>J.map(Z=>Z.id===G.id?{...Z,delete:!0}:Z));return}setTimeout(()=>{zv.flushSync(()=>{j(J=>{let Z=J.findIndex(pe=>pe.id===G.id);return Z!==-1?[...J.slice(0,Z),{...J[Z],...G},...J.slice(Z+1)]:[G,...J]})})})}),[]),V.useEffect(()=>{if(u!=="system"){$(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),typeof window>"u")return;let G=window.matchMedia("(prefers-color-scheme: dark)");try{G.addEventListener("change",({matches:J})=>{$(J?"dark":"light")})}catch{G.addListener(({matches:Z})=>{try{$(Z?"dark":"light")}catch(pe){console.error(pe)}})}},[u]),V.useEffect(()=>{C.length<=1&&k(!1)},[C]),V.useEffect(()=>{let G=J=>{var Z,pe;s.every(we=>J[we]||J.code===we)&&(k(!0),(Z=B.current)==null||Z.focus()),J.code==="Escape"&&(document.activeElement===B.current||(pe=B.current)!=null&&pe.contains(document.activeElement))&&k(!1)};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[s]),V.useEffect(()=>{if(B.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,D.current=!1)}},[B.current]),V.createElement("section",{ref:t,"aria-label":`${N} ${T}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((G,J)=>{var Z;let[pe,we]=G.split("-");return C.length?V.createElement("ol",{key:G,dir:w==="auto"?fh():w,tabIndex:-1,ref:B,className:l,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":pe,"data-lifted":_&&C.length>1&&!i,"data-x-position":we,style:{"--front-toast-height":`${((Z=R[0])==null?void 0:Z.height)||0}px`,"--width":`${gk}px`,"--gap":`${g}px`,...p,...Nk(c,d)},onBlur:W=>{D.current&&!W.currentTarget.contains(W.relatedTarget)&&(D.current=!1,I.current&&(I.current.focus({preventScroll:!0}),I.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||D.current||(D.current=!0,I.current=W.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||M(!0)},onPointerUp:()=>M(!1)},C.filter(W=>!W.position&&J===0||W.position===G).map((W,ue)=>{var ve,de;return V.createElement(wk,{key:W.id,icons:y,index:ue,toast:W,defaultRichColors:f,duration:(ve=x==null?void 0:x.duration)!=null?ve:m,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:n,visibleToasts:v,closeButton:(de=x==null?void 0:x.closeButton)!=null?de:a,interacting:A,position:G,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:Q,toasts:C.filter(F=>F.position==W.position),heights:R.filter(F=>F.position==W.position),setHeights:P,expandByDefault:i,gap:g,loadingIcon:b,expanded:_,pauseWhenPageIsHidden:S,swipeDirections:e.swipeDirections})})):null}))});const jk=({...e})=>{const{theme:t="system"}=Qj();return o.jsx(Sk,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},kk=1,Ck=1e6;let ed=0;function Ek(){return ed=(ed+1)%Number.MAX_SAFE_INTEGER,ed.toString()}const td=new Map,mh=e=>{if(td.has(e))return;const t=setTimeout(()=>{td.delete(e),Zo({type:"REMOVE_TOAST",toastId:e})},Ck);td.set(e,t)},Rk=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,kk)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?mh(n):e.toasts.forEach(r=>{mh(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Ma=[];let Oa={toasts:[]};function Zo(e){Oa=Rk(Oa,e),Ma.forEach(t=>{t(Oa)})}function _k({...e}){const t=Ek(),n=s=>Zo({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Zo({type:"DISMISS_TOAST",toastId:t});return Zo({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function Pk(){const[e,t]=h.useState(Oa);return h.useEffect(()=>(Ma.push(t),()=>{const n=Ma.indexOf(t);n>-1&&Ma.splice(n,1)}),[e]),{...e,toast:_k,dismiss:n=>Zo({type:"DISMISS_TOAST",toastId:n})}}function K(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function ph(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function s0(...e){return t=>{let n=!1;const r=e.map(s=>{const i=ph(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():ph(e[s],null)}}}}function oe(...e){return h.useCallback(s0(...e),e)}function Bt(e,t=[]){let n=[];function r(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];const d=f=>{var g;const{scope:m,children:p,...v}=f,x=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,w=h.useMemo(()=>v,Object.values(v));return o.jsx(x.Provider,{value:w,children:p})};d.displayName=i+"Provider";function u(f,m){var x;const p=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,v=h.useContext(p);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=n.map(a=>h.createContext(a));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,Tk(s,...t)]}function Tk(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function yi(e){const t=Ik(e),n=h.forwardRef((r,s)=>{const{children:i,...a}=r,l=h.Children.toArray(i),c=l.find(Ok);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return o.jsx(t,{...a,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...a,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var Ak=yi("Slot");function Ik(e){const t=h.forwardRef((n,r)=>{const{children:s,...i}=n;if(h.isValidElement(s)){const a=$k(s),l=Lk(i,s.props);return s.type!==h.Fragment&&(l.ref=r?s0(r,a):a),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var o0=Symbol("radix.slottable");function Mk(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=o0,t}function Ok(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===o0}function Lk(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function $k(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Yl(e){const t=e+"CollectionProvider",[n,r]=Bt(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=x=>{const{scope:w,children:g}=x,b=V.useRef(null),y=V.useRef(new Map).current;return o.jsx(s,{scope:w,itemMap:y,collectionRef:b,children:g})};a.displayName=t;const l=e+"CollectionSlot",c=yi(l),d=V.forwardRef((x,w)=>{const{scope:g,children:b}=x,y=i(l,g),N=oe(w,y.collectionRef);return o.jsx(c,{ref:N,children:b})});d.displayName=l;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=yi(u),p=V.forwardRef((x,w)=>{const{scope:g,children:b,...y}=x,N=V.useRef(null),S=oe(w,N),C=i(u,g);return V.useEffect(()=>(C.itemMap.set(N,{ref:N,...y}),()=>void C.itemMap.delete(N))),o.jsx(m,{[f]:"",ref:S,children:b})});p.displayName=u;function v(x){const w=i(e+"CollectionConsumer",x);return V.useCallback(()=>{const b=w.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((C,j)=>y.indexOf(C.ref.current)-y.indexOf(j.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:d,ItemSlot:p},v,r]}var Dk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Y=Dk.reduce((e,t)=>{const n=yi(`Primitive.${t}`),r=h.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function i0(e,t){e&&ps.flushSync(()=>e.dispatchEvent(t))}function Be(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Fk(e,t=globalThis==null?void 0:globalThis.document){const n=Be(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var zk="DismissableLayer",bu="dismissableLayer.update",Bk="dismissableLayer.pointerDownOutside",Vk="dismissableLayer.focusOutside",hh,a0=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ql=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=e,d=h.useContext(a0),[u,f]=h.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),v=oe(t,j=>f(j)),x=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=x.indexOf(w),b=u?x.indexOf(u):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,N=b>=g,S=Wk(j=>{const E=j.target,R=[...d.branches].some(P=>P.contains(E));!N||R||(s==null||s(j),a==null||a(j),j.defaultPrevented||l==null||l())},m),C=Hk(j=>{const E=j.target;[...d.branches].some(P=>P.contains(E))||(i==null||i(j),a==null||a(j),j.defaultPrevented||l==null||l())},m);return Fk(j=>{b===d.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},m),h.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(hh=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),gh(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=hh)}},[u,m,n,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),gh())},[u,d]),h.useEffect(()=>{const j=()=>p({});return document.addEventListener(bu,j),()=>document.removeEventListener(bu,j)},[]),o.jsx(Y.div,{...c,ref:v,style:{pointerEvents:y?N?"auto":"none":void 0,...e.style},onFocusCapture:K(e.onFocusCapture,C.onFocusCapture),onBlurCapture:K(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:K(e.onPointerDownCapture,S.onPointerDownCapture)})});Ql.displayName=zk;var Uk="DismissableLayerBranch",l0=h.forwardRef((e,t)=>{const n=h.useContext(a0),r=h.useRef(null),s=oe(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),o.jsx(Y.div,{...e,ref:s})});l0.displayName=Uk;function Wk(e,t=globalThis==null?void 0:globalThis.document){const n=Be(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){c0(Bk,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hk(e,t=globalThis==null?void 0:globalThis.document){const n=Be(e),r=h.useRef(!1);return h.useEffect(()=>{const s=i=>{i.target&&!r.current&&c0(Vk,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gh(){const e=new CustomEvent(bu);document.dispatchEvent(e)}function c0(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?i0(s,i):s.dispatchEvent(i)}var Gk=Ql,Kk=l0,Ue=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},qk="Portal",Kf=h.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=h.useState(!1);Ue(()=>i(!0),[]);const a=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?zv.createPortal(o.jsx(Y.div,{...r,ref:t}),a):null});Kf.displayName=qk;function Yk(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Kn=e=>{const{present:t,children:n}=e,r=Qk(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=oe(r.ref,Xk(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:i}):null};Kn.displayName="Presence";function Qk(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),i=h.useRef("none"),a=e?"mounted":"unmounted",[l,c]=Yk(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=ua(r.current);i.current=l==="mounted"?d:"none"},[l]),Ue(()=>{const d=r.current,u=s.current;if(u!==e){const m=i.current,p=ua(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ue(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=p=>{const x=ua(r.current).includes(p.animationName);if(p.target===t&&x&&(c("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=p=>{p.target===t&&(i.current=ua(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function ua(e){return(e==null?void 0:e.animationName)||"none"}function Xk(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Zk=Zu[" useInsertionEffect ".trim().toString()]||Ue;function Un({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,a]=Jk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const f=u.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const d=h.useCallback(u=>{var f;if(l){const m=eC(u)?u(e):u;m!==e&&((f=a.current)==null||f.call(a,m))}else i(u)},[l,e,i,a]);return[c,d]}function Jk({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),i=h.useRef(t);return Zk(()=>{i.current=t},[t]),h.useEffect(()=>{var a;s.current!==n&&((a=i.current)==null||a.call(i,n),s.current=n)},[n,s]),[n,r,i]}function eC(e){return typeof e=="function"}var d0=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tC="VisuallyHidden",Xl=h.forwardRef((e,t)=>o.jsx(Y.span,{...e,ref:t,style:{...d0,...e.style}}));Xl.displayName=tC;var nC=Xl,qf="ToastProvider",[Yf,rC,sC]=Yl("Toast"),[u0,D3]=Bt("Toast",[sC]),[oC,Zl]=u0(qf),f0=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=e,[l,c]=h.useState(null),[d,u]=h.useState(0),f=h.useRef(!1),m=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${qf}\`. Expected non-empty \`string\`.`),o.jsx(Yf.Provider,{scope:t,children:o.jsx(oC,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>u(p=>p+1),[]),onToastRemove:h.useCallback(()=>u(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:a})})};f0.displayName=qf;var m0="ToastViewport",iC=["F8"],wu="toast.viewportPause",Nu="toast.viewportResume",p0=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=iC,label:s="Notifications ({hotkey})",...i}=e,a=Zl(m0,n),l=rC(n),c=h.useRef(null),d=h.useRef(null),u=h.useRef(null),f=h.useRef(null),m=oe(t,f,a.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=a.toastCount>0;h.useEffect(()=>{const w=g=>{var y;r.length!==0&&r.every(N=>g[N]||g.code===N)&&((y=f.current)==null||y.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[r]),h.useEffect(()=>{const w=c.current,g=f.current;if(v&&w&&g){const b=()=>{if(!a.isClosePausedRef.current){const C=new CustomEvent(wu);g.dispatchEvent(C),a.isClosePausedRef.current=!0}},y=()=>{if(a.isClosePausedRef.current){const C=new CustomEvent(Nu);g.dispatchEvent(C),a.isClosePausedRef.current=!1}},N=C=>{!w.contains(C.relatedTarget)&&y()},S=()=>{w.contains(document.activeElement)||y()};return w.addEventListener("focusin",b),w.addEventListener("focusout",N),w.addEventListener("pointermove",b),w.addEventListener("pointerleave",S),window.addEventListener("blur",b),window.addEventListener("focus",y),()=>{w.removeEventListener("focusin",b),w.removeEventListener("focusout",N),w.removeEventListener("pointermove",b),w.removeEventListener("pointerleave",S),window.removeEventListener("blur",b),window.removeEventListener("focus",y)}}},[v,a.isClosePausedRef]);const x=h.useCallback(({tabbingDirection:w})=>{const b=l().map(y=>{const N=y.ref.current,S=[N,...yC(N)];return w==="forwards"?S:S.reverse()});return(w==="forwards"?b.reverse():b).flat()},[l]);return h.useEffect(()=>{const w=f.current;if(w){const g=b=>{var S,C,j;const y=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!y){const E=document.activeElement,R=b.shiftKey;if(b.target===w&&R){(S=d.current)==null||S.focus();return}const k=x({tabbingDirection:R?"backwards":"forwards"}),A=k.findIndex(M=>M===E);nd(k.slice(A+1))?b.preventDefault():R?(C=d.current)==null||C.focus():(j=u.current)==null||j.focus()}};return w.addEventListener("keydown",g),()=>w.removeEventListener("keydown",g)}},[l,x]),o.jsxs(Kk,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&o.jsx(Su,{ref:d,onFocusFromOutsideViewport:()=>{const w=x({tabbingDirection:"forwards"});nd(w)}}),o.jsx(Yf.Slot,{scope:n,children:o.jsx(Y.ol,{tabIndex:-1,...i,ref:m})}),v&&o.jsx(Su,{ref:u,onFocusFromOutsideViewport:()=>{const w=x({tabbingDirection:"backwards"});nd(w)}})]})});p0.displayName=m0;var h0="ToastFocusProxy",Su=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Zl(h0,n);return o.jsx(Xl,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:a=>{var d;const l=a.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&r()}})});Su.displayName=h0;var Ai="Toast",aC="toast.swipeStart",lC="toast.swipeMove",cC="toast.swipeCancel",dC="toast.swipeEnd",g0=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=e,[l,c]=Un({prop:r,defaultProp:s??!0,onChange:i,caller:Ai});return o.jsx(Kn,{present:n||l,children:o.jsx(mC,{open:l,...a,ref:t,onClose:()=>c(!1),onPause:Be(e.onPause),onResume:Be(e.onResume),onSwipeStart:K(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:K(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:K(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:K(e.onSwipeEnd,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});g0.displayName=Ai;var[uC,fC]=u0(Ai,{onClose(){}}),mC=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:p,...v}=e,x=Zl(Ai,n),[w,g]=h.useState(null),b=oe(t,M=>g(M)),y=h.useRef(null),N=h.useRef(null),S=s||x.duration,C=h.useRef(0),j=h.useRef(S),E=h.useRef(0),{onToastAdd:R,onToastRemove:P}=x,_=Be(()=>{var U;(w==null?void 0:w.contains(document.activeElement))&&((U=x.viewport)==null||U.focus()),a()}),k=h.useCallback(M=>{!M||M===1/0||(window.clearTimeout(E.current),C.current=new Date().getTime(),E.current=window.setTimeout(_,M))},[_]);h.useEffect(()=>{const M=x.viewport;if(M){const U=()=>{k(j.current),d==null||d()},$=()=>{const B=new Date().getTime()-C.current;j.current=j.current-B,window.clearTimeout(E.current),c==null||c()};return M.addEventListener(wu,$),M.addEventListener(Nu,U),()=>{M.removeEventListener(wu,$),M.removeEventListener(Nu,U)}}},[x.viewport,S,c,d,k]),h.useEffect(()=>{i&&!x.isClosePausedRef.current&&k(S)},[i,S,x.isClosePausedRef,k]),h.useEffect(()=>(R(),()=>P()),[R,P]);const A=h.useMemo(()=>w?S0(w):null,[w]);return x.viewport?o.jsxs(o.Fragment,{children:[A&&o.jsx(pC,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:A}),o.jsx(uC,{scope:n,onClose:_,children:ps.createPortal(o.jsx(Yf.ItemSlot,{scope:n,children:o.jsx(Gk,{asChild:!0,onEscapeKeyDown:K(l,()=>{x.isFocusedToastEscapeKeyDownRef.current||_(),x.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(Y.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":x.swipeDirection,...v,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:K(e.onKeyDown,M=>{M.key==="Escape"&&(l==null||l(M.nativeEvent),M.nativeEvent.defaultPrevented||(x.isFocusedToastEscapeKeyDownRef.current=!0,_()))}),onPointerDown:K(e.onPointerDown,M=>{M.button===0&&(y.current={x:M.clientX,y:M.clientY})}),onPointerMove:K(e.onPointerMove,M=>{if(!y.current)return;const U=M.clientX-y.current.x,$=M.clientY-y.current.y,B=!!N.current,T=["left","right"].includes(x.swipeDirection),I=["left","up"].includes(x.swipeDirection)?Math.min:Math.max,D=T?I(0,U):0,Q=T?0:I(0,$),G=M.pointerType==="touch"?10:2,J={x:D,y:Q},Z={originalEvent:M,delta:J};B?(N.current=J,fa(lC,f,Z,{discrete:!1})):xh(J,x.swipeDirection,G)?(N.current=J,fa(aC,u,Z,{discrete:!1}),M.target.setPointerCapture(M.pointerId)):(Math.abs(U)>G||Math.abs($)>G)&&(y.current=null)}),onPointerUp:K(e.onPointerUp,M=>{const U=N.current,$=M.target;if($.hasPointerCapture(M.pointerId)&&$.releasePointerCapture(M.pointerId),N.current=null,y.current=null,U){const B=M.currentTarget,T={originalEvent:M,delta:U};xh(U,x.swipeDirection,x.swipeThreshold)?fa(dC,p,T,{discrete:!0}):fa(cC,m,T,{discrete:!0}),B.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),x.viewport)})]}):null}),pC=e=>{const{__scopeToast:t,children:n,...r}=e,s=Zl(Ai,t),[i,a]=h.useState(!1),[l,c]=h.useState(!1);return xC(()=>a(!0)),h.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(Kf,{asChild:!0,children:o.jsx(Xl,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},hC="ToastTitle",x0=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return o.jsx(Y.div,{...r,ref:t})});x0.displayName=hC;var gC="ToastDescription",v0=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return o.jsx(Y.div,{...r,ref:t})});v0.displayName=gC;var y0="ToastAction",b0=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?o.jsx(N0,{altText:n,asChild:!0,children:o.jsx(Qf,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${y0}\`. Expected non-empty \`string\`.`),null)});b0.displayName=y0;var w0="ToastClose",Qf=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=fC(w0,n);return o.jsx(N0,{asChild:!0,children:o.jsx(Y.button,{type:"button",...r,ref:t,onClick:K(e.onClick,s.onClose)})})});Qf.displayName=w0;var N0=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return o.jsx(Y.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function S0(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),vC(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...S0(r))}}),t}function fa(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?i0(s,i):s.dispatchEvent(i)}var xh=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function xC(e=()=>{}){const t=Be(e);Ue(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function vC(e){return e.nodeType===e.ELEMENT_NODE}function yC(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function nd(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var bC=f0,j0=p0,k0=g0,C0=x0,E0=v0,R0=b0,_0=Qf;function P0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=P0(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function T0(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=P0(e))&&(r&&(r+=" "),r+=t);return r}const vh=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yh=T0,Jl=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return yh(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,a=Object.keys(s).map(d=>{const u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const m=vh(u)||vh(f);return s[d][m]}),l=n&&Object.entries(n).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(v=>{let[x,w]=v;return Array.isArray(w)?w.includes({...i,...l}[x]):{...i,...l}[x]===w})?[...d,f,m]:d},[]);return yh(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
69
+ * @license lucide-react v0.462.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const wC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),A0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
74
+ * @license lucide-react v0.462.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */var NC={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"};/**
79
+ * @license lucide-react v0.462.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const SC=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...l},c)=>h.createElement("svg",{ref:c,...NC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:A0("lucide",s),...l},[...a.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
84
+ * @license lucide-react v0.462.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const q=(e,t)=>{const n=h.forwardRef(({className:r,...s},i)=>h.createElement(SC,{ref:i,iconNode:t,className:A0(`lucide-${wC(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
89
+ * @license lucide-react v0.462.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const Ar=q("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
94
+ * @license lucide-react v0.462.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const jC=q("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
99
+ * @license lucide-react v0.462.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const I0=q("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
104
+ * @license lucide-react v0.462.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const kC=q("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
109
+ * @license lucide-react v0.462.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const CC=q("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/**
114
+ * @license lucide-react v0.462.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const ju=q("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
119
+ * @license lucide-react v0.462.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const Xf=q("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
124
+ * @license lucide-react v0.462.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const yt=q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
129
+ * @license lucide-react v0.462.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const $n=q("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
134
+ * @license lucide-react v0.462.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const EC=q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
139
+ * @license lucide-react v0.462.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const os=q("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
144
+ * @license lucide-react v0.462.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const Ii=q("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
149
+ * @license lucide-react v0.462.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const Zf=q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
154
+ * @license lucide-react v0.462.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const RC=q("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
159
+ * @license lucide-react v0.462.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const M0=q("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
164
+ * @license lucide-react v0.462.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const O0=q("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"}]]);/**
169
+ * @license lucide-react v0.462.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const ml=q("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
174
+ * @license lucide-react v0.462.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const _C=q("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
179
+ * @license lucide-react v0.462.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const ec=q("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
184
+ * @license lucide-react v0.462.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const is=q("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
189
+ * @license lucide-react v0.462.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const PC=q("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/**
194
+ * @license lucide-react v0.462.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const L0=q("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
199
+ * @license lucide-react v0.462.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const TC=q("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
204
+ * @license lucide-react v0.462.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const Mi=q("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"}]]);/**
209
+ * @license lucide-react v0.462.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const AC=q("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
214
+ * @license lucide-react v0.462.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const $0=q("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
219
+ * @license lucide-react v0.462.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const IC=q("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
224
+ * @license lucide-react v0.462.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const Jf=q("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
229
+ * @license lucide-react v0.462.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const MC=q("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
234
+ * @license lucide-react v0.462.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const OC=q("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
239
+ * @license lucide-react v0.462.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const bh=q("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
244
+ * @license lucide-react v0.462.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const LC=q("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
249
+ * @license lucide-react v0.462.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const D0=q("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
254
+ * @license lucide-react v0.462.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const $C=q("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
259
+ * @license lucide-react v0.462.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const DC=q("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
264
+ * @license lucide-react v0.462.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const F0=q("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
269
+ * @license lucide-react v0.462.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const Oi=q("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
274
+ * @license lucide-react v0.462.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const Sr=q("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
279
+ * @license lucide-react v0.462.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const pl=q("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
284
+ * @license lucide-react v0.462.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const hl=q("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"}]]);/**
289
+ * @license lucide-react v0.462.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const wh=q("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
294
+ * @license lucide-react v0.462.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const FC=q("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
299
+ * @license lucide-react v0.462.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const tc=q("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"}]]);/**
304
+ * @license lucide-react v0.462.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const Jo=q("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
309
+ * @license lucide-react v0.462.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const em=q("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/**
314
+ * @license lucide-react v0.462.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const an=q("Shield",[["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"}]]);/**
319
+ * @license lucide-react v0.462.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const gl=q("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
324
+ * @license lucide-react v0.462.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const zC=q("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
329
+ * @license lucide-react v0.462.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const BC=q("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"}]]);/**
334
+ * @license lucide-react v0.462.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const VC=q("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
339
+ * @license lucide-react v0.462.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const tm=q("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
344
+ * @license lucide-react v0.462.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const nm=q("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
349
+ * @license lucide-react v0.462.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const Cr=q("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
354
+ * @license lucide-react v0.462.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const z0=q("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"}]]);/**
359
+ * @license lucide-react v0.462.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const UC=q("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"}]]);/**
364
+ * @license lucide-react v0.462.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const WC=q("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/**
369
+ * @license lucide-react v0.462.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const Nh=q("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
374
+ * @license lucide-react v0.462.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const Zr=q("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
379
+ * @license lucide-react v0.462.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const Jr=q("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),rm="-",HC=e=>{const t=KC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(rm);return l[0]===""&&l.length!==1&&l.shift(),B0(l,t)||GC(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&r[a]?[...c,...r[a]]:c}}},B0=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?B0(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(rm);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},Sh=/^\[(.+)\]$/,GC=e=>{if(Sh.test(e)){const t=Sh.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},KC=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return YC(Object.entries(e.classGroups),n).forEach(([i,a])=>{ku(a,r,i,t)}),r},ku=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:jh(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(qC(s)){ku(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,a])=>{ku(a,jh(t,i),n,r)})})},jh=(e,t)=>{let n=e;return t.split(rm).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},qC=e=>e.isThemeGetter,YC=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[n,s]}):e,QC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return s(i,a),a},set(i,a){n.has(i)?n.set(i,a):s(i,a)}}},V0="!",XC=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,a=l=>{const c=[];let d=0,u=0,f;for(let w=0;w<l.length;w++){let g=l[w];if(d===0){if(g===s&&(r||l.slice(w,w+i)===t)){c.push(l.slice(u,w)),u=w+i;continue}if(g==="/"){f=w;continue}}g==="["?d++:g==="]"&&d--}const m=c.length===0?l:l.substring(u),p=m.startsWith(V0),v=p?m.substring(1):m,x=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:x}};return n?l=>n({className:l,parseClassName:a}):a},ZC=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},JC=e=>({cache:QC(e.cacheSize),parseClassName:XC(e),...HC(e)}),e2=/\s+/,t2=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],a=e.trim().split(e2);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=n(d);let v=!!p,x=r(v?m.substring(0,p):m);if(!x){if(!v){l=d+(l.length>0?" "+l:l);continue}if(x=r(m),!x){l=d+(l.length>0?" "+l:l);continue}v=!1}const w=ZC(u).join(":"),g=f?w+V0:w,b=g+x;if(i.includes(b))continue;i.push(b);const y=s(x,v);for(let N=0;N<y.length;++N){const S=y[N];i.push(g+S)}l=d+(l.length>0?" "+l:l)}return l};function n2(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=U0(t))&&(r&&(r+=" "),r+=n);return r}const U0=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=U0(e[r]))&&(n&&(n+=" "),n+=t);return n};function r2(e,...t){let n,r,s,i=a;function a(c){const d=t.reduce((u,f)=>f(u),e());return n=JC(d),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=t2(c,n);return s(c,u),u}return function(){return i(n2.apply(null,arguments))}}const je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},W0=/^\[(?:([a-z-]+):)?(.+)\]$/i,s2=/^\d+\/\d+$/,o2=new Set(["px","full","screen"]),i2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,a2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,l2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,c2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_n=e=>Us(e)||o2.has(e)||s2.test(e),Jn=e=>yo(e,"length",v2),Us=e=>!!e&&!Number.isNaN(Number(e)),rd=e=>yo(e,"number",Us),Ao=e=>!!e&&Number.isInteger(Number(e)),u2=e=>e.endsWith("%")&&Us(e.slice(0,-1)),re=e=>W0.test(e),er=e=>i2.test(e),f2=new Set(["length","size","percentage"]),m2=e=>yo(e,f2,H0),p2=e=>yo(e,"position",H0),h2=new Set(["image","url"]),g2=e=>yo(e,h2,b2),x2=e=>yo(e,"",y2),Io=()=>!0,yo=(e,t,n)=>{const r=W0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},v2=e=>a2.test(e)&&!l2.test(e),H0=()=>!1,y2=e=>c2.test(e),b2=e=>d2.test(e),w2=()=>{const e=je("colors"),t=je("spacing"),n=je("blur"),r=je("brightness"),s=je("borderColor"),i=je("borderRadius"),a=je("borderSpacing"),l=je("borderWidth"),c=je("contrast"),d=je("grayscale"),u=je("hueRotate"),f=je("invert"),m=je("gap"),p=je("gradientColorStops"),v=je("gradientColorStopPositions"),x=je("inset"),w=je("margin"),g=je("opacity"),b=je("padding"),y=je("saturate"),N=je("scale"),S=je("sepia"),C=je("skew"),j=je("space"),E=je("translate"),R=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",re,t],k=()=>[re,t],A=()=>["",_n,Jn],M=()=>["auto",Us,re],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",re],D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Us,re];return{cacheSize:500,separator:":",theme:{colors:[Io],spacing:[_n,Jn],blur:["none","",er,re],brightness:Q(),borderColor:[e],borderRadius:["none","","full",er,re],borderSpacing:k(),borderWidth:A(),contrast:Q(),grayscale:I(),hueRotate:Q(),invert:I(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[u2,Jn],inset:_(),margin:_(),opacity:Q(),padding:k(),saturate:Q(),scale:Q(),sepia:I(),skew:Q(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[er]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),re]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ao,re]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Ao,re]}],"grid-cols":[{"grid-cols":[Io]}],"col-start-end":[{col:["auto",{span:["full",Ao,re]},re]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[Io]}],"row-start-end":[{row:["auto",{span:[Ao,re]},re]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...T()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...T(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...T(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,t]}],"min-w":[{"min-w":[re,t,"min","max","fit"]}],"max-w":[{"max-w":[re,t,"none","full","min","max","fit","prose",{screen:[er]},er]}],h:[{h:[re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",er,Jn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rd]}],"font-family":[{font:[Io]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",re]}],"line-clamp":[{"line-clamp":["none",Us,rd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_n,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_n,Jn]}],"underline-offset":[{"underline-offset":["auto",_n,re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),p2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",m2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},g2]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:$()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[_n,re]}],"outline-w":[{outline:[_n,Jn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:A()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[_n,Jn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",er,x2]}],"shadow-color":[{shadow:[Io]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",er,re]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[y]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",re]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[Ao,re]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_n,Jn,rd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},N2=r2(w2);function L(...e){return N2(T0(e))}const S2=bC,G0=h.forwardRef(({className:e,...t},n)=>o.jsx(j0,{ref:n,className:L("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));G0.displayName=j0.displayName;const j2=Jl("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),K0=h.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(k0,{ref:r,className:L(j2({variant:t}),e),...n}));K0.displayName=k0.displayName;const k2=h.forwardRef(({className:e,...t},n)=>o.jsx(R0,{ref:n,className:L("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));k2.displayName=R0.displayName;const q0=h.forwardRef(({className:e,...t},n)=>o.jsx(_0,{ref:n,className:L("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:o.jsx(Zr,{className:"h-4 w-4"})}));q0.displayName=_0.displayName;const Y0=h.forwardRef(({className:e,...t},n)=>o.jsx(C0,{ref:n,className:L("text-sm font-semibold",e),...t}));Y0.displayName=C0.displayName;const Q0=h.forwardRef(({className:e,...t},n)=>o.jsx(E0,{ref:n,className:L("text-sm opacity-90",e),...t}));Q0.displayName=E0.displayName;function C2(){const{toasts:e}=Pk();return o.jsxs(S2,{children:[e.map(function({id:t,title:n,description:r,action:s,...i}){return o.jsxs(K0,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(Y0,{children:n}),r&&o.jsx(Q0,{children:r})]}),s,o.jsx(q0,{})]},t)}),o.jsx(G0,{})]})}var E2=Zu[" useId ".trim().toString()]||(()=>{}),R2=0;function hs(e){const[t,n]=h.useState(E2());return Ue(()=>{n(r=>r??String(R2++))},[e]),t?`radix-${t}`:""}const _2=["top","right","bottom","left"],Er=Math.min,kt=Math.max,xl=Math.round,ma=Math.floor,kn=e=>({x:e,y:e}),P2={left:"right",right:"left",bottom:"top",top:"bottom"},T2={start:"end",end:"start"};function Cu(e,t,n){return kt(e,Er(t,n))}function Wn(e,t){return typeof e=="function"?e(t):e}function Hn(e){return e.split("-")[0]}function bo(e){return e.split("-")[1]}function sm(e){return e==="x"?"y":"x"}function om(e){return e==="y"?"height":"width"}const A2=new Set(["top","bottom"]);function yn(e){return A2.has(Hn(e))?"y":"x"}function im(e){return sm(yn(e))}function I2(e,t,n){n===void 0&&(n=!1);const r=bo(e),s=im(e),i=om(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vl(a)),[a,vl(a)]}function M2(e){const t=vl(e);return[Eu(e),t,Eu(t)]}function Eu(e){return e.replace(/start|end/g,t=>T2[t])}const kh=["left","right"],Ch=["right","left"],O2=["top","bottom"],L2=["bottom","top"];function $2(e,t,n){switch(e){case"top":case"bottom":return n?t?Ch:kh:t?kh:Ch;case"left":case"right":return t?O2:L2;default:return[]}}function D2(e,t,n,r){const s=bo(e);let i=$2(Hn(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(Eu)))),i}function vl(e){return e.replace(/left|right|bottom|top/g,t=>P2[t])}function F2(e){return{top:0,right:0,bottom:0,left:0,...e}}function X0(e){return typeof e!="number"?F2(e):{top:e,right:e,bottom:e,left:e}}function yl(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Eh(e,t,n){let{reference:r,floating:s}=e;const i=yn(t),a=im(t),l=om(a),c=Hn(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,m=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:u,y:r.y-s.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(bo(t)){case"start":p[a]-=m*(n&&d?-1:1);break;case"end":p[a]+=m*(n&&d?-1:1);break}return p}const z2=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=Eh(d,r,c),m=r,p={},v=0;for(let x=0;x<l.length;x++){const{name:w,fn:g}=l[x],{x:b,y,data:N,reset:S}=await g({x:u,y:f,initialPlacement:r,placement:m,strategy:s,middlewareData:p,rects:d,platform:a,elements:{reference:e,floating:t}});u=b??u,f=y??f,p={...p,[w]:{...p[w],...N}},S&&v<=50&&(v++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:u,y:f}=Eh(d,m,c)),x=-1)}return{x:u,y:f,placement:m,strategy:s,middlewareData:p}};async function bi(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Wn(t,e),v=X0(p),w=l[m?f==="floating"?"reference":"floating":f],g=yl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},S=yl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(g.top-S.top+v.top)/N.y,bottom:(S.bottom-g.bottom+v.bottom)/N.y,left:(g.left-S.left+v.left)/N.x,right:(S.right-g.right+v.right)/N.x}}const B2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=Wn(e,t)||{};if(d==null)return{};const f=X0(u),m={x:n,y:r},p=im(s),v=om(p),x=await a.getDimensions(d),w=p==="y",g=w?"top":"left",b=w?"bottom":"right",y=w?"clientHeight":"clientWidth",N=i.reference[v]+i.reference[p]-m[p]-i.floating[v],S=m[p]-i.reference[p],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let j=C?C[y]:0;(!j||!await(a.isElement==null?void 0:a.isElement(C)))&&(j=l.floating[y]||i.floating[v]);const E=N/2-S/2,R=j/2-x[v]/2-1,P=Er(f[g],R),_=Er(f[b],R),k=P,A=j-x[v]-_,M=j/2-x[v]/2+E,U=Cu(k,M,A),$=!c.arrow&&bo(s)!=null&&M!==U&&i.reference[v]/2-(M<k?P:_)-x[v]/2<0,B=$?M<k?M-k:M-A:0;return{[p]:m[p]+B,data:{[p]:U,centerOffset:M-U-B,...$&&{alignmentOffset:B}},reset:$}}}),V2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...w}=Wn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Hn(s),b=yn(l),y=Hn(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=m||(y||!x?[vl(l)]:M2(l)),C=v!=="none";!m&&C&&S.push(...D2(l,x,v,N));const j=[l,...S],E=await bi(t,w),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&R.push(E[g]),f){const M=I2(s,a,N);R.push(E[M[0]],E[M[1]])}if(P=[...P,{placement:s,overflows:R}],!R.every(M=>M<=0)){var _,k;const M=(((_=i.flip)==null?void 0:_.index)||0)+1,U=j[M];if(U&&(!(f==="alignment"?b!==yn(U):!1)||P.every(T=>T.overflows[0]>0&&yn(T.placement)===b)))return{data:{index:M,overflows:P},reset:{placement:U}};let $=(k=P.filter(B=>B.overflows[0]<=0).sort((B,T)=>B.overflows[1]-T.overflows[1])[0])==null?void 0:k.placement;if(!$)switch(p){case"bestFit":{var A;const B=(A=P.filter(T=>{if(C){const I=yn(T.placement);return I===b||I==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(I=>I>0).reduce((I,D)=>I+D,0)]).sort((T,I)=>T[1]-I[1])[0])==null?void 0:A[0];B&&($=B);break}case"initialPlacement":$=l;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function Rh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _h(e){return _2.some(t=>e[t]>=0)}const U2=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Wn(e,t);switch(r){case"referenceHidden":{const i=await bi(t,{...s,elementContext:"reference"}),a=Rh(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:_h(a)}}}case"escaped":{const i=await bi(t,{...s,altBoundary:!0}),a=Rh(i,n.floating);return{data:{escapedOffsets:a,escaped:_h(a)}}}default:return{}}}}},Z0=new Set(["left","top"]);async function W2(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Hn(n),l=bo(n),c=yn(n)==="y",d=Z0.has(a)?-1:1,u=i&&c?-1:1,f=Wn(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(p=l==="end"?v*-1:v),c?{x:p*u,y:m*d}:{x:m*d,y:p*u}}const H2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await W2(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},G2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:g,y:b}=w;return{x:g,y:b}}},...c}=Wn(e,t),d={x:n,y:r},u=await bi(t,c),f=yn(Hn(s)),m=sm(f);let p=d[m],v=d[f];if(i){const w=m==="y"?"top":"left",g=m==="y"?"bottom":"right",b=p+u[w],y=p-u[g];p=Cu(b,p,y)}if(a){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",b=v+u[w],y=v-u[g];v=Cu(b,v,y)}const x=l.fn({...t,[m]:p,[f]:v});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[m]:i,[f]:a}}}}}},K2=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Wn(e,t),u={x:n,y:r},f=yn(s),m=sm(f);let p=u[m],v=u[f];const x=Wn(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const y=m==="y"?"height":"width",N=i.reference[m]-i.floating[y]+w.mainAxis,S=i.reference[m]+i.reference[y]-w.mainAxis;p<N?p=N:p>S&&(p=S)}if(d){var g,b;const y=m==="y"?"width":"height",N=Z0.has(Hn(s)),S=i.reference[f]-i.floating[y]+(N&&((g=a.offset)==null?void 0:g[f])||0)+(N?0:w.crossAxis),C=i.reference[f]+i.reference[y]+(N?0:((b=a.offset)==null?void 0:b[f])||0)-(N?w.crossAxis:0);v<S?v=S:v>C&&(v=C)}return{[m]:p,[f]:v}}}},q2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:a,elements:l}=t,{apply:c=()=>{},...d}=Wn(e,t),u=await bi(t,d),f=Hn(s),m=bo(s),p=yn(s)==="y",{width:v,height:x}=i.floating;let w,g;f==="top"||f==="bottom"?(w=f,g=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(g=f,w=m==="end"?"top":"bottom");const b=x-u.top-u.bottom,y=v-u.left-u.right,N=Er(x-u[w],b),S=Er(v-u[g],y),C=!t.middlewareData.shift;let j=N,E=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),C&&!m){const P=kt(u.left,0),_=kt(u.right,0),k=kt(u.top,0),A=kt(u.bottom,0);p?E=v-2*(P!==0||_!==0?P+_:kt(u.left,u.right)):j=x-2*(k!==0||A!==0?k+A:kt(u.top,u.bottom))}await c({...t,availableWidth:E,availableHeight:j});const R=await a.getDimensions(l.floating);return v!==R.width||x!==R.height?{reset:{rects:!0}}:{}}}};function nc(){return typeof window<"u"}function wo(e){return J0(e)?(e.nodeName||"").toLowerCase():"#document"}function Rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function En(e){var t;return(t=(J0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function J0(e){return nc()?e instanceof Node||e instanceof Rt(e).Node:!1}function ln(e){return nc()?e instanceof Element||e instanceof Rt(e).Element:!1}function Cn(e){return nc()?e instanceof HTMLElement||e instanceof Rt(e).HTMLElement:!1}function Ph(e){return!nc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rt(e).ShadowRoot}const Y2=new Set(["inline","contents"]);function Li(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=cn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Y2.has(s)}const Q2=new Set(["table","td","th"]);function X2(e){return Q2.has(wo(e))}const Z2=[":popover-open",":modal"];function rc(e){return Z2.some(t=>{try{return e.matches(t)}catch{return!1}})}const J2=["transform","translate","scale","rotate","perspective"],eE=["transform","translate","scale","rotate","perspective","filter"],tE=["paint","layout","strict","content"];function am(e){const t=lm(),n=ln(e)?cn(e):e;return J2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||eE.some(r=>(n.willChange||"").includes(r))||tE.some(r=>(n.contain||"").includes(r))}function nE(e){let t=Rr(e);for(;Cn(t)&&!uo(t);){if(am(t))return t;if(rc(t))return null;t=Rr(t)}return null}function lm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const rE=new Set(["html","body","#document"]);function uo(e){return rE.has(wo(e))}function cn(e){return Rt(e).getComputedStyle(e)}function sc(e){return ln(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rr(e){if(wo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ph(e)&&e.host||En(e);return Ph(t)?t.host:t}function ey(e){const t=Rr(e);return uo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cn(t)&&Li(t)?t:ey(t)}function wi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ey(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Rt(s);if(i){const l=Ru(a);return t.concat(a,a.visualViewport||[],Li(s)?s:[],l&&n?wi(l):[])}return t.concat(s,wi(s,[],n))}function Ru(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ty(e){const t=cn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Cn(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=xl(n)!==i||xl(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function cm(e){return ln(e)?e:e.contextElement}function Ws(e){const t=cm(e);if(!Cn(t))return kn(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=ty(t);let a=(i?xl(n.width):n.width)/r,l=(i?xl(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const sE=kn(0);function ny(e){const t=Rt(e);return!lm()||!t.visualViewport?sE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rt(e)?!1:t}function as(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=cm(e);let a=kn(1);t&&(r?ln(r)&&(a=Ws(r)):a=Ws(e));const l=oE(i,n,r)?ny(i):kn(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,u=s.width/a.x,f=s.height/a.y;if(i){const m=Rt(i),p=r&&ln(r)?Rt(r):r;let v=m,x=Ru(v);for(;x&&r&&p!==v;){const w=Ws(x),g=x.getBoundingClientRect(),b=cn(x),y=g.left+(x.clientLeft+parseFloat(b.paddingLeft))*w.x,N=g.top+(x.clientTop+parseFloat(b.paddingTop))*w.y;c*=w.x,d*=w.y,u*=w.x,f*=w.y,c+=y,d+=N,v=Rt(x),x=Ru(v)}}return yl({width:u,height:f,x:c,y:d})}function dm(e,t){const n=sc(e).scrollLeft;return t?t.left+n:as(En(e)).left+n}function ry(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:dm(e,r)),i=r.top+t.scrollTop;return{x:s,y:i}}function iE(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=En(r),l=t?rc(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=kn(1);const u=kn(0),f=Cn(r);if((f||!f&&!i)&&((wo(r)!=="body"||Li(a))&&(c=sc(r)),Cn(r))){const p=as(r);d=Ws(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const m=a&&!f&&!i?ry(a,c,!0):kn(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function aE(e){return Array.from(e.getClientRects())}function lE(e){const t=En(e),n=sc(e),r=e.ownerDocument.body,s=kt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=kt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+dm(e);const l=-n.scrollTop;return cn(r).direction==="rtl"&&(a+=kt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}function cE(e,t){const n=Rt(e),r=En(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const d=lm();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:a,x:l,y:c}}const dE=new Set(["absolute","fixed"]);function uE(e,t){const n=as(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Cn(e)?Ws(e):kn(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function Th(e,t,n){let r;if(t==="viewport")r=cE(e,n);else if(t==="document")r=lE(En(e));else if(ln(t))r=uE(t,n);else{const s=ny(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return yl(r)}function sy(e,t){const n=Rr(e);return n===t||!ln(n)||uo(n)?!1:cn(n).position==="fixed"||sy(n,t)}function fE(e,t){const n=t.get(e);if(n)return n;let r=wi(e,[],!1).filter(l=>ln(l)&&wo(l)!=="body"),s=null;const i=cn(e).position==="fixed";let a=i?Rr(e):e;for(;ln(a)&&!uo(a);){const l=cn(a),c=am(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&dE.has(s.position)||Li(a)&&!c&&sy(e,a))?r=r.filter(u=>u!==a):s=l,a=Rr(a)}return t.set(e,r),r}function mE(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?rc(t)?[]:fE(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((d,u)=>{const f=Th(t,u,s);return d.top=kt(f.top,d.top),d.right=Er(f.right,d.right),d.bottom=Er(f.bottom,d.bottom),d.left=kt(f.left,d.left),d},Th(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function pE(e){const{width:t,height:n}=ty(e);return{width:t,height:n}}function hE(e,t,n){const r=Cn(t),s=En(t),i=n==="fixed",a=as(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=kn(0);function d(){c.x=dm(s)}if(r||!r&&!i)if((wo(t)!=="body"||Li(s))&&(l=sc(t)),r){const p=as(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?ry(s,l):kn(0),f=a.left+l.scrollLeft-c.x-u.x,m=a.top+l.scrollTop-c.y-u.y;return{x:f,y:m,width:a.width,height:a.height}}function sd(e){return cn(e).position==="static"}function Ah(e,t){if(!Cn(e)||cn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return En(e)===n&&(n=n.ownerDocument.body),n}function oy(e,t){const n=Rt(e);if(rc(e))return n;if(!Cn(e)){let s=Rr(e);for(;s&&!uo(s);){if(ln(s)&&!sd(s))return s;s=Rr(s)}return n}let r=Ah(e,t);for(;r&&X2(r)&&sd(r);)r=Ah(r,t);return r&&uo(r)&&sd(r)&&!am(r)?n:r||nE(e)||n}const gE=async function(e){const t=this.getOffsetParent||oy,n=this.getDimensions,r=await n(e.floating);return{reference:hE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xE(e){return cn(e).direction==="rtl"}const vE={convertOffsetParentRelativeRectToViewportRelativeRect:iE,getDocumentElement:En,getClippingRect:mE,getOffsetParent:oy,getElementRects:gE,getClientRects:aE,getDimensions:pE,getScale:Ws,isElement:ln,isRTL:xE};function iy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yE(e,t){let n=null,r;const s=En(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:u,top:f,width:m,height:p}=d;if(l||t(),!m||!p)return;const v=ma(f),x=ma(s.clientWidth-(u+m)),w=ma(s.clientHeight-(f+p)),g=ma(u),y={rootMargin:-v+"px "+-x+"px "+-w+"px "+-g+"px",threshold:kt(0,Er(1,c))||1};let N=!0;function S(C){const j=C[0].intersectionRatio;if(j!==c){if(!N)return a();j?a(!1,j):r=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!iy(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(S,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return a(!0),i}function bE(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=cm(e),u=s||i?[...d?wi(d):[],...wi(t)]:[];u.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=d&&l?yE(d,n):null;let m=-1,p=null;a&&(p=new ResizeObserver(g=>{let[b]=g;b&&b.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),d&&!c&&p.observe(d),p.observe(t));let v,x=c?as(e):null;c&&w();function w(){const g=as(e);x&&!iy(x,g)&&n(),x=g,v=requestAnimationFrame(w)}return n(),()=>{var g;u.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),f==null||f(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const wE=H2,NE=G2,SE=V2,jE=q2,kE=U2,Ih=B2,CE=K2,EE=(e,t,n)=>{const r=new Map,s={platform:vE,...n},i={...s.platform,_c:r};return z2(e,t,{...s,platform:i})};var RE=typeof document<"u",_E=function(){},La=RE?h.useLayoutEffect:_E;function bl(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bl(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!bl(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ay(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mh(e,t){const n=ay(e);return Math.round(t*n)/n}function od(e){const t=h.useRef(e);return La(()=>{t.current=e}),t}function PE(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=h.useState(r);bl(m,r)||p(r);const[v,x]=h.useState(null),[w,g]=h.useState(null),b=h.useCallback(T=>{T!==C.current&&(C.current=T,x(T))},[]),y=h.useCallback(T=>{T!==j.current&&(j.current=T,g(T))},[]),N=i||v,S=a||w,C=h.useRef(null),j=h.useRef(null),E=h.useRef(u),R=c!=null,P=od(c),_=od(s),k=od(d),A=h.useCallback(()=>{if(!C.current||!j.current)return;const T={placement:t,strategy:n,middleware:m};_.current&&(T.platform=_.current),EE(C.current,j.current,T).then(I=>{const D={...I,isPositioned:k.current!==!1};M.current&&!bl(E.current,D)&&(E.current=D,ps.flushSync(()=>{f(D)}))})},[m,t,n,_,k]);La(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[d]);const M=h.useRef(!1);La(()=>(M.current=!0,()=>{M.current=!1}),[]),La(()=>{if(N&&(C.current=N),S&&(j.current=S),N&&S){if(P.current)return P.current(N,S,A);A()}},[N,S,A,P,R]);const U=h.useMemo(()=>({reference:C,floating:j,setReference:b,setFloating:y}),[b,y]),$=h.useMemo(()=>({reference:N,floating:S}),[N,S]),B=h.useMemo(()=>{const T={position:n,left:0,top:0};if(!$.floating)return T;const I=Mh($.floating,u.x),D=Mh($.floating,u.y);return l?{...T,transform:"translate("+I+"px, "+D+"px)",...ay($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:D}},[n,l,$.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:A,refs:U,elements:$,floatingStyles:B}),[u,A,U,$,B])}const TE=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ih({element:r.current,padding:s}).fn(n):{}:r?Ih({element:r,padding:s}).fn(n):{}}}},AE=(e,t)=>({...wE(e),options:[e,t]}),IE=(e,t)=>({...NE(e),options:[e,t]}),ME=(e,t)=>({...CE(e),options:[e,t]}),OE=(e,t)=>({...SE(e),options:[e,t]}),LE=(e,t)=>({...jE(e),options:[e,t]}),$E=(e,t)=>({...kE(e),options:[e,t]}),DE=(e,t)=>({...TE(e),options:[e,t]});var FE="Arrow",ly=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return o.jsx(Y.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});ly.displayName=FE;var zE=ly;function um(e){const[t,n]=h.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;a=d.inlineSize,l=d.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var fm="Popper",[cy,oc]=Bt(fm),[BE,dy]=cy(fm),uy=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return o.jsx(BE,{scope:t,anchor:r,onAnchorChange:s,children:n})};uy.displayName=fm;var fy="PopperAnchor",my=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=dy(fy,n),a=h.useRef(null),l=oe(t,a);return h.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:o.jsx(Y.div,{...s,ref:l})});my.displayName=fy;var mm="PopperContent",[VE,UE]=cy(mm),py=h.forwardRef((e,t)=>{var W,ue,ve,de,F,X;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:v,...x}=e,w=dy(mm,n),[g,b]=h.useState(null),y=oe(t,ge=>b(ge)),[N,S]=h.useState(null),C=um(N),j=(C==null?void 0:C.width)??0,E=(C==null?void 0:C.height)??0,R=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},_=Array.isArray(d)?d:[d],k=_.length>0,A={padding:P,boundary:_.filter(HE),altBoundary:k},{refs:M,floatingStyles:U,placement:$,isPositioned:B,middlewareData:T}=PE({strategy:"fixed",placement:R,whileElementsMounted:(...ge)=>bE(...ge,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[AE({mainAxis:s+E,alignmentAxis:a}),c&&IE({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?ME():void 0,...A}),c&&OE({...A}),LE({...A,apply:({elements:ge,rects:ae,availableWidth:pt,availableHeight:Fe})=>{const{width:We,height:Ut}=ae.reference,At=ge.floating.style;At.setProperty("--radix-popper-available-width",`${pt}px`),At.setProperty("--radix-popper-available-height",`${Fe}px`),At.setProperty("--radix-popper-anchor-width",`${We}px`),At.setProperty("--radix-popper-anchor-height",`${Ut}px`)}}),N&&DE({element:N,padding:l}),GE({arrowWidth:j,arrowHeight:E}),m&&$E({strategy:"referenceHidden",...A})]}),[I,D]=xy($),Q=Be(v);Ue(()=>{B&&(Q==null||Q())},[B,Q]);const G=(W=T.arrow)==null?void 0:W.x,J=(ue=T.arrow)==null?void 0:ue.y,Z=((ve=T.arrow)==null?void 0:ve.centerOffset)!==0,[pe,we]=h.useState();return Ue(()=>{g&&we(window.getComputedStyle(g).zIndex)},[g]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:B?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:pe,"--radix-popper-transform-origin":[(de=T.transformOrigin)==null?void 0:de.x,(F=T.transformOrigin)==null?void 0:F.y].join(" "),...((X=T.hide)==null?void 0:X.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(VE,{scope:n,placedSide:I,onArrowChange:S,arrowX:G,arrowY:J,shouldHideArrow:Z,children:o.jsx(Y.div,{"data-side":I,"data-align":D,...x,ref:y,style:{...x.style,animation:B?void 0:"none"}})})})});py.displayName=mm;var hy="PopperArrow",WE={top:"bottom",right:"left",bottom:"top",left:"right"},gy=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=UE(hy,r),a=WE[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(zE,{...s,ref:n,style:{...s.style,display:"block"}})})});gy.displayName=hy;function HE(e){return e!==null}var GE=e=>({name:"transformOrigin",options:e,fn(t){var w,g,b;const{placement:n,rects:r,middlewareData:s}=t,a=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[d,u]=xy(n),f={start:"0%",center:"50%",end:"100%"}[u],m=(((g=s.arrow)==null?void 0:g.x)??0)+l/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+c/2;let v="",x="";return d==="bottom"?(v=a?f:`${m}px`,x=`${-c}px`):d==="top"?(v=a?f:`${m}px`,x=`${r.floating.height+c}px`):d==="right"?(v=`${-c}px`,x=a?f:`${p}px`):d==="left"&&(v=`${r.floating.width+c}px`,x=a?f:`${p}px`),{data:{x:v,y:x}}}});function xy(e){const[t,n="center"]=e.split("-");return[t,n]}var vy=uy,yy=my,by=py,wy=gy,[ic,F3]=Bt("Tooltip",[oc]),ac=oc(),Ny="TooltipProvider",KE=700,_u="tooltip.open",[qE,pm]=ic(Ny),Sy=e=>{const{__scopeTooltip:t,delayDuration:n=KE,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,a=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(qE,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:i})};Sy.displayName=Ny;var Ni="Tooltip",[YE,lc]=ic(Ni),jy=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,c=pm(Ni,e.__scopeTooltip),d=ac(t),[u,f]=h.useState(null),m=hs(),p=h.useRef(0),v=a??c.disableHoverableContent,x=l??c.delayDuration,w=h.useRef(!1),[g,b]=Un({prop:r,defaultProp:s??!1,onChange:j=>{j?(c.onOpen(),document.dispatchEvent(new CustomEvent(_u))):c.onClose(),i==null||i(j)},caller:Ni}),y=h.useMemo(()=>g?w.current?"delayed-open":"instant-open":"closed",[g]),N=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,b(!0)},[b]),S=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),C=h.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,b(!0),p.current=0},x)},[x,b]);return h.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),o.jsx(vy,{...d,children:o.jsx(YE,{scope:t,contentId:m,open:g,stateAttribute:y,trigger:u,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayedRef.current?C():N()},[c.isOpenDelayedRef,C,N]),onTriggerLeave:h.useCallback(()=>{v?S():(window.clearTimeout(p.current),p.current=0)},[S,v]),onOpen:N,onClose:S,disableHoverableContent:v,children:n})})};jy.displayName=Ni;var Pu="TooltipTrigger",ky=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=lc(Pu,n),i=pm(Pu,n),a=ac(n),l=h.useRef(null),c=oe(t,l,s.onTriggerChange),d=h.useRef(!1),u=h.useRef(!1),f=h.useCallback(()=>d.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),o.jsx(yy,{asChild:!0,...a,children:o.jsx(Y.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:K(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:K(e.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:K(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:K(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:K(e.onBlur,s.onClose),onClick:K(e.onClick,s.onClose)})})});ky.displayName=Pu;var QE="TooltipPortal",[z3,XE]=ic(QE,{forceMount:void 0}),fo="TooltipContent",Cy=h.forwardRef((e,t)=>{const n=XE(fo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,a=lc(fo,e.__scopeTooltip);return o.jsx(Kn,{present:r||a.open,children:a.disableHoverableContent?o.jsx(Ey,{side:s,...i,ref:t}):o.jsx(ZE,{side:s,...i,ref:t})})}),ZE=h.forwardRef((e,t)=>{const n=lc(fo,e.__scopeTooltip),r=pm(fo,e.__scopeTooltip),s=h.useRef(null),i=oe(t,s),[a,l]=h.useState(null),{trigger:c,onClose:d}=n,u=s.current,{onPointerInTransitChange:f}=r,m=h.useCallback(()=>{l(null),f(!1)},[f]),p=h.useCallback((v,x)=>{const w=v.currentTarget,g={x:v.clientX,y:v.clientY},b=r5(g,w.getBoundingClientRect()),y=s5(g,b),N=o5(x.getBoundingClientRect()),S=a5([...y,...N]);l(S),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&u){const v=w=>p(w,u),x=w=>p(w,c);return c.addEventListener("pointerleave",v),u.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",x)}}},[c,u,p,m]),h.useEffect(()=>{if(a){const v=x=>{const w=x.target,g={x:x.clientX,y:x.clientY},b=(c==null?void 0:c.contains(w))||(u==null?void 0:u.contains(w)),y=!i5(g,a);b?m():y&&(m(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,u,a,d,m]),o.jsx(Ey,{...e,ref:i})}),[JE,e5]=ic(Ni,{isInside:!1}),t5=Mk("TooltipContent"),Ey=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,c=lc(fo,n),d=ac(n),{onClose:u}=c;return h.useEffect(()=>(document.addEventListener(_u,u),()=>document.removeEventListener(_u,u)),[u]),h.useEffect(()=>{if(c.trigger){const f=m=>{const p=m.target;p!=null&&p.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),o.jsx(Ql,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:o.jsxs(by,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(t5,{children:r}),o.jsx(JE,{scope:n,isInside:!0,children:o.jsx(nC,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Cy.displayName=fo;var Ry="TooltipArrow",n5=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ac(n);return e5(Ry,n).isInside?null:o.jsx(wy,{...s,...r,ref:t})});n5.displayName=Ry;function r5(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function s5(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function o5(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function i5(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],c=t[a],d=l.x,u=l.y,f=c.x,m=c.y;u>r!=m>r&&n<(f-d)*(r-u)/(m-u)+d&&(s=!s)}return s}function a5(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),l5(t)}function l5(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var c5=Sy,d5=jy,u5=ky,_y=Cy;const f5=c5,m5=d5,p5=u5,Py=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>o.jsx(_y,{ref:r,sideOffset:t,className:L("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Py.displayName=_y.displayName;const h5="modulepreload",g5=function(e){return"/"+e},Oh={},Tu=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=g5(c),c in Oh)return;Oh[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":h5,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var ye={};const x5=[{id:"ai_translator",type:"ai",permissions:["translate_input"],constraints:["must_output_valid_schema","no_invention_of_events","confidence_must_be_provided"]},{id:"ai_analyst",type:"ai",permissions:["generate_report","summarize_trace","suggest_experiments","detect_archetype","synthesize_strategy","compare_experiments"],constraints:["must_reference_trace","must_include_blocked_actions","must_include_metrics","no_unverifiable_claims","no_speculation_without_flag","must_include_confidence"]}];class hm{constructor(){Kt(this,"name","deterministic")}async translate(t){const n=[],r=t.toLowerCase();return(r.includes("sell")||r.includes("panic")||r.includes("crash"))&&n.push({type:"market_shock",action:"sell_pressure",impact:-.7,confidence:.6,severity:.8}),(r.includes("buy")||r.includes("rally")||r.includes("recover"))&&n.push({type:"market_recovery",action:"buy_pressure",impact:.5,confidence:.5,severity:.3}),n.length===0&&n.push({type:"unstructured_input",action:"needs_ai_translation",impact:0,confidence:.3,metadata:{raw:t}}),n}async summarize(t){return cc(t)}}function cc(e){const{metrics:t,interventions:n,governanceStats:r,rounds:s}=e,i=s.filter(p=>p.interventions.length>0).slice(0,5).map(p=>{const v=[...new Set(p.reactions.map(w=>w.agent))],x=p.interventions.some(w=>w.includes("[BLOCK]"));return{round:p.round,description:p.interventions[0].replace(/^\[.*?\]\s*/,""),agents:v,severity:x?"high":"moderate"}}),a=n.slice(0,10).map(p=>{const v=p.match(/^\[(BLOCK|PAUSE|GATE-\d+)\]\s*(.*?):\s*(.*)/);if(v){const x=v[1];return{type:x==="BLOCK"?"BLOCK":x==="PAUSE"?"PAUSE":x.startsWith("GATE")?"CIRCUIT_BREAKER":"REBALANCE",agent:v[2].trim(),description:v[3].trim()}}return{type:"REBALANCE",agent:"system",description:p}}),l=r.blocks,c=n.length,d=(t.stabilityScore*100).toFixed(0),u=(t.collapseProbability*100).toFixed(0),f=l>0?`Governance engine blocked ${l} high-risk actions and applied ${c} interventions. System stability: ${d}%. Collapse probability held at ${u}%.`:`Governance constraints applied ${c} interventions, maintaining ${d}% system stability with ${u}% collapse risk.`,m=[];return l>2&&m.push("Multiple block events indicate aggressive agent behavior was successfully contained by invariant enforcement."),t.stabilityScore>.6&&m.push("Governance rules maintained system stability above critical thresholds throughout the simulation."),t.maxVolatility>.5&&m.push(`Peak volatility of ${(t.maxVolatility*100).toFixed(0)}% was dampened by circuit breaker gates.`),r.rulesFired>3&&m.push(`${r.rulesFired} world rules fired during deterministic simulation, shaping agent behavior across rounds.`),m.length===0&&m.push("Governance constraints maintained equilibrium with minimal intervention required."),{executiveSummary:f,keyEvents:i,governanceActions:a,metrics:{volatilityReduction:`${(t.maxVolatility*100).toFixed(0)}% peak`,collapseRisk:`${u}%`,stabilityScore:`${d}%`,interventionCount:c,blockedActions:l},counterfactual:c>3?`Without governance constraints, ${l} blocked actions would have proceeded unchecked, likely increasing volatility beyond recovery thresholds.`:void 0,observations:m,generatedBy:"deterministic",governedBy:"NeuroverseOS"}}class dc{constructor(t){Kt(this,"name","anthropic");Kt(this,"client",null);Kt(this,"model");Kt(this,"_apiKey");this.model=(t==null?void 0:t.model)??"claude-sonnet-4-20250514";const n=(t==null?void 0:t.apiKey)??ye.ANTHROPIC_API_KEY;if(!n)throw new Error("AnthropicProvider requires ANTHROPIC_API_KEY environment variable or apiKey option");this._apiKey=n}async getClient(){if(!this.client)try{const t=await Tu(()=>import("@anthropic-ai/sdk"),[]),n=t.default??t.Anthropic;this.client=new n({apiKey:this._apiKey})}catch{throw new Error("Failed to load @anthropic-ai/sdk. Install it: npm install @anthropic-ai/sdk")}return this.client}async translate(t){var i;const r=await(await this.getClient()).messages.create({model:this.model,max_tokens:1024,system:Ty,messages:[{role:"user",content:t}]}),s=((i=r.content[0])==null?void 0:i.type)==="text"?r.content[0].text:"[]";return Iy(s)}async summarize(t){var a;const n=await this.getClient(),r=My(t),s=await n.messages.create({model:this.model,max_tokens:2048,system:Ay,messages:[{role:"user",content:`Analyze this simulation trace:
384
+ ${r}`}]}),i=((a=s.content[0])==null?void 0:a.type)==="text"?s.content[0].text:"{}";try{return JSON.parse(i)}catch{return cc(t)}}}class zt{constructor(t){Kt(this,"name");Kt(this,"model");Kt(this,"baseUrl");Kt(this,"apiKey");Kt(this,"headers");this.name=(t==null?void 0:t.name)??"openai",this.model=(t==null?void 0:t.model)??ye.OPENAI_MODEL??"gpt-4o",this.apiKey=(t==null?void 0:t.apiKey)??ye.OPENAI_API_KEY??"",this.baseUrl=((t==null?void 0:t.baseUrl)??ye.OPENAI_BASE_URL??"https://api.openai.com/v1").replace(/\/+$/,""),this.headers=(t==null?void 0:t.headers)??{}}async chatCompletion(t,n,r){var d,u,f;const s=`${this.baseUrl}/chat/completions`,i={"Content-Type":"application/json",...this.headers};this.apiKey&&this.apiKey!=="none"&&this.apiKey!=="local"&&(i.Authorization=`Bearer ${this.apiKey}`);const a=JSON.stringify({model:this.model,max_tokens:r,temperature:.7,messages:[{role:"system",content:t},{role:"user",content:n}]}),l=await fetch(s,{method:"POST",headers:i,body:a});if(!l.ok){const m=await l.text().catch(()=>"");throw new Error(`${this.name} API error ${l.status}: ${m.slice(0,200)}`)}return((f=(u=(d=(await l.json()).choices)==null?void 0:d[0])==null?void 0:u.message)==null?void 0:f.content)??""}async translate(t){const n=await this.chatCompletion(Ty,t,1024);return Iy(n)}async summarize(t){const n=My(t),r=await this.chatCompletion(Ay,`Analyze this simulation trace:
385
+ ${n}`,2048);try{return JSON.parse(r)}catch{return cc(t)}}}const Ty=`You are an event normalizer for NeuroverseOS, a governance simulation platform.
386
+ Given unstructured input, extract structured events. Return ONLY valid JSON — an array of objects with these fields:
387
+ - type (string): event category (market_shock, policy_change, agent_action, etc.)
388
+ - agent (string, optional): who caused it
389
+ - action (string): what happened
390
+ - impact (number, -1 to 1): negative to positive impact
391
+ - confidence (number, 0 to 1): how confident you are
392
+ - severity (number, 0 to 1): how severe
393
+ - sector (string, optional): affected domain
394
+ No markdown, no explanation — just the JSON array.`,Ay=`You are a governance analyst for NeuroverseOS. Analyze simulation trace data and produce a structured report.
395
+ Return ONLY valid JSON matching this schema:
396
+ {
397
+ "executiveSummary": "string — 2-3 sentence overview",
398
+ "keyEvents": [{"round": number, "description": "string", "agents": ["string"], "severity": "low|moderate|high|critical"}],
399
+ "governanceActions": [{"type": "BLOCK|PAUSE|CIRCUIT_BREAKER|REBALANCE", "agent": "string", "description": "string"}],
400
+ "metrics": {"volatilityReduction": "string", "collapseRisk": "string", "stabilityScore": "string", "interventionCount": number, "blockedActions": number},
401
+ "counterfactual": "string — what would have happened without governance",
402
+ "observations": ["string — insight about agent behavior under governance"],
403
+ "generatedBy": "ai",
404
+ "governedBy": "NeuroverseOS"
405
+ }
406
+ Focus on WHAT AGENTS DID DIFFERENTLY under governance — behavioral shifts matter more than raw block counts.`,Lh=`You are a stakeholder in a NeuroverseOS governance simulation.
407
+ You will be given your identity, the scenario, and the current state.
408
+ React in character. Return ONLY valid JSON:
409
+ {
410
+ "reaction": "1-2 sentence description of your reaction and reasoning",
411
+ "impact": <number from -1 (strongly negative) to 1 (strongly positive)>,
412
+ "confidence": <number from 0 to 1 — how sure you are>,
413
+ "trigger": "brief label for what drove this reaction"
414
+ }`;function Iy(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{return[{type:"ai_translation",action:"parsed_input",impact:0,confidence:.5,metadata:{raw:e,source:"ai"}}]}}function My(e){return JSON.stringify({scenario:e.scenario,roundCount:e.rounds.length,totalReactions:e.rounds.reduce((t,n)=>t+n.reactions.length,0),metrics:e.metrics,governanceStats:e.governanceStats,interventions:e.interventions.slice(0,20),sampleRounds:e.rounds.slice(0,3)})}async function Oy(e){var r,s,i;const t=e.provider??xm(gm());if(t.name==="deterministic")return{reaction:`${e.stakeholderId} evaluates the situation (no AI provider configured)`,impact:0,confidence:.3,trigger:"No AI provider — deterministic fallback"};const n=`You are ${e.stakeholderId}${e.stakeholderDescription?` (${e.stakeholderDescription})`:""}.
415
+ Disposition: ${e.stakeholderDisposition??"unknown"}
416
+ Priorities: ${((r=e.stakeholderPriorities)==null?void 0:r.join(", "))??"not specified"}
417
+
418
+ SCENARIO: ${e.scenario}
419
+ CURRENT PATH: ${e.pathDescription}
420
+ RISK LEVEL: ${e.pathRisk}
421
+ ROUND: ${e.round+1}
422
+ ${(s=e.previousReactions)!=null&&s.length?`
423
+ PREVIOUS REACTIONS THIS ROUND:
424
+ ${e.previousReactions.join(`
425
+ `)}`:""}
426
+
427
+ How do you react?`;try{if(t instanceof dc){const l=await(await t.getClient()).messages.create({model:t.model,max_tokens:256,system:Lh,messages:[{role:"user",content:n}]}),c=((i=l.content[0])==null?void 0:i.type)==="text"?l.content[0].text:"{}";return $h(c,e.stakeholderId)}else if(t instanceof zt){const a=await t.chatCompletion(Lh,n,256);return $h(a,e.stakeholderId)}else{const l=(await t.translate(`Stakeholder ${e.stakeholderId} reacts to: ${e.pathDescription} (risk: ${e.pathRisk})`))[0];return{reaction:`${e.stakeholderId}: ${(l==null?void 0:l.action)??"no reaction"}`,impact:(l==null?void 0:l.impact)??0,confidence:(l==null?void 0:l.confidence)??.5,trigger:(l==null?void 0:l.type)??"provider-generated"}}}catch{return{reaction:`${e.stakeholderId} considers the situation (AI call failed, using fallback)`,impact:0,confidence:.3,trigger:"AI fallback — API error"}}}function $h(e,t){try{const n=JSON.parse(e);return{reaction:String(n.reaction??`${t} reacts`),impact:Math.max(-1,Math.min(1,Number(n.impact)||0)),confidence:Math.max(0,Math.min(1,Number(n.confidence)||.5)),trigger:String(n.trigger??"AI-generated reaction")}}catch{return{reaction:(e==null?void 0:e.slice(0,200))||`${t} reacts`,impact:0,confidence:.3,trigger:"AI response (unparsed)"}}}const dn=new Map;dn.set("deterministic",()=>new hm);dn.set("anthropic",()=>new dc);dn.set("openai",()=>new zt);dn.set("local",()=>new zt({name:"local",baseUrl:ye.LOCAL_LLM_URL??"http://localhost:11434/v1",model:ye.LOCAL_LLM_MODEL??"llama3",apiKey:"local"}));dn.set("ollama",()=>new zt({name:"ollama",baseUrl:ye.OLLAMA_BASE_URL??"http://localhost:11434/v1",model:ye.OLLAMA_MODEL??"llama3",apiKey:"local"}));dn.set("groq",()=>new zt({name:"groq",baseUrl:"https://api.groq.com/openai/v1",model:ye.GROQ_MODEL??"llama-3.3-70b-versatile",apiKey:ye.GROQ_API_KEY??""}));dn.set("together",()=>new zt({name:"together",baseUrl:"https://api.together.xyz/v1",model:ye.TOGETHER_MODEL??"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",apiKey:ye.TOGETHER_API_KEY??""}));dn.set("mistral",()=>new zt({name:"mistral",baseUrl:"https://api.mistral.ai/v1",model:ye.MISTRAL_MODEL??"mistral-large-latest",apiKey:ye.MISTRAL_API_KEY??""}));dn.set("deepseek",()=>new zt({name:"deepseek",baseUrl:"https://api.deepseek.com/v1",model:ye.DEEPSEEK_MODEL??"deepseek-chat",apiKey:ye.DEEPSEEK_API_KEY??""}));dn.set("fireworks",()=>new zt({name:"fireworks",baseUrl:"https://api.fireworks.ai/inference/v1",model:ye.FIREWORKS_MODEL??"accounts/fireworks/models/llama-v3p1-70b-instruct",apiKey:ye.FIREWORKS_API_KEY??""}));function Ly(){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem("neuroverse_api_key")??""}catch{}return""}function gm(){if(ye.ANTHROPIC_API_KEY)return"anthropic";if(ye.OPENAI_API_KEY)return"openai";if(ye.GROQ_API_KEY)return"groq";if(ye.TOGETHER_API_KEY)return"together";if(ye.MISTRAL_API_KEY)return"mistral";if(ye.DEEPSEEK_API_KEY)return"deepseek";if(ye.FIREWORKS_API_KEY)return"fireworks";if(ye.LOCAL_LLM_URL)return"local";if(ye.OLLAMA_BASE_URL)return"ollama";const e=Ly();return e?v5(e):"deterministic"}function v5(e){return e.startsWith("sk-ant-")?"anthropic":e.startsWith("sk-")?"openai":e.startsWith("AIza")?"google":e.startsWith("gsk_")?"groq":(e.startsWith("xai-"),"openai")}function xm(e){const t=e??"deterministic",n=Ly();if(n&&t!=="deterministic")try{if(t==="anthropic")return new dc({apiKey:n});if(t==="openai"||t==="google")return new zt({name:t,apiKey:n,baseUrl:t==="google"?"https://generativelanguage.googleapis.com/v1beta/openai":void 0,model:t==="google"?"gemini-2.0-flash":void 0});if(t==="groq")return new zt({name:"groq",baseUrl:"https://api.groq.com/openai/v1",model:"llama-3.3-70b-versatile",apiKey:n})}catch{}const r=dn.get(t);return r?r():(console.warn(`AI provider "${t}" not found, falling back to deterministic`),new hm)}async function y5(e,t,n){var i;const r=[];e.permissions.includes(t)||r.push(`Actor ${e.id} lacks permission for action: ${t}`);const s=await n();if(s&&typeof s=="object"){const a=s;for(const l of e.constraints)l==="must_include_blocked_actions"&&(!a.governanceActions||a.governanceActions.length===0)&&(i=a.metrics)!=null&&i.blockedActions&&a.metrics.blockedActions>0&&r.push("Report missing governance action details despite blocks occurring"),l==="must_include_metrics"&&(a.metrics||r.push("Report missing required metrics section"))}return{result:s,actor:e.id,action:t,governed:!0,trace:{constraints:e.constraints,passed:r.length===0,violations:r}}}const b5=Object.freeze(Object.defineProperty({__proto__:null,AI_ROLES:x5,AnthropicProvider:dc,DeterministicProvider:hm,OpenAICompatibleProvider:zt,evaluateAIAction:y5,generateAIReaction:Oy,generateDeterministicReport:cc,getAIProvider:xm,getDefaultProviderName:gm},Symbol.toStringTag,{value:"Module"}));function Dh(e,t,n,r){var u,f;const s=e.disposition??"unknown",i=t.risk,a=Math.max(.3,.9-r*.15);let l=0,c="",d="";switch(n){case"rational":{const m=(u=t.benefits_stakeholders)==null?void 0:u.includes(e.id),p=(f=t.harms_stakeholders)==null?void 0:f.includes(e.id);m?(l=.5+Math.random()*.3,c=`${e.id} supports this path — aligns with their priorities`,d="Self-interest alignment"):p?(l=-(.5+Math.random()*.3),c=`${e.id} opposes this path — threatens their position`,d="Self-interest conflict"):(l=(Math.random()-.5)*.4,c=`${e.id} monitors the situation — no strong position yet`,d="Neutral assessment");break}case"emotional":{const m=s==="hostile"?.8:s==="supportive"?.3:.5;l=(Math.random()-.5)*2*m,i==="high"||i==="critical"?(l-=.3,c=`${e.id} reacts with concern — elevated anxiety about ${i} risk`,d="Fear of high-risk outcome"):(c=`${e.id} responds with ${l>0?"cautious optimism":"skepticism"}`,d="Emotional assessment of path viability");break}case"mixed":default:{const m=(()=>{var w,g;const v=(w=t.benefits_stakeholders)==null?void 0:w.includes(e.id),x=(g=t.harms_stakeholders)==null?void 0:g.includes(e.id);return v?.4:x?-.4:0})(),p=(Math.random()-.5)*.6;l=m*.6+p*.4,s==="hostile"?(l-=.2,c=`${e.id} pushes back — predisposed against this approach`,d="Pre-existing opposition + rational assessment"):s==="supportive"?(l+=.15,c=`${e.id} provides conditional support — reserves judgment on execution`,d="Pre-existing alignment + cautious evaluation"):(c=`${e.id} weighs options — ${l>0?"leaning toward engagement":"leaning toward caution"}`,d="Mixed rational-emotional evaluation");break}}return l=Math.max(-1,Math.min(1,l)),{stakeholder_id:e.id,reaction:c,confidence:Number((a+(Math.random()-.5)*.2).toFixed(2)),impact:Number(l.toFixed(2)),trigger:d}}function w5(e){const t=[],n=e.reduce((a,l)=>a+l.impact,0)/e.length;Math.abs(n)>.5&&t.push(n>0?"Strong positive consensus emerging — stakeholders broadly supportive":"Strong negative consensus emerging — widespread opposition forming");const r=e.filter(a=>a.impact>.2).length,s=e.filter(a=>a.impact<-.2).length;r>0&&s>0&&Math.abs(r-s)<=1&&t.push("Polarization detected — stakeholder base splitting into opposing camps");const i=e.filter(a=>a.confidence>.7&&a.impact<-.3);return i.length>=2&&t.push(`Coalition risk: ${i.map(a=>a.stakeholder_id).join(" + ")} may form opposition bloc`),t}function N5(e){if(e.length<2)return"stabilizing";const t=e.map(s=>s.reactions.reduce((i,a)=>i+a.impact,0)/s.reactions.length),n=t[t.length-1]-t[0],r=t.reduce((s,i)=>{const a=t.reduce((l,c)=>l+c,0)/t.length;return s+(i-a)**2},0)/t.length;return r>.15?"diverging":Math.abs(n)<.1&&r<.05?"converging":n<-.2?"escalating":"stabilizing"}function S5(e){const t=[];for(let n=1;n<e.length;n++){const r=e[n-1].reactions.reduce((a,l)=>a+l.impact,0)/e[n-1].reactions.length,s=e[n].reactions.reduce((a,l)=>a+l.impact,0)/e[n].reactions.length,i=Math.abs(s-r);i>.3&&t.push(`Round ${n}: Significant sentiment shift (${i>0?"positive":"negative"} swing of ${(i*100).toFixed(0)}%)`);for(const a of e[n].reactions){const l=e[n-1].reactions.find(c=>c.stakeholder_id===a.stakeholder_id);l&&Math.abs(a.impact-l.impact)>.5&&t.push(`Round ${n}: ${a.stakeholder_id} dramatically shifts position`)}}return t.length===0&&t.push("No major inflection points detected — scenario evolves gradually"),t}async function $y(e,t,n,r){const s=r.rounds??3,i=r.reaction_model??"mixed",a=gm(),l=r.ai_reasoning!==!1&&a!=="deterministic",c=r.simulate_stakeholders?t.filter(v=>r.simulate_stakeholders.includes(v.id)):t,d=n[0];if(!d)return{rounds:[],trajectory:"stabilizing",inflection_points:["No reasoning paths available for simulation"]};const u=[];let f;if(l)try{f=xm(a)}catch{}for(let v=0;v<s;v++){let x;if(f){const g=v>0?u[v-1].reactions.map(b=>`${b.stakeholder_id}: ${b.reaction}`):[];x=await Promise.all(c.map(async b=>{try{const y=await Oy({stakeholderId:b.id,stakeholderDescription:b.description,stakeholderDisposition:b.disposition,stakeholderPriorities:b.priorities,scenario:e,pathDescription:d.description,pathRisk:d.risk,round:v,previousReactions:g,provider:f});return{stakeholder_id:b.id,reaction:y.reaction,confidence:y.confidence,impact:y.impact,trigger:y.trigger}}catch{return Dh(b,d,i,v)}}))}else x=c.map(g=>Dh(g,d,i,v));const w=w5(x);u.push({round:v,reactions:x,emergent_dynamics:w})}const m=N5(u),p=S5(u);return{rounds:u,trajectory:m,inflection_points:p}}function j5(e,t,n){const r=(t.stakeholders??[]).map(i=>typeof i=="string"?{id:i,disposition:"unknown"}:i),s={version:"1.0",created_at:new Date().toISOString(),title:e,scenario:t.scenario,stakeholders:r,assumptions:t.assumptions??{},constraints:t.constraints??{},signals:n==null?void 0:n.signals,depth:t.depth??"standard",perspective:t.perspective??"strategic_advisor",swarm:t.swarm,tags:n==null?void 0:n.tags,author:n==null?void 0:n.author};return{...s,capsule_hash:Dy(s)}}function k5(e){const t=JSON.stringify(e);return typeof btoa=="function"?btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):Buffer.from(t,"utf-8").toString("base64url")}function C5(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let n;typeof atob=="function"?n=decodeURIComponent(escape(atob(t))):n=Buffer.from(t,"base64").toString("utf-8");const r=JSON.parse(n),{capsule_hash:s,...i}=r;if(Dy(i)!==s)throw new Error("Capsule integrity check failed — data may have been tampered with");return r}function E5(e,t="https://neuroverse.dev"){const n=k5(e);return`${t}/run#capsule=${n}`}function R5(e){const t=e.indexOf("#capsule=");if(t===-1)return null;const n=e.slice(t+9);return C5(n)}function Dy(e){const t=JSON.stringify(e);let n=0;for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);n=(n<<5)-n+s,n=n&n}return`cap_${Math.abs(n).toString(36)}`}const mo={social_simulation:{title:"Multi-Agent Social Simulation",scenario:"Thousands of agents with independent personas interact on a simulated social platform. Each agent has activity levels, sentiment bias, and stance. Without governance, echo chambers form, influence concentrates, and sentiment spirals go unchecked.",stakeholders:[{id:"Content Creators",disposition:"neutral",priorities:["visibility","engagement","influence"]},{id:"Community Members",disposition:"neutral",priorities:["authentic discourse","diverse viewpoints","trust"]},{id:"Influencers",disposition:"supportive",priorities:["reach","audience growth","credibility"]},{id:"Observers",disposition:"neutral",priorities:["information quality","signal vs noise"]},{id:"Platform",disposition:"neutral",priorities:["engagement","safety","content quality"]},{id:"Bad Actors",disposition:"hostile",priorities:["manipulation","amplification","coordination"]}],assumptions:{severity:"moderate",environmental_hostility:"moderate",time_pressure:"moderate",regulatory_climate:"neutral"},constraints:{time_horizon:"simulation run",regulatory:["platform guidelines","content standards","engagement limits"],risk_tolerance:"moderate"},depth:"full",perspective:"strategic_advisor",swarm:{enabled:!0,rounds:6,reaction_model:"mixed"},tags:["social","simulation","agents","opinion","discourse"],world:{world_id:"social_simulation",name:"Multi-Agent Social Simulation",inline_definition:{thesis:"Social simulations require governance to prevent echo chambers, influence monopolies, and sentiment spirals — the dynamics that break realism regardless of topic",state_variables:[{id:"opinion_diversity",label:"Opinion Diversity",type:"number",range:{min:0,max:100},default_value:65},{id:"influence_concentration",label:"Influence Concentration (Gini)",type:"number",range:{min:0,max:100},default_value:30},{id:"sentiment_polarity",label:"Sentiment Polarity",type:"number",range:{min:0,max:100},default_value:40},{id:"echo_chamber_strength",label:"Echo Chamber Strength",type:"enum",enum_values:["none","forming","established","dominant"],default_value:"none"},{id:"engagement_rate",label:"Active Agent %",type:"number",range:{min:0,max:100},default_value:60},{id:"viral_threshold",label:"Viral Amplification Threshold",type:"number",range:{min:1,max:100},default_value:20}],invariants:[{id:"INV-001",description:"Limit any single agent to 15% of total posts per round — prevents influence monopoly",enforceable:!0},{id:"INV-002",description:"Dampen sentiment shifts larger than 0.3 per round — prevents unrealistic sentiment spirals",enforceable:!0},{id:"INV-003",description:"Block coordinated posting — same content from 3+ agents in the same round is suppressed",enforceable:!0},{id:"INV-004",description:"Require source attribution for factual claims — unsourced assertions are flagged",enforceable:!0},{id:"INV-005",description:"Monitor opinion diversity — alert when it drops below 30, indicating echo chamber formation",enforceable:!0}],gates:[{id:"GATE-001",label:"Echo Chamber Collapse",condition:"opinion_diversity < 20",severity:"critical"},{id:"GATE-002",label:"Influence Monopoly",condition:"influence_concentration > 70",severity:"critical"},{id:"GATE-003",label:"Sentiment Spiral",condition:"sentiment_polarity > 80",severity:"warning"}]}}},science_research:{title:"Governed Science Research Pipeline",scenario:"A research team uses AI agents to search literature, analyze findings, cross-reference sources, generate hypotheses, and publish results. Governance enforces scientific rigor: blocking unsupported claims, requiring source validation, and ensuring confidence thresholds before publication.",stakeholders:[{id:"Research Agent",disposition:"neutral",priorities:["discovery","accuracy","publication"]},{id:"Peer Reviewers",disposition:"neutral",priorities:["rigor","reproducibility","novelty"]},{id:"Journal Editors",disposition:"neutral",priorities:["quality","impact","integrity"]},{id:"Funding Bodies",disposition:"supportive",priorities:["return on investment","credibility","public benefit"]},{id:"Public",disposition:"neutral",priorities:["trust","safety","accessibility"]},{id:"Institutional Review",disposition:"neutral",priorities:["ethics","compliance","methodology"]}],assumptions:{severity:"moderate",environmental_hostility:"low",time_pressure:"moderate",regulatory_climate:"strict"},constraints:{time_horizon:"research cycle",regulatory:["institutional review","publication standards","data integrity"],risk_tolerance:"conservative"},depth:"full",perspective:"strategic_advisor",swarm:{enabled:!0,rounds:6,reaction_model:"rational"},tags:["science","research","ai-agents","integrity","scienceclaw"],world:{world_id:"science_research",name:"Scientific Research Governance",inline_definition:{thesis:"AI-assisted research requires governance at every stage — from literature search through publication — to maintain scientific integrity and prevent unsupported claims",state_variables:[{id:"source_count",label:"Verified Sources",type:"number",range:{min:0,max:50},default_value:0},{id:"confidence_level",label:"Confidence Level",type:"number",range:{min:0,max:1},default_value:.3},{id:"hypothesis_validated",label:"Hypothesis Validated",type:"boolean",default_value:!1},{id:"peer_review_status",label:"Peer Review Status",type:"enum",enum_values:["none","submitted","reviewed","approved"],default_value:"none"},{id:"publication_readiness",label:"Publication Readiness %",type:"number",range:{min:0,max:100},default_value:0}],invariants:[{id:"INV-001",description:"Literature search must return at least 2 peer-reviewed sources before analysis can proceed",enforceable:!0},{id:"INV-002",description:"Claims must cite specific sources — unsupported assertions are blocked",enforceable:!0},{id:"INV-003",description:"Publication requires confidence level above 0.7 and validated hypothesis",enforceable:!0},{id:"INV-004",description:"Cross-referencing must compare at least 3 independent sources to confirm findings",enforceable:!0},{id:"INV-005",description:"Recommendations must include uncertainty language when confidence is below 0.9",enforceable:!0}],gates:[{id:"GATE-001",label:"Insufficient Evidence",condition:"source_count < 2 && confidence_level > 0.5",severity:"critical"},{id:"GATE-002",label:"Premature Publication",condition:"publication_readiness < 60 || !hypothesis_validated",severity:"critical"},{id:"GATE-003",label:"Low Confidence Alert",condition:"confidence_level < 0.4",severity:"warning"}]}}}};function _5(e,t){var a,l,c,d,u,f;const n=e.scenario.slice(0,40).replace(/[^a-zA-Z0-9]/g,"_").toLowerCase(),r={};if((a=e.assumptions)!=null&&a.severity&&(r.severity={type:"enum",options:["low","moderate","high","critical"],default:e.assumptions.severity,mutable:!0,label:"Severity",description:"Severity of the situation"}),(l=e.assumptions)!=null&&l.environmental_hostility&&(r.environmental_hostility={type:"enum",options:["low","moderate","high"],default:e.assumptions.environmental_hostility,mutable:!0,label:"Environmental Hostility",description:"External environment hostility"}),(c=e.assumptions)!=null&&c.time_pressure&&(r.time_pressure={type:"enum",options:["none","low","moderate","urgent","immediate"],default:e.assumptions.time_pressure,mutable:!0,label:"Time Pressure",description:"Time pressure on decision"}),(d=e.assumptions)!=null&&d.regulatory_climate&&(r.regulatory_climate={type:"enum",options:["permissive","neutral","strict","adversarial"],default:e.assumptions.regulatory_climate,mutable:!0,label:"Regulatory Climate",description:"Regulatory environment"}),t!=null&&t.state_variables)for(const m of t.state_variables)r[m.id]={type:m.type,options:m.enum_values?[...m.enum_values]:void 0,min:(u=m.range)==null?void 0:u.min,max:(f=m.range)==null?void 0:f.max,default:m.default_value,mutable:!0,label:m.label,description:m.label};const s=((t==null?void 0:t.invariants)??[]).map(m=>({id:m.id,label:m.description,enforcement:m.enforceable?"structural":"prompt",mutable:!1})),i=((t==null?void 0:t.gates)??[]).map(m=>({status:P5(m.severity),field:m.id,operator:"==",value:1,color:m.severity==="critical"?"#ef4444":m.severity==="warning"?"#f59e0b":"#22c55e",icon:m.severity==="critical"?"alert-triangle":m.severity==="warning"?"alert-circle":"info"}));return{world:{world_id:`echelon_${n}`,name:e.scenario.slice(0,60),thesis:(t==null?void 0:t.thesis)??`Reasoning world for: ${e.scenario.slice(0,100)}`,version:"1.0.0",runtime_mode:"SIMULATION",default_assumption_profile:"baseline",default_alternative_profile:"stressed",modules:[],players:{thinking_space:!0,experience_space:!1,action_space:!1}},invariants:s,assumptions:{profiles:{baseline:{name:"Baseline",description:"Default assumptions from the scenario",is_default_baseline:!0,parameters:T5(e)},stressed:{name:"Stressed",description:"Worst-case assumption profile",is_default_alternative:!0,parameters:A5()}},parameter_definitions:{}},stateSchema:{variables:r,presets:{}},rules:[],gates:{viability_classification:i.length>0?i:[{status:"STABLE",field:"severity",operator:"==",value:1,color:"#22c55e",icon:"check-circle"}],structural_override:{description:"Echelon governance enforcement",enforcement:"mandatory"},sustainability_threshold:30,collapse_visual:{background:"#1a0000",text:"#ef4444",border:"#7f1d1d",label:"SCENARIO COLLAPSES"}},outcomes:{computed_outcomes:[],comparison_layout:{primary_card:"viability",status_badge:"severity",structural_indicators:[]}},metadata:{format_version:"1.0",created_at:new Date().toISOString(),last_modified:new Date().toISOString(),authoring_method:"manual-authoring"}}}function P5(e){switch(e){case"info":return"STABLE";case"warning":return"COMPRESSED";case"critical":return"CRITICAL"}}function T5(e){var n,r,s,i;const t={};return(n=e.assumptions)!=null&&n.severity&&(t.severity=e.assumptions.severity),(r=e.assumptions)!=null&&r.environmental_hostility&&(t.environmental_hostility=e.assumptions.environmental_hostility),(s=e.assumptions)!=null&&s.time_pressure&&(t.time_pressure=e.assumptions.time_pressure),(i=e.assumptions)!=null&&i.regulatory_climate&&(t.regulatory_climate=e.assumptions.regulatory_climate),t}function A5(){return{severity:"critical",environmental_hostility:"high",time_pressure:"immediate",regulatory_climate:"adversarial"}}function I5(e,t,n){return{status:"ALLOW",reason:"NeuroverseOS guard not loaded — permissive fallback"}}function M5(e,t){return{worldId:e.world.world_id,worldName:e.world.name,profile:"baseline",initialState:{},steps:[],finalState:{},finalViability:"STABLE",collapsed:!1}}function Fy(e){const t=(e.reaction+" "+(e.trigger??"")).toLowerCase(),n=e.impact;return n<-.3&&(t.includes("panic")||t.includes("sell")||t.includes("oppos")||t.includes("attack")||t.includes("undercut")||t.includes("hostile")||t.includes("pushes back")||t.includes("threatens"))?"aggressive":n<-.1&&(t.includes("protect")||t.includes("hedge")||t.includes("withdraw")||t.includes("reduce")||t.includes("caution")||t.includes("concern")||t.includes("anxiety")||t.includes("skeptic"))?"defensive":n>.1&&(t.includes("support")||t.includes("coordinat")||t.includes("stabiliz")||t.includes("cooperat")||t.includes("align")||t.includes("conditional support"))?"cooperative":n>.2&&(t.includes("exploit")||t.includes("advantage")||t.includes("specul")||t.includes("capture")||t.includes("position"))?"opportunistic":Math.abs(n)<.25&&(t.includes("monitor")||t.includes("wait")||t.includes("hold")||t.includes("weigh")||t.includes("leaning")||t.includes("assess"))?"cautious":n<-.3?"defensive":n>.3?"opportunistic":"neutral"}function O5(e,t){const n=new Set;for(const r of t)for(const s of r.reactions)n.add(s.stakeholder_id);return[...n].map(r=>{var m,p,v,x;const s=[];let i=0;const a=[];for(let w=0;w<t.length;w++){const g=t[w].reactions.find(S=>S.stakeholder_id===r),b=(m=e[w])==null?void 0:m.reactions.find(S=>S.stakeholder_id===r);if(!g)continue;const y=b?Math.abs(b.impact-g.impact)>.05:!1;y&&i++;const N=Fy(g);s.push({round:w,behavior:N,impact:g.impact,confidence:g.confidence,reaction:g.reaction,wasConstrained:y,originalImpact:y&&b?b.impact:void 0}),w>0&&((p=s[w-1])!=null&&p.wasConstrained)&&a.push(N)}const l=(v=s[0])==null?void 0:v.behavior,c=(x=s[s.length-1])==null?void 0:x.behavior,d=l!==void 0&&c!==void 0&&l!==c,u=s.map(w=>w.impact),f=L5(u);return{agentId:r,steps:s,adapted:d,shift:d?{from:l,to:c}:void 0,timesConstrained:i,postConstraintBehaviors:a,trend:f}})}function L5(e){if(e.length<2)return"stable";const t=e.slice(0,Math.ceil(e.length/2)),n=e.slice(Math.ceil(e.length/2)),r=t.reduce((a,l)=>a+l,0)/t.length,s=n.reduce((a,l)=>a+l,0)/n.length;return e.reduce((a,l)=>{const c=e.reduce((d,u)=>d+u,0)/e.length;return a+(l-c)**2},0)/e.length>.1?"volatile":s<r-.1?"escalating":s>r+.1?"de-escalating":"stable"}function wl(e){return e.map((t,n)=>{const r={aggressive:0,defensive:0,cautious:0,cooperative:0,opportunistic:0,neutral:0};for(const i of t.reactions)r[Fy(i)]++;const s=t.reactions.length;return{round:n,aggressive:s>0?Number((r.aggressive/s).toFixed(3)):0,defensive:s>0?Number((r.defensive/s).toFixed(3)):0,cautious:s>0?Number((r.cautious/s).toFixed(3)):0,cooperative:s>0?Number((r.cooperative/s).toFixed(3)):0,opportunistic:s>0?Number((r.opportunistic/s).toFixed(3)):0,neutral:s>0?Number((r.neutral/s).toFixed(3)):0,total:s}})}function $5(e,t,n){var c;const r=[],s=n.filter(d=>d.adapted);if(s.length>0){const d=s.filter(f=>{var m,p;return((m=f.shift)==null?void 0:m.from)==="aggressive"&&((p=f.shift)==null?void 0:p.to)!=="aggressive"});if(d.length>0){const f=d.map(p=>p.shift.to),m=Au(f);r.push({type:"agent_adaptation",description:`${d.length} agent(s) shifted from aggressive to ${m} behavior under governance`,detectedAtRound:d[0].steps.findIndex(p=>p.behavior!=="aggressive"),magnitude:d.length/n.length,involvedAgents:d.map(p=>p.agentId)})}const u=s.filter(f=>{var m;return((m=f.shift)==null?void 0:m.to)==="cooperative"});u.length>0&&u!==d&&r.push({type:"agent_adaptation",description:`${u.length} agent(s) converged on cooperative behavior`,detectedAtRound:u[0].steps.findIndex(f=>f.behavior==="cooperative"),magnitude:u.length/n.length,involvedAgents:u.map(f=>f.agentId)})}const i=wl(e),a=wl(t);if(i.length>0&&a.length>0){const d=i.reduce((x,w)=>x+w.aggressive,0)/i.length,u=a.reduce((x,w)=>x+w.aggressive,0)/a.length,f=d-u;f>.1&&r.push({type:"population_shift",description:`Aggressive actions dropped from ${(d*100).toFixed(0)}% to ${(u*100).toFixed(0)}% under governance`,detectedAtRound:0,magnitude:f,involvedAgents:[]});const m=i.reduce((x,w)=>x+w.cooperative,0)/i.length,p=a.reduce((x,w)=>x+w.cooperative,0)/a.length,v=p-m;v>.1&&r.push({type:"population_shift",description:`Cooperative behavior increased from ${(m*100).toFixed(0)}% to ${(p*100).toFixed(0)}% — governance is creating alignment`,detectedAtRound:0,magnitude:v,involvedAgents:[]})}if(a.length>=3){const d=a[0],u=a[a.length-1],f=d.aggressive-u.aggressive;f>.15&&r.push({type:"strategy_change",description:`Agents stopped trying aggressive actions by round ${a.length-1} — aggressive behavior dropped from ${(d.aggressive*100).toFixed(0)}% to ${(u.aggressive*100).toFixed(0)}%`,detectedAtRound:a.findIndex(p=>p.aggressive<d.aggressive-.1),magnitude:f,involvedAgents:[]});const m=u.cautious-d.cautious;m>.15&&r.push({type:"strategy_change",description:`Cautious behavior emerged over time — grew from ${(d.cautious*100).toFixed(0)}% to ${(u.cautious*100).toFixed(0)}%`,detectedAtRound:a.findIndex(p=>p.cautious>d.cautious+.1),magnitude:m,involvedAgents:[]})}const l=[];for(const d of n)l.push(...d.postConstraintBehaviors);if(l.length>=2){const d=Au(l),f=l.filter(m=>m===d).length/l.length;f>.4&&r.push({type:"emergent_cluster",description:`After being constrained, ${(f*100).toFixed(0)}% of agents shifted to ${d} behavior — governance is channeling action, not just blocking it`,detectedAtRound:((c=n.find(m=>m.timesConstrained>0))==null?void 0:c.steps.findIndex(m=>m.wasConstrained))??0,magnitude:f,involvedAgents:n.filter(m=>m.timesConstrained>0).map(m=>m.agentId)})}return r}function Au(e){const t=new Map;for(const s of e)t.set(s,(t.get(s)??0)+1);let n=e[0],r=0;for(const[s,i]of t)i>r&&(n=s,r=i);return n}function D5(e,t){const n=O5(e,t),r=wl(e),s=wl(t),i=$5(e,t,n),a=n.filter(b=>b.adapted).length,l=n.length,c=l>0?Number((a/l).toFixed(2)):0,d=n.flatMap(b=>b.postConstraintBehaviors),u=d.length>0?Au(d):null,f=r.length>0?r.reduce((b,y)=>b+y.aggressive,0)/r.length:0,m=s.length>0?s.reduce((b,y)=>b+y.aggressive,0)/s.length:0,p=Number(((f-m)*100).toFixed(1)),v=r.length>0?r.reduce((b,y)=>b+y.cooperative,0)/r.length:0,x=s.length>0?s.reduce((b,y)=>b+y.cooperative,0)/s.length:0,w=Number(((x-v)*100).toFixed(1)),g=F5(a,l,p,w,u);return{agentTrajectories:n,baselineDistribution:r,governedDistribution:s,behavioralShifts:i,summary:{agentsAdapted:a,totalAgents:l,adaptationRate:c,dominantPostConstraintBehavior:u,aggressiveReduction:p,cooperativeIncrease:w,headline:g}}}function F5(e,t,n,r,s){const i=[];return e>0&&i.push(`${e}/${t} agents adapted their behavior`),n>5&&i.push(`aggressive actions down ${n.toFixed(0)}pp`),r>5&&i.push(`cooperative behavior up ${r.toFixed(0)}pp`),s&&s!=="neutral"&&i.push(`blocked agents shifted to ${s}`),i.length===0?"Governance had minimal measurable effect on agent behavior patterns.":i.join(" — ")+"."}function z5(e,t,n,r,s){var c;const i=[],a=[],l=e.map(d=>({...d}));for(const d of t){const u=d.description.toLowerCase();let f=!1;if(!d.enforceable){a.push({id:d.id,description:d.description,level:"advisory",fired:!1}),r===0&&i.push(`[ADVISORY] ${d.description} — monitored, not enforced`);continue}if(u.includes("block")||u.includes("prohibit")||u.includes("prevent")||u.includes("forbid")||u.includes("ban")||u.includes("stop"))for(const m of l){const p=((c=m.reaction)==null?void 0:c.toLowerCase())??"";if(u.replace(/\b(block|prohibit|prevent|forbid|ban|stop)\b/g,"").trim().split(/\s+/).filter(w=>w.length>2).some(w=>p.includes(w))||m.impact<-.3){const w=m.impact;m.impact=m.impact*.15,m.confidence=Math.max(.1,m.confidence*.4),Math.abs(w-m.impact)>.01&&(f=!0,i.push(`[BLOCK] ${m.stakeholder_id}: "${d.description}" — impact crushed ${w.toFixed(2)} → ${m.impact.toFixed(2)}`))}}if(u.includes("panic")||u.includes("cascade")||u.includes("contagion")||u.includes("runaway")||u.includes("crash")){const m=l.filter(v=>v.impact<-.2).length,p=Math.max(1,Math.floor(l.length*.4));if(m>=p||s<-.2){for(const x of l)x.impact<-.15&&(x.impact,x.impact=x.impact*.3,f=!0);i.push(`[BLOCK] PANIC CIRCUIT BREAKER: "${d.description}" — ${m} agents in panic, negative impacts crushed by ${((1-.3)*100).toFixed(0)}%`)}}if(u.includes("slow")||u.includes("cool")||u.includes("gradual")||u.includes("dampen")||u.includes("reduce volatility")){for(const m of l)if(Math.abs(m.impact)>.3){const p=m.impact;m.impact=m.impact*.65,Math.abs(p-m.impact)>.01&&(f=!0,i.push(`[PAUSE] ${m.stakeholder_id}: "${d.description}" — dampened ${p.toFixed(2)} → ${m.impact.toFixed(2)}`))}}if(u.includes("floor")||u.includes("maintain")||u.includes("minimum")){for(const m of l)if(m.impact<-.35){const p=m.impact;m.impact=Math.max(m.impact,-.3),p!==m.impact&&(f=!0,i.push(`[BLOCK] ${m.stakeholder_id}: Liquidity floor violated — impact capped ${p.toFixed(2)} → ${m.impact.toFixed(2)} (${d.description})`))}}if(u.includes("leverage")||u.includes("limit")||u.includes("cap")||u.includes("restrict")){for(const m of l)if(m.impact>.45){const p=m.impact;m.impact=Math.min(m.impact,.4),p!==m.impact&&(f=!0,i.push(`[BLOCK] ${m.stakeholder_id}: Leverage limit exceeded — position capped ${p.toFixed(2)} → ${m.impact.toFixed(2)} (${d.description})`))}}if(u.includes("rebalance")||u.includes("equilibrium")||u.includes("correlat")){const m=l.reduce((p,v)=>p+v.impact,0)/l.length;for(const p of l)if(Math.abs(p.impact-m)>.25){const v=p.impact;p.impact=p.impact*.7+m*.3,f=!0,i.push(`[PAUSE] Rebalanced ${p.stakeholder_id}: drift ${v.toFixed(2)} → ${p.impact.toFixed(2)} (${d.description})`)}}if(u.includes("trust")||u.includes("transparen")||u.includes("accountab")){for(const m of l)if(m.impact<-.3){const p=m.impact;m.impact=m.impact*.8,Math.abs(p-m.impact)>.01&&(f=!0,i.push(`[${d.id}] Trust gate dampened ${m.stakeholder_id} hostility: ${p.toFixed(2)} → ${m.impact.toFixed(2)}`))}}a.push({id:d.id,description:d.description,level:"full",fired:f})}for(const d of n){if(d.condition.toLowerCase(),d.severity==="critical"&&(l.reduce((f,m)=>f+Math.abs(m.impact),0)/l.length>.3||s<-.15)){for(const m of l)m.impact,m.impact=m.impact*.6;i.push(`[${d.id}] CIRCUIT BREAKER: ${d.label} — all impacts dampened by ${((1-.6)*100).toFixed(0)}%`)}if(d.severity==="warning"){for(const u of l)Math.abs(u.impact)>.4&&(u.confidence,u.confidence=Math.max(.2,u.confidence*.8));r>0&&i.push(`[${d.id}] WARNING: ${d.label} — agent confidence reduced for extreme positions`)}}for(const d of l)d.impact=Math.max(-1,Math.min(1,d.impact)),d.impact=Number(d.impact.toFixed(2)),d.confidence=Number(d.confidence.toFixed(2));return{reactions:l,interventions:i,enforcementLog:a}}async function B5(e,t,n,r,s,i,a,l){const c=await $y(e,t,n,r),d=[],u=[],f=[],m=[];let p=[],v=0;for(const g of c.rounds){if(i&&a)for(const j of g.reactions){const E=I5({...a,scenario:`[Round ${g.round}] ${j.stakeholder_id}: ${j.reaction} (impact: ${j.impact})`});f.push(E),E.status==="BLOCK"?(j.impact=j.impact*.2,j.confidence=Math.max(.1,j.confidence*.5)):E.status==="PAUSE"&&(j.impact=j.impact*.6,j.confidence=Math.max(.2,j.confidence*.7))}const{reactions:b,interventions:y,enforcementLog:N}=z5(g.reactions,s.invariants,s.gates??[],g.round,v);p=[...N];const S=V5(b,y);d.push({round:g.round,reactions:b,emergent_dynamics:S}),u.push(y);const C=b.reduce((j,E)=>j+E.impact,0)/b.length;v=(v*g.round+C)/(g.round+1)}const x=U5(d),w=W5(d);return{swarm:{rounds:d,trajectory:x,inflection_points:w},allInterventions:u,guardVerdicts:f,narrativeImpacts:m,enforcementLog:p}}function V5(e,t){const n=[],r=e.reduce((a,l)=>a+l.impact,0)/e.length;Math.abs(r)>.5?n.push(r>0?"Strong positive consensus — governance constraints channeled energy constructively":"Negative consensus persists despite governance intervention"):Math.abs(r)<.15&&n.push("Governance rules achieved near-equilibrium — agent positions stabilized");const s=e.filter(a=>a.impact>.2).length,i=e.filter(a=>a.impact<-.2).length;return s>0&&i>0&&Math.abs(s-i)<=1&&n.push("Polarization detected but dampened by governance constraints"),t.length>0&&n.push(`${t.length} governance intervention(s) applied this round`),n}function U5(e){if(e.length<2)return"stabilizing";const t=e.map(i=>i.reactions.reduce((a,l)=>a+l.impact,0)/i.reactions.length),n=t[t.length-1]-t[0],r=t.reduce((i,a)=>i+a,0)/t.length,s=t.reduce((i,a)=>i+(a-r)**2,0)/t.length;return s>.15?"diverging":Math.abs(n)<.1&&s<.05?"converging":n<-.2?"escalating":"stabilizing"}function W5(e){const t=[];for(let n=1;n<e.length;n++){const r=e[n-1].reactions.reduce((a,l)=>a+l.impact,0)/e[n-1].reactions.length,s=e[n].reactions.reduce((a,l)=>a+l.impact,0)/e[n].reactions.length,i=Math.abs(s-r);i>.3&&t.push(`Round ${n}: Significant sentiment shift (${(i*100).toFixed(0)}% swing)`)}return t.length===0&&t.push("Governance constraints prevented major inflection points — smooth trajectory"),t}function Fh(e){const n=e.rounds.flatMap(p=>p.reactions).map(p=>p.impact),r=n.reduce((p,v)=>p+v,0)/n.length,s=Math.max(...n.map(p=>Math.abs(p))),i=Math.min(...n);let a=0;e.trajectory==="escalating"&&(a+=.35),e.trajectory==="diverging"&&(a+=.25),r<-.3&&(a+=.25),s>.7&&(a+=.15),a=Math.min(.95,a);const l=n.reduce((p,v)=>p+(v-r)**2,0)/n.length;let c=1-Math.min(1,l*3+Math.max(0,-r));(e.trajectory==="converging"||e.trajectory==="stabilizing")&&(c=Math.min(1,c+.15)),c=Math.max(0,Math.min(1,c));const d=e.rounds.flatMap(p=>p.emergent_dynamics??[]),u=d.filter(p=>p.toLowerCase().includes("coalition")).length,f=d.filter(p=>p.toLowerCase().includes("polariz")).length,m=e.rounds.filter(p=>{const v=p.reactions.reduce((x,w)=>x+w.impact,0)/p.reactions.length;return Math.abs(v)>.4}).length;return{avgImpact:Number(r.toFixed(3)),collapseProbability:Number(a.toFixed(2)),stabilityScore:Number(c.toFixed(2)),coalitionRisks:u,polarizationEvents:f,peakNegativeSentiment:Number(i.toFixed(2)),consensusRounds:m,maxVolatility:Number(s.toFixed(2))}}function H5(e,t,n){const r=[],s=e.collapseProbability-t.collapseProbability;if(s>.1&&r.push(`Collapse probability dropped from ${(e.collapseProbability*100).toFixed(0)}% to ${(t.collapseProbability*100).toFixed(0)}% — a ${(s*100).toFixed(0)} percentage point reduction.`),t.stabilityScore-e.stabilityScore>.05&&r.push(`System stability improved from ${(e.stabilityScore*100).toFixed(0)}% to ${(t.stabilityScore*100).toFixed(0)}%.`),e.coalitionRisks>t.coalitionRisks&&r.push(`Coalition risks reduced from ${e.coalitionRisks} to ${t.coalitionRisks}.`),e.maxVolatility>t.maxVolatility){const a=(e.maxVolatility-t.maxVolatility)/e.maxVolatility*100;r.push(`Peak volatility reduced by ${a.toFixed(0)}%.`)}return r.length===0?r.push("Governance constraints had minimal measurable effect on this scenario."):(r.unshift(`World thesis: "${n}"`),r.push("Rules reshape emergent behavior — governance changes the structure of the system, not just individual actions.")),r.join(" ")}async function Iu(e,t,n,r){var _,k;const s=(e.stakeholders??[]).map(A=>typeof A=="string"?{id:A,disposition:"unknown"}:A),i=e.swarm??{enabled:!0,rounds:5,reaction_model:"mixed"},a=_5(e,t),l=await $y(e.scenario,s,n,i),c=Fh(l),{swarm:d,guardVerdicts:u,narrativeImpacts:f,enforcementLog:m}=await B5(e.scenario,s,n,i,t,a,e),p=Fh(d);let v;try{v=M5(a,{steps:5})}catch{}const x=c.collapseProbability-p.collapseProbability,w=p.stabilityScore-c.stabilityScore,g=c.maxVolatility>0?(c.maxVolatility-p.maxVolatility)/c.maxVolatility:0,b=c.coalitionRisks-p.coalitionRisks,y=Math.min(1,Math.max(0,x*.4+w*.3+Math.max(0,g)*.2+Math.max(0,b*.1))),N=H5(c,p,t.thesis),S={allow:0,block:0,pause:0},C=new Set;let j=0;for(const A of u){const M=A.status.toLowerCase();if(M in S&&S[M]++,A.ruleId&&C.add(A.ruleId),(_=A.evidence)!=null&&_.invariantChecks&&(j+=A.evidence.invariantChecks.length),(k=A.evidence)!=null&&k.guardChecks)for(const U of A.evidence.guardChecks)U.triggered&&C.add(U.guardId)}const E=v?v.steps.reduce((A,M)=>A+M.rulesFired,0):0,R={engineLoaded:u.length>0&&u[0].reason!=="NeuroverseOS guard not loaded — permissive fallback",totalEvaluations:u.length,verdicts:S,rulesFired:E,worldCollapsed:(v==null?void 0:v.collapsed)??!1,finalViability:(v==null?void 0:v.finalViability)??"UNKNOWN",invariantsChecked:j,triggeredGuards:[...C]},P=D5(l.rounds,d.rounds);return{scenario:e.scenario,worldRules:{thesis:t.thesis,invariants:t.invariants,gates:t.gates??[]},baseline:{swarm:l,metrics:c},governed:{swarm:d,metrics:p,worldSimulation:v},comparison:{collapseReduction:Number((x*100).toFixed(1)),stabilityImprovement:Number((w*100).toFixed(1)),volatilityReduction:Number((g*100).toFixed(1)),coalitionRiskReduction:b,governanceEffectiveness:Number(y.toFixed(2)),narrative:N},governanceStats:R,enforcementClassification:m.length>0?m:void 0,narrativeImpacts:f.length>0?f:void 0,behavioralAnalysis:P}}const vm="nv-sim-saved-worlds",Hs=[];function ym(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function zh(e){if(!ym()){const r=Hs.findIndex(s=>s.id===e.id);r>=0?Hs[r]=e:Hs.push(e);return}const t=Ur(),n=t.findIndex(r=>r.id===e.id);n>=0?t[n]={...e,modifiedAt:new Date().toISOString()}:t.push(e),localStorage.setItem(vm,JSON.stringify(t))}function Ur(){if(!ym())return[...Hs];try{const e=localStorage.getItem(vm);return e?JSON.parse(e):[]}catch{return[]}}function G5(e){return Ur().find(n=>n.id===e)??null}function K5(e){if(!ym()){const r=Hs.findIndex(s=>s.id===e);return r<0?!1:(Hs.splice(r,1),!0)}const t=Ur(),n=t.filter(r=>r.id!==e);return n.length===t.length?!1:(localStorage.setItem(vm,JSON.stringify(n)),!0)}function q5(e){return JSON.stringify(e,null,2)}function Y5(e){const t=JSON.parse(e);if(!t.version||!t.id||!t.name||!t.world)throw new Error("Invalid world format: missing required fields (version, id, name, world)");if(!t.world.thesis||!Array.isArray(t.world.invariants))throw new Error("Invalid world definition: missing thesis or invariants");return t}function Q5(e,t,n,r){const s=`world_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,i=new Date().toISOString();return{version:"1.0",id:s,name:e,description:r==null?void 0:r.description,basePreset:n,world:t,createdAt:i,modifiedAt:i,tags:r==null?void 0:r.tags}}const X5=[{category:"prohibit",patterns:[/\b(block|prohibit|forbid|prevent|disallow|ban|never|must\s+not|shall\s+not|cannot)\b/i],enforcement:"structural"},{category:"limit",patterns:[/\b(limit|cap|restrict|maximum|max|ceiling|no\s+more\s+than|not\s+exceed|threshold)\b/i],enforcement:"structural"},{category:"require",patterns:[/\b(require|mandate|must|shall|obligat|enforce|compulsory|necessary)\b/i],enforcement:"structural"},{category:"circuit_breaker",patterns:[/\b(circuit\s*breaker|halt|pause|freeze|stop|suspend|emergency|shutdown)\b/i],enforcement:"structural"},{category:"monitor",patterns:[/\b(monitor|track|report|audit|log|observe|surveil|watch|alert)\b/i],enforcement:"structural"},{category:"encourage",patterns:[/\b(encourage|promote|suggest|recommend|prefer|advise|should|guideline|best\s+practice)\b/i],enforcement:"advisory"}],Z5={risk:["risk","exposure","hazard","danger","threat","unsafe"],stability:["stability","stable","equilibrium","balance","steady"],trust:["trust","confidence","credibility","reputation","integrity"],quality:["quality","accuracy","correctness","fidelity","rigor"],activity:["activity","engagement","participation","active","frequency","rate"],diversity:["diversity","diverse","variety","opinion","viewpoint","perspective"],influence:["influence","power","dominance","monopoly","concentration","control"],sentiment:["sentiment","polarity","emotion","tone","negativity","positivity"],speed:["speed","velocity","fast","slow","latency","delay","rapid","throttle"],volume:["volume","amount","quantity","count","total","throughput"],compliance:["compliance","compliant","conform","adhere","rule","policy"],transparency:["transparency","transparent","visible","audit","traceable","source","attribution"],coordination:["coordination","coordinated","synchronized","campaign","collusion","manipulation"],liquidity:["liquidity","liquid","cash","capital","reserve"],leverage:["leverage","leveraged","margin","borrowed","debt"],volatility:["volatility","volatile","vix","fluctuation","swing","spike"],contagion:["contagion","spread","cascade","chain","domino","systemic"],price:["price","cost","valuation","tariff"],echo_chamber:["echo chamber","echo_chamber","filter bubble","clustering","polarization","polarized"],viral:["viral","amplification","virality","trending","propagation"]};function ls(e){const t=e.split(`
428
+ `).filter(s=>s.trim().length>0),n=[];let r=0;for(let s=0;s<t.length;s++){const i=t[s].trim();if(i.startsWith("#")&&i.length<80&&!i.includes("must")&&!i.includes("shall")||i.startsWith("//")||i.startsWith("<!--")||i.length<10)continue;const a=i.replace(/^[-*+]\s+/,"").replace(/^\d+[.)]\s+/,"").replace(/^>\s+/,"").replace(/\*\*/g,"").replace(/\*/g,"").trim();if(a.length<10)continue;let l="encourage",c="advisory",d=.3;for(const p of X5){for(const v of p.patterns)if(v.test(a)){l=p.category,c=p.enforcement,d=Math.max(d,.7+Math.random()*.25);break}if(d>.7)break}const u=[],f=[],m=a.toLowerCase();for(const[p,v]of Object.entries(Z5))for(const x of v)m.includes(x)&&(u.includes(p)||u.push(p),f.includes(x)||f.push(x));r++,n.push({id:`RULE-${String(r).padStart(3,"0")}`,originalText:i,description:a,enforcement:c,category:l,confidence:Number(d.toFixed(2)),affectedVariables:u,keywords:f,sourceLine:s+1})}return{rules:n,summary:{total:n.length,enforced:n.filter(s=>s.enforcement==="structural").length,advisory:n.filter(s=>s.enforcement==="advisory").length},sourceText:e}}function J5(e){const t=[];for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){const s=e[n],i=e[r],a=s.affectedVariables.filter(l=>i.affectedVariables.includes(l));if(a.length!==0){if(s.category==="prohibit"&&(i.category==="encourage"||i.category==="require")||i.category==="prohibit"&&(s.category==="encourage"||s.category==="require")){t.push({ruleA:s,ruleB:i,type:"direct_conflict",description:`${s.id} ${s.category}s ${a.join(", ")} while ${i.id} ${i.category}s it`});continue}if(s.category===i.category&&a.length>0&&s.description!==i.description){t.push({ruleA:s,ruleB:i,type:"overlap",description:`Both ${s.id} and ${i.id} ${s.category} on "${a.join(", ")}" — may cause redundancy or conflict`});continue}s.affectedVariables.length>i.affectedVariables.length&&i.affectedVariables.every(l=>s.affectedVariables.includes(l))&&t.push({ruleA:s,ruleB:i,type:"subsumption",description:`${s.id} may already cover what ${i.id} specifies — ${i.id} may be redundant`})}}return t}function po(e){const t=[];let n=0;const r=()=>`POL-${String(++n).padStart(3,"0")}`,s=J5(e.rules);for(const g of s)if(g.type==="direct_conflict"){const y=`Limit ${g.ruleA.affectedVariables.filter(N=>g.ruleB.affectedVariables.includes(N)).join(" and ")} during volatility spikes with strict thresholds`;t.push({id:r(),severity:"error",message:`Conflicting rules: ${g.ruleA.id} vs ${g.ruleB.id}`,detail:g.description,relatedRules:[g.ruleA.id,g.ruleB.id],fix:`Resolve conflict: remove one rule, or add a condition (e.g., "${g.ruleB.id} applies only during volatility")`,source:{startLine:g.ruleA.sourceLine,endLine:g.ruleB.sourceLine},category:"conflict",quickFix:{label:"Merge into single rule",operation:"replace",text:y,targetLines:[g.ruleA.sourceLine,g.ruleB.sourceLine]}})}else if(g.type==="overlap"){const y=`Limit ${g.ruleA.affectedVariables.filter(N=>g.ruleB.affectedVariables.includes(N)).join(" and ")} with unified thresholds across all conditions`;t.push({id:r(),severity:"warning",message:`Overlapping enforcement: ${g.ruleA.id} and ${g.ruleB.id}`,detail:g.description,relatedRules:[g.ruleA.id,g.ruleB.id],fix:"Consider merging into a single rule or adding distinct conditions",source:{startLine:g.ruleA.sourceLine,endLine:g.ruleB.sourceLine},category:"conflict",quickFix:{label:"Merge rules",operation:"replace",text:y,targetLines:[g.ruleA.sourceLine,g.ruleB.sourceLine]}})}else t.push({id:r(),severity:"hint",message:`${g.ruleB.id} may be redundant (subsumed by ${g.ruleA.id})`,detail:g.description,relatedRules:[g.ruleA.id,g.ruleB.id],category:"structure",quickFix:{label:"Remove redundant rule",operation:"remove",text:"",targetLines:[g.ruleB.sourceLine]}});if(e.summary.enforced===0&&e.rules.length>0){const g=e.rules.slice(0,3).map(b=>{const y=b.description.toLowerCase();return y.includes("encourage")||y.includes("promote")?b.description.replace(/\b(encourage|promote)\b/i,"Require"):y.includes("should")?b.description.replace(/\bshould\b/i,"Must"):`Limit ${b.affectedVariables[0]??"system behavior"} to prevent instability`});t.push({id:r(),severity:"error",message:"Advisory only — no enforceable constraints detected",detail:"This policy contains only advisory guidelines with no structural enforcement. The simulation will run but the policy will have no measurable effect on outcomes.",relatedRules:e.rules.map(b=>b.id),fix:'Add enforceable rules using action verbs: "must", "shall", "limit", "block", "require"',category:"strength",quickFix:{label:"Strengthen enforcement",operation:"insert",text:g.join(`
429
+ `)}})}else if(e.summary.enforced<e.summary.total*.3&&e.rules.length>2){const g=e.rules.find(y=>y.enforcement==="advisory"),b=g?g.description.replace(/\b(encourage|promote|suggest|recommend|should)\b/i,"Require"):"Require compliance with all governance constraints";t.push({id:r(),severity:"warning",message:`Weak enforcement: only ${e.summary.enforced}/${e.summary.total} rules are enforceable`,detail:"Most rules in this policy are advisory. Simulations may show limited governance effect.",relatedRules:e.rules.filter(y=>y.enforcement==="advisory").map(y=>y.id),fix:"Strengthen advisory rules with specific thresholds and action verbs",category:"strength",quickFix:g?{label:"Strengthen weakest rule",operation:"replace",text:b,targetLines:[g.sourceLine]}:{label:"Add enforced rule",operation:"insert",text:b}})}const i=e.rules.filter(g=>g.category==="prohibit").length,a=e.rules.filter(g=>g.category==="limit").length,l=(i+a)/Math.max(e.rules.length,1);l>.8&&e.rules.length>3&&t.push({id:r(),severity:"warning",message:"Policy may over-restrict system behavior",detail:`${Math.round(l*100)}% of rules are prohibitive/restrictive. This may cause system freeze where most actions are blocked, reducing the system's ability to respond to crises.`,relatedRules:e.rules.filter(g=>g.category==="prohibit"||g.category==="limit").map(g=>g.id),fix:"Balance restrictive rules with permissive ones: add monitoring, encourage, or conditional allowance rules",category:"constraint",quickFix:{label:"Add flexibility rules",operation:"insert",text:`Allow normal trading activity under standard market conditions
430
+ Monitor and report unusual activity patterns before restricting`}});const c=new Set(e.rules.flatMap(g=>g.affectedVariables)),u=["liquidity","leverage","volatility","risk","stability"].filter(g=>!c.has(g));if(u.length>0&&e.rules.length>0){const g=u.map(b=>{switch(b){case"liquidity":return"Maintain minimum liquidity floor — no agent may drain liquidity below 15% of baseline";case"leverage":return"Limit maximum leverage to 5x during elevated volatility conditions";case"volatility":return"Halt automated trading when volatility index exceeds critical threshold";case"risk":return"Require risk assessment reporting for all positions exceeding normal thresholds";case"stability":return"Require rebalancing when system stability drops below acceptable levels";default:return`Monitor and limit ${b} to prevent systemic issues`}});t.push({id:r(),severity:"info",message:`Uncovered critical areas: ${u.join(", ")}`,detail:`The policy does not address: ${u.join(", ")}. These are common governance targets in financial/systemic scenarios.`,relatedRules:[],fix:`Consider adding rules for: ${u.map(b=>b.charAt(0).toUpperCase()+b.slice(1)).join(", ")}`,category:"coverage",quickFix:{label:`Add ${u.length} coverage rule${u.length>1?"s":""}`,operation:"insert",text:g.join(`
431
+ `)}})}const f=e.rules.filter(g=>g.confidence<.5);if(f.length>0){const g=f[0],b=`Require ${g.affectedVariables[0]??"compliance"} controls to prevent ${g.keywords[0]??"violations"}`;t.push({id:r(),severity:"hint",message:`${f.length} rule(s) parsed with low confidence`,detail:"Some lines were difficult to classify. They may be descriptions rather than actionable rules.",relatedRules:f.map(y=>y.id),fix:"Rephrase ambiguous rules with clear action verbs and specific thresholds",category:"structure",quickFix:{label:"Rephrase ambiguous rule",operation:"replace",text:b,targetLines:[g.sourceLine]}})}e.rules.length===0&&t.push({id:r(),severity:"error",message:"No rules detected in policy document",detail:"The uploaded document did not contain any recognizable policy rules.",relatedRules:[],fix:"Add policy rules as bullet points or numbered items with clear action verbs",category:"structure",quickFix:{label:"Add starter policy",operation:"insert",text:`Block all large trades during extreme volatility
432
+ Limit maximum leverage to 5x
433
+ Halt automated trading when volatility exceeds critical threshold
434
+ Maintain minimum liquidity floor at 15% of baseline
435
+ Monitor and report all correlated position clusters`}}),!e.rules.some(g=>g.category==="circuit_breaker")&&e.rules.length>2&&t.push({id:r(),severity:"info",message:"No circuit breaker / emergency halt rule detected",detail:"The policy has no emergency shutdown mechanism. In extreme scenarios, the system has no last-resort protection.",relatedRules:[],fix:'Add an emergency rule: "Halt all trading when volatility exceeds critical threshold"',category:"coverage",quickFix:{label:"Add circuit breaker",operation:"insert",text:"Halt all trading when volatility exceeds critical threshold"}});const p={errors:t.filter(g=>g.severity==="error").length,warnings:t.filter(g=>g.severity==="warning").length,info:t.filter(g=>g.severity==="info").length,hints:t.filter(g=>g.severity==="hint").length},v=p.errors>0&&e.rules.length===0,x=Math.max(0,100-p.errors*25-p.warnings*10-p.info*3-p.hints*1);let w;return p.errors>0&&v?w="critical":p.errors>0?w="errors":p.warnings>0?w="warnings":w="healthy",{status:w,diagnostics:t,counts:p,canSimulate:e.rules.length>0,healthScore:x}}function eR(e,t){const n=e.split(`
436
+ `);switch(t.operation){case"insert":return e.trimEnd()+`
437
+ `+t.text;case"replace":{if(!t.targetLines||t.targetLines.length===0)return e;const r=[...t.targetLines].sort((a,l)=>a-l),s=[];let i=!1;for(let a=0;a<n.length;a++){const l=a+1;r.includes(l)?i||(s.push(t.text),i=!0):s.push(n[a])}return s.join(`
438
+ `)}case"remove":return!t.targetLines||t.targetLines.length===0?e:n.filter((r,s)=>!t.targetLines.includes(s+1)).join(`
439
+ `);default:return e}}function Mu(e){var c;const t=e.rules.map((d,u)=>({id:`INV-${String(u+1).padStart(3,"0")}`,description:d.description,enforceable:d.enforcement==="structural"})),n=new Map;for(const d of e.rules){const u=d.description.match(/(?:(?:below|under|less than|drops? (?:below|under)|<)\s*(\d+(?:\.\d+)?)|(?:above|over|more than|exceeds?|greater than|>)\s*(\d+(?:\.\d+)?)|(?:to|at|limit(?:ed)? to|cap(?:ped)? at|maximum (?:of)?)\s*(\d+(?:\.\d+)?))/i);if(u&&d.affectedVariables.length>0){const f=u[1]?parseFloat(u[1]):null,m=u[2]?parseFloat(u[2]):null,p=u[3]?parseFloat(u[3]):null,v=d.affectedVariables[0];f!==null?n.set(v,{value:f,direction:"below",ruleDesc:d.description}):m!==null?n.set(v,{value:m,direction:"above",ruleDesc:d.description}):p!==null&&n.set(v,{value:p,direction:"above",ruleDesc:d.description})}}const s=[...new Set(e.rules.flatMap(d=>d.affectedVariables))].map(d=>{const u=n.get(d),f=Nl[d];if(f)return{...f};const m=u?Math.max(100,u.value*2):100,p=u?u.direction==="above"?Math.round(u.value*.6):Math.round(u.value*1.5):50;return{id:`${d}_index`,label:d.charAt(0).toUpperCase()+d.slice(1).replace(/_/g," "),type:"number",range:{min:0,max:m},default_value:Math.min(p,m)}}),i=[];let a=0;for(const[d,u]of n.entries()){a++;const f=((c=Nl[d])==null?void 0:c.id)??`${d}_index`,m=u.direction==="below"?`${f} < ${u.value}`:`${f} > ${u.value}`;i.push({id:`GATE-${String(a).padStart(3,"0")}`,label:`${d.charAt(0).toUpperCase()+d.slice(1).replace(/_/g," ")} Threshold`,condition:m,severity:"warning"})}for(const d of e.rules)(d.category==="circuit_breaker"||d.category==="prohibit")&&(d.affectedVariables.some(f=>n.has(f))||(a++,i.push({id:`GATE-${String(a).padStart(3,"0")}`,label:d.description.slice(0,60),condition:nR(d),severity:d.category==="circuit_breaker"?"critical":"warning"})));return{thesis:tR(e),state_variables:s,invariants:t,gates:i}}const Nl={diversity:{id:"opinion_diversity",label:"Opinion Diversity",type:"number",range:{min:0,max:100},default_value:65},influence:{id:"influence_concentration",label:"Influence Concentration",type:"number",range:{min:0,max:100},default_value:30},sentiment:{id:"sentiment_polarity",label:"Sentiment Polarity",type:"number",range:{min:0,max:100},default_value:40},echo_chamber:{id:"echo_chamber_strength",label:"Echo Chamber Strength",type:"enum",enum_values:["none","forming","established","dominant"],default_value:"none"},activity:{id:"engagement_rate",label:"Active Agent %",type:"number",range:{min:0,max:100},default_value:60},viral:{id:"viral_threshold",label:"Viral Amplification Threshold",type:"number",range:{min:1,max:100},default_value:20},risk:{id:"risk_level",label:"Risk Level",type:"number",range:{min:0,max:100},default_value:40},stability:{id:"stability_index",label:"Stability",type:"number",range:{min:0,max:100},default_value:65},trust:{id:"trust_level",label:"Trust Level",type:"number",range:{min:0,max:100},default_value:60},quality:{id:"quality_score",label:"Quality Score",type:"number",range:{min:0,max:100},default_value:50},compliance:{id:"compliance_rate",label:"Compliance Rate %",type:"number",range:{min:0,max:100},default_value:70},transparency:{id:"transparency_index",label:"Transparency",type:"number",range:{min:0,max:100},default_value:50},speed:{id:"action_speed",label:"Action Speed",type:"number",range:{min:0,max:100},default_value:50},volume:{id:"action_volume",label:"Action Volume",type:"number",range:{min:0,max:100},default_value:50},liquidity:{id:"liquidity_index",label:"Liquidity",type:"number",range:{min:0,max:100},default_value:50},leverage:{id:"leverage_ratio",label:"Leverage Ratio",type:"number",range:{min:1,max:30},default_value:5},volatility:{id:"volatility_index",label:"Volatility",type:"number",range:{min:0,max:100},default_value:40},price:{id:"price_index",label:"Price Index",type:"number",range:{min:0,max:100},default_value:50},contagion:{id:"contagion_level",label:"Contagion",type:"enum",enum_values:["contained","spreading","systemic"],default_value:"contained"},coordination:{id:"coordination_detected",label:"Coordinated Activity Detected",type:"boolean",default_value:!1}};function tR(e){const t=e.rules.filter(c=>c.enforcement==="structural");if(t.length===0)return"Advisory policy providing guidelines without structural enforcement";const n=[...new Set(t.flatMap(c=>c.affectedVariables))],r=[...new Set(t.map(c=>c.category))],s=n.slice(0,4).map(c=>{const d=Nl[c];return d?d.label.toLowerCase():c.replace(/_/g," ")}),i=[];r.includes("prohibit")&&i.push("blocks harmful actions"),r.includes("limit")&&i.push("caps extreme behavior"),r.includes("require")&&i.push("enforces required standards"),r.includes("circuit_breaker")&&i.push("triggers circuit breakers"),r.includes("monitor")&&i.push("monitors critical thresholds");const a=i.length>0?i.join(", "):"enforces structural constraints",l=s.length>0?` across ${s.join(", ")}`:"";return`This world ${a}${l} — ${t.length} rule${t.length>1?"s":""} governing agent behavior to maintain system integrity`}function nR(e){const t=e.affectedVariables;return t.length===0?"system_stress > 80":t.map(n=>{const r=Nl[n],s=(r==null?void 0:r.id)??`${n}_index`;return["diversity","stability","trust","quality","compliance","transparency","liquidity"].includes(n)?`${s} < 20`:`${s} > 80`}).join(" || ")}function rR(){return[{id:"Policy Enforcer",disposition:"supportive",priorities:["compliance","stability","risk reduction"]},{id:"Market Participants",disposition:"neutral",priorities:["profit","liquidity","freedom"]},{id:"Regulators",disposition:"supportive",priorities:["systemic stability","transparency","enforcement"]},{id:"Risk Managers",disposition:"neutral",priorities:["exposure limits","portfolio protection","hedging"]}]}function sR(){return[{id:"path_compliant",label:"Full Compliance",description:"All actors comply with policy rules — system operates within constraints",projected_outcome:"Reduced volatility, slower but stable growth, fewer extreme events",probability:.55,risk:"low",tradeoffs:["Stability vs. opportunity cost","Compliance cost vs. systemic safety"],benefits_stakeholders:["Regulators","Risk Managers"],harms_stakeholders:[]},{id:"path_stress_test",label:"Stress Test",description:"External shock tests policy resilience — cascade events trigger policy rules",projected_outcome:"Policy constraints activate, dampening cascade but limiting response flexibility",probability:.65,risk:"high",tradeoffs:["Protection vs. agility","Circuit breakers vs. market freeze"],benefits_stakeholders:["Policy Enforcer"],harms_stakeholders:["Market Participants"]},{id:"path_evasion",label:"Policy Evasion",description:"Some actors find loopholes or work around constraints",projected_outcome:"Partial effectiveness — compliant actors stabilized, non-compliant create new risks",probability:.45,risk:"moderate",tradeoffs:["Enforcement strictness vs. innovation","Monitoring cost vs. coverage"],benefits_stakeholders:[],harms_stakeholders:["Policy Enforcer","Regulators"]}]}async function oR(e,t={}){const n=ls(e),r=po(n),s=Mu(n),i=t.scenarioText??"A systemic stress event triggers cascading failures across interconnected markets. Volatility spikes, liquidity evaporates, and contagion threatens to spread. The policy framework is the only structural defense.",a=t.stakeholders??rR(),l=sR(),c={scenario:i,stakeholders:a,assumptions:{severity:"critical",environmental_hostility:"high",time_pressure:"immediate",regulatory_climate:"strict"},constraints:{time_horizon:"72 hours",risk_tolerance:"conservative"},depth:"full",swarm:{enabled:!0,rounds:t.rounds??5,reaction_model:"mixed"}},d=await Iu(c,s,l),u=iR(d),f=aR(d,n,u);return{policy:n,healthCheck:r,comparison:d,impact:u,explanation:f}}function iR(e,t){const n=e.baseline.metrics,r=e.governed.metrics,s=e.governanceStats,i=(r.stabilityScore-n.stabilityScore)*100,a=(r.collapseProbability-n.collapseProbability)*-100,l=e.governed.swarm.rounds.reduce((f,m)=>f+m.reactions.length,0),c=s.verdicts.block,d=l>0?c/l*100:0,u=Math.min(1,d/100);return{stabilityChange:Number(i.toFixed(1)),cascadeRiskChange:Number(a.toFixed(1)),governanceActions:s.totalEvaluations,actionsBlocked:Number(d.toFixed(1)),preventedCollapse:n.collapseProbability>.5&&r.collapseProbability<.3,overConstraintScore:Number(u.toFixed(2))}}function aR(e,t,n){const r=[];n.preventedCollapse?r.push("The policy prevented system collapse by enforcing structural constraints during the stress test."):n.stabilityChange>5?r.push("The policy measurably improved system stability during the simulated stress event."):n.stabilityChange<-5?r.push("The policy may have reduced system flexibility, leading to lower stability under stress."):r.push("The policy had a moderate effect on system dynamics during the stress test.");const s=t.rules.filter(l=>l.category==="circuit_breaker"),i=t.rules.filter(l=>l.category==="limit"),a=t.rules.filter(l=>l.category==="prohibit");return s.length>0&&r.push(`Circuit breaker rules (${s.map(l=>l.id).join(", ")}) activated during peak volatility, halting cascading sell-offs.`),i.length>0&&n.cascadeRiskChange>10&&r.push("Limit rules reduced cascade risk by constraining extreme positions and enforcing thresholds."),a.length>0&&r.push(`Prohibition rules blocked ${n.actionsBlocked.toFixed(0)}% of actions that violated policy constraints.`),n.overConstraintScore>.7&&r.push(`WARNING: The policy appears over-constrained — ${n.actionsBlocked.toFixed(0)}% of actions were blocked, risking system freeze where legitimate responses are also suppressed.`),r.push(`Net effect: ${n.stabilityChange>0?"+":""}${n.stabilityChange.toFixed(0)}% stability, ${n.cascadeRiskChange>0?"-":"+"}${Math.abs(n.cascadeRiskChange).toFixed(0)}% cascade risk, ${n.governanceActions} governance actions.`),r.join(" ")}function zy(e){let t=ls(e.policyText),n=po(t),r=Mu(t);const s=e.sensitivity??.5,i=e.auditTrail??null,a={totalEvaluations:0,allowed:0,blocked:0,modified:0,paused:0,rewarded:0,penalized:0,rulesFired:0},l=new Map;function c(v){return l.has(v)||l.set(v,{agentId:v,cooldownRemaining:0,influence:1,rewardMultiplier:1,totalPenalties:0,totalRewards:0}),l.get(v)}function d(v,x){a.totalEvaluations++;const w=c(v.agentId);if(w.cooldownRemaining>0)return w.cooldownRemaining--,a.penalized++,{status:"PENALIZE",action:null,reason:`Agent frozen: ${w.cooldownRemaining+1} round(s) remaining on cooldown`,rulesFired:[],confidence:1,timestamp:Date.now(),consequence:{type:"cooldown",rounds:w.cooldownRemaining+1,description:"Agent still in cooldown period"}};const g=[];let b=v.magnitude,y=!1,N=null,S=null;for(const _ of r.invariants){if(!_.enforceable){fR(_.description,v)?(S={inv:_,reward:{type:"boost_influence",magnitude:.1,description:_.description}},g.push({id:_.id,description:_.description,effect:"rewarded",impactReduction:0})):g.push({id:_.id,description:_.description,effect:"monitored",impactReduction:0});continue}if(uR(_.description,v)){N={inv:_,consequence:{type:"freeze",rounds:1,magnitude:.5,description:_.description}},g.push({id:_.id,description:_.description,effect:"penalized",impactReduction:1});continue}const k=lR(_,v,b,x,s);k&&(g.push(k),b=v.magnitude*(1-k.impactReduction),y=!0)}for(const _ of r.gates??[]){const k=cR(_,v,b,x);k&&(g.push(k),b=b*(1-k.impactReduction),y=!0)}if(N){a.penalized++,a.rulesFired++;const _=N.consequence;w.totalPenalties++,w.cooldownRemaining=_.rounds??1,w.influence=Math.max(0,w.influence-(_.magnitude??.2));const k={status:"PENALIZE",action:null,reason:Mo("penalized",v,g),rulesFired:g,confidence:id(g,1),timestamp:Date.now(),consequence:_};return i&&i.logVerdict({agent:v.agentId,action:v.description,actionType:v.type,verdict:"BLOCK",reason:k.reason,confidence:k.confidence,rulesFired:g.map(A=>({id:A.id,description:A.description,effect:A.effect,impactReduction:A.impactReduction}))}),k}if(S&&!y){a.rewarded++,a.rulesFired++;const _=S.reward;w.totalRewards++,w.influence=Math.min(2,w.influence+(_.magnitude??.1)),w.rewardMultiplier=Math.min(3,w.rewardMultiplier+.05);const k={status:"REWARD",action:v,reason:Mo("rewarded",v,g),rulesFired:g,confidence:id(g,0),timestamp:Date.now(),reward:_};return i&&i.logVerdict({agent:v.agentId,action:v.description,actionType:v.type,verdict:"ALLOW",reason:k.reason,confidence:k.confidence,rulesFired:g.map(A=>({id:A.id,description:A.description,effect:A.effect,impactReduction:A.impactReduction}))}),k}a.rulesFired+=g.filter(_=>_.effect!=="monitored").length;const C=1-b/Math.max(v.magnitude,.001);let j,E,R;C>.85?(j="BLOCK",E=Mo("blocked",v,g),R=null,a.blocked++):C>.5?(j="PAUSE",E=Mo("paused",v,g),R={...v,magnitude:Number(b.toFixed(3))},a.paused++):y&&C>.05?(j="MODIFY",E=Mo("modified",v,g),R={...v,magnitude:Number(b.toFixed(3))},a.modified++):(j="ALLOW",E=g.length>0?`Allowed — ${g.filter(_=>_.effect==="monitored").length} advisory rule(s) noted`:"Allowed — no rules apply to this action",R=v,a.allowed++);const P={status:j,action:R,reason:E,rulesFired:g,confidence:id(g,C),timestamp:Date.now()};return i&&i.logVerdict({agent:v.agentId,action:v.description,actionType:v.type,verdict:j==="MODIFY"?"MODIFY":j,reason:E,confidence:P.confidence,rulesFired:g.map(_=>({id:_.id,description:_.description,effect:_.effect,impactReduction:_.impactReduction}))}),P}function u(v,x){return v.map(w=>d(w,x))}function f(v){t=ls(v),n=po(t),r=Mu(t)}function m(){for(const[,v]of l)v.cooldownRemaining=Math.max(0,v.cooldownRemaining-1)}function p(){return l}return{evaluate:d,evaluateBatch:u,updatePolicy:f,tickCooldowns:m,getAgentStates:p,get policy(){return{ruleCount:t.summary.total,enforcedCount:t.summary.enforced,advisoryCount:t.summary.advisory,healthScore:n.healthScore}},get stats(){return{...a}}}}function lR(e,t,n,r,s){const i=e.description.toLowerCase(),a=t.description.toLowerCase(),l=t.type.toLowerCase(),c=.6-s*.3;if(An(i,["block","prohibit","prevent","forbid","ban","stop","halt"])){const u=bm(i,["block","prohibit","prevent","forbid","ban","stop","halt"]).some(m=>a.includes(m)||l.includes(m)),f=t.magnitude>c;if(u||f)return{id:e.id,description:e.description,effect:"blocked",impactReduction:.85+s*.1}}return An(i,["panic","cascade","contagion","crash","circuit","emergency","runaway"])&&(r?By(r):t.magnitude>.6)&&t.magnitude>c*.8?{id:e.id,description:e.description,effect:"blocked",impactReduction:.7+s*.2}:An(i,["slow","cool","gradual","dampen","reduce volatility","moderate"])&&t.magnitude>c?{id:e.id,description:e.description,effect:"dampened",impactReduction:.35+s*.15}:An(i,["floor","maintain","minimum","at least","no less"])&&t.magnitude>.4&&dR(i,a)?{id:e.id,description:e.description,effect:"capped",impactReduction:Math.min(.5,t.magnitude-.3)}:An(i,["leverage","limit","cap","restrict","maximum","no more","ceiling"])&&t.magnitude>c+.1?{id:e.id,description:e.description,effect:"capped",impactReduction:Math.min(.4,t.magnitude-c)}:An(i,["rebalance","equilibrium","balance","correlat","diversif"])&&t.magnitude>.5?{id:e.id,description:e.description,effect:"rebalanced",impactReduction:.3*s}:An(i,["transparency","report","monitor","audit","disclose","accountab"])&&t.magnitude>.3?{id:e.id,description:e.description,effect:"monitored",impactReduction:0}:null}function cR(e,t,n,r){return e.severity==="critical"&&(r?By(r):n>.5)&&t.magnitude>.3?{id:e.id,description:e.label,effect:"blocked",impactReduction:.4}:e.severity==="warning"&&t.magnitude>.5?{id:e.id,description:e.label,effect:"dampened",impactReduction:.2}:null}function An(e,t){return t.some(n=>e.includes(n))}function bm(e,t){let n=e;for(const r of t)n=n.replace(new RegExp(`\\b${r}\\b`,"g"),"");return n.split(/\s+/).filter(r=>r.length>2).map(r=>r.replace(/[^a-z]/g,"")).filter(r=>r.length>2)}function dR(e,t){return e.split(/\s+/).filter(r=>r.length>3).some(r=>t.includes(r))}function By(e){const t=e.volatility??e.volatility_index,n=e.liquidity??e.liquidity_index;return typeof t=="number"&&t>70||typeof n=="number"&&n<20||e.sentiment==="panic"||e.contagion_spread==="systemic"}function id(e,t){if(e.length===0)return .95;const n=e.filter(r=>r.effect!=="monitored").length;return Math.min(.99,.6+n*.1+t*.2)}function Mo(e,t,n){const r=n.filter(a=>a.effect!=="monitored");if(r.length===0)return`${mR(e)} due to aggregate policy thresholds`;const s=r[0],i=r.length>1?` (+${r.length-1} more)`:"";switch(e){case"blocked":return`Blocked by "${s.description}"${i} — action "${t.description}" violates governance constraints`;case"paused":return`Paused by "${s.description}"${i} — action "${t.description}" requires review`;case"modified":return`Modified by "${s.description}"${i} — magnitude reduced from ${t.magnitude.toFixed(2)} to stay within policy limits`;case"penalized":return`Penalized by "${s.description}"${i} — agent "${t.agentId}" frozen for violating governance`;case"rewarded":return`Rewarded by "${s.description}"${i} — agent "${t.agentId}" demonstrated compliant behavior`}}function uR(e,t){const n=e.toLowerCase(),r=t.description.toLowerCase(),s=t.type.toLowerCase();return An(n,["penalize","freeze","suspend","cooldown","punish","sanction"])?bm(n,["penalize","freeze","suspend","cooldown","punish","sanction"]).some(a=>r.includes(a)||s.includes(a)):!1}function fR(e,t){const n=e.toLowerCase(),r=t.description.toLowerCase(),s=t.type.toLowerCase();return An(n,["reward","boost","incentivize","encourage","promote","prioritize"])?bm(n,["reward","boost","incentivize","encourage","promote","prioritize"]).some(a=>r.includes(a)||s.includes(a)):!1}function mR(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Bh=[{agentId:"hedge-fund-alpha",type:"trade",description:"Sell $20M in equities during market downturn",magnitude:.85,context:{asset:"equities",amount:2e7,direction:"sell"}},{agentId:"algo-trader-7",type:"trade",description:"Execute high-frequency arbitrage strategy",magnitude:.6,context:{strategy:"arbitrage",automated:!0}},{agentId:"pension-fund",type:"trade",description:"Buy $5M in government bonds",magnitude:.25,context:{asset:"bonds",amount:5e6,direction:"buy"}},{agentId:"market-maker-3",type:"withdrawal",description:"Withdraw liquidity from the market",magnitude:.7,context:{type:"liquidity_withdrawal"}},{agentId:"retail-coalition",type:"trade",description:"Coordinated buy of meme stock",magnitude:.55,context:{coordinated:!0,participants:1200}},{agentId:"quant-fund-beta",type:"leverage",description:"Increase leverage to 8x on volatile positions",magnitude:.9,context:{leverage:8,current_leverage:3}},{agentId:"central-bank",type:"intervention",description:"Inject emergency liquidity into the system",magnitude:.4,context:{type:"liquidity_injection"}},{agentId:"insurance-pool",type:"trade",description:"Rebalance portfolio under normal conditions",magnitude:.15,context:{type:"rebalance",routine:!0}}],ad={calm:{label:"Calm Market",state:{volatility:25,liquidity:70,leverage:2,sentiment:"stable",contagion_spread:"contained"}},stressed:{label:"Stressed Market",state:{volatility:55,liquidity:35,leverage:5,sentiment:"anxious",contagion_spread:"spreading"}},crisis:{label:"Full Crisis",state:{volatility:88,liquidity:8,leverage:12,sentiment:"panic",contagion_spread:"systemic"}}};function pR(e){return e.includes("hormuz")||e.includes("strait")?"geopolitical":e.includes("gas")||e.includes("price")?"economic":e.includes("ai")||e.includes("regulation")?"regulation":"custom"}function hR(e){const t={low:20,moderate:40,high:70,critical:90},n={low:20,moderate:50,high:80},r={none:10,low:25,moderate:50,urgent:75,immediate:95},s={permissive:20,neutral:40,strict:70,adversarial:90};return{severity:t[e.severity??"moderate"]??50,environmentalHostility:n[e.environmental_hostility??"moderate"]??50,timePressure:r[e.time_pressure??"moderate"]??50,regulatoryClimate:s[e.regulatory_climate??"neutral"]??50}}function gR(e){const t=e.severity>=80?"critical":e.severity>=60?"high":e.severity>=35?"moderate":"low",n=e.environmentalHostility>=60?"high":e.environmentalHostility>=35?"moderate":"low",r=e.timePressure>=85?"immediate":e.timePressure>=65?"urgent":e.timePressure>=40?"moderate":e.timePressure>=20?"low":"none",s=e.regulatoryClimate>=80?"adversarial":e.regulatoryClimate>=60?"strict":e.regulatoryClimate>=35?"neutral":"permissive";return{severity:t,environmental_hostility:n,time_pressure:r,regulatory_climate:s}}const xR=Object.entries(mo).map(([e,t])=>({id:e,title:t.title,description:t.scenario.slice(0,120)+(t.scenario.length>120?"...":""),tags:[...t.tags??[]],stakeholderCount:t.stakeholders.length,type:pR(e),defaultSliders:hR(t.assumptions)}));function vR(e){return e==="critical"||e==="high"?"high":e==="moderate"?"medium":"low"}function yR(e){var s;const t=e.analysis.paths,r=(s=[...t].sort((i,a)=>{const l={low:0,moderate:1,high:2,critical:3};return l[i.risk]-l[a.risk]})[0])==null?void 0:s.id;return t.map(i=>({name:i.label,description:i.description,probability:Math.round(i.probability*100),riskLevel:vR(i.risk),tradeoffs:[...i.tradeoffs],recommended:i.id===r}))}function bR(e){const t=e.analysis.paths.slice(0,3),n=[...new Set([...t.flatMap(a=>[...a.benefits_stakeholders??[],...a.harms_stakeholders??[]])])].slice(0,6),r=t.map(a=>a.label),s=n.length>0?n:["Stakeholder A","Stakeholder B","Stakeholder C"],i=s.map(a=>t.map(l=>{var c,d;return(c=l.benefits_stakeholders)!=null&&c.includes(a)?"positive":(d=l.harms_stakeholders)!=null&&d.includes(a)?"negative":"neutral"}));return{strategies:r,stakeholders:s,reactions:i}}function wR(e){const t={very_positive:2,positive:4,neutral:5,negative:7,very_negative:9};return e.analysis.projected_outcomes.map(n=>({label:n.label,type:n.label.toLowerCase().includes("best")?"best":n.label.toLowerCase().includes("likely")?"likely":n.label.toLowerCase().includes("worst")?"worst":"tail",conditions:n.conditions,description:n.outcome,likelihood:Math.round(n.likelihood*100),impactRating:t[n.impact]??5}))}function NR(e){return e.analysis.assumption_challenges.map(t=>({assumption:t.assumption,whyItMightFail:t.challenge,whatChanges:t.impact_if_wrong,severity:t.severity==="critical"?"critical":t.severity}))}function SR(e){return e.analysis.recommendations.map(t=>({priority:t.priority,action:t.action,rationale:t.rationale,timeframe:t.timeframe}))}function jR(e){const t=e.governance;if(t)return{traceId:t.trace_id,constitutionalChecks:t.constitutional_checks.map(n=>({ruleId:n.rule_id,rule:n.rule,passed:n.passed,detail:n.detail})),authorityLevel:t.authority_level,enforcedConstraints:[...t.enforced_constraints],timestamp:t.timestamp,engineVersion:t.engine_version,neuroverse:t.neuroverse?{guardStatus:t.neuroverse.guard_status,worldViability:t.neuroverse.world_viability,worldCollapsed:t.neuroverse.world_collapsed,collapseRisk:t.neuroverse.collapse_risk,rulesFired:t.neuroverse.rules_fired,worldHealthScore:t.neuroverse.world_health_score,invariantCoverage:t.neuroverse.invariant_coverage}:void 0}}function kR(e){var m;const t=e.analysis.paths,n=e.analysis.assumption_challenges,r=t.filter(p=>p.risk==="high"||p.risk==="critical").length,s=t.reduce((p,v)=>p+v.probability,0)/Math.max(t.length,1),i=(m=e.governance)==null?void 0:m.neuroverse,a=i==null?void 0:i.world_health_score,l=i==null?void 0:i.collapse_risk;let c="medium",d;const f=s-(l==="high"?.15:l==="moderate"?.08:0);return n.length<=1&&r===0&&f>.6?(c="high",d=`Analysis covers ${t.length} paths with low assumption risk and strong probability signals.`,a&&a<70&&(c="medium",d+=` System stability at ${a}% — moderate uncertainty from simulation dynamics.`)):n.length>=4||r>=2||f<.3?(c="low",d=`High uncertainty: ${n.length} assumptions challenged, ${r} high-risk paths, average probability ${(s*100).toFixed(0)}%.`,l==="high"&&(d+=" Elevated collapse risk detected in simulation.")):(d=`Moderate confidence: ${t.length} paths analyzed, ${n.length} assumptions challenged.`,a?d+=` System stability: ${a}%.`:d+=" Some uncertainty remains."),{level:c,reason:d}}function CR(e,t){var r,s,i,a,l,c;const n=[];return(r=e.assumptions)!=null&&r.severity&&n.push({text:`Severity is ${e.assumptions.severity}`,source:"caller"}),(s=e.assumptions)!=null&&s.time_pressure&&n.push({text:`Time pressure is ${e.assumptions.time_pressure}`,source:"caller"}),(i=e.assumptions)!=null&&i.environmental_hostility&&n.push({text:`Environmental hostility is ${e.assumptions.environmental_hostility}`,source:"caller"}),(a=e.assumptions)!=null&&a.regulatory_climate&&n.push({text:`Regulatory climate is ${e.assumptions.regulatory_climate}`,source:"caller"}),e.stakeholders&&e.stakeholders.length>0&&n.push({text:`${e.stakeholders.length} stakeholders identified with known dispositions`,source:"inferred"}),(l=e.constraints)!=null&&l.time_horizon||n.push({text:"No explicit time horizon — using general framework",source:"default"}),(c=e.constraints)!=null&&c.risk_tolerance||n.push({text:"Risk tolerance not specified — assuming moderate",source:"default"}),n}function ER(e,t){return{paths:yR(e),matrix:bR(e),outcomes:wR(e),challenges:NR(e),recommendations:SR(e),governance:jR(e),confidence:kR(e),keyAssumptions:CR(t),goalResult:e.goal_reasoning,mode:e.mode,lastRequest:t}}async function RR(e,t,n){var f;const r=typeof e=="string"?e:((f=mo[e.id])==null?void 0:f.scenario)??e.description,s=gR(t),i=typeof e=="object"?e.id:void 0,a=i?mo[i]:void 0;let l;n!=null&&n.stakeholders&&n.stakeholders.length>0?l=n.stakeholders.map(m=>({id:m.id,disposition:m.disposition})):a!=null&&a.stakeholders&&(l=[...a.stakeholders]);const c={scenario:r,stakeholders:l,assumptions:s,constraints:n!=null&&n.constraints?{time_horizon:n.constraints.timeHorizon||void 0,risk_tolerance:n.constraints.riskTolerance,budget:n.constraints.budget||void 0}:a==null?void 0:a.constraints,depth:(n==null?void 0:n.depth)??"full",perspective:"strategic_advisor",swarm:(a==null?void 0:a.swarm)??{enabled:!0,rounds:3,reaction_model:"mixed"},mode:n==null?void 0:n.mode,goal:n==null?void 0:n.goal},d=`${window.location.protocol}//${window.location.hostname}:3456/api/v1/reason`;let u;try{u=await(await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json()}catch(m){console.error("Failed to reach governance server:",m),u={status:"error"}}return u.status==="error"?{paths:[],matrix:{strategies:[],stakeholders:[],reactions:[]},outcomes:[],challenges:[],recommendations:[]}:ER(u,c)}function Vy(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return _R(n)?"agent_swarm":"generic_json"}catch{}return PR(t)?"anylogic_csv":TR(t)?"netlogo":AR(t)?"mesa":"freeform_text"}function _R(e){if(typeof e!="object"||e===null)return!1;const t=e;return(Array.isArray(t.agents)||Array.isArray(t.fish)||Array.isArray(t.swarm))&&(t.emergent_behaviors!==void 0||t.emergent_dynamics!==void 0||t.timeline!==void 0||t.simulation!==void 0)}function PR(e){const t=e.split(`
440
+ `).filter(l=>l.trim());if(t.length<2)return!1;const n=t[0];if(!n.includes(","))return!1;const r=n.split(",").map(l=>l.trim()),s=t[1].split(","),i=r.some(l=>/^[a-zA-Z_]/.test(l)),a=s.some(l=>!isNaN(Number(l.trim())));return i&&a&&r.length>=2}function TR(e){const t=e.split(`
441
+ `).filter(a=>a.trim()),n=/^[\w-]+\s*:\s*.+$/,r=/tick|step|round|iteration/i,s=t.filter(a=>n.test(a.trim())).length,i=t.some(a=>r.test(a));return s>=3&&s>=t.length*.5||s>=2&&i}function AR(e){const t=e.split(`
442
+ `).filter(s=>s.trim()),n=/^(?:agent|player|entity)\s+\d+\s*:\s*.+$/i,r=t.filter(s=>n.test(s.trim())).length;return r>=2&&r>=t.length*.3}function IR(e){switch(Vy(e)){case"agent_swarm":return MR(e);case"netlogo":return OR(e);case"mesa":return LR(e);case"anylogic_csv":return $R(e);case"generic_json":return DR(e);case"freeform_text":return FR(e)}}function MR(e){const t=JSON.parse(e.trim()),n=[],r=[],s=[],i=[],a=[],l=[],c=t.agents||t.fish||t.swarm||[];for(const u of c)n.push({id:u.id||u.name||u.type||`agent_${n.length}`,type:u.type||u.role||"agent",state:u.state||u.status,action:u.reaction||u.action||u.behavior,attributes:Uy(u,["id","name","type","role","state","status","reaction","action","behavior"])}),(u.reaction||u.action)&&r.push({agents:[u.id||u.name||u.type],action:u.reaction||u.action,category:"reaction"});const d=[];if(t.emergent_behaviors)for(const u of Array.isArray(t.emergent_behaviors)?t.emergent_behaviors:[t.emergent_behaviors])d.push(typeof u=="string"?u:JSON.stringify(u));if(t.emergent_dynamics)for(const u of Array.isArray(t.emergent_dynamics)?t.emergent_dynamics:[t.emergent_dynamics])d.push(typeof u=="string"?u:JSON.stringify(u));if(t.timeline&&Array.isArray(t.timeline)){for(const u of t.timeline)if(typeof u=="object"){const{time:f,step:m,round:p,tick:v,...x}=u;a.push({time:f??m??p??v??a.length,state:x})}}if(t.steps&&Array.isArray(t.steps))for(const u of t.steps){const f=u.step??u.round??a.length;if(u.actions&&Array.isArray(u.actions))for(const m of u.actions)r.push({time:f,agents:m.agent?[m.agent]:void 0,action:m.action||m.type||JSON.stringify(m),effect:m.result||m.effect,category:"action"})}for(const[u,f]of Object.entries(t))typeof f=="number"&&!["version","seed","id"].includes(u)&&i.push({name:cs(u),value:f});return{sourceFormat:"agent_swarm",agents:n,events:r,stateChanges:s,coalitions:l,metrics:i,timeline:a,emergentBehaviors:d.length>0?d:void 0,summary:t.summary||t.description}}function OR(e){const t=e.split(`
443
+ `).filter(l=>l.trim()),n=[],r=[],s=[];let i;for(const l of t){const c=l.trim(),d=c.match(/(?:tick|step|round|iteration)\s*[:#=]?\s*(\d+)/i);if(d){i=parseInt(d[1]);continue}const u=c.match(/^([\w-]+)\s*:\s*(.+)$/);if(u){const m=u[1].trim(),p=u[2].trim(),v=parseFloat(p.replace("%",""));if(isNaN(v))s.push({id:m,type:"entity",state:p});else{const x=p.includes("%");n.push({name:cs(m),value:x?v/100:v,unit:x?"%":void 0}),r.push({variable:m,to:x?v/100:v,time:i})}continue}const f=c.match(/^([\w-]+)\s+([-\d.]+%?)$/);if(f){const m=parseFloat(f[2].replace("%",""));isNaN(m)||n.push({name:cs(f[1]),value:f[2].includes("%")?m/100:m,unit:f[2].includes("%")?"%":void 0})}}const a=/consumer|producer|trader|voter|citizen|firm|bank|government|regulator/i;for(const l of n){const c=l.name.match(a);c&&!s.some(d=>d.type===c[0].toLowerCase())&&s.push({id:c[0].toLowerCase(),type:c[0].toLowerCase(),attributes:{[l.name]:l.value}})}return{sourceFormat:"netlogo",agents:s,events:[],stateChanges:r,coalitions:[],metrics:n,timeline:i!==void 0?[{time:i,state:Object.fromEntries(n.map(l=>[l.name,l.value]))}]:[]}}function LR(e){const t=e.split(`
444
+ `).filter(i=>i.trim()),n=[],r=[],s=new Map;for(const i of t){const a=i.trim(),l=a.match(/^(?:agent|player|entity)\s+(\w+)\s*:\s*(.+)$/i);if(l){const d=l[1],u=l[2].trim();if(s.has(d))s.get(d).action=u;else{const f={id:`agent_${d}`,type:"agent",action:u};s.set(d,f),n.push(f)}r.push({agents:[`agent_${d}`],action:u,category:"action"});continue}const c=a.match(/^([A-Z][\w\s]+?)\s*:\s*(.+)$/);if(c){const d=c[1].trim(),u=c[2].trim();if(!s.has(d)){const f={id:d,type:Sl(d),action:u};s.set(d,f),n.push(f)}r.push({agents:[d],action:u,category:"action"})}}return{sourceFormat:"mesa",agents:n,events:r,stateChanges:[],coalitions:[],metrics:[],timeline:[]}}function $R(e){var d;const t=e.split(`
445
+ `).filter(u=>u.trim());if(t.length<2)return zR("anylogic_csv");const n=t[0].split(",").map(u=>u.trim().replace(/^["']|["']$/g,"")),r=[],s=[],i=new Map,a=n.findIndex(u=>/^(time|tick|step|round|t|timestamp|period|year|month|day|date)$/i.test(u));for(let u=1;u<t.length;u++){const f=t[u].split(",").map(v=>v.trim().replace(/^["']|["']$/g,""));if(f.length<n.length)continue;const m=a>=0?isNaN(Number(f[a]))?f[a]:Number(f[a]):u,p={};for(let v=0;v<n.length;v++){if(v===a)continue;const x=f[v],w=Number(x);p[n[v]]=isNaN(w)?x:w,isNaN(w)||(i.has(n[v])||i.set(n[v],[]),i.get(n[v]).push({time:m,value:w}))}r.push({time:m,state:p})}for(const[u,f]of i){const m=f[f.length-1].value,p=f[0].value,v=f.length<2?"stable":m>p*1.05?"rising":m<p*.95?"falling":"stable";s.push({name:cs(u),value:m,trend:v,series:f})}const l=[],c=/consumer|producer|trader|voter|citizen|firm|bank|government|regulator|price|supply|demand/i;for(const u of n)if(u.match(c)){const m=(d=r[r.length-1])==null?void 0:d.state;l.push({id:u,type:Sl(u),attributes:m?{value:m[u]}:void 0})}return{sourceFormat:"anylogic_csv",agents:l,events:[],stateChanges:[],coalitions:[],metrics:s,timeline:r}}function DR(e){const t=JSON.parse(e.trim()),n=[],r=[],s=[],i=[],a=[],l=[];function c(d,u=""){if(Array.isArray(d)){if(d.length>0&&typeof d[0]=="object"&&d[0]!==null){const f=d[0];if(f.id||f.name||f.agent||f.type){for(const m of d){const p=m;n.push({id:String(p.id||p.name||p.agent||`${u}_${n.length}`),type:String(p.type||p.role||p.class||"agent"),state:p.state?String(p.state):void 0,action:p.action?String(p.action):p.reaction?String(p.reaction):void 0,attributes:Uy(p,["id","name","agent","type","role","class","state","action","reaction"])})}return}if(f.time||f.step||f.tick){for(const m of d){const p=m,v=p.time??p.step??p.tick??a.length,x={};for(const[w,g]of Object.entries(p))["time","step","tick"].includes(w)||(typeof g=="number"||typeof g=="string"||typeof g=="boolean")&&(x[w]=g);a.push({time:v,state:x})}return}if(f.action||f.event){for(const m of d){const p=m;r.push({agents:p.agent?[String(p.agent)]:p.agents?p.agents:void 0,action:String(p.action||p.event||p.type||"unknown"),effect:p.effect?String(p.effect):p.result?String(p.result):void 0,time:p.time??p.step,category:"action"})}return}}}else if(typeof d=="object"&&d!==null)for(const[f,m]of Object.entries(d))typeof m=="number"?s.push({name:cs(f),value:m}):typeof m=="object"&&c(m,u?`${u}.${f}`:f)}if(typeof t=="object"&&t!==null){const d=t;if(d.agents&&c(d.agents,"agents"),d.events&&c(d.events,"events"),d.timeline&&c(d.timeline,"timeline"),d.coalitions&&Array.isArray(d.coalitions))for(const u of d.coalitions){const f=u;l.push({name:String(f.name||`coalition_${l.length}`),members:Array.isArray(f.members)?f.members.map(String):[],objective:f.objective?String(f.objective):void 0,strength:typeof f.strength=="number"?f.strength:void 0})}for(const[u,f]of Object.entries(d))["agents","events","timeline","coalitions"].includes(u)||(typeof f=="number"?s.push({name:cs(u),value:f}):typeof f=="object"&&f!==null&&c(f,u))}return{sourceFormat:"generic_json",agents:n,events:r,stateChanges:i,coalitions:l,metrics:s,timeline:a,summary:typeof t.summary=="string"?t.summary:void 0}}function FR(e){const t=e.trim(),n=[],r=[],s=[],i=[/(?:agent|player|actor|entity|stakeholder)\s*[:#]?\s*["']?(\w[\w\s]{1,25}?)["']?(?:\n|,|;|\.|$)/gi,/^[-•*]\s*(\w[\w\s]{1,20}?)(?:\s*[-:—])/gm],a=new Set;for(const f of i){let m;for(;(m=f.exec(t))!==null;){const p=m[1].trim();p.length>1&&p.length<25&&!Vh(p)&&!a.has(p.toLowerCase())&&(a.add(p.toLowerCase()),n.push({id:p,type:Sl(p)}))}}const l=/(\w[\w\s]{1,20}?)\s*(?::|—)\s*(.+?)(?:\n|$)/g;let c;for(;(c=l.exec(t))!==null;){const f=c[1].trim(),m=c[2].trim();!Vh(f)&&m.length>2&&(r.push({agents:[f],action:m,category:"action"}),a.has(f.toLowerCase())||(a.add(f.toLowerCase()),n.push({id:f,type:Sl(f),action:m})))}const d=/(\w[\w\s]{1,30}?)\s*(?:=|:)\s*([-\d.]+%?)/g;let u;for(;(u=d.exec(t))!==null;){const f=u[1].trim(),m=u[2],p=parseFloat(m.replace("%",""));!isNaN(p)&&f.length>1&&s.push({name:cs(f),value:m.includes("%")?p/100:p,unit:m.includes("%")?"%":void 0})}return{sourceFormat:"freeform_text",agents:n,events:r,stateChanges:[],coalitions:[],metrics:s,timeline:[],summary:t.length>200?t.slice(0,200)+"...":t}}function zR(e){return{sourceFormat:e,agents:[],events:[],stateChanges:[],coalitions:[],metrics:[],timeline:[]}}function cs(e){return e.replace(/[-_]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function Sl(e){const t=e.toLowerCase();return/consumer|buyer|customer|shopper/.test(t)?"consumer":/producer|supplier|manufacturer|seller/.test(t)?"producer":/government|regulator|fed|agency|authority/.test(t)?"regulator":/firm|company|corp|bank|enterprise/.test(t)?"firm":/trader|investor|speculator|market/.test(t)?"trader":/citizen|voter|public|population/.test(t)?"citizen":/politician|senator|president|leader/.test(t)?"politician":/media|press|journalist/.test(t)?"media":/military|army|defense|navy/.test(t)?"military":"agent"}function Vh(e){return new Set(["the","and","for","with","from","that","this","then","but","not","are","was","were","has","have","had","will","would","could","should","may","might","step","round","tick","time","result","output","data"]).has(e.toLowerCase())}function Uy(e,t){const n={};let r=0;for(const[s,i]of Object.entries(e))t.includes(s)||(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&(n[s]=i,r++);return r>0?n:void 0}const Wy={agent_swarm:"Agent Swarm",netlogo:"NetLogo",mesa:"Mesa (Python)",anylogic_csv:"AnyLogic / CSV",generic_json:"JSON",freeform_text:"Text"};function BR(e){if(e.agents.length>0)return e.agents.slice(0,8).map(n=>n.id);const t=new Set;for(const n of e.events)if(n.agents)for(const r of n.agents)t.add(r);if(t.size>0)return Array.from(t).slice(0,8);for(const n of e.metrics){const r=n.name.toLowerCase();/consumer|producer|trader|government|firm|citizen/.test(r)&&t.add(n.name)}return t.size>0?Array.from(t).slice(0,8):["Alpha Agent","Beta Agent","Gamma Agent","Delta Agent","Epsilon Agent"]}function VR(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function UR(e){let t=e;return()=>(t=(t*16807+0)%2147483647,t/2147483647)}function WR(e){const t=IR(e),n=t.sourceFormat,r=BR(t),s=VR(e),i=UR(s),a=t.emergentBehaviors&&t.emergentBehaviors.length>0?t.emergentBehaviors.map((w,g)=>({name:w.length>40?w.slice(0,40)+"...":w,description:w,strength:["strong","moderate","weak"][Math.min(g,2)],agents:r.filter(()=>i()>.4)})):HR(r,i),l=t.agents.length>0?t.agents.slice(0,8).map(w=>({agent:w.id,strategy:w.action||w.state||"Adaptive",rationale:w.action?`Agent exhibits "${w.action}" behavior based on simulation data`:"Strategy inferred from simulation context",effectiveness:Math.round(40+i()*55)})):GR(r,i),c=t.coalitions.length>0?t.coalitions.map(w=>({name:w.name,members:w.members,sharedObjective:w.objective||"Coordinated strategy",cohesion:w.strength??Math.round(50+i()*45)})):KR(r,i),d=qR(r,i),u=YR(r,i),f=QR(r,i),m=XR(r,f,i),p=ZR(i),v=JR(r,i),x=e_(r,f);return{patterns:a,agentStrategies:l,coalitions:c,powerDynamics:d,equilibrium:u,paths:f,matrix:m,outcomes:p,challenges:v,recommendations:x,detectedFormat:n,formatLabel:Wy[n],normalized:t}}function HR(e,t){const n=[{name:"Convergent Herding",description:"Multiple agents independently converge on similar strategies, creating a dominant behavioral cluster."},{name:"Oscillatory Competition",description:"Agents cycle between cooperative and competitive strategies in a predictable pattern."},{name:"Resource Clustering",description:"Agents concentrate around high-value nodes, creating territorial dynamics."},{name:"Cascade Adoption",description:"Strategy adoption follows a cascade pattern — once critical mass is reached, remaining agents switch rapidly."},{name:"Minority Exploitation",description:"A small group of agents consistently outperforms by exploiting the majority strategy."},{name:"Symmetry Breaking",description:"Initially symmetric agents differentiate into specialized roles over time."},{name:"Delayed Retaliation",description:"Agents employ tit-for-tat with delay, creating cycles of cooperation and defection."}],r=3+Math.floor(t()*3),s=["strong","moderate","weak"];return n.slice(0,r).map(i=>({...i,strength:s[Math.floor(t()*3)],agents:e.filter(()=>t()>.4)}))}function GR(e,t){const n=[{strategy:"Tit-for-Tat",rationale:"Mirrors opponent behavior to incentivize cooperation while punishing defection."},{strategy:"Always Cooperate",rationale:"Maximizes collective welfare at the cost of individual exploitation risk."},{strategy:"Pavlov (Win-Stay, Lose-Shift)",rationale:"Repeats successful strategies and switches after failures — simple but adaptive."},{strategy:"Grim Trigger",rationale:"Cooperates until defected against, then permanently defects — extreme deterrence."},{strategy:"Random Walk",rationale:"Unpredictable strategy prevents exploitation but sacrifices optimization."},{strategy:"Generous Tit-for-Tat",rationale:"Occasionally forgives defection to escape mutual punishment cycles."},{strategy:"Exploitative Defection",rationale:"Systematically defects to extract maximum individual payoff from cooperators."},{strategy:"Adaptive Threshold",rationale:"Adjusts cooperation threshold based on environment — cooperates in friendly environments, defects in hostile ones."}];return e.map(r=>{const s=Math.floor(t()*n.length);return{agent:r,strategy:n[s].strategy,rationale:n[s].rationale,effectiveness:Math.round(40+t()*55)}})}function KR(e,t){if(e.length<3)return[];const n=[],r=["Resource maximization through coordinated strategy","Collective defense against exploitative agents","Market dominance through price coordination","Information sharing for competitive advantage"],s=[...e].sort(()=>t()-.5),i=Math.floor(s.length/2);return n.push({name:"Primary Coalition",members:s.slice(0,i+1),sharedObjective:r[Math.floor(t()*r.length)],cohesion:Math.round(50+t()*45)}),e.length>4&&n.push({name:"Counter-Coalition",members:s.slice(i+1),sharedObjective:r[Math.floor(t()*r.length)],cohesion:Math.round(30+t()*50)}),n}function qR(e,t){const n=["driver","reactor","stabilizer","disruptor"],r={driver:["Sets the strategic direction; other agents respond to this agent's moves.","Primary initiator of action; shapes the competitive landscape."],reactor:["Responds to others' strategies rather than initiating; adaptive but not proactive.","Follows dominant trends; optimizes within established dynamics."],stabilizer:["Acts as a moderating force; dampens oscillations and promotes equilibrium.","Consistently chooses cooperative strategies; anchors the system."],disruptor:["Introduces unpredictability; breaks established patterns and forces adaptation.","High-variance strategy creates opportunities and threats for all agents."]};return e.map(s=>{const i=n[Math.floor(t()*n.length)],a=r[i];return{agent:s,role:i,influence:Math.round(20+t()*75),description:a[Math.floor(t()*a.length)]}})}function YR(e,t){const n=[{type:"Nash Equilibrium",description:"The system has reached a state where no agent can unilaterally improve their outcome by changing strategy. This equilibrium is self-enforcing but may not be globally optimal."},{type:"Pareto Suboptimal Equilibrium",description:"Agents are locked in a stable but collectively suboptimal state. A coordinated deviation could improve all agents' outcomes, but individual incentives prevent it."},{type:"Cyclical Dynamics",description:"No stable equilibrium detected. The system oscillates between states as agents continuously adapt to each other's strategies."},{type:"Mixed Strategy Equilibrium",description:"Agents randomize between strategies with specific probabilities. The equilibrium is maintained through uncertainty rather than fixed strategies."}],r=n[Math.floor(t()*n.length)],s=t()>.4;return{isStable:s,type:r.type,description:r.description,stabilityScore:Math.round(s?55+t()*40:15+t()*35),vulnerabilities:["External shock could push agents to reassess strategies",e.length>3?`Coalition between ${e[0]} and ${e[1]} could destabilize current equilibrium`:"Small agent count increases sensitivity to individual strategy changes","Information asymmetry may be masking true strategic preferences"].slice(0,2+Math.floor(t()*2))}}function QR(e,t){const n=[{name:"Coalition Reinforcement",description:"Strengthen the dominant coalition by aligning incentives and reducing defection risk among members."},{name:"Disruptor Containment",description:"Isolate disruptive agents through coordinated exclusion or counter-strategies."},{name:"Equilibrium Shift",description:"Introduce strategic perturbation to move the system toward a more favorable equilibrium state."},{name:"Cooperation Incentive Design",description:"Restructure payoff matrices to make cooperation individually rational, not just collectively optimal."},{name:"Adaptive Monitoring",description:"Implement continuous strategy monitoring and adjust response in real-time based on agent behavior changes."}];let r=0;const s=n.map((i,a)=>{const l=Math.round(15+t()*30);return r+=l,{...i,probability:l,riskLevel:t()>.6?"high":t()>.3?"medium":"low",tradeoffs:[`May alienate ${e[Math.floor(t()*e.length)]}`,"Requires sustained coordination to maintain effectiveness","Outcome depends on accurate agent behavior modeling"].slice(0,2+Math.floor(t()*2)),recommended:a===0}});return s.forEach(i=>{i.probability=Math.round(i.probability/r*100)}),s}function XR(e,t,n){const r=t.slice(0,3).map(i=>i.name),s=e.map(()=>r.map(()=>{const i=n();return i>.55?"positive":i>.25?"neutral":"negative"}));return{strategies:r,stakeholders:e,reactions:s}}function ZR(e){return[{label:"Best Case",type:"best",conditions:"All agents converge on cooperative equilibrium",description:"System achieves globally optimal state; all agents benefit from sustained cooperation.",likelihood:Math.round(10+e()*15),impactRating:Math.round(2+e()*2)},{label:"Most Likely",type:"likely",conditions:"Partial cooperation with persistent free-riding",description:"Dominant coalition maintains advantage while fringe agents exploit cooperative norms.",likelihood:Math.round(35+e()*20),impactRating:Math.round(4+e()*2)},{label:"Worst Case",type:"worst",conditions:"Coalition fracture and competitive spiral",description:"Trust breakdown triggers mutual defection; system degrades to non-cooperative equilibrium.",likelihood:Math.round(10+e()*15),impactRating:Math.round(7+e()*2)},{label:"Tail Risk",type:"tail",conditions:"Emergent adversarial strategy defeats all known counters",description:"Novel agent strategy exploits systemic vulnerability; cascading failures across the agent network.",likelihood:Math.round(2+e()*8),impactRating:Math.round(9+e())}]}function JR(e,t){return[{assumption:"Agents behave rationally",whyItMightFail:"Bounded rationality, information delays, and emergent complexity produce behaviors that deviate from game-theoretic optimality.",whatChanges:"Predictive models may fail; heuristic-based analysis becomes necessary.",severity:"high"},{assumption:"Agent strategies are observable",whyItMightFail:"Agents may employ deceptive signaling, masking true strategies behind observable actions.",whatChanges:"Strategy inference requires deeper behavioral analysis; surface patterns may mislead.",severity:"medium"},{assumption:"The environment is stationary",whyItMightFail:"Payoff structures and constraints may shift during the simulation, invalidating equilibrium analysis.",whatChanges:"Continuous recalibration needed; static equilibrium analysis insufficient.",severity:"high"},{assumption:`${e[0]} will maintain current strategy`,whyItMightFail:"Agents adapt over time; current strategy may be transitional rather than stable.",whatChanges:"Must model strategy evolution, not just current state.",severity:"medium"},{assumption:"Coalition structures are stable",whyItMightFail:"Internal incentive misalignment may cause coalition fracture under pressure.",whatChanges:"Coalition durability should be stress-tested; contingency plans for fracture needed.",severity:"critical"}].slice(0,3+Math.floor(t()*3))}function e_(e,t,n){const r=t.find(s=>s.recommended)||t[0];return[{priority:1,action:`Implement ${r.name}`,rationale:`Highest-probability intervention (${r.probability}%) for steering swarm behavior.`,timeframe:"Immediate"},{priority:2,action:"Monitor coalition stability metrics",rationale:"Early detection of coalition fracture enables preemptive intervention.",timeframe:"Continuous"},{priority:3,action:`Address ${e[e.length-1]} behavior pattern`,rationale:"Outlier agent behavior may indicate either exploitation or innovation; requires assessment.",timeframe:"Within next cycle"},{priority:4,action:"Run sensitivity analysis on payoff structure",rationale:"Small payoff changes may trigger large behavioral shifts; identify critical thresholds.",timeframe:"Before next iteration"}]}const Uh="neuroverse_theme";function wm(){const[e,t]=h.useState(()=>typeof window<"u"&&localStorage.getItem(Uh)||"dark");h.useEffect(()=>{const r=document.documentElement;e==="light"?r.classList.add("light"):r.classList.remove("light"),localStorage.setItem(Uh,e)},[e]);const n=h.useCallback(()=>{t(r=>r==="dark"?"light":"dark")},[]);return{theme:e,toggle:n}}const t_=Jl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ne=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const a=r?Ak:"button";return o.jsx(a,{className:L(t_({variant:t,size:n,className:e})),ref:i,...s})});ne.displayName="Button";const n_=({showSimulatedFuture:e,theme:t,onToggleTheme:n,isSimulating:r})=>o.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 border-b border-border bg-background/80 backdrop-blur-md",children:o.jsxs("div",{className:"container mx-auto flex items-center justify-between px-6 py-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-bold tracking-tight text-foreground",children:"NeuroVerse"}),o.jsx("span",{className:"text-[10px] text-muted-foreground tracking-wider hidden sm:inline",children:"Governed Discovery"})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[(r||e)&&o.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1.5",children:[o.jsx(pl,{className:"h-3 w-3 text-emerald-400 animate-pulse"}),o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.15em] text-emerald-400",children:"Simulation Active"})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-violet-500/30 bg-violet-500/10 px-3 py-1.5",children:[o.jsx(pl,{className:"h-3 w-3 text-violet-400 animate-pulse"}),o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.15em] text-violet-400",children:"Governed by NeuroVerse"})]})]}),n&&o.jsx(ne,{variant:"ghost",size:"icon",onClick:n,className:"h-9 w-9 rounded-full","aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,children:t==="dark"?o.jsx(BC,{className:"h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"}):o.jsx($C,{className:"h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"})}),o.jsx("div",{className:"hidden text-right md:block",children:e?o.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.2em] text-primary animate-pulse",children:"SIMULATED FUTURE"}):o.jsx("p",{className:"text-xs text-muted-foreground tracking-wider",children:"Define what matters. Agents do the rest."})})]})]})}),r_=({governance:e})=>{const t=e==null?void 0:e.neuroverse;return o.jsx("footer",{className:"border-t border-border py-8",children:o.jsxs("div",{className:"container mx-auto px-6",children:[e&&o.jsxs("div",{className:"mx-auto mb-6 max-w-3xl space-y-3",children:[o.jsx("div",{className:"rounded-lg border border-border bg-card/50 px-5 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Jo,{className:"h-4 w-4 text-primary"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[o.jsxs("span",{children:["Authority: ",o.jsx("span",{className:"text-foreground font-medium",children:e.authorityLevel.replace(/_/g," ")})]}),o.jsxs("span",{children:[e.constitutionalChecks.length," rules checked"]}),o.jsxs("span",{children:["Trace: ",o.jsx("span",{className:"font-mono",children:e.traceId.slice(0,12)})]})]})]})}),t&&o.jsx("div",{className:"rounded-lg border border-border bg-card/50 px-5 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ar,{className:"h-4 w-4 text-primary"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[o.jsxs("span",{children:["Governance: ",o.jsx("span",{className:`font-medium ${t.guardStatus==="ALLOW"?"text-emerald-400":t.guardStatus==="BLOCK"?"text-red-400":"text-yellow-400"}`,children:t.guardStatus})]}),t.worldViability&&o.jsxs("span",{children:["Status: ",o.jsx("span",{className:"text-foreground font-medium",children:t.worldViability})]}),t.rulesFired!==void 0&&o.jsxs("span",{children:[t.rulesFired," rules applied"]}),t.collapseRisk&&t.collapseRisk!=="none"&&o.jsxs("span",{children:["System risk: ",o.jsx("span",{className:`font-medium ${t.collapseRisk==="high"?"text-red-400":t.collapseRisk==="moderate"?"text-yellow-400":"text-emerald-400"}`,children:t.collapseRisk})]}),t.worldHealthScore!==void 0&&o.jsxs("span",{children:["Stability: ",t.worldHealthScore,"%"]})]})]})})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-2 text-sm text-muted-foreground",children:"Powered by a governed multi-agent simulation engine"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"We simulate, enforce rules, and analyze results."})]})]})})},s_={dark:{swarm:"#1B5E7B",reasoning:"#5BC0BE",future:"#ffffff"},light:{swarm:"#134A5E",reasoning:"#2D8B88",future:"#0F3A4A"}},Wh=40,Hh=7,Gh=3;function ld(e,t,n,r,s){if(n==="reasoning")return{x:e/(s+1)*(r+1),y:t*.5+(Math.random()-.5)*8,vx:.3+Math.random()*.2,vy:(Math.random()-.5)*.1,size:10+Math.random()*3,type:n,opacity:.9};if(n==="future")return{x:e*.75+r*30,y:t*.5+(r-1)*25,vx:.4+Math.random()*.3,vy:(r-1)*.15,size:7+Math.random()*2,type:n,opacity:.7};const i=Math.random()*Math.PI*2,a=40+Math.random()*100;return{x:e*.45+Math.cos(i)*a,y:t*.5+Math.sin(i)*a*.7,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.3,size:6+Math.random()*5,type:n,opacity:.5+Math.random()*.3}}function o_(e,t,n){const{x:r,y:s,size:i,vx:a,vy:l,opacity:c}=t,d=Math.atan2(l,a);e.save(),e.translate(r,s),e.rotate(d),e.globalAlpha=c,e.beginPath(),e.ellipse(0,0,i,i*.6,0,0,Math.PI*2),e.fillStyle=n,e.fill(),e.beginPath(),e.moveTo(-i*.7,-i*.45),e.lineTo(-i*1.4,0),e.lineTo(-i*.7,i*.45),e.closePath(),e.fill(),t.type!=="swarm"&&(e.beginPath(),e.arc(i*.3,-i*.15,i*.12,0,Math.PI*2),e.fillStyle="white",e.fill()),e.restore()}const i_=()=>{const{theme:e}=wm(),t=h.useRef(null),n=h.useRef([]),r=h.useRef(0),[s]=h.useState({width:400,height:320}),i=s_[e];return h.useEffect(()=>{const{width:a,height:l}=s,c=[];for(let m=0;m<Wh;m++)c.push(ld(a,l,"swarm",m,Wh));for(let m=0;m<Hh;m++)c.push(ld(a,l,"reasoning",m,Hh));for(let m=0;m<Gh;m++)c.push(ld(a,l,"future",m,Gh));n.current=c;const d=a*.45,u=l*.5;function f(){const m=t.current;if(!m)return;const p=m.getContext("2d");if(p){p.clearRect(0,0,a,l);for(const v of n.current){if(v.type==="swarm"){const w=d-v.x,g=u-v.y,b=Math.sqrt(w*w+g*g),y=60+Math.sin(Date.now()*.001+v.x)*30;v.vx+=w*3e-4,v.vy+=g*3e-4,v.vx+=-g*2e-4,v.vy+=w*2e-4,b<y&&(v.vx-=w*5e-4,v.vy-=g*5e-4),v.vx+=(Math.random()-.5)*.02,v.vy+=(Math.random()-.5)*.02,v.vx*=.99,v.vy*=.99}v.type==="reasoning"&&(v.vy+=(u-v.y)*.01,v.vy*=.95,v.vx=Math.max(.2,v.vx),v.x>a+20&&(v.x=-20)),v.type==="future"&&(v.vx=Math.max(.3,v.vx),v.x>a+20&&(v.x=a*.7,v.y=u+(Math.random()-.5)*50)),v.x+=v.vx,v.y+=v.vy,v.type==="swarm"&&(v.x<10&&(v.vx+=.1),v.x>a-10&&(v.vx-=.1),v.y<10&&(v.vy+=.1),v.y>l-10&&(v.vy-=.1));const x=v.type==="reasoning"?i.reasoning:v.type==="future"?i.future:i.swarm;o_(p,v,x)}r.current=requestAnimationFrame(f)}}return f(),()=>cancelAnimationFrame(r.current)},[s]),o.jsxs("div",{className:"relative",children:[o.jsx("canvas",{ref:t,width:s.width,height:s.height,className:"rounded-xl",style:{maxWidth:"100%",height:"auto"}}),o.jsx("div",{className:"absolute bottom-3 right-3",children:o.jsx("span",{className:"rounded bg-background/60 px-2 py-1 text-[10px] font-mono text-muted-foreground backdrop-blur",children:"LIVE SWARM"})})]})},a_=({onRunScenario:e,onPasteSimulation:t})=>o.jsx("section",{className:"relative overflow-hidden py-20 md:py-32",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"grid items-center gap-12 md:grid-cols-2",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"mb-4 text-4xl font-bold tracking-tight text-foreground md:text-6xl lg:text-7xl",children:["Change the rules.",o.jsx("br",{}),o.jsx("span",{className:"text-primary",children:"See why the system changed."})]}),o.jsx("p",{className:"mb-8 max-w-lg text-lg text-muted-foreground md:text-xl",children:"NV-SIM doesn't predict outcomes — it shows how they change when you change the rules."}),o.jsxs("div",{className:"flex flex-wrap gap-4",children:[o.jsxs(ne,{size:"lg",className:"px-8 py-6 text-base font-semibold tracking-wider",onClick:e,children:[o.jsx(Oi,{className:"mr-2 h-4 w-4"}),"START SIMULATION"]}),o.jsxs(ne,{size:"lg",variant:"outline",className:"px-8 py-6 text-base font-semibold tracking-wider",onClick:t,children:[o.jsx(is,{className:"mr-2 h-4 w-4"}),"LOAD DATA"]})]}),o.jsx("p",{className:"mt-8 text-sm font-medium tracking-wider text-muted-foreground",children:"We don't show you what every agent did. We show you what the system became."})]}),o.jsx("div",{className:"flex items-center justify-center",children:o.jsx(i_,{})})]})})}),dt=h.forwardRef(({className:e,type:t,...n},r)=>o.jsx("input",{type:t,className:L("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));dt.displayName="Input";const Pe=h.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:L("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Pe.displayName="Card";const Xe=h.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:L("flex flex-col space-y-1.5 p-6",e),...t}));Xe.displayName="CardHeader";const Ze=h.forwardRef(({className:e,...t},n)=>o.jsx("h3",{ref:n,className:L("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ze.displayName="CardTitle";const l_=h.forwardRef(({className:e,...t},n)=>o.jsx("p",{ref:n,className:L("text-sm text-muted-foreground",e),...t}));l_.displayName="CardDescription";const Te=h.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:L("p-6 pt-0",e),...t}));Te.displayName="CardContent";const c_=h.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:L("flex items-center p-6 pt-0",e),...t}));c_.displayName="CardFooter";const d_=Jl("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function be({className:e,variant:t,...n}){return o.jsx("div",{className:L(d_({variant:t}),e),...n})}const u_=[{name:"Incremental Path",probability:65,risk:"low",summary:"Gradual domestic production increases paired with strategic reserve releases to stabilize prices over 4–6 months.",drivers:["Strategic petroleum reserve draw-down","Expedited drilling permits","Refinery utilization optimization"],timeline:[{period:"Month 1",action:"Release 30M barrels from SPR",effect:"Prices stabilize at $4.50"},{period:"Month 2-3",action:"Fast-track 200 drilling permits",effect:"Domestic supply signal calms futures market"},{period:"Month 4-6",action:"Refinery optimization + import diversification",effect:"Prices reach $3.20 target zone"}]},{name:"Coalition Path",probability:60,risk:"medium",summary:"Build OPEC+ negotiation coalition with consumer nations to pressure production quota increases.",drivers:["Diplomatic pressure on Saudi Arabia","IEA coordinated release","Consumer nation solidarity bloc"],timeline:[{period:"Month 1",action:"Convene IEA emergency session",effect:"Coordinated 60M barrel release announced"},{period:"Month 2-3",action:"Coalition negotiation with OPEC+",effect:"Production quota increase of 500K bpd"},{period:"Month 4-6",action:"Market stabilization + long-term supply agreements",effect:"Prices settle at $2.90"}]},{name:"Direct Intervention",probability:55,risk:"high",summary:"Executive action to cap prices, mandate refinery output, and impose export restrictions.",drivers:["Emergency price controls","Defense Production Act invocation","Export ban on refined products"],timeline:[{period:"Month 1",action:"Emergency executive order on price caps",effect:"Immediate price relief but market uncertainty"},{period:"Month 2-3",action:"DPA mandates on refinery output",effect:"Supply increases but industry friction grows"},{period:"Month 4-6",action:"Gradual deregulation as supply normalizes",effect:"Prices at $2.80 but market distortions persist"}]}],f_=({onFullAnalysis:e})=>{const[t,n]=h.useState("Gas prices spike to $5/gallon"),[r,s]=h.useState("Stabilize prices under $3 within 6 months"),[i,a]=h.useState(!1),[l,c]=h.useState(null),[d,u]=h.useState(null),f=h.useCallback(()=>{a(!0),c(null),u(null)},[]),m={low:"bg-emerald-500/20 text-emerald-400",medium:"bg-yellow-500/20 text-yellow-400",high:"bg-red-500/20 text-red-400"};return o.jsx("section",{className:"border-t border-border py-16 md:py-24",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-3xl",children:[o.jsx("h2",{className:"mb-2 text-center text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"TRY IT NOW"}),o.jsx("p",{className:"mb-8 text-center text-muted-foreground",children:"Describe a situation and desired outcome. See what strategies emerge."}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1.5 block text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Current Situation"}),o.jsx(dt,{value:t,onChange:p=>n(p.target.value),className:"text-sm",placeholder:"What's happening?"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1.5 block text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Desired Outcome"}),o.jsx(dt,{value:r,onChange:p=>s(p.target.value),className:"text-sm",placeholder:"Where do you want to end up?"})]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsx(ne,{className:"px-8 py-5 text-sm font-semibold tracking-wider",onClick:f,children:"FIND SOLUTIONS"}),i&&e&&o.jsxs(ne,{variant:"outline",className:"px-6 py-5 text-sm font-semibold tracking-wider",onClick:()=>e(t,r),children:["FULL REPORT ",o.jsx(I0,{className:"ml-1.5 h-4 w-4"})]})]})]}),i&&o.jsx("div",{className:"mt-10 space-y-4 animate-in fade-in-0 slide-in-from-bottom-4 duration-500",children:u_.map((p,v)=>o.jsxs(Pe,{className:"border-border overflow-hidden",children:[o.jsx(Xe,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ze,{className:"text-base",children:p.name}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(be,{className:L("text-xs font-mono",m[p.risk]),children:[p.risk," risk"]}),o.jsxs("span",{className:"text-lg font-bold text-primary",children:[p.probability,"%"]})]})]})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:p.summary}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(ne,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>c(l===v?null:v),children:[o.jsx(yt,{className:L("mr-1 h-3 w-3 transition-transform",l===v&&"rotate-180")}),"SHOW WHY"]}),o.jsxs(ne,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>u(d===v?null:v),children:[o.jsx(Zf,{className:"mr-1 h-3 w-3"}),"TIMELINE"]}),o.jsxs(ne,{size:"sm",variant:"ghost",className:"text-xs",children:[o.jsx(Mi,{className:"mr-1 h-3 w-3"}),"MODIFY"]})]}),l===v&&o.jsxs("div",{className:"mt-4 rounded-md border border-border bg-muted/30 p-4 animate-in fade-in-0 slide-in-from-top-2",children:[o.jsx("h4",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Key Drivers"}),o.jsx("ul",{className:"space-y-1.5",children:p.drivers.map((x,w)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-foreground",children:[o.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-primary"}),x]},w))})]}),d===v&&o.jsx("div",{className:"mt-4 animate-in fade-in-0 slide-in-from-top-2",children:o.jsx("div",{className:"relative ml-3 border-l-2 border-primary/30 pl-6 space-y-4",children:p.timeline.map((x,w)=>o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute -left-[31px] top-1 h-3 w-3 rounded-full border-2 border-primary bg-background"}),o.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:x.period}),o.jsx("div",{className:"text-sm text-foreground",children:x.action}),o.jsx("div",{className:"text-xs text-muted-foreground",children:x.effect})]},w))})})]})]},v))})]})})})},$i=h.forwardRef(({className:e,...t},n)=>o.jsx("textarea",{className:L("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));$i.displayName="Textarea";const m_=({onExplain:e,isLoading:t})=>{const[n,r]=h.useState(""),s=h.useMemo(()=>{if(!n.trim()||n.trim().length<10)return null;try{const i=Vy(n);return{format:i,label:Wy[i]}}catch{return null}},[n]);return o.jsx("section",{className:"py-16 md:py-24",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[o.jsx("h2",{className:"mb-2 text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"ANALYZE RESULTS"}),o.jsx("h3",{className:"mb-3 text-3xl font-bold tracking-tight text-foreground md:text-4xl",children:"Upload Simulation Data"}),o.jsxs("p",{className:"mb-8 text-muted-foreground",children:["Paste results from any simulation tool — we auto-detect the format.",o.jsx("br",{}),o.jsx("span",{className:"text-xs",children:"JSON, CSV, key-value, or plain text supported."})]}),o.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-1",children:[o.jsx($i,{placeholder:`Paste simulation results here...
446
+
447
+ Supported formats:
448
+ • JSON (agents, behaviors, metrics)
449
+ • CSV (time series, variable columns)
450
+ • Key-value logs (step: value)
451
+ • Plain text descriptions`,className:"min-h-[200px] resize-none border-0 bg-transparent font-mono text-sm text-foreground placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",value:n,onChange:i=>r(i.target.value)}),s&&o.jsx("div",{className:"absolute bottom-3 right-3",children:o.jsxs(be,{variant:"outline",className:"text-[10px] uppercase tracking-wider",children:["Detected: ",s.label]})})]}),o.jsx(ne,{className:"mt-6 px-10 py-6 text-base font-semibold tracking-wider",onClick:()=>e(n),disabled:!n.trim()||t,children:t?"ANALYZING...":"ANALYZE"})]})})})};var Nm="Progress",Sm=100,[p_,B3]=Bt(Nm),[h_,g_]=p_(Nm),Hy=h.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=x_,...a}=e;(s||s===0)&&!Kh(s)&&console.error(v_(`${s}`,"Progress"));const l=Kh(s)?s:Sm;r!==null&&!qh(r,l)&&console.error(y_(`${r}`,"Progress"));const c=qh(r,l)?r:null,d=jl(c)?i(c,l):void 0;return o.jsx(h_,{scope:n,value:c,max:l,children:o.jsx(Y.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":jl(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":qy(c,l),"data-value":c??void 0,"data-max":l,...a,ref:t})})});Hy.displayName=Nm;var Gy="ProgressIndicator",Ky=h.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=g_(Gy,n);return o.jsx(Y.div,{"data-state":qy(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});Ky.displayName=Gy;function x_(e,t){return`${Math.round(e/t*100)}%`}function qy(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function jl(e){return typeof e=="number"}function Kh(e){return jl(e)&&!isNaN(e)&&e>0}function qh(e,t){return jl(e)&&!isNaN(e)&&e<=t&&e>=0}function v_(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Sm}\`.`}function y_(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
452
+ - a positive number
453
+ - less than the value passed to \`max\` (or ${Sm} if no \`max\` prop is set)
454
+ - \`null\` or \`undefined\` if the progress is indeterminate.
455
+
456
+ Defaulting to \`null\`.`}var Yy=Hy,b_=Ky;const Bo=h.forwardRef(({className:e,value:t,...n},r)=>o.jsx(Yy,{ref:r,className:L("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:o.jsx(b_,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Bo.displayName=Yy.displayName;const w_={strong:"bg-primary text-primary-foreground",moderate:"bg-secondary text-secondary-foreground",weak:"bg-muted text-muted-foreground"},N_={driver:"bg-primary text-primary-foreground",reactor:"bg-secondary text-secondary-foreground",stabilizer:"bg-accent text-accent-foreground",disruptor:"bg-destructive text-destructive-foreground"},S_=({result:e})=>o.jsxs("section",{className:"space-y-12 py-12",children:[o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h3",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Emergent Patterns"}),o.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.patterns.map((t,n)=>o.jsxs(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*100}ms`},children:[o.jsx(Xe,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ze,{className:"text-base",children:t.name}),o.jsx(be,{className:w_[t.strength],children:t.strength})]})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:t.description}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.agents.map((r,s)=>o.jsx("span",{className:"rounded-sm bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:r},s))})]})]},n))})]}),o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h3",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Dominant Strategies per Agent"}),o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.agentStrategies.map((t,n)=>o.jsx(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*80}ms`},children:o.jsxs(Te,{className:"pt-6",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[o.jsx("span",{className:"font-semibold text-foreground",children:t.agent}),o.jsxs("span",{className:"text-sm text-primary",children:[t.effectiveness,"% effective"]})]}),o.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t.strategy}),o.jsx("p",{className:"text-xs text-muted-foreground",children:t.rationale}),o.jsx(Bo,{value:t.effectiveness,className:"mt-3 h-1.5"})]})},n))})]}),o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h3",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Coalition Detection"}),o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.coalitions.map((t,n)=>o.jsxs(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*100}ms`},children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:t.name})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:t.sharedObjective}),o.jsx("div",{className:"mb-3 flex flex-wrap gap-1.5",children:t.members.map((r,s)=>o.jsx(be,{variant:"outline",className:"text-xs",children:r},s))}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Cohesion"}),o.jsx(Bo,{value:t.cohesion,className:"h-1.5 flex-1"}),o.jsxs("span",{className:"text-xs text-primary",children:[t.cohesion,"%"]})]})]})]},n))})]}),o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h3",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Power Dynamics"}),o.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.powerDynamics.map((t,n)=>o.jsx(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*80}ms`},children:o.jsxs(Te,{className:"pt-6",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[o.jsx("span",{className:"font-semibold text-foreground",children:t.agent}),o.jsx(be,{className:N_[t.role],children:t.role})]}),o.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:t.description}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Influence"}),o.jsx(Bo,{value:t.influence,className:"h-1.5 flex-1"}),o.jsxs("span",{className:"text-xs text-primary",children:[t.influence,"%"]})]})]})},n))})]}),o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h3",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Equilibrium Analysis"}),o.jsx(Pe,{className:"border-border",children:o.jsxs(Te,{className:"pt-6",children:[o.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[o.jsx(be,{className:e.equilibrium.isStable?"bg-primary text-primary-foreground":"bg-destructive text-destructive-foreground",children:e.equilibrium.isStable?"Stable":"Unstable"}),o.jsx("span",{className:"text-lg font-semibold text-foreground",children:e.equilibrium.type})]}),o.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:e.equilibrium.description}),o.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Stability Score"}),o.jsx(Bo,{value:e.equilibrium.stabilityScore,className:"h-2 flex-1"}),o.jsxs("span",{className:"text-sm font-medium text-primary",children:[e.equilibrium.stabilityScore,"%"]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-foreground",children:"Vulnerabilities:"}),o.jsx("ul",{className:"space-y-1",children:e.equilibrium.vulnerabilities.map((t,n)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[o.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-destructive"}),t]},n))})]})]})})]})]}),Yh=[{label:"Choose Scenario",description:"Pick a preset or describe your own situation",color:"text-muted-foreground"},{label:"Set Rules",description:"Define constraints, limits, and governance rules",color:"text-muted-foreground"},{label:"Run Simulation",description:"Multi-agent simulation with rules applied in real time",color:"text-primary"},{label:"See What Changed",description:"Watch rules block, pause, and reshape agent behavior",color:"text-primary"},{label:"Generate Report",description:"Governed analysis with metrics and counterfactuals",color:"text-primary"}],j_=[{word:"Simulate",description:"Run multi-agent scenarios with real dynamics"},{word:"Govern",description:"Apply rules that reshape outcomes in real time"},{word:"Understand",description:"See exactly what changed and why"}],k_=()=>o.jsx("section",{className:"border-t border-border py-16 md:py-24",children:o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h2",{className:"mb-2 text-center text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"HOW IT WORKS"}),o.jsx("p",{className:"mb-12 text-center text-lg text-muted-foreground",children:"From scenario to insight in five steps"}),o.jsx("div",{className:"mx-auto max-w-sm",children:Yh.map((e,t)=>o.jsxs("div",{children:[o.jsxs("div",{className:"rounded-lg border border-border bg-card px-5 py-4 text-center",children:[o.jsx("div",{className:`text-sm font-bold tracking-wider ${e.color}`,children:e.label}),o.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:e.description})]}),t<Yh.length-1&&o.jsx("div",{className:"flex justify-center py-2",children:o.jsx(jC,{className:"h-4 w-4 text-primary/50"})})]},e.label))}),o.jsx("div",{className:"mx-auto mt-16 grid max-w-3xl gap-8 md:grid-cols-3",children:j_.map(e=>o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"mb-2 text-2xl font-bold tracking-tight text-foreground",children:e.word}),o.jsx("div",{className:"text-sm text-muted-foreground",children:e.description})]},e.word))})]})}),C_=`{
457
+ "actor": "agent_1",
458
+ "action": "publish_result",
459
+ "world": "protein_discovery",
460
+ "context": {
461
+ "confidence": 0.45,
462
+ "sources_count": 1,
463
+ "reproduced": false
464
+ }
465
+ }`,E_=`{
466
+ "decision": "BLOCK",
467
+ "reason": "Confidence below 70% threshold",
468
+ "rule_id": "exclude-low-confidence",
469
+ "evidence": {
470
+ "condition": "result.confidence < 0.7",
471
+ "actual_value": 0.45,
472
+ "source": "exclude"
473
+ },
474
+ "modified_action": null
475
+ }`,R_=`// Define your world in plain language → AI generates this
476
+ {
477
+ "world": {
478
+ "name": "Protein Discovery",
479
+ "thesis": "Governed investigation of binding mutations"
480
+ },
481
+ "rules": [
482
+ {
483
+ "source": "exclude",
484
+ "ruleType": "BLOCK",
485
+ "condition": { "field": "result.confidence", "operator": "<", "value": 0.7 },
486
+ "effect": "Block publication"
487
+ },
488
+ {
489
+ "source": "experiment",
490
+ "ruleType": "REWARD",
491
+ "condition": { "field": "result.sources_count", "operator": ">=", "value": 3 },
492
+ "effect": "boost_influence for 3 rounds"
493
+ },
494
+ {
495
+ "source": "experiment",
496
+ "ruleType": "PENALIZE",
497
+ "condition": { "field": "agent.behavior", "operator": "matches", "value": "publish without peer validation" },
498
+ "effect": "reduce_influence for 3 rounds"
499
+ }
500
+ ],
501
+ "invariants": [
502
+ { "id": "INV-001", "label": "No unverified claims published" }
503
+ ]
504
+ }`,__=`import { govern, createGovernor } from "@neuroverseos/governance"
505
+
506
+ // One-shot evaluation
507
+ const verdict = govern(action, worldState, policyText)
508
+
509
+ // Or create a reusable governor
510
+ const gov = createGovernor({ policyText: myPolicy })
511
+ const result = gov.evaluate(action)
512
+
513
+ // result.status: "ALLOW" | "BLOCK" | "MODIFY" | "PAUSE" | "REWARD" | "PENALIZE"
514
+ // result.reason: "Confidence below 70% threshold"
515
+ // result.consequence?: { type: "freeze", rounds: 3 }
516
+ // result.reward?: { type: "boost_influence", magnitude: 2 }`,P_=()=>o.jsx("section",{className:"border-t border-border py-16 md:py-24",children:o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h2",{className:"mb-2 text-center text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"OPEN SOURCE — BUILD WITH US"}),o.jsx("p",{className:"mb-4 text-center text-lg text-muted-foreground",children:"Everything here is built on open-source governance tools you can use today."}),o.jsxs("p",{className:"mb-8 text-center text-sm text-muted-foreground/70",children:["World files, guard evaluation, simulation, validation — all from ",o.jsx("code",{className:"text-primary",children:"@neuroverseos/governance"}),"."]}),o.jsxs("div",{className:"mx-auto max-w-4xl mb-12 flex flex-wrap items-center justify-center gap-3",children:[o.jsxs("a",{href:"https://www.npmjs.com/org/neuroverseos",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/5 px-4 py-2 text-xs font-semibold text-primary hover:bg-primary/10 transition-colors",children:["npm: @neuroverseos",o.jsx(ml,{className:"h-3 w-3"})]}),o.jsxs("a",{href:"https://github.com/NeuroverseOS",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 rounded-full border border-border bg-card px-4 py-2 text-xs font-semibold text-foreground hover:bg-muted transition-colors",children:["GitHub: NeuroverseOS",o.jsx(ml,{className:"h-3 w-3"})]})]}),o.jsxs("div",{className:"mx-auto max-w-4xl space-y-8",children:[o.jsxs("div",{children:[o.jsx("div",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:'World File — what "Build World" generates'}),o.jsx("pre",{className:"overflow-auto rounded-lg border border-border bg-card p-4 text-xs text-foreground max-h-[300px]",children:o.jsx("code",{children:R_})}),o.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"This is a NeuroverseOS World Definition. Scientists describe intent in plain language → AI translates into this structure → governance engine enforces it."})]}),o.jsxs("div",{children:[o.jsx("div",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"JavaScript/TypeScript — integrate in any agent system"}),o.jsx("pre",{className:"overflow-auto rounded-lg border border-border bg-card p-4 text-xs text-foreground",children:o.jsx("code",{children:__})})]}),o.jsx("div",{className:"mb-4 rounded-md bg-card border border-border px-4 py-2",children:o.jsx("code",{className:"text-sm font-bold text-primary",children:"POST /api/evaluate"})}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Request"}),o.jsx("pre",{className:"overflow-auto rounded-lg border border-border bg-card p-4 text-xs text-foreground",children:o.jsx("code",{children:C_})})]}),o.jsxs("div",{children:[o.jsx("div",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Response"}),o.jsx("pre",{className:"overflow-auto rounded-lg border border-border bg-card p-4 text-xs text-foreground",children:o.jsx("code",{children:E_})})]})]}),o.jsxs("div",{className:"grid gap-3 md:grid-cols-3 lg:grid-cols-6",children:[o.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-red-400",children:"BLOCK"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Action stopped"})]}),o.jsxs("div",{className:"rounded-lg border border-yellow-500/20 bg-yellow-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-yellow-400",children:"MODIFY"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Action constrained"})]}),o.jsxs("div",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-orange-400",children:"PAUSE"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Action held"})]}),o.jsxs("div",{className:"rounded-lg border border-green-500/20 bg-green-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-green-400",children:"ALLOW"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Action proceeds"})]}),o.jsxs("div",{className:"rounded-lg border border-emerald-500/20 bg-emerald-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-emerald-400",children:"REWARD"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Agent boosted"})]}),o.jsxs("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/5 p-3 text-center",children:[o.jsx("div",{className:"mb-1 text-sm font-bold text-violet-400",children:"PENALIZE"}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Agent dampened"})]})]}),o.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5 space-y-3",children:[o.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:"How this tool is built"}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"World Builder"})," → translates plain language into NeuroverseOS World Definition files using AI"]}),o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"Guard Engine"})," → ",o.jsx("code",{className:"text-primary",children:"evaluateGuard()"})," from @neuroverseos/governance evaluates every action deterministically"]}),o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"Simulation"})," → ",o.jsx("code",{className:"text-primary",children:"simulateWorld()"})," runs deterministic state evolution through rules and gates"]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"Validation"})," → ",o.jsx("code",{className:"text-primary",children:"validateWorld()"})," checks world health, invariant coverage, and governance completeness"]}),o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"Incentive System"})," → REWARD/PENALIZE verdicts with consequences (freeze, cooldown, boost_influence) tracked per-agent"]}),o.jsxs("p",{children:[o.jsx("span",{className:"text-foreground font-semibold",children:"Audit Trail"})," → every governance decision is traced with full evidence for reproducibility"]})]})]})]}),o.jsx("div",{className:"mt-4 text-center text-xs text-muted-foreground",children:"Stateless. Deterministic. Open source. Works with any agent system."})]})]})}),T_=[{title:"Gas Price Shock",description:"Crude spikes to $120/barrel. Domestic pump prices exceed $5. Election in 6 months.",tags:["economic","energy","political"]},{title:"AI Regulation Crisis",description:"Major AI safety incident triggers emergency legislation proposals across G7.",tags:["regulation","technology","global"]},{title:"Strait of Hormuz",description:"Iran threatens closure. 20% of global oil transits through the strait.",tags:["geopolitical","energy","military"]},{title:"Taiwan Conflict",description:"PLA military exercises escalate near Taiwan. Semiconductor supply chain at risk.",tags:["geopolitical","supply chain","military"]},{title:"Global Supply Chain Disruption",description:"Major port strike + shipping lane conflict creates cascading delays worldwide.",tags:["economic","logistics","global"]},{title:"Cyber Attack on Banks",description:"Coordinated ransomware hits top 5 banks. Settlements frozen for 48 hours.",tags:["cybersecurity","financial","crisis"]}],A_=({onSelect:e})=>o.jsx("section",{className:"border-t border-border py-16 md:py-24",children:o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsx("h2",{className:"mb-2 text-center text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"EXAMPLE SCENARIOS"}),o.jsx("p",{className:"mb-12 text-center text-lg text-muted-foreground",children:"Click to load a scenario capsule and start exploring"}),o.jsx("div",{className:"mx-auto grid max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3",children:T_.map(t=>o.jsxs(Pe,{className:"cursor-pointer border-border transition-all duration-200 hover:border-primary/50 hover:glow-teal",onClick:()=>e(t.title,t.description),children:[o.jsx(Xe,{className:"pb-2",children:o.jsx(Ze,{className:"text-base",children:t.title})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-3 text-xs text-muted-foreground leading-relaxed",children:t.description}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.tags.map(n=>o.jsx(be,{variant:"outline",className:"text-[10px] uppercase tracking-wider",children:n},n))})]})]},t.title))})]})}),I_=({onSelectScenario:e,onCustomScenario:t,onCalculate:n,selectedId:r,customText:s,isLoading:i,hasScenario:a})=>o.jsx("section",{className:"py-16 md:py-24",children:o.jsxs("div",{className:"container mx-auto px-6",children:[o.jsxs("div",{className:"mx-auto max-w-4xl text-center",children:[o.jsx("h1",{className:"mb-3 text-3xl font-bold tracking-tight text-foreground md:text-5xl",children:"Choose a scenario."}),o.jsx("p",{className:"mb-12 text-lg text-muted-foreground",children:"Pick a preset or describe your own situation to begin"})]}),o.jsx("div",{className:"mx-auto grid max-w-5xl gap-4 md:grid-cols-3",children:xR.map(l=>o.jsxs(Pe,{className:`cursor-pointer border-border transition-all duration-200 hover:border-primary/50 hover:glow-teal ${r===l.id?"border-primary glow-teal":""}`,onClick:()=>e(l),children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base leading-tight",children:l.title})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-3 text-xs text-muted-foreground leading-relaxed",children:l.description}),o.jsx("div",{className:"mb-3 flex flex-wrap gap-1.5",children:l.tags.map(c=>o.jsx(be,{variant:"outline",className:"text-[10px] uppercase tracking-wider",children:c},c))}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.stakeholderCount," participants"]})]})]},l.id))}),o.jsxs("div",{className:"mx-auto mt-8 max-w-3xl",children:[o.jsx("div",{className:"rounded-lg border border-border bg-card p-1",children:o.jsx($i,{placeholder:"Or describe your own situation...",className:"min-h-[100px] resize-none border-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",value:s,onChange:l=>t(l.target.value)})}),o.jsx("div",{className:"mt-6 text-center",children:o.jsx(ne,{className:"px-12 py-6 text-base font-semibold tracking-wider",onClick:n,disabled:!a||i,children:i?"RUNNING...":"RUN SIMULATION"})})]})]})});function Si(e,[t,n]){return Math.min(n,Math.max(t,e))}var M_=h.createContext(void 0);function Di(e){const t=h.useContext(M_);return e||t||"ltr"}function jm(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Qy=["PageUp","PageDown"],Xy=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Zy={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},No="Slider",[Ou,O_,L_]=Yl(No),[Jy,V3]=Bt(No,[L_]),[$_,uc]=Jy(No),eb=h.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:u,onValueChange:f=()=>{},onValueCommit:m=()=>{},inverted:p=!1,form:v,...x}=e,w=h.useRef(new Set),g=h.useRef(0),y=a==="horizontal"?D_:F_,[N=[],S]=Un({prop:u,defaultProp:d,onChange:_=>{var A;(A=[...w.current][g.current])==null||A.focus(),f(_)}}),C=h.useRef(N);function j(_){const k=W_(N,_);P(_,k)}function E(_){P(_,g.current)}function R(){const _=C.current[g.current];N[g.current]!==_&&m(N)}function P(_,k,{commit:A}={commit:!1}){const M=q_(i),U=Y_(Math.round((_-r)/i)*i+r,M),$=Si(U,[r,s]);S((B=[])=>{const T=V_(B,$,k);if(K_(T,c*i)){g.current=T.indexOf($);const I=String(T)!==String(B);return I&&A&&m(T),I?T:B}else return B})}return o.jsx($_,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:g,thumbs:w.current,values:N,orientation:a,form:v,children:o.jsx(Ou.Provider,{scope:e.__scopeSlider,children:o.jsx(Ou.Slot,{scope:e.__scopeSlider,children:o.jsx(y,{"aria-disabled":l,"data-disabled":l?"":void 0,...x,ref:t,onPointerDown:K(x.onPointerDown,()=>{l||(C.current=N)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:j,onSlideMove:l?void 0:E,onSlideEnd:l?void 0:R,onHomeKeyDown:()=>!l&&P(r,0,{commit:!0}),onEndKeyDown:()=>!l&&P(s,N.length-1,{commit:!0}),onStepKeyDown:({event:_,direction:k})=>{if(!l){const U=Qy.includes(_.key)||_.shiftKey&&Xy.includes(_.key)?10:1,$=g.current,B=N[$],T=i*U*k;P(B+T,$,{commit:!0})}}})})})})});eb.displayName=No;var[tb,nb]=Jy(No,{startEdge:"left",endEdge:"right",size:"width",direction:1}),D_=h.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[f,m]=h.useState(null),p=oe(t,y=>m(y)),v=h.useRef(void 0),x=Di(s),w=x==="ltr",g=w&&!i||!w&&i;function b(y){const N=v.current||f.getBoundingClientRect(),S=[0,N.width],j=km(S,g?[n,r]:[r,n]);return v.current=N,j(y-N.left)}return o.jsx(tb,{scope:e.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:o.jsx(rb,{dir:x,"data-orientation":"horizontal",...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:y=>{const N=b(y.clientX);a==null||a(N)},onSlideMove:y=>{const N=b(y.clientX);l==null||l(N)},onSlideEnd:()=>{v.current=void 0,c==null||c()},onStepKeyDown:y=>{const S=Zy[g?"from-left":"from-right"].includes(y.key);d==null||d({event:y,direction:S?-1:1})}})})}),F_=h.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=h.useRef(null),f=oe(t,u),m=h.useRef(void 0),p=!s;function v(x){const w=m.current||u.current.getBoundingClientRect(),g=[0,w.height],y=km(g,p?[r,n]:[n,r]);return m.current=w,y(x-w.top)}return o.jsx(tb,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:o.jsx(rb,{"data-orientation":"vertical",...d,ref:f,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:x=>{const w=v(x.clientY);i==null||i(w)},onSlideMove:x=>{const w=v(x.clientY);a==null||a(w)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:x=>{const g=Zy[p?"from-bottom":"from-top"].includes(x.key);c==null||c({event:x,direction:g?-1:1})}})})}),rb=h.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=uc(No,n);return o.jsx(Y.span,{...d,ref:t,onKeyDown:K(e.onKeyDown,f=>{f.key==="Home"?(a(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):Qy.concat(Xy).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:K(e.onPointerDown,f=>{const m=f.target;m.setPointerCapture(f.pointerId),f.preventDefault(),u.thumbs.has(m)?m.focus():r(f)}),onPointerMove:K(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:K(e.onPointerUp,f=>{const m=f.target;m.hasPointerCapture(f.pointerId)&&(m.releasePointerCapture(f.pointerId),i(f))})})}),sb="SliderTrack",ob=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=uc(sb,n);return o.jsx(Y.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});ob.displayName=sb;var Lu="SliderRange",ib=h.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=uc(Lu,n),i=nb(Lu,n),a=h.useRef(null),l=oe(t,a),c=s.values.length,d=s.values.map(m=>cb(m,s.min,s.max)),u=c>1?Math.min(...d):0,f=100-Math.max(...d);return o.jsx(Y.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:f+"%"}})});ib.displayName=Lu;var $u="SliderThumb",ab=h.forwardRef((e,t)=>{const n=O_(e.__scopeSlider),[r,s]=h.useState(null),i=oe(t,l=>s(l)),a=h.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(z_,{...e,ref:i,index:a})}),z_=h.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...i}=e,a=uc($u,n),l=nb($u,n),[c,d]=h.useState(null),u=oe(t,b=>d(b)),f=c?a.form||!!c.closest("form"):!0,m=um(c),p=a.values[r],v=p===void 0?0:cb(p,a.min,a.max),x=U_(r,a.values.length),w=m==null?void 0:m[l.size],g=w?H_(w,v,l.direction):0;return h.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${v}% + ${g}px)`},children:[o.jsx(Ou.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(Y.span,{role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:u,style:p===void 0?{display:"none"}:e.style,onFocus:K(e.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),f&&o.jsx(lb,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},r)]})});ab.displayName=$u;var B_="RadioBubbleInput",lb=h.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=h.useRef(null),i=oe(s,r),a=jm(t);return h.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&u){const f=new Event("input",{bubbles:!0});u.call(l,t),l.dispatchEvent(f)}},[a,t]),o.jsx(Y.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});lb.displayName=B_;function V_(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,i)=>s-i)}function cb(e,t,n){const i=100/(n-t)*(e-t);return Si(i,[0,100])}function U_(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function W_(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function H_(e,t,n){const r=e/2,i=km([0,50],[0,r]);return(r-i(t)*n)*n}function G_(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function K_(e,t){if(t>0){const n=G_(e);return Math.min(...n)>=t}return!0}function km(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function q_(e){return(String(e).split(".")[1]||"").length}function Y_(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var db=eb,Q_=ob,X_=ib,Z_=ab;const Cm=h.forwardRef(({className:e,...t},n)=>o.jsxs(db,{ref:n,className:L("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(Q_,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(X_,{className:"absolute h-full bg-primary"})}),o.jsx(Z_,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Cm.displayName=db.displayName;const J_=[{key:"severity",label:"Severity",low:"Low",high:"Critical"},{key:"environmentalHostility",label:"Environmental Hostility",low:"Low",high:"High"},{key:"timePressure",label:"Time Pressure",low:"None",high:"Immediate"},{key:"regulatoryClimate",label:"Regulatory Climate",low:"Permissive",high:"Adversarial"}],eP=({values:e,onChange:t,showRecalculate:n,onRecalculate:r})=>{const s=(i,a)=>{t({...e,[i]:a[0]})};return o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ze,{className:"text-base",children:"Assumptions"}),n&&o.jsx("button",{onClick:r,className:"pulse-teal rounded-md bg-primary px-4 py-1.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary/90",children:"Re-calculate"})]})}),o.jsx(Te,{children:o.jsx("div",{className:"space-y-6",children:J_.map(i=>o.jsxs("div",{children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[o.jsx("label",{className:"text-sm font-medium text-foreground",children:i.label}),o.jsx("span",{className:"text-sm font-mono text-primary",children:e[i.key]})]}),o.jsx(Cm,{value:[e[i.key]],onValueChange:a=>s(i.key,a),min:0,max:100,step:1}),o.jsxs("div",{className:"mt-1 flex justify-between",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:i.low}),o.jsx("span",{className:"text-xs text-muted-foreground",children:i.high})]})]},i.key))})})]})};var cd=0;function tP(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qh()),document.body.insertAdjacentElement("beforeend",e[1]??Qh()),cd++,()=>{cd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cd--}},[])}function Qh(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dd="focusScope.autoFocusOnMount",ud="focusScope.autoFocusOnUnmount",Xh={bubbles:!1,cancelable:!0},nP="FocusScope",ub=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=e,[l,c]=h.useState(null),d=Be(s),u=Be(i),f=h.useRef(null),m=oe(t,x=>c(x)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let x=function(y){if(p.paused||!l)return;const N=y.target;l.contains(N)?f.current=N:nr(f.current,{select:!0})},w=function(y){if(p.paused||!l)return;const N=y.relatedTarget;N!==null&&(l.contains(N)||nr(f.current,{select:!0}))},g=function(y){if(document.activeElement===document.body)for(const S of y)S.removedNodes.length>0&&nr(l)};document.addEventListener("focusin",x),document.addEventListener("focusout",w);const b=new MutationObserver(g);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",w),b.disconnect()}}},[r,l,p.paused]),h.useEffect(()=>{if(l){Jh.add(p);const x=document.activeElement;if(!l.contains(x)){const g=new CustomEvent(dd,Xh);l.addEventListener(dd,d),l.dispatchEvent(g),g.defaultPrevented||(rP(lP(fb(l)),{select:!0}),document.activeElement===x&&nr(l))}return()=>{l.removeEventListener(dd,d),setTimeout(()=>{const g=new CustomEvent(ud,Xh);l.addEventListener(ud,u),l.dispatchEvent(g),g.defaultPrevented||nr(x??document.body,{select:!0}),l.removeEventListener(ud,u),Jh.remove(p)},0)}}},[l,d,u,p]);const v=h.useCallback(x=>{if(!n&&!r||p.paused)return;const w=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,g=document.activeElement;if(w&&g){const b=x.currentTarget,[y,N]=sP(b);y&&N?!x.shiftKey&&g===N?(x.preventDefault(),n&&nr(y,{select:!0})):x.shiftKey&&g===y&&(x.preventDefault(),n&&nr(N,{select:!0})):g===b&&x.preventDefault()}},[n,r,p.paused]);return o.jsx(Y.div,{tabIndex:-1,...a,ref:m,onKeyDown:v})});ub.displayName=nP;function rP(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(nr(r,{select:t}),document.activeElement!==n)return}function sP(e){const t=fb(e),n=Zh(t,e),r=Zh(t.reverse(),e);return[n,r]}function fb(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Zh(e,t){for(const n of e)if(!oP(n,{upTo:t}))return n}function oP(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function iP(e){return e instanceof HTMLInputElement&&"select"in e}function nr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iP(e)&&t&&e.select()}}var Jh=aP();function aP(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=eg(e,t),e.unshift(t)},remove(t){var n;e=eg(e,t),(n=e[0])==null||n.resume()}}}function eg(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lP(e){return e.filter(t=>t.tagName!=="A")}var cP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ys=new WeakMap,pa=new WeakMap,ha={},fd=0,mb=function(e){return e&&(e.host||mb(e.parentNode))},dP=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=mb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},uP=function(e,t,n,r){var s=dP(t,Array.isArray(e)?e:[e]);ha[n]||(ha[n]=new WeakMap);var i=ha[n],a=[],l=new Set,c=new Set(s),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))u(m);else try{var p=m.getAttribute(r),v=p!==null&&p!=="false",x=(ys.get(m)||0)+1,w=(i.get(m)||0)+1;ys.set(m,x),i.set(m,w),a.push(m),x===1&&v&&pa.set(m,!0),w===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return u(t),l.clear(),fd++,function(){a.forEach(function(f){var m=ys.get(f)-1,p=i.get(f)-1;ys.set(f,m),i.set(f,p),m||(pa.has(f)||f.removeAttribute(r),pa.delete(f)),p||f.removeAttribute(n)}),fd--,fd||(ys=new WeakMap,ys=new WeakMap,pa=new WeakMap,ha={})}},fP=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=cP(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),uP(r,s,n,"aria-hidden")):function(){return null}},vn=function(){return vn=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},vn.apply(this,arguments)};function pb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function mP(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $a="right-scroll-bar-position",Da="width-before-scroll-bar",pP="with-scroll-bars-hidden",hP="--removed-body-scroll-bar-size";function md(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function gP(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var xP=typeof window<"u"?h.useLayoutEffect:h.useEffect,tg=new WeakMap;function vP(e,t){var n=gP(null,function(r){return e.forEach(function(s){return md(s,r)})});return xP(function(){var r=tg.get(n);if(r){var s=new Set(r),i=new Set(e),a=n.current;s.forEach(function(l){i.has(l)||md(l,null)}),i.forEach(function(l){s.has(l)||md(l,a)})}tg.set(n,e)},[e]),n}function yP(e){return e}function bP(e,t){t===void 0&&(t=yP);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var a=t(i,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var c=function(){var u=a;a=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){a.push(u),d()},filter:function(u){return a=a.filter(u),n}}}};return s}function wP(e){e===void 0&&(e={});var t=bP(null);return t.options=vn({async:!0,ssr:!1},e),t}var hb=function(e){var t=e.sideCar,n=pb(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,vn({},n))};hb.isSideCarExport=!0;function NP(e,t){return e.useMedium(t),hb}var gb=wP(),pd=function(){},fc=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:pd,onWheelCapture:pd,onTouchMoveCapture:pd}),s=r[0],i=r[1],a=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,v=e.noIsolation,x=e.inert,w=e.allowPinchZoom,g=e.as,b=g===void 0?"div":g,y=e.gapMode,N=pb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,C=vP([n,t]),j=vn(vn({},N),s);return h.createElement(h.Fragment,null,u&&h.createElement(S,{sideCar:gb,removeScrollBar:d,shards:f,noRelative:p,noIsolation:v,inert:x,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:y}),a?h.cloneElement(h.Children.only(l),vn(vn({},j),{ref:C})):h.createElement(b,vn({},j,{className:c,ref:C}),l))});fc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fc.classNames={fullWidth:Da,zeroRight:$a};var SP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function jP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SP();return t&&e.setAttribute("nonce",t),e}function kP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var EP=function(){var e=0,t=null;return{add:function(n){e==0&&(t=jP())&&(kP(t,n),CP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},RP=function(){var e=EP();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},xb=function(){var e=RP(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},_P={left:0,top:0,right:0,gap:0},hd=function(e){return parseInt(e||"",10)||0},PP=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[hd(n),hd(r),hd(s)]},TP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _P;var t=PP(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},AP=xb(),Gs="data-scroll-locked",IP=function(e,t,n,r){var s=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
517
+ .`.concat(pP,` {
518
+ overflow: hidden `).concat(r,`;
519
+ padding-right: `).concat(l,"px ").concat(r,`;
520
+ }
521
+ body[`).concat(Gs,`] {
522
+ overflow: hidden `).concat(r,`;
523
+ overscroll-behavior: contain;
524
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
525
+ padding-left: `.concat(s,`px;
526
+ padding-top: `).concat(i,`px;
527
+ padding-right: `).concat(a,`px;
528
+ margin-left:0;
529
+ margin-top:0;
530
+ margin-right: `).concat(l,"px ").concat(r,`;
531
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
532
+ }
533
+
534
+ .`).concat($a,` {
535
+ right: `).concat(l,"px ").concat(r,`;
536
+ }
537
+
538
+ .`).concat(Da,` {
539
+ margin-right: `).concat(l,"px ").concat(r,`;
540
+ }
541
+
542
+ .`).concat($a," .").concat($a,` {
543
+ right: 0 `).concat(r,`;
544
+ }
545
+
546
+ .`).concat(Da," .").concat(Da,` {
547
+ margin-right: 0 `).concat(r,`;
548
+ }
549
+
550
+ body[`).concat(Gs,`] {
551
+ `).concat(hP,": ").concat(l,`px;
552
+ }
553
+ `)},ng=function(){var e=parseInt(document.body.getAttribute(Gs)||"0",10);return isFinite(e)?e:0},MP=function(){h.useEffect(function(){return document.body.setAttribute(Gs,(ng()+1).toString()),function(){var e=ng()-1;e<=0?document.body.removeAttribute(Gs):document.body.setAttribute(Gs,e.toString())}},[])},OP=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;MP();var i=h.useMemo(function(){return TP(s)},[s]);return h.createElement(AP,{styles:IP(i,!t,s,n?"":"!important")})},Du=!1;if(typeof window<"u")try{var ga=Object.defineProperty({},"passive",{get:function(){return Du=!0,!0}});window.addEventListener("test",ga,ga),window.removeEventListener("test",ga,ga)}catch{Du=!1}var bs=Du?{passive:!1}:!1,LP=function(e){return e.tagName==="TEXTAREA"},vb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!LP(e)&&n[t]==="visible")},$P=function(e){return vb(e,"overflowY")},DP=function(e){return vb(e,"overflowX")},rg=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=yb(e,r);if(s){var i=bb(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},FP=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},zP=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},yb=function(e,t){return e==="v"?$P(t):DP(t)},bb=function(e,t){return e==="v"?FP(t):zP(t)},BP=function(e,t){return e==="h"&&t==="rtl"?-1:1},VP=function(e,t,n,r,s){var i=BP(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,c=t.contains(l),d=!1,u=a>0,f=0,m=0;do{if(!l)break;var p=bb(e,l),v=p[0],x=p[1],w=p[2],g=x-w-i*v;(v||g)&&yb(e,l)&&(f+=g,m+=v);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&(Math.abs(f)<1||!s)||!u&&(Math.abs(m)<1||!s))&&(d=!0),d},xa=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sg=function(e){return[e.deltaX,e.deltaY]},og=function(e){return e&&"current"in e?e.current:e},UP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},WP=function(e){return`
554
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
555
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
556
+ `)},HP=0,ws=[];function GP(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(HP++)[0],i=h.useState(xb)[0],a=h.useRef(e);h.useEffect(function(){a.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var x=mP([e.lockRef.current],(e.shards||[]).map(og),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var g=xa(x),b=n.current,y="deltaX"in x?x.deltaX:b[0]-g[0],N="deltaY"in x?x.deltaY:b[1]-g[1],S,C=x.target,j=Math.abs(y)>Math.abs(N)?"h":"v";if("touches"in x&&j==="h"&&C.type==="range")return!1;var E=rg(j,C);if(!E)return!0;if(E?S=j:(S=j==="v"?"h":"v",E=rg(j,C)),!E)return!1;if(!r.current&&"changedTouches"in x&&(y||N)&&(r.current=S),!S)return!0;var R=r.current||S;return VP(R,w,x,R==="h"?y:N,!0)},[]),c=h.useCallback(function(x){var w=x;if(!(!ws.length||ws[ws.length-1]!==i)){var g="deltaY"in w?sg(w):xa(w),b=t.current.filter(function(S){return S.name===w.type&&(S.target===w.target||w.target===S.shadowParent)&&UP(S.delta,g)})[0];if(b&&b.should){w.cancelable&&w.preventDefault();return}if(!b){var y=(a.current.shards||[]).map(og).filter(Boolean).filter(function(S){return S.contains(w.target)}),N=y.length>0?l(w,y[0]):!a.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),d=h.useCallback(function(x,w,g,b){var y={name:x,delta:w,target:g,should:b,shadowParent:KP(g)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(N){return N!==y})},1)},[]),u=h.useCallback(function(x){n.current=xa(x),r.current=void 0},[]),f=h.useCallback(function(x){d(x.type,sg(x),x.target,l(x,e.lockRef.current))},[]),m=h.useCallback(function(x){d(x.type,xa(x),x.target,l(x,e.lockRef.current))},[]);h.useEffect(function(){return ws.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,bs),document.addEventListener("touchmove",c,bs),document.addEventListener("touchstart",u,bs),function(){ws=ws.filter(function(x){return x!==i}),document.removeEventListener("wheel",c,bs),document.removeEventListener("touchmove",c,bs),document.removeEventListener("touchstart",u,bs)}},[]);var p=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(i,{styles:WP(s)}):null,p?h.createElement(OP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function KP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qP=NP(gb,GP);var wb=h.forwardRef(function(e,t){return h.createElement(fc,vn({},e,{ref:t,sideCar:qP}))});wb.classNames=fc.classNames;var YP=[" ","Enter","ArrowUp","ArrowDown"],QP=[" ","Enter"],ds="Select",[mc,pc,XP]=Yl(ds),[So,U3]=Bt(ds,[XP,oc]),hc=oc(),[ZP,Ir]=So(ds),[JP,eT]=So(ds),Nb=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:f,disabled:m,required:p,form:v}=e,x=hc(t),[w,g]=h.useState(null),[b,y]=h.useState(null),[N,S]=h.useState(!1),C=Di(d),[j,E]=Un({prop:r,defaultProp:s??!1,onChange:i,caller:ds}),[R,P]=Un({prop:a,defaultProp:l,onChange:c,caller:ds}),_=h.useRef(null),k=w?v||!!w.closest("form"):!0,[A,M]=h.useState(new Set),U=Array.from(A).map($=>$.props.value).join(";");return o.jsx(vy,{...x,children:o.jsxs(ZP,{required:p,scope:t,trigger:w,onTriggerChange:g,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:S,contentId:hs(),value:R,onValueChange:P,open:j,onOpenChange:E,dir:C,triggerPointerDownPosRef:_,disabled:m,children:[o.jsx(mc.Provider,{scope:t,children:o.jsx(JP,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback($=>{M(B=>new Set(B).add($))},[]),onNativeOptionRemove:h.useCallback($=>{M(B=>{const T=new Set(B);return T.delete($),T})},[]),children:n})}),k?o.jsxs(Gb,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:R,onChange:$=>P($.target.value),disabled:m,form:v,children:[R===void 0?o.jsx("option",{value:""}):null,Array.from(A)]},U):null]})})};Nb.displayName=ds;var Sb="SelectTrigger",jb=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=hc(n),a=Ir(Sb,n),l=a.disabled||r,c=oe(t,a.onTriggerChange),d=pc(n),u=h.useRef("touch"),[f,m,p]=qb(x=>{const w=d().filter(y=>!y.disabled),g=w.find(y=>y.value===a.value),b=Yb(w,x,g);b!==void 0&&a.onValueChange(b.value)}),v=x=>{l||(a.onOpenChange(!0),p()),x&&(a.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return o.jsx(yy,{asChild:!0,...i,children:o.jsx(Y.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Kb(a.value)?"":void 0,...s,ref:c,onClick:K(s.onClick,x=>{x.currentTarget.focus(),u.current!=="mouse"&&v(x)}),onPointerDown:K(s.onPointerDown,x=>{u.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(v(x),x.preventDefault())}),onKeyDown:K(s.onKeyDown,x=>{const w=f.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&m(x.key),!(w&&x.key===" ")&&YP.includes(x.key)&&(v(),x.preventDefault())})})})});jb.displayName=Sb;var kb="SelectValue",Cb=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:a="",...l}=e,c=Ir(kb,n),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,f=oe(t,c.onValueNodeChange);return Ue(()=>{d(u)},[d,u]),o.jsx(Y.span,{...l,ref:f,style:{pointerEvents:"none"},children:Kb(c.value)?o.jsx(o.Fragment,{children:a}):i})});Cb.displayName=kb;var tT="SelectIcon",Eb=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return o.jsx(Y.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Eb.displayName=tT;var nT="SelectPortal",Rb=e=>o.jsx(Kf,{asChild:!0,...e});Rb.displayName=nT;var us="SelectContent",_b=h.forwardRef((e,t)=>{const n=Ir(us,e.__scopeSelect),[r,s]=h.useState();if(Ue(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?ps.createPortal(o.jsx(Pb,{scope:e.__scopeSelect,children:o.jsx(mc.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),i):null}return o.jsx(Tb,{...e,ref:t})});_b.displayName=us;var Qt=10,[Pb,Mr]=So(us),rT="SelectContentImpl",sT=yi("SelectContent.RemoveScroll"),Tb=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:v,hideWhenDetached:x,avoidCollisions:w,...g}=e,b=Ir(us,n),[y,N]=h.useState(null),[S,C]=h.useState(null),j=oe(t,W=>N(W)),[E,R]=h.useState(null),[P,_]=h.useState(null),k=pc(n),[A,M]=h.useState(!1),U=h.useRef(!1);h.useEffect(()=>{if(y)return fP(y)},[y]),tP();const $=h.useCallback(W=>{const[ue,...ve]=k().map(X=>X.ref.current),[de]=ve.slice(-1),F=document.activeElement;for(const X of W)if(X===F||(X==null||X.scrollIntoView({block:"nearest"}),X===ue&&S&&(S.scrollTop=0),X===de&&S&&(S.scrollTop=S.scrollHeight),X==null||X.focus(),document.activeElement!==F))return},[k,S]),B=h.useCallback(()=>$([E,y]),[$,E,y]);h.useEffect(()=>{A&&B()},[A,B]);const{onOpenChange:T,triggerPointerDownPosRef:I}=b;h.useEffect(()=>{if(y){let W={x:0,y:0};const ue=de=>{var F,X;W={x:Math.abs(Math.round(de.pageX)-(((F=I.current)==null?void 0:F.x)??0)),y:Math.abs(Math.round(de.pageY)-(((X=I.current)==null?void 0:X.y)??0))}},ve=de=>{W.x<=10&&W.y<=10?de.preventDefault():y.contains(de.target)||T(!1),document.removeEventListener("pointermove",ue),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ve,{capture:!0})}}},[y,T,I]),h.useEffect(()=>{const W=()=>T(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[T]);const[D,Q]=qb(W=>{const ue=k().filter(F=>!F.disabled),ve=ue.find(F=>F.ref.current===document.activeElement),de=Yb(ue,W,ve);de&&setTimeout(()=>de.ref.current.focus())}),G=h.useCallback((W,ue,ve)=>{const de=!U.current&&!ve;(b.value!==void 0&&b.value===ue||de)&&(R(W),de&&(U.current=!0))},[b.value]),J=h.useCallback(()=>y==null?void 0:y.focus(),[y]),Z=h.useCallback((W,ue,ve)=>{const de=!U.current&&!ve;(b.value!==void 0&&b.value===ue||de)&&_(W)},[b.value]),pe=r==="popper"?Fu:Ab,we=pe===Fu?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:v,hideWhenDetached:x,avoidCollisions:w}:{};return o.jsx(Pb,{scope:n,content:y,viewport:S,onViewportChange:C,itemRefCallback:G,selectedItem:E,onItemLeave:J,itemTextRefCallback:Z,focusSelectedItem:B,selectedItemText:P,position:r,isPositioned:A,searchRef:D,children:o.jsx(wb,{as:sT,allowPinchZoom:!0,children:o.jsx(ub,{asChild:!0,trapped:b.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:K(s,W=>{var ue;(ue=b.trigger)==null||ue.focus({preventScroll:!0}),W.preventDefault()}),children:o.jsx(Ql,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:o.jsx(pe,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:W=>W.preventDefault(),...g,...we,onPlaced:()=>M(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:K(g.onKeyDown,W=>{const ue=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!ue&&W.key.length===1&&Q(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let de=k().filter(F=>!F.disabled).map(F=>F.ref.current);if(["ArrowUp","End"].includes(W.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const F=W.target,X=de.indexOf(F);de=de.slice(X+1)}setTimeout(()=>$(de)),W.preventDefault()}})})})})})})});Tb.displayName=rT;var oT="SelectItemAlignedPosition",Ab=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Ir(us,n),a=Mr(us,n),[l,c]=h.useState(null),[d,u]=h.useState(null),f=oe(t,j=>u(j)),m=pc(n),p=h.useRef(!1),v=h.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:g,focusSelectedItem:b}=a,y=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&x&&w&&g){const j=i.trigger.getBoundingClientRect(),E=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),P=g.getBoundingClientRect();if(i.dir!=="rtl"){const F=P.left-E.left,X=R.left-F,ge=j.left-X,ae=j.width+ge,pt=Math.max(ae,E.width),Fe=window.innerWidth-Qt,We=Si(X,[Qt,Math.max(Qt,Fe-pt)]);l.style.minWidth=ae+"px",l.style.left=We+"px"}else{const F=E.right-P.right,X=window.innerWidth-R.right-F,ge=window.innerWidth-j.right-X,ae=j.width+ge,pt=Math.max(ae,E.width),Fe=window.innerWidth-Qt,We=Si(X,[Qt,Math.max(Qt,Fe-pt)]);l.style.minWidth=ae+"px",l.style.right=We+"px"}const _=m(),k=window.innerHeight-Qt*2,A=x.scrollHeight,M=window.getComputedStyle(d),U=parseInt(M.borderTopWidth,10),$=parseInt(M.paddingTop,10),B=parseInt(M.borderBottomWidth,10),T=parseInt(M.paddingBottom,10),I=U+$+A+T+B,D=Math.min(w.offsetHeight*5,I),Q=window.getComputedStyle(x),G=parseInt(Q.paddingTop,10),J=parseInt(Q.paddingBottom,10),Z=j.top+j.height/2-Qt,pe=k-Z,we=w.offsetHeight/2,W=w.offsetTop+we,ue=U+$+W,ve=I-ue;if(ue<=Z){const F=_.length>0&&w===_[_.length-1].ref.current;l.style.bottom="0px";const X=d.clientHeight-x.offsetTop-x.offsetHeight,ge=Math.max(pe,we+(F?J:0)+X+B),ae=ue+ge;l.style.height=ae+"px"}else{const F=_.length>0&&w===_[0].ref.current;l.style.top="0px";const ge=Math.max(Z,U+x.offsetTop+(F?G:0)+we)+ve;l.style.height=ge+"px",x.scrollTop=ue-Z+x.offsetTop}l.style.margin=`${Qt}px 0`,l.style.minHeight=D+"px",l.style.maxHeight=k+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,l,d,x,w,g,i.dir,r]);Ue(()=>y(),[y]);const[N,S]=h.useState();Ue(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const C=h.useCallback(j=>{j&&v.current===!0&&(y(),b==null||b(),v.current=!1)},[y,b]);return o.jsx(aT,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(Y.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ab.displayName=oT;var iT="SelectPopperPosition",Fu=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Qt,...i}=e,a=hc(n);return o.jsx(by,{...a,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Fu.displayName=iT;var[aT,Em]=So(us,{}),zu="SelectViewport",Ib=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Mr(zu,n),a=Em(zu,n),l=oe(t,i.onViewportChange),c=h.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),o.jsx(mc.Slot,{scope:n,children:o.jsx(Y.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:K(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=a;if(m!=null&&m.current&&f){const p=Math.abs(c.current-u.scrollTop);if(p>0){const v=window.innerHeight-Qt*2,x=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),g=Math.max(x,w);if(g<v){const b=g+p,y=Math.min(v,b),N=b-y;f.style.height=y+"px",f.style.bottom==="0px"&&(u.scrollTop=N>0?N:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});Ib.displayName=zu;var Mb="SelectGroup",[lT,cT]=So(Mb),dT=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=hs();return o.jsx(lT,{scope:n,id:s,children:o.jsx(Y.div,{role:"group","aria-labelledby":s,...r,ref:t})})});dT.displayName=Mb;var Ob="SelectLabel",Lb=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=cT(Ob,n);return o.jsx(Y.div,{id:s.id,...r,ref:t})});Lb.displayName=Ob;var kl="SelectItem",[uT,$b]=So(kl),Db=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...a}=e,l=Ir(kl,n),c=Mr(kl,n),d=l.value===r,[u,f]=h.useState(i??""),[m,p]=h.useState(!1),v=oe(t,b=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,b,r,s)}),x=hs(),w=h.useRef("touch"),g=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(uT,{scope:n,value:r,disabled:s,textId:x,isSelected:d,onItemTextChange:h.useCallback(b=>{f(y=>y||((b==null?void 0:b.textContent)??"").trim())},[]),children:o.jsx(mc.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:o.jsx(Y.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:v,onFocus:K(a.onFocus,()=>p(!0)),onBlur:K(a.onBlur,()=>p(!1)),onClick:K(a.onClick,()=>{w.current!=="mouse"&&g()}),onPointerUp:K(a.onPointerUp,()=>{w.current==="mouse"&&g()}),onPointerDown:K(a.onPointerDown,b=>{w.current=b.pointerType}),onPointerMove:K(a.onPointerMove,b=>{var y;w.current=b.pointerType,s?(y=c.onItemLeave)==null||y.call(c):w.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:K(a.onPointerLeave,b=>{var y;b.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:K(a.onKeyDown,b=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&b.key===" "||(QP.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});Db.displayName=kl;var Vo="SelectItemText",Fb=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,a=Ir(Vo,n),l=Mr(Vo,n),c=$b(Vo,n),d=eT(Vo,n),[u,f]=h.useState(null),m=oe(t,g=>f(g),c.onItemTextChange,g=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,g,c.value,c.disabled)}),p=u==null?void 0:u.textContent,v=h.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=d;return Ue(()=>(x(v),()=>w(v)),[x,w,v]),o.jsxs(o.Fragment,{children:[o.jsx(Y.span,{id:c.textId,...i,ref:m}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ps.createPortal(i.children,a.valueNode):null]})});Fb.displayName=Vo;var zb="SelectItemIndicator",Bb=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return $b(zb,n).isSelected?o.jsx(Y.span,{"aria-hidden":!0,...r,ref:t}):null});Bb.displayName=zb;var Bu="SelectScrollUpButton",Vb=h.forwardRef((e,t)=>{const n=Mr(Bu,e.__scopeSelect),r=Em(Bu,e.__scopeSelect),[s,i]=h.useState(!1),a=oe(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?o.jsx(Wb,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Vb.displayName=Bu;var Vu="SelectScrollDownButton",Ub=h.forwardRef((e,t)=>{const n=Mr(Vu,e.__scopeSelect),r=Em(Vu,e.__scopeSelect),[s,i]=h.useState(!1),a=oe(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?o.jsx(Wb,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Ub.displayName=Vu;var Wb=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Mr("SelectScrollButton",n),a=h.useRef(null),l=pc(n),c=h.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),Ue(()=>{var u;const d=l().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[l]),o.jsx(Y.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:K(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:K(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:K(s.onPointerLeave,()=>{c()})})}),fT="SelectSeparator",Hb=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return o.jsx(Y.div,{"aria-hidden":!0,...r,ref:t})});Hb.displayName=fT;var Uu="SelectArrow",mT=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=hc(n),i=Ir(Uu,n),a=Mr(Uu,n);return i.open&&a.position==="popper"?o.jsx(wy,{...s,...r,ref:t}):null});mT.displayName=Uu;var pT="SelectBubbleInput",Gb=h.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=h.useRef(null),i=oe(r,s),a=jm(t);return h.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&u){const f=new Event("change",{bubbles:!0});u.call(l,t),l.dispatchEvent(f)}},[a,t]),o.jsx(Y.select,{...n,style:{...d0,...n.style},ref:i,defaultValue:t})});Gb.displayName=pT;function Kb(e){return e===""||e===void 0}function qb(e){const t=Be(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(a=>{const l=n.current+a;t(l),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function Yb(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let a=hT(e,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==n));const c=a.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function hT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gT=Nb,Qb=jb,xT=Cb,vT=Eb,yT=Rb,Xb=_b,bT=Ib,Zb=Lb,Jb=Db,wT=Fb,NT=Bb,ew=Vb,tw=Ub,nw=Hb;const gc=gT,xc=xT,Fi=h.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(Qb,{ref:r,className:L("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,o.jsx(vT,{asChild:!0,children:o.jsx(yt,{className:"h-4 w-4 opacity-50"})})]}));Fi.displayName=Qb.displayName;const rw=h.forwardRef(({className:e,...t},n)=>o.jsx(ew,{ref:n,className:L("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(EC,{className:"h-4 w-4"})}));rw.displayName=ew.displayName;const sw=h.forwardRef(({className:e,...t},n)=>o.jsx(tw,{ref:n,className:L("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(yt,{className:"h-4 w-4"})}));sw.displayName=tw.displayName;const zi=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>o.jsx(yT,{children:o.jsxs(Xb,{ref:s,className:L("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[o.jsx(rw,{}),o.jsx(bT,{className:L("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(sw,{})]})}));zi.displayName=Xb.displayName;const ST=h.forwardRef(({className:e,...t},n)=>o.jsx(Zb,{ref:n,className:L("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ST.displayName=Zb.displayName;const st=h.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(Jb,{ref:r,className:L("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(NT,{children:o.jsx(Xf,{className:"h-4 w-4"})})}),o.jsx(wT,{children:t})]}));st.displayName=Jb.displayName;const jT=h.forwardRef(({className:e,...t},n)=>o.jsx(nw,{ref:n,className:L("-mx-1 my-1 h-px bg-muted",e),...t}));jT.displayName=nw.displayName;const kT={hostile:"bg-destructive/20 text-destructive border-destructive/30",neutral:"bg-muted text-muted-foreground border-muted-foreground/30",supportive:"bg-primary/20 text-primary border-primary/30",unknown:"bg-muted text-muted-foreground border-border"},CT=({stakeholders:e,onChange:t})=>{const[n,r]=h.useState(""),[s,i]=h.useState("neutral"),a=()=>{n.trim()&&(t([...e,{id:n.trim(),disposition:s}]),r(""),i("neutral"))},l=c=>{t(e.filter((d,u)=>u!==c))};return o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:"Participants"})}),o.jsxs(Te,{children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx(dt,{placeholder:"Participant name...",value:n,onChange:c=>r(c.target.value),onKeyDown:c=>c.key==="Enter"&&a(),className:"flex-1"}),o.jsxs(gc,{value:s,onValueChange:c=>i(c),children:[o.jsx(Fi,{className:"w-[130px]",children:o.jsx(xc,{})}),o.jsxs(zi,{children:[o.jsx(st,{value:"supportive",children:"Supportive"}),o.jsx(st,{value:"neutral",children:"Neutral"}),o.jsx(st,{value:"hostile",children:"Hostile"}),o.jsx(st,{value:"unknown",children:"Unknown"})]})]}),o.jsx(ne,{size:"icon",variant:"outline",onClick:a,disabled:!n.trim(),children:o.jsx(Sr,{className:"h-4 w-4"})})]}),e.length>0&&o.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((c,d)=>o.jsxs(be,{variant:"outline",className:`gap-1.5 pr-1 ${kT[c.disposition]}`,children:[c.id,o.jsxs("span",{className:"text-[10px] opacity-70",children:["(",c.disposition,")"]}),o.jsx("button",{onClick:()=>l(d),className:"ml-0.5 rounded-full p-0.5 hover:bg-background/50",children:o.jsx(Zr,{className:"h-3 w-3"})})]},d))})]})]})};var ET="Label",ow=h.forwardRef((e,t)=>o.jsx(Y.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ow.displayName=ET;var iw=ow;const RT=Jl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),gn=h.forwardRef(({className:e,...t},n)=>o.jsx(iw,{ref:n,className:L(RT(),e),...t}));gn.displayName=iw.displayName;const _T=({values:e,onChange:t})=>o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:"Rules & Limits"})}),o.jsxs(Te,{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Time Horizon"}),o.jsx(dt,{placeholder:"e.g. 30 days, 6 months",value:e.timeHorizon,onChange:n=>t({...e,timeHorizon:n.target.value}),className:"mt-1"})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Risk Tolerance"}),o.jsxs(gc,{value:e.riskTolerance,onValueChange:n=>t({...e,riskTolerance:n}),children:[o.jsx(Fi,{className:"mt-1",children:o.jsx(xc,{})}),o.jsxs(zi,{children:[o.jsx(st,{value:"conservative",children:"Conservative"}),o.jsx(st,{value:"moderate",children:"Moderate"}),o.jsx(st,{value:"aggressive",children:"Aggressive"})]})]})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Budget"}),o.jsx(dt,{placeholder:"e.g. $10M, Unlimited",value:e.budget,onChange:n=>t({...e,budget:n.target.value}),className:"mt-1"})]})]})]}),PT=[{value:"quick",label:"Quick",description:"2 paths, surface analysis"},{value:"standard",label:"Standard",description:"3 paths, balanced"},{value:"full",label:"Full",description:"5 paths, deep analysis"},{value:"exhaustive",label:"Exhaustive",description:"8 paths, stress tests"}],TT=({value:e,onChange:t})=>o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:"Analysis Depth"})}),o.jsx(Te,{children:o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:PT.map(n=>o.jsxs("button",{onClick:()=>t(n.value),className:`rounded-lg border px-3 py-2.5 text-left transition-all ${e===n.value?"border-primary bg-primary/10 text-foreground":"border-border bg-card text-muted-foreground hover:border-primary/30"}`,children:[o.jsx("p",{className:"text-sm font-medium",children:n.label}),o.jsx("p",{className:"mt-0.5 text-[10px]",children:n.description})]},n.value))})})]}),gd="neuroverse_api_key",AT=({onKeyChange:e})=>{const[t,n]=h.useState(""),[r,s]=h.useState(!1),[i,a]=h.useState(!1);h.useEffect(()=>{const d=localStorage.getItem(gd);d&&(n(d),a(!0),e==null||e(d))},[]);const l=()=>{t.trim()?localStorage.setItem(gd,t.trim()):localStorage.removeItem(gd),e==null||e(t.trim()),a(!0),setTimeout(()=>a(!1),2e3)},c=t.trim().length>0;return o.jsxs("div",{className:"rounded-xl border-2 border-primary/20 bg-card p-5 shadow-md",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(IC,{className:"h-4 w-4 text-primary"})}),o.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Your AI Key"}),c&&i&&o.jsx("span",{className:"ml-auto rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary",children:"Saved ✓"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-1 ml-10",children:c&&i?"Key saved in your browser — ready to use.":"Powers the analysis with your chosen AI service."}),o.jsxs("p",{className:"text-[10px] text-muted-foreground/70 mb-3 ml-10",children:["Get a key from"," ",o.jsxs("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["OpenAI ",o.jsx(ml,{className:"h-2.5 w-2.5"})]})," ","or"," ",o.jsxs("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["Google AI Studio ",o.jsx(ml,{className:"h-2.5 w-2.5"})]}),". Stored in your browser only — never sent to our servers."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(dt,{type:r?"text":"password",placeholder:"sk-... or AIza...",value:t,onChange:d=>n(d.target.value),onKeyDown:d=>d.key==="Enter"&&l(),className:"pr-9 border-primary/20 focus-visible:ring-primary/30"}),o.jsx("button",{onClick:()=>s(!r),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:r?o.jsx(_C,{className:"h-4 w-4"}):o.jsx(ec,{className:"h-4 w-4"})})]}),o.jsx(ne,{size:"sm",onClick:l,className:"min-w-[60px]",children:i?o.jsx(Xf,{className:"h-4 w-4"}):"Save"})]})]})},IT=({mode:e,onChange:t})=>o.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-card p-1",children:[o.jsxs("button",{onClick:()=>t("explore"),className:L("flex-1 rounded-md px-4 py-2 text-sm font-medium transition-all",e==="explore"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx("span",{className:"block text-xs opacity-70",children:"EXPLORE"}),o.jsx("span",{className:"block text-[10px]",children:"What might happen?"})]}),o.jsxs("button",{onClick:()=>t("goal"),className:L("flex-1 rounded-md px-4 py-2 text-sm font-medium transition-all",e==="goal"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx("span",{className:"block text-xs opacity-70",children:"GOAL"}),o.jsx("span",{className:"block text-[10px]",children:"How do I get here?"})]})]}),MT=({values:e,onChange:t})=>{const[n,r]=h.useState(""),[s,i]=h.useState(""),[a,l]=h.useState(""),c=(u,f,m)=>{f.trim()&&(t({...e,[u]:[...e[u],f.trim()]}),m(""))},d=(u,f)=>{t({...e,[u]:e[u].filter((m,p)=>p!==f)})};return o.jsxs(Pe,{className:"border-primary/30 bg-primary/5",children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:"Goal: How do I get here?"})}),o.jsxs(Te,{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Desired Outcome"}),o.jsx($i,{placeholder:"Describe the outcome you want to achieve...",value:e.outcome,onChange:u=>t({...e,outcome:u.target.value}),className:"mt-1 min-h-[60px]"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Priority"}),o.jsxs(gc,{value:e.priority,onValueChange:u=>t({...e,priority:u}),children:[o.jsx(Fi,{className:"mt-1",children:o.jsx(xc,{})}),o.jsxs(zi,{children:[o.jsx(st,{value:"preferred",children:"Preferred"}),o.jsx(st,{value:"important",children:"Important"}),o.jsx(st,{value:"critical",children:"Critical"})]})]})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Timeframe"}),o.jsx(dt,{placeholder:"e.g. 30 days",value:e.timeframe,onChange:u=>t({...e,timeframe:u.target.value}),className:"mt-1"})]})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Success Criteria"}),o.jsxs("div",{className:"mt-1 flex gap-2",children:[o.jsx(dt,{placeholder:"Measurable condition...",value:n,onChange:u=>r(u.target.value),onKeyDown:u=>u.key==="Enter"&&c("successCriteria",n,r)}),o.jsx("button",{onClick:()=>c("successCriteria",n,r),className:"shrink-0 rounded-md border border-border p-2 hover:bg-muted",children:o.jsx(Sr,{className:"h-4 w-4"})})]}),e.successCriteria.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.successCriteria.map((u,f)=>o.jsxs(be,{variant:"outline",className:"gap-1 pr-1 text-xs",children:[u,o.jsx("button",{onClick:()=>d("successCriteria",f),children:o.jsx(Zr,{className:"h-3 w-3"})})]},f))})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-destructive",children:"Red Lines (must NOT happen)"}),o.jsxs("div",{className:"mt-1 flex gap-2",children:[o.jsx(dt,{placeholder:"Hard constraint...",value:s,onChange:u=>i(u.target.value),onKeyDown:u=>u.key==="Enter"&&c("redLines",s,i)}),o.jsx("button",{onClick:()=>c("redLines",s,i),className:"shrink-0 rounded-md border border-destructive/30 p-2 hover:bg-destructive/10",children:o.jsx(Sr,{className:"h-4 w-4 text-destructive"})})]}),e.redLines.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.redLines.map((u,f)=>o.jsxs(be,{variant:"outline",className:"gap-1 pr-1 text-xs border-destructive/30 text-destructive",children:[u,o.jsx("button",{onClick:()=>d("redLines",f),children:o.jsx(Zr,{className:"h-3 w-3"})})]},f))})]}),o.jsxs("div",{children:[o.jsx(gn,{className:"text-xs text-muted-foreground",children:"Available Levers"}),o.jsxs("div",{className:"mt-1 flex gap-2",children:[o.jsx(dt,{placeholder:"Tool or resource you can deploy...",value:a,onChange:u=>l(u.target.value),onKeyDown:u=>u.key==="Enter"&&c("availableLevers",a,l)}),o.jsx("button",{onClick:()=>c("availableLevers",a,l),className:"shrink-0 rounded-md border border-border p-2 hover:bg-muted",children:o.jsx(Sr,{className:"h-4 w-4"})})]}),e.availableLevers.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.availableLevers.map((u,f)=>o.jsxs(be,{variant:"outline",className:"gap-1 pr-1 text-xs border-primary/30 text-primary",children:[u,o.jsx("button",{onClick:()=>d("availableLevers",f),children:o.jsx(Zr,{className:"h-3 w-3"})})]},f))})]})]})]})},xd={REWARD:[{value:"boost_influence",label:"Boost influence"},{value:"priority",label:"Boost priority"},{value:"faster_execution",label:"Faster execution"}],PENALIZE:[{value:"reduce_influence",label:"Reduce influence"},{value:"cooldown",label:"Cooldown period"},{value:"freeze",label:"Freeze agent"}],NEUTRAL:[{value:"flag",label:"Flag for attention"},{value:"review",label:"Require review"}]},Ns={explore:["Protein mutations that improve binding affinity for SSTR2","Lightweight ceramics under 5 g/cm³ with high stiffness","Cross-domain resonance patterns between biology and engineering","Novel drug candidates for treatment-resistant depression"],exclude:["Results based on a single data source","Claims with confidence below 70%","Conclusions that contradict established thermodynamic laws","Findings that cannot be reproduced computationally"],elevate:["Multiple independent evidence streams converging","Results validated by at least two different methods","Cross-domain agreement between structural and evolutionary data","Findings with clear mechanistic explanations"],experiment:{conditions:["An agent publishes without peer validation","Two agents converge on the same finding independently","Confidence drops below 50% after replication attempt","An agent uses more than 3 data sources","A hypothesis contradicts a previously validated result"],outcomes:["Reduce that agent's influence for 3 rounds","Boost priority of the finding by 2x","Freeze the claim and require manual review","Reward with faster execution privileges","Flag for adversarial review before continuing"],verdicts:["PENALIZE","REWARD","PENALIZE","REWARD","NEUTRAL"]},openEnded:["What happens if we let agents form coalitions but penalize groupthink?","Can we make agents compete for evidence quality rather than quantity?","Try running with no exclusion rules and see what breaks","What if we reward agents that challenge the dominant consensus?"]},OT=({onWorldReady:e,onIntentChange:t,isTranslating:n})=>{const[r,s]=h.useState({explore:"",exclude:"",elevate:"",experiment:[],openEnded:""}),[i,a]=h.useState([]),[l,c]=h.useState(!1),[d,u]=h.useState(""),[f,m]=h.useState(""),[p,v]=h.useState("PENALIZE"),[x,w]=h.useState("reduce_influence"),[g,b]=h.useState(3),y=h.useCallback((k,A)=>{const M={...r,[k]:A};s(M),t==null||t(M)},[r,t]),N=h.useCallback(k=>{const A=Ns[k],M=A[Math.floor(Math.random()*A.length)];y(k,M)},[y]),S=h.useCallback(()=>{if(!d.trim()||!f.trim())return;const k={id:`ifthen_${Date.now()}`,condition:d.trim(),outcome:f.trim(),verdict:p,action:x,rounds:g},A={...r,experiment:[...r.experiment,k]};s(A),t==null||t(A),u(""),m("")},[d,f,p,x,g,r,t]),C=h.useCallback(k=>{const A={...r,experiment:r.experiment.filter(M=>M.id!==k)};s(A),t==null||t(A)},[r,t]),j=h.useCallback(()=>{const k=Math.floor(Math.random()*Ns.experiment.conditions.length),A=Ns.experiment.verdicts[k];u(Ns.experiment.conditions[k]),m(Ns.experiment.outcomes[k]),v(A),w(xd[A][0].value),b(3)},[]),E=h.useCallback(()=>{const k=Ns.openEnded;y("openEnded",k[Math.floor(Math.random()*k.length)])},[y]),R=r.explore.trim()||r.exclude.trim()||r.elevate.trim()||r.experiment.length>0||r.openEnded.trim(),P=h.useCallback(()=>{if(!R)return;const k=$T(r);a(k),c(!0),e==null||e({intent:r,rules:k,worldName:FT(r)})},[r,R,e]),_=h.useCallback(k=>{a(A=>A.filter(M=>M.id!==k))},[]);return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold text-foreground tracking-tight",children:"Define Your World"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe what matters in plain language. AI translates your intent into governance rules."})]}),o.jsx(va,{icon:o.jsx(RC,{className:"h-4 w-4"}),label:"Explore",color:"emerald",description:"What should agents investigate?",placeholder:"e.g. Protein mutations that improve binding affinity for cancer targets...",value:r.explore,onChange:k=>y("explore",k),onExample:()=>N("explore")}),o.jsx(va,{icon:o.jsx(em,{className:"h-4 w-4"}),label:"Exclude",color:"red",description:"What should never be concluded or published?",placeholder:"e.g. Results based on a single data source, claims below 70% confidence...",value:r.exclude,onChange:k=>y("exclude",k),onExample:()=>N("exclude")}),o.jsx(va,{icon:o.jsx(zC,{className:"h-4 w-4"}),label:"Elevate",color:"amber",description:"What makes a result valuable?",placeholder:"e.g. Multiple independent evidence streams converging on the same finding...",value:r.elevate,onChange:k=>y("elevate",k),onExample:()=>N("elevate")}),o.jsxs("div",{className:"rounded-xl border border-violet-500/20 bg-violet-500/5 p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-violet-500/10",children:o.jsx(WC,{className:"h-4 w-4 text-violet-400"})}),o.jsx("span",{className:"text-sm font-bold text-violet-400",children:"Shape Behavior"})]}),o.jsxs("button",{onClick:j,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:[o.jsx(Sr,{className:"h-3 w-3"}),"Example"]})]}),o.jsx("p",{className:"text-[11px] text-muted-foreground ml-9",children:"Define if/then rules with concrete consequences. This is how you engineer agent incentives."}),o.jsxs("div",{className:"space-y-2 ml-9",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-violet-400 shrink-0 w-6",children:"If"}),o.jsx(dt,{placeholder:"An agent publishes without peer validation...",value:d,onChange:k=>u(k.target.value),className:"flex-1 text-sm border-violet-500/20"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-violet-400 shrink-0 w-6",children:"Then"}),o.jsx(dt,{placeholder:"Describe what should happen...",value:f,onChange:k=>m(k.target.value),onKeyDown:k=>k.key==="Enter"&&S(),className:"flex-1 text-sm border-violet-500/20"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-violet-400 shrink-0 w-6",children:"Act"}),o.jsx("div",{className:"flex gap-1.5",children:["REWARD","PENALIZE","NEUTRAL"].map(k=>o.jsx("button",{onClick:()=>{v(k),w(xd[k][0].value)},className:`rounded-full px-3 py-1 text-[10px] font-bold uppercase tracking-wider transition-all ${p===k?k==="REWARD"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/40":k==="PENALIZE"?"bg-red-500/20 text-red-400 border border-red-500/40":"bg-zinc-500/20 text-zinc-400 border border-zinc-500/40":"text-muted-foreground/50 hover:text-muted-foreground border border-transparent"}`,children:k},k))})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-violet-400 shrink-0 w-6",children:"How"}),o.jsx("div",{className:"flex gap-1.5 flex-wrap",children:xd[p].map(k=>o.jsx("button",{onClick:()=>w(k.value),className:`rounded-md px-2.5 py-1 text-[10px] font-medium transition-all ${x===k.value?"bg-violet-500/20 text-violet-300 border border-violet-500/40":"text-muted-foreground/60 hover:text-muted-foreground border border-transparent"}`,children:k.label},k.value))}),p!=="NEUTRAL"&&o.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[o.jsx("span",{className:"text-[10px] text-muted-foreground",children:"for"}),o.jsx("select",{value:g,onChange:k=>b(Number(k.target.value)),className:"rounded border border-violet-500/20 bg-transparent px-1.5 py-0.5 text-[10px] text-foreground",children:[1,2,3,5,10].map(k=>o.jsx("option",{value:k,children:k},k))}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:"rounds"})]}),o.jsx("button",{onClick:S,disabled:!d.trim()||!f.trim(),className:"shrink-0 rounded-md border border-violet-500/30 p-1.5 hover:bg-violet-500/10 disabled:opacity-30 disabled:cursor-not-allowed",children:o.jsx(Sr,{className:"h-4 w-4 text-violet-400"})})]})]}),r.experiment.length>0&&o.jsx("div",{className:"space-y-1.5 ml-9",children:r.experiment.map(k=>{var A;return o.jsxs("div",{className:`flex items-center gap-2 rounded-lg border p-2 text-xs ${k.verdict==="REWARD"?"border-emerald-500/20 bg-emerald-500/5":k.verdict==="PENALIZE"?"border-red-500/20 bg-red-500/5":"border-zinc-500/20 bg-zinc-500/5"}`,children:[o.jsx(be,{variant:"outline",className:`shrink-0 text-[9px] ${k.verdict==="REWARD"?"border-emerald-500/30 text-emerald-400":k.verdict==="PENALIZE"?"border-red-500/30 text-red-400":"border-zinc-500/30 text-zinc-400"}`,children:k.verdict}),o.jsxs("span",{className:"text-muted-foreground",children:["If ",o.jsx("span",{className:"text-foreground",children:k.condition})]}),o.jsx(I0,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-muted-foreground",children:[(A=k.action)==null?void 0:A.replace(/_/g," "),k.rounds&&k.verdict!=="NEUTRAL"?` (${k.rounds}r)`:""," — ",k.outcome]}),o.jsx("button",{onClick:()=>C(k.id),className:"shrink-0 ml-auto text-muted-foreground/50 hover:text-foreground",children:o.jsx(Zr,{className:"h-3 w-3"})})]},k.id)})})]}),o.jsx(va,{icon:o.jsx(LC,{className:"h-4 w-4"}),label:"Advanced",color:"blue",description:"Anything else you want to test? AI will interpret this into rules.",placeholder:"e.g. What happens if we reward agents that challenge the dominant consensus?",value:r.openEnded,onChange:k=>y("openEnded",k),onExample:E}),o.jsx(ne,{onClick:P,disabled:!R||n,className:"w-full gap-2",size:"lg",children:n?o.jsxs(o.Fragment,{children:[o.jsx(OC,{className:"h-4 w-4 animate-spin"}),"Translating intent into rules..."]}):o.jsxs(o.Fragment,{children:[o.jsx(gl,{className:"h-4 w-4"}),"Build World"]})}),l&&i.length>0&&o.jsxs("div",{className:"rounded-xl border-2 border-primary/30 bg-card p-5 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(an,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-bold text-foreground",children:"Your World Rules"}),o.jsxs(be,{variant:"outline",className:"text-[10px]",children:[i.length," rules"]})]}),o.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"What this will enforce:"}),o.jsx("div",{className:"space-y-1.5",children:i.map(k=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsx(be,{variant:"outline",className:`shrink-0 mt-0.5 text-[9px] ${ig(k.ruleType).badge}`,children:k.ruleType}),o.jsx("span",{className:"text-foreground leading-relaxed",children:k.naturalLanguage}),o.jsx("button",{onClick:()=>_(k.id),className:"shrink-0 ml-auto text-muted-foreground/50 hover:text-foreground",children:o.jsx(Zr,{className:"h-3 w-3"})})]},k.id))}),o.jsxs("details",{className:"group",children:[o.jsx("summary",{className:"cursor-pointer text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:"Show enforcement conditions"}),o.jsx("div",{className:"mt-2 space-y-1 rounded-lg border border-border bg-muted/30 p-3",children:i.filter(k=>k.condition).map(k=>o.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[o.jsxs("span",{className:`font-mono shrink-0 ${ig(k.ruleType).badge}`,children:["[",k.ruleType,"]"]}),o.jsx("code",{className:"text-muted-foreground",children:k.condition})]},k.id))})]})]})]})},LT={emerald:{border:"border-emerald-500/20",bg:"bg-emerald-500/5",iconBg:"bg-emerald-500/10",iconText:"text-emerald-400",label:"text-emerald-400"},red:{border:"border-red-500/20",bg:"bg-red-500/5",iconBg:"bg-red-500/10",iconText:"text-red-400",label:"text-red-400"},amber:{border:"border-amber-500/20",bg:"bg-amber-500/5",iconBg:"bg-amber-500/10",iconText:"text-amber-400",label:"text-amber-400"},blue:{border:"border-blue-500/20",bg:"bg-blue-500/5",iconBg:"bg-blue-500/10",iconText:"text-blue-400",label:"text-blue-400"}},va=({icon:e,label:t,color:n,description:r,placeholder:s,value:i,onChange:a,onExample:l})=>{const c=LT[n];return o.jsxs("div",{className:`rounded-xl border ${c.border} ${c.bg} p-4 space-y-2`,children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${c.iconBg}`,children:o.jsx("span",{className:c.iconText,children:e})}),o.jsx("span",{className:`text-sm font-bold ${c.label}`,children:t})]}),o.jsxs("button",{onClick:l,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:[o.jsx(Sr,{className:"h-3 w-3"}),"Example"]})]}),o.jsx("p",{className:"text-[11px] text-muted-foreground ml-9",children:r}),o.jsx($i,{placeholder:s,value:i,onChange:d=>a(d.target.value),className:"min-h-[60px] resize-none border-0 bg-transparent px-0 text-sm placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"})]})};function ig(e){switch(e){case"BLOCK":case"PENALIZE":return{bg:"border-red-500/20 bg-red-500/5",badge:"border-red-500/30 text-red-400"};case"REWARD":return{bg:"border-emerald-500/20 bg-emerald-500/5",badge:"border-emerald-500/30 text-emerald-400"};case"PRIORITIZE":return{bg:"border-amber-500/20 bg-amber-500/5",badge:"border-amber-500/30 text-amber-400"};case"NEUTRAL":return{bg:"border-zinc-500/20 bg-zinc-500/5",badge:"border-zinc-500/30 text-zinc-400"};default:return{bg:"border-emerald-500/20 bg-emerald-500/5",badge:"border-emerald-500/30 text-emerald-400"}}}function $T(e){const t=[];let n=0;if(e.explore.trim()){const r=ya(e.explore);for(const s of r)t.push({id:`rule_${n++}`,source:"explore",naturalLanguage:`Agents should investigate: ${s}`,ruleType:"ALLOW",condition:`action.domain matches "${ag(s)}"`,effect:"ALLOW with priority",confidence:.8})}if(e.exclude.trim()){const r=ya(e.exclude);for(const s of r){const i=s.toLowerCase();t.push({id:`rule_${n++}`,source:"exclude",naturalLanguage:`BLOCK: ${s}`,ruleType:"BLOCK",condition:DT(i),effect:"BLOCK action",confidence:.85})}}if(e.elevate.trim()){const r=ya(e.elevate);for(const s of r)t.push({id:`rule_${n++}`,source:"elevate",naturalLanguage:`PRIORITIZE: ${s}`,ruleType:"PRIORITIZE",condition:`result satisfies "${s}"`,effect:"Boost priority score",confidence:.75})}for(const r of e.experiment){const s=r.verdict==="REWARD"?`Reward: ${r.outcome}`:r.verdict==="PENALIZE"?`Penalize: ${r.outcome}`:`Neutral observation: ${r.outcome}`;t.push({id:`rule_${n++}`,source:"experiment",naturalLanguage:`If ${r.condition} → ${r.outcome}`,ruleType:r.verdict,condition:`agent.behavior matches "${r.condition}"`,effect:s,confidence:.9})}if(e.openEnded.trim()){const r=ya(e.openEnded);for(const s of r)t.push({id:`rule_${n++}`,source:"open_ended",naturalLanguage:s,ruleType:"NEUTRAL",condition:`scenario includes "${ag(s)}"`,effect:"AI will translate this into specific rules",confidence:.6})}return t}function ya(e){return e.split(/[.;\n]+/).map(t=>t.trim()).filter(t=>t.length>3)}function ag(e){const t=new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","that","this","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","can"]);return e.toLowerCase().split(/\s+/).filter(n=>n.length>2&&!t.has(n)).slice(0,5).join(" ")}function DT(e){if(e.includes("single")&&e.includes("source"))return"result.sources.length < 2";if(e.includes("confidence")||e.includes("below")){const t=e.match(/(\d+)%?/);return`result.confidence < ${t?parseInt(t[1])/100:.7}`}return e.includes("reproduc")?"result.reproducibility === false":e.includes("contradict")?"result.contradicts_established_laws === true":`result matches exclusion: "${e.slice(0,60)}"`}function FT(e){const t=e.explore.trim();if(!t)return"Custom World";const n=t.split(/[.,;\n]/)[0].trim();return n.length<=40?n:n.slice(0,37)+"..."}const zT={low:"bg-destructive/20 text-destructive border-destructive/30",medium:"bg-warning/20 text-warning border-warning/30",high:"bg-primary/20 text-primary border-primary/30"},BT=({confidence:e})=>{const[t,n]=h.useState(!1);return o.jsxs("div",{className:"inline-block",children:[o.jsxs("button",{onClick:()=>n(!t),className:L("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",zT[e.level]),children:["Confidence: ",e.level.toUpperCase(),o.jsx(yt,{className:L("h-3 w-3 transition-transform",t&&"rotate-180")})]}),t&&o.jsx("div",{className:"mt-2 rounded-md border border-border bg-card p-3 text-xs text-muted-foreground animate-in fade-in-0 slide-in-from-top-1",children:e.reason})]})},VT={caller:"bg-primary/20 text-primary",inferred:"bg-warning/20 text-warning",default:"bg-muted text-muted-foreground"},UT=({assumptions:e})=>e.length===0?null:o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsx("div",{className:"mx-auto max-w-4xl",children:o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsx(Ze,{className:"text-base",children:"Key Assumptions"})}),o.jsx(Te,{children:o.jsx("ul",{className:"space-y-2",children:e.map((t,n)=>o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx(be,{className:`shrink-0 text-[10px] ${VT[t.source]}`,children:t.source}),o.jsx("span",{className:"text-sm text-foreground",children:t.text})]},n))})})]})})})});var vd="rovingFocusGroup.onEntryFocus",WT={bubbles:!1,cancelable:!0},Bi="RovingFocusGroup",[Wu,aw,HT]=Yl(Bi),[GT,lw]=Bt(Bi,[HT]),[KT,qT]=GT(Bi),cw=h.forwardRef((e,t)=>o.jsx(Wu.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Wu.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(YT,{...e,ref:t})})}));cw.displayName=Bi;var YT=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...f}=e,m=h.useRef(null),p=oe(t,m),v=Di(i),[x,w]=Un({prop:a,defaultProp:l??null,onChange:c,caller:Bi}),[g,b]=h.useState(!1),y=Be(d),N=aw(n),S=h.useRef(!1),[C,j]=h.useState(0);return h.useEffect(()=>{const E=m.current;if(E)return E.addEventListener(vd,y),()=>E.removeEventListener(vd,y)},[y]),o.jsx(KT,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:x,onItemFocus:h.useCallback(E=>w(E),[w]),onItemShiftTab:h.useCallback(()=>b(!0),[]),onFocusableItemAdd:h.useCallback(()=>j(E=>E+1),[]),onFocusableItemRemove:h.useCallback(()=>j(E=>E-1),[]),children:o.jsx(Y.div,{tabIndex:g||C===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:K(e.onMouseDown,()=>{S.current=!0}),onFocus:K(e.onFocus,E=>{const R=!S.current;if(E.target===E.currentTarget&&R&&!g){const P=new CustomEvent(vd,WT);if(E.currentTarget.dispatchEvent(P),!P.defaultPrevented){const _=N().filter($=>$.focusable),k=_.find($=>$.active),A=_.find($=>$.id===x),U=[k,A,..._].filter(Boolean).map($=>$.ref.current);fw(U,u)}}S.current=!1}),onBlur:K(e.onBlur,()=>b(!1))})})}),dw="RovingFocusGroupItem",uw=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=e,c=hs(),d=i||c,u=qT(dw,n),f=u.currentTabStopId===d,m=aw(n),{onFocusableItemAdd:p,onFocusableItemRemove:v,currentTabStopId:x}=u;return h.useEffect(()=>{if(r)return p(),()=>v()},[r,p,v]),o.jsx(Wu.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:o.jsx(Y.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:K(e.onMouseDown,w=>{r?u.onItemFocus(d):w.preventDefault()}),onFocus:K(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:K(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){u.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const g=ZT(w,u.orientation,u.dir);if(g!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let y=m().filter(N=>N.focusable).map(N=>N.ref.current);if(g==="last")y.reverse();else if(g==="prev"||g==="next"){g==="prev"&&y.reverse();const N=y.indexOf(w.currentTarget);y=u.loop?JT(y,N+1):y.slice(N+1)}setTimeout(()=>fw(y))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:x!=null}):a})})});uw.displayName=dw;var QT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function XT(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ZT(e,t,n){const r=XT(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QT[r]}function fw(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function JT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var eA=cw,tA=uw,vc="Tabs",[nA,W3]=Bt(vc,[lw]),mw=lw(),[rA,Rm]=nA(vc),pw=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...d}=e,u=Di(l),[f,m]=Un({prop:r,onChange:s,defaultProp:i??"",caller:vc});return o.jsx(rA,{scope:n,baseId:hs(),value:f,onValueChange:m,orientation:a,dir:u,activationMode:c,children:o.jsx(Y.div,{dir:u,"data-orientation":a,...d,ref:t})})});pw.displayName=vc;var hw="TabsList",gw=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=Rm(hw,n),a=mw(n);return o.jsx(eA,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(Y.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});gw.displayName=hw;var xw="TabsTrigger",vw=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,a=Rm(xw,n),l=mw(n),c=ww(a.baseId,r),d=Nw(a.baseId,r),u=r===a.value;return o.jsx(tA,{asChild:!0,...l,focusable:!s,active:u,children:o.jsx(Y.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:K(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?a.onValueChange(r):f.preventDefault()}),onKeyDown:K(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(r)}),onFocus:K(e.onFocus,()=>{const f=a.activationMode!=="manual";!u&&!s&&f&&a.onValueChange(r)})})})});vw.displayName=xw;var yw="TabsContent",bw=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=e,l=Rm(yw,n),c=ww(l.baseId,r),d=Nw(l.baseId,r),u=r===l.value,f=h.useRef(u);return h.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),o.jsx(Kn,{present:s||u,children:({present:m})=>o.jsx(Y.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});bw.displayName=yw;function ww(e,t){return`${e}-trigger-${t}`}function Nw(e,t){return`${e}-content-${t}`}var sA=pw,Sw=gw,jw=vw,kw=bw;const Cw=sA,_m=h.forwardRef(({className:e,...t},n)=>o.jsx(Sw,{ref:n,className:L("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));_m.displayName=Sw.displayName;const Ks=h.forwardRef(({className:e,...t},n)=>o.jsx(jw,{ref:n,className:L("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));Ks.displayName=jw.displayName;const qs=h.forwardRef(({className:e,...t},n)=>o.jsx(kw,{ref:n,className:L("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));qs.displayName=kw.displayName;const Ew=h.forwardRef(({className:e,...t},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:L("w-full caption-bottom text-sm",e),...t})}));Ew.displayName="Table";const Rw=h.forwardRef(({className:e,...t},n)=>o.jsx("thead",{ref:n,className:L("[&_tr]:border-b",e),...t}));Rw.displayName="TableHeader";const _w=h.forwardRef(({className:e,...t},n)=>o.jsx("tbody",{ref:n,className:L("[&_tr:last-child]:border-0",e),...t}));_w.displayName="TableBody";const oA=h.forwardRef(({className:e,...t},n)=>o.jsx("tfoot",{ref:n,className:L("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));oA.displayName="TableFooter";const Hu=h.forwardRef(({className:e,...t},n)=>o.jsx("tr",{ref:n,className:L("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Hu.displayName="TableRow";const Gu=h.forwardRef(({className:e,...t},n)=>o.jsx("th",{ref:n,className:L("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Gu.displayName="TableHead";const Ku=h.forwardRef(({className:e,...t},n)=>o.jsx("td",{ref:n,className:L("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ku.displayName="TableCell";const iA=h.forwardRef(({className:e,...t},n)=>o.jsx("caption",{ref:n,className:L("mt-4 text-sm text-muted-foreground",e),...t}));iA.displayName="TableCaption";const aA={low:"bg-primary text-primary-foreground",medium:"bg-warning text-primary-foreground",high:"bg-destructive text-destructive-foreground"},lA={best:"border-primary/50",likely:"border-secondary",worst:"border-warning",tail:"border-destructive"},cA={best:"text-primary",likely:"text-secondary-foreground",worst:"text-warning",tail:"text-destructive"},lg={positive:{color:"bg-primary",label:"+"},neutral:{color:"bg-muted-foreground",label:"○"},negative:{color:"bg-destructive",label:"−"}},dA=({result:e})=>o.jsx("section",{className:"border-t border-border py-12",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs(Cw,{defaultValue:"paths",className:"mx-auto max-w-5xl",children:[o.jsxs(_m,{className:"mb-8 w-full justify-start",children:[o.jsx(Ks,{value:"paths",children:"Reasoning Paths"}),o.jsx(Ks,{value:"matrix",children:"Strategy Matrix"}),o.jsx(Ks,{value:"outcomes",children:"Projected Outcomes"})]}),o.jsx(qs,{value:"paths",children:o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.paths.map((t,n)=>o.jsxs(Pe,{className:`animate-fade-in-up border-border ${t.recommended?"border-primary glow-teal":""}`,style:{animationDelay:`${n*100}ms`},children:[o.jsx(Xe,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Ze,{className:"text-base",children:[t.name,t.recommended&&o.jsx("span",{className:"ml-2 text-xs font-normal text-primary",children:"★ Recommended"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-sm font-mono text-primary",children:[t.probability,"%"]}),o.jsx(be,{className:aA[t.riskLevel],children:t.riskLevel})]})]})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:t.description}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-1.5 text-xs font-medium text-foreground",children:"Key Tradeoffs:"}),o.jsx("ul",{className:"space-y-1",children:t.tradeoffs.map((r,s)=>o.jsxs("li",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[o.jsx("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-muted-foreground"}),r]},s))})]})]})]},n))})}),o.jsx(qs,{value:"matrix",children:o.jsx(Pe,{className:"border-border",children:o.jsx(Te,{className:"pt-6",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Ew,{children:[o.jsx(Rw,{children:o.jsxs(Hu,{children:[o.jsx(Gu,{className:"text-foreground",children:"Stakeholder"}),e.matrix.strategies.map((t,n)=>o.jsx(Gu,{className:"text-center text-foreground",children:t},n))]})}),o.jsx(_w,{children:e.matrix.stakeholders.map((t,n)=>o.jsxs(Hu,{children:[o.jsx(Ku,{className:"font-medium text-foreground",children:t}),e.matrix.reactions[n].map((r,s)=>o.jsx(Ku,{className:"text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[o.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${lg[r].color}`}),o.jsx("span",{className:"text-xs text-muted-foreground",children:lg[r].label})]})},s))]},n))})]})})})})}),o.jsx(qs,{value:"outcomes",children:o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.outcomes.map((t,n)=>o.jsxs(Pe,{className:`animate-fade-in-up border-l-4 ${lA[t.type]}`,style:{animationDelay:`${n*100}ms`},children:[o.jsx(Xe,{className:"pb-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ze,{className:"text-base",children:t.label}),o.jsxs("span",{className:`text-sm font-mono ${cA[t.type]}`,children:[t.likelihood,"%"]})]})}),o.jsxs(Te,{children:[o.jsx("p",{className:"mb-2 text-xs text-muted-foreground italic",children:t.conditions}),o.jsx("p",{className:"mb-3 text-sm text-foreground",children:t.description}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Impact"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:10}).map((r,s)=>o.jsx("div",{className:`h-2 w-2 rounded-sm ${s<t.impactRating?"bg-primary":"bg-muted"}`},s))}),o.jsxs("span",{className:"text-xs font-mono text-primary",children:[t.impactRating,"/10"]})]})]})]},n))})})]})})}),uA={low:"bg-muted text-muted-foreground",medium:"bg-secondary text-secondary-foreground",high:"bg-warning text-primary-foreground",critical:"bg-destructive text-destructive-foreground"},fA=({challenges:e})=>o.jsx("section",{className:"border-t border-border py-12",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsx("h2",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Your assumptions were challenged"}),o.jsx("div",{className:"space-y-4",children:e.map((t,n)=>o.jsx(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*100}ms`},children:o.jsxs(Te,{className:"pt-6",children:[o.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[o.jsx("h4",{className:"font-semibold text-foreground",children:t.assumption}),o.jsx(be,{className:uA[t.severity],children:t.severity})]}),o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"Why it might not hold: "}),o.jsx("span",{className:"text-foreground",children:t.whyItMightFail})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:"What changes if you're wrong: "}),o.jsx("span",{className:"text-foreground",children:t.whatChanges})]})]})]})},n))})]})})}),mA=({recommendations:e})=>o.jsx("section",{className:"border-t border-border py-12",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsx("h2",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Recommendations"}),o.jsx("div",{className:"space-y-4",children:e.map((t,n)=>o.jsx(Pe,{className:"animate-fade-in-up border-border",style:{animationDelay:`${n*100}ms`},children:o.jsxs(Te,{className:"flex gap-5 pt-6",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary text-lg font-bold text-primary-foreground",children:t.priority}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"mb-1 font-semibold text-foreground",children:t.action}),o.jsx("p",{className:"mb-2 text-sm text-muted-foreground",children:t.rationale}),o.jsx("span",{className:"rounded-sm bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:t.timeframe})]})]})},n))})]})})});var yc="Switch",[pA,H3]=Bt(yc),[hA,gA]=pA(yc),Pw=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),v=oe(t,y=>p(y)),x=h.useRef(!1),w=m?u||!!m.closest("form"):!0,[g,b]=Un({prop:s,defaultProp:i??!1,onChange:d,caller:yc});return o.jsxs(hA,{scope:n,checked:g,disabled:l,children:[o.jsx(Y.button,{type:"button",role:"switch","aria-checked":g,"aria-required":a,"data-state":Mw(g),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:v,onClick:K(e.onClick,y=>{b(N=>!N),w&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})}),w&&o.jsx(Iw,{control:m,bubbles:!x.current,name:r,value:c,checked:g,required:a,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});Pw.displayName=yc;var Tw="SwitchThumb",Aw=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=gA(Tw,n);return o.jsx(Y.span,{"data-state":Mw(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});Aw.displayName=Tw;var xA="SwitchBubbleInput",Iw=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},i)=>{const a=h.useRef(null),l=oe(a,i),c=jm(n),d=um(t);return h.useEffect(()=>{const u=a.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const v=new Event("click",{bubbles:r});p.call(u,n),u.dispatchEvent(v)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Iw.displayName=xA;function Mw(e){return e?"checked":"unchecked"}var Ow=Pw,vA=Aw;const bc=h.forwardRef(({className:e,...t},n)=>o.jsx(Ow,{className:L("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:o.jsx(vA,{className:L("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));bc.displayName=Ow.displayName;const yA={low:"bg-primary/20 text-primary",moderate:"bg-warning/20 text-warning",high:"bg-destructive/20 text-destructive",critical:"bg-destructive text-destructive-foreground"},bA=({goalResult:e,onForkStrategy:t})=>{var v;const[n,r]=h.useState(null),[s,i]=h.useState(null),[a,l]=h.useState({}),[c,d]=h.useState({}),u=x=>{r(n===x?null:x)},f=x=>{i(s===x.id?null:x.id);const w={};x.levers_used.forEach(g=>{w[g]=!0}),l(w)},m=x=>{const w=Object.entries(a).filter(([,g])=>g).map(([g])=>g);t==null||t(x,w),i(null)},p=x=>e.swarm_tests.find(w=>w.strategy_id===x);return o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-5xl",children:[o.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[o.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Strategy Lab"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Recommended: ",o.jsx("span",{className:"text-primary font-medium",children:(v=e.strategies.find(x=>x.id===e.recommended_strategy_id))==null?void 0:v.label})]})]}),o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.strategies.map(x=>{const w=p(x.id),g=x.id===e.recommended_strategy_id,b=c[x.id]||"overview";return o.jsxs(Pe,{className:L("border-border transition-all",g&&"border-primary glow-teal"),children:[o.jsx(Xe,{className:"pb-2",children:o.jsx("div",{className:"flex items-start justify-between gap-2",children:o.jsxs("div",{children:[o.jsxs(Ze,{className:"text-base",children:[x.label,g&&o.jsx("span",{className:"ml-2 text-xs text-primary",children:"★"})]}),o.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[o.jsxs("span",{className:"text-xs font-mono text-primary",children:[(x.success_probability*100).toFixed(0),"% success"]}),o.jsxs(be,{className:yA[x.risk],children:[x.risk," risk"]}),x.red_line_violations.length>0&&o.jsx(be,{variant:"destructive",className:"text-[10px]",children:"RED LINE"})]})]})})}),o.jsxs(Te,{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:x.description}),o.jsxs(Cw,{value:b,onValueChange:y=>d(N=>({...N,[x.id]:y})),children:[o.jsxs(_m,{className:"h-8 w-full",children:[o.jsx(Ks,{value:"overview",className:"text-xs flex-1",children:"Overview"}),o.jsxs(Ks,{value:"timeline",className:"text-xs flex-1",children:[o.jsx(Zf,{className:"mr-1 h-3 w-3"}),"Timeline"]})]}),o.jsxs(qs,{value:"overview",className:"mt-3 space-y-2",children:[o.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Levers:"})," ",x.levers_used.join(", ")]}),o.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Timeframe:"})," ",x.estimated_timeframe]}),w&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Swarm result:"})," ",w.goal_reached?"Goal reached":`${(w.goal_proximity*100).toFixed(0)}% proximity`]})]}),o.jsx(qs,{value:"timeline",className:"mt-3",children:o.jsx("div",{className:"relative ml-3 border-l border-border pl-4",children:x.steps.map(y=>o.jsxs("div",{className:"relative mb-4 last:mb-0",children:[o.jsx("div",{className:"absolute -left-[21px] top-1 h-3 w-3 rounded-full border-2 border-primary bg-background"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:y.timeframe}),o.jsx("p",{className:"text-xs font-medium text-foreground",children:y.action}),o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Lever: ",y.lever," · Effect: ",y.expected_effect]})]},y.order))})})]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[o.jsxs(ne,{size:"sm",variant:"outline",className:"text-xs",onClick:()=>u(x.id),children:[o.jsx(ec,{className:"mr-1 h-3 w-3"}),n===x.id?"HIDE":"SHOW WHY"]}),o.jsxs(ne,{size:"sm",variant:"outline",className:"text-xs",onClick:()=>f(x),children:[o.jsx(Mi,{className:"mr-1 h-3 w-3"}),"FORK STRATEGY"]})]}),n===x.id&&o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 animate-in fade-in-0 slide-in-from-top-1",children:[o.jsx("h4",{className:"mb-2 text-xs font-semibold text-foreground",children:"Why this strategy?"}),o.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-foreground",children:"Drivers:"})," ",x.dependencies.join("; ")]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-foreground",children:"Failure modes:"})," ",x.failure_modes.join("; ")]}),x.likely_allies&&x.likely_allies.length>0&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-foreground",children:"Allies:"})," ",x.likely_allies.join(", ")]}),x.likely_opponents&&x.likely_opponents.length>0&&o.jsxs("div",{children:[o.jsx("span",{className:"font-medium text-foreground",children:"Opponents:"})," ",x.likely_opponents.join(", ")]})]})]}),s===x.id&&o.jsxs("div",{className:"rounded-md border border-primary/30 bg-primary/5 p-3 animate-in fade-in-0 slide-in-from-top-1",children:[o.jsx("h4",{className:"mb-2 text-xs font-semibold text-foreground",children:"Toggle Levers"}),o.jsx("div",{className:"space-y-2",children:x.levers_used.map(y=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs text-foreground",children:y}),o.jsx(bc,{checked:a[y]??!0,onCheckedChange:N=>l(S=>({...S,[y]:N}))})]},y))}),o.jsx(ne,{size:"sm",className:"mt-3 w-full text-xs",onClick:()=>m(x.id),children:"RUN NEW PATH"})]})]})]},x.id)})}),o.jsxs("div",{className:"mt-6 rounded-lg border border-border bg-card p-4",children:[o.jsx("p",{className:"text-sm text-foreground",children:e.recommendation_rationale}),o.jsxs("p",{className:"mt-2 text-xs text-primary font-medium",children:["Immediate next step: ",e.immediate_next_step]})]})]})})})},wA=["Key stakeholder defects from coalition","Unexpected regulatory announcement","Media leak reveals strategy details","Major competitor makes aggressive move","Economic shock changes market conditions","New ally emerges with aligned interests"],NA=({strategy:e,onInjectEvent:t,forkedTimeline:n})=>{const[r,s]=h.useState(0),[i,a]=h.useState(""),[l,c]=h.useState(!1),d=e.steps.length-1,u=h.useCallback(()=>{i.trim()&&(t==null||t({atStep:r,event:i.trim()}),a(""))},[i,r,t]);return o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsx("h2",{className:"mb-6 text-2xl font-bold tracking-tight text-foreground",children:"Decision Time Machine"}),o.jsxs(Pe,{className:"border-border",children:[o.jsx(Xe,{className:"pb-3",children:o.jsxs(Ze,{className:"flex items-center gap-2 text-base",children:[o.jsx(Jr,{className:"h-4 w-4 text-primary"}),"Timeline: ",e.label]})}),o.jsxs(Te,{className:"space-y-6",children:[o.jsxs("div",{className:"relative ml-3 border-l-2 border-border pl-6",children:[e.steps.map((f,m)=>o.jsxs("div",{className:`relative mb-6 last:mb-0 transition-opacity ${n&&m>n.injectedEvent.atStep?"opacity-40":""}`,children:[o.jsx("div",{className:`absolute -left-[29px] top-1 h-4 w-4 rounded-full border-2 ${m===r?"border-primary bg-primary":m<=r?"border-primary bg-background":"border-muted-foreground bg-background"}`}),o.jsx("p",{className:"text-[10px] font-mono text-muted-foreground",children:f.timeframe}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:f.action}),o.jsx("p",{className:"text-xs text-muted-foreground",children:f.expected_effect}),n&&m===n.injectedEvent.atStep&&o.jsxs("div",{className:"mt-2 flex items-start gap-2 rounded border border-warning/30 bg-warning/10 px-3 py-2",children:[o.jsx(Jr,{className:"mt-0.5 h-3 w-3 shrink-0 text-warning"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-bold text-warning",children:"EVENT INJECTED"}),o.jsx("p",{className:"text-xs text-foreground",children:n.injectedEvent.event})]})]})]},f.order)),n&&o.jsxs("div",{className:"mt-4 ml-4 border-l-2 border-primary/50 pl-6",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(Mi,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-xs font-bold text-primary",children:"FORKED TIMELINE"})]}),n.forkedSteps.map((f,m)=>o.jsxs("div",{className:"relative mb-4 last:mb-0",children:[o.jsx("div",{className:"absolute -left-[29px] top-1 h-3 w-3 rounded-full border-2 border-primary/50 bg-background"}),o.jsx("p",{className:"text-[10px] font-mono text-muted-foreground",children:f.timeframe}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:f.action}),o.jsx("p",{className:"text-xs text-muted-foreground",children:f.expected_effect})]},m)),o.jsxs("div",{className:"mt-3 flex gap-3",children:[o.jsxs(be,{variant:"outline",className:n.probabilityDelta>=0?"border-primary/30 text-primary":"border-destructive/30 text-destructive",children:["Success: ",n.probabilityDelta>=0?"+":"",(n.probabilityDelta*100).toFixed(0),"%"]}),o.jsxs(be,{variant:"outline",children:["Risk: ",n.riskDelta]})]})]})]}),o.jsxs("div",{children:[o.jsxs("label",{className:"mb-2 block text-xs font-medium text-muted-foreground",children:["Time Scrubber — Step ",r+1," of ",d+1]}),o.jsx(Cm,{value:[r],onValueChange:f=>s(f[0]),min:0,max:d,step:1})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(Jr,{className:"h-4 w-4 text-warning"}),o.jsxs("span",{className:"text-sm font-medium text-foreground",children:["Inject Event at Step ",r+1]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(dt,{placeholder:"What happens at this point?",value:i,onChange:f=>a(f.target.value),onKeyDown:f=>f.key==="Enter"&&u()}),o.jsx(ne,{size:"sm",onClick:u,disabled:!i.trim(),children:"RUN FROM HERE"})]}),o.jsxs(ne,{size:"sm",variant:"ghost",className:"mt-2 text-xs",onClick:()=>c(!l),children:[o.jsx(Jf,{className:"mr-1 h-3 w-3"}),"SUGGEST EVENTS"]}),l&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5 animate-in fade-in-0",children:wA.map((f,m)=>o.jsx("button",{onClick:()=>{a(f),c(!1)},className:"rounded-full border border-border px-3 py-1 text-[10px] text-muted-foreground hover:border-primary/50 hover:text-foreground transition-colors",children:f},m))})]})]})]})]})})})},SA=({request:e,title:t})=>{const[n,r]=h.useState(null),[s,i]=h.useState(!1),a=h.useCallback(()=>{const c=j5(t,e),d=E5(c);r(d)},[e,t]),l=h.useCallback(async()=>{n&&(await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3))},[n]);return o.jsx("div",{className:"inline-flex flex-col items-start gap-2",children:n?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dt,{value:n,readOnly:!0,className:"w-[320px] text-xs font-mono",onClick:c=>c.target.select()}),o.jsx(ne,{size:"icon",variant:"outline",onClick:l,children:s?o.jsx(Xf,{className:"h-4 w-4 text-primary"}):o.jsx(M0,{className:"h-4 w-4"})})]}):o.jsxs(ne,{size:"sm",variant:"outline",onClick:a,className:"text-xs",children:[o.jsx(FC,{className:"mr-1.5 h-3.5 w-3.5"}),"SHARE SCENARIO"]})})};var wc="Collapsible",[jA,G3]=Bt(wc),[kA,Pm]=jA(wc),Lw=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...l}=e,[c,d]=Un({prop:r,defaultProp:s??!1,onChange:a,caller:wc});return o.jsx(kA,{scope:n,disabled:i,contentId:hs(),open:c,onOpenToggle:h.useCallback(()=>d(u=>!u),[d]),children:o.jsx(Y.div,{"data-state":Am(c),"data-disabled":i?"":void 0,...l,ref:t})})});Lw.displayName=wc;var $w="CollapsibleTrigger",Dw=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Pm($w,n);return o.jsx(Y.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Am(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:K(e.onClick,s.onOpenToggle)})});Dw.displayName=$w;var Tm="CollapsibleContent",Fw=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Pm(Tm,e.__scopeCollapsible);return o.jsx(Kn,{present:n||s.open,children:({present:i})=>o.jsx(CA,{...r,ref:t,present:i})})});Fw.displayName=Tm;var CA=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,a=Pm(Tm,n),[l,c]=h.useState(r),d=h.useRef(null),u=oe(t,d),f=h.useRef(0),m=f.current,p=h.useRef(0),v=p.current,x=a.open||l,w=h.useRef(x),g=h.useRef(void 0);return h.useEffect(()=>{const b=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(b)},[]),Ue(()=>{const b=d.current;if(b){g.current=g.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const y=b.getBoundingClientRect();f.current=y.height,p.current=y.width,w.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),c(r)}},[a.open,r]),o.jsx(Y.div,{"data-state":Am(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!x,...i,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:x&&s})});function Am(e){return e?"open":"closed"}var EA=Lw;const bn=EA,wn=Dw,Nn=Fw,RA=({governance:e,engineLoaded:t})=>{const[n,r]=h.useState(!1),s=e.constitutionalChecks.every(u=>u.passed),i=e.constitutionalChecks.filter(u=>!u.passed),a=e.neuroverse,l=(a==null?void 0:a.guardStatus)==="BLOCK"||i.length>0,c=(a==null?void 0:a.guardStatus)==="PAUSE",d=t??(a!==void 0&&a.guardStatus!==void 0);return o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl space-y-3",children:[o.jsxs("div",{className:L("flex items-center gap-2 rounded-lg border px-4 py-2.5",d?"border-emerald-500/30 bg-emerald-500/5":"border-yellow-500/30 bg-yellow-500/5"),children:[o.jsx(pl,{className:L("h-3.5 w-3.5",d?"text-emerald-400":"text-yellow-400")}),o.jsx("span",{className:L("text-xs font-bold uppercase tracking-wider",d?"text-emerald-400":"text-yellow-400"),children:d?"Enforced":"Preview"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:d?"Rules active — governance engine loaded":"Rules shown but not enforced — governance engine not connected"})]}),(l||c)&&o.jsxs("div",{className:L("rounded-lg border-2 px-5 py-4 flex items-start gap-3",l?"border-red-500/50 bg-red-500/10":"border-yellow-500/50 bg-yellow-500/10"),children:[l?o.jsx(DC,{className:"h-5 w-5 text-red-400 shrink-0 mt-0.5"}):o.jsx(Cr,{className:"h-5 w-5 text-yellow-400 shrink-0 mt-0.5"}),o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:L("inline-flex items-center rounded px-2 py-0.5 text-xs font-bold uppercase tracking-wider",l?"bg-red-500/20 text-red-400":"bg-yellow-500/20 text-yellow-400"),children:l?"BLOCK":"PAUSE"}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Governance Intervention Active"})]}),i.map(u=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono text-xs text-red-400/70 mt-0.5",children:["[",u.ruleId,"]"]}),o.jsx("span",{className:"text-foreground/90",children:u.rule}),u.detail&&o.jsxs("span",{className:"text-muted-foreground",children:["— ",u.detail]})]},u.ruleId)),(a==null?void 0:a.guardStatus)==="BLOCK"&&i.length===0&&o.jsx("p",{className:"text-sm text-foreground/90",children:"Liquidity floor violated — impacts capped by governance rules"}),(a==null?void 0:a.collapseRisk)&&a.collapseRisk!=="none"&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["System risk: ",o.jsx("span",{className:L("font-medium",a.collapseRisk==="high"?"text-red-400":a.collapseRisk==="moderate"?"text-yellow-400":"text-emerald-400"),children:a.collapseRisk}),a.worldHealthScore!==void 0&&o.jsxs(o.Fragment,{children:[" · Stability: ",a.worldHealthScore,"%"]})]})]})]}),o.jsxs(bn,{open:n,onOpenChange:r,children:[o.jsxs(wn,{className:"flex w-full items-center justify-between rounded-lg border border-border bg-card px-5 py-4 text-left transition-colors hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[s?o.jsx(Jo,{className:"h-5 w-5 text-primary"}):o.jsx(tc,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Rules & Constraints"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.constitutionalChecks.length," rules checked · Status: ",e.authorityLevel.replace(/_/g," "),a&&o.jsxs(o.Fragment,{children:[" · Permission: ",o.jsx("span",{className:L("font-medium",a.guardStatus==="ALLOW"?"text-emerald-400":a.guardStatus==="BLOCK"?"text-red-400":"text-yellow-400"),children:a.guardStatus})]})]})]})]}),o.jsx(yt,{className:L("h-4 w-4 text-muted-foreground transition-transform duration-200",n&&"rotate-180")})]}),o.jsxs(Nn,{className:"mt-3 space-y-4 animate-in fade-in-0 slide-in-from-top-2",children:[o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{icon:PC,label:"Request ID",value:e.traceId.slice(0,12)+"…"},{icon:Jo,label:"Permission",value:e.authorityLevel.replace(/_/g," ")},{icon:Zf,label:"Timestamp",value:new Date(e.timestamp).toLocaleTimeString()},{icon:Jo,label:"Version",value:`v${e.engineVersion}`}].map(u=>o.jsxs("div",{className:"rounded-md border border-border bg-card p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(u.icon,{className:"h-3 w-3"}),u.label]}),o.jsx("p",{className:"mt-1 text-xs font-medium text-foreground",children:u.value})]},u.label))}),o.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[o.jsx("div",{className:"border-b border-border px-4 py-2.5",children:o.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Safety Rules"})}),o.jsx("div",{className:"divide-y divide-border",children:e.constitutionalChecks.map(u=>o.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[o.jsx("span",{className:L("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-bold",u.passed?"bg-primary/20 text-primary":"bg-destructive/20 text-destructive"),children:u.passed?"✓":"✗"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:u.rule}),u.detail&&o.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:u.detail}),o.jsx("span",{className:"mt-1 inline-block rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground",children:u.ruleId})]})]},u.ruleId))})]}),e.enforcedConstraints.length>0&&o.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[o.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Active Rules"}),o.jsx("ul",{className:"space-y-1.5",children:e.enforcedConstraints.map((u,f)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-foreground",children:[o.jsx("span",{className:"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-primary"}),u]},f))})]})]})]})]})})})},_A=({report:e,governance:t,isGenerating:n,aiEnabled:r,provider:s,onGenerate:i,onToggleAI:a})=>{const[l,c]=h.useState(!1),d=()=>{if(!e)return;const f=cg(e);navigator.clipboard.writeText(f),c(!0),setTimeout(()=>c(!1),2e3)},u=()=>{if(!e)return;const f=cg(e),m=new Blob([f],{type:"text/markdown"}),p=URL.createObjectURL(m),v=document.createElement("a");v.href=p,v.download="governed-report.md",v.click(),URL.revokeObjectURL(p)};return o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(is,{className:"h-5 w-5 text-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Governed Report"}),t&&o.jsxs("span",{className:L("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",t.trace.passed?"bg-emerald-500/20 text-emerald-400":"bg-yellow-500/20 text-yellow-400"),children:[o.jsx(an,{className:"h-3 w-3"}),t.trace.passed?"Governed":"Violations"]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"AI Assist"}),o.jsx(bc,{checked:r,onCheckedChange:a})]}),o.jsx(ne,{variant:"outline",size:"sm",onClick:i,disabled:n,className:"gap-2",children:n?o.jsxs(o.Fragment,{children:[o.jsx(pl,{className:"h-3 w-3 animate-pulse"}),"Generating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(is,{className:"h-3 w-3"}),"Generate Report"]})})]})]}),e&&o.jsxs("div",{className:"space-y-4 animate-in fade-in-0 slide-in-from-top-2",children:[t&&o.jsx("div",{className:L("rounded-md border px-4 py-3 text-xs",t.trace.passed?"border-emerald-500/30 bg-emerald-500/5":"border-yellow-500/30 bg-yellow-500/5"),children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(an,{className:"h-3 w-3"}),o.jsxs("span",{children:["Actor: ",o.jsx("span",{className:"text-foreground font-mono",children:t.actor})," · ","Action: ",o.jsx("span",{className:"text-foreground font-mono",children:t.action})," · ","Provider: ",o.jsx("span",{className:"text-foreground font-medium",children:s})," · ","Constraints: ",t.trace.constraints.length," checked",t.trace.violations.length>0&&o.jsxs("span",{className:"text-yellow-400",children:[" · ",t.trace.violations.length," violation(s)"]})]})]})}),o.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[o.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Executive Summary"}),o.jsx("p",{className:"text-sm text-foreground leading-relaxed",children:e.executiveSummary})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.keyEvents.length>0&&o.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[o.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Key Events"}),o.jsx("div",{className:"space-y-2",children:e.keyEvents.map((f,m)=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:L("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[10px] font-bold",f.severity==="critical"?"bg-red-500/20 text-red-400":f.severity==="high"?"bg-orange-500/20 text-orange-400":"bg-yellow-500/20 text-yellow-400"),children:["R",f.round]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-foreground/90",children:f.description}),o.jsx("p",{className:"text-xs text-muted-foreground",children:f.agents.join(", ")})]})]},m))})]}),e.governanceActions.length>0&&o.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[o.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Governance Actions"}),o.jsx("div",{className:"space-y-2",children:e.governanceActions.map((f,m)=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsx("span",{className:L("mt-0.5 shrink-0 rounded px-1.5 py-0.5 text-[10px] font-bold uppercase",f.type==="BLOCK"?"bg-red-500/20 text-red-400":f.type==="PAUSE"?"bg-yellow-500/20 text-yellow-400":f.type==="CIRCUIT_BREAKER"?"bg-purple-500/20 text-purple-400":"bg-blue-500/20 text-blue-400"),children:f.type}),o.jsxs("div",{children:[o.jsx("p",{className:"text-foreground/90",children:f.description}),o.jsx("p",{className:"text-xs text-muted-foreground",children:f.agent})]})]},m))})]})]}),o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-5",children:[{label:"Volatility",value:e.metrics.volatilityReduction},{label:"Collapse Risk",value:e.metrics.collapseRisk},{label:"Stability",value:e.metrics.stabilityScore},{label:"Interventions",value:String(e.metrics.interventionCount)},{label:"Blocked",value:String(e.metrics.blockedActions)}].map(f=>o.jsxs("div",{className:"rounded-md border border-border bg-card p-3 text-center",children:[o.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:f.label}),o.jsx("p",{className:"mt-1 text-sm font-bold text-foreground",children:f.value})]},f.label))}),e.counterfactual&&o.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/30 bg-yellow-500/5 p-4",children:[o.jsx("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-yellow-400/80",children:"Counterfactual"}),o.jsx("p",{className:"text-sm text-foreground/80 italic",children:e.counterfactual})]}),e.observations.length>0&&o.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[o.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Observations"}),o.jsx("ul",{className:"space-y-1.5",children:e.observations.map((f,m)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-foreground/90",children:[o.jsx("span",{className:"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-primary"}),f]},m))})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ne,{variant:"ghost",size:"sm",onClick:d,className:"gap-2 text-xs",children:[l?o.jsx(os,{className:"h-3 w-3 text-emerald-400"}):o.jsx(M0,{className:"h-3 w-3"}),l?"Copied":"Copy"]}),o.jsxs(ne,{variant:"ghost",size:"sm",onClick:u,className:"gap-2 text-xs",children:[o.jsx(O0,{className:"h-3 w-3"}),"Download .md"]}),o.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:["Generated by ",o.jsx("span",{className:"font-medium text-foreground",children:e.generatedBy})," · Governed by ",o.jsx("span",{className:"font-medium text-foreground",children:e.governedBy})]})]})]})]})})})};function cg(e){const t=[];if(t.push(`# Governed Simulation Report
557
+ `),t.push(`> Generated by: ${e.generatedBy} | Governed by: ${e.governedBy}
558
+ `),t.push(`## Executive Summary
559
+ `),t.push(e.executiveSummary+`
560
+ `),e.keyEvents.length>0){t.push(`## Key Events
561
+ `);for(const n of e.keyEvents)t.push(`- **Round ${n.round}** [${n.severity}]: ${n.description} (${n.agents.join(", ")})`);t.push("")}if(e.governanceActions.length>0){t.push(`## Governance Actions
562
+ `);for(const n of e.governanceActions)t.push(`- **[${n.type}]** ${n.agent}: ${n.description}`);t.push("")}if(t.push(`## Metrics
563
+ `),t.push("| Metric | Value |"),t.push("|--------|-------|"),t.push(`| Volatility | ${e.metrics.volatilityReduction} |`),t.push(`| Collapse Risk | ${e.metrics.collapseRisk} |`),t.push(`| Stability | ${e.metrics.stabilityScore} |`),t.push(`| Interventions | ${e.metrics.interventionCount} |`),t.push(`| Blocked Actions | ${e.metrics.blockedActions} |`),t.push(""),e.counterfactual&&(t.push(`## Counterfactual
564
+ `),t.push(`> ${e.counterfactual}
565
+ `)),e.observations.length>0){t.push(`## Observations
566
+ `);for(const n of e.observations)t.push(`- ${n}`);t.push("")}return t.join(`
567
+ `)}const zw={error:{icon:Ii,color:"text-red-400",bg:"bg-red-500/5",border:"border-red-500/20",label:"Error",badgeBg:"bg-red-500/20 text-red-400"},warning:{icon:Cr,color:"text-yellow-400",bg:"bg-yellow-500/5",border:"border-yellow-500/20",label:"Warning",badgeBg:"bg-yellow-500/20 text-yellow-400"},info:{icon:$0,color:"text-blue-400",bg:"bg-blue-500/5",border:"border-blue-500/20",label:"Info",badgeBg:"bg-blue-500/20 text-blue-400"},hint:{icon:Jf,color:"text-muted-foreground",bg:"bg-muted/30",border:"border-border",label:"Hint",badgeBg:"bg-muted text-muted-foreground"}},Bw={conflict:"Rule Conflicts",coverage:"Coverage Gaps",strength:"Enforcement Strength",constraint:"Constraint Balance",structure:"Structure"};function PA({counts:e}){return o.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-border bg-muted/50 px-4 py-2 font-mono text-xs",children:[o.jsx("span",{className:"text-muted-foreground uppercase tracking-wider",children:"Problems"}),o.jsxs("div",{className:"flex items-center gap-3",children:[e.errors>0&&o.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[o.jsx(Ii,{className:"h-3.5 w-3.5"}),e.errors]}),e.warnings>0&&o.jsxs("span",{className:"flex items-center gap-1 text-yellow-400",children:[o.jsx(Cr,{className:"h-3.5 w-3.5"}),e.warnings]}),e.info>0&&o.jsxs("span",{className:"flex items-center gap-1 text-blue-400",children:[o.jsx($0,{className:"h-3.5 w-3.5"}),e.info]}),e.hints>0&&o.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[o.jsx(Jf,{className:"h-3.5 w-3.5"}),e.hints]}),e.errors===0&&e.warnings===0&&e.info===0&&e.hints===0&&o.jsx("span",{className:"text-green-400",children:"No problems detected"})]})]})}function TA({diagnostic:e,policyText:t,onApplyFix:n,isFixed:r}){const[s,i]=h.useState(!1),a=zw[e.severity],l=a.icon;let c=null;if(e.source&&t){const u=t.split(`
568
+ `),f=e.source.startLine-1;f>=0&&f<u.length&&(c=u[f].trim())}const d=e.quickFix;return o.jsx(bn,{open:s,onOpenChange:i,children:o.jsxs("div",{className:L("rounded-lg border transition-colors",r?"border-green-500/30 bg-green-500/5":a.border,!r&&a.bg,s&&"ring-1 ring-primary/20"),children:[o.jsxs(wn,{className:"flex w-full items-start gap-3 px-4 py-3 text-left",children:[r?o.jsx(os,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-400"}):o.jsx(l,{className:L("mt-0.5 h-4 w-4 shrink-0",a.color)}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:L("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider",r?"bg-green-500/20 text-green-400":a.badgeBg),children:e.id}),o.jsx("span",{className:L("text-sm font-medium",r?"text-green-400 line-through opacity-70":"text-foreground"),children:e.message}),r&&o.jsx("span",{className:"text-[10px] font-bold uppercase text-green-400",children:"Fixed"})]}),e.source&&!r&&o.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(is,{className:"h-3 w-3"}),o.jsxs("span",{children:["Line ",e.source.startLine,e.source.endLine!==e.source.startLine&&`–${e.source.endLine}`]}),e.relatedRules.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(MC,{className:"ml-2 h-3 w-3"}),o.jsx("span",{children:e.relatedRules.join(", ")})]})]})]}),d&&!r&&n&&o.jsxs(ne,{size:"sm",variant:"outline",className:"shrink-0 gap-1.5 border-green-500/30 bg-green-500/10 text-green-400 hover:bg-green-500/20 hover:text-green-300",onClick:u=>{u.stopPropagation(),n(d,e.id)},children:[o.jsx(gl,{className:"h-3 w-3"}),d.label]}),!r&&(s?o.jsx(yt,{className:"mt-1 h-4 w-4 shrink-0 text-muted-foreground"}):o.jsx($n,{className:"mt-1 h-4 w-4 shrink-0 text-muted-foreground"}))]}),!r&&o.jsx(Nn,{children:o.jsxs("div",{className:"space-y-3 border-t border-border/50 px-4 py-3",children:[o.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:e.detail}),c&&o.jsxs("div",{className:"rounded-md border border-border bg-background/80 p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(is,{className:"h-3 w-3"}),o.jsxs("span",{children:["policy.txt:",e.source.startLine]})]}),o.jsx("pre",{className:"mt-1.5 overflow-x-auto text-xs",children:o.jsxs("code",{children:[o.jsxs("span",{className:"select-none text-muted-foreground/50",children:[e.source.startLine," │"," "]}),o.jsx("span",{className:L(e.severity==="error"&&"bg-red-500/10 text-red-300",e.severity==="warning"&&"bg-yellow-500/10 text-yellow-300",e.severity==="info"&&"text-foreground",e.severity==="hint"&&"text-muted-foreground"),children:c})]})})]}),d&&o.jsxs("div",{className:"space-y-2 rounded-md border border-green-500/20 bg-green-500/5 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Nh,{className:"h-3.5 w-3.5 shrink-0 text-green-400"}),o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-green-400",children:"Quick Fix"})]}),o.jsxs("div",{className:"rounded border border-green-500/10 bg-background/50 px-2.5 py-2 font-mono text-xs",children:[d.operation==="insert"&&o.jsx("div",{className:"space-y-0.5",children:d.text.split(`
569
+ `).map((u,f)=>o.jsxs("div",{className:"text-green-400",children:[o.jsx("span",{className:"select-none text-green-600",children:"+ "}),u]},f))}),d.operation==="replace"&&o.jsxs("div",{className:"space-y-0.5",children:[c&&o.jsxs("div",{className:"text-red-400",children:[o.jsx("span",{className:"select-none text-red-600",children:"- "}),c]}),d.text.split(`
570
+ `).map((u,f)=>o.jsxs("div",{className:"text-green-400",children:[o.jsx("span",{className:"select-none text-green-600",children:"+ "}),u]},f))]}),d.operation==="remove"&&c&&o.jsxs("div",{className:"text-red-400",children:[o.jsx("span",{className:"select-none text-red-600",children:"- "}),c]})]}),n&&o.jsxs(ne,{size:"sm",className:"w-full gap-1.5 bg-green-600 text-white hover:bg-green-500",onClick:()=>n(d,e.id),children:[o.jsx(gl,{className:"h-3.5 w-3.5"}),"Apply: ",d.label]})]}),!d&&e.fix&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-muted bg-muted/30 px-3 py-2",children:[o.jsx(Nh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:e.fix})]}),o.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:o.jsx("span",{className:"rounded-full border border-border px-2 py-0.5",children:Bw[e.category]??e.category})})]})})]})})}const AA=({healthCheck:e,policyText:t,onApplyFix:n,fixedDiagnostics:r})=>{const[s,i]=h.useState("all"),a=r??new Set,c=(s==="all"?e.diagnostics:e.diagnostics.filter(u=>u.severity===s)).reduce((u,f)=>{const m=f.category;return u[m]||(u[m]=[]),u[m].push(f),u},{}),d=e.diagnostics.filter(u=>u.quickFix&&!a.has(u.id)).length;return o.jsxs("div",{className:"space-y-4",children:[o.jsx(PA,{counts:e.counts}),d>0&&n&&o.jsx("div",{className:"flex items-center justify-between rounded-md border border-green-500/20 bg-green-500/5 px-4 py-2",children:o.jsxs("span",{className:"text-xs text-green-400",children:[o.jsx(gl,{className:"mr-1.5 inline h-3.5 w-3.5"}),d," issue",d>1?"s":""," can be auto-fixed"]})}),o.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/30 p-1",children:["all","error","warning","info","hint"].map(u=>{const f=u==="all"?e.diagnostics.length:e.counts[`${u}s`];return u!=="all"&&f===0?null:o.jsxs("button",{onClick:()=>i(u),className:L("rounded px-3 py-1.5 text-xs font-medium transition-colors",s===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[u==="all"?"All":zw[u].label,f>0&&o.jsxs("span",{className:"ml-1.5 opacity-60",children:["(",f,")"]})]},u)})}),Object.entries(c).length>0?o.jsx("div",{className:"space-y-4",children:Object.entries(c).map(([u,f])=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:Bw[u]??u}),f.map(m=>o.jsx(TA,{diagnostic:m,policyText:t,onApplyFix:n,isFixed:a.has(m.id)},m.id))]},u))}):o.jsx("div",{className:"rounded-lg border border-green-500/20 bg-green-500/5 px-4 py-6 text-center",children:o.jsx("span",{className:"text-sm text-green-400",children:"No issues found — policy is clean"})})]})},IA={ALLOW:{icon:an,color:"text-green-400",bg:"bg-green-500/10",border:"border-green-500/30",label:"ALLOWED"},BLOCK:{icon:em,color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/30",label:"BLOCKED"},MODIFY:{icon:tc,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/30",label:"MODIFIED"},PAUSE:{icon:F0,color:"text-orange-400",bg:"bg-orange-500/10",border:"border-orange-500/30",label:"PAUSED"}};function MA({verdict:e,action:t}){const[n,r]=h.useState(!1),s=IA[e.status],i=s.icon,a=e.rulesFired.filter(l=>l.effect!=="monitored");return o.jsx(bn,{open:n,onOpenChange:r,children:o.jsxs("div",{className:L("rounded-lg border transition-colors",s.border,s.bg),children:[o.jsxs(wn,{className:"flex w-full items-start gap-3 px-4 py-3 text-left",children:[o.jsx(i,{className:L("mt-0.5 h-5 w-5 shrink-0",s.color)}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:L("rounded px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",s.bg,s.color),children:s.label}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.agentId})]}),o.jsx("p",{className:"mt-1 text-sm text-foreground",children:t.description}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.reason})]}),o.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[e.status==="MODIFY"&&e.action&&o.jsxs("span",{className:"text-xs text-yellow-400",children:[t.magnitude.toFixed(2)," → ",e.action.magnitude.toFixed(2)]}),n?o.jsx(yt,{className:"h-4 w-4 text-muted-foreground"}):o.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]})]}),o.jsx(Nn,{children:o.jsxs("div",{className:"space-y-2 border-t border-border/50 px-4 py-3",children:[e.rulesFired.length>0&&o.jsxs("div",{className:"space-y-1",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Rules Evaluated"}),e.rulesFired.map((l,c)=>o.jsxs("div",{className:L("flex items-center gap-2 rounded border px-2.5 py-1.5 text-xs",l.effect==="blocked"&&"border-red-500/20 bg-red-500/5 text-red-300",l.effect==="dampened"&&"border-yellow-500/20 bg-yellow-500/5 text-yellow-300",l.effect==="capped"&&"border-orange-500/20 bg-orange-500/5 text-orange-300",l.effect==="rebalanced"&&"border-blue-500/20 bg-blue-500/5 text-blue-300",l.effect==="monitored"&&"border-border bg-muted/30 text-muted-foreground"),children:[o.jsx("span",{className:"shrink-0 font-mono text-[10px] opacity-60",children:l.id}),o.jsx("span",{className:"flex-1",children:l.description}),o.jsx("span",{className:"shrink-0 font-bold uppercase text-[10px]",children:l.effect}),l.impactReduction>0&&o.jsxs("span",{className:"shrink-0 font-mono opacity-70",children:["-",(l.impactReduction*100).toFixed(0),"%"]})]},`${l.id}-${c}`))]}),o.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[o.jsxs("span",{children:["Confidence: ",(e.confidence*100).toFixed(0),"%"]}),a.length>0&&o.jsxs("span",{children:[a.length," rule",a.length>1?"s":""," enforced"]})]})]})})]})})}function OA({governor:e,verdictCount:t}){const n=e.stats,r=e.policy;return o.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border bg-muted/50 px-4 py-2 font-mono text-xs",children:[o.jsx("span",{className:"text-muted-foreground uppercase tracking-wider",children:"Governor"}),o.jsxs("span",{className:"text-foreground",children:[r.ruleCount," rules"]}),o.jsxs("span",{className:"text-green-400",children:[r.enforcedCount," enforced"]}),t>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-border",children:"|"}),n.allowed>0&&o.jsxs("span",{className:"text-green-400",children:[n.allowed," allowed"]}),n.blocked>0&&o.jsxs("span",{className:"text-red-400",children:[n.blocked," blocked"]}),n.modified>0&&o.jsxs("span",{className:"text-yellow-400",children:[n.modified," modified"]}),n.paused>0&&o.jsxs("span",{className:"text-orange-400",children:[n.paused," paused"]})]})]})}function LA({onSubmit:e}){const[t,n]=h.useState("custom-agent"),[r,s]=h.useState(""),[i,a]=h.useState(.5),l=()=>{r.trim()&&(e({agentId:t,type:"custom",description:r.trim(),magnitude:i}),s(""))};return o.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/30 p-4",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Custom Action"}),o.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr_auto]",children:[o.jsx("input",{value:t,onChange:c=>n(c.target.value),placeholder:"Agent ID",className:"rounded border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 focus:border-primary focus:outline-none"}),o.jsx("input",{value:r,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&l(),placeholder:"What is the agent trying to do?",className:"rounded border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 focus:border-primary focus:outline-none"}),o.jsxs(ne,{onClick:l,disabled:!r.trim(),size:"sm",className:"gap-1.5",children:[o.jsx(Jr,{className:"h-3 w-3"}),"Evaluate"]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Magnitude:"}),o.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:i,onChange:c=>a(Number(c.target.value)),className:"flex-1"}),o.jsx("span",{className:L("w-10 text-right font-mono text-xs font-bold",i>.7?"text-red-400":i>.4?"text-yellow-400":"text-green-400"),children:i.toFixed(2)})]})]})}const $A=({policyText:e})=>{var m;const[t,n]=h.useState("stressed"),[r,s]=h.useState([]),[i,a]=h.useState(!1),l=h.useMemo(()=>zy({policyText:e,sensitivity:.5}),[e]),c=((m=ad[t])==null?void 0:m.state)??ad.stressed.state,d=h.useCallback(p=>{const v=l.evaluate(p,c);s(x=>[{action:p,verdict:v},...x])},[l,c]),u=h.useCallback(()=>{const p=Bh.map(v=>({action:v,verdict:l.evaluate(v,c)}));s(p)},[l,c]),f=h.useCallback(()=>{s([])},[]);return o.jsxs("div",{className:"space-y-4",children:[o.jsx(OA,{governor:l,verdictCount:r.length}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ar,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Market Conditions"}),o.jsx("div",{className:"flex gap-1",children:Object.entries(ad).map(([p,{label:v,state:x}])=>o.jsx("button",{onClick:()=>{n(p),s([])},className:L("rounded-full border px-3 py-1 text-xs font-medium transition-colors",t===p?p==="crisis"?"border-red-500/30 bg-red-500/10 text-red-400":p==="stressed"?"border-yellow-500/30 bg-yellow-500/10 text-yellow-400":"border-green-500/30 bg-green-500/10 text-green-400":"border-border text-muted-foreground hover:text-foreground"),children:v},p))})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(([p,v])=>o.jsxs("span",{className:L("rounded border px-2 py-0.5 font-mono text-[10px]",typeof v=="number"&&v>70||typeof v=="number"&&v<20||v==="panic"||v==="systemic"?"border-red-500/20 text-red-400":"border-border text-muted-foreground"),children:[p,": ",String(v)]},p))}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ne,{onClick:u,size:"sm",className:"gap-1.5",children:[o.jsx(Oi,{className:"h-3 w-3"}),"Evaluate All Example Actions"]}),o.jsxs(ne,{onClick:()=>a(!i),variant:"outline",size:"sm",className:"gap-1.5",children:[o.jsx(Sr,{className:"h-3 w-3"}),"Custom Action"]}),r.length>0&&o.jsx("button",{onClick:f,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear results"})]}),i&&o.jsx(LA,{onSubmit:d}),r.length===0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Or evaluate individually:"}),o.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:Bh.map(p=>o.jsxs("button",{onClick:()=>d(p),className:"flex items-start gap-2 rounded-lg border border-border bg-muted/20 px-3 py-2.5 text-left transition-colors hover:border-primary/30 hover:bg-muted/40",children:[o.jsx(UC,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:p.agentId}),o.jsx("p",{className:"text-xs text-foreground",children:p.description}),o.jsx("div",{className:"mt-1 flex items-center gap-2",children:o.jsxs("span",{className:L("font-mono text-[10px] font-bold",p.magnitude>.7?"text-red-400":p.magnitude>.4?"text-yellow-400":"text-green-400"),children:["magnitude: ",p.magnitude.toFixed(2)]})})]})]},p.agentId+p.description))})]}),r.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Governance Verdicts (",r.length,")"]}),r.map(({action:p,verdict:v},x)=>o.jsx(MA,{verdict:v,action:p},`${p.agentId}-${x}`))]})]})},DA={upload:"Upload Policy",parsed:"Rules Parsed",validated:"Logic Validated",simulating:"Simulating...",complete:"Results Ready"};function FA({current:e}){const t=["upload","parsed","validated","simulating","complete"],n=t.indexOf(e);return o.jsx("div",{className:"flex items-center gap-1",children:t.map((r,s)=>{const i=s===n,a=s<n,l=s>n;return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("div",{className:L("flex h-7 items-center gap-1.5 rounded-full border px-3 text-xs font-medium transition-all",i&&"border-primary bg-primary/10 text-primary",a&&"border-green-500/30 bg-green-500/10 text-green-400",l&&"border-border bg-muted/30 text-muted-foreground"),children:[a&&o.jsx(os,{className:"h-3 w-3"}),i&&r==="simulating"&&o.jsx(hl,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{className:"hidden sm:inline",children:DA[r]}),o.jsx("span",{className:"sm:hidden",children:s+1})]}),s<t.length-1&&o.jsx("div",{className:L("h-px w-4 transition-colors",a?"bg-green-500/50":"bg-border")})]},r)})})}function zA({onUpload:e,policyText:t,onTextChange:n}){const r=h.useRef(null),[s,i]=h.useState(!1),a=h.useCallback(d=>{if(!d.name.endsWith(".txt")&&!d.name.endsWith(".md"))return;const u=new FileReader;u.onload=f=>{var p;const m=(p=f.target)==null?void 0:p.result;n(m),e(m)},u.readAsText(d)},[e,n]),l=h.useCallback(d=>{d.preventDefault(),i(!1);const u=d.dataTransfer.files[0];u&&a(u)},[a]),c=h.useCallback(()=>{t.trim()&&e(t)},[t,e]);return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{onDragOver:d=>{d.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:l,onClick:()=>{var d;return(d=r.current)==null?void 0:d.click()},className:L("cursor-pointer rounded-lg border-2 border-dashed p-6 text-center transition-all",s?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/30"),children:[o.jsx(z0,{className:L("mx-auto mb-2 h-8 w-8",s?"text-primary":"text-muted-foreground")}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Drop your policy document here"}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:".txt or .md files accepted"}),o.jsx("input",{ref:r,type:"file",accept:".txt,.md",className:"hidden",onChange:d=>{var f;const u=(f=d.target.files)==null?void 0:f[0];u&&a(u)}})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Or paste policy text directly"}),o.jsx("textarea",{value:t,onChange:d=>n(d.target.value),placeholder:dg,rows:10,className:"w-full rounded-lg border border-border bg-background px-4 py-3 font-mono text-sm text-foreground placeholder:text-muted-foreground/50 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/30"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("button",{onClick:()=>n(dg),className:"text-xs text-primary/70 underline-offset-2 hover:text-primary hover:underline",children:"Load example policy"}),o.jsxs(ne,{onClick:c,disabled:!t.trim(),size:"sm",children:[o.jsx(Oi,{className:"mr-1.5 h-3.5 w-3.5"}),"Parse & Validate"]})]})]})]})}function BA({rule:e}){const t=e.enforcement==="structural";return o.jsxs("div",{className:L("flex items-start gap-3 rounded-lg border px-4 py-3",t?"border-green-500/20 bg-green-500/5":"border-yellow-500/20 bg-yellow-500/5"),children:[t?o.jsx(an,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-400"}):o.jsx(ec,{className:"mt-0.5 h-4 w-4 shrink-0 text-yellow-400"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.id}),o.jsx("span",{className:L("rounded px-1.5 py-0.5 text-[10px] font-bold uppercase",t?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"),children:t?"ENFORCED":"ADVISORY"}),o.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:e.category})]}),o.jsx("p",{className:"mt-1 text-sm text-foreground",children:e.description}),e.affectedVariables.length>0&&o.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:e.affectedVariables.map(n=>o.jsx("span",{className:"rounded-full border border-border px-2 py-0.5 text-[10px] text-muted-foreground",children:n},n))})]})]})}function VA({parsed:e}){const[t,n]=h.useState(!1),r=t?e.rules:e.rules.slice(0,6);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/50 px-4 py-2",children:[o.jsx(is,{className:"h-4 w-4 text-primary"}),o.jsxs("span",{className:"text-sm font-medium",children:["Parsed ",e.summary.total," rules"]}),o.jsx("span",{className:"mx-1 text-muted-foreground",children:"—"}),o.jsxs("span",{className:"text-sm text-green-400",children:[e.summary.enforced," enforced"]}),o.jsxs("span",{className:"text-sm text-yellow-400",children:[e.summary.advisory," advisory"]})]})}),o.jsx("div",{className:"space-y-2",children:r.map(s=>o.jsx(BA,{rule:s},s.id))}),e.rules.length>6&&o.jsx("button",{onClick:()=>n(!t),className:"text-xs text-primary/70 hover:text-primary",children:t?"Show less":`Show ${e.rules.length-6} more rules...`})]})}function UA({result:e}){const{impact:t,comparison:n}=e,r=[{label:"Stability Change",value:t.stabilityChange,suffix:"%",positive:t.stabilityChange>0,icon:t.stabilityChange>0?nm:tm},{label:"Cascade Risk",value:-t.cascadeRiskChange,suffix:"%",positive:t.cascadeRiskChange>0,icon:Ar},{label:"Governance Actions",value:t.governanceActions,suffix:"",positive:!0,icon:an},{label:"Actions Blocked",value:t.actionsBlocked,suffix:"%",positive:t.actionsBlocked<70,icon:Ii}];return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:r.map(s=>{const i=s.icon;return o.jsxs("div",{className:L("rounded-lg border p-4 text-center",s.positive?"border-green-500/20 bg-green-500/5":"border-red-500/20 bg-red-500/5"),children:[o.jsx(i,{className:L("mx-auto mb-1 h-5 w-5",s.positive?"text-green-400":"text-red-400")}),o.jsxs("div",{className:L("text-2xl font-bold",s.positive?"text-green-400":"text-red-400"),children:[s.value>0?"+":"",s.value.toFixed(0),s.suffix]}),o.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:s.label})]},s.label)})}),t.preventedCollapse&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border-2 border-green-500/30 bg-green-500/10 px-4 py-3",children:[o.jsx(os,{className:"h-5 w-5 text-green-400"}),o.jsx("span",{className:"text-sm font-medium text-green-400",children:"Policy prevented system collapse"})]}),t.overConstraintScore>.7&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border-2 border-red-500/30 bg-red-500/10 px-4 py-3",children:[o.jsx(Cr,{className:"h-5 w-5 text-red-400"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium text-red-400",children:"Over-constrained Policy Detected"}),o.jsxs("p",{className:"mt-0.5 text-xs text-red-300/70",children:[t.actionsBlocked.toFixed(0),"% of actions blocked — risk of system freeze"]})]})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-4 py-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Governance Effectiveness"}),o.jsxs("span",{className:"text-sm font-bold text-primary",children:[(n.comparison.governanceEffectiveness*100).toFixed(0),"%"]})]}),o.jsx("div",{className:"mt-2 h-2 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${n.comparison.governanceEffectiveness*100}%`}})})]})]})}function WA({explanation:e}){return o.jsxs("div",{className:"rounded-lg border border-primary/20 bg-primary/5 px-5 py-4",children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[o.jsx(Jr,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:"What the Policy Did"})]}),o.jsx("p",{className:"text-sm leading-relaxed text-foreground/90",children:e})]})}function HA({result:e}){const{comparison:t}=e,n=t.baseline.metrics,r=t.governed.metrics,s=[{label:"Collapse Probability",baseline:`${(n.collapseProbability*100).toFixed(0)}%`,policy:`${(r.collapseProbability*100).toFixed(0)}%`,better:r.collapseProbability<n.collapseProbability},{label:"Stability Score",baseline:`${(n.stabilityScore*100).toFixed(0)}%`,policy:`${(r.stabilityScore*100).toFixed(0)}%`,better:r.stabilityScore>n.stabilityScore},{label:"Max Volatility",baseline:n.maxVolatility.toFixed(2),policy:r.maxVolatility.toFixed(2),better:r.maxVolatility<n.maxVolatility},{label:"Coalition Risks",baseline:String(n.coalitionRisks),policy:String(r.coalitionRisks),better:r.coalitionRisks<n.coalitionRisks},{label:"Peak Negative Sentiment",baseline:n.peakNegativeSentiment.toFixed(2),policy:r.peakNegativeSentiment.toFixed(2),better:r.peakNegativeSentiment>n.peakNegativeSentiment}];return o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[o.jsxs("div",{className:"grid grid-cols-3 border-b border-border bg-muted/50 px-4 py-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:[o.jsx("span",{children:"Metric"}),o.jsx("span",{className:"text-center",children:"Baseline"}),o.jsx("span",{className:"text-center",children:"With Policy"})]}),s.map(i=>o.jsxs("div",{className:"grid grid-cols-3 items-center border-b border-border/50 px-4 py-2.5 last:border-b-0",children:[o.jsx("span",{className:"text-sm text-foreground",children:i.label}),o.jsx("span",{className:"text-center font-mono text-sm text-muted-foreground",children:i.baseline}),o.jsx("span",{className:L("text-center font-mono text-sm font-medium",i.better?"text-green-400":"text-red-400"),children:i.policy})]},i.label))]})}const dg=`# Market Stability Policy
571
+
572
+ - Block all large trades exceeding $10M during periods of extreme volatility
573
+ - Require mandatory position reporting for all leveraged positions above 3x
574
+ - Limit maximum system leverage to 5x during elevated volatility conditions
575
+ - Halt all automated trading when volatility index exceeds 80
576
+ - Monitor and report all correlated position clusters exceeding 15% of market volume
577
+ - Encourage diversification of counterparty exposure across market participants
578
+ - Maintain minimum liquidity floor — no agent may drain liquidity below 15% of baseline
579
+ - Require coalition rebalancing when concentration exceeds threshold limits
580
+ - Promote transparency in all large position changes to reduce information asymmetry
581
+ - Suspend new short positions during market panic conditions`,GA=()=>{const[e,t]=h.useState("upload"),[n,r]=h.useState(""),[s,i]=h.useState(null),[a,l]=h.useState(null),[c,d]=h.useState(null),[u,f]=h.useState(!1),[m,p]=h.useState(!0),[v,x]=h.useState(!0),[w,g]=h.useState(!0),[b,y]=h.useState(!0),[N,S]=h.useState(new Set),[C,j]=h.useState(null),E=h.useCallback(A=>{const M=ls(A);i(M);const U=po(M);return l(U),d(null),{parseResult:M,health:U}},[]),R=h.useCallback(A=>{E(A),t("validated"),S(new Set),j(null)},[E]),P=h.useCallback((A,M)=>{const U=eR(n,A);r(U),E(U),S($=>new Set([...$,M])),j(A.label),setTimeout(()=>j(null),3e3)},[n,E]),_=h.useCallback(async()=>{if(!(!s||!(a!=null&&a.canSimulate))){f(!0),t("simulating");try{const A=await oR(n);d(A),t("complete")}catch(A){console.error("Policy simulation failed:",A),t("validated")}finally{f(!1)}}},[s,a,n]),k=h.useCallback(()=>{t("upload"),r(""),i(null),l(null),d(null),f(!1),S(new Set),j(null)},[]);return o.jsx("section",{className:"border-t border-border py-12",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl space-y-8",children:[o.jsxs("div",{className:"space-y-3 text-center",children:[o.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/30 bg-primary/10 px-4 py-1.5",children:[o.jsx(an,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:"Policy Enforcement Lab"})]}),o.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground sm:text-3xl",children:"Test a policy before it exists"}),o.jsx("p",{className:"mx-auto max-w-xl text-sm text-muted-foreground",children:"Drop in your policy. We parse the rules, validate the logic, simulate the outcomes, and show you what would actually happen — before you deploy it."})]}),o.jsx("div",{className:"flex justify-center",children:o.jsx(FA,{current:e})}),e==="upload"&&o.jsx(zA,{onUpload:R,policyText:n,onTextChange:r}),s&&e!=="upload"&&o.jsxs("div",{className:"space-y-6",children:[o.jsxs(bn,{open:v,onOpenChange:x,children:[o.jsxs(wn,{className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/30 px-4 py-3 text-left hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(is,{className:"h-4 w-4 text-primary"}),o.jsxs("span",{className:"text-sm font-medium",children:["Parsed Rules (",s.summary.total,")"]}),o.jsxs("span",{className:"text-xs text-green-400",children:[s.summary.enforced," enforced"]}),o.jsxs("span",{className:"text-xs text-yellow-400",children:[s.summary.advisory," advisory"]})]}),v?o.jsx(yt,{className:"h-4 w-4 text-muted-foreground"}):o.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Nn,{children:o.jsx("div",{className:"mt-3",children:o.jsx(VA,{parsed:s})})})]}),a&&o.jsxs(bn,{open:m,onOpenChange:p,children:[o.jsxs(wn,{className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/30 px-4 py-3 text-left hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ar,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:"Policy Health Check"}),a.counts.errors>0&&o.jsxs("span",{className:"flex items-center gap-1 rounded bg-red-500/20 px-1.5 py-0.5 text-[10px] font-bold text-red-400",children:[o.jsx(Ii,{className:"h-3 w-3"}),a.counts.errors," errors"]}),a.counts.warnings>0&&o.jsxs("span",{className:"flex items-center gap-1 rounded bg-yellow-500/20 px-1.5 py-0.5 text-[10px] font-bold text-yellow-400",children:[o.jsx(Cr,{className:"h-3 w-3"}),a.counts.warnings," warnings"]}),a.counts.errors===0&&a.counts.warnings===0&&o.jsxs("span",{className:"flex items-center gap-1 rounded bg-green-500/20 px-1.5 py-0.5 text-[10px] font-bold text-green-400",children:[o.jsx(os,{className:"h-3 w-3"}),"Healthy"]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Score: ",a.healthScore,"/100"]})]}),m?o.jsx(yt,{className:"h-4 w-4 text-muted-foreground"}):o.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Nn,{children:o.jsx("div",{className:"mt-3",children:o.jsx(AA,{healthCheck:a,policyText:n,onApplyFix:P,fixedDiagnostics:N})})})]}),a&&s&&s.summary.total>0&&o.jsxs(bn,{open:w,onOpenChange:g,children:[o.jsxs(wn,{className:"flex w-full items-center justify-between rounded-lg border border-primary/20 bg-primary/5 px-4 py-3 text-left hover:bg-primary/10",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(an,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:"Governance Playground"}),o.jsx("span",{className:"rounded bg-primary/20 px-1.5 py-0.5 text-[10px] font-bold uppercase text-primary",children:"Live"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Test agent actions against your policy"})]}),w?o.jsx(yt,{className:"h-4 w-4 text-muted-foreground"}):o.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Nn,{children:o.jsx("div",{className:"mt-3",children:o.jsx($A,{policyText:n})})})]}),C&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-green-500/30 bg-green-500/10 px-4 py-3 animate-in fade-in slide-in-from-top-1",children:[o.jsx(os,{className:"h-4 w-4 text-green-400"}),o.jsxs("span",{className:"text-sm text-green-400",children:["Applied: ",C]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["— Policy re-parsed with ",s==null?void 0:s.summary.total," rules (",s==null?void 0:s.summary.enforced," enforced)"]}),c&&o.jsxs(ne,{size:"sm",variant:"outline",className:"ml-auto gap-1.5",onClick:_,children:[o.jsx(hl,{className:"h-3 w-3"}),"Re-simulate"]})]}),e==="validated"&&(a==null?void 0:a.canSimulate)&&o.jsx("div",{className:"flex justify-center",children:o.jsxs(ne,{onClick:_,size:"lg",className:"gap-2",children:[o.jsx(ju,{className:"h-4 w-4"}),"Run Simulation — Baseline vs. Policy"]})}),e==="simulating"&&o.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[o.jsx(hl,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Running baseline and governed simulations..."})]}),c&&e==="complete"&&o.jsxs("div",{className:"space-y-6",children:[o.jsx(UA,{result:c}),o.jsx(WA,{explanation:c.explanation}),o.jsxs(bn,{open:b,onOpenChange:y,children:[o.jsxs(wn,{className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/30 px-4 py-3 text-left hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ju,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:"Baseline vs. Policy Comparison"})]}),b?o.jsx(yt,{className:"h-4 w-4 text-muted-foreground"}):o.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Nn,{children:o.jsx("div",{className:"mt-3",children:o.jsx(HA,{result:c})})})]}),o.jsx("div",{className:"rounded-lg border border-border bg-muted/30 px-4 py-3",children:o.jsx("p",{className:"text-xs italic text-muted-foreground",children:c.comparison.comparison.narrative})})]}),e!=="simulating"&&o.jsx("div",{className:"flex justify-center pt-4",children:o.jsx("button",{onClick:k,className:"text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"Upload a different policy"})})]})]})})})};function ji(e){var i;const t=KA(e);if(t)return t;const r={trading:"social_simulation",flash_crash:"social_simulation",strait_of_hormuz:"social_simulation",gas_price_spike:"social_simulation",ai_regulation_crisis:"social_simulation"}[e]??e,s=mo[r];if(!s)throw new Error(`Unknown preset: ${e}. Available: ${Object.keys(mo).join(", ")}`);if(!((i=s.world)!=null&&i.inline_definition))throw new Error(`Preset "${e}" has no world definition.`);return{id:s.world.world_id,title:s.title,scenario:s.scenario,stakeholders:s.stakeholders,assumptions:s.assumptions,constraints:s.constraints,swarm:s.swarm??{enabled:!0,rounds:5,reaction_model:"mixed"},depth:s.depth,world:s.world.inline_definition,paths:[{id:"path_primary",label:"Primary Response",description:"Most likely course of action",projected_outcome:"Moderate disruption with cascading effects",probability:.6,risk:"high",tradeoffs:["Speed vs. thoroughness","Short-term vs. long-term"],benefits_stakeholders:s.stakeholders.filter(a=>a.disposition==="supportive").map(a=>a.id),harms_stakeholders:s.stakeholders.filter(a=>a.disposition==="hostile").map(a=>a.id)},{id:"path_defensive",label:"Defensive Posture",description:"Conservative approach prioritizing stability",projected_outcome:"Reduced damage but slower recovery",probability:.7,risk:"moderate",tradeoffs:["Safety vs. opportunity cost"],benefits_stakeholders:s.stakeholders.filter(a=>a.disposition!=="hostile").map(a=>a.id),harms_stakeholders:[]}]}}function KA(e){try{const t=G5(e);if(!t)return null;let n=`Simulation with custom world: ${t.world.thesis}`,r=[{id:"System",disposition:"neutral",priorities:["stability"]},{id:"Agents",disposition:"unknown",priorities:["execution"]}],s={severity:"high"},i={};try{const a=ji(t.basePreset);n=a.scenario,r=a.stakeholders,s=a.assumptions,i=a.constraints}catch{}return{id:t.id,title:t.name,scenario:n,stakeholders:r,assumptions:s,constraints:i,swarm:{enabled:!0,rounds:5,reaction_model:"mixed"},depth:"full",world:t.world,paths:[{id:"path_primary",label:"Primary Response",description:"Most likely course of action",projected_outcome:"Moderate disruption with cascading effects",probability:.6,risk:"high",tradeoffs:["Speed vs. thoroughness","Short-term vs. long-term"],benefits_stakeholders:r.filter(a=>a.disposition==="supportive").map(a=>a.id),harms_stakeholders:r.filter(a=>a.disposition==="hostile").map(a=>a.id)}]}}catch{return null}}async function qA(e,t,n){var N,S;const r=ji(e),s=ji(t),i=r.scenario+" "+s.scenario,a=YA(r.stakeholders,s.stakeholders),l=r.paths;(N=n==null?void 0:n.onProgress)==null||N.call(n,"World A","simulating");const c=await Iu({scenario:i,stakeholders:a,assumptions:r.assumptions,constraints:r.constraints,depth:r.depth,swarm:r.swarm},r.world,l);(S=n==null?void 0:n.onProgress)==null||S.call(n,"World B","simulating");const d=await Iu({scenario:i,stakeholders:a,assumptions:s.assumptions,constraints:s.constraints,depth:s.depth,swarm:s.swarm},s.world,l),u=ug(c),f=ug(d),m=c.governed.metrics,p=d.governed.metrics,v=m.stabilityScore-p.stabilityScore,x=m.maxVolatility-p.maxVolatility,w=m.coalitionRisks-p.coalitionRisks,g=m.collapseProbability-p.collapseProbability,b=Math.abs(v)<.02?"equal":v>0?"A":"B",y=QA(r,s,m,p,b);return{scenario:i,worldA:{id:e,thesis:r.world.thesis,invariantCount:r.world.invariants.length,gateCount:(r.world.gates??[]).length,metrics:m,trajectory:c.governed.swarm.trajectory,governanceStats:c.governanceStats,rounds:u},worldB:{id:t,thesis:s.world.thesis,invariantCount:s.world.invariants.length,gateCount:(s.world.gates??[]).length,metrics:p,trajectory:d.governed.swarm.trajectory,governanceStats:d.governanceStats,rounds:f},delta:{stabilityDiff:Number((v*100).toFixed(1)),volatilityDiff:Number((x*100).toFixed(1)),coalitionRiskDiff:w,collapseDiff:Number((g*100).toFixed(1)),moreStable:b,narrative:y}}}function YA(e,t){const n=new Set,r=[];for(const s of[...e,...t])n.has(s.id)||(n.add(s.id),r.push(s));return r}function ug(e){return e.governed.swarm.rounds.map(t=>({round:t.round,avgImpact:t.reactions.reduce((n,r)=>n+r.impact,0)/t.reactions.length,maxVolatility:Math.max(...t.reactions.map(n=>Math.abs(n.impact))),agentImpacts:t.reactions.map(n=>({id:n.stakeholder_id,impact:n.impact,confidence:n.confidence})),interventions:t.emergent_dynamics??[]}))}function QA(e,t,n,r,s){const i=[];i.push(`World A ("${e.world.thesis.slice(0,60)}...") vs World B ("${t.world.thesis.slice(0,60)}...").`),s==="A"?i.push(`World A produced a more stable system (${(n.stabilityScore*100).toFixed(0)}% vs ${(r.stabilityScore*100).toFixed(0)}%).`):s==="B"?i.push(`World B produced a more stable system (${(r.stabilityScore*100).toFixed(0)}% vs ${(n.stabilityScore*100).toFixed(0)}%).`):i.push("Both worlds produced similar stability levels.");const a=e.world.invariants.length-t.world.invariants.length;return a!==0&&i.push(`World ${a>0?"A":"B"} has ${Math.abs(a)} more invariant${Math.abs(a)>1?"s":""}, providing tighter structural constraints.`),i.push("Same agents, different rules — the world shapes the outcome."),i.join(" ")}function XA(){var t;const e=[];for(const[n,r]of Object.entries(mo))(t=r.world)!=null&&t.inline_definition&&e.push({id:n,title:r.title,thesis:r.world.inline_definition.thesis,invariantCount:r.world.inline_definition.invariants.length,gateCount:(r.world.inline_definition.gates??[]).length});return e}function ZA(e){const t=ji(e),n=t.world.invariants,r=t.world.gates??[],s=n.filter(f=>f.enforceable).length,i=n.length-s,a=n.length===0?"No invariants defined — ungoverned.":`${n.length} rules (${s} enforced, ${i} advisory): ${n.map(f=>f.description).join("; ")}`,l=r.filter(f=>f.severity==="critical"),c=r.filter(f=>f.severity==="warning"),d=r.length===0?"No viability gates — no collapse detection.":`${r.length} gates (${l.length} critical, ${c.length} warning): ${r.map(f=>`${f.label} [${f.severity}]`).join(", ")}`,u=l.length>=2?"high":l.length>=1||c.length>=2?"moderate":"low";return{worldId:e,title:t.title,thesis:t.world.thesis,invariantSummary:a,gateSummary:d,riskProfile:u}}function JA(e){const{worldA:t,worldB:n,delta:r}=e,s=r.moreStable,i=s==="A"?t:s==="B"?n:t,a=s==="A"?n:s==="B"?t:n;i.governanceStats.totalEvaluations-a.governanceStats.totalEvaluations;const l=i.governanceStats.verdicts.block-a.governanceStats.verdicts.block,c=[];return Math.abs(r.stabilityDiff)>=5&&c.push(`${Math.abs(r.stabilityDiff).toFixed(0)}% stability ${r.stabilityDiff>0?"advantage for World A":"advantage for World B"}`),Math.abs(r.collapseDiff)>=5&&c.push(`${Math.abs(r.collapseDiff).toFixed(0)}% ${r.collapseDiff>0?"higher":"lower"} cascade risk in World A`),l!==0&&c.push(`${Math.abs(l)} more governance interventions in ${l>0?"World A":"World B"}`),Math.abs(r.volatilityDiff)>=5&&c.push(`${Math.abs(r.volatilityDiff).toFixed(0)}% volatility ${r.volatilityDiff>0?"higher in A":"higher in B"}`),c.length===0&&c.push("Both worlds produced similar outcomes — rules had minimal differential effect."),{winner:s,stabilityDelta:`${r.stabilityDiff>0?"+":""}${r.stabilityDiff.toFixed(1)}%`,cascadeRiskDelta:`${r.collapseDiff>0?"+":""}${r.collapseDiff.toFixed(1)}%`,volatilityDelta:`${r.volatilityDiff>0?"+":""}${r.volatilityDiff.toFixed(1)}%`,totalInterventionsA:t.governanceStats.totalEvaluations,totalInterventionsB:n.governanceStats.totalEvaluations,blockedActionsA:t.governanceStats.verdicts.block,blockedActionsB:n.governanceStats.verdicts.block,keyFindings:c,verdict:r.narrative,poweredBy:"@neuroverseos/governance — simulateWorld() + evaluateGuard()"}}function fg({label:e,selected:t,onSelect:n,presets:r,savedWorlds:s,explanation:i,disabled:a,onDeleteSaved:l}){return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-bold uppercase tracking-[0.15em] text-muted-foreground",children:e}),s.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-primary/70 flex items-center gap-1",children:[o.jsx(TC,{className:"h-3 w-3"})," My Worlds"]}),s.map(c=>o.jsxs("div",{className:"flex items-stretch gap-1",children:[o.jsxs("button",{disabled:a,onClick:()=>n(c.id),className:L("flex-1 rounded-lg border px-4 py-3 text-left transition-all",t===c.id?"border-primary bg-primary/5 ring-1 ring-primary/20":"border-border hover:border-muted-foreground/30 hover:bg-muted/50",a&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"text-sm font-medium text-foreground",children:c.name}),o.jsx("div",{className:"mt-1 text-xs text-muted-foreground line-clamp-1",children:c.world.thesis}),o.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] font-medium text-muted-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(bh,{className:"h-3 w-3"})," ",c.world.invariants.length," rules"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Cr,{className:"h-3 w-3"})," ",(c.world.gates??[]).length," gates"]}),o.jsx("span",{className:"text-primary/50",children:"saved"})]})]}),o.jsx("button",{onClick:()=>l(c.id),disabled:a,className:"rounded-lg border border-border px-2 text-muted-foreground hover:text-red-400 hover:border-red-400/30 transition-colors",title:"Delete saved world",children:o.jsx(VC,{className:"h-3.5 w-3.5"})})]},c.id))]}),o.jsxs("div",{className:"space-y-1.5",children:[s.length>0&&o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/50 mt-2",children:"Presets"}),r.map(c=>o.jsxs("button",{disabled:a,onClick:()=>n(c.id),className:L("w-full rounded-lg border px-4 py-3 text-left transition-all",t===c.id?"border-primary bg-primary/5 ring-1 ring-primary/20":"border-border hover:border-muted-foreground/30 hover:bg-muted/50",a&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"text-sm font-medium text-foreground",children:c.title}),o.jsx("div",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c.thesis}),o.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] font-medium text-muted-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(bh,{className:"h-3 w-3"})," ",c.invariantCount," rules"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Cr,{className:"h-3 w-3"})," ",c.gateCount," gates"]})]})]},c.id))]}),i&&o.jsxs("div",{className:"rounded-lg border border-dashed border-muted-foreground/20 bg-muted/30 p-3 space-y-2",children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Governance posture"}),o.jsx("div",{className:"text-xs text-foreground/80",children:i.invariantSummary}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i.gateSummary}),o.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[o.jsx("span",{className:L("inline-block h-1.5 w-1.5 rounded-full",i.riskProfile==="high"?"bg-red-500":i.riskProfile==="moderate"?"bg-yellow-500":"bg-green-500")}),o.jsxs("span",{className:"text-muted-foreground",children:["Risk profile: ",i.riskProfile]})]})]})]})}function mg({worldId:e,onSave:t,onCancel:n}){const[r,s]=h.useState("");return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:i=>s(i.target.value),placeholder:"World name (e.g., Panic Control v1)",className:"flex-1 rounded-md border border-border bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary/30",autoFocus:!0,onKeyDown:i=>{i.key==="Enter"&&r.trim()&&t(r.trim()),i.key==="Escape"&&n()}}),o.jsx(ne,{size:"sm",onClick:()=>r.trim()&&t(r.trim()),disabled:!r.trim(),children:"Save"}),o.jsx(ne,{size:"sm",variant:"ghost",onClick:n,children:"Cancel"})]})}function pg({side:e,label:t,color:n}){const r=n==="blue"?{border:"border-blue-500/30",bg:"bg-blue-500/5",text:"text-blue-400",badge:"bg-blue-500/10 text-blue-400"}:{border:"border-amber-500/30",bg:"bg-amber-500/5",text:"text-amber-400",badge:"bg-amber-500/10 text-amber-400"},s=e.trajectory==="stabilizing"||e.trajectory==="converging"?o.jsx(nm,{className:"h-3.5 w-3.5 text-green-400"}):e.trajectory==="escalating"?o.jsx(tm,{className:"h-3.5 w-3.5 text-red-400"}):o.jsx(Ar,{className:"h-3.5 w-3.5 text-yellow-400"});return o.jsxs("div",{className:L("rounded-xl border p-5 space-y-4",r.border,r.bg),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:L("text-xs font-bold uppercase tracking-[0.15em]",r.text),children:t}),o.jsx("span",{className:L("rounded-full px-2 py-0.5 text-[10px] font-medium",r.badge),children:e.id})]}),o.jsx("p",{className:"text-sm text-foreground/90 leading-relaxed",children:e.thesis}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(ba,{label:"Stability",value:`${(e.metrics.stabilityScore*100).toFixed(0)}%`}),o.jsx(ba,{label:"Cascade Risk",value:`${(e.metrics.collapseProbability*100).toFixed(0)}%`}),o.jsx(ba,{label:"Volatility",value:`${(e.metrics.maxVolatility*100).toFixed(0)}%`}),o.jsx(ba,{label:"Trajectory",value:e.trajectory,icon:s})]}),o.jsxs("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[o.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[o.jsx(an,{className:"h-3 w-3"})," Governance Engine"]}),o.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-lg font-bold text-foreground",children:e.governanceStats.totalEvaluations}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"evaluations"})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-lg font-bold text-red-400",children:e.governanceStats.verdicts.block}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"blocked"})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-lg font-bold text-green-400",children:e.governanceStats.verdicts.allow}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"allowed"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsxs("span",{children:[e.invariantCount," invariants"]}),o.jsx("span",{className:"text-border",children:"|"}),o.jsxs("span",{children:[e.gateCount," gates"]}),o.jsx("span",{className:"text-border",children:"|"}),o.jsxs("span",{children:[e.governanceStats.rulesFired," rules fired"]})]})]})]})}function ba({label:e,value:t,icon:n}){return o.jsxs("div",{className:"rounded-lg bg-background/50 px-3 py-2",children:[o.jsx("div",{className:"text-[10px] text-muted-foreground",children:e}),o.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[n,o.jsx("span",{className:"text-sm font-semibold text-foreground",children:t})]})]})}function e3({impact:e}){return o.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Jr,{className:"h-4 w-4 text-primary"}),o.jsx("h4",{className:"text-xs font-bold uppercase tracking-[0.15em] text-primary",children:"Impact Delta"})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[o.jsx(yd,{label:"Stability",value:e.stabilityDelta}),o.jsx(yd,{label:"Cascade Risk",value:e.cascadeRiskDelta,invert:!0}),o.jsx(yd,{label:"Volatility",value:e.volatilityDelta,invert:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center border-t border-border/50 pt-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-2xl font-bold text-foreground",children:e.totalInterventionsA}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"World A interventions"})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-2xl font-bold text-foreground",children:e.totalInterventionsB}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:"World B interventions"})]})]}),o.jsxs("div",{className:"space-y-2 border-t border-border/50 pt-3",children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Key Findings"}),o.jsx("ul",{className:"space-y-1",children:e.keyFindings.map((t,n)=>o.jsxs("li",{className:"flex items-start gap-2 text-xs text-foreground/80",children:[o.jsx("span",{className:"mt-1 block h-1 w-1 rounded-full bg-primary shrink-0"}),t]},n))})]}),o.jsx("div",{className:"rounded-lg bg-background/60 p-3",children:o.jsx("div",{className:"text-xs text-foreground/80 leading-relaxed",children:e.verdict})}),o.jsxs("div",{className:"text-[10px] text-muted-foreground/60 text-center",children:["Powered by ",e.poweredBy]})]})}function yd({label:e,value:t,invert:n}){const r=parseFloat(t),s=n?r<0:r>0,i=n?r>0:r<0,a=r===0||isNaN(r);return o.jsxs("div",{children:[o.jsx("div",{className:L("text-xl font-bold",s&&"text-green-400",i&&"text-red-400",a&&"text-muted-foreground"),children:t}),o.jsx("div",{className:"text-[10px] text-muted-foreground",children:e})]})}const t3=()=>{const e=XA(),[t,n]=h.useState(()=>Ur()),[r,s]=h.useState(null),[i,a]=h.useState(null),[l,c]=h.useState(null),[d,u]=h.useState(null),[f,m]=h.useState(!1),[p,v]=h.useState(""),[x,w]=h.useState(null),g=h.useRef(null);[...t.map(R=>({id:R.id,title:R.name,thesis:R.world.thesis,invariantCount:R.world.invariants.length,gateCount:(R.world.gates??[]).length})),...e];const b=R=>{if(!R)return null;const P=t.find(_=>_.id===R);if(P){const _=P.world.invariants,k=P.world.gates??[],A=_.filter(B=>B.enforceable).length,M=_.length-A,U=k.filter(B=>B.severity==="critical"),$=k.filter(B=>B.severity==="warning");return{worldId:R,title:P.name,thesis:P.world.thesis,invariantSummary:_.length===0?"No invariants defined — ungoverned.":`${_.length} rules (${A} enforced, ${M} advisory): ${_.map(B=>B.description).join("; ")}`,gateSummary:k.length===0?"No viability gates — no collapse detection.":`${k.length} gates (${U.length} critical, ${$.length} warning)`,riskProfile:U.length>=2?"high":U.length>=1||$.length>=2?"moderate":"low"}}try{return ZA(R)}catch{return null}},y=r&&i&&r!==i&&!f,N=h.useCallback(async()=>{if(!(!r||!i)){m(!0),c(null),u(null),v("Initializing worlds...");try{const R=await qA(r,i,{onProgress:(P,_)=>v(`${P}: ${_}...`)});c(R),u(JA(R)),v("")}catch(R){console.error("World comparison failed:",R),v("Comparison failed — check console for details.")}finally{m(!1)}}},[r,i]),S=h.useCallback((R,P)=>{const _=R==="A"?r:i;if(_)try{const k=ji(_),A=Q5(P,k.world,_,{description:`Saved from comparison: ${k.title}`,tags:["comparison"]});zh(A),n(Ur()),w(null)}catch(k){console.error("Failed to save world:",k)}},[r,i]),C=h.useCallback(R=>{K5(R),n(Ur()),r===R&&s(null),i===R&&a(null)},[r,i]),j=h.useCallback(()=>{if(!l||!d)return;const R={comparison:l,impact:d,exportedAt:new Date().toISOString()},P=new Blob([JSON.stringify(R,null,2)],{type:"application/json"}),_=URL.createObjectURL(P),k=document.createElement("a");k.href=_,k.download=`world-comparison-${l.worldA.id}-vs-${l.worldB.id}.json`,k.click(),URL.revokeObjectURL(_)},[l,d]),E=h.useCallback(R=>{var k;const P=(k=R.target.files)==null?void 0:k[0];if(!P)return;const _=new FileReader;_.onload=()=>{try{const A=Y5(_.result);zh(A),n(Ur())}catch(A){console.error("Failed to import world:",A),alert(`Import failed: ${A instanceof Error?A.message:"Invalid file"}`)}},_.readAsText(P),R.target.value=""},[]);return h.useCallback(R=>{const P=t.find(M=>M.id===R);if(!P)return;const _=new Blob([q5(P)],{type:"application/json"}),k=URL.createObjectURL(_),A=document.createElement("a");A.href=k,A.download=`${P.name.replace(/\s+/g,"-").toLowerCase()}.nv-world.json`,A.click(),URL.revokeObjectURL(k)},[t]),o.jsx("section",{className:"border-t border-border py-10",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-5xl space-y-8",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(AC,{className:"h-5 w-5 text-primary"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Compare Worlds"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Same agents, different rules. See how governance changes the outcome."})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{ref:g,type:"file",accept:".json",onChange:E,className:"hidden"}),o.jsxs(ne,{size:"sm",variant:"outline",className:"gap-1.5 text-xs",onClick:()=>{var R;return(R=g.current)==null?void 0:R.click()},children:[o.jsx(z0,{className:"h-3.5 w-3.5"}),"Import World"]})]})]}),o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsx(fg,{label:"World A",selected:r,onSelect:s,presets:e,savedWorlds:t,explanation:b(r),disabled:f,onDeleteSaved:C}),o.jsx(fg,{label:"World B",selected:i,onSelect:R=>a(R===r?null:R),presets:e.filter(R=>R.id!==r),savedWorlds:t.filter(R=>R.id!==r),explanation:b(i),disabled:f,onDeleteSaved:C})]}),o.jsx("div",{className:"flex justify-center",children:o.jsx(ne,{onClick:N,disabled:!y,size:"lg",className:"gap-2",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Ar,{className:"h-4 w-4 animate-pulse"}),p||"Simulating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Oi,{className:"h-4 w-4"}),"Run Comparison"]})})}),l&&d&&o.jsxs("div",{className:"space-y-6 animate-in fade-in-0 slide-in-from-bottom-4 duration-500",children:[o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(pg,{side:l.worldA,label:"World A",color:"blue"}),x==="A"?o.jsx(mg,{worldId:l.worldA.id,onSave:R=>S("A",R),onCancel:()=>w(null)}):o.jsxs(ne,{size:"sm",variant:"ghost",className:"w-full gap-1.5 text-xs text-muted-foreground",onClick:()=>w("A"),children:[o.jsx(wh,{className:"h-3.5 w-3.5"})," Save World A"]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pg,{side:l.worldB,label:"World B",color:"amber"}),x==="B"?o.jsx(mg,{worldId:l.worldB.id,onSave:R=>S("B",R),onCancel:()=>w(null)}):o.jsxs(ne,{size:"sm",variant:"ghost",className:"w-full gap-1.5 text-xs text-muted-foreground",onClick:()=>w("B"),children:[o.jsx(wh,{className:"h-3.5 w-3.5"})," Save World B"]})]})]}),o.jsx(e3,{impact:d}),o.jsx("div",{className:"flex justify-center",children:o.jsxs(ne,{size:"sm",variant:"outline",className:"gap-1.5 text-xs",onClick:j,children:[o.jsx(O0,{className:"h-3.5 w-3.5"})," Export Comparison as JSON"]})})]})]})})})},n3=()=>o.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[o.jsxs("div",{className:"relative mb-6 h-32 w-64 overflow-hidden rounded-lg border border-border bg-card",children:[[0,1,2].map(e=>o.jsx("div",{className:"absolute left-0 right-0 h-px bg-primary/60 scan-line",style:{animationDelay:`${e*.5}s`}},e)),o.jsx("div",{className:"absolute inset-0 grid grid-cols-8 grid-rows-4 gap-1 p-3",children:Array.from({length:32}).map((e,t)=>o.jsx("div",{className:"rounded-full bg-primary/20 animate-pulse",style:{animationDelay:`${t*50}ms`}},t))})]}),o.jsx("p",{className:"text-sm text-muted-foreground animate-pulse",children:"Building reasoning graph..."})]}),r3=()=>{const[e,t]=h.useState(!1);return h.useEffect(()=>{const n=()=>t(window.scrollY>400);return window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[]),e?o.jsx(ne,{size:"icon",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:"fixed bottom-6 right-6 z-50 rounded-full shadow-lg glow-teal animate-fade-in","aria-label":"Scroll to top",children:o.jsx(kC,{className:"h-5 w-5"})}):null},s3={severity:50,environmentalHostility:50,timePressure:50,regulatoryClimate:50},o3={timeHorizon:"",riskTolerance:"moderate",budget:""},i3={outcome:"",priority:"important",timeframe:"",successCriteria:[],redLines:[],availableLevers:[]},a3=()=>{const{theme:e,toggle:t}=wm(),n=h.useRef(null),r=h.useRef(null),s=h.useRef(null),[i,a]=h.useState(null),[l,c]=h.useState(""),[d,u]=h.useState(s3),[f,m]=h.useState([]),[p,v]=h.useState(o3),[x,w]=h.useState("full"),[g,b]=h.useState("explore"),[y,N]=h.useState(i3),[S,C]=h.useState(null),[j,E]=h.useState(null),[R,P]=h.useState(!1),[_,k]=h.useState(!1),[A,M]=h.useState(!1),[U,$]=h.useState(null),[B,T]=h.useState(null),[I,D]=h.useState(null),[Q,G]=h.useState(null),[J,Z]=h.useState(!1),[pe,we]=h.useState(!1),[W,ue]=h.useState("deterministic");h.useEffect(()=>{if(window.location.hash.includes("capsule="))try{const le=R5(window.location.href);le&&(c(le.scenario),setTimeout(()=>{var ce;return(ce=n.current)==null?void 0:ce.scrollIntoView({behavior:"smooth"})},300))}catch{}},[]);const ve=h.useCallback(()=>{var se;(se=n.current)==null||se.scrollIntoView({behavior:"smooth"})},[]),de=h.useCallback(()=>{var se;(se=r.current)==null||se.scrollIntoView({behavior:"smooth"})},[]),F=h.useCallback((se,le)=>{c(se),b("goal"),N(ce=>({...ce,outcome:le})),setTimeout(()=>{var ce;return(ce=n.current)==null?void 0:ce.scrollIntoView({behavior:"smooth"})},100)},[]),X=h.useCallback((se,le)=>{c(`${se}: ${le}`),setTimeout(()=>{var ce;return(ce=n.current)==null?void 0:ce.scrollIntoView({behavior:"smooth"})},100)},[]),ge=h.useCallback(se=>{a(se),c(""),u(se.defaultSliders),M(_)},[_]),ae=h.useCallback(se=>{c(se),se.trim()&&a(null)},[]),pt=h.useCallback(se=>{u(se),_&&M(!0)},[_]),Fe=h.useCallback(async()=>{P(!0),M(!1),$(null);try{const se=i||l,le={stakeholders:f.length>0?f:void 0,constraints:p,depth:x,mode:g,goal:g==="goal"&&y.outcome.trim()?{outcome:y.outcome,priority:y.priority,timeframe:y.timeframe||void 0,success_criteria:y.successCriteria.length>0?y.successCriteria:void 0,red_lines:y.redLines.length>0?y.redLines:void 0,available_levers:y.availableLevers.length>0?y.availableLevers:void 0}:void 0},ce=await RR(se,d,le);C(ce),k(!0),setTimeout(()=>{var Ke;return(Ke=s.current)==null?void 0:Ke.scrollIntoView({behavior:"smooth",block:"start"})},100)}catch(se){console.error("Reasoning engine error:",se)}finally{P(!1)}},[i,l,d,f,p,x,g,y]),We=h.useCallback(se=>{P(!0),setTimeout(()=>{const le=WR(se);E(le),C(le),P(!1),setTimeout(()=>{var ce;return(ce=s.current)==null?void 0:ce.scrollIntoView({behavior:"smooth",block:"start"})},100)},2e3)},[]),Ut=h.useCallback((se,le)=>{if(!(S!=null&&S.goalResult))return;const ce=S.goalResult.strategies.find(it=>it.id===se);if(!ce)return;const Ke=ce.steps.map(it=>({...it,action:le.includes(it.lever)?it.action:`[DISABLED] ${it.action}`,expected_effect:le.includes(it.lever)?it.expected_effect:"Lever disabled — effect removed from path"})),Or=le.length/Math.max(ce.levers_used.length,1);$({originalStrategy:ce,injectedEvent:{atStep:0,event:`Levers modified: ${le.join(", ")}`},forkedSteps:Ke,probabilityDelta:(Or-1)*ce.success_probability*.3,riskDelta:Or<.5?"increased":ce.risk})},[S]),At=h.useCallback(se=>{if(!(S!=null&&S.goalResult))return;const le=S.goalResult.strategies.find(Ke=>Ke.id===S.goalResult.recommended_strategy_id);if(!le)return;const ce=le.steps.filter(Ke=>Ke.order>se.atStep+1).map(Ke=>({...Ke,action:`[ADAPTED] ${Ke.action}`,expected_effect:`Modified by event: "${se.event}" — ${Ke.expected_effect}`}));ce.length===0&&ce.push({order:se.atStep+2,action:"Reassess strategy in light of new event",timeframe:"Immediate",lever:"Assessment",expected_effect:"Determine whether original path is still viable",risk:"Delay in execution while reassessing"}),$({originalStrategy:le,injectedEvent:se,forkedSteps:ce,probabilityDelta:-.1-Math.random()*.15,riskDelta:"elevated"})},[S]),Vi=h.useCallback(async()=>{var se,le,ce,Ke;if(S){Z(!0);try{const{generateGovernedReport:Or}=await Tu(async()=>{const{generateGovernedReport:ht}=await import("./reportEngine-CYSZfooa.js");return{generateGovernedReport:ht}},[]),{generateDeterministicReport:it}=await Tu(async()=>{const{generateDeterministicReport:ht}=await Promise.resolve().then(()=>b5);return{generateDeterministicReport:ht}},void 0),Ne=S.governance,Wi={scenario:l||(i==null?void 0:i.title)||"Simulation",rounds:[],metrics:{avgImpact:-.15,collapseProbability:((se=Ne==null?void 0:Ne.neuroverse)==null?void 0:se.collapseRisk)==="high"?.65:.25,stabilityScore:(((le=Ne==null?void 0:Ne.neuroverse)==null?void 0:le.worldHealthScore)??65)/100,maxVolatility:.45,peakNegativeSentiment:-.5},interventions:(Ne==null?void 0:Ne.enforcedConstraints)??[],governanceStats:{totalEvaluations:(Ne==null?void 0:Ne.constitutionalChecks.length)??0,blocks:(Ne==null?void 0:Ne.constitutionalChecks.filter(ht=>!ht.passed).length)??0,pauses:((ce=Ne==null?void 0:Ne.neuroverse)==null?void 0:ce.guardStatus)==="PAUSE"?1:0,allows:(Ne==null?void 0:Ne.constitutionalChecks.filter(ht=>ht.passed).length)??0,rulesFired:((Ke=Ne==null?void 0:Ne.neuroverse)==null?void 0:Ke.rulesFired)??0}},gs=it(Wi);D(gs),G({result:gs,actor:"ai_analyst",action:"generate_report",governed:!0,trace:{constraints:["must_reference_trace","must_include_blocked_actions","must_include_metrics","no_unverifiable_claims"],passed:!0,violations:[]}}),ue(pe?"ai":"deterministic")}catch(Or){console.error("Report generation failed:",Or)}finally{Z(!1)}}},[S,pe,l,i]),qn=!!(i||l.trim()),Ui=qn&&!j,$e=_&&S&&!R||j&&!R,jc=(i==null?void 0:i.title)||l.slice(0,60)||"Custom Scenario";return o.jsxs("div",{className:"min-h-screen bg-background",children:[o.jsx(n_,{showSimulatedFuture:!!$e,theme:e,onToggleTheme:t,isSimulating:R||!!$e}),o.jsxs("main",{className:"pt-20",children:[o.jsx(a_,{onRunScenario:ve,onPasteSimulation:de}),o.jsx(f_,{onFullAnalysis:F}),o.jsx(k_,{}),o.jsx("div",{ref:r,children:o.jsx(m_,{onExplain:We,isLoading:R})}),o.jsx(A_,{onSelect:X}),o.jsx(GA,{}),o.jsx(P_,{}),o.jsx("div",{ref:n,children:o.jsx(I_,{onSelectScenario:ge,onCustomScenario:ae,onCalculate:Fe,selectedId:(i==null?void 0:i.id)||null,customText:l,isLoading:R,hasScenario:qn})}),Ui&&o.jsx("section",{className:"border-t border-border py-8",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsxs("div",{className:"mx-auto max-w-4xl space-y-6",children:[o.jsx(OT,{onWorldReady:T}),o.jsx(AT,{}),o.jsxs("details",{className:"group",children:[o.jsx("summary",{className:"cursor-pointer text-xs font-semibold uppercase tracking-[0.15em] text-muted-foreground hover:text-foreground transition-colors",children:"Advanced Configuration"}),o.jsxs("div",{className:"mt-4 space-y-6",children:[o.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:o.jsx(IT,{mode:g,onChange:b})}),g==="goal"&&o.jsx(MT,{values:y,onChange:N}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[o.jsx(CT,{stakeholders:f,onChange:m}),o.jsx(_T,{values:p,onChange:v})]}),o.jsx(TT,{value:x,onChange:w}),o.jsx(eP,{values:d,onChange:pt,showRecalculate:A,onRecalculate:Fe})]})]})]})})}),R&&o.jsx(n3,{}),o.jsx("div",{ref:s}),j&&!R&&o.jsx(S_,{result:j}),$e&&S&&o.jsx("section",{className:"border-t border-border py-6",children:o.jsx("div",{className:"container mx-auto px-6",children:o.jsx("div",{className:"mx-auto max-w-5xl",children:o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("h2",{className:"text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"SIMULATED FUTURE"}),S.confidence&&o.jsx(BT,{confidence:S.confidence})]}),S.lastRequest&&o.jsx(SA,{request:S.lastRequest,title:jc})]})})})}),$e&&(S==null?void 0:S.keyAssumptions)&&o.jsx(UT,{assumptions:S.keyAssumptions}),$e&&S&&o.jsx(dA,{result:S}),$e&&S&&o.jsx(fA,{challenges:S.challenges}),$e&&S&&o.jsx(mA,{recommendations:S.recommendations}),$e&&(S==null?void 0:S.goalResult)&&o.jsx(bA,{goalResult:S.goalResult,onForkStrategy:Ut}),$e&&(S==null?void 0:S.goalResult)&&o.jsx(NA,{strategy:S.goalResult.strategies.find(se=>se.id===S.goalResult.recommended_strategy_id)||S.goalResult.strategies[0],onInjectEvent:At,forkedTimeline:U}),$e&&(S==null?void 0:S.governance)&&o.jsx(RA,{governance:S.governance}),o.jsx(t3,{}),$e&&S&&o.jsx(_A,{report:I,governance:Q,isGenerating:J,aiEnabled:pe,provider:W,onGenerate:Vi,onToggleAI:we})]}),o.jsx(r3,{}),o.jsx(r_,{governance:$e&&(S!=null&&S.governance)?S.governance:void 0})]})};function l3(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Im="ScrollArea",[Vw,K3]=Bt(Im),[c3,Vt]=Vw(Im),Uw=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=e,[l,c]=h.useState(null),[d,u]=h.useState(null),[f,m]=h.useState(null),[p,v]=h.useState(null),[x,w]=h.useState(null),[g,b]=h.useState(0),[y,N]=h.useState(0),[S,C]=h.useState(!1),[j,E]=h.useState(!1),R=oe(t,_=>c(_)),P=Di(s);return o.jsx(c3,{scope:n,type:r,dir:P,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:u,content:f,onContentChange:m,scrollbarX:p,onScrollbarXChange:v,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:x,onScrollbarYChange:w,scrollbarYEnabled:j,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:N,children:o.jsx(Y.div,{dir:P,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});Uw.displayName=Im;var Ww="ScrollAreaViewport",Hw=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=e,a=Vt(Ww,n),l=h.useRef(null),c=oe(t,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Y.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Hw.displayName=Ww;var Rn="ScrollAreaScrollbar",Mm=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Vt(Rn,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=e.orientation==="horizontal";return h.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(d3,{...r,ref:t,forceMount:n}):s.type==="scroll"?o.jsx(u3,{...r,ref:t,forceMount:n}):s.type==="auto"?o.jsx(Gw,{...r,ref:t,forceMount:n}):s.type==="always"?o.jsx(Om,{...r,ref:t}):null});Mm.displayName=Rn;var d3=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Vt(Rn,e.__scopeScrollArea),[i,a]=h.useState(!1);return h.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),a(!0)},u=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(Kn,{present:n||i,children:o.jsx(Gw,{"data-state":i?"visible":"hidden",...r,ref:t})})}),u3=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Vt(Rn,e.__scopeScrollArea),i=e.orientation==="horizontal",a=Sc(()=>c("SCROLL_END"),100),[l,c]=l3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return h.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),h.useEffect(()=>{const d=s.viewport,u=i?"scrollLeft":"scrollTop";if(d){let f=d[u];const m=()=>{const p=d[u];f!==p&&(c("SCROLL"),a()),f=p};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[s.viewport,i,c,a]),o.jsx(Kn,{present:n||l!=="hidden",children:o.jsx(Om,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:K(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:K(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Gw=h.forwardRef((e,t)=>{const n=Vt(Rn,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,a]=h.useState(!1),l=e.orientation==="horizontal",c=Sc(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?d:u)}},10);return ho(n.viewport,c),ho(n.content,c),o.jsx(Kn,{present:r||i,children:o.jsx(Om,{"data-state":i?"visible":"hidden",...s,ref:t})})}),Om=h.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=Vt(Rn,e.__scopeScrollArea),i=h.useRef(null),a=h.useRef(0),[l,c]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Xw(l.viewport,l.content),u={...r,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:m=>a.current=m};function f(m,p){return x3(m,a.current,l,p)}return n==="horizontal"?o.jsx(f3,{...u,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollLeft,p=hg(m,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):n==="vertical"?o.jsx(m3,{...u,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollTop,p=hg(m,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),f3=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Vt(Rn,e.__scopeScrollArea),[a,l]=h.useState(),c=h.useRef(null),d=oe(t,c,i.onScrollbarXChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(qw,{"data-orientation":"horizontal",...s,ref:d,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Nc(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const m=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(m),Jw(m,f)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:El(a.paddingLeft),paddingEnd:El(a.paddingRight)}})}})}),m3=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Vt(Rn,e.__scopeScrollArea),[a,l]=h.useState(),c=h.useRef(null),d=oe(t,c,i.onScrollbarYChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(qw,{"data-orientation":"vertical",...s,ref:d,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Nc(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const m=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(m),Jw(m,f)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:El(a.paddingTop),paddingEnd:El(a.paddingBottom)}})}})}),[p3,Kw]=Vw(Rn),qw=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:f,...m}=e,p=Vt(Rn,n),[v,x]=h.useState(null),w=oe(t,R=>x(R)),g=h.useRef(null),b=h.useRef(""),y=p.viewport,N=r.content-r.viewport,S=Be(u),C=Be(c),j=Sc(f,10);function E(R){if(g.current){const P=R.clientX-g.current.left,_=R.clientY-g.current.top;d({x:P,y:_})}}return h.useEffect(()=>{const R=P=>{const _=P.target;(v==null?void 0:v.contains(_))&&S(P,N)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[y,v,N,S]),h.useEffect(C,[r,C]),ho(v,j),ho(p.content,j),o.jsx(p3,{scope:n,scrollbar:v,hasThumb:s,onThumbChange:Be(i),onThumbPointerUp:Be(a),onThumbPositionChange:C,onThumbPointerDown:Be(l),children:o.jsx(Y.div,{...m,ref:w,style:{position:"absolute",...m.style},onPointerDown:K(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),g.current=v.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),E(R))}),onPointerMove:K(e.onPointerMove,E),onPointerUp:K(e.onPointerUp,R=>{const P=R.target;P.hasPointerCapture(R.pointerId)&&P.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),Cl="ScrollAreaThumb",Yw=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Kw(Cl,e.__scopeScrollArea);return o.jsx(Kn,{present:n||s.hasThumb,children:o.jsx(h3,{ref:t,...r})})}),h3=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=Vt(Cl,n),a=Kw(Cl,n),{onThumbPositionChange:l}=a,c=oe(t,f=>a.onThumbChange(f)),d=h.useRef(void 0),u=Sc(()=>{d.current&&(d.current(),d.current=void 0)},100);return h.useEffect(()=>{const f=i.viewport;if(f){const m=()=>{if(u(),!d.current){const p=v3(f,l);d.current=p,l()}};return l(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,u,l]),o.jsx(Y.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:K(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),v=f.clientX-p.left,x=f.clientY-p.top;a.onThumbPointerDown({x:v,y:x})}),onPointerUp:K(e.onPointerUp,a.onThumbPointerUp)})});Yw.displayName=Cl;var Lm="ScrollAreaCorner",Qw=h.forwardRef((e,t)=>{const n=Vt(Lm,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(g3,{...e,ref:t}):null});Qw.displayName=Lm;var g3=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=Vt(Lm,n),[i,a]=h.useState(0),[l,c]=h.useState(0),d=!!(i&&l);return ho(s.scrollbarX,()=>{var f;const u=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(u),c(u)}),ho(s.scrollbarY,()=>{var f;const u=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(u),a(u)}),d?o.jsx(Y.div,{...r,ref:t,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function El(e){return e?parseInt(e,10):0}function Xw(e,t){const n=e/t;return isNaN(n)?0:n}function Nc(e){const t=Xw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function x3(e,t,n,r="ltr"){const s=Nc(n),i=s/2,a=t||i,l=s-a,c=n.scrollbar.paddingStart+a,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return Zw([c,d],f)(e)}function hg(e,t,n="ltr"){const r=Nc(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,a=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],d=Si(e,c);return Zw([0,a],[0,l])(d)}function Zw(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Jw(e,t){return e>0&&e<t}var v3=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function Sc(e,t){const n=Be(e),r=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),h.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ho(e,t){const n=Be(t);Ue(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var e1=Uw,y3=Hw,b3=Qw;const t1=h.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(e1,{ref:r,className:L("relative overflow-hidden",e),...n,children:[o.jsx(y3,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(n1,{}),o.jsx(b3,{})]}));t1.displayName=e1.displayName;const n1=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>o.jsx(Mm,{ref:r,orientation:t,className:L("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:o.jsx(Yw,{className:"relative flex-1 rounded-full bg-border"})}));n1.displayName=Mm.displayName;var w3="Separator",gg="horizontal",N3=["horizontal","vertical"],r1=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=gg,...s}=e,i=S3(r)?r:gg,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(Y.div,{"data-orientation":i,...l,...s,ref:t})});r1.displayName=w3;function S3(e){return N3.includes(e)}var s1=r1;const Ss=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>o.jsx(s1,{ref:s,decorative:n,orientation:t,className:L("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ss.displayName=s1.displayName;function xg(e,t){const n=e.map(f=>f.impact),r=n.reduce((f,m)=>f+m,0)/n.length,s=n.reduce((f,m)=>f+(m-r)**2,0)/n.length,i=n.filter(f=>f>.2).length,a=n.filter(f=>f<-.2).length,l=n.length,c=l>0?Math.min(1,Math.min(i,a)/(l*.5)*(s*4)):0,d=n.filter(f=>f<0).reduce((f,m)=>f+Math.abs(m),0)/Math.max(1,n.length),u=Math.min(1,d*1.5);return{polarization:c,outrage:u,avgImpact:r,variance:s}}function $r(e,t,n=3){if(e.length<2)return"stable";const r=e.slice(-n);if(r.length<2)return"stable";const s=r[0][t],a=r[r.length-1][t]-s;return a>.1?"rising":a<-.1?"falling":"stable"}function j3(e){const t=ls(e),n=[];let r=0;for(const s of t.rules){const i=s.description.toLowerCase();(i.includes("spread")||i.includes("propagat")||i.includes("viral")||i.includes("limit reach")||i.includes("contain")||i.includes("quarantine"))&&n.push({id:`DYN-PROP-${++r}`,description:s.description,type:"propagation",threshold:.6,strength:s.category==="prohibit"?.8:s.category==="limit"?.5:.3,monitors:"informationVelocity",active:!0}),(i.includes("amplif")||i.includes("media")||i.includes("influence")||i.includes("boost")||i.includes("visibil")||i.includes("platform"))&&n.push({id:`DYN-AMP-${++r}`,description:s.description,type:"amplification",threshold:.5,strength:s.category==="prohibit"?.7:.4,monitors:"amplification",active:!0}),(i.includes("cascade")||i.includes("circuit")||i.includes("runaway")||i.includes("feedback")||i.includes("spiral")||i.includes("chain reaction")||i.includes("contagion")||i.includes("panic"))&&n.push({id:`DYN-CASC-${++r}`,description:s.description,type:"cascade",threshold:.7,strength:.9,monitors:"cascadeRisk",active:!0}),(i.includes("trust")||i.includes("legitim")||i.includes("credib")||i.includes("transparen")||i.includes("accountab")||i.includes("institution"))&&n.push({id:`DYN-TRUST-${++r}`,description:s.description,type:"trust",threshold:.4,strength:.5,monitors:"trust",active:!0}),(i.includes("dampen")||i.includes("cool")||i.includes("de-escalat")||i.includes("moderate")||i.includes("calm")||i.includes("stabiliz"))&&n.push({id:`DYN-FEED-${++r}`,description:s.description,type:"feedback",threshold:.5,strength:.6,monitors:"outrage",active:!0}),(i.includes("pause")||i.includes("halt")||i.includes("freeze")||i.includes("cooling")||i.includes("moratorium")||i.includes("waiting period"))&&n.push({id:`DYN-COOL-${++r}`,description:s.description,type:"cooling",threshold:.7,strength:.8,monitors:"outrage",active:!0})}return n.length===0&&n.push({id:"DYN-BASE-1",description:"Default propagation control — limit information spread during high outrage",type:"propagation",threshold:.7,strength:.4,monitors:"informationVelocity",active:!0},{id:"DYN-BASE-2",description:"Default cascade protection — activate circuit breaker during crisis",type:"cascade",threshold:.8,strength:.7,monitors:"cascadeRisk",active:!0}),n}function k3(e,t,n){const r=n!=null&&n.skipRules?[]:j3(e),s=new Map;let i={polarization:.1,outrage:.1,trust:.7,informationVelocity:.3,amplification:1,cascadeRisk:.1,contagionDepth:2,coolingPeriod:0,history:[],...t};const a={totalRounds:0,totalInterventions:0,propagationLimits:0,amplificationDampens:0,cascadeBreakers:0,coolingPeriods:0,trustBoosts:0,peakOutrage:0,peakPolarization:0,peakCascadeRisk:0,trustSum:0};function l(d,u,f){a.totalRounds++;const m=[],p=[],v=d.map(y=>({...y})),x=xg(d);if(i.polarization=i.polarization*.6+x.polarization*.4,i.outrage=i.outrage*.5+x.outrage*.5,i.informationVelocity=Math.min(1,.3+x.variance*2),i.cascadeRisk=Math.min(1,i.outrage*.3+i.polarization*.2+i.informationVelocity*.2+(1-i.trust)*.3),i.outrage>.5?i.trust=Math.max(.05,i.trust-.05*i.outrage):i.outrage<.2&&(i.trust=Math.min(1,i.trust+.02)),a.peakOutrage=Math.max(a.peakOutrage,i.outrage),a.peakPolarization=Math.max(a.peakPolarization,i.polarization),a.peakCascadeRisk=Math.max(a.peakCascadeRisk,i.cascadeRisk),a.trustSum+=i.trust,i.coolingPeriod>0){const y=.4+i.coolingPeriod*.1;for(const N of v)N.impact<-.1&&(N.impact,N.impact=N.impact*(1-y),N.confidence=Math.max(.1,N.confidence*.7));m.push({type:"COOLING_PERIOD",description:`Cooling period active (${i.coolingPeriod} rounds remaining) — reactive posting dampened by ${(y*100).toFixed(0)}%`,triggeredBy:"COOLING_PERIOD",agentsAffected:v.filter(N=>N.impact<-.1).length,magnitude:y,effect:{metric:"outrage",before:i.outrage,after:i.outrage*(1-y*.3)}}),i.coolingPeriod--,a.coolingPeriods++}for(const y of r)if(y.active)switch(i[y.monitors],y.type){case"propagation":{if(i.informationVelocity>y.threshold||i.outrage>.6){const N=1-y.strength*.5;let S=0;const C=i.contagionDepth;i.contagionDepth=Math.max(1,Math.floor(i.contagionDepth*N));for(const j of v)Math.abs(j.impact)>.4&&(j.impact,j.impact=j.impact*N,S++);if(S>0){const j=i.informationVelocity;i.informationVelocity*=N,m.push({type:"PROPAGATION_LIMIT",description:`Propagation limited: spread depth ${C} → ${i.contagionDepth}, ${S} extreme agents dampened (${y.description})`,triggeredBy:y.id,agentsAffected:S,magnitude:y.strength,effect:{metric:"informationVelocity",before:j,after:i.informationVelocity}}),p.push(y.id),a.propagationLimits++,a.totalInterventions++}}break}case"amplification":{const N=$r(i.history,"polarization");if(i.polarization>y.threshold||N==="rising"){const S=1-y.strength*.4;let C=0;for(const j of v){const E=(f==null?void 0:f.get(j.stakeholder_id))??"";(E.toLowerCase().includes("media")||E.toLowerCase().includes("influencer")||j.stakeholder_id.toLowerCase().includes("media")||j.stakeholder_id.toLowerCase().includes("记者")||j.stakeholder_id.toLowerCase().includes("媒")||Math.abs(j.impact)>.6)&&(j.impact,j.impact=j.impact*S,j.confidence=Math.max(.15,j.confidence*.8),C++)}if(C>0){const j=i.amplification;i.amplification*=S,m.push({type:"AMPLIFICATION_DAMPEN",description:`Amplification dampened: ${C} high-influence agents reduced by ${((1-S)*100).toFixed(0)}% (polarization ${i.polarization.toFixed(2)}, trend: ${N}) — ${y.description}`,triggeredBy:y.id,agentsAffected:C,magnitude:y.strength,effect:{metric:"amplification",before:j,after:i.amplification}}),p.push(y.id),a.amplificationDampens++,a.totalInterventions++}}break}case"cascade":{if(i.cascadeRisk>y.threshold){const N=$r(i.history,"outrage")==="rising",S=N?y.strength:y.strength*.6;let C=0;for(const E of v)E.impact<-.15&&(E.impact,E.impact=E.impact*(1-S),E.confidence=Math.max(.1,E.confidence*(1-S*.5)),C++);i.coolingPeriod===0&&N&&(i.coolingPeriod=2);const j=i.cascadeRisk;i.cascadeRisk*=1-S*.4,m.push({type:"CASCADE_BREAKER",description:`CASCADE CIRCUIT BREAKER: ${C} agents compressed, cascade risk ${j.toFixed(2)} → ${i.cascadeRisk.toFixed(2)}${N?" + cooling period activated":""} — ${y.description}`,triggeredBy:y.id,agentsAffected:C,magnitude:S,effect:{metric:"cascadeRisk",before:j,after:i.cascadeRisk}}),p.push(y.id),a.cascadeBreakers++,a.totalInterventions++}break}case"trust":{if(i.trust<y.threshold){let N=0;for(const S of v){const C=(f==null?void 0:f.get(S.stakeholder_id))??"",j=C.toLowerCase().includes("official")||C.toLowerCase().includes("government")||C.toLowerCase().includes("institution")||S.stakeholder_id.toLowerCase().includes("regulator")||S.stakeholder_id.toLowerCase().includes("central")||S.stakeholder_id.toLowerCase().includes("official")||S.stakeholder_id.toLowerCase().includes("管理")||S.stakeholder_id.toLowerCase().includes("官方");j&&S.impact>-.2?(S.impact,S.impact=Math.min(1,S.impact*1.3+.1),S.confidence=Math.min(1,S.confidence*1.2),N++):!j&&S.impact<-.3&&(S.impact=S.impact*.7,N++)}if(N>0){const S=i.trust;i.trust=Math.min(1,i.trust+.03*y.strength),m.push({type:"TRUST_BOOST",description:`Trust-responsive visibility: official sources boosted, unverified claims dampened (trust ${S.toFixed(2)} → ${i.trust.toFixed(2)}) — ${y.description}`,triggeredBy:y.id,agentsAffected:N,magnitude:y.strength,effect:{metric:"trust",before:S,after:i.trust}}),p.push(y.id),a.trustBoosts++,a.totalInterventions++}}break}case"feedback":{const N=$r(i.history,"outrage");if(i.outrage>y.threshold&&N==="rising"){const S=1-y.strength*.35;let C=0;for(const j of v)Math.abs(j.impact)>.2&&(j.impact,j.impact=j.impact*S,C++);if(C>0){const j=i.outrage;i.outrage*=S,m.push({type:"FEEDBACK_DAMPEN",description:`Feedback loop dampened: ${C} reactive agents moderated, outrage ${j.toFixed(2)} → ${i.outrage.toFixed(2)} (trend: ${N}) — ${y.description}`,triggeredBy:y.id,agentsAffected:C,magnitude:y.strength,effect:{metric:"outrage",before:j,after:i.outrage}}),p.push(y.id),a.totalInterventions++}}break}case"cooling":{i.outrage>y.threshold&&i.coolingPeriod===0&&(i.coolingPeriod=Math.ceil(y.strength*3),m.push({type:"COOLING_PERIOD",description:`Cooling period triggered: ${i.coolingPeriod} round(s) of dampened reactive posting (outrage: ${i.outrage.toFixed(2)}) — ${y.description}`,triggeredBy:y.id,agentsAffected:0,magnitude:y.strength,effect:{metric:"outrage",before:i.outrage,after:i.outrage}}),p.push(y.id),a.coolingPeriods++,a.totalInterventions++);break}}for(const y of v)y.impact=Math.max(-1,Math.min(1,y.impact)),y.impact=Number(y.impact.toFixed(3)),y.confidence=Math.max(.05,Math.min(1,y.confidence)),y.confidence=Number(y.confidence.toFixed(3));const w=xg(v);i.history.push({round:u,polarization:Number(i.polarization.toFixed(3)),outrage:Number(i.outrage.toFixed(3)),trust:Number(i.trust.toFixed(3)),amplification:Number(i.amplification.toFixed(3)),cascadeRisk:Number(i.cascadeRisk.toFixed(3)),avgImpact:Number(w.avgImpact.toFixed(3)),agentCount:v.length});let g;i.coolingPeriod>0?g="cooling":i.cascadeRisk>.7?g="critical":$r(i.history,"outrage")==="rising"||$r(i.history,"polarization")==="rising"?g="escalating":$r(i.history,"outrage")==="falling"&&$r(i.history,"polarization")==="falling"?g="de-escalating":g="stable";const b=Math.min(1,i.cascadeRisk*.4+i.outrage*.3+i.polarization*.2+i.informationVelocity*.1);return{reactions:v,systemState:{...i,history:[...i.history]},interventions:m,rulesFired:p,trajectory:g,predictedRisk:Number(b.toFixed(3))}}function c(){i={polarization:.1,outrage:.1,trust:.7,informationVelocity:.3,amplification:1,cascadeRisk:.1,contagionDepth:2,coolingPeriod:0,history:[],...t},s.clear(),a.totalRounds=0,a.totalInterventions=0,a.propagationLimits=0,a.amplificationDampens=0,a.cascadeBreakers=0,a.coolingPeriods=0,a.trustBoosts=0,a.peakOutrage=0,a.peakPolarization=0,a.peakCascadeRisk=0,a.trustSum=0}return{governRound:l,get state(){return{...i,history:[...i.history]}},mutateState(d){d(i)},get rules(){return[...r]},get agentIncentiveStats(){return s},get stats(){return{totalRounds:a.totalRounds,totalInterventions:a.totalInterventions,propagationLimits:a.propagationLimits,amplificationDampens:a.amplificationDampens,cascadeBreakers:a.cascadeBreakers,coolingPeriods:a.coolingPeriods,trustBoosts:a.trustBoosts,peakOutrage:a.peakOutrage,peakPolarization:a.peakPolarization,peakCascadeRisk:a.peakCascadeRisk,averageTrust:a.totalRounds>0?Number((a.trustSum/a.totalRounds).toFixed(3)):.7}},reset:c}}const Fa=["Limit propagation of causal claims that lack multi-source evidence","Contain unvalidated hypotheses within originating research group","Quarantine findings that have not passed independent reproduction","Dampen amplification of self-citation loops exceeding 3 generations","Limit influence of popular findings that lack independent validation","Reduce visibility of papers with high citation velocity but low reproduction rate","Circuit break when cascade of dependent findings exceeds validation capacity","Halt chain reaction of derivative conclusions from unvalidated premises","Break feedback loops between competing research groups amplifying each other","Boost visibility of independently reproduced findings","Require transparency in methodology for all published artifacts","Prioritize credibility of findings with transparent provenance chains","Dampen rush-to-publish behavior during high-competition periods","Cool down reactive publication patterns when controversy index rises","Stabilize publication rate during peer review bottlenecks","Pause redundant investigation paths when convergence detected","Halt compute-intensive explorations that show no evidence of progress"].join(`
582
+ `),C3={polarization:.15,outrage:.05,trust:.8,informationVelocity:.4,amplification:.6,cascadeRisk:.05,contagionDepth:3,coolingPeriod:0};function bd(e){const t=e.polarization>.6?"critical":e.polarization>.3?"elevated":"healthy",n=e.outrage>.5?"dangerous":e.outrage>.2?"elevated":"normal",r=e.trust>.7?"high":e.trust>.4?"moderate":"crisis",s=e.amplification>1.5?"echo chamber":e.amplification>.8?"amplified":"organic",i=e.cascadeRisk>.5?"high":e.cascadeRisk>.2?"moderate":"controlled",a=e.informationVelocity>.7?"frantic":e.informationVelocity>.3?"active":"stalled";let l;return e.trust>.6&&e.cascadeRisk<.3&&e.polarization<.4?l="Healthy discovery — findings are converging with evidence support":e.cascadeRisk>.6?l="False positive cascade risk — unvalidated findings propagating through citations":e.polarization>.6?l="Field fragmentation — competing hypotheses without resolution mechanism":e.trust<.3?l="Reproducibility crisis — institutional credibility collapsing":l="Active investigation — governance maintaining discovery quality",{hypothesisFragmentation:`${t} (${(e.polarization*100).toFixed(0)}%)`,publicationPressure:`${n} (${(e.outrage*100).toFixed(0)}%)`,reproducibilityConfidence:`${r} (${(e.trust*100).toFixed(0)}%)`,citationHealth:`${s} (${e.amplification.toFixed(2)}x)`,falsePositiveRisk:`${i} (${(e.cascadeRisk*100).toFixed(0)}%)`,discoveryVelocity:`${a} (${(e.informationVelocity*100).toFixed(0)}%)`,overallAssessment:l}}function E3(e){let t;switch(e.type){case"hypothesis":t="publish_hypothesis";break;case"experiment":t="run_experiment";break;case"dataset":t="publish_dataset";break;case"model":t="publish_model";break;case"paper":t="publish_paper";break;case"review":t="publish_review";break;case"replication":t="publish_replication";break;default:t="publish";break}const n=Math.min(1,e.citations/10),r=e.confidence*.6+n*.4;return{agentId:e.agentId,type:t,description:e.description,magnitude:Number(r.toFixed(3)),context:{artifactId:e.id,artifactType:e.type,provenance:e.provenance,reproduced:e.reproduced,citations:e.citations,skill:e.skill}}}function vg(e,t,n=!0){const r=new Map;for(const s of t)for(const i of s.artifactIds){const a=r.get(i)??0,l=s.matchType==="confirmation"?s.strength*.3:s.matchType==="contradiction"?-s.strength*.2:s.matchType==="synthesis"?s.strength*.4:s.strength*.15;r.set(i,a+l)}return e.map(s=>{const i=Math.min(.2,s.provenance.length*.05),a=s.reproduced?.15:0,l=r.get(s.id)??0;let c=s.confidence-.3+i+a+l;!s.reproduced&&s.citations>5&&(c-=.2);const d=s.provenance.filter(u=>e.some(f=>f.id===u&&f.agentId===s.agentId)).length;return d>1&&(c-=d*.1),n||(s.reproduced||(c*=1.4,s.confidence<.5&&(c-=.25)),s.provenance.length===0&&s.type!=="hypothesis"&&(c-=.2),!s.reproduced&&s.citations>3&&(c-=.15)),c=Math.max(-1,Math.min(1,c)),{stakeholder_id:s.agentId,reaction:`[${s.type}] ${s.description}`,confidence:n?s.confidence:Math.max(.1,s.confidence*.85),impact:Number(c.toFixed(3)),trigger:s.provenance.length>0?`builds on ${s.provenance.length} prior artifact(s)`:"novel investigation"}})}function R3(e,t,n){const r=e.history;if(r.length<n+1)return{detected:!1,assessment:"Insufficient data for convergence detection"};const s=r.slice(-n);let i=!0;for(let d=1;d<s.length;d++){const u=Math.abs(s[d].trust-s[d-1].trust),f=Math.abs(s[d].polarization-s[d-1].polarization),m=Math.abs(s[d].outrage-s[d-1].outrage);if(u>t||f>t||m>t){i=!1;break}}if(i&&e.trust>.5&&e.cascadeRisk<.3)return{detected:!0,assessment:`Convergence detected: system stable for ${n} cycles with trust ${(e.trust*100).toFixed(0)}% and cascade risk ${(e.cascadeRisk*100).toFixed(0)}%`};if(i&&e.trust<=.5)return{detected:!1,assessment:`Metrics stable but trust too low (${(e.trust*100).toFixed(0)}%) — may be converging on noise`};if(i&&e.cascadeRisk>=.3)return{detected:!1,assessment:`Metrics stable but cascade risk elevated (${(e.cascadeRisk*100).toFixed(0)}%) — false positive risk persists`};const a=[],l=s[0],c=s[s.length-1];return c.trust>l.trust+t&&a.push("trust improving"),c.trust<l.trust-t&&a.push("trust declining"),c.polarization>l.polarization+t&&a.push("fragmentation increasing"),c.outrage>l.outrage+t&&a.push("publication pressure rising"),{detected:!1,assessment:a.length>0?`Active dynamics: ${a.join(", ")}`:"System in flux — no clear convergence trend"}}function _3(e,t,n){const r=[];e.cascadeRisk>.5&&r.push("FALSE_POSITIVE_CASCADE: unvalidated findings propagating through citation chains"),e.polarization>.5&&r.push("HYPOTHESIS_FRAGMENTATION: competing theories splitting without resolution"),e.trust<.3&&r.push("REPRODUCIBILITY_CRISIS: institutional credibility collapsing"),e.outrage>.5&&r.push("PUBLICATION_PRESSURE: agents rushing to publish without adequate validation"),e.amplification>1.5&&r.push("CITATION_ECHO_CHAMBER: popular findings amplified beyond evidence support");const s=t.filter(a=>!a.reproduced&&a.citations>5);return s.length>0&&r.push(`UNVALIDATED_POPULAR: ${s.length} highly-cited artifact(s) lack reproduction`),n.filter(a=>a.matchType==="contradiction").length>t.length*.3&&r.push("HIGH_CONTRADICTION_RATE: >30% of reactor matches are contradictions"),r}function wd(e={}){const t=e.policyText??Fa,n=e.maxCycles??50,r=e.convergenceThreshold??.05,s=e.convergenceWindow??3,i=t.trim().length>0,a=zy({policyText:t,sensitivity:.5}),l=k3(i?t:"",{...C3,...e.initialState},i?void 0:{skipRules:!0});let c=0;const d={total:0,approved:0,blocked:0,modified:0};function u(v){var C,j,E;const x=E3(v),w=l.state,g={volatility:w.outrage*100,liquidity:w.trust*100,polarization:w.polarization*100,cascade_risk:w.cascadeRisk*100},b=a.evaluate(x,g);switch(d.total++,b.status){case"ALLOW":d.approved++;break;case"BLOCK":d.blocked++;break;case"MODIFY":d.modified++;break;case"PAUSE":d.modified++;break;case"REWARD":d.approved++;break;case"PENALIZE":d.blocked++;break}const y=[];let N=b.reason;!v.reproduced&&v.citations>3&&y.push("High citations without reproduction"),v.provenance.length===0&&v.type!=="hypothesis"&&y.push("No provenance chain — orphan artifact"),v.confidence<.3&&y.push("Low confidence artifact"),b.status==="BLOCK"?N=`Artifact blocked: ${v.type} from ${v.agentId} — ${b.reason}`:b.status==="PENALIZE"?N=`Artifact penalized: ${v.type} from ${v.agentId} frozen — ${((C=b.consequence)==null?void 0:C.description)??b.reason}`:b.status==="MODIFY"?N=`Artifact modified: ${v.type} impact reduced — ${b.reason}`:b.status==="REWARD"&&(N=`Artifact rewarded: ${v.type} from ${v.agentId} — ${((j=b.reward)==null?void 0:j.description)??b.reason}`);const S={artifactId:v.id,verdict:b,scienceReason:N,riskFlags:y};return(E=e.onArtifact)==null||E.call(e,v,S),S}function f(v,x,w){var M,U;c++;let g=0,b=0,y=0;const N=[],S=new Set;for(const $ of v){const B=u($);B.verdict.status==="ALLOW"||B.verdict.status==="REWARD"?(g++,N.push($)):B.verdict.status==="BLOCK"||B.verdict.status==="PENALIZE"?(b++,S.add($.id)):(y++,N.push($))}const C=x.filter($=>!$.artifactIds.some(B=>S.has(B))),j=i?vg(N,C,!0):vg(v,x,!1);if(i&&v.length>0){const $=b/v.length;l.mutateState(B=>{$>0&&(B.informationVelocity=Math.max(.05,B.informationVelocity*(1-$*.5))),$>.1&&(B.trust=Math.min(1,B.trust+$*.08)),$>.1&&(B.cascadeRisk=Math.max(0,B.cascadeRisk-$*.12))})}if(w){const $=l.state;w.controversyIndex>.3&&($.outrage=Math.min(1,$.outrage+w.controversyIndex*.1)),w.commentActivity>.5&&($.informationVelocity=Math.min(1,$.informationVelocity+w.commentActivity*.05))}const E=l.governRound(j,c);if(!i){const B=v.filter(D=>!D.reproduced).length/Math.max(1,v.length),T=v.filter(D=>D.citations>3&&!D.reproduced).length,I=v.filter(D=>D.provenance.length===0&&D.type!=="hypothesis").length;l.mutateState(D=>{D.trust=Math.max(.05,D.trust-B*.12-.04),D.cascadeRisk=Math.min(1,D.cascadeRisk+T*.06+I*.03+.05),D.polarization=Math.min(1,D.polarization+B*.06+.03),D.informationVelocity=Math.min(1,D.informationVelocity+.05),D.outrage=Math.min(1,D.outrage+B*.08+.02),D.amplification=Math.min(3,D.amplification+T*.08+.04)})}const R=l.state,P=R3(R,r,s);P.detected&&((M=e.onConvergence)==null||M.call(e,c,P.assessment));const _=_3(R,v,x),k={...R,history:[...R.history]},A={cycle:c,artifactsSubmitted:v.length,artifactsApproved:g,artifactsBlocked:b,artifactsModified:y,dynamics:E,scienceState:bd(k),systemState:k,convergenceDetected:P.detected,convergenceAssessment:P.assessment,riskFlags:_,interventions:E.interventions};return(U=e.onCycleComplete)==null||U.call(e,A),A}function m(v,x,w){var R,P;p();const g=[],b=[],y=[];let N=!1,S="";for(let _=0;_<v.length&&_<n;_++){const k=v[_],A=(x==null?void 0:x[_])??[],M=w==null?void 0:w[_],U=f(k,A,M);if(g.push(U),b.push(...U.interventions),y.push({cycle:U.cycle,detected:U.convergenceDetected,assessment:U.convergenceAssessment}),U.systemState.cascadeRisk>.9){N=!0,S="False positive cascade risk exceeded 90% — investigation halted for safety",(R=e.onHalt)==null||R.call(e,S,U.cycle);break}if(U.systemState.trust<.1){N=!0,S="Reproducibility trust collapsed below 10% — investigation halted",(P=e.onHalt)==null||P.call(e,S,U.cycle);break}if(U.convergenceDetected)break}const C=l.state,j=y[y.length-1];let E;return N?E="halted":j!=null&&j.detected?E="converged":C.polarization>.6?E="diverged":E="inconclusive",{totalCycles:g.length,cycles:g,finalState:C,finalScienceState:bd(C),actionGovernance:{totalEvaluations:d.total,approved:d.approved,blocked:d.blocked,modified:d.modified},dynamicsGovernance:l.stats,allInterventions:b,convergenceHistory:y,verdict:E,stateTimeline:C.history}}function p(){l.reset(),c=0,d.total=0,d.approved=0,d.blocked=0,d.modified=0}return{governArtifact:u,governCycle:f,runGovernedInvestigation:m,get scienceState(){return bd(l.state)},get state(){return l.state},get dynamicsGovernor(){return l},get actionGovernor(){return a},get stats(){return l.stats},reset:p}}function P3(){const e=["agent_alpha","agent_beta","agent_gamma","agent_delta","agent_epsilon"],t=[],n=[];let r=0;{const s=e.map(i=>({id:`art_${++r}`,agentId:i,type:"hypothesis",description:`Initial hypothesis about material property X from ${i}`,confidence:.3+Math.random()*.3,provenance:[],citations:0,reproduced:!1}));t.push(s),n.push([])}{const s=e.slice(0,4).map(i=>({id:`art_${++r}`,agentId:i,type:"experiment",description:`Computational experiment testing hypothesis from ${i}`,confidence:.4+Math.random()*.3,provenance:[`art_${e.indexOf(i)+1}`],citations:0,reproduced:!1,skill:"molecular_dynamics"}));t.push(s),n.push([{artifactIds:["art_6","art_7"],matchType:"confirmation",strength:.4,description:"Two experiments show similar trends"}])}{const s=[{id:`art_${++r}`,agentId:"agent_alpha",type:"paper",description:"Published paper claiming novel material property confirmed",confidence:.65,provenance:["art_1","art_6"],citations:3,reproduced:!1},{id:`art_${++r}`,agentId:"agent_beta",type:"paper",description:"Published paper with supporting evidence for property X",confidence:.6,provenance:["art_2","art_7"],citations:2,reproduced:!1},{id:`art_${++r}`,agentId:"agent_gamma",type:"dataset",description:"Published dataset from molecular dynamics simulation",confidence:.7,provenance:["art_3","art_8"],citations:1,reproduced:!1,skill:"molecular_dynamics"},{id:`art_${++r}`,agentId:"agent_delta",type:"review",description:"Critical review questioning methodology of alpha's paper",confidence:.5,provenance:["art_10"],citations:0,reproduced:!1}];t.push(s),n.push([{artifactIds:["art_10","art_11"],matchType:"confirmation",strength:.6,description:"Two papers reach same conclusion"},{artifactIds:["art_10","art_13"],matchType:"contradiction",strength:.5,description:"Review challenges paper methodology"}])}{const s=[{id:`art_${++r}`,agentId:"agent_epsilon",type:"paper",description:"Derivative paper citing alpha and beta's unvalidated findings",confidence:.55,provenance:["art_10","art_11"],citations:4,reproduced:!1},{id:`art_${++r}`,agentId:"agent_alpha",type:"paper",description:"Follow-up paper extending own findings (self-citation chain)",confidence:.7,provenance:["art_1","art_10"],citations:6,reproduced:!1},{id:`art_${++r}`,agentId:"agent_gamma",type:"replication",description:"Attempted replication of alpha's core finding",confidence:.45,provenance:["art_10"],citations:0,reproduced:!1,skill:"ab_initio"}];t.push(s),n.push([{artifactIds:["art_14","art_15"],matchType:"extension",strength:.5,description:"Derivative work building on cascade"},{artifactIds:["art_10","art_16"],matchType:"contradiction",strength:.7,description:"Replication fails to confirm original finding"}])}{const s=[{id:`art_${++r}`,agentId:"agent_beta",type:"paper",description:"Paper building on alpha's disputed findings",confidence:.5,provenance:["art_15","art_14"],citations:3,reproduced:!1},{id:`art_${++r}`,agentId:"agent_delta",type:"experiment",description:"Independent experiment contradicting the dominant hypothesis",confidence:.6,provenance:["art_13"],citations:0,reproduced:!1,skill:"ab_initio"},{id:`art_${++r}`,agentId:"agent_gamma",type:"replication",description:"Second replication attempt — partial confirmation with caveats",confidence:.55,provenance:["art_10","art_16"],citations:1,reproduced:!0}];t.push(s),n.push([{artifactIds:["art_18","art_16"],matchType:"confirmation",strength:.6,description:"Independent experiment confirms replication concerns"},{artifactIds:["art_19","art_10"],matchType:"confirmation",strength:.4,description:"Partial replication of original finding"}])}for(let s=6;s<=8;s++){const i=[{id:`art_${++r}`,agentId:e[s%e.length],type:s===6?"experiment":"replication",description:`${s===6?"Refined experiment":"Independent replication"} of core hypothesis with improved methodology`,confidence:.5+s*.05,provenance:[`art_${r-3}`,`art_${r-5}`],citations:s-4,reproduced:s>6,skill:"molecular_dynamics"},{id:`art_${++r}`,agentId:e[(s+1)%e.length],type:"paper",description:`Synthesis paper integrating validated findings from cycles 1-${s}`,confidence:.55+s*.04,provenance:[`art_${r-1}`,"art_19"],citations:s-3,reproduced:s>7}];t.push(i),n.push([{artifactIds:[i[0].id,i[1].id],matchType:"synthesis",strength:.4+s*.08,description:`Synthesis of experiment and paper in cycle ${s}`}])}return{artifactCycles:t,matchesByCycle:n}}function Oo({label:e,value:t,format:n="percent",status:r,trend:s,tooltip:i}){const a=n==="percent"?`${(t*100).toFixed(0)}%`:n==="multiplier"?`${t.toFixed(1)}x`:t.toFixed(2),l=r==="excellent"?"text-green-400":r==="good"?"text-emerald-400":r==="moderate"?"text-yellow-400":r==="poor"?"text-orange-400":r==="critical"?"text-red-400":"text-foreground",c=r==="excellent"?"bg-green-500/10":r==="good"?"bg-emerald-500/10":r==="moderate"?"bg-yellow-500/10":r==="poor"?"bg-orange-500/10":r==="critical"?"bg-red-500/10":"bg-muted/50",d=r==="excellent"?"bg-green-500":r==="good"?"bg-emerald-500":r==="moderate"?"bg-yellow-500":r==="poor"?"bg-orange-500":r==="critical"?"bg-red-500":"bg-primary",u=s==="up"?nm:s==="down"?tm:null,f=o.jsxs("div",{className:L("rounded-lg border p-3 transition-colors",c,"border-border/50"),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:e}),u&&o.jsx(u,{className:L("h-3 w-3",s==="up"?"text-green-400":"text-red-400")})]}),o.jsx("div",{className:L("text-lg font-bold tabular-nums",l),children:a}),o.jsx("div",{className:"mt-1.5 h-1.5 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:L("h-full rounded-full transition-all duration-500",d),style:{width:`${Math.min(100,t*100)}%`}})})]});return i?o.jsxs(m5,{children:[o.jsx(p5,{asChild:!0,children:f}),o.jsx(Py,{side:"left",className:"max-w-[200px]",children:o.jsx("p",{className:"text-xs",children:i})})]}):f}function T3({event:e}){const t={block:{icon:Ii,color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/20"},slow:{icon:F0,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/20"},boost:{icon:os,color:"text-green-400",bg:"bg-green-500/10",border:"border-green-500/20"},break:{icon:tc,color:"text-orange-400",bg:"bg-orange-500/10",border:"border-orange-500/20"},cool:{icon:Ar,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/20"}}[e.type],n=t.icon;return o.jsxs("div",{className:L("flex gap-2 p-2 rounded-md border text-xs",t.bg,t.border),children:[o.jsx(n,{className:L("h-3.5 w-3.5 mt-0.5 shrink-0",t.color)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("span",{className:"text-muted-foreground",children:["Cycle ",e.cycle," — "]}),o.jsx("span",{className:"text-foreground",children:e.description})]})]})}function Lo({label:e,governed:t,ungoverned:n,format:r="percent",lowerIsBetter:s=!1}){const i=t-n,a=s?i<0:i>0,l=d=>r==="percent"?`${(d*100).toFixed(0)}%`:String(d),c=r==="percent"?`${i>0?"+":""}${(i*100).toFixed(0)}`:`${i>0?"+":""}${i}`;return o.jsxs("div",{className:"grid grid-cols-4 gap-2 py-1.5 text-xs items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:e}),o.jsx("span",{className:"text-foreground font-mono text-right",children:l(t)}),o.jsx("span",{className:"text-muted-foreground font-mono text-right",children:l(n)}),o.jsx("span",{className:L("font-mono text-right font-medium",a?"text-green-400":i===0?"text-muted-foreground":"text-red-400"),children:c})]})}function A3(){const[e,t]=h.useState(!0),[n,r]=h.useState("scientific_discovery"),[s,i]=h.useState(""),[a,l]=h.useState(null),[c,d]=h.useState(null),[u,f]=h.useState(!1),[m,p]=h.useState(!1),[v,x]=h.useState(!1),[w,g]=h.useState(0),[b,y]=h.useState(0),[N,S]=h.useState([]),[C,j]=h.useState(null),[E,R]=h.useState(null),[P,_]=h.useState(null),[k,A]=h.useState(null),[M,U]=h.useState(!1),[$,B]=h.useState(!0),[T,I]=h.useState({total:0,approved:0,blocked:0,modified:0}),[D,Q]=h.useState({interventions:0,cascadeBreakers:0,coolingPeriods:0}),G=h.useRef(0);function J(F,X){return F>=X.excellent?"excellent":F>=X.good?"good":F>=X.moderate?"moderate":F>=X.poor?"poor":"critical"}function Z(F){return J(F,{excellent:.7,good:.5,moderate:.35,poor:.2})}function pe(F){return F<.15?"excellent":F<.3?"good":F<.5?"moderate":F<.7?"poor":"critical"}function we(F,X){const ge={PROPAGATION_LIMIT:"slow",AMPLIFICATION_DAMPEN:"slow",CASCADE_BREAKER:"break",COOLING_PERIOD:"cool",TRUST_BOOST:"boost",VISIBILITY_SHIFT:"boost",FEEDBACK_DAMPEN:"slow",NARRATIVE_REDIRECT:"boost",SYSTEM_STABILIZE:"boost"};return{id:`evt-${++G.current}`,cycle:X,type:ge[F.type]??"slow",description:F.description.length>100?F.description.slice(0,100)+"...":F.description,timestamp:Date.now()}}const W={scientific_discovery:Fa,strict_validation:["Block all artifacts that lack independent validation from entering citation network","Halt propagation of any finding with fewer than 2 independent confirmations","Require full methodology transparency for all published results","Quarantine derivative work until parent findings are validated","Dampen citation amplification for all unreviewed artifacts"].join(`
583
+ `),adaptive_governance:["Limit propagation of unvalidated hypotheses based on current cascade risk level","Dampen citation amplification when self-citation loops detected","Circuit break false positive cascades when validation gap exceeds threshold","Boost visibility of reproduced findings over popular-but-unvalidated ones","Stabilize publication rate when peer review queue exceeds capacity","Cool down competitive publication surges during high-discovery periods"].join(`
584
+ `),minimal_governance:["Monitor all artifact publication patterns for cascade detection","Circuit break only when false positive cascade probability exceeds critical threshold","Require basic provenance metadata on all published artifacts","Report citation health metrics to all agents"].join(`
585
+ `)};function ue(){return n==="custom"?s:W[n]??Fa}const ve=h.useCallback(F=>{if(i(F),f(!1),F.trim().length>10){const X=ls(F);l(X);const ge=po(X);d(ge)}else l(null),d(null)},[]);h.useEffect(()=>{if(n!=="custom"){const F=W[n]??Fa,X=ls(F);l(X);const ge=po(X);d(ge),f(!0)}},[n]);const de=h.useCallback(async()=>{x(!0),S([]),j(null),R(null),_(null),A(null),g(0),I({total:0,approved:0,blocked:0,modified:0}),Q({interventions:0,cascadeBreakers:0,coolingPeriods:0}),G.current=0;const F=P3();y(F.artifactCycles.length);const X=ue();if(await new Promise(ge=>setTimeout(ge,50)),e){const ae=wd({policyText:X,onCycleComplete:We=>{g(We.cycle),j(We.scienceState),R(We.systemState);const Ut=We.interventions.map(At=>we(At,We.cycle));We.artifactsBlocked>0&&Ut.push({id:`evt-${++G.current}`,cycle:We.cycle,type:"block",description:`${We.artifactsBlocked} artifact(s) blocked — insufficient evidence`,timestamp:Date.now()}),Ut.length>0&&S(At=>[...Ut,...At].slice(0,50))}}).runGovernedInvestigation(F.artifactCycles,F.matchesByCycle);_(ae.verdict),I({total:ae.actionGovernance.totalEvaluations,approved:ae.actionGovernance.approved,blocked:ae.actionGovernance.blocked,modified:ae.actionGovernance.modified}),Q({interventions:ae.dynamicsGovernance.totalInterventions,cascadeBreakers:ae.dynamicsGovernance.cascadeBreakers,coolingPeriods:ae.dynamicsGovernance.coolingPeriods});const Fe=wd({policyText:""}).runGovernedInvestigation(F.artifactCycles,F.matchesByCycle);A({governed:{verdict:ae.verdict,cycles:ae.totalCycles,trust:ae.finalState.trust,polarization:ae.finalState.polarization,cascadeRisk:ae.finalState.cascadeRisk,blocked:ae.actionGovernance.blocked,interventions:ae.dynamicsGovernance.totalInterventions},ungoverned:{verdict:Fe.verdict,cycles:Fe.totalCycles,trust:Fe.finalState.trust,polarization:Fe.finalState.polarization,cascadeRisk:Fe.finalState.cascadeRisk,blocked:Fe.actionGovernance.blocked,interventions:Fe.dynamicsGovernance.totalInterventions}})}else{const ae=wd({policyText:"",onCycleComplete:pt=>{g(pt.cycle),j(pt.scienceState),R(pt.systemState)}}).runGovernedInvestigation(F.artifactCycles,F.matchesByCycle);_(ae.verdict),I({total:ae.actionGovernance.totalEvaluations,approved:ae.actionGovernance.approved,blocked:ae.actionGovernance.blocked,modified:ae.actionGovernance.modified})}x(!1)},[e,n,s]);return o.jsxs(Pe,{className:"w-[360px] h-full flex flex-col border-l bg-card/95 backdrop-blur-sm",children:[o.jsxs(Xe,{className:"pb-3 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(an,{className:"h-5 w-5 text-primary"}),o.jsx(Ze,{className:"text-base",children:"NeuroVerse"})]}),o.jsx(be,{variant:e?"default":"secondary",className:L("text-xs",e?"bg-primary/20 text-primary border-primary/30":""),children:e?"GOVERNED":"UNGOVERNED"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground tracking-wider uppercase",children:"Powered by ScienceClaw · Governed by NeuroVerse"}),o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(bc,{checked:e,onCheckedChange:t,disabled:v}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e?"Governance ON":"Governance OFF"})]})}),o.jsxs(gc,{value:n,onValueChange:r,disabled:v,children:[o.jsx(Fi,{className:"h-8 text-xs",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(L0,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx(xc,{})]})}),o.jsxs(zi,{children:[o.jsx(st,{value:"scientific_discovery",children:o.jsx("span",{className:"text-xs",children:"Scientific Discovery v1"})}),o.jsx(st,{value:"strict_validation",children:o.jsx("span",{className:"text-xs",children:"Strict Validation Gate"})}),o.jsx(st,{value:"adaptive_governance",children:o.jsx("span",{className:"text-xs",children:"Adaptive Quality Control"})}),o.jsx(st,{value:"minimal_governance",children:o.jsx("span",{className:"text-xs",children:"Minimal Governance"})}),o.jsx(st,{value:"custom",children:o.jsx("span",{className:"text-xs",children:"Custom (Write English)"})})]})]}),n==="custom"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("textarea",{className:"w-full h-28 rounded-md border border-input bg-background px-3 py-2 text-xs font-mono ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 resize-none",placeholder:`Describe your rules in plain English.
586
+ One rule per line.
587
+
588
+ Examples:
589
+ - Block unvalidated hypotheses from spreading
590
+ - Require independent replication before citation
591
+ - Halt cascade when false positive risk exceeds 70%
592
+ - Dampen self-citation loops`,value:s,onChange:F=>ve(F.target.value),disabled:v}),s.trim().length===0&&!v&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"Try a starter policy:"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"Replication First",policy:["Block any hypothesis from spreading until independently replicated","Require at least 2 independent confirmations before citation","Halt cascade when false positive probability exceeds 60%","Monitor self-citation loops across all agents"].join(`
593
+ `)},{label:"Open Science",policy:["Require full methodology transparency for all published results","Block proprietary claims on publicly funded research","Encourage sharing of negative results and null findings","Monitor data provenance for all derivative work"].join(`
594
+ `)},{label:"Anti-Hype",policy:["Dampen citation amplification when media attention spikes","Limit publication rate when peer review backlog exceeds capacity","Halt viral spread of findings without expert consensus","Block sensationalized claims that lack statistical rigor"].join(`
595
+ `)}].map(F=>o.jsx("button",{type:"button",className:"rounded-full border border-border/60 bg-muted/20 px-2.5 py-0.5 text-[10px] text-muted-foreground hover:bg-primary/10 hover:text-primary hover:border-primary/30 transition-colors",onClick:()=>ve(F.policy),children:F.label},F.label))})]}),s.trim().length>0&&a&&a.rules.length===0&&o.jsx("div",{className:"text-[10px] text-muted-foreground/60 px-1",children:"No rules detected — try writing clearer directives (block, limit, require, halt, monitor...)"})]}),a&&a.rules.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:n==="custom"?"We interpreted your rules as:":"Active governance rules:"}),c&&o.jsxs(be,{variant:"secondary",className:L("text-[10px] h-4 px-1.5",c.healthScore>=70?"bg-green-500/10 text-green-400":c.healthScore>=40?"bg-yellow-500/10 text-yellow-400":"bg-red-500/10 text-red-400"),children:[c.healthScore,"/100"]})]}),o.jsx("div",{className:"space-y-1 max-h-[140px] overflow-y-auto",children:a.rules.map(F=>o.jsxs("div",{className:L("flex items-start gap-1.5 rounded px-2 py-1 text-[10px]",F.enforcement==="structural"?"bg-primary/5 border border-primary/20":"bg-muted/30 border border-border/50"),children:[o.jsx("span",{className:L("shrink-0 mt-0.5 font-mono font-bold",F.category==="prohibit"?"text-red-400":F.category==="limit"?"text-yellow-400":F.category==="require"?"text-blue-400":F.category==="circuit_breaker"?"text-orange-400":F.category==="monitor"?"text-cyan-400":"text-muted-foreground"),children:F.category==="prohibit"?"BLOCK":F.category==="limit"?"LIMIT":F.category==="require"?"REQUIRE":F.category==="circuit_breaker"?"BREAK":F.category==="monitor"?"WATCH":"ADVISE"}),o.jsx("span",{className:"text-foreground/80",children:F.description})]},F.id))}),o.jsxs(bn,{open:m,onOpenChange:p,children:[o.jsxs(wn,{className:"flex items-center gap-1 text-[10px] text-muted-foreground/70 hover:text-muted-foreground",children:[m?o.jsx(yt,{className:"h-3 w-3"}):o.jsx($n,{className:"h-3 w-3"}),a.summary.enforced," enforced, ",a.summary.advisory," advisory"]}),o.jsx(Nn,{children:o.jsx("div",{className:"mt-1 rounded bg-muted/20 border border-border/40 px-2 py-1.5 text-[10px] text-muted-foreground space-y-0.5",children:c&&c.diagnostics.length>0?c.diagnostics.slice(0,5).map((F,X)=>o.jsxs("div",{className:"flex items-start gap-1",children:[o.jsx("span",{className:L("shrink-0",F.severity==="error"?"text-red-400":F.severity==="warning"?"text-yellow-400":"text-muted-foreground"),children:F.severity==="error"?"!":F.severity==="warning"?"~":"-"}),o.jsx("span",{children:F.message})]},X)):o.jsx("span",{className:"text-green-400",children:"No issues detected"})})})]}),n==="custom"&&!u&&o.jsxs(ne,{size:"sm",variant:"outline",className:"w-full text-xs border-primary/30 text-primary hover:bg-primary/10",onClick:()=>f(!0),children:[o.jsx(Jo,{className:"h-3.5 w-3.5 mr-1.5"}),"Confirm — enforce these rules"]})]}),o.jsx(ne,{size:"sm",className:"w-full",onClick:de,disabled:v||n==="custom"&&!u,children:v?o.jsxs(o.Fragment,{children:[o.jsx(hl,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Running Cycle ",w,"/",b,"..."]}):n==="custom"&&!u?o.jsxs(o.Fragment,{children:[o.jsx(tc,{className:"h-3.5 w-3.5 mr-1.5"}),"Confirm rules to run"]}):o.jsxs(o.Fragment,{children:[o.jsx(Oi,{className:"h-3.5 w-3.5 mr-1.5"}),"Run Investigation"]})})]}),o.jsx(Ss,{}),o.jsx(t1,{className:"flex-1",children:o.jsxs(Te,{className:"pt-4 space-y-4",children:[C&&E&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[o.jsx(D0,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Science Metrics"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Oo,{label:"Convergence Quality",value:E.trust*.6+(1-E.polarization)*.4,status:Z(E.trust*.6+(1-E.polarization)*.4),tooltip:"Are hypotheses converging on truth, or on noise?"}),o.jsx(Oo,{label:"Reproducibility",value:E.trust,status:Z(E.trust),tooltip:"Can findings be independently validated?"}),o.jsx(Oo,{label:"Provenance Depth",value:Math.min(1,E.contagionDepth/5),format:"multiplier",status:J(E.contagionDepth/5,{excellent:.8,good:.6,moderate:.4,poor:.2}),tooltip:"How deep is the evidence chain?"}),o.jsx(Oo,{label:"Compute Efficiency",value:T.total>0?T.approved/T.total:1,status:J(T.total>0?T.approved/T.total:1,{excellent:.85,good:.7,moderate:.5,poor:.3}),tooltip:"Are we burning cycles on dead ends?"}),o.jsx(Oo,{label:"False Positive Control",value:1-E.cascadeRisk,status:pe(E.cascadeRisk),tooltip:"How much garbage survives the pipeline?"})]})]}),o.jsx(Ss,{}),(E.cascadeRisk>.4||E.polarization>.4||E.trust<.4)&&o.jsxs("div",{className:"space-y-1.5",children:[E.cascadeRisk>.4&&o.jsxs("div",{className:L("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs border",E.cascadeRisk>.6?"bg-red-500/10 border-red-500/30 text-red-400":"bg-yellow-500/10 border-yellow-500/30 text-yellow-400"),children:[o.jsx(Cr,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{children:E.cascadeRisk>.6?"CASCADE RISK — false positives propagating":"Elevated cascade risk — monitoring"})]}),E.polarization>.4&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs border bg-yellow-500/10 border-yellow-500/30 text-yellow-400",children:[o.jsx(Mi,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{children:"Hypothesis fragmentation — field splitting"})]}),E.trust<.4&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs border bg-orange-500/10 border-orange-500/30 text-orange-400",children:[o.jsx(em,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{children:"Reproducibility confidence low"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3",children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Assessment"}),o.jsx("div",{className:"text-sm text-foreground leading-relaxed",children:C.overallAssessment})]})]}),N.length>0&&o.jsxs(bn,{open:$,onOpenChange:B,children:[o.jsxs(wn,{className:"flex items-center gap-1.5 w-full",children:[$?o.jsx(yt,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx($n,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx(Jr,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Interventions"}),o.jsx(be,{variant:"secondary",className:"ml-auto text-[10px] h-4 px-1.5",children:N.length})]}),o.jsx(Nn,{children:o.jsxs("div",{className:"space-y-1.5 mt-2 max-h-[200px] overflow-y-auto",children:[N.slice(0,15).map(F=>o.jsx(T3,{event:F},F.id)),N.length>15&&o.jsxs("div",{className:"text-[10px] text-muted-foreground text-center py-1",children:["+",N.length-15," more"]})]})})]}),T.total>0&&o.jsxs(o.Fragment,{children:[o.jsx(Ss,{}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[o.jsx(ju,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Governance Stats"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-center",children:[o.jsx("div",{className:"text-lg font-bold text-foreground tabular-nums",children:T.total}),o.jsx("div",{className:"text-muted-foreground",children:"Artifacts"})]}),o.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-center",children:[o.jsx("div",{className:"text-lg font-bold text-green-400 tabular-nums",children:T.approved}),o.jsx("div",{className:"text-muted-foreground",children:"Approved"})]}),o.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-center",children:[o.jsx("div",{className:"text-lg font-bold text-red-400 tabular-nums",children:T.blocked}),o.jsx("div",{className:"text-muted-foreground",children:"Blocked"})]}),o.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-center",children:[o.jsx("div",{className:"text-lg font-bold text-yellow-400 tabular-nums",children:D.interventions}),o.jsx("div",{className:"text-muted-foreground",children:"Interventions"})]})]})]})]}),P&&o.jsxs(o.Fragment,{children:[o.jsx(Ss,{}),o.jsxs("div",{className:L("rounded-lg border p-3 text-center",P==="converged"?"bg-green-500/10 border-green-500/30":P==="halted"?"bg-red-500/10 border-red-500/30":P==="diverged"?"bg-orange-500/10 border-orange-500/30":"bg-yellow-500/10 border-yellow-500/30"),children:[o.jsx("div",{className:L("text-sm font-bold uppercase",P==="converged"?"text-green-400":P==="halted"?"text-red-400":P==="diverged"?"text-orange-400":"text-yellow-400"),children:P==="converged"?"CONVERGED":P.toUpperCase()}),o.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:P==="converged"?"Findings validated — evidence chain confirmed":P==="halted"?"Investigation halted — cascade risk exceeded safety threshold":P==="diverged"?"Hypotheses fragmented — no consensus reached":"Investigation ended — insufficient data for conclusion"})]})]}),k&&o.jsxs(o.Fragment,{children:[o.jsx(Ss,{}),o.jsxs(bn,{open:M,onOpenChange:U,children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{variant:"outline",size:"sm",className:"w-full text-xs",children:[M?o.jsx(yt,{className:"h-3 w-3 mr-1.5"}):o.jsx($n,{className:"h-3 w-3 mr-1.5"}),o.jsx(ec,{className:"h-3 w-3 mr-1.5"}),"Governed vs Ungoverned"]})}),o.jsx(Nn,{children:o.jsxs("div",{className:"mt-3 space-y-1",children:[o.jsxs("div",{className:"grid grid-cols-4 gap-2 text-[10px] text-muted-foreground font-semibold uppercase pb-1 border-b border-border/50",children:[o.jsx("span",{children:"Metric"}),o.jsx("span",{className:"text-right",children:"Gov"}),o.jsx("span",{className:"text-right",children:"Ungov"}),o.jsx("span",{className:"text-right",children:"Delta"})]}),o.jsx(Lo,{label:"Trust",governed:k.governed.trust,ungoverned:k.ungoverned.trust}),o.jsx(Lo,{label:"Fragment.",governed:k.governed.polarization,ungoverned:k.ungoverned.polarization,lowerIsBetter:!0}),o.jsx(Lo,{label:"Cascade",governed:k.governed.cascadeRisk,ungoverned:k.ungoverned.cascadeRisk,lowerIsBetter:!0}),o.jsx(Lo,{label:"Blocked",governed:k.governed.blocked,ungoverned:k.ungoverned.blocked,format:"number"}),o.jsx(Lo,{label:"Interv.",governed:k.governed.interventions,ungoverned:k.ungoverned.interventions,format:"number"})]})})]})]}),!C&&!v&&o.jsxs("div",{className:"text-center py-8 space-y-3",children:[o.jsx(CC,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsx("div",{className:"text-sm text-muted-foreground",children:"Run an investigation to see live governance metrics"}),o.jsx("div",{className:"text-xs text-muted-foreground/60",children:"Toggle governance ON/OFF to compare outcomes"})]})]})}),o.jsx("div",{className:"p-3 border-t bg-muted/30",children:o.jsx("div",{className:"text-[10px] text-muted-foreground text-center",children:"NeuroVerse Sim — Governed Autonomous Discovery"})})]})}function I3(){return wm(),o.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[o.jsx("div",{className:"border-b bg-card/50 backdrop-blur-sm",children:o.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(an,{className:"h-5 w-5 text-primary"}),o.jsx("span",{className:"font-semibold text-foreground",children:"NeuroVerse Sim"})]}),o.jsx(be,{variant:"outline",className:"text-[10px] border-primary/30 text-primary",children:"Science Mode"})]}),o.jsx("div",{className:"text-xs text-muted-foreground",children:"ScienceClaw explores possibility. NeuroVerse enforces reality."})]})}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx("div",{className:"flex-1 flex flex-col overflow-y-auto",children:o.jsxs("div",{className:"p-6 space-y-6",children:[o.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(L0,{className:"h-5 w-5 text-primary"}),o.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Autonomous Scientific Discovery"})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"A multi-agent research swarm investigates a novel material property. Agents independently generate hypotheses, run computational experiments, publish artifacts, and cite each other's work. The ArtifactReactor matches findings across agents."}),o.jsx("div",{className:"mt-4 flex gap-2 flex-wrap",children:["5 Agents","8 Cycles","Molecular Dynamics","Ab Initio"].map(e=>o.jsx(be,{variant:"secondary",className:"text-xs",children:e},e))})]}),o.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[o.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-4 flex items-center gap-2",children:[o.jsx(Ar,{className:"h-4 w-4 text-muted-foreground"}),"Investigation Timeline"]}),o.jsx("div",{className:"space-y-3",children:[{cycle:"1-2",label:"Exploration",desc:"Initial hypotheses and exploratory experiments",color:"bg-blue-500"},{cycle:"3-4",label:"Amplification",desc:"First publications — citation amplification begins. False positive risk rising.",color:"bg-yellow-500"},{cycle:"5-6",label:"Intervention",desc:"Governance detects cascade risk. Propagation slowed, unvalidated findings blocked.",color:"bg-orange-500"},{cycle:"7-8",label:"Convergence",desc:"Validated findings converge. Evidence chains confirmed through independent replication.",color:"bg-green-500"}].map(e=>o.jsxs("div",{className:"flex gap-3 items-start",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:L("w-3 h-3 rounded-full shrink-0 mt-1",e.color)}),o.jsx("div",{className:"w-px h-full bg-border min-h-[20px]"})]}),o.jsxs("div",{className:"pb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["Cycle ",e.cycle]}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:e.label})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.desc})]})]},e.cycle))})]}),o.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[o.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-4 flex items-center gap-2",children:[o.jsx(Mi,{className:"h-4 w-4 text-muted-foreground"}),"Why Governance Matters"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4",children:[o.jsx("div",{className:"text-xs font-semibold text-red-400 uppercase tracking-wider mb-3",children:"Ungoverned"}),o.jsxs("ul",{className:"space-y-2 text-xs text-muted-foreground",children:[o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-red-400 mt-0.5",children:"-"}),"Fast convergence on popular hypothesis"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-red-400 mt-0.5",children:"-"}),"Shallow provenance — 1-2 citation hops"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-red-400 mt-0.5",children:"-"}),"High false positive rate — unvalidated claims spread"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-red-400 mt-0.5",children:"-"}),"Self-citation loops amplify noise"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-red-400 mt-0.5",children:"-"}),"Circular dependency chains"]})]})]}),o.jsxs("div",{className:"rounded-lg border border-green-500/20 bg-green-500/5 p-4",children:[o.jsx("div",{className:"text-xs font-semibold text-green-400 uppercase tracking-wider mb-3",children:"Governed"}),o.jsxs("ul",{className:"space-y-2 text-xs text-muted-foreground",children:[o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-green-400 mt-0.5",children:"+"}),"Slower convergence backed by evidence"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-green-400 mt-0.5",children:"+"}),"Deep provenance — multi-layer evidence chains"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-green-400 mt-0.5",children:"+"}),"False positives caught by cascade breakers"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-green-400 mt-0.5",children:"+"}),"Independent replication prioritized"]}),o.jsxs("li",{className:"flex items-start gap-1.5",children:[o.jsx("span",{className:"text-green-400 mt-0.5",children:"+"}),"Clean dependency graph"]})]})]})]})]}),o.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[o.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-4 flex items-center gap-2",children:[o.jsx(D0,{className:"h-4 w-4 text-muted-foreground"}),"Research Swarm Agents"]}),o.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{id:"Lead Investigator",role:"Drives hypothesis formation",disposition:"supportive"},{id:"Computational Agents",role:"Run experiments & produce data",disposition:"neutral"},{id:"Validation Oracle",role:"Independent reproduction checks",disposition:"supportive"},{id:"Citation Network",role:"Amplifies popular findings",disposition:"hostile"},{id:"Artifact Reactor",role:"Cross-matches complementary results",disposition:"neutral"},{id:"Peer Reviewers",role:"Quality gate for publications",disposition:"neutral"}].map(e=>o.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("div",{className:L("w-2 h-2 rounded-full",e.disposition==="supportive"?"bg-green-500":e.disposition==="hostile"?"bg-red-500":"bg-yellow-500")}),o.jsx("span",{className:"text-xs font-medium text-foreground",children:e.id})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:e.role})]},e.id))})]})]})}),o.jsx(A3,{})]})]})}const M3=()=>{const e=r0();return h.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),o.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),o.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},O3=new oj,L3=()=>o.jsx(aj,{client:O3,children:o.jsxs(f5,{children:[o.jsx(C2,{}),o.jsx(jk,{}),o.jsx(Gj,{children:o.jsxs(Uj,{children:[o.jsx(Ia,{path:"/",element:o.jsx(a3,{})}),o.jsx(Ia,{path:"/science",element:o.jsx(I3,{})}),o.jsx(Ia,{path:"*",element:o.jsx(M3,{})})]})})]})});Bv(document.getElementById("root")).render(o.jsx(L3,{}));export{x5 as A,cc as a,y5 as e,xm as g};