@exellix/jobs-ui 2.0.4 → 2.0.5
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.
- package/README.md +26 -5
- package/dist/assets/index-Bs8g4vza.js +61 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/index-CvDv2DRH.js +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var Yb=Object.defineProperty;var Fy=a=>{throw TypeError(a)};var Pb=(a,s,r)=>s in a?Yb(a,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[s]=r;var Xy=(a,s,r)=>Pb(a,typeof s!="symbol"?s+"":s,r),Md=(a,s,r)=>s.has(a)||Fy("Cannot "+r);var R=(a,s,r)=>(Md(a,s,"read from private field"),r?r.call(a):s.get(a)),pe=(a,s,r)=>s.has(a)?Fy("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,r),ie=(a,s,r,c)=>(Md(a,s,"write to private field"),c?c.call(a,r):s.set(a,r),r),Ae=(a,s,r)=>(Md(a,s,"access private method"),r);var $c=(a,s,r,c)=>({set _(u){ie(a,s,u,r)},get _(){return R(a,s,c)}});(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(u){if(u.ep)return;u.ep=!0;const f=r(u);fetch(u.href,f)}})();var kd={exports:{}},Wi={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Vy;function Fb(){if(Vy)return Wi;Vy=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(c,u,f){var h=null;if(f!==void 0&&(h=""+f),u.key!==void 0&&(h=""+u.key),"key"in u){f={};for(var m in u)m!=="key"&&(f[m]=u[m])}else f=u;return u=f.ref,{$$typeof:a,type:c,key:h,ref:u!==void 0?u:null,props:f}}return Wi.Fragment=s,Wi.jsx=r,Wi.jsxs=r,Wi}var Jy;function Xb(){return Jy||(Jy=1,kd.exports=Fb()),kd.exports}var n=Xb(),zd={exports:{}},Ee={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Zy;function Vb(){if(Zy)return Ee;Zy=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),N=Symbol.iterator;function j(T){return T===null||typeof T!="object"?null:(T=N&&T[N]||T["@@iterator"],typeof T=="function"?T:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function O(T,U,W){this.props=T,this.context=U,this.refs=A,this.updater=W||E}O.prototype.isReactComponent={},O.prototype.setState=function(T,U){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,U,"setState")},O.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function Q(){}Q.prototype=O.prototype;function B(T,U,W){this.props=T,this.context=U,this.refs=A,this.updater=W||E}var z=B.prototype=new Q;z.constructor=B,C(z,O.prototype),z.isPureReactComponent=!0;var q=Array.isArray;function V(){}var Z={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function te(T,U,W){var se=W.ref;return{$$typeof:a,type:T,key:U,ref:se!==void 0?se:null,props:W}}function ye(T,U){return te(T.type,U,T.props)}function ue(T){return typeof T=="object"&&T!==null&&T.$$typeof===a}function re(T){var U={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(W){return U[W]})}var Ce=/\/+/g;function Te(T,U){return typeof T=="object"&&T!==null&&T.key!=null?re(""+T.key):U.toString(36)}function ve(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(V,V):(T.status="pending",T.then(function(U){T.status==="pending"&&(T.status="fulfilled",T.value=U)},function(U){T.status==="pending"&&(T.status="rejected",T.reason=U)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function k(T,U,W,se,F){var ce=typeof T;(ce==="undefined"||ce==="boolean")&&(T=null);var xe=!1;if(T===null)xe=!0;else switch(ce){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(T.$$typeof){case a:case s:xe=!0;break;case x:return xe=T._init,k(xe(T._payload),U,W,se,F)}}if(xe)return F=F(T),xe=se===""?"."+Te(T,0):se,q(F)?(W="",xe!=null&&(W=xe.replace(Ce,"$&/")+"/"),k(F,U,W,"",function(Ze){return Ze})):F!=null&&(ue(F)&&(F=ye(F,W+(F.key==null||T&&T.key===F.key?"":(""+F.key).replace(Ce,"$&/")+"/")+xe)),U.push(F)),1;xe=0;var le=se===""?".":se+":";if(q(T))for(var de=0;de<T.length;de++)se=T[de],ce=le+Te(se,de),xe+=k(se,U,W,ce,F);else if(de=j(T),typeof de=="function")for(T=de.call(T),de=0;!(se=T.next()).done;)se=se.value,ce=le+Te(se,de++),xe+=k(se,U,W,ce,F);else if(ce==="object"){if(typeof T.then=="function")return k(ve(T),U,W,se,F);throw U=String(T),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return xe}function J(T,U,W){if(T==null)return T;var se=[],F=0;return k(T,se,"","",function(ce){return U.call(W,ce,F++)}),se}function ae(T){if(T._status===-1){var U=T._result;U=U(),U.then(function(W){(T._status===0||T._status===-1)&&(T._status=1,T._result=W)},function(W){(T._status===0||T._status===-1)&&(T._status=2,T._result=W)}),T._status===-1&&(T._status=0,T._result=U)}if(T._status===1)return T._result.default;throw T._result}var Ne=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},G={map:J,forEach:function(T,U,W){J(T,function(){U.apply(this,arguments)},W)},count:function(T){var U=0;return J(T,function(){U++}),U},toArray:function(T){return J(T,function(U){return U})||[]},only:function(T){if(!ue(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ee.Activity=v,Ee.Children=G,Ee.Component=O,Ee.Fragment=r,Ee.Profiler=u,Ee.PureComponent=B,Ee.StrictMode=c,Ee.Suspense=p,Ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,Ee.__COMPILER_RUNTIME={__proto__:null,c:function(T){return Z.H.useMemoCache(T)}},Ee.cache=function(T){return function(){return T.apply(null,arguments)}},Ee.cacheSignal=function(){return null},Ee.cloneElement=function(T,U,W){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var se=C({},T.props),F=T.key;if(U!=null)for(ce in U.key!==void 0&&(F=""+U.key),U)!I.call(U,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&U.ref===void 0||(se[ce]=U[ce]);var ce=arguments.length-2;if(ce===1)se.children=W;else if(1<ce){for(var xe=Array(ce),le=0;le<ce;le++)xe[le]=arguments[le+2];se.children=xe}return te(T.type,F,se)},Ee.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},Ee.createElement=function(T,U,W){var se,F={},ce=null;if(U!=null)for(se in U.key!==void 0&&(ce=""+U.key),U)I.call(U,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(F[se]=U[se]);var xe=arguments.length-2;if(xe===1)F.children=W;else if(1<xe){for(var le=Array(xe),de=0;de<xe;de++)le[de]=arguments[de+2];F.children=le}if(T&&T.defaultProps)for(se in xe=T.defaultProps,xe)F[se]===void 0&&(F[se]=xe[se]);return te(T,ce,F)},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(T){return{$$typeof:m,render:T}},Ee.isValidElement=ue,Ee.lazy=function(T){return{$$typeof:x,_payload:{_status:-1,_result:T},_init:ae}},Ee.memo=function(T,U){return{$$typeof:g,type:T,compare:U===void 0?null:U}},Ee.startTransition=function(T){var U=Z.T,W={};Z.T=W;try{var se=T(),F=Z.S;F!==null&&F(W,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(V,Ne)}catch(ce){Ne(ce)}finally{U!==null&&W.types!==null&&(U.types=W.types),Z.T=U}},Ee.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},Ee.use=function(T){return Z.H.use(T)},Ee.useActionState=function(T,U,W){return Z.H.useActionState(T,U,W)},Ee.useCallback=function(T,U){return Z.H.useCallback(T,U)},Ee.useContext=function(T){return Z.H.useContext(T)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(T,U){return Z.H.useDeferredValue(T,U)},Ee.useEffect=function(T,U){return Z.H.useEffect(T,U)},Ee.useEffectEvent=function(T){return Z.H.useEffectEvent(T)},Ee.useId=function(){return Z.H.useId()},Ee.useImperativeHandle=function(T,U,W){return Z.H.useImperativeHandle(T,U,W)},Ee.useInsertionEffect=function(T,U){return Z.H.useInsertionEffect(T,U)},Ee.useLayoutEffect=function(T,U){return Z.H.useLayoutEffect(T,U)},Ee.useMemo=function(T,U){return Z.H.useMemo(T,U)},Ee.useOptimistic=function(T,U){return Z.H.useOptimistic(T,U)},Ee.useReducer=function(T,U,W){return Z.H.useReducer(T,U,W)},Ee.useRef=function(T){return Z.H.useRef(T)},Ee.useState=function(T){return Z.H.useState(T)},Ee.useSyncExternalStore=function(T,U,W){return Z.H.useSyncExternalStore(T,U,W)},Ee.useTransition=function(){return Z.H.useTransition()},Ee.version="19.2.7",Ee}var Wy;function Rf(){return Wy||(Wy=1,zd.exports=Vb()),zd.exports}var S=Rf(),Dd={exports:{}},er={},qd={exports:{}},Bd={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var eg;function Jb(){return eg||(eg=1,(function(a){function s(k,J){var ae=k.length;k.push(J);e:for(;0<ae;){var Ne=ae-1>>>1,G=k[Ne];if(0<u(G,J))k[Ne]=J,k[ae]=G,ae=Ne;else break e}}function r(k){return k.length===0?null:k[0]}function c(k){if(k.length===0)return null;var J=k[0],ae=k.pop();if(ae!==J){k[0]=ae;e:for(var Ne=0,G=k.length,T=G>>>1;Ne<T;){var U=2*(Ne+1)-1,W=k[U],se=U+1,F=k[se];if(0>u(W,ae))se<G&&0>u(F,W)?(k[Ne]=F,k[se]=ae,Ne=se):(k[Ne]=W,k[U]=ae,Ne=U);else if(se<G&&0>u(F,ae))k[Ne]=F,k[se]=ae,Ne=se;else break e}}return J}function u(k,J){var ae=k.sortIndex-J.sortIndex;return ae!==0?ae:k.id-J.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],g=[],x=1,v=null,N=3,j=!1,E=!1,C=!1,A=!1,O=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function z(k){for(var J=r(g);J!==null;){if(J.callback===null)c(g);else if(J.startTime<=k)c(g),J.sortIndex=J.expirationTime,s(p,J);else break;J=r(g)}}function q(k){if(C=!1,z(k),!E)if(r(p)!==null)E=!0,V||(V=!0,re());else{var J=r(g);J!==null&&ve(q,J.startTime-k)}}var V=!1,Z=-1,I=5,te=-1;function ye(){return A?!0:!(a.unstable_now()-te<I)}function ue(){if(A=!1,V){var k=a.unstable_now();te=k;var J=!0;try{e:{E=!1,C&&(C=!1,Q(Z),Z=-1),j=!0;var ae=N;try{t:{for(z(k),v=r(p);v!==null&&!(v.expirationTime>k&&ye());){var Ne=v.callback;if(typeof Ne=="function"){v.callback=null,N=v.priorityLevel;var G=Ne(v.expirationTime<=k);if(k=a.unstable_now(),typeof G=="function"){v.callback=G,z(k),J=!0;break t}v===r(p)&&c(p),z(k)}else c(p);v=r(p)}if(v!==null)J=!0;else{var T=r(g);T!==null&&ve(q,T.startTime-k),J=!1}}break e}finally{v=null,N=ae,j=!1}J=void 0}}finally{J?re():V=!1}}}var re;if(typeof B=="function")re=function(){B(ue)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,Te=Ce.port2;Ce.port1.onmessage=ue,re=function(){Te.postMessage(null)}}else re=function(){O(ue,0)};function ve(k,J){Z=O(function(){k(a.unstable_now())},J)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(k){k.callback=null},a.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<k?Math.floor(1e3/k):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_next=function(k){switch(N){case 1:case 2:case 3:var J=3;break;default:J=N}var ae=N;N=J;try{return k()}finally{N=ae}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(k,J){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var ae=N;N=k;try{return J()}finally{N=ae}},a.unstable_scheduleCallback=function(k,J,ae){var Ne=a.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?Ne+ae:Ne):ae=Ne,k){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=ae+G,k={id:x++,callback:J,priorityLevel:k,startTime:ae,expirationTime:G,sortIndex:-1},ae>Ne?(k.sortIndex=ae,s(g,k),r(p)===null&&k===r(g)&&(C?(Q(Z),Z=-1):C=!0,ve(q,ae-Ne))):(k.sortIndex=G,s(p,k),E||j||(E=!0,V||(V=!0,re()))),k},a.unstable_shouldYield=ye,a.unstable_wrapCallback=function(k){var J=N;return function(){var ae=N;N=J;try{return k.apply(this,arguments)}finally{N=ae}}}})(Bd)),Bd}var tg;function Zb(){return tg||(tg=1,qd.exports=Jb()),qd.exports}var Ld={exports:{}},Qt={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var ng;function Wb(){if(ng)return Qt;ng=1;var a=Rf();function s(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var c={d:{f:r,r:function(){throw Error(s(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(p,g,x){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:v==null?null:""+v,children:p,containerInfo:g,implementation:x}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,Qt.createPortal=function(p,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(s(299));return f(p,g,null,x)},Qt.flushSync=function(p){var g=h.T,x=c.p;try{if(h.T=null,c.p=2,p)return p()}finally{h.T=g,c.p=x,c.d.f()}},Qt.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,c.d.C(p,g))},Qt.prefetchDNS=function(p){typeof p=="string"&&c.d.D(p)},Qt.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var x=g.as,v=m(x,g.crossOrigin),N=typeof g.integrity=="string"?g.integrity:void 0,j=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?c.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:v,integrity:N,fetchPriority:j}):x==="script"&&c.d.X(p,{crossOrigin:v,integrity:N,fetchPriority:j,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Qt.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=m(g.as,g.crossOrigin);c.d.M(p,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&c.d.M(p)},Qt.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,v=m(x,g.crossOrigin);c.d.L(p,x,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Qt.preloadModule=function(p,g){if(typeof p=="string")if(g){var x=m(g.as,g.crossOrigin);c.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else c.d.m(p)},Qt.requestFormReset=function(p){c.d.r(p)},Qt.unstable_batchedUpdates=function(p,g){return p(g)},Qt.useFormState=function(p,g,x){return h.H.useFormState(p,g,x)},Qt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Qt.version="19.2.7",Qt}var ag;function e0(){if(ag)return Ld.exports;ag=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Ld.exports=Wb(),Ld.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var lg;function t0(){if(lg)return er;lg=1;var a=Zb(),s=Rf(),r=e0();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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 u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function h(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 m(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(f(e)!==e)throw Error(c(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var l=e,i=t;;){var o=l.return;if(o===null)break;var d=o.alternate;if(d===null){if(i=o.return,i!==null){l=i;continue}break}if(o.child===d.child){for(d=o.child;d;){if(d===l)return p(o),e;if(d===i)return p(o),t;d=d.sibling}throw Error(c(188))}if(l.return!==i.return)l=o,i=d;else{for(var y=!1,b=o.child;b;){if(b===l){y=!0,l=o,i=d;break}if(b===i){y=!0,i=o,l=d;break}b=b.sibling}if(!y){for(b=d.child;b;){if(b===l){y=!0,l=d,i=o;break}if(b===i){y=!0,i=d,l=o;break}b=b.sibling}if(!y)throw Error(c(189))}}if(l.alternate!==i)throw Error(c(190))}if(l.tag!==3)throw Error(c(188));return l.stateNode.current===l?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,N=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ye=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var Ce=Symbol.for("react.client.reference");function Te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case A:return"StrictMode";case q:return"Suspense";case V:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case B:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return t=e.displayName||null,t!==null?t:Te(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return Te(e(t))}catch{}}return null}var ve=Array.isArray,k=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},Ne=[],G=-1;function T(e){return{current:e}}function U(e){0>G||(e.current=Ne[G],Ne[G]=null,G--)}function W(e,t){G++,Ne[G]=e.current,e.current=t}var se=T(null),F=T(null),ce=T(null),xe=T(null);function le(e,t){switch(W(ce,t),W(F,e),W(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?gy(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=gy(t),e=vy(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(se),W(se,e)}function de(){U(se),U(F),U(ce)}function Ze(e){e.memoizedState!==null&&W(xe,e);var t=se.current,l=vy(t,e.type);t!==l&&(W(F,e),W(se,l))}function ut(e){F.current===e&&(U(se),U(F)),xe.current===e&&(U(xe),Xi._currentValue=ae)}var it,Pe;function Tt(e){if(it===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);it=t&&t[1]||"",Pe=-1<l.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+it+e+Pe}var St=!1;function at(e,t){if(!e||St)return"";St=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(K){var $=K}Reflect.construct(e,[],X)}else{try{X.call()}catch(K){$=K}e.call(X.prototype)}}else{try{throw Error()}catch(K){$=K}(X=e())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(K){if(K&&$&&typeof K.stack=="string")return[K.stack,$.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=i.DetermineComponentFrameRoot(),y=d[0],b=d[1];if(y&&b){var w=y.split(`
|
|
44
|
-
`),_=b.split(`
|
|
45
|
-
`);for(o=i=0;i<w.length&&!w[i].includes("DetermineComponentFrameRoot");)i++;for(;o<_.length&&!_[o].includes("DetermineComponentFrameRoot");)o++;if(i===w.length||o===_.length)for(i=w.length-1,o=_.length-1;1<=i&&0<=o&&w[i]!==_[o];)o--;for(;1<=i&&0<=o;i--,o--)if(w[i]!==_[o]){if(i!==1||o!==1)do if(i--,o--,0>o||w[i]!==_[o]){var Y=`
|
|
46
|
-
`+w[i].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=i&&0<=o);break}}}finally{St=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Tt(l):""}function Gn(e,t){switch(e.tag){case 26:case 27:case 5:return Tt(e.type);case 16:return Tt("Lazy");case 13:return e.child!==t&&t!==null?Tt("Suspense Fallback"):Tt("Suspense");case 19:return Tt("SuspenseList");case 0:case 15:return at(e.type,!1);case 11:return at(e.type.render,!1);case 1:return at(e.type,!0);case 31:return Tt("Activity");default:return""}}function In(e){try{var t="",l=null;do t+=Gn(e,l),l=e,e=e.return;while(e);return t}catch(i){return`
|
|
47
|
-
Error generating stack: `+i.message+`
|
|
48
|
-
`+i.stack}}var Ln=Object.prototype.hasOwnProperty,ne=a.unstable_scheduleCallback,H=a.unstable_cancelCallback,Me=a.unstable_shouldYield,wt=a.unstable_requestPaint,rt=a.unstable_now,ka=a.unstable_getCurrentPriorityLevel,vl=a.unstable_ImmediatePriority,ii=a.unstable_UserBlockingPriority,xl=a.unstable_NormalPriority,Cr=a.unstable_LowPriority,ri=a.unstable_IdlePriority,me=a.log,$e=a.unstable_setDisableYieldValue,gn=null,_t=null;function Ut(e){if(typeof me=="function"&&$e(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(gn,e)}catch{}}var nn=Math.clz32?Math.clz32:kx,Ox=Math.log,Mx=Math.LN2;function kx(e){return e>>>=0,e===0?32:31-(Ox(e)/Mx|0)|0}var Er=256,Tr=262144,wr=4194304;function jl(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 Rr(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var o=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~d,i!==0?o=jl(i):(y&=b,y!==0?o=jl(y):l||(l=b&~e,l!==0&&(o=jl(l))))):(b=i&~d,b!==0?o=jl(b):y!==0?o=jl(y):l||(l=i&~e,l!==0&&(o=jl(l)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:o}function ci(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function zx(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 Zf(){var e=wr;return wr<<=1,(wr&62914560)===0&&(wr=4194304),e}function xo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function oi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dx(e,t,l,i,o,d){var y=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var b=e.entanglements,w=e.expirationTimes,_=e.hiddenUpdates;for(l=y&~l;0<l;){var Y=31-nn(l),X=1<<Y;b[Y]=0,w[Y]=-1;var $=_[Y];if($!==null)for(_[Y]=null,Y=0;Y<$.length;Y++){var K=$[Y];K!==null&&(K.lane&=-536870913)}l&=~X}i!==0&&Wf(e,i,0),d!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Wf(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-nn(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function eh(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var i=31-nn(l),o=1<<i;o&t|e[i]&t&&(e[i]|=t),l&=~o}}function th(e,t){var l=t&-t;return l=(l&42)!==0?1:jo(l),(l&(e.suspendedLanes|t))!==0?0:l}function jo(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 bo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function nh(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:$y(e.type))}function ah(e,t){var l=J.p;try{return J.p=e,t()}finally{J.p=l}}var za=Math.random().toString(36).slice(2),kt="__reactFiber$"+za,Pt="__reactProps$"+za,Jl="__reactContainer$"+za,So="__reactEvents$"+za,qx="__reactListeners$"+za,Bx="__reactHandles$"+za,lh="__reactResources$"+za,ui="__reactMarker$"+za;function No(e){delete e[kt],delete e[Pt],delete e[So],delete e[qx],delete e[Bx]}function Zl(e){var t=e[kt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Jl]||l[kt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Ey(e);e!==null;){if(l=e[kt])return l;e=Ey(e)}return t}e=l,l=e.parentNode}return null}function Wl(e){if(e=e[kt]||e[Jl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function di(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function es(e){var t=e[lh];return t||(t=e[lh]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Rt(e){e[ui]=!0}var sh=new Set,ih={};function bl(e,t){ts(e,t),ts(e+"Capture",t)}function ts(e,t){for(ih[e]=t,e=0;e<t.length;e++)sh.add(t[e])}var Lx=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]*$"),rh={},ch={};function _x(e){return Ln.call(ch,e)?!0:Ln.call(rh,e)?!1:Lx.test(e)?ch[e]=!0:(rh[e]=!0,!1)}function Ar(e,t,l){if(_x(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Or(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Wn(e,t,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+i)}}function vn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ux(e,t,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var o=i.get,d=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(y){l=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Co(e){if(!e._valueTracker){var t=oh(e)?"checked":"value";e._valueTracker=Ux(e,t,""+e[t])}}function uh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=oh(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function Mr(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 Qx=/[\n"\\]/g;function xn(e){return e.replace(Qx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eo(e,t,l,i,o,d,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+vn(t)):e.value!==""+vn(t)&&(e.value=""+vn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?To(e,y,vn(t)):l!=null?To(e,y,vn(l)):i!=null&&e.removeAttribute("value"),o==null&&d!=null&&(e.defaultChecked=!!d),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+vn(b):e.removeAttribute("name")}function dh(e,t,l,i,o,d,y,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Co(e);return}l=l!=null?""+vn(l):"",t=t!=null?""+vn(t):l,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),Co(e)}function To(e,t,l){t==="number"&&Mr(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function ns(e,t,l,i){if(e=e.options,t){t={};for(var o=0;o<l.length;o++)t["$"+l[o]]=!0;for(l=0;l<e.length;l++)o=t.hasOwnProperty("$"+e[l].value),e[l].selected!==o&&(e[l].selected=o),o&&i&&(e[l].defaultSelected=!0)}else{for(l=""+vn(l),t=null,o=0;o<e.length;o++){if(e[o].value===l){e[o].selected=!0,i&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function fh(e,t,l){if(t!=null&&(t=""+vn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+vn(l):""}function hh(e,t,l,i){if(t==null){if(i!=null){if(l!=null)throw Error(c(92));if(ve(i)){if(1<i.length)throw Error(c(93));i=i[0]}l=i}l==null&&(l=""),t=l}l=vn(t),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),Co(e)}function as(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var $x=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 mh(e,t,l){var i=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,l):typeof l!="number"||l===0||$x.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function ph(e,t,l){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var o in t)i=t[o],t.hasOwnProperty(o)&&l[o]!==i&&mh(e,o,i)}else for(var d in t)t.hasOwnProperty(d)&&mh(e,d,t[d])}function wo(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 Hx=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"]]),Kx=/^[\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 kr(e){return Kx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ea(){}var Ro=null;function Ao(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ls=null,ss=null;function yh(e){var t=Wl(e);if(t&&(e=t.stateNode)){var l=e[Pt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Eo(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+xn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var i=l[t];if(i!==e&&i.form===e.form){var o=i[Pt]||null;if(!o)throw Error(c(90));Eo(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<l.length;t++)i=l[t],i.form===e.form&&uh(i)}break e;case"textarea":fh(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&ns(e,!!l.multiple,t,!1)}}}var Oo=!1;function gh(e,t,l){if(Oo)return e(t,l);Oo=!0;try{var i=e(t);return i}finally{if(Oo=!1,(ls!==null||ss!==null)&&(xc(),ls&&(t=ls,e=ss,ss=ls=null,yh(t),e)))for(t=0;t<e.length;t++)yh(e[t])}}function fi(e,t){var l=e.stateNode;if(l===null)return null;var i=l[Pt]||null;if(i===null)return null;l=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(c(231,t,typeof l));return l}var ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mo=!1;if(ta)try{var hi={};Object.defineProperty(hi,"passive",{get:function(){Mo=!0}}),window.addEventListener("test",hi,hi),window.removeEventListener("test",hi,hi)}catch{Mo=!1}var Da=null,ko=null,zr=null;function vh(){if(zr)return zr;var e,t=ko,l=t.length,i,o="value"in Da?Da.value:Da.textContent,d=o.length;for(e=0;e<l&&t[e]===o[e];e++);var y=l-e;for(i=1;i<=y&&t[l-i]===o[d-i];i++);return zr=o.slice(e,1<i?1-i:void 0)}function Dr(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 qr(){return!0}function xh(){return!1}function Ft(e){function t(l,i,o,d,y){this._reactName=l,this._targetInst=o,this.type=i,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(l=e[b],this[b]=l?l(d):d[b]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?qr:xh,this.isPropagationStopped=xh,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=qr)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=qr)},persist:function(){},isPersistent:qr}),t}var Sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Br=Ft(Sl),mi=v({},Sl,{view:0,detail:0}),Gx=Ft(mi),zo,Do,pi,Lr=v({},mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bo,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!==pi&&(pi&&e.type==="mousemove"?(zo=e.screenX-pi.screenX,Do=e.screenY-pi.screenY):Do=zo=0,pi=e),zo)},movementY:function(e){return"movementY"in e?e.movementY:Do}}),jh=Ft(Lr),Ix=v({},Lr,{dataTransfer:0}),Yx=Ft(Ix),Px=v({},mi,{relatedTarget:0}),qo=Ft(Px),Fx=v({},Sl,{animationName:0,elapsedTime:0,pseudoElement:0}),Xx=Ft(Fx),Vx=v({},Sl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Jx=Ft(Vx),Zx=v({},Sl,{data:0}),bh=Ft(Zx),Wx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ej={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"},tj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nj(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=tj[e])?!!t[e]:!1}function Bo(){return nj}var aj=v({},mi,{key:function(e){if(e.key){var t=Wx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Dr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ej[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bo,charCode:function(e){return e.type==="keypress"?Dr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Dr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lj=Ft(aj),sj=v({},Lr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sh=Ft(sj),ij=v({},mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bo}),rj=Ft(ij),cj=v({},Sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),oj=Ft(cj),uj=v({},Lr,{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}),dj=Ft(uj),fj=v({},Sl,{newState:0,oldState:0}),hj=Ft(fj),mj=[9,13,27,32],Lo=ta&&"CompositionEvent"in window,yi=null;ta&&"documentMode"in document&&(yi=document.documentMode);var pj=ta&&"TextEvent"in window&&!yi,Nh=ta&&(!Lo||yi&&8<yi&&11>=yi),Ch=" ",Eh=!1;function Th(e,t){switch(e){case"keyup":return mj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var is=!1;function yj(e,t){switch(e){case"compositionend":return wh(t);case"keypress":return t.which!==32?null:(Eh=!0,Ch);case"textInput":return e=t.data,e===Ch&&Eh?null:e;default:return null}}function gj(e,t){if(is)return e==="compositionend"||!Lo&&Th(e,t)?(e=vh(),zr=ko=Da=null,is=!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 Nh&&t.locale!=="ko"?null:t.data;default:return null}}var vj={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 Rh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vj[e.type]:t==="textarea"}function Ah(e,t,l,i){ls?ss?ss.push(i):ss=[i]:ls=i,t=Tc(t,"onChange"),0<t.length&&(l=new Br("onChange","change",null,l,i),e.push({event:l,listeners:t}))}var gi=null,vi=null;function xj(e){dy(e,0)}function _r(e){var t=di(e);if(uh(t))return e}function Oh(e,t){if(e==="change")return t}var Mh=!1;if(ta){var _o;if(ta){var Uo="oninput"in document;if(!Uo){var kh=document.createElement("div");kh.setAttribute("oninput","return;"),Uo=typeof kh.oninput=="function"}_o=Uo}else _o=!1;Mh=_o&&(!document.documentMode||9<document.documentMode)}function zh(){gi&&(gi.detachEvent("onpropertychange",Dh),vi=gi=null)}function Dh(e){if(e.propertyName==="value"&&_r(vi)){var t=[];Ah(t,vi,e,Ao(e)),gh(xj,t)}}function jj(e,t,l){e==="focusin"?(zh(),gi=t,vi=l,gi.attachEvent("onpropertychange",Dh)):e==="focusout"&&zh()}function bj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _r(vi)}function Sj(e,t){if(e==="click")return _r(t)}function Nj(e,t){if(e==="input"||e==="change")return _r(t)}function Cj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var an=typeof Object.is=="function"?Object.is:Cj;function xi(e,t){if(an(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var o=l[i];if(!Ln.call(t,o)||!an(e[o],t[o]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Bh(e,t){var l=qh(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=t&&i>=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=qh(l)}}function Lh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _h(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mr(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Mr(e.document)}return t}function Qo(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 Ej=ta&&"documentMode"in document&&11>=document.documentMode,rs=null,$o=null,ji=null,Ho=!1;function Uh(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ho||rs==null||rs!==Mr(i)||(i=rs,"selectionStart"in i&&Qo(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ji&&xi(ji,i)||(ji=i,i=Tc($o,"onSelect"),0<i.length&&(t=new Br("onSelect","select",null,t,l),e.push({event:t,listeners:i}),t.target=rs)))}function Nl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var cs={animationend:Nl("Animation","AnimationEnd"),animationiteration:Nl("Animation","AnimationIteration"),animationstart:Nl("Animation","AnimationStart"),transitionrun:Nl("Transition","TransitionRun"),transitionstart:Nl("Transition","TransitionStart"),transitioncancel:Nl("Transition","TransitionCancel"),transitionend:Nl("Transition","TransitionEnd")},Ko={},Qh={};ta&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function Cl(e){if(Ko[e])return Ko[e];if(!cs[e])return e;var t=cs[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Qh)return Ko[e]=t[l];return e}var $h=Cl("animationend"),Hh=Cl("animationiteration"),Kh=Cl("animationstart"),Tj=Cl("transitionrun"),wj=Cl("transitionstart"),Rj=Cl("transitioncancel"),Gh=Cl("transitionend"),Ih=new Map,Go="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(" ");Go.push("scrollEnd");function _n(e,t){Ih.set(e,t),bl(t,[e])}var Ur=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)},jn=[],os=0,Io=0;function Qr(){for(var e=os,t=Io=os=0;t<e;){var l=jn[t];jn[t++]=null;var i=jn[t];jn[t++]=null;var o=jn[t];jn[t++]=null;var d=jn[t];if(jn[t++]=null,i!==null&&o!==null){var y=i.pending;y===null?o.next=o:(o.next=y.next,y.next=o),i.pending=o}d!==0&&Yh(l,o,d)}}function $r(e,t,l,i){jn[os++]=e,jn[os++]=t,jn[os++]=l,jn[os++]=i,Io|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Yo(e,t,l,i){return $r(e,t,l,i),Hr(e)}function El(e,t){return $r(e,null,null,t),Hr(e)}function Yh(e,t,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var o=!1,d=e.return;d!==null;)d.childLanes|=l,i=d.alternate,i!==null&&(i.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(o=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,o&&t!==null&&(o=31-nn(l),e=d.hiddenUpdates,i=e[o],i===null?e[o]=[t]:i.push(t),t.lane=l|536870912),d):null}function Hr(e){if(50<Hi)throw Hi=0,td=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var us={};function Aj(e,t,l,i){this.tag=e,this.key=l,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ln(e,t,l,i){return new Aj(e,t,l,i)}function Po(e){return e=e.prototype,!(!e||!e.isReactComponent)}function na(e,t){var l=e.alternate;return l===null?(l=ln(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Ph(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Kr(e,t,l,i,o,d){var y=0;if(i=e,typeof e=="function")Po(e)&&(y=1);else if(typeof e=="string")y=Db(e,l,se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=ln(31,l,t,o),e.elementType=te,e.lanes=d,e;case C:return Tl(l.children,o,d,t);case A:y=8,o|=24;break;case O:return e=ln(12,l,t,o|2),e.elementType=O,e.lanes=d,e;case q:return e=ln(13,l,t,o),e.elementType=q,e.lanes=d,e;case V:return e=ln(19,l,t,o),e.elementType=V,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case Q:y=9;break e;case z:y=11;break e;case Z:y=14;break e;case I:y=16,i=null;break e}y=29,l=Error(c(130,e===null?"null":typeof e,"")),i=null}return t=ln(y,l,t,o),t.elementType=e,t.type=i,t.lanes=d,t}function Tl(e,t,l,i){return e=ln(7,e,i,t),e.lanes=l,e}function Fo(e,t,l){return e=ln(6,e,null,t),e.lanes=l,e}function Fh(e){var t=ln(18,null,null,0);return t.stateNode=e,t}function Xo(e,t,l){return t=ln(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xh=new WeakMap;function bn(e,t){if(typeof e=="object"&&e!==null){var l=Xh.get(e);return l!==void 0?l:(t={value:e,source:t,stack:In(t)},Xh.set(e,t),t)}return{value:e,source:t,stack:In(t)}}var ds=[],fs=0,Gr=null,bi=0,Sn=[],Nn=0,qa=null,Yn=1,Pn="";function aa(e,t){ds[fs++]=bi,ds[fs++]=Gr,Gr=e,bi=t}function Vh(e,t,l){Sn[Nn++]=Yn,Sn[Nn++]=Pn,Sn[Nn++]=qa,qa=e;var i=Yn;e=Pn;var o=32-nn(i)-1;i&=~(1<<o),l+=1;var d=32-nn(t)+o;if(30<d){var y=o-o%5;d=(i&(1<<y)-1).toString(32),i>>=y,o-=y,Yn=1<<32-nn(t)+o|l<<o|i,Pn=d+e}else Yn=1<<d|l<<o|i,Pn=e}function Vo(e){e.return!==null&&(aa(e,1),Vh(e,1,0))}function Jo(e){for(;e===Gr;)Gr=ds[--fs],ds[fs]=null,bi=ds[--fs],ds[fs]=null;for(;e===qa;)qa=Sn[--Nn],Sn[Nn]=null,Pn=Sn[--Nn],Sn[Nn]=null,Yn=Sn[--Nn],Sn[Nn]=null}function Jh(e,t){Sn[Nn++]=Yn,Sn[Nn++]=Pn,Sn[Nn++]=qa,Yn=t.id,Pn=t.overflow,qa=e}var zt=null,et=null,Be=!1,Ba=null,Cn=!1,Zo=Error(c(519));function La(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Si(bn(t,e)),Zo}function Zh(e){var t=e.stateNode,l=e.type,i=e.memoizedProps;switch(t[kt]=e,t[Pt]=i,l){case"dialog":ze("cancel",t),ze("close",t);break;case"iframe":case"object":case"embed":ze("load",t);break;case"video":case"audio":for(l=0;l<Gi.length;l++)ze(Gi[l],t);break;case"source":ze("error",t);break;case"img":case"image":case"link":ze("error",t),ze("load",t);break;case"details":ze("toggle",t);break;case"input":ze("invalid",t),dh(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":ze("invalid",t);break;case"textarea":ze("invalid",t),hh(t,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||i.suppressHydrationWarning===!0||py(t.textContent,l)?(i.popover!=null&&(ze("beforetoggle",t),ze("toggle",t)),i.onScroll!=null&&ze("scroll",t),i.onScrollEnd!=null&&ze("scrollend",t),i.onClick!=null&&(t.onclick=ea),t=!0):t=!1,t||La(e,!0)}function Wh(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:zt=zt.return}}function hs(e){if(e!==zt)return!1;if(!Be)return Wh(e),Be=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||yd(e.type,e.memoizedProps)),l=!l),l&&et&&La(e),Wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));et=Cy(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));et=Cy(e)}else t===27?(t=et,Ja(e.type)?(e=bd,bd=null,et=e):et=t):et=zt?Tn(e.stateNode.nextSibling):null;return!0}function wl(){et=zt=null,Be=!1}function Wo(){var e=Ba;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Ba=null),e}function Si(e){Ba===null?Ba=[e]:Ba.push(e)}var eu=T(null),Rl=null,la=null;function _a(e,t,l){W(eu,t._currentValue),t._currentValue=l}function sa(e){e._currentValue=eu.current,U(eu)}function tu(e,t,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===l)break;e=e.return}}function nu(e,t,l,i){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var d=o.dependencies;if(d!==null){var y=o.child;d=d.firstContext;e:for(;d!==null;){var b=d;d=o;for(var w=0;w<t.length;w++)if(b.context===t[w]){d.lanes|=l,b=d.alternate,b!==null&&(b.lanes|=l),tu(d.return,l,e),i||(y=null);break e}d=b.next}}else if(o.tag===18){if(y=o.return,y===null)throw Error(c(341));y.lanes|=l,d=y.alternate,d!==null&&(d.lanes|=l),tu(y,l,e),y=null}else y=o.child;if(y!==null)y.return=o;else for(y=o;y!==null;){if(y===e){y=null;break}if(o=y.sibling,o!==null){o.return=y.return,y=o;break}y=y.return}o=y}}function ms(e,t,l,i){e=null;for(var o=t,d=!1;o!==null;){if(!d){if((o.flags&524288)!==0)d=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var y=o.alternate;if(y===null)throw Error(c(387));if(y=y.memoizedProps,y!==null){var b=o.type;an(o.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(o===xe.current){if(y=o.alternate,y===null)throw Error(c(387));y.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Xi):e=[Xi])}o=o.return}e!==null&&nu(t,e,l,i),t.flags|=262144}function Ir(e){for(e=e.firstContext;e!==null;){if(!an(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Al(e){Rl=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Dt(e){return em(Rl,e)}function Yr(e,t){return Rl===null&&Al(e),em(e,t)}function em(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},la===null){if(e===null)throw Error(c(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return l}var Oj=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Mj=a.unstable_scheduleCallback,kj=a.unstable_NormalPriority,gt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function au(){return{controller:new Oj,data:new Map,refCount:0}}function Ni(e){e.refCount--,e.refCount===0&&Mj(kj,function(){e.controller.abort()})}var Ci=null,lu=0,ps=0,ys=null;function zj(e,t){if(Ci===null){var l=Ci=[];lu=0,ps=rd(),ys={status:"pending",value:void 0,then:function(i){l.push(i)}}}return lu++,t.then(tm,tm),t}function tm(){if(--lu===0&&Ci!==null){ys!==null&&(ys.status="fulfilled");var e=Ci;Ci=null,ps=0,ys=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Dj(e,t){var l=[],i={status:"pending",value:null,reason:null,then:function(o){l.push(o)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var o=0;o<l.length;o++)(0,l[o])(t)},function(o){for(i.status="rejected",i.reason=o,o=0;o<l.length;o++)(0,l[o])(void 0)}),i}var nm=k.S;k.S=function(e,t){Up=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&zj(e,t),nm!==null&&nm(e,t)};var Ol=T(null);function su(){var e=Ol.current;return e!==null?e:Je.pooledCache}function Pr(e,t){t===null?W(Ol,Ol.current):W(Ol,t.pool)}function am(){var e=su();return e===null?null:{parent:gt._currentValue,pool:e}}var gs=Error(c(460)),iu=Error(c(474)),Fr=Error(c(542)),Xr={then:function(){}};function lm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sm(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ea,ea),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,rm(e),e;default:if(typeof t.status=="string")t.then(ea,ea);else{if(e=Je,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=i}},function(i){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,rm(e),e}throw kl=t,gs}}function Ml(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(kl=l,gs):l}}var kl=null;function im(){if(kl===null)throw Error(c(459));var e=kl;return kl=null,e}function rm(e){if(e===gs||e===Fr)throw Error(c(483))}var vs=null,Ei=0;function Vr(e){var t=Ei;return Ei+=1,vs===null&&(vs=[]),sm(vs,e,t)}function Ti(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Jr(e,t){throw t.$$typeof===N?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function cm(e){function t(D,M){if(e){var L=D.deletions;L===null?(D.deletions=[M],D.flags|=16):L.push(M)}}function l(D,M){if(!e)return null;for(;M!==null;)t(D,M),M=M.sibling;return null}function i(D){for(var M=new Map;D!==null;)D.key!==null?M.set(D.key,D):M.set(D.index,D),D=D.sibling;return M}function o(D,M){return D=na(D,M),D.index=0,D.sibling=null,D}function d(D,M,L){return D.index=L,e?(L=D.alternate,L!==null?(L=L.index,L<M?(D.flags|=67108866,M):L):(D.flags|=67108866,M)):(D.flags|=1048576,M)}function y(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function b(D,M,L,P){return M===null||M.tag!==6?(M=Fo(L,D.mode,P),M.return=D,M):(M=o(M,L),M.return=D,M)}function w(D,M,L,P){var ge=L.type;return ge===C?Y(D,M,L.props.children,P,L.key):M!==null&&(M.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===I&&Ml(ge)===M.type)?(M=o(M,L.props),Ti(M,L),M.return=D,M):(M=Kr(L.type,L.key,L.props,null,D.mode,P),Ti(M,L),M.return=D,M)}function _(D,M,L,P){return M===null||M.tag!==4||M.stateNode.containerInfo!==L.containerInfo||M.stateNode.implementation!==L.implementation?(M=Xo(L,D.mode,P),M.return=D,M):(M=o(M,L.children||[]),M.return=D,M)}function Y(D,M,L,P,ge){return M===null||M.tag!==7?(M=Tl(L,D.mode,P,ge),M.return=D,M):(M=o(M,L),M.return=D,M)}function X(D,M,L){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Fo(""+M,D.mode,L),M.return=D,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case j:return L=Kr(M.type,M.key,M.props,null,D.mode,L),Ti(L,M),L.return=D,L;case E:return M=Xo(M,D.mode,L),M.return=D,M;case I:return M=Ml(M),X(D,M,L)}if(ve(M)||re(M))return M=Tl(M,D.mode,L,null),M.return=D,M;if(typeof M.then=="function")return X(D,Vr(M),L);if(M.$$typeof===B)return X(D,Yr(D,M),L);Jr(D,M)}return null}function $(D,M,L,P){var ge=M!==null?M.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return ge!==null?null:b(D,M,""+L,P);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case j:return L.key===ge?w(D,M,L,P):null;case E:return L.key===ge?_(D,M,L,P):null;case I:return L=Ml(L),$(D,M,L,P)}if(ve(L)||re(L))return ge!==null?null:Y(D,M,L,P,null);if(typeof L.then=="function")return $(D,M,Vr(L),P);if(L.$$typeof===B)return $(D,M,Yr(D,L),P);Jr(D,L)}return null}function K(D,M,L,P,ge){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return D=D.get(L)||null,b(M,D,""+P,ge);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case j:return D=D.get(P.key===null?L:P.key)||null,w(M,D,P,ge);case E:return D=D.get(P.key===null?L:P.key)||null,_(M,D,P,ge);case I:return P=Ml(P),K(D,M,L,P,ge)}if(ve(P)||re(P))return D=D.get(L)||null,Y(M,D,P,ge,null);if(typeof P.then=="function")return K(D,M,L,Vr(P),ge);if(P.$$typeof===B)return K(D,M,L,Yr(M,P),ge);Jr(M,P)}return null}function oe(D,M,L,P){for(var ge=null,_e=null,fe=M,Re=M=0,qe=null;fe!==null&&Re<L.length;Re++){fe.index>Re?(qe=fe,fe=null):qe=fe.sibling;var Ue=$(D,fe,L[Re],P);if(Ue===null){fe===null&&(fe=qe);break}e&&fe&&Ue.alternate===null&&t(D,fe),M=d(Ue,M,Re),_e===null?ge=Ue:_e.sibling=Ue,_e=Ue,fe=qe}if(Re===L.length)return l(D,fe),Be&&aa(D,Re),ge;if(fe===null){for(;Re<L.length;Re++)fe=X(D,L[Re],P),fe!==null&&(M=d(fe,M,Re),_e===null?ge=fe:_e.sibling=fe,_e=fe);return Be&&aa(D,Re),ge}for(fe=i(fe);Re<L.length;Re++)qe=K(fe,D,Re,L[Re],P),qe!==null&&(e&&qe.alternate!==null&&fe.delete(qe.key===null?Re:qe.key),M=d(qe,M,Re),_e===null?ge=qe:_e.sibling=qe,_e=qe);return e&&fe.forEach(function(nl){return t(D,nl)}),Be&&aa(D,Re),ge}function be(D,M,L,P){if(L==null)throw Error(c(151));for(var ge=null,_e=null,fe=M,Re=M=0,qe=null,Ue=L.next();fe!==null&&!Ue.done;Re++,Ue=L.next()){fe.index>Re?(qe=fe,fe=null):qe=fe.sibling;var nl=$(D,fe,Ue.value,P);if(nl===null){fe===null&&(fe=qe);break}e&&fe&&nl.alternate===null&&t(D,fe),M=d(nl,M,Re),_e===null?ge=nl:_e.sibling=nl,_e=nl,fe=qe}if(Ue.done)return l(D,fe),Be&&aa(D,Re),ge;if(fe===null){for(;!Ue.done;Re++,Ue=L.next())Ue=X(D,Ue.value,P),Ue!==null&&(M=d(Ue,M,Re),_e===null?ge=Ue:_e.sibling=Ue,_e=Ue);return Be&&aa(D,Re),ge}for(fe=i(fe);!Ue.done;Re++,Ue=L.next())Ue=K(fe,D,Re,Ue.value,P),Ue!==null&&(e&&Ue.alternate!==null&&fe.delete(Ue.key===null?Re:Ue.key),M=d(Ue,M,Re),_e===null?ge=Ue:_e.sibling=Ue,_e=Ue);return e&&fe.forEach(function(Ib){return t(D,Ib)}),Be&&aa(D,Re),ge}function Ve(D,M,L,P){if(typeof L=="object"&&L!==null&&L.type===C&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case j:e:{for(var ge=L.key;M!==null;){if(M.key===ge){if(ge=L.type,ge===C){if(M.tag===7){l(D,M.sibling),P=o(M,L.props.children),P.return=D,D=P;break e}}else if(M.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===I&&Ml(ge)===M.type){l(D,M.sibling),P=o(M,L.props),Ti(P,L),P.return=D,D=P;break e}l(D,M);break}else t(D,M);M=M.sibling}L.type===C?(P=Tl(L.props.children,D.mode,P,L.key),P.return=D,D=P):(P=Kr(L.type,L.key,L.props,null,D.mode,P),Ti(P,L),P.return=D,D=P)}return y(D);case E:e:{for(ge=L.key;M!==null;){if(M.key===ge)if(M.tag===4&&M.stateNode.containerInfo===L.containerInfo&&M.stateNode.implementation===L.implementation){l(D,M.sibling),P=o(M,L.children||[]),P.return=D,D=P;break e}else{l(D,M);break}else t(D,M);M=M.sibling}P=Xo(L,D.mode,P),P.return=D,D=P}return y(D);case I:return L=Ml(L),Ve(D,M,L,P)}if(ve(L))return oe(D,M,L,P);if(re(L)){if(ge=re(L),typeof ge!="function")throw Error(c(150));return L=ge.call(L),be(D,M,L,P)}if(typeof L.then=="function")return Ve(D,M,Vr(L),P);if(L.$$typeof===B)return Ve(D,M,Yr(D,L),P);Jr(D,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,M!==null&&M.tag===6?(l(D,M.sibling),P=o(M,L),P.return=D,D=P):(l(D,M),P=Fo(L,D.mode,P),P.return=D,D=P),y(D)):l(D,M)}return function(D,M,L,P){try{Ei=0;var ge=Ve(D,M,L,P);return vs=null,ge}catch(fe){if(fe===gs||fe===Fr)throw fe;var _e=ln(29,fe,null,D.mode);return _e.lanes=P,_e.return=D,_e}finally{}}}var zl=cm(!0),om=cm(!1),Ua=!1;function ru(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cu(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 Qa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $a(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Qe&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Hr(e),Yh(e,null,l),t}return $r(e,i,t,l),Hr(e)}function wi(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,eh(e,l)}}function ou(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var o=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?o=d=y:d=d.next=y,l=l.next}while(l!==null);d===null?o=d=t:d=d.next=t}else o=d=t;l={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:d,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var uu=!1;function Ri(){if(uu){var e=ys;if(e!==null)throw e}}function Ai(e,t,l,i){uu=!1;var o=e.updateQueue;Ua=!1;var d=o.firstBaseUpdate,y=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var w=b,_=w.next;w.next=null,y===null?d=_:y.next=_,y=w;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==y&&(b===null?Y.firstBaseUpdate=_:b.next=_,Y.lastBaseUpdate=w))}if(d!==null){var X=o.baseState;y=0,Y=_=w=null,b=d;do{var $=b.lane&-536870913,K=$!==b.lane;if(K?(De&$)===$:(i&$)===$){$!==0&&$===ps&&(uu=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var oe=e,be=b;$=t;var Ve=l;switch(be.tag){case 1:if(oe=be.payload,typeof oe=="function"){X=oe.call(Ve,X,$);break e}X=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=be.payload,$=typeof oe=="function"?oe.call(Ve,X,$):oe,$==null)break e;X=v({},X,$);break e;case 2:Ua=!0}}$=b.callback,$!==null&&(e.flags|=64,K&&(e.flags|=8192),K=o.callbacks,K===null?o.callbacks=[$]:K.push($))}else K={lane:$,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(_=Y=K,w=X):Y=Y.next=K,y|=$;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;K=b,b=K.next,K.next=null,o.lastBaseUpdate=K,o.shared.pending=null}}while(!0);Y===null&&(w=X),o.baseState=w,o.firstBaseUpdate=_,o.lastBaseUpdate=Y,d===null&&(o.shared.lanes=0),Ya|=y,e.lanes=y,e.memoizedState=X}}function um(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function dm(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)um(l[e],t)}var xs=T(null),Zr=T(0);function fm(e,t){e=ma,W(Zr,e),W(xs,t),ma=e|t.baseLanes}function du(){W(Zr,ma),W(xs,xs.current)}function fu(){ma=Zr.current,U(xs),U(Zr)}var sn=T(null),En=null;function Ha(e){var t=e.alternate;W(mt,mt.current&1),W(sn,e),En===null&&(t===null||xs.current!==null||t.memoizedState!==null)&&(En=e)}function hu(e){W(mt,mt.current),W(sn,e),En===null&&(En=e)}function hm(e){e.tag===22?(W(mt,mt.current),W(sn,e),En===null&&(En=e)):Ka()}function Ka(){W(mt,mt.current),W(sn,sn.current)}function rn(e){U(sn),En===e&&(En=null),U(mt)}var mt=T(0);function Wr(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||xd(l)||jd(l)))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 ia=0,we=null,Fe=null,vt=null,ec=!1,js=!1,Dl=!1,tc=0,Oi=0,bs=null,qj=0;function dt(){throw Error(c(321))}function mu(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!an(e[l],t[l]))return!1;return!0}function pu(e,t,l,i,o,d){return ia=d,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Vm:Ou,Dl=!1,d=l(i,o),Dl=!1,js&&(d=pm(t,l,i,o)),mm(e),d}function mm(e){k.H=zi;var t=Fe!==null&&Fe.next!==null;if(ia=0,vt=Fe=we=null,ec=!1,Oi=0,bs=null,t)throw Error(c(300));e===null||xt||(e=e.dependencies,e!==null&&Ir(e)&&(xt=!0))}function pm(e,t,l,i){we=e;var o=0;do{if(js&&(bs=null),Oi=0,js=!1,25<=o)throw Error(c(301));if(o+=1,vt=Fe=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}k.H=Jm,d=t(l,i)}while(js);return d}function Bj(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?Mi(t):t,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(we.flags|=1024),t}function yu(){var e=tc!==0;return tc=0,e}function gu(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function vu(e){if(ec){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ec=!1}ia=0,vt=Fe=we=null,js=!1,Oi=tc=0,bs=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?we.memoizedState=vt=e:vt=vt.next=e,vt}function pt(){if(Fe===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=vt===null?we.memoizedState:vt.next;if(t!==null)vt=t,Fe=e;else{if(e===null)throw we.alternate===null?Error(c(467)):Error(c(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},vt===null?we.memoizedState=vt=e:vt=vt.next=e}return vt}function nc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mi(e){var t=Oi;return Oi+=1,bs===null&&(bs=[]),e=sm(bs,e,t),t=we,(vt===null?t.memoizedState:vt.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Vm:Ou),e}function ac(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Mi(e);if(e.$$typeof===B)return Dt(e)}throw Error(c(438,String(e)))}function xu(e){var t=null,l=we.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var i=we.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=nc(),we.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),i=0;i<e;i++)l[i]=ye;return t.index++,l}function ra(e,t){return typeof t=="function"?t(e):t}function lc(e){var t=pt();return ju(t,Fe,e)}function ju(e,t,l){var i=e.queue;if(i===null)throw Error(c(311));i.lastRenderedReducer=l;var o=e.baseQueue,d=i.pending;if(d!==null){if(o!==null){var y=o.next;o.next=d.next,d.next=y}t.baseQueue=o=d,i.pending=null}if(d=e.baseState,o===null)e.memoizedState=d;else{t=o.next;var b=y=null,w=null,_=t,Y=!1;do{var X=_.lane&-536870913;if(X!==_.lane?(De&X)===X:(ia&X)===X){var $=_.revertLane;if($===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),X===ps&&(Y=!0);else if((ia&$)===$){_=_.next,$===ps&&(Y=!0);continue}else X={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=X,y=d):w=w.next=X,we.lanes|=$,Ya|=$;X=_.action,Dl&&l(d,X),d=_.hasEagerState?_.eagerState:l(d,X)}else $={lane:X,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=$,y=d):w=w.next=$,we.lanes|=X,Ya|=X;_=_.next}while(_!==null&&_!==t);if(w===null?y=d:w.next=b,!an(d,e.memoizedState)&&(xt=!0,Y&&(l=ys,l!==null)))throw l;e.memoizedState=d,e.baseState=y,e.baseQueue=w,i.lastRenderedState=d}return o===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function bu(e){var t=pt(),l=t.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=e;var i=l.dispatch,o=l.pending,d=t.memoizedState;if(o!==null){l.pending=null;var y=o=o.next;do d=e(d,y.action),y=y.next;while(y!==o);an(d,t.memoizedState)||(xt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,i]}function ym(e,t,l){var i=we,o=pt(),d=Be;if(d){if(l===void 0)throw Error(c(407));l=l()}else l=t();var y=!an((Fe||o).memoizedState,l);if(y&&(o.memoizedState=l,xt=!0),o=o.queue,Cu(xm.bind(null,i,o,e),[e]),o.getSnapshot!==t||y||vt!==null&&vt.memoizedState.tag&1){if(i.flags|=2048,Ss(9,{destroy:void 0},vm.bind(null,i,o,l,t),null),Je===null)throw Error(c(349));d||(ia&127)!==0||gm(i,t,l)}return l}function gm(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=we.updateQueue,t===null?(t=nc(),we.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function vm(e,t,l,i){t.value=l,t.getSnapshot=i,jm(t)&&bm(e)}function xm(e,t,l){return l(function(){jm(t)&&bm(e)})}function jm(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!an(e,l)}catch{return!0}}function bm(e){var t=El(e,2);t!==null&&Wt(t,e,2)}function Su(e){var t=Kt();if(typeof e=="function"){var l=e;if(e=l(),Dl){Ut(!0);try{l()}finally{Ut(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:e},t}function Sm(e,t,l,i){return e.baseState=l,ju(e,Fe,typeof i=="function"?i:ra)}function Lj(e,t,l,i,o){if(rc(e))throw Error(c(485));if(e=t.action,e!==null){var d={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};k.T!==null?l(!0):d.isTransition=!1,i(d),l=t.pending,l===null?(d.next=t.pending=d,Nm(t,d)):(d.next=l.next,t.pending=l.next=d)}}function Nm(e,t){var l=t.action,i=t.payload,o=e.state;if(t.isTransition){var d=k.T,y={};k.T=y;try{var b=l(o,i),w=k.S;w!==null&&w(y,b),Cm(e,t,b)}catch(_){Nu(e,t,_)}finally{d!==null&&y.types!==null&&(d.types=y.types),k.T=d}}else try{d=l(o,i),Cm(e,t,d)}catch(_){Nu(e,t,_)}}function Cm(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){Em(e,t,i)},function(i){return Nu(e,t,i)}):Em(e,t,l)}function Em(e,t,l){t.status="fulfilled",t.value=l,Tm(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Nm(e,l)))}function Nu(e,t,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=l,Tm(t),t=t.next;while(t!==i)}e.action=null}function Tm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function wm(e,t){return t}function Rm(e,t){if(Be){var l=Je.formState;if(l!==null){e:{var i=we;if(Be){if(et){t:{for(var o=et,d=Cn;o.nodeType!==8;){if(!d){o=null;break t}if(o=Tn(o.nextSibling),o===null){o=null;break t}}d=o.data,o=d==="F!"||d==="F"?o:null}if(o){et=Tn(o.nextSibling),i=o.data==="F!";break e}}La(i)}i=!1}i&&(t=l[0])}}return l=Kt(),l.memoizedState=l.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wm,lastRenderedState:t},l.queue=i,l=Pm.bind(null,we,i),i.dispatch=l,i=Su(!1),d=Au.bind(null,we,!1,i.queue),i=Kt(),o={state:t,dispatch:null,action:e,pending:null},i.queue=o,l=Lj.bind(null,we,o,d,l),o.dispatch=l,i.memoizedState=e,[t,l,!1]}function Am(e){var t=pt();return Om(t,Fe,e)}function Om(e,t,l){if(t=ju(e,t,wm)[0],e=lc(ra)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Mi(t)}catch(y){throw y===gs?Fr:y}else i=t;t=pt();var o=t.queue,d=o.dispatch;return l!==t.memoizedState&&(we.flags|=2048,Ss(9,{destroy:void 0},_j.bind(null,o,l),null)),[i,d,e]}function _j(e,t){e.action=t}function Mm(e){var t=pt(),l=Fe;if(l!==null)return Om(t,l,e);pt(),t=t.memoizedState,l=pt();var i=l.queue.dispatch;return l.memoizedState=e,[t,i,!1]}function Ss(e,t,l,i){return e={tag:e,create:l,deps:i,inst:t,next:null},t=we.updateQueue,t===null&&(t=nc(),we.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,t.lastEffect=e),e}function km(){return pt().memoizedState}function sc(e,t,l,i){var o=Kt();we.flags|=e,o.memoizedState=Ss(1|t,{destroy:void 0},l,i===void 0?null:i)}function ic(e,t,l,i){var o=pt();i=i===void 0?null:i;var d=o.memoizedState.inst;Fe!==null&&i!==null&&mu(i,Fe.memoizedState.deps)?o.memoizedState=Ss(t,d,l,i):(we.flags|=e,o.memoizedState=Ss(1|t,d,l,i))}function zm(e,t){sc(8390656,8,e,t)}function Cu(e,t){ic(2048,8,e,t)}function Uj(e){we.flags|=4;var t=we.updateQueue;if(t===null)t=nc(),we.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Dm(e){var t=pt().memoizedState;return Uj({ref:t,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function qm(e,t){return ic(4,2,e,t)}function Bm(e,t){return ic(4,4,e,t)}function Lm(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _m(e,t,l){l=l!=null?l.concat([e]):null,ic(4,4,Lm.bind(null,t,e),l)}function Eu(){}function Um(e,t){var l=pt();t=t===void 0?null:t;var i=l.memoizedState;return t!==null&&mu(t,i[1])?i[0]:(l.memoizedState=[e,t],e)}function Qm(e,t){var l=pt();t=t===void 0?null:t;var i=l.memoizedState;if(t!==null&&mu(t,i[1]))return i[0];if(i=e(),Dl){Ut(!0);try{e()}finally{Ut(!1)}}return l.memoizedState=[i,t],i}function Tu(e,t,l){return l===void 0||(ia&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=$p(),we.lanes|=e,Ya|=e,l)}function $m(e,t,l,i){return an(l,t)?l:xs.current!==null?(e=Tu(e,l,i),an(e,t)||(xt=!0),e):(ia&42)===0||(ia&1073741824)!==0&&(De&261930)===0?(xt=!0,e.memoizedState=l):(e=$p(),we.lanes|=e,Ya|=e,t)}function Hm(e,t,l,i,o){var d=J.p;J.p=d!==0&&8>d?d:8;var y=k.T,b={};k.T=b,Au(e,!1,t,l);try{var w=o(),_=k.S;if(_!==null&&_(b,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var Y=Dj(w,i);ki(e,t,Y,un(e))}else ki(e,t,i,un(e))}catch(X){ki(e,t,{then:function(){},status:"rejected",reason:X},un())}finally{J.p=d,y!==null&&b.types!==null&&(y.types=b.types),k.T=y}}function Qj(){}function wu(e,t,l,i){if(e.tag!==5)throw Error(c(476));var o=Km(e).queue;Hm(e,o,t,ae,l===null?Qj:function(){return Gm(e),l(i)})}function Km(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gm(e){var t=Km(e);t.next===null&&(t=e.alternate.memoizedState),ki(e,t.next.queue,{},un())}function Ru(){return Dt(Xi)}function Im(){return pt().memoizedState}function Ym(){return pt().memoizedState}function $j(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=un();e=Qa(l);var i=$a(t,e,l);i!==null&&(Wt(i,t,l),wi(i,t,l)),t={cache:au()},e.payload=t;return}t=t.return}}function Hj(e,t,l){var i=un();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},rc(e)?Fm(t,l):(l=Yo(e,t,l,i),l!==null&&(Wt(l,e,i),Xm(l,t,i)))}function Pm(e,t,l){var i=un();ki(e,t,l,i)}function ki(e,t,l,i){var o={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(rc(e))Fm(t,o);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,b=d(y,l);if(o.hasEagerState=!0,o.eagerState=b,an(b,y))return $r(e,t,o,0),Je===null&&Qr(),!1}catch{}finally{}if(l=Yo(e,t,o,i),l!==null)return Wt(l,e,i),Xm(l,t,i),!0}return!1}function Au(e,t,l,i){if(i={lane:2,revertLane:rd(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},rc(e)){if(t)throw Error(c(479))}else t=Yo(e,l,i,2),t!==null&&Wt(t,e,2)}function rc(e){var t=e.alternate;return e===we||t!==null&&t===we}function Fm(e,t){js=ec=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Xm(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,eh(e,l)}}var zi={readContext:Dt,use:ac,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};zi.useEffectEvent=dt;var Vm={readContext:Dt,use:ac,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:zm,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,sc(4194308,4,Lm.bind(null,t,e),l)},useLayoutEffect:function(e,t){return sc(4194308,4,e,t)},useInsertionEffect:function(e,t){sc(4,2,e,t)},useMemo:function(e,t){var l=Kt();t=t===void 0?null:t;var i=e();if(Dl){Ut(!0);try{e()}finally{Ut(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=Kt();if(l!==void 0){var o=l(t);if(Dl){Ut(!0);try{l(t)}finally{Ut(!1)}}}else o=t;return i.memoizedState=i.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},i.queue=e,e=e.dispatch=Hj.bind(null,we,e),[i.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Su(e);var t=e.queue,l=Pm.bind(null,we,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Eu,useDeferredValue:function(e,t){var l=Kt();return Tu(l,e,t)},useTransition:function(){var e=Su(!1);return e=Hm.bind(null,we,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=we,o=Kt();if(Be){if(l===void 0)throw Error(c(407));l=l()}else{if(l=t(),Je===null)throw Error(c(349));(De&127)!==0||gm(i,t,l)}o.memoizedState=l;var d={value:l,getSnapshot:t};return o.queue=d,zm(xm.bind(null,i,d,e),[e]),i.flags|=2048,Ss(9,{destroy:void 0},vm.bind(null,i,d,l,t),null),l},useId:function(){var e=Kt(),t=Je.identifierPrefix;if(Be){var l=Pn,i=Yn;l=(i&~(1<<32-nn(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=tc++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=qj++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ru,useFormState:Rm,useActionState:Rm,useOptimistic:function(e){var t=Kt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Au.bind(null,we,!0,l),l.dispatch=t,[e,t]},useMemoCache:xu,useCacheRefresh:function(){return Kt().memoizedState=$j.bind(null,we)},useEffectEvent:function(e){var t=Kt(),l={impl:e};return t.memoizedState=l,function(){if((Qe&2)!==0)throw Error(c(440));return l.impl.apply(void 0,arguments)}}},Ou={readContext:Dt,use:ac,useCallback:Um,useContext:Dt,useEffect:Cu,useImperativeHandle:_m,useInsertionEffect:qm,useLayoutEffect:Bm,useMemo:Qm,useReducer:lc,useRef:km,useState:function(){return lc(ra)},useDebugValue:Eu,useDeferredValue:function(e,t){var l=pt();return $m(l,Fe.memoizedState,e,t)},useTransition:function(){var e=lc(ra)[0],t=pt().memoizedState;return[typeof e=="boolean"?e:Mi(e),t]},useSyncExternalStore:ym,useId:Im,useHostTransitionStatus:Ru,useFormState:Am,useActionState:Am,useOptimistic:function(e,t){var l=pt();return Sm(l,Fe,e,t)},useMemoCache:xu,useCacheRefresh:Ym};Ou.useEffectEvent=Dm;var Jm={readContext:Dt,use:ac,useCallback:Um,useContext:Dt,useEffect:Cu,useImperativeHandle:_m,useInsertionEffect:qm,useLayoutEffect:Bm,useMemo:Qm,useReducer:bu,useRef:km,useState:function(){return bu(ra)},useDebugValue:Eu,useDeferredValue:function(e,t){var l=pt();return Fe===null?Tu(l,e,t):$m(l,Fe.memoizedState,e,t)},useTransition:function(){var e=bu(ra)[0],t=pt().memoizedState;return[typeof e=="boolean"?e:Mi(e),t]},useSyncExternalStore:ym,useId:Im,useHostTransitionStatus:Ru,useFormState:Mm,useActionState:Mm,useOptimistic:function(e,t){var l=pt();return Fe!==null?Sm(l,Fe,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:xu,useCacheRefresh:Ym};Jm.useEffectEvent=Dm;function Mu(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var ku={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=un(),o=Qa(i);o.payload=t,l!=null&&(o.callback=l),t=$a(e,o,i),t!==null&&(Wt(t,e,i),wi(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=un(),o=Qa(i);o.tag=1,o.payload=t,l!=null&&(o.callback=l),t=$a(e,o,i),t!==null&&(Wt(t,e,i),wi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=un(),i=Qa(l);i.tag=2,t!=null&&(i.callback=t),t=$a(e,i,l),t!==null&&(Wt(t,e,l),wi(t,e,l))}};function Zm(e,t,l,i,o,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,d,y):t.prototype&&t.prototype.isPureReactComponent?!xi(l,i)||!xi(o,d):!0}function Wm(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&ku.enqueueReplaceState(t,t.state,null)}function ql(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var o in e)l[o]===void 0&&(l[o]=e[o])}return l}function ep(e){Ur(e)}function tp(e){console.error(e)}function np(e){Ur(e)}function cc(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function ap(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function zu(e,t,l){return l=Qa(l),l.tag=3,l.payload={element:null},l.callback=function(){cc(e,t)},l}function lp(e){return e=Qa(e),e.tag=3,e}function sp(e,t,l,i){var o=l.type.getDerivedStateFromError;if(typeof o=="function"){var d=i.value;e.payload=function(){return o(d)},e.callback=function(){ap(t,l,i)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){ap(t,l,i),typeof o!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function Kj(e,t,l,i,o){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&ms(t,l,o,!0),l=sn.current,l!==null){switch(l.tag){case 31:case 13:return En===null?jc():l.alternate===null&&ft===0&&(ft=3),l.flags&=-257,l.flags|=65536,l.lanes=o,i===Xr?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),ld(e,i,o)),!1;case 22:return l.flags|=65536,i===Xr?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),ld(e,i,o)),!1}throw Error(c(435,l.tag))}return ld(e,i,o),jc(),!1}if(Be)return t=sn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,i!==Zo&&(e=Error(c(422),{cause:i}),Si(bn(e,l)))):(i!==Zo&&(t=Error(c(423),{cause:i}),Si(bn(t,l))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,i=bn(i,l),o=zu(e.stateNode,i,o),ou(e,o),ft!==4&&(ft=2)),!1;var d=Error(c(520),{cause:i});if(d=bn(d,l),$i===null?$i=[d]:$i.push(d),ft!==4&&(ft=2),t===null)return!0;i=bn(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=o&-o,l.lanes|=e,e=zu(l.stateNode,i,e),ou(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Pa===null||!Pa.has(d))))return l.flags|=65536,o&=-o,l.lanes|=o,o=lp(o),sp(o,e,l,i),ou(l,o),!1}l=l.return}while(l!==null);return!1}var Du=Error(c(461)),xt=!1;function qt(e,t,l,i){t.child=e===null?om(t,null,l,i):zl(t,e.child,l,i)}function ip(e,t,l,i,o){l=l.render;var d=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Al(t),i=pu(e,t,l,y,d,o),b=yu(),e!==null&&!xt?(gu(e,t,o),ca(e,t,o)):(Be&&b&&Vo(t),t.flags|=1,qt(e,t,i,o),t.child)}function rp(e,t,l,i,o){if(e===null){var d=l.type;return typeof d=="function"&&!Po(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,cp(e,t,d,i,o)):(e=Kr(l.type,null,i,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Hu(e,o)){var y=d.memoizedProps;if(l=l.compare,l=l!==null?l:xi,l(y,i)&&e.ref===t.ref)return ca(e,t,o)}return t.flags|=1,e=na(d,i),e.ref=t.ref,e.return=t,t.child=e}function cp(e,t,l,i,o){if(e!==null){var d=e.memoizedProps;if(xi(d,i)&&e.ref===t.ref)if(xt=!1,t.pendingProps=i=d,Hu(e,o))(e.flags&131072)!==0&&(xt=!0);else return t.lanes=e.lanes,ca(e,t,o)}return qu(e,t,l,i,o)}function op(e,t,l,i){var o=i.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(i=t.child=e.child,o=0;i!==null;)o=o|i.lanes|i.childLanes,i=i.sibling;i=o&~d}else i=0,t.child=null;return up(e,t,d,l,i)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Pr(t,d!==null?d.cachePool:null),d!==null?fm(t,d):du(),hm(t);else return i=t.lanes=536870912,up(e,t,d!==null?d.baseLanes|l:l,l,i)}else d!==null?(Pr(t,d.cachePool),fm(t,d),Ka(),t.memoizedState=null):(e!==null&&Pr(t,null),du(),Ka());return qt(e,t,o,l),t.child}function Di(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function up(e,t,l,i,o){var d=su();return d=d===null?null:{parent:gt._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Pr(t,null),du(),hm(t),e!==null&&ms(e,t,i,!0),t.childLanes=o,null}function oc(e,t){return t=dc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function dp(e,t,l){return zl(t,e.child,null,l),e=oc(t,t.pendingProps),e.flags|=2,rn(t),t.memoizedState=null,e}function Gj(e,t,l){var i=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Be){if(i.mode==="hidden")return e=oc(t,i),t.lanes=536870912,Di(null,e);if(hu(t),(e=et)?(e=Ny(e,Cn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qa!==null?{id:Yn,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},l=Fh(e),l.return=t,t.child=l,zt=t,et=null)):e=null,e===null)throw La(t);return t.lanes=536870912,null}return oc(t,i)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(hu(t),o)if(t.flags&256)t.flags&=-257,t=dp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(xt||ms(e,t,l,!1),o=(l&e.childLanes)!==0,xt||o){if(i=Je,i!==null&&(y=th(i,l),y!==0&&y!==d.retryLane))throw d.retryLane=y,El(e,y),Wt(i,e,y),Du;jc(),t=dp(e,t,l)}else e=d.treeContext,et=Tn(y.nextSibling),zt=t,Be=!0,Ba=null,Cn=!1,e!==null&&Jh(t,e),t=oc(t,i),t.flags|=4096;return t}return e=na(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(c(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function qu(e,t,l,i,o){return Al(t),l=pu(e,t,l,i,void 0,o),i=yu(),e!==null&&!xt?(gu(e,t,o),ca(e,t,o)):(Be&&i&&Vo(t),t.flags|=1,qt(e,t,l,o),t.child)}function fp(e,t,l,i,o,d){return Al(t),t.updateQueue=null,l=pm(t,i,l,o),mm(e),i=yu(),e!==null&&!xt?(gu(e,t,d),ca(e,t,d)):(Be&&i&&Vo(t),t.flags|=1,qt(e,t,l,d),t.child)}function hp(e,t,l,i,o){if(Al(t),t.stateNode===null){var d=us,y=l.contextType;typeof y=="object"&&y!==null&&(d=Dt(y)),d=new l(i,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ku,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=i,d.state=t.memoizedState,d.refs={},ru(t),y=l.contextType,d.context=typeof y=="object"&&y!==null?Dt(y):us,d.state=t.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Mu(t,l,y,i),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&ku.enqueueReplaceState(d,d.state,null),Ai(t,i,d,o),Ri(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){d=t.stateNode;var b=t.memoizedProps,w=ql(l,b);d.props=w;var _=d.context,Y=l.contextType;y=us,typeof Y=="object"&&Y!==null&&(y=Dt(Y));var X=l.getDerivedStateFromProps;Y=typeof X=="function"||typeof d.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b||_!==y)&&Wm(t,d,i,y),Ua=!1;var $=t.memoizedState;d.state=$,Ai(t,i,d,o),Ri(),_=t.memoizedState,b||$!==_||Ua?(typeof X=="function"&&(Mu(t,l,X,i),_=t.memoizedState),(w=Ua||Zm(t,l,w,i,$,_,y))?(Y||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=_),d.props=i,d.state=_,d.context=y,i=w):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{d=t.stateNode,cu(e,t),y=t.memoizedProps,Y=ql(l,y),d.props=Y,X=t.pendingProps,$=d.context,_=l.contextType,w=us,typeof _=="object"&&_!==null&&(w=Dt(_)),b=l.getDerivedStateFromProps,(_=typeof b=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==X||$!==w)&&Wm(t,d,i,w),Ua=!1,$=t.memoizedState,d.state=$,Ai(t,i,d,o),Ri();var K=t.memoizedState;y!==X||$!==K||Ua||e!==null&&e.dependencies!==null&&Ir(e.dependencies)?(typeof b=="function"&&(Mu(t,l,b,i),K=t.memoizedState),(Y=Ua||Zm(t,l,Y,i,$,K,w)||e!==null&&e.dependencies!==null&&Ir(e.dependencies))?(_||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(i,K,w),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(i,K,w)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=K),d.props=i,d.state=K,d.context=w,i=Y):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),i=!1)}return d=i,uc(e,t),i=(t.flags&128)!==0,d||i?(d=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&i?(t.child=zl(t,e.child,null,o),t.child=zl(t,null,l,o)):qt(e,t,l,o),t.memoizedState=d.state,e=t.child):e=ca(e,t,o),e}function mp(e,t,l,i){return wl(),t.flags|=256,qt(e,t,l,i),t.child}var Bu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Lu(e){return{baseLanes:e,cachePool:am()}}function _u(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=on),e}function pp(e,t,l){var i=t.pendingProps,o=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(mt.current&2)!==0),y&&(o=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Be){if(o?Ha(t):Ka(),(e=et)?(e=Ny(e,Cn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qa!==null?{id:Yn,overflow:Pn}:null,retryLane:536870912,hydrationErrors:null},l=Fh(e),l.return=t,t.child=l,zt=t,et=null)):e=null,e===null)throw La(t);return jd(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,o?(Ka(),o=t.mode,b=dc({mode:"hidden",children:b},o),i=Tl(i,o,l,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=Lu(l),i.childLanes=_u(e,y,l),t.memoizedState=Bu,Di(null,i)):(Ha(t),Uu(t,b))}var w=e.memoizedState;if(w!==null&&(b=w.dehydrated,b!==null)){if(d)t.flags&256?(Ha(t),t.flags&=-257,t=Qu(e,t,l)):t.memoizedState!==null?(Ka(),t.child=e.child,t.flags|=128,t=null):(Ka(),b=i.fallback,o=t.mode,i=dc({mode:"visible",children:i.children},o),b=Tl(b,o,l,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,zl(t,e.child,null,l),i=t.child,i.memoizedState=Lu(l),i.childLanes=_u(e,y,l),t.memoizedState=Bu,t=Di(null,i));else if(Ha(t),jd(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var _=y.dgst;y=_,i=Error(c(419)),i.stack="",i.digest=y,Si({value:i,source:null,stack:null}),t=Qu(e,t,l)}else if(xt||ms(e,t,l,!1),y=(l&e.childLanes)!==0,xt||y){if(y=Je,y!==null&&(i=th(y,l),i!==0&&i!==w.retryLane))throw w.retryLane=i,El(e,i),Wt(y,e,i),Du;xd(b)||jc(),t=Qu(e,t,l)}else xd(b)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,et=Tn(b.nextSibling),zt=t,Be=!0,Ba=null,Cn=!1,e!==null&&Jh(t,e),t=Uu(t,i.children),t.flags|=4096);return t}return o?(Ka(),b=i.fallback,o=t.mode,w=e.child,_=w.sibling,i=na(w,{mode:"hidden",children:i.children}),i.subtreeFlags=w.subtreeFlags&65011712,_!==null?b=na(_,b):(b=Tl(b,o,l,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,Di(null,i),i=t.child,b=e.child.memoizedState,b===null?b=Lu(l):(o=b.cachePool,o!==null?(w=gt._currentValue,o=o.parent!==w?{parent:w,pool:w}:o):o=am(),b={baseLanes:b.baseLanes|l,cachePool:o}),i.memoizedState=b,i.childLanes=_u(e,y,l),t.memoizedState=Bu,Di(e.child,i)):(Ha(t),l=e.child,e=l.sibling,l=na(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=l,t.memoizedState=null,l)}function Uu(e,t){return t=dc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function dc(e,t){return e=ln(22,e,null,t),e.lanes=0,e}function Qu(e,t,l){return zl(t,e.child,null,l),e=Uu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yp(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),tu(e.return,t,l)}function $u(e,t,l,i,o,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:o,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=l,y.tailMode=o,y.treeForkCount=d)}function gp(e,t,l){var i=t.pendingProps,o=i.revealOrder,d=i.tail;i=i.children;var y=mt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,W(mt,y),qt(e,t,i,l),i=Be?bi:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yp(e,l,t);else if(e.tag===19)yp(e,l,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(o){case"forwards":for(l=t.child,o=null;l!==null;)e=l.alternate,e!==null&&Wr(e)===null&&(o=l),l=l.sibling;l=o,l===null?(o=t.child,t.child=null):(o=l.sibling,l.sibling=null),$u(t,!1,o,l,d,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Wr(e)===null){t.child=o;break}e=o.sibling,o.sibling=l,l=o,o=e}$u(t,!0,l,null,d,i);break;case"together":$u(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function ca(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Ya|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(ms(e,t,l,!1),(l&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,l=na(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=na(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Hu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ir(e)))}function Ij(e,t,l){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),_a(t,gt,e.memoizedState.cache),wl();break;case 27:case 5:Ze(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:_a(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,hu(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ha(t),t.flags|=128,null):(l&t.child.childLanes)!==0?pp(e,t,l):(Ha(t),e=ca(e,t,l),e!==null?e.sibling:null);Ha(t);break;case 19:var o=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(ms(e,t,l,!1),i=(l&t.childLanes)!==0),o){if(i)return gp(e,t,l);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),W(mt,mt.current),i)break;return null;case 22:return t.lanes=0,op(e,t,l,t.pendingProps);case 24:_a(t,gt,e.memoizedState.cache)}return ca(e,t,l)}function vp(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)xt=!0;else{if(!Hu(e,l)&&(t.flags&128)===0)return xt=!1,Ij(e,t,l);xt=(e.flags&131072)!==0}else xt=!1,Be&&(t.flags&1048576)!==0&&Vh(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Ml(t.elementType),t.type=e,typeof e=="function")Po(e)?(i=ql(e,i),t.tag=1,t=hp(null,t,e,i,l)):(t.tag=0,t=qu(null,t,e,i,l));else{if(e!=null){var o=e.$$typeof;if(o===z){t.tag=11,t=ip(null,t,e,i,l);break e}else if(o===Z){t.tag=14,t=rp(null,t,e,i,l);break e}}throw t=Te(e)||e,Error(c(306,t,""))}}return t;case 0:return qu(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,o=ql(i,t.pendingProps),hp(e,t,i,o,l);case 3:e:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(c(387));i=t.pendingProps;var d=t.memoizedState;o=d.element,cu(e,t),Ai(t,i,null,l);var y=t.memoizedState;if(i=y.cache,_a(t,gt,i),i!==d.cache&&nu(t,[gt],l,!0),Ri(),i=y.element,d.isDehydrated)if(d={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=mp(e,t,i,l);break e}else if(i!==o){o=bn(Error(c(424)),t),Si(o),t=mp(e,t,i,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(et=Tn(e.firstChild),zt=t,Be=!0,Ba=null,Cn=!0,l=om(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(wl(),i===o){t=ca(e,t,l);break e}qt(e,t,i,l)}t=t.child}return t;case 26:return uc(e,t),e===null?(l=Ay(t.type,null,t.pendingProps,null))?t.memoizedState=l:Be||(l=t.type,e=t.pendingProps,i=wc(ce.current).createElement(l),i[kt]=t,i[Pt]=e,Bt(i,l,e),Rt(i),t.stateNode=i):t.memoizedState=Ay(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ze(t),e===null&&Be&&(i=t.stateNode=Ty(t.type,t.pendingProps,ce.current),zt=t,Cn=!0,o=et,Ja(t.type)?(bd=o,et=Tn(i.firstChild)):et=o),qt(e,t,t.pendingProps.children,l),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Be&&((o=i=et)&&(i=bb(i,t.type,t.pendingProps,Cn),i!==null?(t.stateNode=i,zt=t,et=Tn(i.firstChild),Cn=!1,o=!0):o=!1),o||La(t)),Ze(t),o=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,i=d.children,yd(o,d)?i=null:y!==null&&yd(o,y)&&(t.flags|=32),t.memoizedState!==null&&(o=pu(e,t,Bj,null,null,l),Xi._currentValue=o),uc(e,t),qt(e,t,i,l),t.child;case 6:return e===null&&Be&&((e=l=et)&&(l=Sb(l,t.pendingProps,Cn),l!==null?(t.stateNode=l,zt=t,et=null,e=!0):e=!1),e||La(t)),null;case 13:return pp(e,t,l);case 4:return le(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=zl(t,null,i,l):qt(e,t,i,l),t.child;case 11:return ip(e,t,t.type,t.pendingProps,l);case 7:return qt(e,t,t.pendingProps,l),t.child;case 8:return qt(e,t,t.pendingProps.children,l),t.child;case 12:return qt(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,_a(t,t.type,i.value),qt(e,t,i.children,l),t.child;case 9:return o=t.type._context,i=t.pendingProps.children,Al(t),o=Dt(o),i=i(o),t.flags|=1,qt(e,t,i,l),t.child;case 14:return rp(e,t,t.type,t.pendingProps,l);case 15:return cp(e,t,t.type,t.pendingProps,l);case 19:return gp(e,t,l);case 31:return Gj(e,t,l);case 22:return op(e,t,l,t.pendingProps);case 24:return Al(t),i=Dt(gt),e===null?(o=su(),o===null&&(o=Je,d=au(),o.pooledCache=d,d.refCount++,d!==null&&(o.pooledCacheLanes|=l),o=d),t.memoizedState={parent:i,cache:o},ru(t),_a(t,gt,o)):((e.lanes&l)!==0&&(cu(e,t),Ai(t,null,null,l),Ri()),o=e.memoizedState,d=t.memoizedState,o.parent!==i?(o={parent:i,cache:i},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),_a(t,gt,i)):(i=d.cache,_a(t,gt,i),i!==o.cache&&nu(t,[gt],l,!0))),qt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function oa(e){e.flags|=4}function Ku(e,t,l,i,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Ip())e.flags|=8192;else throw kl=Xr,iu}else e.flags&=-16777217}function xp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Dy(t))if(Ip())e.flags|=8192;else throw kl=Xr,iu}function fc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Zf():536870912,e.lanes|=t,Ts|=t)}function qi(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function tt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags&65011712,i|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags,i|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function Yj(e,t,l){var i=t.pendingProps;switch(Jo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(t),null;case 1:return tt(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),sa(gt),de(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(hs(t)?oa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Wo())),tt(t),null;case 26:var o=t.type,d=t.memoizedState;return e===null?(oa(t),d!==null?(tt(t),xp(t,d)):(tt(t),Ku(t,o,null,i,l))):d?d!==e.memoizedState?(oa(t),tt(t),xp(t,d)):(tt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&oa(t),tt(t),Ku(t,o,e,i,l)),null;case 27:if(ut(t),l=ce.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&oa(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return tt(t),null}e=se.current,hs(t)?Zh(t):(e=Ty(o,i,l),t.stateNode=e,oa(t))}return tt(t),null;case 5:if(ut(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&oa(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return tt(t),null}if(d=se.current,hs(t))Zh(t);else{var y=wc(ce.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?d.multiple=!0:i.size&&(d.size=i.size);break;default:d=typeof i.is=="string"?y.createElement(o,{is:i.is}):y.createElement(o)}}d[kt]=t,d[Pt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=d;e:switch(Bt(d,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&oa(t)}}return tt(t),Ku(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&oa(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(e=ce.current,hs(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,o=zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}e[kt]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||py(e.nodeValue,l)),e||La(t,!0)}else e=wc(e).createTextNode(i),e[kt]=t,t.stateNode=e}return tt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=hs(t),l!==null){if(e===null){if(!i)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[kt]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tt(t),e=!1}else l=Wo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(rn(t),t):(rn(t),null);if((t.flags&128)!==0)throw Error(c(558))}return tt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=hs(t),i!==null&&i.dehydrated!==null){if(e===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[kt]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tt(t),o=!1}else o=Wo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(rn(t),t):(rn(t),null)}return rn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==o&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),fc(t,t.updateQueue),tt(t),null);case 4:return de(),e===null&&dd(t.stateNode.containerInfo),tt(t),null;case 10:return sa(t.type),tt(t),null;case 19:if(U(mt),i=t.memoizedState,i===null)return tt(t),null;if(o=(t.flags&128)!==0,d=i.rendering,d===null)if(o)qi(i,!1);else{if(ft!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Wr(e),d!==null){for(t.flags|=128,qi(i,!1),e=d.updateQueue,t.updateQueue=e,fc(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Ph(l,e),l=l.sibling;return W(mt,mt.current&1|2),Be&&aa(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&rt()>gc&&(t.flags|=128,o=!0,qi(i,!1),t.lanes=4194304)}else{if(!o)if(e=Wr(d),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,fc(t,e),qi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!d.alternate&&!Be)return tt(t),null}else 2*rt()-i.renderingStartTime>gc&&l!==536870912&&(t.flags|=128,o=!0,qi(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(e=i.last,e!==null?e.sibling=d:t.child=d,i.last=d)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=rt(),e.sibling=null,l=mt.current,W(mt,o?l&1|2:l&1),Be&&aa(t,i.treeForkCount),e):(tt(t),null);case 22:case 23:return rn(t),fu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),l=t.updateQueue,l!==null&&fc(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&U(Ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),sa(gt),tt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Pj(e,t){switch(Jo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(gt),de(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ut(t),null;case 31:if(t.memoizedState!==null){if(rn(t),t.alternate===null)throw Error(c(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(rn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(mt),null;case 4:return de(),null;case 10:return sa(t.type),null;case 22:case 23:return rn(t),fu(),e!==null&&U(Ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(gt),null;case 25:return null;default:return null}}function jp(e,t){switch(Jo(t),t.tag){case 3:sa(gt),de();break;case 26:case 27:case 5:ut(t);break;case 4:de();break;case 31:t.memoizedState!==null&&rn(t);break;case 13:rn(t);break;case 19:U(mt);break;case 10:sa(t.type);break;case 22:case 23:rn(t),fu(),e!==null&&U(Ol);break;case 24:sa(gt)}}function Bi(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var o=i.next;l=o;do{if((l.tag&e)===e){i=void 0;var d=l.create,y=l.inst;i=d(),y.destroy=i}l=l.next}while(l!==o)}}catch(b){Ge(t,t.return,b)}}function Ga(e,t,l){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var d=o.next;i=d;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,o=t;var w=l,_=b;try{_()}catch(Y){Ge(o,w,Y)}}}i=i.next}while(i!==d)}}catch(Y){Ge(t,t.return,Y)}}function bp(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{dm(t,l)}catch(i){Ge(e,e.return,i)}}}function Sp(e,t,l){l.props=ql(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){Ge(e,t,i)}}function Li(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(o){Ge(e,t,o)}}function Fn(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(o){Ge(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(o){Ge(e,t,o)}else l.current=null}function Np(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(o){Ge(e,e.return,o)}}function Gu(e,t,l){try{var i=e.stateNode;pb(i,e.type,l,t),i[Pt]=t}catch(o){Ge(e,e.return,o)}}function Cp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ja(e.type)||e.tag===4}function Iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cp(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&&Ja(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 Yu(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ea));else if(i!==4&&(i===27&&Ja(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Yu(e,t,l),e=e.sibling;e!==null;)Yu(e,t,l),e=e.sibling}function hc(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&Ja(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(hc(e,t,l),e=e.sibling;e!==null;)hc(e,t,l),e=e.sibling}function Ep(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Bt(t,i,l),t[kt]=e,t[Pt]=l}catch(d){Ge(e,e.return,d)}}var ua=!1,jt=!1,Pu=!1,Tp=typeof WeakSet=="function"?WeakSet:Set,At=null;function Fj(e,t){if(e=e.containerInfo,md=Dc,e=_h(e),Qo(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var o=i.anchorOffset,d=i.focusNode;i=i.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var y=0,b=-1,w=-1,_=0,Y=0,X=e,$=null;t:for(;;){for(var K;X!==l||o!==0&&X.nodeType!==3||(b=y+o),X!==d||i!==0&&X.nodeType!==3||(w=y+i),X.nodeType===3&&(y+=X.nodeValue.length),(K=X.firstChild)!==null;)$=X,X=K;for(;;){if(X===e)break t;if($===l&&++_===o&&(b=y),$===d&&++Y===i&&(w=y),(K=X.nextSibling)!==null)break;X=$,$=X.parentNode}X=K}l=b===-1||w===-1?null:{start:b,end:w}}else l=null}l=l||{start:0,end:0}}else l=null;for(pd={focusedElem:e,selectionRange:l},Dc=!1,At=t;At!==null;)if(t=At,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,At=e;else for(;At!==null;){switch(t=At,d=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(l=0;l<e.length;l++)o=e[l],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,o=d.memoizedProps,d=d.memoizedState,i=l.stateNode;try{var oe=ql(l.type,o);e=i.getSnapshotBeforeUpdate(oe,d),i.__reactInternalSnapshotBeforeUpdate=e}catch(be){Ge(l,l.return,be)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)vd(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vd(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,At=e;break}At=t.return}}function wp(e,t,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:fa(e,l),i&4&&Bi(5,l);break;case 1:if(fa(e,l),i&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(y){Ge(l,l.return,y)}else{var o=ql(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ge(l,l.return,y)}}i&64&&bp(l),i&512&&Li(l,l.return);break;case 3:if(fa(e,l),i&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{dm(e,t)}catch(y){Ge(l,l.return,y)}}break;case 27:t===null&&i&4&&Ep(l);case 26:case 5:fa(e,l),t===null&&i&4&&Np(l),i&512&&Li(l,l.return);break;case 12:fa(e,l);break;case 31:fa(e,l),i&4&&Op(e,l);break;case 13:fa(e,l),i&4&&Mp(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=ab.bind(null,l),Nb(e,l))));break;case 22:if(i=l.memoizedState!==null||ua,!i){t=t!==null&&t.memoizedState!==null||jt,o=ua;var d=jt;ua=i,(jt=t)&&!d?ha(e,l,(l.subtreeFlags&8772)!==0):fa(e,l),ua=o,jt=d}break;case 30:break;default:fa(e,l)}}function Rp(e){var t=e.alternate;t!==null&&(e.alternate=null,Rp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&No(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 lt=null,Xt=!1;function da(e,t,l){for(l=l.child;l!==null;)Ap(e,t,l),l=l.sibling}function Ap(e,t,l){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(gn,l)}catch{}switch(l.tag){case 26:jt||Fn(l,t),da(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:jt||Fn(l,t);var i=lt,o=Xt;Ja(l.type)&&(lt=l.stateNode,Xt=!1),da(e,t,l),Yi(l.stateNode),lt=i,Xt=o;break;case 5:jt||Fn(l,t);case 6:if(i=lt,o=Xt,lt=null,da(e,t,l),lt=i,Xt=o,lt!==null)if(Xt)try{(lt.nodeType===9?lt.body:lt.nodeName==="HTML"?lt.ownerDocument.body:lt).removeChild(l.stateNode)}catch(d){Ge(l,t,d)}else try{lt.removeChild(l.stateNode)}catch(d){Ge(l,t,d)}break;case 18:lt!==null&&(Xt?(e=lt,by(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Ds(e)):by(lt,l.stateNode));break;case 4:i=lt,o=Xt,lt=l.stateNode.containerInfo,Xt=!0,da(e,t,l),lt=i,Xt=o;break;case 0:case 11:case 14:case 15:Ga(2,l,t),jt||Ga(4,l,t),da(e,t,l);break;case 1:jt||(Fn(l,t),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Sp(l,t,i)),da(e,t,l);break;case 21:da(e,t,l);break;case 22:jt=(i=jt)||l.memoizedState!==null,da(e,t,l),jt=i;break;default:da(e,t,l)}}function Op(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ds(e)}catch(l){Ge(t,t.return,l)}}}function Mp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ds(e)}catch(l){Ge(t,t.return,l)}}function Xj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Tp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Tp),t;default:throw Error(c(435,e.tag))}}function mc(e,t){var l=Xj(e);t.forEach(function(i){if(!l.has(i)){l.add(i);var o=lb.bind(null,e,i);i.then(o,o)}})}function Vt(e,t){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var o=l[i],d=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(Ja(b.type)){lt=b.stateNode,Xt=!1;break e}break;case 5:lt=b.stateNode,Xt=!1;break e;case 3:case 4:lt=b.stateNode.containerInfo,Xt=!0;break e}b=b.return}if(lt===null)throw Error(c(160));Ap(d,y,o),lt=null,Xt=!1,d=o.alternate,d!==null&&(d.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)kp(t,e),t=t.sibling}var Un=null;function kp(e,t){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vt(t,e),Jt(e),i&4&&(Ga(3,e,e.return),Bi(3,e),Ga(5,e,e.return));break;case 1:Vt(t,e),Jt(e),i&512&&(jt||l===null||Fn(l,l.return)),i&64&&ua&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var o=Un;if(Vt(t,e),Jt(e),i&512&&(jt||l===null||Fn(l,l.return)),i&4){var d=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,o=o.ownerDocument||o;t:switch(i){case"title":d=o.getElementsByTagName("title")[0],(!d||d[ui]||d[kt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=o.createElement(i),o.head.insertBefore(d,o.querySelector("head > title"))),Bt(d,i,l),d[kt]=e,Rt(d),i=d;break e;case"link":var y=ky("link","href",o).get(i+(l.href||""));if(y){for(var b=0;b<y.length;b++)if(d=y[b],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){y.splice(b,1);break t}}d=o.createElement(i),Bt(d,i,l),o.head.appendChild(d);break;case"meta":if(y=ky("meta","content",o).get(i+(l.content||""))){for(b=0;b<y.length;b++)if(d=y[b],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){y.splice(b,1);break t}}d=o.createElement(i),Bt(d,i,l),o.head.appendChild(d);break;default:throw Error(c(468,i))}d[kt]=e,Rt(d),i=d}e.stateNode=i}else zy(o,e.type,e.stateNode);else e.stateNode=My(o,i,e.memoizedProps);else d!==i?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,i===null?zy(o,e.type,e.stateNode):My(o,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Gu(e,e.memoizedProps,l.memoizedProps)}break;case 27:Vt(t,e),Jt(e),i&512&&(jt||l===null||Fn(l,l.return)),l!==null&&i&4&&Gu(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Vt(t,e),Jt(e),i&512&&(jt||l===null||Fn(l,l.return)),e.flags&32){o=e.stateNode;try{as(o,"")}catch(oe){Ge(e,e.return,oe)}}i&4&&e.stateNode!=null&&(o=e.memoizedProps,Gu(e,o,l!==null?l.memoizedProps:o)),i&1024&&(Pu=!0);break;case 6:if(Vt(t,e),Jt(e),i&4){if(e.stateNode===null)throw Error(c(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(oe){Ge(e,e.return,oe)}}break;case 3:if(Oc=null,o=Un,Un=Rc(t.containerInfo),Vt(t,e),Un=o,Jt(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Ds(t.containerInfo)}catch(oe){Ge(e,e.return,oe)}Pu&&(Pu=!1,zp(e));break;case 4:i=Un,Un=Rc(e.stateNode.containerInfo),Vt(t,e),Jt(e),Un=i;break;case 12:Vt(t,e),Jt(e);break;case 31:Vt(t,e),Jt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,mc(e,i)));break;case 13:Vt(t,e),Jt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(yc=rt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,mc(e,i)));break;case 22:o=e.memoizedState!==null;var w=l!==null&&l.memoizedState!==null,_=ua,Y=jt;if(ua=_||o,jt=Y||w,Vt(t,e),jt=Y,ua=_,Jt(e),i&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(l===null||w||ua||jt||Bl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){w=l=t;try{if(d=w.stateNode,o)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=w.stateNode;var X=w.memoizedProps.style,$=X!=null&&X.hasOwnProperty("display")?X.display:null;b.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(oe){Ge(w,w.return,oe)}}}else if(t.tag===6){if(l===null){w=t;try{w.stateNode.nodeValue=o?"":w.memoizedProps}catch(oe){Ge(w,w.return,oe)}}}else if(t.tag===18){if(l===null){w=t;try{var K=w.stateNode;o?Sy(K,!0):Sy(w.stateNode,!1)}catch(oe){Ge(w,w.return,oe)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,mc(e,l))));break;case 19:Vt(t,e),Jt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,mc(e,i)));break;case 30:break;case 21:break;default:Vt(t,e),Jt(e)}}function Jt(e){var t=e.flags;if(t&2){try{for(var l,i=e.return;i!==null;){if(Cp(i)){l=i;break}i=i.return}if(l==null)throw Error(c(160));switch(l.tag){case 27:var o=l.stateNode,d=Iu(e);hc(e,d,o);break;case 5:var y=l.stateNode;l.flags&32&&(as(y,""),l.flags&=-33);var b=Iu(e);hc(e,b,y);break;case 3:case 4:var w=l.stateNode.containerInfo,_=Iu(e);Yu(e,_,w);break;default:throw Error(c(161))}}catch(Y){Ge(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;zp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)wp(e,t.alternate,t),t=t.sibling}function Bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ga(4,t,t.return),Bl(t);break;case 1:Fn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Sp(t,t.return,l),Bl(t);break;case 27:Yi(t.stateNode);case 26:case 5:Fn(t,t.return),Bl(t);break;case 22:t.memoizedState===null&&Bl(t);break;case 30:Bl(t);break;default:Bl(t)}e=e.sibling}}function ha(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,o=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:ha(o,d,l),Bi(4,d);break;case 1:if(ha(o,d,l),i=d,o=i.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(_){Ge(i,i.return,_)}if(i=d,o=i.updateQueue,o!==null){var b=i.stateNode;try{var w=o.shared.hiddenCallbacks;if(w!==null)for(o.shared.hiddenCallbacks=null,o=0;o<w.length;o++)um(w[o],b)}catch(_){Ge(i,i.return,_)}}l&&y&64&&bp(d),Li(d,d.return);break;case 27:Ep(d);case 26:case 5:ha(o,d,l),l&&i===null&&y&4&&Np(d),Li(d,d.return);break;case 12:ha(o,d,l);break;case 31:ha(o,d,l),l&&y&4&&Op(o,d);break;case 13:ha(o,d,l),l&&y&4&&Mp(o,d);break;case 22:d.memoizedState===null&&ha(o,d,l),Li(d,d.return);break;case 30:break;default:ha(o,d,l)}t=t.sibling}}function Fu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Ni(l))}function Xu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ni(e))}function Qn(e,t,l,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dp(e,t,l,i),t=t.sibling}function Dp(e,t,l,i){var o=t.flags;switch(t.tag){case 0:case 11:case 15:Qn(e,t,l,i),o&2048&&Bi(9,t);break;case 1:Qn(e,t,l,i);break;case 3:Qn(e,t,l,i),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ni(e)));break;case 12:if(o&2048){Qn(e,t,l,i),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,b=d.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){Ge(t,t.return,w)}}else Qn(e,t,l,i);break;case 31:Qn(e,t,l,i);break;case 13:Qn(e,t,l,i);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?Qn(e,t,l,i):_i(e,t):d._visibility&2?Qn(e,t,l,i):(d._visibility|=2,Ns(e,t,l,i,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Fu(y,t);break;case 24:Qn(e,t,l,i),o&2048&&Xu(t.alternate,t);break;default:Qn(e,t,l,i)}}function Ns(e,t,l,i,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,b=l,w=i,_=y.flags;switch(y.tag){case 0:case 11:case 15:Ns(d,y,b,w,o),Bi(8,y);break;case 23:break;case 22:var Y=y.stateNode;y.memoizedState!==null?Y._visibility&2?Ns(d,y,b,w,o):_i(d,y):(Y._visibility|=2,Ns(d,y,b,w,o)),o&&_&2048&&Fu(y.alternate,y);break;case 24:Ns(d,y,b,w,o),o&&_&2048&&Xu(y.alternate,y);break;default:Ns(d,y,b,w,o)}t=t.sibling}}function _i(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,i=t,o=i.flags;switch(i.tag){case 22:_i(l,i),o&2048&&Fu(i.alternate,i);break;case 24:_i(l,i),o&2048&&Xu(i.alternate,i);break;default:_i(l,i)}t=t.sibling}}var Ui=8192;function Cs(e,t,l){if(e.subtreeFlags&Ui)for(e=e.child;e!==null;)qp(e,t,l),e=e.sibling}function qp(e,t,l){switch(e.tag){case 26:Cs(e,t,l),e.flags&Ui&&e.memoizedState!==null&&qb(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Cs(e,t,l);break;case 3:case 4:var i=Un;Un=Rc(e.stateNode.containerInfo),Cs(e,t,l),Un=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Ui,Ui=16777216,Cs(e,t,l),Ui=i):Cs(e,t,l));break;default:Cs(e,t,l)}}function Bp(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 Qi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];At=i,_p(i,e)}Bp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lp(e),e=e.sibling}function Lp(e){switch(e.tag){case 0:case 11:case 15:Qi(e),e.flags&2048&&Ga(9,e,e.return);break;case 3:Qi(e);break;case 12:Qi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,pc(e)):Qi(e);break;default:Qi(e)}}function pc(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];At=i,_p(i,e)}Bp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ga(8,t,t.return),pc(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,pc(t));break;default:pc(t)}e=e.sibling}}function _p(e,t){for(;At!==null;){var l=At;switch(l.tag){case 0:case 11:case 15:Ga(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Ni(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,At=i;else e:for(l=e;At!==null;){i=At;var o=i.sibling,d=i.return;if(Rp(i),i===l){At=null;break e}if(o!==null){o.return=d,At=o;break e}At=d}}}var Vj={getCacheForType:function(e){var t=Dt(gt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Dt(gt).controller.signal}},Jj=typeof WeakMap=="function"?WeakMap:Map,Qe=0,Je=null,ke=null,De=0,Ke=0,cn=null,Ia=!1,Es=!1,Vu=!1,ma=0,ft=0,Ya=0,Ll=0,Ju=0,on=0,Ts=0,$i=null,Zt=null,Zu=!1,yc=0,Up=0,gc=1/0,vc=null,Pa=null,Nt=0,Fa=null,ws=null,pa=0,Wu=0,ed=null,Qp=null,Hi=0,td=null;function un(){return(Qe&2)!==0&&De!==0?De&-De:k.T!==null?rd():nh()}function $p(){if(on===0)if((De&536870912)===0||Be){var e=Tr;Tr<<=1,(Tr&3932160)===0&&(Tr=262144),on=e}else on=536870912;return e=sn.current,e!==null&&(e.flags|=32),on}function Wt(e,t,l){(e===Je&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Rs(e,0),Xa(e,De,on,!1)),oi(e,l),((Qe&2)===0||e!==Je)&&(e===Je&&((Qe&2)===0&&(Ll|=l),ft===4&&Xa(e,De,on,!1)),Xn(e))}function Hp(e,t,l){if((Qe&6)!==0)throw Error(c(327));var i=!l&&(t&127)===0&&(t&e.expiredLanes)===0||ci(e,t),o=i?eb(e,t):ad(e,t,!0),d=i;do{if(o===0){Es&&!i&&Xa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Zj(l)){o=ad(e,t,!1),d=!1;continue}if(o===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;o=$i;var w=b.current.memoizedState.isDehydrated;if(w&&(Rs(b,y).flags|=256),y=ad(b,y,!1),y!==2){if(Vu&&!w){b.errorRecoveryDisabledLanes|=d,Ll|=d,o=4;break e}d=Zt,Zt=o,d!==null&&(Zt===null?Zt=d:Zt.push.apply(Zt,d))}o=y}if(d=!1,o!==2)continue}}if(o===1){Rs(e,0),Xa(e,t,0,!0);break}e:{switch(i=e,d=o,d){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Xa(i,t,on,!Ia);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(o=yc+300-rt(),10<o)){if(Xa(i,t,on,!Ia),Rr(i,0,!0)!==0)break e;pa=t,i.timeoutHandle=xy(Kp.bind(null,i,l,Zt,vc,Zu,t,on,Ll,Ts,Ia,d,"Throttled",-0,0),o);break e}Kp(i,l,Zt,vc,Zu,t,on,Ll,Ts,Ia,d,null,-0,0)}}break}while(!0);Xn(e)}function Kp(e,t,l,i,o,d,y,b,w,_,Y,X,$,K){if(e.timeoutHandle=-1,X=t.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ea},qp(t,d,X);var oe=(d&62914560)===d?yc-rt():(d&4194048)===d?Up-rt():0;if(oe=Bb(X,oe),oe!==null){pa=d,e.cancelPendingCommit=oe(Jp.bind(null,e,t,d,l,i,o,y,b,w,Y,X,null,$,K)),Xa(e,d,y,!_);return}}Jp(e,t,d,l,i,o,y,b,w)}function Zj(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var o=l[i],d=o.getSnapshot;o=o.value;try{if(!an(d(),o))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 Xa(e,t,l,i){t&=~Ju,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var o=t;0<o;){var d=31-nn(o),y=1<<d;i[d]=-1,o&=~y}l!==0&&Wf(e,l,t)}function xc(){return(Qe&6)===0?(Ki(0),!1):!0}function nd(){if(ke!==null){if(Ke===0)var e=ke.return;else e=ke,la=Rl=null,vu(e),vs=null,Ei=0,e=ke;for(;e!==null;)jp(e.alternate,e),e=e.return;ke=null}}function Rs(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,vb(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),pa=0,nd(),Je=e,ke=l=na(e.current,null),De=t,Ke=0,cn=null,Ia=!1,Es=ci(e,t),Vu=!1,Ts=on=Ju=Ll=Ya=ft=0,Zt=$i=null,Zu=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var o=31-nn(i),d=1<<o;t|=e[o],i&=~d}return ma=t,Qr(),l}function Gp(e,t){we=null,k.H=zi,t===gs||t===Fr?(t=im(),Ke=3):t===iu?(t=im(),Ke=4):Ke=t===Du?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,cn=t,ke===null&&(ft=1,cc(e,bn(t,e.current)))}function Ip(){var e=sn.current;return e===null?!0:(De&4194048)===De?En===null:(De&62914560)===De||(De&536870912)!==0?e===En:!1}function Yp(){var e=k.H;return k.H=zi,e===null?zi:e}function Pp(){var e=k.A;return k.A=Vj,e}function jc(){ft=4,Ia||(De&4194048)!==De&&sn.current!==null||(Es=!0),(Ya&134217727)===0&&(Ll&134217727)===0||Je===null||Xa(Je,De,on,!1)}function ad(e,t,l){var i=Qe;Qe|=2;var o=Yp(),d=Pp();(Je!==e||De!==t)&&(vc=null,Rs(e,t)),t=!1;var y=ft;e:do try{if(Ke!==0&&ke!==null){var b=ke,w=cn;switch(Ke){case 8:nd(),y=6;break e;case 3:case 2:case 9:case 6:sn.current===null&&(t=!0);var _=Ke;if(Ke=0,cn=null,As(e,b,w,_),l&&Es){y=0;break e}break;default:_=Ke,Ke=0,cn=null,As(e,b,w,_)}}Wj(),y=ft;break}catch(Y){Gp(e,Y)}while(!0);return t&&e.shellSuspendCounter++,la=Rl=null,Qe=i,k.H=o,k.A=d,ke===null&&(Je=null,De=0,Qr()),y}function Wj(){for(;ke!==null;)Fp(ke)}function eb(e,t){var l=Qe;Qe|=2;var i=Yp(),o=Pp();Je!==e||De!==t?(vc=null,gc=rt()+500,Rs(e,t)):Es=ci(e,t);e:do try{if(Ke!==0&&ke!==null){t=ke;var d=cn;t:switch(Ke){case 1:Ke=0,cn=null,As(e,t,d,1);break;case 2:case 9:if(lm(d)){Ke=0,cn=null,Xp(t);break}t=function(){Ke!==2&&Ke!==9||Je!==e||(Ke=7),Xn(e)},d.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:lm(d)?(Ke=0,cn=null,Xp(t)):(Ke=0,cn=null,As(e,t,d,7));break;case 5:var y=null;switch(ke.tag){case 26:y=ke.memoizedState;case 5:case 27:var b=ke;if(y?Dy(y):b.stateNode.complete){Ke=0,cn=null;var w=b.sibling;if(w!==null)ke=w;else{var _=b.return;_!==null?(ke=_,bc(_)):ke=null}break t}}Ke=0,cn=null,As(e,t,d,5);break;case 6:Ke=0,cn=null,As(e,t,d,6);break;case 8:nd(),ft=6;break e;default:throw Error(c(462))}}tb();break}catch(Y){Gp(e,Y)}while(!0);return la=Rl=null,k.H=i,k.A=o,Qe=l,ke!==null?0:(Je=null,De=0,Qr(),ft)}function tb(){for(;ke!==null&&!Me();)Fp(ke)}function Fp(e){var t=vp(e.alternate,e,ma);e.memoizedProps=e.pendingProps,t===null?bc(e):ke=t}function Xp(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=fp(l,t,t.pendingProps,t.type,void 0,De);break;case 11:t=fp(l,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:vu(t);default:jp(l,t),t=ke=Ph(t,ma),t=vp(l,t,ma)}e.memoizedProps=e.pendingProps,t===null?bc(e):ke=t}function As(e,t,l,i){la=Rl=null,vu(t),vs=null,Ei=0;var o=t.return;try{if(Kj(e,o,t,l,De)){ft=1,cc(e,bn(l,e.current)),ke=null;return}}catch(d){if(o!==null)throw ke=o,d;ft=1,cc(e,bn(l,e.current)),ke=null;return}t.flags&32768?(Be||i===1?e=!0:Es||(De&536870912)!==0?e=!1:(Ia=e=!0,(i===2||i===9||i===3||i===6)&&(i=sn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Vp(t,e)):bc(t)}function bc(e){var t=e;do{if((t.flags&32768)!==0){Vp(t,Ia);return}e=t.return;var l=Yj(t.alternate,t,ma);if(l!==null){ke=l;return}if(t=t.sibling,t!==null){ke=t;return}ke=t=e}while(t!==null);ft===0&&(ft=5)}function Vp(e,t){do{var l=Pj(e.alternate,e);if(l!==null){l.flags&=32767,ke=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){ke=e;return}ke=e=l}while(e!==null);ft=6,ke=null}function Jp(e,t,l,i,o,d,y,b,w){e.cancelPendingCommit=null;do Sc();while(Nt!==0);if((Qe&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(d=t.lanes|t.childLanes,d|=Io,Dx(e,l,d,y,b,w),e===Je&&(ke=Je=null,De=0),ws=t,Fa=e,pa=l,Wu=d,ed=o,Qp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,sb(xl,function(){return ny(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=k.T,k.T=null,o=J.p,J.p=2,y=Qe,Qe|=4;try{Fj(e,t,l)}finally{Qe=y,J.p=o,k.T=i}}Nt=1,Zp(),Wp(),ey()}}function Zp(){if(Nt===1){Nt=0;var e=Fa,t=ws,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var i=J.p;J.p=2;var o=Qe;Qe|=4;try{kp(t,e);var d=pd,y=_h(e.containerInfo),b=d.focusedElem,w=d.selectionRange;if(y!==b&&b&&b.ownerDocument&&Lh(b.ownerDocument.documentElement,b)){if(w!==null&&Qo(b)){var _=w.start,Y=w.end;if(Y===void 0&&(Y=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min(Y,b.value.length);else{var X=b.ownerDocument||document,$=X&&X.defaultView||window;if($.getSelection){var K=$.getSelection(),oe=b.textContent.length,be=Math.min(w.start,oe),Ve=w.end===void 0?be:Math.min(w.end,oe);!K.extend&&be>Ve&&(y=Ve,Ve=be,be=y);var D=Bh(b,be),M=Bh(b,Ve);if(D&&M&&(K.rangeCount!==1||K.anchorNode!==D.node||K.anchorOffset!==D.offset||K.focusNode!==M.node||K.focusOffset!==M.offset)){var L=X.createRange();L.setStart(D.node,D.offset),K.removeAllRanges(),be>Ve?(K.addRange(L),K.extend(M.node,M.offset)):(L.setEnd(M.node,M.offset),K.addRange(L))}}}}for(X=[],K=b;K=K.parentNode;)K.nodeType===1&&X.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<X.length;b++){var P=X[b];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}Dc=!!md,pd=md=null}finally{Qe=o,J.p=i,k.T=l}}e.current=t,Nt=2}}function Wp(){if(Nt===2){Nt=0;var e=Fa,t=ws,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var i=J.p;J.p=2;var o=Qe;Qe|=4;try{wp(e,t.alternate,t)}finally{Qe=o,J.p=i,k.T=l}}Nt=3}}function ey(){if(Nt===4||Nt===3){Nt=0,wt();var e=Fa,t=ws,l=pa,i=Qp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Nt=5:(Nt=0,ws=Fa=null,ty(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Pa=null),bo(l),t=t.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(gn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=k.T,o=J.p,J.p=2,k.T=null;try{for(var d=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];d(b.value,{componentStack:b.stack})}}finally{k.T=t,J.p=o}}(pa&3)!==0&&Sc(),Xn(e),o=e.pendingLanes,(l&261930)!==0&&(o&42)!==0?e===td?Hi++:(Hi=0,td=e):Hi=0,Ki(0)}}function ty(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ni(t)))}function Sc(){return Zp(),Wp(),ey(),ny()}function ny(){if(Nt!==5)return!1;var e=Fa,t=Wu;Wu=0;var l=bo(pa),i=k.T,o=J.p;try{J.p=32>l?32:l,k.T=null,l=ed,ed=null;var d=Fa,y=pa;if(Nt=0,ws=Fa=null,pa=0,(Qe&6)!==0)throw Error(c(331));var b=Qe;if(Qe|=4,Lp(d.current),Dp(d,d.current,y,l),Qe=b,Ki(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(gn,d)}catch{}return!0}finally{J.p=o,k.T=i,ty(e,t)}}function ay(e,t,l){t=bn(l,t),t=zu(e.stateNode,t,2),e=$a(e,t,2),e!==null&&(oi(e,2),Xn(e))}function Ge(e,t,l){if(e.tag===3)ay(e,e,l);else for(;t!==null;){if(t.tag===3){ay(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Pa===null||!Pa.has(i))){e=bn(l,e),l=lp(2),i=$a(t,l,2),i!==null&&(sp(l,i,t,e),oi(i,2),Xn(i));break}}t=t.return}}function ld(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new Jj;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(l)||(Vu=!0,o.add(l),e=nb.bind(null,e,t,l),t.then(e,e))}function nb(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Je===e&&(De&l)===l&&(ft===4||ft===3&&(De&62914560)===De&&300>rt()-yc?(Qe&2)===0&&Rs(e,0):Ju|=l,Ts===De&&(Ts=0)),Xn(e)}function ly(e,t){t===0&&(t=Zf()),e=El(e,t),e!==null&&(oi(e,t),Xn(e))}function ab(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),ly(e,l)}function lb(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,o=e.memoizedState;o!==null&&(l=o.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),ly(e,l)}function sb(e,t){return ne(e,t)}var Nc=null,Os=null,sd=!1,Cc=!1,id=!1,Va=0;function Xn(e){e!==Os&&e.next===null&&(Os===null?Nc=Os=e:Os=Os.next=e),Cc=!0,sd||(sd=!0,rb())}function Ki(e,t){if(!id&&Cc){id=!0;do for(var l=!1,i=Nc;i!==null;){if(e!==0){var o=i.pendingLanes;if(o===0)var d=0;else{var y=i.suspendedLanes,b=i.pingedLanes;d=(1<<31-nn(42|e)+1)-1,d&=o&~(y&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,cy(i,d))}else d=De,d=Rr(i,i===Je?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(d&3)===0||ci(i,d)||(l=!0,cy(i,d));i=i.next}while(l);id=!1}}function ib(){sy()}function sy(){Cc=sd=!1;var e=0;Va!==0&&gb()&&(e=Va);for(var t=rt(),l=null,i=Nc;i!==null;){var o=i.next,d=iy(i,t);d===0?(i.next=null,l===null?Nc=o:l.next=o,o===null&&(Os=l)):(l=i,(e!==0||(d&3)!==0)&&(Cc=!0)),i=o}Nt!==0&&Nt!==5||Ki(e),Va!==0&&(Va=0)}function iy(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-nn(d),b=1<<y,w=o[y];w===-1?((b&l)===0||(b&i)!==0)&&(o[y]=zx(b,t)):w<=t&&(e.expiredLanes|=b),d&=~b}if(t=Je,l=De,l=Rr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&H(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||ci(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(i!==null&&H(i),bo(l)){case 2:case 8:l=ii;break;case 32:l=xl;break;case 268435456:l=ri;break;default:l=xl}return i=ry.bind(null,e),l=ne(l,i),e.callbackPriority=t,e.callbackNode=l,t}return i!==null&&i!==null&&H(i),e.callbackPriority=2,e.callbackNode=null,2}function ry(e,t){if(Nt!==0&&Nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Sc()&&e.callbackNode!==l)return null;var i=De;return i=Rr(e,e===Je?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Hp(e,i,t),iy(e,rt()),e.callbackNode!=null&&e.callbackNode===l?ry.bind(null,e):null)}function cy(e,t){if(Sc())return null;Hp(e,t,!0)}function rb(){xb(function(){(Qe&6)!==0?ne(vl,ib):sy()})}function rd(){if(Va===0){var e=ps;e===0&&(e=Er,Er<<=1,(Er&261888)===0&&(Er=256)),Va=e}return Va}function oy(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:kr(""+e)}function uy(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function cb(e,t,l,i,o){if(t==="submit"&&l&&l.stateNode===o){var d=oy((o[Pt]||null).action),y=i.submitter;y&&(t=(t=y[Pt]||null)?oy(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var b=new Br("action","action",null,i,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Va!==0){var w=y?uy(o,y):new FormData(o);wu(l,{pending:!0,data:w,method:o.method,action:d},null,w)}}else typeof d=="function"&&(b.preventDefault(),w=y?uy(o,y):new FormData(o),wu(l,{pending:!0,data:w,method:o.method,action:d},d,w))},currentTarget:o}]})}}for(var cd=0;cd<Go.length;cd++){var od=Go[cd],ob=od.toLowerCase(),ub=od[0].toUpperCase()+od.slice(1);_n(ob,"on"+ub)}_n($h,"onAnimationEnd"),_n(Hh,"onAnimationIteration"),_n(Kh,"onAnimationStart"),_n("dblclick","onDoubleClick"),_n("focusin","onFocus"),_n("focusout","onBlur"),_n(Tj,"onTransitionRun"),_n(wj,"onTransitionStart"),_n(Rj,"onTransitionCancel"),_n(Gh,"onTransitionEnd"),ts("onMouseEnter",["mouseout","mouseover"]),ts("onMouseLeave",["mouseout","mouseover"]),ts("onPointerEnter",["pointerout","pointerover"]),ts("onPointerLeave",["pointerout","pointerover"]),bl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bl("onBeforeInput",["compositionend","keypress","textInput","paste"]),bl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gi="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(" "),db=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gi));function dy(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],o=i.event;i=i.listeners;e:{var d=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],w=b.instance,_=b.currentTarget;if(b=b.listener,w!==d&&o.isPropagationStopped())break e;d=b,o.currentTarget=_;try{d(o)}catch(Y){Ur(Y)}o.currentTarget=null,d=w}else for(y=0;y<i.length;y++){if(b=i[y],w=b.instance,_=b.currentTarget,b=b.listener,w!==d&&o.isPropagationStopped())break e;d=b,o.currentTarget=_;try{d(o)}catch(Y){Ur(Y)}o.currentTarget=null,d=w}}}}function ze(e,t){var l=t[So];l===void 0&&(l=t[So]=new Set);var i=e+"__bubble";l.has(i)||(fy(t,e,2,!1),l.add(i))}function ud(e,t,l){var i=0;t&&(i|=4),fy(l,e,i,t)}var Ec="_reactListening"+Math.random().toString(36).slice(2);function dd(e){if(!e[Ec]){e[Ec]=!0,sh.forEach(function(l){l!=="selectionchange"&&(db.has(l)||ud(l,!1,e),ud(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ec]||(t[Ec]=!0,ud("selectionchange",!1,t))}}function fy(e,t,l,i){switch($y(t)){case 2:var o=Ub;break;case 8:o=Qb;break;default:o=Td}l=o.bind(null,t,l,e),o=void 0,!Mo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),i?o!==void 0?e.addEventListener(t,l,{capture:!0,passive:o}):e.addEventListener(t,l,!0):o!==void 0?e.addEventListener(t,l,{passive:o}):e.addEventListener(t,l,!1)}function fd(e,t,l,i,o){var d=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===o)break;if(y===4)for(y=i.return;y!==null;){var w=y.tag;if((w===3||w===4)&&y.stateNode.containerInfo===o)return;y=y.return}for(;b!==null;){if(y=Zl(b),y===null)return;if(w=y.tag,w===5||w===6||w===26||w===27){i=d=y;continue e}b=b.parentNode}}i=i.return}gh(function(){var _=d,Y=Ao(l),X=[];e:{var $=Ih.get(e);if($!==void 0){var K=Br,oe=e;switch(e){case"keypress":if(Dr(l)===0)break e;case"keydown":case"keyup":K=lj;break;case"focusin":oe="focus",K=qo;break;case"focusout":oe="blur",K=qo;break;case"beforeblur":case"afterblur":K=qo;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=jh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Yx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=rj;break;case $h:case Hh:case Kh:K=Xx;break;case Gh:K=oj;break;case"scroll":case"scrollend":K=Gx;break;case"wheel":K=dj;break;case"copy":case"cut":case"paste":K=Jx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Sh;break;case"toggle":case"beforetoggle":K=hj}var be=(t&4)!==0,Ve=!be&&(e==="scroll"||e==="scrollend"),D=be?$!==null?$+"Capture":null:$;be=[];for(var M=_,L;M!==null;){var P=M;if(L=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||L===null||D===null||(P=fi(M,D),P!=null&&be.push(Ii(M,P,L))),Ve)break;M=M.return}0<be.length&&($=new K($,oe,null,l,Y),X.push({event:$,listeners:be}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",$&&l!==Ro&&(oe=l.relatedTarget||l.fromElement)&&(Zl(oe)||oe[Jl]))break e;if((K||$)&&($=Y.window===Y?Y:($=Y.ownerDocument)?$.defaultView||$.parentWindow:window,K?(oe=l.relatedTarget||l.toElement,K=_,oe=oe?Zl(oe):null,oe!==null&&(Ve=f(oe),be=oe.tag,oe!==Ve||be!==5&&be!==27&&be!==6)&&(oe=null)):(K=null,oe=_),K!==oe)){if(be=jh,P="onMouseLeave",D="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(be=Sh,P="onPointerLeave",D="onPointerEnter",M="pointer"),Ve=K==null?$:di(K),L=oe==null?$:di(oe),$=new be(P,M+"leave",K,l,Y),$.target=Ve,$.relatedTarget=L,P=null,Zl(Y)===_&&(be=new be(D,M+"enter",oe,l,Y),be.target=L,be.relatedTarget=Ve,P=be),Ve=P,K&&oe)t:{for(be=fb,D=K,M=oe,L=0,P=D;P;P=be(P))L++;P=0;for(var ge=M;ge;ge=be(ge))P++;for(;0<L-P;)D=be(D),L--;for(;0<P-L;)M=be(M),P--;for(;L--;){if(D===M||M!==null&&D===M.alternate){be=D;break t}D=be(D),M=be(M)}be=null}else be=null;K!==null&&hy(X,$,K,be,!1),oe!==null&&Ve!==null&&hy(X,Ve,oe,be,!0)}}e:{if($=_?di(_):window,K=$.nodeName&&$.nodeName.toLowerCase(),K==="select"||K==="input"&&$.type==="file")var _e=Oh;else if(Rh($))if(Mh)_e=Nj;else{_e=bj;var fe=jj}else K=$.nodeName,!K||K.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?_&&wo(_.elementType)&&(_e=Oh):_e=Sj;if(_e&&(_e=_e(e,_))){Ah(X,_e,l,Y);break e}fe&&fe(e,$,_),e==="focusout"&&_&&$.type==="number"&&_.memoizedProps.value!=null&&To($,"number",$.value)}switch(fe=_?di(_):window,e){case"focusin":(Rh(fe)||fe.contentEditable==="true")&&(rs=fe,$o=_,ji=null);break;case"focusout":ji=$o=rs=null;break;case"mousedown":Ho=!0;break;case"contextmenu":case"mouseup":case"dragend":Ho=!1,Uh(X,l,Y);break;case"selectionchange":if(Ej)break;case"keydown":case"keyup":Uh(X,l,Y)}var Re;if(Lo)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else is?Th(e,l)&&(qe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(qe="onCompositionStart");qe&&(Nh&&l.locale!=="ko"&&(is||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&is&&(Re=vh()):(Da=Y,ko="value"in Da?Da.value:Da.textContent,is=!0)),fe=Tc(_,qe),0<fe.length&&(qe=new bh(qe,e,null,l,Y),X.push({event:qe,listeners:fe}),Re?qe.data=Re:(Re=wh(l),Re!==null&&(qe.data=Re)))),(Re=pj?yj(e,l):gj(e,l))&&(qe=Tc(_,"onBeforeInput"),0<qe.length&&(fe=new bh("onBeforeInput","beforeinput",null,l,Y),X.push({event:fe,listeners:qe}),fe.data=Re)),cb(X,e,_,l,Y)}dy(X,t)})}function Ii(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Tc(e,t){for(var l=t+"Capture",i=[];e!==null;){var o=e,d=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||d===null||(o=fi(e,l),o!=null&&i.unshift(Ii(e,o,d)),o=fi(e,t),o!=null&&i.push(Ii(e,o,d))),e.tag===3)return i;e=e.return}return[]}function fb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function hy(e,t,l,i,o){for(var d=t._reactName,y=[];l!==null&&l!==i;){var b=l,w=b.alternate,_=b.stateNode;if(b=b.tag,w!==null&&w===i)break;b!==5&&b!==26&&b!==27||_===null||(w=_,o?(_=fi(l,d),_!=null&&y.unshift(Ii(l,_,w))):o||(_=fi(l,d),_!=null&&y.push(Ii(l,_,w)))),l=l.return}y.length!==0&&e.push({event:t,listeners:y})}var hb=/\r\n?/g,mb=/\u0000|\uFFFD/g;function my(e){return(typeof e=="string"?e:""+e).replace(hb,`
|
|
49
|
-
`).replace(mb,"")}function py(e,t){return t=my(t),my(e)===t}function Xe(e,t,l,i,o,d){switch(l){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||as(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&as(e,""+i);break;case"className":Or(e,"class",i);break;case"tabIndex":Or(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Or(e,l,i);break;case"style":ph(e,i,d);break;case"data":if(t!=="object"){Or(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=kr(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"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 d=="function"&&(l==="formAction"?(t!=="input"&&Xe(e,t,"name",o.name,o,null),Xe(e,t,"formEncType",o.formEncType,o,null),Xe(e,t,"formMethod",o.formMethod,o,null),Xe(e,t,"formTarget",o.formTarget,o,null)):(Xe(e,t,"encType",o.encType,o,null),Xe(e,t,"method",o.method,o,null),Xe(e,t,"target",o.target,o,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=kr(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=ea);break;case"onScroll":i!=null&&ze("scroll",e);break;case"onScrollEnd":i!=null&&ze("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(l=i.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=kr(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":ze("beforetoggle",e),ze("toggle",e),Ar(e,"popover",i);break;case"xlinkActuate":Wn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Wn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Wn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Wn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Wn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Wn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Ar(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Hx.get(l)||l,Ar(e,l,i))}}function hd(e,t,l,i,o,d){switch(l){case"style":ph(e,i,d);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(l=i.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"children":typeof i=="string"?as(e,i):(typeof i=="number"||typeof i=="bigint")&&as(e,""+i);break;case"onScroll":i!=null&&ze("scroll",e);break;case"onScrollEnd":i!=null&&ze("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ih.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(o=l.endsWith("Capture"),t=l.slice(2,o?l.length-7:void 0),d=e[Pt]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,o),typeof i=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,i,o);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):Ar(e,l,i)}}}function Bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("load",e);var i=!1,o=!1,d;for(d in l)if(l.hasOwnProperty(d)){var y=l[d];if(y!=null)switch(d){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Xe(e,t,d,y,l,null)}}o&&Xe(e,t,"srcSet",l.srcSet,l,null),i&&Xe(e,t,"src",l.src,l,null);return;case"input":ze("invalid",e);var b=d=y=o=null,w=null,_=null;for(i in l)if(l.hasOwnProperty(i)){var Y=l[i];if(Y!=null)switch(i){case"name":o=Y;break;case"type":y=Y;break;case"checked":w=Y;break;case"defaultChecked":_=Y;break;case"value":d=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(c(137,t));break;default:Xe(e,t,i,Y,l,null)}}dh(e,d,b,w,_,y,o,!1);return;case"select":ze("invalid",e),i=y=d=null;for(o in l)if(l.hasOwnProperty(o)&&(b=l[o],b!=null))switch(o){case"value":d=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:Xe(e,t,o,b,l,null)}t=d,l=y,e.multiple=!!i,t!=null?ns(e,!!i,t,!1):l!=null&&ns(e,!!i,l,!0);return;case"textarea":ze("invalid",e),d=o=i=null;for(y in l)if(l.hasOwnProperty(y)&&(b=l[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":o=b;break;case"children":d=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(c(91));break;default:Xe(e,t,y,b,l,null)}hh(e,i,o,d);return;case"option":for(w in l)if(l.hasOwnProperty(w)&&(i=l[w],i!=null))switch(w){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Xe(e,t,w,i,l,null)}return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(i=0;i<Gi.length;i++)ze(Gi[i],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("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(_ in l)if(l.hasOwnProperty(_)&&(i=l[_],i!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Xe(e,t,_,i,l,null)}return;default:if(wo(t)){for(Y in l)l.hasOwnProperty(Y)&&(i=l[Y],i!==void 0&&hd(e,t,Y,i,l,void 0));return}}for(b in l)l.hasOwnProperty(b)&&(i=l[b],i!=null&&Xe(e,t,b,i,l,null))}function pb(e,t,l,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,d=null,y=null,b=null,w=null,_=null,Y=null;for(K in l){var X=l[K];if(l.hasOwnProperty(K)&&X!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":w=X;default:i.hasOwnProperty(K)||Xe(e,t,K,null,i,X)}}for(var $ in i){var K=i[$];if(X=l[$],i.hasOwnProperty($)&&(K!=null||X!=null))switch($){case"type":d=K;break;case"name":o=K;break;case"checked":_=K;break;case"defaultChecked":Y=K;break;case"value":y=K;break;case"defaultValue":b=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(c(137,t));break;default:K!==X&&Xe(e,t,$,K,i,X)}}Eo(e,y,b,w,_,Y,d,o);return;case"select":K=y=b=$=null;for(d in l)if(w=l[d],l.hasOwnProperty(d)&&w!=null)switch(d){case"value":break;case"multiple":K=w;default:i.hasOwnProperty(d)||Xe(e,t,d,null,i,w)}for(o in i)if(d=i[o],w=l[o],i.hasOwnProperty(o)&&(d!=null||w!=null))switch(o){case"value":$=d;break;case"defaultValue":b=d;break;case"multiple":y=d;default:d!==w&&Xe(e,t,o,d,i,w)}t=b,l=y,i=K,$!=null?ns(e,!!l,$,!1):!!i!=!!l&&(t!=null?ns(e,!!l,t,!0):ns(e,!!l,l?[]:"",!1));return;case"textarea":K=$=null;for(b in l)if(o=l[b],l.hasOwnProperty(b)&&o!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Xe(e,t,b,null,i,o)}for(y in i)if(o=i[y],d=l[y],i.hasOwnProperty(y)&&(o!=null||d!=null))switch(y){case"value":$=o;break;case"defaultValue":K=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(c(91));break;default:o!==d&&Xe(e,t,y,o,i,d)}fh(e,$,K);return;case"option":for(var oe in l)if($=l[oe],l.hasOwnProperty(oe)&&$!=null&&!i.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Xe(e,t,oe,null,i,$)}for(w in i)if($=i[w],K=l[w],i.hasOwnProperty(w)&&$!==K&&($!=null||K!=null))switch(w){case"selected":e.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:Xe(e,t,w,$,i,K)}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 be in l)$=l[be],l.hasOwnProperty(be)&&$!=null&&!i.hasOwnProperty(be)&&Xe(e,t,be,null,i,$);for(_ in i)if($=i[_],K=l[_],i.hasOwnProperty(_)&&$!==K&&($!=null||K!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(c(137,t));break;default:Xe(e,t,_,$,i,K)}return;default:if(wo(t)){for(var Ve in l)$=l[Ve],l.hasOwnProperty(Ve)&&$!==void 0&&!i.hasOwnProperty(Ve)&&hd(e,t,Ve,void 0,i,$);for(Y in i)$=i[Y],K=l[Y],!i.hasOwnProperty(Y)||$===K||$===void 0&&K===void 0||hd(e,t,Y,$,i,K);return}}for(var D in l)$=l[D],l.hasOwnProperty(D)&&$!=null&&!i.hasOwnProperty(D)&&Xe(e,t,D,null,i,$);for(X in i)$=i[X],K=l[X],!i.hasOwnProperty(X)||$===K||$==null&&K==null||Xe(e,t,X,$,i,K)}function yy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var o=l[i],d=o.transferSize,y=o.initiatorType,b=o.duration;if(d&&b&&yy(y)){for(y=0,b=o.responseEnd,i+=1;i<l.length;i++){var w=l[i],_=w.startTime;if(_>b)break;var Y=w.transferSize,X=w.initiatorType;Y&&yy(X)&&(w=w.responseEnd,y+=Y*(w<b?1:(b-_)/(w-_)))}if(--i,t+=8*(d+y)/(o.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 md=null,pd=null;function wc(e){return e.nodeType===9?e:e.ownerDocument}function gy(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 vy(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 yd(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 gd=null;function gb(){var e=window.event;return e&&e.type==="popstate"?e===gd?!1:(gd=e,!0):(gd=null,!1)}var xy=typeof setTimeout=="function"?setTimeout:void 0,vb=typeof clearTimeout=="function"?clearTimeout:void 0,jy=typeof Promise=="function"?Promise:void 0,xb=typeof queueMicrotask=="function"?queueMicrotask:typeof jy<"u"?function(e){return jy.resolve(null).then(e).catch(jb)}:xy;function jb(e){setTimeout(function(){throw e})}function Ja(e){return e==="head"}function by(e,t){var l=t,i=0;do{var o=l.nextSibling;if(e.removeChild(l),o&&o.nodeType===8)if(l=o.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(o),Ds(t);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")Yi(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Yi(l);for(var d=l.firstChild;d;){var y=d.nextSibling,b=d.nodeName;d[ui]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=y}}else l==="body"&&Yi(e.ownerDocument.body);l=o}while(l);Ds(t)}function Sy(e,t){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function vd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":vd(l),No(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function bb(e,t,l,i){for(;e.nodeType===1;){var o=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[ui])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Tn(e.nextSibling),e===null)break}return null}function Sb(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Tn(e.nextSibling),e===null))return null;return e}function Ny(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Tn(e.nextSibling),e===null))return null;return e}function xd(e){return e.data==="$?"||e.data==="$~"}function jd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Nb(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var i=function(){t(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Tn(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 bd=null;function Cy(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Tn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Ey(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Ty(e,t,l){switch(t=wc(l),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 Yi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);No(e)}var wn=new Map,wy=new Set;function Rc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ya=J.d;J.d={f:Cb,r:Eb,D:Tb,C:wb,L:Rb,m:Ab,X:Mb,S:Ob,M:kb};function Cb(){var e=ya.f(),t=xc();return e||t}function Eb(e){var t=Wl(e);t!==null&&t.tag===5&&t.type==="form"?Gm(t):ya.r(e)}var Ms=typeof document>"u"?null:document;function Ry(e,t,l){var i=Ms;if(i&&typeof t=="string"&&t){var o=xn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof l=="string"&&(o+='[crossorigin="'+l+'"]'),wy.has(o)||(wy.add(o),e={rel:e,crossOrigin:l,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),Bt(t,"link",e),Rt(t),i.head.appendChild(t)))}}function Tb(e){ya.D(e),Ry("dns-prefetch",e,null)}function wb(e,t){ya.C(e,t),Ry("preconnect",e,t)}function Rb(e,t,l){ya.L(e,t,l);var i=Ms;if(i&&e&&t){var o='link[rel="preload"][as="'+xn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(o+='[imagesrcset="'+xn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(o+='[imagesizes="'+xn(l.imageSizes)+'"]')):o+='[href="'+xn(e)+'"]';var d=o;switch(t){case"style":d=ks(e);break;case"script":d=zs(e)}wn.has(d)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),wn.set(d,e),i.querySelector(o)!==null||t==="style"&&i.querySelector(Pi(d))||t==="script"&&i.querySelector(Fi(d))||(t=i.createElement("link"),Bt(t,"link",e),Rt(t),i.head.appendChild(t)))}}function Ab(e,t){ya.m(e,t);var l=Ms;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+xn(i)+'"][href="'+xn(e)+'"]',d=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=zs(e)}if(!wn.has(d)&&(e=v({rel:"modulepreload",href:e},t),wn.set(d,e),l.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Fi(d)))return}i=l.createElement("link"),Bt(i,"link",e),Rt(i),l.head.appendChild(i)}}}function Ob(e,t,l){ya.S(e,t,l);var i=Ms;if(i&&e){var o=es(i).hoistableStyles,d=ks(e);t=t||"default";var y=o.get(d);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(Pi(d)))b.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=wn.get(d))&&Sd(e,l);var w=y=i.createElement("link");Rt(w),Bt(w,"link",e),w._p=new Promise(function(_,Y){w.onload=_,w.onerror=Y}),w.addEventListener("load",function(){b.loading|=1}),w.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Ac(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},o.set(d,y)}}}function Mb(e,t){ya.X(e,t);var l=Ms;if(l&&e){var i=es(l).hoistableScripts,o=zs(e),d=i.get(o);d||(d=l.querySelector(Fi(o)),d||(e=v({src:e,async:!0},t),(t=wn.get(o))&&Nd(e,t),d=l.createElement("script"),Rt(d),Bt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(o,d))}}function kb(e,t){ya.M(e,t);var l=Ms;if(l&&e){var i=es(l).hoistableScripts,o=zs(e),d=i.get(o);d||(d=l.querySelector(Fi(o)),d||(e=v({src:e,async:!0,type:"module"},t),(t=wn.get(o))&&Nd(e,t),d=l.createElement("script"),Rt(d),Bt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(o,d))}}function Ay(e,t,l,i){var o=(o=ce.current)?Rc(o):null;if(!o)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=ks(l.href),l=es(o).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=ks(l.href);var d=es(o).hoistableStyles,y=d.get(e);if(y||(o=o.ownerDocument||o,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=o.querySelector(Pi(e)))&&!d._p&&(y.instance=d,y.state.loading=5),wn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},wn.set(e,l),d||zb(o,e,l,y.state))),t&&i===null)throw Error(c(528,""));return y}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zs(l),l=es(o).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function ks(e){return'href="'+xn(e)+'"'}function Pi(e){return'link[rel="stylesheet"]['+e+"]"}function Oy(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function zb(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Bt(t,"link",l),Rt(t),e.head.appendChild(t))}function zs(e){return'[src="'+xn(e)+'"]'}function Fi(e){return"script[async]"+e}function My(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+xn(l.href)+'"]');if(i)return t.instance=i,Rt(i),i;var o=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Rt(i),Bt(i,"style",o),Ac(i,l.precedence,e),t.instance=i;case"stylesheet":o=ks(l.href);var d=e.querySelector(Pi(o));if(d)return t.state.loading|=4,t.instance=d,Rt(d),d;i=Oy(l),(o=wn.get(o))&&Sd(i,o),d=(e.ownerDocument||e).createElement("link"),Rt(d);var y=d;return y._p=new Promise(function(b,w){y.onload=b,y.onerror=w}),Bt(d,"link",i),t.state.loading|=4,Ac(d,l.precedence,e),t.instance=d;case"script":return d=zs(l.src),(o=e.querySelector(Fi(d)))?(t.instance=o,Rt(o),o):(i=l,(o=wn.get(d))&&(i=v({},l),Nd(i,o)),e=e.ownerDocument||e,o=e.createElement("script"),Rt(o),Bt(o,"link",i),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Ac(i,l.precedence,e));return t.instance}function Ac(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,d=o,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)d=b;else if(d!==o)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Sd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oc=null;function ky(e,t,l){if(Oc===null){var i=new Map,o=Oc=new Map;o.set(l,i)}else o=Oc,i=o.get(l),i||(i=new Map,o.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),o=0;o<l.length;o++){var d=l[o];if(!(d[ui]||d[kt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(d):i.set(y,[d])}}return i}function zy(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Db(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Dy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qb(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var o=ks(i.href),d=t.querySelector(Pi(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Mc.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Rt(d);return}d=t.ownerDocument||t,i=Oy(i),(o=wn.get(o))&&Sd(i,o),d=d.createElement("link"),Rt(d);var y=d;y._p=new Promise(function(b,w){y.onload=b,y.onerror=w}),Bt(d,"link",i),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Mc.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Cd=0;function Bb(e,t){return e.stylesheets&&e.count===0&&zc(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&zc(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Cd===0&&(Cd=62500*yb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&zc(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Cd?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function Mc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var kc=null;function zc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,kc=new Map,t.forEach(Lb,e),kc=null,Mc.call(e))}function Lb(e,t){if(!(t.state.loading&4)){var l=kc.get(e);if(l)var i=l.get(null);else{l=new Map,kc.set(e,l);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<o.length;d++){var y=o[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),i=y)}i&&l.set(null,i)}o=t.instance,y=o.getAttribute("data-precedence"),d=l.get(y)||i,d===i&&l.set(null,o),l.set(y,o),this.count++,i=Mc.bind(this),o.addEventListener("load",i),o.addEventListener("error",i),d?d.parentNode.insertBefore(o,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Xi={$$typeof:B,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function _b(e,t,l,i,o,d,y,b,w){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=xo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xo(0),this.hiddenUpdates=xo(null),this.identifierPrefix=i,this.onUncaughtError=o,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function qy(e,t,l,i,o,d,y,b,w,_,Y,X){return e=new _b(e,t,l,y,w,_,Y,X,b),t=1,d===!0&&(t|=24),d=ln(3,null,null,t),e.current=d,d.stateNode=e,t=au(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:i,isDehydrated:l,cache:t},ru(d),e}function By(e){return e?(e=us,e):us}function Ly(e,t,l,i,o,d){o=By(o),i.context===null?i.context=o:i.pendingContext=o,i=Qa(t),i.payload={element:l},d=d===void 0?null:d,d!==null&&(i.callback=d),l=$a(e,i,t),l!==null&&(Wt(l,e,t),wi(l,e,t))}function _y(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Ed(e,t){_y(e,t),(e=e.alternate)&&_y(e,t)}function Uy(e){if(e.tag===13||e.tag===31){var t=El(e,67108864);t!==null&&Wt(t,e,67108864),Ed(e,67108864)}}function Qy(e){if(e.tag===13||e.tag===31){var t=un();t=jo(t);var l=El(e,t);l!==null&&Wt(l,e,t),Ed(e,t)}}var Dc=!0;function Ub(e,t,l,i){var o=k.T;k.T=null;var d=J.p;try{J.p=2,Td(e,t,l,i)}finally{J.p=d,k.T=o}}function Qb(e,t,l,i){var o=k.T;k.T=null;var d=J.p;try{J.p=8,Td(e,t,l,i)}finally{J.p=d,k.T=o}}function Td(e,t,l,i){if(Dc){var o=wd(i);if(o===null)fd(e,t,i,qc,l),Hy(e,i);else if(Hb(o,e,t,l,i))i.stopPropagation();else if(Hy(e,i),t&4&&-1<$b.indexOf(e)){for(;o!==null;){var d=Wl(o);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=jl(d.pendingLanes);if(y!==0){var b=d;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var w=1<<31-nn(y);b.entanglements[1]|=w,y&=~w}Xn(d),(Qe&6)===0&&(gc=rt()+500,Ki(0))}}break;case 31:case 13:b=El(d,2),b!==null&&Wt(b,d,2),xc(),Ed(d,2)}if(d=wd(i),d===null&&fd(e,t,i,qc,l),d===o)break;o=d}o!==null&&i.stopPropagation()}else fd(e,t,i,null,l)}}function wd(e){return e=Ao(e),Rd(e)}var qc=null;function Rd(e){if(qc=null,e=Zl(e),e!==null){var t=f(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=h(t),e!==null)return e;e=null}else if(l===31){if(e=m(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return qc=e,null}function $y(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(ka()){case vl:return 2;case ii:return 8;case xl:case Cr:return 32;case ri:return 268435456;default:return 32}default:return 32}}var Ad=!1,Za=null,Wa=null,el=null,Vi=new Map,Ji=new Map,tl=[],$b="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 Hy(e,t){switch(e){case"focusin":case"focusout":Za=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":el=null;break;case"pointerover":case"pointerout":Vi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ji.delete(t.pointerId)}}function Zi(e,t,l,i,o,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:i,nativeEvent:d,targetContainers:[o]},t!==null&&(t=Wl(t),t!==null&&Uy(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Hb(e,t,l,i,o){switch(t){case"focusin":return Za=Zi(Za,e,t,l,i,o),!0;case"dragenter":return Wa=Zi(Wa,e,t,l,i,o),!0;case"mouseover":return el=Zi(el,e,t,l,i,o),!0;case"pointerover":var d=o.pointerId;return Vi.set(d,Zi(Vi.get(d)||null,e,t,l,i,o)),!0;case"gotpointercapture":return d=o.pointerId,Ji.set(d,Zi(Ji.get(d)||null,e,t,l,i,o)),!0}return!1}function Ky(e){var t=Zl(e.target);if(t!==null){var l=f(t);if(l!==null){if(t=l.tag,t===13){if(t=h(l),t!==null){e.blockedOn=t,ah(e.priority,function(){Qy(l)});return}}else if(t===31){if(t=m(l),t!==null){e.blockedOn=t,ah(e.priority,function(){Qy(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Bc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=wd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);Ro=i,l.target.dispatchEvent(i),Ro=null}else return t=Wl(l),t!==null&&Uy(t),e.blockedOn=l,!1;t.shift()}return!0}function Gy(e,t,l){Bc(e)&&l.delete(t)}function Kb(){Ad=!1,Za!==null&&Bc(Za)&&(Za=null),Wa!==null&&Bc(Wa)&&(Wa=null),el!==null&&Bc(el)&&(el=null),Vi.forEach(Gy),Ji.forEach(Gy)}function Lc(e,t){e.blockedOn===t&&(e.blockedOn=null,Ad||(Ad=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Kb)))}var _c=null;function Iy(e){_c!==e&&(_c=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){_c===e&&(_c=null);for(var t=0;t<e.length;t+=3){var l=e[t],i=e[t+1],o=e[t+2];if(typeof i!="function"){if(Rd(i||l)===null)continue;break}var d=Wl(l);d!==null&&(e.splice(t,3),t-=3,wu(d,{pending:!0,data:o,method:l.method,action:i},i,o))}}))}function Ds(e){function t(w){return Lc(w,e)}Za!==null&&Lc(Za,e),Wa!==null&&Lc(Wa,e),el!==null&&Lc(el,e),Vi.forEach(t),Ji.forEach(t);for(var l=0;l<tl.length;l++){var i=tl[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<tl.length&&(l=tl[0],l.blockedOn===null);)Ky(l),l.blockedOn===null&&tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var o=l[i],d=l[i+1],y=o[Pt]||null;if(typeof d=="function")y||Iy(l);else if(y){var b=null;if(d&&d.hasAttribute("formAction")){if(o=d,y=d[Pt]||null)b=y.formAction;else if(Rd(o)!==null)continue}else b=y.action;typeof b=="function"?l[i+1]=b:(l.splice(i,3),i-=3),Iy(l)}}}function Yy(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return o=y})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Od(e){this._internalRoot=e}Uc.prototype.render=Od.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var l=t.current,i=un();Ly(l,i,e,t,null,null)},Uc.prototype.unmount=Od.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ly(e.current,2,null,e,null,null),xc(),t[Jl]=null}};function Uc(e){this._internalRoot=e}Uc.prototype.unstable_scheduleHydration=function(e){if(e){var t=nh();e={blockedOn:null,target:e,priority:t};for(var l=0;l<tl.length&&t!==0&&t<tl[l].priority;l++);tl.splice(l,0,e),l===0&&Ky(e)}};var Py=s.version;if(Py!=="19.2.7")throw Error(c(527,Py,"19.2.7"));J.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=g(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var Gb={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qc.isDisabled&&Qc.supportsFiber)try{gn=Qc.inject(Gb),_t=Qc}catch{}}return er.createRoot=function(e,t){if(!u(e))throw Error(c(299));var l=!1,i="",o=ep,d=tp,y=np;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=qy(e,1,!1,null,null,l,i,null,o,d,y,Yy),e[Jl]=t.current,dd(e),new Od(t)},er.hydrateRoot=function(e,t,l){if(!u(e))throw Error(c(299));var i=!1,o="",d=ep,y=tp,b=np,w=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(o=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(b=l.onRecoverableError),l.formState!==void 0&&(w=l.formState)),t=qy(e,1,!0,t,l??null,i,o,w,d,y,b,Yy),t.context=By(null),l=t.current,i=un(),i=jo(i),o=Qa(i),o.callback=null,$a(l,o,i),l=i,t.current.lanes=l,oi(t,l),Xn(t),e[Jl]=t.current,dd(e),new Uc(t)},er.version="19.2.7",er}var sg;function n0(){if(sg)return Dd.exports;sg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Dd.exports=t0(),Dd.exports}var a0=n0(),ei=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ql,il,$s,Gg,l0=(Gg=class extends ei{constructor(){super();pe(this,Ql);pe(this,il);pe(this,$s);ie(this,$s,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){R(this,il)||this.setEventListener(R(this,$s))}onUnsubscribe(){var s;this.hasListeners()||((s=R(this,il))==null||s.call(this),ie(this,il,void 0))}setEventListener(s){var r;ie(this,$s,s),(r=R(this,il))==null||r.call(this),ie(this,il,s(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()}))}setFocused(s){R(this,Ql)!==s&&(ie(this,Ql,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof R(this,Ql)=="boolean"?R(this,Ql):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},Ql=new WeakMap,il=new WeakMap,$s=new WeakMap,Gg),Af=new l0,s0={setTimeout:(a,s)=>setTimeout(a,s),clearTimeout:a=>clearTimeout(a),setInterval:(a,s)=>setInterval(a,s),clearInterval:a=>clearInterval(a)},rl,wf,Ig,i0=(Ig=class{constructor(){pe(this,rl,s0);pe(this,wf,!1)}setTimeoutProvider(a){ie(this,rl,a)}setTimeout(a,s){return R(this,rl).setTimeout(a,s)}clearTimeout(a){R(this,rl).clearTimeout(a)}setInterval(a,s){return R(this,rl).setInterval(a,s)}clearInterval(a){R(this,rl).clearInterval(a)}},rl=new WeakMap,wf=new WeakMap,Ig),Ul=new i0;function r0(a){setTimeout(a,0)}var c0=typeof window>"u"||"Deno"in globalThis;function It(){}function o0(a,s){return typeof a=="function"?a(s):a}function tf(a){return typeof a=="number"&&a>=0&&a!==1/0}function tv(a,s){return Math.max(a+(s||0)-Date.now(),0)}function yl(a,s){return typeof a=="function"?a(s):a}function hn(a,s){return typeof a=="function"?a(s):a}function ig(a,s){const{type:r="all",exact:c,fetchStatus:u,predicate:f,queryKey:h,stale:m}=a;if(h){if(c){if(s.queryHash!==Of(h,s.options))return!1}else if(!or(s.queryKey,h))return!1}if(r!=="all"){const p=s.isActive();if(r==="active"&&!p||r==="inactive"&&p)return!1}return!(typeof m=="boolean"&&s.isStale()!==m||u&&u!==s.state.fetchStatus||f&&!f(s))}function rg(a,s){const{exact:r,status:c,predicate:u,mutationKey:f}=a;if(f){if(!s.options.mutationKey)return!1;if(r){if(Vl(s.options.mutationKey)!==Vl(f))return!1}else if(!or(s.options.mutationKey,f))return!1}return!(c&&s.state.status!==c||u&&!u(s))}function Of(a,s){return((s==null?void 0:s.queryKeyHashFn)||Vl)(a)}function Vl(a){return JSON.stringify(a,(s,r)=>nf(r)?Object.keys(r).sort().reduce((c,u)=>(c[u]=r[u],c),{}):r)}function or(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"&&typeof s=="object"?Object.keys(s).every(r=>or(a[r],s[r])):!1}var u0=Object.prototype.hasOwnProperty;function nv(a,s,r=0){if(a===s)return a;if(r>500)return s;const c=cg(a)&&cg(s);if(!c&&!(nf(a)&&nf(s)))return s;const f=(c?a:Object.keys(a)).length,h=c?s:Object.keys(s),m=h.length,p=c?new Array(m):{};let g=0;for(let x=0;x<m;x++){const v=c?x:h[x],N=a[v],j=s[v];if(N===j){p[v]=N,(c?x<f:u0.call(a,v))&&g++;continue}if(N===null||j===null||typeof N!="object"||typeof j!="object"){p[v]=j;continue}const E=nv(N,j,r+1);p[v]=E,E===N&&g++}return f===m&&g===f?a:p}function Zc(a,s){if(!s||Object.keys(a).length!==Object.keys(s).length)return!1;for(const r in a)if(a[r]!==s[r])return!1;return!0}function cg(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function nf(a){if(!og(a))return!1;const s=a.constructor;if(s===void 0)return!0;const r=s.prototype;return!(!og(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(a)!==Object.prototype)}function og(a){return Object.prototype.toString.call(a)==="[object Object]"}function d0(a){return new Promise(s=>{Ul.setTimeout(s,a)})}function af(a,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(a,s):r.structuralSharing!==!1?nv(a,s):s}function f0(a,s,r=0){const c=[...a,s];return r&&c.length>r?c.slice(1):c}function h0(a,s,r=0){const c=[s,...a];return r&&c.length>r?c.slice(0,-1):c}var Mf=Symbol();function av(a,s){return!a.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!a.queryFn||a.queryFn===Mf?()=>Promise.reject(new Error(`Missing queryFn: '${a.queryHash}'`)):a.queryFn}function kf(a,s){return typeof a=="function"?a(...s):!!a}function m0(a,s,r){let c=!1,u;return Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(u??(u=s()),c||(c=!0,u.aborted?r():u.addEventListener("abort",r,{once:!0})),u)}),a}var ur=(()=>{let a=()=>c0;return{isServer(){return a()},setIsServer(s){a=s}}})();function lf(){let a,s;const r=new Promise((u,f)=>{a=u,s=f});r.status="pending",r.catch(()=>{});function c(u){Object.assign(r,u),delete r.resolve,delete r.reject}return r.resolve=u=>{c({status:"fulfilled",value:u}),a(u)},r.reject=u=>{c({status:"rejected",reason:u}),s(u)},r}var p0=r0;function y0(){let a=[],s=0,r=m=>{m()},c=m=>{m()},u=p0;const f=m=>{s?a.push(m):u(()=>{r(m)})},h=()=>{const m=a;a=[],m.length&&u(()=>{c(()=>{m.forEach(p=>{r(p)})})})};return{batch:m=>{let p;s++;try{p=m()}finally{s--,s||h()}return p},batchCalls:m=>(...p)=>{f(()=>{m(...p)})},schedule:f,setNotifyFunction:m=>{r=m},setBatchNotifyFunction:m=>{c=m},setScheduler:m=>{u=m}}}var Et=y0(),Hs,cl,Ks,Yg,g0=(Yg=class extends ei{constructor(){super();pe(this,Hs,!0);pe(this,cl);pe(this,Ks);ie(this,Ks,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),c=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",c)}}})}onSubscribe(){R(this,cl)||this.setEventListener(R(this,Ks))}onUnsubscribe(){var s;this.hasListeners()||((s=R(this,cl))==null||s.call(this),ie(this,cl,void 0))}setEventListener(s){var r;ie(this,Ks,s),(r=R(this,cl))==null||r.call(this),ie(this,cl,s(this.setOnline.bind(this)))}setOnline(s){R(this,Hs)!==s&&(ie(this,Hs,s),this.listeners.forEach(c=>{c(s)}))}isOnline(){return R(this,Hs)}},Hs=new WeakMap,cl=new WeakMap,Ks=new WeakMap,Yg),Wc=new g0;function v0(a){return Math.min(1e3*2**a,3e4)}function lv(a){return(a??"online")==="online"?Wc.isOnline():!0}var sf=class extends Error{constructor(a){super("CancelledError"),this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function sv(a){let s=!1,r=0,c;const u=lf(),f=()=>u.status!=="pending",h=C=>{var A;if(!f()){const O=new sf(C);N(O),(A=a.onCancel)==null||A.call(a,O)}},m=()=>{s=!0},p=()=>{s=!1},g=()=>Af.isFocused()&&(a.networkMode==="always"||Wc.isOnline())&&a.canRun(),x=()=>lv(a.networkMode)&&a.canRun(),v=C=>{f()||(c==null||c(),u.resolve(C))},N=C=>{f()||(c==null||c(),u.reject(C))},j=()=>new Promise(C=>{var A;c=O=>{(f()||g())&&C(O)},(A=a.onPause)==null||A.call(a)}).then(()=>{var C;c=void 0,f()||(C=a.onContinue)==null||C.call(a)}),E=()=>{if(f())return;let C;const A=r===0?a.initialPromise:void 0;try{C=A??a.fn()}catch(O){C=Promise.reject(O)}Promise.resolve(C).then(v).catch(O=>{var V;if(f())return;const Q=a.retry??(ur.isServer()?0:3),B=a.retryDelay??v0,z=typeof B=="function"?B(r,O):B,q=Q===!0||typeof Q=="number"&&r<Q||typeof Q=="function"&&Q(r,O);if(s||!q){N(O);return}r++,(V=a.onFail)==null||V.call(a,r,O),d0(z).then(()=>g()?void 0:j()).then(()=>{s?N(O):E()})})};return{promise:u,status:()=>u.status,cancel:h,continue:()=>(c==null||c(),u),cancelRetry:m,continueRetry:p,canStart:x,start:()=>(x()?E():j().then(E),u)}}var $l,Pg,iv=(Pg=class{constructor(){pe(this,$l)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tf(this.gcTime)&&ie(this,$l,Ul.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(ur.isServer()?1/0:300*1e3))}clearGcTimeout(){R(this,$l)!==void 0&&(Ul.clearTimeout(R(this,$l)),ie(this,$l,void 0))}},$l=new WeakMap,Pg);function x0(a){return{onFetch:(s,r)=>{var x,v,N,j,E;const c=s.options,u=(N=(v=(x=s.fetchOptions)==null?void 0:x.meta)==null?void 0:v.fetchMore)==null?void 0:N.direction,f=((j=s.state.data)==null?void 0:j.pages)||[],h=((E=s.state.data)==null?void 0:E.pageParams)||[];let m={pages:[],pageParams:[]},p=0;const g=async()=>{let C=!1;const A=B=>{m0(B,()=>s.signal,()=>C=!0)},O=av(s.options,s.fetchOptions),Q=async(B,z,q)=>{if(C)return Promise.reject(s.signal.reason);if(z==null&&B.pages.length)return Promise.resolve(B);const Z=(()=>{const ue={client:s.client,queryKey:s.queryKey,pageParam:z,direction:q?"backward":"forward",meta:s.options.meta};return A(ue),ue})(),I=await O(Z),{maxPages:te}=s.options,ye=q?h0:f0;return{pages:ye(B.pages,I,te),pageParams:ye(B.pageParams,z,te)}};if(u&&f.length){const B=u==="backward",z=B?rv:rf,q={pages:f,pageParams:h},V=z(c,q);m=await Q(q,V,B)}else{const B=a??f.length;do{const z=p===0?h[0]??c.initialPageParam:rf(c,m);if(p>0&&z==null)break;m=await Q(m,z),p++}while(p<B)}return m};s.options.persister?s.fetchFn=()=>{var C,A;return(A=(C=s.options).persister)==null?void 0:A.call(C,g,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=g}}}function rf(a,{pages:s,pageParams:r}){const c=s.length-1;return s.length>0?a.getNextPageParam(s[c],s,r[c],r):void 0}function rv(a,{pages:s,pageParams:r}){var c;return s.length>0?(c=a.getPreviousPageParam)==null?void 0:c.call(a,s[0],s,r[0],r):void 0}function j0(a,s){return s?rf(a,s)!=null:!1}function b0(a,s){return!s||!a.getPreviousPageParam?!1:rv(a,s)!=null}var Gs,Hl,Is,An,Kl,Ot,pr,Gl,fn,cv,ba,Fg,S0=(Fg=class extends iv{constructor(s){super();pe(this,fn);pe(this,Gs);pe(this,Hl);pe(this,Is);pe(this,An);pe(this,Kl);pe(this,Ot);pe(this,pr);pe(this,Gl);ie(this,Gl,!1),ie(this,pr,s.defaultOptions),this.setOptions(s.options),this.observers=[],ie(this,Kl,s.client),ie(this,An,R(this,Kl).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,ie(this,Hl,dg(this.options)),this.state=s.state??R(this,Hl),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return R(this,Gs)}get promise(){var s;return(s=R(this,Ot))==null?void 0:s.promise}setOptions(s){if(this.options={...R(this,pr),...s},s!=null&&s._type&&ie(this,Gs,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=dg(this.options);r.data!==void 0&&(this.setState(ug(r.data,r.dataUpdatedAt)),ie(this,Hl,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,An).remove(this)}setData(s,r){const c=af(this.state.data,s,this.options);return Ae(this,fn,ba).call(this,{data:c,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),c}setState(s){Ae(this,fn,ba).call(this,{type:"setState",state:s})}cancel(s){var c,u;const r=(c=R(this,Ot))==null?void 0:c.promise;return(u=R(this,Ot))==null||u.cancel(s),r?r.then(It).catch(It):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return R(this,Hl)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>hn(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Mf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>yl(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!tv(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(c=>c.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=R(this,Ot))==null||r.continue()}onOnline(){var r;const s=this.observers.find(c=>c.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=R(this,Ot))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),R(this,An).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(R(this,Ot)&&(R(this,Gl)||Ae(this,fn,cv).call(this)?R(this,Ot).cancel({revert:!0}):R(this,Ot).cancelRetry()),this.scheduleGc()),R(this,An).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,fn,ba).call(this,{type:"invalidate"})}async fetch(s,r){var g,x,v,N,j,E,C,A,O,Q,B;if(this.state.fetchStatus!=="idle"&&((g=R(this,Ot))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(R(this,Ot))return R(this,Ot).continueRetry(),R(this,Ot).promise}if(s&&this.setOptions(s),!this.options.queryFn){const z=this.observers.find(q=>q.options.queryFn);z&&this.setOptions(z.options)}const c=new AbortController,u=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(ie(this,Gl,!0),c.signal)})},f=()=>{const z=av(this.options,r),V=(()=>{const Z={client:R(this,Kl),queryKey:this.queryKey,meta:this.meta};return u(Z),Z})();return ie(this,Gl,!1),this.options.persister?this.options.persister(z,V,this):z(V)},m=(()=>{const z={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:R(this,Kl),state:this.state,fetchFn:f};return u(z),z})(),p=R(this,Gs)==="infinite"?x0(this.options.pages):this.options.behavior;p==null||p.onFetch(m,this),ie(this,Is,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=m.fetchOptions)==null?void 0:x.meta))&&Ae(this,fn,ba).call(this,{type:"fetch",meta:(v=m.fetchOptions)==null?void 0:v.meta}),ie(this,Ot,sv({initialPromise:r==null?void 0:r.initialPromise,fn:m.fetchFn,onCancel:z=>{z instanceof sf&&z.revert&&this.setState({...R(this,Is),fetchStatus:"idle"}),c.abort()},onFail:(z,q)=>{Ae(this,fn,ba).call(this,{type:"failed",failureCount:z,error:q})},onPause:()=>{Ae(this,fn,ba).call(this,{type:"pause"})},onContinue:()=>{Ae(this,fn,ba).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const z=await R(this,Ot).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(j=(N=R(this,An).config).onSuccess)==null||j.call(N,z,this),(C=(E=R(this,An).config).onSettled)==null||C.call(E,z,this.state.error,this),z}catch(z){if(z instanceof sf){if(z.silent)return R(this,Ot).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ae(this,fn,ba).call(this,{type:"error",error:z}),(O=(A=R(this,An).config).onError)==null||O.call(A,z,this),(B=(Q=R(this,An).config).onSettled)==null||B.call(Q,this.state.data,z,this),z}finally{this.scheduleGc()}}},Gs=new WeakMap,Hl=new WeakMap,Is=new WeakMap,An=new WeakMap,Kl=new WeakMap,Ot=new WeakMap,pr=new WeakMap,Gl=new WeakMap,fn=new WeakSet,cv=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ba=function(s){const r=c=>{switch(s.type){case"failed":return{...c,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...c,fetchStatus:"paused"};case"continue":return{...c,fetchStatus:"fetching"};case"fetch":return{...c,...ov(c.data,this.options),fetchMeta:s.meta??null};case"success":const u={...c,...ug(s.data,s.dataUpdatedAt),dataUpdateCount:c.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ie(this,Is,s.manual?u:void 0),u;case"error":const f=s.error;return{...c,error:f,errorUpdateCount:c.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:c.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...c,isInvalidated:!0};case"setState":return{...c,...s.state}}};this.state=r(this.state),Et.batch(()=>{this.observers.forEach(c=>{c.onQueryUpdate()}),R(this,An).notify({query:this,type:"updated",action:s})})},Fg);function ov(a,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:lv(s.networkMode)?"fetching":"paused",...a===void 0&&{error:null,status:"pending"}}}function ug(a,s){return{data:a,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function dg(a){const s=typeof a.initialData=="function"?a.initialData():a.initialData,r=s!==void 0,c=r?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?c??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var en,Le,yr,Gt,Il,Ys,Na,ol,gr,Ps,Fs,Yl,Pl,ul,Xs,He,sr,cf,of,uf,df,ff,hf,mf,dv,Xg,uv=(Xg=class extends ei{constructor(s,r){super();pe(this,He);pe(this,en);pe(this,Le);pe(this,yr);pe(this,Gt);pe(this,Il);pe(this,Ys);pe(this,Na);pe(this,ol);pe(this,gr);pe(this,Ps);pe(this,Fs);pe(this,Yl);pe(this,Pl);pe(this,ul);pe(this,Xs,new Set);this.options=r,ie(this,en,s),ie(this,ol,null),ie(this,Na,lf()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,Le).addObserver(this),fg(R(this,Le),this.options)?Ae(this,He,sr).call(this):this.updateResult(),Ae(this,He,df).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pf(R(this,Le),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pf(R(this,Le),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,He,ff).call(this),Ae(this,He,hf).call(this),R(this,Le).removeObserver(this)}setOptions(s){const r=this.options,c=R(this,Le);if(this.options=R(this,en).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hn(this.options.enabled,R(this,Le))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,He,mf).call(this),R(this,Le).setOptions(this.options),r._defaulted&&!Zc(this.options,r)&&R(this,en).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,Le),observer:this});const u=this.hasListeners();u&&hg(R(this,Le),c,this.options,r)&&Ae(this,He,sr).call(this),this.updateResult(),u&&(R(this,Le)!==c||hn(this.options.enabled,R(this,Le))!==hn(r.enabled,R(this,Le))||yl(this.options.staleTime,R(this,Le))!==yl(r.staleTime,R(this,Le)))&&Ae(this,He,cf).call(this);const f=Ae(this,He,of).call(this);u&&(R(this,Le)!==c||hn(this.options.enabled,R(this,Le))!==hn(r.enabled,R(this,Le))||f!==R(this,ul))&&Ae(this,He,uf).call(this,f)}getOptimisticResult(s){const r=R(this,en).getQueryCache().build(R(this,en),s),c=this.createResult(r,s);return C0(this,c)&&(ie(this,Gt,c),ie(this,Ys,this.options),ie(this,Il,R(this,Le).state)),c}getCurrentResult(){return R(this,Gt)}trackResult(s,r){return new Proxy(s,{get:(c,u)=>(this.trackProp(u),r==null||r(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&R(this,Na).status==="pending"&&R(this,Na).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(c,u))})}trackProp(s){R(this,Xs).add(s)}getCurrentQuery(){return R(this,Le)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=R(this,en).defaultQueryOptions(s),c=R(this,en).getQueryCache().build(R(this,en),r);return c.fetch().then(()=>this.createResult(c,r))}fetch(s){return Ae(this,He,sr).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Gt)))}createResult(s,r){var te;const c=R(this,Le),u=this.options,f=R(this,Gt),h=R(this,Il),m=R(this,Ys),g=s!==c?s.state:R(this,yr),{state:x}=s;let v={...x},N=!1,j;if(r._optimisticResults){const ye=this.hasListeners(),ue=!ye&&fg(s,r),re=ye&&hg(s,c,r,u);(ue||re)&&(v={...v,...ov(x.data,s.options)}),r._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:E,errorUpdatedAt:C,status:A}=v;j=v.data;let O=!1;if(r.placeholderData!==void 0&&j===void 0&&A==="pending"){let ye;f!=null&&f.isPlaceholderData&&r.placeholderData===(m==null?void 0:m.placeholderData)?(ye=f.data,O=!0):ye=typeof r.placeholderData=="function"?r.placeholderData((te=R(this,Fs))==null?void 0:te.state.data,R(this,Fs)):r.placeholderData,ye!==void 0&&(A="success",j=af(f==null?void 0:f.data,ye,r),N=!0)}if(r.select&&j!==void 0&&!O)if(f&&j===(h==null?void 0:h.data)&&r.select===R(this,gr))j=R(this,Ps);else try{ie(this,gr,r.select),j=r.select(j),j=af(f==null?void 0:f.data,j,r),ie(this,Ps,j),ie(this,ol,null)}catch(ye){ie(this,ol,ye)}R(this,ol)&&(E=R(this,ol),j=R(this,Ps),C=Date.now(),A="error");const Q=v.fetchStatus==="fetching",B=A==="pending",z=A==="error",q=B&&Q,V=j!==void 0,I={status:A,fetchStatus:v.fetchStatus,isPending:B,isSuccess:A==="success",isError:z,isInitialLoading:q,isLoading:q,data:j,dataUpdatedAt:v.dataUpdatedAt,error:E,errorUpdatedAt:C,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:v.dataUpdateCount>g.dataUpdateCount||v.errorUpdateCount>g.errorUpdateCount,isFetching:Q,isRefetching:Q&&!B,isLoadingError:z&&!V,isPaused:v.fetchStatus==="paused",isPlaceholderData:N,isRefetchError:z&&V,isStale:zf(s,r),refetch:this.refetch,promise:R(this,Na),isEnabled:hn(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const ye=I.data!==void 0,ue=I.status==="error"&&!ye,re=ve=>{ue?ve.reject(I.error):ye&&ve.resolve(I.data)},Ce=()=>{const ve=ie(this,Na,I.promise=lf());re(ve)},Te=R(this,Na);switch(Te.status){case"pending":s.queryHash===c.queryHash&&re(Te);break;case"fulfilled":(ue||I.data!==Te.value)&&Ce();break;case"rejected":(!ue||I.error!==Te.reason)&&Ce();break}}return I}updateResult(){const s=R(this,Gt),r=this.createResult(R(this,Le),this.options);if(ie(this,Il,R(this,Le).state),ie(this,Ys,this.options),R(this,Il).data!==void 0&&ie(this,Fs,R(this,Le)),Zc(r,s))return;ie(this,Gt,r);const c=()=>{if(!s)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!R(this,Xs).size)return!0;const h=new Set(f??R(this,Xs));return this.options.throwOnError&&h.add("error"),Object.keys(R(this,Gt)).some(m=>{const p=m;return R(this,Gt)[p]!==s[p]&&h.has(p)})};Ae(this,He,dv).call(this,{listeners:c()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,He,df).call(this)}},en=new WeakMap,Le=new WeakMap,yr=new WeakMap,Gt=new WeakMap,Il=new WeakMap,Ys=new WeakMap,Na=new WeakMap,ol=new WeakMap,gr=new WeakMap,Ps=new WeakMap,Fs=new WeakMap,Yl=new WeakMap,Pl=new WeakMap,ul=new WeakMap,Xs=new WeakMap,He=new WeakSet,sr=function(s){Ae(this,He,mf).call(this);let r=R(this,Le).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(It)),r},cf=function(){Ae(this,He,ff).call(this);const s=yl(this.options.staleTime,R(this,Le));if(ur.isServer()||R(this,Gt).isStale||!tf(s))return;const c=tv(R(this,Gt).dataUpdatedAt,s)+1;ie(this,Yl,Ul.setTimeout(()=>{R(this,Gt).isStale||this.updateResult()},c))},of=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,Le)):this.options.refetchInterval)??!1},uf=function(s){Ae(this,He,hf).call(this),ie(this,ul,s),!(ur.isServer()||hn(this.options.enabled,R(this,Le))===!1||!tf(R(this,ul))||R(this,ul)===0)&&ie(this,Pl,Ul.setInterval(()=>{(this.options.refetchIntervalInBackground||Af.isFocused())&&Ae(this,He,sr).call(this)},R(this,ul)))},df=function(){Ae(this,He,cf).call(this),Ae(this,He,uf).call(this,Ae(this,He,of).call(this))},ff=function(){R(this,Yl)!==void 0&&(Ul.clearTimeout(R(this,Yl)),ie(this,Yl,void 0))},hf=function(){R(this,Pl)!==void 0&&(Ul.clearInterval(R(this,Pl)),ie(this,Pl,void 0))},mf=function(){const s=R(this,en).getQueryCache().build(R(this,en),this.options);if(s===R(this,Le))return;const r=R(this,Le);ie(this,Le,s),ie(this,yr,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},dv=function(s){Et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(R(this,Gt))}),R(this,en).getQueryCache().notify({query:R(this,Le),type:"observerResultsUpdated"})})},Xg);function N0(a,s){return hn(s.enabled,a)!==!1&&a.state.data===void 0&&!(a.state.status==="error"&&hn(s.retryOnMount,a)===!1)}function fg(a,s){return N0(a,s)||a.state.data!==void 0&&pf(a,s,s.refetchOnMount)}function pf(a,s,r){if(hn(s.enabled,a)!==!1&&yl(s.staleTime,a)!=="static"){const c=typeof r=="function"?r(a):r;return c==="always"||c!==!1&&zf(a,s)}return!1}function hg(a,s,r,c){return(a!==s||hn(c.enabled,a)===!1)&&(!r.suspense||a.state.status!=="error")&&zf(a,r)}function zf(a,s){return hn(s.enabled,a)!==!1&&a.isStaleByTime(yl(s.staleTime,a))}function C0(a,s){return!Zc(a.getCurrentResult(),s)}var E0=class extends uv{constructor(a,s){super(a,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(a){a._type="infinite",super.setOptions(a)}getOptimisticResult(a){return a._type="infinite",super.getOptimisticResult(a)}fetchNextPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"backward"}}})}createResult(a,s){var E,C;const{state:r}=a,c=super.createResult(a,s),{isFetching:u,isRefetching:f,isError:h,isRefetchError:m}=c,p=(C=(E=r.fetchMeta)==null?void 0:E.fetchMore)==null?void 0:C.direction,g=h&&p==="forward",x=u&&p==="forward",v=h&&p==="backward",N=u&&p==="backward";return{...c,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:j0(s,r.data),hasPreviousPage:b0(s,r.data),isFetchNextPageError:g,isFetchingNextPage:x,isFetchPreviousPageError:v,isFetchingPreviousPage:N,isRefetchError:m&&!g&&!v,isRefetching:f&&!x&&!N}}},vr,Vn,$t,Fl,Jn,sl,Vg,T0=(Vg=class extends iv{constructor(s){super();pe(this,Jn);pe(this,vr);pe(this,Vn);pe(this,$t);pe(this,Fl);ie(this,vr,s.client),this.mutationId=s.mutationId,ie(this,$t,s.mutationCache),ie(this,Vn,[]),this.state=s.state||fv(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){R(this,Vn).includes(s)||(R(this,Vn).push(s),this.clearGcTimeout(),R(this,$t).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){ie(this,Vn,R(this,Vn).filter(r=>r!==s)),this.scheduleGc(),R(this,$t).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){R(this,Vn).length||(this.state.status==="pending"?this.scheduleGc():R(this,$t).remove(this))}continue(){var s;return((s=R(this,Fl))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var h,m,p,g,x,v,N,j,E,C,A,O,Q,B,z,q,V,Z;const r=()=>{Ae(this,Jn,sl).call(this,{type:"continue"})},c={client:R(this,vr),meta:this.options.meta,mutationKey:this.options.mutationKey};ie(this,Fl,sv({fn:()=>this.options.mutationFn?this.options.mutationFn(s,c):Promise.reject(new Error("No mutationFn found")),onFail:(I,te)=>{Ae(this,Jn,sl).call(this,{type:"failed",failureCount:I,error:te})},onPause:()=>{Ae(this,Jn,sl).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,$t).canRun(this)}));const u=this.state.status==="pending",f=!R(this,Fl).canStart();try{if(u)r();else{Ae(this,Jn,sl).call(this,{type:"pending",variables:s,isPaused:f}),R(this,$t).config.onMutate&&await R(this,$t).config.onMutate(s,this,c);const te=await((m=(h=this.options).onMutate)==null?void 0:m.call(h,s,c));te!==this.state.context&&Ae(this,Jn,sl).call(this,{type:"pending",context:te,variables:s,isPaused:f})}const I=await R(this,Fl).start();return await((g=(p=R(this,$t).config).onSuccess)==null?void 0:g.call(p,I,s,this.state.context,this,c)),await((v=(x=this.options).onSuccess)==null?void 0:v.call(x,I,s,this.state.context,c)),await((j=(N=R(this,$t).config).onSettled)==null?void 0:j.call(N,I,null,this.state.variables,this.state.context,this,c)),await((C=(E=this.options).onSettled)==null?void 0:C.call(E,I,null,s,this.state.context,c)),Ae(this,Jn,sl).call(this,{type:"success",data:I}),I}catch(I){try{await((O=(A=R(this,$t).config).onError)==null?void 0:O.call(A,I,s,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((B=(Q=this.options).onError)==null?void 0:B.call(Q,I,s,this.state.context,c))}catch(te){Promise.reject(te)}try{await((q=(z=R(this,$t).config).onSettled)==null?void 0:q.call(z,void 0,I,this.state.variables,this.state.context,this,c))}catch(te){Promise.reject(te)}try{await((Z=(V=this.options).onSettled)==null?void 0:Z.call(V,void 0,I,s,this.state.context,c))}catch(te){Promise.reject(te)}throw Ae(this,Jn,sl).call(this,{type:"error",error:I}),I}finally{R(this,$t).runNext(this)}}},vr=new WeakMap,Vn=new WeakMap,$t=new WeakMap,Fl=new WeakMap,Jn=new WeakSet,sl=function(s){const r=c=>{switch(s.type){case"failed":return{...c,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...c,isPaused:!0};case"continue":return{...c,isPaused:!1};case"pending":return{...c,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...c,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...c,data:void 0,error:s.error,failureCount:c.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Et.batch(()=>{R(this,Vn).forEach(c=>{c.onMutationUpdate(s)}),R(this,$t).notify({mutation:this,type:"updated",action:s})})},Vg);function fv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ca,$n,xr,Jg,w0=(Jg=class extends ei{constructor(s={}){super();pe(this,Ca);pe(this,$n);pe(this,xr);this.config=s,ie(this,Ca,new Set),ie(this,$n,new Map),ie(this,xr,0)}build(s,r,c){const u=new T0({client:s,mutationCache:this,mutationId:++$c(this,xr)._,options:s.defaultMutationOptions(r),state:c});return this.add(u),u}add(s){R(this,Ca).add(s);const r=Hc(s);if(typeof r=="string"){const c=R(this,$n).get(r);c?c.push(s):R(this,$n).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(R(this,Ca).delete(s)){const r=Hc(s);if(typeof r=="string"){const c=R(this,$n).get(r);if(c)if(c.length>1){const u=c.indexOf(s);u!==-1&&c.splice(u,1)}else c[0]===s&&R(this,$n).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=Hc(s);if(typeof r=="string"){const c=R(this,$n).get(r),u=c==null?void 0:c.find(f=>f.state.status==="pending");return!u||u===s}else return!0}runNext(s){var c;const r=Hc(s);if(typeof r=="string"){const u=(c=R(this,$n).get(r))==null?void 0:c.find(f=>f!==s&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Et.batch(()=>{R(this,Ca).forEach(s=>{this.notify({type:"removed",mutation:s})}),R(this,Ca).clear(),R(this,$n).clear()})}getAll(){return Array.from(R(this,Ca))}find(s){const r={exact:!0,...s};return this.getAll().find(c=>rg(r,c))}findAll(s={}){return this.getAll().filter(r=>rg(s,r))}notify(s){Et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return Et.batch(()=>Promise.all(s.map(r=>r.continue().catch(It))))}},Ca=new WeakMap,$n=new WeakMap,xr=new WeakMap,Jg);function Hc(a){var s;return(s=a.options.scope)==null?void 0:s.id}var Ea,dl,tn,Ta,Aa,Fc,yf,Zg,R0=(Zg=class extends ei{constructor(r,c){super();pe(this,Aa);pe(this,Ea);pe(this,dl);pe(this,tn);pe(this,Ta);ie(this,Ea,r),this.setOptions(c),this.bindMethods(),Ae(this,Aa,Fc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var u;const c=this.options;this.options=R(this,Ea).defaultMutationOptions(r),Zc(this.options,c)||R(this,Ea).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,tn),observer:this}),c!=null&&c.mutationKey&&this.options.mutationKey&&Vl(c.mutationKey)!==Vl(this.options.mutationKey)?this.reset():((u=R(this,tn))==null?void 0:u.state.status)==="pending"&&R(this,tn).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=R(this,tn))==null||r.removeObserver(this)}onMutationUpdate(r){Ae(this,Aa,Fc).call(this),Ae(this,Aa,yf).call(this,r)}getCurrentResult(){return R(this,dl)}reset(){var r;(r=R(this,tn))==null||r.removeObserver(this),ie(this,tn,void 0),Ae(this,Aa,Fc).call(this),Ae(this,Aa,yf).call(this)}mutate(r,c){var u;return ie(this,Ta,c),(u=R(this,tn))==null||u.removeObserver(this),ie(this,tn,R(this,Ea).getMutationCache().build(R(this,Ea),this.options)),R(this,tn).addObserver(this),R(this,tn).execute(r)}},Ea=new WeakMap,dl=new WeakMap,tn=new WeakMap,Ta=new WeakMap,Aa=new WeakSet,Fc=function(){var c;const r=((c=R(this,tn))==null?void 0:c.state)??fv();ie(this,dl,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},yf=function(r){Et.batch(()=>{var c,u,f,h,m,p,g,x;if(R(this,Ta)&&this.hasListeners()){const v=R(this,dl).variables,N=R(this,dl).context,j={client:R(this,Ea),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(u=(c=R(this,Ta)).onSuccess)==null||u.call(c,r.data,v,N,j)}catch(E){Promise.reject(E)}try{(h=(f=R(this,Ta)).onSettled)==null||h.call(f,r.data,null,v,N,j)}catch(E){Promise.reject(E)}}else if((r==null?void 0:r.type)==="error"){try{(p=(m=R(this,Ta)).onError)==null||p.call(m,r.error,v,N,j)}catch(E){Promise.reject(E)}try{(x=(g=R(this,Ta)).onSettled)==null||x.call(g,void 0,r.error,v,N,j)}catch(E){Promise.reject(E)}}}this.listeners.forEach(v=>{v(R(this,dl))})})},Zg),Zn,Wg,A0=(Wg=class extends ei{constructor(s={}){super();pe(this,Zn);this.config=s,ie(this,Zn,new Map)}build(s,r,c){const u=r.queryKey,f=r.queryHash??Of(u,r);let h=this.get(f);return h||(h=new S0({client:s,queryKey:u,queryHash:f,options:s.defaultQueryOptions(r),state:c,defaultOptions:s.getQueryDefaults(u)}),this.add(h)),h}add(s){R(this,Zn).has(s.queryHash)||(R(this,Zn).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=R(this,Zn).get(s.queryHash);r&&(s.destroy(),r===s&&R(this,Zn).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){Et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return R(this,Zn).get(s)}getAll(){return[...R(this,Zn).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(c=>ig(r,c))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(c=>ig(s,c)):r}notify(s){Et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},Zn=new WeakMap,Wg),ht,fl,hl,Vs,Js,ml,Zs,Ws,ev,O0=(ev=class{constructor(a={}){pe(this,ht);pe(this,fl);pe(this,hl);pe(this,Vs);pe(this,Js);pe(this,ml);pe(this,Zs);pe(this,Ws);ie(this,ht,a.queryCache||new A0),ie(this,fl,a.mutationCache||new w0),ie(this,hl,a.defaultOptions||{}),ie(this,Vs,new Map),ie(this,Js,new Map),ie(this,ml,0)}mount(){$c(this,ml)._++,R(this,ml)===1&&(ie(this,Zs,Af.subscribe(async a=>{a&&(await this.resumePausedMutations(),R(this,ht).onFocus())})),ie(this,Ws,Wc.subscribe(async a=>{a&&(await this.resumePausedMutations(),R(this,ht).onOnline())})))}unmount(){var a,s;$c(this,ml)._--,R(this,ml)===0&&((a=R(this,Zs))==null||a.call(this),ie(this,Zs,void 0),(s=R(this,Ws))==null||s.call(this),ie(this,Ws,void 0))}isFetching(a){return R(this,ht).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return R(this,fl).findAll({...a,status:"pending"}).length}getQueryData(a){var r;const s=this.defaultQueryOptions({queryKey:a});return(r=R(this,ht).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(a){const s=this.defaultQueryOptions(a),r=R(this,ht).build(this,s),c=r.state.data;return c===void 0?this.fetchQuery(a):(a.revalidateIfStale&&r.isStaleByTime(yl(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(c))}getQueriesData(a){return R(this,ht).findAll(a).map(({queryKey:s,state:r})=>{const c=r.data;return[s,c]})}setQueryData(a,s,r){const c=this.defaultQueryOptions({queryKey:a}),u=R(this,ht).get(c.queryHash),f=u==null?void 0:u.state.data,h=o0(s,f);if(h!==void 0)return R(this,ht).build(this,c).setData(h,{...r,manual:!0})}setQueriesData(a,s,r){return Et.batch(()=>R(this,ht).findAll(a).map(({queryKey:c})=>[c,this.setQueryData(c,s,r)]))}getQueryState(a){var r;const s=this.defaultQueryOptions({queryKey:a});return(r=R(this,ht).get(s.queryHash))==null?void 0:r.state}removeQueries(a){const s=R(this,ht);Et.batch(()=>{s.findAll(a).forEach(r=>{s.remove(r)})})}resetQueries(a,s){const r=R(this,ht);return Et.batch(()=>(r.findAll(a).forEach(c=>{c.reset()}),this.refetchQueries({type:"active",...a},s)))}cancelQueries(a,s={}){const r={revert:!0,...s},c=Et.batch(()=>R(this,ht).findAll(a).map(u=>u.cancel(r)));return Promise.all(c).then(It).catch(It)}invalidateQueries(a,s={}){return Et.batch(()=>(R(this,ht).findAll(a).forEach(r=>{r.invalidate()}),(a==null?void 0:a.refetchType)==="none"?Promise.resolve():this.refetchQueries({...a,type:(a==null?void 0:a.refetchType)??(a==null?void 0:a.type)??"active"},s)))}refetchQueries(a,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},c=Et.batch(()=>R(this,ht).findAll(a).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,r);return r.throwOnError||(f=f.catch(It)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(c).then(It)}fetchQuery(a){const s=this.defaultQueryOptions(a);s.retry===void 0&&(s.retry=!1);const r=R(this,ht).build(this,s);return r.isStaleByTime(yl(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(It).catch(It)}fetchInfiniteQuery(a){return a._type="infinite",this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(It).catch(It)}ensureInfiniteQueryData(a){return a._type="infinite",this.ensureQueryData(a)}resumePausedMutations(){return Wc.isOnline()?R(this,fl).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,ht)}getMutationCache(){return R(this,fl)}getDefaultOptions(){return R(this,hl)}setDefaultOptions(a){ie(this,hl,a)}setQueryDefaults(a,s){R(this,Vs).set(Vl(a),{queryKey:a,defaultOptions:s})}getQueryDefaults(a){const s=[...R(this,Vs).values()],r={};return s.forEach(c=>{or(a,c.queryKey)&&Object.assign(r,c.defaultOptions)}),r}setMutationDefaults(a,s){R(this,Js).set(Vl(a),{mutationKey:a,defaultOptions:s})}getMutationDefaults(a){const s=[...R(this,Js).values()],r={};return s.forEach(c=>{or(a,c.mutationKey)&&Object.assign(r,c.defaultOptions)}),r}defaultQueryOptions(a){if(a._defaulted)return a;const s={...R(this,hl).queries,...this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return s.queryHash||(s.queryHash=Of(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===Mf&&(s.enabled=!1),s}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...R(this,hl).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){R(this,ht).clear(),R(this,fl).clear()}},ht=new WeakMap,fl=new WeakMap,hl=new WeakMap,Vs=new WeakMap,Js=new WeakMap,ml=new WeakMap,Zs=new WeakMap,Ws=new WeakMap,ev),hv=S.createContext(void 0),qn=a=>{const s=S.useContext(hv);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},M0=({client:a,children:s})=>(S.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),n.jsx(hv.Provider,{value:a,children:s})),mv=S.createContext(!1),k0=()=>S.useContext(mv);mv.Provider;function z0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var D0=S.createContext(z0()),q0=()=>S.useContext(D0),B0=(a,s,r)=>{const c=r!=null&&r.state.error&&typeof a.throwOnError=="function"?kf(a.throwOnError,[r.state.error,r]):a.throwOnError;(a.suspense||a.experimental_prefetchInRender||c)&&(s.isReset()||(a.retryOnMount=!1))},L0=a=>{S.useEffect(()=>{a.clearReset()},[a])},_0=({result:a,errorResetBoundary:s,throwOnError:r,query:c,suspense:u})=>a.isError&&!s.isReset()&&!a.isFetching&&c&&(u&&a.data===void 0||kf(r,[a.error,c])),U0=a=>{if(a.suspense){const r=u=>u==="static"?u:Math.max(u??1e3,1e3),c=a.staleTime;a.staleTime=typeof c=="function"?(...u)=>r(c(...u)):r(c),typeof a.gcTime=="number"&&(a.gcTime=Math.max(a.gcTime,1e3))}},Q0=(a,s)=>a.isLoading&&a.isFetching&&!s,$0=(a,s)=>(a==null?void 0:a.suspense)&&s.isPending,mg=(a,s,r)=>s.fetchOptimistic(a).catch(()=>{r.clearReset()});function pv(a,s,r){var j,E,C,A;const c=k0(),u=q0(),f=qn(),h=f.defaultQueryOptions(a);(E=(j=f.getDefaultOptions().queries)==null?void 0:j._experimental_beforeQuery)==null||E.call(j,h);const m=f.getQueryCache().get(h.queryHash),p=a.subscribed!==!1;h._optimisticResults=c?"isRestoring":p?"optimistic":void 0,U0(h),B0(h,u,m),L0(u);const g=!f.getQueryCache().get(h.queryHash),[x]=S.useState(()=>new s(f,h)),v=x.getOptimisticResult(h),N=!c&&p;if(S.useSyncExternalStore(S.useCallback(O=>{const Q=N?x.subscribe(Et.batchCalls(O)):It;return x.updateResult(),Q},[x,N]),()=>x.getCurrentResult(),()=>x.getCurrentResult()),S.useEffect(()=>{x.setOptions(h)},[h,x]),$0(h,v))throw mg(h,x,u);if(_0({result:v,errorResetBoundary:u,throwOnError:h.throwOnError,query:m,suspense:h.suspense}))throw v.error;if((A=(C=f.getDefaultOptions().queries)==null?void 0:C._experimental_afterQuery)==null||A.call(C,h,v),h.experimental_prefetchInRender&&!ur.isServer()&&Q0(v,c)){const O=g?mg(h,x,u):m==null?void 0:m.promise;O==null||O.catch(It).finally(()=>{x.updateResult()})}return h.notifyOnChangeProps?v:x.trackResult(v)}function he(a,s){return pv(a,uv)}function Ye(a,s){const r=qn(),[c]=S.useState(()=>new R0(r,a));S.useEffect(()=>{c.setOptions(a)},[c,a]);const u=S.useSyncExternalStore(S.useCallback(h=>c.subscribe(Et.batchCalls(h)),[c]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),f=S.useCallback((h,m)=>{c.mutate(h,m).catch(It)},[c]);if(u.error&&kf(c.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}function yv(a,s){return pv(a,E0)}const H0="exellix-memorix-agents.selected-agent",gv=S.createContext({agentId:"",setAgentId:()=>{},agentQueryParam:void 0});function K0({children:a,storageKey:s=H0}){const[r,c]=S.useState(()=>localStorage.getItem(s)??""),u=h=>{c(h),h?localStorage.setItem(s,h):localStorage.removeItem(s)},f=S.useMemo(()=>({agentId:r,setAgentId:u,agentQueryParam:r||void 0}),[r]);return n.jsx(gv.Provider,{value:f,children:a})}function Bn(){return S.useContext(gv)}const G0="/api/memorix-agents";async function ga(a,s,r){const c=`${a.replace(/\/$/,"")}${s}`,u=await fetch(c,r);if(!u.ok){const f=await u.json().catch(()=>({}));throw new Error(String(f.error??`${u.status} ${u.statusText}`))}return u.json()}function I0(a){return{listAgents:()=>ga(a,""),getAgent:s=>ga(a,`/${encodeURIComponent(s)}`),createAgent:s=>ga(a,"",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),updateAgent:(s,r)=>ga(a,`/${encodeURIComponent(s)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),deleteAgent:s=>ga(a,`/${encodeURIComponent(s)}`,{method:"DELETE"}),listObjectTypeScopes:()=>ga(a,"/object-types"),bindObjectTypeToAgent:(s,r)=>ga(a,`/${encodeURIComponent(s)}/bind/${encodeURIComponent(r)}`,{method:"POST"}),unbindObjectTypeFromAgent:(s,r)=>ga(a,`/${encodeURIComponent(s)}/bind/${encodeURIComponent(r)}`,{method:"DELETE"}),setObjectTypeScopeAgents:(s,r)=>ga(a,`/object-types/${encodeURIComponent(s)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:r})})}}const pg=new Map;function vv(a=G0){const s=a.replace(/\/$/,""),r=pg.get(s);if(r)return r;const c=I0(s);return pg.set(s,c),c}vv();function Y0({client:a,apiBase:s,className:r}){const c=S.useMemo(()=>a??vv(s),[a,s]),{agentId:u,setAgentId:f}=Bn(),[h,m]=S.useState([]),[p,g]=S.useState(!0),x=S.useCallback(async()=>{g(!0);try{m(await c.listAgents())}catch{m([])}finally{g(!1)}},[c]);S.useEffect(()=>{x()},[x]);const v=h.find(j=>j.id===u),N=u&&(h.length===0||v)?u:"";return n.jsxs("div",{className:`memorix-agents-scope${u?" scoped":""}${r?` ${r}`:""}`,title:"Filter views to one agent, or leave unscoped for all agents",children:[n.jsx("span",{className:"memorix-agents-scope-label",children:"Agent"}),n.jsxs("div",{className:"memorix-agents-scope-control",children:[n.jsxs("select",{className:`memorix-agents-scope-select${u?" scoped":""}`,value:N,onChange:j=>f(j.target.value),"aria-label":"Agent context filter",children:[n.jsx("option",{value:"",children:p?"Loading…":"Any agent"}),h.map(j=>n.jsx("option",{value:j.id,children:j.name===j.id?j.id:`${j.name} (${j.id})`},j.id)),u&&!v&&!p&&n.jsx("option",{value:u,children:u})]}),n.jsx("span",{className:"memorix-agents-scope-chevron","aria-hidden":"true",children:"▾"})]}),u&&n.jsx("button",{type:"button",className:"memorix-agents-scope-clear",onClick:()=>f(""),"aria-label":"Show all agents (clear scope)",title:"Any agent",children:"×"})]})}/**
|
|
50
|
-
* react-router v7.18.0
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var Df=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,xv=/^[\\/]{2}/;function P0(a,s){return s+a.replace(/\\/g,"/")}var yg="popstate";function gg(a){return typeof a=="object"&&a!=null&&"pathname"in a&&"search"in a&&"hash"in a&&"state"in a&&"key"in a}function F0(a={}){function s(c,u){var g;let f=(g=u.state)==null?void 0:g.masked,{pathname:h,search:m,hash:p}=f||c.location;return gf("",{pathname:h,search:m,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",f?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function r(c,u){return typeof u=="string"?u:dr(u)}return V0(s,r,null,a)}function st(a,s){if(a===!1||a===null||typeof a>"u")throw new Error(s)}function Dn(a,s){if(!a){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function X0(){return Math.random().toString(36).substring(2,10)}function vg(a,s){return{usr:a.state,key:a.key,idx:s,masked:a.mask?{pathname:a.pathname,search:a.search,hash:a.hash}:void 0}}function gf(a,s,r=null,c,u){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof s=="string"?ti(s):s,state:r,key:s&&s.key||c||X0(),mask:u}}function dr({pathname:a="/",search:s="",hash:r=""}){return s&&s!=="?"&&(a+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(a+=r.charAt(0)==="#"?r:"#"+r),a}function ti(a){let s={};if(a){let r=a.indexOf("#");r>=0&&(s.hash=a.substring(r),a=a.substring(0,r));let c=a.indexOf("?");c>=0&&(s.search=a.substring(c),a=a.substring(0,c)),a&&(s.pathname=a)}return s}function V0(a,s,r,c={}){let{window:u=document.defaultView,v5Compat:f=!1}=c,h=u.history,m="POP",p=null,g=x();g==null&&(g=0,h.replaceState({...h.state,idx:g},""));function x(){return(h.state||{idx:null}).idx}function v(){m="POP";let A=x(),O=A==null?null:A-g;g=A,p&&p({action:m,location:C.location,delta:O})}function N(A,O){m="PUSH";let Q=gg(A)?A:gf(C.location,A,O);g=x()+1;let B=vg(Q,g),z=C.createHref(Q.mask||Q);try{h.pushState(B,"",z)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;u.location.assign(z)}f&&p&&p({action:m,location:C.location,delta:1})}function j(A,O){m="REPLACE";let Q=gg(A)?A:gf(C.location,A,O);g=x();let B=vg(Q,g),z=C.createHref(Q.mask||Q);h.replaceState(B,"",z),f&&p&&p({action:m,location:C.location,delta:0})}function E(A){return J0(u,A)}let C={get action(){return m},get location(){return a(u,h)},listen(A){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(yg,v),p=A,()=>{u.removeEventListener(yg,v),p=null}},createHref(A){return s(u,A)},createURL:E,encodeLocation(A){let O=E(A);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:N,replace:j,go(A){return h.go(A)}};return C}function J0(a,s,r=!1){let c="http://localhost";a&&(c=a.location.origin!=="null"?a.location.origin:a.location.href),st(c,"No window.location.(origin|href) available to create URL");let u=typeof s=="string"?s:dr(s);return u=u.replace(/ $/,"%20"),!r&&xv.test(u)&&(u=c+u),new URL(u,c)}function jv(a,s,r="/"){return Z0(a,s,r,!1)}function Z0(a,s,r,c,u){let f=typeof s=="string"?ti(s):s,h=Oa(f.pathname||"/",r);if(h==null)return null;let m=W0(a),p=null,g=uS(h);for(let x=0;p==null&&x<m.length;++x)p=oS(m[x],g,c);return p}function W0(a){let s=bv(a);return eS(s),s}function bv(a,s=[],r=[],c="",u=!1){let f=(h,m,p=u,g)=>{let x={relativePath:g===void 0?h.path||"":g,caseSensitive:h.caseSensitive===!0,childrenIndex:m,route:h};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(c)&&p)return;st(x.relativePath.startsWith(c),`Absolute route path "${x.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(c.length)}let v=Hn([c,x.relativePath]),N=r.concat(x);h.children&&h.children.length>0&&(st(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),bv(h.children,s,N,v,p)),!(h.path==null&&!h.index)&&s.push({path:v,score:rS(v,h.index),routesMeta:N.map((j,E)=>{let[C,A]=Cv(j.relativePath,j.caseSensitive,E===N.length-1);return{...j,matcher:C,compiledParams:A}})})};return a.forEach((h,m)=>{var p;if(h.path===""||!((p=h.path)!=null&&p.includes("?")))f(h,m);else for(let g of Sv(h.path))f(h,m,!0,g)}),s}function Sv(a){let s=a.split("/");if(s.length===0)return[];let[r,...c]=s,u=r.endsWith("?"),f=r.replace(/\?$/,"");if(c.length===0)return u?[f,""]:[f];let h=Sv(c.join("/")),m=[];return m.push(...h.map(p=>p===""?f:[f,p].join("/"))),u&&m.push(...h),m.map(p=>a.startsWith("/")&&p===""?"/":p)}function eS(a){a.sort((s,r)=>s.score!==r.score?r.score-s.score:cS(s.routesMeta.map(c=>c.childrenIndex),r.routesMeta.map(c=>c.childrenIndex)))}var tS=/^:[\w-]+$/,nS=3,aS=2,lS=1,sS=10,iS=-2,xg=a=>a==="*";function rS(a,s){let r=a.split("/"),c=r.length;return r.some(xg)&&(c+=iS),s&&(c+=aS),r.filter(u=>!xg(u)).reduce((u,f)=>u+(tS.test(f)?nS:f===""?lS:sS),c)}function cS(a,s){return a.length===s.length&&a.slice(0,-1).every((c,u)=>c===s[u])?a[a.length-1]-s[s.length-1]:0}function oS(a,s,r=!1){let{routesMeta:c}=a,u={},f="/",h=[];for(let m=0;m<c.length;++m){let p=c[m],g=m===c.length-1,x=f==="/"?s:s.slice(f.length)||"/",v={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},N=p.matcher&&p.compiledParams?Nv(v,x,p.matcher,p.compiledParams):eo(v,x),j=p.route;if(!N&&g&&r&&!c[c.length-1].route.index&&(N=eo({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},x)),!N)return null;Object.assign(u,N.params),h.push({params:u,pathname:Hn([f,N.pathname]),pathnameBase:hS(Hn([f,N.pathnameBase])),route:j}),N.pathnameBase!=="/"&&(f=Hn([f,N.pathnameBase]))}return h}function eo(a,s){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[r,c]=Cv(a.path,a.caseSensitive,a.end);return Nv(a,s,r,c)}function Nv(a,s,r,c){let u=s.match(r);if(!u)return null;let f=u[0],h=f.replace(/(.)\/+$/,"$1"),m=u.slice(1);return{params:c.reduce((g,{paramName:x,isOptional:v},N)=>{if(x==="*"){let E=m[N]||"";h=f.slice(0,f.length-E.length).replace(/(.)\/+$/,"$1")}const j=m[N];return v&&!j?g[x]=void 0:g[x]=(j||"").replace(/%2F/g,"/"),g},{}),pathname:f,pathnameBase:h,pattern:a}}function Cv(a,s=!1,r=!0){Dn(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let c=[],u="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,m,p,g,x)=>{if(c.push({paramName:m,isOptional:p!=null}),p){let v=x.charAt(g+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return a.endsWith("*")?(c.push({paramName:"*"}),u+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?u+="\\/*$":a!==""&&a!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,s?void 0:"i"),c]}function uS(a){try{return a.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Dn(!1,`The URL path "${a}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),a}}function Oa(a,s){if(s==="/")return a;if(!a.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,c=a.charAt(r);return c&&c!=="/"?null:a.slice(r)||"/"}function dS(a,s="/"){let{pathname:r,search:c="",hash:u=""}=typeof a=="string"?ti(a):a,f;return r?(r=Ev(r),r.startsWith("/")?f=jg(r.substring(1),"/"):f=jg(r,s)):f=s,{pathname:f,search:mS(c),hash:pS(u)}}function jg(a,s){let r=to(s).split("/");return a.split("/").forEach(u=>{u===".."?r.length>1&&r.pop():u!=="."&&r.push(u)}),r.length>1?r.join("/"):"/"}function _d(a,s,r,c){return`Cannot include a '${a}' character in a manually specified \`to.${s}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function fS(a){return a.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function qf(a){let s=fS(a);return s.map((r,c)=>c===s.length-1?r.pathname:r.pathnameBase)}function io(a,s,r,c=!1){let u;typeof a=="string"?u=ti(a):(u={...a},st(!u.pathname||!u.pathname.includes("?"),_d("?","pathname","search",u)),st(!u.pathname||!u.pathname.includes("#"),_d("#","pathname","hash",u)),st(!u.search||!u.search.includes("#"),_d("#","search","hash",u)));let f=a===""||u.pathname==="",h=f?"/":u.pathname,m;if(h==null)m=r;else{let v=s.length-1;if(!c&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),v-=1;u.pathname=N.join("/")}m=v>=0?s[v]:"/"}let p=dS(u,m),g=h&&h!=="/"&&h.endsWith("/"),x=(f||h===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(g||x)&&(p.pathname+="/"),p}var Ev=a=>a.replace(/[\\/]{2,}/g,"/"),Hn=a=>Ev(a.join("/")),to=a=>a.replace(/\/+$/,""),hS=a=>to(a).replace(/^\/*/,"/"),mS=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,pS=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a,yS=class{constructor(a,s,r,c=!1){this.status=a,this.statusText=s||"",this.internal=c,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function gS(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}function vS(a){let s=a.map(r=>r.route.path).filter(Boolean);return Hn(s)||"/"}var Tv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wv(a,s){let r=a;if(typeof r!="string"||!Df.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let c=r,u=!1;if(Tv)try{let f=new URL(window.location.href),h=xv.test(r)?new URL(P0(r,f.protocol)):new URL(r),m=Oa(h.pathname,s);h.origin===f.origin&&m!=null?r=m+h.search+h.hash:u=!0}catch{Dn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:u,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Rv=["POST","PUT","PATCH","DELETE"];new Set(Rv);var xS=["GET",...Rv];new Set(xS);var jS=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function bS(a){try{return jS.includes(new URL(a).protocol)}catch{return!1}}var ni=S.createContext(null);ni.displayName="DataRouter";var ro=S.createContext(null);ro.displayName="DataRouterState";var Av=S.createContext(!1);function SS(){return S.useContext(Av)}var Ov=S.createContext({isTransitioning:!1});Ov.displayName="ViewTransition";var NS=S.createContext(new Map);NS.displayName="Fetchers";var CS=S.createContext(null);CS.displayName="Await";var mn=S.createContext(null);mn.displayName="Navigation";var jr=S.createContext(null);jr.displayName="Location";var Kn=S.createContext({outlet:null,matches:[],isDataRoute:!1});Kn.displayName="Route";var Bf=S.createContext(null);Bf.displayName="RouteError";var Mv="REACT_ROUTER_ERROR",ES="REDIRECT",TS="ROUTE_ERROR_RESPONSE";function wS(a){if(a.startsWith(`${Mv}:${ES}:{`))try{let s=JSON.parse(a.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function RS(a){if(a.startsWith(`${Mv}:${TS}:{`))try{let s=JSON.parse(a.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new yS(s.status,s.statusText,s.data)}catch{}}function AS(a,{relative:s}={}){st(ai(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:c}=S.useContext(mn),{hash:u,pathname:f,search:h}=br(a,{relative:s}),m=f;return r!=="/"&&(m=f==="/"?r:Hn([r,f])),c.createHref({pathname:m,search:h,hash:u})}function ai(){return S.useContext(jr)!=null}function pn(){return st(ai(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(jr).location}var kv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function zv(a){S.useContext(mn).static||S.useLayoutEffect(a)}function yn(){let{isDataRoute:a}=S.useContext(Kn);return a?HS():OS()}function OS(){st(ai(),"useNavigate() may be used only in the context of a <Router> component.");let a=S.useContext(ni),{basename:s,navigator:r}=S.useContext(mn),{matches:c}=S.useContext(Kn),{pathname:u}=pn(),f=JSON.stringify(qf(c)),h=S.useRef(!1);return zv(()=>{h.current=!0}),S.useCallback((p,g={})=>{if(Dn(h.current,kv),!h.current)return;if(typeof p=="number"){r.go(p);return}let x=io(p,JSON.parse(f),u,g.relative==="path");a==null&&s!=="/"&&(x.pathname=x.pathname==="/"?s:Hn([s,x.pathname])),(g.replace?r.replace:r.push)(x,g.state,g)},[s,r,f,u,a])}S.createContext(null);function li(){let{matches:a}=S.useContext(Kn),s=a[a.length-1];return(s==null?void 0:s.params)??{}}function br(a,{relative:s}={}){let{matches:r}=S.useContext(Kn),{pathname:c}=pn(),u=JSON.stringify(qf(r));return S.useMemo(()=>io(a,JSON.parse(u),c,s==="path"),[a,u,c,s])}function MS(a,s){return Dv(a,s)}function Dv(a,s,r){var A;st(ai(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=S.useContext(mn),{matches:u}=S.useContext(Kn),f=u[u.length-1],h=f?f.params:{},m=f?f.pathname:"/",p=f?f.pathnameBase:"/",g=f&&f.route;{let O=g&&g.path||"";Bv(m,!g||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${O}">) 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.
|
|
59
|
-
|
|
60
|
-
Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let x=pn(),v;if(s){let O=typeof s=="string"?ti(s):s;st(p==="/"||((A=O.pathname)==null?void 0:A.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 "${O.pathname}" was given in the \`location\` prop.`),v=O}else v=x;let N=v.pathname||"/",j=N;if(p!=="/"){let O=p.replace(/^\//,"").split("/");j="/"+N.replace(/^\//,"").split("/").slice(O.length).join("/")}let E=r&&r.state.matches.length?r.state.matches.map(O=>Object.assign(O,{route:r.manifest[O.route.id]||O.route})):jv(a,{pathname:j});Dn(g||E!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Dn(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.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 C=BS(E&&E.map(O=>Object.assign({},O,{params:Object.assign({},h,O.params),pathname:Hn([p,c.encodeLocation?c.encodeLocation(O.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?p:Hn([p,c.encodeLocation?c.encodeLocation(O.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),u,r);return s&&C?S.createElement(jr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...v},navigationType:"POP"}},C):C}function kS(){let a=$S(),s=gS(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),r=a instanceof Error?a.stack:null,c="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:c},f={padding:"2px 4px",backgroundColor:c},h=null;return console.error("Error handled by React Router default ErrorBoundary:",a),h=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:f},"ErrorBoundary")," or"," ",S.createElement("code",{style:f},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},s),r?S.createElement("pre",{style:u},r):null,h)}var zS=S.createElement(kS,null),qv=class extends S.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,s){return s.location!==a.location||s.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:s.error,location:s.location,revalidation:a.revalidation||s.revalidation}}componentDidCatch(a,s){this.props.onError?this.props.onError(a,s):console.error("React Router caught the following error during render",a)}render(){let a=this.state.error;if(this.context&&typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){const r=RS(a.digest);r&&(a=r)}let s=a!==void 0?S.createElement(Kn.Provider,{value:this.props.routeContext},S.createElement(Bf.Provider,{value:a,children:this.props.component})):this.props.children;return this.context?S.createElement(DS,{error:a},s):s}};qv.contextType=Av;var Ud=new WeakMap;function DS({children:a,error:s}){let{basename:r}=S.useContext(mn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let c=wS(s.digest);if(c){let u=Ud.get(s);if(u)throw u;let f=wv(c.location,r),h=f.absoluteURL||f.to;if(bS(h))throw new Error("Invalid redirect location");if(Tv&&!Ud.get(s))if(f.isExternal||c.reloadDocument)window.location.href=h;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:c.replace}));throw Ud.set(s,m),m}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${h}`})}}return a}function qS({routeContext:a,match:s,children:r}){let c=S.useContext(ni);return c&&c.static&&c.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=s.route.id),S.createElement(Kn.Provider,{value:a},r)}function BS(a,s=[],r){let c=r==null?void 0:r.state;if(a==null){if(!c)return null;if(c.errors)a=c.matches;else if(s.length===0&&!c.initialized&&c.matches.length>0)a=c.matches;else return null}let u=a,f=c==null?void 0:c.errors;if(f!=null){let x=u.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);st(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),u=u.slice(0,Math.min(u.length,x+1))}let h=!1,m=-1;if(r&&c){h=c.renderFallback;for(let x=0;x<u.length;x++){let v=u[x];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(m=x),v.route.id){let{loaderData:N,errors:j}=c,E=v.route.loader&&!N.hasOwnProperty(v.route.id)&&(!j||j[v.route.id]===void 0);if(v.route.lazy||E){r.isStatic&&(h=!0),m>=0?u=u.slice(0,m+1):u=[u[0]];break}}}}let p=r==null?void 0:r.onError,g=c&&p?(x,v)=>{var N,j;p(x,{location:c.location,params:((j=(N=c.matches)==null?void 0:N[0])==null?void 0:j.params)??{},pattern:vS(c.matches),errorInfo:v})}:void 0;return u.reduceRight((x,v,N)=>{let j,E=!1,C=null,A=null;c&&(j=f&&v.route.id?f[v.route.id]:void 0,C=v.route.errorElement||zS,h&&(m<0&&N===0?(Bv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,A=null):m===N&&(E=!0,A=v.route.hydrateFallbackElement||null)));let O=s.concat(u.slice(0,N+1)),Q=()=>{let B;return j?B=C:E?B=A:v.route.Component?B=S.createElement(v.route.Component,null):v.route.element?B=v.route.element:B=x,S.createElement(qS,{match:v,routeContext:{outlet:x,matches:O,isDataRoute:c!=null},children:B})};return c&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?S.createElement(qv,{location:c.location,revalidation:c.revalidation,component:C,error:j,children:Q(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:g}):Q()},null)}function Lf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function LS(a){let s=S.useContext(ni);return st(s,Lf(a)),s}function _S(a){let s=S.useContext(ro);return st(s,Lf(a)),s}function US(a){let s=S.useContext(Kn);return st(s,Lf(a)),s}function _f(a){let s=US(a),r=s.matches[s.matches.length-1];return st(r.route.id,`${a} can only be used on routes that contain a unique "id"`),r.route.id}function QS(){return _f("useRouteId")}function $S(){var c;let a=S.useContext(Bf),s=_S("useRouteError"),r=_f("useRouteError");return a!==void 0?a:(c=s.errors)==null?void 0:c[r]}function HS(){let{router:a}=LS("useNavigate"),s=_f("useNavigate"),r=S.useRef(!1);return zv(()=>{r.current=!0}),S.useCallback(async(u,f={})=>{Dn(r.current,kv),r.current&&(typeof u=="number"?await a.navigate(u):await a.navigate(u,{fromRouteId:s,...f}))},[a,s])}var bg={};function Bv(a,s,r){!s&&!bg[a]&&(bg[a]=!0,Dn(!1,r))}S.memo(KS);function KS({routes:a,manifest:s,future:r,state:c,isStatic:u,onError:f}){return Dv(a,void 0,{manifest:s,state:c,isStatic:u,onError:f})}function va({to:a,replace:s,state:r,relative:c}){st(ai(),"<Navigate> may be used only in the context of a <Router> component.");let{static:u}=S.useContext(mn);Dn(!u,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=S.useContext(Kn),{pathname:h}=pn(),m=yn(),p=io(a,qf(f),h,c==="path"),g=JSON.stringify(p);return S.useEffect(()=>{m(JSON.parse(g),{replace:s,state:r,relative:c})},[m,g,c,s,r]),null}function Ie(a){st(!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 GS({basename:a="/",children:s=null,location:r,navigationType:c="POP",navigator:u,static:f=!1,useTransitions:h}){st(!ai(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=a.replace(/^\/*/,"/"),p=S.useMemo(()=>({basename:m,navigator:u,static:f,useTransitions:h,future:{}}),[m,u,f,h]);typeof r=="string"&&(r=ti(r));let{pathname:g="/",search:x="",hash:v="",state:N=null,key:j="default",mask:E}=r,C=S.useMemo(()=>{let A=Oa(g,m);return A==null?null:{location:{pathname:A,search:x,hash:v,state:N,key:j,mask:E},navigationType:c}},[m,g,x,v,N,j,c,E]);return Dn(C!=null,`<Router basename="${m}"> is not able to match the URL "${g}${x}${v}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:S.createElement(mn.Provider,{value:p},S.createElement(jr.Provider,{children:s,value:C}))}function IS({children:a,location:s}){return MS(vf(a),s)}function vf(a,s=[]){let r=[];return S.Children.forEach(a,(c,u)=>{if(!S.isValidElement(c))return;let f=[...s,u];if(c.type===S.Fragment){r.push.apply(r,vf(c.props.children,f));return}st(c.type===Ie,`[${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>`),st(!c.props.index||!c.props.children,"An index route cannot have child routes.");let h={id:c.props.id||f.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&&(h.children=vf(c.props.children,f)),r.push(h)}),r}var Xc="get",Vc="application/x-www-form-urlencoded";function co(a){return typeof HTMLElement<"u"&&a instanceof HTMLElement}function YS(a){return co(a)&&a.tagName.toLowerCase()==="button"}function PS(a){return co(a)&&a.tagName.toLowerCase()==="form"}function FS(a){return co(a)&&a.tagName.toLowerCase()==="input"}function XS(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function VS(a,s){return a.button===0&&(!s||s==="_self")&&!XS(a)}function xf(a=""){return new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((s,r)=>{let c=a[r];return s.concat(Array.isArray(c)?c.map(u=>[r,u]):[[r,c]])},[]))}function JS(a,s){let r=xf(a);return s&&s.forEach((c,u)=>{r.has(u)||s.getAll(u).forEach(f=>{r.append(u,f)})}),r}var Kc=null;function ZS(){if(Kc===null)try{new FormData(document.createElement("form"),0),Kc=!1}catch{Kc=!0}return Kc}var WS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Qd(a){return a!=null&&!WS.has(a)?(Dn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vc}"`),null):a}function eN(a,s){let r,c,u,f,h;if(PS(a)){let m=a.getAttribute("action");c=m?Oa(m,s):null,r=a.getAttribute("method")||Xc,u=Qd(a.getAttribute("enctype"))||Vc,f=new FormData(a)}else if(YS(a)||FS(a)&&(a.type==="submit"||a.type==="image")){let m=a.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=a.getAttribute("formaction")||m.getAttribute("action");if(c=p?Oa(p,s):null,r=a.getAttribute("formmethod")||m.getAttribute("method")||Xc,u=Qd(a.getAttribute("formenctype"))||Qd(m.getAttribute("enctype"))||Vc,f=new FormData(m,a),!ZS()){let{name:g,type:x,value:v}=a;if(x==="image"){let N=g?`${g}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else g&&f.append(g,v)}}else{if(co(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Xc,c=null,u=Vc,h=a}return f&&u==="text/plain"&&(h=f,f=void 0),{action:c,method:r.toLowerCase(),encType:u,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Uf(a,s){if(a===!1||a===null||typeof a>"u")throw new Error(s)}function Lv(a,s,r,c){let u=typeof a=="string"?new URL(a,typeof window>"u"?"server://singlefetch/":window.location.origin):a;return r?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${c}`:u.pathname=`${u.pathname}.${c}`:u.pathname==="/"?u.pathname=`_root.${c}`:s&&Oa(u.pathname,s)==="/"?u.pathname=`${to(s)}/_root.${c}`:u.pathname=`${to(u.pathname)}.${c}`,u}async function tN(a,s){if(a.id in s)return s[a.id];try{let r=await import(a.module);return s[a.id]=r,r}catch(r){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nN(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function aN(a,s,r){let c=await Promise.all(a.map(async u=>{let f=s.routes[u.route.id];if(f){let h=await tN(f,r);return h.links?h.links():[]}return[]}));return rN(c.flat(1).filter(nN).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function Sg(a,s,r,c,u,f){let h=(p,g)=>r[g]?p.route.id!==r[g].route.id:!0,m=(p,g)=>{var x;return r[g].pathname!==p.pathname||((x=r[g].route.path)==null?void 0:x.endsWith("*"))&&r[g].params["*"]!==p.params["*"]};return f==="assets"?s.filter((p,g)=>h(p,g)||m(p,g)):f==="data"?s.filter((p,g)=>{var v;let x=c.routes[p.route.id];if(!x||!x.hasLoader)return!1;if(h(p,g)||m(p,g))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(a,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function lN(a,s,{includeHydrateFallback:r}={}){return sN(a.map(c=>{let u=s.routes[c.route.id];if(!u)return[];let f=[u.module];return u.clientActionModule&&(f=f.concat(u.clientActionModule)),u.clientLoaderModule&&(f=f.concat(u.clientLoaderModule)),r&&u.hydrateFallbackModule&&(f=f.concat(u.hydrateFallbackModule)),u.imports&&(f=f.concat(u.imports)),f}).flat(1))}function sN(a){return[...new Set(a)]}function iN(a){let s={},r=Object.keys(a).sort();for(let c of r)s[c]=a[c];return s}function rN(a,s){let r=new Set;return new Set(s),a.reduce((c,u)=>{let f=JSON.stringify(iN(u));return r.has(f)||(r.add(f),c.push({key:f,link:u})),c},[])}function Qf(){let a=S.useContext(ni);return Uf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function cN(){let a=S.useContext(ro);return Uf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var $f=S.createContext(void 0);$f.displayName="FrameworkContext";function oo(){let a=S.useContext($f);return Uf(a,"You must render this element inside a <HydratedRouter> element"),a}function oN(a,s){let r=S.useContext($f),[c,u]=S.useState(!1),[f,h]=S.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:g,onMouseLeave:x,onTouchStart:v}=s,N=S.useRef(null);S.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let C=O=>{O.forEach(Q=>{h(Q.isIntersecting)})},A=new IntersectionObserver(C,{threshold:.5});return N.current&&A.observe(N.current),()=>{A.disconnect()}}},[a]),S.useEffect(()=>{if(c){let C=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(C)}}},[c]);let j=()=>{u(!0)},E=()=>{u(!1),h(!1)};return r?a!=="intent"?[f,N,{}]:[f,N,{onFocus:tr(m,j),onBlur:tr(p,E),onMouseEnter:tr(g,j),onMouseLeave:tr(x,E),onTouchStart:tr(v,j)}]:[!1,N,{}]}function tr(a,s){return r=>{a&&a(r),r.defaultPrevented||s(r)}}function uN({page:a,...s}){let r=SS(),{nonce:c}=oo(),{router:u}=Qf(),f=S.useMemo(()=>jv(u.routes,a,u.basename),[u.routes,a,u.basename]);return f?(s.nonce==null&&c&&(s={...s,nonce:c}),r?S.createElement(fN,{page:a,matches:f,...s}):S.createElement(hN,{page:a,matches:f,...s})):null}function dN(a){let{manifest:s,routeModules:r}=oo(),[c,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return aN(a,s,r).then(h=>{f||u(h)}),()=>{f=!0}},[a,s,r]),c}function fN({page:a,matches:s,...r}){let c=pn(),{future:u}=oo(),{basename:f}=Qf(),h=S.useMemo(()=>{if(a===c.pathname+c.search+c.hash)return[];let m=Lv(a,f,u.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let x of s)typeof x.route.shouldRevalidate=="function"?p=!0:g.push(x.route.id);return p&&g.length>0&&m.searchParams.set("_routes",g.join(",")),[m.pathname+m.search]},[f,u.v8_trailingSlashAwareDataRequests,a,c,s]);return S.createElement(S.Fragment,null,h.map(m=>S.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})))}function hN({page:a,matches:s,...r}){let c=pn(),{future:u,manifest:f,routeModules:h}=oo(),{basename:m}=Qf(),{loaderData:p,matches:g}=cN(),x=S.useMemo(()=>Sg(a,s,g,f,c,"data"),[a,s,g,f,c]),v=S.useMemo(()=>Sg(a,s,g,f,c,"assets"),[a,s,g,f,c]),N=S.useMemo(()=>{if(a===c.pathname+c.search+c.hash)return[];let C=new Set,A=!1;if(s.forEach(Q=>{var z;let B=f.routes[Q.route.id];!B||!B.hasLoader||(!x.some(q=>q.route.id===Q.route.id)&&Q.route.id in p&&((z=h[Q.route.id])!=null&&z.shouldRevalidate)||B.hasClientLoader?A=!0:C.add(Q.route.id))}),C.size===0)return[];let O=Lv(a,m,u.v8_trailingSlashAwareDataRequests,"data");return A&&C.size>0&&O.searchParams.set("_routes",s.filter(Q=>C.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[O.pathname+O.search]},[m,u.v8_trailingSlashAwareDataRequests,p,c,f,x,s,a,h]),j=S.useMemo(()=>lN(v,f),[v,f]),E=dN(v);return S.createElement(S.Fragment,null,N.map(C=>S.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),j.map(C=>S.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),E.map(({key:C,link:A})=>S.createElement("link",{key:C,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function mN(...a){return s=>{a.forEach(r=>{typeof r=="function"?r(s):r!=null&&(r.current=s)})}}var pN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{pN&&(window.__reactRouterVersion="7.18.0")}catch{}function yN({basename:a,children:s,useTransitions:r,window:c}){let u=S.useRef();u.current==null&&(u.current=F0({window:c,v5Compat:!0}));let f=u.current,[h,m]=S.useState({action:f.action,location:f.location}),p=S.useCallback(g=>{r===!1?m(g):S.startTransition(()=>m(g))},[r]);return S.useLayoutEffect(()=>f.listen(p),[f,p]),S.createElement(GS,{basename:a,children:s,location:h.location,navigationType:h.action,navigator:f,useTransitions:r})}var je=S.forwardRef(function({onClick:s,discover:r="render",prefetch:c="none",relative:u,reloadDocument:f,replace:h,mask:m,state:p,target:g,to:x,preventScrollReset:v,viewTransition:N,defaultShouldRevalidate:j,...E},C){let{basename:A,navigator:O,useTransitions:Q}=S.useContext(mn),B=typeof x=="string"&&Df.test(x),z=wv(x,A);x=z.to;let q=AS(x,{relative:u}),V=pn(),Z=null;if(m){let ve=io(m,[],V.mask?V.mask.pathname:"/",!0);A!=="/"&&(ve.pathname=ve.pathname==="/"?A:Hn([A,ve.pathname])),Z=O.createHref(ve)}let[I,te,ye]=oN(c,E),ue=xN(x,{replace:h,mask:m,state:p,target:g,preventScrollReset:v,relative:u,viewTransition:N,defaultShouldRevalidate:j,useTransitions:Q});function re(ve){s&&s(ve),ve.defaultPrevented||ue(ve)}let Ce=!(z.isExternal||f),Te=S.createElement("a",{...E,...ye,href:(Ce?Z:void 0)||z.absoluteURL||q,onClick:Ce?re:s,ref:mN(C,te),target:g,"data-discover":!B&&r==="render"?"true":void 0});return I&&!B?S.createElement(S.Fragment,null,Te,S.createElement(uN,{page:q})):Te});je.displayName="Link";var Sa=S.forwardRef(function({"aria-current":s="page",caseSensitive:r=!1,className:c="",end:u=!1,style:f,to:h,viewTransition:m,children:p,...g},x){let v=br(h,{relative:g.relative}),N=pn(),j=S.useContext(ro),{navigator:E,basename:C}=S.useContext(mn),A=j!=null&&CN(v)&&m===!0,O=E.encodeLocation?E.encodeLocation(v).pathname:v.pathname,Q=N.pathname,B=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),B=B?B.toLowerCase():null,O=O.toLowerCase()),B&&C&&(B=Oa(B,C)||B);const z=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let q=Q===O||!u&&Q.startsWith(O)&&Q.charAt(z)==="/",V=B!=null&&(B===O||!u&&B.startsWith(O)&&B.charAt(O.length)==="/"),Z={isActive:q,isPending:V,isTransitioning:A},I=q?s:void 0,te;typeof c=="function"?te=c(Z):te=[c,q?"active":null,V?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let ye=typeof f=="function"?f(Z):f;return S.createElement(je,{...g,"aria-current":I,className:te,ref:x,style:ye,to:h,viewTransition:m},typeof p=="function"?p(Z):p)});Sa.displayName="NavLink";var gN=S.forwardRef(({discover:a="render",fetcherKey:s,navigate:r,reloadDocument:c,replace:u,state:f,method:h=Xc,action:m,onSubmit:p,relative:g,preventScrollReset:x,viewTransition:v,defaultShouldRevalidate:N,...j},E)=>{let{useTransitions:C}=S.useContext(mn),A=SN(),O=NN(m,{relative:g}),Q=h.toLowerCase()==="get"?"get":"post",B=typeof m=="string"&&Df.test(m),z=q=>{if(p&&p(q),q.defaultPrevented)return;q.preventDefault();let V=q.nativeEvent.submitter,Z=(V==null?void 0:V.getAttribute("formmethod"))||h,I=()=>A(V||q.currentTarget,{fetcherKey:s,method:Z,navigate:r,replace:u,state:f,relative:g,preventScrollReset:x,viewTransition:v,defaultShouldRevalidate:N});C&&r!==!1?S.startTransition(()=>I()):I()};return S.createElement("form",{ref:E,method:Q,action:O,onSubmit:c?p:z,...j,"data-discover":!B&&a==="render"?"true":void 0})});gN.displayName="Form";function vN(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _v(a){let s=S.useContext(ni);return st(s,vN(a)),s}function xN(a,{target:s,replace:r,mask:c,state:u,preventScrollReset:f,relative:h,viewTransition:m,defaultShouldRevalidate:p,useTransitions:g}={}){let x=yn(),v=pn(),N=br(a,{relative:h});return S.useCallback(j=>{if(VS(j,s)){j.preventDefault();let E=r!==void 0?r:dr(v)===dr(N),C=()=>x(a,{replace:E,mask:c,state:u,preventScrollReset:f,relative:h,viewTransition:m,defaultShouldRevalidate:p});g?S.startTransition(()=>C()):C()}},[v,x,N,r,c,u,s,a,f,h,m,p,g])}function si(a){Dn(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 s=S.useRef(xf(a)),r=S.useRef(!1),c=pn(),u=S.useMemo(()=>JS(c.search,r.current?null:s.current),[c.search]),f=yn(),h=S.useCallback((m,p)=>{const g=xf(typeof m=="function"?m(new URLSearchParams(u)):m);r.current=!0,f("?"+g,p)},[f,u]);return[u,h]}var jN=0,bN=()=>`__${String(++jN)}__`;function SN(){let{router:a}=_v("useSubmit"),{basename:s}=S.useContext(mn),r=QS(),c=a.fetch,u=a.navigate;return S.useCallback(async(f,h={})=>{let{action:m,method:p,encType:g,formData:x,body:v}=eN(f,s);if(h.navigate===!1){let N=h.fetcherKey||bN();await c(N,r,h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:x,body:v,formMethod:h.method||p,formEncType:h.encType||g,flushSync:h.flushSync})}else await u(h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:x,body:v,formMethod:h.method||p,formEncType:h.encType||g,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[c,u,s,r])}function NN(a,{relative:s}={}){let{basename:r}=S.useContext(mn),c=S.useContext(Kn);st(c,"useFormAction must be used inside a RouteContext");let[u]=c.matches.slice(-1),f={...br(a||".",{relative:s})},h=pn();if(a==null){f.search=h.search;let m=new URLSearchParams(f.search),p=m.getAll("index");if(p.some(x=>x==="")){m.delete("index"),p.filter(v=>v).forEach(v=>m.append("index",v));let x=m.toString();f.search=x?`?${x}`:""}}return(!a||a===".")&&u.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Hn([r,f.pathname])),dr(f)}function CN(a,{relative:s}={}){let r=S.useContext(Ov);st(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=_v("useViewTransitionState"),u=br(a,{relative:s});if(!r.isTransitioning)return!1;let f=Oa(r.currentLocation.pathname,c)||r.currentLocation.pathname,h=Oa(r.nextLocation.pathname,c)||r.nextLocation.pathname;return eo(u.pathname,h)!=null||eo(u.pathname,f)!=null}const EN="/api";async function pl(a,s,r){var h;const c=typeof window<"u"&&((h=window.location)!=null&&h.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost",u=new URL(EN+a,c);if(r)for(const[m,p]of Object.entries(r))p!==void 0&&p!==""&&u.searchParams.set(m,String(p));const f=await fetch(u.toString(),s);if(!f.ok){const m=await f.json().catch(()=>({}));throw new Error(String(m.error??`${f.status} ${f.statusText}`))}return f.json()}const Oe=(a,s)=>pl(a,void 0,s),ct=(a,s)=>pl(a,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0}),Ng=(a,s)=>pl(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),TN=a=>pl(a,{method:"DELETE"}),wN={health:()=>Oe("/health"),ready:()=>Oe("/ready"),config:()=>Oe("/config"),queueSettings:()=>Oe("/settings"),saveQueueSettings:a=>Ng("/settings",a),pushQueue:a=>ct("/queue/push",a),executeRun:(a,s)=>ct(`/factory-runs/${encodeURIComponent(a)}/execute`,s===void 0?{}:{force:s}),queueRunNext:a=>ct(`/factory-runs/${encodeURIComponent(a)}/queue-next`),statsByStatus:a=>Oe("/stats/by-status",{jobDefId:a}),throughput:a=>Oe("/stats/throughput",a),stuck:a=>Oe("/stats/stuck",a),runs:a=>Oe("/runs",a),recentFailures:a=>Oe("/runs/recent-failures",a),run:a=>Oe(`/runs/${a}`),runEvents:a=>Oe(`/runs/${a}/events`),runActivities:(a,s)=>Oe(`/factory-runs/${encodeURIComponent(a)}/activities`,s?{limit:s}:void 0),retryRun:a=>ct(`/factory-runs/${a}/retry`),cancelRun:a=>ct(`/factory-runs/${a}/cancel`),cancelRuns:a=>ct("/factory-runs/cancel",{runIds:a}),cancelAllRuns:a=>ct("/factory-runs/cancel-all",a),itemRuns:a=>Oe(`/items/${a}/runs`),itemGraph:a=>Oe(`/items/${a}/graph`),filters:()=>Oe("/meta/filters"),compatibleGraphs:a=>Oe("/meta/graphs",a),descriptors:()=>Oe("/descriptors"),entitySources:a=>Oe(`/entities/${encodeURIComponent(a)}/sources`),entityRelations:a=>Oe(`/entities/${encodeURIComponent(a)}/relations`),entityRecordSamples:(a,s)=>Oe(`/entities/${encodeURIComponent(a)}/record-samples`,{...s,random:s.random?"1":void 0}),jobDefs:()=>Oe("/job-defs"),jobDef:a=>Oe(`/job-defs/${a}`),saveJobDef:a=>ct("/job-defs",a),updateJobDef:(a,s)=>Ng(`/job-defs/${a}`,s),deleteJobDef:a=>TN(`/job-defs/${a}`),enqueue:a=>ct("/jobs/enqueue",a),previewContext:a=>ct("/context/preview",a),executeGraph:a=>ct("/graphs/execute",a),records:a=>Oe("/records",a),recordStats:a=>Oe("/records/stats",a),recordGraphRuns:(a,s)=>Oe(`/records/${encodeURIComponent(a)}/graph-runs`,s),listEntities:a=>Oe("/entities/summary",a?{agent:a}:void 0),entitySummary:a=>Oe(`/entities/${encodeURIComponent(a)}/summary`),listNarratives:a=>Oe("/narratives",a?{entity:a}:void 0),graphsForEntity:a=>Oe("/graphs",{entity:a}),coreRecords:a=>{var s;return Oe("/core-records",{entity:a.entity,collection:a.collection,narratives:(s=a.narratives)==null?void 0:s.join(","),processingGraphId:a.processingGraphId,processingCondition:a.processingCondition,search:a.search,page:a.page,pageSize:a.pageSize})},coreRecord:(a,s,r,c)=>Oe(`/core-records/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,{collection:r,includeDoc:c?"1":void 0}),deleteCoreRecord:(a,s,r)=>pl(`/core-records/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,{method:"DELETE"},{collection:r}),clearCoreRecords:a=>ct("/core-records/clear",a),resetGraphRun:(a,s)=>ct(`/records/${encodeURIComponent(a)}/reset-graph-run`,s),previewMatching:a=>ct("/selection/preview",a),listWork:a=>Oe("/work",a?{agent:a}:void 0),work:a=>Oe(`/work/${a}`),createWork:a=>ct("/work",a),setWorkStatus:(a,s)=>pl(`/work/${a}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:s})}),updateWork:(a,s)=>pl(`/work/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),runEvaluation:a=>ct(`/work/${a}/evaluate`),deleteWork:a=>pl(`/work/${a}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),workEvaluations:a=>Oe(`/work/${a}/evaluations`),listBatches:()=>Oe("/batches"),batch:a=>Oe(`/batches/${a}`),batchFailureBreakdown:a=>Oe(`/batches/${encodeURIComponent(a)}/failure-breakdown`),factoryPreflight:a=>ct("/factory/preflight",a),retryAllFactoryRuns:a=>ct("/factory-runs/retry-all",a),recoverBatch:(a,s)=>ct(`/batches/${encodeURIComponent(a)}/recover`,s),queueBatch:a=>ct("/batches",a),queueSingle:a=>ct("/on-demand/single",a),assemblerProperties:a=>Oe("/assembler/properties",a),assemblerPreview:a=>ct("/assembler/preview",a),factoryRuns:a=>Oe("/factory-runs",a),factoryRun:a=>Oe(`/factory-runs/${a}`),runStatusCounts:(a,s)=>Oe("/factory-runs/status-counts",{scope:a,agent:s}),clearJobs:()=>ct("/jobs/clear",{confirm:!0})},ee=wN,Uv={configured:{label:"Configured",tone:"pending"},evaluating:{label:"Evaluating",tone:"running"},matched:{label:"Matched",tone:"pending"},queued:{label:"Queued",tone:"pending"},pending:{label:"Pending",tone:"pending"},running:{label:"Running",tone:"running"},succeeded:{label:"Succeeded",tone:"done"},done:{label:"Done",tone:"done"},failed:{label:"Failed",tone:"failed"},cancelled:{label:"Cancelled",tone:"cancelled"},skipped:{label:"Skipped",tone:"cancelled"},excluded:{label:"Excluded",tone:"blocked"},blocked:{label:"Blocked",tone:"blocked"},active:{label:"Active",tone:"running"},inactive:{label:"Inactive",tone:"cancelled"},completed:{label:"Completed",tone:"done"},partial:{label:"Partial",tone:"blocked"},"not-processed":{label:"Not processed",tone:"pending"},in_progress:{label:"In progress",tone:"running"},never:{label:"Never",tone:"pending"},unknown:{label:"Unknown",tone:"cancelled"}};function RN(a){var s;return((s=Uv[a])==null?void 0:s.label)??a.replace(/[-_]/g," ")}function AN(a){var s;return((s=Uv[a])==null?void 0:s.tone)??"pending"}function Ht({status:a}){return n.jsx("span",{className:`badge badge-${AN(a)}`,children:RN(a)})}const ON=[{label:"5s",ms:5e3},{label:"15s",ms:15e3},{label:"30s",ms:3e4},{label:"Off",ms:0}];function Qv({onRefresh:a,intervalMs:s=5e3,lastRefreshed:r}){const[c,u]=S.useState(s),[f,h]=S.useState(!1),m=S.useRef(null);return S.useEffect(()=>{if(!(f||c===0))return m.current=setTimeout(()=>a(),c),()=>{m.current&&clearTimeout(m.current)}},[a,c,f,r]),n.jsxs("div",{className:"refresh-control",children:[n.jsx("span",{className:`refresh-dot${f||c===0?" paused":""}`}),r&&n.jsx("span",{children:r.toLocaleTimeString()}),n.jsx("select",{value:c,onChange:p=>{const g=Number(p.target.value);u(g),h(g===0)},style:{minWidth:"unset",width:60},children:ON.map(({label:p,ms:g})=>n.jsx("option",{value:g,children:p},g))}),n.jsx("button",{onClick:()=>{h(p=>!p)},title:f?"Resume auto-refresh":"Pause auto-refresh",style:{padding:"3px 8px"},children:f?"▶":"⏸"}),n.jsx("button",{onClick:a,title:"Refresh now",style:{padding:"3px 8px"},children:"↻"})]})}function MN({buckets:a}){if(!a.length)return n.jsx("div",{className:"text-dim",style:{fontSize:12,padding:"8px 0"},children:"No throughput data"});const s=new Map;for(const u of a)s.set(u.bucket,(s.get(u.bucket)??0)+u.count);const r=[...s.entries()].sort((u,f)=>u[0].localeCompare(f[0])),c=Math.max(...r.map(([,u])=>u),1);return n.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:48,marginTop:8},children:r.map(([u,f])=>n.jsx("div",{title:`${new Date(u).toLocaleString()}: ${f}`,style:{flex:1,minWidth:4,height:`${Math.max(8,f/c*100)}%`,background:"var(--color-accent)",borderRadius:2,opacity:.85}},u))})}function Ma(a){if(!a)return"—";const s=Date.now()-new Date(a).getTime(),r=Math.abs(s),c=s<0,u=Math.round(r/6e4);if(u<1)return c?"in <1m":"just now";if(u<60)return c?`in ${u}m`:`${u}m ago`;const f=Math.round(u/60);if(f<24)return c?`in ${f}h`:`${f}h ago`;const h=Math.round(f/24);return c?`in ${h}d`:`${h}d ago`}function Mt(a){return a?new Date(a).toLocaleString():"—"}function fr(a){return a%1440===0?`every ${a/1440} day${a===1440?"":"s"}`:a%60===0?`every ${a/60} hour${a===60?"":"s"}`:`every ${a} min`}const kN={ttl:"TTL reprocessing",skip:"Skip processed","failed-only":"Failed only",all:"Reprocess all","before-date":"Before date","after-date":"After date",condition:"Conditional"};function zN(a){const s=(a==null?void 0:a.reprocessingMode)??"ttl";if(s==="ttl"){const r=(a==null?void 0:a.reprocessingTtl)??{value:7,unit:"days"};return`Re-run after ${r.value} ${r.unit}`}return kN[s]}function DN(a){if(!a)return{};const s=a.match(/^(\d+)\s+enqueued\s+of\s+(\d+)\s+matched$/i);return s?{enqueued:Number(s[1]),matched:Number(s[2])}:{raw:a}}const gl="inferences",wa={continuous:"Ongoing Work","on-demand-single":"On-Demand Single","on-demand-batch":"On-Demand Batch"},qN={entity:"Entities",event:"Events",knowledge:"Knowledge"},$v={"already-processed":"Already completed successfully","already-queued":"Already queued (pending/blocked)","already-running":"Currently running for this graph","missing-narrative":"Missing a required narrative","incompatible-graph":"Graph not compatible with this item","missing-data":"Item is missing required data","metadata-unavailable":"Metadata unavailable","changed-since-eligible":"Changed or became ineligible since preview","prerequisite-graph-not-met":"Required prior processing not completed","cross-entity-prerequisite-not-met":"Linked entity information not yet processed"},Hv={ttl:"Re-run if older than… (default)",skip:"Skip — never re-run already-processed information","failed-only":"Failed only — re-run information where last attempt failed",all:"All — force re-run of every already-processed item","before-date":"Before date — re-run information processed before…","after-date":"After date — re-run information processed after…",condition:"Condition — re-run only if item matches a filter"},BN=["blocked","pending","running","done","failed","cancelled"],Cg={blocked:"var(--status-blocked)",pending:"var(--status-pending)",running:"var(--status-running)",done:"var(--status-done)",failed:"var(--status-failed)",cancelled:"var(--status-cancelled)"},LN=["continuous","on-demand-single","on-demand-batch"];function _N(){const a=yn(),{agentQueryParam:s,agentId:r}=Bn(),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,x]=S.useState(new Date),v=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()}),N=he({queryKey:["overview-runs",s??"all",c,f,m],queryFn:()=>ee.factoryRuns({agent:s,sourceType:c||void 0,workId:f||void 0,entity:m||void 0,pageSize:1e3})}),j=he({queryKey:["throughput"],queryFn:()=>ee.throughput({hours:24,bucket:"hour"})}),E=he({queryKey:["entities",s??"all"],queryFn:()=>ee.listEntities(s)}),C=he({queryKey:["work",s??"all"],queryFn:()=>ee.listWork(s)}),A=S.useMemo(()=>{var I;return((I=N.data)==null?void 0:I.runs)??[]},[N.data]),O=S.useMemo(()=>{const I={blocked:0,pending:0,running:0,done:0,failed:0,cancelled:0};for(const te of A)I[te.status]+=1;return I},[A]),Q=A.filter(I=>I.status==="running").slice(0,8),B=[...A.filter(I=>I.status==="pending")].sort((I,te)=>+new Date(I.availableAt)-+new Date(te.availableAt)).slice(0,8),z=A.filter(I=>I.status==="failed").slice(0,8),q=S.useCallback(()=>{N.refetch(),x(new Date)},[N]),V=qn(),Z=Ye({mutationFn:I=>ee.cancelRun(I),onSuccess:()=>{V.invalidateQueries({queryKey:["overview-runs"]}),V.invalidateQueries({queryKey:["factory-runs"]}),V.invalidateQueries({queryKey:["run-status-counts"]})}});return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Overview"}),n.jsxs("span",{className:"page-subtitle",children:["Factory health and queue monitoring.",r?n.jsxs(n.Fragment,{children:[" Agent scope: ",n.jsx("span",{className:"mono",children:r})," ·"]}):null,v.data&&n.jsxs(n.Fragment,{children:[" ","Manager: ",n.jsx("strong",{children:v.data.queueMode==="running"?"Running":"Paused"})," · ",v.data.runningCount??0," running / ",v.data.maxConcurrentJobs," capacity"]})]})]}),n.jsx(Qv,{onRefresh:q,lastRefreshed:g??void 0})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Source type"}),n.jsxs("select",{value:c,onChange:I=>u(I.target.value),children:[n.jsx("option",{value:"",children:"All"}),LN.map(I=>n.jsx("option",{value:I,children:wa[I]},I))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Ongoing work"}),n.jsxs("select",{value:f,onChange:I=>h(I.target.value),children:[n.jsx("option",{value:"",children:"All"}),(C.data??[]).map(I=>n.jsx("option",{value:I.id,children:I.name},I.id))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:m,onChange:I=>p(I.target.value),children:[n.jsx("option",{value:"",children:"All"}),(E.data??[]).map(I=>n.jsx("option",{value:I.name,children:I.label},I.name))]})]})]}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:BN.map(I=>n.jsxs("div",{className:"status-card",onClick:()=>a(`/journal?status=${I}`),children:[n.jsx("div",{className:"status-card-label",style:{color:Cg[I]},children:I}),n.jsx("div",{className:"status-card-count",style:{color:Cg[I]},children:O[I].toLocaleString()})]},I))}),n.jsxs("div",{className:"card",style:{marginBottom:20},children:[n.jsx("div",{className:"card-title",children:"Throughput (24h)"}),j.isLoading&&n.jsx("span",{className:"spinner"}),j.data&&n.jsx(MN,{buckets:j.data})]}),n.jsxs("div",{className:"overview-cols",children:[n.jsx($d,{title:"Recent failed",runs:z,emptyMsg:"No failed runs"}),n.jsx($d,{title:"Currently running",runs:Q,emptyMsg:"No running runs"}),n.jsx($d,{title:"Oldest pending",runs:B,emptyMsg:"No pending runs",onCancel:I=>Z.mutate(I)})]})]})}function $d({title:a,runs:s,emptyMsg:r,onCancel:c}){return n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:a}),s.length===0&&n.jsx("div",{className:"empty-state",style:{padding:"24px 0"},children:r}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:s.map(u=>{var f;return n.jsxs("div",{style:{position:"relative"},children:[n.jsx(je,{to:`/journal/${u.id}`,style:{display:"block",textDecoration:"none"},children:n.jsxs("div",{style:{padding:"8px 10px",background:"var(--color-surface-raised)",borderRadius:"var(--radius)",border:"1px solid var(--color-border)"},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[n.jsxs("span",{children:[n.jsx(Ht,{status:u.status}),u.status==="pending"&&((f=u.queueOptions)==null?void 0:f.admissionHeld)&&n.jsx("span",{className:"chip",style:{marginLeft:6,fontSize:10},children:"held"})]}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:Ma(u.updatedAt)})]}),n.jsxs("div",{className:"mono",style:{color:"var(--color-text-muted)",fontSize:11},children:[wa[u.sourceType]," · ",u.entity,"/",u.recordLabel??u.recordId]}),u.error&&n.jsx("div",{style:{color:"var(--status-failed)",fontSize:11},children:u.error.message})]})}),c&&(u.status==="pending"||u.status==="blocked")&&n.jsx("button",{className:"btn btn-sm",style:{position:"absolute",top:8,right:8,fontSize:10,color:"var(--status-cancelled)"},onClick:h=>{h.preventDefault(),window.confirm("Cancel this pending run?")&&c(u.id)},children:"Cancel"})]},u.id)})})]})}function yt({title:a,message:s,detail:r,onRetry:c,safeActionLabel:u,onSafeAction:f}){const[h,m]=S.useState(!1),p=r===void 0?"":typeof r=="string"?r:String((r==null?void 0:r.message)??JSON.stringify(r,null,2));return n.jsxs("div",{className:"error-state",style:{color:"var(--color-text)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{color:"var(--status-failed)",fontSize:16},children:"⚠"}),n.jsx("strong",{style:{color:"var(--status-failed)"},children:a})]}),s&&n.jsx("div",{style:{marginTop:6,lineHeight:1.5},children:s}),n.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,flexWrap:"wrap"},children:[c&&n.jsx("button",{type:"button",onClick:c,children:"Retry"}),u&&n.jsx("button",{type:"button",onClick:f,children:u}),p&&n.jsx("button",{type:"button",onClick:()=>m(g=>!g),children:h?"Hide technical details":"Show technical details"})]}),h&&p&&n.jsx("pre",{style:{marginTop:10,fontSize:11,whiteSpace:"pre-wrap",opacity:.8,fontFamily:"var(--font-mono)"},children:p})]})}function ir({open:a,title:s,onClose:r,children:c,actions:u}){return S.useEffect(()=>{if(!a)return;const f=document.body.style.overflow;document.body.style.overflow="hidden";function h(m){m.key==="Escape"&&r()}return document.addEventListener("keydown",h),()=>{document.body.style.overflow=f,document.removeEventListener("keydown",h)}},[a,r]),a?n.jsx("div",{className:"confirm-dialog-backdrop",onClick:r,role:"presentation",children:n.jsxs("div",{className:"confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onClick:f=>f.stopPropagation(),children:[n.jsx("h2",{id:"confirm-dialog-title",className:"confirm-dialog-title",children:s}),n.jsx("div",{className:"confirm-dialog-body",children:c}),n.jsx("div",{className:"confirm-dialog-actions",children:u.map(f=>n.jsx("button",{type:"button",className:`confirm-dialog-btn confirm-dialog-btn--${f.variant??"default"}`,disabled:f.disabled||f.loading,onClick:f.onClick,children:f.loading?`${f.label}…`:f.label},f.label))})]})}):null}function Kv({open:a,totalRunCount:s,busy:r,onClose:c,onConfirm:u}){return n.jsxs(ir,{open:a,title:"Clear all jobs?",onClose:c,actions:[{label:"Keep jobs",onClick:c,variant:"ghost",disabled:r},{label:"Clear all jobs",onClick:u,variant:"danger",disabled:r||s===0,loading:r}],children:[n.jsxs("p",{children:["Permanently delete ",n.jsxs("strong",{children:[s.toLocaleString()," job run",s===1?"":"s"]}),", batch records, and work evaluation history from the runtime store."]}),n.jsx("p",{className:"confirm-dialog-note confirm-dialog-note--warn",children:"Continuous work definitions and queue settings are kept. This cannot be undone."}),n.jsxs("p",{className:"confirm-dialog-note",children:["To stop runs without deleting history, use ",n.jsx("strong",{children:"Cancel all"})," instead."]})]})}function Gv({variant:a="compact"}){const s=qn(),r=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings(),refetchInterval:1e4}),c=Ye({mutationFn:g=>ee.saveQueueSettings({queueMode:g}),onSuccess:()=>{s.invalidateQueries({queryKey:["queue-settings"]}),s.invalidateQueries({queryKey:["overview-runs"]}),s.invalidateQueries({queryKey:["factory-runs"]})}}),u=r.data,h=((u==null?void 0:u.queueMode)??"running")==="running",m=r.isLoading||c.isPending;function p(){c.mutate(h?"paused":"running")}return a==="card"?n.jsxs("div",{className:`queue-manager-card${h?" is-running":" is-paused"}`,children:[n.jsxs("div",{className:"queue-manager-card-head",children:[n.jsxs("div",{children:[n.jsx("div",{className:"queue-manager-title",children:"Job manager"}),n.jsx("div",{className:"queue-manager-subtitle",children:h?"Pending jobs are picked up and executed automatically.":"Queue is paused — jobs stay pending until you resume."})]}),n.jsx("span",{className:`queue-manager-badge${h?" running":" paused"}`,children:h?"Running":"Paused"})]}),u&&n.jsxs("div",{className:"queue-manager-stats",children:[n.jsxs("span",{children:[u.runningCount??0," running"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[u.pendingCount??0," pending"]}),(u.heldCount??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:[u.heldCount," held at capacity"]})]})]}),n.jsx("div",{style:{marginTop:16},children:n.jsx("button",{type:"button",className:h?"":"primary",disabled:m,onClick:p,children:m?"Updating…":h?"Pause job manager":"Resume job manager"})})]}):n.jsxs("button",{type:"button",className:`queue-manager-toggle${h?" running":" paused"}`,disabled:m,onClick:p,title:h?`Job manager running — ${(u==null?void 0:u.runningCount)??0} active, ${(u==null?void 0:u.pendingCount)??0} pending. Click to pause.`:`Job manager paused — ${(u==null?void 0:u.pendingCount)??0} pending. Click to resume.`,children:[n.jsx("span",{className:`queue-manager-dot${h?" running":" paused"}`}),n.jsx("span",{className:"queue-manager-label",children:h?"Running":"Paused"}),u&&n.jsxs("span",{className:"queue-manager-counts",children:[u.runningCount??0,"/",u.pendingCount??0]})]})}const UN=[{ms:15e3,label:"15 seconds"},{ms:3e4,label:"30 seconds"},{ms:6e4,label:"1 minute"},{ms:12e4,label:"2 minutes"}];function QN(){const a=qn(),[s,r]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,x]=S.useState(!1),[v,N]=S.useState(!1),j=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()});S.useEffect(()=>{j.data&&(r(j.data.maxConcurrentJobs),u(j.data.queueAdmissionIntervalMs),h(j.data.batchJobMaxAttempts),p(j.data.continuousJobMaxAttempts),x(!1))},[j.data]);const E=Ye({mutationFn:()=>ee.saveQueueSettings({maxConcurrentJobs:Number(s),queueAdmissionIntervalMs:Number(c),batchJobMaxAttempts:Number(f),continuousJobMaxAttempts:Number(m)}),onSuccess:()=>{x(!0),a.invalidateQueries({queryKey:["queue-settings"]})}}),C=he({queryKey:["run-status-counts","total"],queryFn:()=>ee.runStatusCounts("total")}),A=C.data?Object.values(C.data).reduce((Q,B)=>Q+B,0):void 0,O=Ye({mutationFn:()=>ee.clearJobs(),onSuccess:()=>{N(!1),a.invalidateQueries({queryKey:["overview-runs"]}),a.invalidateQueries({queryKey:["factory-runs"]}),a.invalidateQueries({queryKey:["run-status-counts"]}),a.invalidateQueries({queryKey:["batch"]}),a.invalidateQueries({queryKey:["work"]}),C.refetch()}});return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Settings"}),n.jsx("span",{className:"page-subtitle",children:"App-wide jobs factory configuration."})]})}),n.jsx("div",{className:"card",style:{maxWidth:640,marginBottom:20},children:n.jsx(Gv,{variant:"card"})}),n.jsxs("div",{className:"card",style:{maxWidth:640},children:[n.jsx("div",{className:"card-title",children:"Queue execution"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:16},children:"Capacity limits apply while the job manager is running. When capacity frees up, waiting jobs are promoted on the check interval below."}),j.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),j.isError&&n.jsx(yt,{title:"Failed to load settings",detail:j.error}),j.data&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Max concurrent jobs"}),n.jsx("input",{type:"number",min:1,value:s,onChange:Q=>{r(Number(Q.target.value)),x(!1)}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Admission check interval"}),n.jsx("select",{value:c,onChange:Q=>{u(Number(Q.target.value)),x(!1)},children:UN.map(Q=>n.jsx("option",{value:Q.ms,children:Q.label},Q.ms))}),n.jsx("span",{className:"hint",children:"How often the factory checks for free capacity and promotes waiting jobs."})]})]}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Transient failure retries"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Default max execution attempts for batch and ongoing work. Only transient infrastructure errors (Mongo connection blips, network timeouts) consume this budget — graph and data errors fail immediately."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Batch jobs default"}),n.jsx("input",{type:"number",min:1,max:20,value:f,onChange:Q=>{h(Number(Q.target.value)),x(!1)}}),n.jsx("span",{className:"hint",children:"Used when queueing on-demand batches unless overridden per batch."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Ongoing work default"}),n.jsx("input",{type:"number",min:1,max:20,value:m,onChange:Q=>{p(Number(Q.target.value)),x(!1)}}),n.jsx("span",{className:"hint",children:"Used when continuous work enqueues jobs unless overridden per work definition."})]})]}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:16},children:[n.jsx("button",{type:"button",className:"primary",disabled:E.isPending,onClick:()=>E.mutate(),children:E.isPending?"Saving…":"Save settings"}),g&&!E.isPending&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"Saved"})]}),E.isError&&n.jsx("div",{style:{marginTop:12},children:n.jsx(yt,{title:"Failed to save settings",detail:E.error})})]})]}),n.jsxs("div",{className:"card",style:{maxWidth:640,marginTop:20},children:[n.jsx("div",{className:"card-title",children:"Clear jobs"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Remove all job runs from the journal, batch records, and work evaluation history. Ongoing work definitions and queue settings are not deleted."}),C.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),C.data&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:["Currently ",(A==null?void 0:A.toLocaleString())??"0"," run",(A??0)===1?"":"s"," in the runtime store",["running","pending","blocked"].some(Q=>{var B;return(((B=C.data)==null?void 0:B[Q])??0)>0})&&n.jsxs(n.Fragment,{children:[" (",C.data.running," running, ",C.data.pending+C.data.blocked," queued)"]}),"."]}),n.jsx("button",{type:"button",disabled:O.isPending||A===0,style:{color:"var(--status-failed)"},onClick:()=>N(!0),children:O.isPending?"Clearing…":"Clear all jobs"}),O.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginTop:12},children:["Cleared ",O.data.jobRuns.toLocaleString()," job run",O.data.jobRuns===1?"":"s",O.data.batches>0&&`, ${O.data.batches} batch${O.data.batches===1?"":"es"}`,O.data.workEvaluations>0&&`, ${O.data.workEvaluations} evaluation${O.data.workEvaluations===1?"":"s"}`,"."]}),O.isError&&n.jsx("div",{style:{marginTop:12},children:n.jsx(yt,{title:"Failed to clear jobs",detail:O.error})})]}),n.jsx(Kv,{open:v,totalRunCount:A??0,busy:O.isPending,onClose:()=>N(!1),onConfirm:()=>O.mutate()})]})}function Sr({loaded:a,total:s,hasMore:r,isFetchingNextPage:c,onLoadMore:u}){const f=S.useRef(null);return S.useEffect(()=>{if(!r||c)return;const h=f.current;if(!h)return;const m=new IntersectionObserver(p=>{var g;(g=p[0])!=null&&g.isIntersecting&&u()},{rootMargin:"400px"});return m.observe(h),()=>m.disconnect()},[r,c,u]),n.jsxs("div",{className:"infinite-scroll-footer",children:[n.jsxs("span",{children:[a.toLocaleString()," of ",s.toLocaleString()]}),c&&n.jsxs("span",{className:"infinite-scroll-loading",children:[n.jsx("span",{className:"spinner"})," Loading more…"]}),!r&&a>0&&n.jsx("span",{className:"text-dim",children:"End of list"}),r&&n.jsx("div",{ref:f,className:"infinite-scroll-sentinel","aria-hidden":!0})]})}function Yt({title:a,message:s,actionLabel:r,actionTo:c,onAction:u,icon:f="○"}){return n.jsxs("div",{className:"empty-state",style:{padding:"40px 24px"},children:[n.jsx("div",{style:{fontSize:28,opacity:.5,marginBottom:10},children:f}),n.jsx("div",{style:{fontSize:15,fontWeight:600,color:"var(--color-text)",marginBottom:6},children:a}),s&&n.jsx("div",{style:{maxWidth:480,margin:"0 auto",lineHeight:1.55},children:s}),r&&n.jsx("div",{style:{marginTop:16},children:c?n.jsx(je,{to:c,children:n.jsx("button",{type:"button",className:"primary",children:r})}):n.jsx("button",{type:"button",className:"primary",onClick:u,children:r})})]})}function $N(a,s){return s?"all matching blocked, pending, or running runs":`${a.toLocaleString()} run${a===1?"":"s"}`}function HN({request:a,onClose:s,onCancelRuns:r,onCancelAll:c,busy:u,cancellableCount:f,hasExtraFilters:h,activeFilters:m}){if(!a)return null;const p=h||f>0,g=h?"Cancel all matching":`Cancel all (${f.toLocaleString()})`,x=m.length>0&&n.jsx("ul",{className:"confirm-dialog-list",children:m.map(v=>n.jsx("li",{children:v},v))});if(a.kind==="one"){const v=a.run;return n.jsxs(ir,{open:!0,title:"Cancel job run?",onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},...p?[{label:g,onClick:c,variant:"danger",disabled:u,loading:u}]:[],{label:"Cancel this run",onClick:()=>r([v.id]),variant:"primary",disabled:u,loading:u}],children:[n.jsxs("p",{children:[n.jsx("strong",{children:v.recordLabel??v.recordId})," on ",n.jsx("span",{className:"mono",children:v.entity})," ","will be marked ",n.jsx("strong",{children:"cancelled"})," and will not execute."]}),n.jsx("p",{className:"confirm-dialog-note",children:"Cancelled runs stay in the journal — they are not deleted."}),p&&n.jsxs("p",{className:"confirm-dialog-note",children:["You can cancel just this run, or stop every blocked, pending, or running run",h?" matching your filters":" in the queue","."]}),x]})}if(a.kind==="selected"){const v=a.runIds.length;return n.jsxs(ir,{open:!0,title:`Cancel ${v} selected run${v===1?"":"s"}?`,onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},...p?[{label:g,onClick:c,variant:"danger",disabled:u,loading:u}]:[],{label:`Cancel selected (${v})`,onClick:()=>r(a.runIds),variant:"primary",disabled:u,loading:u}],children:[n.jsxs("p",{children:["The selected run",v===1?"":"s"," will be marked ",n.jsx("strong",{children:"cancelled"})," and will not execute."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["Only the runs you selected on this page are included — not every loaded page. Use ",n.jsx("strong",{children:g})," to stop the full queue",h?" matching your filters":"","."]}),x]})}return n.jsxs(ir,{open:!0,title:"Cancel all job runs?",onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},{label:g,onClick:c,variant:"primary",disabled:u||!p,loading:u}],children:[n.jsxs("p",{children:["This will mark ",n.jsx("strong",{children:$N(f,h)})," as"," ",n.jsx("strong",{children:"cancelled"}),". They will stop executing but remain visible in the journal."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["To permanently remove runs from the database, use ",n.jsx("strong",{children:"Clear all jobs"})," instead."]}),n.jsx("p",{className:"confirm-dialog-note",children:"Active continuous work will be paused so cancelled items are not immediately re-queued. Re-enable work from the Work page when you want processing to resume."}),x]})}const Iv=100;function Yv(a){if(!(a.page*a.pageSize>=a.total))return a.page+1}function Nr(a){var s;return((s=a==null?void 0:a[0])==null?void 0:s.total)??0}function uo(a,s,r){return yv({queryKey:[...a,s],queryFn:({pageParam:c})=>ee.factoryRuns({...s,page:c,pageSize:Iv}),initialPageParam:1,getNextPageParam:Yv,enabled:!0})}function KN(a,s,r){return yv({queryKey:[...a,s],queryFn:({pageParam:c})=>ee.coreRecords({...s,page:c,pageSize:Iv}),initialPageParam:1,getNextPageParam:Yv,enabled:(r==null?void 0:r.enabled)??!0})}const Hd=["blocked","pending","running","done","failed","cancelled"],GN=["continuous","on-demand-single","on-demand-batch"],jf=["blocked","pending","running"],Kd={blocked:"var(--status-blocked)",pending:"var(--status-pending)",running:"var(--status-running)",done:"var(--status-done)",failed:"var(--status-failed)",cancelled:"var(--status-cancelled)"},Gd=[{key:"total",label:"Total"},{key:"today",label:"Today"},{key:"this-week",label:"This week"},{key:"this-month",label:"This month"}];function Id(a){return jf.includes(a.status)}function IN({run:a}){var s;return a.status!=="pending"||!((s=a.queueOptions)!=null&&s.admissionHeld)?null:n.jsx("span",{className:"chip",style:{marginLeft:6,fontSize:10},title:"Waiting for admission capacity",children:"held"})}function YN(){var In,Ln,ne;const[a,s]=si(),r=yn(),c=qn(),{agentQueryParam:u,agentId:f}=Bn(),[h,m]=S.useState(new Date),p=a.get("scope"),g=Gd.some(H=>H.key===p)?p:"total",[x,v]=S.useState(new Set),[N,j]=S.useState(null),[E,C]=S.useState(!1),A=a.get("status")??"",O=a.get("sourceType")??"",Q=a.get("workId")??"",B=a.get("batchId")??"",z=a.get("graphId")??"",q=a.get("entity")??"",V=a.get("recordId")??"",Z=!A||jf.includes(A),I=S.useMemo(()=>({agent:u,scope:g==="total"?void 0:g,status:A||void 0,sourceType:O||void 0,workId:Q||void 0,batchId:B||void 0,graphId:z||void 0,entity:q||void 0,recordId:V||void 0}),[u,g,A,O,Q,B,z,q,V]),te=(H,Me)=>{s(wt=>{const rt=new URLSearchParams(wt);return Me?rt.set(H,Me):rt.delete(H),rt}),v(new Set)},ye=H=>{s(Me=>{const wt=new URLSearchParams(Me);return H==="total"?wt.delete("scope"):wt.set("scope",H),wt}),v(new Set)},ue=uo(["factory-runs",u??"all",g,A,O,Q,B,z,q,V],I),re=he({queryKey:["run-status-counts",g,u??"all"],queryFn:()=>ee.runStatusCounts(g,u)}),Ce=he({queryKey:["meta-filters"],queryFn:()=>ee.filters()}),Te=he({queryKey:["entities",u??"all"],queryFn:()=>ee.listEntities(u)}),ve=he({queryKey:["work",u??"all"],queryFn:()=>ee.listWork(u)}),k=Ye({mutationFn:H=>ee.cancelRuns(H),onSuccess:()=>{j(null),v(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]})}}),J=Ye({mutationFn:()=>ee.cancelAllRuns({confirm:!0,agent:u,scope:g==="total"?void 0:g,status:A||void 0,sourceType:O||void 0,workId:Q||void 0,batchId:B||void 0,graphId:z||void 0,entity:q||void 0,recordId:V||void 0}),onSuccess:()=>{j(null),v(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]}),c.invalidateQueries({queryKey:["work"]})}}),ae=Ye({mutationFn:()=>ee.clearJobs(),onSuccess:()=>{C(!1),v(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]}),c.invalidateQueries({queryKey:["batch"]}),c.invalidateQueries({queryKey:["work"]})}}),Ne=S.useCallback(()=>{ue.refetch(),m(new Date)},[ue]),G=re.data,T=S.useMemo(()=>{var H;return((H=ue.data)==null?void 0:H.pages.flatMap(Me=>Me.runs))??[]},[ue.data]),U=Nr((In=ue.data)==null?void 0:In.pages),W=T.length<U,se=S.useMemo(()=>T.filter(Id),[T]),F=se.length>0&&se.every(H=>x.has(H.id));function ce(H){v(Me=>{const wt=new Set(Me);return wt.has(H)?wt.delete(H):wt.add(H),wt})}function xe(){v(F?new Set:new Set(se.map(H=>H.id)))}const le=S.useMemo(()=>G?A&&jf.includes(A)?G[A]??0:A?0:(G.blocked??0)+(G.pending??0)+(G.running??0):0,[G,A]),de=S.useMemo(()=>G?Hd.reduce((H,Me)=>H+(G[Me]??0),0):0,[G]),Ze=!!(O||Q||B||z||q||V),ut=S.useMemo(()=>{var Me,wt,rt;const H=[];if(g!=="total"&&H.push(`Scope: ${((Me=Gd.find(ka=>ka.key===g))==null?void 0:Me.label)??g}`),A&&H.push(`Status: ${A}`),O&&H.push(`Source type: ${wa[O]}`),Q){const ka=((rt=(wt=ve.data)==null?void 0:wt.find(vl=>vl.id===Q))==null?void 0:rt.name)??Q;H.push(`Ongoing work: ${ka}`)}return B&&H.push(`Batch: ${B}`),z&&H.push(`Pipeline: ${z}`),q&&H.push(`Entity: ${q}`),V&&H.push(`Item id: ${V}`),H},[g,A,O,Q,B,z,q,V,ve.data]),it=k.isPending||J.isPending,Pe=it||ae.isPending,Tt=it?"Cancelling…":x.size>0?`Cancel (${x.size} selected)`:Ze?"Cancel all matching":le>0?`Cancel all (${le.toLocaleString()})`:"Cancel runs";function St(){if(x.size>0){j({kind:"selected",runIds:[...x]});return}j({kind:"all"})}const at=S.useCallback(()=>{W&&!ue.isFetchingNextPage&&ue.fetchNextPage()},[W,ue]),Gn=x.size>0||Ze||le>0;return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Journal"}),!ue.isLoading&&n.jsxs("span",{className:"page-subtitle",children:[f?n.jsxs(n.Fragment,{children:["Agent scope: ",n.jsx("span",{className:"mono",children:f})," · "]}):null,U.toLocaleString()," total job executions"]})]}),n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[Gn&&n.jsx("button",{disabled:Pe,onClick:St,style:{color:"var(--status-cancelled)"},children:Tt}),de>0&&n.jsx("button",{disabled:Pe,onClick:()=>C(!0),style:{color:"var(--status-failed)"},children:ae.isPending?"Clearing…":"Clear all jobs"}),n.jsx(Qv,{onRefresh:Ne,lastRefreshed:h??void 0})]})]}),J.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(yt,{title:"Failed to cancel runs",detail:J.error})}),J.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:["Cancelled ",J.data.matched.toLocaleString()," run",J.data.matched===1?"":"s",".",(((Ln=J.data.pausedWorkDefs)==null?void 0:Ln.length)??0)>0&&n.jsxs(n.Fragment,{children:[" ","Paused ",J.data.pausedWorkDefs.length," continuous work definition",J.data.pausedWorkDefs.length===1?"":"s","."]})]}),ae.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(yt,{title:"Failed to clear jobs",detail:ae.error})}),ae.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:["Cleared ",ae.data.jobRuns.toLocaleString()," job run",ae.data.jobRuns===1?"":"s"," from the runtime store."]}),n.jsx(HN,{request:N,onClose:()=>j(null),onCancelRuns:H=>k.mutate(H),onCancelAll:()=>J.mutate(),busy:it,cancellableCount:le,hasExtraFilters:Ze,activeFilters:ut}),n.jsx(Kv,{open:E,totalRunCount:de,busy:ae.isPending,onClose:()=>C(!1),onConfirm:()=>ae.mutate()}),n.jsxs("div",{style:{marginBottom:20},children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:10},children:Gd.map(({key:H,label:Me})=>n.jsx("button",{className:`btn btn-sm${g===H?" active":""}`,onClick:()=>ye(H),children:Me},H))}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:Hd.map(H=>n.jsxs("div",{className:`status-card${A===H?" selected":""}`,style:A===H?{outline:`2px solid ${Kd[H]}`}:void 0,onClick:()=>te("status",A===H?"":H),title:`Filter by ${H}`,children:[n.jsx("div",{className:"status-card-label",style:{color:Kd[H]},children:H}),n.jsx("div",{className:"status-card-count",style:{color:Kd[H]},children:G?G[H].toLocaleString():"—"})]},H))})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Status"}),n.jsxs("select",{value:A,onChange:H=>te("status",H.target.value),children:[n.jsx("option",{value:"",children:"All"}),Hd.map(H=>n.jsx("option",{value:H,children:H},H))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Source type"}),n.jsxs("select",{value:O,onChange:H=>te("sourceType",H.target.value),children:[n.jsx("option",{value:"",children:"All"}),GN.map(H=>n.jsx("option",{value:H,children:wa[H]},H))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Ongoing work"}),n.jsxs("select",{value:Q,onChange:H=>te("workId",H.target.value),children:[n.jsx("option",{value:"",children:"All"}),(ve.data??[]).map(H=>n.jsx("option",{value:H.id,children:H.name},H.id))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Pipeline"}),n.jsxs("select",{value:z,onChange:H=>te("graphId",H.target.value),children:[n.jsx("option",{value:"",children:"All"}),(((ne=Ce.data)==null?void 0:ne.graphIds)??[]).map(H=>n.jsx("option",{value:H,children:H},H))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:q,onChange:H=>te("entity",H.target.value),children:[n.jsx("option",{value:"",children:"All"}),(Te.data??[]).map(H=>n.jsx("option",{value:H.name,children:H.label},H.name))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Item id"}),n.jsx("input",{type:"text",value:V,placeholder:"item id",onChange:H=>te("recordId",H.target.value),style:{width:160}})]})]}),ue.isError&&n.jsx(yt,{title:"Failed to load journal",detail:ue.error,onRetry:Ne}),ue.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading journal…"]}),!ue.isLoading&&T.length===0&&n.jsx(Yt,{title:"No journal entries",message:"No executions match the current filters."}),T.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[Z&&n.jsx("th",{style:{width:36},children:n.jsx("input",{type:"checkbox",checked:F,onChange:xe,title:"Select all cancellable (loaded)"})}),n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Source type"}),n.jsx("th",{children:"Source"}),n.jsx("th",{children:"Entity"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Attempts"}),n.jsx("th",{children:"Priority"}),n.jsx("th",{children:"Created"}),n.jsx("th",{children:"Updated"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:T.map(H=>n.jsxs("tr",{onClick:()=>r(`/journal/${H.id}`),children:[Z&&n.jsx("td",{onClick:Me=>Me.stopPropagation(),children:Id(H)&&n.jsx("input",{type:"checkbox",checked:x.has(H.id),onChange:()=>ce(H.id)})}),n.jsxs("td",{children:[n.jsx(Ht,{status:H.status}),n.jsx(IN,{run:H})]}),n.jsx("td",{children:n.jsx("span",{className:"chip",children:wa[H.sourceType]})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:H.sourceName??"—"}),n.jsx("td",{className:"td-mono",children:H.entity}),n.jsx("td",{className:"td-mono",children:H.recordLabel??H.recordId}),n.jsx("td",{className:"td-mono",onClick:Me=>Me.stopPropagation(),children:n.jsx(je,{to:`/pipelines/${encodeURIComponent(H.graphId)}`,children:H.graphName??H.graphId})}),n.jsxs("td",{className:"td-mono",children:[H.attempts,"/",H.maxAttempts]}),n.jsx("td",{className:"td-mono",children:H.priority}),n.jsx("td",{className:"td-mono",children:Mt(H.createdAt)}),n.jsx("td",{className:"td-mono",children:Mt(H.updatedAt)}),n.jsx("td",{onClick:Me=>Me.stopPropagation(),children:Id(H)&&n.jsx("button",{className:"btn btn-sm",style:{color:"var(--status-cancelled)",fontSize:11},disabled:it,onClick:()=>j({kind:"one",run:H}),children:"Cancel"})})]},H.id))})]}),n.jsx(Sr,{loaded:T.length,total:U,hasMore:W,isFetchingNextPage:ue.isFetchingNextPage,onLoadMore:at})]})]})}function Lt({label:a,value:s,defaultOpen:r=!1}){const[c,u]=S.useState(r);if(s==null)return null;const f=JSON.stringify(s,null,2);return n.jsxs("div",{className:"json-section",children:[n.jsxs("div",{className:`json-section-header${c?" open":""}`,onClick:()=>u(h=>!h),role:"button",tabIndex:0,onKeyDown:h=>h.key==="Enter"&&u(m=>!m),children:[n.jsx("span",{className:`json-chevron${c?" open":""}`,children:"▶"}),a,n.jsx("span",{className:"text-dim",style:{marginLeft:"auto",fontWeight:400,textTransform:"none",fontSize:"11px"},children:c?"collapse":`${f.split(`
|
|
61
|
-
`).length} lines`})]}),c&&n.jsx("div",{className:"json-body",children:n.jsx("pre",{children:f})})]})}const PN={enqueued:"muted",claimed:"start",done:"done",failed:"fail",retry:"info",lease_expired:"fail",cancelled:"muted"},FN={info:"var(--color-text)",start:"var(--status-running)",done:"var(--status-done)",fail:"var(--status-failed)",muted:"var(--color-text-muted)"};function Ra(a){if(typeof a=="number")return a>1e12?a:a*1e3;if(typeof a=="string"){const s=new Date(a).getTime();return Number.isNaN(s)?void 0:s}}function Pv(a){return new Date(a).toLocaleTimeString(void 0,{hour12:!1})}function bf(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function Eg(a){const s=(a??"").toLowerCase();return s.includes("fail")||s.includes("error")?"fail":s.includes("complete")||s.includes("done")||s.includes("success")||s.includes("ended")?"done":s.includes("start")||s.includes("running")||s.includes("progress")?"start":"info"}function XN(a){return a==="fail"?"✕":a==="done"?"✓":a==="start"?"▶":"·"}function VN(a){if(a)return typeof a=="string"?a:typeof a=="object"&&a&&"message"in a?String(a.message):JSON.stringify(a)}function Fv(a,s=120){return a.length<=s?a:`${a.slice(0,s-1)}…`}function JN(a){const s=bf(a.runContext);return{...a,nodeId:a.nodeId??(s==null?void 0:s.nodeId),graphId:a.graphId??(s==null?void 0:s.graphId),skillKey:a.skillKey??(s==null?void 0:s.skillKey)}}function ZN(a){const s=a.nodeId??a.skillKey??"node",r=a.skillKey&&a.skillKey!==a.nodeId?` · ${a.skillKey}`:"";return`${s}${r}`}function Xv(a,s,r){if(typeof a.durationMs=="number")return a.durationMs;if(typeof a.duration=="number")return a.duration;if(s!=null&&r!=null)return Math.max(0,Math.round(r-s))}function WN(a){const s=[],r=bf(a.runContext),c=bf(a.outer),u=Ra(a.startTime)??Ra(a.createdAt),f=Ra(a.endTime)??Ra(a.updatedAt),h=Xv(a,u,f);s.push({label:"Summary",value:{activityId:a.activityId,status:a.status,phase:a.phase,nodeId:a.nodeId??(r==null?void 0:r.nodeId),graphId:a.graphId??(r==null?void 0:r.graphId),skillKey:a.skillKey??(r==null?void 0:r.skillKey),kind:a.kind,startTime:u!=null?new Date(u).toISOString():a.startTime,endTime:f!=null?new Date(f).toISOString():a.endTime,durationMs:h}}),a.inputVariableKeys&&s.push({label:"Input variable keys",value:a.inputVariableKeys}),a.executionKeys&&s.push({label:"Execution keys",value:a.executionKeys}),(c==null?void 0:c.input)!=null&&s.push({label:"Input",value:c.input}),(c==null?void 0:c.output)!=null&&s.push({label:"Output",value:c.output}),(c==null?void 0:c.metadata)!=null&&s.push({label:"Metadata",value:c.metadata}),(c==null?void 0:c.memory)!=null&&s.push({label:"Memory",value:c.memory}),a.outputSummary!=null&&s.push({label:"Output summary",value:a.outputSummary}),a.narrixSummary!=null&&s.push({label:"Narrix",value:a.narrixSummary}),a.error!=null&&s.push({label:"Error",value:a.error}),Array.isArray(a.inner)&&a.inner.length>0&&s.push({label:"Inner steps",value:a.inner});const m={},p=new Set(["activityId","status","phase","nodeId","graphId","skillKey","kind","startTime","endTime","createdAt","updatedAt","durationMs","duration","runContext","outer","inner","error","inputVariableKeys","executionKeys","outputSummary","narrixSummary"]);for(const[g,x]of Object.entries(a))p.has(g)||x==null||(m[g]=x);return Object.keys(m).length>0&&s.push({label:"Record fields",value:m}),s}function e1(a){return a.map((s,r)=>{const c=Ra(s.at)??0,u=s.meta&&Object.keys(s.meta).length?s.meta:void 0;return{id:`event-${r}-${s.kind}-${c}`,ts:c,time:Pv(c),level:PN[s.kind]??"info",label:s.kind.replace(/_/g," "),summary:u?Fv(JSON.stringify(u)):void 0,sections:u?[{label:"Event meta",value:u}]:void 0}})}function t1(a){return a.map((s,r)=>{const c=JN(s),u=Ra(c.startTime)??Ra(c.createdAt)??0,f=Ra(c.endTime)??(Eg(c.status)!=="start"?Ra(c.updatedAt):void 0),h=Eg(c.status),m=Xv(c,u,f),p=VN(c.error),g=WN(c);return{id:`activity-${c.activityId??c.nodeId??r}-${u}`,ts:u,time:Pv(u),level:h,label:`${XN(h)} ${ZN(c)}`,summary:p?Fv(p):m!=null?`${m}ms`:void 0,sections:g.length>0?g:void 0}})}function n1({entry:a}){var u;const[s,r]=S.useState(!1),c=(((u=a.sections)==null?void 0:u.length)??0)>0;return n.jsxs("div",{className:`live-console-entry${s?" open":""}`,children:[n.jsxs("div",{className:`live-console-line${c?" expandable":""}`,onClick:c?()=>r(f=>!f):void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?f=>f.key==="Enter"&&r(h=>!h):void 0,children:[c&&n.jsx("span",{className:`live-console-chevron${s?" open":""}`,children:"▶"}),n.jsx("span",{className:"live-console-time",children:a.time}),n.jsx("span",{style:{color:FN[a.level]},children:a.label}),a.summary&&n.jsx("span",{className:"live-console-detail",children:a.summary})]}),s&&a.sections&&n.jsx("div",{className:"live-console-expand",children:a.sections.map(f=>n.jsx(Lt,{label:f.label,value:f.value},f.label))})]})}function a1({runId:a,live:s}){var N;const r=s?1200:!1,c=he({queryKey:["run-events",a],queryFn:()=>ee.runEvents(a),refetchInterval:r}),u=he({queryKey:["run-activities",a],queryFn:()=>ee.runActivities(a),refetchInterval:r}),f=S.useMemo(()=>{var E,C;const j=[...e1(((E=c.data)==null?void 0:E.events)??[]),...t1(((C=u.data)==null?void 0:C.activities)??[])];return j.sort((A,O)=>A.ts-O.ts),j},[c.data,u.data]),h=S.useRef(null),m=S.useRef(!0),p=()=>{const j=h.current;j&&(m.current=j.scrollHeight-j.scrollTop-j.clientHeight<40)};S.useEffect(()=>{m.current&&h.current&&(h.current.scrollTop=h.current.scrollHeight)},[f.length]);const g=((N=u.data)==null?void 0:N.available)??!0,x=f.length===0,v=f.filter(j=>{var E;return(((E=j.sections)==null?void 0:E.length)??0)>0}).length;return n.jsxs("div",{className:"live-console",children:[n.jsxs("div",{className:"live-console-head",children:[n.jsxs("span",{className:"live-console-title",children:[n.jsx("span",{className:`live-dot${s?" live":""}`}),"Live Console"]}),n.jsxs("span",{className:"live-console-meta mono",children:[s?"streaming…":"idle"," · ",f.length," entr",f.length===1?"y":"ies",v>0?` · ${v} expandable`:""]})]}),n.jsxs("div",{className:"live-console-body",ref:h,onScroll:p,children:[x&&n.jsx("div",{className:"live-console-line muted",children:s?"Waiting for execution events…":"No execution activity recorded yet."}),f.map(j=>n.jsx(n1,{entry:j},j.id))]}),!g&&n.jsx("div",{className:"live-console-foot",children:"Per-node activity tracking is unavailable — showing run lifecycle events only."})]})}function kn({title:a,children:s,summary:r,defaultOpen:c=!0,className:u,style:f,id:h}){const[m,p]=S.useState(c);return n.jsxs("div",{id:h,className:`card collapsible-card${m?" open":""}${u?` ${u}`:""}`,style:f,children:[n.jsxs("button",{type:"button",className:"collapsible-card-head",onClick:()=>p(g=>!g),"aria-expanded":m,children:[n.jsx("span",{className:`collapsible-chevron${m?" open":""}`,"aria-hidden":!0,children:"▶"}),n.jsx("span",{className:"collapsible-card-title",children:a}),!m&&r!=null&&r!==""&&n.jsx("span",{className:"collapsible-card-summary",children:r})]}),m&&n.jsx("div",{className:"collapsible-card-body",children:s})]})}function Se(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function We(a){return typeof a=="number"&&Number.isFinite(a)?a:void 0}function no(a){if(a!=null)try{return new TextEncoder().encode(JSON.stringify(a)).length}catch{return}}function zn(a){return a==null||!Number.isFinite(a)?"—":a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(2)} MB`}function ao(a){return a==null||!Number.isFinite(a)?"—":a===0?"$0.00":a<.01?`$${a.toFixed(4)}`:a<1?`$${a.toFixed(3)}`:`$${a.toFixed(2)}`}function nt(a){if(a==null||!Number.isFinite(a))return"—";if(a<1e3)return`${Math.round(a)} ms`;if(a<6e4)return`${(a/1e3).toFixed(2)} s`;const s=Math.floor(a/6e4),r=(a%6e4/1e3).toFixed(1);return`${s}m ${r}s`}function Tg(a){return a.skillKey==="finalizer"||a.nodeId.includes(":finalizer")}function Hf(a,s){const r=Tg(a),c=Tg(s);if(r!==c)return r?1:-1;const u=a.startedAt??0,f=s.startedAt??0;return u!==f?u-f:a.nodeId.localeCompare(s.nodeId)}function rr(a){if(!a)return"—";const s=a.total??(a.prompt!=null||a.completion!=null?(a.prompt??0)+(a.completion??0):void 0);if(s==null&&a.prompt==null&&a.completion==null)return"—";const r=[];return a.prompt!=null&&r.push(`${a.prompt} in`),a.completion!=null&&r.push(`${a.completion} out`),s!=null&&r.push(`${s} total`),r.join(" · ")}function Kf(...a){for(const s of a){if(!s)continue;const r=We(s.costUsd)??We(s.cost);if(r!=null)return r;const c=Se(s.cost),u=We(c==null?void 0:c.costUsd);if(u!=null)return u;const f=Se(s.usage),h=We(f==null?void 0:f.costUsd);if(h!=null)return h;const m=Se(s.timing),p=We(m==null?void 0:m.costUsd);if(p!=null)return p}}function Vv(a){return Kf(a,Se(a.cost),Se(a.usage))}function wg(a,s){let r=0,c=!1;for(const u of a){if(String(u.nodeId??"")!==s||u.status!=null&&u.status!=="completed")continue;const f=Vv(u);f!=null&&(r+=f,c=!0)}return c?r:void 0}function l1(a,s){var h;const r=Se((h=Se(a))==null?void 0:h.trace);if(!r)return;const c=Object.values(Se(r.unitExecutions)??{}).filter(m=>!!m&&typeof m=="object"),u=wg(c,s);if(u!=null)return u;const f=Object.values(Se(r.modelInvocations)??{}).filter(m=>!!m&&typeof m=="object");return wg(f,s)}function s1(a,s){var f;const r=(f=Se(a))==null?void 0:f.runLog;if(!Array.isArray(r))return;let c=0,u=!1;for(const h of r){const m=Se(h);if(!m||m.nodeId!==s)continue;const p=Se(m.data),g=Kf(m,p,Se(p==null?void 0:p.usage),Se(p==null?void 0:p.timing));g!=null&&(c+=g,u=!0)}return u?c:void 0}function i1(a,s){var r,c;return a.costUsd??((r=a.metrics)==null?void 0:r.costUsd)??l1(s,a.nodeId)??Kf(a.summary,a.metrics,(c=Se(a.summary))==null?void 0:c.usage)??(s!=null?s1(s,a.nodeId):void 0)}function r1(...a){for(const s of a){if(!s)continue;const r=Se(s.usage)??Se(s.tokenUsage)??Se(s.tokens),c=We(s.promptTokens)??We(s.prompt_tokens)??We(r==null?void 0:r.prompt_tokens)??We(r==null?void 0:r.promptTokens)??We(r==null?void 0:r.input_tokens)??We(r==null?void 0:r.inputTokens),u=We(s.completionTokens)??We(s.completion_tokens)??We(r==null?void 0:r.completion_tokens)??We(r==null?void 0:r.completionTokens)??We(r==null?void 0:r.output_tokens)??We(r==null?void 0:r.outputTokens),f=We(s.totalTokens)??We(s.total_tokens)??We(r==null?void 0:r.total_tokens)??We(r==null?void 0:r.totalTokens);if(c!=null||u!=null||f!=null)return{...c!=null?{prompt:c}:{},...u!=null?{completion:u}:{},...f!=null?{total:f}:{}}}}function Jv(a,s){const r=a.summary,c=a.metrics,u=a.inputBytes??(c==null?void 0:c.inputBytes),f=a.outputBytes??(c==null?void 0:c.outputBytes),h=(c==null?void 0:c.tokens)??r1(r),m=i1(a,s);return{...u!=null?{inputBytes:u}:{},...f!=null?{outputBytes:f}:{},...h?{tokens:h}:{},...m!=null?{costUsd:m}:{}}}const Zv={webScope:"Web search",synthesis:"Pre-synthesis",inputSynthesis:"Input synthesis",audit:"Post audit",polish:"Post polish",planner:"Planner",optimizer:"Optimizer"},Yd={"synthesized-context":"Pre-synthesis",webScope:"Web search",audit:"Post audit",polish:"Post polish"};function Rg(a,s){if(s){const r=Zv[s];if(r)return r}switch(a){case"externalPreUtility":return s?`Pre (${s})`:"Pre-action";case"pipelinePhase":return s?`Pipeline (${s})`:"Pipeline phase";case"mainSkill":return"Main skill";case"externalPostUtility":return s?`Post (${s})`:"Post-action";case"narrativePreprocessor":return"Narrix preprocess";case"narrativeHandler":return"Narrix handler";case"mapping":return"Write-back mapping";case"localSkill":return"Local skill";case"finalizer":return"Finalizer";case"validation":return"Validation";default:return a??"Step"}}function Ag(a){if(typeof a=="string")return Yd[a]??a;const s=Se(a);if(!s)return"Step";const r=typeof s.type=="string"?s.type:void 0,c=typeof s.phase=="string"?s.phase:void 0;return r&&Yd[r]?Yd[r]:c&&r?`${c}: ${r}`:r||"Step"}function c1(a){const s=Se(a.usage);if(!s)return;const r=We(s.inputTokens),c=We(s.outputTokens),u=We(s.totalTokens);if(!(r==null&&c==null&&u==null))return{...r!=null?{prompt:r}:{},...c!=null?{completion:c}:{},...u!=null?{total:u}:{}}}function o1(a){var c,u,f,h,m,p;const s=((c=Se(a.input))==null?void 0:c.preview)??((f=Se((u=Se(a.input))==null?void 0:u.valueRef))==null?void 0:f.preview),r=((h=Se(a.output))==null?void 0:h.preview)??((p=Se((m=Se(a.output))==null?void 0:m.valueRef))==null?void 0:p.preview);return{inputBytes:no(s),outputBytes:no(r)}}function u1(a,s){var m;const r=Se(a),c=Se(r==null?void 0:r.trace);if(!c)return[];const u=Se(c.unitExecutions);if(u)return Object.values(u).filter(p=>!p||typeof p!="object"?!1:String(p.nodeId??"")===s);const f=Se((m=Se(c.nodeExecutions))==null?void 0:m[s]),h=Se(f==null?void 0:f.units);return h?Object.values(h).filter(p=>!!p&&typeof p=="object"):[]}function d1(a){const s=[];for(const r of a){const c=typeof r.unitKind=="string"?r.unitKind:void 0;if(c==="mapping")continue;const u=typeof r.strategyKey=="string"?r.strategyKey:typeof r.actionKey=="string"?r.actionKey:void 0,f=We(r.durationMs),h=typeof r.status=="string"?r.status:void 0,m=h==="pending"||h==="queued"||h==="created",p=o1(r),g=c1(r),x=Vv(r),v=f!=null||p.inputBytes!=null||p.outputBytes!=null||g!=null||x!=null;if(m&&!v){s.push({stepKey:String(r.unitId??`${c??"unit"}:${s.length}`),label:Rg(c,u),planned:!0});continue}s.push({stepKey:String(r.unitId??`${c??"unit"}:${s.length}`),label:Rg(c,u),...f!=null?{durationMs:f}:{},...p.inputBytes!=null?{inputBytes:p.inputBytes}:{},...p.outputBytes!=null?{outputBytes:p.outputBytes}:{},...g?{tokens:g}:{},...x!=null?{costUsd:x}:{},...h!=null?{ok:h==="completed"}:{}})}return s.sort((r,c)=>{const u=f=>f.includes("pre")||f.includes("web")||f.includes("narrix")?0:f.includes("main")||f.includes("skill")?1:f.includes("post")||f.includes("audit")||f.includes("polish")?2:3;return u(r.stepKey)-u(c.stepKey)||r.label.localeCompare(c.label)})}function f1(a){var u,f;const s=(u=a.metrics)==null?void 0:u.effectiveExecutionPipeline,r=(f=a.summary)==null?void 0:f.effectiveExecutionPipeline,c=Array.isArray(s)?s:Array.isArray(r)?r:[];return c.length===0?[]:c.map((h,m)=>({stepKey:`pipeline:${m}:${Ag(h)}`,label:Ag(h),planned:!0}))}function h1(a){if(!a)return[];const s=[],r=Se(a.postSteps);if(r)for(const[c,u]of Object.entries(r)){const f=Se(u);if(!f)continue;const h=We(f.durationMs);s.push({stepKey:`post:${c}`,label:Zv[c]??`Post ${c}`,...h!=null?{durationMs:h}:{},ok:f.error==null})}return s}function m1(a,s){const r=new Map,c=f=>{const h=r.get(f.stepKey);if(!h){r.set(f.stepKey,f);return}h.planned&&!f.planned&&r.set(f.stepKey,{...f,label:h.label})};for(const f of d1(u1(s,a.nodeId)))c(f);for(const f of h1(a.summary))c(f);if(![...r.values()].some(f=>f.durationMs!=null&&!f.planned))for(const f of f1(a))c(f);return[...r.values()].sort((f,h)=>{const m=p=>p.label.includes("Web")||p.label.includes("Pre")||p.label.includes("Narrix")?0:p.label.includes("Main")?1:p.label.includes("Post")||p.label.includes("Audit")||p.label.includes("Polish")?2:3;return m(f)-m(h)||f.label.localeCompare(h.label)})}function Wv(a,s){const r=Jv(a,s),c=m1(a,s);return{...a,...r.inputBytes!=null?{inputBytes:r.inputBytes}:{},...r.outputBytes!=null?{outputBytes:r.outputBytes}:{},...r.tokens?{metrics:{...a.metrics,tokens:r.tokens}}:{},...r.costUsd!=null?{costUsd:r.costUsd}:{},...c.length>0?{subSteps:c}:{}}}function ex(a){const s=Se(a),r=Se(s==null?void 0:s.analysis);return!r||typeof r.jobId!="string"||typeof r.graphId!="string"||typeof r.startedAt!="number"||typeof r.endedAt!="number"||!Array.isArray(r.nodes)?null:r}function p1(a,s){return!Array.isArray(a.nodes)||a.nodes.length===0?[]:[...a.nodes].sort(Hf).map(r=>Wv(r,s))}function tx(a){const s=Se(a);if(!s)return{};const r=Se(s.execution)??s,c=Se(r._trace),u=Se(c==null?void 0:c.nodes);if(!u)return{};const f={};for(const[h,m]of Object.entries(u)){const p=Se(m);if(!p)continue;const g=p.startedAt,x=p.endedAt;if(typeof g!="number"||typeof x!="number")continue;const v=Array.isArray(p.attempts)?p.attempts.filter(N=>!!N&&typeof N=="object").map(N=>({index:typeof N.index=="number"?N.index:0,ok:N.ok!==!1,durationMs:typeof N.durationMs=="number"?N.durationMs:0})):void 0;f[h]={startedAt:g,endedAt:x,skillKey:typeof p.skillKey=="string"?p.skillKey:"",ok:p.ok!==!1,durationMs:typeof p.durationMs=="number"&&Number.isFinite(p.durationMs)?p.durationMs:Math.max(0,x-g),...typeof p.activityId=="string"?{activityId:p.activityId}:{},...Se(p.metrics)?{metrics:p.metrics}:{},...Se(p.summary)?{summary:p.summary}:{},...Se(p.error)?{error:{message:String(p.error.message??"failed"),...typeof p.error.code=="string"?{code:p.error.code}:{}}}:{},...v!=null&&v.length?{attempts:v}:{}}}return f}function y1(a){const s=Se(a),r=s==null?void 0:s.runLog;if(!Array.isArray(r))return[];const c=[];for(const u of r){const f=Se(u);if(!f)continue;const h=typeof f.scope=="string"?f.scope:void 0;if(h!=="pipeline"&&h!=="task"&&h!=="narrix"&&h!=="logxer")continue;const m=typeof f.ts=="number"?f.ts:Date.now();c.push({ts:m,scope:h,nodeId:typeof f.nodeId=="string"?f.nodeId:void 0,skillKey:typeof f.skillKey=="string"?f.skillKey:void 0,message:typeof f.message=="string"?f.message:String(f.message??""),..."data"in f?{data:f.data}:{}})}return c.sort((u,f)=>u.ts-f.ts)}function nx(a){const s=Se(a.runContext),r=a.nodeId??(s==null?void 0:s.nodeId);return typeof r=="string"&&r.length>0?r:void 0}function g1(a){const s=Se(a.outer);return{inputBytes:no(s==null?void 0:s.input),outputBytes:no(s==null?void 0:s.output)}}function v1(a,s){return a.startedAt<s.endedAt&&s.startedAt<a.endedAt}function x1(a,s,r){return r.filter(c=>c.nodeId!==a&&v1(s,c)).map(c=>c.nodeId).sort()}function Gc(a){if(typeof a=="number"&&Number.isFinite(a))return a>1e12?a:a*1e3;if(typeof a=="string"&&a.length>0){const s=Date.parse(a);return Number.isNaN(s)?void 0:s}}function j1(a){const s=String(a.status??"").toLowerCase();return s.includes("fail")||s.includes("error")}function b1(a){var r;const s={};for(const c of a){const u=nx(c);if(!u)continue;const f=((r=Se(c.outer))==null?void 0:r.metadata)??Se(c.metadata);if(((f==null?void 0:f.kind)??c.kind)==="exellix-graph-run")continue;const m=Gc(c.startTime)??Gc(c.createdAt);if(m==null)continue;const p=String(c.status??"").toLowerCase(),g=!p.includes("complete")&&!p.includes("done")&&!p.includes("success")&&!p.includes("fail"),x=Gc(c.endTime)??Gc(c.updatedAt)??(g?Date.now():m),v=typeof c.durationMs=="number"?c.durationMs:Math.max(0,x-m),N=Se(c.runContext),j=typeof c.skillKey=="string"&&c.skillKey||(typeof(N==null?void 0:N.skillKey)=="string"?N.skillKey:"");s[u]={startedAt:m,endedAt:Math.max(m,x),skillKey:j,ok:!j1(c),durationMs:v}}return s}function ax(a,s,r){var f;const c=r!=null?ex(r):null;if((f=c==null?void 0:c.nodes)!=null&&f.length)return p1(c,r);const u=Object.keys(a).length>0?a:b1(s);return S1(u,s).map(h=>Wv(h,r))}function S1(a,s){const r=new Map;for(const f of s){const h=nx(f);h&&r.set(h,f)}const c=Object.entries(a).map(([f,h])=>{var x;const m=r.get(f),p=m?g1(m):{},g=h.metrics;return{nodeId:f,skillKey:h.skillKey,startedAt:h.startedAt,endedAt:h.endedAt,durationMs:h.durationMs,ok:h.ok,inputBytes:p.inputBytes??(g==null?void 0:g.inputBytes),outputBytes:p.outputBytes??(g==null?void 0:g.outputBytes),concurrentWith:[],...h.metrics?{metrics:h.metrics}:{},...h.summary?{summary:h.summary}:{},...(x=h.attempts)!=null&&x.length?{attempts:h.attempts,retryAttempts:h.attempts.length}:{},...h.error?{error:h.error}:{}}}),u=c.map(f=>({nodeId:f.nodeId,startedAt:f.startedAt,endedAt:f.endedAt}));return c.map(f=>({...f,concurrentWith:x1(f.nodeId,f,u)})).sort(Hf)}function fo(a){if(a.length===0)return null;const s=Math.min(...a.map(h=>h.startedAt)),r=Math.max(...a.map(h=>h.endedAt));let c=0;for(const h of a)c+=h.concurrentWith.length;const u=a.map(h=>h.inputBytes).filter(h=>h!=null),f=a.map(h=>h.outputBytes).filter(h=>h!=null);return{nodeCount:a.length,totalDurationMs:Math.max(0,r-s),runStartedAt:s,runEndedAt:r,parallelPairCount:c/2,failedCount:a.filter(h=>!h.ok).length,...u.length?{totalInputBytes:u.reduce((h,m)=>h+m,0)}:{},...f.length?{totalOutputBytes:f.reduce((h,m)=>h+m,0)}:{}}}function lx(a,s){const r=Math.max(1,s.runEndedAt-s.runStartedAt);return a.map(c=>{const u=(c.startedAt-s.runStartedAt)/r*100,f=Math.max(.4,(c.endedAt-c.startedAt)/r*100);return{nodeId:c.nodeId,leftPct:u,widthPct:Math.min(100-u,f),ok:c.ok,concurrent:c.concurrentWith.length>0}})}function N1(a){if(a.length===0)return[];const s=[...a].sort((u,f)=>u.startedAt-f.startedAt||u.nodeId.localeCompare(f.nodeId)),r=new Set,c=[];for(;r.size<s.length;){const u=s.find(g=>!r.has(g.nodeId));if(!u)break;let f=u.endedAt;const h=[u];r.add(u.nodeId);let m=!0;for(;m;){m=!1;for(const g of s)r.has(g.nodeId)||g.startedAt<f&&(h.push(g),r.add(g.nodeId),f=Math.max(f,g.endedAt),m=!0)}const p=Math.min(...h.map(g=>g.startedAt));c.push({waveIndex:c.length,startedAt:p,endedAt:f,durationMs:Math.max(0,f-p),mode:h.length>1?"parallel":"sequential",nodes:h.sort((g,x)=>g.startedAt-x.startedAt||g.nodeId.localeCompare(x.nodeId))})}return c}function C1(a){const s=[...a].sort((u,f)=>u.startedAt-f.startedAt||u.nodeId.localeCompare(f.nodeId)),r=[],c=[];for(const u of s){let f=!1;for(let h=0;h<r.length;h++)if(r[h]<=u.startedAt){c[h].push(u),r[h]=u.endedAt,f=!0;break}f||(r.push(u.endedAt),c.push([u]))}return c.map((u,f)=>({laneIndex:f,nodes:u}))}function E1(a,s){return a.filter(r=>r.nodeId===s)}function T1(a){if(a.concurrentWith.length===0)return"Sequential window (no overlap with other nodes)";const s=a.concurrentWith.length;return`Parallel with ${s} other node${s===1?"":"s"}: ${a.concurrentWith.join(", ")}`}function Sf(a){return a.replace(/^node:/,"")}function w1({rows:a,summary:s}){const r=S.useMemo(()=>C1(a),[a]),c=S.useMemo(()=>lx(a,s),[a,s]),u=new Map(c.map(f=>[f.nodeId,f]));return n.jsxs("div",{className:"pipeline-swimlanes",children:[n.jsxs("div",{className:"pipeline-gantt-axis",children:[n.jsx("span",{children:new Date(s.runStartedAt).toLocaleTimeString(void 0,{hour12:!1})}),n.jsxs("span",{children:[r.length," lane",r.length===1?"":"s"," · max ",r.length," concurrent"]}),n.jsx("span",{children:new Date(s.runEndedAt).toLocaleTimeString(void 0,{hour12:!1})})]}),r.map(f=>n.jsxs("div",{className:"pipeline-swimlane-row",children:[n.jsxs("div",{className:"pipeline-swimlane-label",children:["Lane ",f.laneIndex+1]}),n.jsx("div",{className:"pipeline-gantt-track pipeline-swimlane-track",children:f.nodes.map(h=>{const m=u.get(h.nodeId);return m?n.jsxs("div",{className:`pipeline-swimlane-node${m.ok?"":" failed"}${m.concurrent?" concurrent":""}`,style:{left:`${m.leftPct}%`,width:`${m.widthPct}%`},title:`${h.nodeId} · ${h.skillKey} · ${nt(h.durationMs)}`,children:[n.jsx("span",{className:"pipeline-swimlane-node-id",children:Sf(h.nodeId)}),n.jsx("span",{className:"pipeline-swimlane-node-dur",children:nt(h.durationMs)})]},h.nodeId):null})})]},f.laneIndex)),n.jsx("p",{className:"pipeline-gantt-legend text-dim",children:"Each lane is one concurrent execution track. Nodes on different lanes at the same horizontal position ran in parallel."})]})}function R1({rows:a}){const s=S.useMemo(()=>N1(a),[a]);return n.jsx("div",{className:"pipeline-flow",children:s.map((r,c)=>n.jsxs("div",{className:"pipeline-flow-wave",children:[c>0&&n.jsxs("div",{className:"pipeline-flow-connector","aria-hidden":!0,children:[n.jsx("span",{className:"pipeline-flow-arrow",children:"↓"}),n.jsx("span",{className:"pipeline-flow-connector-label text-dim",children:"then"})]}),n.jsxs("div",{className:`pipeline-flow-wave-head${r.mode==="parallel"?" parallel":" sequential"}`,children:[n.jsx("span",{className:"pipeline-flow-wave-badge",children:r.mode==="parallel"?"Parallel batch":"Sequential step"}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[r.nodes.length," node",r.nodes.length===1?"":"s"," ·"," ",nt(r.durationMs)," wall"]})]}),n.jsx("div",{className:`pipeline-flow-nodes${r.nodes.length>1?" is-parallel":""}`,children:r.nodes.map(u=>n.jsxs("div",{className:`pipeline-flow-node${u.ok?"":" failed"}${u.concurrentWith.length>0?" concurrent":""}`,children:[n.jsx("div",{className:"pipeline-flow-node-id mono",children:Sf(u.nodeId)}),n.jsx("div",{className:"pipeline-flow-node-skill text-dim",children:u.skillKey||"—"}),n.jsx("div",{className:"pipeline-flow-node-dur",children:nt(u.durationMs)}),u.concurrentWith.length>0&&n.jsxs("div",{className:"pipeline-flow-node-peers text-dim",children:["overlaps ",u.concurrentWith.map(Sf).join(", ")]}),!u.ok&&u.error&&n.jsx("div",{className:"pipeline-flow-node-error",children:u.error.message})]},u.nodeId))})]},r.waveIndex))})}function sx({rows:a,title:s="Execution diagram"}){const[r,c]=S.useState("flow"),u=S.useMemo(()=>fo(a),[a]);return!u||a.length===0?null:n.jsxs("div",{className:"pipeline-diagram",children:[n.jsxs("div",{className:"pipeline-diagram-head",children:[n.jsx("div",{className:"section-title",style:{fontSize:13,margin:0},children:s}),n.jsxs("div",{className:"pipeline-diagram-tabs",children:[n.jsx("button",{type:"button",className:r==="flow"?"active":"",onClick:()=>c("flow"),children:"Flow (waves)"}),n.jsx("button",{type:"button",className:r==="swimlanes"?"active":"",onClick:()=>c("swimlanes"),children:"Swimlanes"})]})]}),r==="flow"?n.jsx(R1,{rows:a}):n.jsx(w1,{rows:a,summary:u})]})}function A1(a){return a.replace(/^node:/,"")}function O1(a,s){for(const r of a){const c=r.runContext;if((r.nodeId??(c==null?void 0:c.nodeId))===s)return r}}function M1({row:a,runLogRows:s,activities:r}){var h,m,p,g;const c=E1(s,a.nodeId),u=O1(r,a.nodeId),f=u==null?void 0:u.outer;return n.jsxs("div",{className:"pipeline-node-detail",children:[n.jsxs("div",{className:"pipeline-node-detail-grid",children:[n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Execution"}),n.jsx("span",{className:"detail-val",style:{fontSize:12},children:T1(a)})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Started"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:new Date(a.startedAt).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3})})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Ended"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:new Date(a.endedAt).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3})})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Payload"}),n.jsxs("span",{className:"detail-val text-dim",style:{fontSize:12},children:[zn(a.inputBytes)," in · ",zn(a.outputBytes)," out",((m=(h=a.metrics)==null?void 0:h.tokens)==null?void 0:m.total)!=null&&` · ${a.metrics.tokens.total} tokens`]})]}),((p=a.metrics)==null?void 0:p.model)&&n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Model"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:a.metrics.model})]})]}),a.attempts&&a.attempts.length>0&&n.jsxs("div",{style:{marginTop:10},children:[n.jsx("div",{className:"pipeline-node-detail-subtitle",children:"Engine retries"}),n.jsx("div",{className:"pipeline-attempts",children:a.attempts.map(x=>n.jsxs("span",{className:`pipeline-attempt-chip${x.ok?"":" failed"}`,children:["#",x.index+1," ",x.ok?"ok":"fail"," · ",nt(x.durationMs)]},x.index))})]}),c.length>0&&n.jsxs("div",{style:{marginTop:10},children:[n.jsxs("div",{className:"pipeline-node-detail-subtitle",children:["Inside this node (",c.length,")"]}),n.jsx("div",{className:"pipeline-runlog pipeline-node-runlog",children:c.map((x,v)=>n.jsxs("div",{className:"pipeline-runlog-line",children:[n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:new Date(x.ts).toLocaleTimeString(void 0,{hour12:!1})}),x.scope&&n.jsx("span",{className:"chip",style:{fontSize:10},children:x.scope}),n.jsx("span",{children:x.message})]},`${x.ts}-${v}`))})]}),a.summary&&Object.keys(a.summary).length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Trace summary",value:a.summary})}),(f==null?void 0:f.output)!=null&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Activix output",value:f.output})}),(u==null?void 0:u.narrixSummary)!=null&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Narrix",value:u.narrixSummary})}),a.error&&n.jsx("div",{className:"run-io-warning",style:{marginTop:10,fontSize:12},children:a.error.message}),c.length===0&&!a.summary&&!u&&!((g=a.attempts)!=null&&g.length)&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,margin:"10px 0 0"},children:["No inner pipeline log for this node — only wall timing from ",n.jsx("span",{className:"mono",children:"execution._trace"}),". Per-stage detail (pre-action, synthesis, main skill) needs backend instrumentation."]})]})}function k1({rows:a,runLogRows:s,activities:r}){var f;const[c,u]=S.useState(((f=a[0])==null?void 0:f.nodeId)??null);return n.jsxs("div",{className:"pipeline-node-inspector",children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-node detail"}),a.map(h=>{const m=c===h.nodeId;return n.jsxs("div",{className:`pipeline-node-inspector-item${m?" open":""}`,children:[n.jsxs("button",{type:"button",className:"pipeline-node-inspector-head",onClick:()=>u(m?null:h.nodeId),"aria-expanded":m,children:[n.jsx("span",{className:"pipeline-node-inspector-chevron",children:m?"▾":"▸"}),n.jsx("span",{className:"mono pipeline-node-inspector-id",children:A1(h.nodeId)}),n.jsx("span",{className:"text-dim",style:{fontSize:12},children:h.skillKey}),n.jsx("span",{className:"pipeline-node-inspector-dur",children:nt(h.durationMs)}),h.concurrentWith.length>0&&n.jsx("span",{className:"chip parallel",style:{fontSize:10},children:"parallel"}),n.jsx("span",{className:"pipeline-node-inspector-status",style:{color:h.ok?"var(--status-done)":"var(--status-failed)"},children:h.ok?"ok":"failed"})]}),m&&n.jsx(M1,{row:h,runLogRows:s,activities:r})]},h.nodeId)})]})}function ho({graphId:a,entity:s,variant:r="compact"}){const c=a!=null&&a.length>0?`/pipelines/${encodeURIComponent(a)}`:"/pipelines",u=s!=null&&s.length>0?`/pipelines/entity/${encodeURIComponent(s)}`:"/pipelines?view=entity";return r==="compact"?n.jsxs("div",{className:"pipeline-guide pipeline-guide-compact",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Per-run view"})," — Gantt timeline of each graph node: duration, parallel overlap, and Activix payload sizes. ",n.jsx("strong",{children:"Pipeline analytics"})," — averages by pipeline (graph) or by entity type across completed runs."]}),a&&n.jsx("p",{style:{marginTop:8},children:n.jsx(je,{to:c,children:"Open pipeline analytics for this graph →"})})]}):n.jsxs("div",{className:"pipeline-guide",children:[n.jsx("h3",{className:"pipeline-guide-title",children:"How to read pipeline performance"}),n.jsxs("div",{className:"pipeline-guide-grid",children:[n.jsxs("div",{children:[n.jsx("strong",{children:"Wall time"}),n.jsx("p",{className:"text-dim",children:"First node start → last node end for this run. Slower than the sum of node durations when nodes run in parallel waves or the graph waits between waves."})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Node duration"}),n.jsxs("p",{className:"text-dim",children:["One graph node boundary (local skill or single ai-tasks ",n.jsx("span",{className:"mono",children:"runTask"}),"). Inner steps (web search, pre-synthesis, main skill, post audit) appear as indented sub-rows when execution trace or analysis metadata is on the run."]})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Parallel overlap"}),n.jsx("p",{className:"text-dim",children:"Highlighted bars overlapped in time with another node — evidence the engine ran them concurrently (same wave). No overlap means sequential execution or incomplete trace."})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Input / output size"}),n.jsxs("p",{className:"text-dim",children:["Approximate JSON byte size of Activix activity payloads (",n.jsx("span",{className:"mono",children:"outer.input"})," /",n.jsx("span",{className:"mono",children:"outer.output"}),"). Requires Activix; timing works from"," ",n.jsx("span",{className:"mono",children:"execution._trace"})," alone."]})]})]}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:["Navigate: top bar ",n.jsx(je,{to:"/pipelines",children:"Pipeline analytics"})," ","· ",n.jsx(je,{to:"/pipelines?view=entity",children:"by entity"}),a?n.jsxs(n.Fragment,{children:[" ","· ",n.jsx(je,{to:c,children:"this pipeline"})]}):null,s?n.jsxs(n.Fragment,{children:[" ","· ",n.jsx(je,{to:u,children:"this entity"})]}):null," ","· Journal → open a completed run → ",n.jsx("em",{children:"Pipeline performance"})," card below Live Console."]})]})}function z1({status:a,graphId:s,entity:r}){const c=s!=null&&s.length>0?`/pipelines/${encodeURIComponent(s)}`:"/pipelines",u=r!=null&&r.length>0?`/pipelines/entity/${encodeURIComponent(r)}`:"/pipelines?view=entity";return a==="pending"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["This run is still ",n.jsx("strong",{children:"queued"}),". Performance data appears after you ",n.jsx("strong",{children:"Execute now"})," and nodes finish."]})}):a==="running"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["Graph is ",n.jsx("strong",{children:"running"}),". Node bars appear here as Activix activities and"," ",n.jsx("span",{className:"mono",children:"execution._trace"})," are written — this page refreshes automatically."]})}):a==="failed"||a==="cancelled"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["No performance trace on this run. Failed or cancelled runs may not persist"," ",n.jsx("span",{className:"mono",children:"execution._trace"}),". Try a successful run, or open"," ",n.jsx(je,{to:c,children:"pipeline analytics"}),r?n.jsxs(n.Fragment,{children:[" ","or ",n.jsx(je,{to:u,children:"entity analytics"})]}):null,"."]})}):n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["No ",n.jsx("span",{className:"mono",children:"execution._trace"})," on this result. Run the graph again via On-Demand or Journal, or view aggregates at ",n.jsx(je,{to:c,children:"pipeline analytics"}),"."]})})}function xa({label:a,value:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function D1({rows:a,runStartedAt:s,runEndedAt:r}){const c=fo(a);if(!c)return null;const u=lx(a,c),f=new Map(u.map(h=>[h.nodeId,h]));return n.jsxs("div",{className:"pipeline-gantt",children:[n.jsxs("div",{className:"pipeline-gantt-axis",children:[n.jsx("span",{children:new Date(s).toLocaleTimeString(void 0,{hour12:!1})}),n.jsxs("span",{children:[nt(c.totalDurationMs)," wall"]}),n.jsx("span",{children:new Date(r).toLocaleTimeString(void 0,{hour12:!1})})]}),a.map(h=>{const m=f.get(h.nodeId);return m?n.jsxs("div",{className:"pipeline-gantt-row",children:[n.jsx("div",{className:"pipeline-gantt-label",title:h.skillKey,children:n.jsx("span",{className:"mono",children:h.nodeId})}),n.jsx("div",{className:"pipeline-gantt-track",children:n.jsx("div",{className:`pipeline-gantt-bar${m.ok?"":" failed"}${m.concurrent?" concurrent":""}`,style:{left:`${m.leftPct}%`,width:`${m.widthPct}%`},title:`${h.skillKey} · ${nt(h.durationMs)}${h.concurrentWith.length?` · parallel with ${h.concurrentWith.join(", ")}`:""}`})}),n.jsx("div",{className:"pipeline-gantt-dur text-dim",children:nt(h.durationMs)})]},h.nodeId):null}),n.jsxs("p",{className:"pipeline-gantt-legend text-dim",children:[n.jsx("span",{className:"pipeline-gantt-swatch"})," node duration",n.jsx("span",{className:"pipeline-gantt-swatch concurrent"})," overlapped with another node (true parallel window)"]})]})}function q1({rows:a}){const s=a.some(r=>{var c;return(((c=r.subSteps)==null?void 0:c.length)??0)>0});return n.jsx("div",{className:"table-wrap",style:{marginTop:12},children:n.jsxs("table",{className:"data-table pipeline-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:s?"Node / step":"Node"}),n.jsx("th",{children:"Skill"}),n.jsx("th",{children:"Duration"}),n.jsx("th",{children:"Input"}),n.jsx("th",{children:"Output"}),n.jsx("th",{children:"Tokens"}),n.jsx("th",{children:"Cost"}),n.jsx("th",{children:"Parallel"}),n.jsx("th",{children:"Status"})]})}),n.jsx("tbody",{children:a.flatMap(r=>{var u;const c=[n.jsxs("tr",{children:[n.jsx("td",{className:"mono",children:r.nodeId}),n.jsx("td",{className:"mono text-dim",style:{fontSize:12},children:r.skillKey||"—"}),n.jsx("td",{children:nt(r.durationMs)}),n.jsx("td",{className:"text-dim",children:zn(r.inputBytes)}),n.jsx("td",{className:"text-dim",children:zn(r.outputBytes)}),n.jsx("td",{className:"text-dim",style:{fontSize:11},children:rr((u=r.metrics)==null?void 0:u.tokens)}),n.jsx("td",{className:"text-dim",children:ao(r.costUsd)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:r.concurrentWith.length>0?r.concurrentWith.join(", "):"—"}),n.jsxs("td",{children:[n.jsx("span",{style:{color:r.ok?"var(--status-done)":"var(--status-failed)"},children:r.ok?"ok":"failed"}),r.retryAttempts!=null&&r.retryAttempts>1&&n.jsxs("span",{className:"text-dim",style:{marginLeft:6,fontSize:11},children:["(",r.retryAttempts," attempts)"]})]})]},r.nodeId)];for(const f of r.subSteps??[])c.push(n.jsxs("tr",{className:"pipeline-substep-row",children:[n.jsxs("td",{className:"mono pipeline-substep-label",children:[n.jsx("span",{className:"pipeline-substep-marker",children:"↳"}),f.label,f.planned&&n.jsx("span",{className:"chip text-dim",style:{marginLeft:6,fontSize:10},children:"planned"})]}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{children:f.durationMs!=null?nt(f.durationMs):"—"}),n.jsx("td",{className:"text-dim",children:zn(f.inputBytes)}),n.jsx("td",{className:"text-dim",children:zn(f.outputBytes)}),n.jsx("td",{className:"text-dim",style:{fontSize:11},children:rr(f.tokens)}),n.jsx("td",{className:"text-dim",children:ao(f.costUsd)}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{className:"text-dim",children:"—"})]},`${r.nodeId}:${f.stepKey}`));return c})})]})})}function B1(a,s,r){if(!a)return"No trace yet";const c=[`${a.nodeCount} node${a.nodeCount===1?"":"s"}`,nt(a.totalDurationMs)];return a.parallelPairCount>0&&c.push(`${a.parallelPairCount} parallel pair${a.parallelPairCount===1?"":"s"}`),a.failedCount>0&&c.push(`${a.failedCount} failed`),r||c.push("sizes from trace only"),s&&c.push("pipeline log"),c.join(" · ")}function ix({runId:a,status:s,result:r,live:c,graphId:u,entity:f}){var O,Q,B;const h=he({queryKey:["run-activities",a],queryFn:()=>ee.runActivities(a),refetchInterval:c?1200:!1}),m=S.useMemo(()=>tx(r),[r]),p=S.useMemo(()=>y1(r),[r]),g=((O=h.data)==null?void 0:O.activities)??[],x=S.useMemo(()=>ax(m,g,r),[m,g,r]),v=S.useMemo(()=>ex(r),[r]),N=S.useMemo(()=>fo(x),[x]),j=x.length>0||p.length>0,E=s==="running"||s==="pending",C=((Q=h.data)==null?void 0:Q.available)!==!1,A=B1(N,p.length>0,C);return n.jsxs(kn,{id:"pipeline-performance",title:"Pipeline performance",summary:j?A:E?"Waiting for trace…":"No trace on this run",defaultOpen:j||E,style:{marginBottom:16},children:[n.jsx(ho,{graphId:u,entity:f,variant:"compact"}),!j&&!h.isLoading&&n.jsx(z1,{status:s,graphId:u,entity:f}),(h.isLoading||E&&x.length===0)&&j===!1&&n.jsxs("div",{className:"loading-row",style:{padding:"8px 0"},children:[n.jsx("span",{className:"spinner"}),E?"Waiting for node trace…":"Loading activity payloads…"]}),!C&&x.length>0&&n.jsx("div",{className:"run-io-warning",style:{marginBottom:12},children:"Activix is unavailable — timing comes from the run result; input/output sizes need activity records."}),N&&n.jsxs("div",{className:"pipeline-stats",children:[v&&n.jsxs(n.Fragment,{children:[n.jsx(xa,{label:"Job run",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:v.jobId})}),n.jsx(xa,{label:"Graph",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:v.graphId})}),n.jsx(xa,{label:"Run window",value:n.jsxs("span",{className:"mono",style:{fontSize:11},children:[new Date(v.startedAt).toLocaleString()," → ",new Date(v.endedAt).toLocaleString()]})}),v.planHash&&n.jsx(xa,{label:"Plan hash",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:v.planHash})}),((B=v.totals)==null?void 0:B.totalTokens)!=null&&n.jsx(xa,{label:"Tokens (sum)",value:`${v.totals.promptTokens??"—"} prompt · ${v.totals.completionTokens??"—"} completion · ${v.totals.totalTokens} total`})]}),n.jsx(xa,{label:"Wall time",value:nt(N.totalDurationMs)}),n.jsx(xa,{label:"Nodes",value:N.nodeCount}),n.jsx(xa,{label:"Parallel overlap",value:N.parallelPairCount>0?`${N.parallelPairCount} pair${N.parallelPairCount===1?"":"s"} (intervals overlapped)`:"None detected — nodes ran sequentially or traces are incomplete"}),(N.totalInputBytes!=null||N.totalOutputBytes!=null)&&n.jsx(xa,{label:"Activix payloads (sum)",value:`${zn(N.totalInputBytes)} in · ${zn(N.totalOutputBytes)} out`})]}),N&&x.length>0&&n.jsx(sx,{rows:x,title:"Execution diagram"}),N&&x.length>0&&n.jsx(D1,{rows:x,runStartedAt:N.runStartedAt,runEndedAt:N.runEndedAt}),x.length>0&&n.jsx(q1,{rows:x}),x.length>0&&n.jsx(k1,{rows:x,runLogRows:p,activities:g}),x.some(z=>z.summary&&Object.keys(z.summary).length>0)&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-node metadata"}),x.filter(z=>z.summary&&Object.keys(z.summary).length>0).map(z=>n.jsx(Lt,{label:`${z.nodeId} summary`,value:z.summary},z.nodeId))]}),p.length>0&&n.jsxs("div",{style:{marginTop:16},children:[n.jsxs("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:["Pipeline / task log (",p.length,")"]}),n.jsx("div",{className:"pipeline-runlog",children:p.map((z,q)=>n.jsxs("div",{className:"pipeline-runlog-line",children:[n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:new Date(z.ts).toLocaleTimeString(void 0,{hour12:!1})}),z.scope&&n.jsx("span",{className:"chip",style:{fontSize:10},children:z.scope}),z.nodeId&&n.jsx("span",{className:"mono",style:{fontSize:11},children:z.nodeId}),n.jsx("span",{children:z.message})]},`${z.ts}-${q}`))})]}),!j&&E&&!h.isLoading&&n.jsx("p",{className:"text-muted",style:{fontSize:13,marginTop:8},children:"Trace appears after nodes complete. Refresh is automatic while the run is live."})]})}function Qs(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function Og(a){if(!a)return{payload:void 0,memorixRef:void 0};const{_memorixRef:s,...r}=a;return{payload:Object.keys(r).length>0?r:void 0,memorixRef:s}}function L1(a){try{return JSON.stringify(a)}catch{return""}}function Ic(a){if(!a)return!1;const s=Object.keys(a);return s.length===1&&s[0]==="recordId"}function Mg(a){const s=Qs(a);return!!(s&&typeof s.objectType=="string"&&Array.isArray(s.contentTypes))}function _1(a){const s=Qs(a);if(!s)return{};const r=Qs(s.outer),c=Qs(r==null?void 0:r.output);return{runtimeInput:r==null?void 0:r.input,runtimeOutput:(c==null?void 0:c.response)??(c&&!c.data?c:void 0),runtimeData:c==null?void 0:c.data,status:s.status,nodesExecuted:s.nodesExecuted,completedAt:s.completedAt,error:s.error??(c==null?void 0:c.error)}}function U1({runId:a,status:s,input:r,recordId:c,result:u,assemblySelection:f,savedResult:h,processingUpdate:m,live:p}){var J,ae,Ne;const g=he({queryKey:["run-activities",a],queryFn:()=>ee.runActivities(a),refetchInterval:p?1200:!1}),x=c??String((r==null?void 0:r.recordId)??""),v=he({queryKey:["assembler-preview",x,L1(f)],queryFn:()=>ee.assemblerPreview({selection:f,recordId:x}),enabled:!!(x&&Mg(f)),staleTime:6e4}),N=S.useMemo(()=>{var G;return _1((G=g.data)==null?void 0:G.graphRun)},[(J=g.data)==null?void 0:J.graphRun]),j=Og(r),E=Og(Qs(N.runtimeInput)),C=u??N.runtimeOutput,A=E.payload??(N.runtimeInput!=null&&s!=="pending"?N.runtimeInput:void 0),O=A!=null&&!Ic(Qs(A)),Q=O?A:((ae=v.data)==null?void 0:ae.assembled)??(Ic(j.payload)?void 0:j.payload),B=O?"runtime":(Ne=v.data)!=null&&Ne.assembled?"preview":Q?"queued":void 0,z=Mg(f),q=C!=null,V=N.runtimeData!=null,Z=j.memorixRef!=null||E.memorixRef!=null,I=N.status!=null||N.nodesExecuted!=null||N.error!=null,te=j.payload!=null&&!Ic(j.payload),ye=Ic(j.payload)&&!z&&!O,ue=(m==null?void 0:m.status)==="skipped",re=(m==null?void 0:m.status)==="pending"&&!h&&s!=="failed"&&s!=="running"&&!p,Ce=((m==null?void 0:m.status)==="in_progress"||(m==null?void 0:m.status)==="pending"&&(p||s==="running"))&&!h&&s!=="failed",Te=(m==null?void 0:m.status)==="failed";if(!r&&!z&&Q==null&&!q&&!V&&!Z&&!I&&!h&&!m&&!g.isLoading&&!v.isLoading)return n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Request & response"}),n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No input or output recorded for this run yet."})]});const k=B==="runtime"?"Graph input (recorded at execution)":B==="preview"?"Graph input (resolved from Memorix)":"Graph input";return n.jsxs("div",{className:"card run-io-panel",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Request & response"}),n.jsxs("p",{className:"run-io-hint",children:["The graph receives assembled Memorix record data as ",n.jsx("span",{className:"mono",children:"runtime.input"})," ","— not the internal job reference. After execution, the recorded runtime snapshot is shown when available."]}),ye&&n.jsx("div",{className:"run-io-warning",children:"This run has no assembly selection — the graph will receive only the record id unless input is expanded elsewhere."}),v.isError&&!Q&&n.jsxs("div",{className:"run-io-warning",children:["Could not resolve Memorix record data for preview: ",String(v.error)]}),v.isLoading&&!Q&&z&&n.jsx("div",{className:"run-io-pending",children:"Resolving graph input from Memorix…"}),Q!=null&&n.jsx(Lt,{label:k,value:Q,defaultOpen:!0}),z&&n.jsx(Lt,{label:"Assembly selection",value:f}),te&&n.jsx(Lt,{label:"Additional queued fields",value:j.payload}),Z&&n.jsx(Lt,{label:"Memorix reference",value:E.memorixRef??j.memorixRef}),q?n.jsx(Lt,{label:"Response",value:C,defaultOpen:!0}):n.jsx("div",{className:"run-io-pending",children:p||s==="running"?"Response will appear when the graph finishes.":s==="failed"?"No response — run failed before producing output.":"No response recorded yet."}),h&&n.jsxs("div",{className:"run-io-writeback",children:[n.jsx("div",{className:"run-io-writeback-title",children:"Saved to Memorix"}),n.jsxs("div",{className:"detail-row",style:{margin:0},children:[n.jsx("span",{className:"detail-key",children:"Collection"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:12},children:h.collection})]}),n.jsxs("div",{className:"detail-row",style:{margin:0},children:[n.jsx("span",{className:"detail-key",children:"Record"}),n.jsx("span",{className:"detail-val",children:n.jsx(je,{to:`/information/${encodeURIComponent(h.recordId)}?entity=${encodeURIComponent(h.entityName)}&collection=${encodeURIComponent(h.contentType)}`,className:"mono",style:{fontSize:12},children:h.recordId})})]}),n.jsx(Lt,{label:"Writeback reference",value:h})]}),ue&&!h&&n.jsx("div",{className:"run-io-pending",children:(m==null?void 0:m.detail)??"Results were not written to Memorix."}),Ce&&n.jsx("div",{className:"run-io-pending",children:"Graph is running — result writeback will appear here when persistency is enabled."}),re&&n.jsx("div",{className:"run-io-pending",children:"Result writeback will appear here when the run finishes and persistency is enabled."}),Te&&n.jsx("div",{className:"run-io-warning",children:(m==null?void 0:m.detail)??"Result writeback failed."}),V&&n.jsx(Lt,{label:"Execution diagnostics",value:N.runtimeData}),N.error!=null&&n.jsx(Lt,{label:"Graph error",value:N.error,defaultOpen:!0}),I&&n.jsx(Lt,{label:"Run telemetry",value:{status:N.status,nodesExecuted:N.nodesExecuted,completedAt:N.completedAt}})]})}const Q1=["Overview","Console","Pipeline","Input & Output","Details"];function ot({label:a,value:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function $1(a){if(a.sourceType==="continuous"&&a.sourceRef)return`/work/${a.sourceRef}`;if(a.sourceType==="on-demand-batch"&&a.sourceRef)return`/on-demand/batch/${a.sourceRef}`}function H1(a){var c;if(a.status==="pending"&&a.error&&new Date(a.availableAt).getTime()>Date.now()&&!((c=a.queueOptions)!=null&&c.admissionHeld))return`Retry scheduled for ${Mt(a.availableAt)}`;const r=a.queueOptions;return a.status!=="pending"?Mt(a.availableAt):r!=null&&r.admissionHeld?r.slotsAvailable>0?"Waiting for capacity — a slot is available; you can execute now":`Waiting for capacity (${r.admittedCount}/${r.maxConcurrentJobs} slots in use)`:r&&r.slotsAvailable<=0?`Queued (${r.admittedCount}/${r.maxConcurrentJobs} slots in use) — waiting for worker or execute now`:"Queued — ready to execute"}const rx=12e4;function K1(a){return a.status!=="running"?!1:Date.now()-new Date(a.updatedAt).getTime()>rx}function G1(a){const s=a&&typeof a=="object"&&!Array.isArray(a)?a:void 0;return!!(s&&typeof s.objectType=="string"&&Array.isArray(s.contentTypes))}function kg(a,s){return a.status==="updated"?"succeeded":a.status==="failed"?"failed":a.status==="in_progress"||a.status==="pending"&&s==="running"?"running":a.status==="skipped"?"skipped":"pending"}function I1(a,s,r){if(a.status==="updated"&&!r)return`This item was marked as processed by "${a.graphId}".`;if(a.status==="updated"&&r)return`Graph output was written to ${r.collection}.`;if(a.status==="failed")return a.detail??"Processing metadata update failed.";if(a.status==="in_progress"||a.status==="pending"&&s==="running")return"Graph is running — Memorix writeback will update when the run completes.";if(a.status==="pending")return"The item will be marked as processed when the run succeeds and results are written.";if(a.status==="skipped")return a.detail??"Processing metadata update was skipped (simulation or graph without persistence)."}function Y1(a){return a.status==="running"||a.status==="pending"&&a.attempts>0?"Console":(a.status==="failed","Overview")}function P1(a){var s;return{entity:a.entity,collection:a.collection,recordId:a.recordId,graphId:a.graphId,priority:a.priority,...(s=a.relatedRecords)!=null&&s.length?{relatedRecords:a.relatedRecords}:{},...G1(a.assemblySelection)?{assemblySelection:a.assemblySelection}:{}}}function zg({run:a,pu:s}){return n.jsxs(kn,{title:"Processing result",summary:s?kg(s,a.status):"none",defaultOpen:!!s,style:{marginBottom:0,borderColor:(s==null?void 0:s.status)==="updated"?"var(--status-done)":(s==null?void 0:s.status)==="failed"?"var(--status-failed)":void 0},children:[!s&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No processing result recorded."}),s&&n.jsxs(n.Fragment,{children:[n.jsx(ot,{label:"Status",value:n.jsx(Ht,{status:kg(s,a.status)})}),n.jsx(ot,{label:"Graph",value:s.graphId}),a.savedResult&&n.jsx(ot,{label:"Saved to",value:n.jsxs(je,{to:`/information/${encodeURIComponent(a.savedResult.recordId)}?entity=${encodeURIComponent(a.savedResult.entityName)}&collection=${encodeURIComponent(a.savedResult.contentType)}`,className:"mono",style:{fontSize:12},children:[a.savedResult.collection," / ",a.savedResult.recordId]})}),n.jsx("div",{style:{fontSize:13,marginTop:8,color:s.status==="failed"?"var(--status-failed)":"var(--color-text-muted)"},children:I1(s,a.status,a.savedResult)})]})]})}function F1(){var ue;const{id:a}=li(),s=yn(),r=qn(),[c,u]=S.useState("Overview"),[f,h]=S.useState(!1),m=he({queryKey:["factory-run",a],queryFn:()=>ee.factoryRun(a),enabled:!!a,refetchInterval:re=>{var Ce;return((Ce=re.state.data)==null?void 0:Ce.status)==="running"?1500:!1}}),p=Ye({mutationFn:()=>ee.retryRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),r.invalidateQueries({queryKey:["factory-runs"]})}}),g=Ye({mutationFn:()=>ee.cancelRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),r.invalidateQueries({queryKey:["factory-runs"]})}}),x=Ye({mutationFn:()=>ee.executeRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),u("Console")}}),v=Ye({mutationFn:()=>ee.queueRunNext(a),onSuccess:()=>r.invalidateQueries({queryKey:["factory-run",a]})}),N=Ye({mutationFn:re=>ee.queueSingle(P1(re)),onSuccess:({run:re})=>{r.invalidateQueries({queryKey:["factory-runs"]}),r.invalidateQueries({queryKey:["run-status-counts"]}),s(`/journal/${re.id}`)}}),j=m.data;if(S.useEffect(()=>{!j||f||(u(Y1(j)),h(!0))},[j,f]),S.useEffect(()=>{h(!1)},[a]),m.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(m.isError||!j)return n.jsx(yt,{title:"Journal entry not found",detail:m.error});const E=j.queueOptions,C=j.status==="failed"||j.status==="cancelled",A=j.status==="done"||j.status==="failed"||j.status==="cancelled",O=j.status==="blocked"||j.status==="pending"||j.status==="running",Q=j.status==="pending"&&((E==null?void 0:E.canExecuteNow)??!0),B=j.status==="pending"&&((E==null?void 0:E.admissionHeld)||((E==null?void 0:E.slotsAvailable)??1)<=0),z=$1(j),q=j.processingUpdate,V=x.isPending||j.status==="running",Z=K1(j),I=j.status!=="pending"||j.attempts>0,te=Q1.filter(re=>re!=="Console"||V||I);function ye(){const re=`Queue a new run for ${j.recordLabel??j.recordId} through ${j.graphName??j.graphId}? This creates a new journal entry.`;window.confirm(re)&&N.mutate(j)}return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/journal",children:"Journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{className:"mono",children:j.id})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",marginBottom:4},children:[n.jsx("h1",{className:"page-title",style:{margin:0},children:j.recordLabel??j.recordId}),n.jsx(Ht,{status:j.status}),j.status==="pending"&&(E==null?void 0:E.admissionHeld)&&n.jsx("span",{className:"chip",title:"Waiting for admission capacity",children:"capacity held"})]}),n.jsxs("span",{className:"page-subtitle mono",children:[j.entity," ·"," ",n.jsx(je,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordId})," · ",n.jsx(je,{to:`/pipelines/${encodeURIComponent(j.graphId)}`,children:j.graphName??j.graphId})]})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",justifyContent:"flex-end"},children:[A&&n.jsx("button",{className:"primary",disabled:N.isPending,onClick:ye,children:N.isPending?"Queuing…":"Re-run"}),Q&&n.jsx("button",{className:A?"":"primary",disabled:x.isPending,onClick:()=>x.mutate(),children:x.isPending?"Executing…":"Execute now"}),B&&n.jsx("button",{disabled:v.isPending,onClick:()=>v.mutate(),children:v.isPending?"Updating…":"Run next when slot available"}),C&&n.jsx("button",{disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Retrying…":"Retry same entry"}),O&&n.jsx("button",{disabled:g.isPending,onClick:()=>g.mutate(),style:{color:"var(--status-cancelled)"},children:g.isPending?"Cancelling…":"Cancel"})]})]}),n.jsx("div",{className:"tabs",children:te.map(re=>n.jsxs("button",{type:"button",className:`tab${c===re?" active":""}`,onClick:()=>u(re),children:[re,re==="Console"&&V&&n.jsx("span",{className:"live-dot live",style:{marginLeft:8}})]},re))}),c==="Overview"&&n.jsxs(n.Fragment,{children:[Z&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["This run has been ",n.jsx("strong",{children:"running"})," for over ",Math.round(rx/6e4)," minutes with no update — the API likely stopped mid-execute. Use ",n.jsx("strong",{children:"Cancel"}),", then ",n.jsx("strong",{children:"Re-run"})," or ",n.jsx("strong",{children:"Retry same entry"})," and ",n.jsx("strong",{children:"Execute now"})," again."]}),j.status==="pending"&&j.error&&new Date(j.availableAt).getTime()>Date.now()&&!(E!=null&&E.admissionHeld)&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:16,fontSize:13,color:"var(--status-pending)"},children:["Transient failure — automatic retry scheduled for ",Mt(j.availableAt)," (",j.attempts,"/",j.maxAttempts," attempts used)."]}),j.status==="pending"&&E&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:16,fontSize:13},children:[E.admissionHeld&&n.jsx("div",{style:{marginBottom:6,color:"var(--status-pending)"},children:"Waiting for capacity — this run is held until a slot opens or you execute it manually."}),E.slotsAvailable>0?`${E.slotsAvailable} execution slot${E.slotsAvailable===1?"":"s"} available (${E.admittedCount}/${E.maxConcurrentJobs} in use).`:`All ${E.maxConcurrentJobs} execution slots are in use.`,B&&" Use “Run next when slot available” to move this job to the front of the waiting queue."]}),n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Summary"}),n.jsx(ot,{label:"Status",value:n.jsx(Ht,{status:j.status})}),n.jsx(ot,{label:"Source",value:z?n.jsx(je,{to:z,children:j.sourceName??wa[j.sourceType]}):j.sourceName??wa[j.sourceType]}),n.jsx(ot,{label:"Item",value:n.jsx(je,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordLabel??j.recordId})}),n.jsx(ot,{label:"Pipeline",value:j.graphName??j.graphId}),n.jsx(ot,{label:"Attempts",value:`${j.attempts} / ${j.maxAttempts}`}),n.jsx(ot,{label:"Updated",value:Mt(j.updatedAt)})]}),n.jsx(zg,{run:j,pu:q})]}),x.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:["Execute failed: ",String(x.error)]}),N.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:["Re-run failed: ",String(N.error)]}),j.error&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:[n.jsxs("div",{style:{color:"var(--status-failed)",fontWeight:600},children:["Error: ",j.error.message]}),j.error.code&&n.jsxs("div",{className:"mono text-muted",style:{fontSize:12,marginTop:4},children:["code: ",j.error.code,j.error.code==="TRANSIENT"?" — transient failure; may retry automatically":"",j.error.code==="NON_RETRYABLE"?" — will not auto-retry":""]})]})]}),c==="Console"&&(V||I?n.jsx(a1,{runId:j.id,live:V}):n.jsx("div",{className:"card",children:n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No console output yet."})})),c==="Pipeline"&&n.jsx(ix,{runId:j.id,status:j.status,result:j.result,live:V,graphId:j.graphId,entity:j.entity}),c==="Input & Output"&&n.jsx(U1,{runId:j.id,status:j.status,input:j.input,recordId:j.recordId,result:j.result,assemblySelection:j.assemblySelection,savedResult:j.savedResult,processingUpdate:j.processingUpdate,live:V}),c==="Details"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs(kn,{title:"Source",summary:wa[j.sourceType],defaultOpen:!0,children:[n.jsx(ot,{label:"Source type",value:wa[j.sourceType]}),n.jsx(ot,{label:"Source name",value:z?n.jsx(je,{to:z,children:j.sourceName}):j.sourceName??"—"}),n.jsx(ot,{label:"Source ref",value:j.sourceRef??"—"})]}),n.jsxs(kn,{title:"Target",summary:`${j.entity} · ${j.recordLabel??j.recordId}`,defaultOpen:!0,children:[n.jsx(ot,{label:"Entity",value:`${j.entity} · ${j.collection}`}),n.jsx(ot,{label:"Item",value:n.jsx(je,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordLabel??j.recordId})}),n.jsx(ot,{label:"Graph",value:j.graphName??j.graphId}),n.jsx(ot,{label:"Context",value:(ue=j.relatedRecords)!=null&&ue.length?j.relatedRecords.join(", "):"—"}),n.jsx(ot,{label:"Output collection",value:j.outputCollection??"—"})]}),n.jsxs(kn,{title:"Execution",summary:`${j.attempts} / ${j.maxAttempts} attempts`,defaultOpen:!0,children:[n.jsx(ot,{label:"Attempts",value:`${j.attempts} / ${j.maxAttempts}`}),n.jsx(ot,{label:"Priority",value:j.priority}),n.jsx(ot,{label:"Claimed by",value:j.claimedBy??n.jsx("span",{className:"text-dim",children:"unclaimed"})}),n.jsx(ot,{label:"Queue state",value:H1(j)})]}),n.jsxs(kn,{title:"Timestamps",summary:Mt(j.updatedAt),defaultOpen:!0,children:[n.jsx(ot,{label:"Created",value:Mt(j.createdAt)}),n.jsx(ot,{label:"Updated",value:Mt(j.updatedAt)})]})]}),n.jsx(zg,{run:j,pu:q})]})]})}function X1(a){const s=new Map,r=new Map(a.nodes.map(u=>[u.id,u]));function c(u,f=new Set){if(s.has(u))return s.get(u);if(f.has(u))return 0;f.add(u);const h=r.get(u);if(!h||!h.dependsOn.length)return s.set(u,0),0;const m=Math.max(...h.dependsOn.map(p=>c(p,f)))+1;return s.set(u,m),m}for(const u of a.nodes)c(u.id);return s}function V1({graph:a}){if(!a.nodes.length)return n.jsx("div",{className:"empty-state",children:"No graph data"});const s=X1(a),r=Math.max(...s.values(),0),c=Array.from({length:r+1},()=>[]);for(const u of a.nodes)c[s.get(u.id)??0].push(u);return n.jsxs("div",{className:"card",style:{marginBottom:20,overflow:"auto"},children:[n.jsx("div",{className:"card-title",children:"Dependency Graph"}),n.jsx("div",{style:{display:"flex",gap:24,padding:"12px 0",minWidth:"max-content"},children:c.map((u,f)=>n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,minWidth:160},children:[n.jsxs("div",{className:"text-dim",style:{fontSize:11,textAlign:"center"},children:["Layer ",f]}),u.map(h=>n.jsxs(je,{to:`/journal/${h.id}`,style:{display:"block",padding:"10px 12px",background:"var(--color-surface-raised)",border:"1px solid var(--color-border)",borderLeft:`3px solid var(--status-${h.status})`,borderRadius:"var(--radius)",textDecoration:"none"},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,marginBottom:4},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:h.graphId}),n.jsx(Ht,{status:h.status})]}),n.jsx("div",{className:"mono text-dim",style:{fontSize:10},children:h.id})]},h.id))]},f))}),a.edges.length>0&&n.jsxs("div",{className:"text-dim",style:{fontSize:11,marginTop:8},children:[a.edges.length," dependency edge",a.edges.length===1?"":"s"]})]})}function J1({run:a,allRuns:s}){var u;const r=(u=a.input)==null?void 0:u.upstream;if(!r||typeof r!="object"||Array.isArray(r))return null;const c=Object.entries(r);return c.length?n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Received from Upstream"}),c.map(([f,h])=>{const m=s==null?void 0:s.find(p=>p.graphId===f&&p.status==="done");return n.jsxs("div",{style:{marginBottom:10},children:[n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:4},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:f}),m&&n.jsx(je,{to:`/journal/${m.id}`,style:{fontSize:11},children:"view in journal"})]}),n.jsx("pre",{style:{fontSize:11,overflow:"auto",maxHeight:120,padding:8,background:"var(--color-bg)",borderRadius:"var(--radius)"},children:JSON.stringify(h,null,2)})]},f)})]}):null}function Z1({run:a,allRuns:s}){var c;if(((c=a.error)==null?void 0:c.code)!=="DEP_FAILED"||!a.dependsOn.length)return null;const r=(s==null?void 0:s.find(u=>a.dependsOn.includes(u.id)&&u.status==="failed"))??(s==null?void 0:s.find(u=>a.dependsOn.includes(u.id)));return n.jsxs("div",{style:{fontSize:12,marginTop:6},children:["Root cause:"," ",r?n.jsxs(je,{to:`/journal/${r.id}`,style:{color:"var(--status-failed)"},children:[r.graphId," (",r.id,")"]}):n.jsx("span",{className:"mono",children:a.dependsOn[0]})]})}function W1(a){return new Date(a).toLocaleString()}function eC({run:a,allRuns:s}){if(a.status!=="blocked"||a.dependsOn.length===0)return null;const r=a.dependsOn.map(f=>s.find(h=>h.id===f)).filter(f=>f!=null),c=r.filter(f=>f.status==="failed"||f.status==="cancelled"),u=r.filter(f=>f.status==="pending"||f.status==="running");return c.length===0&&u.length===0?null:n.jsxs("div",{style:{padding:"10px 14px",background:"var(--status-blocked-bg)",border:"1px solid var(--status-blocked)",borderRadius:"var(--radius)",marginBottom:8,fontSize:13},children:[n.jsx("strong",{style:{color:"var(--status-blocked)"},children:"Blocked"}),c.length>0&&n.jsxs("div",{style:{marginTop:6},children:["Upstream failures:"," ",c.map(f=>n.jsx(je,{to:`/journal/${f.id}`,style:{marginRight:8,color:"var(--status-failed)"},children:f.graphId},f.id))]}),u.length>0&&n.jsxs("div",{style:{marginTop:6},children:["Waiting on:"," ",u.map(f=>n.jsx(je,{to:`/journal/${f.id}`,style:{marginRight:8,color:"var(--status-pending)"},children:f.graphId},f.id))]})]})}function tC(){const{itemId:a}=li(),s=he({queryKey:["item-runs",a],queryFn:()=>ee.itemRuns(a),enabled:!!a}),r=he({queryKey:["item-graph",a],queryFn:()=>ee.itemGraph(a),enabled:!!a}),c=s.data??[];if(s.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading timeline…"]});if(s.isError)return n.jsxs("div",{className:"error-state",children:["Error: ",String(s.error)]});const u=[...new Set(c.map(f=>f.graphId))];return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/journal",children:"Journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx(je,{to:`/journal?itemId=${a}`,children:"Item journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{className:"mono",children:a})]}),n.jsxs("div",{className:"page-header",children:[n.jsx("h1",{className:"page-title",children:"Run timeline"}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),c.length===0&&n.jsx("div",{className:"empty-state",children:"No job runs found for this item."}),c.length>0&&n.jsxs(n.Fragment,{children:[r.data&&n.jsx(V1,{graph:r.data}),n.jsxs("div",{className:"card",style:{marginBottom:20},children:[n.jsx("div",{className:"card-title",children:"Pipeline status"}),n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:10,marginTop:8},children:u.map(f=>{const h=c.filter(p=>p.graphId===f),m=h[h.length-1];return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--color-surface-raised)",borderRadius:"var(--radius)",border:"1px solid var(--color-border)"},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:f}),m&&n.jsx(Ht,{status:m.status}),n.jsxs("span",{className:"text-dim",style:{fontSize:11},children:[h.length,"×"]})]},f)})})]}),n.jsx("div",{className:"timeline",children:c.map(f=>n.jsxs("div",{className:"timeline-item",children:[n.jsx("div",{className:`timeline-dot timeline-dot-${f.status}`}),n.jsxs("div",{className:"card",style:{borderLeft:`3px solid var(--status-${f.status})`},children:[n.jsx(eC,{run:f,allRuns:c}),n.jsx(J1,{run:f,allRuns:c}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx(Ht,{status:f.status}),n.jsx("span",{className:"mono",style:{fontSize:13},children:f.graphId})]}),n.jsx(je,{to:`/journal/${f.id}`,className:"mono text-muted",style:{fontSize:11},children:f.id})]}),n.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",fontSize:12,color:"var(--color-text-muted)"},children:[n.jsxs("span",{children:["Job: ",n.jsx("span",{className:"mono",children:f.jobDefId})]}),n.jsxs("span",{children:["Attempts: ",n.jsxs("span",{className:"mono",children:[f.attempts,"/",f.maxAttempts]})]}),n.jsxs("span",{children:["Created: ",n.jsx("span",{className:"mono",children:W1(f.createdAt)})]})]}),f.error&&n.jsxs("div",{style:{marginTop:10,padding:"8px 10px",background:"var(--status-failed-bg)",borderRadius:"var(--radius)",fontSize:12,color:"var(--status-failed)"},children:[f.error.message,n.jsx(Z1,{run:f,allRuns:c})]}),f.dependsOn.length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:`Depends On (${f.dependsOn.length})`,value:f.dependsOn})})]})]},f.id))})]})]})}function cx({work:a,busy:s,onClose:r,onConfirm:c}){return a?n.jsxs(ir,{open:!0,title:`Delete "${a.name}"?`,onClose:r,actions:[{label:"Keep work",onClick:r,variant:"ghost",disabled:s},{label:"Delete ongoing work",onClick:c,variant:"danger",disabled:s,loading:s}],children:[n.jsxs("p",{children:["This permanently removes ",n.jsx("strong",{children:a.name})," and its evaluation history. Scheduled scans will stop and this definition cannot be recovered."]}),n.jsxs("p",{className:"confirm-dialog-note confirm-dialog-note--warn",children:["Any blocked, pending, or running jobs created by this work (",a.jobsCreated.toLocaleString()," total"," ","created) will be cancelled. Completed runs stay in the journal."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["To pause scans without deleting, use ",n.jsx("strong",{children:"Pause"})," instead."]})]}):null}function nC(){const a=yn(),s=qn(),{agentQueryParam:r,agentId:c}=Bn(),u=he({queryKey:["work",r??"all"],queryFn:()=>ee.listWork(r)}),f=Ye({mutationFn:C=>ee.runEvaluation(C),onSuccess:()=>s.invalidateQueries({queryKey:["work"]})}),h=Ye({mutationFn:({id:C,status:A})=>ee.setWorkStatus(C,A),onSuccess:()=>s.invalidateQueries({queryKey:["work"]})}),[m,p]=S.useState(null),g=Ye({mutationFn:C=>ee.deleteWork(C),onSuccess:()=>{p(null),s.invalidateQueries({queryKey:["work"]}),s.invalidateQueries({queryKey:["factory-runs"]}),s.invalidateQueries({queryKey:["run-status-counts"]})}}),x=u.data??[],v=g.isPending,N=f.isPending||h.isPending||v,j=x.filter(C=>C.status==="active").length,E=x.reduce((C,A)=>C+A.jobsCreated,0);return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Ongoing Work"}),n.jsx("span",{className:"page-subtitle",children:c?n.jsxs(n.Fragment,{children:["Ongoing work for object types in agent scope ",n.jsx("span",{className:"mono",children:c}),"."]}):"Scheduled evaluations that match information and queue jobs automatically."})]}),n.jsx(je,{to:"/work/new",children:n.jsx("button",{className:"primary",children:"+ New ongoing work"})})]}),u.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),u.isError&&n.jsx(yt,{title:"Failed to load ongoing work",detail:u.error,onRetry:()=>u.refetch()}),g.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(yt,{title:"Failed to delete ongoing work",detail:g.error})}),n.jsx(cx,{work:m,busy:v,onClose:()=>p(null),onConfirm:()=>m&&g.mutate(m.id)}),x.length===0&&!u.isLoading&&!u.isError&&n.jsx(Yt,{title:"No ongoing work yet",message:"Ongoing work evaluates information on a schedule and queues jobs for items that match your narratives and processing rules.",actionLabel:"New ongoing work",actionTo:"/work/new"}),x.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"metric-grid",style:{gridTemplateColumns:"repeat(3, 1fr)",maxWidth:720},children:[n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:x.length}),n.jsx("div",{className:"metric-label",children:"Definitions"}),n.jsxs("div",{className:"metric-sub",children:[j," active · ",x.length-j," paused"]})]}),n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:j}),n.jsx("div",{className:"metric-label",children:"Scanning now"}),n.jsx("div",{className:"metric-sub",children:"On their re-scan schedule"})]}),n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:E.toLocaleString()}),n.jsx("div",{className:"metric-label",children:"Jobs created"}),n.jsx("div",{className:"metric-sub",children:"Across all definitions"})]})]}),n.jsx("div",{className:"work-list",children:x.map(C=>n.jsx(aC,{work:C,busy:N,onOpen:()=>a(`/work/${C.id}`),onEvaluate:()=>f.mutate(C.id),onToggleStatus:()=>h.mutate({id:C.id,status:C.status==="active"?"inactive":"active"}),onDelete:()=>p(C)},C.id))})]})]})}function aC({work:a,busy:s,onOpen:r,onEvaluate:c,onToggleStatus:u,onDelete:f}){const h=DN(a.lastResult),m=a.status==="active";return n.jsxs("article",{className:`work-card${m?"":" work-card-paused"}`,children:[n.jsxs("div",{className:"work-card-head",children:[n.jsx("button",{type:"button",className:"work-card-title",onClick:r,children:a.name}),n.jsx(Ht,{status:a.status}),n.jsxs("div",{className:"work-card-actions",onClick:p=>p.stopPropagation(),children:[n.jsx("button",{type:"button",className:"primary",disabled:s,onClick:c,title:"Run evaluation now",children:"Evaluate now"}),n.jsx("button",{type:"button",disabled:s,onClick:u,children:m?"Pause":"Activate"}),n.jsx("button",{type:"button",disabled:s,onClick:f,style:{color:"var(--status-cancelled)"},title:"Delete this ongoing work definition",children:"Delete"})]})]}),!m&&n.jsx("div",{className:"work-card-notice",children:"Paused — scheduled scans are off. Activate or run an evaluation manually."}),n.jsxs("div",{className:"work-card-stats",children:[n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:a.jobsCreated.toLocaleString()}),n.jsx("span",{className:"work-stat-label",children:"Jobs created"})]}),n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:Ma(a.lastEvaluatedAt)}),n.jsx("span",{className:"work-stat-label",children:"Last scanned"})]}),n.jsxs("div",{className:"work-stat work-stat-wide",children:[n.jsx("span",{className:"work-stat-value",children:h.enqueued!=null&&h.matched!=null?n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:h.enqueued.toLocaleString()}),n.jsx("span",{className:"work-stat-sep",children:" enqueued of "}),n.jsx("strong",{children:h.matched.toLocaleString()}),n.jsx("span",{className:"work-stat-sep",children:" matched"})]}):h.raw??"No scans yet"}),n.jsx("span",{className:"work-stat-label",children:"Last result"})]}),n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:m?Ma(a.nextEvaluationAt):"—"}),n.jsx("span",{className:"work-stat-label",children:"Next scan"})]})]}),n.jsxs("div",{className:"work-card-meta",children:[n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Entity"}),n.jsx("span",{className:"mono",children:a.entity})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Graph"}),n.jsx("span",{className:"mono",children:a.graphName??a.graphId})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Schedule"}),n.jsx("span",{children:fr(a.policy.rescanIntervalMinutes)})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Reprocessing"}),n.jsx("span",{children:zN(a.processing)})]})]}),a.narratives.length>0&&n.jsxs("div",{className:"work-card-narratives",children:[n.jsx("span",{className:"work-meta-k",children:"Narratives"}),n.jsx("span",{className:"chip-row",children:a.narratives.map(p=>n.jsx("span",{className:"chip narrative",children:p},p))})]})]})}function Gf({steps:a,current:s,isComplete:r,canGoTo:c,onGoTo:u,maxWidth:f,scrollable:h}){const m=S.useRef(null),p=h??a.length>5;return S.useEffect(()=>{const g=m.current;if(!g)return;const x=g.querySelector(".wizard-step.is-active");x==null||x.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[s,p]),n.jsx("div",{ref:m,className:`wizard-steps${p?" wizard-steps--scrollable":""}`,style:f?{maxWidth:f}:void 0,children:a.map((g,x)=>{const v=s===x,N=(r==null?void 0:r(x))??x<s,j=(c==null?void 0:c(x))??x<=s,E=g.summary?`${g.title} — ${g.summary}`:g.title;return n.jsxs("button",{type:"button",className:`wizard-step${v?" is-active":""}${N?" is-done":""}${j?" is-clickable":""}`,onClick:()=>j&&u(x),disabled:!j&&!v,title:E,"aria-current":v?"step":void 0,children:[n.jsx("span",{className:"wizard-step-num",children:N&&!v?"✓":x+1}),n.jsxs("span",{className:"wizard-step-label",children:[n.jsx("span",{className:"wizard-step-title",children:g.title}),g.summary&&n.jsx("span",{className:"wizard-step-summary",children:g.summary})]})]},g.id)})})}function bt({onBack:a,backLabel:s="Back",onNext:r,nextLabel:c="Next",nextDisabled:u,children:f}){return n.jsxs("div",{className:"wizard-nav",children:[a?n.jsx("button",{type:"button",onClick:a,children:s}):n.jsx("span",{}),n.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[f,r&&n.jsx("button",{type:"button",className:"primary",disabled:u,onClick:r,children:c})]})]})}function mo({entity:a,selected:s,onChange:r,requireSelection:c=!0}){const u=he({queryKey:["narratives",a],queryFn:()=>ee.listNarratives(a),enabled:!!a}),f=u.data??[];function h(v){r(s.includes(v)?s.filter(N=>N!==v):[...s,v])}if(u.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading narratives…"]});if(f.length===0)return n.jsx(Yt,{title:"No narratives available",message:c?"No narrative filters defined for this object type. You can continue — all information will be included.":"No narrative filters are available for this object type."});const m=s.length===f.length,p=f.map(v=>v.key);function g(){r(p)}function x(){r([])}return n.jsxs("div",{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10,gap:12,flexWrap:"wrap"},children:[n.jsxs("span",{style:{fontWeight:600,color:"var(--color-text)",fontSize:13},children:[s.length," of ",f.length," selected"]}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:m,onClick:g,children:"Select all"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:s.length===0,onClick:x,children:"Clear"})]})]}),s.length>0&&n.jsxs("div",{className:"selector-summary",children:[s.map(v=>{const N=f.find(j=>j.key===v);return n.jsx("span",{className:"chip narrative",children:(N==null?void 0:N.label)??v},v)}),n.jsx("span",{style:{color:"var(--color-text-dim)"},children:"·"}),n.jsx("span",{style:{color:"var(--color-text-dim)",fontSize:11},children:"information must match ALL (AND)"})]}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:f.map(v=>{const N=s.includes(v.key);return n.jsxs("div",{role:"checkbox","aria-checked":N,tabIndex:0,className:`selector-card${N?" selected":""}`,onClick:()=>h(v.key),onKeyDown:j=>(j.key===" "||j.key==="Enter")&&h(v.key),children:[n.jsx("div",{className:"selector-card-check-indicator"}),n.jsxs("div",{className:"selector-card-body",children:[n.jsxs("div",{className:"selector-card-meta",children:[n.jsx("span",{className:"selector-card-title",children:v.label}),n.jsx("span",{className:"selector-card-id",children:v.key})]}),v.description&&n.jsx("div",{className:"selector-card-desc",children:v.description})]}),v.activeRecords!==void 0&&n.jsxs("div",{className:"selector-card-count",children:[n.jsx("div",{className:"selector-card-count-num",children:v.activeRecords.toLocaleString()}),n.jsx("div",{className:"selector-card-count-label",children:"items"})]})]},v.key)})}),c&&s.length===0&&n.jsx("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:"Select at least one narrative to continue."}),!c&&s.length===0&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:["Information must match ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:"all"})," selected narratives (AND). For OR logic, create another ongoing work or batch."]})]})}const lC={core:"Core",snapshot:"Snapshot",scoped:"Scoped",lens:"Lens",enrichment:"Enrichment","processing-output":"Inferences",unknown:""};function hr(a){const s=lC[a.role];return s||a.key.charAt(0).toUpperCase()+a.key.slice(1)}function If({options:a,selected:s,onChange:r}){function c(u){if(s.includes(u)){if(s.length===1)return;r(s.filter(f=>f!==u))}else r([...s,u])}return a.length===0?null:a.length===1?n.jsx("span",{className:"mono",style:{fontSize:13},children:hr(a[0])}):n.jsx("div",{className:"chip-row",children:a.map(u=>n.jsxs("button",{type:"button",className:`chip selectable${s.includes(u.key)?" selected":""}`,onClick:()=>c(u.key),children:[hr(u),u.count>0&&n.jsx("span",{style:{opacity:.65,marginLeft:5,fontSize:11},children:u.count.toLocaleString()})]},u.key))})}const ox="jobs-ui-recent-graphs",sC=20;function ux(){try{const a=localStorage.getItem(ox);if(!a)return[];const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}}function iC(a){localStorage.setItem(ox,JSON.stringify(a.slice(0,sC)))}function rC(a){if(!a)return;const s=Date.now(),r=[{graphId:a,usedAt:s},...ux().filter(c=>c.graphId!==a)];iC(r)}function cC(){return ux().sort((a,s)=>s.usedAt-a.usedAt).map(a=>a.graphId)}function lo(a){var s;return(s=a.name)!=null&&s.trim()?a.name.trim():a.graphId.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function oC(a,s){const r=s.trim().toLowerCase();return r?[a.graphId,a.name,a.description,a.version,...a.entityCompatible].filter(Boolean).join(" ").toLowerCase().includes(r):!0}function Dg(a,s){var u,f;if(!s)return 0;const r=s.toLowerCase();let c=0;a.graphId.toLowerCase()===r&&(c+=100),a.graphId.toLowerCase().includes(r)&&(c+=40);for(const h of a.entityCompatible){const m=h.toLowerCase();m===r?c+=80:(m.includes(r)||r.includes(m))&&(c+=30)}return(u=a.name)!=null&&u.toLowerCase().includes(r)&&(c+=20),(f=a.description)!=null&&f.toLowerCase().includes(r)&&(c+=10),c}function uC(a,s,r,c){const u=a.filter(f=>oC(f,c));if(s==="recent"){const f=new Map(u.map(m=>[m.graphId,m])),h=[];for(const m of cC()){const p=f.get(m);p&&h.push(p)}for(const m of u)h.some(p=>p.graphId===m.graphId)||h.push(m);return h}return[...u].sort((f,h)=>{const m=Dg(h,r)-Dg(f,r);return m!==0?m:lo(f).localeCompare(lo(h))})}const dC=52,fC=5;function po({entity:a,value:s,onChange:r}){const[c,u]=S.useState("recent"),[f,h]=S.useState(""),m=he({queryKey:["graphs",a],queryFn:()=>ee.graphsForEntity(a),enabled:!!a}),p=m.data??[],g=S.useMemo(()=>uC(p,c,a,f),[p,c,a,f]);function x(v){rC(v.graphId),r(v.graphId,v)}return m.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading graphs…"]}):m.isError?n.jsx(Yt,{title:"Could not load graphs",message:m.error instanceof Error?m.error.message:"The graph list failed to load."}):p.length===0?n.jsx(Yt,{title:"No graphs found",message:`No pipelines are available for "${a}". Choose a different object type or add a graph for this type in Graphs Studio.`}):n.jsxs("div",{className:"graph-picker",children:[n.jsxs("div",{className:"graph-picker-toolbar",children:[n.jsxs("div",{className:"chip-row",children:[n.jsx("button",{type:"button",className:`chip selectable${c==="recent"?" selected":""}`,onClick:()=>u("recent"),children:"Recent"}),n.jsx("button",{type:"button",className:`chip selectable${c==="relevant"?" selected":""}`,onClick:()=>u("relevant"),children:"Relevant"})]}),n.jsx("input",{type:"search",className:"graph-picker-search",placeholder:"Search graphs…",value:f,onChange:v=>h(v.target.value)})]}),n.jsx("div",{className:"graph-picker-list",style:{maxHeight:dC*fC},role:"listbox","aria-label":"Graphs",children:g.length===0?n.jsx("div",{className:"graph-picker-empty",children:"No graphs match your search."}):g.map(v=>{const N=s===v.graphId,j=lo(v);return n.jsxs("button",{type:"button",role:"option","aria-selected":N,className:`graph-picker-row${N?" selected":""}`,onClick:()=>x(v),children:[n.jsxs("div",{className:"graph-picker-row-main",children:[n.jsx("span",{className:"graph-picker-row-title",children:j}),v.version&&n.jsx("span",{className:"chip",style:{fontSize:10},children:v.version})]}),n.jsx("span",{className:"graph-picker-row-id mono",children:v.graphId}),v.description&&n.jsx("span",{className:"graph-picker-row-desc",children:v.description})]},v.graphId)})})]})}function Yf({value:a,entities:s,loading:r,error:c,onChange:u,style:f}){if(c){const h=c instanceof Error?c.message:String(c);return n.jsxs("div",{className:"memorix-panel",style:{borderColor:"var(--status-failed)",background:"var(--status-failed-bg)"},children:[n.jsx("div",{className:"memorix-panel-title",style:{color:"var(--status-failed)"},children:"Could not load object types"}),n.jsx("p",{style:{fontSize:13,margin:"4px 0 0"},children:h||"The API is unavailable. Use http://localhost:3099 or start the API before the Vite dev server (5190)."})]})}return n.jsxs("select",{value:a,disabled:r,onChange:h=>u(h.target.value),style:f??{maxWidth:320},children:[n.jsx("option",{value:"",children:r?"Loading object types…":"— select object type —"}),!r&&["entity","event","knowledge"].map(h=>{const m=s.filter(p=>p.target===h);return m.length?n.jsx("optgroup",{label:qN[h],children:m.map(p=>n.jsx("option",{value:p.name,children:p.label},p.name))},h):null})]})}function yo({included:a,excluded:s,includedLabel:r="Matching information"}){const c=s.reduce((u,f)=>u+f.count,0);return n.jsxs("div",{className:"card",style:{padding:14},children:[n.jsxs("div",{style:{display:"flex",gap:24,marginBottom:s.length?12:0},children:[n.jsxs("div",{children:[n.jsx("div",{className:"status-card-count",style:{fontSize:24,color:"var(--status-done)"},children:a.toLocaleString()}),n.jsx("div",{className:"text-muted",style:{fontSize:12},children:r})]}),n.jsxs("div",{children:[n.jsx("div",{className:"status-card-count",style:{fontSize:24,color:c?"var(--status-blocked)":"var(--color-text-dim)"},children:c.toLocaleString()}),n.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Excluded"})]})]}),s.length>0&&n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map(u=>n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,padding:"4px 0",borderTop:"1px solid var(--color-border)"},children:[n.jsx("span",{className:"text-muted",children:$v[u.reason]}),n.jsx("span",{className:"mono",style:{color:"var(--status-blocked)"},children:u.count})]},u.reason))})]})}function hC(a,s,r,c,u,f){const h=(a==null?void 0:a.reprocessingMode)??"skip",m=s!==void 0,p=(r==null?void 0:r.replaceQueuedRuns)!==!1,g=[];if(f&&g.push(`${f.toLocaleString()} older queued run(s) would be replaced for this job type`),u===c)return g.length?g.join(". ")+".":h==="all"?"All matching items will be queued.":m&&s===null?"Simulation — reprocessing skip only checks items already running (if enabled), not prior simulation runs.":"Every matching item will receive a job under the current rules.";const x=c-u;return h==="all"?g.push(`${x.toLocaleString()} excluded by prerequisite rules`):m&&s?g.push(`${x.toLocaleString()} excluded — result already in writeback target, currently running, or already queued (when replace is off)`):g.push(`${x.toLocaleString()} excluded — see breakdown below`),p||g.push("queued runs are left in place when replace is off"),g.join("; ")+"."}function Xl({entity:a,collection:s,narratives:r,processing:c,graphId:u,persistency:f,queuePolicy:h,headline:m=!1,requireGraph:p=!1}){const g=he({queryKey:["matching",a,s,r,c,u,f,h],queryFn:()=>ee.previewMatching({entity:a,collection:s,narratives:r,processing:c,graphId:u,persistency:f,blockWhenRunning:h==null?void 0:h.blockWhenRunning,replaceQueuedRuns:h==null?void 0:h.replaceQueuedRuns}),enabled:!!(a&&(!p||u))});if(p&&!u)return n.jsx("p",{className:"text-dim",style:{fontSize:12,margin:0},children:"Choose a graph first — job counts depend on which pipeline (and its in-flight queue entries) apply."});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Evaluating matching information…"]});if(g.isError)return n.jsx("p",{className:"text-dim",style:{fontSize:12,color:"var(--color-danger, #e55)"},children:"Could not load preview. Try again in a moment."});if(!g.data)return null;const{matched:x,total:v,eligible:N,excluded:j,sample:E,wouldReplaceQueued:C}=g.data;return n.jsxs("div",{children:[m&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsxs("div",{style:{fontSize:15,fontWeight:600},children:[n.jsx("span",{style:{color:"var(--status-done)"},children:N.toLocaleString()})," ","job",N===1?"":"s"," will be queued"]}),n.jsxs("div",{className:"text-dim",style:{fontSize:12,marginTop:4},children:[x.toLocaleString()," match your filters out of ",v.toLocaleString()," in the collection.",N!==x&&n.jsxs(n.Fragment,{children:[" ",(x-N).toLocaleString()," excluded by eligibility rules."]}),C?n.jsxs(n.Fragment,{children:[" "," ",C.toLocaleString()," queued run(s) would be replaced."]}):null]})]}),n.jsxs("div",{className:"review-grid",style:{marginBottom:12},children:[n.jsx(Pd,{label:"Total in collection",value:v}),n.jsx(Pd,{label:"Matched filters",value:x}),n.jsx(Pd,{label:"Eligible to queue",value:N,highlight:!0})]}),n.jsx(yo,{included:N,excluded:j,includedLabel:"Eligible to queue"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,margin:"10px 0"},children:[x.toLocaleString()," of ",v.toLocaleString()," ",a," items match your filters."," ",hC(c,f,h,x,N,C)]}),E.length>0&&n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Label"}),n.jsx("th",{children:"Narratives"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:E.map(A=>n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:A.id}),n.jsx("td",{children:A.label}),n.jsx("td",{children:n.jsx("span",{className:"chip-row",children:Object.keys(A.narratives).map(O=>n.jsx("span",{className:"chip narrative",children:O},O))})}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:new Date(A.updatedAt).toLocaleString()})]},A.id))})]})})]})}function Pd({label:a,value:s,highlight:r}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:14,fontWeight:r?600:400,color:r?"var(--status-done)":void 0},children:s.toLocaleString()})]})}const mC=["ttl","failed-only","condition","all","skip"],pC=["skip","failed-only","before-date","after-date","condition","all"],qg={value:7,unit:"days"};function Pf({context:a="recurring",entity:s,targetGraphId:r,targetJobTypeId:c,hasContextLinks:u=!1,value:f,onChange:h}){const{agentQueryParam:m}=Bn(),p=he({queryKey:["graphs",s],queryFn:()=>ee.graphsForEntity(s),enabled:!!s}),g=he({queryKey:["entities",m??"all"],queryFn:()=>ee.listEntities(m)}),x=he({queryKey:["entity-relations",s],queryFn:()=>ee.entityRelations(s),enabled:!!s}),v=p.data??[],N=v.filter(G=>G.graphId!==r),j=(g.data??[]).filter(G=>G.name!==s),E=x.data??[],C=a==="recurring"?mC:pC,A=a==="recurring"?"ttl":"skip",O=f.reprocessingMode??A,Q=f.reprocessingTtl??qg,B=f.requiredGraphs??[],z=f.crossEntityPrerequisites??[];function q(G){const T=G.reprocessingMode??f.reprocessingMode??A;h({...f,excludeInFlight:T!=="all",...G})}function V(G){q({reprocessingMode:G,excludeInFlight:G!=="all",reprocessingTtl:G==="ttl"?qg:void 0,reprocessingDate:void 0,reprocessingCondition:void 0})}function Z(G){const T=v.find(U=>U.graphId===G);!T||B.some(U=>U.graphId===G)||q({requiredGraphs:[...B,{graphId:G,graphName:T.name}]})}function I(G){q({requiredGraphs:B.filter(T=>T.graphId!==G)})}const[te,ye]=S.useState(""),[ue,re]=S.useState(""),[Ce,Te]=S.useState(""),k=he({queryKey:["graphs",te],queryFn:()=>ee.graphsForEntity(te),enabled:!!te}).data??[],J=E.filter(G=>G.sourceEntity===s&&G.targetEntity===te);function ae(){if(!te||!Ce||!ue)return;const G=J.find(U=>U.relationKey===ue),T=k.find(U=>U.graphId===Ce);z.some(U=>U.entity===te&&U.relationshipKey===ue&&U.graphId===Ce)||(q({crossEntityPrerequisites:[...z,{entity:te,relationshipKey:ue,relationshipLabel:G==null?void 0:G.relationKey,graphId:Ce,graphName:T==null?void 0:T.name}]}),ye(""),re(""),Te(""))}function Ne(G){q({crossEntityPrerequisites:z.filter((T,U)=>U!==G)})}return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Reprocessing"}),O!==A&&n.jsx("span",{className:"chip",style:{background:"var(--color-warning-subtle, #2a2000)",borderColor:"var(--color-warning-border, #5a4000)",color:"var(--color-warning, #e6c200)"},children:"custom"})]}),n.jsxs("div",{className:"prereq-section-body",style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsx("select",{value:O,onChange:G=>V(G.target.value),style:{width:"100%"},children:C.map(G=>n.jsx("option",{value:G,children:G==="skip"&&c?`Skip already processed for job type "${c}"`:Hv[G]},G))}),O==="skip"&&c&&n.jsxs("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0},children:["Eligibility keys off logical job type ",n.jsx("code",{children:c}),", not the graph implementation id."]}),O==="ttl"&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{fontSize:12,color:"var(--color-text-muted)",whiteSpace:"nowrap"},children:"Only if older than"}),n.jsx("input",{type:"number",min:1,value:Q.value,onChange:G=>q({reprocessingTtl:{...Q,value:Math.max(1,Number(G.target.value))}}),style:{width:70}}),n.jsxs("select",{value:Q.unit,onChange:G=>q({reprocessingTtl:{...Q,unit:G.target.value}}),style:{width:90},children:[n.jsx("option",{value:"hours",children:"hours"}),n.jsx("option",{value:"days",children:"days"}),n.jsx("option",{value:"weeks",children:"weeks"})]})]}),(O==="before-date"||O==="after-date")&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{fontSize:12,color:"var(--color-text-muted)",whiteSpace:"nowrap"},children:O==="before-date"?"Before":"After"}),n.jsx("input",{type:"date",value:f.reprocessingDate??"",onChange:G=>q({reprocessingDate:G.target.value||void 0}),style:{flex:1}})]}),O==="condition"&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsx("textarea",{rows:3,value:f.reprocessingCondition??"",onChange:G=>q({reprocessingCondition:G.target.value||void 0}),placeholder:'{ "fields.criticality": "high" }',style:{fontFamily:"var(--font-mono)",fontSize:12}}),n.jsx("span",{style:{fontSize:11,color:"var(--color-text-dim)"},children:"Information matching this JSON condition will be re-run even if already processed."})]}),O==="all"&&n.jsx("p",{style:{fontSize:11,color:"var(--color-text-dim)",lineHeight:1.5},children:"Every matching item is queued, including items already pending or running for this graph. New jobs are created even when older queue entries still exist."}),O!=="skip"&&O!=="all"&&n.jsx("p",{style:{fontSize:11,color:"var(--color-text-dim)",lineHeight:1.5},children:"Information currently queued or running is always excluded to prevent overlapping work."})]})]}),n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Required prior processing"}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{className:"text-dim",style:{fontSize:12},children:"same entity"}),B.length>0&&n.jsx("span",{className:"chip",style:{background:"var(--color-accent-subtle)",borderColor:"var(--color-accent-border)",color:"var(--color-accent)"},children:B.length})]})]}),n.jsxs("div",{className:"prereq-section-body",children:[n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",marginBottom:12,lineHeight:1.5},children:"This item must have been successfully processed by these graphs before it becomes eligible."}),N.length>0?n.jsxs("select",{value:"",onChange:G=>{G.target.value&&Z(G.target.value)},style:{width:"100%",marginBottom:B.length?10:0},children:[n.jsx("option",{value:"",children:"+ Add required graph…"}),N.filter(G=>!B.some(T=>T.graphId===G.graphId)).map(G=>n.jsxs("option",{value:G.graphId,children:[G.name,G.version?` (${G.version})`:""]},G.graphId))]}):n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:8},children:['No other graphs compatible with "',s,'".']}),B.length>0&&n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:B.map(G=>n.jsxs("span",{className:"prereq-tag",children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:G.graphName??G.graphId}),n.jsx("button",{className:"prereq-tag-remove",onClick:()=>I(G.graphId),title:"Remove",children:"×"})]},G.graphId))})]})]}),u?n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Cross-entity prerequisites"}),z.length>0&&n.jsx("span",{className:"chip",style:{background:"var(--color-accent-subtle)",borderColor:"var(--color-accent-border)",color:"var(--color-accent)"},children:z.length})]}),n.jsxs("div",{className:"prereq-section-body",children:[n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",marginBottom:12,lineHeight:1.5},children:"Information from a linked entity must have been processed first — e.g. process child records only after their linked parent records have been enriched."}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr auto",gap:8,alignItems:"center",marginBottom:10},children:[n.jsxs("select",{value:te,onChange:G=>{ye(G.target.value),re(""),Te("")},children:[n.jsx("option",{value:"",children:"Linked entity…"}),j.map(G=>n.jsx("option",{value:G.name,children:G.label},G.name))]}),n.jsxs("select",{value:ue,onChange:G=>re(G.target.value),disabled:!te,children:[n.jsx("option",{value:"",children:"Relationship…"}),J.map(G=>n.jsx("option",{value:G.relationKey,children:G.relationKey},G.relationKey))]}),n.jsxs("select",{value:Ce,onChange:G=>Te(G.target.value),disabled:!te,children:[n.jsx("option",{value:"",children:"Processed by…"}),k.map(G=>n.jsx("option",{value:G.graphId,children:G.name},G.graphId))]}),n.jsx("button",{type:"button",className:"btn btn-sm",disabled:!te||!ue||!Ce,onClick:ae,children:"Add"})]}),z.length>0&&n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:z.map((G,T)=>n.jsxs("span",{className:"prereq-tag",style:{justifyContent:"space-between"},children:[n.jsxs("span",{style:{fontSize:12},children:[n.jsx("span",{className:"mono",children:G.entity}),G.relationshipKey&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-dim",children:" via "}),n.jsx("span",{className:"mono",children:G.relationshipKey})]}),n.jsx("span",{className:"text-dim",children:" → processed by "}),n.jsx("span",{className:"mono",children:G.graphName??G.graphId})]}),n.jsx("button",{className:"prereq-tag-remove",onClick:()=>Ne(T),title:"Remove",children:"×"})]},T))})]})]}):n.jsxs("div",{className:"prereq-section",children:[n.jsx("div",{className:"prereq-section-header",children:n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Cross-entity prerequisites"})}),n.jsx("div",{className:"prereq-section-body",children:n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0,lineHeight:1.5},children:"Configure context links on the selected graph (or on this work definition) before adding cross-entity prerequisites."})})]})]})}const yC={success:{icon:"✓",color:"var(--status-done)",bg:"var(--status-done-bg)",label:"Success"},partial:{icon:"◐",color:"var(--status-blocked)",bg:"var(--status-blocked-bg)",label:"Partially completed"},failed:{icon:"✕",color:"var(--status-failed)",bg:"var(--status-failed-bg)",label:"Failed"},"created-inactive":{icon:"◌",color:"var(--status-pending)",bg:"var(--status-pending-bg)",label:"Created (inactive)"}},gC={good:"var(--status-done)",warn:"var(--status-blocked)",bad:"var(--status-failed)",default:"var(--color-text)"};function go({result:a}){const s=yC[a.status];return n.jsxs("div",{className:"card",style:{maxWidth:640,margin:"0 auto",borderColor:s.color},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:4},children:[n.jsx("span",{style:{width:40,height:40,borderRadius:"50%",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:s.bg,color:s.color,fontSize:20,fontWeight:700},children:s.icon}),n.jsxs("div",{children:[n.jsx("div",{style:{fontSize:17,fontWeight:600},children:a.title}),a.summary&&n.jsx("div",{className:"text-muted",style:{fontSize:13},children:a.summary})]})]}),a.stats&&a.stats.length>0&&n.jsx("div",{className:"review-grid",style:{marginTop:16},children:a.stats.map(r=>n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:r.label}),n.jsx("span",{style:{color:gC[r.tone??"default"],fontWeight:r.tone&&r.tone!=="default"?600:400},children:String(r.value)})]},r.label))}),a.errors&&a.errors.length>0&&n.jsxs("div",{className:"error-state",style:{marginTop:16,fontSize:12},children:[n.jsxs("strong",{children:[a.errors.length," issue",a.errors.length===1?"":"s",":"]}),n.jsx("ul",{style:{margin:"6px 0 0 18px"},children:a.errors.map((r,c)=>n.jsx("li",{children:r},c))})]}),a.actions&&a.actions.length>0&&n.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginTop:20,paddingTop:16,borderTop:"1px solid var(--color-border)"},children:a.actions.map(r=>r.to?n.jsx(je,{to:r.to,children:n.jsx("button",{type:"button",className:r.primary?"primary":"",children:r.label})},r.label):n.jsx("button",{type:"button",className:r.primary?"primary":"",children:r.label},r.label))})]})}function Nf({name:a,newRecord:s,onChange:r}){return n.jsxs("div",{className:"writeback-existing",children:[n.jsx("div",{className:"writeback-existing-title",children:"Output row per item"}),n.jsx("p",{className:"hint",style:{marginBottom:10},children:"How results are stored in the output collection for each processed item."}),n.jsxs("div",{className:"writeback-modes",children:[n.jsxs("label",{className:`writeback-mode${s?" selected":""}`,children:[n.jsx("input",{type:"radio",name:a,checked:s,onChange:()=>r(!0)}),n.jsxs("span",{children:[n.jsx("strong",{children:"Add new record"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Each successful run appends another row (linked to this item)."})]})]}),n.jsxs("label",{className:`writeback-mode${s?"":" selected"}`,children:[n.jsx("input",{type:"radio",name:a,checked:!s,onChange:()=>r(!1)}),n.jsxs("span",{children:[n.jsx("strong",{children:"Replace existing"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"One row per item: update it when output already exists, or create it on the first successful run."})]})]})]})]})}const Bg={entityId:"same-as-input",contentType:gl,newRecord:!0};function vC(a){if(!a)return"not declared on graph";const s=a.entityId==="same-as-input"?"same as input":a.entityId,r=a.newRecord===!1?"update or create one row per item":"always new record";return`${s} · ${a.contentType} · ${r}`}function dx({enabled:a,value:s,sourceEntity:r,graphPersistency:c,onEnabledChange:u,onChange:f}){const h=s??Bg,m=h.entityId==="same-as-input"?"same-as-input":"custom";function p(g){f({...h,...g})}return n.jsxs("div",{className:"persistency-override",children:[n.jsxs("label",{className:"checkbox-row",style:{display:"flex",gap:8,alignItems:"flex-start",marginBottom:12},children:[n.jsx("input",{type:"checkbox",checked:a,onChange:g=>{const x=g.target.checked;u(x),x&&!s&&f({...Bg}),x||f(void 0)}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Override result persistence"}),n.jsxs("span",{className:"hint",style:{display:"block",marginTop:4},children:["Graph default: ",vC(c),a?" — work-level settings below merge over the graph at job completion.":" — enable to specify or override where graph results are written."]})]})]}),a&&n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Target object type"}),n.jsxs("select",{value:m,onChange:g=>{g.target.value==="same-as-input"?p({entityId:"same-as-input"}):p({entityId:r??""})},children:[n.jsxs("option",{value:"same-as-input",children:["Same as input",r?` (${r})`:""]}),n.jsx("option",{value:"custom",children:"Other object type…"})]})]}),m==="custom"&&n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type name"}),n.jsx("input",{value:h.entityId==="same-as-input"?"":h.entityId,onChange:g=>p({entityId:g.target.value||"same-as-input"}),placeholder:"e.g. vulnerabilities"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Content type"}),n.jsx("input",{value:h.contentType,onChange:g=>p({contentType:g.target.value||gl}),placeholder:gl})]}),n.jsx("div",{className:"writeback-existing-grid-span",children:n.jsx(Nf,{name:"persistency-existing-record-mode",newRecord:h.newRecord!==!1,onChange:g=>p({newRecord:g})})})]})]})}const al={overview:"Overview",work:"Work",onDemand:"On-Demand",information:"Information",outputs:"Outputs",journal:"Journal",pipelines:"Pipeline analytics",settings:"Settings"},Cf={step2Anchor:"Starting item",maxAttempts:"Max retries",maxAttemptsHint:"How many times to retry the pipeline if it fails."},ll={loadingRelations:"Loading links…",loadFailed:"Failed to load links",noRelations:a=>`No links defined for “${a}” yet. Add relationships in Schema UI, then return here.`,lead:"Toggle which related objects to include. Pick collections on each target, or leave empty for defaults.",preview:"Preview row counts",previewing:"Previewing…",previewTitle:"Preview — context that would load",rows:a=>`${a} row${a===1?"":"s"}`,contentTypes:"Collections to pull",contentTypesHint:"(none selected = default collections)"};function Ff({value:a,appDefault:s,onChange:r,id:c}){const u=a??s;return n.jsxs("div",{className:"field",children:[n.jsx("label",{htmlFor:c,children:Cf.maxAttempts}),n.jsx("input",{id:c,type:"number",min:1,max:20,value:u,onChange:f=>{const h=Number(f.target.value);Number.isFinite(h)&&r(h===s?void 0:Math.min(20,Math.max(1,Math.floor(h))))}}),n.jsxs("span",{className:"hint",children:[Cf.maxAttemptsHint," Only transient infrastructure errors (Mongo connection blips, timeouts) are retried automatically."," ","App default: ",s,". Set 1 to disable automatic retries."]})]})}const xC=[{id:"basic",title:"Basic info",summary:"Name & entity"},{id:"narratives",title:"Narratives",summary:"Select information"},{id:"prereqs",title:"Prerequisites",summary:"Processing rules"},{id:"graph",title:"Graph",summary:"Pipeline to run"},{id:"policy",title:"Execution policy",summary:"Interval & concurrency"},{id:"review",title:"Review",summary:"Create"},{id:"result",title:"Created",summary:"Result"}],jC=[5,15,30,60,240,1440];function bC(){var ce,xe;const{agentQueryParam:a}=Bn(),[s,r]=S.useState(0),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,x]=S.useState(["core"]),[v,N]=S.useState([]),[j,E]=S.useState(""),[C,A]=S.useState(),[O,Q]=S.useState([]),[B,z]=S.useState(!1),[q,V]=S.useState(),[Z,I]=S.useState({reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),[te,ye]=S.useState({rescanIntervalMinutes:15,priority:100}),[ue,re]=S.useState(null),Te=((ce=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()}).data)==null?void 0:ce.continuousJobMaxAttempts)??4,ve=he({queryKey:["entities",a??"all"],queryFn:()=>ee.listEntities(a),retry:2}),k=ve.data??[];S.useEffect(()=>{if(!m||!ve.isSuccess)return;k.map(de=>de.name).includes(m)||p("")},[ve.isSuccess,k,m]);const J=k.find(le=>le.name===m),ae=Ye({mutationFn:le=>ee.createWork({name:c,description:f,entity:m,collection:g[0]??"core",narratives:v,processing:Z,graphId:j,contextLinks:O.length?O:void 0,policy:te,activate:le,...B?{persistency:q}:{}}),onSuccess:({result:le})=>{re(le),r(6)}}),Ne=!!(c.trim()&&m),G=!!j,U=!(((J==null?void 0:J.narratives.length)??0)>0)||v.length>0;function W(le){if(le<=s)return r(le);le>=1&&!Ne||le>=2&&!U||le>=4&&!G||r(le)}const se=(()=>{var ut,it;const le=Z.reprocessingMode??"ttl";let de;if(le==="ttl"){const Pe=Z.reprocessingTtl??{value:7,unit:"days"};de=`re-run if older than ${Pe.value} ${Pe.unit}`}else de=Hv[le].split(" — ")[0];const Ze=[de];return(((ut=Z.requiredGraphs)==null?void 0:ut.length)??0)>0&&Ze.push(`${Z.requiredGraphs.length} prior graph(s) required`),(((it=Z.crossEntityPrerequisites)==null?void 0:it.length)??0)>0&&Ze.push(`${Z.crossEntityPrerequisites.length} cross-entity prerequisite(s)`),Ze.join(" · ")})(),F=g.map(le=>{const de=J==null?void 0:J.collections.find(Ze=>Ze.key===le);return de?hr(de):le}).join(", ");return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"New ongoing work"}),n.jsx("span",{className:"page-subtitle",children:"Ongoing work evaluates matching information on a schedule and queues jobs automatically."})]})}),n.jsx(Gf,{steps:xC,current:s,canGoTo:le=>le<=s||le<=5&&Ne,onGoTo:W,maxWidth:980}),n.jsxs("div",{style:{maxWidth:720},children:[s===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Basic info"}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Name *"}),n.jsx("input",{value:c,onChange:le=>u(le.target.value),placeholder:"e.g. Process selected records"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type *"}),n.jsx(Yf,{value:m,entities:k,loading:ve.isLoading,error:ve.error,onChange:le=>{var de,Ze;p(le),N([]),E(""),A(void 0),x([((Ze=(de=k.find(ut=>ut.name===le))==null?void 0:de.collections[0])==null?void 0:Ze.key)??"core"])}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Data sources"}),n.jsx(If,{options:(J==null?void 0:J.collections)??[],selected:g,onChange:x}),n.jsx("span",{className:"hint",children:"Select which data sources are passed to the graph as input."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Description"}),n.jsx("textarea",{value:f,onChange:le=>h(le.target.value),placeholder:"Optional — describe what this ongoing work does",rows:3})]})]}),n.jsx(bt,{onNext:()=>W(1),nextLabel:"Next: narratives",nextDisabled:!Ne})]}),s===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Select information by narratives"}),n.jsx(mo,{entity:m,selected:v,onChange:N}),m&&n.jsx("div",{style:{marginTop:16},children:n.jsx(Xl,{entity:m,collection:g[0]??"core",narratives:v})}),n.jsx(bt,{onBack:()=>W(0),onNext:()=>W(2),nextLabel:"Next: prerequisites",nextDisabled:!U})]}),s===2&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Processing prerequisites"}),n.jsx("p",{className:"wizard-lead",children:"Control which information is eligible. By default, items processed within the last 7 days are skipped — keeping results fresh without re-running everything on every scan."}),n.jsx(Pf,{context:"recurring",entity:m,targetGraphId:j||void 0,targetJobTypeId:C==null?void 0:C.jobTypeId,hasContextLinks:O.length>0||(((xe=C==null?void 0:C.contextLinks)==null?void 0:xe.length)??0)>0,value:Z,onChange:I}),n.jsx(bt,{onBack:()=>W(1),onNext:()=>W(3),nextLabel:"Next: graph"})]}),s===3&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Choose graph / pipeline"}),n.jsxs("p",{className:"wizard-lead",children:['Only graphs compatible with "',m,'" are shown. This graph is also used for reprocessing checks.']}),n.jsx(po,{entity:m,value:j,onChange:(le,de)=>{var Ze,ut,it,Pe;if(E(le),A(de),(Ze=de==null?void 0:de.contextLinks)!=null&&Ze.length&&Q(de.contextLinks),(it=(ut=de==null?void 0:de.jobPipeline)==null?void 0:ut.reprocessing)!=null&&it.mode&&I(Tt=>({...Tt,reprocessingMode:de.jobPipeline.reprocessing.mode,...de.jobPipeline.reprocessing.ttl?{reprocessingTtl:de.jobPipeline.reprocessing.ttl}:{}})),(Pe=de==null?void 0:de.upstream)!=null&&Pe.length){const Tt=de.upstream.filter(St=>St.entity&&St.relationshipKey).map(St=>({entity:St.entity,relationshipKey:St.relationshipKey,graphId:le,graphName:de.name}));Tt.length&&I(St=>({...St,crossEntityPrerequisites:Tt}))}}}),n.jsx("div",{className:"section-title",style:{marginTop:20},children:"Result persistence"}),n.jsx(dx,{enabled:B,value:q,sourceEntity:m,graphPersistency:C==null?void 0:C.persistency,onEnabledChange:z,onChange:V}),n.jsx(bt,{onBack:()=>W(2),onNext:()=>W(4),nextLabel:"Next: execution policy",nextDisabled:!G})]}),s===4&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Execution policy"}),n.jsx("p",{className:"wizard-lead",children:"Running jobs are never interrupted — this policy controls how often new eligible information is discovered. How many jobs run in parallel is configured app-wide in Settings."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Re-scan for new eligible information"}),n.jsx("select",{value:te.rescanIntervalMinutes,onChange:le=>ye({...te,rescanIntervalMinutes:Number(le.target.value)}),children:jC.map(le=>n.jsx("option",{value:le,children:fr(le)},le))}),n.jsx("span",{className:"hint",children:"Every X minutes, information that has become newly eligible (new or changed data matching your narratives) is discovered and queued. Running jobs are not affected."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Priority"}),n.jsx("input",{type:"number",value:te.priority,onChange:le=>ye({...te,priority:Number(le.target.value)})}),n.jsx("span",{className:"hint",children:"Higher priority jobs are picked up before lower priority ones when the queue is contested."})]}),n.jsx(Ff,{id:"create-work-max-attempts",value:te.maxAttempts,appDefault:Te,onChange:le=>ye({...te,maxAttempts:le})})]}),n.jsx(bt,{onBack:()=>W(3),onNext:()=>W(5),nextLabel:"Next: review"})]}),s===5&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Review & create"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:20},children:[n.jsx(ja,{label:"Object type",value:m}),n.jsx(ja,{label:"Data sources",value:F||"—"}),n.jsx(ja,{label:"Narratives (AND)",value:v.join(", ")||"none"}),n.jsx(ja,{label:"Prerequisites",value:se}),n.jsx(ja,{label:"Graph / pipeline",value:(C==null?void 0:C.name)??j}),B&&n.jsx(ja,{label:"Result persistence",value:`${(q==null?void 0:q.entityId)??"same-as-input"} · ${(q==null?void 0:q.contentType)??"inferences"}`}),n.jsx(ja,{label:"Re-scan interval",value:fr(te.rescanIntervalMinutes)}),n.jsx(ja,{label:"Priority",value:String(te.priority)}),n.jsx(ja,{label:"Max retries",value:String(te.maxAttempts??Te)})]}),n.jsx("div",{className:"section-title",children:"Estimated matching information"}),n.jsx(Xl,{entity:m,collection:g[0]??"core",narratives:v,processing:Z,graphId:j}),ae.isError&&n.jsx(yt,{title:"Failed to create ongoing work",detail:ae.error}),n.jsxs(bt,{onBack:()=>W(4),children:[n.jsx("button",{type:"button",disabled:ae.isPending,onClick:()=>ae.mutate(!1),children:"Create inactive"}),n.jsx("button",{type:"button",className:"primary",disabled:ae.isPending,onClick:()=>ae.mutate(!0),children:ae.isPending?"Creating…":"Create and activate"})]})]}),s===6&&ue&&n.jsx(go,{result:ue})]})]})}function ja({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{children:s})]})}const SC=[5,15,30,60,240,1440];function NC({work:a,onSaved:s}){var re,Ce,Te,ve;const[r,c]=S.useState(a.name),[u,f]=S.useState(a.description??""),[h,m]=S.useState(a.narratives),[p,g]=S.useState(a.graphId),[x,v]=S.useState(a.processing??{reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),[N,j]=S.useState(a.policy),[E,C]=S.useState(a.persistency!==void 0),[A,O]=S.useState(a.persistency),[Q,B]=S.useState(!1);S.useEffect(()=>{c(a.name),f(a.description??""),m(a.narratives),g(a.graphId),v(a.processing??{reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),j(a.policy),C(a.persistency!==void 0),O(a.persistency),B(!1)},[a]);const q=(((re=he({queryKey:["narratives",a.entity],queryFn:()=>ee.listNarratives(a.entity)}).data)==null?void 0:re.length)??0)>0,V=he({queryKey:["graphs",a.entity],queryFn:()=>ee.graphsForEntity(a.entity)}),I=((Ce=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()}).data)==null?void 0:Ce.continuousJobMaxAttempts)??4,te=(ve=(Te=V.data)==null?void 0:Te.find(k=>k.graphId===p))==null?void 0:ve.persistency,ye=Ye({mutationFn:()=>ee.updateWork(a.id,{name:r.trim(),description:u.trim()||void 0,narratives:h,processing:x,graphId:p,policy:N,persistency:E?A:null}),onSuccess:()=>{B(!0),s()}}),ue=!!(r.trim()&&p&&(!q||h.length>0));return n.jsxs("div",{className:"card",style:{maxWidth:720},children:[n.jsx("div",{className:"card-title",children:"Configuration"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:16},children:"Edit selection, prerequisites, graph, and schedule for this ongoing work. Parallel execution is configured app-wide in Settings."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Name"}),n.jsx("input",{value:r,onChange:k=>{c(k.target.value),B(!1)}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Description"}),n.jsx("textarea",{value:u,onChange:k=>{f(k.target.value),B(!1)},rows:2,placeholder:"Optional"})]})]}),n.jsx("div",{className:"section-title",style:{marginTop:20},children:"Information selection"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:10},children:["Object type: ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:a.entity})," · ","Data source: ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:a.collection})]}),n.jsx(mo,{entity:a.entity,selected:h,onChange:k=>{m(k),B(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Processing prerequisites"}),n.jsx(Pf,{context:"recurring",entity:a.entity,targetGraphId:p||void 0,value:x,onChange:k=>{v(k),B(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Graph / pipeline"}),n.jsx(po,{entity:a.entity,value:p,onChange:k=>{g(k),B(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Result persistence"}),n.jsx(dx,{enabled:E,value:A,sourceEntity:a.entity,graphPersistency:te,onEnabledChange:k=>{C(k),B(!1)},onChange:k=>{O(k),B(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Execution policy"}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Re-scan for new eligible information"}),n.jsx("select",{value:N.rescanIntervalMinutes,onChange:k=>{j({...N,rescanIntervalMinutes:Number(k.target.value)}),B(!1)},children:SC.map(k=>n.jsx("option",{value:k,children:fr(k)},k))})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Priority"}),n.jsx("input",{type:"number",value:N.priority,onChange:k=>{j({...N,priority:Number(k.target.value)}),B(!1)}})]}),n.jsx(Ff,{id:"work-settings-max-attempts",value:N.maxAttempts,appDefault:I,onChange:k=>{j({...N,maxAttempts:k}),B(!1)}})]}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Matching preview"}),n.jsx(Xl,{entity:a.entity,collection:a.collection,narratives:h,processing:x,graphId:p}),ye.isError&&n.jsx("div",{style:{marginTop:16},children:n.jsx(yt,{title:"Failed to save",detail:ye.error})}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:20},children:[n.jsx("button",{type:"button",className:"primary",disabled:!ue||ye.isPending,onClick:()=>ye.mutate(),children:ye.isPending?"Saving…":"Save configuration"}),Q&&!ye.isPending&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"Saved"})]})]})}const CC=["Overview","Evaluations","Matching Information","Runs","Settings"];function EC(){var A;const{id:a=""}=li(),s=yn(),r=qn(),[c,u]=S.useState("Overview"),[f,h]=S.useState(null),[m,p]=S.useState(!1),g=he({queryKey:["work",a],queryFn:()=>ee.work(a)}),x=g.data,v=he({queryKey:["work-evals",a],queryFn:()=>ee.workEvaluations(a),enabled:!!x}),N=Ye({mutationFn:()=>ee.runEvaluation(a),onSuccess:({result:O})=>{h(O),r.invalidateQueries({queryKey:["work",a]}),r.invalidateQueries({queryKey:["work-evals",a]})}}),j=Ye({mutationFn:()=>ee.setWorkStatus(a,x.status==="active"?"inactive":"active"),onSuccess:()=>r.invalidateQueries({queryKey:["work",a]})}),E=Ye({mutationFn:()=>ee.deleteWork(a),onSuccess:()=>{p(!1),r.invalidateQueries({queryKey:["work"]}),r.invalidateQueries({queryKey:["factory-runs"]}),r.invalidateQueries({queryKey:["run-status-counts"]}),s("/work")}});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(g.isError||!x)return n.jsx(yt,{title:"Ongoing work not found",detail:g.error});const C=N.isPending||j.isPending||E.isPending;return n.jsxs("div",{children:[n.jsx(cx,{work:m?x:null,busy:E.isPending,onClose:()=>p(!1),onConfirm:()=>E.mutate()}),n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/work",children:"Work"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),x.name]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[n.jsx("h1",{className:"page-title",children:x.name}),n.jsx(Ht,{status:x.status})]}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{disabled:C,onClick:()=>N.mutate(),children:"Run evaluation now"}),n.jsx("button",{disabled:C,onClick:()=>j.mutate(),children:x.status==="active"?"Deactivate":"Activate"}),n.jsx("button",{disabled:C,onClick:()=>p(!0),style:{color:"var(--status-cancelled)"},children:"Delete"})]})]}),f&&n.jsx("div",{style:{marginBottom:16},children:n.jsx(go,{result:f})}),n.jsx("div",{className:"tabs",children:CC.map(O=>n.jsx("button",{className:`tab${c===O?" active":""}`,onClick:()=>u(O),children:O},O))}),c==="Overview"&&n.jsxs("div",{className:"detail-grid",children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Configuration"}),n.jsx(Rn,{k:"Entity",v:`${x.entity} · ${x.collection}`}),n.jsx(Rn,{k:"Narratives",v:x.narratives.join(", ")||"none"}),n.jsx(Rn,{k:"Processing rule",v:(A=x.processing)!=null&&A.overrideDuplicatePrevention?"reprocess (override)":"skip already processed / queued / running"}),n.jsx(Rn,{k:"Graph",v:x.graphName??x.graphId}),n.jsx(Rn,{k:"Description",v:x.description??"—"})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Schedule & results"}),n.jsx(Rn,{k:"Re-scan interval",v:fr(x.policy.rescanIntervalMinutes)}),n.jsx(Rn,{k:"Last scanned",v:`${Ma(x.lastEvaluatedAt)} (${Mt(x.lastEvaluatedAt)})`}),n.jsx(Rn,{k:"Next scan",v:x.status==="active"?Ma(x.nextEvaluationAt):"paused (inactive)"}),n.jsx(Rn,{k:"Jobs created",v:String(x.jobsCreated)}),n.jsx(Rn,{k:"Estimated matching",v:String(x.estimatedMatching??"—")}),n.jsx(Rn,{k:"Priority",v:String(x.policy.priority)}),n.jsx(Rn,{k:"Max retries",v:String(x.policy.maxAttempts??"app default")})]})]}),c==="Evaluations"&&n.jsx(TC,{id:a,evalsQuery:v}),c==="Matching Information"&&n.jsx(Xl,{entity:x.entity,collection:x.collection,narratives:x.narratives,processing:x.processing,graphId:x.graphId}),c==="Runs"&&n.jsx(wC,{workId:a}),c==="Settings"&&n.jsx(NC,{work:x,onSaved:()=>r.invalidateQueries({queryKey:["work",a]})})]})}function TC({evalsQuery:a}){const s=a.data??[];return a.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):s.length===0?n.jsx(Yt,{title:"No evaluations yet",message:"When this work is active (or you run an evaluation now), each cycle is recorded here with what it matched, created, and excluded."}):n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:s.map(r=>n.jsxs("div",{className:"card",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[n.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[n.jsx(Ht,{status:r.status}),n.jsx("span",{className:"text-muted",style:{fontSize:12},children:Mt(r.at)})]}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[r.durationMs," ms"]})]}),r.error&&n.jsx("div",{className:"error-state",style:{fontSize:12,marginBottom:8},children:r.error}),r.zeroReason&&n.jsxs("div",{className:"text-muted",style:{fontSize:12,marginBottom:8},children:["Zero jobs: ",r.zeroReason]}),n.jsxs("div",{style:{display:"flex",gap:24,fontSize:13},children:[n.jsxs("span",{children:[n.jsx("strong",{children:r.matched})," ",n.jsx("span",{className:"text-muted",children:"matched"})]}),n.jsxs("span",{children:[n.jsx("strong",{style:{color:"var(--status-done)"},children:r.created})," ",n.jsx("span",{className:"text-muted",children:"created"})]}),n.jsxs("span",{children:[n.jsx("strong",{style:{color:"var(--status-blocked)"},children:r.excluded})," ",n.jsx("span",{className:"text-muted",children:"excluded"})]})]}),r.exclusionReasons.length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(yo,{included:r.created,excluded:r.exclusionReasons,includedLabel:"Jobs created"})})]},r.id))})}function wC({workId:a}){var h;const s=uo(["work-runs",a],{workId:a}),r=S.useMemo(()=>{var m;return((m=s.data)==null?void 0:m.pages.flatMap(p=>p.runs))??[]},[s.data]),c=Nr((h=s.data)==null?void 0:h.pages),u=r.length<c,f=S.useCallback(()=>{u&&!s.isFetchingNextPage&&s.fetchNextPage()},[u,s]);return s.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):r.length===0?n.jsx(Yt,{title:"No runs yet",message:"Jobs created by this ongoing work will appear here."}):n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:r.map(m=>n.jsxs("tr",{onClick:()=>{window.location.href=`/journal/${m.id}`},children:[n.jsx("td",{children:n.jsx(Ht,{status:m.status})}),n.jsx("td",{className:"mono",style:{fontSize:12},children:m.recordLabel??m.recordId}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:m.graphName??m.graphId}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Ma(m.updatedAt)})]},m.id))})]}),n.jsx(Sr,{loaded:r.length,total:c,hasMore:u,isFetchingNextPage:s.isFetchingNextPage,onLoadMore:f})]})}function Rn({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",style:{fontFamily:"inherit"},children:s})]})}function RC(){const a=yn();return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand"}),n.jsx("span",{className:"page-subtitle",children:"Run processing now — pick a single item or a batch selected by narratives."})]})}),n.jsxs("div",{className:"mode-cards",children:[n.jsxs("button",{type:"button",className:"mode-card",onClick:()=>a("/on-demand/single"),children:[n.jsx("div",{className:"mode-card-icon",children:"▶"}),n.jsxs("div",{children:[n.jsx("div",{className:"mode-card-title",children:"Single item"}),n.jsx("div",{className:"mode-card-desc",children:"Run a graph on one item you select manually or at random. Optionally include context."})]}),n.jsx("div",{className:"mode-card-arrow",children:"→"})]}),n.jsxs("button",{type:"button",className:"mode-card",onClick:()=>a("/on-demand/batch"),children:[n.jsx("div",{className:"mode-card-icon",children:"⊞"}),n.jsxs("div",{children:[n.jsx("div",{className:"mode-card-title",children:"Batch"}),n.jsx("div",{className:"mode-card-desc",children:"Run a graph on multiple items that match selected narratives. One job per matching item."})]}),n.jsx("div",{className:"mode-card-arrow",children:"→"})]})]})]})}const AC=new Set(["core","snapshots"]);function Ef(a){return AC.has(a)}function fx({node:a,prefix:s,selected:r,onToggle:c}){var x,v,N;const u=s?`${s}.${a.path}`:a.path,f=((x=a.children)==null?void 0:x.map(j=>`${u}.${j.path}`))??[],h=f.length===0||f.every(j=>r.has(j)),m=!((v=a.children)!=null&&v.length),p=m?r.has(u):h;function g(j){if(m)c(u,j.target.checked);else{const E=hx(a,s);for(const C of E)c(C,j.target.checked)}}return n.jsxs("div",{style:{paddingLeft:s?16:0},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13,paddingBottom:2},children:[n.jsx("input",{type:"checkbox",checked:p,onChange:g}),n.jsx("span",{className:"mono",style:{color:"var(--color-text)"},children:a.path}),a.inferredType&&n.jsx("span",{style:{color:"var(--color-text-dim)",fontSize:11},children:a.inferredType})]}),(N=a.children)==null?void 0:N.map(j=>n.jsx(fx,{node:j,prefix:u,selected:r,onToggle:c},j.path))]})}function hx(a,s){var c;const r=s?`${s}.${a.path}`:a.path;return(c=a.children)!=null&&c.length?a.children.flatMap(u=>hx(u,r)):[r]}function OC({order:a,onChange:s}){function r(c,u){const f=[...a],h=c+u;h<0||h>=f.length||([f[c],f[h]]=[f[h],f[c]],s(f))}return n.jsxs("div",{style:{marginBottom:12},children:[n.jsx("label",{style:{display:"block",marginBottom:4,fontSize:12,color:"var(--color-text-dim)"},children:"Merge priority (top wins on key collision)"}),a.map((c,u)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[n.jsxs("span",{style:{fontSize:11,color:"var(--color-text-dim)",width:16,textAlign:"right"},children:[u+1,"."]}),n.jsx("span",{className:"mono",style:{fontSize:13,flex:1},children:c}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:u===0,onClick:()=>r(u,-1),children:"↑"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:u===a.length-1,onClick:()=>r(u,1),children:"↓"})]},c))]})}function MC({objectType:a,contentTypeKey:s,target:r,selectedPaths:c,onPathsChange:u}){var C,A;const f=he({queryKey:["assembler-props",a,s,r],queryFn:()=>ee.assemblerProperties({objectType:a,contentType:s,target:r}),staleTime:6e4}),h=((C=f.data)==null?void 0:C.flatPaths)??[],m=((A=f.data)==null?void 0:A.properties)??[],p=new Set(c??h);function g(O,Q){const B=new Set(p);Q?B.add(O):B.delete(O);const z=h.filter(q=>B.has(q));u(z.length===h.length?void 0:z)}function x(){u(void 0)}function v(){u([])}const N=c===void 0?h.length:c.length,j=Ef(s)?"1:1":"1:n",E={fontSize:10,padding:"1px 5px",borderRadius:3,background:Ef(s)?"var(--color-accent-dim, #1a3a5c)":"var(--color-bg-3, #2a2a2a)",color:"var(--color-text-dim)",marginLeft:6};return n.jsxs("div",{style:{border:"1px solid var(--color-border)",borderRadius:6,marginBottom:12,overflow:"hidden"},children:[n.jsxs("div",{style:{padding:"8px 12px",background:"var(--color-bg-2)",display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:13},children:s}),n.jsx("span",{style:E,children:j}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--color-text-dim)"},children:f.isLoading?"Loading…":`${N} / ${h.length} properties`}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:x,children:"All"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:v,children:"None"})]}),!f.isLoading&&m.length===0&&n.jsx("div",{style:{padding:"10px 12px",fontSize:12,color:"var(--color-text-dim)"},children:"No properties sampled (collection may be empty)."}),m.length>0&&n.jsx("div",{style:{padding:"10px 12px",maxHeight:240,overflowY:"auto"},children:m.map(O=>n.jsx(fx,{node:O,prefix:"",selected:p,onToggle:g},O.path))})]})}function mx({objectType:a,target:s,collections:r,value:c,onChange:u}){const f=r.filter(Ef),h=r.map(x=>{const v=c==null?void 0:c.contentTypes.find(N=>N.key===x);return{key:x,selectedProperties:v==null?void 0:v.selectedProperties}}),m=(()=>{const x=(c==null?void 0:c.priority)??[],v=f,N=v.filter(j=>!x.includes(j));return[...x.filter(j=>v.includes(j)),...N]})();function p(x,v){const N=h.map(j=>j.key===x?{key:x,selectedProperties:v}:j);u({objectType:a,target:s,contentTypes:N,priority:m})}function g(x){u({objectType:a,target:s,contentTypes:h,priority:x})}return n.jsxs("div",{children:[f.length>1&&n.jsx(OC,{order:m,onChange:g}),r.map(x=>{var v;return n.jsx(MC,{objectType:a,contentTypeKey:x,target:s,selectedPaths:(v=h.find(N=>N.key===x))==null?void 0:v.selectedProperties,onPathsChange:N=>p(x,N)},x)})]})}const mr={entityId:"same-as-input",contentType:gl,newRecord:!0};function kC(a=!0){return{...mr,newRecord:a}}function so(a){if(!a)return"not declared on graph";const s=a.entityId==="same-as-input"?"same as input":a.entityId,r=a.newRecord===!1?"update or create one row per item":"add new record each run";return`${s} · ${a.contentType} · ${r}`}function px(a,s=!0){return`Same object type · ${a?`${a}-${gl}`:`${gl} collection`} · ${s?"new record per run":"one row per item (update or create)"}`}function yx(a,s,r,c,u=!0){if(a==="simulation")return{label:"Simulation",detail:"Graph runs normally; results are not written to Memorix.",simulation:!0};if(a==="same-entity-inferences")return{label:"Write results",detail:px(c,u),simulation:!1};if(a==="custom")return{label:"Write results",detail:so(r??mr),simulation:!1};if(!s)return{label:"Simulation",detail:"Graph has no result persistence — choose Inferences or Custom to write results.",simulation:!0};const f=u!==(s.newRecord!==!1)?{...s,newRecord:u}:s;return{label:"Write results",detail:`Graph default: ${so(f)}`,simulation:!1}}function gx(a,s){return s?"Simulation — the source item is not marked as processed when the run completes.":`On success, marks "${a}" as processed on this item (visible on the item's Processing tab).`}function vx(a,s,r){const c=u=>(r==null?void 0:r.newRecord)===void 0?u:{...u,newRecord:r.newRecord};if(a==="simulation")return null;if(a==="same-entity-inferences")return c(kC((r==null?void 0:r.newRecord)!==!1));if(a==="custom")return s??mr;if(r!=null&&r.graphPersistency)return c(r.graphPersistency)}function xx({mode:a,customValue:s,newRecord:r,sourceEntity:c,graphPersistency:u,onModeChange:f,onCustomChange:h,onNewRecordChange:m}){const p=s??mr,g=p.entityId==="same-as-input"?"same-as-input":"custom";function x(v){h({...p,...v})}return n.jsxs("div",{className:"result-writeback",children:[n.jsx("div",{className:"section-title",children:"Result writeback"}),n.jsx("p",{className:"hint",style:{marginBottom:12},children:"Choose whether this run persists graph output to Memorix or runs as a simulation only."}),n.jsxs("div",{className:"writeback-modes",children:[n.jsxs("label",{className:`writeback-mode${a==="simulation"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="simulation",onChange:()=>f("simulation")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Simulation"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Run the graph without writing results."})]})]}),n.jsxs("label",{className:`writeback-mode${a==="same-entity-inferences"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="same-entity-inferences",onChange:()=>f("same-entity-inferences")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Save to Inferences"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:px(c,r)})]})]}),u&&n.jsxs("label",{className:`writeback-mode${a==="graph-default"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="graph-default",onChange:()=>f("graph-default")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Use graph default"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:so(u)})]})]}),n.jsxs("label",{className:`writeback-mode${a==="custom"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="custom",onChange:()=>{f("custom"),s||h({...mr})}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Custom destination"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Override object type or content type."})]})]})]}),a!=="simulation"&&a!=="custom"&&n.jsx(Nf,{name:"existing-record-mode",newRecord:r,onChange:m}),a==="custom"&&n.jsxs("div",{className:"form-grid",style:{marginTop:12},children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Target object type"}),n.jsxs("select",{value:g,onChange:v=>{v.target.value==="same-as-input"?x({entityId:"same-as-input"}):x({entityId:c??""})},children:[n.jsxs("option",{value:"same-as-input",children:["Same as input",c?` (${c})`:""]}),n.jsx("option",{value:"custom",children:"Other object type…"})]})]}),g==="custom"&&n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type name"}),n.jsx("input",{value:p.entityId==="same-as-input"?"":p.entityId,onChange:v=>x({entityId:v.target.value||"same-as-input"}),placeholder:"e.g. vulnerabilities"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Content type"}),n.jsx("input",{value:p.contentType,onChange:v=>x({contentType:v.target.value||gl}),placeholder:gl})]}),n.jsx("div",{className:"writeback-existing-grid-span",children:n.jsx(Nf,{name:"custom-existing-record-mode",newRecord:p.newRecord!==!1,onChange:v=>x({newRecord:v})})})]})]})}function zC(a){const s=a.find(r=>r.key==="snapshots"||r.role==="snapshot");return s==null?void 0:s.key}function Jc(a){const s=zC(a);return s?[s]:[]}function DC(a){return a[0]}const jx=[{id:"record",title:"Choose item",summary:"What to process"},{id:"related",title:"Context",summary:"Optional linked data"},{id:"graph",title:"Choose graph",summary:"Pipeline to run"},{id:"writeback",title:"Result writeback",summary:"Where to save"},{id:"properties",title:"Properties",summary:"Data to include"},{id:"review",title:"Review & run",summary:"Confirm"},{id:"result",title:"Done",summary:"Result"}],Fd=jx.length-1,nr=3,Xd=4,Lg=5;function qC(){var Ln;const{agentQueryParam:a}=Bn(),[s]=si(),[r,c]=S.useState(0),[u,f]=S.useState(""),[h,m]=S.useState([]),[p,g]=S.useState([]),[x,v]=S.useState(!1),[N,j]=S.useState(""),[E,C]=S.useState(""),[A,O]=S.useState(),[Q,B]=S.useState(100),[z,q]=S.useState(),[V,Z]=S.useState("simulation"),[I,te]=S.useState(),[ye,ue]=S.useState(!0),[re,Ce]=S.useState(null);S.useEffect(()=>{var H;const ne=(H=s.get("entity"))==null?void 0:H.trim();ne&&f(Me=>Me||ne)},[s]),S.useEffect(()=>{A&&!A.persistency&&V==="graph-default"&&Z("same-entity-inferences")},[A,V]);const Te=he({queryKey:["entities",a??"all"],queryFn:()=>ee.listEntities(a),retry:2}),ve=Te.data??[];S.useEffect(()=>{if(!u||!Te.isSuccess)return;ve.map(H=>H.name).includes(u)||f("")},[Te.isSuccess,ve,u]);const k=ve.find(ne=>ne.name===u),J=(k==null?void 0:k.target)==="event"?"event":"entity",ae=S.useCallback(()=>{c(0),Ce(null),j(""),C(""),O(void 0),q(void 0),Z("simulation"),te(void 0),m(k?Jc(k.collections):[])},[k]);S.useEffect(()=>{k&&m(ne=>ne.length>0?ne:Jc(k.collections))},[k]);const Ne=DC(h),G=he({queryKey:["core-records",u,h,p],queryFn:()=>ee.coreRecords({entity:u,collection:Ne,narratives:p,pageSize:100}),enabled:!!(u&&Ne)}),T=((Ln=G.data)==null?void 0:Ln.records)??[],U=T.find(ne=>ne.id===N);function W(ne){m(ne),j(""),q(void 0)}function se(ne){g(ne),j("")}function F(){T.length&&j(T[Math.floor(Math.random()*T.length)].id)}function ce(){if(z)return z;const ne=h.filter(H=>H==="core"||H==="snapshots");return{objectType:u,target:J,contentTypes:h.map(H=>({key:H})),priority:ne}}function xe(){const ne=vx(V,I,{newRecord:ye,graphPersistency:A==null?void 0:A.persistency});return{entity:u,collection:Ne,recordId:N,graphId:E,priority:Q,assemblySelection:ce(),...ne!==void 0?{persistency:ne}:{}}}const le=Ye({mutationFn:()=>ee.queueSingle(xe()),onSuccess:({result:ne,run:H})=>{Ce({...ne,actions:[{label:"View in journal",to:`/journal/${H.id}`,primary:!0}]}),c(Fd)}}),de=Ye({mutationFn:async()=>{const{run:ne}=await ee.queueSingle(xe()),{run:H}=await ee.executeRun(ne.id,!0);return H},onSuccess:ne=>{var Me;const H=ne.status==="failed"?"failed":ne.status==="done"?"success":"partial";Ce({status:H,title:ne.status==="failed"?"Job failed":ne.status==="done"?"Job completed":"Job started",summary:((Me=ne.error)==null?void 0:Me.message)??`Status: ${ne.status}`,stats:[{label:"Run ID",value:ne.id},{label:"Graph",value:ne.graphName??ne.graphId},{label:"Status",value:ne.status,tone:ne.status==="failed"?"bad":ne.status==="done"?"good":"default"}],errors:ne.error?[ne.error.message]:void 0,actions:[{label:"View in journal",to:`/journal/${ne.id}`,primary:!0}]}),c(Fd)}}),Ze=le.error??de.error,ut=!!(u&&N&&h.length>0),it=!!E;function Pe(ne){if(ne<=r)return c(ne);ne>=1&&!ut||ne>=nr&&!it||c(ne)}const Tt=(k==null?void 0:k.collections)??[],St=h.map(ne=>{const H=Tt.find(Me=>Me.key===ne);return H?hr(H):ne}).join(", "),at=z?(z.contentTypes.reduce((ne,H)=>{var Me;return ne+(((Me=H.selectedProperties)==null?void 0:Me.length)??999)},0),`${z.contentTypes.length} content type${z.contentTypes.length!==1?"s":""} selected`):"All properties (default)",Gn=yx(V,A==null?void 0:A.persistency,I,u,ye),In=gx((A==null?void 0:A.name)??E,Gn.simulation);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx("a",{href:"/on-demand",children:"On-Demand"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),"Single item"]}),n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand: single item"}),n.jsx("span",{className:"page-subtitle",children:"Process one item through a graph."})]})}),n.jsx(Gf,{steps:jx,current:r,canGoTo:ne=>ne<=r,onGoTo:Pe,maxWidth:980}),n.jsxs("div",{style:{maxWidth:720},children:[r===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Choose item"}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type"}),n.jsx(Yf,{value:u,entities:ve,loading:Te.isLoading,error:Te.error,onChange:ne=>{const H=ve.find(Me=>Me.name===ne);f(ne),m(Jc((H==null?void 0:H.collections)??[])),g([]),v(!1),j(""),C(""),O(void 0),q(void 0),Z("simulation"),te(void 0)}})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsx("label",{children:"Data sources"}),n.jsx(If,{options:Tt,selected:h,onChange:W}),h.length===0&&n.jsx("span",{className:"hint",style:{color:"var(--status-blocked)",display:"block",marginTop:6},children:"Select at least one data source. Snapshots is selected automatically when available."}),n.jsx("span",{className:"hint",children:"Select which content types are merged and sent to the graph."})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[n.jsxs("label",{style:{marginBottom:0},children:["Narratives",n.jsx("span",{style:{fontWeight:400,color:"var(--color-text-dim)",marginLeft:6},children:"— optional filter"})]}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:()=>v(ne=>!ne),children:x?"Hide":p.length>0?`${p.length} active ▾`:"Filter ▾"})]}),p.length>0&&!x&&n.jsx("div",{className:"chip-row",style:{marginBottom:6},children:p.map(ne=>{const H=k==null?void 0:k.narratives.find(Me=>Me.key===ne);return n.jsx("span",{className:"chip narrative",children:(H==null?void 0:H.label)??ne},ne)})}),x&&n.jsx("div",{style:{marginTop:8},children:n.jsx(mo,{entity:u,selected:p,onChange:se,requireSelection:!1})})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsx("label",{children:"Item *"}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsxs("select",{value:N,onChange:ne=>j(ne.target.value),style:{flex:1},children:[n.jsx("option",{value:"",children:G.isLoading?"Loading…":T.length?"Select an item…":"No information"}),T.map(ne=>n.jsxs("option",{value:ne.id,children:[ne.label," (",ne.id,")"]},ne.id))]}),n.jsx("button",{type:"button",onClick:F,disabled:!T.length,children:"Random"})]}),n.jsxs("span",{className:"hint",children:[T.length," items loaded",p.length>0?` (filtered by ${p.length} narrative${p.length>1?"s":""})`:""," · ",n.jsx("a",{href:`/information?entity=${u}`,children:"Browse all information"})]})]}),n.jsx(bt,{onNext:()=>Pe(1),nextLabel:"Next: context",nextDisabled:!ut})]}),r===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Context (optional)"}),U&&n.jsxs("div",{className:"memorix-panel",children:[n.jsx("div",{className:"memorix-panel-title",children:"Starting item"}),n.jsxs("span",{className:"mono",children:[u," / ",St," / ",U.label]})]}),n.jsx("div",{className:"empty-state",style:{padding:24},children:"Context is not applicable — there are no relations linked to related entities. You can skip this step and continue."}),n.jsx(bt,{onBack:()=>Pe(0),onNext:()=>Pe(2),nextLabel:"Skip — no context"})]}),r===2&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Choose graph"}),n.jsx(po,{entity:u,value:E,onChange:(ne,H)=>{C(ne),O(H)}}),n.jsx(bt,{onBack:()=>Pe(1),onNext:()=>Pe(nr),nextLabel:"Next: result writeback",nextDisabled:!it})]}),r===nr&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Result writeback"}),A&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Selected graph"}),n.jsx("span",{className:"mono",children:A.name??E})]}),n.jsx(xx,{mode:V,customValue:I,newRecord:ye,sourceEntity:u,graphPersistency:A==null?void 0:A.persistency,onModeChange:Z,onCustomChange:te,onNewRecordChange:ue}),n.jsx(bt,{onBack:()=>Pe(2),onNext:()=>Pe(Xd),nextLabel:"Next: properties"})]}),r===Xd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Properties to include"}),n.jsxs("div",{style:{marginBottom:12,color:"var(--color-text-dim)",fontSize:13},children:["Choose which properties are sent to the graph as input. Only domain data is sent — system fields are always excluded.",n.jsxs("ul",{style:{margin:"8px 0 0 16px",lineHeight:1.8,fontSize:12},children:[n.jsxs("li",{children:[n.jsx("strong",{children:"1:1 types"})," (core, snapshots): one record per item, merged at the root. Higher priority wins on duplicate keys."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"1:n types"}),": all matching records, placed as an array under the content-type name."]})]})]}),u&&h.length>0&&n.jsx(mx,{objectType:u,target:J,collections:h,value:z,onChange:q}),n.jsx(bt,{onBack:()=>Pe(nr),onNext:()=>Pe(Lg),nextLabel:"Next: review"})]}),r===Lg&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Review & run"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:16},children:[n.jsx(qs,{label:"Object type",value:u}),n.jsx(qs,{label:"Data sources",value:St}),n.jsx(qs,{label:"Properties",value:at}),n.jsx(qs,{label:"Item",value:(U==null?void 0:U.label)??N}),n.jsx(qs,{label:"Graph",value:(A==null?void 0:A.name)??E}),n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:"Result writeback"}),n.jsxs("div",{className:"writeback-summary",children:[n.jsx("span",{className:`writeback-badge ${Gn.simulation?"simulation":"write"}`,children:Gn.label}),n.jsx("span",{className:"mono",style:{fontSize:12},children:Gn.detail}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",style:{marginLeft:8},onClick:()=>Pe(nr),children:"Change"})]})]}),n.jsx(qs,{label:"Source item tracking",value:In})]}),n.jsx("div",{className:"form-grid",children:n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Queue priority"}),n.jsx("input",{type:"number",value:Q,onChange:ne=>B(Number(ne.target.value))}),n.jsx("span",{className:"hint",children:"Used when sending to the queue. Higher priority is picked up first when the queue is contested."})]})}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Send to queue to run in the background at the priority above, or execute now to run immediately in this session."}),Ze&&n.jsx(yt,{title:"Failed to start job",detail:Ze}),n.jsxs(bt,{onBack:()=>Pe(Xd),children:[n.jsx("button",{type:"button",className:"primary",disabled:le.isPending||de.isPending,onClick:()=>le.mutate(),children:le.isPending?"Sending to queue…":"Send to queue"}),n.jsx("button",{type:"button",disabled:le.isPending||de.isPending,onClick:()=>de.mutate(),children:de.isPending?"Executing…":"Execute now"})]})]}),r===Fd&&re&&n.jsxs(n.Fragment,{children:[n.jsx(go,{result:re}),n.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:16},children:n.jsx("button",{type:"button",className:"primary",onClick:ae,children:"Run another item"})})]})]})]})}function qs({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:12},children:s})]})}function _l(a){return`${a.relationKey}::${a.targetEntity}`}function BC(a,s){return s!=null&&s.length?s.filter(r=>a.some(c=>c.relationKey===r.relationKey&&c.targetEntity===r.targetEntity)):[]}function LC({entity:a,graphContextLinks:s,value:r,onChange:c,previewRecordId:u,anchorLabel:f}){var j,E;const h=he({queryKey:["entity-relations",a],queryFn:()=>ee.entityRelations(a),enabled:!!a}),m=S.useMemo(()=>(h.data??[]).filter(C=>C.sourceEntity===a),[h.data,a]),p=S.useMemo(()=>BC(m,s),[m,s]);S.useEffect(()=>{r!==void 0||p.length===0||c(p)},[r,p,c]);const g=r??p,x=new Set(g.map(_l)),v=Ye({mutationFn:()=>ee.previewContext({sourceEntity:a,input:{recordId:u},contextLinks:g})});function N(C,A){const O=r??p;if(A){const B=p.find(q=>q.relationKey===C.relationKey&&q.targetEntity===C.targetEntity),z=[...O.filter(q=>_l(q)!==_l(C)),B??{relationKey:C.relationKey,targetEntity:C.targetEntity}];c(z);return}const Q=O.filter(B=>_l(B)!==_l(C));c(Q.length?Q:[])}return h.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," ",ll.loadingRelations]}):h.isError?n.jsx("div",{className:"empty-state",style:{padding:24},children:ll.loadFailed}):m.length===0?n.jsxs("div",{className:"empty-state",style:{padding:24},children:[ll.noRelations(a),n.jsx("div",{style:{marginTop:8,fontSize:13,color:"var(--color-text-dim)"},children:"You can skip this step and continue."})]}):n.jsxs("div",{children:[f&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:Cf.step2Anchor}),n.jsx("span",{className:"mono",children:f})]}),n.jsx("p",{className:"wizard-lead",style:{marginBottom:12},children:ll.lead}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:m.map(C=>{var Q;const A=x.has(_l(C)),O=p.find(B=>B.relationKey===C.relationKey&&B.targetEntity===C.targetEntity);return n.jsxs("label",{className:"memorix-panel",style:{display:"flex",gap:10,alignItems:"flex-start",cursor:"pointer",margin:0},children:[n.jsx("input",{type:"checkbox",checked:A,onChange:B=>N(C,B.target.checked),style:{marginTop:3}}),n.jsxs("div",{children:[n.jsx("div",{style:{fontSize:13,fontWeight:500},children:C.relationKey}),n.jsxs("div",{className:"text-dim",style:{fontSize:12},children:["→ ",C.targetEntity,(Q=O==null?void 0:O.contentTypes)!=null&&Q.length?` · ${O.contentTypes.join(", ")}`:""]})]})]},_l(C))})}),u&&g.length>0&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("button",{type:"button",disabled:v.isPending,onClick:()=>v.mutate(),children:v.isPending?ll.previewing:ll.preview}),((E=(j=v.data)==null?void 0:j.jobMemory)==null?void 0:E.context)&&n.jsxs("div",{style:{marginTop:12},children:[n.jsx("div",{className:"memorix-panel-title",style:{marginBottom:8},children:ll.previewTitle}),v.data.jobMemory.context.map(C=>n.jsx("div",{className:"memorix-panel",style:{marginBottom:8},children:n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,fontSize:13},children:[n.jsx("span",{className:"mono",children:C.alias}),n.jsx("span",{className:"text-dim",children:ll.rows(C.rows.length)})]})},C.alias)),n.jsx(Lt,{label:"Context payload",value:v.data.jobMemory})]}),v.isError&&n.jsx("p",{className:"text-dim",style:{fontSize:12,marginTop:8},children:"Preview failed for the sample item — context will still resolve per item at run time."})]})]})}function _C({value:a,jobTypeId:s,onChange:r}){const c=a.blockWhenRunning!==!1,u=a.replaceQueuedRuns!==!1;function f(h){r({...a,...h})}return n.jsxs("div",{className:"prereq-section",style:{marginTop:16},children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Queue overlap"}),s&&n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:s})]}),n.jsxs("div",{className:"prereq-section-body",style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsxs("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0,lineHeight:1.5},children:["Scoped per ",n.jsx("strong",{children:"job type"})," and ",n.jsx("strong",{children:"source item"}),". Cancelled and failed runs never block a new batch."]}),n.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:13,cursor:"pointer"},children:[n.jsx("input",{type:"checkbox",checked:c,onChange:h=>f({blockWhenRunning:h.target.checked}),style:{marginTop:3}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Skip items currently running"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Default on — do not start a second concurrent run for the same item and job type."})]})]}),n.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:13,cursor:"pointer"},children:[n.jsx("input",{type:"checkbox",checked:u,onChange:h=>f({replaceQueuedRuns:h.target.checked}),style:{marginTop:3}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Replace queued runs from older batches"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Default on — cancel pending/blocked runs for this job type and enqueue fresh jobs with this batch's definition. When off, items that already have a queued run are excluded instead."})]})]})]})]})}const UC={priority:100,blockWhenRunning:!0,replaceQueuedRuns:!0};function bx({batch:a}){const s=a.selectionSummary;if(!s)return null;const r=a.excluded.reduce((u,f)=>u+f.count,0),c=[`${s.matched} matched → ${s.queued} queued`];if(r>0){const u=a.excluded.filter(f=>f.count>0).map(f=>`${f.count} ${$v[f.reason]??f.reason}`).join(", ");c.push(`${r} skipped (${u})`)}return a.counts.failed>0&&c.push(`${a.counts.failed} failed`),n.jsx("p",{className:"text-muted",style:{fontSize:13,margin:"0 0 16px"},children:c.join(" · ")})}const Sx=[{id:"entity",title:"Entity",summary:"Object type & sources"},{id:"narratives",title:"Narratives",summary:"Filter items"},{id:"graph",title:"Choose graph",summary:"Pipeline to run"},{id:"writeback",title:"Result writeback",summary:"Where to save"},{id:"processing",title:"Processing",summary:"Eligibility rules"},{id:"context",title:"Context",summary:"Optional linked data"},{id:"properties",title:"Properties",summary:"Data to include"},{id:"review",title:"Review & queue",summary:"Confirm batch"},{id:"result",title:"Queued",summary:"Result"}],_g=Sx.length-1,Vd=2,ar=3,Yc=4,Jd=5,Zd=6,lr=7;function QC(){var wt,rt,ka,vl,ii,xl,Cr,ri;const{agentQueryParam:a}=Bn(),[s]=si(),[r,c]=S.useState(0),[u,f]=S.useState(s.get("entity")??""),[h,m]=S.useState(["core"]),[p,g]=S.useState([]),[x,v]=S.useState(""),[N,j]=S.useState(),[E,C]=S.useState(),[A,O]=S.useState(),[Q,B]=S.useState({reprocessingMode:"skip",excludeInFlight:!0}),[z,q]=S.useState(""),[V,Z]=S.useState({...UC}),[I,te]=S.useState("simulation"),[ye,ue]=S.useState(),[re,Ce]=S.useState(!0),[Te,ve]=S.useState(null),[k,J]=S.useState(null),ae=he({queryKey:["entities",a??"all"],queryFn:()=>ee.listEntities(a),retry:2}),G=((wt=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()}).data)==null?void 0:wt.batchJobMaxAttempts)??4,T=ae.data??[];S.useEffect(()=>{if(!u||!ae.isSuccess)return;T.map($e=>$e.name).includes(u)||f("")},[ae.isSuccess,T,u]);const U=T.find(me=>me.name===u),W=(U==null?void 0:U.target)==="event"?"event":"entity";function se(){return vx(I,ye,{newRecord:re,graphPersistency:N==null?void 0:N.persistency})}const F=se(),ce=he({queryKey:["matching",u,h,p,Q,x,F,V,"count"],queryFn:()=>ee.previewMatching({entity:u,collection:h[0]??"core",narratives:p,processing:Q,graphId:x,persistency:F,blockWhenRunning:V.blockWhenRunning,replaceQueuedRuns:V.replaceQueuedRuns}),enabled:!!(u&&x)}),xe=((rt=ce.data)==null?void 0:rt.eligible)??0,le=he({queryKey:["factory-preflight",u,h[0],xe],queryFn:()=>ee.factoryPreflight({entity:u,collection:h[0]??"core",eligibleCount:xe}),enabled:r===lr&&!!u&&xe>=50}),de=(vl=(ka=ce.data)==null?void 0:ka.sample[0])==null?void 0:vl.id;S.useEffect(()=>{N&&!N.persistency&&I==="graph-default"&&te("same-entity-inferences")},[N,I]);function Ze(){if(A)return A;const me=h.filter($e=>$e==="core"||$e==="snapshots");return{objectType:u,target:W,contentTypes:h.map($e=>({key:$e})),priority:me}}function ut(){var me;return E!==void 0?E.length?E:void 0:(me=N==null?void 0:N.contextLinks)!=null&&me.length?N.contextLinks:void 0}const it=Ye({mutationFn:()=>{var $e;const me=se();return ee.queueBatch({name:z||`${u} batch`,entity:u,collections:h,narratives:p,processing:Q,graphId:x,policy:V,assemblySelection:Ze(),...($e=ut())!=null&&$e.length?{contextLinks:ut()}:{},...me!==void 0?{persistency:me}:{}})},onSuccess:({result:me,batch:$e})=>{ve(me),J($e),c(_g)}}),Pe=!!x,St=!(((U==null?void 0:U.narratives.length)??0)>0)||p.length>0;function at(me){if(me<=r)return c(me);me>=1&&!u||me>=2&&!St||me>=ar&&!Pe||me>=Yc&&!Pe||c(me)}const Gn=(U==null?void 0:U.collections)??[],In=h.map(me=>{const $e=Gn.find(gn=>gn.key===me);return $e?hr($e):me}).join(", "),Ln=A?`${A.contentTypes.length} content type${A.contentTypes.length!==1?"s":""} selected`:"All properties (default)",ne=yx(I,N==null?void 0:N.persistency,ye,u,re),H=gx((N==null?void 0:N.name)??x,ne.simulation),Me=(()=>{const me=ut();return me!=null&&me.length?me.map($e=>`${$e.relationKey} → ${$e.targetEntity}`).join(", "):"None"})();return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx("a",{href:"/on-demand",children:"On-Demand"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),"Batch"]}),n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand: batch"}),n.jsx("span",{className:"page-subtitle",children:"Run one graph on many items that match your selected narratives."})]})}),n.jsx(Gf,{steps:Sx,current:r,canGoTo:me=>me<=r,onGoTo:at,maxWidth:980,scrollable:!0}),n.jsxs("div",{style:{maxWidth:720},children:[r===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Choose entity"}),n.jsx("div",{className:"form-grid",children:n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type"}),n.jsx(Yf,{value:u,entities:T,loading:ae.isLoading,error:ae.error,onChange:me=>{const $e=T.find(gn=>gn.name===me);f(me),m(Jc(($e==null?void 0:$e.collections)??[])),g([]),v(""),j(void 0),C(void 0),O(void 0),te("simulation"),ue(void 0)}})]})}),U&&n.jsxs("div",{className:"field",style:{marginTop:12},children:[n.jsx("label",{children:"Data sources"}),n.jsx(If,{options:U.collections,selected:h,onChange:me=>{m(me),O(void 0)}}),n.jsx("span",{className:"hint",children:"Select which content types are merged and sent to the graph for every item in the batch."})]}),U&&n.jsxs("p",{className:"text-dim",style:{fontSize:12},children:[U.coreCount," core information · ",U.narratives.length," narratives · ",U.graphs.length," compatible graphs"]}),n.jsx(bt,{onNext:()=>at(1),nextLabel:"Next: narratives",nextDisabled:!u})]}),r===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Select narratives"}),n.jsx(mo,{entity:u,selected:p,onChange:g}),n.jsx("div",{style:{marginTop:16},children:n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p})}),n.jsx(bt,{onBack:()=>at(0),onNext:()=>at(Vd),nextLabel:"Next: choose graph",nextDisabled:!St})]}),r===Vd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Choose graph"}),n.jsx("p",{className:"wizard-lead",children:"The graph determines which processing stamps and queue entries apply when predicting job counts."}),n.jsx(po,{entity:u,value:x,onChange:(me,$e)=>{var gn;if(v(me),j($e),C(void 0),te("simulation"),ue(void 0),(gn=$e==null?void 0:$e.upstream)!=null&&gn.length){const _t=$e.upstream.filter(Ut=>Ut.entity&&Ut.relationshipKey).map(Ut=>({entity:Ut.entity,relationshipKey:Ut.relationshipKey,graphId:me,graphName:$e.name}));_t.length&&B(Ut=>({...Ut,crossEntityPrerequisites:_t}))}}}),n.jsx(bt,{onBack:()=>at(1),onNext:()=>at(ar),nextLabel:"Next: result writeback",nextDisabled:!Pe})]}),r===ar&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Result writeback"}),n.jsx("p",{className:"wizard-lead",children:'Where graph output is saved. "Skip already processed" on the next step only applies to this target — not prior simulation runs or a different collection.'}),N&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Selected graph"}),n.jsx("span",{className:"mono",children:N.name??x})]}),n.jsx(xx,{mode:I,customValue:ye,newRecord:re,sourceEntity:u,graphPersistency:N==null?void 0:N.persistency,onModeChange:te,onCustomChange:ue,onNewRecordChange:Ce}),n.jsx(bt,{onBack:()=>at(Vd),onNext:()=>at(Yc),nextLabel:"Next: processing"})]}),r===Yc&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Processing prerequisites"}),n.jsx("p",{className:"wizard-lead",children:'Control which information is eligible. "Skip already processed" checks whether a result already exists in your chosen writeback target above — not whether the graph ran in simulation or wrote elsewhere.'}),n.jsx(Pf,{context:"batch",entity:u,targetGraphId:x||void 0,targetJobTypeId:N==null?void 0:N.jobTypeId,hasContextLinks:((E==null?void 0:E.length)??0)>0||(((ii=N==null?void 0:N.contextLinks)==null?void 0:ii.length)??0)>0,value:Q,onChange:B}),n.jsx(_C,{value:V,jobTypeId:N==null?void 0:N.jobTypeId,onChange:Z}),n.jsxs("div",{style:{marginTop:20},children:[n.jsx("div",{className:"memorix-panel-title",style:{marginBottom:8},children:"Estimated jobs"}),n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p,processing:Q,graphId:x,persistency:F,queuePolicy:V,headline:!0,requireGraph:!0})]}),n.jsx(bt,{onBack:()=>at(ar),onNext:()=>at(Jd),nextLabel:"Next: context"})]}),r===Jd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Context (optional)"}),n.jsx("p",{className:"wizard-lead",style:{marginBottom:12},children:"Linked information is resolved separately for each item in the batch, using the same context configuration."}),n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Batch scope"}),n.jsxs("span",{className:"mono",children:[u," · ",In]})]}),n.jsx(LC,{entity:u,graphContextLinks:N==null?void 0:N.contextLinks,value:E,onChange:C,previewRecordId:de}),n.jsx(bt,{onBack:()=>at(Yc),onNext:()=>at(Zd),nextLabel:(xl=ut())!=null&&xl.length?"Next: properties":"Skip — no context"})]}),r===Zd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"7. Properties to include"}),n.jsxs("div",{style:{marginBottom:12,color:"var(--color-text-dim)",fontSize:13},children:["Choose which properties are sent to the graph as input for every item in the batch. Only domain data is sent — system fields are always excluded.",n.jsxs("ul",{style:{margin:"8px 0 0 16px",lineHeight:1.8,fontSize:12},children:[n.jsxs("li",{children:[n.jsx("strong",{children:"1:1 types"})," (core, snapshots): one record per item, merged at the root. Higher priority wins on duplicate keys."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"1:n types"}),": all matching records, placed as an array under the content-type name."]})]})]}),u&&h.length>0&&n.jsx(mx,{objectType:u,target:W,collections:h,value:A,onChange:O}),n.jsx(bt,{onBack:()=>at(Jd),onNext:()=>at(lr),nextLabel:"Next: review & queue"})]}),r===lr&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"8. Review & queue"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:16},children:[n.jsx(Bs,{label:"Object type",value:u}),n.jsx(Bs,{label:"Data sources",value:In}),n.jsx(Bs,{label:"Context",value:Me}),n.jsx(Bs,{label:"Properties",value:Ln}),n.jsx(Bs,{label:"Graph",value:(N==null?void 0:N.name)??x}),n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:"Result writeback"}),n.jsxs("div",{className:"writeback-summary",children:[n.jsx("span",{className:`writeback-badge ${ne.simulation?"simulation":"write"}`,children:ne.label}),n.jsx("span",{className:"mono",style:{fontSize:12},children:ne.detail}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",style:{marginLeft:8},onClick:()=>at(ar),children:"Change"})]})]}),n.jsx(Bs,{label:"Source item tracking",value:H})]}),n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p,processing:Q,graphId:x,persistency:F,queuePolicy:V,headline:!0}),n.jsxs("div",{className:"form-grid",style:{marginTop:16},children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Batch name"}),n.jsx("input",{value:z,onChange:me=>q(me.target.value),placeholder:`${u} batch`})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Queue priority"}),n.jsx("input",{type:"number",value:V.priority,onChange:me=>Z({...V,priority:Number(me.target.value)})}),n.jsx("span",{className:"hint",children:"Higher priority is picked up first when the queue is contested. Parallel execution is configured app-wide in Settings."})]}),n.jsx(Ff,{id:"batch-max-attempts",value:V.maxAttempts,appDefault:G,onChange:me=>Z({...V,maxAttempts:me})})]}),r===lr&&le.data&&!le.data.ok&&n.jsxs("div",{className:"run-io-warning",style:{marginTop:16},children:["Preflight found blocking issues — resolve before queueing a large batch.",n.jsx("ul",{style:{margin:"8px 0 0 16px",fontSize:13},children:le.data.checks.filter(me=>me.status==="fail").map(me=>n.jsx("li",{children:me.message},me.name))})]}),r===lr&&((Cr=le.data)==null?void 0:Cr.checks.some(me=>me.status==="warn"))&&n.jsxs("div",{className:"memorix-panel",style:{marginTop:16,fontSize:13},children:["Preflight warnings:",n.jsx("ul",{style:{margin:"8px 0 0 16px"},children:le.data.checks.filter(me=>me.status==="warn").map(me=>n.jsx("li",{children:me.message},me.name))})]}),it.isError&&n.jsx(yt,{title:"Failed to queue batch",detail:it.error}),n.jsx(bt,{onBack:()=>at(Zd),children:n.jsx("button",{type:"button",className:"primary",disabled:it.isPending,onClick:()=>it.mutate(),children:it.isPending?"Queueing…":"Queue batch"})})]}),r===_g&&Te&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx(go,{result:Te}),k&&n.jsx(bx,{batch:k}),k&&(k.excluded.length>0||k.selectionSummary&&k.selectionSummary.queued!==k.selectionSummary.matched)&&n.jsx("div",{style:{maxWidth:640,margin:"0 auto",width:"100%"},children:n.jsx(yo,{included:((ri=k.selectionSummary)==null?void 0:ri.queued)??k.counts.total,excluded:k.excluded,includedLabel:"Jobs queued"})})]})]})]})}function Bs({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:12},children:s})]})}function $C(){var A,O,Q,B,z;const{id:a=""}=li(),s=qn(),r=he({queryKey:["batch",a],queryFn:()=>ee.batch(a)}),c=uo(["batch-runs",a],{batchId:a}),u=he({queryKey:["queue-settings"],queryFn:()=>ee.queueSettings()}),f=he({queryKey:["batch-failure-breakdown",a],queryFn:()=>ee.batchFailureBreakdown(a),enabled:(((A=r.data)==null?void 0:A.counts.failed)??0)>0}),h=r.data,m=S.useMemo(()=>{var q;return((q=c.data)==null?void 0:q.pages.flatMap(V=>V.runs))??[]},[c.data]),p=Nr((O=c.data)==null?void 0:O.pages),g=m.length<p,x=S.useCallback(()=>{g&&!c.isFetchingNextPage&&c.fetchNextPage()},[g,c]),v=Ye({mutationFn:()=>ee.retryAllFactoryRuns({batchId:a,confirm:!0}),onSuccess:q=>{s.invalidateQueries({queryKey:["batch",a]}),s.invalidateQueries({queryKey:["batch-runs",a]}),s.invalidateQueries({queryKey:["batch-failure-breakdown",a]}),s.invalidateQueries({queryKey:["factory-runs"]});const V=q.failed.length>0?` ${q.failed.length} could not be retried.`:"";window.alert(`Retried ${q.retried.length} of ${q.matched} failed run(s).${V}`)}}),N=Ye({mutationFn:()=>ee.recoverBatch(a,{confirm:!0,resumeQueue:!0}),onSuccess:q=>{s.invalidateQueries({queryKey:["batch",a]}),s.invalidateQueries({queryKey:["batch-runs",a]}),s.invalidateQueries({queryKey:["batch-failure-breakdown",a]}),s.invalidateQueries({queryKey:["factory-runs"]}),s.invalidateQueries({queryKey:["queue-settings"]});const V=q.queueResumed?" Queue resumed.":"";window.alert(`Recovered batch: retried ${q.retry.retried.length} of ${q.retry.matched} failed run(s).${V} Ensure the queue worker is running.`)}}),j=S.useCallback(()=>{var Z;if(!h)return;const V=((Z=u.data)==null?void 0:Z.queueMode)==="paused"?`Resume the queue and retry ${h.counts.failed} failed run(s) in "${h.name}"?`:`Retry ${h.counts.failed} failed run(s) and refresh batch recovery state for "${h.name}"?`;window.confirm(V)&&N.mutate()},[h,N,(Q=u.data)==null?void 0:Q.queueMode]);if(r.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(r.isError||!h)return n.jsx(yt,{title:"Batch not found",detail:r.error});const E=h.counts,C=h.persistency===null?"Simulation (no writeback)":h.persistency?so(h.persistency):"Graph default";return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/on-demand/batch",children:"Batch"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),h.name]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[n.jsx("h1",{className:"page-title",children:h.name}),n.jsx(Ht,{status:h.status})]}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:["created ",Ma(h.createdAt)]})]}),n.jsx(bx,{batch:h}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:[["Total",E.total],["Pending",E.pending],["Running",E.running],["Done",E.done],["Failed",E.failed],["Cancelled",E.cancelled]].map(([q,V])=>n.jsxs("div",{className:"status-card",style:{cursor:"default"},children:[n.jsx("div",{className:"status-card-label",children:q}),n.jsx("div",{className:"status-card-count",children:V})]},q))}),E.failed>0&&((B=f.data)!=null&&B.breakdown.length)?n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Failure breakdown"}),n.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13},children:f.data.breakdown.map(q=>n.jsxs("li",{children:[q.count," × ",q.label]},q.category))})]}):null,n.jsxs("div",{className:"detail-grid",children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Selection summary"}),h.selectionSummary&&n.jsxs(n.Fragment,{children:[n.jsx(dn,{k:"Total in collection",v:String(h.selectionSummary.totalInCollection)}),n.jsx(dn,{k:"Matched filters",v:String(h.selectionSummary.matched)}),n.jsx(dn,{k:"Eligible to queue",v:String(h.selectionSummary.eligible)}),n.jsx(dn,{k:"Records evaluated",v:String(h.selectionSummary.scanned)}),n.jsx(dn,{k:"Jobs queued",v:String(h.selectionSummary.queued)})]}),n.jsx(dn,{k:"Entity",v:`${h.entity} · ${h.collection}`}),n.jsx(dn,{k:"Narratives",v:h.narratives.join(", ")||"none"}),n.jsx(dn,{k:"Reprocessing",v:(z=h.processing)!=null&&z.reprocessingMode&&h.processing.reprocessingMode!=="skip"?h.processing.reprocessingMode:"skip (default)"}),n.jsx(dn,{k:"Graph",v:h.graphName??h.graphId}),n.jsx(dn,{k:"Result writeback",v:C}),n.jsx(dn,{k:"Priority",v:String(h.policy.priority)}),n.jsx(dn,{k:"Max retries",v:String(h.policy.maxAttempts??"app default")}),n.jsx(dn,{k:"Created",v:Mt(h.createdAt)})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Excluded information"}),h.excluded.length?n.jsx(yo,{included:E.total,excluded:h.excluded,includedLabel:"Queued"}):n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No information was excluded."})]})]}),n.jsxs("div",{className:"section",children:[n.jsxs("div",{className:"section-title",style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},children:[n.jsx("span",{children:"Runs"}),E.failed>0&&n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",className:"primary",disabled:N.isPending||v.isPending,onClick:j,children:N.isPending?"Recovering…":`Recover batch (${E.failed} failed)`}),n.jsx("button",{type:"button",disabled:v.isPending||N.isPending,onClick:()=>{window.confirm(`Retry ${E.failed} failed run(s) without changing queue settings?`)&&v.mutate()},children:v.isPending?"Retrying…":"Retry failed only"})]})]}),v.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:12},children:["Bulk retry failed: ",String(v.error)]}),N.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:12},children:["Batch recover failed: ",String(N.error)]}),c.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),!c.isLoading&&m.length===0&&n.jsx(Yt,{title:"No runs for this batch yet"}),m.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Attempts"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:m.map(q=>n.jsxs("tr",{onClick:()=>{window.location.href=`/journal/${q.id}`},children:[n.jsx("td",{children:n.jsx(Ht,{status:q.status})}),n.jsx("td",{className:"mono",style:{fontSize:12},children:q.recordLabel??q.recordId}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:q.graphName??q.graphId}),n.jsxs("td",{className:"mono",children:[q.attempts,"/",q.maxAttempts]}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Ma(q.updatedAt)})]},q.id))})]}),n.jsx(Sr,{loaded:m.length,total:p,hasMore:g,isFetchingNextPage:c.isFetchingNextPage,onLoadMore:x})]})]})]})}function dn({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",style:{fontFamily:"inherit"},children:s})]})}function HC(a){const s=Object.values(a.processing.graphs);if(s.length===0)return"not processed";const r=s.filter(u=>u.lastStatus==="succeeded").length,c=s.filter(u=>u.lastStatus==="failed").length;return`${r} done${c?`, ${c} failed`:""}`}function KC(a){const s=a.role==="processing-output"?` (output · ${a.count})`:a.key==="core"?` (${a.count})`:` · ${a.count}`;return a.role==="processing-output"?`${a.key}${s}`:`${a.key}${a.key!=="core"?s:` (${a.count})`}`}function Ug(){var T,U,W,se;const a=yn(),s=pn(),r=qn(),{agentQueryParam:c,agentId:u}=Bn(),[f,h]=si(),m=f.get("view")==="outputs"||s.pathname==="/outputs",p=f.get("entity")??"",g=f.get("collection")??"",x=f.get("graphId")??"",v=f.get("processing")??"",N=(f.get("narratives")??"").split(",").filter(Boolean),[j,E]=S.useState("");function C(F){const ce=new URLSearchParams(f);for(const[xe,le]of Object.entries(F))le?ce.set(xe,le):ce.delete(xe);h(ce)}const A=he({queryKey:["entities",c??"all"],queryFn:()=>ee.listEntities(c)}),O=A.data??[],Q=O.find(F=>F.name===p),B=S.useMemo(()=>((Q==null?void 0:Q.collections)??[]).filter(F=>F.role==="processing-output"),[Q]),z=m?((T=B.find(F=>F.key===g))==null?void 0:T.key)??((U=B[0])==null?void 0:U.key)??"":g||"core",q=Q==null?void 0:Q.collections.find(F=>F.key===z),V=(q==null?void 0:q.role)==="processing-output",Z=B.length>0,I=!!(p&&z&&(!m||V));S.useEffect(()=>{if(!(!m||!Q)){if(!Z){g&&C({collection:void 0});return}B.some(F=>F.key===g)||C({collection:B[0].key})}},[m,Q,Z,B,g,p]);const te=he({queryKey:["narratives",p],queryFn:()=>ee.listNarratives(p),enabled:!!p&&!m}),ye=he({queryKey:["graphs",p],queryFn:()=>ee.graphsForEntity(p),enabled:!!p&&!m}),ue=S.useMemo(()=>({entity:p,collection:z,narratives:N.length?N:void 0,processingGraphId:x||void 0,processingCondition:v||void 0}),[p,z,N,x,v]),re=KN(["core-records",p,z,N,x,v],ue,{enabled:I}),Ce=S.useMemo(()=>{var F;return((F=re.data)==null?void 0:F.pages.flatMap(ce=>ce.records))??[]},[re.data]),Te=Nr((W=re.data)==null?void 0:W.pages),ve=Ce.length<Te,k=S.useCallback(()=>{ve&&!re.isFetchingNextPage&&re.fetchNextPage()},[ve,re]),J=Ye({mutationFn:()=>ee.clearCoreRecords({entity:p,collection:z,confirm:!0}),onSuccess:()=>{E(""),r.invalidateQueries({queryKey:["core-records"]}),A.refetch()}});function ae(F){const ce=N.includes(F)?N.filter(xe=>xe!==F):[...N,F];C({narratives:ce.join(",")||void 0})}const Ne=S.useMemo(()=>{const F=Ce[0];if(!F)return[];const ce=new Set(["recordId","entityId","eventId","knowledgeId","displayName","data","_memorix"]);return Object.keys(F.fields).filter(xe=>!ce.has(xe)&&!xe.startsWith("_")).filter(xe=>{const le=F.fields[xe];return le===null||["string","number","boolean"].includes(typeof le)}).slice(0,3)},[Ce]),G=m?B:(Q==null?void 0:Q.collections)??[{key:"core",role:"core",count:0}];return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:m?"Outputs":"Information"}),n.jsxs("span",{className:"page-subtitle",children:[u?n.jsxs(n.Fragment,{children:["Object types in agent scope ",n.jsx("span",{className:"mono",children:u}),". · "]}):null,m?"Browse graph output containers and inspect saved results.":"Browse processed items, their narratives, and processing state."]})]}),p&&!m&&n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx(je,{to:`/on-demand/single?entity=${p}`,children:n.jsx("button",{children:"Run on-demand"})}),n.jsx(je,{to:`/on-demand/batch?entity=${p}`,children:n.jsx("button",{className:"primary",children:"Create batch from filter"})})]}),p&&V&&n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx("input",{type:"text",placeholder:`type ${p}-${z} to confirm`,value:j,onChange:F=>E(F.target.value),style:{width:220,fontSize:12}}),n.jsx("button",{disabled:J.isPending||j!==`${p}-${z}`,style:{color:"var(--status-failed)"},onClick:()=>{window.confirm(`Delete all records in ${p}-${z}? This cannot be undone.`)&&J.mutate()},children:J.isPending?"Clearing…":"Clear collection"})]})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:p,onChange:F=>C({entity:F.target.value||void 0,collection:void 0,narratives:void 0,graphId:void 0,processing:void 0}),children:[n.jsx("option",{value:"",children:"— select —"}),O.map(F=>n.jsx("option",{value:F.name,children:F.label},F.name))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:m?"Output collection":"Collection type"}),n.jsx("select",{value:z,onChange:F=>C({collection:F.target.value}),disabled:!Q||m&&!Z,children:G.length===0?n.jsx("option",{value:"",children:"— none —"}):G.map(F=>n.jsx("option",{value:F.key,children:KC(F)},F.key))})]}),!m&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"filter-divider"}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Processed by"}),n.jsxs("select",{value:x,onChange:F=>C({graphId:F.target.value||void 0,processing:void 0}),disabled:!p,children:[n.jsx("option",{value:"",children:"any graph"}),(ye.data??[]).map(F=>n.jsx("option",{value:F.graphId,children:F.name},F.graphId))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"with status"}),n.jsxs("select",{value:v,onChange:F=>C({processing:F.target.value||void 0}),disabled:!x,title:x?void 0:"Select a graph first",children:[n.jsx("option",{value:"",children:"any status"}),n.jsx("option",{value:"succeeded",children:"succeeded"}),n.jsx("option",{value:"failed",children:"failed"}),n.jsx("option",{value:"running",children:"running"}),n.jsx("option",{value:"queued",children:"queued"}),n.jsx("option",{value:"not-processed",children:"not processed"}),n.jsx("option",{value:"unknown",children:"unknown"})]})]})]})]}),p&&!m&&(((se=te.data)==null?void 0:se.length)??0)>0&&n.jsx("div",{className:"chip-row",style:{marginBottom:16},children:(te.data??[]).map(F=>n.jsx("span",{className:`chip selectable${N.includes(F.key)?" selected":""}`,onClick:()=>ae(F.key),title:F.description,children:F.label},F.key))}),!p&&n.jsx(Yt,{title:"Select an entity",message:m?"Choose an entity to browse its output collections.":"Choose an entity to browse its items, narratives, and processing state.",icon:"◇"}),p&&m&&Q&&!Z&&n.jsx(Yt,{title:"No output collections",message:"This entity has no graph output containers yet. Run a graph with result writeback to populate an output collection."}),p&&I&&re.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),p&&I&&re.isError&&n.jsx(yt,{title:"Failed to load records",detail:re.error,onRetry:()=>re.refetch()}),p&&I&&!re.isLoading&&!re.isError&&Ce.length===0&&n.jsx(Yt,{title:"No matching items",message:m?"This output collection is empty.":"No items match the current filters. Try removing a narrative or changing the processing filter."}),Ce.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"ID"}),n.jsx("th",{children:"Label"}),Ne.map(F=>n.jsx("th",{children:F},F)),!m&&n.jsx("th",{children:"Narratives"}),!m&&n.jsx("th",{children:"Processing"}),n.jsx("th",{children:"Updated"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:Ce.map(F=>n.jsxs("tr",{onClick:()=>a(`${m?"/outputs":"/information"}/${encodeURIComponent(F.id)}?entity=${p}&collection=${z}`),children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:F.id}),n.jsx("td",{children:F.label}),Ne.map(ce=>n.jsx("td",{className:"text-muted",style:{fontSize:12},children:String(F.fields[ce]??"—")},ce)),!m&&n.jsx("td",{children:n.jsx("span",{className:"chip-row",children:Object.keys(F.narratives).map(ce=>n.jsx("span",{className:"chip narrative",children:ce},ce))})}),!m&&n.jsx("td",{className:"text-muted",style:{fontSize:12},children:HC(F)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:new Date(F.updatedAt).toLocaleString()}),n.jsx("td",{onClick:ce=>ce.stopPropagation(),children:!m&&n.jsx(je,{to:`/on-demand/single?entity=${p}`,style:{fontSize:12},children:"Run"})})]},F.id))})]}),n.jsx(Sr,{loaded:Ce.length,total:Te,hasMore:ve,isFetchingNextPage:re.isFetchingNextPage,onLoadMore:k})]})]})}const GC=["Core","Narratives","Processing","Snapshots","Journal"],IC=["Output","Journal"];function Qg(){const{recordId:a}=li(),s=decodeURIComponent(a??""),[r]=si(),c=r.get("entity")??"",u=r.get("collection")??"core",f=u!=="core",[h,m]=S.useState(f?"Output":"Core"),p=qn();S.useEffect(()=>{m(f?"Output":"Core")},[u,f]);const g=he({queryKey:["core-record",c,u,s],queryFn:()=>ee.coreRecord(c,s,u,f),enabled:!!(c&&s)}),x=g.data,v=f?`/outputs?entity=${encodeURIComponent(c)}&collection=${encodeURIComponent(u)}`:`/information?entity=${encodeURIComponent(c)}`,N=Ye({mutationFn:()=>ee.deleteCoreRecord(c,s,u),onSuccess:()=>{p.invalidateQueries({queryKey:["core-records"]}),window.location.href=v}});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(g.isError||!x)return n.jsx(yt,{title:"Failed to load",detail:g.error});const j=f?IC:GC;return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:v,children:f?"Outputs":"Information"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),x.label]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:x.label}),n.jsxs("span",{className:"page-subtitle mono",children:[c," · ",u," · ",x.id]})]}),!f&&n.jsx(je,{to:`/on-demand/single?entity=${c}`,children:n.jsx("button",{className:"primary",children:"Run on-demand"})}),f&&n.jsx("button",{style:{color:"var(--status-failed)"},disabled:N.isPending,onClick:()=>{window.confirm("Delete this output record? Linked processing stamps will be marked failed.")&&N.mutate()},children:N.isPending?"Deleting…":"Delete output"})]}),n.jsx("div",{className:"tabs",children:j.map(E=>n.jsx("button",{className:`tab${h===E?" active":""}`,onClick:()=>m(E),children:E},E))}),h==="Core"&&n.jsxs("div",{className:"card",style:{maxWidth:560},children:[n.jsx("div",{className:"card-title",children:"Core fields"}),n.jsx(Ls,{k:"Item id",v:x.id}),n.jsx(Ls,{k:"Entity",v:x.entity}),n.jsx(Ls,{k:"Label",v:x.label}),Object.entries(x.fields).map(([E,C])=>n.jsx(Ls,{k:E,v:String(C)},E)),n.jsx(Ls,{k:"Created",v:Mt(x.createdAt)}),n.jsx(Ls,{k:"Updated",v:Mt(x.updatedAt)})]}),h==="Output"&&n.jsxs("div",{className:"card run-io-panel",children:[n.jsx("div",{className:"card-title",children:"Output document"}),n.jsxs("p",{className:"run-io-hint",children:["Full contents of this record in the ",n.jsx("span",{className:"mono",children:u})," collection."]}),n.jsx(Lt,{label:"Document JSON",value:x.doc??x.fields,defaultOpen:!0})]}),h==="Narratives"&&(Object.keys(x.narratives).length===0?n.jsx(Yt,{title:"No narratives on this item",message:"This item has no narratives assigned."}):n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Narrative"}),n.jsx("th",{children:"Added"}),n.jsx("th",{children:"Detected by"})]})}),n.jsx("tbody",{children:Object.entries(x.narratives).map(([E,C])=>n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{children:n.jsx("span",{className:"chip narrative",children:E})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:Mt(C.addedAt)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:C.detectedBy??"—"})]},E))})]})})),h==="Processing"&&n.jsx(PC,{entity:c,recordId:s,contentType:"core",graphs:x.processing.graphs}),h==="Snapshots"&&n.jsx(Yt,{title:"Snapshots view",message:"Snapshot perspectives for this item live in the Memorix UI. Core is the operational perspective shown here.",icon:"▤"}),h==="Journal"&&n.jsx(YC,{entity:c,recordId:s})]})}function YC({entity:a,recordId:s}){var m;const r=uo(["record-runs",a,s],{entity:a,recordId:s}),c=S.useMemo(()=>{var p;return((p=r.data)==null?void 0:p.pages.flatMap(g=>g.runs))??[]},[r.data]),u=Nr((m=r.data)==null?void 0:m.pages),f=c.length<u,h=S.useCallback(()=>{f&&!r.isFetchingNextPage&&r.fetchNextPage()},[f,r]);return r.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):c.length===0?n.jsx(Yt,{title:"No journal entries for this item"}):n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Source"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:c.map(p=>n.jsxs("tr",{onClick:()=>{window.location.href=`/journal/${p.id}`},children:[n.jsx("td",{children:n.jsx(Ht,{status:p.status})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:p.sourceName}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:p.graphName??p.graphId}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Ma(p.updatedAt)})]},p.id))})]}),n.jsx(Sr,{loaded:c.length,total:u,hasMore:f,isFetchingNextPage:r.isFetchingNextPage,onLoadMore:h})]})}function PC({entity:a,recordId:s,contentType:r,graphs:c}){const u=Object.values(c);return u.length===0?n.jsx(Yt,{title:"No processing yet",message:"This item has not been processed by any graph."}):n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Version"}),n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Processed at"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:u.map(f=>n.jsx(FC,{entity:a,recordId:s,contentType:r,graph:f},f.graphId))})]})})}function FC({entity:a,recordId:s,contentType:r,graph:c}){const u=he({queryKey:["journal-run-status",c.lastRunId],queryFn:()=>ee.factoryRun(c.lastRunId),enabled:!!c.lastRunId&&c.lastStatus==="running"}),f=u.data&&["pending","running","blocked"].includes(u.data.status),h=c.lastStatus==="running"&&c.lastRunId&&!f&&!u.isLoading,m=Ye({mutationFn:()=>ee.resetGraphRun(a,s,c.graphId,r),onSuccess:()=>{window.location.reload()}});return n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:c.graphName??c.graphId}),n.jsx("td",{children:n.jsx(Ht,{status:c.lastStatus})}),n.jsx("td",{className:"text-muted",children:c.graphVersion??"—"}),n.jsx("td",{children:c.lastRunId?n.jsx(je,{to:`/journal/${c.lastRunId}`,className:"mono",style:{fontSize:12},children:c.lastRunId}):"—"}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(c.processedAt)}),n.jsx("td",{children:h&&n.jsx("button",{className:"btn btn-sm",disabled:m.isPending,onClick:()=>{window.confirm("Reset stuck processing stamp on this item?")&&m.mutate()},children:m.isPending?"Resetting…":"Reset stuck"})})]})}function Ls({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function XC(a){return{stepKey:a.stepKey,label:a.label,durations:[],inputBytes:[],outputBytes:[],promptTokens:[],completionTokens:[],totalTokens:[],costUsd:[],plannedSamples:0,measuredSamples:0}}function VC(a,s){var r,c,u;if(s.planned&&s.durationMs==null){a.plannedSamples+=1;return}a.measuredSamples+=1,s.durationMs!=null&&a.durations.push(s.durationMs),s.inputBytes!=null&&a.inputBytes.push(s.inputBytes),s.outputBytes!=null&&a.outputBytes.push(s.outputBytes),((r=s.tokens)==null?void 0:r.prompt)!=null&&a.promptTokens.push(s.tokens.prompt),((c=s.tokens)==null?void 0:c.completion)!=null&&a.completionTokens.push(s.tokens.completion),((u=s.tokens)==null?void 0:u.total)!=null&&a.totalTokens.push(s.tokens.total),s.costUsd!=null&&a.costUsd.push(s.costUsd)}function Xf(a){if(a.length!==0)return a.reduce((s,r)=>s+r,0)/a.length}function On(a){return a.length===0?{}:{avg:Xf(a),min:Math.min(...a),max:Math.max(...a)}}function Mn(a,s){const r={};return s.avg!=null&&(r[`avg${a}`]=s.avg),s.min!=null&&(r[`min${a}`]=s.min),s.max!=null&&(r[`max${a}`]=s.max),r}function JC(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function ZC(a){if(a.status!=="done")return!1;const s=JC(a.result);return(s==null?void 0:s.status)!=="failed"}function $g(a){return a.includes("Web")||a.includes("Pre")||a.includes("Narrix")?0:a.includes("Main")?1:a.includes("Post")||a.includes("Audit")||a.includes("Polish")?2:3}function WC(a){return[...a.values()].map(s=>{const r=s.durations.length,c=s.measuredSamples===0&&s.plannedSamples>0,u=On(s.inputBytes),f=On(s.outputBytes),h=On(s.promptTokens),m=On(s.completionTokens),p=On(s.totalTokens),g=On(s.costUsd);return{stepKey:s.stepKey,label:s.label,sampleCount:Math.max(s.measuredSamples,s.plannedSamples),...r>0?{avgDurationMs:Xf(s.durations),minDurationMs:Math.min(...s.durations),maxDurationMs:Math.max(...s.durations)}:{},...Mn("InputBytes",u),...Mn("OutputBytes",f),...Mn("PromptTokens",h),...Mn("CompletionTokens",m),...Mn("TotalTokens",p),...Mn("CostUsd",g),plannedOnly:c}}).sort((s,r)=>$g(s.label)-$g(r.label)||s.label.localeCompare(r.label))}function eE(a){const s=tx(a.result);if(Object.keys(s).length===0)return null;const r=ax(s,[],a.result),c=fo(r);return c?{runId:a.id,graphId:a.graphId,completedAt:a.updatedAt,entity:a.entity,recordLabel:a.recordLabel,wallDurationMs:c.totalDurationMs,nodeCount:c.nodeCount,parallelPairCount:c.parallelPairCount,rows:r}:null}function Nx(a,s){var p,g,x;const r=new Map,c=[];let u=0,f=0,h=0;for(const v of s){if(!ZC(v))continue;const N=eE(v);if(N){u+=1,f+=N.wallDurationMs,h+=N.parallelPairCount,c.length<8&&c.push(N);for(const j of N.rows){let E=r.get(j.nodeId);if(E||(E={nodeId:j.nodeId,skillKey:j.skillKey,durations:[],startedAtSamples:[],failCount:0,parallelSampleCount:0,inputBytes:[],outputBytes:[],promptTokens:[],completionTokens:[],totalTokens:[],costUsd:[],subSteps:new Map},r.set(j.nodeId,E)),j.skillKey&&!E.skillKey&&(E.skillKey=j.skillKey),!j.ok){E.failCount+=1;continue}E.durations.push(j.durationMs),E.startedAtSamples.push(j.startedAt),j.concurrentWith.length>0&&(E.parallelSampleCount+=1);const C=Jv(j,v.result);C.inputBytes!=null&&E.inputBytes.push(C.inputBytes),C.outputBytes!=null&&E.outputBytes.push(C.outputBytes),((p=C.tokens)==null?void 0:p.prompt)!=null&&E.promptTokens.push(C.tokens.prompt),((g=C.tokens)==null?void 0:g.completion)!=null&&E.completionTokens.push(C.tokens.completion),((x=C.tokens)==null?void 0:x.total)!=null&&E.totalTokens.push(C.tokens.total),C.costUsd!=null&&E.costUsd.push(C.costUsd);for(const A of j.subSteps??[]){let O=E.subSteps.get(A.stepKey);O||(O=XC(A),E.subSteps.set(A.stepKey,O)),VC(O,A)}}}}const m=[...r.values()].map(v=>{const N=v.durations.reduce((V,Z)=>V+Z,0),j=v.durations.length,E=On(v.inputBytes),C=On(v.outputBytes),A=On(v.promptTokens),O=On(v.completionTokens),Q=On(v.totalTokens),B=On(v.costUsd),z=WC(v.subSteps),q=Xf(v.startedAtSamples)??0;return{nodeId:v.nodeId,skillKey:v.skillKey,sampleCount:j,avgDurationMs:j>0?N/j:0,minDurationMs:j>0?Math.min(...v.durations):0,maxDurationMs:j>0?Math.max(...v.durations):0,failCount:v.failCount,parallelSampleCount:v.parallelSampleCount,avgStartedAt:j>0?q:Number.POSITIVE_INFINITY,...Mn("InputBytes",E),...Mn("OutputBytes",C),...Mn("PromptTokens",A),...Mn("CompletionTokens",O),...Mn("TotalTokens",Q),...Mn("CostUsd",B),...z.length>0?{subSteps:z}:{}}}).sort((v,N)=>Hf({nodeId:v.nodeId,skillKey:v.skillKey,startedAt:v.avgStartedAt},{nodeId:N.nodeId,skillKey:N.skillKey,startedAt:N.avgStartedAt})).map(({avgStartedAt:v,...N})=>N);return{graphId:a,runsSampled:s.length,runsWithTrace:u,nodes:m,recentSamples:c,totals:{...u>0?{avgWallDurationMs:f/u}:{},...u>0?{avgParallelPairsPerRun:h/u}:{}}}}function tE(a,s,r){const c=new Map;for(const g of s){const x=c.get(g.graphId)??[];x.push(g),c.set(g.graphId,x)}const u=[],f=[];let h=0,m=0,p=0;for(const[g,x]of c){const v=Nx(g,x);h+=v.runsWithTrace,v.totals.avgWallDurationMs!=null&&(m+=v.totals.avgWallDurationMs*v.runsWithTrace),v.totals.avgParallelPairsPerRun!=null&&(p+=v.totals.avgParallelPairsPerRun*v.runsWithTrace),f.push(...v.recentSamples),u.push({graphId:g,graphName:r==null?void 0:r[g],runsSampled:v.runsSampled,runsWithTrace:v.runsWithTrace,totals:v.totals,nodes:v.nodes,recentSamples:v.recentSamples})}return u.sort((g,x)=>{const v=(g.graphName??g.graphId).toLowerCase(),N=(x.graphName??x.graphId).toLowerCase();return v.localeCompare(N)}),f.sort((g,x)=>x.completedAt.localeCompare(g.completedAt)),{entity:a,runsSampled:s.length,runsWithTrace:h,graphCount:u.length,graphs:u,recentSamples:f.slice(0,12),totals:{...h>0?{avgWallDurationMs:m/h}:{},...h>0?{avgParallelPairsPerRun:p/h}:{}}}}function cr(a,s){return s!=null&&s.trim()?s.trim():lo({graphId:a,name:s})}function Tf(a){return`/pipelines/${encodeURIComponent(a)}`}function Cx(a){return`/pipelines/entity/${encodeURIComponent(a)}`}function Vf({mode:a}){return n.jsxs("div",{className:"pipeline-diagram-tabs",style:{marginBottom:16},children:[n.jsx(je,{to:"/pipelines",className:a==="graph"?"active":"",style:{textDecoration:"none"},children:"By pipeline"}),n.jsx(je,{to:"/pipelines?view=entity",className:a==="entity"?"active":"",style:{textDecoration:"none"},children:"By entity"})]})}function _s(a,s,r){return{...a!=null?{avg:a}:{},...s!=null?{min:s}:{},...r!=null?{max:r}:{}}}function Us({stats:a,format:s}){return a.avg==null&&a.min==null&&a.max==null?n.jsx("span",{className:"text-dim",children:"—"}):n.jsxs("div",{className:"pipeline-stat-cell",children:[a.avg!=null&&n.jsx("div",{children:s(a.avg)}),a.min!=null&&a.max!=null&&n.jsxs("div",{className:"pipeline-stat-range text-dim",children:[s(a.min)," – ",s(a.max)]})]})}function Wd(a,s){const r=s==="avg"?"avg":s==="min"?"min":"max",c=a[`${r}PromptTokens`],u=a[`${r}CompletionTokens`],f=a[`${r}TotalTokens`];if(!(typeof c!="number"&&typeof u!="number"&&typeof f!="number"))return{...typeof c=="number"?{prompt:Math.round(c)}:{},...typeof u=="number"?{completion:Math.round(u)}:{},...typeof f=="number"?{total:Math.round(f)}:{}}}function Hg({row:a}){const s=Wd(a,"avg"),r=Wd(a,"min"),c=Wd(a,"max");return!s&&!r&&!c?n.jsx("span",{className:"text-dim",children:"—"}):n.jsxs("div",{className:"pipeline-stat-cell",children:[s&&n.jsx("div",{style:{fontSize:11},children:rr(s)}),r&&c&&n.jsxs("div",{className:"pipeline-stat-range text-dim",style:{fontSize:10},children:[rr(r)," – ",rr(c)]})]})}function Ex({nodes:a,runsWithTrace:s}){if(a.length===0)return null;const r=a.some(c=>{var u;return(((u=c.subSteps)==null?void 0:u.length)??0)>0});return n.jsxs("div",{className:"table-wrap",style:{marginTop:12},children:[n.jsxs("table",{className:"data-table pipeline-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:r?"Node / step":"Node"}),n.jsx("th",{children:"Skill"}),n.jsx("th",{children:"Samples"}),n.jsx("th",{children:"Avg duration"}),n.jsx("th",{children:"Min duration"}),n.jsx("th",{children:"Max duration"}),n.jsx("th",{children:"Input"}),n.jsx("th",{children:"Output"}),n.jsx("th",{children:"Tokens"}),n.jsx("th",{children:"Cost"}),n.jsx("th",{children:"Parallel runs"}),n.jsx("th",{children:"Failures"})]})}),n.jsx("tbody",{children:a.flatMap(c=>{const u=[n.jsxs("tr",{children:[n.jsx("td",{className:"mono",children:c.nodeId}),n.jsx("td",{className:"mono text-dim",style:{fontSize:12},children:c.skillKey||"—"}),n.jsx("td",{children:c.sampleCount>0?c.sampleCount:"—"}),n.jsx("td",{children:c.sampleCount>0?nt(c.avgDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:c.sampleCount>0?nt(c.minDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:c.sampleCount>0?nt(c.maxDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgInputBytes,c.minInputBytes,c.maxInputBytes),format:zn})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgOutputBytes,c.minOutputBytes,c.maxOutputBytes),format:zn})}),n.jsx("td",{className:"text-dim",children:n.jsx(Hg,{row:c})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgCostUsd,c.minCostUsd,c.maxCostUsd),format:ao})}),n.jsx("td",{className:"text-dim",children:c.parallelSampleCount>0?c.parallelSampleCount:"—"}),n.jsx("td",{style:{color:c.failCount>0?"var(--status-failed)":void 0},children:c.failCount>0?c.failCount:"—"})]},c.nodeId)];for(const f of c.subSteps??[])u.push(n.jsxs("tr",{className:"pipeline-substep-row",children:[n.jsxs("td",{className:"mono pipeline-substep-label",children:[n.jsx("span",{className:"pipeline-substep-marker",children:"↳"}),f.label,f.plannedOnly&&n.jsx("span",{className:"chip text-dim",style:{marginLeft:6,fontSize:10},children:"planned"})]}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{children:f.sampleCount}),n.jsx("td",{children:f.avgDurationMs!=null?nt(f.avgDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:f.minDurationMs!=null?nt(f.minDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:f.maxDurationMs!=null?nt(f.maxDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgInputBytes,f.minInputBytes,f.maxInputBytes),format:zn})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgOutputBytes,f.minOutputBytes,f.maxOutputBytes),format:zn})}),n.jsx("td",{className:"text-dim",children:n.jsx(Hg,{row:f})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgCostUsd,f.minCostUsd,f.maxCostUsd),format:ao})}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{className:"text-dim",children:"—"})]},`${c.nodeId}:${f.stepKey}`));return u})})]}),n.jsxs("p",{className:"text-dim",style:{fontSize:11,marginTop:8},children:["Based on ",s," successful traced run",s===1?"":"s"," for this pipeline. Averages and min–max ranges use successful node executions only; failed runs and failed nodes are excluded.",r&&n.jsxs(n.Fragment,{children:[" ","Sub-steps come from execution trace units and ai-tasks pipeline metadata when persisted on runs."]})]})]})}function nE(){var p,g;const a=yn(),[s]=si(),r=s.get("view")==="entity"?"entity":"graph",{agentQueryParam:c}=Bn(),u=he({queryKey:["entities",c??"all"],queryFn:()=>ee.listEntities(c)}),f=he({queryKey:["meta-graphs"],queryFn:()=>ee.compatibleGraphs()}),h=((p=f.data)==null?void 0:p.graphs)??[],m=((g=f.data)==null?void 0:g.cataloxAuthoritative)===!1?"Catalox unavailable — showing legacy registry graphs only.":"Pipelines listed from Graphs Studio (Catalox).";return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Pipeline analytics"}),n.jsx("span",{className:"page-subtitle",children:"Aggregated timing and parallelism — browse by pipeline (graph) or by entity type."})]})}),n.jsx(Vf,{mode:r}),r==="graph"?n.jsxs(n.Fragment,{children:[f.isError&&n.jsx(yt,{title:"Failed to load pipelines",detail:f.error}),f.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading pipelines from Catalox…"]}),!f.isLoading&&h.length===0&&n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No pipelines in Catalox yet. Author graphs in Graphs Studio, then return here."}),n.jsxs("div",{className:"card",style:{marginTop:16},children:[n.jsx("div",{className:"card-title",children:"Choose a pipeline"}),n.jsx("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:m}),n.jsx("div",{className:"pipeline-graph-picker",children:h.map(x=>n.jsxs("button",{type:"button",className:"pipeline-graph-pick",onClick:()=>a(Tf(x.graphId)),children:[n.jsx("span",{style:{fontSize:13},children:cr(x.graphId,x.name)}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:x.graphId})]},x.graphId))})]})]}):n.jsxs(n.Fragment,{children:[u.isError&&n.jsx(yt,{title:"Failed to load entities",detail:u.error}),u.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading entity types…"]}),!u.isLoading&&(u.data??[]).length===0&&n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No entity types configured."}),n.jsxs("div",{className:"card",style:{marginTop:16},children:[n.jsx("div",{className:"card-title",children:"Choose an entity type"}),n.jsx("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:"Aggregates completed runs across all pipelines for that object type."}),n.jsx("div",{className:"pipeline-graph-picker",children:(u.data??[]).map(x=>n.jsxs("button",{type:"button",className:"pipeline-graph-pick",onClick:()=>a(Cx(x.name)),children:[n.jsx("span",{style:{fontSize:13},children:x.label}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:x.name})]},x.name))})]})]}),n.jsx(ho,{variant:"full"})]})}function aE({graphId:a}){var N,j,E;const s=yn(),{agentQueryParam:r}=Bn(),u=(N=he({queryKey:["meta-graphs"],queryFn:()=>ee.compatibleGraphs()}).data)==null?void 0:N.graphs.find(C=>C.graphId===a),f=cr(a,u==null?void 0:u.name),h=he({queryKey:["pipeline-insights-runs",a,r??"all"],queryFn:()=>ee.factoryRuns({agent:r,graphId:a,status:"done",pageSize:100}),enabled:!!a}),m=S.useMemo(()=>{var C;return(C=h.data)!=null&&C.runs?Nx(a,h.data.runs):null},[a,(j=h.data)==null?void 0:j.runs]),p=(E=h.data)==null?void 0:E.runs.find(C=>C.result!=null),[g,x]=S.useState(null),v=S.useMemo(()=>m!=null&&m.recentSamples.length?g?m.recentSamples.find(C=>C.runId===g)??m.recentSamples[0]:m.recentSamples[0]:null,[m==null?void 0:m.recentSamples,g]);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/pipelines",children:"Pipeline analytics"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{children:f})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:f}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[n.jsx(je,{className:"btn",to:`/journal?graphId=${encodeURIComponent(a)}`,children:"Journal entries"}),n.jsx("button",{type:"button",className:"btn",onClick:()=>s("/pipelines"),children:"Change pipeline"})]})]}),n.jsx(Vf,{mode:"graph"}),n.jsx(ho,{graphId:a,variant:"full"}),h.isError&&n.jsx(yt,{title:"Failed to load runs",detail:h.error}),h.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading completed runs…"]}),m&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Sample"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Completed runs"}),n.jsx("span",{className:"detail-val",children:m.runsSampled})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"With trace data"}),n.jsx("span",{className:"detail-val",children:m.runsWithTrace})]})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Averages"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Wall time / run"}),n.jsx("span",{className:"detail-val",children:nt(m.totals.avgWallDurationMs)})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Parallel pairs / run"}),n.jsx("span",{className:"detail-val",children:m.totals.avgParallelPairsPerRun!=null?m.totals.avgParallelPairsPerRun.toFixed(1):"—"})]})]})]}),m.runsWithTrace===0&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["No completed runs in this sample include ",n.jsx("span",{className:"mono",children:"execution._trace"}),"."]}),v&&v.rows.length>0&&n.jsxs(kn,{title:"Typical execution pattern",summary:`From run ${v.runId.slice(0,8)}… · ${v.parallelPairCount>0?"parallel batches":"sequential"}`,defaultOpen:!0,style:{marginBottom:16},children:[n.jsxs("div",{className:"filter-group",style:{marginBottom:12,maxWidth:360},children:[n.jsx("label",{children:"Example run for diagram"}),n.jsx("select",{value:v.runId,onChange:C=>x(C.target.value),children:m.recentSamples.map(C=>n.jsxs("option",{value:C.runId,children:[C.runId.slice(0,8),"… · ",C.recordLabel??C.entity," · ",nt(C.wallDurationMs)]},C.runId))})]}),n.jsx(sx,{rows:v.rows,title:"How nodes ran"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:[n.jsx(je,{to:`/journal/${v.runId}`,children:"Open full run detail"})," for per-node logs and payloads."]})]}),m.nodes.length>0&&n.jsx(kn,{title:"Per-node aggregates",summary:`${m.nodes.length} nodes · last ${m.runsWithTrace} traced runs`,defaultOpen:!0,style:{marginBottom:16},children:n.jsx(Ex,{nodes:m.nodes,runsWithTrace:m.runsWithTrace})}),m.recentSamples.length>0&&n.jsx(kn,{title:"Recent runs",summary:`${m.recentSamples.length} with trace`,defaultOpen:!1,style:{marginBottom:16},children:n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Entity"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Wall"}),n.jsx("th",{children:"Nodes"}),n.jsx("th",{children:"Parallel pairs"}),n.jsx("th",{children:"Completed"})]})}),n.jsx("tbody",{children:m.recentSamples.map(C=>n.jsxs("tr",{children:[n.jsx("td",{children:n.jsxs(je,{to:`/journal/${C.runId}`,className:"mono",style:{fontSize:12},children:[C.runId.slice(0,8),"…"]})}),n.jsx("td",{className:"mono",children:n.jsx(je,{to:Cx(C.entity),children:C.entity})}),n.jsx("td",{className:"mono text-dim",children:C.recordLabel??"—"}),n.jsx("td",{children:nt(C.wallDurationMs)}),n.jsx("td",{children:C.nodeCount}),n.jsx("td",{children:C.parallelPairCount>0?C.parallelPairCount:"—"}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(C.completedAt)})]},C.runId))})]})})})]}),p&&n.jsx(kn,{title:"Latest run detail",summary:p.recordLabel??p.recordId,defaultOpen:(m==null?void 0:m.runsWithTrace)===0,style:{marginBottom:16},children:n.jsx(ix,{runId:p.id,status:p.status,result:p.result})})]})}function lE({entityName:a}){var N,j;const s=yn(),{agentQueryParam:r}=Bn(),u=(he({queryKey:["entities",r??"all"],queryFn:()=>ee.listEntities(r)}).data??[]).find(E=>E.name===a),f=(u==null?void 0:u.label)??a,h=he({queryKey:["meta-graphs"],queryFn:()=>ee.compatibleGraphs()}),m=S.useMemo(()=>{var C;const E={};for(const A of((C=h.data)==null?void 0:C.graphs)??[])E[A.graphId]=cr(A.graphId,A.name);return E},[(N=h.data)==null?void 0:N.graphs]),p=he({queryKey:["pipeline-insights-entity-runs",a,r??"all"],queryFn:()=>ee.factoryRuns({agent:r,entity:a,status:"done",pageSize:100}),enabled:!!a}),g=S.useMemo(()=>{var E;return(E=p.data)!=null&&E.runs?tE(a,p.data.runs,m):null},[a,(j=p.data)==null?void 0:j.runs,m]),[x,v]=S.useState(null);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(je,{to:"/pipelines?view=entity",children:"Pipeline analytics"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{children:f})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:f}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[n.jsx(je,{className:"btn",to:`/journal?entity=${encodeURIComponent(a)}`,children:"Journal entries"}),n.jsx("button",{type:"button",className:"btn",onClick:()=>s("/pipelines?view=entity"),children:"Change entity"})]})]}),n.jsx(Vf,{mode:"entity"}),n.jsx(ho,{variant:"full"}),p.isError&&n.jsx(yt,{title:"Failed to load runs",detail:p.error}),p.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading completed runs…"]}),g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Sample"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Completed runs"}),n.jsx("span",{className:"detail-val",children:g.runsSampled})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"With trace data"}),n.jsx("span",{className:"detail-val",children:g.runsWithTrace})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Pipelines used"}),n.jsx("span",{className:"detail-val",children:g.graphCount})]})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Averages (all pipelines)"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Wall time / run"}),n.jsx("span",{className:"detail-val",children:nt(g.totals.avgWallDurationMs)})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Parallel pairs / run"}),n.jsx("span",{className:"detail-val",children:g.totals.avgParallelPairsPerRun!=null?g.totals.avgParallelPairsPerRun.toFixed(1):"—"})]})]})]}),g.graphCount>0&&n.jsxs(kn,{title:"By pipeline",summary:`${g.graphCount} pipeline${g.graphCount===1?"":"s"} · ${g.runsWithTrace} traced runs`,defaultOpen:!0,style:{marginBottom:16},children:[n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Pipeline"}),n.jsx("th",{children:"Runs"}),n.jsx("th",{children:"Traced"}),n.jsx("th",{children:"Avg wall"}),n.jsx("th",{children:"Parallel pairs"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:g.graphs.map(E=>n.jsxs("tr",{children:[n.jsxs("td",{children:[n.jsx("div",{children:E.graphName??cr(E.graphId)}),n.jsx("div",{className:"mono text-dim",style:{fontSize:11},children:E.graphId})]}),n.jsx("td",{children:E.runsSampled}),n.jsx("td",{children:E.runsWithTrace}),n.jsx("td",{children:nt(E.totals.avgWallDurationMs)}),n.jsx("td",{children:E.totals.avgParallelPairsPerRun!=null?E.totals.avgParallelPairsPerRun.toFixed(1):"—"}),n.jsx("td",{children:n.jsx(je,{to:Tf(E.graphId),style:{fontSize:12},children:"Pipeline detail →"})})]},E.graphId))})]})}),g.graphs.some(E=>E.nodes.length>0)&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-pipeline node breakdown"}),g.graphs.filter(E=>E.nodes.length>0).map(E=>{const C=x===E.graphId;return n.jsxs("div",{className:`pipeline-node-inspector-item${C?" open":""}`,style:{marginBottom:6},children:[n.jsxs("button",{type:"button",className:"pipeline-node-inspector-head",onClick:()=>v(C?null:E.graphId),"aria-expanded":C,children:[n.jsx("span",{className:"pipeline-node-inspector-chevron",children:C?"▾":"▸"}),n.jsx("span",{children:E.graphName??cr(E.graphId)}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:E.graphId}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[E.nodes.length," nodes · ",E.runsWithTrace," traced"]})]}),C&&n.jsx(Ex,{nodes:E.nodes,runsWithTrace:E.runsWithTrace})]},E.graphId)})]})]}),g.recentSamples.length>0&&n.jsx(kn,{title:"Recent runs",summary:`${g.recentSamples.length} with trace`,defaultOpen:!1,style:{marginBottom:16},children:n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Pipeline"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Wall"}),n.jsx("th",{children:"Nodes"}),n.jsx("th",{children:"Completed"})]})}),n.jsx("tbody",{children:g.recentSamples.map(E=>n.jsxs("tr",{children:[n.jsx("td",{children:n.jsxs(je,{to:`/journal/${E.runId}`,className:"mono",style:{fontSize:12},children:[E.runId.slice(0,8),"…"]})}),n.jsx("td",{children:n.jsx(je,{to:Tf(E.graphId),style:{fontSize:12},children:m[E.graphId]??E.graphId})}),n.jsx("td",{className:"mono text-dim",children:E.recordLabel??"—"}),n.jsx("td",{children:nt(E.wallDurationMs)}),n.jsx("td",{children:E.nodeCount}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(E.completedAt)})]},E.runId))})]})})})]})]})}function ef(){const{graphId:a,entityName:s}=li();return s?n.jsx(lE,{entityName:s}):a?n.jsx(aE,{graphId:a}):n.jsx(nE,{})}const Tx=S.createContext("Exellix"),wx=S.createContext(null);function sE(){return S.useContext(Tx)}function iE(){return S.useContext(wx)}function rE({children:a}){const{data:s}=he({queryKey:["config"],queryFn:ee.config,staleTime:1/0}),r=(s==null?void 0:s.name)||"Exellix";return S.useEffect(()=>{document.title=`${r} Jobs`},[r]),n.jsx(wx.Provider,{value:s??null,children:n.jsx(Tx.Provider,{value:r,children:a})})}const cE="2.0.4",oE="/api/agents";class uE extends S.Component{constructor(){super(...arguments);Xy(this,"state",{error:null,componentStack:null})}static getDerivedStateFromError(r){return{error:r,componentStack:null}}componentDidCatch(r,c){console.error("UI error:",r,c),this.setState({componentStack:c.componentStack??null})}render(){return this.state.error?n.jsxs("div",{style:{padding:32},children:[n.jsxs("div",{className:"error-state",children:[n.jsx("strong",{children:"Something went wrong on this page."}),n.jsx("pre",{style:{marginTop:8,fontSize:11,whiteSpace:"pre-wrap"},children:this.state.error.message}),this.state.componentStack&&n.jsx("pre",{style:{marginTop:8,fontSize:10,whiteSpace:"pre-wrap",opacity:.75},children:this.state.componentStack})]}),n.jsx("button",{style:{marginTop:12},onClick:()=>this.setState({error:null,componentStack:null}),children:"Try again"})]}):this.props.children}}function dE(){const a=pn(),s=sE(),r=iE(),c=u=>u==="/"?a.pathname==="/":u==="/information"?a.pathname.startsWith("/information"):u==="/outputs"?a.pathname.startsWith("/outputs")||a.search.includes("view=outputs"):u==="/journal"?a.pathname.startsWith("/journal"):u==="/pipelines"?a.pathname.startsWith("/pipelines"):a.pathname.startsWith(u);return n.jsxs("header",{className:"topbar",children:[n.jsxs("div",{className:"topbar-brand",children:[n.jsx("span",{className:"topbar-brand-icon",children:"⚙"}),n.jsxs("span",{children:[n.jsx("span",{style:{color:"var(--color-text)"},children:s})," ",n.jsx("span",{children:"Jobs"})]}),n.jsxs("span",{className:"app-pkg-version",children:["v",cE]})]}),n.jsxs("nav",{className:"topbar-nav",children:[n.jsx(Sa,{to:"/",className:c("/")?"active":"",children:al.overview}),n.jsx(Sa,{to:"/work",className:c("/work")?"active":"",children:al.work}),n.jsx(Sa,{to:"/on-demand",className:c("/on-demand")?"active":"",children:al.onDemand}),n.jsx(Sa,{to:"/information",className:c("/information")?"active":"",children:al.information}),n.jsx(Sa,{to:"/outputs",className:c("/outputs")?"active":"",children:al.outputs}),n.jsx(Sa,{to:"/journal",className:c("/journal")?"active":"",children:al.journal}),n.jsx(Sa,{to:"/pipelines",className:c("/pipelines")?"active":"",children:al.pipelines}),n.jsx(Sa,{to:"/settings",className:c("/settings")?"active":"",children:al.settings})]}),n.jsxs("div",{className:"topbar-meta",children:[n.jsxs("div",{className:"topbar-meta-controls",children:[n.jsx(Gv,{}),n.jsx(Y0,{apiBase:oE,className:"topbar-agent-scope"})]}),r&&n.jsxs("span",{className:"topbar-meta-host mono",title:`${r.runtimeDb} @ ${r.mongoHost}`,children:[r.runtimeDb," @ ",r.mongoHost]})]})]})}const Ct=a=>n.jsx(uE,{children:a});function fE(){return n.jsx(yN,{children:n.jsxs("div",{className:"layout",children:[n.jsx(dE,{}),n.jsx("main",{className:"page",children:n.jsxs(IS,{children:[n.jsx(Ie,{path:"/",element:Ct(n.jsx(_N,{}))}),n.jsx(Ie,{path:"/settings",element:Ct(n.jsx(QN,{}))}),n.jsx(Ie,{path:"/work",element:Ct(n.jsx(nC,{}))}),n.jsx(Ie,{path:"/work/new",element:Ct(n.jsx(bC,{}))}),n.jsx(Ie,{path:"/work/:id",element:Ct(n.jsx(EC,{}))}),n.jsx(Ie,{path:"/on-demand",element:Ct(n.jsx(RC,{}))}),n.jsx(Ie,{path:"/on-demand/single",element:Ct(n.jsx(qC,{}))}),n.jsx(Ie,{path:"/on-demand/batch",element:Ct(n.jsx(QC,{}))}),n.jsx(Ie,{path:"/on-demand/batch/:id",element:Ct(n.jsx($C,{}))}),n.jsx(Ie,{path:"/information",element:Ct(n.jsx(Ug,{}))}),n.jsx(Ie,{path:"/information/:recordId",element:Ct(n.jsx(Qg,{}))}),n.jsx(Ie,{path:"/outputs",element:Ct(n.jsx(Ug,{}))}),n.jsx(Ie,{path:"/outputs/:recordId",element:Ct(n.jsx(Qg,{}))}),n.jsx(Ie,{path:"/journal",element:Ct(n.jsx(YN,{}))}),n.jsx(Ie,{path:"/journal/:id",element:Ct(n.jsx(F1,{}))}),n.jsx(Ie,{path:"/pipelines",element:Ct(n.jsx(ef,{}))}),n.jsx(Ie,{path:"/pipelines/entity/:entityName",element:Ct(n.jsx(ef,{}))}),n.jsx(Ie,{path:"/pipelines/:graphId",element:Ct(n.jsx(ef,{}))}),n.jsx(Ie,{path:"/items/:itemId",element:Ct(n.jsx(tC,{}))}),n.jsx(Ie,{path:"/records",element:n.jsx(va,{to:"/information",replace:!0})}),n.jsx(Ie,{path:"/records/:recordId",element:n.jsx(va,{to:"/information",replace:!0})}),n.jsx(Ie,{path:"/runs",element:n.jsx(va,{to:"/journal",replace:!0})}),n.jsx(Ie,{path:"/runs/:id",element:n.jsx(va,{to:"/journal",replace:!0})}),n.jsx(Ie,{path:"/sources",element:n.jsx(va,{to:"/information",replace:!0})}),n.jsx(Ie,{path:"/job-defs",element:n.jsx(va,{to:"/work",replace:!0})}),n.jsx(Ie,{path:"/job-defs/:id",element:n.jsx(va,{to:"/work",replace:!0})}),n.jsx(Ie,{path:"/jobs/new",element:n.jsx(va,{to:"/on-demand",replace:!0})}),n.jsx(Ie,{path:"*",element:n.jsx(va,{to:"/",replace:!0})})]})})]})})}const Rx=S.createContext(null);async function Pc(a,s){return fetch(`/api/auth/${a}`,{credentials:"include",headers:{"Content-Type":"application/json"},...s})}async function Kg(){try{const a=await fetch("/api/config",{credentials:"include"});return a.ok?(await a.json()).authRequired!==!0:!1}catch{return!1}}function hE({children:a}){const[s,r]=S.useState("loading"),[c,u]=S.useState(null),[f,h]=S.useState(!1),[m,p]=S.useState("Exellix"),[g,x]=S.useState(null),[v,N]=S.useState(null),[j,E]=S.useState(!1),C=S.useRef(s);C.current=s;const A=S.useCallback(async()=>{try{const z=await Pc("me");if(!z.ok){if(z.status===404&&await Kg()){u(null),h(!0),x("disabled"),r("authenticated");return}u(null),r("anonymous");return}const q=await z.json();u(q.user),h(!!q.authDisabled),E(!1),r("authenticated")}catch{u(null),r("anonymous")}},[]),O=S.useCallback(async(z,q)=>{const V=await Pc("login",{method:"POST",body:JSON.stringify({username:z,password:q})});if(!V.ok){const I=await V.json().catch(()=>({}));throw new Error(I.error??"Login failed")}const Z=await V.json();u(Z.user),h(!!Z.authDisabled),r("authenticated")},[]),Q=S.useCallback(async()=>{if(g==="sso"){window.location.assign("/api/auth/sso/logout");return}await Pc("logout",{method:"POST"}).catch(()=>{}),u(null),E(!0),r("anonymous")},[g]);S.useEffect(()=>{let z=!1;return(async()=>{try{const q=await Pc("mode");if(!q.ok){if(q.status===404&&await Kg()){if(z)return;x("disabled"),h(!0),r("authenticated")}return}const V=await q.json();if(z)return;x(V.mode),N(V.loginUrl??null)}catch{}})(),()=>{z=!0}},[]),S.useEffect(()=>{let z=!1;return fetch("/api/config",{credentials:"include"}).then(q=>q.ok?q.json():null).then(q=>{z||!(q!=null&&q.name)||p(q.name)}).catch(()=>{}),()=>{z=!0}},[]),S.useEffect(()=>{const z=window.fetch;return window.fetch=async(...q)=>{const V=await z(...q);try{const Z=typeof q[0]=="string"?q[0]:q[0].toString(),I=Z.startsWith("http")?new URL(Z).pathname:Z;V.status===401&&I.startsWith("/api/")&&!I.startsWith("/api/auth/")&&C.current==="authenticated"&&(u(null),r("anonymous"))}catch{}return V},()=>{window.fetch=z}},[]),S.useEffect(()=>{if(!(typeof window>"u")&&/[?&]signed_out=1\b/.test(window.location.search)){E(!0);const z=new URL(window.location.href);z.searchParams.delete("signed_out"),window.history.replaceState({},"",z.pathname+z.search+z.hash)}},[]),S.useEffect(()=>{A()},[A]);const B=S.useMemo(()=>({status:s,user:c,authDisabled:f,brandName:m,mode:g,loginUrl:v,loggedOut:j,login:O,logout:Q}),[s,c,f,m,g,v,j,O,Q]);return n.jsx(Rx.Provider,{value:B,children:a})}function Jf(){const a=S.useContext(Rx);if(!a)throw new Error("useAuth must be used within an AuthProvider");return a}function vo({name:a}){return n.jsxs("div",{className:"jx-login-brand",children:[n.jsx("span",{className:"jx-login-brand-icon",children:"◆"}),n.jsxs("span",{children:[n.jsx("strong",{children:a})," Jobs"]})]})}function mE({loginUrl:a,brandName:s}){return S.useEffect(()=>{window.location.assign(a)},[a]),n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(vo,{name:s}),n.jsx("div",{className:"jx-login-spinner","aria-hidden":"true"}),n.jsx("p",{className:"jx-login-sub",role:"status","aria-live":"polite",children:"Redirecting to single sign-on…"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",s]})]})})}function pE({loginUrl:a,brandName:s}){return n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(vo,{name:s}),n.jsx("p",{className:"jx-login-sub",children:"You've been signed out."}),n.jsx("a",{className:"jx-login-btn",href:`${a}?prompt=login`,children:"Sign in with SSO"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",s]})]})})}function yE({brandName:a}){const{login:s}=Jf(),[r,c]=S.useState(""),[u,f]=S.useState(""),[h,m]=S.useState(null),[p,g]=S.useState(!1);async function x(v){v.preventDefault(),m(null),g(!0);try{await s(r.trim(),u)}catch(N){m(N instanceof Error?N.message:"Login failed")}finally{g(!1)}}return n.jsx("div",{className:"jx-login-shell",children:n.jsxs("form",{className:"jx-login-card",onSubmit:x,children:[n.jsx(vo,{name:a}),n.jsx("p",{className:"jx-login-sub",children:"Sign in with your operator credentials to continue."}),n.jsxs("label",{className:"jx-login-field",children:["Username",n.jsx("input",{type:"text",autoComplete:"username",value:r,onChange:v=>c(v.target.value),autoFocus:!0,required:!0})]}),n.jsxs("label",{className:"jx-login-field",children:["Password",n.jsx("input",{type:"password",autoComplete:"current-password",value:u,onChange:v=>f(v.target.value),required:!0})]}),h?n.jsx("div",{className:"jx-login-error",children:h}):null,n.jsx("button",{type:"submit",className:"jx-login-btn",disabled:p||!r||!u,children:p?"Signing in…":"Sign in"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",a]})]})})}function gE(){const{mode:a,loginUrl:s,loggedOut:r,brandName:c}=Jf();return a==="sso"&&s?r?n.jsx(pE,{loginUrl:s,brandName:c}):n.jsx(mE,{loginUrl:s,brandName:c}):a===null?n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(vo,{name:c}),n.jsx("div",{className:"jx-login-spinner","aria-hidden":"true"}),n.jsx("p",{className:"jx-login-sub",role:"status","aria-live":"polite",children:"Connecting to sign-in service…"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",c]})]})}):a==="disabled"?null:n.jsx(yE,{brandName:c})}const vE=new O0({defaultOptions:{queries:{retry:1,staleTime:2e3}}});function xE(){const{status:a,authDisabled:s,user:r,logout:c}=Jf();return a==="loading"?n.jsx("div",{className:"jx-auth-splash",children:"Loading…"}):a==="anonymous"?n.jsx(gE,{}):n.jsxs(n.Fragment,{children:[n.jsx(rE,{children:n.jsx(K0,{storageKey:"exellix-memorix-ui.selected-agent",children:n.jsx(fE,{})})}),!s&&n.jsxs("button",{type:"button",className:"jx-logout-btn",onClick:()=>void c(),title:r!=null&&r.displayName?`Signed in as ${r.displayName}`:"Sign out",children:["Sign out",r!=null&&r.displayName?` · ${r.displayName}`:""]})]})}const Ax=document.getElementById("root");if(!Ax)throw new Error("No #root element");a0.createRoot(Ax).render(n.jsx(S.StrictMode,{children:n.jsx(M0,{client:vE,children:n.jsx(hE,{children:n.jsx(xE,{})})})}));
|