specweave 3.0.12 → 3.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +0,0 @@
1
- (function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const x of d)if(x.type==="childList")for(const m of x.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&c(m)}).observe(document,{childList:!0,subtree:!0});function o(d){const x={};return d.integrity&&(x.integrity=d.integrity),d.referrerPolicy&&(x.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?x.credentials="include":d.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function c(d){if(d.ep)return;d.ep=!0;const x=o(d);fetch(d.href,x)}})();var to={exports:{}},Zn={};var L0;function Ng(){if(L0)return Zn;L0=1;var r=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function o(c,d,x){var m=null;if(x!==void 0&&(m=""+x),d.key!==void 0&&(m=""+d.key),"key"in d){x={};for(var j in d)j!=="key"&&(x[j]=d[j])}else x=d;return d=x.ref,{$$typeof:r,type:c,key:m,ref:d!==void 0?d:null,props:x}}return Zn.Fragment=u,Zn.jsx=o,Zn.jsxs=o,Zn}var U0;function Sg(){return U0||(U0=1,to.exports=Ng()),to.exports}var l=Sg(),ao={exports:{}},fe={};var H0;function wg(){if(H0)return fe;H0=1;var r=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),m=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),T=Symbol.iterator;function D(S){return S===null||typeof S!="object"?null:(S=T&&S[T]||S["@@iterator"],typeof S=="function"?S:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,b={};function w(S,$,K){this.props=S,this.context=$,this.refs=b,this.updater=K||_}w.prototype.isReactComponent={},w.prototype.setState=function(S,$){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,$,"setState")},w.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function C(){}C.prototype=w.prototype;function O(S,$,K){this.props=S,this.context=$,this.refs=b,this.updater=K||_}var F=O.prototype=new C;F.constructor=O,A(F,w.prototype),F.isPureReactComponent=!0;var X=Array.isArray;function ee(){}var W={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function U(S,$,K){var ae=K.ref;return{$$typeof:r,type:S,key:$,ref:ae!==void 0?ae:null,props:K}}function P(S,$){return U(S.type,$,S.props)}function I(S){return typeof S=="object"&&S!==null&&S.$$typeof===r}function re(S){var $={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(K){return $[K]})}var Ee=/\/+/g;function Ce(S,$){return typeof S=="object"&&S!==null&&S.key!=null?re(""+S.key):$.toString(36)}function q(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(ee,ee):(S.status="pending",S.then(function($){S.status==="pending"&&(S.status="fulfilled",S.value=$)},function($){S.status==="pending"&&(S.status="rejected",S.reason=$)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function R(S,$,K,ae,de){var ge=typeof S;(ge==="undefined"||ge==="boolean")&&(S=null);var le=!1;if(S===null)le=!0;else switch(ge){case"bigint":case"string":case"number":le=!0;break;case"object":switch(S.$$typeof){case r:case u:le=!0;break;case N:return le=S._init,R(le(S._payload),$,K,ae,de)}}if(le)return de=de(S),le=ae===""?"."+Ce(S,0):ae,X(de)?(K="",le!=null&&(K=le.replace(Ee,"$&/")+"/"),R(de,$,K,"",function(Il){return Il})):de!=null&&(I(de)&&(de=P(de,K+(de.key==null||S&&S.key===de.key?"":(""+de.key).replace(Ee,"$&/")+"/")+le)),$.push(de)),1;le=0;var We=ae===""?".":ae+":";if(X(S))for(var Ye=0;Ye<S.length;Ye++)ae=S[Ye],ge=We+Ce(ae,Ye),le+=R(ae,$,K,ge,de);else if(Ye=D(S),typeof Ye=="function")for(S=Ye.call(S),Ye=0;!(ae=S.next()).done;)ae=ae.value,ge=We+Ce(ae,Ye++),le+=R(ae,$,K,ge,de);else if(ge==="object"){if(typeof S.then=="function")return R(q(S),$,K,ae,de);throw $=String(S),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return le}function Q(S,$,K){if(S==null)return S;var ae=[],de=0;return R(S,ae,"","",function(ge){return $.call(K,ge,de++)}),ae}function ne(S){if(S._status===-1){var $=S._result;$=$(),$.then(function(K){(S._status===0||S._status===-1)&&(S._status=1,S._result=K)},function(K){(S._status===0||S._status===-1)&&(S._status=2,S._result=K)}),S._status===-1&&(S._status=0,S._result=$)}if(S._status===1)return S._result.default;throw S._result}var Z=typeof reportError=="function"?reportError:function(S){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof S=="object"&&S!==null&&typeof S.message=="string"?String(S.message):String(S),error:S});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",S);return}console.error(S)},xe={map:Q,forEach:function(S,$,K){Q(S,function(){$.apply(this,arguments)},K)},count:function(S){var $=0;return Q(S,function(){$++}),$},toArray:function(S){return Q(S,function($){return $})||[]},only:function(S){if(!I(S))throw Error("React.Children.only expected to receive a single React element child.");return S}};return fe.Activity=v,fe.Children=xe,fe.Component=w,fe.Fragment=o,fe.Profiler=d,fe.PureComponent=O,fe.StrictMode=c,fe.Suspense=p,fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,fe.__COMPILER_RUNTIME={__proto__:null,c:function(S){return W.H.useMemoCache(S)}},fe.cache=function(S){return function(){return S.apply(null,arguments)}},fe.cacheSignal=function(){return null},fe.cloneElement=function(S,$,K){if(S==null)throw Error("The argument must be a React element, but you passed "+S+".");var ae=A({},S.props),de=S.key;if($!=null)for(ge in $.key!==void 0&&(de=""+$.key),$)!J.call($,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&$.ref===void 0||(ae[ge]=$[ge]);var ge=arguments.length-2;if(ge===1)ae.children=K;else if(1<ge){for(var le=Array(ge),We=0;We<ge;We++)le[We]=arguments[We+2];ae.children=le}return U(S.type,de,ae)},fe.createContext=function(S){return S={$$typeof:m,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null},S.Provider=S,S.Consumer={$$typeof:x,_context:S},S},fe.createElement=function(S,$,K){var ae,de={},ge=null;if($!=null)for(ae in $.key!==void 0&&(ge=""+$.key),$)J.call($,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(de[ae]=$[ae]);var le=arguments.length-2;if(le===1)de.children=K;else if(1<le){for(var We=Array(le),Ye=0;Ye<le;Ye++)We[Ye]=arguments[Ye+2];de.children=We}if(S&&S.defaultProps)for(ae in le=S.defaultProps,le)de[ae]===void 0&&(de[ae]=le[ae]);return U(S,ge,de)},fe.createRef=function(){return{current:null}},fe.forwardRef=function(S){return{$$typeof:j,render:S}},fe.isValidElement=I,fe.lazy=function(S){return{$$typeof:N,_payload:{_status:-1,_result:S},_init:ne}},fe.memo=function(S,$){return{$$typeof:h,type:S,compare:$===void 0?null:$}},fe.startTransition=function(S){var $=W.T,K={};W.T=K;try{var ae=S(),de=W.S;de!==null&&de(K,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(ee,Z)}catch(ge){Z(ge)}finally{$!==null&&K.types!==null&&($.types=K.types),W.T=$}},fe.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},fe.use=function(S){return W.H.use(S)},fe.useActionState=function(S,$,K){return W.H.useActionState(S,$,K)},fe.useCallback=function(S,$){return W.H.useCallback(S,$)},fe.useContext=function(S){return W.H.useContext(S)},fe.useDebugValue=function(){},fe.useDeferredValue=function(S,$){return W.H.useDeferredValue(S,$)},fe.useEffect=function(S,$){return W.H.useEffect(S,$)},fe.useEffectEvent=function(S){return W.H.useEffectEvent(S)},fe.useId=function(){return W.H.useId()},fe.useImperativeHandle=function(S,$,K){return W.H.useImperativeHandle(S,$,K)},fe.useInsertionEffect=function(S,$){return W.H.useInsertionEffect(S,$)},fe.useLayoutEffect=function(S,$){return W.H.useLayoutEffect(S,$)},fe.useMemo=function(S,$){return W.H.useMemo(S,$)},fe.useOptimistic=function(S,$){return W.H.useOptimistic(S,$)},fe.useReducer=function(S,$,K){return W.H.useReducer(S,$,K)},fe.useRef=function(S){return W.H.useRef(S)},fe.useState=function(S){return W.H.useState(S)},fe.useSyncExternalStore=function(S,$,K){return W.H.useSyncExternalStore(S,$,K)},fe.useTransition=function(){return W.H.useTransition()},fe.version="19.2.8",fe}var B0;function bo(){return B0||(B0=1,ao.exports=wg()),ao.exports}var y=bo(),lo={exports:{}},Kn={},no={exports:{}},so={};var $0;function Eg(){return $0||($0=1,(function(r){function u(R,Q){var ne=R.length;R.push(Q);e:for(;0<ne;){var Z=ne-1>>>1,xe=R[Z];if(0<d(xe,Q))R[Z]=Q,R[ne]=xe,ne=Z;else break e}}function o(R){return R.length===0?null:R[0]}function c(R){if(R.length===0)return null;var Q=R[0],ne=R.pop();if(ne!==Q){R[0]=ne;e:for(var Z=0,xe=R.length,S=xe>>>1;Z<S;){var $=2*(Z+1)-1,K=R[$],ae=$+1,de=R[ae];if(0>d(K,ne))ae<xe&&0>d(de,K)?(R[Z]=de,R[ae]=ne,Z=ae):(R[Z]=K,R[$]=ne,Z=$);else if(ae<xe&&0>d(de,ne))R[Z]=de,R[ae]=ne,Z=ae;else break e}}return Q}function d(R,Q){var ne=R.sortIndex-Q.sortIndex;return ne!==0?ne:R.id-Q.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;r.unstable_now=function(){return x.now()}}else{var m=Date,j=m.now();r.unstable_now=function(){return m.now()-j}}var p=[],h=[],N=1,v=null,T=3,D=!1,_=!1,A=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function F(R){for(var Q=o(h);Q!==null;){if(Q.callback===null)c(h);else if(Q.startTime<=R)c(h),Q.sortIndex=Q.expirationTime,u(p,Q);else break;Q=o(h)}}function X(R){if(A=!1,F(R),!_)if(o(p)!==null)_=!0,ee||(ee=!0,re());else{var Q=o(h);Q!==null&&q(X,Q.startTime-R)}}var ee=!1,W=-1,J=5,U=-1;function P(){return b?!0:!(r.unstable_now()-U<J)}function I(){if(b=!1,ee){var R=r.unstable_now();U=R;var Q=!0;try{e:{_=!1,A&&(A=!1,C(W),W=-1),D=!0;var ne=T;try{t:{for(F(R),v=o(p);v!==null&&!(v.expirationTime>R&&P());){var Z=v.callback;if(typeof Z=="function"){v.callback=null,T=v.priorityLevel;var xe=Z(v.expirationTime<=R);if(R=r.unstable_now(),typeof xe=="function"){v.callback=xe,F(R),Q=!0;break t}v===o(p)&&c(p),F(R)}else c(p);v=o(p)}if(v!==null)Q=!0;else{var S=o(h);S!==null&&q(X,S.startTime-R),Q=!1}}break e}finally{v=null,T=ne,D=!1}Q=void 0}}finally{Q?re():ee=!1}}}var re;if(typeof O=="function")re=function(){O(I)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Ce=Ee.port2;Ee.port1.onmessage=I,re=function(){Ce.postMessage(null)}}else re=function(){w(I,0)};function q(R,Q){W=w(function(){R(r.unstable_now())},Q)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(R){R.callback=null},r.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<R?Math.floor(1e3/R):5},r.unstable_getCurrentPriorityLevel=function(){return T},r.unstable_next=function(R){switch(T){case 1:case 2:case 3:var Q=3;break;default:Q=T}var ne=T;T=Q;try{return R()}finally{T=ne}},r.unstable_requestPaint=function(){b=!0},r.unstable_runWithPriority=function(R,Q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ne=T;T=R;try{return Q()}finally{T=ne}},r.unstable_scheduleCallback=function(R,Q,ne){var Z=r.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?Z+ne:Z):ne=Z,R){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=ne+xe,R={id:N++,callback:Q,priorityLevel:R,startTime:ne,expirationTime:xe,sortIndex:-1},ne>Z?(R.sortIndex=ne,u(h,R),o(p)===null&&R===o(h)&&(A?(C(W),W=-1):A=!0,q(X,ne-Z))):(R.sortIndex=xe,u(p,R),_||D||(_=!0,ee||(ee=!0,re()))),R},r.unstable_shouldYield=P,r.unstable_wrapCallback=function(R){var Q=T;return function(){var ne=T;T=Q;try{return R.apply(this,arguments)}finally{T=ne}}}})(so)),so}var q0;function Cg(){return q0||(q0=1,no.exports=Eg()),no.exports}var ro={exports:{}},rt={};var Y0;function Tg(){if(Y0)return rt;Y0=1;var r=bo();function u(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var N=2;N<arguments.length;N++)h+="&args[]="+encodeURIComponent(arguments[N])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var c={d:{f:o,r:function(){throw Error(u(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},d=Symbol.for("react.portal");function x(p,h,N){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:v==null?null:""+v,children:p,containerInfo:h,implementation:N}}var m=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function j(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return rt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,rt.createPortal=function(p,h){var N=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(u(299));return x(p,h,null,N)},rt.flushSync=function(p){var h=m.T,N=c.p;try{if(m.T=null,c.p=2,p)return p()}finally{m.T=h,c.p=N,c.d.f()}},rt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,c.d.C(p,h))},rt.prefetchDNS=function(p){typeof p=="string"&&c.d.D(p)},rt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var N=h.as,v=j(N,h.crossOrigin),T=typeof h.integrity=="string"?h.integrity:void 0,D=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;N==="style"?c.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:T,fetchPriority:D}):N==="script"&&c.d.X(p,{crossOrigin:v,integrity:T,fetchPriority:D,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},rt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var N=j(h.as,h.crossOrigin);c.d.M(p,{crossOrigin:N,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&c.d.M(p)},rt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var N=h.as,v=j(N,h.crossOrigin);c.d.L(p,N,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},rt.preloadModule=function(p,h){if(typeof p=="string")if(h){var N=j(h.as,h.crossOrigin);c.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:N,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else c.d.m(p)},rt.requestFormReset=function(p){c.d.r(p)},rt.unstable_batchedUpdates=function(p,h){return p(h)},rt.useFormState=function(p,h,N){return m.H.useFormState(p,h,N)},rt.useFormStatus=function(){return m.H.useHostTransitionStatus()},rt.version="19.2.8",rt}var G0;function Ag(){if(G0)return ro.exports;G0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(u){console.error(u)}}return r(),ro.exports=Tg(),ro.exports}var V0;function Rg(){if(V0)return Kn;V0=1;var r=Cg(),u=bo(),o=Ag();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function x(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function m(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 j(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(x(e)!==e)throw Error(c(188))}function h(e){var t=e.alternate;if(!t){if(t=x(e),t===null)throw Error(c(188));return t!==e?null:e}for(var a=e,n=t;;){var s=a.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){a=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===a)return p(s),e;if(i===n)return p(s),t;i=i.sibling}throw Error(c(188))}if(a.return!==n.return)a=s,n=i;else{for(var f=!1,g=s.child;g;){if(g===a){f=!0,a=s,n=i;break}if(g===n){f=!0,n=s,a=i;break}g=g.sibling}if(!f){for(g=i.child;g;){if(g===a){f=!0,a=i,n=s;break}if(g===n){f=!0,n=i,a=s;break}g=g.sibling}if(!f)throw Error(c(189))}}if(a.alternate!==n)throw Error(c(190))}if(a.tag!==3)throw Error(c(188));return a.stateNode.current===a?e:t}function N(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=N(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,T=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),O=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var Ee=Symbol.for("react.client.reference");function Ce(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case w:return"Profiler";case b:return"StrictMode";case X:return"Suspense";case ee:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case O:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return t=e.displayName||null,t!==null?t:Ce(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return Ce(e(t))}catch{}}return null}var q=Array.isArray,R=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},Z=[],xe=-1;function S(e){return{current:e}}function $(e){0>xe||(e.current=Z[xe],Z[xe]=null,xe--)}function K(e,t){xe++,Z[xe]=e.current,e.current=t}var ae=S(null),de=S(null),ge=S(null),le=S(null);function We(e,t){switch(K(ge,t),K(de,e),K(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?s0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=s0(t),e=r0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(ae),K(ae,e)}function Ye(){$(ae),$(de),$(ge)}function Il(e){e.memoizedState!==null&&K(le,e);var t=ae.current,a=r0(t,e.type);t!==a&&(K(de,e),K(ae,a))}function rs(e){de.current===e&&($(ae),$(de)),le.current===e&&($(le),Gn._currentValue=ne)}var Ur,Oo;function Ya(e){if(Ur===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ur=t&&t[1]||"",Oo=-1<a.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Ur+e+Oo}var Hr=!1;function Br(e,t){if(!e||Hr)return"";Hr=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(B){var H=B}Reflect.construct(e,[],V)}else{try{V.call()}catch(B){H=B}e.call(V.prototype)}}else{try{throw Error()}catch(B){H=B}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(B){if(B&&H&&typeof B.stack=="string")return[B.stack,H.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=n.DetermineComponentFrameRoot(),f=i[0],g=i[1];if(f&&g){var E=f.split(`
4
- `),L=g.split(`
5
- `);for(s=n=0;n<E.length&&!E[n].includes("DetermineComponentFrameRoot");)n++;for(;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;if(n===E.length||s===L.length)for(n=E.length-1,s=L.length-1;1<=n&&0<=s&&E[n]!==L[s];)s--;for(;1<=n&&0<=s;n--,s--)if(E[n]!==L[s]){if(n!==1||s!==1)do if(n--,s--,0>s||E[n]!==L[s]){var Y=`
6
- `+E[n].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=n&&0<=s);break}}}finally{Hr=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ya(a):""}function Ix(e,t){switch(e.tag){case 26:case 27:case 5:return Ya(e.type);case 16:return Ya("Lazy");case 13:return e.child!==t&&t!==null?Ya("Suspense Fallback"):Ya("Suspense");case 19:return Ya("SuspenseList");case 0:case 15:return Br(e.type,!1);case 11:return Br(e.type.render,!1);case 1:return Br(e.type,!0);case 31:return Ya("Activity");default:return""}}function zo(e){try{var t="",a=null;do t+=Ix(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
7
- Error generating stack: `+n.message+`
8
- `+n.stack}}var $r=Object.prototype.hasOwnProperty,qr=r.unstable_scheduleCallback,Yr=r.unstable_cancelCallback,em=r.unstable_shouldYield,tm=r.unstable_requestPaint,ht=r.unstable_now,am=r.unstable_getCurrentPriorityLevel,Lo=r.unstable_ImmediatePriority,Uo=r.unstable_UserBlockingPriority,is=r.unstable_NormalPriority,lm=r.unstable_LowPriority,Ho=r.unstable_IdlePriority,nm=r.log,sm=r.unstable_setDisableYieldValue,en=null,gt=null;function ga(e){if(typeof nm=="function"&&sm(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(en,e)}catch{}}var pt=Math.clz32?Math.clz32:cm,rm=Math.log,im=Math.LN2;function cm(e){return e>>>=0,e===0?32:31-(rm(e)/im|0)|0}var cs=256,os=262144,us=4194304;function Ga(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ds(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var g=n&134217727;return g!==0?(n=g&~i,n!==0?s=Ga(n):(f&=g,f!==0?s=Ga(f):a||(a=g&~e,a!==0&&(s=Ga(a))))):(g=n&~i,g!==0?s=Ga(g):f!==0?s=Ga(f):a||(a=n&~e,a!==0&&(s=Ga(a)))),s===0?0:t!==0&&t!==s&&(t&i)===0&&(i=s&-s,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:s}function tn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function om(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bo(){var e=us;return us<<=1,(us&62914560)===0&&(us=4194304),e}function Gr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function an(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function um(e,t,a,n,s,i){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var g=e.entanglements,E=e.expirationTimes,L=e.hiddenUpdates;for(a=f&~a;0<a;){var Y=31-pt(a),V=1<<Y;g[Y]=0,E[Y]=-1;var H=L[Y];if(H!==null)for(L[Y]=null,Y=0;Y<H.length;Y++){var B=H[Y];B!==null&&(B.lane&=-536870913)}a&=~V}n!==0&&$o(e,n,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(f&~t))}function $o(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-pt(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function qo(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-pt(a),s=1<<n;s&t|e[n]&t&&(e[n]|=t),a&=~s}}function Yo(e,t){var a=t&-t;return a=(a&42)!==0?1:Vr(a),(a&(e.suspendedLanes|t))!==0?0:a}function Vr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Go(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:R0(e.type))}function Vo(e,t){var a=Q.p;try{return Q.p=e,t()}finally{Q.p=a}}var pa=Math.random().toString(36).slice(2),tt="__reactFiber$"+pa,ct="__reactProps$"+pa,cl="__reactContainer$"+pa,Xr="__reactEvents$"+pa,dm="__reactListeners$"+pa,fm="__reactHandles$"+pa,Qo="__reactResources$"+pa,ln="__reactMarker$"+pa;function Zr(e){delete e[tt],delete e[ct],delete e[Xr],delete e[dm],delete e[fm]}function ol(e){var t=e[tt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[cl]||a[tt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=x0(e);e!==null;){if(a=e[tt])return a;e=x0(e)}return t}e=a,a=e.parentNode}return null}function ul(e){if(e=e[tt]||e[cl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function nn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function dl(e){var t=e[Qo];return t||(t=e[Qo]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pe(e){e[ln]=!0}var Xo=new Set,Zo={};function Va(e,t){fl(e,t),fl(e+"Capture",t)}function fl(e,t){for(Zo[e]=t,e=0;e<t.length;e++)Xo.add(t[e])}var xm=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ko={},Jo={};function mm(e){return $r.call(Jo,e)?!0:$r.call(Ko,e)?!1:xm.test(e)?Jo[e]=!0:(Ko[e]=!0,!1)}function fs(e,t,a){if(mm(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function xs(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Jt(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function Et(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wo(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hm(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,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(f){a=""+f,i.call(this,f)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(f){a=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kr(e){if(!e._valueTracker){var t=Wo(e)?"checked":"value";e._valueTracker=hm(e,t,""+e[t])}}function Fo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=Wo(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function ms(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}}var gm=/[\n"\\]/g;function Ct(e){return e.replace(gm,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jr(e,t,a,n,s,i,f,g){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Et(t)):e.value!==""+Et(t)&&(e.value=""+Et(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Wr(e,f,Et(t)):a!=null?Wr(e,f,Et(a)):n!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+Et(g):e.removeAttribute("name")}function Po(e,t,a,n,s,i,f,g){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){Kr(e);return}a=a!=null?""+Et(a):"",t=t!=null?""+Et(t):a,g||t===e.value||(e.value=t),e.defaultValue=t}n=n??s,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=g?e.checked:!!n,e.defaultChecked=!!n,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),Kr(e)}function Wr(e,t,a){t==="number"&&ms(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function xl(e,t,a,n){if(e=e.options,t){t={};for(var s=0;s<a.length;s++)t["$"+a[s]]=!0;for(a=0;a<e.length;a++)s=t.hasOwnProperty("$"+e[a].value),e[a].selected!==s&&(e[a].selected=s),s&&n&&(e[a].defaultSelected=!0)}else{for(a=""+Et(a),t=null,s=0;s<e.length;s++){if(e[s].value===a){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Io(e,t,a){if(t!=null&&(t=""+Et(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Et(a):""}function eu(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(c(92));if(q(n)){if(1<n.length)throw Error(c(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=Et(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),Kr(e)}function ml(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var pm=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function tu(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||pm.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function au(e,t,a){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&a[s]!==n&&tu(e,s,n)}else for(var i in t)t.hasOwnProperty(i)&&tu(e,i,t[i])}function Fr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ym=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),vm=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function hs(e){return vm.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wt(){}var Pr=null;function Ir(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hl=null,gl=null;function lu(e){var t=ul(e);if(t&&(e=t.stateNode)){var a=e[ct]||null;e:switch(e=t.stateNode,t.type){case"input":if(Jr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ct(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var s=n[ct]||null;if(!s)throw Error(c(90));Jr(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&Fo(n)}break e;case"textarea":Io(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&xl(e,!!a.multiple,t,!1)}}}var ei=!1;function nu(e,t,a){if(ei)return e(t,a);ei=!0;try{var n=e(t);return n}finally{if(ei=!1,(hl!==null||gl!==null)&&(ar(),hl&&(t=hl,e=gl,gl=hl=null,lu(t),e)))for(t=0;t<e.length;t++)lu(e[t])}}function sn(e,t){var a=e.stateNode;if(a===null)return null;var n=a[ct]||null;if(n===null)return null;a=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(c(231,t,typeof a));return a}var Ft=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ti=!1;if(Ft)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){ti=!0}}),window.addEventListener("test",rn,rn),window.removeEventListener("test",rn,rn)}catch{ti=!1}var ya=null,ai=null,gs=null;function su(){if(gs)return gs;var e,t=ai,a=t.length,n,s="value"in ya?ya.value:ya.textContent,i=s.length;for(e=0;e<a&&t[e]===s[e];e++);var f=a-e;for(n=1;n<=f&&t[a-n]===s[i-n];n++);return gs=s.slice(e,1<n?1-n:void 0)}function ps(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 ys(){return!0}function ru(){return!1}function ot(e){function t(a,n,s,i,f){this._reactName=a,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=f,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(a=e[g],this[g]=a?a(i):i[g]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ys:ru,this.isPropagationStopped=ru,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ys)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ys)},persist:function(){},isPersistent:ys}),t}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vs=ot(Qa),cn=v({},Qa,{view:0,detail:0}),bm=ot(cn),li,ni,on,bs=v({},cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ri,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!==on&&(on&&e.type==="mousemove"?(li=e.screenX-on.screenX,ni=e.screenY-on.screenY):ni=li=0,on=e),li)},movementY:function(e){return"movementY"in e?e.movementY:ni}}),iu=ot(bs),jm=v({},bs,{dataTransfer:0}),Nm=ot(jm),Sm=v({},cn,{relatedTarget:0}),si=ot(Sm),wm=v({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),Em=ot(wm),Cm=v({},Qa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Tm=ot(Cm),Am=v({},Qa,{data:0}),cu=ot(Am),Rm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mm={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"},Dm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function km(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dm[e])?!!t[e]:!1}function ri(){return km}var _m=v({},cn,{key:function(e){if(e.key){var t=Rm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ps(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Mm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ri,charCode:function(e){return e.type==="keypress"?ps(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ps(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Om=ot(_m),zm=v({},bs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ou=ot(zm),Lm=v({},cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ri}),Um=ot(Lm),Hm=v({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bm=ot(Hm),$m=v({},bs,{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}),qm=ot($m),Ym=v({},Qa,{newState:0,oldState:0}),Gm=ot(Ym),Vm=[9,13,27,32],ii=Ft&&"CompositionEvent"in window,un=null;Ft&&"documentMode"in document&&(un=document.documentMode);var Qm=Ft&&"TextEvent"in window&&!un,uu=Ft&&(!ii||un&&8<un&&11>=un),du=" ",fu=!1;function xu(e,t){switch(e){case"keyup":return Vm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pl=!1;function Xm(e,t){switch(e){case"compositionend":return mu(t);case"keypress":return t.which!==32?null:(fu=!0,du);case"textInput":return e=t.data,e===du&&fu?null:e;default:return null}}function Zm(e,t){if(pl)return e==="compositionend"||!ii&&xu(e,t)?(e=su(),gs=ai=ya=null,pl=!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 uu&&t.locale!=="ko"?null:t.data;default:return null}}var Km={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 hu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Km[e.type]:t==="textarea"}function gu(e,t,a,n){hl?gl?gl.push(n):gl=[n]:hl=n,t=or(t,"onChange"),0<t.length&&(a=new vs("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var dn=null,fn=null;function Jm(e){If(e,0)}function js(e){var t=nn(e);if(Fo(t))return e}function pu(e,t){if(e==="change")return t}var yu=!1;if(Ft){var ci;if(Ft){var oi="oninput"in document;if(!oi){var vu=document.createElement("div");vu.setAttribute("oninput","return;"),oi=typeof vu.oninput=="function"}ci=oi}else ci=!1;yu=ci&&(!document.documentMode||9<document.documentMode)}function bu(){dn&&(dn.detachEvent("onpropertychange",ju),fn=dn=null)}function ju(e){if(e.propertyName==="value"&&js(fn)){var t=[];gu(t,fn,e,Ir(e)),nu(Jm,t)}}function Wm(e,t,a){e==="focusin"?(bu(),dn=t,fn=a,dn.attachEvent("onpropertychange",ju)):e==="focusout"&&bu()}function Fm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return js(fn)}function Pm(e,t){if(e==="click")return js(t)}function Im(e,t){if(e==="input"||e==="change")return js(t)}function eh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yt=typeof Object.is=="function"?Object.is:eh;function xn(e,t){if(yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var s=a[n];if(!$r.call(t,s)||!yt(e[s],t[s]))return!1}return!0}function Nu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Su(e,t){var a=Nu(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Nu(a)}}function wu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Eu(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ms(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=ms(e.document)}return t}function ui(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var th=Ft&&"documentMode"in document&&11>=document.documentMode,yl=null,di=null,mn=null,fi=!1;function Cu(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;fi||yl==null||yl!==ms(n)||(n=yl,"selectionStart"in n&&ui(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),mn&&xn(mn,n)||(mn=n,n=or(di,"onSelect"),0<n.length&&(t=new vs("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=yl)))}function Xa(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var vl={animationend:Xa("Animation","AnimationEnd"),animationiteration:Xa("Animation","AnimationIteration"),animationstart:Xa("Animation","AnimationStart"),transitionrun:Xa("Transition","TransitionRun"),transitionstart:Xa("Transition","TransitionStart"),transitioncancel:Xa("Transition","TransitionCancel"),transitionend:Xa("Transition","TransitionEnd")},xi={},Tu={};Ft&&(Tu=document.createElement("div").style,"AnimationEvent"in window||(delete vl.animationend.animation,delete vl.animationiteration.animation,delete vl.animationstart.animation),"TransitionEvent"in window||delete vl.transitionend.transition);function Za(e){if(xi[e])return xi[e];if(!vl[e])return e;var t=vl[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Tu)return xi[e]=t[a];return e}var Au=Za("animationend"),Ru=Za("animationiteration"),Mu=Za("animationstart"),ah=Za("transitionrun"),lh=Za("transitionstart"),nh=Za("transitioncancel"),Du=Za("transitionend"),ku=new Map,mi="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");mi.push("scrollEnd");function Ut(e,t){ku.set(e,t),Va(t,[e])}var Ns=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Tt=[],bl=0,hi=0;function Ss(){for(var e=bl,t=hi=bl=0;t<e;){var a=Tt[t];Tt[t++]=null;var n=Tt[t];Tt[t++]=null;var s=Tt[t];Tt[t++]=null;var i=Tt[t];if(Tt[t++]=null,n!==null&&s!==null){var f=n.pending;f===null?s.next=s:(s.next=f.next,f.next=s),n.pending=s}i!==0&&_u(a,s,i)}}function ws(e,t,a,n){Tt[bl++]=e,Tt[bl++]=t,Tt[bl++]=a,Tt[bl++]=n,hi|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function gi(e,t,a,n){return ws(e,t,a,n),Es(e)}function Ka(e,t){return ws(e,null,null,t),Es(e)}function _u(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var s=!1,i=e.return;i!==null;)i.childLanes|=a,n=i.alternate,n!==null&&(n.childLanes|=a),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-pt(a),e=i.hiddenUpdates,n=e[s],n===null?e[s]=[t]:n.push(t),t.lane=a|536870912),i):null}function Es(e){if(50<Ln)throw Ln=0,Ec=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var jl={};function sh(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vt(e,t,a,n){return new sh(e,t,a,n)}function pi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pt(e,t){var a=e.alternate;return a===null?(a=vt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Ou(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Cs(e,t,a,n,s,i){var f=0;if(n=e,typeof e=="function")pi(e)&&(f=1);else if(typeof e=="string")f=ug(e,a,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U:return e=vt(31,a,t,s),e.elementType=U,e.lanes=i,e;case A:return Ja(a.children,s,i,t);case b:f=8,s|=24;break;case w:return e=vt(12,a,t,s|2),e.elementType=w,e.lanes=i,e;case X:return e=vt(13,a,t,s),e.elementType=X,e.lanes=i,e;case ee:return e=vt(19,a,t,s),e.elementType=ee,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:f=10;break e;case C:f=9;break e;case F:f=11;break e;case W:f=14;break e;case J:f=16,n=null;break e}f=29,a=Error(c(130,e===null?"null":typeof e,"")),n=null}return t=vt(f,a,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function Ja(e,t,a,n){return e=vt(7,e,n,t),e.lanes=a,e}function yi(e,t,a){return e=vt(6,e,null,t),e.lanes=a,e}function zu(e){var t=vt(18,null,null,0);return t.stateNode=e,t}function vi(e,t,a){return t=vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Lu=new WeakMap;function At(e,t){if(typeof e=="object"&&e!==null){var a=Lu.get(e);return a!==void 0?a:(t={value:e,source:t,stack:zo(t)},Lu.set(e,t),t)}return{value:e,source:t,stack:zo(t)}}var Nl=[],Sl=0,Ts=null,hn=0,Rt=[],Mt=0,va=null,Vt=1,Qt="";function It(e,t){Nl[Sl++]=hn,Nl[Sl++]=Ts,Ts=e,hn=t}function Uu(e,t,a){Rt[Mt++]=Vt,Rt[Mt++]=Qt,Rt[Mt++]=va,va=e;var n=Vt;e=Qt;var s=32-pt(n)-1;n&=~(1<<s),a+=1;var i=32-pt(t)+s;if(30<i){var f=s-s%5;i=(n&(1<<f)-1).toString(32),n>>=f,s-=f,Vt=1<<32-pt(t)+s|a<<s|n,Qt=i+e}else Vt=1<<i|a<<s|n,Qt=e}function bi(e){e.return!==null&&(It(e,1),Uu(e,1,0))}function ji(e){for(;e===Ts;)Ts=Nl[--Sl],Nl[Sl]=null,hn=Nl[--Sl],Nl[Sl]=null;for(;e===va;)va=Rt[--Mt],Rt[Mt]=null,Qt=Rt[--Mt],Rt[Mt]=null,Vt=Rt[--Mt],Rt[Mt]=null}function Hu(e,t){Rt[Mt++]=Vt,Rt[Mt++]=Qt,Rt[Mt++]=va,Vt=t.id,Qt=t.overflow,va=e}var at=null,ze=null,je=!1,ba=null,Dt=!1,Ni=Error(c(519));function ja(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gn(At(t,e)),Ni}function Bu(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[tt]=e,t[ct]=n,a){case"dialog":ye("cancel",t),ye("close",t);break;case"iframe":case"object":case"embed":ye("load",t);break;case"video":case"audio":for(a=0;a<Hn.length;a++)ye(Hn[a],t);break;case"source":ye("error",t);break;case"img":case"image":case"link":ye("error",t),ye("load",t);break;case"details":ye("toggle",t);break;case"input":ye("invalid",t),Po(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ye("invalid",t);break;case"textarea":ye("invalid",t),eu(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||l0(t.textContent,a)?(n.popover!=null&&(ye("beforetoggle",t),ye("toggle",t)),n.onScroll!=null&&ye("scroll",t),n.onScrollEnd!=null&&ye("scrollend",t),n.onClick!=null&&(t.onclick=Wt),t=!0):t=!1,t||ja(e,!0)}function $u(e){for(at=e.return;at;)switch(at.tag){case 5:case 31:case 13:Dt=!1;return;case 27:case 3:Dt=!0;return;default:at=at.return}}function wl(e){if(e!==at)return!1;if(!je)return $u(e),je=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||$c(e.type,e.memoizedProps)),a=!a),a&&ze&&ja(e),$u(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));ze=f0(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));ze=f0(e)}else t===27?(t=ze,za(e.type)?(e=Qc,Qc=null,ze=e):ze=t):ze=at?_t(e.stateNode.nextSibling):null;return!0}function Wa(){ze=at=null,je=!1}function Si(){var e=ba;return e!==null&&(xt===null?xt=e:xt.push.apply(xt,e),ba=null),e}function gn(e){ba===null?ba=[e]:ba.push(e)}var wi=S(null),Fa=null,ea=null;function Na(e,t,a){K(wi,t._currentValue),t._currentValue=a}function ta(e){e._currentValue=wi.current,$(wi)}function Ei(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function Ci(e,t,a,n){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var f=s.child;i=i.firstContext;e:for(;i!==null;){var g=i;i=s;for(var E=0;E<t.length;E++)if(g.context===t[E]){i.lanes|=a,g=i.alternate,g!==null&&(g.lanes|=a),Ei(i.return,a,e),n||(f=null);break e}i=g.next}}else if(s.tag===18){if(f=s.return,f===null)throw Error(c(341));f.lanes|=a,i=f.alternate,i!==null&&(i.lanes|=a),Ei(f,a,e),f=null}else f=s.child;if(f!==null)f.return=s;else for(f=s;f!==null;){if(f===e){f=null;break}if(s=f.sibling,s!==null){s.return=f.return,f=s;break}f=f.return}s=f}}function El(e,t,a,n){e=null;for(var s=t,i=!1;s!==null;){if(!i){if((s.flags&524288)!==0)i=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var f=s.alternate;if(f===null)throw Error(c(387));if(f=f.memoizedProps,f!==null){var g=s.type;yt(s.pendingProps.value,f.value)||(e!==null?e.push(g):e=[g])}}else if(s===le.current){if(f=s.alternate,f===null)throw Error(c(387));f.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Gn):e=[Gn])}s=s.return}e!==null&&Ci(t,e,a,n),t.flags|=262144}function As(e){for(e=e.firstContext;e!==null;){if(!yt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Pa(e){Fa=e,ea=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function lt(e){return qu(Fa,e)}function Rs(e,t){return Fa===null&&Pa(e),qu(e,t)}function qu(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ea===null){if(e===null)throw Error(c(308));ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ea=ea.next=t;return a}var rh=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},ih=r.unstable_scheduleCallback,ch=r.unstable_NormalPriority,Xe={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ti(){return{controller:new rh,data:new Map,refCount:0}}function pn(e){e.refCount--,e.refCount===0&&ih(ch,function(){e.controller.abort()})}var yn=null,Ai=0,Cl=0,Tl=null;function oh(e,t){if(yn===null){var a=yn=[];Ai=0,Cl=Dc(),Tl={status:"pending",value:void 0,then:function(n){a.push(n)}}}return Ai++,t.then(Yu,Yu),t}function Yu(){if(--Ai===0&&yn!==null){Tl!==null&&(Tl.status="fulfilled");var e=yn;yn=null,Cl=0,Tl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uh(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(s){a.push(s)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<a.length;s++)(0,a[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<a.length;s++)(0,a[s])(void 0)}),n}var Gu=R.S;R.S=function(e,t){Tf=ht(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&oh(e,t),Gu!==null&&Gu(e,t)};var Ia=S(null);function Ri(){var e=Ia.current;return e!==null?e:_e.pooledCache}function Ms(e,t){t===null?K(Ia,Ia.current):K(Ia,t.pool)}function Vu(){var e=Ri();return e===null?null:{parent:Xe._currentValue,pool:e}}var Al=Error(c(460)),Mi=Error(c(474)),Ds=Error(c(542)),ks={then:function(){}};function Qu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xu(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Wt,Wt),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ku(e),e;default:if(typeof t.status=="string")t.then(Wt,Wt);else{if(e=_e,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ku(e),e}throw tl=t,Al}}function el(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(tl=a,Al):a}}var tl=null;function Zu(){if(tl===null)throw Error(c(459));var e=tl;return tl=null,e}function Ku(e){if(e===Al||e===Ds)throw Error(c(483))}var Rl=null,vn=0;function _s(e){var t=vn;return vn+=1,Rl===null&&(Rl=[]),Xu(Rl,e,t)}function bn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Os(e,t){throw t.$$typeof===T?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ju(e){function t(k,M){if(e){var z=k.deletions;z===null?(k.deletions=[M],k.flags|=16):z.push(M)}}function a(k,M){if(!e)return null;for(;M!==null;)t(k,M),M=M.sibling;return null}function n(k){for(var M=new Map;k!==null;)k.key!==null?M.set(k.key,k):M.set(k.index,k),k=k.sibling;return M}function s(k,M){return k=Pt(k,M),k.index=0,k.sibling=null,k}function i(k,M,z){return k.index=z,e?(z=k.alternate,z!==null?(z=z.index,z<M?(k.flags|=67108866,M):z):(k.flags|=67108866,M)):(k.flags|=1048576,M)}function f(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function g(k,M,z,G){return M===null||M.tag!==6?(M=yi(z,k.mode,G),M.return=k,M):(M=s(M,z),M.return=k,M)}function E(k,M,z,G){var ie=z.type;return ie===A?Y(k,M,z.props.children,G,z.key):M!==null&&(M.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===J&&el(ie)===M.type)?(M=s(M,z.props),bn(M,z),M.return=k,M):(M=Cs(z.type,z.key,z.props,null,k.mode,G),bn(M,z),M.return=k,M)}function L(k,M,z,G){return M===null||M.tag!==4||M.stateNode.containerInfo!==z.containerInfo||M.stateNode.implementation!==z.implementation?(M=vi(z,k.mode,G),M.return=k,M):(M=s(M,z.children||[]),M.return=k,M)}function Y(k,M,z,G,ie){return M===null||M.tag!==7?(M=Ja(z,k.mode,G,ie),M.return=k,M):(M=s(M,z),M.return=k,M)}function V(k,M,z){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=yi(""+M,k.mode,z),M.return=k,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case D:return z=Cs(M.type,M.key,M.props,null,k.mode,z),bn(z,M),z.return=k,z;case _:return M=vi(M,k.mode,z),M.return=k,M;case J:return M=el(M),V(k,M,z)}if(q(M)||re(M))return M=Ja(M,k.mode,z,null),M.return=k,M;if(typeof M.then=="function")return V(k,_s(M),z);if(M.$$typeof===O)return V(k,Rs(k,M),z);Os(k,M)}return null}function H(k,M,z,G){var ie=M!==null?M.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return ie!==null?null:g(k,M,""+z,G);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case D:return z.key===ie?E(k,M,z,G):null;case _:return z.key===ie?L(k,M,z,G):null;case J:return z=el(z),H(k,M,z,G)}if(q(z)||re(z))return ie!==null?null:Y(k,M,z,G,null);if(typeof z.then=="function")return H(k,M,_s(z),G);if(z.$$typeof===O)return H(k,M,Rs(k,z),G);Os(k,z)}return null}function B(k,M,z,G,ie){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return k=k.get(z)||null,g(M,k,""+G,ie);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case D:return k=k.get(G.key===null?z:G.key)||null,E(M,k,G,ie);case _:return k=k.get(G.key===null?z:G.key)||null,L(M,k,G,ie);case J:return G=el(G),B(k,M,z,G,ie)}if(q(G)||re(G))return k=k.get(z)||null,Y(M,k,G,ie,null);if(typeof G.then=="function")return B(k,M,z,_s(G),ie);if(G.$$typeof===O)return B(k,M,z,Rs(M,G),ie);Os(M,G)}return null}function te(k,M,z,G){for(var ie=null,Ne=null,se=M,he=M=0,be=null;se!==null&&he<z.length;he++){se.index>he?(be=se,se=null):be=se.sibling;var Se=H(k,se,z[he],G);if(Se===null){se===null&&(se=be);break}e&&se&&Se.alternate===null&&t(k,se),M=i(Se,M,he),Ne===null?ie=Se:Ne.sibling=Se,Ne=Se,se=be}if(he===z.length)return a(k,se),je&&It(k,he),ie;if(se===null){for(;he<z.length;he++)se=V(k,z[he],G),se!==null&&(M=i(se,M,he),Ne===null?ie=se:Ne.sibling=se,Ne=se);return je&&It(k,he),ie}for(se=n(se);he<z.length;he++)be=B(se,k,he,z[he],G),be!==null&&(e&&be.alternate!==null&&se.delete(be.key===null?he:be.key),M=i(be,M,he),Ne===null?ie=be:Ne.sibling=be,Ne=be);return e&&se.forEach(function($a){return t(k,$a)}),je&&It(k,he),ie}function oe(k,M,z,G){if(z==null)throw Error(c(151));for(var ie=null,Ne=null,se=M,he=M=0,be=null,Se=z.next();se!==null&&!Se.done;he++,Se=z.next()){se.index>he?(be=se,se=null):be=se.sibling;var $a=H(k,se,Se.value,G);if($a===null){se===null&&(se=be);break}e&&se&&$a.alternate===null&&t(k,se),M=i($a,M,he),Ne===null?ie=$a:Ne.sibling=$a,Ne=$a,se=be}if(Se.done)return a(k,se),je&&It(k,he),ie;if(se===null){for(;!Se.done;he++,Se=z.next())Se=V(k,Se.value,G),Se!==null&&(M=i(Se,M,he),Ne===null?ie=Se:Ne.sibling=Se,Ne=Se);return je&&It(k,he),ie}for(se=n(se);!Se.done;he++,Se=z.next())Se=B(se,k,he,Se.value,G),Se!==null&&(e&&Se.alternate!==null&&se.delete(Se.key===null?he:Se.key),M=i(Se,M,he),Ne===null?ie=Se:Ne.sibling=Se,Ne=Se);return e&&se.forEach(function(jg){return t(k,jg)}),je&&It(k,he),ie}function ke(k,M,z,G){if(typeof z=="object"&&z!==null&&z.type===A&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case D:e:{for(var ie=z.key;M!==null;){if(M.key===ie){if(ie=z.type,ie===A){if(M.tag===7){a(k,M.sibling),G=s(M,z.props.children),G.return=k,k=G;break e}}else if(M.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===J&&el(ie)===M.type){a(k,M.sibling),G=s(M,z.props),bn(G,z),G.return=k,k=G;break e}a(k,M);break}else t(k,M);M=M.sibling}z.type===A?(G=Ja(z.props.children,k.mode,G,z.key),G.return=k,k=G):(G=Cs(z.type,z.key,z.props,null,k.mode,G),bn(G,z),G.return=k,k=G)}return f(k);case _:e:{for(ie=z.key;M!==null;){if(M.key===ie)if(M.tag===4&&M.stateNode.containerInfo===z.containerInfo&&M.stateNode.implementation===z.implementation){a(k,M.sibling),G=s(M,z.children||[]),G.return=k,k=G;break e}else{a(k,M);break}else t(k,M);M=M.sibling}G=vi(z,k.mode,G),G.return=k,k=G}return f(k);case J:return z=el(z),ke(k,M,z,G)}if(q(z))return te(k,M,z,G);if(re(z)){if(ie=re(z),typeof ie!="function")throw Error(c(150));return z=ie.call(z),oe(k,M,z,G)}if(typeof z.then=="function")return ke(k,M,_s(z),G);if(z.$$typeof===O)return ke(k,M,Rs(k,z),G);Os(k,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,M!==null&&M.tag===6?(a(k,M.sibling),G=s(M,z),G.return=k,k=G):(a(k,M),G=yi(z,k.mode,G),G.return=k,k=G),f(k)):a(k,M)}return function(k,M,z,G){try{vn=0;var ie=ke(k,M,z,G);return Rl=null,ie}catch(se){if(se===Al||se===Ds)throw se;var Ne=vt(29,se,null,k.mode);return Ne.lanes=G,Ne.return=k,Ne}}}var al=Ju(!0),Wu=Ju(!1),Sa=!1;function Di(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ki(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ea(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(we&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=Es(e),_u(e,null,a),t}return ws(e,n,t,a),Es(e)}function jn(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,qo(e,a)}}function _i(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var s=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?s=i=f:i=i.next=f,a=a.next}while(a!==null);i===null?s=i=t:i=i.next=t}else s=i=t;a={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Oi=!1;function Nn(){if(Oi){var e=Tl;if(e!==null)throw e}}function Sn(e,t,a,n){Oi=!1;var s=e.updateQueue;Sa=!1;var i=s.firstBaseUpdate,f=s.lastBaseUpdate,g=s.shared.pending;if(g!==null){s.shared.pending=null;var E=g,L=E.next;E.next=null,f===null?i=L:f.next=L,f=E;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,g=Y.lastBaseUpdate,g!==f&&(g===null?Y.firstBaseUpdate=L:g.next=L,Y.lastBaseUpdate=E))}if(i!==null){var V=s.baseState;f=0,Y=L=E=null,g=i;do{var H=g.lane&-536870913,B=H!==g.lane;if(B?(ve&H)===H:(n&H)===H){H!==0&&H===Cl&&(Oi=!0),Y!==null&&(Y=Y.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var te=e,oe=g;H=t;var ke=a;switch(oe.tag){case 1:if(te=oe.payload,typeof te=="function"){V=te.call(ke,V,H);break e}V=te;break e;case 3:te.flags=te.flags&-65537|128;case 0:if(te=oe.payload,H=typeof te=="function"?te.call(ke,V,H):te,H==null)break e;V=v({},V,H);break e;case 2:Sa=!0}}H=g.callback,H!==null&&(e.flags|=64,B&&(e.flags|=8192),B=s.callbacks,B===null?s.callbacks=[H]:B.push(H))}else B={lane:H,tag:g.tag,payload:g.payload,callback:g.callback,next:null},Y===null?(L=Y=B,E=V):Y=Y.next=B,f|=H;if(g=g.next,g===null){if(g=s.shared.pending,g===null)break;B=g,g=B.next,B.next=null,s.lastBaseUpdate=B,s.shared.pending=null}}while(!0);Y===null&&(E=V),s.baseState=E,s.firstBaseUpdate=L,s.lastBaseUpdate=Y,i===null&&(s.shared.lanes=0),Ma|=f,e.lanes=f,e.memoizedState=V}}function Fu(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Pu(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Fu(a[e],t)}var Ml=S(null),zs=S(0);function Iu(e,t){e=ua,K(zs,e),K(Ml,t),ua=e|t.baseLanes}function zi(){K(zs,ua),K(Ml,Ml.current)}function Li(){ua=zs.current,$(Ml),$(zs)}var bt=S(null),kt=null;function Ca(e){var t=e.alternate;K(Ge,Ge.current&1),K(bt,e),kt===null&&(t===null||Ml.current!==null||t.memoizedState!==null)&&(kt=e)}function Ui(e){K(Ge,Ge.current),K(bt,e),kt===null&&(kt=e)}function ed(e){e.tag===22?(K(Ge,Ge.current),K(bt,e),kt===null&&(kt=e)):Ta()}function Ta(){K(Ge,Ge.current),K(bt,bt.current)}function jt(e){$(bt),kt===e&&(kt=null),$(Ge)}var Ge=S(0);function Ls(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Gc(a)||Vc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)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 aa=0,me=null,Me=null,Ze=null,Us=!1,Dl=!1,ll=!1,Hs=0,wn=0,kl=null,dh=0;function Be(){throw Error(c(321))}function Hi(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!yt(e[a],t[a]))return!1;return!0}function Bi(e,t,a,n,s,i){return aa=i,me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Ud:ec,ll=!1,i=a(n,s),ll=!1,Dl&&(i=ad(t,a,n,s)),td(e),i}function td(e){R.H=Tn;var t=Me!==null&&Me.next!==null;if(aa=0,Ze=Me=me=null,Us=!1,wn=0,kl=null,t)throw Error(c(300));e===null||Ke||(e=e.dependencies,e!==null&&As(e)&&(Ke=!0))}function ad(e,t,a,n){me=e;var s=0;do{if(Dl&&(kl=null),wn=0,Dl=!1,25<=s)throw Error(c(301));if(s+=1,Ze=Me=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}R.H=Hd,i=t(a,n)}while(Dl);return i}function fh(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?En(t):t,e=e.useState()[0],(Me!==null?Me.memoizedState:null)!==e&&(me.flags|=1024),t}function $i(){var e=Hs!==0;return Hs=0,e}function qi(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Yi(e){if(Us){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Us=!1}aa=0,Ze=Me=me=null,Dl=!1,wn=Hs=0,kl=null}function it(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ze===null?me.memoizedState=Ze=e:Ze=Ze.next=e,Ze}function Ve(){if(Me===null){var e=me.alternate;e=e!==null?e.memoizedState:null}else e=Me.next;var t=Ze===null?me.memoizedState:Ze.next;if(t!==null)Ze=t,Me=e;else{if(e===null)throw me.alternate===null?Error(c(467)):Error(c(310));Me=e,e={memoizedState:Me.memoizedState,baseState:Me.baseState,baseQueue:Me.baseQueue,queue:Me.queue,next:null},Ze===null?me.memoizedState=Ze=e:Ze=Ze.next=e}return Ze}function Bs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function En(e){var t=wn;return wn+=1,kl===null&&(kl=[]),e=Xu(kl,e,t),t=me,(Ze===null?t.memoizedState:Ze.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Ud:ec),e}function $s(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return En(e);if(e.$$typeof===O)return lt(e)}throw Error(c(438,String(e)))}function Gi(e){var t=null,a=me.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=me.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Bs(),me.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=P;return t.index++,a}function la(e,t){return typeof t=="function"?t(e):t}function qs(e){var t=Ve();return Vi(t,Me,e)}function Vi(e,t,a){var n=e.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=a;var s=e.baseQueue,i=n.pending;if(i!==null){if(s!==null){var f=s.next;s.next=i.next,i.next=f}t.baseQueue=s=i,n.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var g=f=null,E=null,L=t,Y=!1;do{var V=L.lane&-536870913;if(V!==L.lane?(ve&V)===V:(aa&V)===V){var H=L.revertLane;if(H===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),V===Cl&&(Y=!0);else if((aa&H)===H){L=L.next,H===Cl&&(Y=!0);continue}else V={lane:0,revertLane:L.revertLane,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},E===null?(g=E=V,f=i):E=E.next=V,me.lanes|=H,Ma|=H;V=L.action,ll&&a(i,V),i=L.hasEagerState?L.eagerState:a(i,V)}else H={lane:V,revertLane:L.revertLane,gesture:L.gesture,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},E===null?(g=E=H,f=i):E=E.next=H,me.lanes|=V,Ma|=V;L=L.next}while(L!==null&&L!==t);if(E===null?f=i:E.next=g,!yt(i,e.memoizedState)&&(Ke=!0,Y&&(a=Tl,a!==null)))throw a;e.memoizedState=i,e.baseState=f,e.baseQueue=E,n.lastRenderedState=i}return s===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Qi(e){var t=Ve(),a=t.queue;if(a===null)throw Error(c(311));a.lastRenderedReducer=e;var n=a.dispatch,s=a.pending,i=t.memoizedState;if(s!==null){a.pending=null;var f=s=s.next;do i=e(i,f.action),f=f.next;while(f!==s);yt(i,t.memoizedState)||(Ke=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),a.lastRenderedState=i}return[i,n]}function ld(e,t,a){var n=me,s=Ve(),i=je;if(i){if(a===void 0)throw Error(c(407));a=a()}else a=t();var f=!yt((Me||s).memoizedState,a);if(f&&(s.memoizedState=a,Ke=!0),s=s.queue,Ki(rd.bind(null,n,s,e),[e]),s.getSnapshot!==t||f||Ze!==null&&Ze.memoizedState.tag&1){if(n.flags|=2048,_l(9,{destroy:void 0},sd.bind(null,n,s,a,t),null),_e===null)throw Error(c(349));i||(aa&127)!==0||nd(n,t,a)}return a}function nd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=me.updateQueue,t===null?(t=Bs(),me.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function sd(e,t,a,n){t.value=a,t.getSnapshot=n,id(t)&&cd(e)}function rd(e,t,a){return a(function(){id(t)&&cd(e)})}function id(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!yt(e,a)}catch{return!0}}function cd(e){var t=Ka(e,2);t!==null&&mt(t,e,2)}function Xi(e){var t=it();if(typeof e=="function"){var a=e;if(e=a(),ll){ga(!0);try{a()}finally{ga(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:la,lastRenderedState:e},t}function od(e,t,a,n){return e.baseState=a,Vi(e,Me,typeof n=="function"?n:la)}function xh(e,t,a,n,s){if(Vs(e))throw Error(c(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){i.listeners.push(f)}};R.T!==null?a(!0):i.isTransition=!1,n(i),a=t.pending,a===null?(i.next=t.pending=i,ud(t,i)):(i.next=a.next,t.pending=a.next=i)}}function ud(e,t){var a=t.action,n=t.payload,s=e.state;if(t.isTransition){var i=R.T,f={};R.T=f;try{var g=a(s,n),E=R.S;E!==null&&E(f,g),dd(e,t,g)}catch(L){Zi(e,t,L)}finally{i!==null&&f.types!==null&&(i.types=f.types),R.T=i}}else try{i=a(s,n),dd(e,t,i)}catch(L){Zi(e,t,L)}}function dd(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){fd(e,t,n)},function(n){return Zi(e,t,n)}):fd(e,t,a)}function fd(e,t,a){t.status="fulfilled",t.value=a,xd(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,ud(e,a)))}function Zi(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,xd(t),t=t.next;while(t!==n)}e.action=null}function xd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function md(e,t){return t}function hd(e,t){if(je){var a=_e.formState;if(a!==null){e:{var n=me;if(je){if(ze){t:{for(var s=ze,i=Dt;s.nodeType!==8;){if(!i){s=null;break t}if(s=_t(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){ze=_t(s.nextSibling),n=s.data==="F!";break e}}ja(n)}n=!1}n&&(t=a[0])}}return a=it(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:md,lastRenderedState:t},a.queue=n,a=Od.bind(null,me,n),n.dispatch=a,n=Xi(!1),i=Ii.bind(null,me,!1,n.queue),n=it(),s={state:t,dispatch:null,action:e,pending:null},n.queue=s,a=xh.bind(null,me,s,i,a),s.dispatch=a,n.memoizedState=e,[t,a,!1]}function gd(e){var t=Ve();return pd(t,Me,e)}function pd(e,t,a){if(t=Vi(e,t,md)[0],e=qs(la)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=En(t)}catch(f){throw f===Al?Ds:f}else n=t;t=Ve();var s=t.queue,i=s.dispatch;return a!==t.memoizedState&&(me.flags|=2048,_l(9,{destroy:void 0},mh.bind(null,s,a),null)),[n,i,e]}function mh(e,t){e.action=t}function yd(e){var t=Ve(),a=Me;if(a!==null)return pd(t,a,e);Ve(),t=t.memoizedState,a=Ve();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function _l(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=me.updateQueue,t===null&&(t=Bs(),me.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function vd(){return Ve().memoizedState}function Ys(e,t,a,n){var s=it();me.flags|=e,s.memoizedState=_l(1|t,{destroy:void 0},a,n===void 0?null:n)}function Gs(e,t,a,n){var s=Ve();n=n===void 0?null:n;var i=s.memoizedState.inst;Me!==null&&n!==null&&Hi(n,Me.memoizedState.deps)?s.memoizedState=_l(t,i,a,n):(me.flags|=e,s.memoizedState=_l(1|t,i,a,n))}function bd(e,t){Ys(8390656,8,e,t)}function Ki(e,t){Gs(2048,8,e,t)}function hh(e){me.flags|=4;var t=me.updateQueue;if(t===null)t=Bs(),me.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function jd(e){var t=Ve().memoizedState;return hh({ref:t,nextImpl:e}),function(){if((we&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function Nd(e,t){return Gs(4,2,e,t)}function Sd(e,t){return Gs(4,4,e,t)}function wd(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ed(e,t,a){a=a!=null?a.concat([e]):null,Gs(4,4,wd.bind(null,t,e),a)}function Ji(){}function Cd(e,t){var a=Ve();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&Hi(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function Td(e,t){var a=Ve();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&Hi(t,n[1]))return n[0];if(n=e(),ll){ga(!0);try{e()}finally{ga(!1)}}return a.memoizedState=[n,t],n}function Wi(e,t,a){return a===void 0||(aa&1073741824)!==0&&(ve&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Rf(),me.lanes|=e,Ma|=e,a)}function Ad(e,t,a,n){return yt(a,t)?a:Ml.current!==null?(e=Wi(e,a,n),yt(e,t)||(Ke=!0),e):(aa&42)===0||(aa&1073741824)!==0&&(ve&261930)===0?(Ke=!0,e.memoizedState=a):(e=Rf(),me.lanes|=e,Ma|=e,t)}function Rd(e,t,a,n,s){var i=Q.p;Q.p=i!==0&&8>i?i:8;var f=R.T,g={};R.T=g,Ii(e,!1,t,a);try{var E=s(),L=R.S;if(L!==null&&L(g,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var Y=uh(E,n);Cn(e,t,Y,wt(e))}else Cn(e,t,n,wt(e))}catch(V){Cn(e,t,{then:function(){},status:"rejected",reason:V},wt())}finally{Q.p=i,f!==null&&g.types!==null&&(f.types=g.types),R.T=f}}function gh(){}function Fi(e,t,a,n){if(e.tag!==5)throw Error(c(476));var s=Md(e).queue;Rd(e,s,t,ne,a===null?gh:function(){return Dd(e),a(n)})}function Md(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:la,lastRenderedState:ne},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:la,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Dd(e){var t=Md(e);t.next===null&&(t=e.alternate.memoizedState),Cn(e,t.next.queue,{},wt())}function Pi(){return lt(Gn)}function kd(){return Ve().memoizedState}function _d(){return Ve().memoizedState}function ph(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=wt();e=wa(a);var n=Ea(t,e,a);n!==null&&(mt(n,t,a),jn(n,t,a)),t={cache:Ti()},e.payload=t;return}t=t.return}}function yh(e,t,a){var n=wt();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Vs(e)?zd(t,a):(a=gi(e,t,a,n),a!==null&&(mt(a,e,n),Ld(a,t,n)))}function Od(e,t,a){var n=wt();Cn(e,t,a,n)}function Cn(e,t,a,n){var s={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Vs(e))zd(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var f=t.lastRenderedState,g=i(f,a);if(s.hasEagerState=!0,s.eagerState=g,yt(g,f))return ws(e,t,s,0),_e===null&&Ss(),!1}catch{}if(a=gi(e,t,s,n),a!==null)return mt(a,e,n),Ld(a,t,n),!0}return!1}function Ii(e,t,a,n){if(n={lane:2,revertLane:Dc(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Vs(e)){if(t)throw Error(c(479))}else t=gi(e,a,n,2),t!==null&&mt(t,e,2)}function Vs(e){var t=e.alternate;return e===me||t!==null&&t===me}function zd(e,t){Dl=Us=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ld(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,qo(e,a)}}var Tn={readContext:lt,use:$s,useCallback:Be,useContext:Be,useEffect:Be,useImperativeHandle:Be,useLayoutEffect:Be,useInsertionEffect:Be,useMemo:Be,useReducer:Be,useRef:Be,useState:Be,useDebugValue:Be,useDeferredValue:Be,useTransition:Be,useSyncExternalStore:Be,useId:Be,useHostTransitionStatus:Be,useFormState:Be,useActionState:Be,useOptimistic:Be,useMemoCache:Be,useCacheRefresh:Be};Tn.useEffectEvent=Be;var Ud={readContext:lt,use:$s,useCallback:function(e,t){return it().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:bd,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ys(4194308,4,wd.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ys(4194308,4,e,t)},useInsertionEffect:function(e,t){Ys(4,2,e,t)},useMemo:function(e,t){var a=it();t=t===void 0?null:t;var n=e();if(ll){ga(!0);try{e()}finally{ga(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=it();if(a!==void 0){var s=a(t);if(ll){ga(!0);try{a(t)}finally{ga(!1)}}}else s=t;return n.memoizedState=n.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},n.queue=e,e=e.dispatch=yh.bind(null,me,e),[n.memoizedState,e]},useRef:function(e){var t=it();return e={current:e},t.memoizedState=e},useState:function(e){e=Xi(e);var t=e.queue,a=Od.bind(null,me,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Ji,useDeferredValue:function(e,t){var a=it();return Wi(a,e,t)},useTransition:function(){var e=Xi(!1);return e=Rd.bind(null,me,e.queue,!0,!1),it().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=me,s=it();if(je){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),_e===null)throw Error(c(349));(ve&127)!==0||nd(n,t,a)}s.memoizedState=a;var i={value:a,getSnapshot:t};return s.queue=i,bd(rd.bind(null,n,i,e),[e]),n.flags|=2048,_l(9,{destroy:void 0},sd.bind(null,n,i,a,t),null),a},useId:function(){var e=it(),t=_e.identifierPrefix;if(je){var a=Qt,n=Vt;a=(n&~(1<<32-pt(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Hs++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=dh++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Pi,useFormState:hd,useActionState:hd,useOptimistic:function(e){var t=it();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Ii.bind(null,me,!0,a),a.dispatch=t,[e,t]},useMemoCache:Gi,useCacheRefresh:function(){return it().memoizedState=ph.bind(null,me)},useEffectEvent:function(e){var t=it(),a={impl:e};return t.memoizedState=a,function(){if((we&2)!==0)throw Error(c(440));return a.impl.apply(void 0,arguments)}}},ec={readContext:lt,use:$s,useCallback:Cd,useContext:lt,useEffect:Ki,useImperativeHandle:Ed,useInsertionEffect:Nd,useLayoutEffect:Sd,useMemo:Td,useReducer:qs,useRef:vd,useState:function(){return qs(la)},useDebugValue:Ji,useDeferredValue:function(e,t){var a=Ve();return Ad(a,Me.memoizedState,e,t)},useTransition:function(){var e=qs(la)[0],t=Ve().memoizedState;return[typeof e=="boolean"?e:En(e),t]},useSyncExternalStore:ld,useId:kd,useHostTransitionStatus:Pi,useFormState:gd,useActionState:gd,useOptimistic:function(e,t){var a=Ve();return od(a,Me,e,t)},useMemoCache:Gi,useCacheRefresh:_d};ec.useEffectEvent=jd;var Hd={readContext:lt,use:$s,useCallback:Cd,useContext:lt,useEffect:Ki,useImperativeHandle:Ed,useInsertionEffect:Nd,useLayoutEffect:Sd,useMemo:Td,useReducer:Qi,useRef:vd,useState:function(){return Qi(la)},useDebugValue:Ji,useDeferredValue:function(e,t){var a=Ve();return Me===null?Wi(a,e,t):Ad(a,Me.memoizedState,e,t)},useTransition:function(){var e=Qi(la)[0],t=Ve().memoizedState;return[typeof e=="boolean"?e:En(e),t]},useSyncExternalStore:ld,useId:kd,useHostTransitionStatus:Pi,useFormState:yd,useActionState:yd,useOptimistic:function(e,t){var a=Ve();return Me!==null?od(a,Me,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Gi,useCacheRefresh:_d};Hd.useEffectEvent=jd;function tc(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:v({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var ac={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=wt(),s=wa(n);s.payload=t,a!=null&&(s.callback=a),t=Ea(e,s,n),t!==null&&(mt(t,e,n),jn(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=wt(),s=wa(n);s.tag=1,s.payload=t,a!=null&&(s.callback=a),t=Ea(e,s,n),t!==null&&(mt(t,e,n),jn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=wt(),n=wa(a);n.tag=2,t!=null&&(n.callback=t),t=Ea(e,n,a),t!==null&&(mt(t,e,a),jn(t,e,a))}};function Bd(e,t,a,n,s,i,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,f):t.prototype&&t.prototype.isPureReactComponent?!xn(a,n)||!xn(s,i):!0}function $d(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&ac.enqueueReplaceState(t,t.state,null)}function nl(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=v({},a));for(var s in e)a[s]===void 0&&(a[s]=e[s])}return a}function qd(e){Ns(e)}function Yd(e){console.error(e)}function Gd(e){Ns(e)}function Qs(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Vd(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function lc(e,t,a){return a=wa(a),a.tag=3,a.payload={element:null},a.callback=function(){Qs(e,t)},a}function Qd(e){return e=wa(e),e.tag=3,e}function Xd(e,t,a,n){var s=a.type.getDerivedStateFromError;if(typeof s=="function"){var i=n.value;e.payload=function(){return s(i)},e.callback=function(){Vd(t,a,n)}}var f=a.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Vd(t,a,n),typeof s!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var g=n.stack;this.componentDidCatch(n.value,{componentStack:g!==null?g:""})})}function vh(e,t,a,n,s){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&El(t,a,s,!0),a=bt.current,a!==null){switch(a.tag){case 31:case 13:return kt===null?lr():a.alternate===null&&$e===0&&($e=3),a.flags&=-257,a.flags|=65536,a.lanes=s,n===ks?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),Ac(e,n,s)),!1;case 22:return a.flags|=65536,n===ks?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),Ac(e,n,s)),!1}throw Error(c(435,a.tag))}return Ac(e,n,s),lr(),!1}if(je)return t=bt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==Ni&&(e=Error(c(422),{cause:n}),gn(At(e,a)))):(n!==Ni&&(t=Error(c(423),{cause:n}),gn(At(t,a))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,n=At(n,a),s=lc(e.stateNode,n,s),_i(e,s),$e!==4&&($e=2)),!1;var i=Error(c(520),{cause:n});if(i=At(i,a),zn===null?zn=[i]:zn.push(i),$e!==4&&($e=2),t===null)return!0;n=At(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=s&-s,a.lanes|=e,e=lc(a.stateNode,n,e),_i(a,e),!1;case 1:if(t=a.type,i=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Da===null||!Da.has(i))))return a.flags|=65536,s&=-s,a.lanes|=s,s=Qd(s),Xd(s,e,a,n),_i(a,s),!1}a=a.return}while(a!==null);return!1}var nc=Error(c(461)),Ke=!1;function nt(e,t,a,n){t.child=e===null?Wu(t,null,a,n):al(t,e.child,a,n)}function Zd(e,t,a,n,s){a=a.render;var i=t.ref;if("ref"in n){var f={};for(var g in n)g!=="ref"&&(f[g]=n[g])}else f=n;return Pa(t),n=Bi(e,t,a,f,i,s),g=$i(),e!==null&&!Ke?(qi(e,t,s),na(e,t,s)):(je&&g&&bi(t),t.flags|=1,nt(e,t,n,s),t.child)}function Kd(e,t,a,n,s){if(e===null){var i=a.type;return typeof i=="function"&&!pi(i)&&i.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=i,Jd(e,t,i,n,s)):(e=Cs(a.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!fc(e,s)){var f=i.memoizedProps;if(a=a.compare,a=a!==null?a:xn,a(f,n)&&e.ref===t.ref)return na(e,t,s)}return t.flags|=1,e=Pt(i,n),e.ref=t.ref,e.return=t,t.child=e}function Jd(e,t,a,n,s){if(e!==null){var i=e.memoizedProps;if(xn(i,n)&&e.ref===t.ref)if(Ke=!1,t.pendingProps=n=i,fc(e,s))(e.flags&131072)!==0&&(Ke=!0);else return t.lanes=e.lanes,na(e,t,s)}return sc(e,t,a,n,s)}function Wd(e,t,a,n){var s=n.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|a:a,e!==null){for(n=t.child=e.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~i}else n=0,t.child=null;return Fd(e,t,i,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ms(t,i!==null?i.cachePool:null),i!==null?Iu(t,i):zi(),ed(t);else return n=t.lanes=536870912,Fd(e,t,i!==null?i.baseLanes|a:a,a,n)}else i!==null?(Ms(t,i.cachePool),Iu(t,i),Ta(),t.memoizedState=null):(e!==null&&Ms(t,null),zi(),Ta());return nt(e,t,s,a),t.child}function An(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Fd(e,t,a,n,s){var i=Ri();return i=i===null?null:{parent:Xe._currentValue,pool:i},t.memoizedState={baseLanes:a,cachePool:i},e!==null&&Ms(t,null),zi(),ed(t),e!==null&&El(e,t,n,!0),t.childLanes=s,null}function Xs(e,t){return t=Ks({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Pd(e,t,a){return al(t,e.child,null,a),e=Xs(t,t.pendingProps),e.flags|=2,jt(t),t.memoizedState=null,e}function bh(e,t,a){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(je){if(n.mode==="hidden")return e=Xs(t,n),t.lanes=536870912,An(null,e);if(Ui(t),(e=ze)?(e=d0(e,Dt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:va!==null?{id:Vt,overflow:Qt}:null,retryLane:536870912,hydrationErrors:null},a=zu(e),a.return=t,t.child=a,at=t,ze=null)):e=null,e===null)throw ja(t);return t.lanes=536870912,null}return Xs(t,n)}var i=e.memoizedState;if(i!==null){var f=i.dehydrated;if(Ui(t),s)if(t.flags&256)t.flags&=-257,t=Pd(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Ke||El(e,t,a,!1),s=(a&e.childLanes)!==0,Ke||s){if(n=_e,n!==null&&(f=Yo(n,a),f!==0&&f!==i.retryLane))throw i.retryLane=f,Ka(e,f),mt(n,e,f),nc;lr(),t=Pd(e,t,a)}else e=i.treeContext,ze=_t(f.nextSibling),at=t,je=!0,ba=null,Dt=!1,e!==null&&Hu(t,e),t=Xs(t,n),t.flags|=4096;return t}return e=Pt(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Zs(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(c(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function sc(e,t,a,n,s){return Pa(t),a=Bi(e,t,a,n,void 0,s),n=$i(),e!==null&&!Ke?(qi(e,t,s),na(e,t,s)):(je&&n&&bi(t),t.flags|=1,nt(e,t,a,s),t.child)}function Id(e,t,a,n,s,i){return Pa(t),t.updateQueue=null,a=ad(t,n,a,s),td(e),n=$i(),e!==null&&!Ke?(qi(e,t,i),na(e,t,i)):(je&&n&&bi(t),t.flags|=1,nt(e,t,a,i),t.child)}function ef(e,t,a,n,s){if(Pa(t),t.stateNode===null){var i=jl,f=a.contextType;typeof f=="object"&&f!==null&&(i=lt(f)),i=new a(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=ac,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},Di(t),f=a.contextType,i.context=typeof f=="object"&&f!==null?lt(f):jl,i.state=t.memoizedState,f=a.getDerivedStateFromProps,typeof f=="function"&&(tc(t,a,f,n),i.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(f=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),f!==i.state&&ac.enqueueReplaceState(i,i.state,null),Sn(t,n,i,s),Nn(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var g=t.memoizedProps,E=nl(a,g);i.props=E;var L=i.context,Y=a.contextType;f=jl,typeof Y=="object"&&Y!==null&&(f=lt(Y));var V=a.getDerivedStateFromProps;Y=typeof V=="function"||typeof i.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,Y||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(g||L!==f)&&$d(t,i,n,f),Sa=!1;var H=t.memoizedState;i.state=H,Sn(t,n,i,s),Nn(),L=t.memoizedState,g||H!==L||Sa?(typeof V=="function"&&(tc(t,a,V,n),L=t.memoizedState),(E=Sa||Bd(t,a,E,n,H,L,f))?(Y||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=L),i.props=n,i.state=L,i.context=f,n=E):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,ki(e,t),f=t.memoizedProps,Y=nl(a,f),i.props=Y,V=t.pendingProps,H=i.context,L=a.contextType,E=jl,typeof L=="object"&&L!==null&&(E=lt(L)),g=a.getDerivedStateFromProps,(L=typeof g=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(f!==V||H!==E)&&$d(t,i,n,E),Sa=!1,H=t.memoizedState,i.state=H,Sn(t,n,i,s),Nn();var B=t.memoizedState;f!==V||H!==B||Sa||e!==null&&e.dependencies!==null&&As(e.dependencies)?(typeof g=="function"&&(tc(t,a,g,n),B=t.memoizedState),(Y=Sa||Bd(t,a,Y,n,H,B,E)||e!==null&&e.dependencies!==null&&As(e.dependencies))?(L||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,B,E),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,B,E)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=B),i.props=n,i.state=B,i.context=E,n=Y):(typeof i.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Zs(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=al(t,e.child,null,s),t.child=al(t,null,a,s)):nt(e,t,a,s),t.memoizedState=i.state,e=t.child):e=na(e,t,s),e}function tf(e,t,a,n){return Wa(),t.flags|=256,nt(e,t,a,n),t.child}var rc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ic(e){return{baseLanes:e,cachePool:Vu()}}function cc(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=St),e}function af(e,t,a){var n=t.pendingProps,s=!1,i=(t.flags&128)!==0,f;if((f=i)||(f=e!==null&&e.memoizedState===null?!1:(Ge.current&2)!==0),f&&(s=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(je){if(s?Ca(t):Ta(),(e=ze)?(e=d0(e,Dt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:va!==null?{id:Vt,overflow:Qt}:null,retryLane:536870912,hydrationErrors:null},a=zu(e),a.return=t,t.child=a,at=t,ze=null)):e=null,e===null)throw ja(t);return Vc(e)?t.lanes=32:t.lanes=536870912,null}var g=n.children;return n=n.fallback,s?(Ta(),s=t.mode,g=Ks({mode:"hidden",children:g},s),n=Ja(n,s,a,null),g.return=t,n.return=t,g.sibling=n,t.child=g,n=t.child,n.memoizedState=ic(a),n.childLanes=cc(e,f,a),t.memoizedState=rc,An(null,n)):(Ca(t),oc(t,g))}var E=e.memoizedState;if(E!==null&&(g=E.dehydrated,g!==null)){if(i)t.flags&256?(Ca(t),t.flags&=-257,t=uc(e,t,a)):t.memoizedState!==null?(Ta(),t.child=e.child,t.flags|=128,t=null):(Ta(),g=n.fallback,s=t.mode,n=Ks({mode:"visible",children:n.children},s),g=Ja(g,s,a,null),g.flags|=2,n.return=t,g.return=t,n.sibling=g,t.child=n,al(t,e.child,null,a),n=t.child,n.memoizedState=ic(a),n.childLanes=cc(e,f,a),t.memoizedState=rc,t=An(null,n));else if(Ca(t),Vc(g)){if(f=g.nextSibling&&g.nextSibling.dataset,f)var L=f.dgst;f=L,n=Error(c(419)),n.stack="",n.digest=f,gn({value:n,source:null,stack:null}),t=uc(e,t,a)}else if(Ke||El(e,t,a,!1),f=(a&e.childLanes)!==0,Ke||f){if(f=_e,f!==null&&(n=Yo(f,a),n!==0&&n!==E.retryLane))throw E.retryLane=n,Ka(e,n),mt(f,e,n),nc;Gc(g)||lr(),t=uc(e,t,a)}else Gc(g)?(t.flags|=192,t.child=e.child,t=null):(e=E.treeContext,ze=_t(g.nextSibling),at=t,je=!0,ba=null,Dt=!1,e!==null&&Hu(t,e),t=oc(t,n.children),t.flags|=4096);return t}return s?(Ta(),g=n.fallback,s=t.mode,E=e.child,L=E.sibling,n=Pt(E,{mode:"hidden",children:n.children}),n.subtreeFlags=E.subtreeFlags&65011712,L!==null?g=Pt(L,g):(g=Ja(g,s,a,null),g.flags|=2),g.return=t,n.return=t,n.sibling=g,t.child=n,An(null,n),n=t.child,g=e.child.memoizedState,g===null?g=ic(a):(s=g.cachePool,s!==null?(E=Xe._currentValue,s=s.parent!==E?{parent:E,pool:E}:s):s=Vu(),g={baseLanes:g.baseLanes|a,cachePool:s}),n.memoizedState=g,n.childLanes=cc(e,f,a),t.memoizedState=rc,An(e.child,n)):(Ca(t),a=e.child,e=a.sibling,a=Pt(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=a,t.memoizedState=null,a)}function oc(e,t){return t=Ks({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ks(e,t){return e=vt(22,e,null,t),e.lanes=0,e}function uc(e,t,a){return al(t,e.child,null,a),e=oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lf(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Ei(e.return,t,a)}function dc(e,t,a,n,s,i){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:s,treeForkCount:i}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=n,f.tail=a,f.tailMode=s,f.treeForkCount=i)}function nf(e,t,a){var n=t.pendingProps,s=n.revealOrder,i=n.tail;n=n.children;var f=Ge.current,g=(f&2)!==0;if(g?(f=f&1|2,t.flags|=128):f&=1,K(Ge,f),nt(e,t,n,a),n=je?hn:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lf(e,a,t);else if(e.tag===19)lf(e,a,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}switch(s){case"forwards":for(a=t.child,s=null;a!==null;)e=a.alternate,e!==null&&Ls(e)===null&&(s=a),a=a.sibling;a=s,a===null?(s=t.child,t.child=null):(s=a.sibling,a.sibling=null),dc(t,!1,s,a,i,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Ls(e)===null){t.child=s;break}e=s.sibling,s.sibling=a,a=s,s=e}dc(t,!0,a,null,i,n);break;case"together":dc(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function na(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ma|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(El(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,a=Pt(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Pt(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function fc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&As(e)))}function jh(e,t,a){switch(t.tag){case 3:We(t,t.stateNode.containerInfo),Na(t,Xe,e.memoizedState.cache),Wa();break;case 27:case 5:Il(t);break;case 4:We(t,t.stateNode.containerInfo);break;case 10:Na(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ui(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Ca(t),t.flags|=128,null):(a&t.child.childLanes)!==0?af(e,t,a):(Ca(t),e=na(e,t,a),e!==null?e.sibling:null);Ca(t);break;case 19:var s=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(El(e,t,a,!1),n=(a&t.childLanes)!==0),s){if(n)return nf(e,t,a);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),K(Ge,Ge.current),n)break;return null;case 22:return t.lanes=0,Wd(e,t,a,t.pendingProps);case 24:Na(t,Xe,e.memoizedState.cache)}return na(e,t,a)}function sf(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ke=!0;else{if(!fc(e,a)&&(t.flags&128)===0)return Ke=!1,jh(e,t,a);Ke=(e.flags&131072)!==0}else Ke=!1,je&&(t.flags&1048576)!==0&&Uu(t,hn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=el(t.elementType),t.type=e,typeof e=="function")pi(e)?(n=nl(e,n),t.tag=1,t=ef(null,t,e,n,a)):(t.tag=0,t=sc(null,t,e,n,a));else{if(e!=null){var s=e.$$typeof;if(s===F){t.tag=11,t=Zd(null,t,e,n,a);break e}else if(s===W){t.tag=14,t=Kd(null,t,e,n,a);break e}}throw t=Ce(e)||e,Error(c(306,t,""))}}return t;case 0:return sc(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,s=nl(n,t.pendingProps),ef(e,t,n,s,a);case 3:e:{if(We(t,t.stateNode.containerInfo),e===null)throw Error(c(387));n=t.pendingProps;var i=t.memoizedState;s=i.element,ki(e,t),Sn(t,n,null,a);var f=t.memoizedState;if(n=f.cache,Na(t,Xe,n),n!==i.cache&&Ci(t,[Xe],a,!0),Nn(),n=f.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=tf(e,t,n,a);break e}else if(n!==s){s=At(Error(c(424)),t),gn(s),t=tf(e,t,n,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,ze=_t(e.firstChild),at=t,je=!0,ba=null,Dt=!0,a=Wu(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Wa(),n===s){t=na(e,t,a);break e}nt(e,t,n,a)}t=t.child}return t;case 26:return Zs(e,t),e===null?(a=p0(t.type,null,t.pendingProps,null))?t.memoizedState=a:je||(a=t.type,e=t.pendingProps,n=ur(ge.current).createElement(a),n[tt]=t,n[ct]=e,st(n,a,e),Pe(n),t.stateNode=n):t.memoizedState=p0(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Il(t),e===null&&je&&(n=t.stateNode=m0(t.type,t.pendingProps,ge.current),at=t,Dt=!0,s=ze,za(t.type)?(Qc=s,ze=_t(n.firstChild)):ze=s),nt(e,t,t.pendingProps.children,a),Zs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&je&&((s=n=ze)&&(n=Fh(n,t.type,t.pendingProps,Dt),n!==null?(t.stateNode=n,at=t,ze=_t(n.firstChild),Dt=!1,s=!0):s=!1),s||ja(t)),Il(t),s=t.type,i=t.pendingProps,f=e!==null?e.memoizedProps:null,n=i.children,$c(s,i)?n=null:f!==null&&$c(s,f)&&(t.flags|=32),t.memoizedState!==null&&(s=Bi(e,t,fh,null,null,a),Gn._currentValue=s),Zs(e,t),nt(e,t,n,a),t.child;case 6:return e===null&&je&&((e=a=ze)&&(a=Ph(a,t.pendingProps,Dt),a!==null?(t.stateNode=a,at=t,ze=null,e=!0):e=!1),e||ja(t)),null;case 13:return af(e,t,a);case 4:return We(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=al(t,null,n,a):nt(e,t,n,a),t.child;case 11:return Zd(e,t,t.type,t.pendingProps,a);case 7:return nt(e,t,t.pendingProps,a),t.child;case 8:return nt(e,t,t.pendingProps.children,a),t.child;case 12:return nt(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,Na(t,t.type,n.value),nt(e,t,n.children,a),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,Pa(t),s=lt(s),n=n(s),t.flags|=1,nt(e,t,n,a),t.child;case 14:return Kd(e,t,t.type,t.pendingProps,a);case 15:return Jd(e,t,t.type,t.pendingProps,a);case 19:return nf(e,t,a);case 31:return bh(e,t,a);case 22:return Wd(e,t,a,t.pendingProps);case 24:return Pa(t),n=lt(Xe),e===null?(s=Ri(),s===null&&(s=_e,i=Ti(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=a),s=i),t.memoizedState={parent:n,cache:s},Di(t),Na(t,Xe,s)):((e.lanes&a)!==0&&(ki(e,t),Sn(t,null,null,a),Nn()),s=e.memoizedState,i=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Na(t,Xe,n)):(n=i.cache,Na(t,Xe,n),n!==s.cache&&Ci(t,[Xe],a,!0))),nt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function sa(e){e.flags|=4}function xc(e,t,a,n,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(_f())e.flags|=8192;else throw tl=ks,Mi}else e.flags&=-16777217}function rf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!N0(t))if(_f())e.flags|=8192;else throw tl=ks,Mi}function Js(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Bo():536870912,e.lanes|=t,Ul|=t)}function Rn(e,t){if(!je)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Le(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function Nh(e,t,a){var n=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Le(t),null;case 1:return Le(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ta(Xe),Ye(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(wl(t)?sa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Si())),Le(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(sa(t),i!==null?(Le(t),rf(t,i)):(Le(t),xc(t,s,null,n,a))):i?i!==e.memoizedState?(sa(t),Le(t),rf(t,i)):(Le(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&sa(t),Le(t),xc(t,s,e,n,a)),null;case 27:if(rs(t),a=ge.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&sa(t);else{if(!n){if(t.stateNode===null)throw Error(c(166));return Le(t),null}e=ae.current,wl(t)?Bu(t):(e=m0(s,n,a),t.stateNode=e,sa(t))}return Le(t),null;case 5:if(rs(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&sa(t);else{if(!n){if(t.stateNode===null)throw Error(c(166));return Le(t),null}if(i=ae.current,wl(t))Bu(t);else{var f=ur(ge.current);switch(i){case 1:i=f.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=f.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=f.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?f.createElement("select",{is:n.is}):f.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?f.createElement(s,{is:n.is}):f.createElement(s)}}i[tt]=t,i[ct]=n;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=i;e:switch(st(i,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&sa(t)}}return Le(t),xc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&sa(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(c(166));if(e=ge.current,wl(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,s=at,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}e[tt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||l0(e.nodeValue,a)),e||ja(t,!0)}else e=ur(e).createTextNode(n),e[tt]=t,t.stateNode=e}return Le(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=wl(t),a!==null){if(e===null){if(!n)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[tt]=t}else Wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),e=!1}else a=Si(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(jt(t),t):(jt(t),null);if((t.flags&128)!==0)throw Error(c(558))}return Le(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=wl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(317));s[tt]=t}else Wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),s=!1}else s=Si(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(jt(t),t):(jt(t),null)}return jt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==s&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Js(t,t.updateQueue),Le(t),null);case 4:return Ye(),e===null&&zc(t.stateNode.containerInfo),Le(t),null;case 10:return ta(t.type),Le(t),null;case 19:if($(Ge),n=t.memoizedState,n===null)return Le(t),null;if(s=(t.flags&128)!==0,i=n.rendering,i===null)if(s)Rn(n,!1);else{if($e!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Ls(e),i!==null){for(t.flags|=128,Rn(n,!1),e=i.updateQueue,t.updateQueue=e,Js(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Ou(a,e),a=a.sibling;return K(Ge,Ge.current&1|2),je&&It(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&ht()>er&&(t.flags|=128,s=!0,Rn(n,!1),t.lanes=4194304)}else{if(!s)if(e=Ls(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Js(t,e),Rn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!je)return Le(t),null}else 2*ht()-n.renderingStartTime>er&&a!==536870912&&(t.flags|=128,s=!0,Rn(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=ht(),e.sibling=null,a=Ge.current,K(Ge,s?a&1|2:a&1),je&&It(t,n.treeForkCount),e):(Le(t),null);case 22:case 23:return jt(t),Li(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),a=t.updateQueue,a!==null&&Js(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&$(Ia),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ta(Xe),Le(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Sh(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ta(Xe),Ye(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return rs(t),null;case 31:if(t.memoizedState!==null){if(jt(t),t.alternate===null)throw Error(c(340));Wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $(Ge),null;case 4:return Ye(),null;case 10:return ta(t.type),null;case 22:case 23:return jt(t),Li(),e!==null&&$(Ia),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ta(Xe),null;case 25:return null;default:return null}}function cf(e,t){switch(ji(t),t.tag){case 3:ta(Xe),Ye();break;case 26:case 27:case 5:rs(t);break;case 4:Ye();break;case 31:t.memoizedState!==null&&jt(t);break;case 13:jt(t);break;case 19:$(Ge);break;case 10:ta(t.type);break;case 22:case 23:jt(t),Li(),e!==null&&$(Ia);break;case 24:ta(Xe)}}function Mn(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var s=n.next;a=s;do{if((a.tag&e)===e){n=void 0;var i=a.create,f=a.inst;n=i(),f.destroy=n}a=a.next}while(a!==s)}}catch(g){Ae(t,t.return,g)}}function Aa(e,t,a){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){var f=n.inst,g=f.destroy;if(g!==void 0){f.destroy=void 0,s=t;var E=a,L=g;try{L()}catch(Y){Ae(s,E,Y)}}}n=n.next}while(n!==i)}}catch(Y){Ae(t,t.return,Y)}}function of(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Pu(t,a)}catch(n){Ae(e,e.return,n)}}}function uf(e,t,a){a.props=nl(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Ae(e,t,n)}}function Dn(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(s){Ae(e,t,s)}}function Xt(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(s){Ae(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(s){Ae(e,t,s)}else a.current=null}function df(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(s){Ae(e,e.return,s)}}function mc(e,t,a){try{var n=e.stateNode;Qh(n,e.type,a,t),n[ct]=t}catch(s){Ae(e,e.return,s)}}function ff(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&za(e.type)||e.tag===4}function hc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ff(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&za(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function gc(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Wt));else if(n!==4&&(n===27&&za(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(gc(e,t,a),e=e.sibling;e!==null;)gc(e,t,a),e=e.sibling}function Ws(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&za(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ws(e,t,a),e=e.sibling;e!==null;)Ws(e,t,a),e=e.sibling}function xf(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);st(t,n,a),t[tt]=e,t[ct]=a}catch(i){Ae(e,e.return,i)}}var ra=!1,Je=!1,pc=!1,mf=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function wh(e,t){if(e=e.containerInfo,Hc=pr,e=Eu(e),ui(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var f=0,g=-1,E=-1,L=0,Y=0,V=e,H=null;t:for(;;){for(var B;V!==a||s!==0&&V.nodeType!==3||(g=f+s),V!==i||n!==0&&V.nodeType!==3||(E=f+n),V.nodeType===3&&(f+=V.nodeValue.length),(B=V.firstChild)!==null;)H=V,V=B;for(;;){if(V===e)break t;if(H===a&&++L===s&&(g=f),H===i&&++Y===n&&(E=f),(B=V.nextSibling)!==null)break;V=H,H=V.parentNode}V=B}a=g===-1||E===-1?null:{start:g,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(Bc={focusedElem:e,selectionRange:a},pr=!1,Ie=t;Ie!==null;)if(t=Ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ie=e;else for(;Ie!==null;){switch(t=Ie,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)s=e[a],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,a=t,s=i.memoizedProps,i=i.memoizedState,n=a.stateNode;try{var te=nl(a.type,s);e=n.getSnapshotBeforeUpdate(te,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(oe){Ae(a,a.return,oe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Yc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Yc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=t.sibling,e!==null){e.return=t.return,Ie=e;break}Ie=t.return}}function hf(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:ca(e,a),n&4&&Mn(5,a);break;case 1:if(ca(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(f){Ae(a,a.return,f)}else{var s=nl(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ae(a,a.return,f)}}n&64&&of(a),n&512&&Dn(a,a.return);break;case 3:if(ca(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Pu(e,t)}catch(f){Ae(a,a.return,f)}}break;case 27:t===null&&n&4&&xf(a);case 26:case 5:ca(e,a),t===null&&n&4&&df(a),n&512&&Dn(a,a.return);break;case 12:ca(e,a);break;case 31:ca(e,a),n&4&&yf(e,a);break;case 13:ca(e,a),n&4&&vf(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=_h.bind(null,a),Ih(e,a))));break;case 22:if(n=a.memoizedState!==null||ra,!n){t=t!==null&&t.memoizedState!==null||Je,s=ra;var i=Je;ra=n,(Je=t)&&!i?oa(e,a,(a.subtreeFlags&8772)!==0):ca(e,a),ra=s,Je=i}break;case 30:break;default:ca(e,a)}}function gf(e){var t=e.alternate;t!==null&&(e.alternate=null,gf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Zr(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ue=null,ut=!1;function ia(e,t,a){for(a=a.child;a!==null;)pf(e,t,a),a=a.sibling}function pf(e,t,a){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(en,a)}catch{}switch(a.tag){case 26:Je||Xt(a,t),ia(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Je||Xt(a,t);var n=Ue,s=ut;za(a.type)&&(Ue=a.stateNode,ut=!1),ia(e,t,a),$n(a.stateNode),Ue=n,ut=s;break;case 5:Je||Xt(a,t);case 6:if(n=Ue,s=ut,Ue=null,ia(e,t,a),Ue=n,ut=s,Ue!==null)if(ut)try{(Ue.nodeType===9?Ue.body:Ue.nodeName==="HTML"?Ue.ownerDocument.body:Ue).removeChild(a.stateNode)}catch(i){Ae(a,t,i)}else try{Ue.removeChild(a.stateNode)}catch(i){Ae(a,t,i)}break;case 18:Ue!==null&&(ut?(e=Ue,o0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ql(e)):o0(Ue,a.stateNode));break;case 4:n=Ue,s=ut,Ue=a.stateNode.containerInfo,ut=!0,ia(e,t,a),Ue=n,ut=s;break;case 0:case 11:case 14:case 15:Aa(2,a,t),Je||Aa(4,a,t),ia(e,t,a);break;case 1:Je||(Xt(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&uf(a,t,n)),ia(e,t,a);break;case 21:ia(e,t,a);break;case 22:Je=(n=Je)||a.memoizedState!==null,ia(e,t,a),Je=n;break;default:ia(e,t,a)}}function yf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ql(e)}catch(a){Ae(t,t.return,a)}}}function vf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ql(e)}catch(a){Ae(t,t.return,a)}}function Eh(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new mf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new mf),t;default:throw Error(c(435,e.tag))}}function Fs(e,t){var a=Eh(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var s=Oh.bind(null,e,n);n.then(s,s)}})}function dt(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var s=a[n],i=e,f=t,g=f;e:for(;g!==null;){switch(g.tag){case 27:if(za(g.type)){Ue=g.stateNode,ut=!1;break e}break;case 5:Ue=g.stateNode,ut=!1;break e;case 3:case 4:Ue=g.stateNode.containerInfo,ut=!0;break e}g=g.return}if(Ue===null)throw Error(c(160));pf(i,f,s),Ue=null,ut=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bf(t,e),t=t.sibling}var Ht=null;function bf(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dt(t,e),ft(e),n&4&&(Aa(3,e,e.return),Mn(3,e),Aa(5,e,e.return));break;case 1:dt(t,e),ft(e),n&512&&(Je||a===null||Xt(a,a.return)),n&64&&ra&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var s=Ht;if(dt(t,e),ft(e),n&512&&(Je||a===null||Xt(a,a.return)),n&4){var i=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,s=s.ownerDocument||s;t:switch(n){case"title":i=s.getElementsByTagName("title")[0],(!i||i[ln]||i[tt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(n),s.head.insertBefore(i,s.querySelector("head > title"))),st(i,n,a),i[tt]=e,Pe(i),n=i;break e;case"link":var f=b0("link","href",s).get(n+(a.href||""));if(f){for(var g=0;g<f.length;g++)if(i=f[g],i.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&i.getAttribute("rel")===(a.rel==null?null:a.rel)&&i.getAttribute("title")===(a.title==null?null:a.title)&&i.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(g,1);break t}}i=s.createElement(n),st(i,n,a),s.head.appendChild(i);break;case"meta":if(f=b0("meta","content",s).get(n+(a.content||""))){for(g=0;g<f.length;g++)if(i=f[g],i.getAttribute("content")===(a.content==null?null:""+a.content)&&i.getAttribute("name")===(a.name==null?null:a.name)&&i.getAttribute("property")===(a.property==null?null:a.property)&&i.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&i.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(g,1);break t}}i=s.createElement(n),st(i,n,a),s.head.appendChild(i);break;default:throw Error(c(468,n))}i[tt]=e,Pe(i),n=i}e.stateNode=n}else j0(s,e.type,e.stateNode);else e.stateNode=v0(s,n,e.memoizedProps);else i!==n?(i===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):i.count--,n===null?j0(s,e.type,e.stateNode):v0(s,n,e.memoizedProps)):n===null&&e.stateNode!==null&&mc(e,e.memoizedProps,a.memoizedProps)}break;case 27:dt(t,e),ft(e),n&512&&(Je||a===null||Xt(a,a.return)),a!==null&&n&4&&mc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(dt(t,e),ft(e),n&512&&(Je||a===null||Xt(a,a.return)),e.flags&32){s=e.stateNode;try{ml(s,"")}catch(te){Ae(e,e.return,te)}}n&4&&e.stateNode!=null&&(s=e.memoizedProps,mc(e,s,a!==null?a.memoizedProps:s)),n&1024&&(pc=!0);break;case 6:if(dt(t,e),ft(e),n&4){if(e.stateNode===null)throw Error(c(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(te){Ae(e,e.return,te)}}break;case 3:if(xr=null,s=Ht,Ht=dr(t.containerInfo),dt(t,e),Ht=s,ft(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{Ql(t.containerInfo)}catch(te){Ae(e,e.return,te)}pc&&(pc=!1,jf(e));break;case 4:n=Ht,Ht=dr(e.stateNode.containerInfo),dt(t,e),ft(e),Ht=n;break;case 12:dt(t,e),ft(e);break;case 31:dt(t,e),ft(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Fs(e,n)));break;case 13:dt(t,e),ft(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Is=ht()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Fs(e,n)));break;case 22:s=e.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,L=ra,Y=Je;if(ra=L||s,Je=Y||E,dt(t,e),Je=Y,ra=L,ft(e),n&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(a===null||E||ra||Je||sl(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){E=a=t;try{if(i=E.stateNode,s)f=i.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{g=E.stateNode;var V=E.memoizedProps.style,H=V!=null&&V.hasOwnProperty("display")?V.display:null;g.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(te){Ae(E,E.return,te)}}}else if(t.tag===6){if(a===null){E=t;try{E.stateNode.nodeValue=s?"":E.memoizedProps}catch(te){Ae(E,E.return,te)}}}else if(t.tag===18){if(a===null){E=t;try{var B=E.stateNode;s?u0(B,!0):u0(E.stateNode,!1)}catch(te){Ae(E,E.return,te)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Fs(e,a))));break;case 19:dt(t,e),ft(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Fs(e,n)));break;case 30:break;case 21:break;default:dt(t,e),ft(e)}}function ft(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(ff(n)){a=n;break}n=n.return}if(a==null)throw Error(c(160));switch(a.tag){case 27:var s=a.stateNode,i=hc(e);Ws(e,i,s);break;case 5:var f=a.stateNode;a.flags&32&&(ml(f,""),a.flags&=-33);var g=hc(e);Ws(e,g,f);break;case 3:case 4:var E=a.stateNode.containerInfo,L=hc(e);gc(e,L,E);break;default:throw Error(c(161))}}catch(Y){Ae(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;jf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ca(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)hf(e,t.alternate,t),t=t.sibling}function sl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),sl(t);break;case 1:Xt(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&uf(t,t.return,a),sl(t);break;case 27:$n(t.stateNode);case 26:case 5:Xt(t,t.return),sl(t);break;case 22:t.memoizedState===null&&sl(t);break;case 30:sl(t);break;default:sl(t)}e=e.sibling}}function oa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=e,i=t,f=i.flags;switch(i.tag){case 0:case 11:case 15:oa(s,i,a),Mn(4,i);break;case 1:if(oa(s,i,a),n=i,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(L){Ae(n,n.return,L)}if(n=i,s=n.updateQueue,s!==null){var g=n.stateNode;try{var E=s.shared.hiddenCallbacks;if(E!==null)for(s.shared.hiddenCallbacks=null,s=0;s<E.length;s++)Fu(E[s],g)}catch(L){Ae(n,n.return,L)}}a&&f&64&&of(i),Dn(i,i.return);break;case 27:xf(i);case 26:case 5:oa(s,i,a),a&&n===null&&f&4&&df(i),Dn(i,i.return);break;case 12:oa(s,i,a);break;case 31:oa(s,i,a),a&&f&4&&yf(s,i);break;case 13:oa(s,i,a),a&&f&4&&vf(s,i);break;case 22:i.memoizedState===null&&oa(s,i,a),Dn(i,i.return);break;case 30:break;default:oa(s,i,a)}t=t.sibling}}function yc(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&pn(a))}function vc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&pn(e))}function Bt(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Nf(e,t,a,n),t=t.sibling}function Nf(e,t,a,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Bt(e,t,a,n),s&2048&&Mn(9,t);break;case 1:Bt(e,t,a,n);break;case 3:Bt(e,t,a,n),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&pn(e)));break;case 12:if(s&2048){Bt(e,t,a,n),e=t.stateNode;try{var i=t.memoizedProps,f=i.id,g=i.onPostCommit;typeof g=="function"&&g(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(E){Ae(t,t.return,E)}}else Bt(e,t,a,n);break;case 31:Bt(e,t,a,n);break;case 13:Bt(e,t,a,n);break;case 23:break;case 22:i=t.stateNode,f=t.alternate,t.memoizedState!==null?i._visibility&2?Bt(e,t,a,n):kn(e,t):i._visibility&2?Bt(e,t,a,n):(i._visibility|=2,Ol(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&yc(f,t);break;case 24:Bt(e,t,a,n),s&2048&&vc(t.alternate,t);break;default:Bt(e,t,a,n)}}function Ol(e,t,a,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,f=t,g=a,E=n,L=f.flags;switch(f.tag){case 0:case 11:case 15:Ol(i,f,g,E,s),Mn(8,f);break;case 23:break;case 22:var Y=f.stateNode;f.memoizedState!==null?Y._visibility&2?Ol(i,f,g,E,s):kn(i,f):(Y._visibility|=2,Ol(i,f,g,E,s)),s&&L&2048&&yc(f.alternate,f);break;case 24:Ol(i,f,g,E,s),s&&L&2048&&vc(f.alternate,f);break;default:Ol(i,f,g,E,s)}t=t.sibling}}function kn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,s=n.flags;switch(n.tag){case 22:kn(a,n),s&2048&&yc(n.alternate,n);break;case 24:kn(a,n),s&2048&&vc(n.alternate,n);break;default:kn(a,n)}t=t.sibling}}var _n=8192;function zl(e,t,a){if(e.subtreeFlags&_n)for(e=e.child;e!==null;)Sf(e,t,a),e=e.sibling}function Sf(e,t,a){switch(e.tag){case 26:zl(e,t,a),e.flags&_n&&e.memoizedState!==null&&dg(a,Ht,e.memoizedState,e.memoizedProps);break;case 5:zl(e,t,a);break;case 3:case 4:var n=Ht;Ht=dr(e.stateNode.containerInfo),zl(e,t,a),Ht=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=_n,_n=16777216,zl(e,t,a),_n=n):zl(e,t,a));break;default:zl(e,t,a)}}function wf(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function On(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Ie=n,Cf(n,e)}wf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ef(e),e=e.sibling}function Ef(e){switch(e.tag){case 0:case 11:case 15:On(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:On(e);break;case 12:On(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ps(e)):On(e);break;default:On(e)}}function Ps(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Ie=n,Cf(n,e)}wf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),Ps(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ps(t));break;default:Ps(t)}e=e.sibling}}function Cf(e,t){for(;Ie!==null;){var a=Ie;switch(a.tag){case 0:case 11:case 15:Aa(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:pn(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,Ie=n;else e:for(a=e;Ie!==null;){n=Ie;var s=n.sibling,i=n.return;if(gf(n),n===a){Ie=null;break e}if(s!==null){s.return=i,Ie=s;break e}Ie=i}}}var Ch={getCacheForType:function(e){var t=lt(Xe),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return lt(Xe).controller.signal}},Th=typeof WeakMap=="function"?WeakMap:Map,we=0,_e=null,pe=null,ve=0,Te=0,Nt=null,Ra=!1,Ll=!1,bc=!1,ua=0,$e=0,Ma=0,rl=0,jc=0,St=0,Ul=0,zn=null,xt=null,Nc=!1,Is=0,Tf=0,er=1/0,tr=null,Da=null,Fe=0,ka=null,Hl=null,da=0,Sc=0,wc=null,Af=null,Ln=0,Ec=null;function wt(){return(we&2)!==0&&ve!==0?ve&-ve:R.T!==null?Dc():Go()}function Rf(){if(St===0)if((ve&536870912)===0||je){var e=os;os<<=1,(os&3932160)===0&&(os=262144),St=e}else St=536870912;return e=bt.current,e!==null&&(e.flags|=32),St}function mt(e,t,a){(e===_e&&(Te===2||Te===9)||e.cancelPendingCommit!==null)&&(Bl(e,0),_a(e,ve,St,!1)),an(e,a),((we&2)===0||e!==_e)&&(e===_e&&((we&2)===0&&(rl|=a),$e===4&&_a(e,ve,St,!1)),Zt(e))}function Mf(e,t,a){if((we&6)!==0)throw Error(c(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||tn(e,t),s=n?Mh(e,t):Tc(e,t,!0),i=n;do{if(s===0){Ll&&!n&&_a(e,t,0,!1);break}else{if(a=e.current.alternate,i&&!Ah(a)){s=Tc(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var g=e;s=zn;var E=g.current.memoizedState.isDehydrated;if(E&&(Bl(g,f).flags|=256),f=Tc(g,f,!1),f!==2){if(bc&&!E){g.errorRecoveryDisabledLanes|=i,rl|=i,s=4;break e}i=xt,xt=s,i!==null&&(xt===null?xt=i:xt.push.apply(xt,i))}s=f}if(i=!1,s!==2)continue}}if(s===1){Bl(e,0),_a(e,t,0,!0);break}e:{switch(n=e,i=s,i){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:_a(n,t,St,!Ra);break e;case 2:xt=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(s=Is+300-ht(),10<s)){if(_a(n,t,St,!Ra),ds(n,0,!0)!==0)break e;da=t,n.timeoutHandle=i0(Df.bind(null,n,a,xt,tr,Nc,t,St,rl,Ul,Ra,i,"Throttled",-0,0),s);break e}Df(n,a,xt,tr,Nc,t,St,rl,Ul,Ra,i,null,-0,0)}}break}while(!0);Zt(e)}function Df(e,t,a,n,s,i,f,g,E,L,Y,V,H,B){if(e.timeoutHandle=-1,V=t.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wt},Sf(t,i,V);var te=(i&62914560)===i?Is-ht():(i&4194048)===i?Tf-ht():0;if(te=fg(V,te),te!==null){da=i,e.cancelPendingCommit=te(Bf.bind(null,e,t,i,a,n,s,f,g,E,Y,V,null,H,B)),_a(e,i,f,!L);return}}Bf(e,t,i,a,n,s,f,g,E)}function Ah(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var s=a[n],i=s.getSnapshot;s=s.value;try{if(!yt(i(),s))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 _a(e,t,a,n){t&=~jc,t&=~rl,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var s=t;0<s;){var i=31-pt(s),f=1<<i;n[i]=-1,s&=~f}a!==0&&$o(e,a,t)}function ar(){return(we&6)===0?(Un(0),!1):!0}function Cc(){if(pe!==null){if(Te===0)var e=pe.return;else e=pe,ea=Fa=null,Yi(e),Rl=null,vn=0,e=pe;for(;e!==null;)cf(e.alternate,e),e=e.return;pe=null}}function Bl(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Kh(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),da=0,Cc(),_e=e,pe=a=Pt(e.current,null),ve=t,Te=0,Nt=null,Ra=!1,Ll=tn(e,t),bc=!1,Ul=St=jc=rl=Ma=$e=0,xt=zn=null,Nc=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var s=31-pt(n),i=1<<s;t|=e[s],n&=~i}return ua=t,Ss(),a}function kf(e,t){me=null,R.H=Tn,t===Al||t===Ds?(t=Zu(),Te=3):t===Mi?(t=Zu(),Te=4):Te=t===nc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Nt=t,pe===null&&($e=1,Qs(e,At(t,e.current)))}function _f(){var e=bt.current;return e===null?!0:(ve&4194048)===ve?kt===null:(ve&62914560)===ve||(ve&536870912)!==0?e===kt:!1}function Of(){var e=R.H;return R.H=Tn,e===null?Tn:e}function zf(){var e=R.A;return R.A=Ch,e}function lr(){$e=4,Ra||(ve&4194048)!==ve&&bt.current!==null||(Ll=!0),(Ma&134217727)===0&&(rl&134217727)===0||_e===null||_a(_e,ve,St,!1)}function Tc(e,t,a){var n=we;we|=2;var s=Of(),i=zf();(_e!==e||ve!==t)&&(tr=null,Bl(e,t)),t=!1;var f=$e;e:do try{if(Te!==0&&pe!==null){var g=pe,E=Nt;switch(Te){case 8:Cc(),f=6;break e;case 3:case 2:case 9:case 6:bt.current===null&&(t=!0);var L=Te;if(Te=0,Nt=null,$l(e,g,E,L),a&&Ll){f=0;break e}break;default:L=Te,Te=0,Nt=null,$l(e,g,E,L)}}Rh(),f=$e;break}catch(Y){kf(e,Y)}while(!0);return t&&e.shellSuspendCounter++,ea=Fa=null,we=n,R.H=s,R.A=i,pe===null&&(_e=null,ve=0,Ss()),f}function Rh(){for(;pe!==null;)Lf(pe)}function Mh(e,t){var a=we;we|=2;var n=Of(),s=zf();_e!==e||ve!==t?(tr=null,er=ht()+500,Bl(e,t)):Ll=tn(e,t);e:do try{if(Te!==0&&pe!==null){t=pe;var i=Nt;t:switch(Te){case 1:Te=0,Nt=null,$l(e,t,i,1);break;case 2:case 9:if(Qu(i)){Te=0,Nt=null,Uf(t);break}t=function(){Te!==2&&Te!==9||_e!==e||(Te=7),Zt(e)},i.then(t,t);break e;case 3:Te=7;break e;case 4:Te=5;break e;case 7:Qu(i)?(Te=0,Nt=null,Uf(t)):(Te=0,Nt=null,$l(e,t,i,7));break;case 5:var f=null;switch(pe.tag){case 26:f=pe.memoizedState;case 5:case 27:var g=pe;if(f?N0(f):g.stateNode.complete){Te=0,Nt=null;var E=g.sibling;if(E!==null)pe=E;else{var L=g.return;L!==null?(pe=L,nr(L)):pe=null}break t}}Te=0,Nt=null,$l(e,t,i,5);break;case 6:Te=0,Nt=null,$l(e,t,i,6);break;case 8:Cc(),$e=6;break e;default:throw Error(c(462))}}Dh();break}catch(Y){kf(e,Y)}while(!0);return ea=Fa=null,R.H=n,R.A=s,we=a,pe!==null?0:(_e=null,ve=0,Ss(),$e)}function Dh(){for(;pe!==null&&!em();)Lf(pe)}function Lf(e){var t=sf(e.alternate,e,ua);e.memoizedProps=e.pendingProps,t===null?nr(e):pe=t}function Uf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Id(a,t,t.pendingProps,t.type,void 0,ve);break;case 11:t=Id(a,t,t.pendingProps,t.type.render,t.ref,ve);break;case 5:Yi(t);default:cf(a,t),t=pe=Ou(t,ua),t=sf(a,t,ua)}e.memoizedProps=e.pendingProps,t===null?nr(e):pe=t}function $l(e,t,a,n){ea=Fa=null,Yi(t),Rl=null,vn=0;var s=t.return;try{if(vh(e,s,t,a,ve)){$e=1,Qs(e,At(a,e.current)),pe=null;return}}catch(i){if(s!==null)throw pe=s,i;$e=1,Qs(e,At(a,e.current)),pe=null;return}t.flags&32768?(je||n===1?e=!0:Ll||(ve&536870912)!==0?e=!1:(Ra=e=!0,(n===2||n===9||n===3||n===6)&&(n=bt.current,n!==null&&n.tag===13&&(n.flags|=16384))),Hf(t,e)):nr(t)}function nr(e){var t=e;do{if((t.flags&32768)!==0){Hf(t,Ra);return}e=t.return;var a=Nh(t.alternate,t,ua);if(a!==null){pe=a;return}if(t=t.sibling,t!==null){pe=t;return}pe=t=e}while(t!==null);$e===0&&($e=5)}function Hf(e,t){do{var a=Sh(e.alternate,e);if(a!==null){a.flags&=32767,pe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){pe=e;return}pe=e=a}while(e!==null);$e=6,pe=null}function Bf(e,t,a,n,s,i,f,g,E){e.cancelPendingCommit=null;do sr();while(Fe!==0);if((we&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(i=t.lanes|t.childLanes,i|=hi,um(e,a,i,f,g,E),e===_e&&(pe=_e=null,ve=0),Hl=t,ka=e,da=a,Sc=i,wc=s,Af=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zh(is,function(){return Vf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=R.T,R.T=null,s=Q.p,Q.p=2,f=we,we|=4;try{wh(e,t,a)}finally{we=f,Q.p=s,R.T=n}}Fe=1,$f(),qf(),Yf()}}function $f(){if(Fe===1){Fe=0;var e=ka,t=Hl,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=R.T,R.T=null;var n=Q.p;Q.p=2;var s=we;we|=4;try{bf(t,e);var i=Bc,f=Eu(e.containerInfo),g=i.focusedElem,E=i.selectionRange;if(f!==g&&g&&g.ownerDocument&&wu(g.ownerDocument.documentElement,g)){if(E!==null&&ui(g)){var L=E.start,Y=E.end;if(Y===void 0&&(Y=L),"selectionStart"in g)g.selectionStart=L,g.selectionEnd=Math.min(Y,g.value.length);else{var V=g.ownerDocument||document,H=V&&V.defaultView||window;if(H.getSelection){var B=H.getSelection(),te=g.textContent.length,oe=Math.min(E.start,te),ke=E.end===void 0?oe:Math.min(E.end,te);!B.extend&&oe>ke&&(f=ke,ke=oe,oe=f);var k=Su(g,oe),M=Su(g,ke);if(k&&M&&(B.rangeCount!==1||B.anchorNode!==k.node||B.anchorOffset!==k.offset||B.focusNode!==M.node||B.focusOffset!==M.offset)){var z=V.createRange();z.setStart(k.node,k.offset),B.removeAllRanges(),oe>ke?(B.addRange(z),B.extend(M.node,M.offset)):(z.setEnd(M.node,M.offset),B.addRange(z))}}}}for(V=[],B=g;B=B.parentNode;)B.nodeType===1&&V.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<V.length;g++){var G=V[g];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}pr=!!Hc,Bc=Hc=null}finally{we=s,Q.p=n,R.T=a}}e.current=t,Fe=2}}function qf(){if(Fe===2){Fe=0;var e=ka,t=Hl,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=R.T,R.T=null;var n=Q.p;Q.p=2;var s=we;we|=4;try{hf(e,t.alternate,t)}finally{we=s,Q.p=n,R.T=a}}Fe=3}}function Yf(){if(Fe===4||Fe===3){Fe=0,tm();var e=ka,t=Hl,a=da,n=Af;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Fe=5:(Fe=0,Hl=ka=null,Gf(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Da=null),Qr(a),t=t.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(en,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=R.T,s=Q.p,Q.p=2,R.T=null;try{for(var i=e.onRecoverableError,f=0;f<n.length;f++){var g=n[f];i(g.value,{componentStack:g.stack})}}finally{R.T=t,Q.p=s}}(da&3)!==0&&sr(),Zt(e),s=e.pendingLanes,(a&261930)!==0&&(s&42)!==0?e===Ec?Ln++:(Ln=0,Ec=e):Ln=0,Un(0)}}function Gf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,pn(t)))}function sr(){return $f(),qf(),Yf(),Vf()}function Vf(){if(Fe!==5)return!1;var e=ka,t=Sc;Sc=0;var a=Qr(da),n=R.T,s=Q.p;try{Q.p=32>a?32:a,R.T=null,a=wc,wc=null;var i=ka,f=da;if(Fe=0,Hl=ka=null,da=0,(we&6)!==0)throw Error(c(331));var g=we;if(we|=4,Ef(i.current),Nf(i,i.current,f,a),we=g,Un(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(en,i)}catch{}return!0}finally{Q.p=s,R.T=n,Gf(e,t)}}function Qf(e,t,a){t=At(a,t),t=lc(e.stateNode,t,2),e=Ea(e,t,2),e!==null&&(an(e,2),Zt(e))}function Ae(e,t,a){if(e.tag===3)Qf(e,e,a);else for(;t!==null;){if(t.tag===3){Qf(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Da===null||!Da.has(n))){e=At(a,e),a=Qd(2),n=Ea(t,a,2),n!==null&&(Xd(a,n,t,e),an(n,2),Zt(n));break}}t=t.return}}function Ac(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new Th;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(a)||(bc=!0,s.add(a),e=kh.bind(null,e,t,a),t.then(e,e))}function kh(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,_e===e&&(ve&a)===a&&($e===4||$e===3&&(ve&62914560)===ve&&300>ht()-Is?(we&2)===0&&Bl(e,0):jc|=a,Ul===ve&&(Ul=0)),Zt(e)}function Xf(e,t){t===0&&(t=Bo()),e=Ka(e,t),e!==null&&(an(e,t),Zt(e))}function _h(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Xf(e,a)}function Oh(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(a=s.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(c(314))}n!==null&&n.delete(t),Xf(e,a)}function zh(e,t){return qr(e,t)}var rr=null,ql=null,Rc=!1,ir=!1,Mc=!1,Oa=0;function Zt(e){e!==ql&&e.next===null&&(ql===null?rr=ql=e:ql=ql.next=e),ir=!0,Rc||(Rc=!0,Uh())}function Un(e,t){if(!Mc&&ir){Mc=!0;do for(var a=!1,n=rr;n!==null;){if(e!==0){var s=n.pendingLanes;if(s===0)var i=0;else{var f=n.suspendedLanes,g=n.pingedLanes;i=(1<<31-pt(42|e)+1)-1,i&=s&~(f&~g),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,Wf(n,i))}else i=ve,i=ds(n,n===_e?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||tn(n,i)||(a=!0,Wf(n,i));n=n.next}while(a);Mc=!1}}function Lh(){Zf()}function Zf(){ir=Rc=!1;var e=0;Oa!==0&&Zh()&&(e=Oa);for(var t=ht(),a=null,n=rr;n!==null;){var s=n.next,i=Kf(n,t);i===0?(n.next=null,a===null?rr=s:a.next=s,s===null&&(ql=a)):(a=n,(e!==0||(i&3)!==0)&&(ir=!0)),n=s}Fe!==0&&Fe!==5||Un(e),Oa!==0&&(Oa=0)}function Kf(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var f=31-pt(i),g=1<<f,E=s[f];E===-1?((g&a)===0||(g&n)!==0)&&(s[f]=om(g,t)):E<=t&&(e.expiredLanes|=g),i&=~g}if(t=_e,a=ve,a=ds(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(Te===2||Te===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&Yr(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||tn(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&Yr(n),Qr(a)){case 2:case 8:a=Uo;break;case 32:a=is;break;case 268435456:a=Ho;break;default:a=is}return n=Jf.bind(null,e),a=qr(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&Yr(n),e.callbackPriority=2,e.callbackNode=null,2}function Jf(e,t){if(Fe!==0&&Fe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(sr()&&e.callbackNode!==a)return null;var n=ve;return n=ds(e,e===_e?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Mf(e,n,t),Kf(e,ht()),e.callbackNode!=null&&e.callbackNode===a?Jf.bind(null,e):null)}function Wf(e,t){if(sr())return null;Mf(e,t,!0)}function Uh(){Jh(function(){(we&6)!==0?qr(Lo,Lh):Zf()})}function Dc(){if(Oa===0){var e=Cl;e===0&&(e=cs,cs<<=1,(cs&261888)===0&&(cs=256)),Oa=e}return Oa}function Ff(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hs(""+e)}function Pf(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Hh(e,t,a,n,s){if(t==="submit"&&a&&a.stateNode===s){var i=Ff((s[ct]||null).action),f=n.submitter;f&&(t=(t=f[ct]||null)?Ff(t.formAction):f.getAttribute("formAction"),t!==null&&(i=t,f=null));var g=new vs("action","action",null,n,s);e.push({event:g,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Oa!==0){var E=f?Pf(s,f):new FormData(s);Fi(a,{pending:!0,data:E,method:s.method,action:i},null,E)}}else typeof i=="function"&&(g.preventDefault(),E=f?Pf(s,f):new FormData(s),Fi(a,{pending:!0,data:E,method:s.method,action:i},i,E))},currentTarget:s}]})}}for(var kc=0;kc<mi.length;kc++){var _c=mi[kc],Bh=_c.toLowerCase(),$h=_c[0].toUpperCase()+_c.slice(1);Ut(Bh,"on"+$h)}Ut(Au,"onAnimationEnd"),Ut(Ru,"onAnimationIteration"),Ut(Mu,"onAnimationStart"),Ut("dblclick","onDoubleClick"),Ut("focusin","onFocus"),Ut("focusout","onBlur"),Ut(ah,"onTransitionRun"),Ut(lh,"onTransitionStart"),Ut(nh,"onTransitionCancel"),Ut(Du,"onTransitionEnd"),fl("onMouseEnter",["mouseout","mouseover"]),fl("onMouseLeave",["mouseout","mouseover"]),fl("onPointerEnter",["pointerout","pointerover"]),fl("onPointerLeave",["pointerout","pointerover"]),Va("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Va("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Va("onBeforeInput",["compositionend","keypress","textInput","paste"]),Va("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qh=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hn));function If(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],s=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var f=n.length-1;0<=f;f--){var g=n[f],E=g.instance,L=g.currentTarget;if(g=g.listener,E!==i&&s.isPropagationStopped())break e;i=g,s.currentTarget=L;try{i(s)}catch(Y){Ns(Y)}s.currentTarget=null,i=E}else for(f=0;f<n.length;f++){if(g=n[f],E=g.instance,L=g.currentTarget,g=g.listener,E!==i&&s.isPropagationStopped())break e;i=g,s.currentTarget=L;try{i(s)}catch(Y){Ns(Y)}s.currentTarget=null,i=E}}}}function ye(e,t){var a=t[Xr];a===void 0&&(a=t[Xr]=new Set);var n=e+"__bubble";a.has(n)||(e0(t,e,2,!1),a.add(n))}function Oc(e,t,a){var n=0;t&&(n|=4),e0(a,e,n,t)}var cr="_reactListening"+Math.random().toString(36).slice(2);function zc(e){if(!e[cr]){e[cr]=!0,Xo.forEach(function(a){a!=="selectionchange"&&(qh.has(a)||Oc(a,!1,e),Oc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[cr]||(t[cr]=!0,Oc("selectionchange",!1,t))}}function e0(e,t,a,n){switch(R0(t)){case 2:var s=hg;break;case 8:s=gg;break;default:s=Wc}a=s.bind(null,t,a,e),s=void 0,!ti||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,a,{capture:!0,passive:s}):e.addEventListener(t,a,!0):s!==void 0?e.addEventListener(t,a,{passive:s}):e.addEventListener(t,a,!1)}function Lc(e,t,a,n,s){var i=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var f=n.tag;if(f===3||f===4){var g=n.stateNode.containerInfo;if(g===s)break;if(f===4)for(f=n.return;f!==null;){var E=f.tag;if((E===3||E===4)&&f.stateNode.containerInfo===s)return;f=f.return}for(;g!==null;){if(f=ol(g),f===null)return;if(E=f.tag,E===5||E===6||E===26||E===27){n=i=f;continue e}g=g.parentNode}}n=n.return}nu(function(){var L=i,Y=Ir(a),V=[];e:{var H=ku.get(e);if(H!==void 0){var B=vs,te=e;switch(e){case"keypress":if(ps(a)===0)break e;case"keydown":case"keyup":B=Om;break;case"focusin":te="focus",B=si;break;case"focusout":te="blur",B=si;break;case"beforeblur":case"afterblur":B=si;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":B=iu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":B=Nm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":B=Um;break;case Au:case Ru:case Mu:B=Em;break;case Du:B=Bm;break;case"scroll":case"scrollend":B=bm;break;case"wheel":B=qm;break;case"copy":case"cut":case"paste":B=Tm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":B=ou;break;case"toggle":case"beforetoggle":B=Gm}var oe=(t&4)!==0,ke=!oe&&(e==="scroll"||e==="scrollend"),k=oe?H!==null?H+"Capture":null:H;oe=[];for(var M=L,z;M!==null;){var G=M;if(z=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||z===null||k===null||(G=sn(M,k),G!=null&&oe.push(Bn(M,G,z))),ke)break;M=M.return}0<oe.length&&(H=new B(H,te,null,a,Y),V.push({event:H,listeners:oe}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",B=e==="mouseout"||e==="pointerout",H&&a!==Pr&&(te=a.relatedTarget||a.fromElement)&&(ol(te)||te[cl]))break e;if((B||H)&&(H=Y.window===Y?Y:(H=Y.ownerDocument)?H.defaultView||H.parentWindow:window,B?(te=a.relatedTarget||a.toElement,B=L,te=te?ol(te):null,te!==null&&(ke=x(te),oe=te.tag,te!==ke||oe!==5&&oe!==27&&oe!==6)&&(te=null)):(B=null,te=L),B!==te)){if(oe=iu,G="onMouseLeave",k="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(oe=ou,G="onPointerLeave",k="onPointerEnter",M="pointer"),ke=B==null?H:nn(B),z=te==null?H:nn(te),H=new oe(G,M+"leave",B,a,Y),H.target=ke,H.relatedTarget=z,G=null,ol(Y)===L&&(oe=new oe(k,M+"enter",te,a,Y),oe.target=z,oe.relatedTarget=ke,G=oe),ke=G,B&&te)t:{for(oe=Yh,k=B,M=te,z=0,G=k;G;G=oe(G))z++;G=0;for(var ie=M;ie;ie=oe(ie))G++;for(;0<z-G;)k=oe(k),z--;for(;0<G-z;)M=oe(M),G--;for(;z--;){if(k===M||M!==null&&k===M.alternate){oe=k;break t}k=oe(k),M=oe(M)}oe=null}else oe=null;B!==null&&t0(V,H,B,oe,!1),te!==null&&ke!==null&&t0(V,ke,te,oe,!0)}}e:{if(H=L?nn(L):window,B=H.nodeName&&H.nodeName.toLowerCase(),B==="select"||B==="input"&&H.type==="file")var Ne=pu;else if(hu(H))if(yu)Ne=Im;else{Ne=Fm;var se=Wm}else B=H.nodeName,!B||B.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?L&&Fr(L.elementType)&&(Ne=pu):Ne=Pm;if(Ne&&(Ne=Ne(e,L))){gu(V,Ne,a,Y);break e}se&&se(e,H,L),e==="focusout"&&L&&H.type==="number"&&L.memoizedProps.value!=null&&Wr(H,"number",H.value)}switch(se=L?nn(L):window,e){case"focusin":(hu(se)||se.contentEditable==="true")&&(yl=se,di=L,mn=null);break;case"focusout":mn=di=yl=null;break;case"mousedown":fi=!0;break;case"contextmenu":case"mouseup":case"dragend":fi=!1,Cu(V,a,Y);break;case"selectionchange":if(th)break;case"keydown":case"keyup":Cu(V,a,Y)}var he;if(ii)e:{switch(e){case"compositionstart":var be="onCompositionStart";break e;case"compositionend":be="onCompositionEnd";break e;case"compositionupdate":be="onCompositionUpdate";break e}be=void 0}else pl?xu(e,a)&&(be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(be="onCompositionStart");be&&(uu&&a.locale!=="ko"&&(pl||be!=="onCompositionStart"?be==="onCompositionEnd"&&pl&&(he=su()):(ya=Y,ai="value"in ya?ya.value:ya.textContent,pl=!0)),se=or(L,be),0<se.length&&(be=new cu(be,e,null,a,Y),V.push({event:be,listeners:se}),he?be.data=he:(he=mu(a),he!==null&&(be.data=he)))),(he=Qm?Xm(e,a):Zm(e,a))&&(be=or(L,"onBeforeInput"),0<be.length&&(se=new cu("onBeforeInput","beforeinput",null,a,Y),V.push({event:se,listeners:be}),se.data=he)),Hh(V,e,L,a,Y)}If(V,t)})}function Bn(e,t,a){return{instance:e,listener:t,currentTarget:a}}function or(e,t){for(var a=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=sn(e,a),s!=null&&n.unshift(Bn(e,s,i)),s=sn(e,t),s!=null&&n.push(Bn(e,s,i))),e.tag===3)return n;e=e.return}return[]}function Yh(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function t0(e,t,a,n,s){for(var i=t._reactName,f=[];a!==null&&a!==n;){var g=a,E=g.alternate,L=g.stateNode;if(g=g.tag,E!==null&&E===n)break;g!==5&&g!==26&&g!==27||L===null||(E=L,s?(L=sn(a,i),L!=null&&f.unshift(Bn(a,L,E))):s||(L=sn(a,i),L!=null&&f.push(Bn(a,L,E)))),a=a.return}f.length!==0&&e.push({event:t,listeners:f})}var Gh=/\r\n?/g,Vh=/\u0000|\uFFFD/g;function a0(e){return(typeof e=="string"?e:""+e).replace(Gh,`
9
- `).replace(Vh,"")}function l0(e,t){return t=a0(t),a0(e)===t}function De(e,t,a,n,s,i){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||ml(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&ml(e,""+n);break;case"className":xs(e,"class",n);break;case"tabIndex":xs(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":xs(e,a,n);break;case"style":au(e,n,i);break;case"data":if(t!=="object"){xs(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=hs(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(a==="formAction"?(t!=="input"&&De(e,t,"name",s.name,s,null),De(e,t,"formEncType",s.formEncType,s,null),De(e,t,"formMethod",s.formMethod,s,null),De(e,t,"formTarget",s.formTarget,s,null)):(De(e,t,"encType",s.encType,s,null),De(e,t,"method",s.method,s,null),De(e,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=hs(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Wt);break;case"onScroll":n!=null&&ye("scroll",e);break;case"onScrollEnd":n!=null&&ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(c(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(c(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=hs(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":ye("beforetoggle",e),ye("toggle",e),fs(e,"popover",n);break;case"xlinkActuate":Jt(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":Jt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":Jt(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":Jt(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":Jt(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":Jt(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":Jt(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":Jt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":Jt(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":fs(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=ym.get(a)||a,fs(e,a,n))}}function Uc(e,t,a,n,s,i){switch(a){case"style":au(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(c(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(c(60));e.innerHTML=a}}break;case"children":typeof n=="string"?ml(e,n):(typeof n=="number"||typeof n=="bigint")&&ml(e,""+n);break;case"onScroll":n!=null&&ye("scroll",e);break;case"onScrollEnd":n!=null&&ye("scrollend",e);break;case"onClick":n!=null&&(e.onclick=Wt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zo.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(s=a.endsWith("Capture"),t=a.slice(2,s?a.length-7:void 0),i=e[ct]||null,i=i!=null?i[a]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof n=="function")){typeof i!="function"&&i!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,s);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):fs(e,a,n)}}}function st(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ye("error",e),ye("load",e);var n=!1,s=!1,i;for(i in a)if(a.hasOwnProperty(i)){var f=a[i];if(f!=null)switch(i){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:De(e,t,i,f,a,null)}}s&&De(e,t,"srcSet",a.srcSet,a,null),n&&De(e,t,"src",a.src,a,null);return;case"input":ye("invalid",e);var g=i=f=s=null,E=null,L=null;for(n in a)if(a.hasOwnProperty(n)){var Y=a[n];if(Y!=null)switch(n){case"name":s=Y;break;case"type":f=Y;break;case"checked":E=Y;break;case"defaultChecked":L=Y;break;case"value":i=Y;break;case"defaultValue":g=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(c(137,t));break;default:De(e,t,n,Y,a,null)}}Po(e,i,g,E,L,f,s,!1);return;case"select":ye("invalid",e),n=f=i=null;for(s in a)if(a.hasOwnProperty(s)&&(g=a[s],g!=null))switch(s){case"value":i=g;break;case"defaultValue":f=g;break;case"multiple":n=g;default:De(e,t,s,g,a,null)}t=i,a=f,e.multiple=!!n,t!=null?xl(e,!!n,t,!1):a!=null&&xl(e,!!n,a,!0);return;case"textarea":ye("invalid",e),i=s=n=null;for(f in a)if(a.hasOwnProperty(f)&&(g=a[f],g!=null))switch(f){case"value":n=g;break;case"defaultValue":s=g;break;case"children":i=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(c(91));break;default:De(e,t,f,g,a,null)}eu(e,n,s,i);return;case"option":for(E in a)a.hasOwnProperty(E)&&(n=a[E],n!=null)&&(E==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":De(e,t,E,n,a,null));return;case"dialog":ye("beforetoggle",e),ye("toggle",e),ye("cancel",e),ye("close",e);break;case"iframe":case"object":ye("load",e);break;case"video":case"audio":for(n=0;n<Hn.length;n++)ye(Hn[n],e);break;case"image":ye("error",e),ye("load",e);break;case"details":ye("toggle",e);break;case"embed":case"source":case"link":ye("error",e),ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(L in a)if(a.hasOwnProperty(L)&&(n=a[L],n!=null))switch(L){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:De(e,t,L,n,a,null)}return;default:if(Fr(t)){for(Y in a)a.hasOwnProperty(Y)&&(n=a[Y],n!==void 0&&Uc(e,t,Y,n,a,void 0));return}}for(g in a)a.hasOwnProperty(g)&&(n=a[g],n!=null&&De(e,t,g,n,a,null))}function Qh(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,f=null,g=null,E=null,L=null,Y=null;for(B in a){var V=a[B];if(a.hasOwnProperty(B)&&V!=null)switch(B){case"checked":break;case"value":break;case"defaultValue":E=V;default:n.hasOwnProperty(B)||De(e,t,B,null,n,V)}}for(var H in n){var B=n[H];if(V=a[H],n.hasOwnProperty(H)&&(B!=null||V!=null))switch(H){case"type":i=B;break;case"name":s=B;break;case"checked":L=B;break;case"defaultChecked":Y=B;break;case"value":f=B;break;case"defaultValue":g=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(c(137,t));break;default:B!==V&&De(e,t,H,B,n,V)}}Jr(e,f,g,E,L,Y,i,s);return;case"select":B=f=g=H=null;for(i in a)if(E=a[i],a.hasOwnProperty(i)&&E!=null)switch(i){case"value":break;case"multiple":B=E;default:n.hasOwnProperty(i)||De(e,t,i,null,n,E)}for(s in n)if(i=n[s],E=a[s],n.hasOwnProperty(s)&&(i!=null||E!=null))switch(s){case"value":H=i;break;case"defaultValue":g=i;break;case"multiple":f=i;default:i!==E&&De(e,t,s,i,n,E)}t=g,a=f,n=B,H!=null?xl(e,!!a,H,!1):!!n!=!!a&&(t!=null?xl(e,!!a,t,!0):xl(e,!!a,a?[]:"",!1));return;case"textarea":B=H=null;for(g in a)if(s=a[g],a.hasOwnProperty(g)&&s!=null&&!n.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:De(e,t,g,null,n,s)}for(f in n)if(s=n[f],i=a[f],n.hasOwnProperty(f)&&(s!=null||i!=null))switch(f){case"value":H=s;break;case"defaultValue":B=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(c(91));break;default:s!==i&&De(e,t,f,s,n,i)}Io(e,H,B);return;case"option":for(var te in a)H=a[te],a.hasOwnProperty(te)&&H!=null&&!n.hasOwnProperty(te)&&(te==="selected"?e.selected=!1:De(e,t,te,null,n,H));for(E in n)H=n[E],B=a[E],n.hasOwnProperty(E)&&H!==B&&(H!=null||B!=null)&&(E==="selected"?e.selected=H&&typeof H!="function"&&typeof H!="symbol":De(e,t,E,H,n,B));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var oe in a)H=a[oe],a.hasOwnProperty(oe)&&H!=null&&!n.hasOwnProperty(oe)&&De(e,t,oe,null,n,H);for(L in n)if(H=n[L],B=a[L],n.hasOwnProperty(L)&&H!==B&&(H!=null||B!=null))switch(L){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(c(137,t));break;default:De(e,t,L,H,n,B)}return;default:if(Fr(t)){for(var ke in a)H=a[ke],a.hasOwnProperty(ke)&&H!==void 0&&!n.hasOwnProperty(ke)&&Uc(e,t,ke,void 0,n,H);for(Y in n)H=n[Y],B=a[Y],!n.hasOwnProperty(Y)||H===B||H===void 0&&B===void 0||Uc(e,t,Y,H,n,B);return}}for(var k in a)H=a[k],a.hasOwnProperty(k)&&H!=null&&!n.hasOwnProperty(k)&&De(e,t,k,null,n,H);for(V in n)H=n[V],B=a[V],!n.hasOwnProperty(V)||H===B||H==null&&B==null||De(e,t,V,H,n,B)}function n0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xh(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var s=a[n],i=s.transferSize,f=s.initiatorType,g=s.duration;if(i&&g&&n0(f)){for(f=0,g=s.responseEnd,n+=1;n<a.length;n++){var E=a[n],L=E.startTime;if(L>g)break;var Y=E.transferSize,V=E.initiatorType;Y&&n0(V)&&(E=E.responseEnd,f+=Y*(E<g?1:(g-L)/(E-L)))}if(--n,t+=8*(i+f)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Hc=null,Bc=null;function ur(e){return e.nodeType===9?e:e.ownerDocument}function s0(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function r0(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function $c(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qc=null;function Zh(){var e=window.event;return e&&e.type==="popstate"?e===qc?!1:(qc=e,!0):(qc=null,!1)}var i0=typeof setTimeout=="function"?setTimeout:void 0,Kh=typeof clearTimeout=="function"?clearTimeout:void 0,c0=typeof Promise=="function"?Promise:void 0,Jh=typeof queueMicrotask=="function"?queueMicrotask:typeof c0<"u"?function(e){return c0.resolve(null).then(e).catch(Wh)}:i0;function Wh(e){setTimeout(function(){throw e})}function za(e){return e==="head"}function o0(e,t){var a=t,n=0;do{var s=a.nextSibling;if(e.removeChild(a),s&&s.nodeType===8)if(a=s.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(s),Ql(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")$n(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,$n(a);for(var i=a.firstChild;i;){var f=i.nextSibling,g=i.nodeName;i[ln]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=f}}else a==="body"&&$n(e.ownerDocument.body);a=s}while(a);Ql(t)}function u0(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function Yc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Yc(a),Zr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Fh(e,t,a,n){for(;e.nodeType===1;){var s=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[ln])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=_t(e.nextSibling),e===null)break}return null}function Ph(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=_t(e.nextSibling),e===null))return null;return e}function d0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=_t(e.nextSibling),e===null))return null;return e}function Gc(e){return e.data==="$?"||e.data==="$~"}function Vc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ih(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function _t(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==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Qc=null;function f0(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return _t(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function x0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function m0(e,t,a){switch(t=ur(a),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function $n(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Zr(e)}var Ot=new Map,h0=new Set;function dr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var fa=Q.d;Q.d={f:eg,r:tg,D:ag,C:lg,L:ng,m:sg,X:ig,S:rg,M:cg};function eg(){var e=fa.f(),t=ar();return e||t}function tg(e){var t=ul(e);t!==null&&t.tag===5&&t.type==="form"?Dd(t):fa.r(e)}var Yl=typeof document>"u"?null:document;function g0(e,t,a){var n=Yl;if(n&&typeof t=="string"&&t){var s=Ct(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof a=="string"&&(s+='[crossorigin="'+a+'"]'),h0.has(s)||(h0.add(s),e={rel:e,crossOrigin:a,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),st(t,"link",e),Pe(t),n.head.appendChild(t)))}}function ag(e){fa.D(e),g0("dns-prefetch",e,null)}function lg(e,t){fa.C(e,t),g0("preconnect",e,t)}function ng(e,t,a){fa.L(e,t,a);var n=Yl;if(n&&e&&t){var s='link[rel="preload"][as="'+Ct(t)+'"]';t==="image"&&a&&a.imageSrcSet?(s+='[imagesrcset="'+Ct(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(s+='[imagesizes="'+Ct(a.imageSizes)+'"]')):s+='[href="'+Ct(e)+'"]';var i=s;switch(t){case"style":i=Gl(e);break;case"script":i=Vl(e)}Ot.has(i)||(e=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ot.set(i,e),n.querySelector(s)!==null||t==="style"&&n.querySelector(qn(i))||t==="script"&&n.querySelector(Yn(i))||(t=n.createElement("link"),st(t,"link",e),Pe(t),n.head.appendChild(t)))}}function sg(e,t){fa.m(e,t);var a=Yl;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Ct(n)+'"][href="'+Ct(e)+'"]',i=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Vl(e)}if(!Ot.has(i)&&(e=v({rel:"modulepreload",href:e},t),Ot.set(i,e),a.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yn(i)))return}n=a.createElement("link"),st(n,"link",e),Pe(n),a.head.appendChild(n)}}}function rg(e,t,a){fa.S(e,t,a);var n=Yl;if(n&&e){var s=dl(n).hoistableStyles,i=Gl(e);t=t||"default";var f=s.get(i);if(!f){var g={loading:0,preload:null};if(f=n.querySelector(qn(i)))g.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ot.get(i))&&Xc(e,a);var E=f=n.createElement("link");Pe(E),st(E,"link",e),E._p=new Promise(function(L,Y){E.onload=L,E.onerror=Y}),E.addEventListener("load",function(){g.loading|=1}),E.addEventListener("error",function(){g.loading|=2}),g.loading|=4,fr(f,t,n)}f={type:"stylesheet",instance:f,count:1,state:g},s.set(i,f)}}}function ig(e,t){fa.X(e,t);var a=Yl;if(a&&e){var n=dl(a).hoistableScripts,s=Vl(e),i=n.get(s);i||(i=a.querySelector(Yn(s)),i||(e=v({src:e,async:!0},t),(t=Ot.get(s))&&Zc(e,t),i=a.createElement("script"),Pe(i),st(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function cg(e,t){fa.M(e,t);var a=Yl;if(a&&e){var n=dl(a).hoistableScripts,s=Vl(e),i=n.get(s);i||(i=a.querySelector(Yn(s)),i||(e=v({src:e,async:!0,type:"module"},t),(t=Ot.get(s))&&Zc(e,t),i=a.createElement("script"),Pe(i),st(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function p0(e,t,a,n){var s=(s=ge.current)?dr(s):null;if(!s)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Gl(a.href),a=dl(s).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Gl(a.href);var i=dl(s).hoistableStyles,f=i.get(e);if(f||(s=s.ownerDocument||s,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,f),(i=s.querySelector(qn(e)))&&!i._p&&(f.instance=i,f.state.loading=5),Ot.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ot.set(e,a),i||og(s,e,a,f.state))),t&&n===null)throw Error(c(528,""));return f}if(t&&n!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Vl(a),a=dl(s).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function Gl(e){return'href="'+Ct(e)+'"'}function qn(e){return'link[rel="stylesheet"]['+e+"]"}function y0(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function og(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),st(t,"link",a),Pe(t),e.head.appendChild(t))}function Vl(e){return'[src="'+Ct(e)+'"]'}function Yn(e){return"script[async]"+e}function v0(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Ct(a.href)+'"]');if(n)return t.instance=n,Pe(n),n;var s=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),Pe(n),st(n,"style",s),fr(n,a.precedence,e),t.instance=n;case"stylesheet":s=Gl(a.href);var i=e.querySelector(qn(s));if(i)return t.state.loading|=4,t.instance=i,Pe(i),i;n=y0(a),(s=Ot.get(s))&&Xc(n,s),i=(e.ownerDocument||e).createElement("link"),Pe(i);var f=i;return f._p=new Promise(function(g,E){f.onload=g,f.onerror=E}),st(i,"link",n),t.state.loading|=4,fr(i,a.precedence,e),t.instance=i;case"script":return i=Vl(a.src),(s=e.querySelector(Yn(i)))?(t.instance=s,Pe(s),s):(n=a,(s=Ot.get(i))&&(n=v({},a),Zc(n,s)),e=e.ownerDocument||e,s=e.createElement("script"),Pe(s),st(s,"link",n),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,fr(n,a.precedence,e));return t.instance}function fr(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,i=s,f=0;f<n.length;f++){var g=n[f];if(g.dataset.precedence===t)i=g;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Xc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Zc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var xr=null;function b0(e,t,a){if(xr===null){var n=new Map,s=xr=new Map;s.set(a,n)}else s=xr,n=s.get(a),n||(n=new Map,s.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),s=0;s<a.length;s++){var i=a[s];if(!(i[ln]||i[tt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var f=i.getAttribute(t)||"";f=e+f;var g=n.get(f);g?g.push(i):n.set(f,[i])}}return n}function j0(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function ug(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function N0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function dg(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var s=Gl(n.href),i=t.querySelector(qn(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=mr.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,Pe(i);return}i=t.ownerDocument||t,n=y0(n),(s=Ot.get(s))&&Xc(n,s),i=i.createElement("link"),Pe(i);var f=i;f._p=new Promise(function(g,E){f.onload=g,f.onerror=E}),st(i,"link",n),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=mr.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Kc=0;function fg(e,t){return e.stylesheets&&e.count===0&&gr(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Kc===0&&(Kc=62500*Xh());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Kc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function mr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hr=null;function gr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hr=new Map,t.forEach(xg,e),hr=null,mr.call(e))}function xg(e,t){if(!(t.state.loading&4)){var a=hr.get(e);if(a)var n=a.get(null);else{a=new Map,hr.set(e,a);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var f=s[i];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(a.set(f.dataset.precedence,f),n=f)}n&&a.set(null,n)}s=t.instance,f=s.getAttribute("data-precedence"),i=a.get(f)||n,i===n&&a.set(null,s),a.set(f,s),this.count++,n=mr.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var Gn={$$typeof:O,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function mg(e,t,a,n,s,i,f,g,E){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Gr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gr(0),this.hiddenUpdates=Gr(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function S0(e,t,a,n,s,i,f,g,E,L,Y,V){return e=new mg(e,t,a,f,E,L,Y,V,g),t=1,i===!0&&(t|=24),i=vt(3,null,null,t),e.current=i,i.stateNode=e,t=Ti(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:a,cache:t},Di(i),e}function w0(e){return e?(e=jl,e):jl}function E0(e,t,a,n,s,i){s=w0(s),n.context===null?n.context=s:n.pendingContext=s,n=wa(t),n.payload={element:a},i=i===void 0?null:i,i!==null&&(n.callback=i),a=Ea(e,n,t),a!==null&&(mt(a,e,t),jn(a,e,t))}function C0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Jc(e,t){C0(e,t),(e=e.alternate)&&C0(e,t)}function T0(e){if(e.tag===13||e.tag===31){var t=Ka(e,67108864);t!==null&&mt(t,e,67108864),Jc(e,67108864)}}function A0(e){if(e.tag===13||e.tag===31){var t=wt();t=Vr(t);var a=Ka(e,t);a!==null&&mt(a,e,t),Jc(e,t)}}var pr=!0;function hg(e,t,a,n){var s=R.T;R.T=null;var i=Q.p;try{Q.p=2,Wc(e,t,a,n)}finally{Q.p=i,R.T=s}}function gg(e,t,a,n){var s=R.T;R.T=null;var i=Q.p;try{Q.p=8,Wc(e,t,a,n)}finally{Q.p=i,R.T=s}}function Wc(e,t,a,n){if(pr){var s=Fc(n);if(s===null)Lc(e,t,n,yr,a),M0(e,n);else if(yg(s,e,t,a,n))n.stopPropagation();else if(M0(e,n),t&4&&-1<pg.indexOf(e)){for(;s!==null;){var i=ul(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var f=Ga(i.pendingLanes);if(f!==0){var g=i;for(g.pendingLanes|=2,g.entangledLanes|=2;f;){var E=1<<31-pt(f);g.entanglements[1]|=E,f&=~E}Zt(i),(we&6)===0&&(er=ht()+500,Un(0))}}break;case 31:case 13:g=Ka(i,2),g!==null&&mt(g,i,2),ar(),Jc(i,2)}if(i=Fc(n),i===null&&Lc(e,t,n,yr,a),i===s)break;s=i}s!==null&&n.stopPropagation()}else Lc(e,t,n,null,a)}}function Fc(e){return e=Ir(e),Pc(e)}var yr=null;function Pc(e){if(yr=null,e=ol(e),e!==null){var t=x(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=m(t),e!==null)return e;e=null}else if(a===31){if(e=j(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return yr=e,null}function R0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(am()){case Lo:return 2;case Uo:return 8;case is:case lm:return 32;case Ho:return 268435456;default:return 32}default:return 32}}var Ic=!1,La=null,Ua=null,Ha=null,Vn=new Map,Qn=new Map,Ba=[],pg="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function M0(e,t){switch(e){case"focusin":case"focusout":La=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Ha=null;break;case"pointerover":case"pointerout":Vn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qn.delete(t.pointerId)}}function Xn(e,t,a,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=ul(t),t!==null&&T0(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function yg(e,t,a,n,s){switch(t){case"focusin":return La=Xn(La,e,t,a,n,s),!0;case"dragenter":return Ua=Xn(Ua,e,t,a,n,s),!0;case"mouseover":return Ha=Xn(Ha,e,t,a,n,s),!0;case"pointerover":var i=s.pointerId;return Vn.set(i,Xn(Vn.get(i)||null,e,t,a,n,s)),!0;case"gotpointercapture":return i=s.pointerId,Qn.set(i,Xn(Qn.get(i)||null,e,t,a,n,s)),!0}return!1}function D0(e){var t=ol(e.target);if(t!==null){var a=x(t);if(a!==null){if(t=a.tag,t===13){if(t=m(a),t!==null){e.blockedOn=t,Vo(e.priority,function(){A0(a)});return}}else if(t===31){if(t=j(a),t!==null){e.blockedOn=t,Vo(e.priority,function(){A0(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Fc(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);Pr=n,a.target.dispatchEvent(n),Pr=null}else return t=ul(a),t!==null&&T0(t),e.blockedOn=a,!1;t.shift()}return!0}function k0(e,t,a){vr(e)&&a.delete(t)}function vg(){Ic=!1,La!==null&&vr(La)&&(La=null),Ua!==null&&vr(Ua)&&(Ua=null),Ha!==null&&vr(Ha)&&(Ha=null),Vn.forEach(k0),Qn.forEach(k0)}function br(e,t){e.blockedOn===t&&(e.blockedOn=null,Ic||(Ic=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,vg)))}var jr=null;function _0(e){jr!==e&&(jr=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){jr===e&&(jr=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],s=e[t+2];if(typeof n!="function"){if(Pc(n||a)===null)continue;break}var i=ul(a);i!==null&&(e.splice(t,3),t-=3,Fi(i,{pending:!0,data:s,method:a.method,action:n},n,s))}}))}function Ql(e){function t(E){return br(E,e)}La!==null&&br(La,e),Ua!==null&&br(Ua,e),Ha!==null&&br(Ha,e),Vn.forEach(t),Qn.forEach(t);for(var a=0;a<Ba.length;a++){var n=Ba[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Ba.length&&(a=Ba[0],a.blockedOn===null);)D0(a),a.blockedOn===null&&Ba.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var s=a[n],i=a[n+1],f=s[ct]||null;if(typeof i=="function")f||_0(a);else if(f){var g=null;if(i&&i.hasAttribute("formAction")){if(s=i,f=i[ct]||null)g=f.formAction;else if(Pc(s)!==null)continue}else g=f.action;typeof g=="function"?a[n+1]=g:(a.splice(n,3),n-=3),_0(a)}}}function O0(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(f){return s=f})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function eo(e){this._internalRoot=e}Nr.prototype.render=eo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var a=t.current,n=wt();E0(a,n,e,t,null,null)},Nr.prototype.unmount=eo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;E0(e.current,2,null,e,null,null),ar(),t[cl]=null}};function Nr(e){this._internalRoot=e}Nr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Go();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ba.length&&t!==0&&t<Ba[a].priority;a++);Ba.splice(a,0,e),a===0&&D0(e)}};var z0=u.version;if(z0!=="19.2.8")throw Error(c(527,z0,"19.2.8"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=h(t),e=e!==null?N(e):null,e=e===null?null:e.stateNode,e};var bg={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sr.isDisabled&&Sr.supportsFiber)try{en=Sr.inject(bg),gt=Sr}catch{}}return Kn.createRoot=function(e,t){if(!d(e))throw Error(c(299));var a=!1,n="",s=qd,i=Yd,f=Gd;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=S0(e,1,!1,null,null,a,n,null,s,i,f,O0),e[cl]=t.current,zc(e),new eo(t)},Kn.hydrateRoot=function(e,t,a){if(!d(e))throw Error(c(299));var n=!1,s="",i=qd,f=Yd,g=Gd,E=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(s=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(f=a.onCaughtError),a.onRecoverableError!==void 0&&(g=a.onRecoverableError),a.formState!==void 0&&(E=a.formState)),t=S0(e,1,!0,t,a??null,n,s,E,i,f,g,O0),t.context=w0(null),a=t.current,n=wt(),n=Vr(n),s=wa(n),s.callback=null,Ea(a,s,n),a=n,t.current.lanes=a,an(t,a),Zt(t),e[cl]=t.current,zc(e),new Nr(t)},Kn.version="19.2.8",Kn}var Q0;function Mg(){if(Q0)return lo.exports;Q0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(u){console.error(u)}}return r(),lo.exports=Rg(),lo.exports}var Dg=Mg();var jo=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,bx=/^[\\/]{2}/;function kg(r,u){return u+r.replace(/\\/g,"/")}var X0="popstate";function Z0(r){return typeof r=="object"&&r!=null&&"pathname"in r&&"search"in r&&"hash"in r&&"state"in r&&"key"in r}function _g(r={}){function u(c,d){let x=d.state?.masked,{pathname:m,search:j,hash:p}=x||c.location;return ho("",{pathname:m,search:j,hash:p},d.state&&d.state.usr||null,d.state&&d.state.key||"default",x?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function o(c,d){return typeof d=="string"?d:ts(d)}return zg(u,o,null,r)}function He(r,u){if(r===!1||r===null||typeof r>"u")throw new Error(u)}function qt(r,u){if(!r){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function Og(){return Math.random().toString(36).substring(2,10)}function K0(r,u){return{usr:r.state,key:r.key,idx:u,masked:r.mask?{pathname:r.pathname,search:r.search,hash:r.hash}:void 0}}function ho(r,u,o=null,c,d){return{pathname:typeof r=="string"?r:r.pathname,search:"",hash:"",...typeof u=="string"?Fl(u):u,state:o,key:u&&u.key||c||Og(),mask:d}}function ts({pathname:r="/",search:u="",hash:o=""}){return u&&u!=="?"&&(r+=u.charAt(0)==="?"?u:"?"+u),o&&o!=="#"&&(r+=o.charAt(0)==="#"?o:"#"+o),r}function Fl(r){let u={};if(r){let o=r.indexOf("#");o>=0&&(u.hash=r.substring(o),r=r.substring(0,o));let c=r.indexOf("?");c>=0&&(u.search=r.substring(c),r=r.substring(0,c)),r&&(u.pathname=r)}return u}function zg(r,u,o,c={}){let{window:d=document.defaultView,v5Compat:x=!1}=c,m=d.history,j="POP",p=null,h=N();h==null&&(h=0,m.replaceState({...m.state,idx:h},""));function N(){return(m.state||{idx:null}).idx}function v(){j="POP";let b=N(),w=b==null?null:b-h;h=b,p&&p({action:j,location:A.location,delta:w})}function T(b,w){j="PUSH";let C=Z0(b)?b:ho(A.location,b,w);h=N()+1;let O=K0(C,h),F=A.createHref(C.mask||C);try{m.pushState(O,"",F)}catch(X){if(X instanceof DOMException&&X.name==="DataCloneError")throw X;d.location.assign(F)}x&&p&&p({action:j,location:A.location,delta:1})}function D(b,w){j="REPLACE";let C=Z0(b)?b:ho(A.location,b,w);h=N();let O=K0(C,h),F=A.createHref(C.mask||C);m.replaceState(O,"",F),x&&p&&p({action:j,location:A.location,delta:0})}function _(b){return Lg(d,b)}let A={get action(){return j},get location(){return r(d,m)},listen(b){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(X0,v),p=b,()=>{d.removeEventListener(X0,v),p=null}},createHref(b){return u(d,b)},createURL:_,encodeLocation(b){let w=_(b);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:T,replace:D,go(b){return m.go(b)}};return A}function Lg(r,u,o=!1){let c="http://localhost";r&&(c=r.location.origin!=="null"?r.location.origin:r.location.href),He(c,"No window.location.(origin|href) available to create URL");let d=typeof u=="string"?u:ts(u);return d=d.replace(/ $/,"%20"),!o&&bx.test(d)&&(d=c+d),new URL(d,c)}function jx(r,u,o="/"){return Ug(r,u,o,!1)}function Ug(r,u,o,c,d){let x=typeof u=="string"?Fl(u):u,m=ma(x.pathname||"/",o);if(m==null)return null;let j=Hg(r),p=null,h=Jg(m);for(let N=0;p==null&&N<j.length;++N)p=Kg(j[N],h,c);return p}function Hg(r){let u=Nx(r);return Bg(u),u}function Nx(r,u=[],o=[],c="",d=!1){let x=(m,j,p=d,h)=>{let N={relativePath:h===void 0?m.path||"":h,caseSensitive:m.caseSensitive===!0,childrenIndex:j,route:m};if(N.relativePath.startsWith("/")){if(!N.relativePath.startsWith(c)&&p)return;He(N.relativePath.startsWith(c),`Absolute route path "${N.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),N.relativePath=N.relativePath.slice(c.length)}let v=$t([c,N.relativePath]),T=o.concat(N);m.children&&m.children.length>0&&(He(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Nx(m.children,u,T,v,p)),!(m.path==null&&!m.index)&&u.push({path:v,score:Xg(v,m.index),routesMeta:T.map((D,_)=>{let[A,b]=Ex(D.relativePath,D.caseSensitive,_===T.length-1);return{...D,matcher:A,compiledParams:b}})})};return r.forEach((m,j)=>{if(m.path===""||!m.path?.includes("?"))x(m,j);else for(let p of Sx(m.path))x(m,j,!0,p)}),u}function Sx(r){let u=r.split("/");if(u.length===0)return[];let[o,...c]=u,d=o.endsWith("?"),x=o.replace(/\?$/,"");if(c.length===0)return d?[x,""]:[x];let m=Sx(c.join("/")),j=[];return j.push(...m.map(p=>p===""?x:[x,p].join("/"))),d&&j.push(...m),j.map(p=>r.startsWith("/")&&p===""?"/":p)}function Bg(r){r.sort((u,o)=>u.score!==o.score?o.score-u.score:Zg(u.routesMeta.map(c=>c.childrenIndex),o.routesMeta.map(c=>c.childrenIndex)))}var $g=/^:[\w-]+$/,qg=3,Yg=2,Gg=1,Vg=10,Qg=-2,J0=r=>r==="*";function Xg(r,u){let o=r.split("/"),c=o.length;return o.some(J0)&&(c+=Qg),u&&(c+=Yg),o.filter(d=>!J0(d)).reduce((d,x)=>d+($g.test(x)?qg:x===""?Gg:Vg),c)}function Zg(r,u){return r.length===u.length&&r.slice(0,-1).every((c,d)=>c===u[d])?r[r.length-1]-u[u.length-1]:0}function Kg(r,u,o=!1){let{routesMeta:c}=r,d={},x="/",m=[];for(let j=0;j<c.length;++j){let p=c[j],h=j===c.length-1,N=x==="/"?u:u.slice(x.length)||"/",v={path:p.relativePath,caseSensitive:p.caseSensitive,end:h},T=p.matcher&&p.compiledParams?wx(v,N,p.matcher,p.compiledParams):Rr(v,N),D=p.route;if(!T&&h&&o&&!c[c.length-1].route.index&&(T=Rr({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},N)),!T)return null;Object.assign(d,T.params),m.push({params:d,pathname:$t([x,T.pathname]),pathnameBase:Pg($t([x,T.pathnameBase])),route:D}),T.pathnameBase!=="/"&&(x=$t([x,T.pathnameBase]))}return m}function Rr(r,u){typeof r=="string"&&(r={path:r,caseSensitive:!1,end:!0});let[o,c]=Ex(r.path,r.caseSensitive,r.end);return wx(r,u,o,c)}function wx(r,u,o,c){let d=u.match(o);if(!d)return null;let x=d[0],m=x.replace(/(.)\/+$/,"$1"),j=d.slice(1);return{params:c.reduce((h,{paramName:N,isOptional:v},T)=>{if(N==="*"){let _=j[T]||"";m=x.slice(0,x.length-_.length).replace(/(.)\/+$/,"$1")}const D=j[T];return v&&!D?h[N]=void 0:h[N]=(D||"").replace(/%2F/g,"/"),h},{}),pathname:x,pathnameBase:m,pattern:r}}function Ex(r,u=!1,o=!0){qt(r==="*"||!r.endsWith("*")||r.endsWith("/*"),`Route path "${r}" will be treated as if it were "${r.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${r.replace(/\*$/,"/*")}".`);let c=[],d="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,j,p,h,N)=>{if(c.push({paramName:j,isOptional:p!=null}),p){let v=N.charAt(h+m.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return r.endsWith("*")?(c.push({paramName:"*"}),d+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?d+="\\/*$":r!==""&&r!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,u?void 0:"i"),c]}function Jg(r){try{return r.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return qt(!1,`The URL path "${r}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${u}).`),r}}function ma(r,u){if(u==="/")return r;if(!r.toLowerCase().startsWith(u.toLowerCase()))return null;let o=u.endsWith("/")?u.length-1:u.length,c=r.charAt(o);return c&&c!=="/"?null:r.slice(o)||"/"}function Wg(r,u="/"){let{pathname:o,search:c="",hash:d=""}=typeof r=="string"?Fl(r):r,x;return o?(o=Tx(o),o.startsWith("/")?x=W0(o.substring(1),"/"):x=W0(o,u)):x=u,{pathname:x,search:Ig(c),hash:ep(d)}}function W0(r,u){let o=Mr(u).split("/");return r.split("/").forEach(d=>{d===".."?o.length>1&&o.pop():d!=="."&&o.push(d)}),o.length>1?o.join("/"):"/"}function io(r,u,o,c){return`Cannot include a '${r}' character in a manually specified \`to.${u}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Fg(r){return r.filter((u,o)=>o===0||u.route.path&&u.route.path.length>0)}function Cx(r){let u=Fg(r);return u.map((o,c)=>c===u.length-1?o.pathname:o.pathnameBase)}function No(r,u,o,c=!1){let d;typeof r=="string"?d=Fl(r):(d={...r},He(!d.pathname||!d.pathname.includes("?"),io("?","pathname","search",d)),He(!d.pathname||!d.pathname.includes("#"),io("#","pathname","hash",d)),He(!d.search||!d.search.includes("#"),io("#","search","hash",d)));let x=r===""||d.pathname==="",m=x?"/":d.pathname,j;if(m==null)j=o;else{let v=u.length-1;if(!c&&m.startsWith("..")){let T=m.split("/");for(;T[0]==="..";)T.shift(),v-=1;d.pathname=T.join("/")}j=v>=0?u[v]:"/"}let p=Wg(d,j),h=m&&m!=="/"&&m.endsWith("/"),N=(x||m===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(h||N)&&(p.pathname+="/"),p}var Tx=r=>r.replace(/[\\/]{2,}/g,"/"),$t=r=>Tx(r.join("/")),Mr=r=>r.replace(/\/+$/,""),Pg=r=>Mr(r).replace(/^\/*/,"/"),Ig=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,ep=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r,tp=class{constructor(r,u,o,c=!1){this.status=r,this.statusText=u||"",this.internal=c,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function ap(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}function lp(r){let u=r.map(o=>o.route.path).filter(Boolean);return $t(u)||"/"}var Ax=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Rx(r,u){let o=r;if(typeof o!="string"||!jo.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let c=o,d=!1;if(Ax)try{let x=new URL(window.location.href),m=bx.test(o)?new URL(kg(o,x.protocol)):new URL(o),j=ma(m.pathname,u);m.origin===x.origin&&j!=null?o=j+m.search+m.hash:d=!0}catch{qt(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:d,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Mx=["POST","PUT","PATCH","DELETE"];new Set(Mx);var np=["GET",...Mx];new Set(np);var sp=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function rp(r){try{return sp.includes(new URL(r).protocol)}catch{return!1}}var Pl=y.createContext(null);Pl.displayName="DataRouter";var Dr=y.createContext(null);Dr.displayName="DataRouterState";var Dx=y.createContext(!1);function ip(){return y.useContext(Dx)}var kx=y.createContext({isTransitioning:!1});kx.displayName="ViewTransition";var cp=y.createContext(new Map);cp.displayName="Fetchers";var op=y.createContext(null);op.displayName="Await";var Lt=y.createContext(null);Lt.displayName="Navigation";var as=y.createContext(null);as.displayName="Location";var Kt=y.createContext({outlet:null,matches:[],isDataRoute:!1});Kt.displayName="Route";var So=y.createContext(null);So.displayName="RouteError";var _x="REACT_ROUTER_ERROR",up="REDIRECT",dp="ROUTE_ERROR_RESPONSE";function fp(r){if(r.startsWith(`${_x}:${up}:{`))try{let u=JSON.parse(r.slice(28));if(typeof u=="object"&&u&&typeof u.status=="number"&&typeof u.statusText=="string"&&typeof u.location=="string"&&typeof u.reloadDocument=="boolean"&&typeof u.replace=="boolean")return u}catch{}}function xp(r){if(r.startsWith(`${_x}:${dp}:{`))try{let u=JSON.parse(r.slice(40));if(typeof u=="object"&&u&&typeof u.status=="number"&&typeof u.statusText=="string")return new tp(u.status,u.statusText,u.data)}catch{}}function mp(r,{relative:u}={}){He(ls(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:c}=y.useContext(Lt),{hash:d,pathname:x,search:m}=ns(r,{relative:u}),j=x;return o!=="/"&&(j=x==="/"?o:$t([o,x])),c.createHref({pathname:j,search:m,hash:d})}function ls(){return y.useContext(as)!=null}function Yt(){return He(ls(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(as).location}var Ox="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function zx(r){y.useContext(Lt).static||y.useLayoutEffect(r)}function wo(){let{isDataRoute:r}=y.useContext(Kt);return r?Ap():hp()}function hp(){He(ls(),"useNavigate() may be used only in the context of a <Router> component.");let r=y.useContext(Pl),{basename:u,navigator:o}=y.useContext(Lt),{matches:c}=y.useContext(Kt),{pathname:d}=Yt(),x=JSON.stringify(Cx(c)),m=y.useRef(!1);return zx(()=>{m.current=!0}),y.useCallback((p,h={})=>{if(qt(m.current,Ox),!m.current)return;if(typeof p=="number"){o.go(p);return}let N=No(p,JSON.parse(x),d,h.relative==="path");r==null&&u!=="/"&&(N.pathname=N.pathname==="/"?u:$t([u,N.pathname])),(h.replace?o.replace:o.push)(N,h.state,h)},[u,o,x,d,r])}y.createContext(null);function gp(){let{matches:r}=y.useContext(Kt);return r[r.length-1]?.params??{}}function ns(r,{relative:u}={}){let{matches:o}=y.useContext(Kt),{pathname:c}=Yt(),d=JSON.stringify(Cx(o));return y.useMemo(()=>No(r,JSON.parse(d),c,u==="path"),[r,d,c,u])}function pp(r,u){return Lx(r,u)}function Lx(r,u,o){He(ls(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=y.useContext(Lt),{matches:d}=y.useContext(Kt),x=d[d.length-1],m=x?x.params:{},j=x?x.pathname:"/",p=x?x.pathnameBase:"/",h=x&&x.route;{let b=h&&h.path||"";Hx(j,!h||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${j}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
-
11
- Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let N=Yt(),v;if(u){let b=typeof u=="string"?Fl(u):u;He(p==="/"||b.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${b.pathname}" was given in the \`location\` prop.`),v=b}else v=N;let T=v.pathname||"/",D=T;if(p!=="/"){let b=p.replace(/^\//,"").split("/");D="/"+T.replace(/^\//,"").split("/").slice(b.length).join("/")}let _=o&&o.state.matches.length?o.state.matches.map(b=>Object.assign(b,{route:o.manifest[b.route.id]||b.route})):jx(r,{pathname:D});qt(h||_!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),qt(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=Np(_&&_.map(b=>Object.assign({},b,{params:Object.assign({},m,b.params),pathname:$t([p,c.encodeLocation?c.encodeLocation(b.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?p:$t([p,c.encodeLocation?c.encodeLocation(b.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),d,o);return u&&A?y.createElement(as.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...v},navigationType:"POP"}},A):A}function yp(){let r=Tp(),u=ap(r)?`${r.status} ${r.statusText}`:r instanceof Error?r.message:JSON.stringify(r),o=r instanceof Error?r.stack:null,c="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:c},x={padding:"2px 4px",backgroundColor:c},m=null;return console.error("Error handled by React Router default ErrorBoundary:",r),m=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:x},"ErrorBoundary")," or"," ",y.createElement("code",{style:x},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},u),o?y.createElement("pre",{style:d},o):null,m)}var vp=y.createElement(yp,null),Ux=class extends y.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,u){return u.location!==r.location||u.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:u.error,location:u.location,revalidation:r.revalidation||u.revalidation}}componentDidCatch(r,u){this.props.onError?this.props.onError(r,u):console.error("React Router caught the following error during render",r)}render(){let r=this.state.error;if(this.context&&typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){const o=xp(r.digest);o&&(r=o)}let u=r!==void 0?y.createElement(Kt.Provider,{value:this.props.routeContext},y.createElement(So.Provider,{value:r,children:this.props.component})):this.props.children;return this.context?y.createElement(bp,{error:r},u):u}};Ux.contextType=Dx;var co=new WeakMap;function bp({children:r,error:u}){let{basename:o}=y.useContext(Lt);if(typeof u=="object"&&u&&"digest"in u&&typeof u.digest=="string"){let c=fp(u.digest);if(c){let d=co.get(u);if(d)throw d;let x=Rx(c.location,o),m=x.absoluteURL||x.to;if(rp(m))throw new Error("Invalid redirect location");if(Ax&&!co.get(u))if(x.isExternal||c.reloadDocument)window.location.href=m;else{const j=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(x.to,{replace:c.replace}));throw co.set(u,j),j}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m}`})}}return r}function jp({routeContext:r,match:u,children:o}){let c=y.useContext(Pl);return c&&c.static&&c.staticContext&&(u.route.errorElement||u.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=u.route.id),y.createElement(Kt.Provider,{value:r},o)}function Np(r,u=[],o){let c=o?.state;if(r==null){if(!c)return null;if(c.errors)r=c.matches;else if(u.length===0&&!c.initialized&&c.matches.length>0)r=c.matches;else return null}let d=r,x=c?.errors;if(x!=null){let N=d.findIndex(v=>v.route.id&&x?.[v.route.id]!==void 0);He(N>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(x).join(",")}`),d=d.slice(0,Math.min(d.length,N+1))}let m=!1,j=-1;if(o&&c){m=c.renderFallback;for(let N=0;N<d.length;N++){let v=d[N];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(j=N),v.route.id){let{loaderData:T,errors:D}=c,_=v.route.loader&&!T.hasOwnProperty(v.route.id)&&(!D||D[v.route.id]===void 0);if(v.route.lazy||_){o.isStatic&&(m=!0),j>=0?d=d.slice(0,j+1):d=[d[0]];break}}}}let p=o?.onError,h=c&&p?(N,v)=>{p(N,{location:c.location,params:c.matches?.[0]?.params??{},pattern:lp(c.matches),errorInfo:v})}:void 0;return d.reduceRight((N,v,T)=>{let D,_=!1,A=null,b=null;c&&(D=x&&v.route.id?x[v.route.id]:void 0,A=v.route.errorElement||vp,m&&(j<0&&T===0?(Hx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,b=null):j===T&&(_=!0,b=v.route.hydrateFallbackElement||null)));let w=u.concat(d.slice(0,T+1)),C=()=>{let O;return D?O=A:_?O=b:v.route.Component?O=y.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=N,y.createElement(jp,{match:v,routeContext:{outlet:N,matches:w,isDataRoute:c!=null},children:O})};return c&&(v.route.ErrorBoundary||v.route.errorElement||T===0)?y.createElement(Ux,{location:c.location,revalidation:c.revalidation,component:A,error:D,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:h}):C()},null)}function Eo(r){return`${r} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sp(r){let u=y.useContext(Pl);return He(u,Eo(r)),u}function wp(r){let u=y.useContext(Dr);return He(u,Eo(r)),u}function Ep(r){let u=y.useContext(Kt);return He(u,Eo(r)),u}function Co(r){let u=Ep(r),o=u.matches[u.matches.length-1];return He(o.route.id,`${r} can only be used on routes that contain a unique "id"`),o.route.id}function Cp(){return Co("useRouteId")}function Tp(){let r=y.useContext(So),u=wp("useRouteError"),o=Co("useRouteError");return r!==void 0?r:u.errors?.[o]}function Ap(){let{router:r}=Sp("useNavigate"),u=Co("useNavigate"),o=y.useRef(!1);return zx(()=>{o.current=!0}),y.useCallback(async(d,x={})=>{qt(o.current,Ox),o.current&&(typeof d=="number"?await r.navigate(d):await r.navigate(d,{fromRouteId:u,...x}))},[r,u])}var F0={};function Hx(r,u,o){!u&&!F0[r]&&(F0[r]=!0,qt(!1,o))}y.memo(Rp);function Rp({routes:r,manifest:u,future:o,state:c,isStatic:d,onError:x}){return Lx(r,void 0,{manifest:u,state:c,isStatic:d,onError:x})}function qe(r){He(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Mp({basename:r="/",children:u=null,location:o,navigationType:c="POP",navigator:d,static:x=!1,useTransitions:m}){He(!ls(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let j=r.replace(/^\/*/,"/"),p=y.useMemo(()=>({basename:j,navigator:d,static:x,useTransitions:m,future:{}}),[j,d,x,m]);typeof o=="string"&&(o=Fl(o));let{pathname:h="/",search:N="",hash:v="",state:T=null,key:D="default",mask:_}=o,A=y.useMemo(()=>{let b=ma(h,j);return b==null?null:{location:{pathname:b,search:N,hash:v,state:T,key:D,mask:_},navigationType:c}},[j,h,N,v,T,D,c,_]);return qt(A!=null,`<Router basename="${j}"> is not able to match the URL "${h}${N}${v}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:y.createElement(Lt.Provider,{value:p},y.createElement(as.Provider,{children:u,value:A}))}function Dp({children:r,location:u}){return pp(go(r),u)}function go(r,u=[]){let o=[];return y.Children.forEach(r,(c,d)=>{if(!y.isValidElement(c))return;let x=[...u,d];if(c.type===y.Fragment){o.push.apply(o,go(c.props.children,x));return}He(c.type===qe,`[${typeof c.type=="string"?c.type:c.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),He(!c.props.index||!c.props.children,"An index route cannot have child routes.");let m={id:c.props.id||x.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,middleware:c.props.middleware,loader:c.props.loader,action:c.props.action,hydrateFallbackElement:c.props.hydrateFallbackElement,HydrateFallback:c.props.HydrateFallback,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.hasErrorBoundary===!0||c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(m.children=go(c.props.children,x)),o.push(m)}),o}var Cr="get",Tr="application/x-www-form-urlencoded";function kr(r){return typeof HTMLElement<"u"&&r instanceof HTMLElement}function kp(r){return kr(r)&&r.tagName.toLowerCase()==="button"}function _p(r){return kr(r)&&r.tagName.toLowerCase()==="form"}function Op(r){return kr(r)&&r.tagName.toLowerCase()==="input"}function zp(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Lp(r,u){return r.button===0&&(!u||u==="_self")&&!zp(r)}function po(r=""){return new URLSearchParams(typeof r=="string"||Array.isArray(r)||r instanceof URLSearchParams?r:Object.keys(r).reduce((u,o)=>{let c=r[o];return u.concat(Array.isArray(c)?c.map(d=>[o,d]):[[o,c]])},[]))}function Up(r,u){let o=po(r);return u&&u.forEach((c,d)=>{o.has(d)||u.getAll(d).forEach(x=>{o.append(d,x)})}),o}var wr=null;function Hp(){if(wr===null)try{new FormData(document.createElement("form"),0),wr=!1}catch{wr=!0}return wr}var Bp=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function oo(r){return r!=null&&!Bp.has(r)?(qt(!1,`"${r}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tr}"`),null):r}function $p(r,u){let o,c,d,x,m;if(_p(r)){let j=r.getAttribute("action");c=j?ma(j,u):null,o=r.getAttribute("method")||Cr,d=oo(r.getAttribute("enctype"))||Tr,x=new FormData(r)}else if(kp(r)||Op(r)&&(r.type==="submit"||r.type==="image")){let j=r.form;if(j==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=r.getAttribute("formaction")||j.getAttribute("action");if(c=p?ma(p,u):null,o=r.getAttribute("formmethod")||j.getAttribute("method")||Cr,d=oo(r.getAttribute("formenctype"))||oo(j.getAttribute("enctype"))||Tr,x=new FormData(j,r),!Hp()){let{name:h,type:N,value:v}=r;if(N==="image"){let T=h?`${h}.`:"";x.append(`${T}x`,"0"),x.append(`${T}y`,"0")}else h&&x.append(h,v)}}else{if(kr(r))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Cr,c=null,d=Tr,m=r}return x&&d==="text/plain"&&(m=x,x=void 0),{action:c,method:o.toLowerCase(),encType:d,formData:x,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function To(r,u){if(r===!1||r===null||typeof r>"u")throw new Error(u)}function Bx(r,u,o,c){let d=typeof r=="string"?new URL(r,typeof window>"u"?"server://singlefetch/":window.location.origin):r;return o?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${c}`:d.pathname=`${d.pathname}.${c}`:d.pathname==="/"?d.pathname=`_root.${c}`:u&&ma(d.pathname,u)==="/"?d.pathname=`${Mr(u)}/_root.${c}`:d.pathname=`${Mr(d.pathname)}.${c}`,d}async function qp(r,u){if(r.id in u)return u[r.id];try{let o=await import(r.module);return u[r.id]=o,o}catch(o){return console.error(`Error loading route module \`${r.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Yp(r){return r==null?!1:r.href==null?r.rel==="preload"&&typeof r.imageSrcSet=="string"&&typeof r.imageSizes=="string":typeof r.rel=="string"&&typeof r.href=="string"}async function Gp(r,u,o){let c=await Promise.all(r.map(async d=>{let x=u.routes[d.route.id];if(x){let m=await qp(x,o);return m.links?m.links():[]}return[]}));return Zp(c.flat(1).filter(Yp).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function P0(r,u,o,c,d,x){let m=(p,h)=>o[h]?p.route.id!==o[h].route.id:!0,j=(p,h)=>o[h].pathname!==p.pathname||o[h].route.path?.endsWith("*")&&o[h].params["*"]!==p.params["*"];return x==="assets"?u.filter((p,h)=>m(p,h)||j(p,h)):x==="data"?u.filter((p,h)=>{let N=c.routes[p.route.id];if(!N||!N.hasLoader)return!1;if(m(p,h)||j(p,h))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:o[0]?.params||{},nextUrl:new URL(r,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function Vp(r,u,{includeHydrateFallback:o}={}){return Qp(r.map(c=>{let d=u.routes[c.route.id];if(!d)return[];let x=[d.module];return d.clientActionModule&&(x=x.concat(d.clientActionModule)),d.clientLoaderModule&&(x=x.concat(d.clientLoaderModule)),o&&d.hydrateFallbackModule&&(x=x.concat(d.hydrateFallbackModule)),d.imports&&(x=x.concat(d.imports)),x}).flat(1))}function Qp(r){return[...new Set(r)]}function Xp(r){let u={},o=Object.keys(r).sort();for(let c of o)u[c]=r[c];return u}function Zp(r,u){let o=new Set;return new Set(u),r.reduce((c,d)=>{let x=JSON.stringify(Xp(d));return o.has(x)||(o.add(x),c.push({key:x,link:d})),c},[])}function Ao(){let r=y.useContext(Pl);return To(r,"You must render this element inside a <DataRouterContext.Provider> element"),r}function Kp(){let r=y.useContext(Dr);return To(r,"You must render this element inside a <DataRouterStateContext.Provider> element"),r}var Ro=y.createContext(void 0);Ro.displayName="FrameworkContext";function _r(){let r=y.useContext(Ro);return To(r,"You must render this element inside a <HydratedRouter> element"),r}function Jp(r,u){let o=y.useContext(Ro),[c,d]=y.useState(!1),[x,m]=y.useState(!1),{onFocus:j,onBlur:p,onMouseEnter:h,onMouseLeave:N,onTouchStart:v}=u,T=y.useRef(null);y.useEffect(()=>{if(r==="render"&&m(!0),r==="viewport"){let A=w=>{w.forEach(C=>{m(C.isIntersecting)})},b=new IntersectionObserver(A,{threshold:.5});return T.current&&b.observe(T.current),()=>{b.disconnect()}}},[r]),y.useEffect(()=>{if(c){let A=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(A)}}},[c]);let D=()=>{d(!0)},_=()=>{d(!1),m(!1)};return o?r!=="intent"?[x,T,{}]:[x,T,{onFocus:Jn(j,D),onBlur:Jn(p,_),onMouseEnter:Jn(h,D),onMouseLeave:Jn(N,_),onTouchStart:Jn(v,D)}]:[!1,T,{}]}function Jn(r,u){return o=>{r&&r(o),o.defaultPrevented||u(o)}}function Wp({page:r,...u}){let o=ip(),{nonce:c}=_r(),{router:d}=Ao(),x=y.useMemo(()=>jx(d.routes,r,d.basename),[d.routes,r,d.basename]);return x?(u.nonce==null&&c&&(u={...u,nonce:c}),o?y.createElement(Pp,{page:r,matches:x,...u}):y.createElement(Ip,{page:r,matches:x,...u})):null}function Fp(r){let{manifest:u,routeModules:o}=_r(),[c,d]=y.useState([]);return y.useEffect(()=>{let x=!1;return Gp(r,u,o).then(m=>{x||d(m)}),()=>{x=!0}},[r,u,o]),c}function Pp({page:r,matches:u,...o}){let c=Yt(),{future:d}=_r(),{basename:x}=Ao(),m=y.useMemo(()=>{if(r===c.pathname+c.search+c.hash)return[];let j=Bx(r,x,d.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,h=[];for(let N of u)typeof N.route.shouldRevalidate=="function"?p=!0:h.push(N.route.id);return p&&h.length>0&&j.searchParams.set("_routes",h.join(",")),[j.pathname+j.search]},[x,d.v8_trailingSlashAwareDataRequests,r,c,u]);return y.createElement(y.Fragment,null,m.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})))}function Ip({page:r,matches:u,...o}){let c=Yt(),{future:d,manifest:x,routeModules:m}=_r(),{basename:j}=Ao(),{loaderData:p,matches:h}=Kp(),N=y.useMemo(()=>P0(r,u,h,x,c,"data"),[r,u,h,x,c]),v=y.useMemo(()=>P0(r,u,h,x,c,"assets"),[r,u,h,x,c]),T=y.useMemo(()=>{if(r===c.pathname+c.search+c.hash)return[];let A=new Set,b=!1;if(u.forEach(C=>{let O=x.routes[C.route.id];!O||!O.hasLoader||(!N.some(F=>F.route.id===C.route.id)&&C.route.id in p&&m[C.route.id]?.shouldRevalidate||O.hasClientLoader?b=!0:A.add(C.route.id))}),A.size===0)return[];let w=Bx(r,j,d.v8_trailingSlashAwareDataRequests,"data");return b&&A.size>0&&w.searchParams.set("_routes",u.filter(C=>A.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[j,d.v8_trailingSlashAwareDataRequests,p,c,x,N,u,r,m]),D=y.useMemo(()=>Vp(v,x),[v,x]),_=Fp(v);return y.createElement(y.Fragment,null,T.map(A=>y.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...o})),D.map(A=>y.createElement("link",{key:A,rel:"modulepreload",href:A,...o})),_.map(({key:A,link:b})=>y.createElement("link",{key:A,nonce:o.nonce,...b,crossOrigin:b.crossOrigin??o.crossOrigin})))}function ey(...r){return u=>{r.forEach(o=>{typeof o=="function"?o(u):o!=null&&(o.current=u)})}}var ty=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ty&&(window.__reactRouterVersion="7.18.2")}catch{}function ay({basename:r,children:u,useTransitions:o,window:c}){let d=y.useRef();d.current==null&&(d.current=_g({window:c,v5Compat:!0}));let x=d.current,[m,j]=y.useState({action:x.action,location:x.location}),p=y.useCallback(h=>{o===!1?j(h):y.startTransition(()=>j(h))},[o]);return y.useLayoutEffect(()=>x.listen(p),[x,p]),y.createElement(Mp,{basename:r,children:u,location:m.location,navigationType:m.action,navigator:x,useTransitions:o})}var Qe=y.forwardRef(function({onClick:u,discover:o="render",prefetch:c="none",relative:d,reloadDocument:x,replace:m,mask:j,state:p,target:h,to:N,preventScrollReset:v,viewTransition:T,defaultShouldRevalidate:D,..._},A){let{basename:b,navigator:w,useTransitions:C}=y.useContext(Lt),O=typeof N=="string"&&jo.test(N),F=Rx(N,b);N=F.to;let X=mp(N,{relative:d}),ee=Yt(),W=null;if(j){let q=No(j,[],ee.mask?ee.mask.pathname:"/",!0);b!=="/"&&(q.pathname=q.pathname==="/"?b:$t([b,q.pathname])),W=w.createHref(q)}let[J,U,P]=Jp(c,_),I=sy(N,{replace:m,mask:j,state:p,target:h,preventScrollReset:v,relative:d,viewTransition:T,defaultShouldRevalidate:D,useTransitions:C});function re(q){u&&u(q),q.defaultPrevented||I(q)}let Ee=!(F.isExternal||x),Ce=y.createElement("a",{..._,...P,href:(Ee?W:void 0)||F.absoluteURL||X,onClick:Ee?re:u,ref:ey(A,U),target:h,"data-discover":!O&&o==="render"?"true":void 0});return J&&!O?y.createElement(y.Fragment,null,Ce,y.createElement(Wp,{page:X})):Ce});Qe.displayName="Link";var yo=y.forwardRef(function({"aria-current":u="page",caseSensitive:o=!1,className:c="",end:d=!1,style:x,to:m,viewTransition:j,children:p,...h},N){let v=ns(m,{relative:h.relative}),T=Yt(),D=y.useContext(Dr),{navigator:_,basename:A}=y.useContext(Lt),b=D!=null&&uy(v)&&j===!0,w=_.encodeLocation?_.encodeLocation(v).pathname:v.pathname,C=T.pathname,O=D&&D.navigation&&D.navigation.location?D.navigation.location.pathname:null;o||(C=C.toLowerCase(),O=O?O.toLowerCase():null,w=w.toLowerCase()),O&&A&&(O=ma(O,A)||O);const F=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let X=C===w||!d&&C.startsWith(w)&&C.charAt(F)==="/",ee=O!=null&&(O===w||!d&&O.startsWith(w)&&O.charAt(w.length)==="/"),W={isActive:X,isPending:ee,isTransitioning:b},J=X?u:void 0,U;typeof c=="function"?U=c(W):U=[c,X?"active":null,ee?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let P=typeof x=="function"?x(W):x;return y.createElement(Qe,{...h,"aria-current":J,className:U,ref:N,style:P,to:m,viewTransition:j},typeof p=="function"?p(W):p)});yo.displayName="NavLink";var ly=y.forwardRef(({discover:r="render",fetcherKey:u,navigate:o,reloadDocument:c,replace:d,state:x,method:m=Cr,action:j,onSubmit:p,relative:h,preventScrollReset:N,viewTransition:v,defaultShouldRevalidate:T,...D},_)=>{let{useTransitions:A}=y.useContext(Lt),b=cy(),w=oy(j,{relative:h}),C=m.toLowerCase()==="get"?"get":"post",O=typeof j=="string"&&jo.test(j),F=X=>{if(p&&p(X),X.defaultPrevented)return;X.preventDefault();let ee=X.nativeEvent.submitter,W=ee?.getAttribute("formmethod")||m,J=()=>b(ee||X.currentTarget,{fetcherKey:u,method:W,navigate:o,replace:d,state:x,relative:h,preventScrollReset:N,viewTransition:v,defaultShouldRevalidate:T});A&&o!==!1?y.startTransition(()=>J()):J()};return y.createElement("form",{ref:_,method:C,action:w,onSubmit:c?p:F,...D,"data-discover":!O&&r==="render"?"true":void 0})});ly.displayName="Form";function ny(r){return`${r} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $x(r){let u=y.useContext(Pl);return He(u,ny(r)),u}function sy(r,{target:u,replace:o,mask:c,state:d,preventScrollReset:x,relative:m,viewTransition:j,defaultShouldRevalidate:p,useTransitions:h}={}){let N=wo(),v=Yt(),T=ns(r,{relative:m});return y.useCallback(D=>{if(Lp(D,u)){D.preventDefault();let _=o!==void 0?o:ts(v)===ts(T),A=()=>N(r,{replace:_,mask:c,state:d,preventScrollReset:x,relative:m,viewTransition:j,defaultShouldRevalidate:p});h?y.startTransition(()=>A()):A()}},[v,N,T,o,c,d,u,r,x,m,j,p,h])}function Or(r){qt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let u=y.useRef(po(r)),o=y.useRef(!1),c=Yt(),d=y.useMemo(()=>Up(c.search,o.current?null:u.current),[c.search]),x=wo(),m=y.useCallback((j,p)=>{const h=po(typeof j=="function"?j(new URLSearchParams(d)):j);o.current=!0,x("?"+h,p)},[x,d]);return[d,m]}var ry=0,iy=()=>`__${String(++ry)}__`;function cy(){let{router:r}=$x("useSubmit"),{basename:u}=y.useContext(Lt),o=Cp(),c=r.fetch,d=r.navigate;return y.useCallback(async(x,m={})=>{let{action:j,method:p,encType:h,formData:N,body:v}=$p(x,u);if(m.navigate===!1){let T=m.fetcherKey||iy();await c(T,o,m.action||j,{defaultShouldRevalidate:m.defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:N,body:v,formMethod:m.method||p,formEncType:m.encType||h,flushSync:m.flushSync})}else await d(m.action||j,{defaultShouldRevalidate:m.defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:N,body:v,formMethod:m.method||p,formEncType:m.encType||h,replace:m.replace,state:m.state,fromRouteId:o,flushSync:m.flushSync,viewTransition:m.viewTransition})},[c,d,u,o])}function oy(r,{relative:u}={}){let{basename:o}=y.useContext(Lt),c=y.useContext(Kt);He(c,"useFormAction must be used inside a RouteContext");let[d]=c.matches.slice(-1),x={...ns(r||".",{relative:u})},m=Yt();if(r==null){x.search=m.search;let j=new URLSearchParams(x.search),p=j.getAll("index");if(p.some(N=>N==="")){j.delete("index"),p.filter(v=>v).forEach(v=>j.append("index",v));let N=j.toString();x.search=N?`?${N}`:""}}return(!r||r===".")&&d.route.index&&(x.search=x.search?x.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(x.pathname=x.pathname==="/"?o:$t([o,x.pathname])),ts(x)}function uy(r,{relative:u}={}){let o=y.useContext(kx);He(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=$x("useViewTransitionState"),d=ns(r,{relative:u});if(!o.isTransitioning)return!1;let x=ma(o.currentLocation.pathname,c)||o.currentLocation.pathname,m=ma(o.nextLocation.pathname,c)||o.nextLocation.pathname;return Rr(d.pathname,m)!=null||Rr(d.pathname,x)!=null}function Mo(r,u){const{timeout:o=3e4,retries:c=1,retryDelay:d=2e3}={},[x,m]=y.useState(null),[j,p]=y.useState(!0),[h,N]=y.useState(null),[v,T]=y.useState(0),[D,_]=y.useState(null),A=y.useCallback(()=>T(b=>b+1),[]);return y.useEffect(()=>{if(!r){p(!1),m(null),N(null);return}let b=!1;p(!0),N(null);async function w(C){const O=new AbortController,F=setTimeout(()=>O.abort(),o);try{const X=await fetch(r,{signal:O.signal});if(clearTimeout(F),!X.ok)throw new Error(`HTTP ${X.status}`);const ee=X.headers.get("content-type")||"";if(!ee.includes("application/json"))throw new Error(`Expected JSON response but got ${ee||"unknown"} — server may be restarting`);const W=await X.json();b||(m(W.data??W),N(null),_(new Date),p(!1))}catch(X){if(clearTimeout(F),b)return;if(C>0&&X.name!=="AbortError")return await new Promise(ee=>setTimeout(ee,d)),b?void 0:w(C-1);X.name==="AbortError"?N(`Request timed out (${Math.round(o/1e3)}s)`):N(String(X.message||X)),p(!1)}}return w(c),()=>{b=!0}},[r,v,o,c,d]),{data:x,loading:j,error:h,refetch:A,fetchedAt:D}}const qx=y.createContext({projects:[],activeProject:null,setActiveProject:()=>{},refreshProjects:()=>{}});function ha(){return y.useContext(qx)}function dy(){const[r,u]=y.useState([]),[o,c]=Or(),d=y.useCallback(async()=>{try{const h=await(await fetch("/api/projects")).json();h.ok&&u(h.data||[])}catch{}},[]);y.useEffect(()=>{d()},[d]);const x=o.get("project"),m=x?r.find(p=>p.id===x)||r[0]||null:r[0]||null,j=y.useCallback(p=>{c(h=>(h.set("project",p),h))},[c]);return{projects:r,activeProject:m,setActiveProject:j,refreshProjects:d}}function Re(r,u){const{activeProject:o}=ha(),c=r.includes("?")?"&":"?",d=o?`${r}${c}project=${o.id}`:r;return Mo(d)}const Do=y.createContext(null),fy=["heartbeat","increment-update","analytics-event","cost-update","notification","sync-update","sync-audit","error-detected","config-changed","activity","command-output","command-complete","job-progress","marketplace-scan","submission-update","verification-complete","hook-event","hook-agent"];function xy({url:r="/api/events",children:u}){const[o,c]=y.useState("connecting"),d=y.useRef(null),x=y.useRef(null),m=y.useRef(new Map),j=y.useCallback(()=>{d.current&&d.current.close(),c("connecting");const h=new EventSource(r);d.current=h;for(const N of fy)h.addEventListener(N,v=>{let T;try{T=JSON.parse(v.data)}catch{return}const D=m.current.get(N);if(D)for(const _ of D)try{_(T)}catch{}});h.onopen=()=>c("connected"),h.onerror=()=>{h.close(),c("disconnected"),x.current=setTimeout(()=>{d.current===h&&j()},3e3)}},[r]);y.useEffect(()=>(j(),()=>{x.current&&(clearTimeout(x.current),x.current=null),d.current?.close(),d.current=null}),[j]);const p=y.useCallback((h,N)=>(m.current.has(h)||m.current.set(h,new Set),m.current.get(h).add(N),()=>{const v=m.current.get(h);v&&(v.delete(N),v.size===0&&m.current.delete(h))}),[]);return l.jsx(Do.Provider,{value:{status:o,subscribe:p},children:u})}function Oe(r,u){const o=y.useContext(Do),c=y.useRef(u);c.current=u,y.useEffect(()=>{if(!o)return;const d=x=>c.current(x);return o.subscribe(r,d)},[o,r])}function Yx(){return y.useContext(Do)?.status??"disconnected"}const I0=["backlog","active","blocked","review","done"],Wn={backlog:"Backlog",active:"In progress",blocked:"Blocked",review:"Review",done:"Done"},Ar=r=>r?new Date(r).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Unknown",Kl=r=>r||"Unknown";function ex({title:r,children:u,onClose:o}){const c=y.useRef(null);return y.useEffect(()=>{c.current?.showModal()},[]),l.jsxs("dialog",{ref:c,className:"work-dialog",onCancel:o,onClose:o,"aria-label":r,children:[l.jsxs("div",{className:"work-dialog-heading",children:[l.jsx("h2",{children:r}),l.jsx("button",{type:"button",className:"work-icon-button","aria-label":"Close dialog",onClick:o,children:"×"})]}),u]})}function tx({sessionsOnly:r=!1}){const{activeProject:u}=ha(),{data:o,error:c,loading:d,refetch:x}=Re("/api/work"),[m,j]=y.useState(""),[p,h]=y.useState(null),[N,v]=y.useState(!1),[T,D]=y.useState(!1),[_,A]=y.useState(""),[b,w]=y.useState(""),[C,O]=y.useState(null),F=u?`?project=${encodeURIComponent(u.id)}`:"",{data:X,loading:ee,refetch:W}=Mo(r||p?`/api/work/sessions${F}`:""),J=Yx();Oe("increment-update",x),y.useEffect(()=>{const q=setInterval(()=>{x(),(r||p)&&W()},15e3);return()=>clearInterval(q)},[x,W,r,p]),y.useEffect(()=>{h(null),v(!1)},[u?.id]);async function U(q,R,Q){if(T)return!1;D(!0),w("");try{const ne=u?`?project=${encodeURIComponent(u.id)}`:"",Z=await fetch(`/api/work${q}${ne}`,{method:R,headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}),xe=await Z.json();if(!Z.ok||!xe.ok)throw new Error(xe.error||"Could not save work");return x(),!0}catch(ne){return w(ne instanceof Error?ne.message:"Could not save work"),x(),!1}finally{D(!1)}}async function P(q,R){R!==q.state&&await U(`/${encodeURIComponent(q.id)}`,"PATCH",{revision:q.revision,state:R})&&A(`${q.title} moved to ${Wn[R]}.`)}const I=(o?.items??[]).filter(q=>`${q.title} ${q.summary} ${q.incrementId??""}`.toLowerCase().includes(m.toLowerCase())),re=o?.items.find(q=>q.id===p),Ee=[...new Map((o?.items??[]).filter(q=>q.incrementId).map(q=>[q.incrementId,q])).values()],Ce=u?`?project=${encodeURIComponent(u.id)}`:"";return l.jsxs("div",{className:"work-page",children:[l.jsxs("div",{className:"work-eyebrow",children:[l.jsx("span",{className:`work-live-dot ${J==="connected"?"connected":""}`}),J==="connected"?"LIVE WORKSPACE":"WORKSPACE",l.jsx("span",{children:"LOCAL · NO MODEL CALLS"})]}),l.jsxs("div",{className:"work-heading",children:[l.jsxs("div",{children:[l.jsx("h1",{children:r?"Execution history":"Work, without the reset."}),l.jsx("p",{children:r?"Follow the tools and people that carried each intent forward.":"Keep the intent. See the progress. Pick up with any tool."})]}),!r&&l.jsx("button",{className:"work-primary",onClick:()=>v(!0),children:"+ New intent"})]}),l.jsxs("div",{className:"work-metrics",children:[l.jsxs("div",{children:[l.jsx("span",{children:"In progress"}),l.jsx("strong",{children:o?.counts.active??"—"}),l.jsx("small",{children:"moving forward"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"Needs attention"}),l.jsx("strong",{className:"work-amber",children:o?.counts.blocked??"—"}),l.jsx("small",{children:"blocked or stale claims"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"Tasks complete"}),l.jsxs("strong",{children:[o?.totals.done??"—",l.jsxs("em",{children:[" / ",o?.totals.tasks??"—"]})]}),l.jsx("small",{children:"from the task ledger"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"Verification passed"}),l.jsx("strong",{children:o?.totals.verified??"—"}),l.jsx("small",{children:"linked increments with current reports"})]})]}),l.jsxs("div",{className:"work-toolbar",children:[l.jsxs("div",{className:"work-view-label",children:[r?"SETUPS & CONTINUATIONS":"INTENT BOARD",l.jsxs("span",{children:[I.length," items"]})]}),l.jsxs("label",{className:"work-search",children:[l.jsx("span",{"aria-hidden":"true",children:"⌕"}),l.jsx("input",{"aria-label":"Search work",value:m,onChange:q=>j(q.target.value),placeholder:"Find an intent or increment…"})]})]}),(b||c)&&l.jsxs("div",{role:"alert",className:"work-error",children:[b||c,l.jsx("button",{onClick:x,children:"Retry"})]}),l.jsx("span",{className:"work-sr-only",role:"status","aria-live":"polite",children:_}),o?.warnings.map(q=>l.jsx("p",{className:"work-warning",children:q},q)),d&&!o?l.jsx("p",{className:"work-empty",children:"Reading local work…"}):r?l.jsxs("div",{className:"work-session-list",children:[l.jsx(my,{sessions:X||[],loading:ee,items:o?.items||[],saving:T,link:async(q,R)=>{await U(`/${encodeURIComponent(R.id)}`,"PATCH",{revision:R.revision,sessionRef:q})&&A("Session linked to intent.")}}),I.filter(q=>q.executions.length).map(q=>l.jsxs("section",{className:"work-session-group",children:[l.jsxs("button",{onClick:()=>h(q.id),children:[q.title," ",l.jsx("span",{children:"↗"})]}),l.jsx(vo,{item:q})]},q.id)),!I.some(q=>q.executions.length)&&l.jsx("p",{className:"work-empty",children:"No execution history yet. Claims appear automatically; add a setup to an intent to record its model and effort."})]}):l.jsx("div",{className:"work-board-scroll",children:l.jsx("div",{className:"work-board",children:I0.map(q=>l.jsxs("section",{className:`work-column state-${q} ${C===q?"is-drop-target":""}`,"aria-label":`${Wn[q]} column`,onDragOver:R=>{R.dataTransfer.types.includes("application/specweave-intent")&&(R.preventDefault(),O(q))},onDragLeave:R=>{R.currentTarget.contains(R.relatedTarget)||O(null)},onDrop:R=>{R.preventDefault(),O(null);const Q=o?.items.find(ne=>ne.id===R.dataTransfer.getData("application/specweave-intent"));Q&&P(Q,q)},children:[l.jsxs("div",{className:"work-column-title",children:[l.jsx("span",{className:"work-state-dot"}),l.jsx("h2",{children:Wn[q]}),l.jsx("span",{className:"work-count",children:I.filter(R=>R.state===q).length})]}),l.jsxs("div",{className:"work-cards",children:[I.filter(R=>R.state===q).map(R=>l.jsxs("article",{className:"work-card","data-intent-id":R.id,draggable:!T,onDragStart:Q=>{Q.dataTransfer.setData("application/specweave-intent",R.id),Q.dataTransfer.effectAllowed="move"},onDragEnd:()=>O(null),children:[l.jsxs("div",{className:"work-card-top",children:[l.jsx("span",{children:R.incrementId?`INC ${R.incrementId.split("-")[0]}`:"INTENT"}),l.jsx("span",{className:"work-drag","aria-hidden":"true",children:"⠿"})]}),l.jsx("button",{className:"work-card-title",onClick:()=>h(R.id),children:R.title}),l.jsx("p",{className:"work-card-summary",children:R.summary||"Add a short outcome so the next session starts with context."}),R.tasks.total>0&&l.jsxs("div",{className:"work-progress",children:[l.jsxs("div",{children:[l.jsxs("span",{children:[R.tasks.done,"/",R.tasks.total," tasks"]}),l.jsxs("span",{children:[R.acs.done,"/",R.acs.total," ACs"]})]}),l.jsx("progress",{"aria-label":`${R.title} task progress`,value:R.tasks.done,max:R.tasks.total}),R.tasks.skipped>0&&l.jsxs("small",{children:[R.tasks.skipped," skipped"]})]}),l.jsxs("div",{className:"work-card-proof",children:[l.jsx("span",{className:`proof-${R.verification.status}`,children:R.verification.status==="passed"?"✓ Verified":R.verification.status==="failed"?"× Check failed":R.verification.status==="stale"?"↻ Recheck needed":R.incrementId?"○ Not verified":"○ No increment"}),R.incrementId&&l.jsx(Qe,{to:`/increments/${encodeURIComponent(R.incrementId)}${Ce}`,"aria-label":`Evidence for ${R.title}`,children:"Evidence ↗"})]}),R.executions.length>0&&l.jsxs("div",{className:"work-card-actor",children:[l.jsx("span",{className:"work-avatar",children:(R.executions[R.executions.length-1]?.harness||"?").slice(0,1).toUpperCase()}),l.jsxs("span",{children:[Kl(R.executions[R.executions.length-1].harness),l.jsx("small",{children:R.executions[R.executions.length-1].model||"Model unknown"})]}),R.executions.length>1&&l.jsxs("span",{className:"work-setup-count",children:["+",R.executions.length-1]})]}),l.jsxs("label",{className:"work-state-control",children:[l.jsxs("span",{className:"work-sr-only",children:["State for ",R.title]}),l.jsx("select",{value:R.state,disabled:T,onChange:Q=>{P(R,Q.target.value)},children:I0.map(Q=>l.jsx("option",{value:Q,children:Wn[Q]},Q))})]})]},R.id)),!I.some(R=>R.state===q)&&l.jsx("div",{className:"work-column-empty",children:q==="backlog"?"A clear intent is enough to start.":q==="done"?"Finished work lands here.":"No work here yet."})]})]},q))})}),l.jsxs("div",{className:"work-footnote",children:[l.jsx("span",{children:"Board state organizes work. Verification comes from linked increments."}),l.jsx("span",{children:o?`Updated ${Ar(o.generatedAt)}`:""})]}),N&&l.jsx(ex,{title:"Capture an intent",onClose:()=>v(!1),children:l.jsxs("form",{className:"work-form",onSubmit:async q=>{q.preventDefault();const R=new FormData(q.currentTarget);await U("","POST",Object.fromEntries(R))&&(v(!1),A("Intent created."))},children:[l.jsx("p",{children:"Describe the outcome. Small work can start without an increment."}),l.jsxs("label",{children:["Title",l.jsx("input",{name:"title",required:!0,maxLength:180,autoFocus:!0,placeholder:"What should be different when this is done?"})]}),l.jsxs("label",{children:["Intent",l.jsx("textarea",{name:"summary",rows:3,maxLength:2e3,placeholder:"Why it matters, expected result, or context for the next session."})]}),l.jsxs("label",{children:["Linked increment",l.jsxs("select",{name:"incrementId",children:[l.jsx("option",{value:"",children:"No increment yet"}),Ee.map(q=>l.jsx("option",{value:q.incrementId,children:q.incrementId},q.incrementId))]})]}),b&&l.jsx("p",{role:"alert",className:"work-error",children:b}),l.jsx("button",{disabled:T,className:"work-primary",children:T?"Saving…":"Create intent"})]})}),re&&l.jsx(ex,{title:re.title,onClose:()=>h(null),children:l.jsxs("div",{className:"work-detail",children:[l.jsxs("div",{className:"work-detail-meta",children:[l.jsx("span",{children:Wn[re.state]}),l.jsx("span",{children:re.incrementId||"No increment linked"})]}),l.jsxs("form",{className:"work-form",onSubmit:async q=>{q.preventDefault();const R=Object.fromEntries(new FormData(q.currentTarget));await U(`/${encodeURIComponent(re.id)}`,"PATCH",{...R,revision:re.revision})&&A("Intent updated.")},children:[l.jsxs("label",{children:["Intent",l.jsx("textarea",{name:"summary",defaultValue:re.summary,rows:3,maxLength:2e3})]}),l.jsxs("label",{children:["Linked increment",l.jsxs("select",{name:"incrementId",defaultValue:re.incrementId||"",children:[l.jsx("option",{value:"",children:"No increment"}),Ee.map(q=>l.jsx("option",{value:q.incrementId,children:q.incrementId},q.incrementId))]})]}),l.jsx("button",{className:"work-secondary",disabled:T,children:"Save context"})]},`${re.id}-summary`),l.jsxs("section",{className:"work-evidence",children:[l.jsx("h3",{children:"Delivery evidence"}),l.jsxs("div",{children:[l.jsxs("strong",{children:[re.tasks.done,"/",re.tasks.total]}),l.jsxs("span",{children:["tasks complete · ",re.evidenceCount," with ledger evidence"]})]}),l.jsxs("p",{children:[re.acs.done,"/",re.acs.total," acceptance criteria · Verification"," ",re.verification.status,re.verification.ranAt?` · ${Ar(re.verification.ranAt)}`:""]}),re.incrementId?l.jsx(Qe,{to:`/increments/${encodeURIComponent(re.incrementId)}${Ce}`,children:"Open specification, tasks and verification ↗"}):l.jsx("p",{children:"Attach an increment when this work needs a specification and checks."})]}),l.jsxs("section",{children:[l.jsx("h3",{children:"Execution history"}),l.jsx("p",{className:"work-muted",children:"A tool change keeps the same intent. Ledger actors are observed; added setups are declared. Unknown facts remain unknown."}),l.jsx(vo,{item:re})]}),l.jsxs("details",{className:"work-add-setup",children:[l.jsx("summary",{children:"Link a local Codex or Claude Code session"}),l.jsx("p",{className:"work-muted",children:"Only sessions rooted in this project appear. Linking associates the observed setup with this intent; it never imports conversation text."}),ee?l.jsx("p",{className:"work-muted",children:"Reading metadata…"}):l.jsxs("form",{className:"work-form",onSubmit:async q=>{q.preventDefault();const R=new FormData(q.currentTarget).get("sessionRef");await U(`/${encodeURIComponent(re.id)}`,"PATCH",{revision:re.revision,sessionRef:R})&&A("Session linked.")},children:[l.jsxs("label",{children:["Local session",l.jsxs("select",{"aria-label":"Local session",name:"sessionRef",required:!0,defaultValue:"",children:[l.jsx("option",{value:"",disabled:!0,children:"Select a session"}),(X||[]).map(q=>l.jsxs("option",{value:q.key,children:[q.harness," · ",q.sessionId.slice(0,8)," · ",Ar(q.updatedAt)]},q.key))]})]}),l.jsx("button",{className:"work-secondary",disabled:T||!X?.length,children:"Link observed session"}),!X?.length&&l.jsx("p",{children:"No supported local session metadata found. Record a setup below."})]})]}),l.jsxs("details",{className:"work-add-setup",children:[l.jsx("summary",{children:"+ Record a setup or continuation"}),l.jsxs("form",{className:"work-form",onSubmit:async q=>{q.preventDefault();const R=q.currentTarget,Q=Object.fromEntries(new FormData(R));await U(`/${encodeURIComponent(re.id)}/executions`,"POST",{...Q,revision:re.revision})&&(R.reset(),A("Execution setup recorded."))},children:[l.jsxs("div",{className:"work-form-grid",children:[l.jsxs("label",{children:["Harness",l.jsx("input",{name:"harness",required:!0,placeholder:"Codex, Claude Code, Cursor…",maxLength:120})]}),l.jsxs("label",{children:["Model",l.jsx("input",{name:"model",placeholder:"Exact model ID, if known",maxLength:120})]}),l.jsxs("label",{children:["Effort",l.jsx("input",{name:"effort",placeholder:"e.g. high",maxLength:80})]}),l.jsxs("label",{children:["Provider",l.jsx("input",{name:"provider",placeholder:"e.g. OpenAI, OpenRouter",maxLength:120})]}),l.jsxs("label",{children:["Surface",l.jsx("input",{name:"surface",placeholder:"Desktop, terminal, VS Code…",maxLength:120})]}),l.jsxs("label",{children:["Session ID",l.jsx("input",{name:"sessionId",placeholder:"Optional source session",maxLength:200})]})]}),l.jsxs("label",{children:["Continuation note",l.jsx("input",{name:"note",placeholder:"What changed or where to continue",maxLength:500})]}),l.jsx("button",{className:"work-primary",disabled:T,children:"Record setup"})]})]}),re.handoff&&l.jsxs("details",{className:"work-handoff",children:[l.jsx("summary",{children:"Latest handoff"}),l.jsx("pre",{children:re.handoff})]}),b&&l.jsx("p",{role:"alert",className:"work-error",children:b})]})})]})}function vo({item:r}){return r.executions.length?l.jsx("ol",{className:"work-timeline",children:r.executions.map(u=>l.jsxs("li",{children:[l.jsx("div",{className:"work-timeline-dot"}),l.jsxs("div",{children:[l.jsxs("div",{className:"work-timeline-title",children:[l.jsx("strong",{children:Kl(u.harness)}),l.jsx("span",{children:Kl(u.model)}),l.jsx("small",{children:u.source==="ledger"?"Ledger":u.source==="session"?"Observed":"Declared"})]}),l.jsxs("p",{children:["Effort ",Kl(u.effort)," · Provider ",Kl(u.provider)," · ",Kl(u.surface)]}),l.jsxs("p",{children:[Ar(u.startedAt)," · ",u.actor,u.sessionId?` · ${u.sessionId}`:""]}),u.note&&l.jsx("p",{className:"work-timeline-note",children:u.note})]})]},u.id))}):l.jsx("p",{className:"work-empty small",children:"No execution recorded. Task claims will appear here automatically."})}function my({sessions:r,loading:u,items:o,saving:c,link:d}){return l.jsxs("section",{className:"work-local-sessions",children:[l.jsx("h2",{children:"Local sessions"}),l.jsx("p",{className:"work-muted",children:"Project-scoped Codex and Claude Code metadata. Associate sessions with an intent explicitly. Model changes in large logs may be missing between observed windows."}),u&&l.jsx("p",{className:"work-empty",children:"Reading local metadata…"}),!u&&!r.length&&l.jsx("p",{className:"work-empty",children:"No supported session metadata found for this project."}),r.map(x=>l.jsxs("article",{className:"work-session-group",children:[l.jsxs("div",{className:"work-local-session-heading",children:[l.jsx("strong",{children:x.harness}),l.jsx("span",{children:x.sessionId.slice(0,8)}),l.jsx("small",{children:x.coverage==="partial"?"Partial log coverage":"Full log coverage"})]}),l.jsx(vo,{item:{executions:x.segments}}),l.jsxs("form",{className:"work-session-link",onSubmit:async m=>{m.preventDefault();const j=o.find(p=>p.id===new FormData(m.currentTarget).get("intent"));j&&await d(x.key,j)},children:[l.jsxs("label",{children:[l.jsxs("span",{className:"work-sr-only",children:["Intent for session ",x.sessionId]}),l.jsxs("select",{name:"intent",required:!0,defaultValue:"",children:[l.jsx("option",{value:"",disabled:!0,children:"Link to an intent…"}),o.map(m=>l.jsx("option",{value:m.id,children:m.title},m.id))]})]}),l.jsx("button",{className:"work-secondary",disabled:c||!o.length,children:"Link session"})]})]},x.key))]})}function hy(){const{activeProject:r}=ha();return r?l.jsx(gy,{projectId:r.id},r.id):l.jsx("div",{className:"hub-page",role:"status",children:"Loading project…"})}function gy({projectId:r}){const u=r?`?project=${encodeURIComponent(r)}`:"",{data:o,loading:c,error:d,refetch:x}=Mo(`/api/project-hub${u}`),[m,j]=y.useState(null),[p,h]=y.useState(0),[N,v]=y.useState(!1),[T,D]=y.useState(""),[_,A]=y.useState(!1),[b,w]=y.useState(""),[C,O]=y.useState(""),[F,X]=y.useState("codex"),[ee,W]=y.useState(!1),J=y.useRef(null),U=y.useRef(null);Oe("increment-update",x),y.useEffect(()=>{const Z=setInterval(x,15e3);return()=>clearInterval(Z)},[x]),y.useEffect(()=>{C&&J.current?.showModal()},[C]);function P(Z){h(o?.hub.revision??0),j(Z),D(""),w(""),A(!1)}async function I(Z,xe,S){if(N)return!1;v(!0),D(""),w("");try{const $=await fetch(`/api/project-hub${Z}${u}`,{method:xe,headers:{"Content-Type":"application/json"},body:JSON.stringify(S)}),K=await $.json();if(!$.ok||!K.ok)throw $.status===409&&(A(!0),x()),new Error(K.error||"Could not save");return x(),!0}catch($){return D($ instanceof Error?$.message:String($)),!1}finally{v(!1)}}async function re(Z){Z.preventDefault();const xe=Object.fromEntries(new FormData(Z.currentTarget));await I(m==="profile"?"":m==="work"?"/work":m==="artifact"?"/artifacts":"/routines",m==="profile"?"PATCH":"POST",{...xe,revision:p})&&(j(null),w(m==="routine"?"Routine saved. Configure its schedule in your AI tool when ready.":"Saved to this project."))}async function Ee(Z,xe){if(ee)return;W(!0),D("");const S=new URLSearchParams({harness:F,...r?{project:r}:{},...Z?{intent:Z}:{},...xe?{routine:xe}:{}});try{const $=await fetch(`/api/project-hub/brief?${S}`),K=await $.json();if(!$.ok||!K.ok)throw new Error(K.error||"Could not prepare brief");O(K.data.text)}catch($){D($ instanceof Error?$.message:String($))}finally{W(!1)}}async function Ce(){try{await navigator.clipboard.writeText(C),w("Worker brief copied.")}catch{U.current?.focus(),U.current?.select(),w("Select and copy the brief below.")}}const q=o?.hub,R=o?.work.items??[],Q=R.filter(Z=>Z.state!=="done"),ne=`/${u}`;return!q&&c?l.jsx("div",{className:"hub-page",role:"status",children:"Loading project…"}):q?l.jsxs("div",{className:"hub-page",children:[l.jsxs("header",{className:"hub-heading",children:[l.jsxs("div",{children:[l.jsx("p",{className:"hub-eyebrow",children:"PROJECT HUB / SHARED CONTEXT"}),l.jsx("h1",{children:q.name}),l.jsx("p",{className:"hub-lede",children:"One goal. Every task starts with the same context."})]}),l.jsxs("div",{className:"hub-actions",children:[l.jsxs("label",{className:"hub-harness",children:["Prepare for",l.jsxs("select",{"aria-label":"Brief target",value:F,onChange:Z=>X(Z.target.value),children:[l.jsx("option",{value:"codex",children:"Codex"}),l.jsx("option",{value:"claude",children:"Claude Code"}),l.jsx("option",{value:"generic",children:"Any AI tool"})]})]}),l.jsx("button",{className:"hub-primary",disabled:ee,onClick:()=>Ee(),children:ee?"Preparing…":"Coordinator brief ↗"})]})]}),(d||T)&&l.jsxs("div",{className:"hub-error",role:"alert",children:[T||d," ",l.jsx("button",{onClick:x,children:"Refresh"}),_&&m&&l.jsxs("p",{children:["Review the current project details above before retrying your draft. ",l.jsx("button",{disabled:c,onClick:()=>{h(q.revision),A(!1),D(""),w("Draft retained. Save when ready to apply it to the current revision.")},children:"Use latest revision for draft"})]})]}),b&&l.jsx("p",{role:"status",className:"hub-notice",children:b}),o?.work.warnings.map(Z=>l.jsx("p",{className:"hub-error",children:Z},Z)),l.jsxs("div",{className:"hub-grid",children:[l.jsxs("section",{className:"hub-purpose",children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsx("h2",{children:"Project brief"}),l.jsx("button",{onClick:()=>P("profile"),children:q.goal?"Edit brief":"Set project goal"})]}),l.jsx("p",{className:"hub-goal",children:q.goal||"Give this project a clear outcome."}),l.jsx("h3",{children:"Shared context"}),l.jsx("p",{className:"hub-context",children:q.context||"Keep decisions, working agreements and useful background here. Future tasks can pick up where you left off."}),l.jsxs("div",{className:"hub-meta",children:[q.updatedAt?`Updated ${new Date(q.updatedAt).toLocaleDateString()}`:"Ready for your first brief",l.jsxs("span",{children:["Revision ",q.revision]})]})]}),l.jsxs("section",{className:"hub-work",children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsxs("h2",{children:["Work in motion ",l.jsx("span",{children:Q.length})]}),l.jsx("button",{onClick:()=>P("work"),children:"+ Add work"})]}),l.jsx("p",{className:"hub-description",children:"Prepare an assignment, then continue in your preferred AI tool."}),l.jsx("div",{className:"hub-work-list",children:Q.slice(0,8).map(Z=>l.jsxs("article",{className:"hub-work-row",children:[l.jsxs("div",{children:[l.jsx("span",{className:`hub-state hub-state-${Z.state}`,children:Z.state==="active"?"In progress":Z.state}),l.jsx("h3",{children:Z.title}),l.jsx("p",{children:Z.summary||"No description yet"})]}),l.jsx("button",{"aria-label":`Prepare ${Z.title}`,disabled:ee,onClick:()=>Ee(Z.id),children:"Prepare ↗"})]},Z.id))}),!Q.length&&l.jsx("p",{className:"hub-empty",children:"No open work. Add a distinct outcome to get started."}),l.jsxs(Qe,{className:"hub-text-link",to:ne,children:["Open work board ",Q.length>8?`· ${Q.length} open items`:"→"]})]})]}),m&&l.jsxs("section",{className:"hub-form-panel","aria-label":`Add or edit ${m}`,children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsx("h2",{children:m==="profile"?"Edit project brief":`Add ${m}`}),l.jsx("button",{onClick:()=>j(null),disabled:N,children:"Cancel"})]}),l.jsxs("form",{onSubmit:re,children:[m==="profile"?l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Project name",l.jsx("input",{name:"name",required:!0,maxLength:180,defaultValue:q.name,autoFocus:!0})]}),l.jsxs("label",{children:["Goal",l.jsx("textarea",{"aria-label":"Goal",name:"goal",required:!0,maxLength:2e3,defaultValue:q.goal,rows:2})]}),l.jsxs("label",{children:["Shared context",l.jsx("textarea",{"aria-label":"Shared context",name:"context",maxLength:16e3,defaultValue:q.context,rows:5})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Title",l.jsx("input",{name:"title",required:!0,maxLength:180,autoFocus:!0})]}),m==="work"&&l.jsxs("label",{children:["Outcome and scope",l.jsx("textarea",{name:"summary",maxLength:2e3,rows:3})]}),m==="artifact"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["File path or HTTPS link",l.jsx("input",{name:"location",required:!0,maxLength:2e3,placeholder:"reports/research.md or https://…"})]}),l.jsxs("label",{children:["Related work",l.jsxs("select",{name:"intentId",children:[l.jsx("option",{value:"",children:"Shared with the whole project"}),R.map(Z=>l.jsx("option",{value:Z.id,children:Z.title},Z.id))]})]})]}),m==="routine"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Requested cadence",l.jsx("input",{name:"cadence",required:!0,maxLength:180,placeholder:"Mondays at 9am, America/New_York"})]}),l.jsxs("label",{children:["Instructions",l.jsx("textarea",{name:"instructions",required:!0,maxLength:8e3,rows:4})]}),l.jsx("p",{className:"hub-description",children:"This saves a reusable routine. It does not schedule or start an agent."})]})]}),l.jsx("button",{className:"hub-primary",disabled:N,type:"submit",children:N?"Saving…":"Save"})]},m)]}),l.jsxs("div",{className:"hub-grid hub-libraries",children:[l.jsxs("section",{children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsxs("h2",{children:["Artifact library ",l.jsx("span",{children:q.artifacts.length})]}),l.jsx("button",{onClick:()=>P("artifact"),children:"+ Add artifact"})]}),l.jsx("p",{className:"hub-description",children:"Documents, designs, code and research. Kept with their work."}),!q.artifacts.length&&l.jsx("p",{className:"hub-empty",children:"Add a file or link to keep useful outputs within reach."}),q.artifacts.map(Z=>l.jsxs("article",{className:"hub-library-row",children:[l.jsxs("div",{children:[l.jsxs("small",{children:[Z.kind==="file"?"FILE":"LINK"," · ",R.find(xe=>xe.id===Z.intentId)?.title||(Z.intentId?"Linked work unavailable":"PROJECT")]}),l.jsx("h3",{children:Z.title}),Z.kind==="link"&&/^https:\/\//i.test(Z.location)?l.jsx("a",{href:Z.location,target:"_blank",rel:"noreferrer",children:Z.location}):l.jsxs("a",{href:`/api/project-hub/artifacts/${Z.id}/download${u}`,download:!0,children:[Z.location," ↓"]})]}),l.jsx("button",{"aria-label":`Remove ${Z.title}`,disabled:N,onClick:()=>I(`/artifacts/${Z.id}`,"DELETE",{revision:q.revision}),children:"Remove"})]},Z.id))]}),l.jsxs("section",{children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsxs("h2",{children:["Routines ",l.jsx("span",{children:q.routines.length})]}),l.jsx("button",{onClick:()=>P("routine"),children:"+ Add routine"})]}),l.jsx("p",{className:"hub-description",children:"Reusable assignments. Scheduling stays in your AI tool."}),!q.routines.length&&l.jsx("p",{className:"hub-empty",children:"Capture a repeatable workflow, then prepare it whenever needed."}),q.routines.map(Z=>l.jsxs("article",{className:"hub-library-row",children:[l.jsxs("div",{children:[l.jsxs("small",{children:["DEFINITION · ",Z.cadence]}),l.jsx("h3",{children:Z.title}),l.jsx("p",{children:Z.instructions}),l.jsx("span",{className:"hub-schedule-status",children:"No schedule managed here"})]}),l.jsxs("div",{className:"hub-row-actions",children:[l.jsx("button",{disabled:ee,onClick:()=>Ee(void 0,Z.id),children:"Prepare ↗"}),l.jsx("button",{"aria-label":`Remove ${Z.title}`,disabled:N,onClick:()=>I(`/routines/${Z.id}`,"DELETE",{revision:q.revision}),children:"Remove"})]})]},Z.id))]})]}),l.jsxs("footer",{className:"hub-footer",children:[l.jsx("span",{children:"Shared files stay with your project."}),l.jsx(Qe,{to:`/sessions${u}`,children:"Sessions & execution history ↗"})]}),l.jsxs("dialog",{className:"hub-dialog",ref:J,onClose:()=>O(""),"aria-label":"Portable worker brief",children:[l.jsxs("div",{className:"hub-section-head",children:[l.jsx("h2",{children:"Portable worker brief"}),l.jsx("button",{onClick:()=>J.current?.close(),"aria-label":"Close worker brief",children:"Close"})]}),l.jsx("p",{children:"Fresh context for your next task. Copy into your chosen AI tool."}),l.jsx("textarea",{ref:U,"aria-label":"Worker brief text",readOnly:!0,value:C}),l.jsx("button",{className:"hub-primary",onClick:Ce,children:"Copy brief"})]})]}):l.jsxs("div",{className:"hub-page",children:[l.jsx("div",{role:"alert",children:d||"Project unavailable"}),l.jsx("button",{onClick:x,children:"Retry"})]})}const py=[["/project","Project hub","◈"],["/","Work board","▥"],["/increments","Evidence","▤"],["/sessions","Sessions","↗"],["/sync","Connections","⇄"]],yy=[["/overview","Overview"],["/activity","Activity"],["/costs","Usage & estimates"],["/analytics","Analytics"],["/errors","Errors"],["/notifications","Notifications"],["/workspace","Workspace"],["/repos","Repositories"],["/plugins","Plugins"],["/marketplace","Marketplace"],["/hooks","Hooks"],["/agents","Agents"],["/services","Services"],["/config","Settings"]];function vy(){const{projects:r,activeProject:u,setActiveProject:o}=ha(),[c]=Or(),d=Yx(),x=m=>c.get("project")?`${m}?project=${encodeURIComponent(c.get("project"))}`:m;return l.jsxs("aside",{className:"work-sidebar",children:[l.jsx(by,{}),l.jsxs("div",{className:"work-project-select",children:[l.jsx("label",{htmlFor:"workspace-project",children:"WORKSPACE"}),l.jsx("select",{id:"workspace-project",value:u?.id||"",onChange:m=>o(m.target.value),children:r.map(m=>l.jsx("option",{value:m.id,children:m.name},m.id))})]}),l.jsx("nav",{"aria-label":"Main navigation",className:"work-navigation",children:py.map(([m,j,p])=>l.jsxs(yo,{title:j,end:m==="/",to:x(m),className:({isActive:h})=>h?"active":"",children:[l.jsx("span",{"aria-hidden":"true",className:"work-nav-icon",children:p}),l.jsx("span",{className:"work-nav-label",children:j})]},m))}),l.jsxs("div",{className:"work-sidebar-note",children:[l.jsx("span",{children:"ONE INTENT."}),l.jsxs("strong",{children:["Every tool.",l.jsx("br",{}),"Every next step."]}),l.jsx("p",{children:"Your work stays in your project."})]}),l.jsxs("details",{className:"work-advanced",children:[l.jsx("summary",{title:"Diagnostics and settings",children:"Diagnostics & settings"}),l.jsx("nav",{"aria-label":"Advanced navigation",children:yy.map(([m,j])=>l.jsx(yo,{to:x(m),children:j},m))})]}),l.jsxs("div",{className:"work-sidebar-footer",children:[l.jsx("span",{className:`work-live-dot ${d==="connected"?"connected":""}`}),l.jsx("span",{children:d==="connected"?"Live connection":"Reconnecting…"})]})]})}function by(){return l.jsxs("div",{className:"work-brand",children:[l.jsxs("div",{"aria-hidden":"true",className:"work-brand-mark",children:["S",l.jsx("span",{children:"W"})]}),l.jsxs("span",{children:["SpecWeave",l.jsx("small",{children:"WORK CONTINUITY"})]})]})}function jy(){const{activeProject:r}=ha();return l.jsxs("header",{className:"work-header",children:[l.jsxs("span",{children:["Workspace ",l.jsx("b",{children:"/"})," ",l.jsx("strong",{children:r?.name||"Project"})]}),l.jsx("span",{children:"Intent → evidence → continuation"})]})}class Ny extends y.Component{constructor(u){super(u),this.state={hasError:!1,error:null}}static getDerivedStateFromError(u){return{hasError:!0,error:u}}componentDidCatch(u,o){console.error("[Dashboard ErrorBoundary]",u,o.componentStack)}componentDidUpdate(u){this.state.hasError&&u.resetKey!==this.props.resetKey&&this.setState({hasError:!1,error:null})}render(){return this.state.hasError?l.jsx("div",{className:"flex items-center justify-center min-h-[400px] p-8",children:l.jsxs("div",{className:"max-w-md text-center space-y-4",children:[l.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-rose-500/10 flex items-center justify-center",children:l.jsx("svg",{className:"w-6 h-6 text-rose-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),l.jsx("h3",{className:"text-lg font-semibold text-gray-200",children:"Something went wrong"}),l.jsx("p",{className:"text-sm text-gray-500",children:this.state.error?.message||"An unexpected error occurred while rendering this page."}),l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),className:"px-4 py-2 text-sm bg-gray-800 text-gray-300 rounded-lg hover:bg-gray-700 transition-colors",children:"Try Again"}),l.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 text-sm bg-indigo-600 text-white rounded-lg hover:bg-indigo-500 transition-colors",children:"Reload Page"}),l.jsx("a",{href:"/",className:"px-4 py-2 text-sm text-gray-400 hover:text-gray-200 transition-colors",children:"Go Home"})]})]})}):this.props.children}}const Sy={indigo:"from-indigo-500/10 to-indigo-500/5 border-indigo-500/20",emerald:"from-emerald-500/10 to-emerald-500/5 border-emerald-500/20",amber:"from-amber-500/10 to-amber-500/5 border-amber-500/20",rose:"from-rose-500/10 to-rose-500/5 border-rose-500/20",cyan:"from-cyan-500/10 to-cyan-500/5 border-cyan-500/20"},wy={indigo:"text-indigo-400",emerald:"text-emerald-400",amber:"text-amber-400",rose:"text-rose-400",cyan:"text-cyan-400"};function ce({title:r,value:u,subtitle:o,tooltip:c,color:d="indigo"}){return l.jsxs("div",{className:`bg-gradient-to-br ${Sy[d]} border rounded-xl p-4 relative group`,title:c,children:[l.jsx("div",{className:"text-gray-400 text-xs font-medium uppercase tracking-wider mb-2",children:r}),l.jsx("div",{className:`text-2xl font-bold ${wy[d]}`,children:u}),o&&l.jsx("div",{className:"text-gray-500 text-xs mt-1",children:o}),c&&l.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2.5 py-1.5 bg-gray-800 border border-gray-700 rounded-lg text-[10px] text-gray-300 whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 shadow-lg",children:[c,l.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 -mt-px border-4 border-transparent border-t-gray-800"})]})]})}const Ey={active:"#6366f1",completed:"#10b981",paused:"#f59e0b",planning:"#06b6d4",abandoned:"#ef4444",backlog:"#6b7280",ready_for_review:"#8b5cf6"};function Cy(r){return Ey[r]||"#6b7280"}function Ty({segments:r,size:u=160,centerLabel:o,centerValue:c}){const d=r.reduce((p,h)=>p+h.value,0);if(d===0)return l.jsx("div",{className:"flex items-center justify-center",style:{width:u,height:u},children:l.jsx("span",{className:"text-gray-600 text-xs",children:"No data"})});const x=52,m=2*Math.PI*x;let j=0;return l.jsxs("div",{className:"relative inline-flex items-center justify-center",style:{width:u,height:u},children:[l.jsx("svg",{viewBox:"0 0 128 128",className:"w-full h-full -rotate-90",children:r.map((p,h)=>{const v=p.value/d*m,T=j;return j+=v,l.jsx("circle",{cx:"64",cy:"64",r:x,fill:"none",stroke:p.color,strokeWidth:"12",strokeDasharray:`${v} ${m-v}`,strokeDashoffset:-T,className:"transition-all duration-500"},h)})}),l.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[c!=null&&l.jsx("span",{className:"text-xl font-bold text-gray-200",children:c}),o&&l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:o})]})]})}function Ay(r){return Object.entries(r).filter(([u,o])=>o>0).map(([u,o])=>({label:u,value:o,color:Cy(u)}))}const Ry={default:"bg-gray-800 text-gray-300",success:"bg-emerald-500/15 text-emerald-400",warning:"bg-amber-500/15 text-amber-400",error:"bg-rose-500/15 text-rose-400",info:"bg-cyan-500/15 text-cyan-400"};function ue({label:r,variant:u="default"}){return l.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium ${Ry[u]}`,children:r})}function zr(r){switch(r){case"active":case"running":return"info";case"completed":case"success":return"success";case"paused":case"pending":case"planning":return"warning";case"failed":case"abandoned":case"error":return"error";default:return"default"}}function My({size:r="md"}){const u={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};return l.jsxs("svg",{className:`${u[r]} animate-spin text-indigo-400`,viewBox:"0 0 24 24",fill:"none",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}function et(){return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(My,{size:"lg"})})}function Gt({message:r,onRetry:u,title:o="Something went wrong"}){const c=r.toLowerCase().includes("timed out");return l.jsx("div",{className:"p-6",children:l.jsxs("div",{className:"bg-rose-900/30 border border-rose-700 rounded-lg px-5 py-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-rose-300",children:o}),l.jsx("p",{className:"text-xs text-rose-400/80 mt-1",children:r})]}),u&&l.jsx("button",{onClick:u,className:"text-xs text-rose-400 hover:text-rose-200 px-3 py-1.5 border border-rose-700 rounded transition-colors flex-shrink-0",children:"Retry"})]}),c&&l.jsx("p",{className:"text-[10px] text-rose-400/60",children:"The server may be processing a large number of session logs. Try again in a moment."})]})})}function ax(r){switch(r){case"connected":return"success";case"sync_failed":return"warning";case"configured_never_synced":return"info";default:return"default"}}function Dy(r){switch(r){case"connected":return"Connected";case"sync_failed":return"Sync Failed";case"configured_never_synced":return"Ready";case"not_configured":return"Not Configured";default:return r||"Unknown"}}const lx=r=>r.billingContext?.planType==="subscription";function ky(){const[r,u]=y.useState(0),{data:o,loading:c,error:d,refetch:x}=Re(`/api/overview?_r=${r}`),[m,j]=y.useState([]),[p,h]=y.useState([]),[N,v]=y.useState([]),{activeProject:T}=ha();Oe("increment-update",()=>u(b=>b+1)),Oe("notification",()=>u(b=>b+1)),Oe("sync-update",()=>u(b=>b+1)),Oe("sync-error",()=>u(b=>b+1)),Oe("cost-update",()=>u(b=>b+1));const D=y.useRef(null);y.useEffect(()=>{if(!T||D.current===T.id)return;D.current=T.id;const b=`project=${T.id}`;fetch(`/api/activity/stream?limit=20&${b}`).then(w=>w.json()).then(w=>{w.ok&&Array.isArray(w.data)&&j(w.data)}).catch(()=>{})},[T]);const _=y.useCallback(b=>{j(w=>[b,...w].slice(0,20))},[]);if(Oe("activity",_),y.useEffect(()=>{fetch("/api/sync/errors?hours=24&limit=5").then(b=>b.json()).then(b=>{b.ok&&Array.isArray(b.data)&&h(b.data)}).catch(()=>{}),fetch("/api/sync/gaps").then(b=>b.json()).then(b=>{b.ok&&Array.isArray(b.data)&&v(b.data)}).catch(()=>{})},[r]),c)return l.jsx(et,{});if(d)return l.jsx(Gt,{message:d,onRetry:x});if(!o)return null;const A=Ay(o.project.statusBreakdown);return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("h2",{className:"text-lg font-semibold text-gray-200",children:[o.project.name||"Project"," Overview"]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(Qe,{to:"/increments?status=active",className:"group",children:l.jsx(ce,{title:"Active Increments",value:o.project.activeIncrements,subtitle:`${o.project.totalIncrements} total`,color:"indigo"})}),l.jsx(Qe,{to:"/increments?status=completed",className:"group",children:l.jsx(ce,{title:"Completed",value:o.project.completedIncrements,subtitle:`${Math.round(o.project.completedIncrements/Math.max(o.project.totalIncrements,1)*100)}% done`,color:"emerald"})}),l.jsx(Qe,{to:"/costs",className:"group",children:l.jsx(ce,{title:"Estimated API Value",value:o.costs.totalCost==null?"Unknown":`$${o.costs.totalCost.toFixed(2)}`,subtitle:lx(o.costs)?`via Claude Code · $${o.costs.billingContext?.monthlyAmount??"?"}/mo plan`:`Claude Code · ${o.costs.sessionCount.toLocaleString()} sessions · legacy estimates`,color:"amber"})}),l.jsx(Qe,{to:"/analytics",className:"group",children:l.jsx(ce,{title:"Events Today",value:o.analytics.last24hEvents,subtitle:`${o.analytics.totalEvents.toLocaleString()} total`,color:"cyan"})})]}),l.jsx(_y,{}),lx(o.costs)&&l.jsxs("div",{className:"bg-indigo-500/10 border border-indigo-500/20 rounded-xl px-4 py-3 flex items-center gap-3",children:[l.jsx(ue,{label:"Subscription",variant:"info"}),l.jsx("span",{className:"text-xs text-gray-300",children:"Legacy rate estimates from Claude Code logs; actual bills may differ."})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Increment Status"}),l.jsx("div",{className:"flex items-center justify-center",children:l.jsx(Ty,{segments:A,centerValue:o.project.totalIncrements,centerLabel:"total"})}),l.jsx("div",{className:"flex flex-wrap gap-2 mt-4 justify-center",children:A.map(b=>l.jsxs(Qe,{to:`/increments?status=${b.label.toLowerCase()}`,className:"flex items-center gap-1.5 hover:opacity-80 transition-opacity",children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:b.color}}),l.jsxs("span",{className:"text-xs text-gray-500 hover:text-gray-300",children:[b.label," (",b.value,")"]})]},b.label))})]}),l.jsxs(Qe,{to:"/sync",className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5 hover:border-gray-700 transition-colors block",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Sync Health"}),l.jsx("div",{className:"space-y-3",children:Object.entries(o.sync.platforms).length===0?l.jsx("p",{className:"text-gray-600 text-xs",children:"No sync platforms configured"}):Object.entries(o.sync.platforms).map(([b,w])=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-800/50 rounded-lg",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-300 capitalize",children:b}),w.configDetail&&l.jsx("div",{className:"text-[10px] text-gray-600 mt-0.5",children:w.configDetail}),!w.configDetail&&w.lastImport&&l.jsxs("div",{className:"text-xs text-gray-600 mt-0.5",children:["Last: ",new Date(w.lastImport).toLocaleDateString()]})]}),l.jsx(ue,{label:Dy(w.connectionStatus||w.lastSyncResult),variant:ax(w.connectionStatus)!=="default"?ax(w.connectionStatus):zr(w.lastSyncResult||"")})]},b))}),l.jsx("div",{className:"mt-4 pt-4 border-t border-gray-800",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500",children:"Notifications"}),l.jsxs("div",{className:"flex gap-2",children:[o.notifications.criticalCount>0&&l.jsx(Qe,{to:"/notifications",onClick:b=>b.stopPropagation(),children:l.jsx(ue,{label:`${o.notifications.criticalCount} critical`,variant:"error"})}),l.jsx(Qe,{to:"/notifications",onClick:b=>b.stopPropagation(),children:l.jsx(ue,{label:`${o.notifications.pendingCount} pending`,variant:o.notifications.pendingCount>0?"warning":"default"})})]})]})})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Live Activity"}),l.jsx(Qe,{to:"/activity",className:"text-[10px] text-indigo-400 hover:text-indigo-300",children:"View all"})]}),l.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto custom-scrollbar",children:m.length===0?l.jsx("p",{className:"text-gray-600 text-xs",children:"No recent activity"}):m.map((b,w)=>l.jsxs("div",{className:"flex items-start gap-2 py-1 slide-in",children:[l.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-1.5 ${b.severity==="error"?"bg-rose-400":b.severity==="warning"?"bg-amber-400":"bg-gray-600"}`}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-xs text-gray-400 truncate",children:b.title}),l.jsxs("div",{className:"text-[10px] text-gray-600",children:[b.category,b.timestamp&&` · ${nx(b.timestamp)}`]})]})]},w))})]})]}),N.length>0&&l.jsxs(Qe,{to:"/sync",className:"bg-amber-500/10 border border-amber-500/20 rounded-xl px-4 py-3 flex items-center gap-3 hover:border-amber-500/30 transition-colors block",children:[l.jsx(ue,{label:`${N.length} gaps`,variant:"warning"}),l.jsxs("span",{className:"text-xs text-gray-300",children:[N.length," increment",N.length!==1?"s have":" has"," partial sync coverage"]})]}),p.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Recent Sync Errors"}),l.jsx(Qe,{to:"/sync",className:"text-[10px] text-indigo-400 hover:text-indigo-300",children:"View all"})]}),l.jsx("div",{className:"space-y-2",children:p.map((b,w)=>l.jsxs("div",{className:"flex items-start gap-2 p-3 bg-gray-800/50 rounded-lg",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full mt-1.5 bg-rose-400"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-300 capitalize",children:b.provider}),l.jsx(ue,{label:b.incrementId,variant:"default"})]}),l.jsx("div",{className:"text-xs text-gray-500 mt-1 truncate",children:b.error}),l.jsx("div",{className:"text-[10px] text-gray-600 mt-0.5",children:nx(b.timestamp)})]})]},w))})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Increment Types"}),l.jsx("div",{className:"flex gap-4 flex-wrap",children:Object.entries(o.project.typeBreakdown).map(([b,w])=>l.jsxs(Qe,{to:`/increments?type=${b}`,className:"flex items-center gap-2 px-3 py-2 bg-gray-800/50 rounded-lg hover:bg-gray-800/80 transition-colors",children:[l.jsx("span",{className:"text-sm text-gray-300 capitalize",children:b}),l.jsx("span",{className:"text-xs text-gray-500 bg-gray-800 px-2 py-0.5 rounded",children:w})]},b))})]})]})}function _y(){const[r,u]=y.useState(0);Oe("error-detected",()=>u(D=>D+1));const{data:o}=Re(`/api/prompt-health?_r=${r}`);if(!o?.health||o.health.warningLevel==="normal")return null;const{health:c,alert:d}=o,x=d?.level==="emergency",m=c.warningLevel==="critical"||x,j=m?"border-rose-500/30":"border-amber-500/20",p=m?"bg-rose-500/10":"bg-amber-500/10",h=m?"text-rose-400":"text-amber-400",N=Math.round(c.baseline/1e3),v=Math.min(Math.round(c.baseline/2e5*100),100),T=m?"bg-rose-500":"bg-amber-500";return l.jsxs("div",{className:`${p} border ${j} rounded-xl px-4 py-3 space-y-2`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{label:m?"Critical":"Warning",variant:m?"error":"warning"}),l.jsxs("span",{className:`text-xs ${h}`,children:["Prompt baseline: ",N,"KB (",v,"% of context window)"]})]}),l.jsx(Qe,{to:"/errors",className:"text-[10px] text-gray-500 hover:text-gray-300",children:"Details"})]}),l.jsx("div",{className:"w-full bg-gray-800 rounded-full h-1.5",children:l.jsx("div",{className:`${T} h-1.5 rounded-full`,style:{width:`${v}%`}})}),l.jsxs("div",{className:"flex gap-4 text-[10px] text-gray-500",children:[l.jsxs("span",{children:["CLAUDE.md: ",Math.round(c.claudeMdSize/1e3),"KB"]}),l.jsxs("span",{children:["MEMORY.md: ",Math.round(c.memoryMdSize/1e3),"KB"]}),l.jsxs("span",{children:["Skills: ",Math.round(c.skillBudget/1e3),"KB"]}),d&&l.jsxs("span",{className:h,children:["Compactions: ",d.compactionCount]})]})]})}function nx(r){try{const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}catch{return""}}function Oy(){const r=wo(),[u]=Or();return y.useCallback(o=>{const c=u.get("project");if(c){const d=o.includes("?")?"&":"?";r(`${o}${d}project=${encodeURIComponent(c)}`)}else r(o)},[r,u])}const In=new Map;let uo=!1,Gx=null;function zy(){uo||(uo=!0,queueMicrotask(()=>{uo=!1;const r=Gx;if(!r||In.size===0){In.clear();return}const u=new Map(In);In.clear(),r(o=>{const c=new URLSearchParams(o);for(const[d,{value:x,defaultValue:m}]of u)x&&x!==m?c.set(d,x):c.delete(d);return c})}))}function zt(r,u=""){const[o,c]=Or(),d=o.get(r)??u,x=y.useCallback(m=>{Gx=c,In.set(r,{value:m,defaultValue:u}),zy()},[r,u,c]);return[d,x]}function ko({title:r,description:u}){return l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-800 flex items-center justify-center mb-4",children:l.jsx("svg",{className:"w-6 h-6 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})})}),l.jsx("h3",{className:"text-gray-400 text-sm font-medium",children:r}),u&&l.jsx("p",{className:"text-gray-600 text-xs mt-1 max-w-xs",children:u})]})}const Fn=50;function Ly(){const[r,u]=y.useState(0),[o,c]=y.useState(0),[d,x]=zt("status","all"),[m,j]=zt("type","all"),p=Oy(),h=y.useRef(void 0);Oe("increment-update",()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>u(O=>O+1),500)}),y.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const N=new URLSearchParams({_r:String(r),limit:String(Fn),offset:String(o)});d!=="all"&&N.set("status",d),m!=="all"&&N.set("type",m);const{data:v,loading:T,error:D,refetch:_}=Re(`/api/increments?${N}`),A=y.useRef(d),b=y.useRef(m);if(y.useEffect(()=>{(A.current!==d||b.current!==m)&&(c(0),A.current=d,b.current=m)},[d,m]),T&&o===0)return l.jsx(et,{});if(D)return l.jsx(Gt,{message:D,onRetry:_});if(!v)return null;const w=Object.keys(v.summary).filter(O=>O!=="total"&&v.summary[O]>0),C=v.pagination;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Increments"}),l.jsxs("span",{className:"text-sm text-gray-500",children:[C?.total??v.increments.length," total"]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-xs text-gray-500 w-14",children:"Status:"}),l.jsxs("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:[l.jsx(fo,{label:"All",active:d==="all",onClick:()=>x("all"),count:v.summary.total}),w.map(O=>l.jsx(fo,{label:O,active:d===O,onClick:()=>x(O),count:v.summary[O]},O))]})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-xs text-gray-500 w-14",children:"Type:"}),l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:l.jsx(fo,{label:"All",active:m==="all",onClick:()=>j("all")})})]}),C&&C.total>0&&l.jsxs("span",{className:"text-xs text-gray-500",children:["Showing ",o+1,"–",Math.min(o+Fn,C.total)," of ",C.total]})]}),v.increments.length===0?l.jsx(ko,{title:"No increments match filters",description:"Try adjusting your filters"}):l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"ID"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Title"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Status"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Type"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Priority"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Tasks"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"ACs"}),l.jsx("th",{className:"text-left px-4 py-3 text-xs text-gray-500 font-medium uppercase",children:"Last Activity"})]})}),l.jsx("tbody",{children:v.increments.map(O=>l.jsxs("tr",{onClick:()=>p(`/increments/${O.id}`),className:"border-b border-gray-800/50 hover:bg-gray-800/30 transition-colors cursor-pointer",children:[l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:"text-xs text-indigo-400 font-mono",children:O.id})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:"text-sm text-gray-300",children:O.title})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(ue,{label:O.status,variant:zr(O.status)})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:"text-xs text-gray-400 capitalize",children:O.type})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Uy,{priority:O.priority})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(sx,{completed:O.tasks.completed,total:O.tasks.total})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(sx,{completed:O.acs.completed,total:O.acs.total})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:"text-xs text-gray-500",children:O.lastActivity?Hy(O.lastActivity):"-"})})]},O.id))})]})}),C&&C.total>Fn&&l.jsxs("div",{className:"flex justify-center gap-2",children:[l.jsx("button",{onClick:()=>c(Math.max(0,o-Fn)),disabled:o===0,className:"px-4 py-2 text-sm text-gray-300 bg-gray-800 hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Previous"}),l.jsx("button",{onClick:()=>c(o+Fn),disabled:!C.hasMore,className:"px-4 py-2 text-sm text-gray-300 bg-gray-800 hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Next"})]})]})}function fo({label:r,active:u,onClick:o,count:c}){return l.jsxs("button",{onClick:o,className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${u?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:[r,c!==void 0&&l.jsx("span",{className:"ml-1 text-[10px] text-gray-500",children:c})]})}function sx({completed:r,total:u}){const o=u>0?Math.round(r/u*100):0;return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-16 h-1.5 bg-gray-800 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-indigo-500 rounded-full transition-all",style:{width:`${o}%`}})}),l.jsxs("span",{className:"text-xs text-gray-500",children:[r,"/",u]})]})}function Uy({priority:r}){const u={P0:"text-rose-400 bg-rose-500/10",P1:"text-amber-400 bg-amber-500/10",P2:"text-cyan-400 bg-cyan-500/10",P3:"text-gray-400 bg-gray-500/10"};return l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${u[r]||u.P2}`,children:r})}function Hy(r){try{const u=new Date(r),c=new Date().getTime()-u.getTime(),d=Math.floor(c/6e4);if(d<1)return"Just now";if(d<60)return`${d}m ago`;const x=Math.floor(d/60);if(x<24)return`${x}h ago`;const m=Math.floor(x/24);return m<7?`${m}d ago`:u.toLocaleDateString()}catch{return r}}function By(){const[r,u]=y.useState("skills"),[o,c]=y.useState(!1),[d,x]=y.useState(0);Oe("analytics-event",()=>x(w=>w+1));const{data:m,loading:j,error:p,refetch:h,fetchedAt:N}=Re(`/api/analytics/summary?_r=${d}`),{data:v,loading:T,refetch:D}=Re(`/api/analytics/skills?_r=${d}`);if(j||T)return l.jsx(et,{});if(p)return l.jsx(Gt,{message:p,onRetry:h});if(!m)return null;const _=m.topCommands?.reduce((w,C)=>w+C.count,0)||0,A=m.topSkills?.reduce((w,C)=>w+C.count,0)||0,b=m.topAgents?.reduce((w,C)=>w+C.count,0)||0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Analytics"}),l.jsxs("div",{className:"flex items-center gap-3",children:[N&&l.jsxs("span",{className:"text-[10px] text-gray-600",children:["Updated ",N.toLocaleTimeString()]}),l.jsxs("span",{className:"text-sm text-gray-500",children:[m.totalEvents.toLocaleString()," total events"]}),l.jsx("button",{onClick:()=>{c(!0),h(),D(),setTimeout(()=>c(!1),600)},disabled:o,className:"p-1.5 text-gray-500 hover:text-gray-300 hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50",title:"Refresh analytics",children:l.jsx("svg",{className:`w-4 h-4 ${o?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Total Events",value:m.totalEvents.toLocaleString(),subtitle:`${m.successRate}% success rate`,color:"indigo",tooltip:`${m.totalEvents} events tracked from analytics JSONL`}),l.jsx(ce,{title:"Commands",value:_.toLocaleString(),subtitle:`${m.topCommands?.length||0} unique`,color:"cyan",tooltip:`${_} total command invocations across ${m.topCommands?.length||0} distinct commands`}),l.jsx(ce,{title:"Skills",value:A.toLocaleString(),subtitle:`${m.topSkills?.length||0} unique`,color:"emerald",tooltip:`${A} total skill activations across ${m.topSkills?.length||0} distinct skills`}),l.jsx(ce,{title:"Agents",value:b.toLocaleString(),subtitle:`${m.topAgents?.length||0} unique`,color:"amber",tooltip:`${b} agent spawns across ${m.topAgents?.length||0} distinct agent types`})]}),l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:[{key:"skills",label:"Skills"},{key:"commands",label:"Commands"},{key:"agents",label:"Agents"},{key:"daily",label:"Daily Trends"}].map(w=>l.jsx("button",{onClick:()=>u(w.key),className:`flex-1 px-3 py-1.5 text-xs rounded-md transition-colors ${r===w.key?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:w.label},w.key))}),r==="commands"&&l.jsx($y,{commands:m.topCommands||[]}),r==="skills"&&l.jsx(qy,{skills:v||[]}),r==="agents"&&l.jsx(Yy,{agents:m.topAgents||[]}),r==="daily"&&l.jsx(Gy,{days:m.dailySummaries||[]})]})}function $y({commands:r}){if(r.length===0)return l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No command data available"})});const u=[...r].sort((c,d)=>d.count-c.count),o=u[0]?.count||1;return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Top Commands"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500 w-12",children:"Rank"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Command"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Usage"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Count"})]})}),l.jsx("tbody",{children:u.map((c,d)=>{const x=Math.max(2,c.count/o*100);return l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsxs("td",{className:"px-4 py-2.5 text-xs text-gray-600",children:["#",d+1]}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"text-sm text-gray-300 font-mono",children:c.name})}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("div",{className:"w-full h-1.5 bg-gray-800 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-indigo-500/60 transition-all",style:{width:`${x}%`}})})}),l.jsx("td",{className:"px-4 py-2.5 text-sm font-mono text-gray-400 text-right",children:c.count.toLocaleString()})]},c.name)})})]})]})}function qy({skills:r}){const u=[...r].sort((o,c)=>c.count-o.count);return u.length===0?l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No skill usage data available"})}):l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Skill Usage Leaderboard"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500 w-12",children:"Rank"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Skill Name"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Plugin"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Invocations"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Success Rate"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Last Used"})]})}),l.jsx("tbody",{children:u.map((o,c)=>{const d=o.count>0?Math.round(o.successCount/o.count*100):100,x=d>=90?"success":d>=70?"warning":"error";return l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsxs("td",{className:"px-4 py-2.5 text-xs text-gray-600",children:["#",c+1]}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"text-sm text-gray-300 font-mono",children:o.name})}),l.jsx("td",{className:"px-4 py-2.5",children:o.plugin&&l.jsx("span",{className:"text-[10px] text-gray-600 bg-gray-800 px-1.5 py-0.5 rounded",children:o.plugin})}),l.jsx("td",{className:"px-4 py-2.5 text-sm font-mono text-gray-400 text-right",children:o.count.toLocaleString()}),l.jsx("td",{className:"px-4 py-2.5 text-right",children:l.jsx(ue,{label:`${d}%`,variant:x})}),l.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-600 text-right whitespace-nowrap",children:o.lastUsed?Vy(o.lastUsed):"-"})]},o.name)})})]})]})}function Yy({agents:r}){if(r.length===0)return l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No agent data available"})});const u=[...r].sort((c,d)=>d.count-c.count),o=u[0]?.count||1;return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Top Agents"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500 w-12",children:"Rank"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Agent"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Usage"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Count"})]})}),l.jsx("tbody",{children:u.map((c,d)=>{const x=Math.max(2,c.count/o*100);return l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsxs("td",{className:"px-4 py-2.5 text-xs text-gray-600",children:["#",d+1]}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"text-sm text-gray-300",children:c.name})}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("div",{className:"w-full h-1.5 bg-gray-800 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-cyan-500/60 transition-all",style:{width:`${x}%`}})})}),l.jsx("td",{className:"px-4 py-2.5 text-sm font-mono text-gray-400 text-right",children:c.count.toLocaleString()})]},c.name)})})]})]})}function Gy({days:r}){const u=r.slice(-14);if(u.length===0)return l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No daily data available"})});const o=Math.max(...u.map(x=>x.totalEvents),1),c=u.reduce((x,m)=>x+m.totalEvents,0),d=Math.round(c/u.length);return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsx(ce,{title:"Period Total",value:c.toLocaleString(),subtitle:`Last ${u.length} days`,color:"indigo"}),l.jsx(ce,{title:"Daily Average",value:d.toLocaleString(),color:"cyan"}),l.jsx(ce,{title:"Peak Day",value:o.toLocaleString(),subtitle:u.find(x=>x.totalEvents===o)?.date||"",color:"emerald"})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:["Daily Events (Last ",u.length," Days)"]}),l.jsx("div",{className:"flex items-end gap-1.5 h-40",children:u.map(x=>{const m=Math.max(2,x.totalEvents/o*100),j=x.date.slice(5);return l.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[l.jsx("span",{className:"text-[9px] text-gray-500",children:x.totalEvents}),l.jsx("div",{className:"w-full bg-indigo-500/40 rounded-t hover:bg-indigo-500/60 transition-colors cursor-default",style:{height:`${m}%`},title:`${x.date}: ${x.totalEvents} events`}),l.jsx("span",{className:"text-[8px] text-gray-700",children:j})]},x.date)})})]})]})}function Vy(r){if(!r)return"";try{const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}catch{return""}}function Vx({items:r,maxBars:u=10}){const o=[...r].sort((d,x)=>x.value-d.value).slice(0,u),c=Math.max(...o.map(d=>d.value),1);return l.jsx("div",{className:"space-y-2",children:o.map((d,x)=>l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-xs text-gray-400 w-28 truncate text-right",title:d.label,children:d.label}),l.jsx("div",{className:"flex-1 h-5 bg-gray-800 rounded overflow-hidden",children:l.jsx("div",{className:"h-full rounded transition-all duration-500",style:{width:`${d.value/c*100}%`,backgroundColor:d.color||"#6366f1"}})}),l.jsx("span",{className:"text-xs text-gray-500 w-10 text-right",children:d.value})]},x))})}const Qy={anthropic:"#6366f1",openai:"#10b981",google:"#f59e0b",mistral:"#ef4444",groq:"#8b5cf6",together:"#06b6d4","aws-bedrock":"#f97316","azure-openai":"#3b82f6"};function Xy({data:r,showProviderLines:u=!1,height:o=200}){if(!r||r.length===0)return l.jsx("div",{className:"flex items-center justify-center h-40 text-gray-500 text-sm",children:"No spend data available"});const c={top:20,right:20,bottom:30,left:50},d=600,x=d-c.left-c.right,m=o-c.top-c.bottom,j=Math.max(...r.map(A=>A.total_cost),.01),p=A=>c.left+A/Math.max(r.length-1,1)*x,h=A=>c.top+m-A/j*m,N=r.map((A,b)=>`${b===0?"M":"L"} ${p(b).toFixed(1)} ${h(A.total_cost).toFixed(1)}`).join(" "),v=[];if(u){const A=new Set;r.forEach(b=>Object.keys(b.providers).forEach(w=>A.add(w)));for(const b of A){const w=r.map((C,O)=>{const F=C.providers[b]?.cost??0;return`${O===0?"M":"L"} ${p(O).toFixed(1)} ${h(F).toFixed(1)}`}).join(" ");v.push({provider:b,path:w,color:Qy[b]||"#9ca3af"})}}const T=[0,j/2,j].map(A=>({value:A,y:h(A),label:`$${A<1?A.toFixed(2):A.toFixed(0)}`})),D=Math.min(r.length,5),_=Array.from({length:D},(A,b)=>{const w=Math.round(b/Math.max(D-1,1)*(r.length-1));return{x:p(w),label:r[w].date.slice(5)}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("svg",{viewBox:`0 0 ${d} ${o}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[T.map((A,b)=>l.jsx("line",{x1:c.left,y1:A.y,x2:d-c.right,y2:A.y,stroke:"#374151",strokeDasharray:"4 4"},b)),T.map((A,b)=>l.jsx("text",{x:c.left-8,y:A.y+4,textAnchor:"end",fill:"#9ca3af",fontSize:"10",children:A.label},`y-${b}`)),_.map((A,b)=>l.jsx("text",{x:A.x,y:o-5,textAnchor:"middle",fill:"#9ca3af",fontSize:"10",children:A.label},`x-${b}`)),v.map(A=>l.jsx("path",{d:A.path,fill:"none",stroke:A.color,strokeWidth:"1.5",strokeOpacity:"0.5"},A.provider)),l.jsx("path",{d:N,fill:"none",stroke:"#6366f1",strokeWidth:"2.5"}),r.map((A,b)=>l.jsx("circle",{cx:p(b),cy:h(A.total_cost),r:"3",fill:"#6366f1",className:"hover:r-5 transition-all",children:l.jsx("title",{children:`${A.date}: $${A.total_cost.toFixed(4)}`})},b))]}),u&&v.length>0&&l.jsx("div",{className:"flex flex-wrap gap-3 mt-2 text-xs text-gray-400",children:v.map(A=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("div",{className:"w-3 h-0.5",style:{backgroundColor:A.color}}),l.jsx("span",{children:A.provider})]},A.provider))})]})}const Zy={anthropic:"bg-indigo-500/20 text-indigo-400",openai:"bg-emerald-500/20 text-emerald-400",google:"bg-amber-500/20 text-amber-400",mistral:"bg-red-500/20 text-red-400",groq:"bg-violet-500/20 text-violet-400",together:"bg-cyan-500/20 text-cyan-400","aws-bedrock":"bg-orange-500/20 text-orange-400","azure-openai":"bg-blue-500/20 text-blue-400"};function rx(r){return r<.01?`$${r.toFixed(4)}`:`$${r.toFixed(2)}`}function ix(r){return r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:String(r)}function Ky({data:r}){const[u,o]=y.useState(null);if(!r||Object.keys(r).length===0)return l.jsx("div",{className:"text-sm text-gray-500 py-4 text-center",children:"No multi-provider spend data"});const c=Object.entries(r).sort((d,x)=>x[1].total_cost-d[1].total_cost);return l.jsx("div",{className:"space-y-2",children:c.map(([d,x])=>l.jsxs("div",{children:[l.jsxs("button",{className:"w-full flex items-center justify-between p-2 rounded hover:bg-gray-800/50 transition-colors",onClick:()=>o(u===d?null:d),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${Zy[d]||"bg-gray-500/20 text-gray-400"}`,children:d}),l.jsxs("span",{className:"text-xs text-gray-500",children:[x.sessions," sessions"]})]}),l.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[l.jsxs("span",{className:"text-gray-400",children:[ix(x.total_tokens)," tokens"]}),l.jsx("span",{className:"text-gray-200 font-medium",children:rx(x.total_cost)}),l.jsx("span",{className:"text-gray-600",children:u===d?"▲":"▼"})]})]}),u===d&&l.jsx("div",{className:"ml-6 mt-1 space-y-1",children:Object.entries(x.models).sort((m,j)=>j[1].cost-m[1].cost).map(([m,j])=>l.jsxs("div",{className:"flex items-center justify-between py-1 px-2 text-xs text-gray-400",children:[l.jsx("span",{className:"truncate max-w-48",children:m}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{children:ix(j.tokens)}),l.jsx("span",{className:"text-gray-300",children:rx(j.cost)})]})]},m))})]},d))})}function Jy({currentSpend:r,monthlyLimit:u}){if(!u)return null;const o=r/u*100,c=Math.min(o,100);let d="bg-emerald-500",x="";return o>=100?(d="bg-red-500",x="animate-pulse ring-1 ring-red-500/50"):o>=80&&(d="bg-amber-500"),l.jsxs("div",{className:`rounded-lg p-3 bg-gray-800/50 ${x}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:"text-xs text-gray-400",children:"Monthly Budget"}),l.jsxs("span",{className:"text-sm font-medium text-gray-200",children:["$",r.toFixed(2)," / $",u.toFixed(2)]})]}),l.jsx("div",{className:"h-2 bg-gray-700 rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${d}`,style:{width:`${c}%`}})}),l.jsx("div",{className:"mt-1 text-right",children:l.jsxs("span",{className:"text-xs text-gray-500",children:[o.toFixed(1),"%"]})})]})}function Wy(){const[r,u]=y.useState("overview"),[o,c]=y.useState(null),[d,x]=y.useState(0);Oe("cost-update",()=>x(C=>C+1));const{data:m,loading:j,error:p,refetch:h}=Re(`/api/costs/summary?_r=${d}`);if(j)return l.jsx(et,{});if(p)return l.jsx(Gt,{message:p,onRetry:h});if(!m)return null;const N=m.sessions||[],v=m.billingContext?.planType==="subscription",T=m.modelBreakdown?Object.entries(m.modelBreakdown).map(([C,O])=>({model:C,...O})).sort((C,O)=>(O.cost??-1)-(C.cost??-1)):Py(N),D=N.reduce((C,O)=>C+(O.inputTokens||0),0),_=N.reduce((C,O)=>C+(O.outputTokens||0),0),A=N.reduce((C,O)=>C+(O.cacheReadTokens||0),0),b=N.reduce((C,O)=>C+(O.cacheWriteTokens||0),0),w=D+_+A+b;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("div",{className:"flex items-center gap-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("svg",{className:"w-5 h-5 text-amber-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),l.jsx("path",{d:"M2 17l10 5 10-5"}),l.jsx("path",{d:"M2 12l10 5 10-5"})]}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Claude Code Usage"}),l.jsx("span",{className:"text-xs text-gray-500",children:v&&m.billingContext?.monthlyAmount?`$${m.billingContext.monthlyAmount}/mo plan`:"API-equivalent usage analytics"})]})]})}),l.jsxs("p",{className:"text-xs text-gray-400 border border-gray-800 rounded-lg px-4 py-3",children:["Local Claude Code logs only. Prices use exact matches in the ",m.pricingAsOf||"2026-03"," legacy rate table. These are API estimates, not bills. Unknown or mixed-model sessions are unpriced.",!!m.unpricedSessionCount&&l.jsxs("span",{className:"block mt-1 text-amber-300",children:[m.unpricedSessionCount," unpriced session",m.unpricedSessionCount===1?"":"s"," · Priced subtotal: ",il(m.estimatedSubtotal)]})]}),v&&l.jsxs("div",{className:"bg-indigo-500/10 border border-indigo-500/20 rounded-xl px-4 py-3 flex items-center gap-3",children:[l.jsx(ue,{label:"Subscription",variant:"info"}),l.jsxs("span",{className:"text-xs text-gray-300",children:[m.billingContext?.monthlyAmount?`$${m.billingContext.monthlyAmount}/mo plan. `:"","Costs shown as API-equivalent value for usage analytics."]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Estimated API Value",value:il(m.totalCost),subtitle:v&&m.billingContext?.monthlyAmount?`Your plan: $${m.billingContext.monthlyAmount}/mo`:void 0,color:"amber"}),l.jsx(ce,{title:"Estimated Cache Savings",value:il(m.totalSavings),subtitle:v?"API-equivalent savings from cache":void 0,color:"emerald"}),l.jsx(ce,{title:"Total Tokens",value:Jl(m.totalTokens),subtitle:Iy(m.totalTokens),color:"indigo"}),l.jsx(ce,{title:"Sessions",value:m.sessionCount.toLocaleString(),color:"cyan"})]}),m.budget&&m.budget.monthlyLimit>0&&l.jsx(Jy,{currentSpend:m.budget.currentSpend,monthlyLimit:m.budget.monthlyLimit}),l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:["overview","trends","providers","sessions"].map(C=>{const O={overview:"Breakdown",trends:"Trends",providers:"Providers",sessions:`Sessions (${N.length})`};return l.jsx("button",{onClick:()=>u(C),className:`flex-1 px-3 py-1.5 text-xs rounded-md transition-colors ${r===C?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:O[C]},C)})}),r==="overview"&&l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Priced Model Estimates"}),T.some(C=>C.cost!=null)?l.jsx(Vx,{items:T.filter(C=>C.cost!=null).map(C=>({label:C.model,value:Number(C.cost?.toFixed(2)),color:"#f59e0b"}))}):l.jsx("p",{className:"text-gray-600 text-xs",children:"No priced model estimates"})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Token Breakdown"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(Er,{label:"Input",value:D,total:w,color:"bg-indigo-500"}),l.jsx(Er,{label:"Output",value:_,total:w,color:"bg-cyan-500"}),A>0&&l.jsx(Er,{label:"Cache Read",value:A,total:w,color:"bg-emerald-500"}),b>0&&l.jsx(Er,{label:"Cache Write",value:b,total:w,color:"bg-amber-500"})]})]}),T.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden lg:col-span-2",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Model Details"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Model"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Sessions"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Tokens"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Estimate"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Avg/Session"})]})}),l.jsx("tbody",{children:T.map(C=>l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsx("td",{className:"px-4 py-2 text-sm text-gray-300",children:C.model}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:C.sessions.toLocaleString()}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:Jl(C.tokens)}),l.jsx("td",{className:"px-4 py-2 text-xs text-amber-400 text-right",children:il(C.cost)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:il(C.cost!=null&&C.sessions>0?C.cost/C.sessions:null,4)})]},C.model))})]})]})]}),r==="trends"&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Daily Cost Trends"}),l.jsx(Xy,{data:m.trends||[],showProviderLines:!0,height:250})]}),r==="providers"&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Provider Breakdown"}),l.jsx(Ky,{data:m.providerBreakdown})]}),r==="sessions"&&l.jsx(Fy,{sessions:N,expandedSession:o,onToggle:C=>c(o===C?null:C)}),l.jsx("div",{className:"text-center py-4 border-t border-gray-800/50",children:l.jsx("span",{className:"text-xs text-gray-600",children:"More providers coming soon"})})]})}const xo=37,cx=210,ox=5;function Fy({sessions:r,expandedSession:u,onToggle:o}){const c=y.useRef(null),[d,x]=y.useState(0),m=y.useCallback(()=>{c.current&&x(c.current.scrollTop)},[]),j=y.useMemo(()=>r.map(A=>(A.sessionId||"-")===u?cx:xo),[r,u]),p=y.useMemo(()=>{const A=[];let b=0;for(const w of j)A.push(b),b+=w;return A},[j]),h=p.length>0?p[p.length-1]+j[j.length-1]:0,N=Math.min(h,xo*20),v=y.useMemo(()=>{if(r.length===0)return{start:0,end:0};const A=d,b=d+N;let w=0,C=r.length-1;for(;w<C;){const X=w+C>>1;p[X]+j[X]<=A?w=X+1:C=X}const O=Math.max(0,w-ox);for(w=O,C=r.length-1;w<C;){const X=w+C+1>>1;p[X]>=b?C=X-1:w=X}const F=Math.min(r.length,w+ox+1);return{start:O,end:F}},[d,N,r.length,p,j]);if(y.useEffect(()=>{if(!u||!c.current)return;const A=r.findIndex(O=>(O.sessionId||"-")===u);if(A<0)return;const b=p[A],w=b+cx,C=c.current;w>C.scrollTop+N?C.scrollTop=w-N:b<C.scrollTop&&(C.scrollTop=b)},[u,r,p,N]),r.length===0)return l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No session data available"})});const T=r.slice(v.start,v.end),D=v.start>0?p[v.start]:0,_=v.end<r.length?h-p[v.end]:0;return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 border-b border-gray-800 flex items-center justify-between",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Recent Sessions"}),l.jsxs("span",{className:"text-xs text-gray-500",children:[r.length," sessions"]})]}),l.jsx("table",{className:"w-full table-fixed",children:l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500 w-8"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Session"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Model"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Input"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Output"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Cache"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Estimate"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Duration"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"When"})]})})}),l.jsx("div",{ref:c,onScroll:m,className:"overflow-y-auto custom-scrollbar",style:{maxHeight:`${N}px`},children:l.jsxs("div",{style:{height:`${h}px`,position:"relative"},children:[D>0&&l.jsx("div",{style:{height:`${D}px`}}),l.jsx("table",{className:"w-full table-fixed",children:l.jsx("tbody",{children:T.map(A=>{const b=A.sessionId||"-",w=u===b,C=(A.cacheReadTokens||0)+(A.cacheWriteTokens||0);return l.jsxs(y.Fragment,{children:[l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30 cursor-pointer",style:{height:`${xo}px`},onClick:()=>o(b),children:[l.jsx("td",{className:"px-4 py-2 text-xs text-gray-600 w-8",children:l.jsx("span",{className:`inline-block transition-transform ${w?"rotate-90":""}`,children:"▸"})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400 font-mono",children:b.slice(0,8)}),l.jsx("td",{className:"px-4 py-2",title:A.models?.join(" → "),children:l.jsx(ue,{label:A.model||"unknown",variant:"default"})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:Jl(A.inputTokens)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:Jl(A.outputTokens)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:C>0?Jl(C):"-"}),l.jsx("td",{className:"px-4 py-2 text-xs text-amber-400 text-right",children:il(A.cost,4)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:A.duration?ux(A.duration):"-"}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500",children:ev(A.timestamp)})]}),w&&l.jsx("tr",{className:"border-b border-gray-800/50",children:l.jsx("td",{colSpan:9,className:"px-6 py-3 bg-gray-800/20",children:l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-xs",children:[l.jsxs("div",{className:"col-span-full",children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Observed model IDs"}),l.jsx("span",{className:"text-gray-300 font-mono break-all",children:A.models?.join(" → ")||A.model||"unknown"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Input Tokens"}),l.jsx("span",{className:"text-gray-300 font-mono",children:A.inputTokens.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Output Tokens"}),l.jsx("span",{className:"text-gray-300 font-mono",children:A.outputTokens.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Cache Write"}),l.jsx("span",{className:"text-gray-300 font-mono",children:(A.cacheWriteTokens||0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Cache Read"}),l.jsx("span",{className:"text-gray-300 font-mono",children:(A.cacheReadTokens||0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"API Estimate"}),l.jsx("span",{className:"text-amber-400 font-mono",children:il(A.cost,6)})]}),A.savings!=null&&A.savings>0&&l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Cache Savings"}),l.jsxs("span",{className:"text-emerald-400 font-mono",children:["$",A.savings.toFixed(6)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Duration"}),l.jsx("span",{className:"text-gray-300",children:A.duration?ux(A.duration):"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 block mb-1",children:"Session ID"}),l.jsx("span",{className:"text-gray-400 font-mono text-[10px]",children:A.sessionId})]})]})})})]},b)})})}),_>0&&l.jsx("div",{style:{height:`${_}px`}})]})})]})}function Er({label:r,value:u,total:o,color:c}){const d=o>0?u/o*100:0,x={"bg-indigo-500":"rgb(99 102 241 / 0.6)","bg-cyan-500":"rgb(6 182 212 / 0.6)","bg-emerald-500":"rgb(16 185 129 / 0.6)","bg-amber-500":"rgb(245 158 11 / 0.6)"};return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-xs text-gray-400",children:r}),l.jsxs("span",{className:"text-xs text-gray-500",children:[Jl(u)," (",d.toFixed(1),"%)"]})]}),l.jsx("div",{className:"h-2 bg-gray-800 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,backgroundColor:x[c]||c}})})]})}function Py(r){const u=new Map;for(const o of r){const c=o.model||"unknown",d=u.get(c)||{cost:0,tokens:0,sessions:0};d.cost=d.cost==null||o.cost==null?null:d.cost+o.cost,d.tokens+=(o.inputTokens||0)+(o.outputTokens||0),d.sessions++,u.set(c,d)}return Array.from(u.entries()).map(([o,c])=>({model:o,...c})).sort((o,c)=>(c.cost??-1)-(o.cost??-1))}function Jl(r){return r?r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:String(r):"0"}function Iy(r){return r?r.toLocaleString():"0"}function ux(r){const u=Math.round(r);if(u<60)return`${u}s`;const o=Math.floor(u/60),c=u%60;return o<60?`${o}m ${c}s`:`${Math.floor(o/60)}h ${o%60}m`}function ev(r){if(!r)return"-";try{const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}catch{return"-"}}function il(r,u=2){return r==null?"Unknown":`$${r.toFixed(u)}`}function Lr(){const[r,u]=y.useState(!1),[o,c]=y.useState(null),[d,x]=y.useState(null),[m,j]=y.useState([]),[p,h]=y.useState("idle"),N=y.useRef(null),v=y.useRef(null);Oe("command-output",_=>{const A=_;v.current&&A.executionId===v.current&&A.line&&j(b=>[...b,A.line])}),Oe("command-complete",_=>{const A=_;if(v.current&&A.executionId===v.current){if(N.current&&(clearTimeout(N.current),N.current=null),u(!1),A.exitCode===0)h("success"),j(b=>[...b,"Command completed successfully."]);else{h("error");const b=`Command failed (exit code ${A.exitCode??"unknown"})`;x(b),j(w=>[...w,b])}v.current=null}}),y.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const T=y.useCallback(async(_,A)=>{const b=A?.queryParams,w=A?.timeoutMs??6e4;u(!0),x(null),j([`> specweave ${_}${b?` (${Object.values(b).join(", ")})`:""}`]),h("running");try{const C=b?"?"+new URLSearchParams(b).toString():"",F=await(await fetch(`/api/commands/${_}${C}`,{method:"POST"})).json();if(!F.ok)return x(F.error||"Command failed"),h("error"),j(ee=>[...ee,`Error: ${F.error||"Command failed"}`]),u(!1),null;c(F.data),v.current=F.data?.id||null;const X=Math.round(w/1e3);return N.current=setTimeout(()=>{v.current&&(v.current=null,u(!1),h("error"),x(`Command timed out after ${X} seconds`),j(ee=>[...ee,`Timed out after ${X} seconds.`]))},w),F.data}catch(C){return x(String(C)),h("error"),j(O=>[...O,`Error: ${String(C)}`]),u(!1),null}},[]),D=y.useCallback(()=>{u(!1),c(null),x(null),j([]),h("idle"),v.current=null,N.current&&(clearTimeout(N.current),N.current=null)},[]);return{execute:T,running:r,result:o,error:d,output:m,status:p,reset:D}}function tv(r){switch(r){case"connected":return"success";case"sync_failed":return"warning";case"configured_never_synced":return"info";default:return"default"}}function av(r){switch(r){case"connected":return"Connected";case"sync_failed":return"Sync Failed";case"configured_never_synced":return"Ready";case"not_configured":return"Not Configured";default:return r||"Unknown"}}function lv(){const[r,u]=y.useState("health"),[o,c]=y.useState(null),[d,x]=y.useState(0),[m,j]=y.useState([]);Oe("sync-update",()=>x(U=>U+1)),Oe("sync-error",()=>x(U=>U+1));const{data:p,loading:h,error:N,refetch:v}=Re(`/api/sync/status?_r=${d}`);y.useEffect(()=>{fetch("/api/sync/errors?hours=24&limit=20").then(U=>U.json()).then(U=>{U.ok&&Array.isArray(U.data)&&j(U.data)}).catch(()=>{})},[d]);const{data:T,loading:D}=Re(`/api/sync/audit?limit=100&_r=${d}`),{data:_,loading:A}=Re(`/api/sync/audit/summary?_r=${d}`),{execute:b,running:w}=Lr(),C=async(U,P)=>{const I=P?`${P}-${U}`:U;c(I);try{const re=new URLSearchParams(window.location.search).get("project")||"",Ee=new URLSearchParams;Ee.set("platform",U),P&&Ee.set("repo",P),re&&Ee.set("project",re);const Ce=new AbortController,q=setTimeout(()=>Ce.abort(),3e4);await fetch(`/api/sync/verify?${Ee.toString()}`,{method:"POST",signal:Ce.signal}),clearTimeout(q),v()}catch{}c(null)};if(h||D||A)return l.jsx(et,{});if(N)return l.jsx(Gt,{message:N,onRetry:v});if(!p)return null;const O=T?.length||0,F=T?.filter(U=>U.result==="error").length||0,X=T?.filter(U=>U.conflict)||[],ee=p.isUmbrella&&p.repos&&p.repos.length>0;let W=0,J=0;if(ee&&p.repos)for(const U of p.repos){const P=Object.values(U.platforms).filter(I=>I.connectionStatus!=="not_configured");J+=P.length,W+=P.filter(I=>I.connectionStatus==="connected").length}else{const U=Object.entries(p.platforms).filter(([P])=>["github","jira","ado"].includes(P));J=U.length,W=U.filter(([,P])=>P.connectionStatus==="connected").length}return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Sync Health"}),!ee&&l.jsx("button",{onClick:()=>b("sync-push"),disabled:w,className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:w?"Syncing...":"Sync Now"})]}),p.permissions&&l.jsx(nv,{permissions:p.permissions,onSave:v}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:ee?"Repos":"Platforms",value:ee?p.repos.length:J,subtitle:`${W} connected`,color:"indigo"}),l.jsx(ce,{title:"Audit Entries",value:O,color:"cyan"}),l.jsx(ce,{title:"Errors",value:F,color:"rose"}),l.jsx(ce,{title:"Conflicts",value:X.length,color:"amber"})]}),l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:["health","audit","conflicts"].map(U=>l.jsx("button",{onClick:()=>u(U),className:`flex-1 px-3 py-1.5 text-xs rounded-md transition-colors ${r===U?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:U==="health"?"Platform Health":U==="audit"?"Audit Log":`Conflicts (${X.length})`},U))}),r==="health"&&l.jsx(l.Fragment,{children:ee&&p.repos?l.jsx(sv,{repos:p.repos,auditSummary:_,verifying:o,onVerify:C,execute:b,running:w}):l.jsx(rv,{platforms:p.platforms,auditSummary:_,verifying:o,onVerify:C})}),r==="health"&&m.length>0&&l.jsx(iv,{errors:m}),r==="audit"&&l.jsx(dx,{entries:T||[]}),r==="conflicts"&&l.jsx(dx,{entries:X}),p.lastUpdated&&l.jsxs("p",{className:"text-xs text-gray-600",children:["Last metadata update: ",new Date(p.lastUpdated).toLocaleString()]})]})}function nv({permissions:r,onSave:u}){const[o,c]=y.useState(r),[d,x]=y.useState(!1),[m,j]=y.useState(null),p=JSON.stringify(o)!==JSON.stringify(r),h=async()=>{x(!0),j(null);try{const v=new URLSearchParams(window.location.search).get("project")||"",T=v?`?project=${v}`:"",D=await fetch(`/api/config${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({sync:{settings:o}})});if(D.ok)u();else{const _=await D.json().catch(()=>({}));j(_.error||`Save failed (HTTP ${D.status})`)}}catch(v){j(String(v))}x(!1)},N=[{key:"canUpsertInternalItems",label:"Create/Update Internal",desc:"Can create/update items created by SpecWeave"},{key:"canUpdateExternalItems",label:"Update External",desc:"Can modify items originally from external tools"},{key:"canUpdateStatus",label:"Update Status",desc:"Can close/reopen issues on external platforms"},{key:"autoSyncOnCompletion",label:"Auto-Sync",desc:"Automatically sync when tasks are completed"}];return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("span",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider",children:"Sync Permissions"}),p&&l.jsx("button",{onClick:h,disabled:d,className:"px-2.5 py-1 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white text-[10px] rounded transition-colors",children:d?"Saving...":"Save"})]}),m&&l.jsxs("p",{className:"text-xs text-red-400 mb-2",children:["Failed to save: ",m]}),l.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:N.map(({key:v,label:T,desc:D})=>l.jsxs("button",{onClick:()=>c(_=>({..._,[v]:!_[v]})),className:`text-left p-2.5 rounded-lg border transition-colors ${o[v]?"bg-emerald-500/10 border-emerald-500/30 hover:border-emerald-500/50":"bg-gray-800/30 border-gray-800 hover:border-gray-700"}`,children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${o[v]?"bg-emerald-400":"bg-gray-600"}`}),l.jsx("span",{className:"text-xs font-medium text-gray-300",children:T})]}),l.jsx("p",{className:"text-[10px] text-gray-500 leading-tight",children:D})]},v))})]})}function sv({repos:r,auditSummary:u,verifying:o,onVerify:c,execute:d,running:x}){return r.length===0?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No child repositories configured"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"Add repos in umbrella.childRepos in config.json"})]}):l.jsx("div",{className:"space-y-4",children:r.map(m=>{const p=Object.entries(m.platforms).filter(([h])=>["github","jira","ado"].includes(h)).filter(([,h])=>h.connectionStatus!=="not_configured");return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium text-gray-200",children:m.repoName}),m.hasSpecweave&&l.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-medium bg-emerald-500/15 text-emerald-400 rounded",children:".specweave"}),!m.hasSpecweave&&l.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-medium bg-gray-700/50 text-gray-500 rounded",children:"no .specweave"})]}),l.jsx("span",{className:"text-[10px] text-gray-600",children:m.repoPath})]}),l.jsx("button",{onClick:()=>d("sync-push",{queryParams:{repo:m.repoId}}),disabled:x||!m.hasSpecweave,title:m.hasSpecweave?"Sync this repository":"Initialize .specweave in this repo to enable sync",className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-40 disabled:cursor-not-allowed text-white text-xs rounded-lg transition-colors",children:x?"Syncing...":"Sync Now"})]}),p.length===0?l.jsxs("div",{className:"text-xs text-gray-600 p-3 bg-gray-800/20 rounded-lg",children:["No platforms configured for this repository.",l.jsx(Qe,{to:"/config",className:"ml-1 text-indigo-400 hover:text-indigo-300",children:"Configure"})]}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:p.map(([h,N])=>l.jsx(Qx,{platform:h,info:N,summary:u?.[h],verifying:o===`${m.repoId}-${h}`,onVerify:()=>c(h,m.repoId)},h))})]},m.repoId)})})}function rv({platforms:r,auditSummary:u,verifying:o,onVerify:c}){const d=Object.entries(r).filter(([x])=>["github","jira","ado"].includes(x));return d.length===0?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No sync platforms configured"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"Configure GitHub, JIRA, or ADO in your config"})]}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(([x,m])=>l.jsx(Qx,{platform:x,info:m,summary:u?.[x],verifying:o===x,onVerify:()=>c(x)},x))})}function Qx({platform:r,info:u,summary:o,verifying:c,onVerify:d}){const x=u.connectionStatus||"unknown";return l.jsxs("div",{className:"bg-gray-800/30 border border-gray-800/50 rounded-xl p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Xx,{platform:r}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm font-medium text-gray-300 capitalize",children:r}),u.configDetail&&l.jsx("div",{className:"text-[10px] text-gray-600 mt-0.5",children:u.configDetail})]})]}),l.jsx(ue,{label:av(x),variant:tv(x)})]}),u.diagnosticMessage&&l.jsx("div",{className:"text-xs text-gray-500 mb-3 p-2 bg-gray-800/30 rounded-lg",children:u.diagnosticMessage}),x==="not_configured"&&l.jsx(Qe,{to:"/config",className:"block text-center text-xs text-indigo-400 hover:text-indigo-300 py-2 border border-gray-800 rounded-lg hover:border-indigo-500/30 transition-colors",children:"Configure in Settings"}),x==="configured_never_synced"&&l.jsx("button",{onClick:d,disabled:c,className:"w-full text-xs text-indigo-400 hover:text-indigo-300 py-2 border border-gray-800 rounded-lg hover:border-indigo-500/30 transition-colors disabled:opacity-50",children:c?"Verifying...":"Verify Connection"}),x==="sync_failed"&&l.jsx("button",{onClick:d,disabled:c,className:"w-full text-xs text-amber-400 hover:text-amber-300 py-2 border border-amber-500/20 rounded-lg hover:border-amber-500/40 transition-colors disabled:opacity-50",children:c?"Verifying...":"Retry Sync"}),l.jsxs("div",{className:"space-y-2 mt-3",children:[u.lastImport&&l.jsx(Xl,{label:"Last Import",value:new Date(u.lastImport).toLocaleString()}),x==="connected"&&!u.lastImport&&l.jsx(Xl,{label:"Status",value:"Connected, no imports yet"}),u.lastImportCount!=null&&u.lastImportCount>0&&l.jsx(Xl,{label:"Items Imported",value:u.lastImportCount.toLocaleString()}),u.lastSkippedCount!=null&&u.lastSkippedCount>0&&l.jsx(Xl,{label:"Skipped",value:u.lastSkippedCount.toLocaleString()}),o&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t border-gray-800 my-2"}),l.jsx(Xl,{label:"Total Ops",value:o.total.toLocaleString()}),l.jsx(Xl,{label:"Success",value:o.success.toLocaleString()}),o.errors>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500",children:"Errors"}),l.jsx(ue,{label:String(o.errors),variant:"error"})]})]})]})]})}function iv({errors:r}){const[u,o]=y.useState(null);return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Sync Errors (last 24h)"}),l.jsx("div",{className:"space-y-2",children:r.map((c,d)=>{const x=`${c.provider}-${c.incrementId}-${d}`,m=u===x;return l.jsxs("div",{children:[l.jsxs("button",{"data-testid":`sync-error-row-${d}`,onClick:()=>o(m?null:x),className:"w-full flex items-start gap-2 p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800/80 transition-colors text-left",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full mt-1.5 bg-rose-400 shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-300 capitalize",children:c.provider}),l.jsx(ue,{label:c.incrementId,variant:"default"}),l.jsx(ue,{label:c.outcome,variant:"error"})]}),l.jsx("div",{className:"text-xs text-gray-500 mt-1 truncate",children:c.error}),l.jsx("div",{className:"text-[10px] text-gray-600 mt-0.5",children:Zx(c.timestamp)})]}),l.jsx("span",{className:"text-[10px] text-gray-600 mt-1",children:m?"▲":"▼"})]}),m&&l.jsxs("div",{"data-testid":`sync-error-detail-${d}`,className:"mt-1 p-3 bg-gray-800/30 rounded-lg border border-gray-800/50",children:[l.jsx("div",{className:"text-xs text-gray-400 mb-2 font-medium",children:"Full Error"}),l.jsx("pre",{className:"text-xs text-gray-500 whitespace-pre-wrap font-mono mb-2",children:c.error}),c.errorStack&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-xs text-gray-400 mb-1 font-medium",children:"Stack Trace"}),l.jsx("pre",{className:"text-xs text-gray-600 whitespace-pre-wrap font-mono max-h-32 overflow-y-auto",children:c.errorStack.split(`
12
- `).slice(0,3).join(`
13
- `)})]})]})]},x)})})]})}function dx({entries:r}){const[u,o]=y.useState(null);if(r.length===0)return l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No audit entries"})});const c={success:"success",error:"error",denied:"warning",skipped:"default"};return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Time"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Platform"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Operation"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Item"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Direction"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Result"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Duration"})]})}),l.jsx("tbody",{children:r.map((d,x)=>{const m=!!d.message,j=u===x;return l.jsxs("tr",{className:`border-b border-gray-800/50 hover:bg-gray-800/30 ${m?"cursor-pointer":""}`,onClick:()=>m&&o(j?null:x),children:[l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500",children:Zx(d.timestamp)}),l.jsx("td",{className:"px-4 py-2",children:l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Xx,{platform:d.platform}),l.jsx("span",{className:"text-xs text-gray-400 capitalize",children:d.platform})]})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400",children:d.operation}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 font-mono max-w-[120px] truncate",children:d.itemId||"-"}),l.jsx("td",{className:"px-4 py-2",children:l.jsx(ue,{label:d.direction,variant:d.direction==="push"?"info":"default"})}),l.jsx("td",{className:"px-4 py-2",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ue,{label:d.result,variant:c[d.result]||"default"}),m&&l.jsx("span",{className:"text-[10px] text-gray-600",children:j?"▲":"▼"})]})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-600 text-right",children:d.duration?`${d.duration}ms`:"-"})]},x)})})]}),u!==null&&r[u]?.message&&l.jsx("div",{className:"border-t border-gray-800 px-4 py-3 bg-gray-800/20",children:l.jsx("pre",{className:"text-xs text-gray-400 whitespace-pre-wrap font-mono max-h-40 overflow-y-auto",children:r[u].message})})]})}function Xl({label:r,value:u}){return l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500",children:r}),l.jsx("span",{className:"text-xs text-gray-400",children:u})]})}function Xx({platform:r}){const u={github:"bg-gray-700",jira:"bg-blue-700",ado:"bg-blue-600"};return l.jsx("div",{className:`w-5 h-5 rounded ${u[r]||"bg-gray-700"} flex items-center justify-center`,children:l.jsx("span",{className:"text-[9px] text-white font-bold",children:r[0]?.toUpperCase()})})}function Zx(r){if(!r)return"-";try{const u=new Date(r).getTime();if(isNaN(u))return"-";const o=Date.now()-u,c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const d=Math.floor(c/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}catch{return"-"}}const Kx={prompt_too_long:"error",api_error:"warning",tool_failure:"info",hook_error:"default",rate_limit:"warning",unknown:"default"},es=50;function cv(){const[r,u]=zt("tab","groups"),[o,c]=zt("type",""),[d,x]=zt("q",""),[m,j]=zt("session",""),[p,h]=y.useState(0),[N,v]=y.useState(d),T=p*es,D=o?`&type=${encodeURIComponent(o)}`:"",_=d?`&search=${encodeURIComponent(d)}`:"",[A,b]=y.useState(0);Oe("error-detected",()=>b(le=>le+1));const{data:w,loading:C,error:O}=Re(r==="groups"?`/api/errors/groups?_r=${A}`:""),{data:F,loading:X,error:ee}=Re(r==="errors"||r==="groups"?`/api/errors/recent?limit=${es}&offset=${T}${D}${_}&_r=${A}`:""),{data:W,loading:J,error:U}=Re(r==="sessions"||m?`/api/errors/sessions?limit=50&_r=${A}`:""),{data:P,loading:I,error:re}=Re(r==="timeline"?`/api/errors/timeline?bucket=60&_r=${A}`:""),Ee=y.useCallback(()=>{x(N.trim()),h(0),N.trim()&&u("errors")},[N,x,u]);y.useEffect(()=>{m&&W&&!W.find(le=>le.sessionId===m)&&j("")},[m,W,j]);const Ce=r==="groups"&&C||r==="errors"&&X||r==="timeline"&&I||r==="sessions"&&J,q=O||ee||(r==="sessions"?U:null)||(r==="timeline"?re:null),R=F?.total||0,Q=F?.errors||[],ne=w?.length||0,Z=w?.reduce((le,We)=>le+We.sessions,0)||0,xe=w?.[0]?.type||"-",S=m?W?.find(le=>le.sessionId===m):null,$=o?(W||[]).filter(le=>le.errors.some(We=>We.type===o)):W||[],K=Math.ceil(R/es),ae=le=>{c(le),u("errors"),j(""),h(0)},de=le=>{u(le),j(""),le!=="errors"&&h(0)},ge=()=>{c(""),x(""),v(""),h(0)};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Error Tracing"}),l.jsx("span",{className:"text-xs text-gray-500",children:"Observability for Claude Code sessions"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{type:"text",value:N,onChange:le=>v(le.target.value),onKeyDown:le=>le.key==="Enter"&&Ee(),placeholder:"Search errors by message, tool name, or context...",className:"w-full px-3 py-2 text-sm bg-gray-900/50 border border-gray-700 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500/30"}),d&&l.jsx("button",{onClick:()=>{x(""),v(""),h(0)},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-300 text-xs",children:"clear"})]}),l.jsx("button",{onClick:Ee,className:"px-4 py-2 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors",children:"Search"})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Total Errors",value:R,color:"rose"}),l.jsx(ce,{title:"Error Types",value:ne,color:"amber"}),l.jsx(ce,{title:"Affected Sessions",value:Z,color:"indigo"}),l.jsx(ce,{title:"Most Common",value:xe,color:"cyan"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:["groups","errors","timeline","sessions"].map(le=>l.jsx("button",{onClick:()=>de(le),className:`flex-1 px-3 py-1.5 text-xs rounded-md transition-colors ${r===le?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:le==="groups"?"Error Groups":le==="errors"?"All Errors":le==="timeline"?"Timeline":"Sessions"},le))}),(o||d)&&l.jsxs("div",{className:"flex items-center gap-2",children:[o&&l.jsx(ue,{label:`type: ${o.replace(/_/g," ")}`,variant:"info"}),d&&l.jsx(ue,{label:`search: ${d.slice(0,20)}`,variant:"default"}),l.jsx("button",{onClick:ge,className:"text-xs text-gray-500 hover:text-gray-300 transition-colors",children:"clear all"})]})]}),q&&l.jsxs("div",{className:"bg-rose-900/30 border border-rose-700 rounded-lg px-4 py-3 flex items-center justify-between",children:[l.jsx("div",{className:"text-sm text-rose-300",children:q}),l.jsx("button",{onClick:()=>window.location.reload(),className:"text-xs text-rose-400 hover:text-rose-200 px-2 py-1 border border-rose-700 rounded transition-colors",children:"Retry"})]}),m&&S&&l.jsx(xv,{session:S,onClose:()=>j("")}),Ce&&!m&&l.jsx(et,{}),!m&&!Ce&&r==="groups"&&l.jsx(ov,{groups:w||[],onGroupClick:ae}),!m&&!Ce&&r==="errors"&&l.jsx(uv,{errors:Q,total:R,page:p,totalPages:K,onPageChange:h,onSessionClick:le=>{j(le),u("sessions")}}),!m&&!Ce&&r==="timeline"&&l.jsx(dv,{buckets:P||[],errors:Q,onSessionClick:le=>j(le)}),!m&&!Ce&&r==="sessions"&&l.jsx(fv,{sessions:$,onSelect:le=>j(le)}),!Ce&&!q&&R===0&&!m&&l.jsx(ko,{title:"No errors detected",description:"Claude Code session logs are clean"})]})}function ov({groups:r,onGroupClick:u}){return r.length===0?null:l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Error Groups"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Type"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Count"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Sessions"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Last Seen"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Sample Message"})]})}),l.jsx("tbody",{children:r.map(o=>l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsx("td",{className:"px-4 py-2",children:l.jsx(ue,{label:o.type.replace(/_/g," "),variant:Kx[o.type]||"default"})}),l.jsx("td",{className:"px-4 py-2 text-right",children:l.jsx("button",{onClick:()=>u(o.type),className:"text-sm text-indigo-400 hover:text-indigo-300 font-mono transition-colors",title:`View all ${o.count} errors of this type`,children:o.count})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:o.sessions}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-300 font-mono",title:Wl(o.lastSeen),children:ss(o.lastSeen)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 max-w-xs truncate",children:o.recentMessages[0]||"-"})]},o.type))})]})]})}function uv({errors:r,total:u,page:o,totalPages:c,onPageChange:d,onSessionClick:x}){const[m,j]=y.useState(new Set),p=y.useCallback(v=>{j(T=>{const D=new Set(T);return D.has(v)?D.delete(v):D.add(v),D})},[]);if(r.length===0)return l.jsx(ko,{title:"No errors",description:"No errors match the current filter"});const h=o*es+1,N=Math.min(o*es+r.length,u);return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 border-b border-gray-800 flex items-center justify-between",children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-300",children:["Errors ",h,"–",N," of ",u]}),c>1&&l.jsx(fx,{page:o,totalPages:c,onChange:d})]}),l.jsx("div",{className:"divide-y divide-gray-800/50",children:r.map((v,T)=>{const D=m.has(T),_=v.message.length>120;return l.jsx("div",{className:"px-4 py-3 hover:bg-gray-800/20 transition-colors",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx(ue,{label:v.type.replace(/_/g," "),variant:Kx[v.type]||"default"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:`text-xs text-gray-300 ${D?"whitespace-pre-wrap break-words":"truncate"} ${_?"cursor-pointer":""}`,onClick:()=>_&&p(T),title:_?D?"Click to collapse":"Click to expand details":void 0,children:[_&&l.jsx("span",{className:"text-indigo-400 mr-1 text-[10px] inline-block w-3",children:D?"▼":"▶"}),D?v.message:v.message.slice(0,200),!D&&_&&l.jsx("span",{className:"text-indigo-400 ml-1",children:"...more"})]}),v.context?.toolName&&l.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 bg-gray-800 border border-gray-700 rounded text-amber-400",children:v.context.toolName}),v.context.toolInput&&l.jsx("span",{className:"text-[10px] text-gray-500 font-mono truncate max-w-md",children:v.context.toolInput})]}),D&&l.jsx(Jx,{context:v.context})]}),l.jsxs("div",{className:"flex-shrink-0 text-right",children:[l.jsx("div",{className:"text-[10px] text-gray-300 font-mono",title:Wl(v.timestamp),children:ss(v.timestamp)}),l.jsx("div",{className:"text-[10px] text-gray-600",children:Wl(v.timestamp)}),l.jsx("button",{onClick:()=>x(v.sessionId),className:"text-[10px] text-indigo-400 hover:text-indigo-300 font-mono mt-0.5 transition-colors",title:"View full session",children:v.sessionId.slice(0,8)}),v.context?.messageIndex!=null&&l.jsxs("div",{className:"text-[10px] text-gray-600",children:["msg #",v.context.messageIndex]})]})]})},`${v.sessionId}-${v.timestamp}-${T}`)})}),c>1&&l.jsx("div",{className:"px-5 py-3 border-t border-gray-800 flex justify-end",children:l.jsx(fx,{page:o,totalPages:c,onChange:d})})]})}function Jx({context:r}){if(!r)return null;const{precedingAction:u,recentTools:o}=r;return!u&&(!o||o.length===0)?null:l.jsxs("div",{className:"mt-2 p-2 bg-gray-900/60 border border-gray-800 rounded-lg space-y-1.5",children:[u&&l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"What preceded this error:"}),l.jsx("div",{className:"text-[11px] text-gray-400 font-mono mt-0.5",children:u})]}),o&&o.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Recent tool chain:"}),l.jsx("div",{className:"flex flex-col gap-0.5 mt-0.5",children:o.map((c,d)=>l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[l.jsxs("span",{className:"text-gray-600",children:[o.length-d,"."]}),l.jsx("span",{className:"font-mono text-amber-400/80",children:c.name}),c.input&&l.jsx("span",{className:"text-gray-600 font-mono truncate max-w-sm",children:c.input})]},d))})]})]})}function fx({page:r,totalPages:u,onChange:o}){return l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>o(Math.max(0,r-1)),disabled:r===0,className:"px-2 py-1 text-xs rounded transition-colors disabled:text-gray-700 text-gray-400 hover:text-white hover:bg-gray-700",children:"Prev"}),l.jsxs("span",{className:"text-[10px] text-gray-500 px-2",children:[r+1," / ",u]}),l.jsx("button",{onClick:()=>o(Math.min(u-1,r+1)),disabled:r>=u-1,className:"px-2 py-1 text-xs rounded transition-colors disabled:text-gray-700 text-gray-400 hover:text-white hover:bg-gray-700",children:"Next"})]})}function dv({buckets:r,errors:u,onSessionClick:o}){const[c,d]=y.useState(null),x=Math.max(...r.map(h=>h.count),1),m={tool_failure:"bg-blue-500",prompt_too_long:"bg-rose-500",api_error:"bg-amber-500",hook_error:"bg-gray-500",rate_limit:"bg-amber-400",unknown:"bg-gray-600"},j=c?u.filter(h=>{const N=new Date(h.timestamp).getTime();return N>=new Date(c.start).getTime()&&N<new Date(c.end).getTime()}):u,p=h=>{try{return new Date(h).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return h}};return l.jsxs("div",{className:"space-y-4",children:[r.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Error Density (per hour)"}),c&&l.jsx("button",{onClick:()=>d(null),className:"text-[10px] text-indigo-400 hover:text-indigo-300",children:"Clear filter"})]}),l.jsx("div",{className:"flex items-end gap-px h-24",children:r.map((h,N)=>{const v=h.count/x*100,T=c?.start===h.start;return l.jsx("div",{className:"flex-1 flex flex-col items-center justify-end cursor-pointer group relative",onClick:()=>d(T?null:h),title:`${p(h.start)}: ${h.count} errors`,children:l.jsx("div",{className:`w-full min-h-[2px] rounded-t transition-all ${T?"bg-indigo-400":"bg-rose-500/70 group-hover:bg-rose-400"}`,style:{height:`${Math.max(v,2)}%`}})},N)})}),l.jsxs("div",{className:"flex justify-between mt-1",children:[l.jsx("span",{className:"text-[9px] text-gray-600",children:r.length>0?p(r[0].start):""}),l.jsx("span",{className:"text-[9px] text-gray-600",children:r.length>0?p(r[r.length-1].start):""})]}),l.jsx("div",{className:"flex gap-3 mt-2",children:Object.entries(m).map(([h,N])=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${N}`}),l.jsx("span",{className:"text-[9px] text-gray-600",children:h.replace(/_/g," ")})]},h))})]}),c&&l.jsxs("div",{className:"text-xs text-gray-400 px-1",children:["Showing ",j.length," errors from ",p(c.start)]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:c?"Filtered Errors":"Recent Errors"}),l.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto custom-scrollbar",children:[j.length===0&&l.jsx("p",{className:"text-xs text-gray-600",children:"No errors in this time range"}),j.slice(0,100).map((h,N)=>l.jsxs("div",{className:"flex items-start gap-3 py-2 px-2 hover:bg-gray-800/30 rounded cursor-pointer",onClick:()=>o(h.sessionId),children:[l.jsx("div",{className:`w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ${m[h.type]||"bg-gray-500"}`}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-400 font-mono",children:h.type.replace(/_/g," ")}),h.context?.toolName&&l.jsx("span",{className:"text-[10px] font-mono px-1 py-0.5 bg-gray-800 border border-gray-700 rounded text-amber-400",children:h.context.toolName}),l.jsx("span",{className:"text-[10px] text-gray-300 font-mono",children:ss(h.timestamp)}),l.jsx("span",{className:"text-[10px] text-gray-600",children:Wl(h.timestamp)})]}),l.jsx("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:h.message}),h.context?.precedingAction&&l.jsxs("div",{className:"text-[10px] text-gray-600 mt-0.5 truncate",children:["After: ",h.context.precedingAction]})]})]},N))]})]})]})}function fv({sessions:r,onSelect:u}){return r.length===0?null:l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Recent Sessions"})}),l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Session"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Branch"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Messages"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Tool Calls"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Errors"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Started"})]})}),l.jsx("tbody",{children:r.map(o=>l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30 cursor-pointer",onClick:()=>u(o.sessionId),children:[l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400 font-mono",children:o.sessionId.slice(0,8)}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500",children:o.gitBranch||"-"}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:o.messageCount}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500 text-right",children:o.toolCallCount}),l.jsx("td",{className:"px-4 py-2 text-right",children:o.errors.length>0?l.jsx(ue,{label:String(o.errors.length),variant:"error"}):l.jsx("span",{className:"text-xs text-gray-600",children:"0"})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-300 font-mono",title:Wl(o.startTime),children:ss(o.startTime)})]},o.sessionId))})]})]})}function xv({session:r,onClose:u}){const[o,c]=y.useState(new Set),d=x=>{c(m=>{const j=new Set(m);return j.has(x)?j.delete(x):j.add(x),j})};return l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-300",children:["Session: ",l.jsx("span",{className:"font-mono",children:r.sessionId.slice(0,12)})]}),l.jsxs("div",{className:"text-[10px] text-gray-600 mt-0.5",children:["v",r.version," | ",r.gitBranch," | ",r.messageCount," messages | ",r.toolCallCount," tool calls"]})]}),l.jsx("button",{onClick:u,className:"px-2 py-1 text-xs text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors",children:"Back"})]}),l.jsxs("div",{className:"flex gap-3 mb-4",children:[l.jsxs("div",{className:"text-xs text-gray-500",children:["Started: ",new Date(r.startTime).toLocaleString()]}),r.endTime&&l.jsxs("div",{className:"text-xs text-gray-500",children:["Ended: ",new Date(r.endTime).toLocaleString()]})]}),r.errors.length===0?l.jsx("p",{className:"text-gray-600 text-xs",children:"No errors in this session"}):l.jsx("div",{className:"space-y-2",children:r.errors.map((x,m)=>{const j=o.has(m),p=x.message.length>150;return l.jsxs("div",{className:"p-3 bg-gray-800/50 rounded-lg border-l-2 border-rose-500/50",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(ue,{label:x.type.replace(/_/g," "),variant:"error"}),x.context?.toolName&&l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 bg-gray-800 border border-gray-700 rounded text-amber-400",children:x.context.toolName}),l.jsx("span",{className:"text-[10px] text-gray-300 font-mono",children:ss(x.timestamp)}),l.jsx("span",{className:"text-[10px] text-gray-600",children:Wl(x.timestamp)})]}),l.jsxs("div",{className:`text-xs text-gray-400 ${j?"whitespace-pre-wrap break-words":""} ${p?"cursor-pointer":""}`,onClick:()=>p&&d(m),title:p?j?"Click to collapse":"Click to expand":void 0,children:[p&&l.jsx("span",{className:"text-indigo-400 mr-1 text-[10px] inline-block w-3",children:j?"▼":"▶"}),j?x.message:x.message.slice(0,300),!j&&p&&l.jsx("span",{className:"text-indigo-400 ml-1",children:"...more"})]}),x.context?.toolInput&&l.jsx("div",{className:"text-[10px] text-gray-500 font-mono mt-1.5 bg-gray-900/50 px-2 py-1 rounded",children:x.context.toolInput}),x.context?.messageIndex!=null&&l.jsxs("div",{className:"text-[10px] text-gray-600 mt-1",children:["At message #",x.context.messageIndex]}),j&&l.jsx(Jx,{context:x.context})]},m)})})]})}function Wl(r){if(!r)return"-";const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}function ss(r){if(!r)return"-";try{return new Date(r).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return r}}const mv=[{value:"all",label:"All"},{value:"command",label:"Commands"},{value:"hook",label:"Hooks"},{value:"notification",label:"Notifications"},{value:"cost",label:"Cost"}],hv=[{value:"all",label:"All Levels"},{value:"error",label:"Errors"},{value:"warning",label:"Warnings"},{value:"info",label:"Info"}];function gv(){const[r,u]=zt("category","all"),[o,c]=zt("severity","all"),d=r||"all",x=o||"all",[m,j]=y.useState([]),[p,h]=y.useState(200),[N,v]=y.useState(null),T=new URLSearchParams;T.set("limit",String(p)),d!=="all"&&T.set("categories",d),x!=="all"&&T.set("severity",x);const{data:D,loading:_}=Re(`/api/activity/stream?${T.toString()}`),A=y.useCallback(U=>{j(P=>[U,...P].slice(0,50))},[]);if(Oe("activity",A),_)return l.jsx(et,{});const b=[...m,...D||[]],w=new Set,C=[];for(const U of b){const P=`${U.timestamp}:${U.title}`;w.has(P)||(w.add(P),C.push(U))}const O=C.filter(U=>!(d!=="all"&&U.category!==d||x!=="all"&&U.severity!==x)),F=C.filter(U=>U.severity==="error").length,X=C.filter(U=>U.severity==="warning").length,ee=new Set(C.map(U=>U.source)),W=U=>{v(P=>P===U?null:U)},J=()=>{h(U=>U+200)};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Activity Stream"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-400 pulse-dot"}),l.jsx("span",{className:"text-xs text-gray-500",children:"Live"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Total Events",value:C.length,color:"indigo"}),l.jsx(ce,{title:"Errors",value:F,color:"rose"}),l.jsx(ce,{title:"Warnings",value:X,color:"amber"}),l.jsx(ce,{title:"Sources",value:ee.size,color:"cyan"})]}),l.jsxs("div",{className:"flex flex-wrap gap-4",children:[l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:mv.map(U=>l.jsx("button",{onClick:()=>u(U.value),className:`px-3 py-1 text-xs rounded-md transition-colors ${d===U.value?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:U.label},U.value))}),l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:hv.map(U=>l.jsx("button",{onClick:()=>c(U.value),className:`px-3 py-1 text-xs rounded-md transition-colors ${x===U.value?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:U.label},U.value))}),l.jsxs("span",{className:"text-xs text-gray-500 self-center",children:[O.length," events"]})]}),l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl divide-y divide-gray-800/50",children:O.length===0?l.jsxs("div",{className:"p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No events match filters"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"Try adjusting category or severity filters"})]}):l.jsxs(l.Fragment,{children:[O.slice(0,p).map((U,P)=>{const I=`${U.timestamp}-${P}`,re=N===I;return l.jsx(pv,{event:U,isExpanded:re,onToggle:()=>W(I)},I)}),O.length>=p&&l.jsx("div",{className:"p-4 text-center",children:l.jsx("button",{onClick:J,className:"px-4 py-2 text-xs text-indigo-400 hover:text-indigo-300 border border-indigo-500/30 rounded-lg transition-colors",children:"Load more events"})})]})})]})}function pv({event:r,isExpanded:u,onToggle:o}){const c=r.severity==="error"?"bg-rose-400":r.severity==="warning"?"bg-amber-400":"bg-gray-600",d={command:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z",hook:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101",notification:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9",cost:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1",sync:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581"},x=r.detail||r.metadata&&Object.keys(r.metadata).length>0;return l.jsxs("div",{children:[l.jsxs("div",{className:`px-4 py-3 flex items-start gap-3 transition-colors ${x?"cursor-pointer hover:bg-gray-800/20":""}`,onClick:x?o:void 0,children:[l.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-2 flex-shrink-0 ${c}`}),l.jsx("div",{className:"w-5 h-5 flex-shrink-0 mt-0.5 text-gray-500",children:l.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:d[r.category]||d.command})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-gray-300",children:r.title}),l.jsx(ue,{label:r.category,variant:zr(r.severity)})]}),r.detail&&!u&&l.jsx("p",{className:"text-xs text-gray-500 mt-0.5 truncate",children:r.detail}),r.source&&l.jsxs("span",{className:"text-[10px] text-gray-600 mt-0.5 block",children:["via ",r.source]})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.timestamp&&l.jsx("span",{className:"text-[10px] text-gray-600 whitespace-nowrap",children:yv(r.timestamp)}),x&&l.jsx("svg",{className:`w-4 h-4 text-gray-600 transition-transform duration-200 ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),u&&l.jsxs("div",{className:"px-4 pb-3 ml-10 space-y-2",children:[r.detail&&l.jsxs("div",{className:"bg-gray-800/50 rounded p-3",children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase block mb-1",children:"Detail"}),l.jsx("p",{className:"text-xs text-gray-300 whitespace-pre-wrap",children:r.detail})]}),r.metadata&&Object.keys(r.metadata).length>0&&l.jsxs("div",{className:"bg-gray-800/50 rounded p-3",children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase block mb-1",children:"Metadata"}),l.jsx("pre",{className:"text-xs text-gray-400 font-mono whitespace-pre-wrap overflow-x-auto",children:JSON.stringify(r.metadata,null,2)})]})]})]})}function yv(r){if(!r)return"-";const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}function vv(){const[r,u]=y.useState(0);Oe("config-changed",()=>u(J=>J+1));const{data:o,loading:c,error:d,refetch:x}=Re(`/api/config?_r=${r}`),{activeProject:m}=ha(),[j,p]=y.useState(new Set),[h,N]=y.useState({}),[v,T]=y.useState(!1),[D,_]=y.useState(null),[A,b]=y.useState([]);if(c)return l.jsx(et,{});if(d)return l.jsx(Gt,{message:d,onRetry:x});if(!o)return null;const w=J=>{p(U=>{const P=new Set(U);return P.has(J)?P.delete(J):P.add(J),P})},C=Object.keys(h).length>0,O=(J,U)=>{N(P=>({...P,[J]:U})),b(P=>P.filter(I=>I.path!==J))},F=async()=>{if(C){T(!0),_(null),b([]);try{const J={};for(const[Ce,q]of Object.entries(h))jv(J,Ce,q);const U=m?`?project=${m.id}`:"",I=await(await fetch(`/api/config/validate${U}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})).json();if(I.errors&&I.errors.length>0){b(I.errors),_("Validation failed. Fix errors before saving."),T(!1);return}const Ee=await(await fetch(`/api/config${U}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})).json();Ee.ok?(_("Saved successfully"),N({}),b([]),x(),setTimeout(()=>_(null),3e3)):_(`Error: ${Ee.error}`)}catch(J){_(`Error: ${J}`)}finally{T(!1)}}},X=()=>{N({}),_(null),b([])},ee=Object.entries(o).filter(([J,U])=>typeof U=="object"&&U!==null),W=Object.entries(o).filter(([J,U])=>typeof U!="object"||U===null);return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Configuration"}),l.jsx("span",{className:"text-xs text-gray-500",children:".specweave/config.json"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[D&&l.jsx("span",{className:`text-xs ${D.startsWith("Error")||D.startsWith("Validation")?"text-rose-400":"text-emerald-400"}`,children:D}),C&&l.jsxs(l.Fragment,{children:[l.jsx(ue,{label:`${Object.keys(h).length} changes`,variant:"warning"}),l.jsx("button",{onClick:X,className:"px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200 border border-gray-700 rounded-lg transition-colors",children:"Discard"}),l.jsx("button",{onClick:F,disabled:v,className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:v?"Saving...":"Save Changes"})]})]})]}),D&&!C&&D==="Saved successfully"&&l.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg px-4 py-2 flex items-center gap-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-400"}),l.jsx("span",{className:"text-xs text-emerald-400",children:"Configuration saved successfully"})]}),A.length>0&&l.jsxs("div",{className:"bg-rose-500/10 border border-rose-500/30 rounded-lg px-4 py-3 space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-rose-400"}),l.jsx("span",{className:"text-xs text-rose-400 font-medium",children:"Validation errors"})]}),A.map((J,U)=>l.jsxs("div",{className:"text-xs text-rose-300 pl-4",children:[l.jsx("span",{className:"font-mono text-rose-400",children:J.path}),": ",J.message]},U))]}),W.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-3",children:"General"}),l.jsx("div",{className:"space-y-3",children:W.map(([J,U])=>l.jsx(Fx,{path:J,label:J,value:h[J]!==void 0?h[J]:U,original:U,onChange:P=>O(J,P),edited:h[J]!==void 0,validationError:A.find(P=>P.path===J)?.message},J))})]}),ee.map(([J,U])=>l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("button",{onClick:()=>w(J),className:"w-full px-5 py-3 flex items-center justify-between hover:bg-gray-800/30 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 capitalize",children:J}),xx(h,J)>0&&l.jsx(ue,{label:`${xx(h,J)} edited`,variant:"warning"}),A.some(P=>P.path.startsWith(J+"."))&&l.jsx(ue,{label:"errors",variant:"error"})]}),l.jsx("svg",{className:`w-4 h-4 text-gray-500 transition-transform duration-200 ${j.has(J)?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),j.has(J)&&l.jsx("div",{className:"px-5 py-3 border-t border-gray-800",children:l.jsx(Wx,{data:U,path:J,edits:h,onChange:O,validationErrors:A,depth:0})})]},J))]})}function Wx({data:r,path:u,edits:o,onChange:c,validationErrors:d,depth:x}){return x>4?l.jsx("span",{className:"text-xs text-gray-600",children:"..."}):l.jsx("div",{className:"space-y-3",style:{marginLeft:x>0?16:0},children:Object.entries(r).map(([m,j])=>{const p=`${u}.${m}`;return j&&typeof j=="object"&&!Array.isArray(j)?l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-gray-400 font-mono font-medium",children:m}),l.jsx(Wx,{data:j,path:p,edits:o,onChange:c,validationErrors:d,depth:x+1})]},m):l.jsx(Fx,{path:p,label:m,value:o[p]!==void 0?o[p]:j,original:j,onChange:h=>c(p,h),edited:o[p]!==void 0,validationError:d.find(h=>h.path===p)?.message},m)})})}function Fx({path:r,label:u,value:o,original:c,onChange:d,edited:x,validationError:m}){return typeof c=="boolean"||typeof o=="boolean"?l.jsxs("div",{className:"py-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:u}),l.jsx("button",{onClick:()=>d(!o),className:`relative w-9 h-5 rounded-full transition-colors ${o?"bg-indigo-600":"bg-gray-700"} ${x?"ring-1 ring-amber-500/50":""}`,children:l.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform ${o?"left-[18px]":"left-0.5"}`})})]}),m&&l.jsx("p",{className:"text-[10px] text-rose-400 mt-0.5",children:m})]}):typeof c=="number"||typeof o=="number"?l.jsxs("div",{className:"py-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:u}),l.jsx("input",{type:"number",value:String(o??""),onChange:j=>d(j.target.value?Number(j.target.value):0),className:`bg-gray-800 border text-xs text-amber-400 font-mono rounded px-2 py-1 w-24 text-right ${m?"border-rose-500":x?"border-amber-500/50":"border-gray-700"} focus:ring-indigo-500 focus:border-indigo-500`})]}),m&&l.jsx("p",{className:"text-[10px] text-rose-400 mt-0.5 text-right",children:m})]}):Array.isArray(c)||Array.isArray(o)?l.jsx(bv,{path:r,label:u,value:Array.isArray(o)?o:Array.isArray(c)?c:[],edited:x,onChange:d,validationError:m}):l.jsxs("div",{className:"py-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:u}),l.jsx("input",{type:"text",value:String(o??""),onChange:j=>d(j.target.value),className:`bg-gray-800 border text-xs text-gray-300 rounded px-2 py-1 w-48 text-right ${m?"border-rose-500":x?"border-amber-500/50":"border-gray-700"} focus:ring-indigo-500 focus:border-indigo-500`})]}),m&&l.jsx("p",{className:"text-[10px] text-rose-400 mt-0.5 text-right",children:m})]})}function bv({path:r,label:u,value:o,edited:c,onChange:d,validationError:x}){const[m,j]=y.useState(!1),[p,h]=y.useState(""),N=D=>{const _=[...o];_.splice(D,1),d(_)},v=()=>{const D=p.trim();D&&(d([...o,D]),h(""))},T=D=>{D.key==="Enter"&&(D.preventDefault(),v())};return l.jsxs("div",{className:"py-1",children:[l.jsxs("button",{onClick:()=>j(D=>!D),className:"flex items-center justify-between w-full group",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:u}),l.jsxs("div",{className:"flex items-center gap-2",children:[c&&l.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"}),l.jsxs("span",{className:"text-xs text-gray-400 font-mono",children:["[",o.length," items]"]}),l.jsx("svg",{className:`w-3 h-3 text-gray-500 transition-transform duration-200 ${m?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),m&&l.jsxs("div",{className:"mt-2 ml-4 space-y-1",children:[o.length===0&&l.jsx("p",{className:"text-[10px] text-gray-600",children:"No items"}),o.map((D,_)=>l.jsxs("div",{className:"flex items-center gap-2 group/item",children:[l.jsx("span",{className:"text-xs text-gray-300 font-mono flex-1 truncate",children:String(D)}),l.jsx("button",{onClick:()=>N(_),className:"text-[10px] text-gray-600 hover:text-rose-400 opacity-0 group-hover/item:opacity-100 transition-opacity",children:"remove"})]},_)),l.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[l.jsx("input",{type:"text",value:p,onChange:D=>h(D.target.value),onKeyDown:T,placeholder:"Add item...",className:"bg-gray-800 border border-gray-700 text-xs text-gray-300 rounded px-2 py-1 flex-1 focus:ring-indigo-500 focus:border-indigo-500"}),l.jsx("button",{onClick:v,disabled:!p.trim(),className:"px-2 py-1 text-[10px] text-indigo-400 hover:text-indigo-300 border border-indigo-500/30 rounded disabled:opacity-50 transition-colors",children:"Add"})]})]}),x&&l.jsx("p",{className:"text-[10px] text-rose-400 mt-0.5",children:x})]})}function xx(r,u){return Object.keys(r).filter(o=>o.startsWith(u+".")).length}function jv(r,u,o){const c=u.split(".");let d=r;for(let x=0;x<c.length-1;x++)(!d[c[x]]||typeof d[c[x]]!="object")&&(d[c[x]]={}),d=d[c[x]];d[c[c.length-1]]=o}function _o({lines:r,status:u,onDismiss:o}){const c=y.useRef(null);return y.useEffect(()=>{c.current?.scrollIntoView({behavior:"smooth"})},[r]),r.length===0&&u==="idle"?null:l.jsxs("div",{className:"mt-4 rounded-lg bg-gray-950 border border-gray-700 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-900 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${u==="running"?"bg-yellow-400 animate-pulse":u==="success"?"bg-green-400":u==="error"?"bg-red-400":"bg-gray-500"}`}),l.jsx("span",{className:"text-xs text-gray-400 font-mono",children:u==="running"?"Running...":u==="success"?"Completed":u==="error"?"Failed":"Output"})]}),u!=="running"&&o&&l.jsx("button",{onClick:o,className:"text-gray-500 hover:text-gray-300 text-xs",children:"Dismiss"})]}),l.jsxs("div",{className:"p-3 max-h-48 overflow-y-auto font-mono text-xs text-gray-300 whitespace-pre-wrap",children:[r.map((d,x)=>l.jsx("div",{children:d},x)),l.jsx("div",{ref:c})]})]})}function Nv(){const{data:r,loading:u}=Re("/api/plugins/full"),{execute:o,running:c,output:d,status:x,reset:m}=Lr(),[j,p]=y.useState(null);if(u)return l.jsx(et,{});const h=r?.plugins||[],N=r?.skills||[],v=r?.lsp,T=r?.warmup,D=r?.triggerCount||0,_=h.reduce((C,O)=>C+O.skillCount,0),A=h.reduce((C,O)=>C+O.commandCount,0),b=C=>N.filter(O=>O.plugin===C).sort((O,F)=>F.count-O.count),w=C=>{p(O=>O===C?null:C)};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Plugins & LSP"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>o("lsp-status"),disabled:c,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:"Check LSP"}),l.jsx("button",{onClick:()=>o("refresh-plugins"),disabled:c,className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:c?"Running...":"Refresh Plugins"})]})]}),l.jsx(_o,{lines:d,status:x,onDismiss:m}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[l.jsx(qa,{label:"Plugins",value:h.length}),l.jsx(qa,{label:"Total Skills",value:_}),l.jsx(qa,{label:"Total Commands",value:A}),l.jsx(qa,{label:"Trigger Keywords",value:D})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Installed Plugins"})}),h.length===0?l.jsx("div",{className:"p-5 text-gray-500 text-xs",children:"No plugins installed"}):l.jsx("div",{className:"divide-y divide-gray-800/50",children:h.map(C=>{const O=j===C.name,F=b(C.name);return l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>w(C.name),className:"w-full px-4 py-3 flex items-center justify-between hover:bg-gray-800/30 transition-colors text-left",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("span",{className:"text-sm text-gray-300",children:C.name}),l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:C.version})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ue,{label:`${C.skillCount} skills`,variant:"info"}),l.jsx(ue,{label:`${C.commandCount} cmds`,variant:"default"}),l.jsx("svg",{className:`w-4 h-4 text-gray-500 transition-transform duration-200 ${O?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),O&&l.jsx("div",{className:"px-4 pb-4 bg-gray-800/20",children:F.length===0?l.jsx("p",{className:"text-xs text-gray-600 py-2",children:"No skill usage data for this plugin"}):l.jsxs("div",{className:"space-y-1 mt-1",children:[l.jsxs("div",{className:"grid grid-cols-[1fr,80px,80px,120px] gap-2 px-2 py-1",children:[l.jsx("span",{className:"text-[10px] text-gray-600 uppercase",children:"Skill"}),l.jsx("span",{className:"text-[10px] text-gray-600 uppercase text-right",children:"Invocations"}),l.jsx("span",{className:"text-[10px] text-gray-600 uppercase text-right",children:"Success"}),l.jsx("span",{className:"text-[10px] text-gray-600 uppercase text-right",children:"Last Used"})]}),F.map(X=>l.jsxs("div",{className:"grid grid-cols-[1fr,80px,80px,120px] gap-2 px-2 py-1.5 bg-gray-800/40 rounded",children:[l.jsx("span",{className:"text-xs text-gray-300 font-mono truncate",children:X.name}),l.jsx("span",{className:"text-xs text-gray-400 text-right font-mono",children:X.count}),l.jsxs("span",{className:"text-xs text-right font-mono",children:[l.jsx("span",{className:"text-emerald-400",children:X.successCount}),X.failureCount>0&&l.jsxs("span",{className:"text-rose-400",children:["/",X.failureCount]})]}),l.jsx("span",{className:"text-[10px] text-gray-500 text-right",children:X.lastUsed?Sv(X.lastUsed):"-"})]},X.name))]})})]},C.name)})})]}),N.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Skill Usage Leaderboard"}),l.jsx(Vx,{items:N.sort((C,O)=>O.count-C.count).slice(0,20).map(C=>({label:C.name,value:C.count,color:"#10b981"})),maxBars:20})]}),v&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"LSP Status"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{label:v.status,variant:v.status==="ok"?"success":"warning"}),v.checked&&l.jsxs("span",{className:"text-[10px] text-gray-600",children:["Checked: ",new Date(v.checked).toLocaleDateString()]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-4",children:[l.jsx(qa,{label:"Total Languages",value:v.stats.totalLanguages}),l.jsx(qa,{label:"Checked",value:v.stats.checkedLanguages}),l.jsx(qa,{label:"Binary Missing",value:v.stats.binaryMissing}),l.jsx(qa,{label:"Plugin Missing",value:v.stats.pluginMissing})]}),v.missing.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-xs text-gray-500",children:"Missing Languages"}),v.missing.map((C,O)=>l.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-800/50 rounded",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{label:C.type,variant:C.type==="binary"?"warning":"default"}),l.jsx("span",{className:"text-xs text-gray-300",children:C.language})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"text-[10px] text-gray-500",children:C.binaryInstall}),C.message&&l.jsx("span",{className:"text-[10px] text-gray-600 max-w-[200px] truncate",children:C.message})]})]},O))]})]}),T&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"LSP Warmup Status"}),l.jsxs("span",{className:"text-[10px] text-gray-600",children:[T.elapsed?`${(T.elapsed/1e3).toFixed(1)}s`:""," |"," ",T.timestamp?new Date(T.timestamp).toLocaleString():""]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[T.warmedUp.map(C=>l.jsx(ue,{label:C,variant:"success"},C)),T.failed.map(C=>l.jsx(ue,{label:C,variant:"error"},C))]}),T.warmedUp.length===0&&T.failed.length===0&&l.jsx("p",{className:"text-gray-600 text-xs",children:"No warmup data"})]})]})}function qa({label:r,value:u}){return l.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-3 text-center",children:[l.jsx("div",{className:"text-lg font-bold text-gray-300",children:u}),l.jsx("div",{className:"text-[10px] text-gray-500",children:r})]})}function Sv(r){if(!r)return"-";const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}function wv(){const{data:r,loading:u}=Re("/api/links"),{data:o,loading:c,refetch:d}=Re("/api/services"),{execute:x,running:m,output:j,status:p,reset:h}=Lr();if(u||c)return l.jsx(et,{});const N=(o||[]).filter(b=>b.status==="running").length,v=(o||[]).length,T=new Map;for(const b of o||[])if(b.port>0&&b.status==="running"){const w=T.get(b.port)||[];w.push(b.name),T.set(b.port,w)}const D=Array.from(T.entries()).filter(([,b])=>b.length>1),_=async b=>{await x(b,{timeoutMs:3e5}),setTimeout(()=>d(),3e3)},A=async b=>{await x(b,{timeoutMs:3e5}),setTimeout(()=>d(),2e3)};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Services & Links"}),l.jsx(_o,{lines:j,status:p,onDismiss:h}),D.length>0&&l.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-xl p-4 flex items-start gap-3",children:[l.jsx("svg",{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium text-amber-300",children:"Port Conflict Detected"}),l.jsx("div",{className:"text-xs text-amber-400/80 mt-1",children:D.map(([b,w])=>l.jsxs("span",{className:"block",children:["Port ",b," is used by: ",w.join(", ")]},b))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Services",value:v,color:"indigo",tooltip:`${v} managed services`}),l.jsx(ce,{title:"Running",value:N,color:"emerald",tooltip:`${N} services currently active`}),l.jsx(ce,{title:"External Links",value:(r||[]).length,color:"cyan",tooltip:"Configured external links (docs, repos, etc.)"}),l.jsx(ce,{title:"Stopped",value:v-N,color:"rose",tooltip:`${v-N} services not running`})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"Service Status"}),l.jsx("div",{className:"space-y-3",children:(o||[]).map((b,w)=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-800/50 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${b.status==="running"?"bg-emerald-400":"bg-gray-600"}`}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-300",children:b.name}),l.jsx("div",{className:"text-[10px] text-gray-600",children:b.status==="running"&&b.detail?l.jsx("a",{href:b.detail,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline transition-colors",children:b.detail}):b.detail})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[b.status==="running"&&b.port>0&&l.jsx(ue,{label:`Port ${b.port}`,variant:"info"}),b.status==="running"?l.jsx(ue,{label:"Running",variant:"success"}):l.jsx(ue,{label:"Stopped",variant:"default"}),b.startCommand&&b.stopCommand?b.status==="running"?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("a",{href:b.detail,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 text-[10px] text-indigo-400 hover:text-indigo-300 border border-indigo-500/30 rounded transition-colors",children:"Open"}),l.jsx("button",{onClick:()=>A(b.stopCommand),disabled:m,className:"px-2 py-1 text-[10px] text-rose-400 hover:text-rose-300 border border-rose-500/30 rounded transition-colors disabled:opacity-50",children:"Stop"})]}):l.jsx("button",{onClick:()=>_(b.startCommand),disabled:m,className:"px-2 py-1 text-[10px] text-emerald-400 hover:text-emerald-300 border border-emerald-500/30 rounded transition-colors disabled:opacity-50",children:m?"Starting...":"Start"}):b.status==="running"&&l.jsx("a",{href:b.detail,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 text-[10px] text-indigo-400 hover:text-indigo-300 border border-indigo-500/30 rounded transition-colors",children:"Open"})]})]},w))})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-4",children:"External Links"}),(r||[]).length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No external links configured"}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:(r||[]).map((b,w)=>l.jsxs("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800 transition-colors group",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Ev,{type:b.type}),l.jsxs("div",{children:[l.jsx("div",{className:"text-sm text-gray-300 transition-colors",children:b.name}),l.jsx("div",{className:"text-[10px] text-gray-600 truncate max-w-[200px]",children:b.url})]})]}),l.jsx("svg",{className:"w-4 h-4 text-gray-600 group-hover:text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]},w))})]})]})}function Ev({type:r}){const u={docs:"bg-indigo-600",github:"bg-indigo-600",jira:"bg-blue-700",ado:"bg-blue-600"};return l.jsx("div",{className:`w-8 h-8 rounded-lg ${u[r]||"bg-indigo-600"} flex items-center justify-center`,children:l.jsx("span",{className:"text-xs text-white font-bold",children:r[0]?.toUpperCase()})})}const mx={critical:0,warning:1,info:2};function Cv(){const[r,u]=y.useState("pending"),[o,c]=y.useState(null),[d,x]=y.useState(0);Oe("notification",()=>x(U=>U+1));const{activeProject:m}=ha(),{data:j,loading:p,error:h,refetch:N}=Re(`/api/notifications?_r=${d}`);if(p)return l.jsx(et,{});if(h)return l.jsx(Gt,{message:h,onRetry:N});const v=j||[],T=v.filter(U=>!U.dismissedAt),D=v.filter(U=>!!U.dismissedAt),_=T.filter(U=>U.severity==="critical"),A=T.filter(U=>U.severity==="warning"),w=[...r==="pending"?T:r==="dismissed"?D:v].sort((U,P)=>{const I=mx[U.severity]??3,re=mx[P.severity]??3;return I!==re?I-re:new Date(P.createdAt).getTime()-new Date(U.createdAt).getTime()}),C=async U=>{c(U);try{const P=m?`?project=${m.id}`:"";(await fetch(`/api/notifications/${U}/dismiss${P}`,{method:"POST"})).ok&&N()}finally{c(null)}},O=async()=>{c("__all__");try{const U=m?`?project=${m.id}`:"";for(const P of T)await fetch(`/api/notifications/${P.id}/dismiss${U}`,{method:"POST"});N()}finally{c(null)}},F=U=>U==="critical"?"error":U==="warning"?"warning":"info",X=U=>U==="critical"?"border-l-rose-500":U==="warning"?"border-l-amber-500":"border-l-blue-500",W=(U=>{const P={};for(const I of U)P[I.severity]||(P[I.severity]=[]),P[I.severity].push(I);return P})(w),J={critical:"Critical",warning:"Warnings",info:"Informational"};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Notifications"}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Pending",value:T.length,color:"indigo"}),l.jsx(ce,{title:"Critical",value:_.length,color:"rose"}),l.jsx(ce,{title:"Warnings",value:A.length,color:"amber"}),l.jsx(ce,{title:"Dismissed",value:D.length,color:"cyan"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"flex gap-1 bg-gray-900/50 border border-gray-800 rounded-lg p-1",children:[{value:"pending",label:`Pending (${T.length})`},{value:"dismissed",label:`Dismissed (${D.length})`},{value:"all",label:`All (${v.length})`}].map(U=>l.jsx("button",{onClick:()=>u(U.value),className:`px-3 py-1.5 text-xs rounded-md transition-colors ${r===U.value?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300"}`,children:U.label},U.value))}),T.length>0&&l.jsx("button",{onClick:O,disabled:o==="__all__",className:"px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200 border border-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o==="__all__"?"Dismissing...":"Dismiss All"})]}),w.length===0?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-800 flex items-center justify-center mx-auto mb-4",children:l.jsx("svg",{className:"w-6 h-6 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})})}),l.jsx("p",{className:"text-gray-400 text-sm font-medium",children:r==="pending"?"No pending notifications":"No notifications"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1 max-w-xs mx-auto",children:"Notifications appear here when imports complete, discrepancies are found, or syncs fail"})]}):l.jsx("div",{className:"space-y-4",children:["critical","warning","info"].map(U=>{const P=W[U];return!P||P.length===0?null:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("h3",{className:"text-xs font-medium text-gray-400 uppercase",children:J[U]||U}),l.jsxs("span",{className:"text-[10px] text-gray-600",children:["(",P.length,")"]})]}),l.jsx("div",{className:"space-y-2",children:P.map(I=>l.jsxs("div",{className:`bg-gray-900/50 border border-gray-800 border-l-4 ${X(I.severity)} rounded-xl p-4 flex items-start gap-4 ${I.dismissedAt?"opacity-60":""}`,children:[l.jsx(Tv,{severity:I.severity}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"text-sm font-medium text-gray-200",children:I.title}),l.jsx(ue,{label:I.severity,variant:F(I.severity)}),I.type&&l.jsx(ue,{label:I.type,variant:"default"})]}),I.message&&l.jsx("p",{className:"text-xs text-gray-400 mb-2",children:I.message}),l.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-gray-600",children:[l.jsx("span",{children:new Date(I.createdAt).toLocaleString()}),I.source&&l.jsxs("span",{children:["via ",I.source]}),I.dismissedAt&&l.jsxs("span",{children:["Dismissed ",new Date(I.dismissedAt).toLocaleString()]})]})]}),!I.dismissedAt&&l.jsx("button",{onClick:()=>C(I.id),disabled:o===I.id,className:"px-2 py-1 text-xs text-gray-500 hover:text-gray-300 hover:bg-gray-800 rounded transition-colors disabled:opacity-50 flex-shrink-0",children:o===I.id?"...":"Dismiss"})]},I.id))})]},U)})})]})}function Tv({severity:r}){return r==="critical"?l.jsx("div",{className:"w-8 h-8 rounded-full bg-rose-500/10 flex items-center justify-center flex-shrink-0",children:l.jsx("svg",{className:"w-4 h-4 text-rose-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"})})}):r==="warning"?l.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 flex items-center justify-center flex-shrink-0",children:l.jsx("svg",{className:"w-4 h-4 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}):l.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-500/10 flex items-center justify-center flex-shrink-0",children:l.jsx("svg",{className:"w-4 h-4 text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})})}function Av(r){if(!r)return null;if(r.startsWith("https://"))return r.replace(/\.git$/,"");const u=r.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(u)return`https://${u[1]}/${u[2]}`;const o=r.match(/^ssh:\/\/git@([^/]+)\/(.+?)(?:\.git)?$/);return o?`https://${o[1]}/${o[2]}`:null}function Rv(){const{data:r,loading:u,error:o,refetch:c}=Re("/api/repos");if(u)return l.jsx(et,{});if(o)return l.jsx(Gt,{message:o,onRetry:c});const d=r||[],x=[...new Set(d.map(p=>p.org))],m=d.filter(p=>p.hasSpecweave||p.isUmbrellaManaged).length,j=d.find(p=>p.isCurrent);return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Repositories"}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Repositories",value:d.length,color:"indigo"}),l.jsx(ce,{title:"Organizations",value:x.length,color:"cyan"}),l.jsx(ce,{title:"With SpecWeave",value:m,color:"emerald"}),l.jsx(ce,{title:"Current",value:j?j.name:"-",subtitle:j?`${j.org}/${j.name}`:"No current project",color:"amber"})]}),d.length===0?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No repositories found"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"This project doesn't use multi-repo mode, or the repositories/ directory hasn't been set up yet"})]}):l.jsx(l.Fragment,{children:x.map(p=>{const h=d.filter(N=>N.org===p);return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx(Mv,{}),l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:p}),l.jsxs("span",{className:"text-[10px] text-gray-600",children:[h.length," ",h.length===1?"repo":"repos"]})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:h.map(N=>{const v=Av(N.remote);return l.jsxs("div",{className:`bg-gray-900/50 border rounded-xl p-4 ${N.isCurrent?"border-indigo-500/30":"border-gray-800"}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Dv,{}),l.jsx("span",{className:"text-sm font-medium text-gray-300",children:N.name})]}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[N.isCurrent&&l.jsx(ue,{label:"Current Project",variant:"info"}),l.jsx(ue,{label:N.hasSpecweave?"SpecWeave":N.isUmbrellaManaged?"via umbrella":"No SpecWeave",variant:N.hasSpecweave?"success":N.isUmbrellaManaged?"info":"default"})]})]}),l.jsxs("div",{className:"space-y-1.5 mt-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Organization"}),l.jsx("span",{className:"text-[10px] text-gray-400",children:N.org})]}),N.branch&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Branch"}),l.jsx(ue,{label:N.branch,variant:"default"})]}),v&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Remote"}),l.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-indigo-400 hover:text-indigo-300 hover:underline truncate max-w-[180px]",title:v,children:v.replace("https://","")})]}),!v&&N.remote&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Remote"}),l.jsx("span",{className:"text-[10px] text-gray-600 font-mono truncate max-w-[180px]",title:N.remote,children:N.remote})]}),N.path&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Path"}),l.jsx("span",{className:"text-[10px] text-gray-600 font-mono truncate max-w-[180px]",title:N.path,children:N.path.split("/").slice(-3).join("/")})]}),N.lastModified&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Last Modified"}),l.jsx("span",{className:"text-[10px] text-gray-400",children:_v(N.lastModified)})]})]}),v&&l.jsxs("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"mt-3 flex items-center justify-center gap-1.5 text-xs text-gray-400 hover:text-gray-200 py-2 border border-gray-800 rounded-lg hover:border-gray-700 transition-colors",children:[l.jsx(kv,{}),"Open on GitHub"]})]},N.path||`${N.org}/${N.name}`)})})]},p)})})]})}function Mv(){return l.jsx("div",{className:"w-6 h-6 rounded bg-gray-700 flex items-center justify-center",children:l.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})})})}function Dv(){return l.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}function kv(){return l.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function _v(r){if(!r)return"-";try{const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}catch{return"-"}}const Ov=[{value:"",label:"All"},{value:"discovered",label:"Discovered"},{value:"scanning",label:"Scanning"},{value:"tier1_passed",label:"Passed"},{value:"tier1_failed",label:"Failed"},{value:"verified",label:"Verified"},{value:"rejected",label:"Rejected"}],xa=20;function zv(r){switch(r){case"discovered":return"default";case"queued":return"info";case"scanning":return"warning";case"tier1_passed":return"success";case"tier1_failed":return"error";case"tier2_pending":return"info";case"verified":return"success";case"rejected":return"error";default:return"default"}}function Lv(r){switch(r){case"discovered":return"Discovered";case"queued":return"Queued";case"scanning":return"Scanning";case"tier1_passed":return"T1 Passed";case"tier1_failed":return"T1 Failed";case"tier2_pending":return"T2 Pending";case"verified":return"Verified";case"rejected":return"Rejected";default:return r}}function hx(r){if(!r)return"-";try{const u=Date.now()-new Date(r).getTime(),o=Math.floor(u/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}catch{return"-"}}function Uv(r){return r>=80?"text-emerald-400":r>=50?"text-amber-400":"text-rose-400"}function Px(r){const u=r.tier1Result?.score??0,o=r.tier2Result?.score??0;return u&&o?Math.round((u+o)/2):u||o}function Hv(r){return r>=80?"bg-emerald-500":r>=50?"bg-amber-500":"bg-rose-500"}function Bv(r){return r>=80?"text-emerald-400":r>=50?"text-amber-400":"text-rose-400"}function $v(r){return r>=1e6?`${(r/1e6).toFixed(1)}m`:r>=1e3?`${(r/1e3).toFixed(1)}k`:String(r)}function gx(r){const u=Math.log10(Math.max(r.stars,1))*20,o=Px(r);return u+o}function qv(r,u){if(u===0)return"rose";const o=r/u;return o>.5?"emerald":o>.1?"amber":"rose"}function Yv(){const[r,u]=y.useState(""),[o,c]=y.useState(0),[d,x]=y.useState(0),[m,j]=y.useState(null),[p,h]=y.useState(""),{output:N,status:v,reset:T}=Lr(),D=r?`status=${r}&limit=${xa}&offset=${o}`:`limit=${xa}&offset=${o}`,{data:_,loading:A,error:b,refetch:w}=Re(`/api/marketplace/scanner/status?_r=${d}`),{data:C,loading:O,refetch:F}=Re(`/api/marketplace/queue?${D}&_r=${d}`),{data:X,loading:ee}=Re(`/api/marketplace/verified?_r=${d}`),{data:W,loading:J}=Re(`/api/marketplace/insights?_r=${d}`),U=y.useCallback(()=>{x(S=>S+1)},[]);Oe("submission-update",y.useCallback(()=>{U()},[U])),Oe("marketplace-scan",y.useCallback(()=>{U()},[U])),Oe("verification-complete",y.useCallback(()=>{U()},[U]));const P=async()=>{try{const S=new URLSearchParams(window.location.search).get("project")||"",$=S?`?project=${S}`:"";await fetch(`/api/marketplace/scanner/start${$}`,{method:"POST"}),w()}catch{}},I=async()=>{try{const S=new URLSearchParams(window.location.search).get("project")||"",$=S?`?project=${S}`:"";await fetch(`/api/marketplace/scanner/stop${$}`,{method:"POST"}),w()}catch{}},re=async S=>{j(S);try{const $=new URLSearchParams(window.location.search).get("project")||"",K=$?`?project=${$}`:"";await fetch(`/api/marketplace/queue/${S}/approve${K}`,{method:"POST"}),F()}catch{}j(null)},Ee=async S=>{j(S);try{const $=new URLSearchParams(window.location.search).get("project")||"",K=$?`?project=${$}`:"";await fetch(`/api/marketplace/queue/${S}/reject${K}`,{method:"POST"}),F()}catch{}j(null)};if(A&&O&&ee&&J)return l.jsx(et,{});const q=C?.items||[],R=C?.total||0,Q=X||[],ne=Math.floor(o/xa)+1,Z=Math.ceil(R/xa),xe=S=>S==="tier1_passed"||S==="tier2_pending";return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Marketplace Scanner"}),l.jsx("div",{className:"flex gap-2",children:_?.running?l.jsx("button",{onClick:I,className:"px-3 py-1.5 bg-rose-600 hover:bg-rose-500 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:"Stop Scanner"}):l.jsx("button",{onClick:P,className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white text-xs rounded-lg transition-colors",children:"Start Scanner"})})]}),l.jsx(_o,{lines:N,status:v,onDismiss:T}),b&&l.jsx(Gt,{message:b,onRetry:w}),_?l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Scanner",value:_.running?"Running":"Stopped",subtitle:_.running?"Active":"Idle",color:_.running?"emerald":"amber"}),l.jsx(ce,{title:"Last Scan",value:_.lastScanTime?hx(_.lastScanTime):"Never",color:"cyan"}),l.jsx(ce,{title:"Repos Scanned",value:_.reposScanned,color:"indigo"}),l.jsx(ce,{title:"Rate Limit",value:_.rateLimitRemaining!=null&&_.rateLimitTotal!=null?`${_.rateLimitRemaining}/${_.rateLimitTotal}`:"No token",subtitle:_.rateLimitRemaining!=null&&_.rateLimitTotal!=null&&_.rateLimitTotal>0?`${Math.round(_.rateLimitRemaining/_.rateLimitTotal*100)}% remaining`:"Set GITHUB_TOKEN in environment",color:_.rateLimitRemaining!=null&&_.rateLimitTotal!=null?qv(_.rateLimitRemaining,_.rateLimitTotal):"amber"})]}):!A&&!b?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("div",{className:"text-gray-400 text-sm mb-2",children:"No scanner data available"}),l.jsx("p",{className:"text-gray-600 text-xs mb-4",children:"Start the marketplace scanner to discover and verify community skills."}),l.jsx("button",{onClick:P,className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm rounded-lg transition-colors",children:"Start Scanner"})]}):null,l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 border-b border-gray-800 flex items-center justify-between",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Submission Queue"}),l.jsxs("span",{className:"text-xs text-gray-500",children:[R," total"]})]}),l.jsx("div",{className:"flex gap-1 px-4 pt-3 pb-2 overflow-x-auto",children:Ov.map(S=>l.jsx("button",{onClick:()=>{u(S.value),c(0)},className:`px-3 py-1.5 text-xs rounded-md transition-colors whitespace-nowrap ${r===S.value?"bg-gray-700 text-white":"text-gray-400 hover:text-gray-300 hover:bg-gray-800"}`,children:S.label},S.value))}),O?l.jsx("div",{className:"p-8 flex justify-center",children:l.jsx(et,{})}):q.length===0?l.jsxs("div",{className:"p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No submissions found"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:r?"Try a different filter.":"Submissions will appear here once the scanner discovers repos."})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Repo"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Author"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Stars"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Status"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Tier"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Security"}),l.jsx("th",{className:"text-left px-4 py-2 text-xs text-gray-500",children:"Discovered"}),l.jsx("th",{className:"text-right px-4 py-2 text-xs text-gray-500",children:"Actions"})]})}),l.jsx("tbody",{children:q.map(S=>l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsx("td",{className:"px-4 py-2",children:S.repoUrl?l.jsx("a",{href:S.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-400 hover:text-indigo-300 font-mono",children:S.repoFullName}):l.jsx("span",{className:"text-xs text-gray-300 font-mono",children:S.repoFullName})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400",children:S.author}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400 text-right font-mono",children:S.stars.toLocaleString()}),l.jsx("td",{className:"px-4 py-2",children:l.jsx(ue,{label:Lv(S.status),variant:zv(S.status)})}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-400",children:S.tier||"-"}),l.jsx("td",{className:`px-4 py-2 text-xs text-right font-mono ${Uv(S.securityScore)}`,children:S.securityScore!=null?S.securityScore:"-"}),l.jsx("td",{className:"px-4 py-2 text-xs text-gray-500",children:hx(S.discoveredAt)}),l.jsx("td",{className:"px-4 py-2 text-right",children:xe(S.status)&&l.jsxs("div",{className:"flex gap-1 justify-end",children:[l.jsx("button",{onClick:()=>re(S.id),disabled:m===S.id,className:"px-2 py-1 bg-emerald-600/20 hover:bg-emerald-600/40 text-emerald-400 text-[10px] rounded transition-colors disabled:opacity-50",children:"Approve"}),l.jsx("button",{onClick:()=>Ee(S.id),disabled:m===S.id,className:"px-2 py-1 bg-rose-600/20 hover:bg-rose-600/40 text-rose-400 text-[10px] rounded transition-colors disabled:opacity-50",children:"Reject"})]})})]},S.id))})]})}),R>xa&&l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-800",children:[l.jsxs("span",{className:"text-xs text-gray-500",children:[o+1,"-",Math.min(o+xa,R)," of ",R]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:()=>c(Math.max(0,o-xa)),disabled:o===0,className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-200 disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),l.jsxs("span",{className:"px-2 py-1 text-xs text-gray-500",children:["Page ",ne," of ",Z]}),l.jsx("button",{onClick:()=>c(o+xa),disabled:o+xa>=R,className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-200 disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 border-b border-gray-800 flex items-center justify-between gap-4",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 shrink-0",children:"Popular Skills"}),Q.length>0&&l.jsxs("div",{className:"relative max-w-xs w-full",children:[l.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),l.jsx("input",{type:"text",placeholder:"Discover popular skills...",value:p,onChange:S=>h(S.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-gray-800/50 border border-gray-700 rounded-lg text-xs text-gray-200 placeholder-gray-500 focus:outline-none focus:border-gray-600 transition-colors"})]})]}),ee?l.jsx("div",{className:"p-8 flex justify-center",children:l.jsx(et,{})}):Q.length===0?l.jsxs("div",{className:"p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No verified skills yet"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"Skills will appear here after passing security verification."})]}):l.jsx(Gv,{skills:Q,search:p})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Insights"})}),J?l.jsx("div",{className:"p-8 flex justify-center",children:l.jsx(et,{})}):W?l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Discovered",value:W.totalDiscovered,color:"cyan"}),l.jsx(ce,{title:"Verified",value:W.totalVerified,color:"emerald"}),l.jsx(ce,{title:"Rejected",value:W.totalRejected,color:"rose"}),l.jsx(ce,{title:"Pending",value:W.totalPending,color:"amber"})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsx(px,{label:"Tier 1 Pass Rate",rate:W.tier1PassRate}),l.jsx(px,{label:"Tier 2 Pass Rate",rate:W.tier2PassRate})]})]}):l.jsx("div",{className:"p-8 text-center",children:l.jsx("p",{className:"text-gray-500 text-sm",children:"No insights data available"})})]})]})}function Gv({skills:r,search:u}){const o=[...r].sort((x,m)=>gx(m)-gx(x)),c=new Set(o.slice(0,3).map(x=>x.id)),d=u?o.filter(x=>x.repoFullName.toLowerCase().includes(u.toLowerCase())||x.author.toLowerCase().includes(u.toLowerCase())):o;return d.length===0?l.jsx("div",{className:"p-8 text-center",children:l.jsxs("p",{className:"text-gray-500 text-sm",children:['No skills match "',u,'"']})}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4",children:d.map(x=>l.jsx(Vv,{skill:x,trending:c.has(x.id)},x.id))})}function Vv({skill:r,trending:u}){const o=Px(r),c=Hv(o),d=Bv(o);return l.jsxs("div",{className:"bg-gray-800/50 border border-gray-700/50 rounded-lg p-4 hover:border-gray-600 transition-colors",children:[l.jsxs("div",{className:"flex items-start justify-between mb-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[r.repoUrl?l.jsx("a",{href:r.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-200 hover:text-indigo-300 truncate block transition-colors",children:r.repoFullName.split("/").pop()}):l.jsx("div",{className:"text-sm font-medium text-gray-200 truncate",children:r.repoFullName.split("/").pop()}),l.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:r.author})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 ml-2",children:[u&&l.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-orange-500/15 text-orange-400 text-[10px] font-medium rounded",children:[l.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M12.395 2.553a1 1 0 00-1.45-.385c-.345.23-.614.558-.822.88-.214.33-.403.713-.57 1.116-.334.804-.614 1.768-.84 2.734a31.365 31.365 0 00-.613 3.58 2.64 2.64 0 01-.945-1.067c-.328-.68-.398-1.534-.398-2.654A1 1 0 005.05 6.05 6.981 6.981 0 003 11a7 7 0 1011.95-4.95c-.592-.591-.98-.985-1.348-1.467-.363-.476-.724-1.063-1.207-2.03zM12.12 15.12A3 3 0 017 13s.879.5 2.5.5c0-1 .5-4 1.25-4.5.5 1 .786 1.293 1.371 1.879A2.99 2.99 0 0113 13a2.99 2.99 0 01-.879 2.121z",clipRule:"evenodd"})}),"Hot"]}),l.jsx(ue,{label:"Verified",variant:"success"})]})]}),l.jsxs("div",{className:"mb-3",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"Trust"}),l.jsx("span",{className:`text-xs font-mono font-medium ${d}`,children:o})]}),l.jsx("div",{className:"w-full h-1.5 bg-gray-700 rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full ${c} rounded-full transition-all duration-500`,style:{width:`${o}%`}})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})}),$v(r.stars)]}),r.repoUrl&&l.jsx("a",{href:r.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-gray-500 hover:text-gray-300 transition-colors",children:"View on GitHub"})]})]})}function px({label:r,rate:u}){const o=Math.round(u),c=o>=70?"bg-emerald-500":o>=40?"bg-amber-500":"bg-rose-500";return l.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:"text-xs text-gray-400",children:r}),l.jsxs("span",{className:"text-sm font-bold text-gray-200",children:[o,"%"]})]}),l.jsx("div",{className:"w-full h-2 bg-gray-700 rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full ${c} rounded-full transition-all duration-500`,style:{width:`${o}%`}})})]})}function Qv(){const{id:r}=gp(),[u,o]=y.useState(0);Oe("increment-update",()=>o(h=>h+1));const{data:c,loading:d,error:x,refetch:m}=Re(`/api/increments/${r||"_none"}?_r=${u}`);if(!r)return l.jsx("div",{className:"p-6 text-gray-500 text-sm",children:"No increment ID specified"});if(d)return l.jsx(et,{});if(x)return l.jsx(Gt,{message:x,onRetry:m});if(!c)return l.jsx("div",{className:"p-6 text-gray-500 text-sm",children:"Increment not found"});const j=c.taskSummary.total>0?Math.round(c.taskSummary.completed/c.taskSummary.total*100):0,p=c.acSummary.total>0?Math.round(c.acSummary.completed/c.acSummary.total*100):0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[l.jsx("span",{className:"text-xs text-indigo-400 font-mono",children:c.dirName}),l.jsx(ue,{label:c.metadata.status||"unknown",variant:zr(c.metadata.status||"")}),c.metadata.type&&l.jsx("span",{className:"text-xs text-gray-400 capitalize",children:c.metadata.type}),c.metadata.priority&&l.jsx(Xv,{priority:c.metadata.priority})]}),l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:c.metadata.title||c.id}),c.metadata.project&&l.jsxs("span",{className:"text-xs text-gray-500",children:["Project: ",c.metadata.project]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Tasks",value:`${c.taskSummary.completed}/${c.taskSummary.total}`,color:"indigo"}),l.jsx(ce,{title:"Task Progress",value:`${j}%`,color:"cyan"}),l.jsx(ce,{title:"ACs",value:`${c.acSummary.completed}/${c.acSummary.total}`,color:"emerald"}),l.jsx(ce,{title:"AC Progress",value:`${p}%`,color:"amber"})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5 space-y-4",children:[l.jsx(yx,{label:"Tasks",completed:c.taskSummary.completed,total:c.taskSummary.total,color:"indigo"}),l.jsx(yx,{label:"Acceptance Criteria",completed:c.acSummary.completed,total:c.acSummary.total,color:"emerald"})]}),l.jsxs("section",{className:"work-evidence",children:[l.jsx("h3",{children:"Verification and specification"}),l.jsxs("p",{children:["Verification ",c.verification?.status||"missing",c.verification?.ranAt?` · ${c.verification.ranAt}`:""]}),l.jsxs("details",{className:"work-handoff",children:[l.jsx("summary",{children:"Read specification"}),l.jsx("pre",{children:c.spec||"No specification found."})]}),c.verify&&Object.keys(c.verify).length>0&&l.jsxs("details",{className:"work-handoff",children:[l.jsx("summary",{children:"Verification report"}),l.jsx("pre",{children:JSON.stringify(c.verify,null,2)})]}),c.handoff&&l.jsxs("details",{className:"work-handoff",children:[l.jsx("summary",{children:"Latest handoff"}),l.jsx("pre",{children:c.handoff})]}),l.jsxs("details",{className:"work-handoff",children:[l.jsx("summary",{children:"Task evidence"}),c.tasks.map(h=>l.jsxs("div",{className:"py-3",children:[l.jsxs("strong",{children:[h.id," · ",h.status]}),l.jsx("p",{children:h.actor||"Actor unknown"}),l.jsx("pre",{children:h.evidence||h.note||"No ledger evidence recorded."})]},h.id))]})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsxs("h3",{className:"text-sm font-medium text-gray-300",children:["Tasks (",c.tasks.length,")"]})}),c.tasks.length===0?l.jsx("div",{className:"p-5 text-center text-gray-500 text-xs",children:"No tasks found in tasks.md"}):l.jsx("div",{className:"divide-y divide-gray-800/50",children:c.tasks.map(h=>l.jsxs("div",{className:"px-5 py-3 flex items-center gap-3",children:[l.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${h.status==="completed"?"bg-indigo-500/20 border-indigo-500 text-indigo-400":"border-gray-600"}`,children:h.status==="completed"&&l.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:h.id}),l.jsx("span",{className:`text-sm ${h.status==="completed"?"text-gray-500 line-through":"text-gray-300"}`,children:h.title})]}),(h.userStory||h.acs)&&l.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[h.userStory&&l.jsx("span",{className:"text-[10px] text-indigo-400",children:h.userStory}),h.acs?.map(N=>l.jsx("span",{className:"text-[10px] text-emerald-500",children:N},N))]})]})]},h.id))})]}),c.acs.length>0&&l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:[l.jsx("div",{className:"px-5 py-3 border-b border-gray-800",children:l.jsxs("h3",{className:"text-sm font-medium text-gray-300",children:["Acceptance Criteria (",c.acs.length,")"]})}),l.jsx("div",{className:"divide-y divide-gray-800/50",children:c.acs.map(h=>l.jsxs("div",{className:"px-5 py-3 flex items-start gap-3",children:[l.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 mt-0.5 ${h.completed?"bg-emerald-500/20 border-emerald-500 text-emerald-400":"border-gray-600"}`,children:h.completed&&l.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-emerald-500 font-mono",children:h.id}),l.jsx("span",{className:`text-sm ml-2 ${h.completed?"text-gray-500 line-through":"text-gray-300"}`,children:h.text})]})]},h.id))})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-5",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-300 mb-3",children:"Metadata"}),l.jsx("div",{className:"space-y-1.5",children:Object.entries(c.metadata).filter(([h])=>!["title"].includes(h)).map(([h,N])=>l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-500 font-mono",children:h}),l.jsx("span",{className:"text-xs text-gray-400",children:typeof N=="object"?JSON.stringify(N):String(N??"")})]},h))})]})]})}function yx({label:r,completed:u,total:o,color:c}){const d=o>0?Math.round(u/o*100):0,x=c==="emerald"?"bg-emerald-500":"bg-indigo-500";return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[l.jsx("span",{className:"text-xs text-gray-400",children:r}),l.jsxs("span",{className:"text-xs text-gray-500",children:[u,"/",o," (",d,"%)"]})]}),l.jsx("div",{className:"w-full h-2 bg-gray-800 rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full ${x} rounded-full transition-all`,style:{width:`${d}%`}})})]})}function Xv({priority:r}){const u={P0:"text-rose-400 bg-rose-500/10",P1:"text-amber-400 bg-amber-500/10",P2:"text-cyan-400 bg-cyan-500/10",P3:"text-gray-400 bg-gray-500/10"};return l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${u[r]||u.P2}`,children:r})}const Zv=["All","PreToolUse","PostToolUse","Stop","SubagentStop","TaskCompleted","UserPromptSubmit","PostToolUseFailure","PermissionRequest","SessionStart","SessionEnd","Notification","SubagentStart","ConfigChange","PreCompact","TeammateIdle"],Kv=[{label:"All time",value:"0"},{label:"Last 1h",value:"3600000"},{label:"Last 6h",value:"21600000"},{label:"Last 24h",value:"86400000"}];function Jv(r){const u=Date.now()-new Date(r).getTime();return u<6e4?`${Math.floor(u/1e3)}s ago`:u<36e5?`${Math.floor(u/6e4)}m ago`:u<864e5?`${Math.floor(u/36e5)}h ago`:`${Math.floor(u/864e5)}d ago`}function Wv(r){const u=[];for(const o of r){const c=u[u.length-1];c&&c.type===o.eventName&&c.count<100?(c.count++,c.events.push(o)):u.push({type:o.eventName,count:1,events:[o],collapsed:!0})}return u}function Fv(){const{data:r,loading:u}=Re("/api/hooks/events?limit=200"),[o,c]=y.useState([]),[d,x]=zt("eventType","All"),[m,j]=zt("session",""),[p,h]=zt("range","0"),[N,v]=y.useState(null),[T,D]=y.useState(new Set);Oe("hook-event",w=>{const C=w;C.id&&c(O=>[C,...O].slice(0,50))});const _=y.useMemo(()=>{const w=r?.data??[],C=new Set(w.map(F=>F.id));return[...o.filter(F=>!C.has(F.id)),...w].sort((F,X)=>new Date(X.timestamp).getTime()-new Date(F.timestamp).getTime())},[r,o]),A=y.useMemo(()=>{let w=_;d!=="All"&&(w=w.filter(O=>O.eventName===d)),m&&(w=w.filter(O=>O.sessionId.includes(m)));const C=parseInt(p,10);if(C>0){const O=Date.now()-C;w=w.filter(F=>new Date(F.timestamp).getTime()>O)}return w},[_,d,m,p]),b=y.useMemo(()=>Wv(A),[A]);return u&&!r?l.jsx("div",{className:"p-6 text-center text-gray-500",children:"Loading hook events..."}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-semibold text-gray-100",children:"Hook Events"}),l.jsxs("span",{className:"text-sm text-gray-500",children:[A.length," events"]})]}),l.jsxs("div",{className:"flex gap-3 flex-wrap",children:[l.jsx("select",{value:d,onChange:w=>x(w.target.value),className:"bg-gray-800 border border-gray-700 text-gray-200 text-sm rounded px-3 py-1.5",children:Zv.map(w=>l.jsx("option",{value:w,children:w},w))}),l.jsx("input",{type:"text",placeholder:"Filter by session ID...",value:m,onChange:w=>j(w.target.value),className:"bg-gray-800 border border-gray-700 text-gray-200 text-sm rounded px-3 py-1.5 w-48"}),l.jsx("select",{value:p,onChange:w=>h(w.target.value),className:"bg-gray-800 border border-gray-700 text-gray-200 text-sm rounded px-3 py-1.5",children:Kv.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))})]}),l.jsxs("div",{className:"space-y-1",children:[b.map((w,C)=>{const O=T.has(C),F=w.count===1||O?w.events:[w.events[0]];return l.jsxs("div",{children:[w.count>1&&l.jsxs("button",{onClick:()=>{D(X=>{const ee=new Set(X);return ee.has(C)?ee.delete(C):ee.add(C),ee})},className:"w-full text-left px-3 py-1 text-xs text-gray-500 hover:text-gray-300 bg-gray-900 rounded",children:[O?"▾":"▸"," ",w.count,"× ",w.type]}),F.map(X=>{const ee=X.result?.decision==="deny"||X.result?.decision==="block";return l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>v(N===X.id?null:X.id),className:`w-full text-left flex items-center gap-3 px-3 py-2 rounded text-sm hover:bg-gray-800/50 ${ee?"bg-red-950/30 border border-red-900/40":""}`,children:[l.jsx("span",{className:"text-gray-500 text-xs font-mono w-16 shrink-0",children:Jv(X.timestamp)}),l.jsx(ue,{label:X.eventName,variant:ee?"error":"default"}),l.jsx("span",{className:"text-gray-400 text-xs truncate",children:X.sessionId.slice(0,12)}),X.durationMs!=null&&l.jsxs("span",{className:"text-gray-600 text-xs ml-auto",children:[X.durationMs,"ms"]})]}),N===X.id&&l.jsx("pre",{className:"mx-3 mb-2 p-3 bg-gray-900 rounded text-xs text-gray-400 overflow-x-auto max-h-64",children:JSON.stringify(X.payload,null,2)})]},X.id)})]},C)}),b.length===0&&l.jsx("div",{className:"text-center text-gray-600 py-8",children:"No hook events yet"})]})]})}function vx(r){return r<1e3?`${r}ms`:r<6e4?`${Math.floor(r/1e3)}s`:r<36e5?`${Math.floor(r/6e4)}m ${Math.floor(r%6e4/1e3)}s`:`${Math.floor(r/36e5)}h ${Math.floor(r%36e5/6e4)}m`}function Pv(){const{data:r,loading:u}=Re("/api/hooks/agents"),[o,c]=y.useState([]),[d,x]=zt("session",""),[,m]=y.useState(0);Oe("hook-agent",T=>{const D=T;D.agentId&&c(_=>{const A=_.findIndex(b=>b.agentId===D.agentId);if(A>=0){const b=[..._];return b[A]={...b[A],...D},b}return[D,..._]})});const j=y.useMemo(()=>{const T=r?.data??[],D=new Set(T.map(_=>_.agentId));return[...o.filter(_=>!D.has(_.agentId)),...T]},[r,o]),p=y.useMemo(()=>d?j.filter(T=>T.sessionId.includes(d)):j,[j,d]),h=y.useMemo(()=>{const T=new Set(j.map(D=>D.sessionId));return Array.from(T)},[j]),N=y.useMemo(()=>p.filter(T=>!T.stoppedAt).length,[p]);y.useEffect(()=>{if(N===0)return;const T=setInterval(()=>m(D=>D+1),1e3);return()=>clearInterval(T)},[N]);const v=y.useMemo(()=>{const T=p.filter(D=>D.durationMs!=null);return T.length===0?0:Math.round(T.reduce((D,_)=>D+(_.durationMs??0),0)/T.length)},[p]);return u&&!r?l.jsx("div",{className:"p-6 text-center text-gray-500",children:"Loading agents..."}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-semibold text-gray-100",children:"Agents"}),l.jsxs("div",{className:"flex gap-4 text-sm text-gray-400",children:[l.jsxs("span",{children:["Total: ",p.length]}),l.jsxs("span",{children:["Running: ",N]}),l.jsxs("span",{children:["Avg duration: ",vx(v)]})]})]}),l.jsx("div",{className:"flex gap-3",children:l.jsxs("select",{value:d,onChange:T=>x(T.target.value),className:"bg-gray-800 border border-gray-700 text-gray-200 text-sm rounded px-3 py-1.5",children:[l.jsx("option",{value:"",children:"All sessions"}),h.map(T=>l.jsx("option",{value:T,children:T.slice(0,20)},T))]})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-left text-gray-500 border-b border-gray-800",children:[l.jsx("th",{className:"py-2 px-3",children:"Agent ID"}),l.jsx("th",{className:"py-2 px-3",children:"Type"}),l.jsx("th",{className:"py-2 px-3",children:"Session"}),l.jsx("th",{className:"py-2 px-3",children:"Started"}),l.jsx("th",{className:"py-2 px-3",children:"Stopped"}),l.jsx("th",{className:"py-2 px-3",children:"Duration"}),l.jsx("th",{className:"py-2 px-3",children:"Status"})]})}),l.jsxs("tbody",{children:[p.map(T=>{const D=!T.stoppedAt,_=D?Date.now()-new Date(T.startedAt).getTime():T.durationMs??0;return l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30",children:[l.jsx("td",{className:"py-2 px-3 font-mono text-xs text-gray-300",children:T.agentId.slice(0,16)}),l.jsx("td",{className:"py-2 px-3 text-gray-300",children:T.agentType}),l.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:T.sessionId.slice(0,12)}),l.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:new Date(T.startedAt).toLocaleTimeString()}),l.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:T.stoppedAt?new Date(T.stoppedAt).toLocaleTimeString():"—"}),l.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:vx(_)}),l.jsx("td",{className:"py-2 px-3",children:l.jsx(ue,{label:D?"running":"stopped",variant:D?"success":"default"})})]},T.agentId)}),p.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"py-8 text-center text-gray-600",children:"No agents tracked yet"})})]})]})})]})}function Pn({value:r,onSave:u,placeholder:o}){const[c,d]=y.useState(!1),[x,m]=y.useState(r),j=y.useRef(null);y.useEffect(()=>{c&&(j.current?.focus(),j.current?.select())},[c]);const p=()=>{x!==r&&u(x),d(!1)},h=()=>{m(r),d(!1)};return c?l.jsx("input",{ref:j,value:x,onChange:N=>m(N.target.value),onKeyDown:N=>{N.key==="Enter"&&p(),N.key==="Escape"&&h()},onBlur:p,className:"bg-gray-800 border border-indigo-500/50 text-gray-200 text-xs rounded px-2 py-1 w-full focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:o}):l.jsx("span",{onClick:()=>{m(r),d(!0)},className:"text-xs text-gray-400 cursor-pointer hover:text-gray-200 hover:bg-gray-800/50 rounded px-1.5 py-0.5 transition-colors min-w-[60px] inline-block",title:"Click to edit",children:r||l.jsx("span",{className:"text-gray-600 italic",children:o||"Click to set"})})}function Zl(r,u){return r?u==="github"&&r.github?`${r.github.owner}/${r.github.repo}`:u==="jira"&&r.jira?r.jira.projectKey:u==="ado"&&r.ado?r.ado.project:"":""}function mo(r,u){if(r==="github"){const o=u.split("/");return o.length===2?{github:{owner:o[0],repo:o[1]}}:{github:{owner:"",repo:u}}}return r==="jira"?{jira:{projectKey:u}}:r==="ado"?{ado:{project:u}}:{}}function Iv({onClose:r,onSubmit:u}){const[o,c]=y.useState(""),[d,x]=y.useState(""),[m,j]=y.useState(""),[p,h]=y.useState(""),[N,v]=y.useState(""),T=y.useRef(null);y.useEffect(()=>{T.current?.focus()},[]);const D=_=>{if(_.preventDefault(),!o.trim()||!d.trim()||!m.trim()){v("ID, Path, and Prefix are required");return}u({id:o.trim(),path:d.trim(),prefix:m.trim(),name:p.trim()||void 0})};return l.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:r,children:l.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl p-6 w-full max-w-md shadow-2xl",onClick:_=>_.stopPropagation(),children:[l.jsx("h3",{className:"text-sm font-semibold text-gray-200 mb-4",children:"Add Repository"}),l.jsxs("form",{onSubmit:D,className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"ID *"}),l.jsx("input",{ref:T,value:o,onChange:_=>c(_.target.value),className:"w-full bg-gray-800 border border-gray-700 text-gray-200 text-xs rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"e.g., frontend-app"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"Path *"}),l.jsx("input",{value:d,onChange:_=>x(_.target.value),className:"w-full bg-gray-800 border border-gray-700 text-gray-200 text-xs rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"e.g., repositories/acme/frontend-app"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"Prefix *"}),l.jsx("input",{value:m,onChange:_=>j(_.target.value),className:"w-full bg-gray-800 border border-gray-700 text-gray-200 text-xs rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"e.g., FE"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"Display Name"}),l.jsx("input",{value:p,onChange:_=>h(_.target.value),className:"w-full bg-gray-800 border border-gray-700 text-gray-200 text-xs rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"e.g., Frontend App"})]}),N&&l.jsx("p",{className:"text-xs text-rose-400",children:N}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-400 hover:text-gray-200 px-3 py-1.5 border border-gray-700 rounded-lg transition-colors",children:"Cancel"}),l.jsx("button",{type:"submit",className:"text-xs text-white bg-indigo-600 hover:bg-indigo-500 px-4 py-1.5 rounded-lg transition-colors",children:"Add Repo"})]})]})]})})}function eb(){const{data:r,loading:u,error:o,refetch:c}=Re("/api/workspace"),{activeProject:d}=ha(),[x,m]=y.useState(!1),[j,p]=y.useState(null),h=d?.id?`?project=${d.id}`:"",N=y.useCallback(async(w,C)=>{try{p(null);const O=await fetch(`/api/workspace/repos/${encodeURIComponent(w)}${h}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(!O.ok){const F=await O.json();p(F.error||`Failed to update ${w}`);return}c()}catch(O){p(O.message)}},[h,c]),v=y.useCallback(async w=>{try{p(null);const C=await fetch(`/api/workspace/repos${h}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!C.ok){const O=await C.json();p(O.error||"Failed to add repo");return}m(!1),c()}catch(C){p(C.message)}},[h,c]),T=y.useCallback(async w=>{if(confirm(`Remove "${w}" from workspace?`))try{p(null);const C=await fetch(`/api/workspace/repos/${encodeURIComponent(w)}${h}`,{method:"DELETE"});if(!C.ok&&C.status!==204){const O=await C.json();p(O.error||`Failed to remove ${w}`);return}c()}catch(C){p(C.message)}},[h,c]);if(u)return l.jsx(et,{});if(o)return l.jsx(Gt,{message:o,onRetry:c});const D=r||{name:"",rootRepo:null,repos:[]},_=D.repos.filter(w=>w.sync?.github).length,A=D.repos.filter(w=>w.sync?.jira).length,b=D.repos.filter(w=>w.sync?.ado).length;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200",children:"Workspace"}),D.name&&l.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:D.name})]}),l.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1.5 text-xs text-white bg-indigo-600 hover:bg-indigo-500 px-3 py-1.5 rounded-lg transition-colors",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),"Add Repo"]})]}),j&&l.jsx("div",{className:"bg-rose-900/30 border border-rose-700 rounded-lg px-4 py-2",children:l.jsx("p",{className:"text-xs text-rose-400",children:j})}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(ce,{title:"Repositories",value:D.repos.length,color:"indigo"}),l.jsx(ce,{title:"GitHub Mapped",value:_,color:"cyan"}),l.jsx(ce,{title:"Jira Mapped",value:A,color:"amber"}),l.jsx(ce,{title:"ADO Mapped",value:b,color:"emerald"})]}),D.rootRepo&&l.jsxs("div",{className:"bg-gray-900/50 border border-indigo-500/20 rounded-xl p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(ue,{label:"Root",variant:"info"}),l.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Umbrella Repository"})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-3",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"GitHub"}),l.jsx("span",{className:"text-xs text-gray-400",children:Zl(D.rootRepo,"github")||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"Jira"}),l.jsx("span",{className:"text-xs text-gray-400",children:Zl(D.rootRepo,"jira")||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider block mb-1",children:"ADO"}),l.jsx("span",{className:"text-xs text-gray-400",children:Zl(D.rootRepo,"ado")||"-"})]})]})]}),D.repos.length===0?l.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl p-8 text-center",children:[l.jsx("p",{className:"text-gray-500 text-sm",children:"No repositories in workspace"}),l.jsx("p",{className:"text-gray-600 text-xs mt-1",children:'Click "Add Repo" to register your first repository'})]}):l.jsx("div",{className:"bg-gray-900/50 border border-gray-800 rounded-xl overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-800",children:[l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"ID"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"Name"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"Prefix"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"GitHub"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"Jira"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"ADO"}),l.jsx("th",{className:"text-left text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3",children:"Role"}),l.jsx("th",{className:"text-right text-[10px] text-gray-500 uppercase tracking-wider px-4 py-3 w-10"})]})}),l.jsx("tbody",{children:D.repos.map(w=>l.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-gray-800/30 transition-colors",children:[l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:"text-xs font-mono text-gray-300",children:w.id})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Pn,{value:w.name||"",onSave:C=>N(w.id,{name:C}),placeholder:"Set name"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(ue,{label:w.prefix,variant:"default"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Pn,{value:Zl(w.sync,"github"),onSave:C=>N(w.id,{sync:{...w.sync,...mo("github",C)}}),placeholder:"owner/repo"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Pn,{value:Zl(w.sync,"jira"),onSave:C=>N(w.id,{sync:{...w.sync,...mo("jira",C)}}),placeholder:"PROJECT"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Pn,{value:Zl(w.sync,"ado"),onSave:C=>N(w.id,{sync:{...w.sync,...mo("ado",C)}}),placeholder:"project"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx(Pn,{value:w.role||"",onSave:C=>N(w.id,{role:C}),placeholder:"Set role"})}),l.jsx("td",{className:"px-4 py-3 text-right",children:l.jsx("button",{onClick:()=>T(w.id),className:"text-gray-600 hover:text-rose-400 transition-colors p-1",title:"Remove from workspace",children:l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})})]},w.id))})]})})}),x&&l.jsx(Iv,{onClose:()=>m(!1),onSubmit:v})]})}function tb(){const r=dy(),u=Yt();return l.jsx(qx.Provider,{value:r,children:l.jsx(xy,{children:l.jsxs("div",{className:"work-shell flex min-h-screen text-gray-100",children:[l.jsx(vy,{}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[l.jsx(jy,{}),l.jsx("main",{className:"flex-1 overflow-y-auto",children:l.jsx(Ny,{resetKey:u.pathname,children:l.jsxs(Dp,{children:[l.jsx(qe,{path:"/",element:l.jsx(tx,{})}),l.jsx(qe,{path:"/project",element:l.jsx(hy,{})}),l.jsx(qe,{path:"/sessions",element:l.jsx(tx,{sessionsOnly:!0})}),l.jsx(qe,{path:"/overview",element:l.jsx(ky,{})}),l.jsx(qe,{path:"/increments",element:l.jsx(Ly,{})}),l.jsx(qe,{path:"/increments/:id",element:l.jsx(Qv,{})}),l.jsx(qe,{path:"/analytics",element:l.jsx(By,{})}),l.jsx(qe,{path:"/costs",element:l.jsx(Wy,{})}),l.jsx(qe,{path:"/sync",element:l.jsx(lv,{})}),l.jsx(qe,{path:"/errors",element:l.jsx(cv,{})}),l.jsx(qe,{path:"/activity",element:l.jsx(gv,{})}),l.jsx(qe,{path:"/config",element:l.jsx(vv,{})}),l.jsx(qe,{path:"/plugins",element:l.jsx(Nv,{})}),l.jsx(qe,{path:"/services",element:l.jsx(wv,{})}),l.jsx(qe,{path:"/notifications",element:l.jsx(Cv,{})}),l.jsx(qe,{path:"/repos",element:l.jsx(Rv,{})}),l.jsx(qe,{path:"/marketplace",element:l.jsx(Yv,{})}),l.jsx(qe,{path:"/hooks",element:l.jsx(Fv,{})}),l.jsx(qe,{path:"/agents",element:l.jsx(Pv,{})}),l.jsx(qe,{path:"/workspace",element:l.jsx(eb,{})}),l.jsx(qe,{path:"*",element:l.jsxs("div",{className:"p-6 text-center",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-200 mb-2",children:"Page Not Found"}),l.jsx("p",{className:"text-sm text-gray-500",children:"The page you're looking for doesn't exist."})]})})]})})})]})]})})})}Dg.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(ay,{children:l.jsx(tb,{})})}));