@useorgx/openclaw-plugin 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +48 -1
  2. package/dashboard/dist/assets/index-BjqNjHpY.css +1 -0
  3. package/dashboard/dist/assets/index-DCLkU4AM.js +57 -0
  4. package/dashboard/dist/index.html +2 -2
  5. package/dist/adapters/outbox.d.ts +8 -0
  6. package/dist/adapters/outbox.d.ts.map +1 -0
  7. package/dist/adapters/outbox.js +6 -0
  8. package/dist/adapters/outbox.js.map +1 -0
  9. package/dist/agent-context-store.d.ts +24 -0
  10. package/dist/agent-context-store.d.ts.map +1 -0
  11. package/dist/agent-context-store.js +110 -0
  12. package/dist/agent-context-store.js.map +1 -0
  13. package/dist/agent-run-store.d.ts +31 -0
  14. package/dist/agent-run-store.d.ts.map +1 -0
  15. package/dist/agent-run-store.js +158 -0
  16. package/dist/agent-run-store.js.map +1 -0
  17. package/dist/api.d.ts +4 -139
  18. package/dist/api.d.ts.map +1 -1
  19. package/dist/api.js +4 -347
  20. package/dist/api.js.map +1 -1
  21. package/dist/auth-store.d.ts.map +1 -1
  22. package/dist/auth-store.js +27 -1
  23. package/dist/auth-store.js.map +1 -1
  24. package/dist/byok-store.d.ts +11 -0
  25. package/dist/byok-store.d.ts.map +1 -0
  26. package/dist/byok-store.js +94 -0
  27. package/dist/byok-store.js.map +1 -0
  28. package/dist/contracts/client.d.ts +154 -0
  29. package/dist/contracts/client.d.ts.map +1 -0
  30. package/dist/contracts/client.js +422 -0
  31. package/dist/contracts/client.js.map +1 -0
  32. package/dist/contracts/types.d.ts +430 -0
  33. package/dist/contracts/types.d.ts.map +1 -0
  34. package/dist/contracts/types.js +8 -0
  35. package/dist/contracts/types.js.map +1 -0
  36. package/dist/http-handler.d.ts +10 -1
  37. package/dist/http-handler.d.ts.map +1 -1
  38. package/dist/http-handler.js +2256 -98
  39. package/dist/http-handler.js.map +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +348 -24
  42. package/dist/index.js.map +1 -1
  43. package/dist/local-openclaw.d.ts.map +1 -1
  44. package/dist/local-openclaw.js +57 -15
  45. package/dist/local-openclaw.js.map +1 -1
  46. package/dist/openclaw.plugin.json +3 -3
  47. package/dist/outbox.d.ts +7 -0
  48. package/dist/outbox.d.ts.map +1 -1
  49. package/dist/outbox.js +94 -6
  50. package/dist/outbox.js.map +1 -1
  51. package/dist/snapshot-store.d.ts +10 -0
  52. package/dist/snapshot-store.d.ts.map +1 -0
  53. package/dist/snapshot-store.js +64 -0
  54. package/dist/snapshot-store.js.map +1 -0
  55. package/dist/types.d.ts +5 -410
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/types.js +5 -4
  58. package/dist/types.js.map +1 -1
  59. package/openclaw.plugin.json +3 -3
  60. package/package.json +13 -3
  61. package/dashboard/dist/assets/index-BrAP-X_H.css +0 -1
  62. package/dashboard/dist/assets/index-cOk6qwh-.js +0 -56
@@ -0,0 +1,57 @@
1
+ var om=e=>{throw TypeError(e)};var Cu=(e,n,s)=>n.has(e)||om("Cannot "+s);var D=(e,n,s)=>(Cu(e,n,"read from private field"),s?s.call(e):n.get(e)),Ee=(e,n,s)=>n.has(e)?om("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,s),ye=(e,n,s,a)=>(Cu(e,n,"write to private field"),a?a.call(e,s):n.set(e,s),s),Le=(e,n,s)=>(Cu(e,n,"access private method"),s);var al=(e,n,s,a)=>({set _(l){ye(e,n,l,s)},get _(){return D(e,n,a)}});(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function a(l){if(l.ep)return;l.ep=!0;const u=s(l);fetch(l.href,u)}})();var Au={exports:{}},vo={},Eu={exports:{}},Re={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var am;function Aw(){if(am)return Re;am=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function v(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,S={};function j(N,z,fe){this.props=N,this.context=z,this.refs=S,this.updater=fe||k}j.prototype.isReactComponent={},j.prototype.setState=function(N,z){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,z,"setState")},j.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function F(){}F.prototype=j.prototype;function _(N,z,fe){this.props=N,this.context=z,this.refs=S,this.updater=fe||k}var A=_.prototype=new F;A.constructor=_,E(A,j.prototype),A.isPureReactComponent=!0;var P=Array.isArray,M=Object.prototype.hasOwnProperty,C={current:null},B={key:!0,ref:!0,__self:!0,__source:!0};function R(N,z,fe){var se,xe={},de=null,ge=null;if(z!=null)for(se in z.ref!==void 0&&(ge=z.ref),z.key!==void 0&&(de=""+z.key),z)M.call(z,se)&&!B.hasOwnProperty(se)&&(xe[se]=z[se]);var ae=arguments.length-2;if(ae===1)xe.children=fe;else if(1<ae){for(var _e=Array(ae),Ue=0;Ue<ae;Ue++)_e[Ue]=arguments[Ue+2];xe.children=_e}if(N&&N.defaultProps)for(se in ae=N.defaultProps,ae)xe[se]===void 0&&(xe[se]=ae[se]);return{$$typeof:e,type:N,key:de,ref:ge,props:xe,_owner:C.current}}function G(N,z){return{$$typeof:e,type:N.type,key:z,ref:N.ref,props:N.props,_owner:N._owner}}function he(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function $(N){var z={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(fe){return z[fe]})}var ie=/\/+/g;function W(N,z){return typeof N=="object"&&N!==null&&N.key!=null?$(""+N.key):z.toString(36)}function H(N,z,fe,se,xe){var de=typeof N;(de==="undefined"||de==="boolean")&&(N=null);var ge=!1;if(N===null)ge=!0;else switch(de){case"string":case"number":ge=!0;break;case"object":switch(N.$$typeof){case e:case n:ge=!0}}if(ge)return ge=N,xe=xe(ge),N=se===""?"."+W(ge,0):se,P(xe)?(fe="",N!=null&&(fe=N.replace(ie,"$&/")+"/"),H(xe,z,fe,"",function(Ue){return Ue})):xe!=null&&(he(xe)&&(xe=G(xe,fe+(!xe.key||ge&&ge.key===xe.key?"":(""+xe.key).replace(ie,"$&/")+"/")+N)),z.push(xe)),1;if(ge=0,se=se===""?".":se+":",P(N))for(var ae=0;ae<N.length;ae++){de=N[ae];var _e=se+W(de,ae);ge+=H(de,z,fe,_e,xe)}else if(_e=v(N),typeof _e=="function")for(N=_e.call(N),ae=0;!(de=N.next()).done;)de=de.value,_e=se+W(de,ae++),ge+=H(de,z,fe,_e,xe);else if(de==="object")throw z=String(N),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return ge}function L(N,z,fe){if(N==null)return N;var se=[],xe=0;return H(N,se,"","",function(de){return z.call(fe,de,xe++)}),se}function X(N){if(N._status===-1){var z=N._result;z=z(),z.then(function(fe){(N._status===0||N._status===-1)&&(N._status=1,N._result=fe)},function(fe){(N._status===0||N._status===-1)&&(N._status=2,N._result=fe)}),N._status===-1&&(N._status=0,N._result=z)}if(N._status===1)return N._result.default;throw N._result}var te={current:null},Y={transition:null},Z={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:Y,ReactCurrentOwner:C};function V(){throw Error("act(...) is not supported in production builds of React.")}return Re.Children={map:L,forEach:function(N,z,fe){L(N,function(){z.apply(this,arguments)},fe)},count:function(N){var z=0;return L(N,function(){z++}),z},toArray:function(N){return L(N,function(z){return z})||[]},only:function(N){if(!he(N))throw Error("React.Children.only expected to receive a single React element child.");return N}},Re.Component=j,Re.Fragment=s,Re.Profiler=l,Re.PureComponent=_,Re.StrictMode=a,Re.Suspense=m,Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,Re.act=V,Re.cloneElement=function(N,z,fe){if(N==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+N+".");var se=E({},N.props),xe=N.key,de=N.ref,ge=N._owner;if(z!=null){if(z.ref!==void 0&&(de=z.ref,ge=C.current),z.key!==void 0&&(xe=""+z.key),N.type&&N.type.defaultProps)var ae=N.type.defaultProps;for(_e in z)M.call(z,_e)&&!B.hasOwnProperty(_e)&&(se[_e]=z[_e]===void 0&&ae!==void 0?ae[_e]:z[_e])}var _e=arguments.length-2;if(_e===1)se.children=fe;else if(1<_e){ae=Array(_e);for(var Ue=0;Ue<_e;Ue++)ae[Ue]=arguments[Ue+2];se.children=ae}return{$$typeof:e,type:N.type,key:xe,ref:de,props:se,_owner:ge}},Re.createContext=function(N){return N={$$typeof:d,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},N.Provider={$$typeof:u,_context:N},N.Consumer=N},Re.createElement=R,Re.createFactory=function(N){var z=R.bind(null,N);return z.type=N,z},Re.createRef=function(){return{current:null}},Re.forwardRef=function(N){return{$$typeof:f,render:N}},Re.isValidElement=he,Re.lazy=function(N){return{$$typeof:g,_payload:{_status:-1,_result:N},_init:X}},Re.memo=function(N,z){return{$$typeof:x,type:N,compare:z===void 0?null:z}},Re.startTransition=function(N){var z=Y.transition;Y.transition={};try{N()}finally{Y.transition=z}},Re.unstable_act=V,Re.useCallback=function(N,z){return te.current.useCallback(N,z)},Re.useContext=function(N){return te.current.useContext(N)},Re.useDebugValue=function(){},Re.useDeferredValue=function(N){return te.current.useDeferredValue(N)},Re.useEffect=function(N,z){return te.current.useEffect(N,z)},Re.useId=function(){return te.current.useId()},Re.useImperativeHandle=function(N,z,fe){return te.current.useImperativeHandle(N,z,fe)},Re.useInsertionEffect=function(N,z){return te.current.useInsertionEffect(N,z)},Re.useLayoutEffect=function(N,z){return te.current.useLayoutEffect(N,z)},Re.useMemo=function(N,z){return te.current.useMemo(N,z)},Re.useReducer=function(N,z,fe){return te.current.useReducer(N,z,fe)},Re.useRef=function(N){return te.current.useRef(N)},Re.useState=function(N){return te.current.useState(N)},Re.useSyncExternalStore=function(N,z,fe){return te.current.useSyncExternalStore(N,z,fe)},Re.useTransition=function(){return te.current.useTransition()},Re.version="18.3.1",Re}var lm;function Bd(){return lm||(lm=1,Eu.exports=Aw()),Eu.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var cm;function Ew(){if(cm)return vo;cm=1;var e=Bd(),n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function d(f,m,x){var g,y={},v=null,k=null;x!==void 0&&(v=""+x),m.key!==void 0&&(v=""+m.key),m.ref!==void 0&&(k=m.ref);for(g in m)a.call(m,g)&&!u.hasOwnProperty(g)&&(y[g]=m[g]);if(f&&f.defaultProps)for(g in m=f.defaultProps,m)y[g]===void 0&&(y[g]=m[g]);return{$$typeof:n,type:f,key:v,ref:k,props:y,_owner:l.current}}return vo.Fragment=s,vo.jsx=d,vo.jsxs=d,vo}var um;function Tw(){return um||(um=1,Au.exports=Ew()),Au.exports}var i=Tw(),b=Bd(),ll={},Tu={exports:{}},Ht={},Pu={exports:{}},Mu={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var dm;function Pw(){return dm||(dm=1,(function(e){function n(Y,Z){var V=Y.length;Y.push(Z);e:for(;0<V;){var N=V-1>>>1,z=Y[N];if(0<l(z,Z))Y[N]=Z,Y[V]=z,V=N;else break e}}function s(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var Z=Y[0],V=Y.pop();if(V!==Z){Y[0]=V;e:for(var N=0,z=Y.length,fe=z>>>1;N<fe;){var se=2*(N+1)-1,xe=Y[se],de=se+1,ge=Y[de];if(0>l(xe,V))de<z&&0>l(ge,xe)?(Y[N]=ge,Y[de]=V,N=de):(Y[N]=xe,Y[se]=V,N=se);else if(de<z&&0>l(ge,V))Y[N]=ge,Y[de]=V,N=de;else break e}}return Z}function l(Y,Z){var V=Y.sortIndex-Z.sortIndex;return V!==0?V:Y.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],x=[],g=1,y=null,v=3,k=!1,E=!1,S=!1,j=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(Y){for(var Z=s(x);Z!==null;){if(Z.callback===null)a(x);else if(Z.startTime<=Y)a(x),Z.sortIndex=Z.expirationTime,n(m,Z);else break;Z=s(x)}}function P(Y){if(S=!1,A(Y),!E)if(s(m)!==null)E=!0,X(M);else{var Z=s(x);Z!==null&&te(P,Z.startTime-Y)}}function M(Y,Z){E=!1,S&&(S=!1,F(R),R=-1),k=!0;var V=v;try{for(A(Z),y=s(m);y!==null&&(!(y.expirationTime>Z)||Y&&!$());){var N=y.callback;if(typeof N=="function"){y.callback=null,v=y.priorityLevel;var z=N(y.expirationTime<=Z);Z=e.unstable_now(),typeof z=="function"?y.callback=z:y===s(m)&&a(m),A(Z)}else a(m);y=s(m)}if(y!==null)var fe=!0;else{var se=s(x);se!==null&&te(P,se.startTime-Z),fe=!1}return fe}finally{y=null,v=V,k=!1}}var C=!1,B=null,R=-1,G=5,he=-1;function $(){return!(e.unstable_now()-he<G)}function ie(){if(B!==null){var Y=e.unstable_now();he=Y;var Z=!0;try{Z=B(!0,Y)}finally{Z?W():(C=!1,B=null)}}else C=!1}var W;if(typeof _=="function")W=function(){_(ie)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,L=H.port2;H.port1.onmessage=ie,W=function(){L.postMessage(null)}}else W=function(){j(ie,0)};function X(Y){B=Y,C||(C=!0,W())}function te(Y,Z){R=j(function(){Y(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){E||k||(E=!0,X(M))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return s(m)},e.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var Z=3;break;default:Z=v}var V=v;v=Z;try{return Y()}finally{v=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,Z){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var V=v;v=Y;try{return Z()}finally{v=V}},e.unstable_scheduleCallback=function(Y,Z,V){var N=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?N+V:N):V=N,Y){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=V+z,Y={id:g++,callback:Z,priorityLevel:Y,startTime:V,expirationTime:z,sortIndex:-1},V>N?(Y.sortIndex=V,n(x,Y),s(m)===null&&Y===s(x)&&(S?(F(R),R=-1):S=!0,te(P,V-N))):(Y.sortIndex=z,n(m,Y),E||k||(E=!0,X(M))),Y},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(Y){var Z=v;return function(){var V=v;v=Z;try{return Y.apply(this,arguments)}finally{v=V}}}})(Mu)),Mu}var hm;function Mw(){return hm||(hm=1,Pu.exports=Pw()),Pu.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var fm;function Fw(){if(fm)return Ht;fm=1;var e=Bd(),n=Mw();function s(t){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,l={};function u(t,r){d(t,r),d(t+"Capture",r)}function d(t,r){for(l[t]=r,t=0;t<r.length;t++)a.add(r[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,x=/^[: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]*$/,g={},y={};function v(t){return m.call(y,t)?!0:m.call(g,t)?!1:x.test(t)?y[t]=!0:(g[t]=!0,!1)}function k(t,r,o,c){if(o!==null&&o.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function E(t,r,o,c){if(r===null||typeof r>"u"||k(t,r,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function S(t,r,o,c,h,p,w){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=c,this.attributeNamespace=h,this.mustUseProperty=o,this.propertyName=t,this.type=r,this.sanitizeURL=p,this.removeEmptyString=w}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){j[t]=new S(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var r=t[0];j[r]=new S(r,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){j[t]=new S(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){j[t]=new S(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){j[t]=new S(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){j[t]=new S(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){j[t]=new S(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){j[t]=new S(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){j[t]=new S(t,5,!1,t.toLowerCase(),null,!1,!1)});var F=/[\-:]([a-z])/g;function _(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var r=t.replace(F,_);j[r]=new S(r,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var r=t.replace(F,_);j[r]=new S(r,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var r=t.replace(F,_);j[r]=new S(r,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){j[t]=new S(t,1,!1,t.toLowerCase(),null,!1,!1)}),j.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){j[t]=new S(t,1,!1,t.toLowerCase(),null,!0,!0)});function A(t,r,o,c){var h=j.hasOwnProperty(r)?j[r]:null;(h!==null?h.type!==0:c||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(E(r,o,h,c)&&(o=null),c||h===null?v(r)&&(o===null?t.removeAttribute(r):t.setAttribute(r,""+o)):h.mustUseProperty?t[h.propertyName]=o===null?h.type===3?!1:"":o:(r=h.attributeName,c=h.attributeNamespace,o===null?t.removeAttribute(r):(h=h.type,o=h===3||h===4&&o===!0?"":""+o,c?t.setAttributeNS(c,r,o):t.setAttribute(r,o))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),C=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),he=Symbol.for("react.provider"),$=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),Y=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=Y&&t[Y]||t["@@iterator"],typeof t=="function"?t:null)}var V=Object.assign,N;function z(t){if(N===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);N=r&&r[1]||""}return`
34
+ `+N+t}var fe=!1;function se(t,r){if(!t||fe)return"";fe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(Q){var c=Q}Reflect.construct(t,[],r)}else{try{r.call()}catch(Q){c=Q}t.call(r.prototype)}else{try{throw Error()}catch(Q){c=Q}t()}}catch(Q){if(Q&&c&&typeof Q.stack=="string"){for(var h=Q.stack.split(`
35
+ `),p=c.stack.split(`
36
+ `),w=h.length-1,T=p.length-1;1<=w&&0<=T&&h[w]!==p[T];)T--;for(;1<=w&&0<=T;w--,T--)if(h[w]!==p[T]){if(w!==1||T!==1)do if(w--,T--,0>T||h[w]!==p[T]){var I=`
37
+ `+h[w].replace(" at new "," at ");return t.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",t.displayName)),I}while(1<=w&&0<=T);break}}}finally{fe=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?z(t):""}function xe(t){switch(t.tag){case 5:return z(t.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return t=se(t.type,!1),t;case 11:return t=se(t.type.render,!1),t;case 1:return t=se(t.type,!0),t;default:return""}}function de(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case B:return"Fragment";case C:return"Portal";case G:return"Profiler";case R:return"StrictMode";case W:return"Suspense";case H:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $:return(t.displayName||"Context")+".Consumer";case he:return(t._context.displayName||"Context")+".Provider";case ie:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return r=t.displayName||null,r!==null?r:de(t.type)||"Memo";case X:r=t._payload,t=t._init;try{return de(t(r))}catch{}}return null}function ge(t){var r=t.type;switch(t.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=r.render,t=t.displayName||t.name||"",r.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(r);case 8:return r===R?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function ae(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function _e(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Ue(t){var r=_e(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,r),c=""+t[r];if(!t.hasOwnProperty(r)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return h.call(this)},set:function(w){c=""+w,p.call(this,w)}}),Object.defineProperty(t,r,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function ee(t){t._valueTracker||(t._valueTracker=Ue(t))}function Ce(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var o=r.getValue(),c="";return t&&(c=_e(t)?t.checked?"true":"false":t.value),t=c,t!==o?(r.setValue(t),!0):!1}function De(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Te(t,r){var o=r.checked;return V({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function Ze(t,r){var o=r.defaultValue==null?"":r.defaultValue,c=r.checked!=null?r.checked:r.defaultChecked;o=ae(r.value!=null?r.value:o),t._wrapperState={initialChecked:c,initialValue:o,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function Ge(t,r){r=r.checked,r!=null&&A(t,"checked",r,!1)}function yn(t,r){Ge(t,r);var o=ae(r.value),c=r.type;if(o!=null)c==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(c==="submit"||c==="reset"){t.removeAttribute("value");return}r.hasOwnProperty("value")?Kn(t,r.type,o):r.hasOwnProperty("defaultValue")&&Kn(t,r.type,ae(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(t.defaultChecked=!!r.defaultChecked)}function sn(t,r,o){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var c=r.type;if(!(c!=="submit"&&c!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+t._wrapperState.initialValue,o||r===t.value||(t.value=r),t.defaultValue=r}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Kn(t,r,o){(r!=="number"||De(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var gt=Array.isArray;function re(t,r,o,c){if(t=t.options,r){r={};for(var h=0;h<o.length;h++)r["$"+o[h]]=!0;for(o=0;o<t.length;o++)h=r.hasOwnProperty("$"+t[o].value),t[o].selected!==h&&(t[o].selected=h),h&&c&&(t[o].defaultSelected=!0)}else{for(o=""+ae(o),r=null,h=0;h<t.length;h++){if(t[h].value===o){t[h].selected=!0,c&&(t[h].defaultSelected=!0);return}r!==null||t[h].disabled||(r=t[h])}r!==null&&(r.selected=!0)}}function ne(t,r){if(r.dangerouslySetInnerHTML!=null)throw Error(s(91));return V({},r,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function ve(t,r){var o=r.value;if(o==null){if(o=r.children,r=r.defaultValue,o!=null){if(r!=null)throw Error(s(92));if(gt(o)){if(1<o.length)throw Error(s(93));o=o[0]}r=o}r==null&&(r=""),o=r}t._wrapperState={initialValue:ae(o)}}function Ae(t,r){var o=ae(r.value),c=ae(r.defaultValue);o!=null&&(o=""+o,o!==t.value&&(t.value=o),r.defaultValue==null&&t.defaultValue!==o&&(t.defaultValue=o)),c!=null&&(t.defaultValue=""+c)}function Xe(t){var r=t.textContent;r===t._wrapperState.initialValue&&r!==""&&r!==null&&(t.value=r)}function yt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function vt(t,r){return t==null||t==="http://www.w3.org/1999/xhtml"?yt(r):t==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vn,Mn=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,o,c,h){MSApp.execUnsafeLocalFunction(function(){return t(r,o,c,h)})}:t})(function(t,r){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=r;else{for(vn=vn||document.createElement("div"),vn.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=vn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;r.firstChild;)t.appendChild(r.firstChild)}});function Nt(t,r){if(r){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=r;return}}t.textContent=r}var Fn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Is=["Webkit","ms","Moz","O"];Object.keys(Fn).forEach(function(t){Is.forEach(function(r){r=r+t.charAt(0).toUpperCase()+t.substring(1),Fn[r]=Fn[t]})});function Gr(t,r,o){return r==null||typeof r=="boolean"||r===""?"":o||typeof r!="number"||r===0||Fn.hasOwnProperty(t)&&Fn[t]?(""+r).trim():r+"px"}function _s(t,r){t=t.style;for(var o in r)if(r.hasOwnProperty(o)){var c=o.indexOf("--")===0,h=Gr(o,r[o],c);o==="float"&&(o="cssFloat"),c?t.setProperty(o,h):t[o]=h}}var Li=V({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fr(t,r){if(r){if(Li[t]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(s(137,t));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(s(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(s(61))}if(r.style!=null&&typeof r.style!="object")throw Error(s(62))}}function Ls(t,r){if(t.indexOf("-")===-1)return typeof r.is=="string";switch(t){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 Xr=null;function Ri(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Oi=null,J=null,ke=null;function me(t){if(t=ro(t)){if(typeof Oi!="function")throw Error(s(280));var r=t.stateNode;r&&(r=ka(r),Oi(t.stateNode,t.type,r))}}function le(t){J?ke?ke.push(t):ke=[t]:J=t}function Be(){if(J){var t=J,r=ke;if(ke=J=null,me(t),r)for(t=0;t<r.length;t++)me(r[t])}}function Ve(t,r){return t(r)}function St(){}var $e=!1;function Tt(t,r,o){if($e)return t(r,o);$e=!0;try{return Ve(t,r,o)}finally{$e=!1,(J!==null||ke!==null)&&(St(),Be())}}function Xt(t,r){var o=t.stateNode;if(o===null)return null;var c=ka(o);if(c===null)return null;o=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(s(231,r,typeof o));return o}var Yr=!1;if(f)try{var Hn={};Object.defineProperty(Hn,"passive",{get:function(){Yr=!0}}),window.addEventListener("test",Hn,Hn),window.removeEventListener("test",Hn,Hn)}catch{Yr=!1}function Rs(t,r,o,c,h,p,w,T,I){var Q=Array.prototype.slice.call(arguments,3);try{r.apply(o,Q)}catch(ce){this.onError(ce)}}var Qn=!1,ea=null,ta=!1,Kl=null,Iy={onError:function(t){Qn=!0,ea=t}};function _y(t,r,o,c,h,p,w,T,I){Qn=!1,ea=null,Rs.apply(Iy,arguments)}function Ly(t,r,o,c,h,p,w,T,I){if(_y.apply(this,arguments),Qn){if(Qn){var Q=ea;Qn=!1,ea=null}else throw Error(s(198));ta||(ta=!0,Kl=Q)}}function Zr(t){var r=t,o=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(o=r.return),t=r.return;while(t)}return r.tag===3?o:null}function Eh(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function Th(t){if(Zr(t)!==t)throw Error(s(188))}function Ry(t){var r=t.alternate;if(!r){if(r=Zr(t),r===null)throw Error(s(188));return r!==t?null:t}for(var o=t,c=r;;){var h=o.return;if(h===null)break;var p=h.alternate;if(p===null){if(c=h.return,c!==null){o=c;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===o)return Th(h),t;if(p===c)return Th(h),r;p=p.sibling}throw Error(s(188))}if(o.return!==c.return)o=h,c=p;else{for(var w=!1,T=h.child;T;){if(T===o){w=!0,o=h,c=p;break}if(T===c){w=!0,c=h,o=p;break}T=T.sibling}if(!w){for(T=p.child;T;){if(T===o){w=!0,o=p,c=h;break}if(T===c){w=!0,c=p,o=h;break}T=T.sibling}if(!w)throw Error(s(189))}}if(o.alternate!==c)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?t:r}function Ph(t){return t=Ry(t),t!==null?Mh(t):null}function Mh(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var r=Mh(t);if(r!==null)return r;t=t.sibling}return null}var Fh=n.unstable_scheduleCallback,Dh=n.unstable_cancelCallback,Oy=n.unstable_shouldYield,By=n.unstable_requestPaint,ct=n.unstable_now,$y=n.unstable_getCurrentPriorityLevel,Hl=n.unstable_ImmediatePriority,Ih=n.unstable_UserBlockingPriority,na=n.unstable_NormalPriority,Vy=n.unstable_LowPriority,_h=n.unstable_IdlePriority,ra=null,Dn=null;function zy(t){if(Dn&&typeof Dn.onCommitFiberRoot=="function")try{Dn.onCommitFiberRoot(ra,t,void 0,(t.current.flags&128)===128)}catch{}}var wn=Math.clz32?Math.clz32:Ky,Uy=Math.log,Wy=Math.LN2;function Ky(t){return t>>>=0,t===0?32:31-(Uy(t)/Wy|0)|0}var sa=64,ia=4194304;function Bi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function oa(t,r){var o=t.pendingLanes;if(o===0)return 0;var c=0,h=t.suspendedLanes,p=t.pingedLanes,w=o&268435455;if(w!==0){var T=w&~h;T!==0?c=Bi(T):(p&=w,p!==0&&(c=Bi(p)))}else w=o&~h,w!==0?c=Bi(w):p!==0&&(c=Bi(p));if(c===0)return 0;if(r!==0&&r!==c&&(r&h)===0&&(h=c&-c,p=r&-r,h>=p||h===16&&(p&4194240)!==0))return r;if((c&4)!==0&&(c|=o&16),r=t.entangledLanes,r!==0)for(t=t.entanglements,r&=c;0<r;)o=31-wn(r),h=1<<o,c|=t[o],r&=~h;return c}function Hy(t,r){switch(t){case 1:case 2:case 4:return r+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qy(t,r){for(var o=t.suspendedLanes,c=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes;0<p;){var w=31-wn(p),T=1<<w,I=h[w];I===-1?((T&o)===0||(T&c)!==0)&&(h[w]=Hy(T,r)):I<=r&&(t.expiredLanes|=T),p&=~T}}function Ql(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Lh(){var t=sa;return sa<<=1,(sa&4194240)===0&&(sa=64),t}function ql(t){for(var r=[],o=0;31>o;o++)r.push(t);return r}function $i(t,r,o){t.pendingLanes|=r,r!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,r=31-wn(r),t[r]=o}function qy(t,r){var o=t.pendingLanes&~r;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=r,t.mutableReadLanes&=r,t.entangledLanes&=r,r=t.entanglements;var c=t.eventTimes;for(t=t.expirationTimes;0<o;){var h=31-wn(o),p=1<<h;r[h]=0,c[h]=-1,t[h]=-1,o&=~p}}function Gl(t,r){var o=t.entangledLanes|=r;for(t=t.entanglements;o;){var c=31-wn(o),h=1<<c;h&r|t[c]&r&&(t[c]|=r),o&=~h}}var qe=0;function Rh(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Oh,Xl,Bh,$h,Vh,Yl=!1,aa=[],pr=null,mr=null,xr=null,Vi=new Map,zi=new Map,gr=[],Gy="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function zh(t,r){switch(t){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":xr=null;break;case"pointerover":case"pointerout":Vi.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":zi.delete(r.pointerId)}}function Ui(t,r,o,c,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:r,domEventName:o,eventSystemFlags:c,nativeEvent:p,targetContainers:[h]},r!==null&&(r=ro(r),r!==null&&Xl(r)),t):(t.eventSystemFlags|=c,r=t.targetContainers,h!==null&&r.indexOf(h)===-1&&r.push(h),t)}function Xy(t,r,o,c,h){switch(r){case"focusin":return pr=Ui(pr,t,r,o,c,h),!0;case"dragenter":return mr=Ui(mr,t,r,o,c,h),!0;case"mouseover":return xr=Ui(xr,t,r,o,c,h),!0;case"pointerover":var p=h.pointerId;return Vi.set(p,Ui(Vi.get(p)||null,t,r,o,c,h)),!0;case"gotpointercapture":return p=h.pointerId,zi.set(p,Ui(zi.get(p)||null,t,r,o,c,h)),!0}return!1}function Uh(t){var r=Jr(t.target);if(r!==null){var o=Zr(r);if(o!==null){if(r=o.tag,r===13){if(r=Eh(o),r!==null){t.blockedOn=r,Vh(t.priority,function(){Bh(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function la(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var o=Jl(t.domEventName,t.eventSystemFlags,r[0],t.nativeEvent);if(o===null){o=t.nativeEvent;var c=new o.constructor(o.type,o);Xr=c,o.target.dispatchEvent(c),Xr=null}else return r=ro(o),r!==null&&Xl(r),t.blockedOn=o,!1;r.shift()}return!0}function Wh(t,r,o){la(t)&&o.delete(r)}function Yy(){Yl=!1,pr!==null&&la(pr)&&(pr=null),mr!==null&&la(mr)&&(mr=null),xr!==null&&la(xr)&&(xr=null),Vi.forEach(Wh),zi.forEach(Wh)}function Wi(t,r){t.blockedOn===r&&(t.blockedOn=null,Yl||(Yl=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Yy)))}function Ki(t){function r(h){return Wi(h,t)}if(0<aa.length){Wi(aa[0],t);for(var o=1;o<aa.length;o++){var c=aa[o];c.blockedOn===t&&(c.blockedOn=null)}}for(pr!==null&&Wi(pr,t),mr!==null&&Wi(mr,t),xr!==null&&Wi(xr,t),Vi.forEach(r),zi.forEach(r),o=0;o<gr.length;o++)c=gr[o],c.blockedOn===t&&(c.blockedOn=null);for(;0<gr.length&&(o=gr[0],o.blockedOn===null);)Uh(o),o.blockedOn===null&&gr.shift()}var Os=P.ReactCurrentBatchConfig,ca=!0;function Zy(t,r,o,c){var h=qe,p=Os.transition;Os.transition=null;try{qe=1,Zl(t,r,o,c)}finally{qe=h,Os.transition=p}}function Jy(t,r,o,c){var h=qe,p=Os.transition;Os.transition=null;try{qe=4,Zl(t,r,o,c)}finally{qe=h,Os.transition=p}}function Zl(t,r,o,c){if(ca){var h=Jl(t,r,o,c);if(h===null)xc(t,r,c,ua,o),zh(t,c);else if(Xy(h,t,r,o,c))c.stopPropagation();else if(zh(t,c),r&4&&-1<Gy.indexOf(t)){for(;h!==null;){var p=ro(h);if(p!==null&&Oh(p),p=Jl(t,r,o,c),p===null&&xc(t,r,c,ua,o),p===h)break;h=p}h!==null&&c.stopPropagation()}else xc(t,r,c,null,o)}}var ua=null;function Jl(t,r,o,c){if(ua=null,t=Ri(c),t=Jr(t),t!==null)if(r=Zr(t),r===null)t=null;else if(o=r.tag,o===13){if(t=Eh(r),t!==null)return t;t=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null);return ua=t,null}function Kh(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($y()){case Hl:return 1;case Ih:return 4;case na:case Vy:return 16;case _h:return 536870912;default:return 16}default:return 16}}var yr=null,ec=null,da=null;function Hh(){if(da)return da;var t,r=ec,o=r.length,c,h="value"in yr?yr.value:yr.textContent,p=h.length;for(t=0;t<o&&r[t]===h[t];t++);var w=o-t;for(c=1;c<=w&&r[o-c]===h[p-c];c++);return da=h.slice(t,1<c?1-c:void 0)}function ha(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function fa(){return!0}function Qh(){return!1}function Yt(t){function r(o,c,h,p,w){this._reactName=o,this._targetInst=h,this.type=c,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var T in t)t.hasOwnProperty(T)&&(o=t[T],this[T]=o?o(p):p[T]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?fa:Qh,this.isPropagationStopped=Qh,this}return V(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=fa)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=fa)},persist:function(){},isPersistent:fa}),r}var Bs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tc=Yt(Bs),Hi=V({},Bs,{view:0,detail:0}),ev=Yt(Hi),nc,rc,Qi,pa=V({},Hi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ic,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Qi&&(Qi&&t.type==="mousemove"?(nc=t.screenX-Qi.screenX,rc=t.screenY-Qi.screenY):rc=nc=0,Qi=t),nc)},movementY:function(t){return"movementY"in t?t.movementY:rc}}),qh=Yt(pa),tv=V({},pa,{dataTransfer:0}),nv=Yt(tv),rv=V({},Hi,{relatedTarget:0}),sc=Yt(rv),sv=V({},Bs,{animationName:0,elapsedTime:0,pseudoElement:0}),iv=Yt(sv),ov=V({},Bs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),av=Yt(ov),lv=V({},Bs,{data:0}),Gh=Yt(lv),cv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uv={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"},dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hv(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=dv[t])?!!r[t]:!1}function ic(){return hv}var fv=V({},Hi,{key:function(t){if(t.key){var r=cv[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=ha(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?uv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ic,charCode:function(t){return t.type==="keypress"?ha(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ha(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),pv=Yt(fv),mv=V({},pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xh=Yt(mv),xv=V({},Hi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ic}),gv=Yt(xv),yv=V({},Bs,{propertyName:0,elapsedTime:0,pseudoElement:0}),vv=Yt(yv),wv=V({},pa,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),bv=Yt(wv),kv=[9,13,27,32],oc=f&&"CompositionEvent"in window,qi=null;f&&"documentMode"in document&&(qi=document.documentMode);var jv=f&&"TextEvent"in window&&!qi,Yh=f&&(!oc||qi&&8<qi&&11>=qi),Zh=" ",Jh=!1;function ef(t,r){switch(t){case"keyup":return kv.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var $s=!1;function Nv(t,r){switch(t){case"compositionend":return tf(r);case"keypress":return r.which!==32?null:(Jh=!0,Zh);case"textInput":return t=r.data,t===Zh&&Jh?null:t;default:return null}}function Sv(t,r){if($s)return t==="compositionend"||!oc&&ef(t,r)?(t=Hh(),da=ec=yr=null,$s=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Yh&&r.locale!=="ko"?null:r.data;default:return null}}var Cv={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 nf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!Cv[t.type]:r==="textarea"}function rf(t,r,o,c){le(c),r=va(r,"onChange"),0<r.length&&(o=new tc("onChange","change",null,o,c),t.push({event:o,listeners:r}))}var Gi=null,Xi=null;function Av(t){kf(t,0)}function ma(t){var r=Ks(t);if(Ce(r))return t}function Ev(t,r){if(t==="change")return r}var sf=!1;if(f){var ac;if(f){var lc="oninput"in document;if(!lc){var of=document.createElement("div");of.setAttribute("oninput","return;"),lc=typeof of.oninput=="function"}ac=lc}else ac=!1;sf=ac&&(!document.documentMode||9<document.documentMode)}function af(){Gi&&(Gi.detachEvent("onpropertychange",lf),Xi=Gi=null)}function lf(t){if(t.propertyName==="value"&&ma(Xi)){var r=[];rf(r,Xi,t,Ri(t)),Tt(Av,r)}}function Tv(t,r,o){t==="focusin"?(af(),Gi=r,Xi=o,Gi.attachEvent("onpropertychange",lf)):t==="focusout"&&af()}function Pv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ma(Xi)}function Mv(t,r){if(t==="click")return ma(r)}function Fv(t,r){if(t==="input"||t==="change")return ma(r)}function Dv(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var bn=typeof Object.is=="function"?Object.is:Dv;function Yi(t,r){if(bn(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var o=Object.keys(t),c=Object.keys(r);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var h=o[c];if(!m.call(r,h)||!bn(t[h],r[h]))return!1}return!0}function cf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function uf(t,r){var o=cf(t);t=0;for(var c;o;){if(o.nodeType===3){if(c=t+o.textContent.length,t<=r&&c>=r)return{node:o,offset:r-t};t=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=cf(o)}}function df(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?df(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function hf(){for(var t=window,r=De();r instanceof t.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)t=r.contentWindow;else break;r=De(t.document)}return r}function cc(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}function Iv(t){var r=hf(),o=t.focusedElem,c=t.selectionRange;if(r!==o&&o&&o.ownerDocument&&df(o.ownerDocument.documentElement,o)){if(c!==null&&cc(o)){if(r=c.start,t=c.end,t===void 0&&(t=r),"selectionStart"in o)o.selectionStart=r,o.selectionEnd=Math.min(t,o.value.length);else if(t=(r=o.ownerDocument||document)&&r.defaultView||window,t.getSelection){t=t.getSelection();var h=o.textContent.length,p=Math.min(c.start,h);c=c.end===void 0?p:Math.min(c.end,h),!t.extend&&p>c&&(h=c,c=p,p=h),h=uf(o,p);var w=uf(o,c);h&&w&&(t.rangeCount!==1||t.anchorNode!==h.node||t.anchorOffset!==h.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(r=r.createRange(),r.setStart(h.node,h.offset),t.removeAllRanges(),p>c?(t.addRange(r),t.extend(w.node,w.offset)):(r.setEnd(w.node,w.offset),t.addRange(r)))}}for(r=[],t=o;t=t.parentNode;)t.nodeType===1&&r.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<r.length;o++)t=r[o],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var _v=f&&"documentMode"in document&&11>=document.documentMode,Vs=null,uc=null,Zi=null,dc=!1;function ff(t,r,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;dc||Vs==null||Vs!==De(c)||(c=Vs,"selectionStart"in c&&cc(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Zi&&Yi(Zi,c)||(Zi=c,c=va(uc,"onSelect"),0<c.length&&(r=new tc("onSelect","select",null,r,o),t.push({event:r,listeners:c}),r.target=Vs)))}function xa(t,r){var o={};return o[t.toLowerCase()]=r.toLowerCase(),o["Webkit"+t]="webkit"+r,o["Moz"+t]="moz"+r,o}var zs={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionend:xa("Transition","TransitionEnd")},hc={},pf={};f&&(pf=document.createElement("div").style,"AnimationEvent"in window||(delete zs.animationend.animation,delete zs.animationiteration.animation,delete zs.animationstart.animation),"TransitionEvent"in window||delete zs.transitionend.transition);function ga(t){if(hc[t])return hc[t];if(!zs[t])return t;var r=zs[t],o;for(o in r)if(r.hasOwnProperty(o)&&o in pf)return hc[t]=r[o];return t}var mf=ga("animationend"),xf=ga("animationiteration"),gf=ga("animationstart"),yf=ga("transitionend"),vf=new Map,wf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function vr(t,r){vf.set(t,r),u(r,[t])}for(var fc=0;fc<wf.length;fc++){var pc=wf[fc],Lv=pc.toLowerCase(),Rv=pc[0].toUpperCase()+pc.slice(1);vr(Lv,"on"+Rv)}vr(mf,"onAnimationEnd"),vr(xf,"onAnimationIteration"),vr(gf,"onAnimationStart"),vr("dblclick","onDoubleClick"),vr("focusin","onFocus"),vr("focusout","onBlur"),vr(yf,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ji="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(" "),Ov=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ji));function bf(t,r,o){var c=t.type||"unknown-event";t.currentTarget=o,Ly(c,r,void 0,t),t.currentTarget=null}function kf(t,r){r=(r&4)!==0;for(var o=0;o<t.length;o++){var c=t[o],h=c.event;c=c.listeners;e:{var p=void 0;if(r)for(var w=c.length-1;0<=w;w--){var T=c[w],I=T.instance,Q=T.currentTarget;if(T=T.listener,I!==p&&h.isPropagationStopped())break e;bf(h,T,Q),p=I}else for(w=0;w<c.length;w++){if(T=c[w],I=T.instance,Q=T.currentTarget,T=T.listener,I!==p&&h.isPropagationStopped())break e;bf(h,T,Q),p=I}}}if(ta)throw t=Kl,ta=!1,Kl=null,t}function Je(t,r){var o=r[kc];o===void 0&&(o=r[kc]=new Set);var c=t+"__bubble";o.has(c)||(jf(r,t,2,!1),o.add(c))}function mc(t,r,o){var c=0;r&&(c|=4),jf(o,t,c,r)}var ya="_reactListening"+Math.random().toString(36).slice(2);function eo(t){if(!t[ya]){t[ya]=!0,a.forEach(function(o){o!=="selectionchange"&&(Ov.has(o)||mc(o,!1,t),mc(o,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[ya]||(r[ya]=!0,mc("selectionchange",!1,r))}}function jf(t,r,o,c){switch(Kh(r)){case 1:var h=Zy;break;case 4:h=Jy;break;default:h=Zl}o=h.bind(null,r,o,t),h=void 0,!Yr||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(h=!0),c?h!==void 0?t.addEventListener(r,o,{capture:!0,passive:h}):t.addEventListener(r,o,!0):h!==void 0?t.addEventListener(r,o,{passive:h}):t.addEventListener(r,o,!1)}function xc(t,r,o,c,h){var p=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var T=c.stateNode.containerInfo;if(T===h||T.nodeType===8&&T.parentNode===h)break;if(w===4)for(w=c.return;w!==null;){var I=w.tag;if((I===3||I===4)&&(I=w.stateNode.containerInfo,I===h||I.nodeType===8&&I.parentNode===h))return;w=w.return}for(;T!==null;){if(w=Jr(T),w===null)return;if(I=w.tag,I===5||I===6){c=p=w;continue e}T=T.parentNode}}c=c.return}Tt(function(){var Q=p,ce=Ri(o),ue=[];e:{var oe=vf.get(t);if(oe!==void 0){var we=tc,je=t;switch(t){case"keypress":if(ha(o)===0)break e;case"keydown":case"keyup":we=pv;break;case"focusin":je="focus",we=sc;break;case"focusout":je="blur",we=sc;break;case"beforeblur":case"afterblur":we=sc;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=qh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=nv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=gv;break;case mf:case xf:case gf:we=iv;break;case yf:we=vv;break;case"scroll":we=ev;break;case"wheel":we=bv;break;case"copy":case"cut":case"paste":we=av;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=Xh}var Ne=(r&4)!==0,ut=!Ne&&t==="scroll",U=Ne?oe!==null?oe+"Capture":null:oe;Ne=[];for(var O=Q,K;O!==null;){K=O;var pe=K.stateNode;if(K.tag===5&&pe!==null&&(K=pe,U!==null&&(pe=Xt(O,U),pe!=null&&Ne.push(to(O,pe,K)))),ut)break;O=O.return}0<Ne.length&&(oe=new we(oe,je,null,o,ce),ue.push({event:oe,listeners:Ne}))}}if((r&7)===0){e:{if(oe=t==="mouseover"||t==="pointerover",we=t==="mouseout"||t==="pointerout",oe&&o!==Xr&&(je=o.relatedTarget||o.fromElement)&&(Jr(je)||je[qn]))break e;if((we||oe)&&(oe=ce.window===ce?ce:(oe=ce.ownerDocument)?oe.defaultView||oe.parentWindow:window,we?(je=o.relatedTarget||o.toElement,we=Q,je=je?Jr(je):null,je!==null&&(ut=Zr(je),je!==ut||je.tag!==5&&je.tag!==6)&&(je=null)):(we=null,je=Q),we!==je)){if(Ne=qh,pe="onMouseLeave",U="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(Ne=Xh,pe="onPointerLeave",U="onPointerEnter",O="pointer"),ut=we==null?oe:Ks(we),K=je==null?oe:Ks(je),oe=new Ne(pe,O+"leave",we,o,ce),oe.target=ut,oe.relatedTarget=K,pe=null,Jr(ce)===Q&&(Ne=new Ne(U,O+"enter",je,o,ce),Ne.target=K,Ne.relatedTarget=ut,pe=Ne),ut=pe,we&&je)t:{for(Ne=we,U=je,O=0,K=Ne;K;K=Us(K))O++;for(K=0,pe=U;pe;pe=Us(pe))K++;for(;0<O-K;)Ne=Us(Ne),O--;for(;0<K-O;)U=Us(U),K--;for(;O--;){if(Ne===U||U!==null&&Ne===U.alternate)break t;Ne=Us(Ne),U=Us(U)}Ne=null}else Ne=null;we!==null&&Nf(ue,oe,we,Ne,!1),je!==null&&ut!==null&&Nf(ue,ut,je,Ne,!0)}}e:{if(oe=Q?Ks(Q):window,we=oe.nodeName&&oe.nodeName.toLowerCase(),we==="select"||we==="input"&&oe.type==="file")var Se=Ev;else if(nf(oe))if(sf)Se=Fv;else{Se=Pv;var Pe=Tv}else(we=oe.nodeName)&&we.toLowerCase()==="input"&&(oe.type==="checkbox"||oe.type==="radio")&&(Se=Mv);if(Se&&(Se=Se(t,Q))){rf(ue,Se,o,ce);break e}Pe&&Pe(t,oe,Q),t==="focusout"&&(Pe=oe._wrapperState)&&Pe.controlled&&oe.type==="number"&&Kn(oe,"number",oe.value)}switch(Pe=Q?Ks(Q):window,t){case"focusin":(nf(Pe)||Pe.contentEditable==="true")&&(Vs=Pe,uc=Q,Zi=null);break;case"focusout":Zi=uc=Vs=null;break;case"mousedown":dc=!0;break;case"contextmenu":case"mouseup":case"dragend":dc=!1,ff(ue,o,ce);break;case"selectionchange":if(_v)break;case"keydown":case"keyup":ff(ue,o,ce)}var Me;if(oc)e:{switch(t){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else $s?ef(t,o)&&(Ie="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(Ie="onCompositionStart");Ie&&(Yh&&o.locale!=="ko"&&($s||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&$s&&(Me=Hh()):(yr=ce,ec="value"in yr?yr.value:yr.textContent,$s=!0)),Pe=va(Q,Ie),0<Pe.length&&(Ie=new Gh(Ie,t,null,o,ce),ue.push({event:Ie,listeners:Pe}),Me?Ie.data=Me:(Me=tf(o),Me!==null&&(Ie.data=Me)))),(Me=jv?Nv(t,o):Sv(t,o))&&(Q=va(Q,"onBeforeInput"),0<Q.length&&(ce=new Gh("onBeforeInput","beforeinput",null,o,ce),ue.push({event:ce,listeners:Q}),ce.data=Me))}kf(ue,r)})}function to(t,r,o){return{instance:t,listener:r,currentTarget:o}}function va(t,r){for(var o=r+"Capture",c=[];t!==null;){var h=t,p=h.stateNode;h.tag===5&&p!==null&&(h=p,p=Xt(t,o),p!=null&&c.unshift(to(t,p,h)),p=Xt(t,r),p!=null&&c.push(to(t,p,h))),t=t.return}return c}function Us(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Nf(t,r,o,c,h){for(var p=r._reactName,w=[];o!==null&&o!==c;){var T=o,I=T.alternate,Q=T.stateNode;if(I!==null&&I===c)break;T.tag===5&&Q!==null&&(T=Q,h?(I=Xt(o,p),I!=null&&w.unshift(to(o,I,T))):h||(I=Xt(o,p),I!=null&&w.push(to(o,I,T)))),o=o.return}w.length!==0&&t.push({event:r,listeners:w})}var Bv=/\r\n?/g,$v=/\u0000|\uFFFD/g;function Sf(t){return(typeof t=="string"?t:""+t).replace(Bv,`
38
+ `).replace($v,"")}function wa(t,r,o){if(r=Sf(r),Sf(t)!==r&&o)throw Error(s(425))}function ba(){}var gc=null,yc=null;function vc(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var wc=typeof setTimeout=="function"?setTimeout:void 0,Vv=typeof clearTimeout=="function"?clearTimeout:void 0,Cf=typeof Promise=="function"?Promise:void 0,zv=typeof queueMicrotask=="function"?queueMicrotask:typeof Cf<"u"?function(t){return Cf.resolve(null).then(t).catch(Uv)}:wc;function Uv(t){setTimeout(function(){throw t})}function bc(t,r){var o=r,c=0;do{var h=o.nextSibling;if(t.removeChild(o),h&&h.nodeType===8)if(o=h.data,o==="/$"){if(c===0){t.removeChild(h),Ki(r);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=h}while(o);Ki(r)}function wr(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return t}function Af(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"){if(r===0)return t;r--}else o==="/$"&&r++}t=t.previousSibling}return null}var Ws=Math.random().toString(36).slice(2),In="__reactFiber$"+Ws,no="__reactProps$"+Ws,qn="__reactContainer$"+Ws,kc="__reactEvents$"+Ws,Wv="__reactListeners$"+Ws,Kv="__reactHandles$"+Ws;function Jr(t){var r=t[In];if(r)return r;for(var o=t.parentNode;o;){if(r=o[qn]||o[In]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(t=Af(t);t!==null;){if(o=t[In])return o;t=Af(t)}return r}t=o,o=t.parentNode}return null}function ro(t){return t=t[In]||t[qn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ks(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(s(33))}function ka(t){return t[no]||null}var jc=[],Hs=-1;function br(t){return{current:t}}function et(t){0>Hs||(t.current=jc[Hs],jc[Hs]=null,Hs--)}function Ye(t,r){Hs++,jc[Hs]=t.current,t.current=r}var kr={},Pt=br(kr),Vt=br(!1),es=kr;function Qs(t,r){var o=t.type.contextTypes;if(!o)return kr;var c=t.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===r)return c.__reactInternalMemoizedMaskedChildContext;var h={},p;for(p in o)h[p]=r[p];return c&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=h),h}function zt(t){return t=t.childContextTypes,t!=null}function ja(){et(Vt),et(Pt)}function Ef(t,r,o){if(Pt.current!==kr)throw Error(s(168));Ye(Pt,r),Ye(Vt,o)}function Tf(t,r,o){var c=t.stateNode;if(r=r.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var h in c)if(!(h in r))throw Error(s(108,ge(t)||"Unknown",h));return V({},o,c)}function Na(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||kr,es=Pt.current,Ye(Pt,t),Ye(Vt,Vt.current),!0}function Pf(t,r,o){var c=t.stateNode;if(!c)throw Error(s(169));o?(t=Tf(t,r,es),c.__reactInternalMemoizedMergedChildContext=t,et(Vt),et(Pt),Ye(Pt,t)):et(Vt),Ye(Vt,o)}var Gn=null,Sa=!1,Nc=!1;function Mf(t){Gn===null?Gn=[t]:Gn.push(t)}function Hv(t){Sa=!0,Mf(t)}function jr(){if(!Nc&&Gn!==null){Nc=!0;var t=0,r=qe;try{var o=Gn;for(qe=1;t<o.length;t++){var c=o[t];do c=c(!0);while(c!==null)}Gn=null,Sa=!1}catch(h){throw Gn!==null&&(Gn=Gn.slice(t+1)),Fh(Hl,jr),h}finally{qe=r,Nc=!1}}return null}var qs=[],Gs=0,Ca=null,Aa=0,on=[],an=0,ts=null,Xn=1,Yn="";function ns(t,r){qs[Gs++]=Aa,qs[Gs++]=Ca,Ca=t,Aa=r}function Ff(t,r,o){on[an++]=Xn,on[an++]=Yn,on[an++]=ts,ts=t;var c=Xn;t=Yn;var h=32-wn(c)-1;c&=~(1<<h),o+=1;var p=32-wn(r)+h;if(30<p){var w=h-h%5;p=(c&(1<<w)-1).toString(32),c>>=w,h-=w,Xn=1<<32-wn(r)+h|o<<h|c,Yn=p+t}else Xn=1<<p|o<<h|c,Yn=t}function Sc(t){t.return!==null&&(ns(t,1),Ff(t,1,0))}function Cc(t){for(;t===Ca;)Ca=qs[--Gs],qs[Gs]=null,Aa=qs[--Gs],qs[Gs]=null;for(;t===ts;)ts=on[--an],on[an]=null,Yn=on[--an],on[an]=null,Xn=on[--an],on[an]=null}var Zt=null,Jt=null,nt=!1,kn=null;function Df(t,r){var o=dn(5,null,null,0);o.elementType="DELETED",o.stateNode=r,o.return=t,r=t.deletions,r===null?(t.deletions=[o],t.flags|=16):r.push(o)}function If(t,r){switch(t.tag){case 5:var o=t.type;return r=r.nodeType!==1||o.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(t.stateNode=r,Zt=t,Jt=wr(r.firstChild),!0):!1;case 6:return r=t.pendingProps===""||r.nodeType!==3?null:r,r!==null?(t.stateNode=r,Zt=t,Jt=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(o=ts!==null?{id:Xn,overflow:Yn}:null,t.memoizedState={dehydrated:r,treeContext:o,retryLane:1073741824},o=dn(18,null,null,0),o.stateNode=r,o.return=t,t.child=o,Zt=t,Jt=null,!0):!1;default:return!1}}function Ac(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ec(t){if(nt){var r=Jt;if(r){var o=r;if(!If(t,r)){if(Ac(t))throw Error(s(418));r=wr(o.nextSibling);var c=Zt;r&&If(t,r)?Df(c,o):(t.flags=t.flags&-4097|2,nt=!1,Zt=t)}}else{if(Ac(t))throw Error(s(418));t.flags=t.flags&-4097|2,nt=!1,Zt=t}}}function _f(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Zt=t}function Ea(t){if(t!==Zt)return!1;if(!nt)return _f(t),nt=!0,!1;var r;if((r=t.tag!==3)&&!(r=t.tag!==5)&&(r=t.type,r=r!=="head"&&r!=="body"&&!vc(t.type,t.memoizedProps)),r&&(r=Jt)){if(Ac(t))throw Lf(),Error(s(418));for(;r;)Df(t,r),r=wr(r.nextSibling)}if(_f(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));e:{for(t=t.nextSibling,r=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"){if(r===0){Jt=wr(t.nextSibling);break e}r--}else o!=="$"&&o!=="$!"&&o!=="$?"||r++}t=t.nextSibling}Jt=null}}else Jt=Zt?wr(t.stateNode.nextSibling):null;return!0}function Lf(){for(var t=Jt;t;)t=wr(t.nextSibling)}function Xs(){Jt=Zt=null,nt=!1}function Tc(t){kn===null?kn=[t]:kn.push(t)}var Qv=P.ReactCurrentBatchConfig;function so(t,r,o){if(t=o.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(s(309));var c=o.stateNode}if(!c)throw Error(s(147,t));var h=c,p=""+t;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===p?r.ref:(r=function(w){var T=h.refs;w===null?delete T[p]:T[p]=w},r._stringRef=p,r)}if(typeof t!="string")throw Error(s(284));if(!o._owner)throw Error(s(290,t))}return t}function Ta(t,r){throw t=Object.prototype.toString.call(r),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t))}function Rf(t){var r=t._init;return r(t._payload)}function Of(t){function r(U,O){if(t){var K=U.deletions;K===null?(U.deletions=[O],U.flags|=16):K.push(O)}}function o(U,O){if(!t)return null;for(;O!==null;)r(U,O),O=O.sibling;return null}function c(U,O){for(U=new Map;O!==null;)O.key!==null?U.set(O.key,O):U.set(O.index,O),O=O.sibling;return U}function h(U,O){return U=Mr(U,O),U.index=0,U.sibling=null,U}function p(U,O,K){return U.index=K,t?(K=U.alternate,K!==null?(K=K.index,K<O?(U.flags|=2,O):K):(U.flags|=2,O)):(U.flags|=1048576,O)}function w(U){return t&&U.alternate===null&&(U.flags|=2),U}function T(U,O,K,pe){return O===null||O.tag!==6?(O=wu(K,U.mode,pe),O.return=U,O):(O=h(O,K),O.return=U,O)}function I(U,O,K,pe){var Se=K.type;return Se===B?ce(U,O,K.props.children,pe,K.key):O!==null&&(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===X&&Rf(Se)===O.type)?(pe=h(O,K.props),pe.ref=so(U,O,K),pe.return=U,pe):(pe=Ja(K.type,K.key,K.props,null,U.mode,pe),pe.ref=so(U,O,K),pe.return=U,pe)}function Q(U,O,K,pe){return O===null||O.tag!==4||O.stateNode.containerInfo!==K.containerInfo||O.stateNode.implementation!==K.implementation?(O=bu(K,U.mode,pe),O.return=U,O):(O=h(O,K.children||[]),O.return=U,O)}function ce(U,O,K,pe,Se){return O===null||O.tag!==7?(O=us(K,U.mode,pe,Se),O.return=U,O):(O=h(O,K),O.return=U,O)}function ue(U,O,K){if(typeof O=="string"&&O!==""||typeof O=="number")return O=wu(""+O,U.mode,K),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case M:return K=Ja(O.type,O.key,O.props,null,U.mode,K),K.ref=so(U,null,O),K.return=U,K;case C:return O=bu(O,U.mode,K),O.return=U,O;case X:var pe=O._init;return ue(U,pe(O._payload),K)}if(gt(O)||Z(O))return O=us(O,U.mode,K,null),O.return=U,O;Ta(U,O)}return null}function oe(U,O,K,pe){var Se=O!==null?O.key:null;if(typeof K=="string"&&K!==""||typeof K=="number")return Se!==null?null:T(U,O,""+K,pe);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case M:return K.key===Se?I(U,O,K,pe):null;case C:return K.key===Se?Q(U,O,K,pe):null;case X:return Se=K._init,oe(U,O,Se(K._payload),pe)}if(gt(K)||Z(K))return Se!==null?null:ce(U,O,K,pe,null);Ta(U,K)}return null}function we(U,O,K,pe,Se){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return U=U.get(K)||null,T(O,U,""+pe,Se);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case M:return U=U.get(pe.key===null?K:pe.key)||null,I(O,U,pe,Se);case C:return U=U.get(pe.key===null?K:pe.key)||null,Q(O,U,pe,Se);case X:var Pe=pe._init;return we(U,O,K,Pe(pe._payload),Se)}if(gt(pe)||Z(pe))return U=U.get(K)||null,ce(O,U,pe,Se,null);Ta(O,pe)}return null}function je(U,O,K,pe){for(var Se=null,Pe=null,Me=O,Ie=O=0,kt=null;Me!==null&&Ie<K.length;Ie++){Me.index>Ie?(kt=Me,Me=null):kt=Me.sibling;var He=oe(U,Me,K[Ie],pe);if(He===null){Me===null&&(Me=kt);break}t&&Me&&He.alternate===null&&r(U,Me),O=p(He,O,Ie),Pe===null?Se=He:Pe.sibling=He,Pe=He,Me=kt}if(Ie===K.length)return o(U,Me),nt&&ns(U,Ie),Se;if(Me===null){for(;Ie<K.length;Ie++)Me=ue(U,K[Ie],pe),Me!==null&&(O=p(Me,O,Ie),Pe===null?Se=Me:Pe.sibling=Me,Pe=Me);return nt&&ns(U,Ie),Se}for(Me=c(U,Me);Ie<K.length;Ie++)kt=we(Me,U,Ie,K[Ie],pe),kt!==null&&(t&&kt.alternate!==null&&Me.delete(kt.key===null?Ie:kt.key),O=p(kt,O,Ie),Pe===null?Se=kt:Pe.sibling=kt,Pe=kt);return t&&Me.forEach(function(Fr){return r(U,Fr)}),nt&&ns(U,Ie),Se}function Ne(U,O,K,pe){var Se=Z(K);if(typeof Se!="function")throw Error(s(150));if(K=Se.call(K),K==null)throw Error(s(151));for(var Pe=Se=null,Me=O,Ie=O=0,kt=null,He=K.next();Me!==null&&!He.done;Ie++,He=K.next()){Me.index>Ie?(kt=Me,Me=null):kt=Me.sibling;var Fr=oe(U,Me,He.value,pe);if(Fr===null){Me===null&&(Me=kt);break}t&&Me&&Fr.alternate===null&&r(U,Me),O=p(Fr,O,Ie),Pe===null?Se=Fr:Pe.sibling=Fr,Pe=Fr,Me=kt}if(He.done)return o(U,Me),nt&&ns(U,Ie),Se;if(Me===null){for(;!He.done;Ie++,He=K.next())He=ue(U,He.value,pe),He!==null&&(O=p(He,O,Ie),Pe===null?Se=He:Pe.sibling=He,Pe=He);return nt&&ns(U,Ie),Se}for(Me=c(U,Me);!He.done;Ie++,He=K.next())He=we(Me,U,Ie,He.value,pe),He!==null&&(t&&He.alternate!==null&&Me.delete(He.key===null?Ie:He.key),O=p(He,O,Ie),Pe===null?Se=He:Pe.sibling=He,Pe=He);return t&&Me.forEach(function(Cw){return r(U,Cw)}),nt&&ns(U,Ie),Se}function ut(U,O,K,pe){if(typeof K=="object"&&K!==null&&K.type===B&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case M:e:{for(var Se=K.key,Pe=O;Pe!==null;){if(Pe.key===Se){if(Se=K.type,Se===B){if(Pe.tag===7){o(U,Pe.sibling),O=h(Pe,K.props.children),O.return=U,U=O;break e}}else if(Pe.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===X&&Rf(Se)===Pe.type){o(U,Pe.sibling),O=h(Pe,K.props),O.ref=so(U,Pe,K),O.return=U,U=O;break e}o(U,Pe);break}else r(U,Pe);Pe=Pe.sibling}K.type===B?(O=us(K.props.children,U.mode,pe,K.key),O.return=U,U=O):(pe=Ja(K.type,K.key,K.props,null,U.mode,pe),pe.ref=so(U,O,K),pe.return=U,U=pe)}return w(U);case C:e:{for(Pe=K.key;O!==null;){if(O.key===Pe)if(O.tag===4&&O.stateNode.containerInfo===K.containerInfo&&O.stateNode.implementation===K.implementation){o(U,O.sibling),O=h(O,K.children||[]),O.return=U,U=O;break e}else{o(U,O);break}else r(U,O);O=O.sibling}O=bu(K,U.mode,pe),O.return=U,U=O}return w(U);case X:return Pe=K._init,ut(U,O,Pe(K._payload),pe)}if(gt(K))return je(U,O,K,pe);if(Z(K))return Ne(U,O,K,pe);Ta(U,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,O!==null&&O.tag===6?(o(U,O.sibling),O=h(O,K),O.return=U,U=O):(o(U,O),O=wu(K,U.mode,pe),O.return=U,U=O),w(U)):o(U,O)}return ut}var Ys=Of(!0),Bf=Of(!1),Pa=br(null),Ma=null,Zs=null,Pc=null;function Mc(){Pc=Zs=Ma=null}function Fc(t){var r=Pa.current;et(Pa),t._currentValue=r}function Dc(t,r,o){for(;t!==null;){var c=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),t===o)break;t=t.return}}function Js(t,r){Ma=t,Pc=Zs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&r)!==0&&(Ut=!0),t.firstContext=null)}function ln(t){var r=t._currentValue;if(Pc!==t)if(t={context:t,memoizedValue:r,next:null},Zs===null){if(Ma===null)throw Error(s(308));Zs=t,Ma.dependencies={lanes:0,firstContext:t}}else Zs=Zs.next=t;return r}var rs=null;function Ic(t){rs===null?rs=[t]:rs.push(t)}function $f(t,r,o,c){var h=r.interleaved;return h===null?(o.next=o,Ic(r)):(o.next=h.next,h.next=o),r.interleaved=o,Zn(t,c)}function Zn(t,r){t.lanes|=r;var o=t.alternate;for(o!==null&&(o.lanes|=r),o=t,t=t.return;t!==null;)t.childLanes|=r,o=t.alternate,o!==null&&(o.childLanes|=r),o=t,t=t.return;return o.tag===3?o.stateNode:null}var Nr=!1;function _c(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vf(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Jn(t,r){return{eventTime:t,lane:r,tag:0,payload:null,callback:null,next:null}}function Sr(t,r,o){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(We&2)!==0){var h=c.pending;return h===null?r.next=r:(r.next=h.next,h.next=r),c.pending=r,Zn(t,o)}return h=c.interleaved,h===null?(r.next=r,Ic(c)):(r.next=h.next,h.next=r),c.interleaved=r,Zn(t,o)}function Fa(t,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194240)!==0)){var c=r.lanes;c&=t.pendingLanes,o|=c,r.lanes=o,Gl(t,o)}}function zf(t,r){var o=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var h=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?h=p=w:p=p.next=w,o=o.next}while(o!==null);p===null?h=p=r:p=p.next=r}else h=p=r;o={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:c.shared,effects:c.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=r:t.next=r,o.lastBaseUpdate=r}function Da(t,r,o,c){var h=t.updateQueue;Nr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,T=h.shared.pending;if(T!==null){h.shared.pending=null;var I=T,Q=I.next;I.next=null,w===null?p=Q:w.next=Q,w=I;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,T=ce.lastBaseUpdate,T!==w&&(T===null?ce.firstBaseUpdate=Q:T.next=Q,ce.lastBaseUpdate=I))}if(p!==null){var ue=h.baseState;w=0,ce=Q=I=null,T=p;do{var oe=T.lane,we=T.eventTime;if((c&oe)===oe){ce!==null&&(ce=ce.next={eventTime:we,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var je=t,Ne=T;switch(oe=r,we=o,Ne.tag){case 1:if(je=Ne.payload,typeof je=="function"){ue=je.call(we,ue,oe);break e}ue=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ne.payload,oe=typeof je=="function"?je.call(we,ue,oe):je,oe==null)break e;ue=V({},ue,oe);break e;case 2:Nr=!0}}T.callback!==null&&T.lane!==0&&(t.flags|=64,oe=h.effects,oe===null?h.effects=[T]:oe.push(T))}else we={eventTime:we,lane:oe,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ce===null?(Q=ce=we,I=ue):ce=ce.next=we,w|=oe;if(T=T.next,T===null){if(T=h.shared.pending,T===null)break;oe=T,T=oe.next,oe.next=null,h.lastBaseUpdate=oe,h.shared.pending=null}}while(!0);if(ce===null&&(I=ue),h.baseState=I,h.firstBaseUpdate=Q,h.lastBaseUpdate=ce,r=h.shared.interleaved,r!==null){h=r;do w|=h.lane,h=h.next;while(h!==r)}else p===null&&(h.shared.lanes=0);os|=w,t.lanes=w,t.memoizedState=ue}}function Uf(t,r,o){if(t=r.effects,r.effects=null,t!==null)for(r=0;r<t.length;r++){var c=t[r],h=c.callback;if(h!==null){if(c.callback=null,c=o,typeof h!="function")throw Error(s(191,h));h.call(c)}}}var io={},_n=br(io),oo=br(io),ao=br(io);function ss(t){if(t===io)throw Error(s(174));return t}function Lc(t,r){switch(Ye(ao,r),Ye(oo,t),Ye(_n,io),t=r.nodeType,t){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:vt(null,"");break;default:t=t===8?r.parentNode:r,r=t.namespaceURI||null,t=t.tagName,r=vt(r,t)}et(_n),Ye(_n,r)}function ei(){et(_n),et(oo),et(ao)}function Wf(t){ss(ao.current);var r=ss(_n.current),o=vt(r,t.type);r!==o&&(Ye(oo,t),Ye(_n,o))}function Rc(t){oo.current===t&&(et(_n),et(oo))}var rt=br(0);function Ia(t){for(var r=t;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Oc=[];function Bc(){for(var t=0;t<Oc.length;t++)Oc[t]._workInProgressVersionPrimary=null;Oc.length=0}var _a=P.ReactCurrentDispatcher,$c=P.ReactCurrentBatchConfig,is=0,st=null,ft=null,wt=null,La=!1,lo=!1,co=0,qv=0;function Mt(){throw Error(s(321))}function Vc(t,r){if(r===null)return!1;for(var o=0;o<r.length&&o<t.length;o++)if(!bn(t[o],r[o]))return!1;return!0}function zc(t,r,o,c,h,p){if(is=p,st=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,_a.current=t===null||t.memoizedState===null?Zv:Jv,t=o(c,h),lo){p=0;do{if(lo=!1,co=0,25<=p)throw Error(s(301));p+=1,wt=ft=null,r.updateQueue=null,_a.current=ew,t=o(c,h)}while(lo)}if(_a.current=Ba,r=ft!==null&&ft.next!==null,is=0,wt=ft=st=null,La=!1,r)throw Error(s(300));return t}function Uc(){var t=co!==0;return co=0,t}function Ln(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?st.memoizedState=wt=t:wt=wt.next=t,wt}function cn(){if(ft===null){var t=st.alternate;t=t!==null?t.memoizedState:null}else t=ft.next;var r=wt===null?st.memoizedState:wt.next;if(r!==null)wt=r,ft=t;else{if(t===null)throw Error(s(310));ft=t,t={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},wt===null?st.memoizedState=wt=t:wt=wt.next=t}return wt}function uo(t,r){return typeof r=="function"?r(t):r}function Wc(t){var r=cn(),o=r.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=t;var c=ft,h=c.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}c.baseQueue=h=p,o.pending=null}if(h!==null){p=h.next,c=c.baseState;var T=w=null,I=null,Q=p;do{var ce=Q.lane;if((is&ce)===ce)I!==null&&(I=I.next={lane:0,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),c=Q.hasEagerState?Q.eagerState:t(c,Q.action);else{var ue={lane:ce,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null};I===null?(T=I=ue,w=c):I=I.next=ue,st.lanes|=ce,os|=ce}Q=Q.next}while(Q!==null&&Q!==p);I===null?w=c:I.next=T,bn(c,r.memoizedState)||(Ut=!0),r.memoizedState=c,r.baseState=w,r.baseQueue=I,o.lastRenderedState=c}if(t=o.interleaved,t!==null){h=t;do p=h.lane,st.lanes|=p,os|=p,h=h.next;while(h!==t)}else h===null&&(o.lanes=0);return[r.memoizedState,o.dispatch]}function Kc(t){var r=cn(),o=r.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=t;var c=o.dispatch,h=o.pending,p=r.memoizedState;if(h!==null){o.pending=null;var w=h=h.next;do p=t(p,w.action),w=w.next;while(w!==h);bn(p,r.memoizedState)||(Ut=!0),r.memoizedState=p,r.baseQueue===null&&(r.baseState=p),o.lastRenderedState=p}return[p,c]}function Kf(){}function Hf(t,r){var o=st,c=cn(),h=r(),p=!bn(c.memoizedState,h);if(p&&(c.memoizedState=h,Ut=!0),c=c.queue,Hc(Gf.bind(null,o,c,t),[t]),c.getSnapshot!==r||p||wt!==null&&wt.memoizedState.tag&1){if(o.flags|=2048,ho(9,qf.bind(null,o,c,h,r),void 0,null),bt===null)throw Error(s(349));(is&30)!==0||Qf(o,r,h)}return h}function Qf(t,r,o){t.flags|=16384,t={getSnapshot:r,value:o},r=st.updateQueue,r===null?(r={lastEffect:null,stores:null},st.updateQueue=r,r.stores=[t]):(o=r.stores,o===null?r.stores=[t]:o.push(t))}function qf(t,r,o,c){r.value=o,r.getSnapshot=c,Xf(r)&&Yf(t)}function Gf(t,r,o){return o(function(){Xf(r)&&Yf(t)})}function Xf(t){var r=t.getSnapshot;t=t.value;try{var o=r();return!bn(t,o)}catch{return!0}}function Yf(t){var r=Zn(t,1);r!==null&&Cn(r,t,1,-1)}function Zf(t){var r=Ln();return typeof t=="function"&&(t=t()),r.memoizedState=r.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:uo,lastRenderedState:t},r.queue=t,t=t.dispatch=Yv.bind(null,st,t),[r.memoizedState,t]}function ho(t,r,o,c){return t={tag:t,create:r,destroy:o,deps:c,next:null},r=st.updateQueue,r===null?(r={lastEffect:null,stores:null},st.updateQueue=r,r.lastEffect=t.next=t):(o=r.lastEffect,o===null?r.lastEffect=t.next=t:(c=o.next,o.next=t,t.next=c,r.lastEffect=t)),t}function Jf(){return cn().memoizedState}function Ra(t,r,o,c){var h=Ln();st.flags|=t,h.memoizedState=ho(1|r,o,void 0,c===void 0?null:c)}function Oa(t,r,o,c){var h=cn();c=c===void 0?null:c;var p=void 0;if(ft!==null){var w=ft.memoizedState;if(p=w.destroy,c!==null&&Vc(c,w.deps)){h.memoizedState=ho(r,o,p,c);return}}st.flags|=t,h.memoizedState=ho(1|r,o,p,c)}function ep(t,r){return Ra(8390656,8,t,r)}function Hc(t,r){return Oa(2048,8,t,r)}function tp(t,r){return Oa(4,2,t,r)}function np(t,r){return Oa(4,4,t,r)}function rp(t,r){if(typeof r=="function")return t=t(),r(t),function(){r(null)};if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function sp(t,r,o){return o=o!=null?o.concat([t]):null,Oa(4,4,rp.bind(null,r,t),o)}function Qc(){}function ip(t,r){var o=cn();r=r===void 0?null:r;var c=o.memoizedState;return c!==null&&r!==null&&Vc(r,c[1])?c[0]:(o.memoizedState=[t,r],t)}function op(t,r){var o=cn();r=r===void 0?null:r;var c=o.memoizedState;return c!==null&&r!==null&&Vc(r,c[1])?c[0]:(t=t(),o.memoizedState=[t,r],t)}function ap(t,r,o){return(is&21)===0?(t.baseState&&(t.baseState=!1,Ut=!0),t.memoizedState=o):(bn(o,r)||(o=Lh(),st.lanes|=o,os|=o,t.baseState=!0),r)}function Gv(t,r){var o=qe;qe=o!==0&&4>o?o:4,t(!0);var c=$c.transition;$c.transition={};try{t(!1),r()}finally{qe=o,$c.transition=c}}function lp(){return cn().memoizedState}function Xv(t,r,o){var c=Tr(t);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},cp(t))up(r,o);else if(o=$f(t,r,o,c),o!==null){var h=Ot();Cn(o,t,c,h),dp(o,r,c)}}function Yv(t,r,o){var c=Tr(t),h={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(cp(t))up(r,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var w=r.lastRenderedState,T=p(w,o);if(h.hasEagerState=!0,h.eagerState=T,bn(T,w)){var I=r.interleaved;I===null?(h.next=h,Ic(r)):(h.next=I.next,I.next=h),r.interleaved=h;return}}catch{}finally{}o=$f(t,r,h,c),o!==null&&(h=Ot(),Cn(o,t,c,h),dp(o,r,c))}}function cp(t){var r=t.alternate;return t===st||r!==null&&r===st}function up(t,r){lo=La=!0;var o=t.pending;o===null?r.next=r:(r.next=o.next,o.next=r),t.pending=r}function dp(t,r,o){if((o&4194240)!==0){var c=r.lanes;c&=t.pendingLanes,o|=c,r.lanes=o,Gl(t,o)}}var Ba={readContext:ln,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},Zv={readContext:ln,useCallback:function(t,r){return Ln().memoizedState=[t,r===void 0?null:r],t},useContext:ln,useEffect:ep,useImperativeHandle:function(t,r,o){return o=o!=null?o.concat([t]):null,Ra(4194308,4,rp.bind(null,r,t),o)},useLayoutEffect:function(t,r){return Ra(4194308,4,t,r)},useInsertionEffect:function(t,r){return Ra(4,2,t,r)},useMemo:function(t,r){var o=Ln();return r=r===void 0?null:r,t=t(),o.memoizedState=[t,r],t},useReducer:function(t,r,o){var c=Ln();return r=o!==void 0?o(r):r,c.memoizedState=c.baseState=r,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:r},c.queue=t,t=t.dispatch=Xv.bind(null,st,t),[c.memoizedState,t]},useRef:function(t){var r=Ln();return t={current:t},r.memoizedState=t},useState:Zf,useDebugValue:Qc,useDeferredValue:function(t){return Ln().memoizedState=t},useTransition:function(){var t=Zf(!1),r=t[0];return t=Gv.bind(null,t[1]),Ln().memoizedState=t,[r,t]},useMutableSource:function(){},useSyncExternalStore:function(t,r,o){var c=st,h=Ln();if(nt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=r(),bt===null)throw Error(s(349));(is&30)!==0||Qf(c,r,o)}h.memoizedState=o;var p={value:o,getSnapshot:r};return h.queue=p,ep(Gf.bind(null,c,p,t),[t]),c.flags|=2048,ho(9,qf.bind(null,c,p,o,r),void 0,null),o},useId:function(){var t=Ln(),r=bt.identifierPrefix;if(nt){var o=Yn,c=Xn;o=(c&~(1<<32-wn(c)-1)).toString(32)+o,r=":"+r+"R"+o,o=co++,0<o&&(r+="H"+o.toString(32)),r+=":"}else o=qv++,r=":"+r+"r"+o.toString(32)+":";return t.memoizedState=r},unstable_isNewReconciler:!1},Jv={readContext:ln,useCallback:ip,useContext:ln,useEffect:Hc,useImperativeHandle:sp,useInsertionEffect:tp,useLayoutEffect:np,useMemo:op,useReducer:Wc,useRef:Jf,useState:function(){return Wc(uo)},useDebugValue:Qc,useDeferredValue:function(t){var r=cn();return ap(r,ft.memoizedState,t)},useTransition:function(){var t=Wc(uo)[0],r=cn().memoizedState;return[t,r]},useMutableSource:Kf,useSyncExternalStore:Hf,useId:lp,unstable_isNewReconciler:!1},ew={readContext:ln,useCallback:ip,useContext:ln,useEffect:Hc,useImperativeHandle:sp,useInsertionEffect:tp,useLayoutEffect:np,useMemo:op,useReducer:Kc,useRef:Jf,useState:function(){return Kc(uo)},useDebugValue:Qc,useDeferredValue:function(t){var r=cn();return ft===null?r.memoizedState=t:ap(r,ft.memoizedState,t)},useTransition:function(){var t=Kc(uo)[0],r=cn().memoizedState;return[t,r]},useMutableSource:Kf,useSyncExternalStore:Hf,useId:lp,unstable_isNewReconciler:!1};function jn(t,r){if(t&&t.defaultProps){r=V({},r),t=t.defaultProps;for(var o in t)r[o]===void 0&&(r[o]=t[o]);return r}return r}function qc(t,r,o,c){r=t.memoizedState,o=o(c,r),o=o==null?r:V({},r,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var $a={isMounted:function(t){return(t=t._reactInternals)?Zr(t)===t:!1},enqueueSetState:function(t,r,o){t=t._reactInternals;var c=Ot(),h=Tr(t),p=Jn(c,h);p.payload=r,o!=null&&(p.callback=o),r=Sr(t,p,h),r!==null&&(Cn(r,t,h,c),Fa(r,t,h))},enqueueReplaceState:function(t,r,o){t=t._reactInternals;var c=Ot(),h=Tr(t),p=Jn(c,h);p.tag=1,p.payload=r,o!=null&&(p.callback=o),r=Sr(t,p,h),r!==null&&(Cn(r,t,h,c),Fa(r,t,h))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var o=Ot(),c=Tr(t),h=Jn(o,c);h.tag=2,r!=null&&(h.callback=r),r=Sr(t,h,c),r!==null&&(Cn(r,t,c,o),Fa(r,t,c))}};function hp(t,r,o,c,h,p,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,p,w):r.prototype&&r.prototype.isPureReactComponent?!Yi(o,c)||!Yi(h,p):!0}function fp(t,r,o){var c=!1,h=kr,p=r.contextType;return typeof p=="object"&&p!==null?p=ln(p):(h=zt(r)?es:Pt.current,c=r.contextTypes,p=(c=c!=null)?Qs(t,h):kr),r=new r(o,p),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=$a,t.stateNode=r,r._reactInternals=t,c&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=h,t.__reactInternalMemoizedMaskedChildContext=p),r}function pp(t,r,o,c){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,c),r.state!==t&&$a.enqueueReplaceState(r,r.state,null)}function Gc(t,r,o,c){var h=t.stateNode;h.props=o,h.state=t.memoizedState,h.refs={},_c(t);var p=r.contextType;typeof p=="object"&&p!==null?h.context=ln(p):(p=zt(r)?es:Pt.current,h.context=Qs(t,p)),h.state=t.memoizedState,p=r.getDerivedStateFromProps,typeof p=="function"&&(qc(t,r,p,o),h.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(r=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),r!==h.state&&$a.enqueueReplaceState(h,h.state,null),Da(t,o,h,c),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308)}function ti(t,r){try{var o="",c=r;do o+=xe(c),c=c.return;while(c);var h=o}catch(p){h=`
39
+ Error generating stack: `+p.message+`
40
+ `+p.stack}return{value:t,source:r,stack:h,digest:null}}function Xc(t,r,o){return{value:t,source:null,stack:o??null,digest:r??null}}function Yc(t,r){try{console.error(r.value)}catch(o){setTimeout(function(){throw o})}}var tw=typeof WeakMap=="function"?WeakMap:Map;function mp(t,r,o){o=Jn(-1,o),o.tag=3,o.payload={element:null};var c=r.value;return o.callback=function(){Qa||(Qa=!0,hu=c),Yc(t,r)},o}function xp(t,r,o){o=Jn(-1,o),o.tag=3;var c=t.type.getDerivedStateFromError;if(typeof c=="function"){var h=r.value;o.payload=function(){return c(h)},o.callback=function(){Yc(t,r)}}var p=t.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(o.callback=function(){Yc(t,r),typeof c!="function"&&(Ar===null?Ar=new Set([this]):Ar.add(this));var w=r.stack;this.componentDidCatch(r.value,{componentStack:w!==null?w:""})}),o}function gp(t,r,o){var c=t.pingCache;if(c===null){c=t.pingCache=new tw;var h=new Set;c.set(r,h)}else h=c.get(r),h===void 0&&(h=new Set,c.set(r,h));h.has(o)||(h.add(o),t=mw.bind(null,t,r,o),r.then(t,t))}function yp(t){do{var r;if((r=t.tag===13)&&(r=t.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return t;t=t.return}while(t!==null);return null}function vp(t,r,o,c,h){return(t.mode&1)===0?(t===r?t.flags|=65536:(t.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(r=Jn(-1,1),r.tag=2,Sr(o,r,1))),o.lanes|=1),t):(t.flags|=65536,t.lanes=h,t)}var nw=P.ReactCurrentOwner,Ut=!1;function Rt(t,r,o,c){r.child=t===null?Bf(r,null,o,c):Ys(r,t.child,o,c)}function wp(t,r,o,c,h){o=o.render;var p=r.ref;return Js(r,h),c=zc(t,r,o,c,p,h),o=Uc(),t!==null&&!Ut?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~h,er(t,r,h)):(nt&&o&&Sc(r),r.flags|=1,Rt(t,r,c,h),r.child)}function bp(t,r,o,c,h){if(t===null){var p=o.type;return typeof p=="function"&&!vu(p)&&p.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(r.tag=15,r.type=p,kp(t,r,p,c,h)):(t=Ja(o.type,null,c,r,r.mode,h),t.ref=r.ref,t.return=r,r.child=t)}if(p=t.child,(t.lanes&h)===0){var w=p.memoizedProps;if(o=o.compare,o=o!==null?o:Yi,o(w,c)&&t.ref===r.ref)return er(t,r,h)}return r.flags|=1,t=Mr(p,c),t.ref=r.ref,t.return=r,r.child=t}function kp(t,r,o,c,h){if(t!==null){var p=t.memoizedProps;if(Yi(p,c)&&t.ref===r.ref)if(Ut=!1,r.pendingProps=c=p,(t.lanes&h)!==0)(t.flags&131072)!==0&&(Ut=!0);else return r.lanes=t.lanes,er(t,r,h)}return Zc(t,r,o,c,h)}function jp(t,r,o){var c=r.pendingProps,h=c.children,p=t!==null?t.memoizedState:null;if(c.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ye(ri,en),en|=o;else{if((o&1073741824)===0)return t=p!==null?p.baseLanes|o:o,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:t,cachePool:null,transitions:null},r.updateQueue=null,Ye(ri,en),en|=t,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=p!==null?p.baseLanes:o,Ye(ri,en),en|=c}else p!==null?(c=p.baseLanes|o,r.memoizedState=null):c=o,Ye(ri,en),en|=c;return Rt(t,r,h,o),r.child}function Np(t,r){var o=r.ref;(t===null&&o!==null||t!==null&&t.ref!==o)&&(r.flags|=512,r.flags|=2097152)}function Zc(t,r,o,c,h){var p=zt(o)?es:Pt.current;return p=Qs(r,p),Js(r,h),o=zc(t,r,o,c,p,h),c=Uc(),t!==null&&!Ut?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~h,er(t,r,h)):(nt&&c&&Sc(r),r.flags|=1,Rt(t,r,o,h),r.child)}function Sp(t,r,o,c,h){if(zt(o)){var p=!0;Na(r)}else p=!1;if(Js(r,h),r.stateNode===null)za(t,r),fp(r,o,c),Gc(r,o,c,h),c=!0;else if(t===null){var w=r.stateNode,T=r.memoizedProps;w.props=T;var I=w.context,Q=o.contextType;typeof Q=="object"&&Q!==null?Q=ln(Q):(Q=zt(o)?es:Pt.current,Q=Qs(r,Q));var ce=o.getDerivedStateFromProps,ue=typeof ce=="function"||typeof w.getSnapshotBeforeUpdate=="function";ue||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(T!==c||I!==Q)&&pp(r,w,c,Q),Nr=!1;var oe=r.memoizedState;w.state=oe,Da(r,c,w,h),I=r.memoizedState,T!==c||oe!==I||Vt.current||Nr?(typeof ce=="function"&&(qc(r,o,ce,c),I=r.memoizedState),(T=Nr||hp(r,o,T,c,oe,I,Q))?(ue||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(r.flags|=4194308)):(typeof w.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=I),w.props=c,w.state=I,w.context=Q,c=T):(typeof w.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{w=r.stateNode,Vf(t,r),T=r.memoizedProps,Q=r.type===r.elementType?T:jn(r.type,T),w.props=Q,ue=r.pendingProps,oe=w.context,I=o.contextType,typeof I=="object"&&I!==null?I=ln(I):(I=zt(o)?es:Pt.current,I=Qs(r,I));var we=o.getDerivedStateFromProps;(ce=typeof we=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(T!==ue||oe!==I)&&pp(r,w,c,I),Nr=!1,oe=r.memoizedState,w.state=oe,Da(r,c,w,h);var je=r.memoizedState;T!==ue||oe!==je||Vt.current||Nr?(typeof we=="function"&&(qc(r,o,we,c),je=r.memoizedState),(Q=Nr||hp(r,o,Q,c,oe,je,I)||!1)?(ce||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(c,je,I),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(c,je,I)),typeof w.componentDidUpdate=="function"&&(r.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof w.componentDidUpdate!="function"||T===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=je),w.props=c,w.state=je,w.context=I,c=Q):(typeof w.componentDidUpdate!="function"||T===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),c=!1)}return Jc(t,r,o,c,p,h)}function Jc(t,r,o,c,h,p){Np(t,r);var w=(r.flags&128)!==0;if(!c&&!w)return h&&Pf(r,o,!1),er(t,r,p);c=r.stateNode,nw.current=r;var T=w&&typeof o.getDerivedStateFromError!="function"?null:c.render();return r.flags|=1,t!==null&&w?(r.child=Ys(r,t.child,null,p),r.child=Ys(r,null,T,p)):Rt(t,r,T,p),r.memoizedState=c.state,h&&Pf(r,o,!0),r.child}function Cp(t){var r=t.stateNode;r.pendingContext?Ef(t,r.pendingContext,r.pendingContext!==r.context):r.context&&Ef(t,r.context,!1),Lc(t,r.containerInfo)}function Ap(t,r,o,c,h){return Xs(),Tc(h),r.flags|=256,Rt(t,r,o,c),r.child}var eu={dehydrated:null,treeContext:null,retryLane:0};function tu(t){return{baseLanes:t,cachePool:null,transitions:null}}function Ep(t,r,o){var c=r.pendingProps,h=rt.current,p=!1,w=(r.flags&128)!==0,T;if((T=w)||(T=t!==null&&t.memoizedState===null?!1:(h&2)!==0),T?(p=!0,r.flags&=-129):(t===null||t.memoizedState!==null)&&(h|=1),Ye(rt,h&1),t===null)return Ec(r),t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((r.mode&1)===0?r.lanes=1:t.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(w=c.children,t=c.fallback,p?(c=r.mode,p=r.child,w={mode:"hidden",children:w},(c&1)===0&&p!==null?(p.childLanes=0,p.pendingProps=w):p=el(w,c,0,null),t=us(t,c,o,null),p.return=r,t.return=r,p.sibling=t,r.child=p,r.child.memoizedState=tu(o),r.memoizedState=eu,t):nu(r,w));if(h=t.memoizedState,h!==null&&(T=h.dehydrated,T!==null))return rw(t,r,w,c,T,h,o);if(p){p=c.fallback,w=r.mode,h=t.child,T=h.sibling;var I={mode:"hidden",children:c.children};return(w&1)===0&&r.child!==h?(c=r.child,c.childLanes=0,c.pendingProps=I,r.deletions=null):(c=Mr(h,I),c.subtreeFlags=h.subtreeFlags&14680064),T!==null?p=Mr(T,p):(p=us(p,w,o,null),p.flags|=2),p.return=r,c.return=r,c.sibling=p,r.child=c,c=p,p=r.child,w=t.child.memoizedState,w=w===null?tu(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},p.memoizedState=w,p.childLanes=t.childLanes&~o,r.memoizedState=eu,c}return p=t.child,t=p.sibling,c=Mr(p,{mode:"visible",children:c.children}),(r.mode&1)===0&&(c.lanes=o),c.return=r,c.sibling=null,t!==null&&(o=r.deletions,o===null?(r.deletions=[t],r.flags|=16):o.push(t)),r.child=c,r.memoizedState=null,c}function nu(t,r){return r=el({mode:"visible",children:r},t.mode,0,null),r.return=t,t.child=r}function Va(t,r,o,c){return c!==null&&Tc(c),Ys(r,t.child,null,o),t=nu(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function rw(t,r,o,c,h,p,w){if(o)return r.flags&256?(r.flags&=-257,c=Xc(Error(s(422))),Va(t,r,w,c)):r.memoizedState!==null?(r.child=t.child,r.flags|=128,null):(p=c.fallback,h=r.mode,c=el({mode:"visible",children:c.children},h,0,null),p=us(p,h,w,null),p.flags|=2,c.return=r,p.return=r,c.sibling=p,r.child=c,(r.mode&1)!==0&&Ys(r,t.child,null,w),r.child.memoizedState=tu(w),r.memoizedState=eu,p);if((r.mode&1)===0)return Va(t,r,w,null);if(h.data==="$!"){if(c=h.nextSibling&&h.nextSibling.dataset,c)var T=c.dgst;return c=T,p=Error(s(419)),c=Xc(p,c,void 0),Va(t,r,w,c)}if(T=(w&t.childLanes)!==0,Ut||T){if(c=bt,c!==null){switch(w&-w){case 4:h=2;break;case 16:h=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:h=32;break;case 536870912:h=268435456;break;default:h=0}h=(h&(c.suspendedLanes|w))!==0?0:h,h!==0&&h!==p.retryLane&&(p.retryLane=h,Zn(t,h),Cn(c,t,h,-1))}return yu(),c=Xc(Error(s(421))),Va(t,r,w,c)}return h.data==="$?"?(r.flags|=128,r.child=t.child,r=xw.bind(null,t),h._reactRetry=r,null):(t=p.treeContext,Jt=wr(h.nextSibling),Zt=r,nt=!0,kn=null,t!==null&&(on[an++]=Xn,on[an++]=Yn,on[an++]=ts,Xn=t.id,Yn=t.overflow,ts=r),r=nu(r,c.children),r.flags|=4096,r)}function Tp(t,r,o){t.lanes|=r;var c=t.alternate;c!==null&&(c.lanes|=r),Dc(t.return,r,o)}function ru(t,r,o,c,h){var p=t.memoizedState;p===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:h}:(p.isBackwards=r,p.rendering=null,p.renderingStartTime=0,p.last=c,p.tail=o,p.tailMode=h)}function Pp(t,r,o){var c=r.pendingProps,h=c.revealOrder,p=c.tail;if(Rt(t,r,c.children,o),c=rt.current,(c&2)!==0)c=c&1|2,r.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Tp(t,o,r);else if(t.tag===19)Tp(t,o,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}c&=1}if(Ye(rt,c),(r.mode&1)===0)r.memoizedState=null;else switch(h){case"forwards":for(o=r.child,h=null;o!==null;)t=o.alternate,t!==null&&Ia(t)===null&&(h=o),o=o.sibling;o=h,o===null?(h=r.child,r.child=null):(h=o.sibling,o.sibling=null),ru(r,!1,h,o,p);break;case"backwards":for(o=null,h=r.child,r.child=null;h!==null;){if(t=h.alternate,t!==null&&Ia(t)===null){r.child=h;break}t=h.sibling,h.sibling=o,o=h,h=t}ru(r,!0,o,null,p);break;case"together":ru(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function za(t,r){(r.mode&1)===0&&t!==null&&(t.alternate=null,r.alternate=null,r.flags|=2)}function er(t,r,o){if(t!==null&&(r.dependencies=t.dependencies),os|=r.lanes,(o&r.childLanes)===0)return null;if(t!==null&&r.child!==t.child)throw Error(s(153));if(r.child!==null){for(t=r.child,o=Mr(t,t.pendingProps),r.child=o,o.return=r;t.sibling!==null;)t=t.sibling,o=o.sibling=Mr(t,t.pendingProps),o.return=r;o.sibling=null}return r.child}function sw(t,r,o){switch(r.tag){case 3:Cp(r),Xs();break;case 5:Wf(r);break;case 1:zt(r.type)&&Na(r);break;case 4:Lc(r,r.stateNode.containerInfo);break;case 10:var c=r.type._context,h=r.memoizedProps.value;Ye(Pa,c._currentValue),c._currentValue=h;break;case 13:if(c=r.memoizedState,c!==null)return c.dehydrated!==null?(Ye(rt,rt.current&1),r.flags|=128,null):(o&r.child.childLanes)!==0?Ep(t,r,o):(Ye(rt,rt.current&1),t=er(t,r,o),t!==null?t.sibling:null);Ye(rt,rt.current&1);break;case 19:if(c=(o&r.childLanes)!==0,(t.flags&128)!==0){if(c)return Pp(t,r,o);r.flags|=128}if(h=r.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),Ye(rt,rt.current),c)break;return null;case 22:case 23:return r.lanes=0,jp(t,r,o)}return er(t,r,o)}var Mp,su,Fp,Dp;Mp=function(t,r){for(var o=r.child;o!==null;){if(o.tag===5||o.tag===6)t.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},su=function(){},Fp=function(t,r,o,c){var h=t.memoizedProps;if(h!==c){t=r.stateNode,ss(_n.current);var p=null;switch(o){case"input":h=Te(t,h),c=Te(t,c),p=[];break;case"select":h=V({},h,{value:void 0}),c=V({},c,{value:void 0}),p=[];break;case"textarea":h=ne(t,h),c=ne(t,c),p=[];break;default:typeof h.onClick!="function"&&typeof c.onClick=="function"&&(t.onclick=ba)}fr(o,c);var w;o=null;for(Q in h)if(!c.hasOwnProperty(Q)&&h.hasOwnProperty(Q)&&h[Q]!=null)if(Q==="style"){var T=h[Q];for(w in T)T.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else Q!=="dangerouslySetInnerHTML"&&Q!=="children"&&Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&Q!=="autoFocus"&&(l.hasOwnProperty(Q)?p||(p=[]):(p=p||[]).push(Q,null));for(Q in c){var I=c[Q];if(T=h!=null?h[Q]:void 0,c.hasOwnProperty(Q)&&I!==T&&(I!=null||T!=null))if(Q==="style")if(T){for(w in T)!T.hasOwnProperty(w)||I&&I.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in I)I.hasOwnProperty(w)&&T[w]!==I[w]&&(o||(o={}),o[w]=I[w])}else o||(p||(p=[]),p.push(Q,o)),o=I;else Q==="dangerouslySetInnerHTML"?(I=I?I.__html:void 0,T=T?T.__html:void 0,I!=null&&T!==I&&(p=p||[]).push(Q,I)):Q==="children"?typeof I!="string"&&typeof I!="number"||(p=p||[]).push(Q,""+I):Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&(l.hasOwnProperty(Q)?(I!=null&&Q==="onScroll"&&Je("scroll",t),p||T===I||(p=[])):(p=p||[]).push(Q,I))}o&&(p=p||[]).push("style",o);var Q=p;(r.updateQueue=Q)&&(r.flags|=4)}},Dp=function(t,r,o,c){o!==c&&(r.flags|=4)};function fo(t,r){if(!nt)switch(t.tailMode){case"hidden":r=t.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function Ft(t){var r=t.alternate!==null&&t.alternate.child===t.child,o=0,c=0;if(r)for(var h=t.child;h!==null;)o|=h.lanes|h.childLanes,c|=h.subtreeFlags&14680064,c|=h.flags&14680064,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)o|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=c,t.childLanes=o,r}function iw(t,r,o){var c=r.pendingProps;switch(Cc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(r),null;case 1:return zt(r.type)&&ja(),Ft(r),null;case 3:return c=r.stateNode,ei(),et(Vt),et(Pt),Bc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(t===null||t.child===null)&&(Ea(r)?r.flags|=4:t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,kn!==null&&(mu(kn),kn=null))),su(t,r),Ft(r),null;case 5:Rc(r);var h=ss(ao.current);if(o=r.type,t!==null&&r.stateNode!=null)Fp(t,r,o,c,h),t.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!c){if(r.stateNode===null)throw Error(s(166));return Ft(r),null}if(t=ss(_n.current),Ea(r)){c=r.stateNode,o=r.type;var p=r.memoizedProps;switch(c[In]=r,c[no]=p,t=(r.mode&1)!==0,o){case"dialog":Je("cancel",c),Je("close",c);break;case"iframe":case"object":case"embed":Je("load",c);break;case"video":case"audio":for(h=0;h<Ji.length;h++)Je(Ji[h],c);break;case"source":Je("error",c);break;case"img":case"image":case"link":Je("error",c),Je("load",c);break;case"details":Je("toggle",c);break;case"input":Ze(c,p),Je("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!p.multiple},Je("invalid",c);break;case"textarea":ve(c,p),Je("invalid",c)}fr(o,p),h=null;for(var w in p)if(p.hasOwnProperty(w)){var T=p[w];w==="children"?typeof T=="string"?c.textContent!==T&&(p.suppressHydrationWarning!==!0&&wa(c.textContent,T,t),h=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(p.suppressHydrationWarning!==!0&&wa(c.textContent,T,t),h=["children",""+T]):l.hasOwnProperty(w)&&T!=null&&w==="onScroll"&&Je("scroll",c)}switch(o){case"input":ee(c),sn(c,p,!0);break;case"textarea":ee(c),Xe(c);break;case"select":case"option":break;default:typeof p.onClick=="function"&&(c.onclick=ba)}c=h,r.updateQueue=c,c!==null&&(r.flags|=4)}else{w=h.nodeType===9?h:h.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=yt(o)),t==="http://www.w3.org/1999/xhtml"?o==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof c.is=="string"?t=w.createElement(o,{is:c.is}):(t=w.createElement(o),o==="select"&&(w=t,c.multiple?w.multiple=!0:c.size&&(w.size=c.size))):t=w.createElementNS(t,o),t[In]=r,t[no]=c,Mp(t,r,!1,!1),r.stateNode=t;e:{switch(w=Ls(o,c),o){case"dialog":Je("cancel",t),Je("close",t),h=c;break;case"iframe":case"object":case"embed":Je("load",t),h=c;break;case"video":case"audio":for(h=0;h<Ji.length;h++)Je(Ji[h],t);h=c;break;case"source":Je("error",t),h=c;break;case"img":case"image":case"link":Je("error",t),Je("load",t),h=c;break;case"details":Je("toggle",t),h=c;break;case"input":Ze(t,c),h=Te(t,c),Je("invalid",t);break;case"option":h=c;break;case"select":t._wrapperState={wasMultiple:!!c.multiple},h=V({},c,{value:void 0}),Je("invalid",t);break;case"textarea":ve(t,c),h=ne(t,c),Je("invalid",t);break;default:h=c}fr(o,h),T=h;for(p in T)if(T.hasOwnProperty(p)){var I=T[p];p==="style"?_s(t,I):p==="dangerouslySetInnerHTML"?(I=I?I.__html:void 0,I!=null&&Mn(t,I)):p==="children"?typeof I=="string"?(o!=="textarea"||I!=="")&&Nt(t,I):typeof I=="number"&&Nt(t,""+I):p!=="suppressContentEditableWarning"&&p!=="suppressHydrationWarning"&&p!=="autoFocus"&&(l.hasOwnProperty(p)?I!=null&&p==="onScroll"&&Je("scroll",t):I!=null&&A(t,p,I,w))}switch(o){case"input":ee(t),sn(t,c,!1);break;case"textarea":ee(t),Xe(t);break;case"option":c.value!=null&&t.setAttribute("value",""+ae(c.value));break;case"select":t.multiple=!!c.multiple,p=c.value,p!=null?re(t,!!c.multiple,p,!1):c.defaultValue!=null&&re(t,!!c.multiple,c.defaultValue,!0);break;default:typeof h.onClick=="function"&&(t.onclick=ba)}switch(o){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return Ft(r),null;case 6:if(t&&r.stateNode!=null)Dp(t,r,t.memoizedProps,c);else{if(typeof c!="string"&&r.stateNode===null)throw Error(s(166));if(o=ss(ao.current),ss(_n.current),Ea(r)){if(c=r.stateNode,o=r.memoizedProps,c[In]=r,(p=c.nodeValue!==o)&&(t=Zt,t!==null))switch(t.tag){case 3:wa(c.nodeValue,o,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&wa(c.nodeValue,o,(t.mode&1)!==0)}p&&(r.flags|=4)}else c=(o.nodeType===9?o:o.ownerDocument).createTextNode(c),c[In]=r,r.stateNode=c}return Ft(r),null;case 13:if(et(rt),c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(nt&&Jt!==null&&(r.mode&1)!==0&&(r.flags&128)===0)Lf(),Xs(),r.flags|=98560,p=!1;else if(p=Ea(r),c!==null&&c.dehydrated!==null){if(t===null){if(!p)throw Error(s(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(s(317));p[In]=r}else Xs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ft(r),p=!1}else kn!==null&&(mu(kn),kn=null),p=!0;if(!p)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=o,r):(c=c!==null,c!==(t!==null&&t.memoizedState!==null)&&c&&(r.child.flags|=8192,(r.mode&1)!==0&&(t===null||(rt.current&1)!==0?pt===0&&(pt=3):yu())),r.updateQueue!==null&&(r.flags|=4),Ft(r),null);case 4:return ei(),su(t,r),t===null&&eo(r.stateNode.containerInfo),Ft(r),null;case 10:return Fc(r.type._context),Ft(r),null;case 17:return zt(r.type)&&ja(),Ft(r),null;case 19:if(et(rt),p=r.memoizedState,p===null)return Ft(r),null;if(c=(r.flags&128)!==0,w=p.rendering,w===null)if(c)fo(p,!1);else{if(pt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(w=Ia(t),w!==null){for(r.flags|=128,fo(p,!1),c=w.updateQueue,c!==null&&(r.updateQueue=c,r.flags|=4),r.subtreeFlags=0,c=o,o=r.child;o!==null;)p=o,t=c,p.flags&=14680066,w=p.alternate,w===null?(p.childLanes=0,p.lanes=t,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=w.childLanes,p.lanes=w.lanes,p.child=w.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=w.memoizedProps,p.memoizedState=w.memoizedState,p.updateQueue=w.updateQueue,p.type=w.type,t=w.dependencies,p.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),o=o.sibling;return Ye(rt,rt.current&1|2),r.child}t=t.sibling}p.tail!==null&&ct()>si&&(r.flags|=128,c=!0,fo(p,!1),r.lanes=4194304)}else{if(!c)if(t=Ia(w),t!==null){if(r.flags|=128,c=!0,o=t.updateQueue,o!==null&&(r.updateQueue=o,r.flags|=4),fo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!w.alternate&&!nt)return Ft(r),null}else 2*ct()-p.renderingStartTime>si&&o!==1073741824&&(r.flags|=128,c=!0,fo(p,!1),r.lanes=4194304);p.isBackwards?(w.sibling=r.child,r.child=w):(o=p.last,o!==null?o.sibling=w:r.child=w,p.last=w)}return p.tail!==null?(r=p.tail,p.rendering=r,p.tail=r.sibling,p.renderingStartTime=ct(),r.sibling=null,o=rt.current,Ye(rt,c?o&1|2:o&1),r):(Ft(r),null);case 22:case 23:return gu(),c=r.memoizedState!==null,t!==null&&t.memoizedState!==null!==c&&(r.flags|=8192),c&&(r.mode&1)!==0?(en&1073741824)!==0&&(Ft(r),r.subtreeFlags&6&&(r.flags|=8192)):Ft(r),null;case 24:return null;case 25:return null}throw Error(s(156,r.tag))}function ow(t,r){switch(Cc(r),r.tag){case 1:return zt(r.type)&&ja(),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return ei(),et(Vt),et(Pt),Bc(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 5:return Rc(r),null;case 13:if(et(rt),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Xs()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return et(rt),null;case 4:return ei(),null;case 10:return Fc(r.type._context),null;case 22:case 23:return gu(),null;case 24:return null;default:return null}}var Ua=!1,Dt=!1,aw=typeof WeakSet=="function"?WeakSet:Set,be=null;function ni(t,r){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){ot(t,r,c)}else o.current=null}function iu(t,r,o){try{o()}catch(c){ot(t,r,c)}}var Ip=!1;function lw(t,r){if(gc=ca,t=hf(),cc(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var h=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var w=0,T=-1,I=-1,Q=0,ce=0,ue=t,oe=null;t:for(;;){for(var we;ue!==o||h!==0&&ue.nodeType!==3||(T=w+h),ue!==p||c!==0&&ue.nodeType!==3||(I=w+c),ue.nodeType===3&&(w+=ue.nodeValue.length),(we=ue.firstChild)!==null;)oe=ue,ue=we;for(;;){if(ue===t)break t;if(oe===o&&++Q===h&&(T=w),oe===p&&++ce===c&&(I=w),(we=ue.nextSibling)!==null)break;ue=oe,oe=ue.parentNode}ue=we}o=T===-1||I===-1?null:{start:T,end:I}}else o=null}o=o||{start:0,end:0}}else o=null;for(yc={focusedElem:t,selectionRange:o},ca=!1,be=r;be!==null;)if(r=be,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,be=t;else for(;be!==null;){r=be;try{var je=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var Ne=je.memoizedProps,ut=je.memoizedState,U=r.stateNode,O=U.getSnapshotBeforeUpdate(r.elementType===r.type?Ne:jn(r.type,Ne),ut);U.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var K=r.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(pe){ot(r,r.return,pe)}if(t=r.sibling,t!==null){t.return=r.return,be=t;break}be=r.return}return je=Ip,Ip=!1,je}function po(t,r,o){var c=r.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&t)===t){var p=h.destroy;h.destroy=void 0,p!==void 0&&iu(r,o,p)}h=h.next}while(h!==c)}}function Wa(t,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var c=o.create;o.destroy=c()}o=o.next}while(o!==r)}}function ou(t){var r=t.ref;if(r!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof r=="function"?r(t):r.current=t}}function _p(t){var r=t.alternate;r!==null&&(t.alternate=null,_p(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&(delete r[In],delete r[no],delete r[kc],delete r[Wv],delete r[Kv])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Lp(t){return t.tag===5||t.tag===3||t.tag===4}function Rp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Lp(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function au(t,r,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?o.nodeType===8?o.parentNode.insertBefore(t,r):o.insertBefore(t,r):(o.nodeType===8?(r=o.parentNode,r.insertBefore(t,o)):(r=o,r.appendChild(t)),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=ba));else if(c!==4&&(t=t.child,t!==null))for(au(t,r,o),t=t.sibling;t!==null;)au(t,r,o),t=t.sibling}function lu(t,r,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?o.insertBefore(t,r):o.appendChild(t);else if(c!==4&&(t=t.child,t!==null))for(lu(t,r,o),t=t.sibling;t!==null;)lu(t,r,o),t=t.sibling}var Ct=null,Nn=!1;function Cr(t,r,o){for(o=o.child;o!==null;)Op(t,r,o),o=o.sibling}function Op(t,r,o){if(Dn&&typeof Dn.onCommitFiberUnmount=="function")try{Dn.onCommitFiberUnmount(ra,o)}catch{}switch(o.tag){case 5:Dt||ni(o,r);case 6:var c=Ct,h=Nn;Ct=null,Cr(t,r,o),Ct=c,Nn=h,Ct!==null&&(Nn?(t=Ct,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):Ct.removeChild(o.stateNode));break;case 18:Ct!==null&&(Nn?(t=Ct,o=o.stateNode,t.nodeType===8?bc(t.parentNode,o):t.nodeType===1&&bc(t,o),Ki(t)):bc(Ct,o.stateNode));break;case 4:c=Ct,h=Nn,Ct=o.stateNode.containerInfo,Nn=!0,Cr(t,r,o),Ct=c,Nn=h;break;case 0:case 11:case 14:case 15:if(!Dt&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){h=c=c.next;do{var p=h,w=p.destroy;p=p.tag,w!==void 0&&((p&2)!==0||(p&4)!==0)&&iu(o,r,w),h=h.next}while(h!==c)}Cr(t,r,o);break;case 1:if(!Dt&&(ni(o,r),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(T){ot(o,r,T)}Cr(t,r,o);break;case 21:Cr(t,r,o);break;case 22:o.mode&1?(Dt=(c=Dt)||o.memoizedState!==null,Cr(t,r,o),Dt=c):Cr(t,r,o);break;default:Cr(t,r,o)}}function Bp(t){var r=t.updateQueue;if(r!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new aw),r.forEach(function(c){var h=gw.bind(null,t,c);o.has(c)||(o.add(c),c.then(h,h))})}}function Sn(t,r){var o=r.deletions;if(o!==null)for(var c=0;c<o.length;c++){var h=o[c];try{var p=t,w=r,T=w;e:for(;T!==null;){switch(T.tag){case 5:Ct=T.stateNode,Nn=!1;break e;case 3:Ct=T.stateNode.containerInfo,Nn=!0;break e;case 4:Ct=T.stateNode.containerInfo,Nn=!0;break e}T=T.return}if(Ct===null)throw Error(s(160));Op(p,w,h),Ct=null,Nn=!1;var I=h.alternate;I!==null&&(I.return=null),h.return=null}catch(Q){ot(h,r,Q)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)$p(r,t),r=r.sibling}function $p(t,r){var o=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Sn(r,t),Rn(t),c&4){try{po(3,t,t.return),Wa(3,t)}catch(Ne){ot(t,t.return,Ne)}try{po(5,t,t.return)}catch(Ne){ot(t,t.return,Ne)}}break;case 1:Sn(r,t),Rn(t),c&512&&o!==null&&ni(o,o.return);break;case 5:if(Sn(r,t),Rn(t),c&512&&o!==null&&ni(o,o.return),t.flags&32){var h=t.stateNode;try{Nt(h,"")}catch(Ne){ot(t,t.return,Ne)}}if(c&4&&(h=t.stateNode,h!=null)){var p=t.memoizedProps,w=o!==null?o.memoizedProps:p,T=t.type,I=t.updateQueue;if(t.updateQueue=null,I!==null)try{T==="input"&&p.type==="radio"&&p.name!=null&&Ge(h,p),Ls(T,w);var Q=Ls(T,p);for(w=0;w<I.length;w+=2){var ce=I[w],ue=I[w+1];ce==="style"?_s(h,ue):ce==="dangerouslySetInnerHTML"?Mn(h,ue):ce==="children"?Nt(h,ue):A(h,ce,ue,Q)}switch(T){case"input":yn(h,p);break;case"textarea":Ae(h,p);break;case"select":var oe=h._wrapperState.wasMultiple;h._wrapperState.wasMultiple=!!p.multiple;var we=p.value;we!=null?re(h,!!p.multiple,we,!1):oe!==!!p.multiple&&(p.defaultValue!=null?re(h,!!p.multiple,p.defaultValue,!0):re(h,!!p.multiple,p.multiple?[]:"",!1))}h[no]=p}catch(Ne){ot(t,t.return,Ne)}}break;case 6:if(Sn(r,t),Rn(t),c&4){if(t.stateNode===null)throw Error(s(162));h=t.stateNode,p=t.memoizedProps;try{h.nodeValue=p}catch(Ne){ot(t,t.return,Ne)}}break;case 3:if(Sn(r,t),Rn(t),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Ki(r.containerInfo)}catch(Ne){ot(t,t.return,Ne)}break;case 4:Sn(r,t),Rn(t);break;case 13:Sn(r,t),Rn(t),h=t.child,h.flags&8192&&(p=h.memoizedState!==null,h.stateNode.isHidden=p,!p||h.alternate!==null&&h.alternate.memoizedState!==null||(du=ct())),c&4&&Bp(t);break;case 22:if(ce=o!==null&&o.memoizedState!==null,t.mode&1?(Dt=(Q=Dt)||ce,Sn(r,t),Dt=Q):Sn(r,t),Rn(t),c&8192){if(Q=t.memoizedState!==null,(t.stateNode.isHidden=Q)&&!ce&&(t.mode&1)!==0)for(be=t,ce=t.child;ce!==null;){for(ue=be=ce;be!==null;){switch(oe=be,we=oe.child,oe.tag){case 0:case 11:case 14:case 15:po(4,oe,oe.return);break;case 1:ni(oe,oe.return);var je=oe.stateNode;if(typeof je.componentWillUnmount=="function"){c=oe,o=oe.return;try{r=c,je.props=r.memoizedProps,je.state=r.memoizedState,je.componentWillUnmount()}catch(Ne){ot(c,o,Ne)}}break;case 5:ni(oe,oe.return);break;case 22:if(oe.memoizedState!==null){Up(ue);continue}}we!==null?(we.return=oe,be=we):Up(ue)}ce=ce.sibling}e:for(ce=null,ue=t;;){if(ue.tag===5){if(ce===null){ce=ue;try{h=ue.stateNode,Q?(p=h.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none"):(T=ue.stateNode,I=ue.memoizedProps.style,w=I!=null&&I.hasOwnProperty("display")?I.display:null,T.style.display=Gr("display",w))}catch(Ne){ot(t,t.return,Ne)}}}else if(ue.tag===6){if(ce===null)try{ue.stateNode.nodeValue=Q?"":ue.memoizedProps}catch(Ne){ot(t,t.return,Ne)}}else if((ue.tag!==22&&ue.tag!==23||ue.memoizedState===null||ue===t)&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===t)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===t)break e;ce===ue&&(ce=null),ue=ue.return}ce===ue&&(ce=null),ue.sibling.return=ue.return,ue=ue.sibling}}break;case 19:Sn(r,t),Rn(t),c&4&&Bp(t);break;case 21:break;default:Sn(r,t),Rn(t)}}function Rn(t){var r=t.flags;if(r&2){try{e:{for(var o=t.return;o!==null;){if(Lp(o)){var c=o;break e}o=o.return}throw Error(s(160))}switch(c.tag){case 5:var h=c.stateNode;c.flags&32&&(Nt(h,""),c.flags&=-33);var p=Rp(t);lu(t,p,h);break;case 3:case 4:var w=c.stateNode.containerInfo,T=Rp(t);au(t,T,w);break;default:throw Error(s(161))}}catch(I){ot(t,t.return,I)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function cw(t,r,o){be=t,Vp(t)}function Vp(t,r,o){for(var c=(t.mode&1)!==0;be!==null;){var h=be,p=h.child;if(h.tag===22&&c){var w=h.memoizedState!==null||Ua;if(!w){var T=h.alternate,I=T!==null&&T.memoizedState!==null||Dt;T=Ua;var Q=Dt;if(Ua=w,(Dt=I)&&!Q)for(be=h;be!==null;)w=be,I=w.child,w.tag===22&&w.memoizedState!==null?Wp(h):I!==null?(I.return=w,be=I):Wp(h);for(;p!==null;)be=p,Vp(p),p=p.sibling;be=h,Ua=T,Dt=Q}zp(t)}else(h.subtreeFlags&8772)!==0&&p!==null?(p.return=h,be=p):zp(t)}}function zp(t){for(;be!==null;){var r=be;if((r.flags&8772)!==0){var o=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:Dt||Wa(5,r);break;case 1:var c=r.stateNode;if(r.flags&4&&!Dt)if(o===null)c.componentDidMount();else{var h=r.elementType===r.type?o.memoizedProps:jn(r.type,o.memoizedProps);c.componentDidUpdate(h,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var p=r.updateQueue;p!==null&&Uf(r,p,c);break;case 3:var w=r.updateQueue;if(w!==null){if(o=null,r.child!==null)switch(r.child.tag){case 5:o=r.child.stateNode;break;case 1:o=r.child.stateNode}Uf(r,w,o)}break;case 5:var T=r.stateNode;if(o===null&&r.flags&4){o=T;var I=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":I.autoFocus&&o.focus();break;case"img":I.src&&(o.src=I.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var Q=r.alternate;if(Q!==null){var ce=Q.memoizedState;if(ce!==null){var ue=ce.dehydrated;ue!==null&&Ki(ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}Dt||r.flags&512&&ou(r)}catch(oe){ot(r,r.return,oe)}}if(r===t){be=null;break}if(o=r.sibling,o!==null){o.return=r.return,be=o;break}be=r.return}}function Up(t){for(;be!==null;){var r=be;if(r===t){be=null;break}var o=r.sibling;if(o!==null){o.return=r.return,be=o;break}be=r.return}}function Wp(t){for(;be!==null;){var r=be;try{switch(r.tag){case 0:case 11:case 15:var o=r.return;try{Wa(4,r)}catch(I){ot(r,o,I)}break;case 1:var c=r.stateNode;if(typeof c.componentDidMount=="function"){var h=r.return;try{c.componentDidMount()}catch(I){ot(r,h,I)}}var p=r.return;try{ou(r)}catch(I){ot(r,p,I)}break;case 5:var w=r.return;try{ou(r)}catch(I){ot(r,w,I)}}}catch(I){ot(r,r.return,I)}if(r===t){be=null;break}var T=r.sibling;if(T!==null){T.return=r.return,be=T;break}be=r.return}}var uw=Math.ceil,Ka=P.ReactCurrentDispatcher,cu=P.ReactCurrentOwner,un=P.ReactCurrentBatchConfig,We=0,bt=null,ht=null,At=0,en=0,ri=br(0),pt=0,mo=null,os=0,Ha=0,uu=0,xo=null,Wt=null,du=0,si=1/0,tr=null,Qa=!1,hu=null,Ar=null,qa=!1,Er=null,Ga=0,go=0,fu=null,Xa=-1,Ya=0;function Ot(){return(We&6)!==0?ct():Xa!==-1?Xa:Xa=ct()}function Tr(t){return(t.mode&1)===0?1:(We&2)!==0&&At!==0?At&-At:Qv.transition!==null?(Ya===0&&(Ya=Lh()),Ya):(t=qe,t!==0||(t=window.event,t=t===void 0?16:Kh(t.type)),t)}function Cn(t,r,o,c){if(50<go)throw go=0,fu=null,Error(s(185));$i(t,o,c),((We&2)===0||t!==bt)&&(t===bt&&((We&2)===0&&(Ha|=o),pt===4&&Pr(t,At)),Kt(t,c),o===1&&We===0&&(r.mode&1)===0&&(si=ct()+500,Sa&&jr()))}function Kt(t,r){var o=t.callbackNode;Qy(t,r);var c=oa(t,t===bt?At:0);if(c===0)o!==null&&Dh(o),t.callbackNode=null,t.callbackPriority=0;else if(r=c&-c,t.callbackPriority!==r){if(o!=null&&Dh(o),r===1)t.tag===0?Hv(Hp.bind(null,t)):Mf(Hp.bind(null,t)),zv(function(){(We&6)===0&&jr()}),o=null;else{switch(Rh(c)){case 1:o=Hl;break;case 4:o=Ih;break;case 16:o=na;break;case 536870912:o=_h;break;default:o=na}o=em(o,Kp.bind(null,t))}t.callbackPriority=r,t.callbackNode=o}}function Kp(t,r){if(Xa=-1,Ya=0,(We&6)!==0)throw Error(s(327));var o=t.callbackNode;if(ii()&&t.callbackNode!==o)return null;var c=oa(t,t===bt?At:0);if(c===0)return null;if((c&30)!==0||(c&t.expiredLanes)!==0||r)r=Za(t,c);else{r=c;var h=We;We|=2;var p=qp();(bt!==t||At!==r)&&(tr=null,si=ct()+500,ls(t,r));do try{fw();break}catch(T){Qp(t,T)}while(!0);Mc(),Ka.current=p,We=h,ht!==null?r=0:(bt=null,At=0,r=pt)}if(r!==0){if(r===2&&(h=Ql(t),h!==0&&(c=h,r=pu(t,h))),r===1)throw o=mo,ls(t,0),Pr(t,c),Kt(t,ct()),o;if(r===6)Pr(t,c);else{if(h=t.current.alternate,(c&30)===0&&!dw(h)&&(r=Za(t,c),r===2&&(p=Ql(t),p!==0&&(c=p,r=pu(t,p))),r===1))throw o=mo,ls(t,0),Pr(t,c),Kt(t,ct()),o;switch(t.finishedWork=h,t.finishedLanes=c,r){case 0:case 1:throw Error(s(345));case 2:cs(t,Wt,tr);break;case 3:if(Pr(t,c),(c&130023424)===c&&(r=du+500-ct(),10<r)){if(oa(t,0)!==0)break;if(h=t.suspendedLanes,(h&c)!==c){Ot(),t.pingedLanes|=t.suspendedLanes&h;break}t.timeoutHandle=wc(cs.bind(null,t,Wt,tr),r);break}cs(t,Wt,tr);break;case 4:if(Pr(t,c),(c&4194240)===c)break;for(r=t.eventTimes,h=-1;0<c;){var w=31-wn(c);p=1<<w,w=r[w],w>h&&(h=w),c&=~p}if(c=h,c=ct()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*uw(c/1960))-c,10<c){t.timeoutHandle=wc(cs.bind(null,t,Wt,tr),c);break}cs(t,Wt,tr);break;case 5:cs(t,Wt,tr);break;default:throw Error(s(329))}}}return Kt(t,ct()),t.callbackNode===o?Kp.bind(null,t):null}function pu(t,r){var o=xo;return t.current.memoizedState.isDehydrated&&(ls(t,r).flags|=256),t=Za(t,r),t!==2&&(r=Wt,Wt=o,r!==null&&mu(r)),t}function mu(t){Wt===null?Wt=t:Wt.push.apply(Wt,t)}function dw(t){for(var r=t;;){if(r.flags&16384){var o=r.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var c=0;c<o.length;c++){var h=o[c],p=h.getSnapshot;h=h.value;try{if(!bn(p(),h))return!1}catch{return!1}}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Pr(t,r){for(r&=~uu,r&=~Ha,t.suspendedLanes|=r,t.pingedLanes&=~r,t=t.expirationTimes;0<r;){var o=31-wn(r),c=1<<o;t[o]=-1,r&=~c}}function Hp(t){if((We&6)!==0)throw Error(s(327));ii();var r=oa(t,0);if((r&1)===0)return Kt(t,ct()),null;var o=Za(t,r);if(t.tag!==0&&o===2){var c=Ql(t);c!==0&&(r=c,o=pu(t,c))}if(o===1)throw o=mo,ls(t,0),Pr(t,r),Kt(t,ct()),o;if(o===6)throw Error(s(345));return t.finishedWork=t.current.alternate,t.finishedLanes=r,cs(t,Wt,tr),Kt(t,ct()),null}function xu(t,r){var o=We;We|=1;try{return t(r)}finally{We=o,We===0&&(si=ct()+500,Sa&&jr())}}function as(t){Er!==null&&Er.tag===0&&(We&6)===0&&ii();var r=We;We|=1;var o=un.transition,c=qe;try{if(un.transition=null,qe=1,t)return t()}finally{qe=c,un.transition=o,We=r,(We&6)===0&&jr()}}function gu(){en=ri.current,et(ri)}function ls(t,r){t.finishedWork=null,t.finishedLanes=0;var o=t.timeoutHandle;if(o!==-1&&(t.timeoutHandle=-1,Vv(o)),ht!==null)for(o=ht.return;o!==null;){var c=o;switch(Cc(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ja();break;case 3:ei(),et(Vt),et(Pt),Bc();break;case 5:Rc(c);break;case 4:ei();break;case 13:et(rt);break;case 19:et(rt);break;case 10:Fc(c.type._context);break;case 22:case 23:gu()}o=o.return}if(bt=t,ht=t=Mr(t.current,null),At=en=r,pt=0,mo=null,uu=Ha=os=0,Wt=xo=null,rs!==null){for(r=0;r<rs.length;r++)if(o=rs[r],c=o.interleaved,c!==null){o.interleaved=null;var h=c.next,p=o.pending;if(p!==null){var w=p.next;p.next=h,c.next=w}o.pending=c}rs=null}return t}function Qp(t,r){do{var o=ht;try{if(Mc(),_a.current=Ba,La){for(var c=st.memoizedState;c!==null;){var h=c.queue;h!==null&&(h.pending=null),c=c.next}La=!1}if(is=0,wt=ft=st=null,lo=!1,co=0,cu.current=null,o===null||o.return===null){pt=1,mo=r,ht=null;break}e:{var p=t,w=o.return,T=o,I=r;if(r=At,T.flags|=32768,I!==null&&typeof I=="object"&&typeof I.then=="function"){var Q=I,ce=T,ue=ce.tag;if((ce.mode&1)===0&&(ue===0||ue===11||ue===15)){var oe=ce.alternate;oe?(ce.updateQueue=oe.updateQueue,ce.memoizedState=oe.memoizedState,ce.lanes=oe.lanes):(ce.updateQueue=null,ce.memoizedState=null)}var we=yp(w);if(we!==null){we.flags&=-257,vp(we,w,T,p,r),we.mode&1&&gp(p,Q,r),r=we,I=Q;var je=r.updateQueue;if(je===null){var Ne=new Set;Ne.add(I),r.updateQueue=Ne}else je.add(I);break e}else{if((r&1)===0){gp(p,Q,r),yu();break e}I=Error(s(426))}}else if(nt&&T.mode&1){var ut=yp(w);if(ut!==null){(ut.flags&65536)===0&&(ut.flags|=256),vp(ut,w,T,p,r),Tc(ti(I,T));break e}}p=I=ti(I,T),pt!==4&&(pt=2),xo===null?xo=[p]:xo.push(p),p=w;do{switch(p.tag){case 3:p.flags|=65536,r&=-r,p.lanes|=r;var U=mp(p,I,r);zf(p,U);break e;case 1:T=I;var O=p.type,K=p.stateNode;if((p.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||K!==null&&typeof K.componentDidCatch=="function"&&(Ar===null||!Ar.has(K)))){p.flags|=65536,r&=-r,p.lanes|=r;var pe=xp(p,T,r);zf(p,pe);break e}}p=p.return}while(p!==null)}Xp(o)}catch(Se){r=Se,ht===o&&o!==null&&(ht=o=o.return);continue}break}while(!0)}function qp(){var t=Ka.current;return Ka.current=Ba,t===null?Ba:t}function yu(){(pt===0||pt===3||pt===2)&&(pt=4),bt===null||(os&268435455)===0&&(Ha&268435455)===0||Pr(bt,At)}function Za(t,r){var o=We;We|=2;var c=qp();(bt!==t||At!==r)&&(tr=null,ls(t,r));do try{hw();break}catch(h){Qp(t,h)}while(!0);if(Mc(),We=o,Ka.current=c,ht!==null)throw Error(s(261));return bt=null,At=0,pt}function hw(){for(;ht!==null;)Gp(ht)}function fw(){for(;ht!==null&&!Oy();)Gp(ht)}function Gp(t){var r=Jp(t.alternate,t,en);t.memoizedProps=t.pendingProps,r===null?Xp(t):ht=r,cu.current=null}function Xp(t){var r=t;do{var o=r.alternate;if(t=r.return,(r.flags&32768)===0){if(o=iw(o,r,en),o!==null){ht=o;return}}else{if(o=ow(o,r),o!==null){o.flags&=32767,ht=o;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{pt=6,ht=null;return}}if(r=r.sibling,r!==null){ht=r;return}ht=r=t}while(r!==null);pt===0&&(pt=5)}function cs(t,r,o){var c=qe,h=un.transition;try{un.transition=null,qe=1,pw(t,r,o,c)}finally{un.transition=h,qe=c}return null}function pw(t,r,o,c){do ii();while(Er!==null);if((We&6)!==0)throw Error(s(327));o=t.finishedWork;var h=t.finishedLanes;if(o===null)return null;if(t.finishedWork=null,t.finishedLanes=0,o===t.current)throw Error(s(177));t.callbackNode=null,t.callbackPriority=0;var p=o.lanes|o.childLanes;if(qy(t,p),t===bt&&(ht=bt=null,At=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||qa||(qa=!0,em(na,function(){return ii(),null})),p=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||p){p=un.transition,un.transition=null;var w=qe;qe=1;var T=We;We|=4,cu.current=null,lw(t,o),$p(o,t),Iv(yc),ca=!!gc,yc=gc=null,t.current=o,cw(o),By(),We=T,qe=w,un.transition=p}else t.current=o;if(qa&&(qa=!1,Er=t,Ga=h),p=t.pendingLanes,p===0&&(Ar=null),zy(o.stateNode),Kt(t,ct()),r!==null)for(c=t.onRecoverableError,o=0;o<r.length;o++)h=r[o],c(h.value,{componentStack:h.stack,digest:h.digest});if(Qa)throw Qa=!1,t=hu,hu=null,t;return(Ga&1)!==0&&t.tag!==0&&ii(),p=t.pendingLanes,(p&1)!==0?t===fu?go++:(go=0,fu=t):go=0,jr(),null}function ii(){if(Er!==null){var t=Rh(Ga),r=un.transition,o=qe;try{if(un.transition=null,qe=16>t?16:t,Er===null)var c=!1;else{if(t=Er,Er=null,Ga=0,(We&6)!==0)throw Error(s(331));var h=We;for(We|=4,be=t.current;be!==null;){var p=be,w=p.child;if((be.flags&16)!==0){var T=p.deletions;if(T!==null){for(var I=0;I<T.length;I++){var Q=T[I];for(be=Q;be!==null;){var ce=be;switch(ce.tag){case 0:case 11:case 15:po(8,ce,p)}var ue=ce.child;if(ue!==null)ue.return=ce,be=ue;else for(;be!==null;){ce=be;var oe=ce.sibling,we=ce.return;if(_p(ce),ce===Q){be=null;break}if(oe!==null){oe.return=we,be=oe;break}be=we}}}var je=p.alternate;if(je!==null){var Ne=je.child;if(Ne!==null){je.child=null;do{var ut=Ne.sibling;Ne.sibling=null,Ne=ut}while(Ne!==null)}}be=p}}if((p.subtreeFlags&2064)!==0&&w!==null)w.return=p,be=w;else e:for(;be!==null;){if(p=be,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:po(9,p,p.return)}var U=p.sibling;if(U!==null){U.return=p.return,be=U;break e}be=p.return}}var O=t.current;for(be=O;be!==null;){w=be;var K=w.child;if((w.subtreeFlags&2064)!==0&&K!==null)K.return=w,be=K;else e:for(w=O;be!==null;){if(T=be,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Wa(9,T)}}catch(Se){ot(T,T.return,Se)}if(T===w){be=null;break e}var pe=T.sibling;if(pe!==null){pe.return=T.return,be=pe;break e}be=T.return}}if(We=h,jr(),Dn&&typeof Dn.onPostCommitFiberRoot=="function")try{Dn.onPostCommitFiberRoot(ra,t)}catch{}c=!0}return c}finally{qe=o,un.transition=r}}return!1}function Yp(t,r,o){r=ti(o,r),r=mp(t,r,1),t=Sr(t,r,1),r=Ot(),t!==null&&($i(t,1,r),Kt(t,r))}function ot(t,r,o){if(t.tag===3)Yp(t,t,o);else for(;r!==null;){if(r.tag===3){Yp(r,t,o);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ar===null||!Ar.has(c))){t=ti(o,t),t=xp(r,t,1),r=Sr(r,t,1),t=Ot(),r!==null&&($i(r,1,t),Kt(r,t));break}}r=r.return}}function mw(t,r,o){var c=t.pingCache;c!==null&&c.delete(r),r=Ot(),t.pingedLanes|=t.suspendedLanes&o,bt===t&&(At&o)===o&&(pt===4||pt===3&&(At&130023424)===At&&500>ct()-du?ls(t,0):uu|=o),Kt(t,r)}function Zp(t,r){r===0&&((t.mode&1)===0?r=1:(r=ia,ia<<=1,(ia&130023424)===0&&(ia=4194304)));var o=Ot();t=Zn(t,r),t!==null&&($i(t,r,o),Kt(t,o))}function xw(t){var r=t.memoizedState,o=0;r!==null&&(o=r.retryLane),Zp(t,o)}function gw(t,r){var o=0;switch(t.tag){case 13:var c=t.stateNode,h=t.memoizedState;h!==null&&(o=h.retryLane);break;case 19:c=t.stateNode;break;default:throw Error(s(314))}c!==null&&c.delete(r),Zp(t,o)}var Jp;Jp=function(t,r,o){if(t!==null)if(t.memoizedProps!==r.pendingProps||Vt.current)Ut=!0;else{if((t.lanes&o)===0&&(r.flags&128)===0)return Ut=!1,sw(t,r,o);Ut=(t.flags&131072)!==0}else Ut=!1,nt&&(r.flags&1048576)!==0&&Ff(r,Aa,r.index);switch(r.lanes=0,r.tag){case 2:var c=r.type;za(t,r),t=r.pendingProps;var h=Qs(r,Pt.current);Js(r,o),h=zc(null,r,c,t,h,o);var p=Uc();return r.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,zt(c)?(p=!0,Na(r)):p=!1,r.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,_c(r),h.updater=$a,r.stateNode=h,h._reactInternals=r,Gc(r,c,t,o),r=Jc(null,r,c,!0,p,o)):(r.tag=0,nt&&p&&Sc(r),Rt(null,r,h,o),r=r.child),r;case 16:c=r.elementType;e:{switch(za(t,r),t=r.pendingProps,h=c._init,c=h(c._payload),r.type=c,h=r.tag=vw(c),t=jn(c,t),h){case 0:r=Zc(null,r,c,t,o);break e;case 1:r=Sp(null,r,c,t,o);break e;case 11:r=wp(null,r,c,t,o);break e;case 14:r=bp(null,r,c,jn(c.type,t),o);break e}throw Error(s(306,c,""))}return r;case 0:return c=r.type,h=r.pendingProps,h=r.elementType===c?h:jn(c,h),Zc(t,r,c,h,o);case 1:return c=r.type,h=r.pendingProps,h=r.elementType===c?h:jn(c,h),Sp(t,r,c,h,o);case 3:e:{if(Cp(r),t===null)throw Error(s(387));c=r.pendingProps,p=r.memoizedState,h=p.element,Vf(t,r),Da(r,c,null,o);var w=r.memoizedState;if(c=w.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},r.updateQueue.baseState=p,r.memoizedState=p,r.flags&256){h=ti(Error(s(423)),r),r=Ap(t,r,c,o,h);break e}else if(c!==h){h=ti(Error(s(424)),r),r=Ap(t,r,c,o,h);break e}else for(Jt=wr(r.stateNode.containerInfo.firstChild),Zt=r,nt=!0,kn=null,o=Bf(r,null,c,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Xs(),c===h){r=er(t,r,o);break e}Rt(t,r,c,o)}r=r.child}return r;case 5:return Wf(r),t===null&&Ec(r),c=r.type,h=r.pendingProps,p=t!==null?t.memoizedProps:null,w=h.children,vc(c,h)?w=null:p!==null&&vc(c,p)&&(r.flags|=32),Np(t,r),Rt(t,r,w,o),r.child;case 6:return t===null&&Ec(r),null;case 13:return Ep(t,r,o);case 4:return Lc(r,r.stateNode.containerInfo),c=r.pendingProps,t===null?r.child=Ys(r,null,c,o):Rt(t,r,c,o),r.child;case 11:return c=r.type,h=r.pendingProps,h=r.elementType===c?h:jn(c,h),wp(t,r,c,h,o);case 7:return Rt(t,r,r.pendingProps,o),r.child;case 8:return Rt(t,r,r.pendingProps.children,o),r.child;case 12:return Rt(t,r,r.pendingProps.children,o),r.child;case 10:e:{if(c=r.type._context,h=r.pendingProps,p=r.memoizedProps,w=h.value,Ye(Pa,c._currentValue),c._currentValue=w,p!==null)if(bn(p.value,w)){if(p.children===h.children&&!Vt.current){r=er(t,r,o);break e}}else for(p=r.child,p!==null&&(p.return=r);p!==null;){var T=p.dependencies;if(T!==null){w=p.child;for(var I=T.firstContext;I!==null;){if(I.context===c){if(p.tag===1){I=Jn(-1,o&-o),I.tag=2;var Q=p.updateQueue;if(Q!==null){Q=Q.shared;var ce=Q.pending;ce===null?I.next=I:(I.next=ce.next,ce.next=I),Q.pending=I}}p.lanes|=o,I=p.alternate,I!==null&&(I.lanes|=o),Dc(p.return,o,r),T.lanes|=o;break}I=I.next}}else if(p.tag===10)w=p.type===r.type?null:p.child;else if(p.tag===18){if(w=p.return,w===null)throw Error(s(341));w.lanes|=o,T=w.alternate,T!==null&&(T.lanes|=o),Dc(w,o,r),w=p.sibling}else w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===r){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}Rt(t,r,h.children,o),r=r.child}return r;case 9:return h=r.type,c=r.pendingProps.children,Js(r,o),h=ln(h),c=c(h),r.flags|=1,Rt(t,r,c,o),r.child;case 14:return c=r.type,h=jn(c,r.pendingProps),h=jn(c.type,h),bp(t,r,c,h,o);case 15:return kp(t,r,r.type,r.pendingProps,o);case 17:return c=r.type,h=r.pendingProps,h=r.elementType===c?h:jn(c,h),za(t,r),r.tag=1,zt(c)?(t=!0,Na(r)):t=!1,Js(r,o),fp(r,c,h),Gc(r,c,h,o),Jc(null,r,c,!0,t,o);case 19:return Pp(t,r,o);case 22:return jp(t,r,o)}throw Error(s(156,r.tag))};function em(t,r){return Fh(t,r)}function yw(t,r,o,c){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(t,r,o,c){return new yw(t,r,o,c)}function vu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function vw(t){if(typeof t=="function")return vu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ie)return 11;if(t===L)return 14}return 2}function Mr(t,r){var o=t.alternate;return o===null?(o=dn(t.tag,r,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=r,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,r=t.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function Ja(t,r,o,c,h,p){var w=2;if(c=t,typeof t=="function")vu(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case B:return us(o.children,h,p,r);case R:w=8,h|=8;break;case G:return t=dn(12,o,r,h|2),t.elementType=G,t.lanes=p,t;case W:return t=dn(13,o,r,h),t.elementType=W,t.lanes=p,t;case H:return t=dn(19,o,r,h),t.elementType=H,t.lanes=p,t;case te:return el(o,h,p,r);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case he:w=10;break e;case $:w=9;break e;case ie:w=11;break e;case L:w=14;break e;case X:w=16,c=null;break e}throw Error(s(130,t==null?t:typeof t,""))}return r=dn(w,o,r,h),r.elementType=t,r.type=c,r.lanes=p,r}function us(t,r,o,c){return t=dn(7,t,c,r),t.lanes=o,t}function el(t,r,o,c){return t=dn(22,t,c,r),t.elementType=te,t.lanes=o,t.stateNode={isHidden:!1},t}function wu(t,r,o){return t=dn(6,t,null,r),t.lanes=o,t}function bu(t,r,o){return r=dn(4,t.children!==null?t.children:[],t.key,r),r.lanes=o,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}function ww(t,r,o,c,h){this.tag=r,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ql(0),this.expirationTimes=ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ql(0),this.identifierPrefix=c,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function ku(t,r,o,c,h,p,w,T,I){return t=new ww(t,r,o,T,I),r===1?(r=1,p===!0&&(r|=8)):r=0,p=dn(3,null,null,r),t.current=p,p.stateNode=t,p.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},_c(p),t}function bw(t,r,o){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:c==null?null:""+c,children:t,containerInfo:r,implementation:o}}function tm(t){if(!t)return kr;t=t._reactInternals;e:{if(Zr(t)!==t||t.tag!==1)throw Error(s(170));var r=t;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(zt(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(s(171))}if(t.tag===1){var o=t.type;if(zt(o))return Tf(t,o,r)}return r}function nm(t,r,o,c,h,p,w,T,I){return t=ku(o,c,!0,t,h,p,w,T,I),t.context=tm(null),o=t.current,c=Ot(),h=Tr(o),p=Jn(c,h),p.callback=r??null,Sr(o,p,h),t.current.lanes=h,$i(t,h,c),Kt(t,c),t}function tl(t,r,o,c){var h=r.current,p=Ot(),w=Tr(h);return o=tm(o),r.context===null?r.context=o:r.pendingContext=o,r=Jn(p,w),r.payload={element:t},c=c===void 0?null:c,c!==null&&(r.callback=c),t=Sr(h,r,w),t!==null&&(Cn(t,h,w,p),Fa(t,h,w)),w}function nl(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function rm(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<r?o:r}}function ju(t,r){rm(t,r),(t=t.alternate)&&rm(t,r)}function kw(){return null}var sm=typeof reportError=="function"?reportError:function(t){console.error(t)};function Nu(t){this._internalRoot=t}rl.prototype.render=Nu.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(s(409));tl(t,r,null,null)},rl.prototype.unmount=Nu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;as(function(){tl(null,t,null,null)}),r[qn]=null}};function rl(t){this._internalRoot=t}rl.prototype.unstable_scheduleHydration=function(t){if(t){var r=$h();t={blockedOn:null,target:t,priority:r};for(var o=0;o<gr.length&&r!==0&&r<gr[o].priority;o++);gr.splice(o,0,t),o===0&&Uh(t)}};function Su(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function sl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function im(){}function jw(t,r,o,c,h){if(h){if(typeof c=="function"){var p=c;c=function(){var Q=nl(w);p.call(Q)}}var w=nm(r,c,t,0,null,!1,!1,"",im);return t._reactRootContainer=w,t[qn]=w.current,eo(t.nodeType===8?t.parentNode:t),as(),w}for(;h=t.lastChild;)t.removeChild(h);if(typeof c=="function"){var T=c;c=function(){var Q=nl(I);T.call(Q)}}var I=ku(t,0,!1,null,null,!1,!1,"",im);return t._reactRootContainer=I,t[qn]=I.current,eo(t.nodeType===8?t.parentNode:t),as(function(){tl(r,I,o,c)}),I}function il(t,r,o,c,h){var p=o._reactRootContainer;if(p){var w=p;if(typeof h=="function"){var T=h;h=function(){var I=nl(w);T.call(I)}}tl(r,w,t,h)}else w=jw(o,r,t,h,c);return nl(w)}Oh=function(t){switch(t.tag){case 3:var r=t.stateNode;if(r.current.memoizedState.isDehydrated){var o=Bi(r.pendingLanes);o!==0&&(Gl(r,o|1),Kt(r,ct()),(We&6)===0&&(si=ct()+500,jr()))}break;case 13:as(function(){var c=Zn(t,1);if(c!==null){var h=Ot();Cn(c,t,1,h)}}),ju(t,1)}},Xl=function(t){if(t.tag===13){var r=Zn(t,134217728);if(r!==null){var o=Ot();Cn(r,t,134217728,o)}ju(t,134217728)}},Bh=function(t){if(t.tag===13){var r=Tr(t),o=Zn(t,r);if(o!==null){var c=Ot();Cn(o,t,r,c)}ju(t,r)}},$h=function(){return qe},Vh=function(t,r){var o=qe;try{return qe=t,r()}finally{qe=o}},Oi=function(t,r,o){switch(r){case"input":if(yn(t,o),r=o.name,o.type==="radio"&&r!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<o.length;r++){var c=o[r];if(c!==t&&c.form===t.form){var h=ka(c);if(!h)throw Error(s(90));Ce(c),yn(c,h)}}}break;case"textarea":Ae(t,o);break;case"select":r=o.value,r!=null&&re(t,!!o.multiple,r,!1)}},Ve=xu,St=as;var Nw={usingClientEntryPoint:!1,Events:[ro,Ks,ka,le,Be,xu]},yo={findFiberByHostInstance:Jr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Sw={bundleType:yo.bundleType,version:yo.version,rendererPackageName:yo.rendererPackageName,rendererConfig:yo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Ph(t),t===null?null:t.stateNode},findFiberByHostInstance:yo.findFiberByHostInstance||kw,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ol.isDisabled&&ol.supportsFiber)try{ra=ol.inject(Sw),Dn=ol}catch{}}return Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Nw,Ht.createPortal=function(t,r){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Su(r))throw Error(s(200));return bw(t,r,null,o)},Ht.createRoot=function(t,r){if(!Su(t))throw Error(s(299));var o=!1,c="",h=sm;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onRecoverableError!==void 0&&(h=r.onRecoverableError)),r=ku(t,1,!1,null,null,o,!1,c,h),t[qn]=r.current,eo(t.nodeType===8?t.parentNode:t),new Nu(r)},Ht.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=Ph(r),t=t===null?null:t.stateNode,t},Ht.flushSync=function(t){return as(t)},Ht.hydrate=function(t,r,o){if(!sl(r))throw Error(s(200));return il(null,t,r,!0,o)},Ht.hydrateRoot=function(t,r,o){if(!Su(t))throw Error(s(405));var c=o!=null&&o.hydratedSources||null,h=!1,p="",w=sm;if(o!=null&&(o.unstable_strictMode===!0&&(h=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),r=nm(r,null,t,1,o??null,h,!1,p,w),t[qn]=r.current,eo(t),c)for(t=0;t<c.length;t++)o=c[t],h=o._getVersion,h=h(o._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[o,h]:r.mutableSourceEagerHydrationData.push(o,h);return new rl(r)},Ht.render=function(t,r,o){if(!sl(r))throw Error(s(200));return il(null,t,r,!1,o)},Ht.unmountComponentAtNode=function(t){if(!sl(t))throw Error(s(40));return t._reactRootContainer?(as(function(){il(null,null,t,!1,function(){t._reactRootContainer=null,t[qn]=null})}),!0):!1},Ht.unstable_batchedUpdates=xu,Ht.unstable_renderSubtreeIntoContainer=function(t,r,o,c){if(!sl(o))throw Error(s(200));if(t==null||t._reactInternals===void 0)throw Error(s(38));return il(t,r,o,!1,c)},Ht.version="18.3.1-next-f1338f8080-20240426",Ht}var pm;function M0(){if(pm)return Tu.exports;pm=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Tu.exports=Fw(),Tu.exports}var mm;function Dw(){if(mm)return ll;mm=1;var e=M0();return ll.createRoot=e.createRoot,ll.hydrateRoot=e.hydrateRoot,ll}var Iw=Dw(),Fi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_w={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},_r,Od,w0,Lw=(w0=class{constructor(){Ee(this,_r,_w);Ee(this,Od,!1)}setTimeoutProvider(e){ye(this,_r,e)}setTimeout(e,n){return D(this,_r).setTimeout(e,n)}clearTimeout(e){D(this,_r).clearTimeout(e)}setInterval(e,n){return D(this,_r).setInterval(e,n)}clearInterval(e){D(this,_r).clearInterval(e)}},_r=new WeakMap,Od=new WeakMap,w0),ms=new Lw;function Rw(e){setTimeout(e,0)}var Ps=typeof window>"u"||"Deno"in globalThis;function $t(){}function Ow(e,n){return typeof e=="function"?e(n):e}function ad(e){return typeof e=="number"&&e>=0&&e!==1/0}function F0(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Wr(e,n){return typeof e=="function"?e(n):e}function xn(e,n){return typeof e=="function"?e(n):e}function xm(e,n){const{type:s="all",exact:a,fetchStatus:l,predicate:u,queryKey:d,stale:f}=e;if(d){if(a){if(n.queryHash!==$d(d,n.options))return!1}else if(!Lo(n.queryKey,d))return!1}if(s!=="all"){const m=n.isActive();if(s==="active"&&!m||s==="inactive"&&m)return!1}return!(typeof f=="boolean"&&n.isStale()!==f||l&&l!==n.state.fetchStatus||u&&!u(n))}function gm(e,n){const{exact:s,status:a,predicate:l,mutationKey:u}=e;if(u){if(!n.options.mutationKey)return!1;if(s){if(Ms(n.options.mutationKey)!==Ms(u))return!1}else if(!Lo(n.options.mutationKey,u))return!1}return!(a&&n.state.status!==a||l&&!l(n))}function $d(e,n){return((n==null?void 0:n.queryKeyHashFn)||Ms)(e)}function Ms(e){return JSON.stringify(e,(n,s)=>ld(s)?Object.keys(s).sort().reduce((a,l)=>(a[l]=s[l],a),{}):s)}function Lo(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(s=>Lo(e[s],n[s])):!1}var Bw=Object.prototype.hasOwnProperty;function D0(e,n,s=0){if(e===n)return e;if(s>500)return n;const a=ym(e)&&ym(n);if(!a&&!(ld(e)&&ld(n)))return n;const u=(a?e:Object.keys(e)).length,d=a?n:Object.keys(n),f=d.length,m=a?new Array(f):{};let x=0;for(let g=0;g<f;g++){const y=a?g:d[g],v=e[y],k=n[y];if(v===k){m[y]=v,(a?g<u:Bw.call(e,y))&&x++;continue}if(v===null||k===null||typeof v!="object"||typeof k!="object"){m[y]=k;continue}const E=D0(v,k,s+1);m[y]=E,E===v&&x++}return u===f&&x===u?e:m}function Cl(e,n){if(!n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}function ym(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ld(e){if(!vm(e))return!1;const n=e.constructor;if(n===void 0)return!0;const s=n.prototype;return!(!vm(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vm(e){return Object.prototype.toString.call(e)==="[object Object]"}function $w(e){return new Promise(n=>{ms.setTimeout(n,e)})}function cd(e,n,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,n):s.structuralSharing!==!1?D0(e,n):n}function Vw(e,n,s=0){const a=[...e,n];return s&&a.length>s?a.slice(1):a}function zw(e,n,s=0){const a=[n,...e];return s&&a.length>s?a.slice(0,-1):a}var Vd=Symbol();function I0(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===Vd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function zd(e,n){return typeof e=="function"?e(...n):!!e}function Uw(e,n,s){let a=!1,l;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(l??(l=n()),a||(a=!0,l.aborted?s():l.addEventListener("abort",s,{once:!0})),l)}),e}var ys,Lr,gi,b0,Ww=(b0=class extends Fi{constructor(){super();Ee(this,ys);Ee(this,Lr);Ee(this,gi);ye(this,gi,n=>{if(!Ps&&window.addEventListener){const s=()=>n();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){D(this,Lr)||this.setEventListener(D(this,gi))}onUnsubscribe(){var n;this.hasListeners()||((n=D(this,Lr))==null||n.call(this),ye(this,Lr,void 0))}setEventListener(n){var s;ye(this,gi,n),(s=D(this,Lr))==null||s.call(this),ye(this,Lr,n(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(n){D(this,ys)!==n&&(ye(this,ys,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(s=>{s(n)})}isFocused(){var n;return typeof D(this,ys)=="boolean"?D(this,ys):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},ys=new WeakMap,Lr=new WeakMap,gi=new WeakMap,b0),Ud=new Ww;function ud(){let e,n;const s=new Promise((l,u)=>{e=l,n=u});s.status="pending",s.catch(()=>{});function a(l){Object.assign(s,l),delete s.resolve,delete s.reject}return s.resolve=l=>{a({status:"fulfilled",value:l}),e(l)},s.reject=l=>{a({status:"rejected",reason:l}),n(l)},s}var Kw=Rw;function Hw(){let e=[],n=0,s=f=>{f()},a=f=>{f()},l=Kw;const u=f=>{n?e.push(f):l(()=>{s(f)})},d=()=>{const f=e;e=[],f.length&&l(()=>{a(()=>{f.forEach(m=>{s(m)})})})};return{batch:f=>{let m;n++;try{m=f()}finally{n--,n||d()}return m},batchCalls:f=>(...m)=>{u(()=>{f(...m)})},schedule:u,setNotifyFunction:f=>{s=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{l=f}}}var mt=Hw(),yi,Rr,vi,k0,Qw=(k0=class extends Fi{constructor(){super();Ee(this,yi,!0);Ee(this,Rr);Ee(this,vi);ye(this,vi,n=>{if(!Ps&&window.addEventListener){const s=()=>n(!0),a=()=>n(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",a)}}})}onSubscribe(){D(this,Rr)||this.setEventListener(D(this,vi))}onUnsubscribe(){var n;this.hasListeners()||((n=D(this,Rr))==null||n.call(this),ye(this,Rr,void 0))}setEventListener(n){var s;ye(this,vi,n),(s=D(this,Rr))==null||s.call(this),ye(this,Rr,n(this.setOnline.bind(this)))}setOnline(n){D(this,yi)!==n&&(ye(this,yi,n),this.listeners.forEach(a=>{a(n)}))}isOnline(){return D(this,yi)}},yi=new WeakMap,Rr=new WeakMap,vi=new WeakMap,k0),Al=new Qw;function qw(e){return Math.min(1e3*2**e,3e4)}function _0(e){return(e??"online")==="online"?Al.isOnline():!0}var dd=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function L0(e){let n=!1,s=0,a;const l=ud(),u=()=>l.status!=="pending",d=S=>{var j;if(!u()){const F=new dd(S);v(F),(j=e.onCancel)==null||j.call(e,F)}},f=()=>{n=!0},m=()=>{n=!1},x=()=>Ud.isFocused()&&(e.networkMode==="always"||Al.isOnline())&&e.canRun(),g=()=>_0(e.networkMode)&&e.canRun(),y=S=>{u()||(a==null||a(),l.resolve(S))},v=S=>{u()||(a==null||a(),l.reject(S))},k=()=>new Promise(S=>{var j;a=F=>{(u()||x())&&S(F)},(j=e.onPause)==null||j.call(e)}).then(()=>{var S;a=void 0,u()||(S=e.onContinue)==null||S.call(e)}),E=()=>{if(u())return;let S;const j=s===0?e.initialPromise:void 0;try{S=j??e.fn()}catch(F){S=Promise.reject(F)}Promise.resolve(S).then(y).catch(F=>{var C;if(u())return;const _=e.retry??(Ps?0:3),A=e.retryDelay??qw,P=typeof A=="function"?A(s,F):A,M=_===!0||typeof _=="number"&&s<_||typeof _=="function"&&_(s,F);if(n||!M){v(F);return}s++,(C=e.onFail)==null||C.call(e,s,F),$w(P).then(()=>x()?void 0:k()).then(()=>{n?v(F):E()})})};return{promise:l,status:()=>l.status,cancel:d,continue:()=>(a==null||a(),l),cancelRetry:f,continueRetry:m,canStart:g,start:()=>(g()?E():k().then(E),l)}}var vs,j0,R0=(j0=class{constructor(){Ee(this,vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ad(this.gcTime)&&ye(this,vs,ms.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ps?1/0:300*1e3))}clearGcTimeout(){D(this,vs)&&(ms.clearTimeout(D(this,vs)),ye(this,vs,void 0))}},vs=new WeakMap,j0),ws,wi,mn,bs,jt,Uo,ks,En,nr,N0,Gw=(N0=class extends R0{constructor(n){super();Ee(this,En);Ee(this,ws);Ee(this,wi);Ee(this,mn);Ee(this,bs);Ee(this,jt);Ee(this,Uo);Ee(this,ks);ye(this,ks,!1),ye(this,Uo,n.defaultOptions),this.setOptions(n.options),this.observers=[],ye(this,bs,n.client),ye(this,mn,D(this,bs).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,ye(this,ws,bm(this.options)),this.state=n.state??D(this,ws),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var n;return(n=D(this,jt))==null?void 0:n.promise}setOptions(n){if(this.options={...D(this,Uo),...n},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=bm(this.options);s.data!==void 0&&(this.setState(wm(s.data,s.dataUpdatedAt)),ye(this,ws,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&D(this,mn).remove(this)}setData(n,s){const a=cd(this.state.data,n,this.options);return Le(this,En,nr).call(this,{data:a,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),a}setState(n,s){Le(this,En,nr).call(this,{type:"setState",state:n,setStateOptions:s})}cancel(n){var a,l;const s=(a=D(this,jt))==null?void 0:a.promise;return(l=D(this,jt))==null||l.cancel(n),s?s.then($t).catch($t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(D(this,ws))}isActive(){return this.observers.some(n=>xn(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vd||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Wr(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!F0(this.state.dataUpdatedAt,n)}onFocus(){var s;const n=this.observers.find(a=>a.shouldFetchOnWindowFocus());n==null||n.refetch({cancelRefetch:!1}),(s=D(this,jt))==null||s.continue()}onOnline(){var s;const n=this.observers.find(a=>a.shouldFetchOnReconnect());n==null||n.refetch({cancelRefetch:!1}),(s=D(this,jt))==null||s.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),D(this,mn).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(s=>s!==n),this.observers.length||(D(this,jt)&&(D(this,ks)?D(this,jt).cancel({revert:!0}):D(this,jt).cancelRetry()),this.scheduleGc()),D(this,mn).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,En,nr).call(this,{type:"invalidate"})}async fetch(n,s){var m,x,g,y,v,k,E,S,j,F,_,A;if(this.state.fetchStatus!=="idle"&&((m=D(this,jt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(D(this,jt))return D(this,jt).continueRetry(),D(this,jt).promise}if(n&&this.setOptions(n),!this.options.queryFn){const P=this.observers.find(M=>M.options.queryFn);P&&this.setOptions(P.options)}const a=new AbortController,l=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(ye(this,ks,!0),a.signal)})},u=()=>{const P=I0(this.options,s),C=(()=>{const B={client:D(this,bs),queryKey:this.queryKey,meta:this.meta};return l(B),B})();return ye(this,ks,!1),this.options.persister?this.options.persister(P,C,this):P(C)},f=(()=>{const P={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:D(this,bs),state:this.state,fetchFn:u};return l(P),P})();(x=this.options.behavior)==null||x.onFetch(f,this),ye(this,wi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=f.fetchOptions)==null?void 0:g.meta))&&Le(this,En,nr).call(this,{type:"fetch",meta:(y=f.fetchOptions)==null?void 0:y.meta}),ye(this,jt,L0({initialPromise:s==null?void 0:s.initialPromise,fn:f.fetchFn,onCancel:P=>{P instanceof dd&&P.revert&&this.setState({...D(this,wi),fetchStatus:"idle"}),a.abort()},onFail:(P,M)=>{Le(this,En,nr).call(this,{type:"failed",failureCount:P,error:M})},onPause:()=>{Le(this,En,nr).call(this,{type:"pause"})},onContinue:()=>{Le(this,En,nr).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const P=await D(this,jt).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(k=(v=D(this,mn).config).onSuccess)==null||k.call(v,P,this),(S=(E=D(this,mn).config).onSettled)==null||S.call(E,P,this.state.error,this),P}catch(P){if(P instanceof dd){if(P.silent)return D(this,jt).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw Le(this,En,nr).call(this,{type:"error",error:P}),(F=(j=D(this,mn).config).onError)==null||F.call(j,P,this),(A=(_=D(this,mn).config).onSettled)==null||A.call(_,this.state.data,P,this),P}finally{this.scheduleGc()}}},ws=new WeakMap,wi=new WeakMap,mn=new WeakMap,bs=new WeakMap,jt=new WeakMap,Uo=new WeakMap,ks=new WeakMap,En=new WeakSet,nr=function(n){const s=a=>{switch(n.type){case"failed":return{...a,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...O0(a.data,this.options),fetchMeta:n.meta??null};case"success":const l={...a,...wm(n.data,n.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ye(this,wi,n.manual?l:void 0),l;case"error":const u=n.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...n.state}}};this.state=s(this.state),mt.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),D(this,mn).notify({query:this,type:"updated",action:n})})},N0);function O0(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_0(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wm(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bm(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,s=n!==void 0,a=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:s?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Qt,ze,Wo,Bt,js,bi,sr,Or,Ko,ki,ji,Ns,Ss,Br,Ni,Qe,Co,hd,fd,pd,md,xd,gd,yd,B0,S0,Xw=(S0=class extends Fi{constructor(n,s){super();Ee(this,Qe);Ee(this,Qt);Ee(this,ze);Ee(this,Wo);Ee(this,Bt);Ee(this,js);Ee(this,bi);Ee(this,sr);Ee(this,Or);Ee(this,Ko);Ee(this,ki);Ee(this,ji);Ee(this,Ns);Ee(this,Ss);Ee(this,Br);Ee(this,Ni,new Set);this.options=s,ye(this,Qt,n),ye(this,Or,null),ye(this,sr,ud()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(D(this,ze).addObserver(this),km(D(this,ze),this.options)?Le(this,Qe,Co).call(this):this.updateResult(),Le(this,Qe,md).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vd(D(this,ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vd(D(this,ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,Qe,xd).call(this),Le(this,Qe,gd).call(this),D(this,ze).removeObserver(this)}setOptions(n){const s=this.options,a=D(this,ze);if(this.options=D(this,Qt).defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xn(this.options.enabled,D(this,ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,Qe,yd).call(this),D(this,ze).setOptions(this.options),s._defaulted&&!Cl(this.options,s)&&D(this,Qt).getQueryCache().notify({type:"observerOptionsUpdated",query:D(this,ze),observer:this});const l=this.hasListeners();l&&jm(D(this,ze),a,this.options,s)&&Le(this,Qe,Co).call(this),this.updateResult(),l&&(D(this,ze)!==a||xn(this.options.enabled,D(this,ze))!==xn(s.enabled,D(this,ze))||Wr(this.options.staleTime,D(this,ze))!==Wr(s.staleTime,D(this,ze)))&&Le(this,Qe,hd).call(this);const u=Le(this,Qe,fd).call(this);l&&(D(this,ze)!==a||xn(this.options.enabled,D(this,ze))!==xn(s.enabled,D(this,ze))||u!==D(this,Br))&&Le(this,Qe,pd).call(this,u)}getOptimisticResult(n){const s=D(this,Qt).getQueryCache().build(D(this,Qt),n),a=this.createResult(s,n);return Zw(this,a)&&(ye(this,Bt,a),ye(this,bi,this.options),ye(this,js,D(this,ze).state)),a}getCurrentResult(){return D(this,Bt)}trackResult(n,s){return new Proxy(n,{get:(a,l)=>(this.trackProp(l),s==null||s(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&D(this,sr).status==="pending"&&D(this,sr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,l))})}trackProp(n){D(this,Ni).add(n)}getCurrentQuery(){return D(this,ze)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const s=D(this,Qt).defaultQueryOptions(n),a=D(this,Qt).getQueryCache().build(D(this,Qt),s);return a.fetch().then(()=>this.createResult(a,s))}fetch(n){return Le(this,Qe,Co).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),D(this,Bt)))}createResult(n,s){var G;const a=D(this,ze),l=this.options,u=D(this,Bt),d=D(this,js),f=D(this,bi),x=n!==a?n.state:D(this,Wo),{state:g}=n;let y={...g},v=!1,k;if(s._optimisticResults){const he=this.hasListeners(),$=!he&&km(n,s),ie=he&&jm(n,a,s,l);($||ie)&&(y={...y,...O0(g.data,n.options)}),s._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:E,errorUpdatedAt:S,status:j}=y;k=y.data;let F=!1;if(s.placeholderData!==void 0&&k===void 0&&j==="pending"){let he;u!=null&&u.isPlaceholderData&&s.placeholderData===(f==null?void 0:f.placeholderData)?(he=u.data,F=!0):he=typeof s.placeholderData=="function"?s.placeholderData((G=D(this,ji))==null?void 0:G.state.data,D(this,ji)):s.placeholderData,he!==void 0&&(j="success",k=cd(u==null?void 0:u.data,he,s),v=!0)}if(s.select&&k!==void 0&&!F)if(u&&k===(d==null?void 0:d.data)&&s.select===D(this,Ko))k=D(this,ki);else try{ye(this,Ko,s.select),k=s.select(k),k=cd(u==null?void 0:u.data,k,s),ye(this,ki,k),ye(this,Or,null)}catch(he){ye(this,Or,he)}D(this,Or)&&(E=D(this,Or),k=D(this,ki),S=Date.now(),j="error");const _=y.fetchStatus==="fetching",A=j==="pending",P=j==="error",M=A&&_,C=k!==void 0,R={status:j,fetchStatus:y.fetchStatus,isPending:A,isSuccess:j==="success",isError:P,isInitialLoading:M,isLoading:M,data:k,dataUpdatedAt:y.dataUpdatedAt,error:E,errorUpdatedAt:S,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>x.dataUpdateCount||y.errorUpdateCount>x.errorUpdateCount,isFetching:_,isRefetching:_&&!A,isLoadingError:P&&!C,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:P&&C,isStale:Wd(n,s),refetch:this.refetch,promise:D(this,sr),isEnabled:xn(s.enabled,n)!==!1};if(this.options.experimental_prefetchInRender){const he=R.data!==void 0,$=R.status==="error"&&!he,ie=L=>{$?L.reject(R.error):he&&L.resolve(R.data)},W=()=>{const L=ye(this,sr,R.promise=ud());ie(L)},H=D(this,sr);switch(H.status){case"pending":n.queryHash===a.queryHash&&ie(H);break;case"fulfilled":($||R.data!==H.value)&&W();break;case"rejected":(!$||R.error!==H.reason)&&W();break}}return R}updateResult(){const n=D(this,Bt),s=this.createResult(D(this,ze),this.options);if(ye(this,js,D(this,ze).state),ye(this,bi,this.options),D(this,js).data!==void 0&&ye(this,ji,D(this,ze)),Cl(s,n))return;ye(this,Bt,s);const a=()=>{if(!n)return!0;const{notifyOnChangeProps:l}=this.options,u=typeof l=="function"?l():l;if(u==="all"||!u&&!D(this,Ni).size)return!0;const d=new Set(u??D(this,Ni));return this.options.throwOnError&&d.add("error"),Object.keys(D(this,Bt)).some(f=>{const m=f;return D(this,Bt)[m]!==n[m]&&d.has(m)})};Le(this,Qe,B0).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,Qe,md).call(this)}},Qt=new WeakMap,ze=new WeakMap,Wo=new WeakMap,Bt=new WeakMap,js=new WeakMap,bi=new WeakMap,sr=new WeakMap,Or=new WeakMap,Ko=new WeakMap,ki=new WeakMap,ji=new WeakMap,Ns=new WeakMap,Ss=new WeakMap,Br=new WeakMap,Ni=new WeakMap,Qe=new WeakSet,Co=function(n){Le(this,Qe,yd).call(this);let s=D(this,ze).fetch(this.options,n);return n!=null&&n.throwOnError||(s=s.catch($t)),s},hd=function(){Le(this,Qe,xd).call(this);const n=Wr(this.options.staleTime,D(this,ze));if(Ps||D(this,Bt).isStale||!ad(n))return;const a=F0(D(this,Bt).dataUpdatedAt,n)+1;ye(this,Ns,ms.setTimeout(()=>{D(this,Bt).isStale||this.updateResult()},a))},fd=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(D(this,ze)):this.options.refetchInterval)??!1},pd=function(n){Le(this,Qe,gd).call(this),ye(this,Br,n),!(Ps||xn(this.options.enabled,D(this,ze))===!1||!ad(D(this,Br))||D(this,Br)===0)&&ye(this,Ss,ms.setInterval(()=>{(this.options.refetchIntervalInBackground||Ud.isFocused())&&Le(this,Qe,Co).call(this)},D(this,Br)))},md=function(){Le(this,Qe,hd).call(this),Le(this,Qe,pd).call(this,Le(this,Qe,fd).call(this))},xd=function(){D(this,Ns)&&(ms.clearTimeout(D(this,Ns)),ye(this,Ns,void 0))},gd=function(){D(this,Ss)&&(ms.clearInterval(D(this,Ss)),ye(this,Ss,void 0))},yd=function(){const n=D(this,Qt).getQueryCache().build(D(this,Qt),this.options);if(n===D(this,ze))return;const s=D(this,ze);ye(this,ze,n),ye(this,Wo,n.state),this.hasListeners()&&(s==null||s.removeObserver(this),n.addObserver(this))},B0=function(n){mt.batch(()=>{n.listeners&&this.listeners.forEach(s=>{s(D(this,Bt))}),D(this,Qt).getQueryCache().notify({query:D(this,ze),type:"observerResultsUpdated"})})},S0);function Yw(e,n){return xn(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function km(e,n){return Yw(e,n)||e.state.data!==void 0&&vd(e,n,n.refetchOnMount)}function vd(e,n,s){if(xn(n.enabled,e)!==!1&&Wr(n.staleTime,e)!=="static"){const a=typeof s=="function"?s(e):s;return a==="always"||a!==!1&&Wd(e,n)}return!1}function jm(e,n,s,a){return(e!==n||xn(a.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Wd(e,s)}function Wd(e,n){return xn(n.enabled,e)!==!1&&e.isStaleByTime(Wr(n.staleTime,e))}function Zw(e,n){return!Cl(e.getCurrentResult(),n)}function Nm(e){return{onFetch:(n,s)=>{var g,y,v,k,E;const a=n.options,l=(v=(y=(g=n.fetchOptions)==null?void 0:g.meta)==null?void 0:y.fetchMore)==null?void 0:v.direction,u=((k=n.state.data)==null?void 0:k.pages)||[],d=((E=n.state.data)==null?void 0:E.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const x=async()=>{let S=!1;const j=A=>{Uw(A,()=>n.signal,()=>S=!0)},F=I0(n.options,n.fetchOptions),_=async(A,P,M)=>{if(S)return Promise.reject();if(P==null&&A.pages.length)return Promise.resolve(A);const B=(()=>{const $={client:n.client,queryKey:n.queryKey,pageParam:P,direction:M?"backward":"forward",meta:n.options.meta};return j($),$})(),R=await F(B),{maxPages:G}=n.options,he=M?zw:Vw;return{pages:he(A.pages,R,G),pageParams:he(A.pageParams,P,G)}};if(l&&u.length){const A=l==="backward",P=A?Jw:Sm,M={pages:u,pageParams:d},C=P(a,M);f=await _(M,C,A)}else{const A=e??u.length;do{const P=m===0?d[0]??a.initialPageParam:Sm(a,f);if(m>0&&P==null)break;f=await _(f,P),m++}while(m<A)}return f};n.options.persister?n.fetchFn=()=>{var S,j;return(j=(S=n.options).persister)==null?void 0:j.call(S,x,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},s)}:n.fetchFn=x}}}function Sm(e,{pages:n,pageParams:s}){const a=n.length-1;return n.length>0?e.getNextPageParam(n[a],n,s[a],s):void 0}function Jw(e,{pages:n,pageParams:s}){var a;return n.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,n[0],n,s[0],s):void 0}var Ho,Bn,It,Cs,$n,Dr,C0,e1=(C0=class extends R0{constructor(n){super();Ee(this,$n);Ee(this,Ho);Ee(this,Bn);Ee(this,It);Ee(this,Cs);ye(this,Ho,n.client),this.mutationId=n.mutationId,ye(this,It,n.mutationCache),ye(this,Bn,[]),this.state=n.state||$0(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){D(this,Bn).includes(n)||(D(this,Bn).push(n),this.clearGcTimeout(),D(this,It).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){ye(this,Bn,D(this,Bn).filter(s=>s!==n)),this.scheduleGc(),D(this,It).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){D(this,Bn).length||(this.state.status==="pending"?this.scheduleGc():D(this,It).remove(this))}continue(){var n;return((n=D(this,Cs))==null?void 0:n.continue())??this.execute(this.state.variables)}async execute(n){var d,f,m,x,g,y,v,k,E,S,j,F,_,A,P,M,C,B;const s=()=>{Le(this,$n,Dr).call(this,{type:"continue"})},a={client:D(this,Ho),meta:this.options.meta,mutationKey:this.options.mutationKey};ye(this,Cs,L0({fn:()=>this.options.mutationFn?this.options.mutationFn(n,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,G)=>{Le(this,$n,Dr).call(this,{type:"failed",failureCount:R,error:G})},onPause:()=>{Le(this,$n,Dr).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>D(this,It).canRun(this)}));const l=this.state.status==="pending",u=!D(this,Cs).canStart();try{if(l)s();else{Le(this,$n,Dr).call(this,{type:"pending",variables:n,isPaused:u}),D(this,It).config.onMutate&&await D(this,It).config.onMutate(n,this,a);const G=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,n,a));G!==this.state.context&&Le(this,$n,Dr).call(this,{type:"pending",context:G,variables:n,isPaused:u})}const R=await D(this,Cs).start();return await((x=(m=D(this,It).config).onSuccess)==null?void 0:x.call(m,R,n,this.state.context,this,a)),await((y=(g=this.options).onSuccess)==null?void 0:y.call(g,R,n,this.state.context,a)),await((k=(v=D(this,It).config).onSettled)==null?void 0:k.call(v,R,null,this.state.variables,this.state.context,this,a)),await((S=(E=this.options).onSettled)==null?void 0:S.call(E,R,null,n,this.state.context,a)),Le(this,$n,Dr).call(this,{type:"success",data:R}),R}catch(R){try{await((F=(j=D(this,It).config).onError)==null?void 0:F.call(j,R,n,this.state.context,this,a))}catch(G){Promise.reject(G)}try{await((A=(_=this.options).onError)==null?void 0:A.call(_,R,n,this.state.context,a))}catch(G){Promise.reject(G)}try{await((M=(P=D(this,It).config).onSettled)==null?void 0:M.call(P,void 0,R,this.state.variables,this.state.context,this,a))}catch(G){Promise.reject(G)}try{await((B=(C=this.options).onSettled)==null?void 0:B.call(C,void 0,R,n,this.state.context,a))}catch(G){Promise.reject(G)}throw Le(this,$n,Dr).call(this,{type:"error",error:R}),R}finally{D(this,It).runNext(this)}}},Ho=new WeakMap,Bn=new WeakMap,It=new WeakMap,Cs=new WeakMap,$n=new WeakSet,Dr=function(n){const s=a=>{switch(n.type){case"failed":return{...a,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...a,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:n.error,failureCount:a.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=s(this.state),mt.batch(()=>{D(this,Bn).forEach(a=>{a.onMutationUpdate(n)}),D(this,It).notify({mutation:this,type:"updated",action:n})})},C0);function $0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ir,Tn,Qo,A0,t1=(A0=class extends Fi{constructor(n={}){super();Ee(this,ir);Ee(this,Tn);Ee(this,Qo);this.config=n,ye(this,ir,new Set),ye(this,Tn,new Map),ye(this,Qo,0)}build(n,s,a){const l=new e1({client:n,mutationCache:this,mutationId:++al(this,Qo)._,options:n.defaultMutationOptions(s),state:a});return this.add(l),l}add(n){D(this,ir).add(n);const s=cl(n);if(typeof s=="string"){const a=D(this,Tn).get(s);a?a.push(n):D(this,Tn).set(s,[n])}this.notify({type:"added",mutation:n})}remove(n){if(D(this,ir).delete(n)){const s=cl(n);if(typeof s=="string"){const a=D(this,Tn).get(s);if(a)if(a.length>1){const l=a.indexOf(n);l!==-1&&a.splice(l,1)}else a[0]===n&&D(this,Tn).delete(s)}}this.notify({type:"removed",mutation:n})}canRun(n){const s=cl(n);if(typeof s=="string"){const a=D(this,Tn).get(s),l=a==null?void 0:a.find(u=>u.state.status==="pending");return!l||l===n}else return!0}runNext(n){var a;const s=cl(n);if(typeof s=="string"){const l=(a=D(this,Tn).get(s))==null?void 0:a.find(u=>u!==n&&u.state.isPaused);return(l==null?void 0:l.continue())??Promise.resolve()}else return Promise.resolve()}clear(){mt.batch(()=>{D(this,ir).forEach(n=>{this.notify({type:"removed",mutation:n})}),D(this,ir).clear(),D(this,Tn).clear()})}getAll(){return Array.from(D(this,ir))}find(n){const s={exact:!0,...n};return this.getAll().find(a=>gm(s,a))}findAll(n={}){return this.getAll().filter(s=>gm(n,s))}notify(n){mt.batch(()=>{this.listeners.forEach(s=>{s(n)})})}resumePausedMutations(){const n=this.getAll().filter(s=>s.state.isPaused);return mt.batch(()=>Promise.all(n.map(s=>s.continue().catch($t))))}},ir=new WeakMap,Tn=new WeakMap,Qo=new WeakMap,A0);function cl(e){var n;return(n=e.options.scope)==null?void 0:n.id}var or,$r,qt,ar,ur,vl,wd,E0,n1=(E0=class extends Fi{constructor(s,a){super();Ee(this,ur);Ee(this,or);Ee(this,$r);Ee(this,qt);Ee(this,ar);ye(this,or,s),this.setOptions(a),this.bindMethods(),Le(this,ur,vl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var l;const a=this.options;this.options=D(this,or).defaultMutationOptions(s),Cl(this.options,a)||D(this,or).getMutationCache().notify({type:"observerOptionsUpdated",mutation:D(this,qt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Ms(a.mutationKey)!==Ms(this.options.mutationKey)?this.reset():((l=D(this,qt))==null?void 0:l.state.status)==="pending"&&D(this,qt).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=D(this,qt))==null||s.removeObserver(this)}onMutationUpdate(s){Le(this,ur,vl).call(this),Le(this,ur,wd).call(this,s)}getCurrentResult(){return D(this,$r)}reset(){var s;(s=D(this,qt))==null||s.removeObserver(this),ye(this,qt,void 0),Le(this,ur,vl).call(this),Le(this,ur,wd).call(this)}mutate(s,a){var l;return ye(this,ar,a),(l=D(this,qt))==null||l.removeObserver(this),ye(this,qt,D(this,or).getMutationCache().build(D(this,or),this.options)),D(this,qt).addObserver(this),D(this,qt).execute(s)}},or=new WeakMap,$r=new WeakMap,qt=new WeakMap,ar=new WeakMap,ur=new WeakSet,vl=function(){var a;const s=((a=D(this,qt))==null?void 0:a.state)??$0();ye(this,$r,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},wd=function(s){mt.batch(()=>{var a,l,u,d,f,m,x,g;if(D(this,ar)&&this.hasListeners()){const y=D(this,$r).variables,v=D(this,$r).context,k={client:D(this,or),meta:this.options.meta,mutationKey:this.options.mutationKey};if((s==null?void 0:s.type)==="success"){try{(l=(a=D(this,ar)).onSuccess)==null||l.call(a,s.data,y,v,k)}catch(E){Promise.reject(E)}try{(d=(u=D(this,ar)).onSettled)==null||d.call(u,s.data,null,y,v,k)}catch(E){Promise.reject(E)}}else if((s==null?void 0:s.type)==="error"){try{(m=(f=D(this,ar)).onError)==null||m.call(f,s.error,y,v,k)}catch(E){Promise.reject(E)}try{(g=(x=D(this,ar)).onSettled)==null||g.call(x,void 0,s.error,y,v,k)}catch(E){Promise.reject(E)}}}this.listeners.forEach(y=>{y(D(this,$r))})})},E0),Vn,T0,r1=(T0=class extends Fi{constructor(n={}){super();Ee(this,Vn);this.config=n,ye(this,Vn,new Map)}build(n,s,a){const l=s.queryKey,u=s.queryHash??$d(l,s);let d=this.get(u);return d||(d=new Gw({client:n,queryKey:l,queryHash:u,options:n.defaultQueryOptions(s),state:a,defaultOptions:n.getQueryDefaults(l)}),this.add(d)),d}add(n){D(this,Vn).has(n.queryHash)||(D(this,Vn).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const s=D(this,Vn).get(n.queryHash);s&&(n.destroy(),s===n&&D(this,Vn).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){mt.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return D(this,Vn).get(n)}getAll(){return[...D(this,Vn).values()]}find(n){const s={exact:!0,...n};return this.getAll().find(a=>xm(s,a))}findAll(n={}){const s=this.getAll();return Object.keys(n).length>0?s.filter(a=>xm(n,a)):s}notify(n){mt.batch(()=>{this.listeners.forEach(s=>{s(n)})})}onFocus(){mt.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){mt.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Vn=new WeakMap,T0),at,Vr,zr,Si,Ci,Ur,Ai,Ei,P0,s1=(P0=class{constructor(e={}){Ee(this,at);Ee(this,Vr);Ee(this,zr);Ee(this,Si);Ee(this,Ci);Ee(this,Ur);Ee(this,Ai);Ee(this,Ei);ye(this,at,e.queryCache||new r1),ye(this,Vr,e.mutationCache||new t1),ye(this,zr,e.defaultOptions||{}),ye(this,Si,new Map),ye(this,Ci,new Map),ye(this,Ur,0)}mount(){al(this,Ur)._++,D(this,Ur)===1&&(ye(this,Ai,Ud.subscribe(async e=>{e&&(await this.resumePausedMutations(),D(this,at).onFocus())})),ye(this,Ei,Al.subscribe(async e=>{e&&(await this.resumePausedMutations(),D(this,at).onOnline())})))}unmount(){var e,n;al(this,Ur)._--,D(this,Ur)===0&&((e=D(this,Ai))==null||e.call(this),ye(this,Ai,void 0),(n=D(this,Ei))==null||n.call(this),ye(this,Ei,void 0))}isFetching(e){return D(this,at).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return D(this,Vr).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const n=this.defaultQueryOptions({queryKey:e});return(s=D(this,at).get(n.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),s=D(this,at).build(this,n),a=s.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Wr(n.staleTime,s))&&this.prefetchQuery(n),Promise.resolve(a))}getQueriesData(e){return D(this,at).findAll(e).map(({queryKey:n,state:s})=>{const a=s.data;return[n,a]})}setQueryData(e,n,s){const a=this.defaultQueryOptions({queryKey:e}),l=D(this,at).get(a.queryHash),u=l==null?void 0:l.state.data,d=Ow(n,u);if(d!==void 0)return D(this,at).build(this,a).setData(d,{...s,manual:!0})}setQueriesData(e,n,s){return mt.batch(()=>D(this,at).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,n,s)]))}getQueryState(e){var s;const n=this.defaultQueryOptions({queryKey:e});return(s=D(this,at).get(n.queryHash))==null?void 0:s.state}removeQueries(e){const n=D(this,at);mt.batch(()=>{n.findAll(e).forEach(s=>{n.remove(s)})})}resetQueries(e,n){const s=D(this,at);return mt.batch(()=>(s.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const s={revert:!0,...n},a=mt.batch(()=>D(this,at).findAll(e).map(l=>l.cancel(s)));return Promise.all(a).then($t).catch($t)}invalidateQueries(e,n={}){return mt.batch(()=>(D(this,at).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},n)))}refetchQueries(e,n={}){const s={...n,cancelRefetch:n.cancelRefetch??!0},a=mt.batch(()=>D(this,at).findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let u=l.fetch(void 0,s);return s.throwOnError||(u=u.catch($t)),l.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(a).then($t)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const s=D(this,at).build(this,n);return s.isStaleByTime(Wr(n.staleTime,s))?s.fetch(n):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($t).catch($t)}fetchInfiniteQuery(e){return e.behavior=Nm(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($t).catch($t)}ensureInfiniteQueryData(e){return e.behavior=Nm(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Al.isOnline()?D(this,Vr).resumePausedMutations():Promise.resolve()}getQueryCache(){return D(this,at)}getMutationCache(){return D(this,Vr)}getDefaultOptions(){return D(this,zr)}setDefaultOptions(e){ye(this,zr,e)}setQueryDefaults(e,n){D(this,Si).set(Ms(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...D(this,Si).values()],s={};return n.forEach(a=>{Lo(e,a.queryKey)&&Object.assign(s,a.defaultOptions)}),s}setMutationDefaults(e,n){D(this,Ci).set(Ms(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...D(this,Ci).values()],s={};return n.forEach(a=>{Lo(e,a.mutationKey)&&Object.assign(s,a.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const n={...D(this,zr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=$d(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===Vd&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...D(this,zr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){D(this,at).clear(),D(this,Vr).clear()}},at=new WeakMap,Vr=new WeakMap,zr=new WeakMap,Si=new WeakMap,Ci=new WeakMap,Ur=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,P0),V0=b.createContext(void 0),qo=e=>{const n=b.useContext(V0);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},i1=({client:e,children:n})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(V0.Provider,{value:e,children:n})),z0=b.createContext(!1),o1=()=>b.useContext(z0);z0.Provider;function a1(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var l1=b.createContext(a1()),c1=()=>b.useContext(l1),u1=(e,n,s)=>{const a=s!=null&&s.state.error&&typeof e.throwOnError=="function"?zd(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(n.isReset()||(e.retryOnMount=!1))},d1=e=>{b.useEffect(()=>{e.clearReset()},[e])},h1=({result:e,errorResetBoundary:n,throwOnError:s,query:a,suspense:l})=>e.isError&&!n.isReset()&&!e.isFetching&&a&&(l&&e.data===void 0||zd(s,[e.error,a])),f1=e=>{if(e.suspense){const s=l=>l==="static"?l:Math.max(l??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...l)=>s(a(...l)):s(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},p1=(e,n)=>e.isLoading&&e.isFetching&&!n,m1=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,Cm=(e,n,s)=>n.fetchOptimistic(e).catch(()=>{s.clearReset()});function x1(e,n,s){var v,k,E,S;const a=o1(),l=c1(),u=qo(),d=u.defaultQueryOptions(e);(k=(v=u.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||k.call(v,d);const f=u.getQueryCache().get(d.queryHash);d._optimisticResults=a?"isRestoring":"optimistic",f1(d),u1(d,l,f),d1(l);const m=!u.getQueryCache().get(d.queryHash),[x]=b.useState(()=>new n(u,d)),g=x.getOptimisticResult(d),y=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(j=>{const F=y?x.subscribe(mt.batchCalls(j)):$t;return x.updateResult(),F},[x,y]),()=>x.getCurrentResult(),()=>x.getCurrentResult()),b.useEffect(()=>{x.setOptions(d)},[d,x]),m1(d,g))throw Cm(d,x,l);if(h1({result:g,errorResetBoundary:l,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw g.error;if((S=(E=u.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||S.call(E,d,g),d.experimental_prefetchInRender&&!Ps&&p1(g,a)){const j=m?Cm(d,x,l):f==null?void 0:f.promise;j==null||j.catch($t).finally(()=>{x.updateResult()})}return d.notifyOnChangeProps?g:x.trackResult(g)}function Kr(e,n){return x1(e,Xw)}function xs(e,n){const s=qo(),[a]=b.useState(()=>new n1(s,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const l=b.useSyncExternalStore(b.useCallback(d=>a.subscribe(mt.batchCalls(d)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=b.useCallback((d,f)=>{a.mutate(d,f).catch($t)},[a]);if(l.error&&zd(a.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:u,mutateAsync:l.mutate}}const Am=()=>{const e=new Date,n=s=>new Date(e.getTime()-s*60*1e3).toISOString();return{connection:"connected",lastActivity:"2m ago",lastSnapshotAt:e.toISOString(),sessions:{groups:[{id:"init-1",label:"Q4 Feature Ship",status:"active"},{id:"init-2",label:"Black Friday Email",status:"active"}],edges:[{parentId:"run-1",childId:"run-2"},{parentId:"run-1",childId:"run-3"}],nodes:[{id:"run-1",parentId:null,runId:"run-1",title:"Q4 Feature Ship – Planning",agentId:"eli",agentName:"Eli",status:"running",progress:45,initiativeId:"init-1",workstreamId:null,groupId:"init-1",groupLabel:"Q4 Feature Ship",startedAt:n(120),updatedAt:n(2),lastEventAt:n(2),lastEventSummary:"Delegated work to design and data agents.",blockers:[]},{id:"run-2",parentId:"run-1",runId:"run-2",title:"Dashboard UI pass",agentId:"dana",agentName:"Dana",status:"running",progress:70,initiativeId:"init-1",workstreamId:"ws-4",groupId:"init-1",groupLabel:"Q4 Feature Ship",startedAt:n(80),updatedAt:n(5),lastEventAt:n(5),lastEventSummary:"Drafted handoff for approval.",blockers:["Approval pending"]},{id:"run-3",parentId:"run-1",runId:"run-3",title:"Usage tracking instrumentation",agentId:"pace",agentName:"Pace",status:"queued",progress:0,initiativeId:"init-1",workstreamId:"ws-5",groupId:"init-1",groupLabel:"Q4 Feature Ship",startedAt:n(30),updatedAt:n(12),lastEventAt:n(12),lastEventSummary:"Waiting for data pipeline access.",blockers:["Access to events table"]},{id:"run-4",parentId:null,runId:"run-4",title:"Black Friday Email Campaign",agentId:"mark",agentName:"Mark",status:"running",progress:55,initiativeId:"init-2",workstreamId:null,groupId:"init-2",groupLabel:"Black Friday Email",startedAt:n(90),updatedAt:n(8),lastEventAt:n(8),lastEventSummary:"Drafted subject line variants.",blockers:[]}]},activity:[{id:"activity-1",type:"decision_requested",title:"Decision requested",description:"Approve dashboard UI layout for Q4 Feature Ship.",agentId:"dana",agentName:"Dana",runId:"run-2",initiativeId:"init-1",timestamp:n(2)},{id:"activity-2",type:"artifact_created",title:"Artifact created: Subject line variants",description:"Drafted 3 subject line variants for approval.",agentId:"mark",agentName:"Mark",runId:"run-4",initiativeId:"init-2",timestamp:n(8)},{id:"activity-3",type:"delegation",title:"Task delegated",description:"Spin up data agent for instrumentation plan.",agentId:"eli",agentName:"Eli",runId:"run-1",initiativeId:"init-1",timestamp:n(18)}],handoffs:[{id:"handoff-1",title:"Dashboard UI approval",status:"created",priority:"high",summary:"Need approval on dashboard UI layout and component hierarchy.",currentActorType:"user",currentActorId:"me",createdAt:n(12),updatedAt:n(2),events:[{id:"handoff-event-1",handoffId:"handoff-1",eventType:"created",actorType:"agent",actorId:"dana",payload:{summary:"Draft layout ready for review."},createdAt:n(12)}]}],decisions:[{id:"decision-1",title:"Approve dashboard copy update",context:"Marketing requested a copy refresh before final launch. Confirm wording changes.",status:"pending",agentName:"Mark",requestedAt:n(22),updatedAt:n(2),waitingMinutes:22}],outbox:{pendingTotal:0,pendingByQueue:{},oldestEventAt:null,newestEventAt:null,replayStatus:"idle",lastReplayAttemptAt:null,lastReplaySuccessAt:null,lastReplayFailureAt:null,lastReplayError:null}}};function Gt(e){const n=e instanceof Date?e:new Date(e),s=Date.now()-n.getTime();if(Number.isNaN(s))return"unknown";const a=Math.floor(s/1e3);if(a<60)return`${a}s ago`;const l=Math.floor(a/60);if(l<60)return`${l}m ago`;const u=Math.floor(l/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}const g1=8e3,y1=320,v1=600,w1=120,b1=120,k1=90,Em=6e4,U0={pendingTotal:0,pendingByQueue:{},oldestEventAt:null,newestEventAt:null,replayStatus:"idle",lastReplayAttemptAt:null,lastReplaySuccessAt:null,lastReplayFailureAt:null,lastReplayError:null},Tm={running:0,queued:1,pending:2,blocked:3,failed:4,cancelled:5,completed:6,archived:7};function xt(e){if(!e)return 0;const n=Date.parse(e);return Number.isFinite(n)?n:0}function W0(e,n){const s=Tm[e.status]??99,a=Tm[n.status]??99;if(s!==a)return s-a;const l=xt(e.updatedAt??e.lastEventAt??e.startedAt),u=xt(n.updatedAt??n.lastEventAt??n.startedAt);return l!==u?u-l:e.id.localeCompare(n.id)}function Pm(e,n){if(e.nodes.length<=n)return e;const s=[...e.nodes].sort(W0).slice(0,n),a=new Set(s.map(u=>u.id)),l=new Set(s.map(u=>u.groupId));return{nodes:s,edges:e.edges.filter(u=>a.has(u.parentId)&&a.has(u.childId)),groups:e.groups.filter(u=>l.has(u.id))}}function Mm(e,n){return e.length<=n?e:[...e].sort((s,a)=>xt(a.updatedAt)-xt(s.updatedAt)).slice(0,n)}function j1(e){const n=e.requestedAt??e.updatedAt??null,s=e.updatedAt??n,a=Number.isFinite(e.waitingMinutes)?Math.max(0,Math.floor(e.waitingMinutes)):n?Math.max(0,Math.floor((Date.now()-xt(n))/6e4)):0;return{id:e.id,title:e.title,context:e.context??null,status:e.status??"pending",agentName:e.agentName??null,requestedAt:n,updatedAt:s,waitingMinutes:a,metadata:e.metadata}}function K0(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s+=1)if(e[s].id!==n[s].id||e[s].timestamp!==n[s].timestamp||e[s].type!==n[s].type||e[s].title!==n[s].title)return!1;return!0}function Fm(e,n){if(e.nodes.length!==n.nodes.length||e.edges.length!==n.edges.length||e.groups.length!==n.groups.length)return!1;for(let s=0;s<e.nodes.length;s+=1){const a=e.nodes[s],l=n.nodes[s];if(a.id!==l.id||a.status!==l.status||a.title!==l.title||a.progress!==l.progress||a.updatedAt!==l.updatedAt||a.lastEventAt!==l.lastEventAt)return!1}for(let s=0;s<e.edges.length;s+=1){const a=e.edges[s],l=n.edges[s];if(a.parentId!==l.parentId||a.childId!==l.childId)return!1}for(let s=0;s<e.groups.length;s+=1){const a=e.groups[s],l=n.groups[s];if(a.id!==l.id||a.label!==l.label||a.status!==l.status)return!1}return!0}function Dm(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s+=1)if(e[s].id!==n[s].id||e[s].updatedAt!==n[s].updatedAt||e[s].status!==n[s].status||e[s].title!==n[s].title)return!1;return!0}function Im(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s+=1)if(e[s].id!==n[s].id||e[s].status!==n[s].status||e[s].updatedAt!==n[s].updatedAt||e[s].waitingMinutes!==n[s].waitingMinutes)return!1;return!0}function H0(e){if(!e||typeof e!="object")return U0;const n=e.pendingByQueue&&typeof e.pendingByQueue=="object"?Object.fromEntries(Object.entries(e.pendingByQueue).filter(([a])=>typeof a=="string"&&a.length>0).map(([a,l])=>[a,Number.isFinite(Number(l))?Math.max(0,Math.floor(Number(l))):0])):{},s=e.replayStatus==="running"||e.replayStatus==="success"||e.replayStatus==="error"?e.replayStatus:"idle";return{pendingTotal:Number.isFinite(e.pendingTotal)?Math.max(0,Math.floor(e.pendingTotal)):Object.values(n).reduce((a,l)=>a+l,0),pendingByQueue:n,oldestEventAt:e.oldestEventAt??null,newestEventAt:e.newestEventAt??null,replayStatus:s,lastReplayAttemptAt:e.lastReplayAttemptAt??null,lastReplaySuccessAt:e.lastReplaySuccessAt??null,lastReplayFailureAt:e.lastReplayFailureAt??null,lastReplayError:e.lastReplayError??null}}function N1(e,n){if(e.pendingTotal!==n.pendingTotal||e.oldestEventAt!==n.oldestEventAt||e.newestEventAt!==n.newestEventAt||e.replayStatus!==n.replayStatus||e.lastReplayAttemptAt!==n.lastReplayAttemptAt||e.lastReplaySuccessAt!==n.lastReplaySuccessAt||e.lastReplayFailureAt!==n.lastReplayFailureAt||e.lastReplayError!==n.lastReplayError)return!1;const s=Object.keys(e.pendingByQueue),a=Object.keys(n.pendingByQueue);if(s.length!==a.length)return!1;for(const l of s)if(e.pendingByQueue[l]!==n.pendingByQueue[l])return!1;return!0}function S1(e,n,s){if(n.length===0)return e;const a=new Map;for(const d of e)a.set(d.id,d);let l=!1;for(const d of n){const f=a.get(d.id);if(!f){a.set(d.id,d),l=!0;continue}(f.timestamp!==d.timestamp||f.type!==d.type||f.title!==d.title||f.description!==d.description)&&(a.set(d.id,d),l=!0)}if(!l)return e;const u=Array.from(a.values()).sort((d,f)=>xt(f.timestamp)-xt(d.timestamp)).slice(0,s);return K0(e,u)?e:u}function Fu(e,n){const s=[...e].sort((u,d)=>xt(d.timestamp)-xt(u.timestamp)).slice(0,n),a=new Set,l=[];for(const u of s)a.has(u.id)||(a.add(u.id),l.push(u));return l}function _m(e,n){const s=e.filter(u=>!!u&&typeof u.id=="string"&&u.id.length>0).map(j1).sort((u,d)=>u.waitingMinutes!==d.waitingMinutes?d.waitingMinutes-u.waitingMinutes:xt(d.requestedAt??d.updatedAt)-xt(u.requestedAt??u.updatedAt)).slice(0,n),a=new Set,l=[];for(const u of s)a.has(u.id)||(a.add(u.id),l.push(u));return l}function Lm(e){return e==="run_failed"||e==="blocker_created"?"blocked":e==="run_completed"||e==="milestone_completed"?"completed":e==="decision_requested"||e==="handoff_requested"?"pending":e==="decision_resolved"||e==="handoff_fulfilled"?"completed":"running"}function C1(e){const n=e.toLowerCase();return n==="running"||n==="active"?"running":n==="queued"||n==="pending"?"queued":n==="blocked"?"blocked":n==="failed"?"failed":n==="completed"||n==="done"?"completed":"archived"}function ul(e){return e?`Initiative ${e.length>16?`${e.slice(0,8)}…`:e}`:"Unscoped"}function Du(e){if(!Array.isArray(e))return[];const n=[];for(const s of e)typeof s=="string"&&s.trim().length>0&&n.push(s.trim());return n}function A1(e,n,s){const a=new Map,l=[...e].sort((f,m)=>xt(m.timestamp)-xt(f.timestamp));for(const f of l){if(!f.runId)continue;const m=f.runId,x=a.get(m),g=f.timestamp;if(!x){const y=f.initiativeId??null;a.set(m,{id:m,parentId:null,runId:m,title:f.title,agentId:f.agentId??null,agentName:f.agentName??null,status:Lm(f.type),progress:null,initiativeId:y,workstreamId:null,groupId:y??"unscoped",groupLabel:ul(y),startedAt:g,updatedAt:g,lastEventAt:g,lastEventSummary:f.title,blockers:f.type==="blocker_created"&&f.description?[f.description]:[]});continue}(!x.startedAt||xt(g)<xt(x.startedAt))&&(x.startedAt=g),xt(g)>=xt(x.updatedAt??x.lastEventAt)&&(x.updatedAt=g,x.lastEventAt=g,x.lastEventSummary=f.title,x.status=Lm(f.type),f.agentName&&(x.agentName=f.agentName),f.agentId&&(x.agentId=f.agentId),f.initiativeId&&(x.initiativeId=f.initiativeId,x.groupId=f.initiativeId,x.groupLabel=ul(f.initiativeId)),(!x.title||x.title.length<4)&&(x.title=f.title)),f.type==="blocker_created"&&f.description&&(x.blockers.includes(f.description)||x.blockers.push(f.description))}for(const f of n??[]){const m=f.runId??`agent:${f.id}`,x=a.get(m),g=C1(f.status),y=f.initiativeId??null,v=f.currentTask&&f.currentTask.trim().length>0?f.currentTask.trim():`${f.name??f.id} ${g==="archived"?"idle":g}`;if(!x){a.set(m,{id:m,parentId:null,runId:m,title:v,agentId:f.id,agentName:f.name??f.id,status:g,progress:null,initiativeId:y,workstreamId:null,groupId:y??"unscoped",groupLabel:ul(y),startedAt:f.startedAt??null,updatedAt:f.startedAt??null,lastEventAt:f.startedAt??null,lastEventSummary:f.currentTask,blockers:Du(f.blockers)});continue}!x.agentName&&f.name&&(x.agentName=f.name),x.agentId||(x.agentId=f.id),(!x.title||x.title===x.runId)&&(x.title=v),x.status==="archived"&&g!=="archived"&&(x.status=g),Du(f.blockers).length>0&&(x.blockers=Du(f.blockers)),y&&!x.initiativeId&&(x.initiativeId=y,x.groupId=y,x.groupLabel=ul(y))}const u=Array.from(a.values()).sort(W0).slice(0,s),d=new Map;for(const f of u)d.has(f.groupId)||d.set(f.groupId,{id:f.groupId,label:f.groupLabel,status:f.status});return{nodes:u,edges:[],groups:Array.from(d.values())}}async function E1(e,n){var s;try{const a=await fetch(e,n),u=(((s=a.headers.get("content-type"))==null?void 0:s.toLowerCase())??"").includes("application/json");if(!a.ok){let d=`${a.status} ${a.statusText}`;if(u){const f=await a.json().catch(()=>null);f!=null&&f.error&&(d=`${a.status} ${f.error}`)}else{const f=(await a.text().catch(()=>"")).replace(/\s+/g," ").slice(0,80);f.length>0&&(d=`${a.status} ${f}`)}return{ok:!1,status:a.status,data:null,error:d}}if(!u){const d=(await a.text().catch(()=>"")).replace(/\s+/g," ").slice(0,80);return{ok:!1,status:a.status,data:null,error:`Unexpected content type for ${e}${d?`: ${d}`:""}`}}return{ok:!0,status:a.status,data:await a.json(),error:null}}catch(a){return{ok:!1,status:0,data:null,error:a instanceof Error?a.message:"Network error"}}}function T1(e,n,s,a,l=U0,u=null){var x,g,y;const d=((x=n[0])==null?void 0:x.timestamp)??null,f=((g=a[0])==null?void 0:g.requestedAt)??((y=a[0])==null?void 0:y.updatedAt)??null,m=xt(d)>=xt(f)?d:f;return{connection:"connected",lastActivity:m?Gt(m):null,lastSnapshotAt:u,sessions:e,activity:n,handoffs:s,decisions:a,outbox:H0(l)}}function P1(e={}){const{enabled:n=!0,pollInterval:s=g1,useMock:a=!1,enableDecisions:l=!0,maxSessions:u=y1,maxActivityItems:d=v1,maxHandoffs:f=w1,maxDecisions:m=b1,batchWindowMs:x=k1}=e,[g,y]=b.useState(Am()),[v,k]=b.useState(!a),[E,S]=b.useState(null),j=b.useRef(),F=b.useRef(null),[_,A]=b.useState(!1),P=b.useRef(0),M=b.useRef(!1),C=b.useCallback(($,ie,W,H=null,L=null,X=null)=>{P.current=Date.now(),M.current=!1;const te=Pm($,u),Y=Fu(ie,d),Z=Mm(W,f);y(V=>{const N=H===null?V.decisions:_m(H,m),z=L===null?V.outbox:H0(L);return Fm(V.sessions,te)&&K0(V.activity,Y)&&Dm(V.handoffs,Z)&&Im(V.decisions,N)&&N1(V.outbox,z)&&V.lastSnapshotAt===X&&V.connection==="connected"?V:T1(te,Y,Z,N,z,X)}),k(!1)},[d,m,f,u]),B=b.useCallback(async()=>{if(!n){y(ie=>ie.connection==="disconnected"?ie:{...ie,connection:"disconnected"}),k(!1),S(null);return}if(F.current)return F.current;if(a){y(Am()),k(!1);return}const $=(async()=>{try{const ie=new URLSearchParams({sessionsLimit:String(u),activityLimit:String(d),decisionsLimit:String(m),include_idle:"true"}),W=[{label:"dashboard-bundle",url:`/orgx/api/dashboard-bundle?${ie.toString()}`},{label:"live/snapshot",url:`/orgx/api/live/snapshot?${ie.toString()}`}],H=[];let L=null,X=!1;for(const z of W){const fe=await E1(z.url);if(fe.ok&&fe.data){L=fe.data;break}(fe.status===401||fe.status===403)&&(X=!0),H.push(`${z.label}: ${fe.error??"unavailable"}`)}if(!L){if(X){const z=new Error("Unauthorized. Update your OrgX API key in Settings (use a user-scoped oxk_... key; userId should be blank).");throw z.code="ORGX_AUTH",z}throw new Error(H.length>0?H.join(" | "):"Snapshot endpoint unavailable")}const te=Array.isArray(L.activity)?L.activity:[],Y=Array.isArray(L.handoffs)?L.handoffs:[],Z=l&&Array.isArray(L.decisions)?L.decisions:[],V=L.sessions&&Array.isArray(L.sessions.nodes)&&Array.isArray(L.sessions.edges)&&Array.isArray(L.sessions.groups)?L.sessions:A1(te,L.agents,u);C(V,te,Y,Z,L.outbox??null,L.generatedAt??null);const N=Array.isArray(L.degraded)?L.degraded:[];N.length>0?(S(`Partial live data: ${N.join("; ")}`),y(z=>z.connection==="reconnecting"?z:{...z,connection:"reconnecting"}),A(!0)):(S(null),y(z=>z.connection==="connected"?z:{...z,connection:"connected"}))}catch(ie){const W=ie instanceof Error?ie.message:"Unknown error",H=!!(ie&&typeof ie=="object"&&"code"in ie&&ie.code==="ORGX_AUTH");H&&(M.current=!0);const L=P.current>0&&Date.now()-P.current>Em;S(W),y(X=>{const te=H||L?"disconnected":"reconnecting";return X.connection===te?X:{...X,connection:te}}),A(!H),k(!1)}finally{F.current=null}})();return F.current=$,$},[C,n,l,d,m,f,u,a]),R=b.useCallback(async($,ie)=>{if(!l)throw new Error("OrgX decisions are unavailable while disconnected.");const W=Array.from(new Set($.filter(Boolean)));if(W.length===0)return{updated:0,failed:0};if(a){const V=new Set(W);return y(N=>{const z=N.decisions.filter(de=>V.has(de.id));if(z.length===0)return N;const fe=new Date().toISOString(),se=z.map(de=>({id:`decision:${ie}:${de.id}:${Date.now()}`,type:"decision_resolved",title:ie==="approve"?`Approved: ${de.title}`:`Rejected: ${de.title}`,description:de.context,agentId:null,agentName:de.agentName,runId:null,initiativeId:null,timestamp:fe,metadata:{decisionId:de.id,action:ie}})),xe=Fu(se.concat(N.activity),d);return{...N,decisions:N.decisions.filter(de=>!V.has(de.id)),activity:xe,lastActivity:Gt(fe)}}),{updated:V.size,failed:0}}const H=await fetch("/orgx/api/live/decisions/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:W,action:ie})}),L=await H.json().catch(()=>null),X=Array.isArray(L==null?void 0:L.results)?L.results:[],te=new Set(X.filter(V=>V.ok).map(V=>V.id));if(!H.ok&&H.status!==207){const V=typeof(L==null?void 0:L.error)=="string"?L.error:`Decision action failed (${H.status})`;throw new Error(V)}if(te.size===0&&H.ok&&((L==null?void 0:L.failed)??0)===0)for(const V of W)te.add(V);te.size>0&&y(V=>{const N=V.decisions.filter(de=>te.has(de.id));if(N.length===0)return V;const z=new Date().toISOString(),fe=N.map(de=>({id:`decision:${ie}:${de.id}:${Date.now()}`,type:"decision_resolved",title:ie==="approve"?`Approved: ${de.title}`:`Rejected: ${de.title}`,description:de.context,agentId:null,agentName:de.agentName,runId:null,initiativeId:null,timestamp:z,metadata:{decisionId:de.id,action:ie}})),se=Fu(fe.concat(V.activity),d);return{...V,decisions:V.decisions.filter(de=>!te.has(de.id)),activity:se,lastActivity:Gt(z)}});const Y=(L==null?void 0:L.updated)??te.size,Z=(L==null?void 0:L.failed)??Math.max(0,W.length-te.size);return{updated:Y,failed:Z}},[l,d,a]),G=b.useCallback(async $=>R([$],"approve"),[R]),he=b.useCallback(async()=>{const $=g.decisions.map(ie=>ie.id);return R($,"approve")},[R,g.decisions]);return b.useEffect(()=>{l||y($=>$.decisions.length===0?$:{...$,decisions:[]})},[l]),b.useEffect(()=>{if(!n){A(!1),k(!1),S(null);return}if(a){B();return}B();const $=new EventSource("/orgx/api/live/stream");let ie=null,W=null,H=null,L=[],X=null,te;const Y=()=>{if(te=void 0,ie){P.current=Date.now(),M.current=!1;const V=ie;ie=null,W=null,H=null,L=[],X=null,C(V.sessions,V.activity,V.handoffs,V.decisions,V.outbox,V.generatedAt);return}!W&&!H&&!X&&L.length===0||(P.current=Date.now(),M.current=!1,y(V=>{var z;let N=V;if(W){const fe=Pm(W,u);W=null,Fm(N.sessions,fe)||(N={...N,sessions:fe})}if(H){const fe=Mm(H,f);H=null,Dm(N.handoffs,fe)||(N={...N,handoffs:fe})}if(X){const fe=_m(X,m);X=null,Im(N.decisions,fe)||(N={...N,decisions:fe})}if(L.length>0){const fe=S1(N.activity,L,d);L=[],fe!==N.activity&&(N={...N,activity:fe,lastActivity:(z=fe[0])!=null&&z.timestamp?Gt(fe[0].timestamp):N.lastActivity})}return N===V?V:N.connection==="connected"?N:{...N,connection:"connected"}}),S(null),k(!1))},Z=()=>{te||(te=setTimeout(Y,x))};return $.onopen=()=>{P.current=Date.now(),M.current=!1,A(!1),y(V=>V.connection==="connected"?V:{...V,connection:"connected"}),S(null)},$.onerror=()=>{if(M.current){y(N=>N.connection==="disconnected"?N:{...N,connection:"disconnected"}),A(!1);return}const V=P.current>0&&Date.now()-P.current>Em;y(N=>N.connection===(V?"disconnected":"reconnecting")?N:{...N,connection:V?"disconnected":"reconnecting"}),A(!0)},$.addEventListener("snapshot",V=>{try{const N=JSON.parse(V.data),z=typeof N.generatedAt=="string"&&N.generatedAt.length>0?N.generatedAt:new Date().toISOString();ie={sessions:N.sessions,activity:N.activity??[],handoffs:N.handoffs??[],decisions:l?N.decisions??null:[],outbox:N.outbox??null,generatedAt:z},Z()}catch(N){S(N instanceof Error?N.message:"Invalid snapshot")}}),$.addEventListener("activity.appended",V=>{try{const N=JSON.parse(V.data);if(N.length===0)return;L=L.concat(N),Z()}catch{}}),$.addEventListener("session.updated",V=>{try{W=JSON.parse(V.data),Z()}catch{}}),$.addEventListener("handoff.updated",V=>{try{H=JSON.parse(V.data),Z()}catch{}}),$.addEventListener("decision.updated",V=>{if(l)try{X=JSON.parse(V.data),Z()}catch{}}),()=>{te&&clearTimeout(te),$.close()}},[C,x,n,l,B,d,m,f,u,a]),b.useEffect(()=>{if(n&&!a&&(j.current&&clearInterval(j.current),!!_))return j.current=setInterval(B,s),()=>{j.current&&clearInterval(j.current)}},[n,B,s,_,a]),{data:g,isLoading:v,error:E,refetch:B,approveDecision:G,approveAllDecisions:he}}const M1="https://orgx.mintlify.site/guides/openclaw-plugin-setup",F1=1500,Iu="orgx.onboarding.skip",_u={status:"idle",hasApiKey:!1,connectionVerified:!1,workspaceName:null,lastError:null,nextAction:"connect",docsUrl:M1,keySource:"none",installationId:null,connectUrl:null,pairingId:null,expiresAt:null,pollIntervalMs:null};function D1(e){if(typeof e=="string")return e;if(e&&typeof e=="object")return JSON.stringify(e)}async function wo(e){const n=await e,s=await n.json().catch(()=>null);return n.ok?s??{}:{ok:!1,error:D1(s==null?void 0:s.error)??`Request failed (${n.status})`}}function I1(){const[e,n]=b.useState(_u),[s,a]=b.useState(!0),[l,u]=b.useState(!1),[d,f]=b.useState(!1),m=b.useRef(null),[x,g]=b.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Iu)==="1"),y=b.useCallback(async()=>{const _=await wo(fetch("/orgx/api/onboarding/status",{method:"GET"}));if(!_.ok||!_.data){const A=_.error??"Failed to load onboarding state",P={..._u,status:"error",lastError:A,nextAction:"retry"};return n(P),P}return n(_.data),_.data},[]);b.useEffect(()=>{let _=!1;return(async()=>{a(!0);const A=await y();_||(n(A),a(!1))})(),()=>{_=!0}},[y]),b.useEffect(()=>{if(!(e.status==="awaiting_browser_auth"||e.status==="pairing"))return;const A=Math.max(900,e.pollIntervalMs??F1),P=window.setInterval(async()=>{const M=await wo(fetch("/orgx/api/onboarding/status",{method:"GET"}));M.ok&&M.data&&n(M.data)},A);return()=>{window.clearInterval(P)}},[e.pollIntervalMs,e.status]),b.useEffect(()=>{if(!(typeof window>"u")){if(x){window.localStorage.setItem(Iu,"1");return}window.localStorage.removeItem(Iu)}},[x]);const v=b.useCallback(()=>{if(typeof window>"u")return null;try{const _=window.open("","_blank");return _?(_.opener=null,_.document.title="Connecting to OrgX…",_.document.body.innerHTML='<div style="font-family:system-ui,-apple-system,sans-serif;padding:20px;color:#111">Connecting to OrgX...</div>',_):null}catch{return null}},[]),k=b.useCallback(async()=>{var A;const _=v();m.current=_,u(!0);try{const P=await wo(fetch("/orgx/api/onboarding/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceName:navigator.platform||"OpenClaw Device",platform:navigator.platform})}));if(!P.ok||!((A=P.data)!=null&&A.state)){_&&!_.closed&&_.close();const M=P.error??"Could not start pairing";n(C=>({...C,status:"error",lastError:M,nextAction:"enter_manual_key"}));return}if(n(P.data.state),P.data.connectUrl){const M=m.current;let C=!1;if(M&&!M.closed)try{M.location.href=P.data.connectUrl,C=!0}catch{C=!1}C||(C=!!window.open(P.data.connectUrl,"_blank","noopener,noreferrer")),C||n(B=>({...B,lastError:'Popup was blocked. Use "Approve in browser" below.',nextAction:"open_browser"}))}}finally{m.current=null,u(!1)}},[v]),E=b.useCallback(async _=>{f(!0);try{const A=_.trim(),P=A.replace(/^[a-z]+_/i,""),M=Array.from(new Set([A,P?`oxk_${P}`:"",P?`orgx_${P}`:""].map(B=>B.trim()).filter(B=>B.length>0)));let C="Manual key validation failed";for(const B of M){const R={"Content-Type":"application/json","X-OrgX-Api-Key":B,Authorization:`Bearer ${B}`},G=await wo(fetch("/orgx/api/onboarding/manual-key",{method:"POST",headers:R,body:JSON.stringify({apiKey:B})}));if(G.ok&&G.data)return n(G.data),G.data;C=G.error??C}throw n(B=>({...B,status:"manual_key",lastError:C,nextAction:"enter_manual_key"})),new Error(C)}finally{f(!1)}},[]),S=b.useCallback(async()=>{const _=await wo(fetch("/orgx/api/onboarding/disconnect",{method:"POST"}));if(_.ok&&_.data)return n(_.data),_.data;const A={..._u,status:"idle"};return n(A),A},[]),j=b.useCallback(()=>{n(_=>({..._,status:"idle",lastError:null,nextAction:"connect",connectUrl:null,pairingId:null,expiresAt:null,pollIntervalMs:null}))},[]),F=b.useMemo(()=>x?!1:!(e.hasApiKey&&e.connectionVerified&&e.status==="connected"),[x,e.connectionVerified,e.hasApiKey,e.status]);return{state:e,showGate:F,isLoading:s,isStarting:l,isSubmittingManual:d,refreshStatus:y,startPairing:k,submitManualKey:E,disconnect:S,skipGate:()=>g(!0),resumeGate:()=>g(!1),backToPairing:j,setManualMode:()=>n(_=>({..._,status:"manual_key",nextAction:"enter_manual_key"}))}}const q={lime:"#BFFF00",teal:"#14B8A6",cyan:"#0AD4C4",iris:"#7C7CFF",amber:"#F5B700",red:"#FF6B88",background:"#02040A",cardBg:"#08090D",cardBgElevated:"#0C0E14",cardBorder:"rgba(255, 255, 255, 0.08)",cardBorderStrong:"rgba(255, 255, 255, 0.12)",textMuted:"#8F9AB7"},_1={Pace:"#7C7CFF",Eli:"#BFFF00",Dana:"#FF00D4",Mark:"#F5B700",System:"#14B8A6"};function L1(e){return _1[e]??q.teal}function R1(e){return e.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2)}const Kd=b.createContext({});function Hd(e){const n=b.useRef(null);return n.current===null&&(n.current=e()),n.current}const Ll=b.createContext(null),Qd=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class O1 extends b.Component{getSnapshotBeforeUpdate(n){const s=this.props.childRef.current;if(s&&n.isPresent&&!this.props.isPresent){const a=this.props.sizeRef.current;a.height=s.offsetHeight||0,a.width=s.offsetWidth||0,a.top=s.offsetTop,a.left=s.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function B1({children:e,isPresent:n}){const s=b.useId(),a=b.useRef(null),l=b.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=b.useContext(Qd);return b.useInsertionEffect(()=>{const{width:d,height:f,top:m,left:x}=l.current;if(n||!a.current||!d||!f)return;a.current.dataset.motionPopId=s;const g=document.createElement("style");return u&&(g.nonce=u),document.head.appendChild(g),g.sheet&&g.sheet.insertRule(`
41
+ [data-motion-pop-id="${s}"] {
42
+ position: absolute !important;
43
+ width: ${d}px !important;
44
+ height: ${f}px !important;
45
+ top: ${m}px !important;
46
+ left: ${x}px !important;
47
+ }
48
+ `),()=>{document.head.removeChild(g)}},[n]),i.jsx(O1,{isPresent:n,childRef:a,sizeRef:l,children:b.cloneElement(e,{ref:a})})}const $1=({children:e,initial:n,isPresent:s,onExitComplete:a,custom:l,presenceAffectsLayout:u,mode:d})=>{const f=Hd(V1),m=b.useId(),x=b.useCallback(y=>{f.set(y,!0);for(const v of f.values())if(!v)return;a&&a()},[f,a]),g=b.useMemo(()=>({id:m,initial:n,isPresent:s,custom:l,onExitComplete:x,register:y=>(f.set(y,!1),()=>f.delete(y))}),u?[Math.random(),x]:[s,x]);return b.useMemo(()=>{f.forEach((y,v)=>f.set(v,!1))},[s]),b.useEffect(()=>{!s&&!f.size&&a&&a()},[s]),d==="popLayout"&&(e=i.jsx(B1,{isPresent:s,children:e})),i.jsx(Ll.Provider,{value:g,children:e})};function V1(){return new Map}function Q0(e=!0){const n=b.useContext(Ll);if(n===null)return[!0,null];const{isPresent:s,onExitComplete:a,register:l}=n,u=b.useId();b.useEffect(()=>{e&&l(u)},[e]);const d=b.useCallback(()=>e&&a&&a(u),[u,a,e]);return!s&&a?[!1,d]:[!0]}const dl=e=>e.key||"";function Rm(e){const n=[];return b.Children.forEach(e,s=>{b.isValidElement(s)&&n.push(s)}),n}const qd=typeof window<"u",q0=qd?b.useLayoutEffect:b.useEffect,dr=({children:e,custom:n,initial:s=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:u="sync",propagate:d=!1})=>{const[f,m]=Q0(d),x=b.useMemo(()=>Rm(e),[e]),g=d&&!f?[]:x.map(dl),y=b.useRef(!0),v=b.useRef(x),k=Hd(()=>new Map),[E,S]=b.useState(x),[j,F]=b.useState(x);q0(()=>{y.current=!1,v.current=x;for(let P=0;P<j.length;P++){const M=dl(j[P]);g.includes(M)?k.delete(M):k.get(M)!==!0&&k.set(M,!1)}},[j,g.length,g.join("-")]);const _=[];if(x!==E){let P=[...x];for(let M=0;M<j.length;M++){const C=j[M],B=dl(C);g.includes(B)||(P.splice(M,0,C),_.push(C))}u==="wait"&&_.length&&(P=_),F(Rm(P)),S(x);return}const{forceRender:A}=b.useContext(Kd);return i.jsx(i.Fragment,{children:j.map(P=>{const M=dl(P),C=d&&!f?!1:x===j||g.includes(M),B=()=>{if(k.has(M))k.set(M,!0);else return;let R=!0;k.forEach(G=>{G||(R=!1)}),R&&(A==null||A(),F(v.current),d&&(m==null||m()),a&&a())};return i.jsx($1,{isPresent:C,initial:!y.current||s?void 0:!1,custom:C?void 0:n,presenceAffectsLayout:l,mode:u,onExitComplete:C?void 0:B,children:P},M)})})},tn=e=>e;let G0=tn;function Gd(e){let n;return()=>(n===void 0&&(n=e()),n)}const Ti=(e,n,s)=>{const a=n-e;return a===0?1:(s-e)/a},lr=e=>e*1e3,cr=e=>e/1e3,z1={useManualTiming:!1};function U1(e){let n=new Set,s=new Set,a=!1,l=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function f(x){u.has(x)&&(m.schedule(x),e()),x(d)}const m={schedule:(x,g=!1,y=!1)=>{const k=y&&a?n:s;return g&&u.add(x),k.has(x)||k.add(x),x},cancel:x=>{s.delete(x),u.delete(x)},process:x=>{if(d=x,a){l=!0;return}a=!0,[n,s]=[s,n],n.forEach(f),n.clear(),a=!1,l&&(l=!1,m.process(x))}};return m}const hl=["read","resolveKeyframes","update","preRender","render","postRender"],W1=40;function X0(e,n){let s=!1,a=!0;const l={delta:0,timestamp:0,isProcessing:!1},u=()=>s=!0,d=hl.reduce((F,_)=>(F[_]=U1(u),F),{}),{read:f,resolveKeyframes:m,update:x,preRender:g,render:y,postRender:v}=d,k=()=>{const F=performance.now();s=!1,l.delta=a?1e3/60:Math.max(Math.min(F-l.timestamp,W1),1),l.timestamp=F,l.isProcessing=!0,f.process(l),m.process(l),x.process(l),g.process(l),y.process(l),v.process(l),l.isProcessing=!1,s&&n&&(a=!1,e(k))},E=()=>{s=!0,a=!0,l.isProcessing||e(k)};return{schedule:hl.reduce((F,_)=>{const A=d[_];return F[_]=(P,M=!1,C=!1)=>(s||E(),A.schedule(P,M,C)),F},{}),cancel:F=>{for(let _=0;_<hl.length;_++)d[hl[_]].cancel(F)},state:l,steps:d}}const{schedule:tt,cancel:Hr,state:Et,steps:Lu}=X0(typeof requestAnimationFrame<"u"?requestAnimationFrame:tn,!0),Y0=b.createContext({strict:!1}),Om={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Pi={};for(const e in Om)Pi[e]={isEnabled:n=>Om[e].some(s=>!!n[s])};function K1(e){for(const n in e)Pi[n]={...Pi[n],...e[n]}}const H1=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function El(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||H1.has(e)}let Z0=e=>!El(e);function Q1(e){e&&(Z0=n=>n.startsWith("on")?!El(n):e(n))}try{Q1(require("@emotion/is-prop-valid").default)}catch{}function q1(e,n,s){const a={};for(const l in e)l==="values"&&typeof e.values=="object"||(Z0(l)||s===!0&&El(l)||!n&&!El(l)||e.draggable&&l.startsWith("onDrag"))&&(a[l]=e[l]);return a}function G1(e){if(typeof Proxy>"u")return e;const n=new Map,s=(...a)=>e(...a);return new Proxy(s,{get:(a,l)=>l==="create"?e:(n.has(l)||n.set(l,e(l)),n.get(l))})}const Rl=b.createContext({});function Ro(e){return typeof e=="string"||Array.isArray(e)}function Ol(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Xd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Yd=["initial",...Xd];function Bl(e){return Ol(e.animate)||Yd.some(n=>Ro(e[n]))}function J0(e){return!!(Bl(e)||e.variants)}function X1(e,n){if(Bl(e)){const{initial:s,animate:a}=e;return{initial:s===!1||Ro(s)?s:void 0,animate:Ro(a)?a:void 0}}return e.inherit!==!1?n:{}}function Y1(e){const{initial:n,animate:s}=X1(e,b.useContext(Rl));return b.useMemo(()=>({initial:n,animate:s}),[Bm(n),Bm(s)])}function Bm(e){return Array.isArray(e)?e.join(" "):e}const Z1=Symbol.for("motionComponentSymbol");function ci(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function J1(e,n,s){return b.useCallback(a=>{a&&e.onMount&&e.onMount(a),n&&(a?n.mount(a):n.unmount()),s&&(typeof s=="function"?s(a):ci(s)&&(s.current=a))},[n])}const Zd=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),eb="framerAppearId",eg="data-"+Zd(eb),{schedule:Jd}=X0(queueMicrotask,!1),tg=b.createContext({});function tb(e,n,s,a,l){var u,d;const{visualElement:f}=b.useContext(Rl),m=b.useContext(Y0),x=b.useContext(Ll),g=b.useContext(Qd).reducedMotion,y=b.useRef(null);a=a||m.renderer,!y.current&&a&&(y.current=a(e,{visualState:n,parent:f,props:s,presenceContext:x,blockInitialAnimation:x?x.initial===!1:!1,reducedMotionConfig:g}));const v=y.current,k=b.useContext(tg);v&&!v.projection&&l&&(v.type==="html"||v.type==="svg")&&nb(y.current,s,l,k);const E=b.useRef(!1);b.useInsertionEffect(()=>{v&&E.current&&v.update(s,x)});const S=s[eg],j=b.useRef(!!S&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,S))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,S)));return q0(()=>{v&&(E.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),Jd.render(v.render),j.current&&v.animationState&&v.animationState.animateChanges())}),b.useEffect(()=>{v&&(!j.current&&v.animationState&&v.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var F;(F=window.MotionHandoffMarkAsComplete)===null||F===void 0||F.call(window,S)}),j.current=!1))}),v}function nb(e,n,s,a){const{layoutId:l,layout:u,drag:d,dragConstraints:f,layoutScroll:m,layoutRoot:x}=n;e.projection=new s(e.latestValues,n["data-framer-portal-id"]?void 0:ng(e.parent)),e.projection.setOptions({layoutId:l,layout:u,alwaysMeasureLayout:!!d||f&&ci(f),visualElement:e,animationType:typeof u=="string"?u:"both",initialPromotionConfig:a,layoutScroll:m,layoutRoot:x})}function ng(e){if(e)return e.options.allowProjection!==!1?e.projection:ng(e.parent)}function rb({preloadedFeatures:e,createVisualElement:n,useRender:s,useVisualState:a,Component:l}){var u,d;e&&K1(e);function f(x,g){let y;const v={...b.useContext(Qd),...x,layoutId:sb(x)},{isStatic:k}=v,E=Y1(x),S=a(x,k);if(!k&&qd){ib();const j=ob(v);y=j.MeasureLayout,E.visualElement=tb(l,S,v,n,j.ProjectionNode)}return i.jsxs(Rl.Provider,{value:E,children:[y&&E.visualElement?i.jsx(y,{visualElement:E.visualElement,...v}):null,s(l,x,J1(S,E.visualElement,g),S,k,E.visualElement)]})}f.displayName=`motion.${typeof l=="string"?l:`create(${(d=(u=l.displayName)!==null&&u!==void 0?u:l.name)!==null&&d!==void 0?d:""})`}`;const m=b.forwardRef(f);return m[Z1]=l,m}function sb({layoutId:e}){const n=b.useContext(Kd).id;return n&&e!==void 0?n+"-"+e:e}function ib(e,n){b.useContext(Y0).strict}function ob(e){const{drag:n,layout:s}=Pi;if(!n&&!s)return{};const a={...n,...s};return{MeasureLayout:n!=null&&n.isEnabled(e)||s!=null&&s.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}const ab=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function eh(e){return typeof e!="string"||e.includes("-")?!1:!!(ab.indexOf(e)>-1||/[A-Z]/u.test(e))}function $m(e){const n=[{},{}];return e==null||e.values.forEach((s,a)=>{n[0][a]=s.get(),n[1][a]=s.getVelocity()}),n}function th(e,n,s,a){if(typeof n=="function"){const[l,u]=$m(a);n=n(s!==void 0?s:e.custom,l,u)}if(typeof n=="string"&&(n=e.variants&&e.variants[n]),typeof n=="function"){const[l,u]=$m(a);n=n(s!==void 0?s:e.custom,l,u)}return n}const bd=e=>Array.isArray(e),lb=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),cb=e=>bd(e)?e[e.length-1]||0:e,Lt=e=>!!(e&&e.getVelocity);function wl(e){const n=Lt(e)?e.get():e;return lb(n)?n.toValue():n}function ub({scrapeMotionValuesFromProps:e,createRenderState:n,onUpdate:s},a,l,u){const d={latestValues:db(a,l,u,e),renderState:n()};return s&&(d.onMount=f=>s({props:a,current:f,...d}),d.onUpdate=f=>s(f)),d}const rg=e=>(n,s)=>{const a=b.useContext(Rl),l=b.useContext(Ll),u=()=>ub(e,n,a,l);return s?u():Hd(u)};function db(e,n,s,a){const l={},u=a(e,{});for(const v in u)l[v]=wl(u[v]);let{initial:d,animate:f}=e;const m=Bl(e),x=J0(e);n&&x&&!m&&e.inherit!==!1&&(d===void 0&&(d=n.initial),f===void 0&&(f=n.animate));let g=s?s.initial===!1:!1;g=g||d===!1;const y=g?f:d;if(y&&typeof y!="boolean"&&!Ol(y)){const v=Array.isArray(y)?y:[y];for(let k=0;k<v.length;k++){const E=th(e,v[k]);if(E){const{transitionEnd:S,transition:j,...F}=E;for(const _ in F){let A=F[_];if(Array.isArray(A)){const P=g?A.length-1:0;A=A[P]}A!==null&&(l[_]=A)}for(const _ in S)l[_]=S[_]}}}return l}const Di=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fs=new Set(Di),sg=e=>n=>typeof n=="string"&&n.startsWith(e),ig=sg("--"),hb=sg("var(--"),nh=e=>hb(e)?fb.test(e.split("/*")[0].trim()):!1,fb=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,og=(e,n)=>n&&typeof e=="number"?n.transform(e):e,hr=(e,n,s)=>s>n?n:s<e?e:s,Ii={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Oo={...Ii,transform:e=>hr(0,1,e)},fl={...Ii,default:1},Go=e=>({test:n=>typeof n=="string"&&n.endsWith(e)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${e}`}),Ir=Go("deg"),zn=Go("%"),Fe=Go("px"),pb=Go("vh"),mb=Go("vw"),Vm={...zn,parse:e=>zn.parse(e)/100,transform:e=>zn.transform(e*100)},xb={borderWidth:Fe,borderTopWidth:Fe,borderRightWidth:Fe,borderBottomWidth:Fe,borderLeftWidth:Fe,borderRadius:Fe,radius:Fe,borderTopLeftRadius:Fe,borderTopRightRadius:Fe,borderBottomRightRadius:Fe,borderBottomLeftRadius:Fe,width:Fe,maxWidth:Fe,height:Fe,maxHeight:Fe,top:Fe,right:Fe,bottom:Fe,left:Fe,padding:Fe,paddingTop:Fe,paddingRight:Fe,paddingBottom:Fe,paddingLeft:Fe,margin:Fe,marginTop:Fe,marginRight:Fe,marginBottom:Fe,marginLeft:Fe,backgroundPositionX:Fe,backgroundPositionY:Fe},gb={rotate:Ir,rotateX:Ir,rotateY:Ir,rotateZ:Ir,scale:fl,scaleX:fl,scaleY:fl,scaleZ:fl,skew:Ir,skewX:Ir,skewY:Ir,distance:Fe,translateX:Fe,translateY:Fe,translateZ:Fe,x:Fe,y:Fe,z:Fe,perspective:Fe,transformPerspective:Fe,opacity:Oo,originX:Vm,originY:Vm,originZ:Fe},zm={...Ii,transform:Math.round},rh={...xb,...gb,zIndex:zm,size:Fe,fillOpacity:Oo,strokeOpacity:Oo,numOctaves:zm},yb={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vb=Di.length;function wb(e,n,s){let a="",l=!0;for(let u=0;u<vb;u++){const d=Di[u],f=e[d];if(f===void 0)continue;let m=!0;if(typeof f=="number"?m=f===(d.startsWith("scale")?1:0):m=parseFloat(f)===0,!m||s){const x=og(f,rh[d]);if(!m){l=!1;const g=yb[d]||d;a+=`${g}(${x}) `}s&&(n[d]=x)}}return a=a.trim(),s?a=s(n,l?"":a):l&&(a="none"),a}function sh(e,n,s){const{style:a,vars:l,transformOrigin:u}=e;let d=!1,f=!1;for(const m in n){const x=n[m];if(Fs.has(m)){d=!0;continue}else if(ig(m)){l[m]=x;continue}else{const g=og(x,rh[m]);m.startsWith("origin")?(f=!0,u[m]=g):a[m]=g}}if(n.transform||(d||s?a.transform=wb(n,e.transform,s):a.transform&&(a.transform="none")),f){const{originX:m="50%",originY:x="50%",originZ:g=0}=u;a.transformOrigin=`${m} ${x} ${g}`}}const bb={offset:"stroke-dashoffset",array:"stroke-dasharray"},kb={offset:"strokeDashoffset",array:"strokeDasharray"};function jb(e,n,s=1,a=0,l=!0){e.pathLength=1;const u=l?bb:kb;e[u.offset]=Fe.transform(-a);const d=Fe.transform(n),f=Fe.transform(s);e[u.array]=`${d} ${f}`}function Um(e,n,s){return typeof e=="string"?e:Fe.transform(n+s*e)}function Nb(e,n,s){const a=Um(n,e.x,e.width),l=Um(s,e.y,e.height);return`${a} ${l}`}function ih(e,{attrX:n,attrY:s,attrScale:a,originX:l,originY:u,pathLength:d,pathSpacing:f=1,pathOffset:m=0,...x},g,y){if(sh(e,x,y),g){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:v,style:k,dimensions:E}=e;v.transform&&(E&&(k.transform=v.transform),delete v.transform),E&&(l!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=Nb(E,l!==void 0?l:.5,u!==void 0?u:.5)),n!==void 0&&(v.x=n),s!==void 0&&(v.y=s),a!==void 0&&(v.scale=a),d!==void 0&&jb(v,d,f,m,!1)}const oh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),ag=()=>({...oh(),attrs:{}}),ah=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lg(e,{style:n,vars:s},a,l){Object.assign(e.style,n,l&&l.getProjectionStyles(a));for(const u in s)e.style.setProperty(u,s[u])}const cg=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ug(e,n,s,a){lg(e,n,void 0,a);for(const l in n.attrs)e.setAttribute(cg.has(l)?l:Zd(l),n.attrs[l])}const Tl={};function Sb(e){Object.assign(Tl,e)}function dg(e,{layout:n,layoutId:s}){return Fs.has(e)||e.startsWith("origin")||(n||s!==void 0)&&(!!Tl[e]||e==="opacity")}function lh(e,n,s){var a;const{style:l}=e,u={};for(const d in l)(Lt(l[d])||n.style&&Lt(n.style[d])||dg(d,e)||((a=s==null?void 0:s.getValue(d))===null||a===void 0?void 0:a.liveStyle)!==void 0)&&(u[d]=l[d]);return u}function hg(e,n,s){const a=lh(e,n,s);for(const l in e)if(Lt(e[l])||Lt(n[l])){const u=Di.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;a[u]=e[l]}return a}function Cb(e,n){try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}const Wm=["x","y","width","height","cx","cy","r"],Ab={useVisualState:rg({scrapeMotionValuesFromProps:hg,createRenderState:ag,onUpdate:({props:e,prevProps:n,current:s,renderState:a,latestValues:l})=>{if(!s)return;let u=!!e.drag;if(!u){for(const f in l)if(Fs.has(f)){u=!0;break}}if(!u)return;let d=!n;if(n)for(let f=0;f<Wm.length;f++){const m=Wm[f];e[m]!==n[m]&&(d=!0)}d&&tt.read(()=>{Cb(s,a),tt.render(()=>{ih(a,l,ah(s.tagName),e.transformTemplate),ug(s,a)})})}})},Eb={useVisualState:rg({scrapeMotionValuesFromProps:lh,createRenderState:oh})};function fg(e,n,s){for(const a in n)!Lt(n[a])&&!dg(a,s)&&(e[a]=n[a])}function Tb({transformTemplate:e},n){return b.useMemo(()=>{const s=oh();return sh(s,n,e),Object.assign({},s.vars,s.style)},[n])}function Pb(e,n){const s=e.style||{},a={};return fg(a,s,e),Object.assign(a,Tb(e,n)),a}function Mb(e,n){const s={},a=Pb(e,n);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=a,s}function Fb(e,n,s,a){const l=b.useMemo(()=>{const u=ag();return ih(u,n,ah(a),e.transformTemplate),{...u.attrs,style:{...u.style}}},[n]);if(e.style){const u={};fg(u,e.style,e),l.style={...u,...l.style}}return l}function Db(e=!1){return(s,a,l,{latestValues:u},d)=>{const m=(eh(s)?Fb:Mb)(a,u,d,s),x=q1(a,typeof s=="string",e),g=s!==b.Fragment?{...x,...m,ref:l}:{},{children:y}=a,v=b.useMemo(()=>Lt(y)?y.get():y,[y]);return b.createElement(s,{...g,children:v})}}function Ib(e,n){return function(a,{forwardMotionProps:l}={forwardMotionProps:!1}){const d={...eh(a)?Ab:Eb,preloadedFeatures:e,useRender:Db(l),createVisualElement:n,Component:a};return rb(d)}}function pg(e,n){if(!Array.isArray(n))return!1;const s=n.length;if(s!==e.length)return!1;for(let a=0;a<s;a++)if(n[a]!==e[a])return!1;return!0}function $l(e,n,s){const a=e.getProps();return th(a,n,s!==void 0?s:a.custom,e)}const _b=Gd(()=>window.ScrollTimeline!==void 0);class Lb{constructor(n){this.stop=()=>this.runAll("stop"),this.animations=n.filter(Boolean)}get finished(){return Promise.all(this.animations.map(n=>"finished"in n?n.finished:n))}getAll(n){return this.animations[0][n]}setAll(n,s){for(let a=0;a<this.animations.length;a++)this.animations[a][n]=s}attachTimeline(n,s){const a=this.animations.map(l=>{if(_b()&&l.attachTimeline)return l.attachTimeline(n);if(typeof s=="function")return s(l)});return()=>{a.forEach((l,u)=>{l&&l(),this.animations[u].stop()})}}get time(){return this.getAll("time")}set time(n){this.setAll("time",n)}get speed(){return this.getAll("speed")}set speed(n){this.setAll("speed",n)}get startTime(){return this.getAll("startTime")}get duration(){let n=0;for(let s=0;s<this.animations.length;s++)n=Math.max(n,this.animations[s].duration);return n}runAll(n){this.animations.forEach(s=>s[n]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Rb extends Lb{then(n,s){return Promise.all(this.animations).then(n).catch(s)}}function ch(e,n){return e?e[n]||e.default||e:void 0}const kd=2e4;function mg(e){let n=0;const s=50;let a=e.next(n);for(;!a.done&&n<kd;)n+=s,a=e.next(n);return n>=kd?1/0:n}function uh(e){return typeof e=="function"}function Km(e,n){e.timeline=n,e.onfinish=null}const dh=e=>Array.isArray(e)&&typeof e[0]=="number",Ob={linearEasing:void 0};function Bb(e,n){const s=Gd(e);return()=>{var a;return(a=Ob[n])!==null&&a!==void 0?a:s()}}const Pl=Bb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xg=(e,n,s=10)=>{let a="";const l=Math.max(Math.round(n/s),2);for(let u=0;u<l;u++)a+=e(Ti(0,l-1,u))+", ";return`linear(${a.substring(0,a.length-2)})`};function gg(e){return!!(typeof e=="function"&&Pl()||!e||typeof e=="string"&&(e in jd||Pl())||dh(e)||Array.isArray(e)&&e.every(gg))}const Ao=([e,n,s,a])=>`cubic-bezier(${e}, ${n}, ${s}, ${a})`,jd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ao([0,.65,.55,1]),circOut:Ao([.55,0,1,.45]),backIn:Ao([.31,.01,.66,-.59]),backOut:Ao([.33,1.53,.69,.99])};function yg(e,n){if(e)return typeof e=="function"&&Pl()?xg(e,n):dh(e)?Ao(e):Array.isArray(e)?e.map(s=>yg(s,n)||jd.easeOut):jd[e]}const An={x:!1,y:!1};function vg(){return An.x||An.y}function $b(e,n,s){var a;if(e instanceof Element)return[e];if(typeof e=="string"){let l=document;const u=(a=void 0)!==null&&a!==void 0?a:l.querySelectorAll(e);return u?Array.from(u):[]}return Array.from(e)}function wg(e,n){const s=$b(e),a=new AbortController,l={passive:!0,...n,signal:a.signal};return[s,l,()=>a.abort()]}function Hm(e){return n=>{n.pointerType==="touch"||vg()||e(n)}}function Vb(e,n,s={}){const[a,l,u]=wg(e,s),d=Hm(f=>{const{target:m}=f,x=n(f);if(typeof x!="function"||!m)return;const g=Hm(y=>{x(y),m.removeEventListener("pointerleave",g)});m.addEventListener("pointerleave",g,l)});return a.forEach(f=>{f.addEventListener("pointerenter",d,l)}),u}const bg=(e,n)=>n?e===n?!0:bg(e,n.parentElement):!1,hh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,zb=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ub(e){return zb.has(e.tagName)||e.tabIndex!==-1}const Eo=new WeakSet;function Qm(e){return n=>{n.key==="Enter"&&e(n)}}function Ru(e,n){e.dispatchEvent(new PointerEvent("pointer"+n,{isPrimary:!0,bubbles:!0}))}const Wb=(e,n)=>{const s=e.currentTarget;if(!s)return;const a=Qm(()=>{if(Eo.has(s))return;Ru(s,"down");const l=Qm(()=>{Ru(s,"up")}),u=()=>Ru(s,"cancel");s.addEventListener("keyup",l,n),s.addEventListener("blur",u,n)});s.addEventListener("keydown",a,n),s.addEventListener("blur",()=>s.removeEventListener("keydown",a),n)};function qm(e){return hh(e)&&!vg()}function Kb(e,n,s={}){const[a,l,u]=wg(e,s),d=f=>{const m=f.currentTarget;if(!qm(f)||Eo.has(m))return;Eo.add(m);const x=n(f),g=(k,E)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",v),!(!qm(k)||!Eo.has(m))&&(Eo.delete(m),typeof x=="function"&&x(k,{success:E}))},y=k=>{g(k,s.useGlobalTarget||bg(m,k.target))},v=k=>{g(k,!1)};window.addEventListener("pointerup",y,l),window.addEventListener("pointercancel",v,l)};return a.forEach(f=>{!Ub(f)&&f.getAttribute("tabindex")===null&&(f.tabIndex=0),(s.useGlobalTarget?window:f).addEventListener("pointerdown",d,l),f.addEventListener("focus",x=>Wb(x,l),l)}),u}function Hb(e){return e==="x"||e==="y"?An[e]?null:(An[e]=!0,()=>{An[e]=!1}):An.x||An.y?null:(An.x=An.y=!0,()=>{An.x=An.y=!1})}const kg=new Set(["width","height","top","left","right","bottom",...Di]);let bl;function Qb(){bl=void 0}const Un={now:()=>(bl===void 0&&Un.set(Et.isProcessing||z1.useManualTiming?Et.timestamp:performance.now()),bl),set:e=>{bl=e,queueMicrotask(Qb)}};function fh(e,n){e.indexOf(n)===-1&&e.push(n)}function ph(e,n){const s=e.indexOf(n);s>-1&&e.splice(s,1)}class mh{constructor(){this.subscriptions=[]}add(n){return fh(this.subscriptions,n),()=>ph(this.subscriptions,n)}notify(n,s,a){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](n,s,a);else for(let u=0;u<l;u++){const d=this.subscriptions[u];d&&d(n,s,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function jg(e,n){return n?e*(1e3/n):0}const Gm=30,qb=e=>!isNaN(parseFloat(e));class Gb{constructor(n,s={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(a,l=!0)=>{const u=Un.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),l&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(n),this.owner=s.owner}setCurrent(n){this.current=n,this.updatedAt=Un.now(),this.canTrackVelocity===null&&n!==void 0&&(this.canTrackVelocity=qb(this.current))}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return this.on("change",n)}on(n,s){this.events[n]||(this.events[n]=new mh);const a=this.events[n].add(s);return n==="change"?()=>{a(),tt.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,s){this.passiveEffect=n,this.stopPassiveEffect=s}set(n,s=!0){!s||!this.passiveEffect?this.updateAndNotify(n,s):this.passiveEffect(n,this.updateAndNotify)}setWithVelocity(n,s,a){this.set(s),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-a}jump(n,s=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=Un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>Gm)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Gm);return jg(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(n){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=n(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Bo(e,n){return new Gb(e,n)}function Xb(e,n,s){e.hasValue(n)?e.getValue(n).set(s):e.addValue(n,Bo(s))}function Yb(e,n){const s=$l(e,n);let{transitionEnd:a={},transition:l={},...u}=s||{};u={...u,...a};for(const d in u){const f=cb(u[d]);Xb(e,d,f)}}function Zb(e){return!!(Lt(e)&&e.add)}function Nd(e,n){const s=e.getValue("willChange");if(Zb(s))return s.add(n)}function Ng(e){return e.props[eg]}const Sg=(e,n,s)=>(((1-3*s+3*n)*e+(3*s-6*n))*e+3*n)*e,Jb=1e-7,e2=12;function t2(e,n,s,a,l){let u,d,f=0;do d=n+(s-n)/2,u=Sg(d,a,l)-e,u>0?s=d:n=d;while(Math.abs(u)>Jb&&++f<e2);return d}function Xo(e,n,s,a){if(e===n&&s===a)return tn;const l=u=>t2(u,0,1,e,s);return u=>u===0||u===1?u:Sg(l(u),n,a)}const Cg=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,Ag=e=>n=>1-e(1-n),Eg=Xo(.33,1.53,.69,.99),xh=Ag(Eg),Tg=Cg(xh),Pg=e=>(e*=2)<1?.5*xh(e):.5*(2-Math.pow(2,-10*(e-1))),gh=e=>1-Math.sin(Math.acos(e)),Mg=Ag(gh),Fg=Cg(gh),Dg=e=>/^0[^.\s]+$/u.test(e);function n2(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Dg(e):!0}const Po=e=>Math.round(e*1e5)/1e5,yh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function r2(e){return e==null}const s2=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vh=(e,n)=>s=>!!(typeof s=="string"&&s2.test(s)&&s.startsWith(e)||n&&!r2(s)&&Object.prototype.hasOwnProperty.call(s,n)),Ig=(e,n,s)=>a=>{if(typeof a!="string")return a;const[l,u,d,f]=a.match(yh);return{[e]:parseFloat(l),[n]:parseFloat(u),[s]:parseFloat(d),alpha:f!==void 0?parseFloat(f):1}},i2=e=>hr(0,255,e),Ou={...Ii,transform:e=>Math.round(i2(e))},gs={test:vh("rgb","red"),parse:Ig("red","green","blue"),transform:({red:e,green:n,blue:s,alpha:a=1})=>"rgba("+Ou.transform(e)+", "+Ou.transform(n)+", "+Ou.transform(s)+", "+Po(Oo.transform(a))+")"};function o2(e){let n="",s="",a="",l="";return e.length>5?(n=e.substring(1,3),s=e.substring(3,5),a=e.substring(5,7),l=e.substring(7,9)):(n=e.substring(1,2),s=e.substring(2,3),a=e.substring(3,4),l=e.substring(4,5),n+=n,s+=s,a+=a,l+=l),{red:parseInt(n,16),green:parseInt(s,16),blue:parseInt(a,16),alpha:l?parseInt(l,16)/255:1}}const Sd={test:vh("#"),parse:o2,transform:gs.transform},ui={test:vh("hsl","hue"),parse:Ig("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:s,alpha:a=1})=>"hsla("+Math.round(e)+", "+zn.transform(Po(n))+", "+zn.transform(Po(s))+", "+Po(Oo.transform(a))+")"},_t={test:e=>gs.test(e)||Sd.test(e)||ui.test(e),parse:e=>gs.test(e)?gs.parse(e):ui.test(e)?ui.parse(e):Sd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?gs.transform(e):ui.transform(e)},a2=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function l2(e){var n,s;return isNaN(e)&&typeof e=="string"&&(((n=e.match(yh))===null||n===void 0?void 0:n.length)||0)+(((s=e.match(a2))===null||s===void 0?void 0:s.length)||0)>0}const _g="number",Lg="color",c2="var",u2="var(",Xm="${}",d2=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function $o(e){const n=e.toString(),s=[],a={color:[],number:[],var:[]},l=[];let u=0;const f=n.replace(d2,m=>(_t.test(m)?(a.color.push(u),l.push(Lg),s.push(_t.parse(m))):m.startsWith(u2)?(a.var.push(u),l.push(c2),s.push(m)):(a.number.push(u),l.push(_g),s.push(parseFloat(m))),++u,Xm)).split(Xm);return{values:s,split:f,indexes:a,types:l}}function Rg(e){return $o(e).values}function Og(e){const{split:n,types:s}=$o(e),a=n.length;return l=>{let u="";for(let d=0;d<a;d++)if(u+=n[d],l[d]!==void 0){const f=s[d];f===_g?u+=Po(l[d]):f===Lg?u+=_t.transform(l[d]):u+=l[d]}return u}}const h2=e=>typeof e=="number"?0:e;function f2(e){const n=Rg(e);return Og(e)(n.map(h2))}const Qr={test:l2,parse:Rg,createTransformer:Og,getAnimatableNone:f2},p2=new Set(["brightness","contrast","saturate","opacity"]);function m2(e){const[n,s]=e.slice(0,-1).split("(");if(n==="drop-shadow")return e;const[a]=s.match(yh)||[];if(!a)return e;const l=s.replace(a,"");let u=p2.has(n)?1:0;return a!==s&&(u*=100),n+"("+u+l+")"}const x2=/\b([a-z-]*)\(.*?\)/gu,Cd={...Qr,getAnimatableNone:e=>{const n=e.match(x2);return n?n.map(m2).join(" "):e}},g2={...rh,color:_t,backgroundColor:_t,outlineColor:_t,fill:_t,stroke:_t,borderColor:_t,borderTopColor:_t,borderRightColor:_t,borderBottomColor:_t,borderLeftColor:_t,filter:Cd,WebkitFilter:Cd},wh=e=>g2[e];function Bg(e,n){let s=wh(e);return s!==Cd&&(s=Qr),s.getAnimatableNone?s.getAnimatableNone(n):void 0}const y2=new Set(["auto","none","0"]);function v2(e,n,s){let a=0,l;for(;a<e.length&&!l;){const u=e[a];typeof u=="string"&&!y2.has(u)&&$o(u).values.length&&(l=e[a]),a++}if(l&&s)for(const u of n)e[u]=Bg(s,l)}const Ym=e=>e===Ii||e===Fe,Zm=(e,n)=>parseFloat(e.split(", ")[n]),Jm=(e,n)=>(s,{transform:a})=>{if(a==="none"||!a)return 0;const l=a.match(/^matrix3d\((.+)\)$/u);if(l)return Zm(l[1],n);{const u=a.match(/^matrix\((.+)\)$/u);return u?Zm(u[1],e):0}},w2=new Set(["x","y","z"]),b2=Di.filter(e=>!w2.has(e));function k2(e){const n=[];return b2.forEach(s=>{const a=e.getValue(s);a!==void 0&&(n.push([s,a.get()]),a.set(s.startsWith("scale")?1:0))}),n}const Mi={width:({x:e},{paddingLeft:n="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(n)-parseFloat(s),height:({y:e},{paddingTop:n="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(n)-parseFloat(s),top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:Jm(4,13),y:Jm(5,14)};Mi.translateX=Mi.x;Mi.translateY=Mi.y;const As=new Set;let Ad=!1,Ed=!1;function $g(){if(Ed){const e=Array.from(As).filter(a=>a.needsMeasurement),n=new Set(e.map(a=>a.element)),s=new Map;n.forEach(a=>{const l=k2(a);l.length&&(s.set(a,l),a.render())}),e.forEach(a=>a.measureInitialState()),n.forEach(a=>{a.render();const l=s.get(a);l&&l.forEach(([u,d])=>{var f;(f=a.getValue(u))===null||f===void 0||f.set(d)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}Ed=!1,Ad=!1,As.forEach(e=>e.complete()),As.clear()}function Vg(){As.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ed=!0)})}function j2(){Vg(),$g()}class bh{constructor(n,s,a,l,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...n],this.onComplete=s,this.name=a,this.motionValue=l,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(As.add(this),Ad||(Ad=!0,tt.read(Vg),tt.resolveKeyframes($g))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:s,element:a,motionValue:l}=this;for(let u=0;u<n.length;u++)if(n[u]===null)if(u===0){const d=l==null?void 0:l.get(),f=n[n.length-1];if(d!==void 0)n[0]=d;else if(a&&s){const m=a.readValue(s,f);m!=null&&(n[0]=m)}n[0]===void 0&&(n[0]=f),l&&d===void 0&&l.set(n[0])}else n[u]=n[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),As.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,As.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const zg=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),N2=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function S2(e){const n=N2.exec(e);if(!n)return[,];const[,s,a,l]=n;return[`--${s??a}`,l]}function Ug(e,n,s=1){const[a,l]=S2(e);if(!a)return;const u=window.getComputedStyle(n).getPropertyValue(a);if(u){const d=u.trim();return zg(d)?parseFloat(d):d}return nh(l)?Ug(l,n,s+1):l}const Wg=e=>n=>n.test(e),C2={test:e=>e==="auto",parse:e=>e},Kg=[Ii,Fe,zn,Ir,mb,pb,C2],ex=e=>Kg.find(Wg(e));class Hg extends bh{constructor(n,s,a,l,u){super(n,s,a,l,u,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:s,name:a}=this;if(!s||!s.current)return;super.readKeyframes();for(let m=0;m<n.length;m++){let x=n[m];if(typeof x=="string"&&(x=x.trim(),nh(x))){const g=Ug(x,s.current);g!==void 0&&(n[m]=g),m===n.length-1&&(this.finalKeyframe=x)}}if(this.resolveNoneKeyframes(),!kg.has(a)||n.length!==2)return;const[l,u]=n,d=ex(l),f=ex(u);if(d!==f)if(Ym(d)&&Ym(f))for(let m=0;m<n.length;m++){const x=n[m];typeof x=="string"&&(n[m]=parseFloat(x))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:s}=this,a=[];for(let l=0;l<n.length;l++)n2(n[l])&&a.push(l);a.length&&v2(n,a,s)}measureInitialState(){const{element:n,unresolvedKeyframes:s,name:a}=this;if(!n||!n.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Mi[a](n.measureViewportBox(),window.getComputedStyle(n.current)),s[0]=this.measuredOrigin;const l=s[s.length-1];l!==void 0&&n.getValue(a,l).jump(l,!1)}measureEndState(){var n;const{element:s,name:a,unresolvedKeyframes:l}=this;if(!s||!s.current)return;const u=s.getValue(a);u&&u.jump(this.measuredOrigin,!1);const d=l.length-1,f=l[d];l[d]=Mi[a](s.measureViewportBox(),window.getComputedStyle(s.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),!((n=this.removedTransforms)===null||n===void 0)&&n.length&&this.removedTransforms.forEach(([m,x])=>{s.getValue(m).set(x)}),this.resolveNoneKeyframes()}}const tx=(e,n)=>n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qr.test(e)||e==="0")&&!e.startsWith("url("));function A2(e){const n=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==n)return!0}function E2(e,n,s,a){const l=e[0];if(l===null)return!1;if(n==="display"||n==="visibility")return!0;const u=e[e.length-1],d=tx(l,n),f=tx(u,n);return!d||!f?!1:A2(e)||(s==="spring"||uh(s))&&a}const T2=e=>e!==null;function Vl(e,{repeat:n,repeatType:s="loop"},a){const l=e.filter(T2),u=n&&s!=="loop"&&n%2===1?0:l.length-1;return!u||a===void 0?l[u]:a}const P2=40;class Qg{constructor({autoplay:n=!0,delay:s=0,type:a="keyframes",repeat:l=0,repeatDelay:u=0,repeatType:d="loop",...f}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Un.now(),this.options={autoplay:n,delay:s,type:a,repeat:l,repeatDelay:u,repeatType:d,...f},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>P2?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&j2(),this._resolved}onKeyframesResolved(n,s){this.resolvedAt=Un.now(),this.hasAttemptedResolve=!0;const{name:a,type:l,velocity:u,delay:d,onComplete:f,onUpdate:m,isGenerator:x}=this.options;if(!x&&!E2(n,a,l,u))if(d)this.options.duration=0;else{m&&m(Vl(n,this.options,s)),f&&f(),this.resolveFinishedPromise();return}const g=this.initPlayback(n,s);g!==!1&&(this._resolved={keyframes:n,finalKeyframe:s,...g},this.onPostResolved())}onPostResolved(){}then(n,s){return this.currentFinishedPromise.then(n,s)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(n=>{this.resolveFinishedPromise=n})}}const it=(e,n,s)=>e+(n-e)*s;function Bu(e,n,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(n-e)*6*s:s<1/2?n:s<2/3?e+(n-e)*(2/3-s)*6:e}function M2({hue:e,saturation:n,lightness:s,alpha:a}){e/=360,n/=100,s/=100;let l=0,u=0,d=0;if(!n)l=u=d=s;else{const f=s<.5?s*(1+n):s+n-s*n,m=2*s-f;l=Bu(m,f,e+1/3),u=Bu(m,f,e),d=Bu(m,f,e-1/3)}return{red:Math.round(l*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:a}}function Ml(e,n){return s=>s>0?n:e}const $u=(e,n,s)=>{const a=e*e,l=s*(n*n-a)+a;return l<0?0:Math.sqrt(l)},F2=[Sd,gs,ui],D2=e=>F2.find(n=>n.test(e));function nx(e){const n=D2(e);if(!n)return!1;let s=n.parse(e);return n===ui&&(s=M2(s)),s}const rx=(e,n)=>{const s=nx(e),a=nx(n);if(!s||!a)return Ml(e,n);const l={...s};return u=>(l.red=$u(s.red,a.red,u),l.green=$u(s.green,a.green,u),l.blue=$u(s.blue,a.blue,u),l.alpha=it(s.alpha,a.alpha,u),gs.transform(l))},I2=(e,n)=>s=>n(e(s)),Yo=(...e)=>e.reduce(I2),Td=new Set(["none","hidden"]);function _2(e,n){return Td.has(e)?s=>s<=0?e:n:s=>s>=1?n:e}function L2(e,n){return s=>it(e,n,s)}function kh(e){return typeof e=="number"?L2:typeof e=="string"?nh(e)?Ml:_t.test(e)?rx:B2:Array.isArray(e)?qg:typeof e=="object"?_t.test(e)?rx:R2:Ml}function qg(e,n){const s=[...e],a=s.length,l=e.map((u,d)=>kh(u)(u,n[d]));return u=>{for(let d=0;d<a;d++)s[d]=l[d](u);return s}}function R2(e,n){const s={...e,...n},a={};for(const l in s)e[l]!==void 0&&n[l]!==void 0&&(a[l]=kh(e[l])(e[l],n[l]));return l=>{for(const u in a)s[u]=a[u](l);return s}}function O2(e,n){var s;const a=[],l={color:0,var:0,number:0};for(let u=0;u<n.values.length;u++){const d=n.types[u],f=e.indexes[d][l[d]],m=(s=e.values[f])!==null&&s!==void 0?s:0;a[u]=m,l[d]++}return a}const B2=(e,n)=>{const s=Qr.createTransformer(n),a=$o(e),l=$o(n);return a.indexes.var.length===l.indexes.var.length&&a.indexes.color.length===l.indexes.color.length&&a.indexes.number.length>=l.indexes.number.length?Td.has(e)&&!l.values.length||Td.has(n)&&!a.values.length?_2(e,n):Yo(qg(O2(a,l),l.values),s):Ml(e,n)};function Gg(e,n,s){return typeof e=="number"&&typeof n=="number"&&typeof s=="number"?it(e,n,s):kh(e)(e,n)}const $2=5;function Xg(e,n,s){const a=Math.max(n-$2,0);return jg(s-e(a),n-a)}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Vu=.001;function V2({duration:e=lt.duration,bounce:n=lt.bounce,velocity:s=lt.velocity,mass:a=lt.mass}){let l,u,d=1-n;d=hr(lt.minDamping,lt.maxDamping,d),e=hr(lt.minDuration,lt.maxDuration,cr(e)),d<1?(l=x=>{const g=x*d,y=g*e,v=g-s,k=Pd(x,d),E=Math.exp(-y);return Vu-v/k*E},u=x=>{const y=x*d*e,v=y*s+s,k=Math.pow(d,2)*Math.pow(x,2)*e,E=Math.exp(-y),S=Pd(Math.pow(x,2),d);return(-l(x)+Vu>0?-1:1)*((v-k)*E)/S}):(l=x=>{const g=Math.exp(-x*e),y=(x-s)*e+1;return-Vu+g*y},u=x=>{const g=Math.exp(-x*e),y=(s-x)*(e*e);return g*y});const f=5/e,m=U2(l,u,f);if(e=lr(e),isNaN(m))return{stiffness:lt.stiffness,damping:lt.damping,duration:e};{const x=Math.pow(m,2)*a;return{stiffness:x,damping:d*2*Math.sqrt(a*x),duration:e}}}const z2=12;function U2(e,n,s){let a=s;for(let l=1;l<z2;l++)a=a-e(a)/n(a);return a}function Pd(e,n){return e*Math.sqrt(1-n*n)}const W2=["duration","bounce"],K2=["stiffness","damping","mass"];function sx(e,n){return n.some(s=>e[s]!==void 0)}function H2(e){let n={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...e};if(!sx(e,K2)&&sx(e,W2))if(e.visualDuration){const s=e.visualDuration,a=2*Math.PI/(s*1.2),l=a*a,u=2*hr(.05,1,1-(e.bounce||0))*Math.sqrt(l);n={...n,mass:lt.mass,stiffness:l,damping:u}}else{const s=V2(e);n={...n,...s,mass:lt.mass},n.isResolvedFromDuration=!0}return n}function Yg(e=lt.visualDuration,n=lt.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:n}:e;let{restSpeed:a,restDelta:l}=s;const u=s.keyframes[0],d=s.keyframes[s.keyframes.length-1],f={done:!1,value:u},{stiffness:m,damping:x,mass:g,duration:y,velocity:v,isResolvedFromDuration:k}=H2({...s,velocity:-cr(s.velocity||0)}),E=v||0,S=x/(2*Math.sqrt(m*g)),j=d-u,F=cr(Math.sqrt(m/g)),_=Math.abs(j)<5;a||(a=_?lt.restSpeed.granular:lt.restSpeed.default),l||(l=_?lt.restDelta.granular:lt.restDelta.default);let A;if(S<1){const M=Pd(F,S);A=C=>{const B=Math.exp(-S*F*C);return d-B*((E+S*F*j)/M*Math.sin(M*C)+j*Math.cos(M*C))}}else if(S===1)A=M=>d-Math.exp(-F*M)*(j+(E+F*j)*M);else{const M=F*Math.sqrt(S*S-1);A=C=>{const B=Math.exp(-S*F*C),R=Math.min(M*C,300);return d-B*((E+S*F*j)*Math.sinh(R)+M*j*Math.cosh(R))/M}}const P={calculatedDuration:k&&y||null,next:M=>{const C=A(M);if(k)f.done=M>=y;else{let B=0;S<1&&(B=M===0?lr(E):Xg(A,M,C));const R=Math.abs(B)<=a,G=Math.abs(d-C)<=l;f.done=R&&G}return f.value=f.done?d:C,f},toString:()=>{const M=Math.min(mg(P),kd),C=xg(B=>P.next(M*B).value,M,30);return M+"ms "+C}};return P}function ix({keyframes:e,velocity:n=0,power:s=.8,timeConstant:a=325,bounceDamping:l=10,bounceStiffness:u=500,modifyTarget:d,min:f,max:m,restDelta:x=.5,restSpeed:g}){const y=e[0],v={done:!1,value:y},k=R=>f!==void 0&&R<f||m!==void 0&&R>m,E=R=>f===void 0?m:m===void 0||Math.abs(f-R)<Math.abs(m-R)?f:m;let S=s*n;const j=y+S,F=d===void 0?j:d(j);F!==j&&(S=F-y);const _=R=>-S*Math.exp(-R/a),A=R=>F+_(R),P=R=>{const G=_(R),he=A(R);v.done=Math.abs(G)<=x,v.value=v.done?F:he};let M,C;const B=R=>{k(v.value)&&(M=R,C=Yg({keyframes:[v.value,E(v.value)],velocity:Xg(A,R,v.value),damping:l,stiffness:u,restDelta:x,restSpeed:g}))};return B(0),{calculatedDuration:null,next:R=>{let G=!1;return!C&&M===void 0&&(G=!0,P(R),B(R)),M!==void 0&&R>=M?C.next(R-M):(!G&&P(R),v)}}}const Q2=Xo(.42,0,1,1),q2=Xo(0,0,.58,1),Zg=Xo(.42,0,.58,1),G2=e=>Array.isArray(e)&&typeof e[0]!="number",X2={linear:tn,easeIn:Q2,easeInOut:Zg,easeOut:q2,circIn:gh,circInOut:Fg,circOut:Mg,backIn:xh,backInOut:Tg,backOut:Eg,anticipate:Pg},ox=e=>{if(dh(e)){G0(e.length===4);const[n,s,a,l]=e;return Xo(n,s,a,l)}else if(typeof e=="string")return X2[e];return e};function Y2(e,n,s){const a=[],l=s||Gg,u=e.length-1;for(let d=0;d<u;d++){let f=l(e[d],e[d+1]);if(n){const m=Array.isArray(n)?n[d]||tn:n;f=Yo(m,f)}a.push(f)}return a}function Z2(e,n,{clamp:s=!0,ease:a,mixer:l}={}){const u=e.length;if(G0(u===n.length),u===1)return()=>n[0];if(u===2&&n[0]===n[1])return()=>n[1];const d=e[0]===e[1];e[0]>e[u-1]&&(e=[...e].reverse(),n=[...n].reverse());const f=Y2(n,a,l),m=f.length,x=g=>{if(d&&g<e[0])return n[0];let y=0;if(m>1)for(;y<e.length-2&&!(g<e[y+1]);y++);const v=Ti(e[y],e[y+1],g);return f[y](v)};return s?g=>x(hr(e[0],e[u-1],g)):x}function J2(e,n){const s=e[e.length-1];for(let a=1;a<=n;a++){const l=Ti(0,n,a);e.push(it(s,1,l))}}function ek(e){const n=[0];return J2(n,e.length-1),n}function tk(e,n){return e.map(s=>s*n)}function nk(e,n){return e.map(()=>n||Zg).splice(0,e.length-1)}function Fl({duration:e=300,keyframes:n,times:s,ease:a="easeInOut"}){const l=G2(a)?a.map(ox):ox(a),u={done:!1,value:n[0]},d=tk(s&&s.length===n.length?s:ek(n),e),f=Z2(d,n,{ease:Array.isArray(l)?l:nk(n,l)});return{calculatedDuration:e,next:m=>(u.value=f(m),u.done=m>=e,u)}}const rk=e=>{const n=({timestamp:s})=>e(s);return{start:()=>tt.update(n,!0),stop:()=>Hr(n),now:()=>Et.isProcessing?Et.timestamp:Un.now()}},sk={decay:ix,inertia:ix,tween:Fl,keyframes:Fl,spring:Yg},ik=e=>e/100;class jh extends Qg{constructor(n){super(n),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:s,motionValue:a,element:l,keyframes:u}=this.options,d=(l==null?void 0:l.KeyframeResolver)||bh,f=(m,x)=>this.onKeyframesResolved(m,x);this.resolver=new d(u,f,s,a,l),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(n){const{type:s="keyframes",repeat:a=0,repeatDelay:l=0,repeatType:u,velocity:d=0}=this.options,f=uh(s)?s:sk[s]||Fl;let m,x;f!==Fl&&typeof n[0]!="number"&&(m=Yo(ik,Gg(n[0],n[1])),n=[0,100]);const g=f({...this.options,keyframes:n});u==="mirror"&&(x=f({...this.options,keyframes:[...n].reverse(),velocity:-d})),g.calculatedDuration===null&&(g.calculatedDuration=mg(g));const{calculatedDuration:y}=g,v=y+l,k=v*(a+1)-l;return{generator:g,mirroredGenerator:x,mapPercentToKeyframes:m,calculatedDuration:y,resolvedDuration:v,totalDuration:k}}onPostResolved(){const{autoplay:n=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!n?this.pause():this.state=this.pendingPlayState}tick(n,s=!1){const{resolved:a}=this;if(!a){const{keyframes:R}=this.options;return{done:!0,value:R[R.length-1]}}const{finalKeyframe:l,generator:u,mirroredGenerator:d,mapPercentToKeyframes:f,keyframes:m,calculatedDuration:x,totalDuration:g,resolvedDuration:y}=a;if(this.startTime===null)return u.next(0);const{delay:v,repeat:k,repeatType:E,repeatDelay:S,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-g/this.speed,this.startTime)),s?this.currentTime=n:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(n-this.startTime)*this.speed;const F=this.currentTime-v*(this.speed>=0?1:-1),_=this.speed>=0?F<0:F>g;this.currentTime=Math.max(F,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=g);let A=this.currentTime,P=u;if(k){const R=Math.min(this.currentTime,g)/y;let G=Math.floor(R),he=R%1;!he&&R>=1&&(he=1),he===1&&G--,G=Math.min(G,k+1),!!(G%2)&&(E==="reverse"?(he=1-he,S&&(he-=S/y)):E==="mirror"&&(P=d)),A=hr(0,1,he)*y}const M=_?{done:!1,value:m[0]}:P.next(A);f&&(M.value=f(M.value));let{done:C}=M;!_&&x!==null&&(C=this.speed>=0?this.currentTime>=g:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return B&&l!==void 0&&(M.value=Vl(m,this.options,l)),j&&j(M.value),B&&this.finish(),M}get duration(){const{resolved:n}=this;return n?cr(n.calculatedDuration):0}get time(){return cr(this.currentTime)}set time(n){n=lr(n),this.currentTime=n,this.holdTime!==null||this.speed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.speed)}get speed(){return this.playbackSpeed}set speed(n){const s=this.playbackSpeed!==n;this.playbackSpeed=n,s&&(this.time=cr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:n=rk,onPlay:s,startTime:a}=this.options;this.driver||(this.driver=n(u=>this.tick(u))),s&&s();const l=this.driver.now();this.holdTime!==null?this.startTime=l-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=l):this.startTime=a??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var n;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(n=this.currentTime)!==null&&n!==void 0?n:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:n}=this.options;n&&n()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}}const ok=new Set(["opacity","clipPath","filter","transform"]);function ak(e,n,s,{delay:a=0,duration:l=300,repeat:u=0,repeatType:d="loop",ease:f="easeInOut",times:m}={}){const x={[n]:s};m&&(x.offset=m);const g=yg(f,l);return Array.isArray(g)&&(x.easing=g),e.animate(x,{delay:a,duration:l,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const lk=Gd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Dl=10,ck=2e4;function uk(e){return uh(e.type)||e.type==="spring"||!gg(e.ease)}function dk(e,n){const s=new jh({...n,keyframes:e,repeat:0,delay:0,isGenerator:!0});let a={done:!1,value:e[0]};const l=[];let u=0;for(;!a.done&&u<ck;)a=s.sample(u),l.push(a.value),u+=Dl;return{times:void 0,keyframes:l,duration:u-Dl,ease:"linear"}}const Jg={anticipate:Pg,backInOut:Tg,circInOut:Fg};function hk(e){return e in Jg}class ax extends Qg{constructor(n){super(n);const{name:s,motionValue:a,element:l,keyframes:u}=this.options;this.resolver=new Hg(u,(d,f)=>this.onKeyframesResolved(d,f),s,a,l),this.resolver.scheduleResolve()}initPlayback(n,s){let{duration:a=300,times:l,ease:u,type:d,motionValue:f,name:m,startTime:x}=this.options;if(!f.owner||!f.owner.current)return!1;if(typeof u=="string"&&Pl()&&hk(u)&&(u=Jg[u]),uk(this.options)){const{onComplete:y,onUpdate:v,motionValue:k,element:E,...S}=this.options,j=dk(n,S);n=j.keyframes,n.length===1&&(n[1]=n[0]),a=j.duration,l=j.times,u=j.ease,d="keyframes"}const g=ak(f.owner.current,m,n,{...this.options,duration:a,times:l,ease:u});return g.startTime=x??this.calcStartTime(),this.pendingTimeline?(Km(g,this.pendingTimeline),this.pendingTimeline=void 0):g.onfinish=()=>{const{onComplete:y}=this.options;f.set(Vl(n,this.options,s)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:g,duration:a,times:l,type:d,ease:u,keyframes:n}}get duration(){const{resolved:n}=this;if(!n)return 0;const{duration:s}=n;return cr(s)}get time(){const{resolved:n}=this;if(!n)return 0;const{animation:s}=n;return cr(s.currentTime||0)}set time(n){const{resolved:s}=this;if(!s)return;const{animation:a}=s;a.currentTime=lr(n)}get speed(){const{resolved:n}=this;if(!n)return 1;const{animation:s}=n;return s.playbackRate}set speed(n){const{resolved:s}=this;if(!s)return;const{animation:a}=s;a.playbackRate=n}get state(){const{resolved:n}=this;if(!n)return"idle";const{animation:s}=n;return s.playState}get startTime(){const{resolved:n}=this;if(!n)return null;const{animation:s}=n;return s.startTime}attachTimeline(n){if(!this._resolved)this.pendingTimeline=n;else{const{resolved:s}=this;if(!s)return tn;const{animation:a}=s;Km(a,n)}return tn}play(){if(this.isStopped)return;const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playState==="finished"&&this.updateFinishedPromise(),s.play()}pause(){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:n}=this;if(!n)return;const{animation:s,keyframes:a,duration:l,type:u,ease:d,times:f}=n;if(s.playState==="idle"||s.playState==="finished")return;if(this.time){const{motionValue:x,onUpdate:g,onComplete:y,element:v,...k}=this.options,E=new jh({...k,keyframes:a,duration:l,type:u,ease:d,times:f,isGenerator:!0}),S=lr(this.time);x.setWithVelocity(E.sample(S-Dl).value,E.sample(S).value,Dl)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:n}=this;n&&n.animation.finish()}cancel(){const{resolved:n}=this;n&&n.animation.cancel()}static supports(n){const{motionValue:s,name:a,repeatDelay:l,repeatType:u,damping:d,type:f}=n;if(!s||!s.owner||!(s.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:x}=s.owner.getProps();return lk()&&a&&ok.has(a)&&!m&&!x&&!l&&u!=="mirror"&&d!==0&&f!=="inertia"}}const fk={type:"spring",stiffness:500,damping:25,restSpeed:10},pk=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mk={type:"keyframes",duration:.8},xk={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gk=(e,{keyframes:n})=>n.length>2?mk:Fs.has(e)?e.startsWith("scale")?pk(n[1]):fk:xk;function yk({when:e,delay:n,delayChildren:s,staggerChildren:a,staggerDirection:l,repeat:u,repeatType:d,repeatDelay:f,from:m,elapsed:x,...g}){return!!Object.keys(g).length}const Nh=(e,n,s,a={},l,u)=>d=>{const f=ch(a,e)||{},m=f.delay||a.delay||0;let{elapsed:x=0}=a;x=x-lr(m);let g={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:n.getVelocity(),...f,delay:-x,onUpdate:v=>{n.set(v),f.onUpdate&&f.onUpdate(v)},onComplete:()=>{d(),f.onComplete&&f.onComplete()},name:e,motionValue:n,element:u?void 0:l};yk(f)||(g={...g,...gk(e,g)}),g.duration&&(g.duration=lr(g.duration)),g.repeatDelay&&(g.repeatDelay=lr(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let y=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(g.duration=0,g.delay===0&&(y=!0)),y&&!u&&n.get()!==void 0){const v=Vl(g.keyframes,f);if(v!==void 0)return tt.update(()=>{g.onUpdate(v),g.onComplete()}),new Rb([])}return!u&&ax.supports(g)?new ax(g):new jh(g)};function vk({protectedKeys:e,needsAnimating:n},s){const a=e.hasOwnProperty(s)&&n[s]!==!0;return n[s]=!1,a}function ey(e,n,{delay:s=0,transitionOverride:a,type:l}={}){var u;let{transition:d=e.getDefaultTransition(),transitionEnd:f,...m}=n;a&&(d=a);const x=[],g=l&&e.animationState&&e.animationState.getState()[l];for(const y in m){const v=e.getValue(y,(u=e.latestValues[y])!==null&&u!==void 0?u:null),k=m[y];if(k===void 0||g&&vk(g,y))continue;const E={delay:s,...ch(d||{},y)};let S=!1;if(window.MotionHandoffAnimation){const F=Ng(e);if(F){const _=window.MotionHandoffAnimation(F,y,tt);_!==null&&(E.startTime=_,S=!0)}}Nd(e,y),v.start(Nh(y,v,k,e.shouldReduceMotion&&kg.has(y)?{type:!1}:E,e,S));const j=v.animation;j&&x.push(j)}return f&&Promise.all(x).then(()=>{tt.update(()=>{f&&Yb(e,f)})}),x}function Md(e,n,s={}){var a;const l=$l(e,n,s.type==="exit"?(a=e.presenceContext)===null||a===void 0?void 0:a.custom:void 0);let{transition:u=e.getDefaultTransition()||{}}=l||{};s.transitionOverride&&(u=s.transitionOverride);const d=l?()=>Promise.all(ey(e,l,s)):()=>Promise.resolve(),f=e.variantChildren&&e.variantChildren.size?(x=0)=>{const{delayChildren:g=0,staggerChildren:y,staggerDirection:v}=u;return wk(e,n,g+x,y,v,s)}:()=>Promise.resolve(),{when:m}=u;if(m){const[x,g]=m==="beforeChildren"?[d,f]:[f,d];return x().then(()=>g())}else return Promise.all([d(),f(s.delay)])}function wk(e,n,s=0,a=0,l=1,u){const d=[],f=(e.variantChildren.size-1)*a,m=l===1?(x=0)=>x*a:(x=0)=>f-x*a;return Array.from(e.variantChildren).sort(bk).forEach((x,g)=>{x.notify("AnimationStart",n),d.push(Md(x,n,{...u,delay:s+m(g)}).then(()=>x.notify("AnimationComplete",n)))}),Promise.all(d)}function bk(e,n){return e.sortNodePosition(n)}function kk(e,n,s={}){e.notify("AnimationStart",n);let a;if(Array.isArray(n)){const l=n.map(u=>Md(e,u,s));a=Promise.all(l)}else if(typeof n=="string")a=Md(e,n,s);else{const l=typeof n=="function"?$l(e,n,s.custom):n;a=Promise.all(ey(e,l,s))}return a.then(()=>{e.notify("AnimationComplete",n)})}const jk=Yd.length;function ty(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?ty(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const n={};for(let s=0;s<jk;s++){const a=Yd[s],l=e.props[a];(Ro(l)||l===!1)&&(n[a]=l)}return n}const Nk=[...Xd].reverse(),Sk=Xd.length;function Ck(e){return n=>Promise.all(n.map(({animation:s,options:a})=>kk(e,s,a)))}function Ak(e){let n=Ck(e),s=lx(),a=!0;const l=m=>(x,g)=>{var y;const v=$l(e,g,m==="exit"?(y=e.presenceContext)===null||y===void 0?void 0:y.custom:void 0);if(v){const{transition:k,transitionEnd:E,...S}=v;x={...x,...S,...E}}return x};function u(m){n=m(e)}function d(m){const{props:x}=e,g=ty(e.parent)||{},y=[],v=new Set;let k={},E=1/0;for(let j=0;j<Sk;j++){const F=Nk[j],_=s[F],A=x[F]!==void 0?x[F]:g[F],P=Ro(A),M=F===m?_.isActive:null;M===!1&&(E=j);let C=A===g[F]&&A!==x[F]&&P;if(C&&a&&e.manuallyAnimateOnMount&&(C=!1),_.protectedKeys={...k},!_.isActive&&M===null||!A&&!_.prevProp||Ol(A)||typeof A=="boolean")continue;const B=Ek(_.prevProp,A);let R=B||F===m&&_.isActive&&!C&&P||j>E&&P,G=!1;const he=Array.isArray(A)?A:[A];let $=he.reduce(l(F),{});M===!1&&($={});const{prevResolvedValues:ie={}}=_,W={...ie,...$},H=te=>{R=!0,v.has(te)&&(G=!0,v.delete(te)),_.needsAnimating[te]=!0;const Y=e.getValue(te);Y&&(Y.liveStyle=!1)};for(const te in W){const Y=$[te],Z=ie[te];if(k.hasOwnProperty(te))continue;let V=!1;bd(Y)&&bd(Z)?V=!pg(Y,Z):V=Y!==Z,V?Y!=null?H(te):v.add(te):Y!==void 0&&v.has(te)?H(te):_.protectedKeys[te]=!0}_.prevProp=A,_.prevResolvedValues=$,_.isActive&&(k={...k,...$}),a&&e.blockInitialAnimation&&(R=!1),R&&(!(C&&B)||G)&&y.push(...he.map(te=>({animation:te,options:{type:F}})))}if(v.size){const j={};v.forEach(F=>{const _=e.getBaseTarget(F),A=e.getValue(F);A&&(A.liveStyle=!0),j[F]=_??null}),y.push({animation:j})}let S=!!y.length;return a&&(x.initial===!1||x.initial===x.animate)&&!e.manuallyAnimateOnMount&&(S=!1),a=!1,S?n(y):Promise.resolve()}function f(m,x){var g;if(s[m].isActive===x)return Promise.resolve();(g=e.variantChildren)===null||g===void 0||g.forEach(v=>{var k;return(k=v.animationState)===null||k===void 0?void 0:k.setActive(m,x)}),s[m].isActive=x;const y=d(m);for(const v in s)s[v].protectedKeys={};return y}return{animateChanges:d,setActive:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=lx(),a=!0}}}function Ek(e,n){return typeof n=="string"?n!==e:Array.isArray(n)?!pg(n,e):!1}function ds(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function lx(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class qr{constructor(n){this.isMounted=!1,this.node=n}update(){}}class Tk extends qr{constructor(n){super(n),n.animationState||(n.animationState=Ak(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();Ol(n)&&(this.unmountControls=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:s}=this.node.prevProps||{};n!==s&&this.updateAnimationControlsSubscription()}unmount(){var n;this.node.animationState.reset(),(n=this.unmountControls)===null||n===void 0||n.call(this)}}let Pk=0;class Mk extends qr{constructor(){super(...arguments),this.id=Pk++}update(){if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:s}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===a)return;const l=this.node.animationState.setActive("exit",!n);s&&!n&&l.then(()=>s(this.id))}mount(){const{register:n}=this.node.presenceContext||{};n&&(this.unmount=n(this.id))}unmount(){}}const Fk={animation:{Feature:Tk},exit:{Feature:Mk}};function Vo(e,n,s,a={passive:!0}){return e.addEventListener(n,s,a),()=>e.removeEventListener(n,s)}function Zo(e){return{point:{x:e.pageX,y:e.pageY}}}const Dk=e=>n=>hh(n)&&e(n,Zo(n));function Mo(e,n,s,a){return Vo(e,n,Dk(s),a)}const cx=(e,n)=>Math.abs(e-n);function Ik(e,n){const s=cx(e.x,n.x),a=cx(e.y,n.y);return Math.sqrt(s**2+a**2)}class ny{constructor(n,s,{transformPagePoint:a,contextWindow:l,dragSnapToOrigin:u=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Uu(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,k=Ik(y.offset,{x:0,y:0})>=3;if(!v&&!k)return;const{point:E}=y,{timestamp:S}=Et;this.history.push({...E,timestamp:S});const{onStart:j,onMove:F}=this.handlers;v||(j&&j(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),F&&F(this.lastMoveEvent,y)},this.handlePointerMove=(y,v)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=zu(v,this.transformPagePoint),tt.update(this.updatePoint,!0)},this.handlePointerUp=(y,v)=>{this.end();const{onEnd:k,onSessionEnd:E,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Uu(y.type==="pointercancel"?this.lastMoveEventInfo:zu(v,this.transformPagePoint),this.history);this.startEvent&&k&&k(y,j),E&&E(y,j)},!hh(n))return;this.dragSnapToOrigin=u,this.handlers=s,this.transformPagePoint=a,this.contextWindow=l||window;const d=Zo(n),f=zu(d,this.transformPagePoint),{point:m}=f,{timestamp:x}=Et;this.history=[{...m,timestamp:x}];const{onSessionStart:g}=s;g&&g(n,Uu(f,this.history)),this.removeListeners=Yo(Mo(this.contextWindow,"pointermove",this.handlePointerMove),Mo(this.contextWindow,"pointerup",this.handlePointerUp),Mo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),Hr(this.updatePoint)}}function zu(e,n){return n?{point:n(e.point)}:e}function ux(e,n){return{x:e.x-n.x,y:e.y-n.y}}function Uu({point:e},n){return{point:e,delta:ux(e,ry(n)),offset:ux(e,_k(n)),velocity:Lk(n,.1)}}function _k(e){return e[0]}function ry(e){return e[e.length-1]}function Lk(e,n){if(e.length<2)return{x:0,y:0};let s=e.length-1,a=null;const l=ry(e);for(;s>=0&&(a=e[s],!(l.timestamp-a.timestamp>lr(n)));)s--;if(!a)return{x:0,y:0};const u=cr(l.timestamp-a.timestamp);if(u===0)return{x:0,y:0};const d={x:(l.x-a.x)/u,y:(l.y-a.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const sy=1e-4,Rk=1-sy,Ok=1+sy,iy=.01,Bk=0-iy,$k=0+iy;function rn(e){return e.max-e.min}function Vk(e,n,s){return Math.abs(e-n)<=s}function dx(e,n,s,a=.5){e.origin=a,e.originPoint=it(n.min,n.max,e.origin),e.scale=rn(s)/rn(n),e.translate=it(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Rk&&e.scale<=Ok||isNaN(e.scale))&&(e.scale=1),(e.translate>=Bk&&e.translate<=$k||isNaN(e.translate))&&(e.translate=0)}function Fo(e,n,s,a){dx(e.x,n.x,s.x,a?a.originX:void 0),dx(e.y,n.y,s.y,a?a.originY:void 0)}function hx(e,n,s){e.min=s.min+n.min,e.max=e.min+rn(n)}function zk(e,n,s){hx(e.x,n.x,s.x),hx(e.y,n.y,s.y)}function fx(e,n,s){e.min=n.min-s.min,e.max=e.min+rn(n)}function Do(e,n,s){fx(e.x,n.x,s.x),fx(e.y,n.y,s.y)}function Uk(e,{min:n,max:s},a){return n!==void 0&&e<n?e=a?it(n,e,a.min):Math.max(e,n):s!==void 0&&e>s&&(e=a?it(s,e,a.max):Math.min(e,s)),e}function px(e,n,s){return{min:n!==void 0?e.min+n:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function Wk(e,{top:n,left:s,bottom:a,right:l}){return{x:px(e.x,s,l),y:px(e.y,n,a)}}function mx(e,n){let s=n.min-e.min,a=n.max-e.max;return n.max-n.min<e.max-e.min&&([s,a]=[a,s]),{min:s,max:a}}function Kk(e,n){return{x:mx(e.x,n.x),y:mx(e.y,n.y)}}function Hk(e,n){let s=.5;const a=rn(e),l=rn(n);return l>a?s=Ti(n.min,n.max-a,e.min):a>l&&(s=Ti(e.min,e.max-l,n.min)),hr(0,1,s)}function Qk(e,n){const s={};return n.min!==void 0&&(s.min=n.min-e.min),n.max!==void 0&&(s.max=n.max-e.min),s}const Fd=.35;function qk(e=Fd){return e===!1?e=0:e===!0&&(e=Fd),{x:xx(e,"left","right"),y:xx(e,"top","bottom")}}function xx(e,n,s){return{min:gx(e,n),max:gx(e,s)}}function gx(e,n){return typeof e=="number"?e:e[n]||0}const yx=()=>({translate:0,scale:1,origin:0,originPoint:0}),di=()=>({x:yx(),y:yx()}),vx=()=>({min:0,max:0}),dt=()=>({x:vx(),y:vx()});function pn(e){return[e("x"),e("y")]}function oy({top:e,left:n,right:s,bottom:a}){return{x:{min:n,max:s},y:{min:e,max:a}}}function Gk({x:e,y:n}){return{top:n.min,right:e.max,bottom:n.max,left:e.min}}function Xk(e,n){if(!n)return e;const s=n({x:e.left,y:e.top}),a=n({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:a.y,right:a.x}}function Wu(e){return e===void 0||e===1}function Dd({scale:e,scaleX:n,scaleY:s}){return!Wu(e)||!Wu(n)||!Wu(s)}function hs(e){return Dd(e)||ay(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ay(e){return wx(e.x)||wx(e.y)}function wx(e){return e&&e!=="0%"}function Il(e,n,s){const a=e-s,l=n*a;return s+l}function bx(e,n,s,a,l){return l!==void 0&&(e=Il(e,l,a)),Il(e,s,a)+n}function Id(e,n=0,s=1,a,l){e.min=bx(e.min,n,s,a,l),e.max=bx(e.max,n,s,a,l)}function ly(e,{x:n,y:s}){Id(e.x,n.translate,n.scale,n.originPoint),Id(e.y,s.translate,s.scale,s.originPoint)}const kx=.999999999999,jx=1.0000000000001;function Yk(e,n,s,a=!1){const l=s.length;if(!l)return;n.x=n.y=1;let u,d;for(let f=0;f<l;f++){u=s[f],d=u.projectionDelta;const{visualElement:m}=u.options;m&&m.props.style&&m.props.style.display==="contents"||(a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&fi(e,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(n.x*=d.x.scale,n.y*=d.y.scale,ly(e,d)),a&&hs(u.latestValues)&&fi(e,u.latestValues))}n.x<jx&&n.x>kx&&(n.x=1),n.y<jx&&n.y>kx&&(n.y=1)}function hi(e,n){e.min=e.min+n,e.max=e.max+n}function Nx(e,n,s,a,l=.5){const u=it(e.min,e.max,l);Id(e,n,s,u,a)}function fi(e,n){Nx(e.x,n.x,n.scaleX,n.scale,n.originX),Nx(e.y,n.y,n.scaleY,n.scale,n.originY)}function cy(e,n){return oy(Xk(e.getBoundingClientRect(),n))}function Zk(e,n,s){const a=cy(e,s),{scroll:l}=n;return l&&(hi(a.x,l.offset.x),hi(a.y,l.offset.y)),a}const uy=({current:e})=>e?e.ownerDocument.defaultView:null,Jk=new WeakMap;class ej{constructor(n){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=dt(),this.visualElement=n}start(n,{snapToCursor:s=!1}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const l=g=>{const{dragSnapToOrigin:y}=this.getProps();y?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(Zo(g).point)},u=(g,y)=>{const{drag:v,dragPropagation:k,onDragStart:E}=this.getProps();if(v&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Hb(v),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),pn(j=>{let F=this.getAxisMotionValue(j).get()||0;if(zn.test(F)){const{projection:_}=this.visualElement;if(_&&_.layout){const A=_.layout.layoutBox[j];A&&(F=rn(A)*(parseFloat(F)/100))}}this.originPoint[j]=F}),E&&tt.postRender(()=>E(g,y)),Nd(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},d=(g,y)=>{const{dragPropagation:v,dragDirectionLock:k,onDirectionLock:E,onDrag:S}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:j}=y;if(k&&this.currentDirection===null){this.currentDirection=tj(j),this.currentDirection!==null&&E&&E(this.currentDirection);return}this.updateAxis("x",y.point,j),this.updateAxis("y",y.point,j),this.visualElement.render(),S&&S(g,y)},f=(g,y)=>this.stop(g,y),m=()=>pn(g=>{var y;return this.getAnimationState(g)==="paused"&&((y=this.getAxisMotionValue(g).animation)===null||y===void 0?void 0:y.play())}),{dragSnapToOrigin:x}=this.getProps();this.panSession=new ny(n,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:f,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:x,contextWindow:uy(this.visualElement)})}stop(n,s){const a=this.isDragging;if(this.cancel(),!a)return;const{velocity:l}=s;this.startAnimation(l);const{onDragEnd:u}=this.getProps();u&&tt.postRender(()=>u(n,s))}cancel(){this.isDragging=!1;const{projection:n,animationState:s}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(n,s,a){const{drag:l}=this.getProps();if(!a||!pl(n,l,this.currentDirection))return;const u=this.getAxisMotionValue(n);let d=this.originPoint[n]+a[n];this.constraints&&this.constraints[n]&&(d=Uk(d,this.constraints[n],this.elastic[n])),u.set(d)}resolveConstraints(){var n;const{dragConstraints:s,dragElastic:a}=this.getProps(),l=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)===null||n===void 0?void 0:n.layout,u=this.constraints;s&&ci(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&l?this.constraints=Wk(l.layoutBox,s):this.constraints=!1,this.elastic=qk(a),u!==this.constraints&&l&&this.constraints&&!this.hasMutatedConstraints&&pn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=Qk(l.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:s}=this.getProps();if(!n||!ci(n))return!1;const a=n.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;const u=Zk(a,l.root,this.visualElement.getTransformPagePoint());let d=Kk(l.layout.layoutBox,u);if(s){const f=s(Gk(d));this.hasMutatedConstraints=!!f,f&&(d=oy(f))}return d}startAnimation(n){const{drag:s,dragMomentum:a,dragElastic:l,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},x=pn(g=>{if(!pl(g,s,this.currentDirection))return;let y=m&&m[g]||{};d&&(y={min:0,max:0});const v=l?200:1e6,k=l?40:1e7,E={type:"inertia",velocity:a?n[g]:0,bounceStiffness:v,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...u,...y};return this.startAxisValueAnimation(g,E)});return Promise.all(x).then(f)}startAxisValueAnimation(n,s){const a=this.getAxisMotionValue(n);return Nd(this.visualElement,n),a.start(Nh(n,a,0,s,this.visualElement,!1))}stopAnimation(){pn(n=>this.getAxisMotionValue(n).stop())}pauseAnimation(){pn(n=>{var s;return(s=this.getAxisMotionValue(n).animation)===null||s===void 0?void 0:s.pause()})}getAnimationState(n){var s;return(s=this.getAxisMotionValue(n).animation)===null||s===void 0?void 0:s.state}getAxisMotionValue(n){const s=`_drag${n.toUpperCase()}`,a=this.visualElement.getProps(),l=a[s];return l||this.visualElement.getValue(n,(a.initial?a.initial[n]:void 0)||0)}snapToCursor(n){pn(s=>{const{drag:a}=this.getProps();if(!pl(s,a,this.currentDirection))return;const{projection:l}=this.visualElement,u=this.getAxisMotionValue(s);if(l&&l.layout){const{min:d,max:f}=l.layout.layoutBox[s];u.set(n[s]-it(d,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:s}=this.getProps(),{projection:a}=this.visualElement;if(!ci(s)||!a||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};pn(d=>{const f=this.getAxisMotionValue(d);if(f&&this.constraints!==!1){const m=f.get();l[d]=Hk({min:m,max:m},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),pn(d=>{if(!pl(d,n,null))return;const f=this.getAxisMotionValue(d),{min:m,max:x}=this.constraints[d];f.set(it(m,x,l[d]))})}addListeners(){if(!this.visualElement.current)return;Jk.set(this.visualElement,this);const n=this.visualElement.current,s=Mo(n,"pointerdown",m=>{const{drag:x,dragListener:g=!0}=this.getProps();x&&g&&this.start(m)}),a=()=>{const{dragConstraints:m}=this.getProps();ci(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:l}=this.visualElement,u=l.addEventListener("measure",a);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),tt.read(a);const d=Vo(window,"resize",()=>this.scalePositionWithinConstraints()),f=l.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:x})=>{this.isDragging&&x&&(pn(g=>{const y=this.getAxisMotionValue(g);y&&(this.originPoint[g]+=m[g].translate,y.set(y.get()+m[g].translate))}),this.visualElement.render())}));return()=>{d(),s(),u(),f&&f()}}getProps(){const n=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:a=!1,dragPropagation:l=!1,dragConstraints:u=!1,dragElastic:d=Fd,dragMomentum:f=!0}=n;return{...n,drag:s,dragDirectionLock:a,dragPropagation:l,dragConstraints:u,dragElastic:d,dragMomentum:f}}}function pl(e,n,s){return(n===!0||n===e)&&(s===null||s===e)}function tj(e,n=10){let s=null;return Math.abs(e.y)>n?s="y":Math.abs(e.x)>n&&(s="x"),s}class nj extends qr{constructor(n){super(n),this.removeGroupControls=tn,this.removeListeners=tn,this.controls=new ej(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Sx=e=>(n,s)=>{e&&tt.postRender(()=>e(n,s))};class rj extends qr{constructor(){super(...arguments),this.removePointerDownListener=tn}onPointerDown(n){this.session=new ny(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:uy(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:s,onPan:a,onPanEnd:l}=this.node.getProps();return{onSessionStart:Sx(n),onStart:Sx(s),onMove:a,onEnd:(u,d)=>{delete this.session,l&&tt.postRender(()=>l(u,d))}}}mount(){this.removePointerDownListener=Mo(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const kl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Cx(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}const bo={correct:(e,n)=>{if(!n.target)return e;if(typeof e=="string")if(Fe.test(e))e=parseFloat(e);else return e;const s=Cx(e,n.target.x),a=Cx(e,n.target.y);return`${s}% ${a}%`}},sj={correct:(e,{treeScale:n,projectionDelta:s})=>{const a=e,l=Qr.parse(e);if(l.length>5)return a;const u=Qr.createTransformer(e),d=typeof l[0]!="number"?1:0,f=s.x.scale*n.x,m=s.y.scale*n.y;l[0+d]/=f,l[1+d]/=m;const x=it(f,m,.5);return typeof l[2+d]=="number"&&(l[2+d]/=x),typeof l[3+d]=="number"&&(l[3+d]/=x),u(l)}};class ij extends b.Component{componentDidMount(){const{visualElement:n,layoutGroup:s,switchLayoutGroup:a,layoutId:l}=this.props,{projection:u}=n;Sb(oj),u&&(s.group&&s.group.add(u),a&&a.register&&l&&a.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),kl.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:s,visualElement:a,drag:l,isPresent:u}=this.props,d=a.projection;return d&&(d.isPresent=u,l||n.layoutDependency!==s||s===void 0?d.willUpdate():this.safeToRemove(),n.isPresent!==u&&(u?d.promote():d.relegate()||tt.postRender(()=>{const f=d.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:n}=this.props.visualElement;n&&(n.root.didUpdate(),Jd.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:s,switchLayoutGroup:a}=this.props,{projection:l}=n;l&&(l.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(l),a&&a.deregister&&a.deregister(l))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function dy(e){const[n,s]=Q0(),a=b.useContext(Kd);return i.jsx(ij,{...e,layoutGroup:a,switchLayoutGroup:b.useContext(tg),isPresent:n,safeToRemove:s})}const oj={borderRadius:{...bo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bo,borderTopRightRadius:bo,borderBottomLeftRadius:bo,borderBottomRightRadius:bo,boxShadow:sj};function aj(e,n,s){const a=Lt(e)?e:Bo(e);return a.start(Nh("",a,n,s)),a.animation}function lj(e){return e instanceof SVGElement&&e.tagName!=="svg"}const cj=(e,n)=>e.depth-n.depth;class uj{constructor(){this.children=[],this.isDirty=!1}add(n){fh(this.children,n),this.isDirty=!0}remove(n){ph(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(cj),this.isDirty=!1,this.children.forEach(n)}}function dj(e,n){const s=Un.now(),a=({timestamp:l})=>{const u=l-s;u>=n&&(Hr(a),e(u-n))};return tt.read(a,!0),()=>Hr(a)}const hy=["TopLeft","TopRight","BottomLeft","BottomRight"],hj=hy.length,Ax=e=>typeof e=="string"?parseFloat(e):e,Ex=e=>typeof e=="number"||Fe.test(e);function fj(e,n,s,a,l,u){l?(e.opacity=it(0,s.opacity!==void 0?s.opacity:1,pj(a)),e.opacityExit=it(n.opacity!==void 0?n.opacity:1,0,mj(a))):u&&(e.opacity=it(n.opacity!==void 0?n.opacity:1,s.opacity!==void 0?s.opacity:1,a));for(let d=0;d<hj;d++){const f=`border${hy[d]}Radius`;let m=Tx(n,f),x=Tx(s,f);if(m===void 0&&x===void 0)continue;m||(m=0),x||(x=0),m===0||x===0||Ex(m)===Ex(x)?(e[f]=Math.max(it(Ax(m),Ax(x),a),0),(zn.test(x)||zn.test(m))&&(e[f]+="%")):e[f]=x}(n.rotate||s.rotate)&&(e.rotate=it(n.rotate||0,s.rotate||0,a))}function Tx(e,n){return e[n]!==void 0?e[n]:e.borderRadius}const pj=fy(0,.5,Mg),mj=fy(.5,.95,tn);function fy(e,n,s){return a=>a<e?0:a>n?1:s(Ti(e,n,a))}function Px(e,n){e.min=n.min,e.max=n.max}function hn(e,n){Px(e.x,n.x),Px(e.y,n.y)}function Mx(e,n){e.translate=n.translate,e.scale=n.scale,e.originPoint=n.originPoint,e.origin=n.origin}function Fx(e,n,s,a,l){return e-=n,e=Il(e,1/s,a),l!==void 0&&(e=Il(e,1/l,a)),e}function xj(e,n=0,s=1,a=.5,l,u=e,d=e){if(zn.test(n)&&(n=parseFloat(n),n=it(d.min,d.max,n/100)-d.min),typeof n!="number")return;let f=it(u.min,u.max,a);e===u&&(f-=n),e.min=Fx(e.min,n,s,f,l),e.max=Fx(e.max,n,s,f,l)}function Dx(e,n,[s,a,l],u,d){xj(e,n[s],n[a],n[l],n.scale,u,d)}const gj=["x","scaleX","originX"],yj=["y","scaleY","originY"];function Ix(e,n,s,a){Dx(e.x,n,gj,s?s.x:void 0,a?a.x:void 0),Dx(e.y,n,yj,s?s.y:void 0,a?a.y:void 0)}function _x(e){return e.translate===0&&e.scale===1}function py(e){return _x(e.x)&&_x(e.y)}function Lx(e,n){return e.min===n.min&&e.max===n.max}function vj(e,n){return Lx(e.x,n.x)&&Lx(e.y,n.y)}function Rx(e,n){return Math.round(e.min)===Math.round(n.min)&&Math.round(e.max)===Math.round(n.max)}function my(e,n){return Rx(e.x,n.x)&&Rx(e.y,n.y)}function Ox(e){return rn(e.x)/rn(e.y)}function Bx(e,n){return e.translate===n.translate&&e.scale===n.scale&&e.originPoint===n.originPoint}class wj{constructor(){this.members=[]}add(n){fh(this.members,n),n.scheduleRender()}remove(n){if(ph(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(n){const s=this.members.findIndex(l=>n===l);if(s===0)return!1;let a;for(let l=s;l>=0;l--){const u=this.members[l];if(u.isPresent!==!1){a=u;break}}return a?(this.promote(a),!0):!1}promote(n,s){const a=this.lead;if(n!==a&&(this.prevLead=a,this.lead=n,n.show(),a)){a.instance&&a.scheduleRender(),n.scheduleRender(),n.resumeFrom=a,s&&(n.resumeFrom.preserveOpacity=!0),a.snapshot&&(n.snapshot=a.snapshot,n.snapshot.latestValues=a.animationValues||a.latestValues),n.root&&n.root.isUpdating&&(n.isLayoutDirty=!0);const{crossfade:l}=n.options;l===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(n=>{const{options:s,resumingFrom:a}=n;s.onExitComplete&&s.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(n=>{n.instance&&n.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function bj(e,n,s){let a="";const l=e.x.translate/n.x,u=e.y.translate/n.y,d=(s==null?void 0:s.z)||0;if((l||u||d)&&(a=`translate3d(${l}px, ${u}px, ${d}px) `),(n.x!==1||n.y!==1)&&(a+=`scale(${1/n.x}, ${1/n.y}) `),s){const{transformPerspective:x,rotate:g,rotateX:y,rotateY:v,skewX:k,skewY:E}=s;x&&(a=`perspective(${x}px) ${a}`),g&&(a+=`rotate(${g}deg) `),y&&(a+=`rotateX(${y}deg) `),v&&(a+=`rotateY(${v}deg) `),k&&(a+=`skewX(${k}deg) `),E&&(a+=`skewY(${E}deg) `)}const f=e.x.scale*n.x,m=e.y.scale*n.y;return(f!==1||m!==1)&&(a+=`scale(${f}, ${m})`),a||"none"}const fs={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},To=typeof window<"u"&&window.MotionDebug!==void 0,Ku=["","X","Y","Z"],kj={visibility:"hidden"},$x=1e3;let jj=0;function Hu(e,n,s,a){const{latestValues:l}=n;l[e]&&(s[e]=l[e],n.setStaticValue(e,0),a&&(a[e]=0))}function xy(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:n}=e.options;if(!n)return;const s=Ng(n);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:l,layoutId:u}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",tt,!(l||u))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&xy(a)}function gy({attachResizeListener:e,defaultParent:n,measureScroll:s,checkIsScrollRoot:a,resetTransform:l}){return class{constructor(d={},f=n==null?void 0:n()){this.id=jj++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,To&&(fs.totalNodes=fs.resolvedTargetDeltas=fs.recalculatedProjection=0),this.nodes.forEach(Cj),this.nodes.forEach(Mj),this.nodes.forEach(Fj),this.nodes.forEach(Aj),To&&window.MotionDebug.record(fs)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new uj)}addEventListener(d,f){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new mh),this.eventHandlers.get(d).add(f)}notifyListeners(d,...f){const m=this.eventHandlers.get(d);m&&m.notify(...f)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,f=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=lj(d),this.instance=d;const{layoutId:m,layout:x,visualElement:g}=this.options;if(g&&!g.current&&g.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),f&&(x||m)&&(this.isLayoutDirty=!0),e){let y;const v=()=>this.root.updateBlockedByResize=!1;e(d,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=dj(v,250),kl.hasAnimatedSinceResize&&(kl.hasAnimatedSinceResize=!1,this.nodes.forEach(zx))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&g&&(m||x)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:v,hasRelativeTargetChanged:k,layout:E})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||g.getDefaultTransition()||Rj,{onLayoutAnimationStart:j,onLayoutAnimationComplete:F}=g.getProps(),_=!this.targetLayout||!my(this.targetLayout,E)||k,A=!v&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||v&&(_||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,A);const P={...ch(S,"layout"),onPlay:j,onComplete:F};(g.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P)}else v||zx(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=E})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Hr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Dj),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xy(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const y=this.path[g];y.shouldResetTransform=!0,y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const x=this.getTransformTemplate();this.prevTransformTemplateValue=x?x(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Vx);return}this.isUpdating||this.nodes.forEach(Tj),this.isUpdating=!1,this.nodes.forEach(Pj),this.nodes.forEach(Nj),this.nodes.forEach(Sj),this.clearAllSnapshots();const f=Un.now();Et.delta=hr(0,1e3/60,f-Et.timestamp),Et.timestamp=f,Et.isProcessing=!0,Lu.update.process(Et),Lu.preRender.process(Et),Lu.render.process(Et),Et.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Jd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ej),this.sharedNodes.forEach(Ij)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,tt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){tt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=dt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(f=!1),f){const m=a(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!l)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!py(this.projectionDelta),m=this.getTransformTemplate(),x=m?m(this.latestValues,""):void 0,g=x!==this.prevTransformTemplateValue;d&&(f||hs(this.latestValues)||g)&&(l(this.instance,x),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return d&&(m=this.removeTransform(m)),Oj(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:f}=this.options;if(!f)return dt();const m=f.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(Bj))){const{scroll:g}=this.root;g&&(hi(m.x,g.offset.x),hi(m.y,g.offset.y))}return m}removeElementScroll(d){var f;const m=dt();if(hn(m,d),!((f=this.scroll)===null||f===void 0)&&f.wasRoot)return m;for(let x=0;x<this.path.length;x++){const g=this.path[x],{scroll:y,options:v}=g;g!==this.root&&y&&v.layoutScroll&&(y.wasRoot&&hn(m,d),hi(m.x,y.offset.x),hi(m.y,y.offset.y))}return m}applyTransform(d,f=!1){const m=dt();hn(m,d);for(let x=0;x<this.path.length;x++){const g=this.path[x];!f&&g.options.layoutScroll&&g.scroll&&g!==g.root&&fi(m,{x:-g.scroll.offset.x,y:-g.scroll.offset.y}),hs(g.latestValues)&&fi(m,g.latestValues)}return hs(this.latestValues)&&fi(m,this.latestValues),m}removeTransform(d){const f=dt();hn(f,d);for(let m=0;m<this.path.length;m++){const x=this.path[m];if(!x.instance||!hs(x.latestValues))continue;Dd(x.latestValues)&&x.updateSnapshot();const g=dt(),y=x.measurePageBox();hn(g,y),Ix(f,x.latestValues,x.snapshot?x.snapshot.layoutBox:void 0,g)}return hs(this.latestValues)&&Ix(f,this.latestValues),f}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Et.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var f;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const x=!!this.resumingFrom||this!==m;if(!(d||x&&this.isSharedProjectionDirty||this.isProjectionDirty||!((f=this.parent)===null||f===void 0)&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:v}=this.options;if(!(!this.layout||!(y||v))){if(this.resolvedRelativeTargetAt=Et.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),Do(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),hn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=dt(),this.targetWithTransforms=dt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),zk(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hn(this.target,this.layout.layoutBox),ly(this.target,this.targetDelta)):hn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),Do(this.relativeTargetOrigin,this.target,k.target),hn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}To&&fs.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Dd(this.parent.latestValues)||ay(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var d;const f=this.getLead(),m=!!this.resumingFrom||this!==f;let x=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(x=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(x=!1),this.resolvedRelativeTargetAt===Et.timestamp&&(x=!1),x)return;const{layout:g,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(g||y))return;hn(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,k=this.treeScale.y;Yk(this.layoutCorrected,this.treeScale,this.path,m),f.layout&&!f.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(f.target=f.layout.layoutBox,f.targetWithTransforms=dt());const{target:E}=f;if(!E){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Mx(this.prevProjectionDelta.x,this.projectionDelta.x),Mx(this.prevProjectionDelta.y,this.projectionDelta.y)),Fo(this.projectionDelta,this.layoutCorrected,E,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==k||!Bx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",E)),To&&fs.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var f;if((f=this.options.visualElement)===null||f===void 0||f.scheduleRender(),d){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=di(),this.projectionDelta=di(),this.projectionDeltaWithTransform=di()}setAnimationOrigin(d,f=!1){const m=this.snapshot,x=m?m.latestValues:{},g={...this.latestValues},y=di();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=dt(),k=m?m.source:void 0,E=this.layout?this.layout.source:void 0,S=k!==E,j=this.getStack(),F=!j||j.members.length<=1,_=!!(S&&!F&&this.options.crossfade===!0&&!this.path.some(Lj));this.animationProgress=0;let A;this.mixTargetDelta=P=>{const M=P/1e3;Ux(y.x,d.x,M),Ux(y.y,d.y,M),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Do(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),_j(this.relativeTarget,this.relativeTargetOrigin,v,M),A&&vj(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=dt()),hn(A,this.relativeTarget)),S&&(this.animationValues=g,fj(g,x,this.latestValues,M,_,F)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Hr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=tt.update(()=>{kl.hasAnimatedSinceResize=!0,this.currentAnimation=aj(0,$x,{...d,onUpdate:f=>{this.mixTargetDelta(f),d.onUpdate&&d.onUpdate(f)},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta($x),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:f,target:m,layout:x,latestValues:g}=d;if(!(!f||!m||!x)){if(this!==d&&this.layout&&x&&yy(this.options.animationType,this.layout.layoutBox,x.layoutBox)){m=this.target||dt();const y=rn(this.layout.layoutBox.x);m.x.min=d.target.x.min,m.x.max=m.x.min+y;const v=rn(this.layout.layoutBox.y);m.y.min=d.target.y.min,m.y.max=m.y.min+v}hn(f,m),fi(f,g),Fo(this.projectionDeltaWithTransform,this.layoutCorrected,f,g)}}registerSharedNode(d,f){this.sharedNodes.has(d)||this.sharedNodes.set(d,new wj),this.sharedNodes.get(d).add(f);const x=f.options.initialPromotionConfig;f.promote({transition:x?x.transition:void 0,preserveFollowOpacity:x&&x.shouldPreserveFollowOpacity?x.shouldPreserveFollowOpacity(f):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:f}=this.options;return f?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:f}=this.options;return f?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:f,preserveFollowOpacity:m}={}){const x=this.getStack();x&&x.promote(this,m),d&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let f=!1;const{latestValues:m}=d;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const x={};m.z&&Hu("z",d,x,this.animationValues);for(let g=0;g<Ku.length;g++)Hu(`rotate${Ku[g]}`,d,x,this.animationValues),Hu(`skew${Ku[g]}`,d,x,this.animationValues);d.render();for(const g in x)d.setStaticValue(g,x[g]),this.animationValues&&(this.animationValues[g]=x[g]);d.scheduleRender()}getProjectionStyles(d){var f,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return kj;const x={visibility:""},g=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,x.opacity="",x.pointerEvents=wl(d==null?void 0:d.pointerEvents)||"",x.transform=g?g(this.latestValues,""):"none",x;const y=this.getLead();if(!this.projectionDelta||!this.layout||!y.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=wl(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!hs(this.latestValues)&&(S.transform=g?g({},""):"none",this.hasProjected=!1),S}const v=y.animationValues||y.latestValues;this.applyTransformsToTarget(),x.transform=bj(this.projectionDeltaWithTransform,this.treeScale,v),g&&(x.transform=g(v,x.transform));const{x:k,y:E}=this.projectionDelta;x.transformOrigin=`${k.origin*100}% ${E.origin*100}% 0`,y.animationValues?x.opacity=y===this?(m=(f=v.opacity)!==null&&f!==void 0?f:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:x.opacity=y===this?v.opacity!==void 0?v.opacity:"":v.opacityExit!==void 0?v.opacityExit:0;for(const S in Tl){if(v[S]===void 0)continue;const{correct:j,applyTo:F}=Tl[S],_=x.transform==="none"?v[S]:j(v[S],y);if(F){const A=F.length;for(let P=0;P<A;P++)x[F[P]]=_}else x[S]=_}return this.options.layoutId&&(x.pointerEvents=y===this?wl(d==null?void 0:d.pointerEvents)||"":"none"),x}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var f;return(f=d.currentAnimation)===null||f===void 0?void 0:f.stop()}),this.root.nodes.forEach(Vx),this.root.sharedNodes.clear()}}}function Nj(e){e.updateLayout()}function Sj(e){var n;const s=((n=e.resumeFrom)===null||n===void 0?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&s&&e.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:l}=e.layout,{animationType:u}=e.options,d=s.source!==e.layout.source;u==="size"?pn(y=>{const v=d?s.measuredBox[y]:s.layoutBox[y],k=rn(v);v.min=a[y].min,v.max=v.min+k}):yy(u,s.layoutBox,a)&&pn(y=>{const v=d?s.measuredBox[y]:s.layoutBox[y],k=rn(a[y]);v.max=v.min+k,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[y].max=e.relativeTarget[y].min+k)});const f=di();Fo(f,a,s.layoutBox);const m=di();d?Fo(m,e.applyTransform(l,!0),s.measuredBox):Fo(m,a,s.layoutBox);const x=!py(f);let g=!1;if(!e.resumeFrom){const y=e.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:v,layout:k}=y;if(v&&k){const E=dt();Do(E,s.layoutBox,v.layoutBox);const S=dt();Do(S,a,k.layoutBox),my(E,S)||(g=!0),y.options.layoutRoot&&(e.relativeTarget=S,e.relativeTargetOrigin=E,e.relativeParent=y)}}}e.notifyListeners("didUpdate",{layout:a,snapshot:s,delta:m,layoutDelta:f,hasLayoutChanged:x,hasRelativeTargetChanged:g})}else if(e.isLead()){const{onExitComplete:a}=e.options;a&&a()}e.options.transition=void 0}function Cj(e){To&&fs.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Aj(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ej(e){e.clearSnapshot()}function Vx(e){e.clearMeasurements()}function Tj(e){e.isLayoutDirty=!1}function Pj(e){const{visualElement:n}=e.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),e.resetTransform()}function zx(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Mj(e){e.resolveTargetDelta()}function Fj(e){e.calcProjection()}function Dj(e){e.resetSkewAndRotation()}function Ij(e){e.removeLeadSnapshot()}function Ux(e,n,s){e.translate=it(n.translate,0,s),e.scale=it(n.scale,1,s),e.origin=n.origin,e.originPoint=n.originPoint}function Wx(e,n,s,a){e.min=it(n.min,s.min,a),e.max=it(n.max,s.max,a)}function _j(e,n,s,a){Wx(e.x,n.x,s.x,a),Wx(e.y,n.y,s.y,a)}function Lj(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Rj={duration:.45,ease:[.4,0,.1,1]},Kx=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Hx=Kx("applewebkit/")&&!Kx("chrome/")?Math.round:tn;function Qx(e){e.min=Hx(e.min),e.max=Hx(e.max)}function Oj(e){Qx(e.x),Qx(e.y)}function yy(e,n,s){return e==="position"||e==="preserve-aspect"&&!Vk(Ox(n),Ox(s),.2)}function Bj(e){var n;return e!==e.root&&((n=e.scroll)===null||n===void 0?void 0:n.wasRoot)}const $j=gy({attachResizeListener:(e,n)=>Vo(e,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Qu={current:void 0},vy=gy({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Qu.current){const e=new $j({});e.mount(window),e.setOptions({layoutScroll:!0}),Qu.current=e}return Qu.current},resetTransform:(e,n)=>{e.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Vj={pan:{Feature:rj},drag:{Feature:nj,ProjectionNode:vy,MeasureLayout:dy}};function qx(e,n,s){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",s==="Start");const l="onHover"+s,u=a[l];u&&tt.postRender(()=>u(n,Zo(n)))}class zj extends qr{mount(){const{current:n}=this.node;n&&(this.unmount=Vb(n,s=>(qx(this.node,s,"Start"),a=>qx(this.node,a,"End"))))}unmount(){}}class Uj extends qr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yo(Vo(this.node.current,"focus",()=>this.onFocus()),Vo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Gx(e,n,s){const{props:a}=e;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",s==="Start");const l="onTap"+(s==="End"?"":s),u=a[l];u&&tt.postRender(()=>u(n,Zo(n)))}class Wj extends qr{mount(){const{current:n}=this.node;n&&(this.unmount=Kb(n,s=>(Gx(this.node,s,"Start"),(a,{success:l})=>Gx(this.node,a,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const _d=new WeakMap,qu=new WeakMap,Kj=e=>{const n=_d.get(e.target);n&&n(e)},Hj=e=>{e.forEach(Kj)};function Qj({root:e,...n}){const s=e||document;qu.has(s)||qu.set(s,{});const a=qu.get(s),l=JSON.stringify(n);return a[l]||(a[l]=new IntersectionObserver(Hj,{root:e,...n})),a[l]}function qj(e,n,s){const a=Qj(n);return _d.set(e,s),a.observe(e),()=>{_d.delete(e),a.unobserve(e)}}const Gj={some:0,all:1};class Xj extends qr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:n={}}=this.node.getProps(),{root:s,margin:a,amount:l="some",once:u}=n,d={root:s?s.current:void 0,rootMargin:a,threshold:typeof l=="number"?l:Gj[l]},f=m=>{const{isIntersecting:x}=m;if(this.isInView===x||(this.isInView=x,u&&!x&&this.hasEnteredView))return;x&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",x);const{onViewportEnter:g,onViewportLeave:y}=this.node.getProps(),v=x?g:y;v&&v(m)};return qj(this.node.current,d,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:s}=this.node;["amount","margin","root"].some(Yj(n,s))&&this.startObserver()}unmount(){}}function Yj({viewport:e={}},{viewport:n={}}={}){return s=>e[s]!==n[s]}const Zj={inView:{Feature:Xj},tap:{Feature:Wj},focus:{Feature:Uj},hover:{Feature:zj}},Jj={layout:{ProjectionNode:vy,MeasureLayout:dy}},Ld={current:null},wy={current:!1};function eN(){if(wy.current=!0,!!qd)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),n=()=>Ld.current=e.matches;e.addListener(n),n()}else Ld.current=!1}const tN=[...Kg,_t,Qr],nN=e=>tN.find(Wg(e)),Xx=new WeakMap;function rN(e,n,s){for(const a in n){const l=n[a],u=s[a];if(Lt(l))e.addValue(a,l);else if(Lt(u))e.addValue(a,Bo(l,{owner:e}));else if(u!==l)if(e.hasValue(a)){const d=e.getValue(a);d.liveStyle===!0?d.jump(l):d.hasAnimated||d.set(l)}else{const d=e.getStaticValue(a);e.addValue(a,Bo(d!==void 0?d:l,{owner:e}))}}for(const a in s)n[a]===void 0&&e.removeValue(a);return n}const Yx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class sN{scrapeMotionValuesFromProps(n,s,a){return{}}constructor({parent:n,props:s,presenceContext:a,reducedMotionConfig:l,blockInitialAnimation:u,visualState:d},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=bh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=Un.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,tt.render(this.render,!1,!0))};const{latestValues:m,renderState:x,onUpdate:g}=d;this.onUpdate=g,this.latestValues=m,this.baseTarget={...m},this.initialValues=s.initial?{...m}:{},this.renderState=x,this.parent=n,this.props=s,this.presenceContext=a,this.depth=n?n.depth+1:0,this.reducedMotionConfig=l,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=Bl(s),this.isVariantNode=J0(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:y,...v}=this.scrapeMotionValuesFromProps(s,{},this);for(const k in v){const E=v[k];m[k]!==void 0&&Lt(E)&&E.set(m[k],!1)}}mount(n){this.current=n,Xx.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,a)=>this.bindToMotionValue(a,s)),wy.current||eN(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ld.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Xx.delete(this.current),this.projection&&this.projection.unmount(),Hr(this.notifyUpdate),Hr(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}bindToMotionValue(n,s){this.valueSubscriptions.has(n)&&this.valueSubscriptions.get(n)();const a=Fs.has(n),l=s.on("change",f=>{this.latestValues[n]=f,this.props.onUpdate&&tt.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0)}),u=s.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,n,s)),this.valueSubscriptions.set(n,()=>{l(),u(),d&&d(),s.owner&&s.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}updateFeatures(){let n="animation";for(n in Pi){const s=Pi[n];if(!s)continue;const{isEnabled:a,Feature:l}=s;if(!this.features[n]&&l&&a(this.props)&&(this.features[n]=new l(this)),this.features[n]){const u=this.features[n];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):dt()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,s){this.latestValues[n]=s}update(n,s){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let a=0;a<Yx.length;a++){const l=Yx[a];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const u="on"+l,d=n[u];d&&(this.propEventSubscriptions[l]=this.on(l,d))}this.prevMotionValues=rN(this,this.scrapeMotionValuesFromProps(n,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(n){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(n),()=>s.variantChildren.delete(n)}addValue(n,s){const a=this.values.get(n);s!==a&&(a&&this.removeValue(n),this.bindToMotionValue(n,s),this.values.set(n,s),this.latestValues[n]=s.get())}removeValue(n){this.values.delete(n);const s=this.valueSubscriptions.get(n);s&&(s(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,s){if(this.props.values&&this.props.values[n])return this.props.values[n];let a=this.values.get(n);return a===void 0&&s!==void 0&&(a=Bo(s===null?void 0:s,{owner:this}),this.addValue(n,a)),a}readValue(n,s){var a;let l=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:(a=this.getBaseTargetFromProps(this.props,n))!==null&&a!==void 0?a:this.readValueFromInstance(this.current,n,this.options);return l!=null&&(typeof l=="string"&&(zg(l)||Dg(l))?l=parseFloat(l):!nN(l)&&Qr.test(s)&&(l=Bg(n,s)),this.setBaseTarget(n,Lt(l)?l.get():l)),Lt(l)?l.get():l}setBaseTarget(n,s){this.baseTarget[n]=s}getBaseTarget(n){var s;const{initial:a}=this.props;let l;if(typeof a=="string"||typeof a=="object"){const d=th(this.props,a,(s=this.presenceContext)===null||s===void 0?void 0:s.custom);d&&(l=d[n])}if(a&&l!==void 0)return l;const u=this.getBaseTargetFromProps(this.props,n);return u!==void 0&&!Lt(u)?u:this.initialValues[n]!==void 0&&l===void 0?void 0:this.baseTarget[n]}on(n,s){return this.events[n]||(this.events[n]=new mh),this.events[n].add(s)}notify(n,...s){this.events[n]&&this.events[n].notify(...s)}}class by extends sN{constructor(){super(...arguments),this.KeyframeResolver=Hg}sortInstanceNodePosition(n,s){return n.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(n,s){return n.style?n.style[s]:void 0}removeValueFromRenderState(n,{vars:s,style:a}){delete s[n],delete a[n]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;Lt(n)&&(this.childSubscription=n.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function iN(e){return window.getComputedStyle(e)}class oN extends by{constructor(){super(...arguments),this.type="html",this.renderInstance=lg}readValueFromInstance(n,s){if(Fs.has(s)){const a=wh(s);return a&&a.default||0}else{const a=iN(n),l=(ig(s)?a.getPropertyValue(s):a[s])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(n,{transformPagePoint:s}){return cy(n,s)}build(n,s,a){sh(n,s,a.transformTemplate)}scrapeMotionValuesFromProps(n,s,a){return lh(n,s,a)}}class aN extends by{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=dt}getBaseTargetFromProps(n,s){return n[s]}readValueFromInstance(n,s){if(Fs.has(s)){const a=wh(s);return a&&a.default||0}return s=cg.has(s)?s:Zd(s),n.getAttribute(s)}scrapeMotionValuesFromProps(n,s,a){return hg(n,s,a)}build(n,s,a){ih(n,s,this.isSVGTag,a.transformTemplate)}renderInstance(n,s,a,l){ug(n,s,a,l)}mount(n){this.isSVGTag=ah(n.tagName),super.mount(n)}}const lN=(e,n)=>eh(e)?new aN(n):new oN(n,{allowProjection:e!==b.Fragment}),cN=Ib({...Fk,...Zj,...Vj,...Jj},lN),Oe=G1(cN),zl="/orgx/live/assets/orgx-logo-QSE5QWy4.png",uN=[{label:"Model Routing",desc:"Right model, right cost, every prompt",accent:"#BFFF00",icon:i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{cx:"12",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.4"}),i.jsx("circle",{cx:"5",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.4"}),i.jsx("circle",{cx:"19",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.4"}),i.jsx("path",{d:"M12 7.5v3m0 0l-5.5 6m5.5-6l5.5 6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})},{label:"Live Operations",desc:"Decisions, handoffs, sessions — real-time",accent:"#14B8A6",icon:i.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M3 12h3l2.5-5 3.5 10 2.5-5H21",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})},{label:"Quality Gates",desc:"Automated checkpoints before shipping",accent:"#7C7CFF",icon:i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("path",{d:"M12 2l8 4.5v5.5c0 4.7-3.4 9-8 10.3C7.4 21 4 16.7 4 12V6.5L12 2z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),i.jsx("path",{d:"M9 12l2.5 2.5L15 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}],dN=[{label:"Initiative",detail:"Top-level outcome and owner context"},{label:"Workstream",detail:"Major track that sequences execution"},{label:"Milestone",detail:"Checkpoint that gates readiness"},{label:"Task",detail:"Atomic action with dependencies and priority"}],Zx="openclaw plugins install @useorgx/openclaw-plugin",Jx="orgx.demo_mode";function hN(e){switch(e){case"config":return"Plugin config";case"environment":return"Environment variable";case"persisted":return"Saved local credential";case"openclaw-config-file":return"OpenClaw config file";case"legacy-dev":return"Legacy dev fallback";default:return"Not detected"}}const fN={hidden:{},visible:{transition:{staggerChildren:.07}}},On={hidden:{opacity:0,y:14},visible:{opacity:1,y:0,transition:{duration:.45,ease:[.16,1,.3,1]}}};function pN({state:e,isStarting:n,onConnect:s,onUseManualKey:a,onContinueWithoutOrgX:l}){const u=!!e.lastError,[d,f]=b.useState("idle"),m=e.hasApiKey&&e.keySource&&e.keySource!=="none";b.useEffect(()=>{if(d==="idle")return;const g=window.setTimeout(()=>f("idle"),2e3);return()=>window.clearTimeout(g)},[d]);const x=async()=>{try{await navigator.clipboard.writeText(Zx),f("ok")}catch{f("error")}};return i.jsxs(Oe.section,{variants:fN,initial:"hidden",animate:"visible",className:"glass-panel soft-shadow rounded-2xl",children:[i.jsxs("div",{className:"px-6 pt-6 sm:px-8 sm:pt-8",children:[i.jsxs(Oe.div,{variants:On,className:"flex items-center gap-2.5",children:[i.jsx("img",{src:zl,alt:"OrgX",className:"h-7 w-7 rounded-lg object-contain"}),i.jsx("span",{className:"text-[13px] font-semibold text-white/70",children:"OrgX"})]}),i.jsx(Oe.h2,{variants:On,className:"mt-5 text-[26px] font-semibold leading-[1.2] tracking-[-0.02em] text-white sm:text-[30px]",children:"Connect your workspace"}),i.jsx(Oe.p,{variants:On,className:"mt-2 max-w-md text-[15px] leading-relaxed text-white/50",children:"Orchestrate agents, approve decisions, and track progress from a single live dashboard."})]}),i.jsx(Oe.div,{variants:On,className:"mt-6 grid grid-cols-1 gap-2.5 px-6 sm:grid-cols-3 sm:px-8",children:uN.map((g,y)=>i.jsxs(Oe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.18+y*.08,duration:.4,ease:[.16,1,.3,1]},className:"hover-lift rounded-xl border border-white/[0.06] bg-white/[0.025] px-4 py-3.5",children:[i.jsx("div",{style:{color:g.accent},className:"mb-2.5 opacity-80",children:g.icon}),i.jsx("p",{className:"text-[13px] font-semibold text-white",children:g.label}),i.jsx("p",{className:"mt-0.5 text-[12px] leading-snug text-white/40",children:g.desc})]},g.label))}),i.jsxs(Oe.div,{variants:On,className:"mt-4 mx-6 sm:mx-8 rounded-xl border border-white/[0.08] bg-white/[0.02] p-4",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-white/38",children:"How Work Ladders Up"}),i.jsx("div",{className:"mt-2 grid gap-1.5 sm:grid-cols-2",children:dN.map(g=>i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] px-2.5 py-2",children:[i.jsx("p",{className:"text-[12px] font-semibold text-white/85",children:g.label}),i.jsx("p",{className:"text-[11px] leading-relaxed text-white/45",children:g.detail})]},g.label))}),i.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-white/45",children:"Mission Control maps dependencies between all four levels so you can stay high-level, then drill down instantly."})]}),i.jsxs(Oe.div,{variants:On,className:"mt-3 mx-6 sm:mx-8 rounded-xl border border-[#14B8A6]/20 bg-[#14B8A6]/[0.06] px-4 py-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[#7EEDE1]",children:"OpenClaw Integration"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-[#CFF8F3]",children:"OrgX syncs with your OpenClaw sessions so initiatives, workstreams, milestones, tasks, and assignment context stay aligned with live agent execution."})]}),i.jsxs(Oe.div,{variants:On,className:"mt-3 mx-6 sm:mx-8 rounded-xl border border-white/[0.08] bg-white/[0.02] px-4 py-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-white/38",children:"Quick Setup"}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx("code",{className:"rounded-md border border-white/[0.08] bg-black/30 px-2 py-1 font-mono text-[11px] text-white/75",children:Zx}),i.jsx("button",{type:"button",onClick:()=>{x()},className:"rounded-full border border-white/[0.12] px-3 py-1 text-[11px] text-white/65 transition hover:border-white/[0.2] hover:text-white/90",children:d==="ok"?"Copied":d==="error"?"Copy failed":"Copy command"})]}),m&&i.jsxs("p",{className:"mt-2 text-[11px] text-white/45",children:["API key source detected: ",hN(e.keySource)]})]}),i.jsxs(Oe.div,{variants:On,className:"mt-6 flex flex-wrap items-center gap-3 px-6 sm:px-8",children:[i.jsx("button",{type:"button",onClick:s,disabled:n,className:"inline-flex items-center gap-2 rounded-full bg-[#BFFF00] px-5 py-2.5 text-[13px] font-semibold text-black shadow-[0_0_24px_rgba(191,255,0,0.12)] transition-all hover:bg-[#d3ff42] hover:shadow-[0_0_32px_rgba(191,255,0,0.22)] disabled:cursor-not-allowed disabled:opacity-50",children:n?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.2"}),i.jsx("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),"Connecting..."]}):"Connect OrgX"}),i.jsx("button",{type:"button",onClick:a,className:"rounded-full border border-white/[0.1] px-4 py-2 text-[13px] text-white/60 transition hover:border-white/[0.18] hover:text-white/85",children:"Use API key"})]}),i.jsx(Oe.div,{variants:On,className:"mx-6 mt-6 sm:mx-8",children:u?i.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-red-500/15 bg-red-500/[0.04] px-4 py-3",children:[i.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-red-500/15",children:i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:i.jsx("path",{d:"M5 2.5v3M5 7.5h.004",stroke:"#FF6B88",strokeWidth:"1.4",strokeLinecap:"round"})})}),i.jsx("div",{className:"min-w-0 flex-1",children:i.jsx("p",{className:"text-[13px] text-red-300/80",children:e.lastError})}),i.jsx("button",{type:"button",onClick:s,disabled:n,className:"shrink-0 text-[12px] font-medium text-red-300/70 transition hover:text-red-200",children:"Retry"})]}):i.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] px-4 py-2.5",children:[i.jsx("span",{className:"relative flex h-1.5 w-1.5",children:i.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-white/40"})}),i.jsx("span",{className:"text-[13px] text-white/40",children:"Ready to connect"})]})}),i.jsxs(Oe.div,{variants:On,className:"mt-4 flex items-center justify-between border-t border-white/[0.05] px-6 py-4 sm:px-8",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("button",{type:"button",onClick:()=>{try{window.localStorage.setItem(Jx,"1")}catch{}l()},className:"text-left text-[12px] text-white/35 transition hover:text-white/60",children:"Explore demo dashboard"}),i.jsx("button",{type:"button",onClick:()=>{try{window.localStorage.removeItem(Jx)}catch{}l()},className:"text-left text-[12px] text-white/25 transition hover:text-white/55",children:"Continue offline"})]}),i.jsxs("a",{href:e.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex items-center gap-1 text-[12px] text-white/35 transition hover:text-white/60",children:["Setup guide",i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:"transition-transform group-hover:translate-x-0.5",children:i.jsx("path",{d:"M3.5 2.5l3 2.5-3 2.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})}const mN={hidden:{},visible:{transition:{staggerChildren:.06}}},oi={hidden:{opacity:0,y:10},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}};function ky({isSubmitting:e,onSubmit:n,onBack:s}){const[a,l]=b.useState(""),[u,d]=b.useState(null),f=async()=>{d(null);const x=a.trim();if(!x){d("API key is required.");return}const g=/^[a-z]+_/i.test(x)?x:`oxk_${x}`;try{await n(g),l("")}catch(y){d(y instanceof Error?y.message:"Failed to validate API key.")}},m=u!==null;return i.jsxs(Oe.section,{variants:mN,initial:"hidden",animate:"visible",className:"glass-panel soft-shadow rounded-2xl",children:[i.jsxs("div",{className:"px-6 pt-6 sm:px-8 sm:pt-8",children:[i.jsxs(Oe.div,{variants:oi,className:"flex items-center gap-2.5",children:[i.jsx("img",{src:zl,alt:"OrgX",className:"h-7 w-7 rounded-lg object-contain"}),i.jsx("span",{className:"text-[13px] font-semibold text-white/70",children:"OrgX"})]}),i.jsx(Oe.h3,{variants:oi,className:"mt-5 text-[22px] font-semibold tracking-[-0.02em] text-white",children:"Manual API key"}),i.jsxs(Oe.p,{variants:oi,className:"mt-1.5 text-[14px] leading-relaxed text-white/45",children:["Paste a key from your ",i.jsx("span",{className:"text-white/60",children:"useorgx.com"})," dashboard. Browser pairing is recommended."]}),i.jsxs(Oe.p,{variants:oi,className:"mt-1 text-[12px] text-white/35",children:["Paste full key or only the part after ",i.jsx("span",{className:"font-mono text-white/50",children:"oxk_"}),"."]})]}),i.jsxs(Oe.div,{variants:oi,className:"mt-6 space-y-4 px-6 sm:px-8",children:[i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1.5 block text-[11px] font-medium uppercase tracking-[0.14em] text-white/40",children:"API key"}),i.jsxs("div",{className:`flex items-stretch overflow-hidden rounded-xl border transition-colors focus-within:border-[#BFFF00]/40 ${m?"border-red-500/30":"border-white/[0.08]"}`,children:[i.jsx("span",{className:"flex items-center border-r border-white/[0.06] bg-white/[0.03] px-3 font-mono text-[13px] text-white/25 select-none",children:"oxk_"}),i.jsx("input",{value:a,onChange:x=>{l(x.target.value),u&&d(null)},placeholder:"paste your key",className:"w-full bg-transparent px-3 py-2.5 font-mono text-[13px] text-white outline-none placeholder:text-white/15"})]}),m&&i.jsx(Oe.p,{initial:{opacity:0,y:-3},animate:{opacity:1,y:0},className:"mt-1.5 text-[12px] text-red-400/70",children:u})]}),i.jsxs("p",{className:"text-[12px] text-white/35",children:["User-scoped keys (",i.jsx("span",{className:"font-mono text-white/50",children:"oxk_..."}),") do not require a separate user ID header."]})]}),i.jsxs(Oe.div,{variants:oi,className:"mt-6 flex flex-wrap items-center gap-3 px-6 sm:px-8",children:[i.jsx("button",{type:"button",onClick:()=>{f()},disabled:e,className:"inline-flex items-center gap-2 rounded-full bg-[#BFFF00] px-5 py-2.5 text-[13px] font-semibold text-black shadow-[0_0_24px_rgba(191,255,0,0.12)] transition-all hover:bg-[#d3ff42] hover:shadow-[0_0_32px_rgba(191,255,0,0.22)] disabled:cursor-not-allowed disabled:opacity-50",children:e?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.2"}),i.jsx("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),"Validating..."]}):"Validate & Connect"}),i.jsx("button",{type:"button",onClick:s,className:"rounded-full border border-white/[0.1] px-4 py-2 text-[13px] text-white/60 transition hover:border-white/[0.18] hover:text-white/85",children:"Back to pairing"})]}),i.jsx("div",{className:"mt-6 border-t border-white/[0.05] px-6 py-4 sm:px-8",children:i.jsx("p",{className:"text-[12px] text-white/25",children:"Keys are stored locally and never leave your device."})})]})}function xN(e){switch(e){case"starting":return"Starting secure session...";case"awaiting_browser_auth":return"Waiting for browser approval...";case"pairing":return"Confirming connection...";case"manual_key":return"Manual key entry";case"connected":return"Connected";case"error":return"Connection issue";default:return"Ready to connect"}}function gN(e){switch(e){case"config":return"Config key";case"environment":return"Env key";case"persisted":return"Saved key";case"openclaw-config-file":return"OpenClaw key";case"legacy-dev":return"Legacy key";default:return"No key"}}function yN(e){return e==="awaiting_browser_auth"||e==="pairing"||e==="starting"?"active":e==="error"?"error":e==="connected"?"active":"idle"}const e0={idle:"bg-white/40",active:"bg-[#BFFF00]",error:"bg-red-400"},Gu="orgx.onboarding.mc_hint.dismissed",t0={initial:{opacity:0,y:14,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.32,ease:[.16,1,.3,1]}};function vN({state:e,isLoading:n,isStarting:s,isSubmittingManual:a,onRefresh:l,onStartPairing:u,onSubmitManualKey:d,onBackToPairing:f,onUseManualKey:m,onSkip:x}){const[g,y]=b.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Gu)==="1");b.useEffect(()=>{typeof window>"u"||(g?window.localStorage.setItem(Gu,"1"):window.localStorage.removeItem(Gu))},[g]);const v=e.status==="manual_key",k=e.status==="awaiting_browser_auth"||e.status==="pairing",E=yN(e.status),S=E==="active"&&e.status!=="connected",j=e.status==="connected"&&!g;return i.jsxs("div",{className:"relative flex min-h-screen items-center justify-center px-4 py-10 sm:py-16",style:{backgroundColor:"#02040A"},children:[i.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[i.jsx("div",{className:"ambient-orb orb-lime",style:{width:500,height:500,top:-200,left:-160}}),i.jsx("div",{className:"ambient-orb orb-teal",style:{width:560,height:560,bottom:-240,right:-170}}),i.jsx("div",{className:"ambient-orb orb-iris",style:{width:340,height:340,bottom:"20%",left:"50%",animationDelay:"3s"}}),i.jsx("div",{className:"grain-overlay absolute inset-0"})]}),i.jsxs(Oe.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.45},className:"relative z-10 w-full max-w-lg",children:[n?i.jsxs("div",{className:"glass-panel rounded-2xl p-6 sm:p-8",children:[i.jsx("div",{className:"shimmer-skeleton h-7 w-28 rounded-lg"}),i.jsx("div",{className:"shimmer-skeleton mt-5 h-8 w-3/4 rounded-lg"}),i.jsx("div",{className:"shimmer-skeleton mt-3 h-4 w-2/3 rounded-lg"}),i.jsxs("div",{className:"mt-7 grid grid-cols-3 gap-2.5",children:[i.jsx("div",{className:"shimmer-skeleton h-24 rounded-xl"}),i.jsx("div",{className:"shimmer-skeleton h-24 rounded-xl"}),i.jsx("div",{className:"shimmer-skeleton h-24 rounded-xl"})]}),i.jsx("div",{className:"shimmer-skeleton mt-7 h-10 w-36 rounded-full"})]}):i.jsx(dr,{mode:"wait",children:v?i.jsx(Oe.div,{...t0,children:i.jsx(ky,{isSubmitting:a,onSubmit:d,onBack:f})},"manual"):i.jsx(Oe.div,{...t0,children:i.jsx(pN,{state:e,isStarting:s,onConnect:()=>{u()},onUseManualKey:m,onContinueWithoutOrgX:x})},"explainer")}),!n&&(k||e.status==="connected")&&i.jsxs(Oe.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{delay:.15,duration:.35,ease:[.16,1,.3,1]},className:"mt-4 flex items-center justify-between rounded-xl border border-white/[0.06] bg-white/[0.025] px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsxs("span",{className:"relative flex h-2 w-2",children:[S&&i.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${e0[E]} opacity-40`}),i.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${e0[E]}`})]}),i.jsx("span",{className:"text-[13px] text-white/60",children:xN(e.status)}),e.workspaceName&&i.jsx("span",{className:"chip",children:e.workspaceName}),e.keySource&&e.keySource!=="none"&&i.jsx("span",{className:"chip",children:gN(e.keySource)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[e.expiresAt&&i.jsx("span",{className:"text-[11px] text-white/30",children:new Date(e.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),e.connectUrl&&k&&i.jsx("a",{href:e.connectUrl,target:"_blank",rel:"noopener noreferrer",className:"rounded-full border border-[#BFFF00]/25 bg-[#BFFF00]/[0.05] px-3 py-1 text-[11px] font-medium text-[#D8FFA1] transition hover:bg-[#BFFF00]/[0.1]",children:"Approve in browser"}),i.jsx("button",{type:"button",onClick:()=>{l()},className:"rounded-full border border-white/[0.08] px-2.5 py-1 text-[11px] text-white/40 transition hover:bg-white/[0.04] hover:text-white/60",children:"Refresh"})]})]}),j&&i.jsxs(Oe.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.2,duration:.3},className:"mt-3 rounded-xl border border-[#7C7CFF]/25 bg-[#7C7CFF]/10 px-4 py-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[#CFCBFF]",children:"Mission Control Tip"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-[#E6E4FF]",children:"Open Mission Control to see initiative → workstream → milestone → task flow with dependencies and recent todos in one expandable view."}),i.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[i.jsx("a",{href:"/orgx/live?view=mission-control",className:"rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-3 py-1 text-[11px] font-medium text-[#D8FFA1]",children:"Open Mission Control"}),i.jsx("button",{type:"button",onClick:()=>y(!0),className:"text-[11px] text-white/60 underline underline-offset-2",children:"Dismiss"})]})]})]})]})}var wN=M0();function _i({open:e,onClose:n,children:s,maxWidth:a="max-w-2xl"}){const l=b.useRef(null),u=b.useRef(null);b.useEffect(()=>{if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null,(()=>{const g=l.current;if(!g)return;const y=g.querySelector('[data-modal-autofocus="true"]');if(y){y.focus();return}const v=g.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');v.length>0?v[0].focus():g.focus()})();const m=g=>{if(g.key==="Escape"){g.preventDefault(),n();return}if(g.key!=="Tab")return;const y=l.current;if(!y)return;const v=y.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(v.length===0){g.preventDefault(),y.focus();return}const k=v[0],E=v[v.length-1],S=document.activeElement;!g.shiftKey&&S===E?(g.preventDefault(),k.focus()):g.shiftKey&&S===k&&(g.preventDefault(),E.focus())},x=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",m),()=>{var g;document.body.style.overflow=x,document.removeEventListener("keydown",m),(g=u.current)==null||g.focus()}},[e,n]);const d=i.jsx(dr,{children:e&&i.jsxs(Oe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[120] flex items-stretch justify-center p-0 sm:items-center sm:p-6",onClick:n,"aria-hidden":!e,children:[i.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-md"}),i.jsxs(Oe.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.24,ease:[.16,1,.3,1]},className:`glass-panel soft-shadow relative flex h-[100dvh] max-h-[100dvh] w-full ${a} overflow-hidden rounded-none sm:h-[88vh] sm:max-h-[88vh] sm:rounded-2xl`,style:{backgroundColor:q.cardBgElevated,borderColor:q.cardBorderStrong},onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true",tabIndex:-1,ref:l,children:[i.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/50 to-transparent"}),s]})]})});return typeof document>"u"?d:wN.createPortal(d,document.body)}function Ke(...e){return e.filter(Boolean).join(" ")}function Xu(e){const n={};return e.embedMode&&(n["X-Orgx-Embed"]="true"),e.authToken&&(n.Authorization=`Bearer ${e.authToken}`),Object.keys(n).length>0?n:void 0}function jy({authToken:e=null,embedMode:n=!1,enabled:s=!0}={}){var x,g;const a=qo(),l=b.useMemo(()=>["byok-settings",{authToken:e,embedMode:n}],[e,n]),u=b.useMemo(()=>["byok-health",{authToken:e,embedMode:n}],[e,n]),d=Kr({queryKey:l,enabled:s,queryFn:async()=>{const y=await fetch("/orgx/api/settings/byok",{headers:Xu({authToken:e,embedMode:n})}),v=await y.json().catch(()=>null);return y.ok?v:{ok:!1,updatedAt:null,providers:{openai:{configured:!1,source:"none",masked:null},anthropic:{configured:!1,source:"none",masked:null},openrouter:{configured:!1,source:"none",masked:null}},error:(v==null?void 0:v.error)??`Failed to load settings (${y.status})`}},staleTime:15e3}),f=Kr({queryKey:u,enabled:!1,queryFn:async()=>{const y=await fetch("/orgx/api/settings/byok/health",{headers:Xu({authToken:e,embedMode:n})}),v=await y.json().catch(()=>null);return y.ok?v:{ok:!1,agentId:"main",providers:{openai:{ok:!1,error:(v==null?void 0:v.error)??`Probe failed (${y.status})`},anthropic:{ok:!1,error:(v==null?void 0:v.error)??`Probe failed (${y.status})`},openrouter:{ok:!1,error:(v==null?void 0:v.error)??`Probe failed (${y.status})`}},error:(v==null?void 0:v.error)??`Probe failed (${y.status})`}}}),m=xs({mutationFn:async y=>{const v=await fetch("/orgx/api/settings/byok",{method:"POST",headers:{"Content-Type":"application/json",...Xu({authToken:e,embedMode:n})??{}},body:JSON.stringify(y??{})}),k=await v.json().catch(()=>null);if(!v.ok)throw new Error((k==null?void 0:k.error)??`Failed to save settings (${v.status})`);return k},onSuccess:async()=>{await a.invalidateQueries({queryKey:l})}});return{status:d.data??null,isLoading:d.isLoading,error:((x=d.data)==null?void 0:x.error)??((g=d.error)==null?void 0:g.message)??null,refetchStatus:d.refetch,update:m.mutateAsync,isSaving:m.isPending,health:f.data??null,probe:f.refetch,isProbing:f.isFetching}}const Ny="orgx.first_run_guide.dismissed";function bN(e){return i.jsx("span",{className:Ke("inline-flex h-2 w-2 rounded-full",e?"bg-emerald-400":"bg-white/35")})}function kN(){try{return typeof window<"u"&&window.localStorage.getItem(Ny)==="1"}catch{return!1}}function jN(e){try{if(typeof window>"u")return;e&&window.localStorage.setItem(Ny,"1")}catch{}}function NN({open:e,onClose:n,onOpenSettings:s,onOpenOrgxSettings:a,onOpenMissionControl:l,demoMode:u,connectionVerified:d,hasSessions:f}){const m=jy({enabled:e}),g=b.useMemo(()=>{var S;return(S=m.status)!=null&&S.ok?Number(m.status.providers.openai.configured)+Number(m.status.providers.anthropic.configured)+Number(m.status.providers.openrouter.configured):0},[m.status])>0,y=g?"mission-control":"settings",v=[{label:u?"Exit demo (optional)":"Connect OrgX",done:u?!1:d,detail:u?"Demo mode shows sample data. Connect OrgX to sync initiatives/tasks.":"Approve the pairing flow so your initiatives, tasks, and activity can sync.",action:!u&&!d&&a?{label:"Connect",onClick:a}:null},{label:"Add provider key(s)",done:g,detail:"Set OpenAI / Anthropic / OpenRouter keys for agent launches, or rely on env vars.",action:g?null:{label:"Open settings",onClick:s}},{label:"Launch your first agent",done:f,detail:"Use the “Launch” button in Agents / Chats to start a scoped run."},{label:"Open Mission Control",done:!1,detail:"Track dependency-ready next-up tasks and start auto-continue for execution.",action:{label:"Open",onClick:l}}],k=v.filter(S=>S.done).length,E=Math.round(k/v.length*100);return i.jsx(_i,{open:e,onClose:n,maxWidth:"max-w-2xl",children:i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"border-b border-white/[0.06] px-5 py-4 sm:px-6",children:i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[15px] font-semibold text-white",children:"First run checklist"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-white/55",children:"A fast path to seeing OrgX value inside OpenClaw."}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"chip",children:[k," / ",v.length," complete"]}),i.jsxs("span",{className:"text-[11px] text-white/35",children:[E,"% done"]})]}),i.jsx("div",{className:"mt-2 h-1.5 w-full max-w-[340px] overflow-hidden rounded-full bg-white/[0.08]",children:i.jsx("div",{className:"h-full rounded-full bg-[#BFFF00]/80",style:{width:`${E}%`}})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>{jN(!0),n()},className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08]",title:"Don't show automatically again",children:"Don't show again"}),i.jsx("button",{type:"button",onClick:n,"aria-label":"Close checklist",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-white/[0.12] bg-white/[0.03] text-white/70 transition-colors hover:bg-white/[0.08] hover:text-white",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M18 6L6 18"}),i.jsx("path",{d:"M6 6l12 12"})]})})]})]})}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4 sm:px-6",children:i.jsxs("div",{className:"rounded-2xl border border-white/[0.07] bg-white/[0.02] p-4",children:[i.jsx("div",{className:"space-y-3",children:v.map(S=>i.jsxs("div",{className:Ke("flex items-start justify-between gap-3 rounded-xl border p-3",S.done?"border-white/[0.06] bg-white/[0.02]":"border-white/[0.10] bg-white/[0.03]"),children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[i.jsx("div",{className:"pt-1",children:bN(S.done)}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:Ke("text-[13px] font-semibold",S.done?"text-white/80":"text-white"),children:S.label}),i.jsx("p",{className:"mt-0.5 text-[12px] leading-relaxed text-white/45",children:S.detail})]})]}),S.action&&!S.done?i.jsx("button",{type:"button",onClick:S.action.onClick,"data-modal-autofocus":y==="settings"&&S.label==="Add provider key(s)"||y==="mission-control"&&S.label==="Open Mission Control"?"true":void 0,className:"shrink-0 rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-3 py-1.5 text-[11px] font-semibold text-[#D8FFA1]",children:S.action.label}):null]},S.label))}),i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:s,"data-modal-autofocus":y==="settings"?"true":void 0,className:"rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-3 py-1.5 text-[11px] font-semibold text-[#D8FFA1]",children:"Open settings"}),i.jsx("button",{type:"button",onClick:l,"data-modal-autofocus":y==="mission-control"?"true":void 0,className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08]",children:"Open Mission Control"}),i.jsx("button",{type:"button",onClick:n,className:"rounded-full border border-white/[0.12] px-3 py-1.5 text-[11px] text-white/55 transition-colors hover:bg-white/[0.05] hover:text-white/80",title:"Hide for now",children:"Not now"})]})]})}),i.jsx("div",{className:"border-t border-white/[0.06] px-5 py-3 sm:px-6",children:i.jsx("p",{className:"text-[11px] text-white/40",children:"Tip: auto-continue is available per initiative from Mission Control quick actions."})})]})})}function n0({children:e,color:n,pulse:s,title:a}){const l=n??q.lime;return i.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.14em]",title:a,style:{backgroundColor:`${l}22`,border:`1px solid ${l}5a`,color:l,boxShadow:`0 8px 20px ${l}24`},children:[i.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[s&&i.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75",style:{backgroundColor:l}}),i.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full",style:{backgroundColor:l}})]}),e]})}const SN=[{id:"agents",label:"Agents",icon:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),i.jsx("circle",{cx:"12",cy:"7",r:"4"})]})},{id:"activity",label:"Activity",icon:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})},{id:"decisions",label:"Decisions",icon:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"}),i.jsx("path",{d:"m9 12 2 2 4-4"})]})},{id:"initiatives",label:"Initiatives",icon:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),i.jsx("line",{x1:"4",x2:"4",y1:"22",y2:"15"})]})}];function CN({activeTab:e,onTabChange:n,pendingDecisionCount:s=0}){return i.jsxs("nav",{className:"fixed inset-x-0 bottom-0 z-40 border-t border-white/[0.08] bg-[#0a0a0f]/95 backdrop-blur-lg lg:hidden","aria-label":"Mobile sections",children:[i.jsx("div",{className:"flex items-stretch",children:SN.map(a=>{const l=e===a.id;return i.jsxs("button",{type:"button",onClick:()=>n(a.id),"aria-current":l?"page":void 0,className:Ke("relative flex flex-1 flex-col items-center gap-0.5 pb-1 pt-2 transition-colors",l?"text-lime":"text-white/40 hover:text-white/60"),children:[l&&i.jsx("span",{className:"absolute inset-x-3 top-0 h-[2px] rounded-full",style:{backgroundColor:q.lime}}),i.jsxs("span",{className:"relative",children:[a.icon,a.id==="decisions"&&s>0&&i.jsx("span",{className:"absolute -right-2 -top-1 flex h-3.5 min-w-[14px] items-center justify-center rounded-full px-1 text-[8px] font-bold text-black",style:{backgroundColor:q.amber},children:s>99?"99+":s})]}),i.jsx("span",{className:"text-[10px]",children:a.label})]},a.id)})}),i.jsx("div",{className:"h-[env(safe-area-inset-bottom)]"})]})}const _l={codex:{id:"codex",label:"Codex",accent:"#10B981",tint:"rgba(16, 185, 129, 0.18)"},openai:{id:"openai",label:"OpenAI",accent:"#9F7AEA",tint:"rgba(159, 122, 234, 0.2)"},anthropic:{id:"anthropic",label:"Anthropic",accent:"#F5B700",tint:"rgba(245, 183, 0, 0.18)"},openclaw:{id:"openclaw",label:"OpenClaw",accent:"#FF4D4D",tint:"rgba(255, 77, 77, 0.18)"},orgx:{id:"orgx",label:"OrgX",accent:q.lime,tint:"rgba(191, 255, 0, 0.18)"},unknown:{id:"unknown",label:"Agent",accent:q.teal,tint:"rgba(20, 184, 166, 0.18)"}},AN=["provider","vendor","model","runtime","engine","agent","name","title","label","summary","description","source"];function jl(e,n,s,a){if(!(e==null||s>2)){if(typeof e=="string"){const l=e.trim();l.length>0&&n.push(l);return}if(Array.isArray(e)){for(const l of e)jl(l,n,s+1,a);return}if(typeof e=="object"){if(a.has(e))return;a.add(e);for(const[l,u]of Object.entries(e)){const d=l.toLowerCase();typeof u=="string"?(AN.some(f=>d.includes(f))||d.startsWith("meta")||d.endsWith("id"))&&jl(u,n,s+1,a):typeof u=="object"&&u!==null&&jl(u,n,s+1,a)}}}}function EN(e){const n=e.toLowerCase();return/\bcodex\b/.test(n)||/\bcursor\b/.test(n)||n.includes("openai/codex")?"codex":n.includes("openclaw")||n.includes("clawdbot")||n.includes("moltbot")?"openclaw":n.includes("anthropic")||n.includes("claude")||n.includes("sonnet")||n.includes("opus")?"anthropic":n.includes("openai")||n.includes("chatgpt")||/\bgpt[-\s]?\d/.test(n)||/\bo[134]/.test(n)?"openai":n.includes("orgx")?"orgx":null}function Io(...e){const n=[],s=new Set;for(const a of e)jl(a,n,0,s);for(const a of n){const l=EN(a);if(l)return _l[l]}return _l.unknown}function TN(e){return _l[e]??_l.unknown}function Wn({children:e,className:n=""}){return i.jsxs("section",{className:Ke("group relative overflow-hidden rounded-2xl","glass-panel soft-shadow hover-lift",n),style:{backgroundColor:q.cardBg,borderColor:q.cardBorder},children:[i.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/50 to-transparent"}),i.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-500 group-hover:opacity-100",style:{background:"radial-gradient(circle at 18% 0%, rgba(191,255,0,0.06), transparent 46%)"}}),e]})}const PN={xs:18,sm:24,md:30};function MN({provider:e}){switch(e){case"openai":return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})});case"anthropic":return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})});case"codex":return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{fill:"currentColor",d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"})});case"openclaw":return i.jsxs("svg",{viewBox:"0 0 120 120","aria-hidden":"true",children:[i.jsx("path",{d:"M60 10C30 10 15 35 15 55C15 75 30 95 45 100V110H55V100C55 100 60 102 65 100V110H75V100C90 95 105 75 105 55C105 35 90 10 60 10Z",fill:"currentColor"}),i.jsx("path",{d:"M20 45C5 40 0 50 5 60C10 70 20 65 25 55C28 48 25 45 20 45Z",fill:"currentColor"}),i.jsx("path",{d:"M100 45C115 40 120 50 115 60C110 70 100 65 95 55C92 48 95 45 100 45Z",fill:"currentColor"}),i.jsx("circle",{cx:"45",cy:"35",r:"6",fill:"rgba(2,4,10,0.92)"}),i.jsx("circle",{cx:"75",cy:"35",r:"6",fill:"rgba(2,4,10,0.92)"})]});case"orgx":return i.jsx("img",{src:zl,alt:"","aria-hidden":"true",className:"h-full w-full rounded-[4px] object-contain"});default:return i.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"1.8",fill:"none"}),i.jsx("path",{d:"m12 6-2 7h3l-1 5 4-8h-3l1-4Z",fill:"currentColor"})]})}}function Nl({provider:e,size:n="sm",className:s,showRing:a=!0}){const l=TN(e),u=PN[n];return i.jsx("span",{className:Ke("inline-flex items-center justify-center rounded-md",s),style:{width:u,height:u,color:l.accent,backgroundColor:l.tint,border:a?`1px solid ${l.accent}55`:"none"},title:l.label,"aria-label":l.label,children:i.jsx("span",{style:{width:Math.round(u*.66),height:Math.round(u*.66),display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i.jsx(MN,{provider:e})})})}const Es={liveData:e=>["live-data",{authToken:e.authToken??null,embedMode:e.embedMode??!1,useMock:e.useMock??!1}],sessions:e=>["sessions",{activeMinutes:e.activeMinutes??null,limit:e.limit??null,authToken:e.authToken??null,embedMode:e.embedMode??!1}],initiativeDetails:e=>["initiative-details",{initiativeId:e.initiativeId,authToken:e.authToken??null,embedMode:e.embedMode??!1}],entities:e=>["entities",{type:e.type,authToken:e.authToken??null,embedMode:e.embedMode??!1}],missionControlGraph:e=>["mission-control-graph",{initiativeId:e.initiativeId,authToken:e.authToken??null,embedMode:e.embedMode??!1}],autoContinueStatus:e=>["auto-continue-status",{initiativeId:e.initiativeId,authToken:e.authToken??null,embedMode:e.embedMode??!1}],liveInitiatives:e=>["live-initiatives",{limit:(e==null?void 0:e.limit)??300}]};function FN(e){const n=e.toLowerCase();return n==="completed"||n==="done"?"completed":n==="blocked"||n==="at_risk"?"blocked":n==="paused"||n==="hold"?"paused":"active"}function DN(e){if(!e)return 0;const n=new Date(e),s=new Date;return Math.max(0,Math.ceil((n.getTime()-s.getTime())/864e5))}function IN(e){return{id:e.id,name:e.title,status:FN(e.status),rawStatus:e.status??null,health:e.progress_pct??0,daysRemaining:DN(e.target_date),targetDate:e.target_date??null,createdAt:e.created_at??null,updatedAt:e.updated_at??e.created_at??null,activeAgents:0,totalAgents:0,description:e.summary??void 0}}function _N(e){const n=e.toLowerCase();return!["deleted","archived","cancelled"].includes(n)}function Sy(e){return Kr({queryKey:Es.entities({type:"initiative"}),queryFn:async()=>{const n=await fetch("/orgx/api/entities?type=initiative&limit=300");return n.ok?((await n.json()).data??[]).filter(a=>_N(a.status??"")).sort((a,l)=>{const u=Date.parse(a.updated_at??a.created_at??"")||0;return(Date.parse(l.updated_at??l.created_at??"")||0)-u}).map(IN):[]},enabled:e,staleTime:6e4})}const Yu={initiativeId:"",workstreams:[],milestones:[],tasks:[]},LN=(e,n)=>({id:e.id,name:e.name??"Untitled workstream",summary:e.summary??null,status:e.status??"planned",progress:typeof e.progress=="number"&&!Number.isNaN(e.progress)?Math.max(0,Math.min(100,e.progress<=1?e.progress*100:e.progress)):null,initiativeId:e.initiative_id??n,createdAt:e.created_at??null}),RN=(e,n)=>({id:e.id,title:e.title??"Untitled milestone",description:e.description??null,status:e.status??"planned",dueDate:e.due_date??null,initiativeId:e.initiative_id??n,workstreamId:e.workstream_id??null,createdAt:e.created_at??null}),ON=(e,n)=>({id:e.id,title:e.title??"Untitled task",description:e.description??null,status:e.status??"todo",priority:e.priority??null,dueDate:e.due_date??null,initiativeId:e.initiative_id??n,milestoneId:e.milestone_id??null,workstreamId:e.workstream_id??null,createdAt:e.created_at??null});function Jo({initiativeId:e,authToken:n=null,embedMode:s=!1,enabled:a=!0}){var d;const l=b.useMemo(()=>Es.initiativeDetails({initiativeId:e,authToken:n,embedMode:s}),[e,n,s]),u=Kr({queryKey:l,enabled:a&&!!e,queryFn:async()=>{if(!e)return Yu;const f={};s&&(f["X-Orgx-Embed"]="true"),n&&(f.Authorization=`Bearer ${n}`);const m=Object.keys(f).length?f:void 0,x=async j=>{try{const F=new URLSearchParams({type:j,initiative_id:e,limit:"100"}),_=await fetch(`/orgx/api/entities?${F.toString()}`,{headers:m});return _.ok?await _.json():(console.warn(`[useInitiativeDetails] ${j} fetch returned ${_.status}, using empty list`),{data:[]})}catch(F){return console.warn(`[useInitiativeDetails] ${j} fetch failed:`,F),{data:[]}}},[g,y,v]=await Promise.all([x("workstream"),x("milestone"),x("task")]),k=Array.isArray(g.data)?g.data.map(j=>LN(j,e)):[],E=Array.isArray(y.data)?y.data.map(j=>RN(j,e)):[],S=Array.isArray(v.data)?v.data.map(j=>ON(j,e)):[];return{initiativeId:e,workstreams:k,milestones:E,tasks:S}}});return{details:u.data??(e?{...Yu,initiativeId:e}:Yu),isLoading:u.isLoading,error:((d=u.error)==null?void 0:d.message)??null,refetch:u.refetch}}function ko(e){const n=(e??"").toLowerCase();return n==="active"?{label:"Active",color:q.lime,bg:"rgba(191,255,0,0.12)"}:n==="blocked"?{label:"Blocked",color:"#fb7185",bg:"rgba(244, 63, 94, 0.12)"}:n==="idle"?{label:"Idle",color:"rgba(255,255,255,0.55)",bg:"rgba(255,255,255,0.06)"}:{label:e||"Unknown",color:q.iris,bg:"rgba(124,124,255,0.10)"}}function BN(e){return[...e.workstreams].sort((n,s)=>n.name.localeCompare(s.name))}function $N(e,n){return[...n?e.tasks.filter(a=>a.workstreamId===n):e.tasks].sort((a,l)=>a.title.localeCompare(l.title))}function VN({open:e,onClose:n,onLaunched:s}){var xe,de,ge,ae,_e,Ue;const a=Kr({queryKey:["openclaw-agent-catalog"],queryFn:async()=>{const ee=await fetch("/orgx/api/agents/catalog");if(!ee.ok){const Ce=await ee.text().catch(()=>"");throw new Error(Ce||`Agent catalog failed (${ee.status})`)}return await ee.json()},enabled:e,staleTime:2e3,refetchInterval:e?3e3:!1}),{data:l}=Sy(e),[u,d]=b.useState(""),[f,m]=b.useState(""),[x,g]=b.useState(""),[y,v]=b.useState(""),[k,E]=b.useState("auto"),[S,j]=b.useState(""),[F,_]=b.useState(null),[A,P]=b.useState(null),[M,C]=b.useState("starter"),[B,R]=b.useState(!1),[G,he]=b.useState(1),$=b.useMemo(()=>{const ee=f.trim();return ee?(l==null?void 0:l.find(Ce=>Ce.id===ee))??null:null},[l,f]),{details:ie}=Jo({initiativeId:$?$.id:null,enabled:e&&!!$}),W=b.useMemo(()=>BN(ie),[ie]),H=b.useMemo(()=>$N(ie,x||null),[ie,x]),L=((xe=a.data)==null?void 0:xe.agents)??[],X=b.useMemo(()=>{const ee=u.trim();return ee?L.find(Ce=>Ce.id===ee)??null:null},[L,u]);b.useEffect(()=>{var Ce,De;if(!e)return;const ee=((Ce=L.find(Te=>Te.isDefault))==null?void 0:Ce.id)??((De=L[0])==null?void 0:De.id)??"";!u&&ee&&d(ee)},[L,e,u]),b.useEffect(()=>{if(!e||f.trim())return;const ee=l??[],Ce=ee.length===1?ee[0]:null;Ce&&m(Ce.id)},[l,e,f]),b.useEffect(()=>{if(!e)return;const ee=(X==null?void 0:X.model)??"",Ce=ee.includes("openrouter")?"openrouter":ee.includes("anthropic")?"anthropic":ee.includes("openai")?"openai":"auto";E(Ce)},[e,X==null?void 0:X.model,u]),b.useEffect(()=>{e&&(_(null),P(null),C("starter"),he(1))},[e]),b.useEffect(()=>{g(""),v("")},[f]),b.useEffect(()=>{v("")},[x]),b.useEffect(()=>{e&&(S.trim().length>0||$&&j(`Kick off: ${$.name}`))},[S,e,$]);const te=!!u.trim()&&!!f.trim(),Y=G===1?!!u.trim():G===2?!!f.trim():te,Z=async()=>{var Ge;const ee=(A==null?void 0:A.checkout)??"/orgx/api/billing/checkout",Ce=M&&M.trim().length>0?M.trim():"starter",Te=await(await fetch(ee,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:Ce,billingCycle:"monthly"})})).json().catch(()=>null),Ze=((Ge=Te==null?void 0:Te.data)==null?void 0:Ge.url)??(Te==null?void 0:Te.url)??null;if(!Ze)throw new Error((Te==null?void 0:Te.error)??"Checkout unavailable");window.open(Ze,"_blank","noopener,noreferrer")},V=async()=>{var Ze;const ee=(A==null?void 0:A.portal)??"/orgx/api/billing/portal",De=await(await fetch(ee,{method:"POST"})).json().catch(()=>null),Te=((Ze=De==null?void 0:De.data)==null?void 0:Ze.url)??(De==null?void 0:De.url)??null;if(!Te)throw new Error((De==null?void 0:De.error)??"Billing portal unavailable");window.open(Te,"_blank","noopener,noreferrer")},N=async()=>{if(!(!te||B)){_(null),P(null),R(!0);try{const ee={agentId:u.trim(),message:S.trim()?S.trim():void 0,initiativeId:f.trim(),initiativeTitle:($==null?void 0:$.name)??null,workstreamId:x.trim()?x.trim():null,taskId:y.trim()?y.trim():null,provider:k!=="auto"?k:null},Ce=new URLSearchParams;Ce.set("agentId",ee.agentId),Ce.set("initiativeId",ee.initiativeId),ee.initiativeTitle&&Ce.set("initiativeTitle",ee.initiativeTitle),ee.workstreamId&&Ce.set("workstreamId",ee.workstreamId),ee.taskId&&Ce.set("taskId",ee.taskId),ee.message&&Ce.set("message",ee.message),ee.provider&&Ce.set("provider",ee.provider);const De=await fetch(`/orgx/api/agents/launch?${Ce.toString()}`,{method:"POST"}),Te=await De.json().catch(()=>null);if(!De.ok||!(Te!=null&&Te.ok))throw(Te==null?void 0:Te.code)==="upgrade_required"&&(P(Te.actions??null),C(Te.requiredPlan??"starter")),new Error((Te==null?void 0:Te.error)??`Launch failed (${De.status})`);n(),s==null||s()}catch(ee){_(ee instanceof Error?ee.message:"Launch failed")}finally{R(!1)}}},z=!!((de=X==null?void 0:X.run)!=null&&de.runId)&&!!((ge=X==null?void 0:X.run)!=null&&ge.pid),fe=async()=>{var ee;if(!(!((ee=X==null?void 0:X.run)!=null&&ee.runId)||!z||B)){_(null),R(!0);try{const Ce=await fetch(`/orgx/api/agents/stop?runId=${encodeURIComponent(X.run.runId)}`,{method:"POST"}),De=await Ce.json().catch(()=>null);if(!Ce.ok||!(De!=null&&De.ok))throw new Error((De==null?void 0:De.error)??`Stop failed (${Ce.status})`);await a.refetch()}catch(Ce){_(Ce instanceof Error?Ce.message:"Stop failed")}finally{R(!1)}}},se=async()=>{var ee;if(!(!((ee=X==null?void 0:X.run)!=null&&ee.runId)||B)){_(null),R(!0);try{const Ce=new URLSearchParams;Ce.set("runId",X.run.runId),S.trim()&&Ce.set("message",S.trim()),k&&k!=="auto"&&Ce.set("provider",k);const De=await fetch(`/orgx/api/agents/restart?${Ce.toString()}`,{method:"POST"}),Te=await De.json().catch(()=>null);if(!De.ok||!(Te!=null&&Te.ok))throw new Error((Te==null?void 0:Te.error)??`Restart failed (${De.status})`);n(),s==null||s()}catch(Ce){_(Ce instanceof Error?Ce.message:"Restart failed")}finally{R(!1)}}};return e?i.jsx(_i,{open:e,onClose:n,maxWidth:"max-w-2xl",children:i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"border-b border-white/[0.06] px-5 py-4 sm:px-6",children:i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[14px] font-semibold text-white",children:"Launch OpenClaw Agent"}),i.jsx("p",{className:"mt-1 text-[12px] text-white/55",children:"Starts a background agent turn and scopes the resulting sessions/activity to the selected OrgX initiative."}),i.jsx("div",{className:"mt-3 inline-flex items-center gap-1 rounded-full border border-white/[0.12] bg-white/[0.03] p-1 text-[10px] uppercase tracking-[0.12em] text-white/55",children:[[1,"Agent"],[2,"Scope"],[3,"Message"]].map(([ee,Ce])=>i.jsxs("button",{type:"button",onClick:()=>he(ee),className:Ke("rounded-full px-3 py-1 transition-colors",G===ee?"bg-white/[0.12] text-white":"hover:bg-white/[0.06]"),children:[ee,". ",Ce]},ee))})]}),i.jsx("button",{type:"button",onClick:n,className:"rounded-lg border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[12px] text-white/60 hover:bg-white/[0.08] hover:text-white",children:"Close"})]})}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4 sm:px-6",children:[a.isLoading&&i.jsx("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4 text-[12px] text-white/55",children:"Loading agent catalog…"}),a.error&&i.jsx("div",{className:"rounded-xl border border-rose-300/20 bg-rose-400/10 p-4 text-[12px] text-rose-100",children:a.error.message}),i.jsx(dr,{mode:"wait",children:i.jsxs(Oe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.22,ease:[.16,1,.3,1]},className:"mt-3 space-y-4",children:[G===1&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] uppercase tracking-[0.1em] text-white/35",children:"Agent"}),i.jsx("select",{value:u,onChange:ee=>d(ee.target.value),className:"mt-1 w-full rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",children:L.map(ee=>{const Ce=ko(ee.status);return i.jsxs("option",{value:ee.id,children:[ee.name," (",ee.id,") · ",Ce.label]},ee.id)})})]}),X&&i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-3 text-[12px] text-white/60",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-medium text-white/80",children:X.name}),i.jsx("span",{className:"rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em]",style:{borderColor:`${ko(X.status).color}55`,color:ko(X.status).color,backgroundColor:ko(X.status).bg},children:ko(X.status).label})]}),i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsxs("p",{className:"truncate",children:[i.jsx("span",{className:"text-white/40",children:"Model:"})," ",X.model??"unknown"]}),i.jsxs("p",{className:"truncate",children:[i.jsx("span",{className:"text-white/40",children:"Workspace:"})," ",X.workspace??"unknown"]}),((ae=X.context)==null?void 0:ae.initiativeId)&&i.jsxs("p",{className:"truncate",children:[i.jsx("span",{className:"text-white/40",children:"Scoped:"})," ",X.context.initiativeTitle??X.context.initiativeId]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.12em] text-white/30",children:"Provider"}),i.jsxs("select",{value:k,onChange:ee=>E(ee.target.value),className:"mt-1 w-full rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",children:[i.jsx("option",{value:"auto",children:"Auto (keep agent model)"}),i.jsx("option",{value:"anthropic",children:"Anthropic"}),i.jsx("option",{value:"openrouter",children:"OpenRouter"}),i.jsx("option",{value:"openai",children:"OpenAI"})]}),i.jsx("p",{className:"mt-1 text-[10px] text-white/35",children:"Selecting a provider updates the agent's default model before launch."})]}),X.run&&i.jsxs("p",{className:"truncate",children:[i.jsx("span",{className:"text-white/40",children:"Tracked run:"})," ",X.run.runId.slice(0,8),"…"," ",i.jsxs("span",{className:"text-white/35",children:["(",X.run.status,")"]})]}),X.run&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-1",children:[i.jsx("button",{type:"button",onClick:fe,disabled:!z||B,className:"rounded-lg border border-rose-300/25 bg-rose-400/10 px-3 py-2 text-[11px] font-semibold text-rose-100 transition-colors hover:bg-rose-400/20 disabled:opacity-45",children:"Stop Run"}),i.jsx("button",{type:"button",onClick:se,disabled:B,className:"rounded-lg border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Restart"})]})]})]})]}),G===2&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] uppercase tracking-[0.1em] text-white/35",children:"Initiative Scope"}),i.jsxs("select",{value:f,onChange:ee=>m(ee.target.value),className:"mt-1 w-full rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",children:[i.jsx("option",{value:"",children:"Select an initiative…"}),(l??[]).map(ee=>i.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.12em] text-white/30",children:"Workstream (optional)"}),i.jsxs("select",{value:x,onChange:ee=>g(ee.target.value),disabled:!$,className:Ke("mt-1 w-full rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",!$&&"opacity-50"),children:[i.jsx("option",{value:"",children:"Any workstream"}),W.map(ee=>i.jsx("option",{value:ee.id,children:ee.name},ee.id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.12em] text-white/30",children:"Task (optional)"}),i.jsxs("select",{value:y,onChange:ee=>v(ee.target.value),disabled:!$,className:Ke("mt-1 w-full rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",!$&&"opacity-50"),children:[i.jsx("option",{value:"",children:"Any task"}),H.slice(0,80).map(ee=>i.jsx("option",{value:ee.id,children:ee.title},ee.id))]}),H.length>80&&i.jsx("p",{className:"mt-1 text-[10px] text-white/35",children:"Showing first 80 tasks to keep the menu usable."})]})]})]}),G===3&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] uppercase tracking-[0.1em] text-white/35",children:"Kickoff Message"}),i.jsx("textarea",{value:S,onChange:ee=>j(ee.target.value),rows:4,className:"mt-1 w-full resize-none rounded-xl border border-white/[0.1] bg-black/30 px-3 py-2 text-[12px] text-white/80 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30",placeholder:"Optional. If left blank, a default kickoff message is used."})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-3 text-[12px] text-white/60",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.12em] text-white/35",children:"Review"}),i.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-black/20 px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-white/35",children:"Agent"}),i.jsx("div",{className:"mt-0.5 truncate text-[12px] text-white/80",children:((X==null?void 0:X.name)??u.trim())||"—"})]}),i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-black/20 px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-white/35",children:"Initiative"}),i.jsx("div",{className:"mt-0.5 truncate text-[12px] text-white/80",children:(($==null?void 0:$.name)??f.trim())||"—"})]}),i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-black/20 px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-white/35",children:"Workstream"}),i.jsx("div",{className:"mt-0.5 truncate text-[12px] text-white/80",children:x.trim()?((_e=W.find(ee=>ee.id===x))==null?void 0:_e.name)??x:"Any"})]}),i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-black/20 px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-white/35",children:"Task"}),i.jsx("div",{className:"mt-0.5 truncate text-[12px] text-white/80",children:y.trim()?((Ue=H.find(ee=>ee.id===y))==null?void 0:Ue.title)??y:"Any"})]})]})]})]})]},G)}),F&&i.jsx("div",{className:"mt-3 rounded-xl border border-rose-300/20 bg-rose-400/10 px-3 py-2 text-[12px] text-rose-100",children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("div",{children:F}),A&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void Z().catch(ee=>_(ee instanceof Error?ee.message:"Checkout failed")),className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-3 py-1.5 text-[11px] font-semibold text-amber-100 transition-colors hover:bg-amber-200/15",children:"Upgrade"}),i.jsx("button",{type:"button",onClick:()=>void V().catch(ee=>_(ee instanceof Error?ee.message:"Portal failed")),className:"rounded-full border border-white/[0.14] bg-white/[0.03] px-3 py-1.5 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08]",children:"Billing portal"}),A.pricing&&i.jsx("a",{href:A.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-white/60 underline decoration-white/20 hover:text-white/80",children:"View pricing"})]})]})})]}),i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-white/[0.06] px-5 py-3.5 sm:px-6",children:[i.jsx("div",{className:"text-[11px] text-white/45",children:G===1?"Pick an agent to configure.":G===2?"Select an initiative scope (required).":te?"Launch will update sessions/activity under the selected initiative.":"Select an agent and initiative to launch."}),i.jsxs("div",{className:"flex items-center gap-2",children:[G>1&&i.jsx("button",{type:"button",onClick:()=>he(ee=>ee>1?ee-1:ee),disabled:B,className:"rounded-xl border border-white/[0.12] bg-white/[0.03] px-4 py-2 text-[12px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Back"}),G<3?i.jsx("button",{type:"button",onClick:()=>he(ee=>ee<3?ee+1:ee),disabled:!Y||B,className:Ke("rounded-xl px-4 py-2 text-[12px] font-semibold transition-colors",Y&&!B?"text-black":"cursor-not-allowed border border-white/[0.12] bg-white/[0.05] text-white/40"),style:Y&&!B?{backgroundColor:q.lime}:void 0,children:"Next"}):i.jsx("button",{type:"button",onClick:N,disabled:!te||B,className:Ke("rounded-xl px-4 py-2 text-[12px] font-semibold transition-colors",te&&!B?"text-black":"cursor-not-allowed border border-white/[0.12] bg-white/[0.05] text-white/40"),style:te&&!B?{backgroundColor:q.lime}:void 0,children:B?"Launching…":"Launch"})]})]})]})}):null}const ml=120,zN=10,r0=new Set(["running","queued","pending","blocked"]),xl=[{id:"all",label:"All offline",minutes:null},{id:"24h",label:"24h",minutes:1440},{id:"3d",label:"3d",minutes:4320},{id:"7d",label:"7d",minutes:10080},{id:"30d",label:"30d",minutes:720*60}],UN=10,WN=[{id:"orchestrator",name:"Orchestrator",role:"Coordinates cross-team execution"},{id:"engineering",name:"Engineering",role:"Builds and ships technical work"},{id:"product",name:"Product",role:"Defines features and requirements"},{id:"marketing",name:"Marketing",role:"Drives campaigns and content"},{id:"design",name:"Design",role:"Creates interfaces and experiences"},{id:"operations",name:"Operations",role:"Manages reliability and processes"}],KN={running:q.lime,queued:q.amber,pending:q.amber,blocked:q.red,failed:q.red,cancelled:q.red,completed:q.teal,archived:"rgba(255,255,255,0.5)"};function s0(e){return KN[e]??q.iris}function pi(e){if(!e)return 0;const n=Date.parse(e);return Number.isFinite(n)?n:0}function Zu(e,n){return pi(n.updatedAt??n.lastEventAt??n.startedAt)-pi(e.updatedAt??e.lastEventAt??e.startedAt)}function HN(e,n){const a=(e.lastEventSummary??n.get(e.runId)??n.get(e.id)??"").trim();return a.length>0?a:"No summary yet. Open the session to inspect messages and outputs."}const QN=b.memo(function({sessions:n,activity:s,selectedSessionId:a,onSelectSession:l,onReconnect:u}){const[d,f]=b.useState(new Set),[m,x]=b.useState(!1),[g,y]=b.useState("all"),[v,k]=b.useState(!1),[E,S]=b.useState(0),j=b.useMemo(()=>{var W,H,L;const $=new Map,ie=[...s].sort((X,te)=>pi(te.timestamp)-pi(X.timestamp));for(const X of ie){const te=X.runId;if(!te||$.has(te))continue;const Y=((W=X.summary)==null?void 0:W.trim())??((H=X.description)==null?void 0:H.trim())??((L=X.title)==null?void 0:L.trim())??"";Y.length>0&&$.set(te,Y)}return $},[s]),{agents:F,hiddenGroupCount:_,filteredOutGroupsByDate:A,filteredOutSessionsByDate:P,visibleSessionCount:M,archivedGroups:C}=b.useMemo(()=>{const $=new Map;for(const Z of n.nodes){const V=Z.agentId??Z.agentName??Z.id,N=$.get(V);N?N.nodes.push(Z):$.set(V,{agentId:Z.agentId,agentName:Z.agentName??"Unassigned",nodes:[Z],latest:Z})}for(const Z of $.values())Z.nodes.sort(Zu),Z.latest=Z.nodes[0];const ie=Array.from($.values()).sort((Z,V)=>Zu(Z.latest,V.latest)),W=xl.find(Z=>Z.id===g)??xl[0],H=W.minutes===null?null:Date.now()-W.minutes*6e4,L=[],X=[];let te=0,Y=0;for(const Z of ie){if(H===null){L.push(Z);continue}const V=Z.nodes.filter(z=>r0.has(z.status)?!0:pi(z.updatedAt??z.lastEventAt??z.startedAt)>=H);if(V.length===0){te+=1,Y+=Z.nodes.length,X.push(Z);continue}const N=Z.nodes.filter(z=>r0.has(z.status)?!1:pi(z.updatedAt??z.lastEventAt??z.startedAt)<H);Y+=N.length,N.length>0&&X.push({...Z,nodes:N,latest:N[0]}),L.push({...Z,nodes:V,latest:V[0]})}return{agents:L.slice(0,ml),hiddenGroupCount:Math.max(0,L.length-ml),filteredOutGroupsByDate:te,filteredOutSessionsByDate:Y,visibleSessionCount:L.slice(0,ml).reduce((Z,V)=>Z+V.nodes.length,0),archivedGroups:X}},[g,n.nodes]);b.useEffect(()=>{k(!1),S(0)},[g]);const B=b.useMemo(()=>C.reduce(($,ie)=>$+ie.nodes.length,0),[C]),R=b.useMemo(()=>{const $=[];for(const ie of C)for(const W of ie.nodes)$.push({node:W,agentName:ie.agentName});return $.sort((ie,W)=>Zu(ie.node,W.node)),$.slice(0,(E+1)*UN)},[C,E]),G=$=>{f(ie=>{const W=new Set(ie);return W.has($)?W.delete($):W.add($),W})},he=n.nodes.length===0;return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-col card-enter",children:[i.jsx(VN,{open:m,onClose:()=>x(!1),onLaunched:()=>u==null?void 0:u()}),i.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Agents / Chats"}),i.jsxs("span",{className:"chip text-[11px]",children:[M,"/",n.nodes.length]})]}),i.jsx("button",{type:"button",onClick:()=>x(!0),className:"rounded-lg border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[12px] font-medium text-white/65 transition-colors hover:bg-white/[0.08] hover:text-white",children:"Launch"})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-white/45",children:"Offline"}),i.jsx("div",{className:"hidden items-center gap-1 rounded-full border border-white/[0.08] bg-black/30 p-0.5 sm:inline-flex",role:"group","aria-label":"Offline session filter",children:xl.map($=>{const ie=g===$.id;return i.jsx("button",{type:"button",onClick:()=>y($.id),"aria-pressed":ie,className:Ke("rounded-full px-2.5 py-1 text-[10px] font-semibold tracking-[-0.01em] transition-colors",ie?"border border-lime/25 bg-lime/[0.12] text-lime":"border border-transparent text-white/55 hover:bg-white/[0.06] hover:text-white/80"),children:$.label},$.id)})}),i.jsx("label",{htmlFor:"offline-date-filter",className:"sr-only",children:"Offline session filter"}),i.jsx("select",{id:"offline-date-filter",value:g,onChange:$=>y($.target.value),className:"rounded-lg border border-white/[0.1] bg-black/30 px-2 py-1 text-[11px] text-white/75 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30 sm:hidden",children:xl.map($=>i.jsx("option",{value:$.id,children:$.label},$.id))})]})]}),i.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[F.length===0&&!he&&i.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-6 text-center",children:[i.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/25",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),i.jsx("p",{className:"text-[12px] text-white/45",children:"No sessions match the selected offline date filter."})]}),F.length===0&&he&&!u&&i.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-6 text-center",children:[i.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/25",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),i.jsx("p",{className:"text-[12px] text-white/45",children:"No active chats yet. Start a session to see agents here."})]}),F.map($=>{const ie=$.agentId??$.agentName,W=d.has(ie),H=$.nodes.length>1,L=$.latest,X=a===L.id,te=W?[]:$.nodes.slice(1,1+zN),Y=Math.max(0,$.nodes.length-1-te.length),Z=HN(L,j),V=Io($.agentName,L.title,L.lastEventSummary,Z,L);return i.jsxs("div",{className:Ke("overflow-hidden rounded-xl border border-white/[0.06] bg-white/[0.02] transition-all",X&&"border-white/20 bg-white/[0.05]"),children:[i.jsxs("div",{className:"flex items-stretch",children:[i.jsx("button",{onClick:()=>l(L.id),className:"flex-1 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.03]",children:i.jsxs("div",{className:"flex items-start gap-2.5",children:[i.jsxs("div",{className:"relative mt-0.5 flex-shrink-0",children:[i.jsx(Nl,{provider:V.id,size:"sm"}),i.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2",style:{backgroundColor:s0(L.status),borderColor:q.cardBg}})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"truncate text-[13px] font-semibold text-white",children:$.agentName}),i.jsxs("div",{className:"flex items-center gap-2",children:[H&&i.jsxs("span",{className:"rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-[10px] text-white/55",children:[$.nodes.length," sessions"]}),L.progress!==null&&i.jsxs("span",{className:"text-[11px] font-medium text-white/60",children:[Math.round(L.progress),"%"]})]})]}),L.progress!==null&&i.jsx("div",{className:"mt-1 h-0.5 rounded-full bg-white/[0.08]",children:i.jsx("div",{className:"h-0.5 rounded-full",style:{width:`${Math.round(L.progress)}%`,background:`linear-gradient(90deg, ${q.lime}, ${q.teal})`}})}),i.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[10px] text-white/45",children:[i.jsx("span",{className:"rounded-full border px-1.5 py-0.5 uppercase tracking-[0.08em]",style:{borderColor:`${V.accent}66`,color:V.accent,backgroundColor:V.tint},children:V.label}),i.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.02] px-1.5 py-0.5 uppercase tracking-[0.08em] text-white/50",children:L.status}),i.jsx("span",{className:"text-[11px]",children:Gt(L.updatedAt??L.lastEventAt??L.startedAt??Date.now())})]}),i.jsx("p",{className:"mt-1 truncate text-[12px] text-white/78",children:L.title}),i.jsx("p",{className:"mt-0.5 line-clamp-2 text-[11px] leading-relaxed text-white/48",children:Z})]})]})}),H&&i.jsx("button",{type:"button",onClick:()=>G(ie),"aria-label":W?"Expand sessions":"Collapse sessions",className:"flex w-10 items-center justify-center border-l border-white/[0.06] text-white/50 transition-colors hover:bg-white/[0.05] hover:text-white/80",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:Ke("transition-transform",W?"-rotate-90":"rotate-0"),children:i.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),H&&i.jsx("div",{className:Ke("overflow-hidden border-t border-white/[0.06] transition-all",W?"max-h-0 opacity-0":"max-h-[360px] opacity-100"),children:i.jsxs("div",{className:"space-y-1.5 p-2",children:[te.map(N=>{const z=a===N.id,fe=Io(N.agentName,N.title,N.lastEventSummary,N);return i.jsx("button",{onClick:()=>l(N.id),className:Ke("w-full rounded-lg px-2.5 py-2 text-left transition-colors",z?"bg-white/[0.09]":"bg-white/[0.02] hover:bg-white/[0.05]"),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Nl,{provider:fe.id,size:"xs"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-[12px] text-white/90",children:N.title}),i.jsxs("p",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:[fe.label," · ",N.status," ·"," ",Gt(N.updatedAt??N.lastEventAt??N.startedAt??Date.now())]})]}),i.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full",style:{backgroundColor:s0(N.status)},"aria-label":N.status,title:N.status})]})},N.id)}),Y>0&&!W&&i.jsxs("p",{className:"px-1 text-[10px] text-white/40",children:["+",Y," older sessions hidden for smooth rendering"]})]})})]},ie)}),_>0&&i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-[11px] text-white/45",children:["Showing ",ml," most recent agent groups (",_," older groups omitted)."]}),u&&i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] text-[11px] text-white/45",children:[i.jsx("p",{className:"px-3 pt-2 pb-1.5 text-[10px] uppercase tracking-[0.1em] text-white/30",children:"OrgX Agent Roster"}),i.jsx("div",{className:"space-y-1 px-2 pb-2",children:WN.map($=>i.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 opacity-55",children:[i.jsx("div",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md border border-white/[0.08] bg-white/[0.03]",children:i.jsx("span",{className:"text-[9px] font-semibold text-white/50",children:$.name.charAt(0)})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-[11px] font-medium text-white/60",children:$.name}),i.jsx("p",{className:"text-[9px] text-white/35",children:$.role})]}),i.jsx("button",{onClick:u,className:"rounded-md border border-lime/25 bg-lime/10 px-2 py-0.5 text-[9px] font-semibold text-lime transition-colors hover:bg-lime/20",children:"Connect"})]},$.id))})]}),P>0&&i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] text-[11px] text-white/45",children:[i.jsxs("button",{onClick:()=>{k($=>!$),v&&S(0)},className:"flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-white/[0.03]",children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:Ke("transition-transform",v?"rotate-0":"-rotate-90"),children:i.jsx("path",{d:"m6 9 6 6 6-6"})}),i.jsxs("span",{children:[B," archived session",B===1?"":"s",A>0?` across ${A} agent${A===1?"":"s"}`:""]})]}),v&&i.jsxs("div",{className:"space-y-1.5 border-t border-white/[0.06] p-2",children:[R.map(({node:$,agentName:ie})=>{const W=Io($.agentName,$.title,$.lastEventSummary,$);return i.jsxs("button",{onClick:()=>l($.id),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left opacity-60 transition-colors hover:bg-white/[0.05] hover:opacity-80",children:[i.jsx(Nl,{provider:W.id,size:"xs"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"truncate text-[11px] font-medium text-white/70",children:ie}),i.jsx("span",{className:"text-[10px] text-white/35",children:Gt($.updatedAt??$.lastEventAt??$.startedAt??Date.now())})]}),i.jsx("p",{className:"truncate text-[10px] text-white/50",children:$.title}),i.jsx("span",{className:"text-[9px] uppercase tracking-[0.08em] text-white/35",children:$.status})]})]},$.id)}),R.length<B&&i.jsxs("button",{onClick:()=>S($=>$+1),className:"w-full rounded-lg border border-white/[0.08] bg-white/[0.02] px-3 py-1.5 text-[10px] text-white/50 transition-colors hover:bg-white/[0.05]",children:["Load more (",B-R.length," remaining)"]})]})]})]})]})}),qN=/^[0-9a-f-]{20,}$/i;function GN(e){if(e.runId)return e.runId;const n=e.metadata;if(!n)return null;const s=["runId","run_id","sessionId","session_id","agentRunId"];for(const a of s){const l=n[a];if(typeof l=="string"&&l.trim().length>0)return l.trim()}return null}const XN=b.memo(function({session:n,activity:s,initiatives:a=[],onContinueHighestPriority:l,onDispatchSession:u,onPauseSession:d,onResumeSession:f,onCancelSession:m,onCreateCheckpoint:x,onRollbackSession:g,onStartInitiative:y,onStartWorkstream:v}){const[k,E]=b.useState(null),[S,j]=b.useState(null),[F,_]=b.useState(!1),A=b.useMemo(()=>n?s.filter(L=>GN(L)===n.runId).sort((L,X)=>Date.parse(X.timestamp)-Date.parse(L.timestamp)).slice(0,8):[],[s,n]),P=b.useMemo(()=>{var Y;if(!n)return[];const L=[],X=n.initiativeId??n.groupId;if(X){const Z=a.find(V=>V.id===X);Z?L.push({label:"Initiative",value:Z.name}):n.groupLabel&&n.groupLabel.trim().length>0&&L.push({label:"Initiative",value:n.groupLabel})}if(n.workstreamId){let Z=null;for(const V of a){const N=(Y=V.workstreams)==null?void 0:Y.find(z=>z.id===n.workstreamId);if(N){Z=N.name;break}}!Z&&!qN.test(n.workstreamId)&&(Z=n.workstreamId),Z&&L.push({label:"Workstream",value:Z})}const te=n.phase??null;return te&&L.push({label:"Milestone",value:String(te)}),n.title&&L.push({label:"Task",value:n.title}),L},[a,n]),M=b.useMemo(()=>{var Y,Z;if(!n)return null;const L=((Y=A[0])==null?void 0:Y.summary)??((Z=A[0])==null?void 0:Z.description)??null,te=n.lastEventSummary??L??null;return te&&te.trim().length>0?te.trim():null},[A,n]),C=b.useMemo(()=>{var L;return n?Io(n.agentName,n.title,n.lastEventSummary,M,(L=A[0])==null?void 0:L.metadata):Io()},[A,n,M]),B=async(L,X,te)=>{if(!(!te||k)){E(L),j(null);try{await te(),j(`${X} requested.`)}catch(Y){j(Y instanceof Error?Y.message:`${X} failed.`)}finally{E(null)}}};if(!n)return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-col card-enter",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.06] px-4 py-3.5",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Session Detail"}),i.jsx("button",{onClick:()=>_(L=>!L),className:"text-white/40 transition-colors hover:text-white/70","aria-label":F?"Expand session detail":"Collapse session detail",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:Ke("transition-transform",F?"-rotate-90":"rotate-0"),children:i.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),i.jsx("div",{className:Ke("transition-all",F?"max-h-0 overflow-hidden":"min-h-0 flex-1"),children:i.jsxs("div",{className:"space-y-2 overflow-y-auto p-4 text-[12px] text-white/45",children:[i.jsx("p",{children:"Select a session to inspect summary, breadcrumbs, blockers, and recent messages."}),i.jsx("button",{onClick:()=>B("continue-priority","Continue highest priority",l),disabled:!l||!!k,className:"rounded-md border border-white/[0.12] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/70 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:k==="continue-priority"?"Dispatching…":"Continue highest priority"}),S&&i.jsx("p",{className:"text-[11px] text-white/55",children:S})]})})]});const R=n.progress===null?null:Math.round(n.progress),G=n.status.toLowerCase(),he=["running","active","queued","pending"].includes(G),$=["paused","blocked","queued","pending"].includes(G),ie=!["completed","archived","cancelled"].includes(G),W=!["archived","cancelled"].includes(G),H=[{label:"Started",value:n.startedAt?Gt(n.startedAt):"—"},{label:"Updated",value:n.updatedAt?Gt(n.updatedAt):"—"},{label:"ETA",value:n.eta??"—"},{label:"Checkpoints",value:n.checkpointCount!==null&&n.checkpointCount!==void 0?String(n.checkpointCount):"—"}];return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-col card-enter",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.06] px-4 py-3.5",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Session Detail"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"chip text-[11px] uppercase",children:n.status}),i.jsx("button",{onClick:()=>_(L=>!L),className:"text-white/40 transition-colors hover:text-white/70","aria-label":F?"Expand session detail":"Collapse session detail",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:Ke("transition-transform",F?"-rotate-90":"rotate-0"),children:i.jsx("path",{d:"m6 9 6 6 6-6"})})})]})]}),i.jsx("div",{className:Ke("transition-all",F?"max-h-0 overflow-hidden":"min-h-0 flex-1"),children:i.jsxs("div",{className:"space-y-3 overflow-y-auto p-4",children:[i.jsxs("div",{className:"flex items-start gap-2.5",children:[i.jsx(Nl,{provider:C.id,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:n.title}),i.jsxs("p",{className:"mt-0.5 text-[11px] text-white/45",children:[n.agentName??"Unassigned"," · ",C.label]})]})]}),P.length>0&&i.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-2.5",children:[i.jsx("p",{className:"mb-1.5 text-[10px] uppercase tracking-[0.1em] text-white/35",children:"Breadcrumb"}),i.jsx("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:P.map((L,X)=>i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.02] px-1.5 py-0.5 text-white/65",children:L.value}),X<P.length-1&&i.jsx("span",{className:"text-[11px] text-white/40",children:"›"})]},`${L.label}-${L.value}`))})]}),M&&i.jsx("p",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-[12px] leading-relaxed text-white/65",children:M}),R!==null&&i.jsxs("div",{children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] text-white/55",children:[i.jsx("span",{children:"Progress"}),i.jsxs("span",{children:[R,"%"]})]}),i.jsx("div",{className:"h-2 rounded-full bg-white/[0.08]",children:i.jsx("div",{className:"h-2 rounded-full",style:{width:`${R}%`,background:`linear-gradient(90deg, ${q.lime}, ${q.teal})`}})})]}),i.jsx("dl",{className:"grid grid-cols-1 gap-1 text-[11px] text-white/55 sm:grid-cols-2",children:H.map(L=>i.jsxs("div",{children:[i.jsx("dt",{className:"text-white/35",children:L.label}),i.jsx("dd",{className:"font-medium",children:L.value})]},L.label))}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Quick actions"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:()=>B("continue-priority","Continue highest priority",l),disabled:!l||!!k,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:k==="continue-priority"?"Dispatching…":"Continue Priority"}),i.jsx("button",{onClick:()=>B("dispatch-session","Dispatch session",()=>u==null?void 0:u(n)),disabled:!u||!!k,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-2 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:k==="dispatch-session"?"Dispatching…":"Dispatch Session"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Session controls"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:()=>B("pause-session","Pause session",()=>d==null?void 0:d(n)),disabled:!d||!he||!!k,className:"rounded-md border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-[11px] font-semibold text-amber-300 transition-colors hover:bg-amber-400/20 disabled:opacity-45",children:k==="pause-session"?"Pausing…":"Pause"}),i.jsx("button",{onClick:()=>B("resume-session","Resume session",()=>f==null?void 0:f(n)),disabled:!f||!$||!!k,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-2 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:k==="resume-session"?"Resuming…":"Resume"}),i.jsx("button",{onClick:()=>B("checkpoint-session","Checkpoint created",()=>x==null?void 0:x(n)),disabled:!x||!!k,className:"rounded-md border border-sky-400/30 bg-sky-400/10 px-3 py-2 text-[11px] font-semibold text-sky-300 transition-colors hover:bg-sky-400/20 disabled:opacity-45",children:k==="checkpoint-session"?"Creating…":"Checkpoint"}),i.jsx("button",{onClick:()=>B("rollback-session","Rollback requested",()=>g==null?void 0:g(n)),disabled:!g||!W||!!k,className:"rounded-md border border-fuchsia-400/30 bg-fuchsia-400/10 px-3 py-2 text-[11px] font-semibold text-fuchsia-300 transition-colors hover:bg-fuchsia-400/20 disabled:opacity-45",children:k==="rollback-session"?"Rolling back…":"Rollback"}),i.jsx("button",{onClick:()=>B("cancel-session","Cancel session",()=>m==null?void 0:m(n)),disabled:!m||!ie||!!k,className:"col-span-2 rounded-md border border-red-400/30 bg-red-400/10 px-3 py-2 text-[11px] font-semibold text-red-300 transition-colors hover:bg-red-400/20 disabled:opacity-45",children:k==="cancel-session"?"Cancelling…":"Cancel session"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/40",children:"Planning"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:()=>B("start-initiative","Start initiative",y),disabled:!y||!!k,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:k==="start-initiative"?"Creating…":"New initiative"}),i.jsx("button",{onClick:()=>B("start-workstream","Start workstream",()=>v==null?void 0:v(n.initiativeId)),disabled:!v||!!k,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-3 py-2 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:k==="start-workstream"?"Creating…":"New workstream"})]})]})]}),S&&i.jsx("p",{className:"rounded-md border border-white/[0.08] bg-white/[0.02] px-2.5 py-1.5 text-[11px] text-white/55",children:S}),n.blockers.length>0&&i.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3",children:[i.jsx("h3",{className:"mb-1 text-[11px] uppercase tracking-[0.12em] text-red-200/70",children:"Blockers"}),i.jsx("ul",{className:"space-y-1 text-[12px] text-red-100/90",children:n.blockers.map(L=>i.jsxs("li",{children:["• ",L]},L))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-[11px] uppercase tracking-[0.12em] text-white/45",children:"Recent Messages"}),A.length===0&&i.jsx("p",{className:"text-[12px] text-white/45",children:"No recent messages for this run."}),i.jsx("div",{className:"space-y-2",children:A.map(L=>i.jsxs("article",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-2",children:[i.jsx("p",{className:"text-[11px] text-white/85",children:L.title}),(L.summary||L.description)&&i.jsx("p",{className:"mt-0.5 line-clamp-2 text-[11px] text-white/55",children:L.summary??L.description}),i.jsxs("p",{className:"mt-1 text-[10px] text-white/35",children:[new Date(L.timestamp).toLocaleString()," · ",Gt(L.timestamp)]})]},L.id))})]})]})})]})}),YN=[[/opus/i,"Opus"],[/sonnet/i,"Sonnet"],[/haiku/i,"Haiku"],[/kimi/i,"Kimi"],[/gemini/i,"Gemini"],[/gpt-4o/i,"GPT-4o"],[/gpt-4/i,"GPT-4"],[/qwen/i,"Qwen"],[/deepseek/i,"DeepSeek"],[/llama/i,"Llama"]];function Sh(e){if(!e)return"";for(const[s,a]of YN)if(s.test(e))return a;const n=e.split("/");return n[n.length-1]??e}function ZN(e,n=4){let s=e.replace(/^\/Users\/[^/]+\//,"~/").replace(/^~\/Code\//,"").replace(/^~\//,"");const a=s.split("/");return a.length>n&&(s=a.slice(-n).join("/")),s}function Pn(e){let n=e;return n=n.replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,s=>`#${s.slice(0,4)}`),n=n.replace(/(?:anthropic|openrouter|openai)\/[a-z0-9._/-]+/gi,s=>Sh(s)),n=n.replace(/\/Users\/[a-zA-Z0-9_-]+\/[^\s"']+/g,s=>ZN(s)),n}const Ju=/\[([^\]]+)\]\(([^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*\n]+)\*|_([^_\n]+)_/g;function JN(e){try{const n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}function ps(e,n){const s=[];let a=0,l=0;Ju.lastIndex=0;for(let u=Ju.exec(e);u;u=Ju.exec(e)){const[d]=u,f=u.index;f>a&&s.push(e.slice(a,f));const m=`${n}-${l++}`,x=u[1],g=u[2],y=u[3],v=u[4],k=u[5],E=u[6],S=u[7];x&&g&&JN(g)?s.push(i.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:"text-[#D8FFA1] underline decoration-white/35 underline-offset-2 transition hover:text-[#ECFFC6]",children:x},m)):y?s.push(i.jsx("code",{className:"rounded bg-white/[0.08] px-1 py-0.5 font-mono text-[0.93em] text-white/95",children:y},m)):v||k?s.push(i.jsx("strong",{className:"font-semibold text-white",children:v??k},m)):E||S?s.push(i.jsx("em",{className:"italic text-white/90",children:E??S},m)):s.push(d),a=f+d.length}return a<e.length&&s.push(e.slice(a)),s}function eS(e,n){const s=e.split(`
49
+ `),a=[];return s.forEach((l,u)=>{a.push(...ps(l,`${n}-line-${u}`)),u<s.length-1&&a.push(i.jsx("br",{},`${n}-br-${u}`))}),a}function Sl(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(s=>s.trim())}function tS(e){const n=Sl(e);return n.length===0?!1:n.every(s=>/^:?-{3,}:?$/.test(s))}function nS(e){const n=e.trim(),s=n.startsWith(":"),a=n.endsWith(":");return s&&a?"center":a?"right":"left"}function rS(e){const n=e.replace(/\r\n/g,`
50
+ `).split(`
51
+ `),s=[];let a=0;for(;a<n.length;){const l=n[a]??"",u=l.trim();if(!u){a+=1;continue}const d=l.includes("|"),f=n[a+1]??"";if(d&&f.includes("|")&&tS(f)){const v=Sl(l),E=Sl(f).map(j=>nS(j));a+=2;const S=[];for(;a<n.length;){const j=n[a]??"";if(!j.trim()||!j.includes("|"))break;S.push(Sl(j)),a+=1}s.push(i.jsx("div",{className:"overflow-x-auto rounded-xl border border-white/[0.1] bg-black/25",children:i.jsxs("table",{className:"min-w-full border-collapse text-left",children:[i.jsx("thead",{children:i.jsx("tr",{className:"border-b border-white/[0.08] bg-white/[0.03]",children:v.map((j,F)=>i.jsx("th",{className:"px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-white/70",style:{textAlign:E[F]??"left"},children:ps(j,`tbl-h-${a}-${F}`)},`tbl-h-${F}`))})}),i.jsx("tbody",{children:S.map((j,F)=>i.jsx("tr",{className:F<S.length-1?"border-b border-white/[0.06]":void 0,children:v.map((_,A)=>i.jsx("td",{className:"px-3 py-2 text-[13px] leading-relaxed text-white/80 align-top",style:{textAlign:E[A]??"left"},children:ps(j[A]??"",`tbl-r-${a}-${F}-${A}`)},`tbl-r-${F}-c-${A}`))},`tbl-r-${F}`))})]})},`tbl-${a}`));continue}if(u.startsWith("```")){const v=u.slice(3).trim(),k=[];for(a+=1;a<n.length&&!(n[a]??"").trim().startsWith("```");)k.push(n[a]??""),a+=1;a<n.length&&(a+=1),s.push(i.jsxs("div",{className:"rounded-xl border border-white/[0.1] bg-black/40 p-3",children:[v&&i.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-[0.12em] text-white/35",children:v}),i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-white/78",children:i.jsx("code",{children:k.join(`
52
+ `)})})]},`code-${a}`));continue}const m=u.match(/^(#{1,3})\s+(.+)$/);if(m){const v=m[1].length,k=m[2],E=v===1?"text-[16px] font-semibold":v===2?"text-[14px] font-semibold":"text-[13px] font-medium";s.push(i.jsx("p",{className:Ke("tracking-[-0.01em] text-white",E),children:ps(k,`h-${a}`)},`h-${a}`)),a+=1;continue}if(l.match(/^\s*[-*]\s+(.+)$/)){const v=[];for(;a<n.length;){const E=(n[a]??"").match(/^\s*[-*]\s+(.+)$/);if(!E)break;v.push(E[1]),a+=1}s.push(i.jsx("ul",{className:"space-y-1.5 pl-4",children:v.map((k,E)=>i.jsx("li",{className:"list-disc text-[13px] leading-relaxed text-white/78",children:ps(k,`ul-${a}-${E}`)},`ul-${a}-${E}`))},`ul-${a}`));continue}if(l.match(/^\s*\d+\.\s+(.+)$/)){const v=[];for(;a<n.length;){const E=(n[a]??"").match(/^\s*\d+\.\s+(.+)$/);if(!E)break;v.push(E[1]),a+=1}s.push(i.jsx("ol",{className:"space-y-1.5 pl-4",children:v.map((k,E)=>i.jsx("li",{className:"list-decimal text-[13px] leading-relaxed text-white/78",children:ps(k,`ol-${a}-${E}`)},`ol-${a}-${E}`))},`ol-${a}`));continue}const y=[];for(;a<n.length;){const v=n[a]??"",k=v.trim();if(!k||/^(#{1,3})\s+/.test(k)||/^\s*[-*]\s+/.test(v)||/^\s*\d+\.\s+/.test(v)||k.startsWith("```"))break;y.push(v),a+=1}s.push(i.jsx("p",{className:"text-[13px] leading-relaxed text-white/78",children:eS(y.join(`
53
+ `),`p-${a}`)},`p-${a}`))}return s}function _o({text:e,mode:n="inline",className:s}){const a=e.replace(/\r\n/g,`
54
+ `);return a.trim()?n==="inline"?i.jsx("span",{className:s,children:ps(a,"inline")}):i.jsx("div",{className:Ke("space-y-2",s),children:rS(a)}):null}const sS={xs:"w-6 h-6 text-[9px]",sm:"w-8 h-8 text-[10px]",md:"w-10 h-10 text-[12px]"},iS="/orgx/live/",fn=e=>`${iS.replace(/\/+$/,"/")}${e}`,oS={pace:fn("brand/product-orchestrator.png"),eli:fn("brand/engineering-autopilot.png"),mark:fn("brand/launch-captain.png"),sage:fn("brand/pipeline-intelligence.png"),orion:fn("brand/control-tower.png"),dana:fn("brand/design-codex.png"),xandy:fn("brand/product-orchestrator.png"),nova:fn("brand/product-orchestrator.png"),openclaw:fn("brand/openclaw-mark.svg"),openai:fn("brand/openai-mark.svg"),anthropic:fn("brand/anthropic-mark.svg"),orgx:fn("brand/orgx-logo.png")},aS=[{test:/\bpace\b|product|nova|strategist/i,key:"pace"},{test:/\beli\b|engineering|dev-delivery|executor/i,key:"eli"},{test:/\bmark\b|marketing|launch-captain/i,key:"mark"},{test:/\bsage\b|sales|pipeline-intelligence|sales-sage/i,key:"sage"},{test:/\borion\b|operations|ops-orbit|control-tower/i,key:"orion"},{test:/\bdana\b|design|codex/i,key:"dana"},{test:/\bxandy\b|orchestrator|router-all-agents/i,key:"xandy"},{test:/\bholt\b|openclaw/i,key:"openclaw"},{test:/openai|gpt|o[1345]-|codex/i,key:"openai"},{test:/anthropic|claude/i,key:"anthropic"},{test:/\borgx\b/i,key:"orgx"}];function lS(...e){const n=e.map(s=>typeof s=="string"?s.trim():"").filter(Boolean).join(" ").toLowerCase();if(!n)return null;for(const s of aS)if(s.test.test(n))return oS[s.key];return null}function mi({name:e,size:n="xs",hint:s,src:a}){const l=L1(e),[u,d]=b.useState(!1),f=b.useMemo(()=>a&&a.trim()?a:lS(e,s),[s,e,a]),m=!!(f&&!u);return i.jsx("div",{className:`${sS[n]} overflow-hidden rounded-full flex items-center justify-center font-semibold flex-shrink-0`,style:{backgroundColor:`${l}20`,color:l,border:`1px solid ${l}30`},children:m?i.jsx("img",{src:f??void 0,alt:e,className:"h-full w-full rounded-full object-cover",onError:()=>d(!0),loading:"lazy"}):R1(e)})}const cS={artifact_created:"⬦",run_failed:"✗",run_started:"▶",run_completed:"✓",decision_requested:"❓",decision_resolved:"✓",delegation:"→",blocker_created:"⚠",milestone_completed:"★"},uS={run_started:q.teal,run_completed:q.lime,run_failed:q.red,artifact_created:q.cyan,decision_requested:q.amber,decision_resolved:q.lime,handoff_requested:q.iris,handoff_claimed:q.teal,handoff_fulfilled:q.lime,blocker_created:q.red,milestone_completed:q.cyan,delegation:q.iris};function dS(e){try{return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}}function hS(e){var s;let n=0;for(const a of e){const l=(s=a.metadata)==null?void 0:s.costTotal;typeof l=="number"&&(n+=l)}return n<=0?null:n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const fS=b.memo(function({items:n,session:s,agentName:a,onBack:l}){const u=b.useMemo(()=>[...n].sort((x,g)=>Date.parse(x.timestamp)-Date.parse(g.timestamp)),[n]),d=b.useMemo(()=>hS(u),[u]),f=b.useMemo(()=>{if(u.length<2)return null;const x=Date.parse(u[0].timestamp),y=Date.parse(u[u.length-1].timestamp)-x;return y<6e4?`${Math.round(y/1e3)}s`:y<36e5?`${Math.round(y/6e4)}m`:`${(y/36e5).toFixed(1)}h`},[u]),m=(s==null?void 0:s.title)??a??"Session";return i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[i.jsxs("button",{onClick:l,className:"mb-2 flex items-center gap-1.5 text-[11px] text-white/50 transition-colors hover:text-white/80",children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m15 18-6-6 6-6"})}),"Back to timeline"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:q.lime,boxShadow:`0 0 12px ${q.lime}55`}}),i.jsx("h3",{className:"text-[14px] font-semibold text-white",children:Pn(m)})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[10px] text-white/45",children:[a&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.1] px-1 py-0.5",children:[i.jsx(mi,{name:a,hint:(s==null?void 0:s.id)??(s==null?void 0:s.runId)??null,size:"xs"}),i.jsx("span",{children:a})]}),i.jsxs("span",{children:[u.length," turn",u.length!==1?"s":""]}),f&&i.jsx("span",{children:f}),d&&i.jsx("span",{className:"text-white/35",children:d}),(s==null?void 0:s.status)&&i.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] uppercase tracking-wider",style:{backgroundColor:s.status==="running"?`${q.lime}20`:s.status==="failed"?`${q.red}20`:`${q.teal}20`,color:s.status==="running"?q.lime:s.status==="failed"?q.red:q.teal},children:s.status})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[i.jsx(dr,{mode:"popLayout",children:i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute left-[7px] top-3 bottom-3 w-px",style:{backgroundColor:`${q.iris}25`}}),i.jsx("div",{className:"space-y-1",children:u.map((x,g)=>{const y=uS[x.type]??q.iris,v=cS[x.type]??"→",k=Sh(x.description),E=Pn(x.title??""),S=x.type==="run_failed",j=x.type==="artifact_created",F=x.type==="decision_requested"||x.type==="decision_resolved";return i.jsxs(Oe.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.2,delay:g*.02},className:"group relative flex items-start gap-2.5 rounded-lg py-1.5 pl-0 pr-2 transition-colors hover:bg-white/[0.02]",children:[i.jsx("span",{className:"relative z-10 mt-1.5 flex h-[15px] w-[15px] flex-shrink-0 items-center justify-center rounded-full text-[8px]",style:{backgroundColor:`${y}20`,color:y,border:`1px solid ${y}40`},children:v}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:`text-[12px] leading-snug ${S?"text-red-400":F?"text-amber-300":j?"text-cyan-300":"text-white/85"}`,children:E}),x.summary&&x.summary!==E&&i.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-white/40",children:Pn(x.summary)})]}),i.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-0.5 pt-0.5",children:[i.jsx("span",{className:"text-[10px] text-white/35",children:dS(x.timestamp)}),k&&i.jsx("span",{className:"text-[9px] text-white/25",children:k})]})]},x.id)})})]})}),u.length===0&&i.jsx("div",{className:"flex flex-col items-center gap-2 py-8 text-center",children:i.jsx("p",{className:"text-[12px] text-white/40",children:"No activity in this session yet."})}),u.length>0&&i.jsxs("div",{className:"mt-4 rounded-lg border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-[10px] text-white/35",children:[u.length," turn",u.length!==1?"s":"",f?` over ${f}`:"",d?` · ${d}`:""," · ",Gt(u[u.length-1].timestamp)]})]})]})}),pS={initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.98}},mS=480,ed={all:"All",messages:"Messages",artifacts:"Artifacts",decisions:"Decisions"},xS={run_started:q.teal,run_completed:q.lime,run_failed:q.red,artifact_created:q.cyan,decision_requested:q.amber,decision_resolved:q.lime,handoff_requested:q.iris,handoff_claimed:q.teal,handoff_fulfilled:q.lime,blocker_created:q.red,milestone_completed:q.cyan,delegation:q.iris};function gS(e){if(!e)return 0;const n=Date.parse(e);return Number.isFinite(n)?n:0}function Cy(e){if(!e)return"";const n=[];for(const[s,a]of Object.entries(e))typeof a=="string"&&(s.toLowerCase().includes("type")||s.toLowerCase().includes("kind")||s.toLowerCase().includes("summary")||s.toLowerCase().includes("message")||s.toLowerCase().includes("artifact")||s.toLowerCase().includes("decision")||s.toLowerCase().includes("run")||s.toLowerCase().includes("title")||s.toLowerCase().includes("task")||s.toLowerCase().includes("workstream")||s.toLowerCase().includes("milestone"))&&n.push(a);return n.join(" ")}function yS(e){if(e.runId)return e.runId;const n=e.metadata;if(!n)return null;const s=["runId","run_id","sessionId","session_id","agentRunId"];for(const a of s){const l=n[a];if(typeof l=="string"&&l.trim().length>0)return l.trim()}return null}function vS(e){return e?["artifact","artifacts","artifact_type","artifactType","output","outputs","result","results","payload","toolOutput","toolOutputs","toolResult","toolResults"].some(s=>s in e):!1}function wS(e){const n=e.metadata,s=Cy(e.metadata),a=[e.type,e.kind,e.summary,e.title,e.description,s].filter(d=>typeof d=="string"&&d.trim().length>0).join(" ").toLowerCase();return e.type==="artifact_created"||vS(n)||/artifact|deliverable|output payload/.test(a)?"artifact":e.type==="decision_requested"||e.type==="decision_resolved"||e.decisionRequired===!0||/decision|approve|approval|reject|review request|request changes/.test(a)?"decision":"message"}function li(e){return e.split("_").join(" ")}function bS(e){const n=new Date(e);if(Number.isNaN(n.getTime()))return"unknown";const s=new Date(n.getFullYear(),n.getMonth(),n.getDate());return String(s.getTime())}function kS(e){const n=Number(e);if(!Number.isFinite(n))return"Unknown day";const s=new Date(n),a=new Date,l=new Date(a.getFullYear(),a.getMonth(),a.getDate()),u=new Date(l);return u.setDate(l.getDate()-1),s.getTime()===l.getTime()?"Today":s.getTime()===u.getTime()?"Yesterday":s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:s.getFullYear()===a.getFullYear()?void 0:"numeric"})}function td(e){return e==="artifact"?"artifact":e==="decision"?"decision":"message"}function jo(e){return e==="artifact"?q.cyan:e==="decision"?q.amber:q.teal}function i0(e){if(!e||Object.keys(e).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return null}}function jS(e){if(!e)return null;const n=e.metadata;if(!n||typeof n!="object")return null;const s=["artifact","artifacts","output","outputs","result","results","payload","toolOutput","toolOutputs","toolResult","toolResults"];for(const a of s){const l=n[a];if(l!=null)return{source:a,value:l}}return e.type==="artifact_created"?{source:"metadata",value:n}:null}function Ay(e){if(typeof e=="string")return i.jsx(_o,{mode:"block",text:e,className:"text-[13px] leading-relaxed text-white/82"});if(typeof e=="number"||typeof e=="boolean")return i.jsx("p",{className:"text-[13px] text-white/82",children:String(e)});if(Array.isArray(e))return i.jsx("div",{className:"space-y-1.5",children:e.map((n,s)=>i.jsx("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] px-2.5 py-2",children:Ay(n)},`artifact-list-${s}`))});if(e&&typeof e=="object"){const n=Object.entries(e);return i.jsx("dl",{className:"space-y-1.5",children:n.map(([s,a])=>i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] px-2.5 py-2",children:[i.jsx("dt",{className:"text-[10px] uppercase tracking-[0.1em] text-white/45",children:Pn(s)}),i.jsx("dd",{className:"mt-1 text-[13px] text-white/82",children:typeof a=="string"||typeof a=="number"||typeof a=="boolean"?String(a):Array.isArray(a)?`${a.length} item${a.length===1?"":"s"}`:a&&typeof a=="object"?`${Object.keys(a).length} field${Object.keys(a).length===1?"":"s"}`:"—"})]},s))})}return i.jsx("p",{className:"text-[13px] text-white/55",children:"No artifact payload."})}function rr(e){if(!e)return null;const n=e.trim();if(!n)return null;const s=Sh(n);return s&&s!==n&&/^[a-z0-9._/-]+$/i.test(n)?s:Pn(n)}function NS(e){if(!e)return null;const n=e.metadata;if(!n||typeof n!="object")return null;const s=typeof n.source=="string"?n.source.trim():"",a=typeof n.turnId=="string"?n.turnId.trim():"";if(s!=="local_openclaw"||!a)return null;const l=typeof n.sessionKey=="string"&&n.sessionKey.trim().length>0?n.sessionKey.trim():null;return{turnId:a,sessionKey:l,runId:e.runId??null}}function o0(e){return e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/\*([^*\n]+)\*/g,"$1").replace(/_([^_\n]+)_/g,"$1")}function SS(e,n){const a=(rr(n??e.summary)??rr(e.description)??Pn(e.title||li(e.type))).replace(/\r\n/g,`
55
+ `).replace(/```[\s\S]*?```/g," ").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s*[-*]\s+/gm,"").replace(/\s+/g," ").trim(),l=a.split(`
56
+ `).map(d=>o0(d).trim()).filter(d=>d.length>0&&!/^\|?[:\-| ]+\|?$/.test(d));let u=l[0]??o0(a);return u.length<24&&l.length>1&&(u=`${u} ${l[1]}`.trim()),u.length>108?`${u.slice(0,107).trimEnd()}…`:u}const CS=b.memo(function({activity:n,sessions:s,selectedRunIds:a,selectedSessionLabel:l=null,onClearSelection:u,onFocusRunId:d}){var gt;const[f,m]=b.useState("all"),[x,g]=b.useState(!1),[y,v]=b.useState(""),[k,E]=b.useState("newest"),[S,j]=b.useState(null),[F,_]=b.useState(null),[A,P]=b.useState(1),[M,C]=b.useState("structured"),[B,R]=b.useState(null),[G,he]=b.useState("feed"),[$,ie]=b.useState(null),[W,H]=b.useState(null),[L,X]=b.useState(!1),te=b.useMemo(()=>{const re=new Map;for(const ne of s)re.set(ne.runId,ne.title),re.set(ne.id,ne.title);return re},[s]),Y=b.useMemo(()=>{const re=new Map;for(const ne of s)ne.status&&(re.set(ne.runId,ne.status),re.set(ne.id,ne.status));return re},[s]),Z=b.useMemo(()=>n.map(re=>{const ne=yS(re),ve=wS(re),Ae=[re.title,re.description,re.summary,re.agentName,Cy(re.metadata)].filter(Xe=>typeof Xe=="string"&&Xe.length>0).join(" ").toLowerCase();return{item:re,bucket:ve,runId:ne,timestampEpoch:gS(re.timestamp),searchText:Ae}}),[n]),V=b.useMemo(()=>{let re=0;for(const ne of Z)re=Math.max(re,ne.timestampEpoch);return re<=0?!1:Date.now()-re<6e4},[Z]),N=b.useMemo(()=>new Set(a.filter(re=>re&&re.trim().length>0)),[a]),z=N.size>0,fe=b.useMemo(()=>{if(!z)return null;for(const re of N){const ne=s.find(ve=>ve.runId===re||ve.id===re);if(ne)return ne}return null},[z,N,s]),{filtered:se,truncatedCount:xe}=b.useMemo(()=>{const re=[];let ne=0;const ve=y.trim().toLowerCase();for(const Xe of Z){const yt=Xe.runId;if(z&&(!yt||!N.has(yt)))continue;const vt=Xe.bucket;if(!(f==="messages"&&vt!=="message")&&!(f==="artifacts"&&vt!=="artifact")&&!(f==="decisions"&&vt!=="decision")){if(ve.length>0){const vn=yt?te.get(yt)??yt:"";if(!`${Xe.searchText} ${vn.toLowerCase()}`.includes(ve))continue}re.length<mS?re.push(Xe):ne+=1}}return{filtered:[...re].sort((Xe,yt)=>{const vt=yt.timestampEpoch-Xe.timestampEpoch;return k==="newest"?vt:-vt}),truncatedCount:ne}},[f,Z,z,y,te,N,k]),de=b.useMemo(()=>{const re=new Map;for(const ve of se){const Ae=bS(ve.item.timestamp),Xe=re.get(Ae);Xe?Xe.push(ve):re.set(Ae,[ve])}return Array.from(re.keys()).sort((ve,Ae)=>{const Xe=Number(Ae)-Number(ve);return k==="newest"?Xe:-Xe}).map(ve=>({key:ve,label:kS(ve),items:re.get(ve)??[]}))},[se,k]),ge=b.useMemo(()=>S?se.findIndex(re=>re.item.id===S):-1,[S,se]),ae=ge>=0?se[ge]:null,_e=b.useMemo(()=>jS((ae==null?void 0:ae.item)??null),[ae]),Ue=b.useMemo(()=>i0((ae==null?void 0:ae.item.metadata)??void 0),[ae]),ee=b.useMemo(()=>{const re=rr(B);return re||(rr(ae==null?void 0:ae.item.summary)??rr(ae==null?void 0:ae.item.description))},[B,ae]),Ce=b.useCallback(()=>{j(null)},[]);b.useEffect(()=>{if(!F)return;const re=window.setTimeout(()=>_(null),2e3);return()=>window.clearTimeout(re)},[F]);const De=b.useCallback(async(re,ne)=>{if(ne)try{await navigator.clipboard.writeText(ne),_(`${re} copied`)}catch{_("Copy failed")}},[]);b.useEffect(()=>{C("structured")},[S]),b.useEffect(()=>{R(null),he("feed");const re=NS((ae==null?void 0:ae.item)??null);if(!re)return;const ne=new URLSearchParams({turnId:re.turnId});re.sessionKey&&ne.set("sessionKey",re.sessionKey),re.runId&&ne.set("run",re.runId);const ve=new AbortController;return fetch(`/orgx/api/live/activity/detail?${ne.toString()}`,{method:"GET",signal:ve.signal}).then(async Ae=>{var yt;return Ae.ok?((yt=(await Ae.json()).detail)==null?void 0:yt.summary)??null:(Ae.status===404&&he("missing"),null)}).then(Ae=>{typeof Ae=="string"&&Ae.trim().length>0?(R(Ae),he("local")):he("missing")}).catch(Ae=>{Ae instanceof DOMException&&Ae.name==="AbortError"||he("missing")}),()=>ve.abort()},[ae]),b.useEffect(()=>{ie(null),H(null);const re=ae==null?void 0:ae.item;if(!re||L)return;const ne=(B??re.summary??re.description??re.title??"").trim();if(!ne)return;const ve=new AbortController;return fetch("/orgx/api/live/activity/headline",{method:"POST",headers:{"Content-Type":"application/json"},signal:ve.signal,body:JSON.stringify({text:ne,title:re.title??null,type:re.type})}).then(async Ae=>Ae.ok?await Ae.json():((Ae.status===404||Ae.status===405)&&X(!0),null)).then(Ae=>{const Xe=Ae==null?void 0:Ae.headline;typeof Xe=="string"&&Xe.trim().length>0&&(X(!1),ie(Xe.trim()),H((Ae==null?void 0:Ae.source)??null))}).catch(Ae=>{Ae instanceof DOMException&&Ae.name}),()=>ve.abort()},[ae,B,L]);const Te=b.useCallback(re=>{var Ae;if(se.length===0)return;const ve=((ge>=0?ge:0)+re+se.length)%se.length;P(re),j(((Ae=se[ve])==null?void 0:Ae.item.id)??null)},[ge,se]);b.useEffect(()=>{S&&(ge>=0||j(null))},[ge,S]),b.useEffect(()=>{if(!S)return;const re=ne=>{ne.key==="ArrowRight"||ne.key.toLowerCase()==="l"?(ne.preventDefault(),Te(1)):(ne.key==="ArrowLeft"||ne.key.toLowerCase()==="h")&&(ne.preventDefault(),Te(-1))};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[S,Te]);const Ze=N.size===1,Ge=Ze?[...N][0]:null,yn=Ge?s.find(re=>re.runId===Ge||re.id===Ge)??null:null,sn=b.useMemo(()=>Ze?Z.filter(re=>re.runId&&N.has(re.runId)).map(re=>re.item):[],[Ze,Z,N]),Kn=(re,ne)=>{const ve=re.item,Ae=xS[ve.type]??q.iris,Xe=k==="newest"&&ne<2,yt=re.bucket,vt=re.runId,vn=vt?te.get(vt)??Pn(vt):"Workspace",Mn=vt?Y.get(vt)??null:null,Nt=Pn(ve.title??""),Fn=rr(ve.summary),Is=rr(ve.description),Gr=jo(yt),_s=td(yt),Li=i0(ve.metadata),fr=new Date(ve.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return i.jsx(Oe.button,{type:"button",variants:pS,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.4,0,.2,1]},whileHover:{y:-1.5},whileTap:{scale:.995},onClick:()=>{P(1),j(ve.id)},className:"group w-full rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2.5 text-left transition-colors hover:border-white/[0.14] hover:bg-white/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#BFFF00]/45","aria-label":`Open activity details for ${Nt||li(ve.type)}`,children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("div",{className:"mt-0.5 flex flex-col items-center gap-1.5",children:[i.jsx(mi,{name:ve.agentName??"OrgX",hint:`${ve.agentId??""} ${vn} ${ve.title??""}`,size:"xs"}),i.jsx("span",{className:Ke("h-2.5 w-2.5 rounded-full",Xe&&"pulse-soft"),style:{backgroundColor:Ae,boxShadow:`0 0 16px ${Ae}77`}})]}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"line-clamp-2 break-words text-[13px] font-semibold leading-snug text-white/90",children:Nt||Pn(ve.title||li(ve.type))}),i.jsxs("p",{className:"mt-0.5 text-[11px] text-white/45",children:[ve.agentName??"OrgX",Mn?` · ${Mn}`:""]})]}),i.jsxs("div",{className:"flex flex-col items-end gap-1 text-right",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.1em] text-white/35",children:li(ve.type)}),i.jsx("span",{className:"text-[11px] text-white/55",children:fr})]})]}),(Fn||Is)&&i.jsx("div",{className:"mt-1 line-clamp-3 text-[11px] leading-relaxed text-white/55",children:i.jsx(_o,{mode:"inline",text:Fn??Is??""})}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 text-[10px]",children:[i.jsx("span",{className:"rounded-full border px-1.5 py-0.5 uppercase tracking-[0.08em]",style:{borderColor:`${Gr}66`,color:Gr},children:_s}),i.jsx("span",{className:"rounded-full border border-white/[0.12] px-1.5 py-0.5 text-white/55",children:vn}),Mn&&i.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.02] px-1.5 py-0.5 uppercase tracking-[0.08em] text-white/50",children:Mn}),i.jsx("span",{className:"text-white/50",children:Gt(ve.timestamp)}),Li&&i.jsx("span",{className:"text-white/35",children:"meta"})]})]})]})},ve.id)};return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-col card-enter",children:[Ze&&sn.length>0?i.jsx(fS,{items:sn,session:yn,agentName:((gt=sn[0])==null?void 0:gt.agentName)??null,onBack:u}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Activity"}),i.jsx("span",{className:"chip",children:se.length}),xe>0&&i.jsxs("span",{className:"chip text-white/60",children:["+",xe," hidden"]}),i.jsx("span",{className:Ke("h-1.5 w-1.5 rounded-full",V&&"pulse-soft"),style:{backgroundColor:q.lime},"aria-label":"Live",title:V?"New activity within the last minute":"Live activity feed"}),z&&i.jsxs("button",{onClick:u,className:"chip inline-flex min-w-0 items-center gap-2","aria-label":"Clear session filter",children:[i.jsx(mi,{name:(fe==null?void 0:fe.agentName)??"OrgX",hint:l??null,size:"xs"}),i.jsxs("span",{className:"min-w-0 truncate",children:["Session",l?`: ${l}`:""]}),i.jsx("span",{className:"ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full border border-white/[0.12] bg-white/[0.04] text-[10px] text-white/60",children:"×"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>E(re=>re==="newest"?"oldest":"newest"),className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-3 py-1 text-[11px] font-medium text-white/70 transition-colors hover:bg-white/[0.08] hover:text-white","aria-label":k==="newest"?"Sort oldest first":"Sort newest first",children:k==="newest"?"Newest":"Oldest"}),i.jsx("button",{type:"button",onClick:()=>g(re=>!re),className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-3 py-1 text-[11px] font-medium text-white/70 transition-colors hover:bg-white/[0.08] hover:text-white","aria-pressed":x,children:x?"Expand":"Compact"})]})]}),i.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row sm:items-center",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-white/35",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("path",{d:"m20 20-3.5-3.5"})]}),i.jsx("input",{value:y,onChange:re=>v(re.target.value),placeholder:"Search activity...",className:"w-full rounded-lg border border-white/[0.1] bg-black/30 py-1.5 pl-9 pr-2 text-[12px] text-white/80 placeholder:text-white/35 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/30","aria-label":"Search activity"})]}),i.jsx("div",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.12] bg-black/30 p-0.5",role:"group","aria-label":"Activity filters",children:Object.keys(ed).map(re=>{const ne=f===re;return i.jsx("button",{type:"button",onClick:()=>m(re),"aria-pressed":ne,className:Ke("rounded-full px-3 py-1 text-[10px] font-semibold transition-colors",ne?"border border-lime/25 bg-lime/[0.12] text-lime":"border border-transparent text-white/60 hover:bg-white/[0.06] hover:text-white/80"),children:ed[re]},re)})})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[se.length===0&&i.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-6 text-center",children:[i.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/25",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),i.jsx("p",{className:"text-[12px] text-white/45",children:z?`No ${ed[f].toLowerCase()} for the selected session.`:"No matching activity right now."}),z&&i.jsx("button",{onClick:u,className:"rounded-md border border-white/[0.12] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/70 transition-colors hover:bg-white/[0.08]",children:"Show all sessions"})]}),se.length>0&&i.jsxs("div",{className:"space-y-4",children:[de.map(re=>{const ne=x?re.items.slice(0,4):re.items;return i.jsxs("section",{children:[i.jsx("h3",{className:"mb-2.5 border-b border-white/[0.06] pb-1.5 text-[11px] uppercase tracking-[0.12em] text-white/35",children:re.label}),i.jsx(dr,{mode:"popLayout",children:i.jsx("div",{className:"space-y-2",children:ne.map((ve,Ae)=>Kn(ve,Ae))})}),x&&re.items.length>ne.length&&i.jsxs("p",{className:"mt-1.5 text-[11px] text-white/35",children:["+",re.items.length-ne.length," more"]})]},re.key)}),xe>0&&i.jsxs("p",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-[11px] text-white/45",children:["Showing latest ",se.length," events (",xe," older events omitted for smooth rendering)."]})]})]})]}),i.jsx(_i,{open:ae!==null,onClose:Ce,maxWidth:"max-w-3xl",children:ae&&i.jsxs("div",{className:"relative flex h-[100dvh] w-full min-h-0 flex-col sm:h-[86vh] sm:max-h-[86vh]",children:[i.jsx("div",{className:"absolute inset-x-0 top-0 h-20 bg-gradient-to-b from-lime/10 via-cyan/5 to-transparent"}),i.jsxs("div",{className:"relative z-10 flex items-center justify-between border-b border-white/[0.06] px-5 py-4 sm:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.12em] text-white/40",children:"Activity Detail"}),i.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[i.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:jo(ae.bucket),boxShadow:`0 0 16px ${jo(ae.bucket)}77`}}),i.jsxs("span",{className:"text-[12px] text-white/70",children:[td(ae.bucket)," · ",ge+1,"/",se.length]}),F&&i.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] text-white/60",children:F})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[ae.runId&&d&&i.jsx("button",{type:"button",onClick:()=>{d(ae.runId),Ce()},className:"rounded-full border border-lime/25 bg-lime/10 px-3 py-1 text-[11px] font-semibold text-lime transition hover:bg-lime/20",children:"Focus session"}),ae.runId&&i.jsx("button",{type:"button",onClick:()=>void De("Run id",ae.runId??""),className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2.5 py-1 text-[11px] text-white/70 transition hover:bg-white/[0.1]","aria-label":"Copy run id",children:"Copy run"}),ae.item.agentId&&i.jsx("button",{type:"button",onClick:()=>void De("Agent id",ae.item.agentId??""),className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2.5 py-1 text-[11px] text-white/70 transition hover:bg-white/[0.1]","aria-label":"Copy agent id",children:"Copy agent"}),i.jsx("button",{type:"button",onClick:()=>void De("Event id",ae.item.id),className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2.5 py-1 text-[11px] text-white/70 transition hover:bg-white/[0.1]","aria-label":"Copy event id",children:"Copy event"}),i.jsx("button",{type:"button",onClick:()=>Te(-1),className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2.5 py-1 text-[11px] text-white/70 transition hover:bg-white/[0.1]","aria-label":"Previous activity item",children:"← Prev"}),i.jsx("button",{type:"button",onClick:()=>Te(1),className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2.5 py-1 text-[11px] text-white/70 transition hover:bg-white/[0.1]","aria-label":"Next activity item",children:"Next →"}),i.jsx("button",{type:"button",onClick:Ce,className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2 py-1 text-[11px] text-white/60 transition hover:bg-white/[0.1] hover:text-white/90","aria-label":"Close activity detail",children:"Esc"})]})]}),i.jsx("div",{className:"relative min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-5 pb-5 pt-4 sm:px-6",children:i.jsx(dr,{mode:"wait",custom:A,children:i.jsx(Oe.section,{custom:A,initial:{opacity:0,x:A*44,scale:.985},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:A*-32,scale:.985},transition:{duration:.28,ease:[.16,1,.3,1]},className:"min-h-full w-full overscroll-contain",children:i.jsxs("div",{className:"space-y-4 pb-1",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[20px] font-semibold tracking-[-0.02em] text-white whitespace-pre-wrap break-words",children:$||SS(ae.item,B)||Pn(ae.item.title||li(ae.item.type))}),i.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2 text-[12px] text-white/45",children:[new Date(ae.item.timestamp).toLocaleString()," · ",Gt(ae.item.timestamp),W==="llm"&&i.jsx("span",{className:"text-white/35",children:"· AI title"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[i.jsx("span",{className:"rounded-full border px-2 py-0.5 uppercase tracking-[0.1em]",style:{borderColor:`${jo(ae.bucket)}55`,color:jo(ae.bucket)},children:td(ae.bucket)}),i.jsx("span",{className:"rounded-full border border-white/[0.12] px-2 py-0.5 text-white/65",children:li(ae.item.type)}),ae.item.agentName&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.12] px-1.5 py-0.5 text-white/65",children:[i.jsx(mi,{name:ae.item.agentName,hint:`${ae.item.agentId??""} ${ae.item.title??""}`,size:"xs"}),i.jsx("span",{children:ae.item.agentName})]}),ae.runId&&i.jsx("span",{className:"rounded-full border border-white/[0.12] px-2 py-0.5 text-white/65",children:te.get(ae.runId)??Pn(ae.runId)})]}),ee&&i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] p-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.11em] text-white/45",children:"Summary"}),G==="missing"&&i.jsx("p",{className:"mt-1 text-[11px] text-amber-200/75",children:"Full local turn transcript was unavailable; showing the event summary payload."}),i.jsx(_o,{mode:"block",text:ee,className:"mt-1.5 text-[14px] leading-relaxed text-white/82"})]}),rr(ae.item.description)&&i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-black/25 p-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.11em] text-white/45",children:"Details"}),i.jsx(_o,{mode:"block",text:rr(ae.item.description)??"",className:"mt-1.5 text-[13px] leading-relaxed text-white/75"})]}),_e&&i.jsxs("div",{className:"rounded-xl border border-cyan-400/20 bg-cyan-500/[0.06] p-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.11em] text-cyan-100/85",children:"Artifact Output"}),i.jsxs("div",{className:"inline-flex rounded-full border border-white/[0.12] bg-black/30 p-0.5 text-[11px]",children:[i.jsx("button",{type:"button",onClick:()=>C("structured"),"aria-pressed":M==="structured",className:`rounded-full px-2.5 py-0.5 transition-colors ${M==="structured"?"bg-white/[0.12] text-white":"text-white/55 hover:text-white/80"}`,children:"Structured"}),i.jsx("button",{type:"button",onClick:()=>C("json"),"aria-pressed":M==="json",className:`rounded-full px-2.5 py-0.5 transition-colors ${M==="json"?"bg-white/[0.12] text-white":"text-white/55 hover:text-white/80"}`,children:"JSON"})]})]}),i.jsxs("p",{className:"mt-1 text-[10px] text-cyan-100/55",children:["Source: ",_e.source]}),i.jsx("div",{className:"mt-2",children:M==="structured"?Ay(_e.value):i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-white/70",children:JSON.stringify(_e.value,null,2)})})]}),Ue&&i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-black/35 p-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.11em] text-white/45",children:"Metadata"}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-white/65",children:Ue})]})]})},ae.item.id)})}),i.jsx("div",{className:"border-t border-white/[0.06] px-5 py-2.5 text-[11px] text-white/40 sm:px-6",children:"Keyboard: ← previous · → next · Esc close"})]})})]})});function AS(e){return e>=15?{border:q.red,glow:`0 0 16px ${q.red}20`}:e>=5?{border:q.amber,glow:`0 0 12px ${q.amber}18`}:{border:q.teal,glow:"none"}}const ES=b.memo(function({decisions:n,onApproveDecision:s,onApproveAll:a}){const[l,u]=b.useState(!1),[d,f]=b.useState(new Set),[m,x]=b.useState(new Set),[g,y]=b.useState(null),v=b.useMemo(()=>[...n].sort((M,C)=>{if(M.waitingMinutes!==C.waitingMinutes)return C.waitingMinutes-M.waitingMinutes;const B=Date.parse(M.requestedAt??M.updatedAt??""),R=Date.parse(C.requestedAt??C.updatedAt??""),G=Number.isFinite(B)?B:0;return(Number.isFinite(R)?R:0)-G}),[n]);b.useEffect(()=>{x(M=>{const C=new Set(v.map(R=>R.id)),B=new Set;for(const R of M)C.has(R)&&B.add(R);return B})},[v]);const k=m.size,E=v.length>0&&k===v.length,S=M=>{x(C=>{const B=new Set(C);return B.has(M)?B.delete(M):B.add(M),B})},j=()=>{x(M=>v.length===0?M:M.size===v.length?new Set:new Set(v.map(C=>C.id)))},F=async()=>{if(!(v.length===0||l)){y(null),u(!0);try{const M=await a();M.failed>0?y(`Approved ${M.updated}; ${M.failed} failed.`):M.updated>0?y(`Approved ${M.updated} decision${M.updated===1?"":"s"}.`):y("No decisions were updated."),x(new Set)}catch(M){y(M instanceof Error?M.message:"Bulk approval failed.")}finally{u(!1)}}},_=async()=>{if(k===0||l)return;y(null),u(!0);let M=0,C=0;try{const B=v.map(R=>R.id).filter(R=>m.has(R));for(const R of B){f(G=>new Set(G).add(R));try{const G=await s(R);M+=G.updated,C+=G.failed}catch{C+=1}finally{f(G=>{const he=new Set(G);return he.delete(R),he})}}C>0?y(`Approved ${M}; ${C} failed.`):y(`Approved ${M} selected decision${M===1?"":"s"}.`),x(new Set)}finally{u(!1)}},A=async M=>{if(!(d.has(M)||l)){y(null),f(C=>{const B=new Set(C);return B.add(M),B});try{const C=await s(M);C.failed>0?y(`Approval failed for ${C.failed} decision.`):C.updated>0&&y("Decision approved.")}catch(C){y(C instanceof Error?C.message:"Decision approval failed.")}finally{f(C=>{const B=new Set(C);return B.delete(M),B}),x(C=>{if(!C.has(M))return C;const B=new Set(C);return B.delete(M),B})}}},P=g!==null&&!g.toLowerCase().includes("fail");return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-col card-enter",children:[i.jsxs("div",{className:"space-y-2 border-b border-white/[0.06] px-4 py-3.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Decisions"}),i.jsx("p",{className:"text-[12px] text-white/45",children:"Select multiple items to bulk review and approve"})]}),i.jsx("button",{onClick:F,disabled:v.length===0||l,className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold transition-colors",style:{backgroundColor:v.length===0||l?"rgba(255,255,255,0.08)":q.lime,color:v.length===0||l?"rgba(255,255,255,0.45)":"#000"},children:l?"Approving…":`Approve all (${v.length})`})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{onClick:j,disabled:v.length===0||l,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-2.5 py-1.5 text-[11px] text-white/70 transition-colors hover:bg-white/[0.07] disabled:opacity-45",children:E?"Clear all":"Select all"}),i.jsx("button",{onClick:_,disabled:k===0||l,className:"rounded-md border border-lime/25 bg-lime/10 px-2.5 py-1.5 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:l?"Approving…":`Approve selected (${k})`}),i.jsx("span",{className:"text-[11px] text-white/45",children:k>0?`${k} selected`:"No selection"})]})]}),i.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto p-3",children:[v.length===0&&i.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] p-4 text-center",children:[i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/25",children:[i.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),i.jsx("p",{className:"text-[12px] text-white/45",children:"No pending decisions. All clear."})]}),i.jsx(dr,{mode:"popLayout",children:v.map(M=>{const C=d.has(M.id),B=AS(M.waitingMinutes),R=m.has(M.id);return i.jsx(Oe.article,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.25,ease:[.4,0,.2,1]},layout:!0,className:"rounded-xl border bg-white/[0.03] px-3 py-2.5 transition-[border-color,box-shadow]",style:{borderColor:R?`${q.lime}50`:`${B.border}35`,borderLeftWidth:3,borderLeftColor:`${B.border}80`,boxShadow:B.glow},children:i.jsxs("div",{className:"flex items-start gap-2.5",children:[i.jsx("input",{type:"checkbox",checked:R,onChange:()=>S(M.id),disabled:C||l,className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-black/40 text-lime focus:ring-lime/40"}),i.jsx("div",{className:"min-w-0 flex-1",children:i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-[13px] font-medium text-white",children:M.title}),M.context&&i.jsx("p",{className:"mt-1 line-clamp-2 text-[11px] text-white/55",children:M.context}),i.jsxs("p",{className:"mt-1.5 text-[10px] text-white/40",children:[M.agentName??"System"," · Waiting ",M.waitingMinutes,"m",M.requestedAt?` · ${Gt(M.requestedAt)}`:""]})]}),i.jsx("button",{onClick:()=>A(M.id),disabled:C||l,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-1.5 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:cursor-not-allowed disabled:border-white/10 disabled:bg-white/[0.08] disabled:text-white/45",children:C?"Approving…":"Approve"})]})})]})},M.id)})})]}),g&&i.jsxs("div",{className:"flex items-center gap-2 border-t border-white/[0.06] px-4 py-2.5 text-[12px] text-white/55",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:P?"text-lime":"text-amber-400",children:P?i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),i.jsx("line",{x1:"12",x2:"12",y1:"9",y2:"13"}),i.jsx("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})]})}),g]})]})});function Ey({value:e,onChange:n,placeholder:s}){return i.jsxs("label",{className:"relative block",children:[i.jsx("span",{className:"sr-only",children:s}),i.jsxs("svg",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-white/35",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("path",{d:"m21 21-4.3-4.3"})]}),i.jsx("input",{type:"text",value:e,onChange:a=>n(a.target.value),placeholder:s,className:"w-full rounded-xl border border-white/[0.08] bg-white/[0.03] py-2.5 pl-10 pr-8 text-[13px] text-white placeholder:text-white/35 transition-all focus:border-[#BFFF00]/30 focus:bg-white/[0.05] focus:outline-none"}),e.length>0&&i.jsx("button",{type:"button",onClick:()=>n(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-full p-0.5 text-white/40 transition-colors hover:text-white/70","aria-label":"Clear search",children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:i.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})}function TS(e,n){if(e.length===0)return 0;if(n>=e.length-1&&e.every(l=>l.status==="completed"))return 100;const s=n/Math.max(1,e.length-1)*100,a=e[n];return a?a.status==="completed"?Math.min(100,s+100/e.length):a.status==="current"||a.status==="warning"?Math.min(100,s+50/e.length):s:s}function PS({phases:e,currentPhase:n,health:s}){const a=TS(e,n);return i.jsxs("div",{className:"space-y-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between text-[9px] uppercase tracking-[0.1em] text-white/38",children:[i.jsx("span",{children:"Momentum"}),i.jsxs("span",{children:[Math.round(s??a),"%"]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"h-2 rounded-full bg-white/[0.08]"}),i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Math.max(0,Math.min(100,a))}%`,background:`linear-gradient(90deg, ${q.lime}, ${q.teal})`,boxShadow:`0 0 18px ${q.teal}45`}}),e.map((l,u)=>{const d=u/Math.max(1,e.length-1)*100,f=l.status==="completed",m=l.status==="current",x=l.status==="warning";return i.jsx("div",{className:"absolute top-1/2 z-10 -translate-y-1/2",style:{left:`${d}%`,transform:"translate(-50%, -50%)"},children:i.jsx("div",{className:Ke("flex h-4 w-4 items-center justify-center rounded-full border text-[9px] font-semibold",f&&"border-lime/80 bg-lime text-black",m&&"border-lime/60 bg-lime/30 text-lime",x&&"border-amber-300/70 bg-amber-300 text-black",!f&&!m&&!x&&"border-white/20 bg-black/60 text-white/45"),children:f?"✓":x?"!":""})},l.name)})]}),i.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${Math.max(e.length,1)}, minmax(0, 1fr))`},children:e.map(l=>i.jsx("span",{className:Ke("truncate text-[8px] uppercase tracking-[0.12em]",l.status==="completed"||l.status==="current"?"text-white/60":"text-white/30"),children:l.name},l.name))})]})}function MS({names:e}){return i.jsx("div",{className:"flex -space-x-1.5",children:e.slice(0,3).map((n,s)=>i.jsx("div",{className:"relative",style:{zIndex:e.length-s},children:i.jsx(mi,{name:n,size:"xs"})},`${n}-${s}`))})}function FS(e){return e==="blocked"?{text:"Watch",className:"border-amber-300/45 bg-amber-300/10 text-amber-200"}:e==="completed"?{text:"Done",className:"border-lime/45 bg-lime/15 text-lime"}:e==="paused"?{text:"Paused",className:"border-white/20 bg-white/[0.04] text-white/60"}:{text:"In Motion",className:"border-teal/45 bg-teal/10 text-teal"}}function DS({initiative:e,onClick:n}){var f;const s=e.phases??[],a=e.currentPhase??0,l=e.avatars??[],u=FS(e.status),d=((f=e.workstreams)==null?void 0:f.length)??0;return i.jsxs("button",{onClick:n,className:"w-full rounded-xl border border-white/[0.08] bg-[linear-gradient(150deg,rgba(20,184,166,0.15),rgba(2,4,10,0.7)_42%,rgba(2,4,10,0.95))] p-3 text-left transition-all duration-200 hover:border-white/[0.16] hover:bg-[linear-gradient(150deg,rgba(20,184,166,0.22),rgba(2,4,10,0.72)_42%,rgba(2,4,10,0.95))]",children:[i.jsxs("div",{className:"mb-2 flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[l.length>0&&i.jsx(MS,{names:l}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:`rounded-full border px-1.5 py-0.5 text-[10px] uppercase tracking-[0.1em] ${u.className}`,children:u.text}),i.jsx("span",{className:"rounded-full border border-white/[0.16] bg-white/[0.03] px-1.5 py-0.5 text-[10px] uppercase tracking-[0.1em] text-white/60",children:e.category??"Program"})]}),i.jsx("h4",{className:"mt-1 text-[13px] font-semibold text-white",children:e.name})]})]}),i.jsxs("span",{className:"text-[12px] text-white/45",style:{fontVariantNumeric:"tabular-nums"},children:[e.health,"%"]})]}),e.description&&i.jsx("p",{className:"mb-2 line-clamp-2 text-[11px] text-white/65",children:e.description}),s.length>0&&i.jsx(PS,{phases:s,currentPhase:a,health:e.health}),i.jsxs("div",{className:"mt-2.5 grid grid-cols-3 gap-1.5 text-[10px] uppercase tracking-[0.08em]",children:[i.jsxs("div",{className:"rounded-md border border-white/[0.1] bg-black/25 px-2 py-1.5",children:[i.jsx("p",{className:"text-white/35",children:"Live Streams"}),i.jsx("p",{className:"text-[12px] font-semibold text-white",children:e.activeAgents})]}),i.jsxs("div",{className:"rounded-md border border-white/[0.1] bg-black/25 px-2 py-1.5",children:[i.jsx("p",{className:"text-white/35",children:"Total Streams"}),i.jsx("p",{className:"text-[12px] font-semibold text-white",children:e.totalAgents})]}),i.jsxs("div",{className:"rounded-md border border-white/[0.1] bg-black/25 px-2 py-1.5",children:[i.jsx("p",{className:"text-white/35",children:"Workstreams"}),i.jsx("p",{className:"text-[12px] font-semibold text-white",children:d})]})]})]})}function IS({initiatives:e,onInitiativeClick:n,onCreateInitiative:s,onCreateWorkstream:a}){const[l,u]=b.useState(""),[d,f]=b.useState(0),[m,x]=b.useState(null),g=3,y=b.useMemo(()=>e.filter(j=>j.name.toLowerCase().includes(l.toLowerCase())),[e,l]),v=Math.max(1,Math.ceil(y.length/g)),k=Math.min(d,Math.max(0,v-1)),E=y.slice(k*g,(k+1)*g),S=async(j,F)=>{if(!(!F||m)){x(j);try{await F()}finally{x(null)}}};return i.jsxs(Wn,{className:"flex h-full min-h-0 flex-1 flex-col card-enter",children:[i.jsxs("div",{className:"flex-shrink-0 space-y-2 border-b border-white/[0.06] px-4 py-3.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[14px] font-semibold text-white",children:"Initiatives"}),i.jsx("span",{className:"text-[12px] text-white/35",children:e.length})]}),i.jsx(Ey,{value:l,onChange:j=>{u(j),f(0)},placeholder:"Search initiatives..."}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsx("button",{onClick:()=>S("initiative",s),disabled:!s||m!==null,className:"rounded-md border border-lime/25 bg-lime/10 px-2.5 py-1.5 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:m==="initiative"?"Creating…":"Start initiative"}),i.jsx("button",{onClick:()=>S("workstream",a),disabled:!a||m!==null,className:"rounded-md border border-white/[0.12] bg-white/[0.03] px-2.5 py-1.5 text-[11px] text-white/75 transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:m==="workstream"?"Creating…":"Start workstream"})]})]}),i.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[E.length===0&&i.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] p-4 text-center",children:[i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/25",children:[i.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),i.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),i.jsx("p",{className:"text-[12px] text-white/45",children:e.length===0?"No active initiatives yet. Start one above.":"No initiatives match this search."})]}),E.map(j=>i.jsx(DS,{initiative:j,onClick:()=>n(j)},j.id))]}),v>1&&i.jsx("div",{className:"flex-shrink-0 border-t border-white/[0.06] px-4 py-2.5",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("button",{onClick:()=>f(Math.max(0,k-1)),disabled:k===0,className:"rounded p-1.5 text-white/45 transition-colors hover:text-white disabled:opacity-30",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}),i.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:v}).map((j,F)=>i.jsx("button",{type:"button",onClick:()=>f(F),"aria-label":`Page ${F+1}`,className:"rounded-full p-1 transition-colors",children:i.jsx("span",{className:"block h-2.5 w-2.5 rounded-full transition-colors",style:{backgroundColor:F===k?q.lime:"rgba(255,255,255,0.25)"}})},F))}),i.jsx("button",{onClick:()=>f(Math.min(v-1,k+1)),disabled:k>=v-1,className:"rounded p-1.5 text-white/45 transition-colors hover:text-white disabled:opacity-30",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"m9 18 6-6-6-6"})})})]})})]})}function _S({activities:e,agents:n,initiatives:s}){return b.useMemo(()=>{const a=new Map,l=(u,d,f,m)=>{const x=a.get(u)??[];x.some(g=>g.id===d)||(x.push({id:d,name:f,confidence:m}),a.set(u,x))};return e.forEach(u=>{const d="metadata"in u&&u.metadata&&typeof u.metadata=="object"?u.metadata:null,f=d&&typeof d=="object"?d:{},m=("initiativeId"in u&&typeof u.initiativeId=="string"?u.initiativeId:void 0)??f.initiativeId??void 0,x=u.agentId??void 0,g=("agentName"in u&&typeof u.agentName=="string"?u.agentName:"agent"in u&&typeof u.agent=="string"?u.agent:void 0)??x??"Unknown";m&&x&&l(m,x,g,"high")}),s.forEach(u=>{var d;(d=u.avatars)!=null&&d.length&&u.avatars.forEach(f=>{const m=n.find(x=>x.name.toLowerCase()===f.toLowerCase());m?l(u.id,m.id,m.name,"medium"):l(u.id,`avatar:${f}`,f,"medium")})}),n.forEach(u=>{if(!u.task)return;const d=u.task.toLowerCase();s.forEach(f=>{f.name.toLowerCase().split(/\s+/).filter(y=>y.length>3).some(y=>d.includes(y))&&l(f.id,u.id,u.name,"low")})}),a},[e,n,s])}function zo({className:e=""}){return i.jsx("div",{className:Ke("shimmer-skeleton",e),"aria-hidden":"true"})}function LS(e){const n={"Content-Type":"application/json"};return e.embedMode&&(n["X-Orgx-Embed"]="true"),e.authToken&&(n.Authorization=`Bearer ${e.authToken}`),n}async function gl(e){if(!e.ok){const n=await e.json().catch(()=>null),s=typeof(n==null?void 0:n.error)=="string"&&n.error||typeof(n==null?void 0:n.message)=="string"&&n.message||`Request failed (${e.status})`;throw new Error(s)}return e}function RS(e){const n=qo(),s=LS(e),a=()=>{n.invalidateQueries({queryKey:["live-data"]}),n.invalidateQueries({queryKey:["initiative-details"]}),n.invalidateQueries({queryKey:["entities"]}),n.invalidateQueries({queryKey:["mission-control-graph"]})},l=xs({mutationFn:async m=>{const{type:x,...g}=m,y=await fetch("/orgx/api/entities",{method:"POST",headers:s,body:JSON.stringify({type:x,...g})});return await gl(y),y.json()},onSuccess:a}),u=xs({mutationFn:async m=>{const{type:x,id:g,...y}=m,v=await fetch("/orgx/api/entities",{method:"PATCH",headers:s,body:JSON.stringify({type:x,id:g,...y})});return await gl(v),v.json()},onSuccess:a}),d=xs({mutationFn:async m=>{const x=await fetch(`/orgx/api/entities/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}/delete`,{method:"POST",headers:s,body:"{}"});return await gl(x),x.json()},onSuccess:a}),f=xs({mutationFn:async m=>{const x=await fetch(`/orgx/api/entities/${encodeURIComponent(m.type)}/${encodeURIComponent(m.id)}/${encodeURIComponent(m.action)}`,{method:"POST",headers:s,body:JSON.stringify({force:m.force??!1})});return await gl(x),x.json()},onSuccess:a});return{createEntity:l,updateEntity:u,deleteEntity:d,entityAction:f}}const Ty=b.createContext(null);function Ds(){const e=b.useContext(Ty);if(!e)throw new Error("useMissionControl must be used within MissionControlProvider");return e}function OS({children:e,agentEntityMap:n,authToken:s,embedMode:a}){const[l,u]=b.useState(new Set),[d,f]=b.useState(null),[m,x]=b.useState(""),[g,y]=b.useState([]),[v,k]=b.useState("target"),[E,S]=b.useState("any"),[j,F]=b.useState(""),[_,A]=b.useState(""),[P,M]=b.useState("status"),[C,B]=b.useState("default"),R=RS({authToken:s,embedMode:a}),G=b.useCallback(V=>{u(N=>{const z=new Set(N);return z.has(V)?z.delete(V):z.add(V),z})},[]),he=b.useCallback(V=>{u(N=>{if(N.has(V))return N;const z=new Set(N);return z.add(V),z})},[]),$=b.useCallback(V=>{u(new Set(V))},[]),ie=b.useCallback(()=>{u(new Set)},[]),W=b.useCallback(V=>{f(V)},[]),H=b.useCallback(()=>{f(null)},[]),L=b.useCallback(V=>{y(N=>{const z=V.trim().toLowerCase();return z?N.includes(z)?N.filter(fe=>fe!==z):[...N,z]:N})},[]),X=b.useCallback(()=>{x(""),y([]),k("target"),S("any"),F(""),A("")},[]),te=g.length+(v!=="target"?1:0)+(E!=="any"?1:0),Y=m.trim().length>0||te>0,Z=b.useMemo(()=>({agentEntityMap:n,expandedInitiatives:l,modalTarget:d,searchQuery:m,statusFilters:g,dateField:v,datePreset:E,dateStart:j,dateEnd:_,activeFilterCount:te,hasActiveFilters:Y,groupBy:P,sortBy:C,authToken:s,embedMode:a,mutations:R,toggleExpanded:G,expandInitiative:he,expandAll:$,collapseAll:ie,openModal:W,closeModal:H,setSearchQuery:x,setStatusFilters:y,toggleStatusFilter:L,setDateField:k,setDatePreset:S,setDateStart:F,setDateEnd:A,setGroupBy:M,setSortBy:B,clearFilters:X}),[n,l,d,m,g,v,E,j,_,te,Y,P,C,s,a,R,G,he,$,ie,W,H,y,L,k,S,F,A,M,B,X]);return i.jsx(Ty.Provider,{value:Z,children:e})}const Py={active:"text-[#BFFF00] bg-[#BFFF00]/10 border-[#BFFF00]/20",paused:"text-[#F5B700] bg-[#F5B700]/10 border-[#F5B700]/20",blocked:"text-[#FF6B88] bg-[#FF6B88]/10 border-[#FF6B88]/20",completed:"text-[#14B8A6] bg-[#14B8A6]/10 border-[#14B8A6]/20"},BS={done:"text-[#14B8A6] bg-[#14B8A6]/10 border-[#14B8A6]/20",completed:"text-[#14B8A6] bg-[#14B8A6]/10 border-[#14B8A6]/20",in_progress:"text-[#BFFF00] bg-[#BFFF00]/10 border-[#BFFF00]/20",active:"text-[#BFFF00] bg-[#BFFF00]/10 border-[#BFFF00]/20",blocked:"text-[#FF6B88] bg-[#FF6B88]/10 border-[#FF6B88]/20",todo:"text-white/60 bg-white/5 border-white/10"},Ch=e=>BS[e.toLowerCase()]??"text-white/60 bg-white/5 border-white/10",My=e=>{const n=e.toLowerCase();return n==="active"||n==="in_progress"?"text-[#BFFF00] bg-[#BFFF00]/10 border-[#BFFF00]/20":n==="blocked"?"text-[#FF6B88] bg-[#FF6B88]/10 border-[#FF6B88]/20":n==="completed"||n==="done"?"text-[#14B8A6] bg-[#14B8A6]/10 border-[#14B8A6]/20":"text-white/60 bg-white/5 border-white/10"},Fy=e=>{const n=e.toLowerCase();return n==="done"||n==="completed"?"text-[#14B8A6] bg-[#14B8A6]/10 border-[#14B8A6]/20":n==="active"||n==="in_progress"?"text-[#BFFF00] bg-[#BFFF00]/10 border-[#BFFF00]/20":"text-white/60 bg-white/5 border-white/10"},gn=e=>e.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase()),a0=e=>{const n=e.toLowerCase();return n==="blocked"?0:n==="in_progress"||n==="active"?1:n==="todo"||n==="planned"?2:n==="done"||n==="completed"?3:4},l0=e=>{const n=e.toLowerCase();return n==="blocked"?q.red:n==="active"||n==="in_progress"?q.lime:n==="done"||n==="completed"?q.teal:n==="paused"?q.amber:"rgba(255,255,255,0.35)"};function $S(e){if(!e)return null;const n=Date.parse(e);if(!Number.isFinite(n))return null;const s=new Date,a=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),l=new Date(n),u=new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime();return Math.round((u-a)/864e5)}function VS(e){const n=$S(e);return n===null?{label:"No target date",tone:"neutral"}:n<0?{label:`Overdue ${Math.abs(n)}d`,tone:"danger"}:n===0?{label:"Due today",tone:"warning"}:n<=7?{label:`Due in ${n}d`,tone:"warning"}:{label:`Due in ${n}d`,tone:"success"}}function Ul({agents:e,max:n=4}){if(!e.length)return null;const s=e.slice(0,n),a=e.length-n;return i.jsxs("div",{className:"flex items-center -space-x-1.5",children:[s.map(l=>i.jsx("div",{className:"relative",title:`${l.name} (${l.confidence} confidence)`,style:{borderRadius:"9999px",border:l.confidence==="high"?"1.5px solid rgba(255,255,255,0.25)":l.confidence==="medium"?"1.5px dashed rgba(255,255,255,0.15)":"1.5px dotted rgba(255,255,255,0.10)"},children:i.jsx(mi,{name:l.name,size:"xs"})},l.id)),a>0&&i.jsxs("span",{className:"ml-1 text-[9px] text-white/40",children:["+",a]})]})}function c0(e){return{initiative:{id:e,title:"Initiative",status:"active",summary:null,assignedAgents:[]},nodes:[],edges:[],recentTodos:[]}}function zS({initiativeId:e,authToken:n=null,embedMode:s=!1,enabled:a=!0}){var f,m;const l=b.useMemo(()=>Es.missionControlGraph({initiativeId:e,authToken:n,embedMode:s}),[e,n,s]),u=Kr({queryKey:l,enabled:a&&!!e,queryFn:async()=>{if(!e)throw new Error("initiativeId is required");const x=new URLSearchParams({initiative_id:e}),g={};s&&(g["X-Orgx-Embed"]="true"),n&&(g.Authorization=`Bearer ${n}`);const y=Object.keys(g).length>0?g:void 0,v=await fetch(`/orgx/api/mission-control/graph?${x.toString()}`,{headers:y});if(!v.ok){const k=await v.json().catch(()=>null),E=typeof(k==null?void 0:k.error)=="string"&&k.error||typeof(k==null?void 0:k.message)=="string"&&k.message||`Failed to fetch Mission Control graph (${v.status})`;return console.warn(`[useMissionControlGraph] ${E}`),{...c0(e),degraded:[E]}}return await v.json()}});return{graph:u.data??(e?c0(e):null),isLoading:u.isLoading,error:((f=u.error)==null?void 0:f.message)??null,degraded:((m=u.data)==null?void 0:m.degraded)??[],refetch:u.refetch}}function nd(e){const n={};return e.embedMode&&(n["X-Orgx-Embed"]="true"),e.authToken&&(n.Authorization=`Bearer ${e.authToken}`),Object.keys(n).length>0?n:void 0}function US({initiativeId:e,authToken:n=null,embedMode:s=!1,enabled:a=!0}){var v,k,E;const l=qo(),u=b.useMemo(()=>Es.autoContinueStatus({initiativeId:e,authToken:n,embedMode:s}),[e,n,s]),d=Kr({queryKey:u,enabled:a&&!!e,queryFn:async()=>{if(!e)throw new Error("initiativeId is required");const S=new URLSearchParams({initiative_id:e}),j=await fetch(`/orgx/api/mission-control/auto-continue/status?${S.toString()}`,{headers:nd({authToken:n,embedMode:s})}),F=await j.json().catch(()=>null);if(!j.ok){const _=typeof(F==null?void 0:F.error)=="string"&&F.error||typeof(F==null?void 0:F.message)=="string"&&F.message||`Failed to load auto-continue status (${j.status})`;return{ok:!1,initiativeId:e,run:null,defaults:{tokenBudget:0,tickMs:0},error:_}}return F},refetchInterval:2500}),f=async()=>{await l.invalidateQueries({queryKey:u}),await l.invalidateQueries({queryKey:Es.missionControlGraph({initiativeId:e,authToken:n,embedMode:s})}),await l.invalidateQueries({queryKey:Es.liveData({authToken:n,embedMode:s})})},m=xs({mutationFn:async S=>{if(!e)throw new Error("initiativeId is required");const j={initiativeId:e};S&&typeof S=="object"&&(typeof S.tokenBudgetTokens=="number"&&(j.tokenBudgetTokens=S.tokenBudgetTokens),typeof S.agentId=="string"&&S.agentId.trim().length>0&&(j.agentId=S.agentId.trim()));const F=await fetch("/orgx/api/mission-control/auto-continue/start",{method:"POST",headers:{"Content-Type":"application/json",...nd({authToken:n,embedMode:s})??{}},body:JSON.stringify(j)}),_=await F.json().catch(()=>null);if(!F.ok){const A=typeof(_==null?void 0:_.error)=="string"&&_.error||typeof(_==null?void 0:_.message)=="string"&&_.message||`Failed to start auto-continue (${F.status})`;throw new Error(A)}if(_&&typeof _=="object"&&"run"in _){const A=d.data??null;return{ok:!0,initiativeId:e,run:_.run??null,defaults:(A==null?void 0:A.defaults)??{tokenBudget:0,tickMs:0}}}return _},onSuccess:()=>{f()}}),x=xs({mutationFn:async()=>{if(!e)throw new Error("initiativeId is required");const S=await fetch("/orgx/api/mission-control/auto-continue/stop",{method:"POST",headers:{"Content-Type":"application/json",...nd({authToken:n,embedMode:s})??{}},body:JSON.stringify({initiativeId:e})}),j=await S.json().catch(()=>null);if(!S.ok){const F=typeof(j==null?void 0:j.error)=="string"&&j.error||typeof(j==null?void 0:j.message)=="string"&&j.message||`Failed to stop auto-continue (${S.status})`;throw new Error(F)}if(j&&typeof j=="object"&&"run"in j){const F=d.data??null;return{ok:!0,initiativeId:e,run:j.run??null,defaults:(F==null?void 0:F.defaults)??{tokenBudget:0,tickMs:0}}}return j},onSuccess:()=>{f()}}),g=((v=d.data)==null?void 0:v.run)??null,y=(g==null?void 0:g.status)==="running"||(g==null?void 0:g.status)==="stopping";return{status:d.data??null,run:g,isRunning:y,isLoading:d.isLoading,error:((k=d.data)==null?void 0:k.error)??((E=d.error)==null?void 0:E.message)??null,start:m.mutateAsync,stop:x.mutateAsync,isStarting:m.isPending,isStopping:x.isPending,refetch:d.refetch}}function WS({editMode:e,onToggleEditMode:n}){return i.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-white/[0.08] bg-white/[0.03] px-3.5 py-2.5",children:[i.jsx("div",{className:"text-[11px] text-white/45",children:e?"Edit mode enabled: status, priority, ETA, duration, dependencies, assignments":"Read mode: click rows to drill in and inspect dependency paths"}),i.jsx("button",{type:"button",onClick:n,className:`rounded-md border px-3 py-1.5 text-[11px] transition-colors ${e?"border-[#BFFF00]/30 bg-[#BFFF00]/15 text-[#D8FFA1]":"border-white/[0.12] bg-white/[0.05] text-white/65 hover:bg-white/[0.1]"}`,children:e?"Exit edit mode":"Edit mode"})]})}function Ah({type:e,className:n=""}){return e==="initiative"?i.jsx("svg",{className:n,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:q.iris,strokeWidth:"1.8",children:i.jsx("circle",{cx:"12",cy:"12",r:"8"})}):e==="workstream"?i.jsx("svg",{className:n,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:q.lime,strokeWidth:"1.8",children:i.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"})}):e==="milestone"?i.jsx("svg",{className:n,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:q.teal,strokeWidth:"1.8",children:i.jsx("path",{d:"M12 4l7 7-7 9-7-9 7-7z"})}):i.jsx("svg",{className:n,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.72)",strokeWidth:"1.8",children:i.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"})})}function KS(e){return e==="initiative"?"Initiatives":e==="workstream"?"Workstreams":e==="milestone"?"Milestones":"Tasks"}function HS({nodes:e,edges:n,selectedNodeId:s,focusedWorkstreamId:a,onSelectNode:l}){const u=b.useMemo(()=>new Map(e.map(A=>[A.id,A])),[e]),[d,f]=b.useState(""),[m,x]=b.useState(!1),g=d.trim().toLowerCase(),y=b.useMemo(()=>{if(!a)return new Set(e.map(M=>M.id));const A=new Set;for(const M of e)(M.type==="initiative"||M.id===a||M.workstreamId===a)&&A.add(M.id);let P=!0;for(;P;){P=!1;for(const M of n)(A.has(M.from)||A.has(M.to))&&(!A.has(M.from)||!A.has(M.to))&&(A.add(M.from),A.add(M.to),P=!0)}return A},[a,e,n]),v=e.filter(A=>y.has(A.id)),k=n.filter(A=>y.has(A.from)&&y.has(A.to)),E=b.useMemo(()=>{if(!s)return new Set;const A=new Set([s]);for(const P of k)P.from===s&&A.add(P.to),P.to===s&&A.add(P.from);return A},[s,k]),S=b.useMemo(()=>{let A=new Set(Array.from(y));return m&&s&&(A=new Set(Array.from(A).filter(P=>E.has(P)))),g.length>0&&(A=new Set(Array.from(A).filter(P=>{const M=u.get(P);return M?M.title.toLowerCase().includes(g):!1}))),A},[u,g,E,m,s,y]),j=e.filter(A=>S.has(A.id)),F=n.filter(A=>S.has(A.from)&&S.has(A.to)),_={initiative:j.filter(A=>A.type==="initiative"),workstream:j.filter(A=>A.type==="workstream"),milestone:j.filter(A=>A.type==="milestone"),task:j.filter(A=>A.type==="task")};return v.length===0?null:i.jsxs("section",{className:"space-y-2 rounded-xl border border-white/[0.08] bg-white/[0.03] p-3.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h4",{className:"text-[11px] uppercase tracking-[0.08em] text-white/45",children:"Dependency map"}),i.jsxs("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/30",children:[j.length,"/",v.length," nodes · ",F.length," links"]})]}),a&&i.jsx("span",{className:"text-[10px] rounded-full border border-[#BFFF00]/25 bg-[#BFFF00]/10 px-2 py-0.5 text-[#D8FFA1]",children:"Focused workstream"})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("input",{value:d,onChange:A=>f(A.target.value),placeholder:"Filter nodes...",className:"h-9 flex-1 min-w-[200px] rounded-lg border border-white/[0.12] bg-black/30 px-3 text-[11px] text-white/80 placeholder:text-white/25 focus:border-[#BFFF00]/40 focus:outline-none"}),s&&i.jsx("button",{type:"button",onClick:()=>x(A=>!A),"aria-pressed":m,className:`h-9 rounded-full border px-3 text-[11px] font-semibold transition-colors ${m?"border-[#BFFF00]/30 bg-[#BFFF00]/15 text-[#D8FFA1]":"border-white/[0.12] bg-white/[0.03] text-white/70 hover:bg-white/[0.06]"}`,title:"Show only the selected node and its direct neighbors",children:"Related only"}),(d.trim().length>0||m)&&i.jsx("button",{type:"button",onClick:()=>{f(""),x(!1)},className:"h-9 rounded-full border border-white/[0.12] bg-white/[0.03] px-3 text-[11px] text-white/70 transition-colors hover:bg-white/[0.06]",children:"Reset"})]}),j.length===0?i.jsx("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] px-3 py-3 text-[11px] text-white/55",children:"No nodes match the current filter."}):i.jsx("div",{className:"grid gap-2 md:grid-cols-2 xl:grid-cols-4",children:Object.keys(_).map(A=>i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-2",children:[i.jsxs("div",{className:"mb-1.5 text-[10px] uppercase tracking-[0.08em] text-white/35",children:[KS(A)," (",_[A].length,")"]}),i.jsxs("div",{className:"space-y-1",children:[_[A].slice(0,10).map(P=>{const M=s===P.id,C=!M&&E.has(P.id);return i.jsxs("button",{type:"button",onClick:()=>l(P.id),title:P.title,className:`flex w-full items-center gap-1.5 rounded-md border px-2 py-1 text-left transition-colors ${M?"border-[#BFFF00]/35 bg-[#BFFF00]/10":C?"border-[#14B8A6]/35 bg-[#14B8A6]/10":"border-white/[0.08] bg-white/[0.03] hover:bg-white/[0.08]"}`,children:[i.jsx(Ah,{type:P.type}),i.jsx("span",{className:"truncate text-[11px] text-white/80",children:P.title})]},P.id)}),_[A].length>10&&i.jsxs("div",{className:"px-1 text-[10px] text-white/35",children:["+",_[A].length-10," more"]})]})]},A))}),F.length>0&&i.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] px-2.5 py-2",children:[i.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Dependency links"}),i.jsx("div",{className:"max-h-[110px] space-y-1 overflow-auto pr-1",children:F.slice(0,36).map(A=>{const P=u.get(A.from),M=u.get(A.to);if(!P||!M)return null;const C=s===P.id||s===M.id;return i.jsxs("button",{type:"button",onClick:()=>l(M.id),className:"flex w-full items-center gap-1 rounded-md px-1.5 py-1 text-left hover:bg-white/[0.06]",children:[i.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:C?q.lime:"rgba(255,255,255,0.35)"}}),i.jsx("span",{className:"truncate text-[10px] text-white/70",children:P.title}),i.jsx("span",{className:"text-[10px] text-white/30",children:"→"}),i.jsx("span",{className:"truncate text-[10px] text-white/70",children:M.title})]},`${A.from}-${A.to}`)})})]})]})}function QS(e){return e.trim().toLowerCase().replace(/[\s-]+/g,"_")}const qS=new Set(["done","completed","complete","cancelled","canceled","archived","deleted"]);function nn(e){return qS.has(QS(e))}function Wl(e){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}function Ts(e,n){return n<=0?0:Wl(e/n*100)}function GS({dependencies:e,allNodes:n,disabled:s=!1,onSave:a}){const[l,u]=b.useState(!1),[d,f]=b.useState(e.join(", ")),m=b.useMemo(()=>n.slice(0,12).map(g=>`${g.id.slice(0,8)}… ${g.title}`),[n]),x=()=>{const g=d.split(",").map(y=>y.trim()).filter(Boolean);a(Array.from(new Set(g))),u(!1)};return i.jsxs("div",{className:"relative",children:[i.jsx("button",{type:"button",disabled:s,onClick:()=>{f(e.join(", ")),u(g=>!g)},className:"rounded-md border border-white/[0.12] bg-white/[0.04] px-2 py-1 text-[10px] text-white/70 hover:bg-white/[0.08] disabled:opacity-40",children:e.length>0?`${e.length} linked`:"Set links"}),l&&i.jsxs("div",{className:"absolute right-0 z-20 mt-1.5 w-[300px] rounded-xl border border-white/[0.14] bg-[#0A0D14] p-2.5 shadow-[0_20px_40px_rgba(0,0,0,0.45)]",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.08em] text-white/40",children:"Dependency IDs (comma separated)"}),i.jsx("textarea",{value:d,onChange:g=>f(g.target.value),className:"mt-1.5 h-[72px] w-full resize-none rounded-md border border-white/[0.12] bg-white/[0.04] px-2 py-1.5 text-[11px] text-white/80 outline-none focus:border-[#BFFF00]/40"}),i.jsxs("div",{className:"mt-2 rounded-md border border-white/[0.08] bg-white/[0.02] p-1.5 text-[10px] text-white/45",children:["IDs: ",m.join(" • ")]}),i.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded-md border border-white/[0.12] px-2 py-1 text-[10px] text-white/60",children:"Cancel"}),i.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-2 py-1 text-[10px] text-[#D8FFA1]",children:"Save links"})]})]})]})}function XS(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const s=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),u=String(n.getHours()).padStart(2,"0"),d=String(n.getMinutes()).padStart(2,"0");return`${s}-${a}-${l}T${u}:${d}`}const YS=["not_started","planned","todo","in_progress","active","blocked","done"];function ZS({nodes:e,edges:n,selectedNodeId:s,highlightedNodeIds:a,editMode:l,onSelectNode:u,onFocusWorkstream:d,onOpenNode:f,onUpdateNode:m,mutations:x}){const g=b.useMemo(()=>new Map(e.map(C=>[C.id,C])),[e]),y=b.useMemo(()=>e.map(C=>({id:C.id,title:C.title})),[e]),v=b.useMemo(()=>e.filter(C=>C.type==="workstream").sort((C,B)=>C.priorityNum-B.priorityNum||C.title.localeCompare(B.title)),[e]),k=b.useMemo(()=>{const C=new Map;for(const B of e.filter(R=>R.type==="milestone")){const R=B.workstreamId??"unscoped",G=C.get(R)??[];G.push(B),C.set(R,G)}for(const B of C.values())B.sort((R,G)=>R.priorityNum-G.priorityNum||R.title.localeCompare(G.title));return C},[e]),E=b.useMemo(()=>{const C=new Map;for(const B of e.filter(R=>R.type==="task"&&R.milestoneId)){const R=B.milestoneId??"unscoped",G=C.get(R)??[];G.push(B),C.set(R,G)}for(const B of C.values())B.sort((R,G)=>R.priorityNum-G.priorityNum||R.title.localeCompare(G.title));return C},[e]),S=b.useMemo(()=>{const C=new Map;for(const B of e.filter(R=>R.type==="task"&&!R.milestoneId)){const R=B.workstreamId??"unscoped",G=C.get(R)??[];G.push(B),C.set(R,G)}for(const B of C.values())B.sort((R,G)=>R.priorityNum-G.priorityNum||R.title.localeCompare(G.title));return C},[e]),j=b.useMemo(()=>{const C=new Set;for(const B of v)C.add(B.id);for(const B of e.filter(R=>R.type==="milestone"))C.add(B.id);return C},[e,v]),[F,_]=b.useState(j);b.useEffect(()=>{_(j)},[j]);const A=b.useMemo(()=>{const C=[];for(const G of v){const he=k.get(G.id)??[],$=S.get(G.id)??[],ie=he.length>0||$.length>0;if(C.push({node:G,depth:0,canCollapse:ie}),!!F.has(G.id)){for(const W of he){const H=E.get(W.id)??[];if(C.push({node:W,depth:1,canCollapse:H.length>0}),F.has(W.id))for(const L of H)C.push({node:L,depth:2,canCollapse:!1})}for(const W of $)C.push({node:W,depth:1,canCollapse:!1})}}const B=k.get("unscoped")??[],R=S.get("unscoped")??[];for(const G of B)if(C.push({node:G,depth:0,canCollapse:(E.get(G.id)??[]).length>0}),F.has(G.id))for(const he of E.get(G.id)??[])C.push({node:he,depth:1,canCollapse:!1});for(const G of R)C.push({node:G,depth:0,canCollapse:!1});return C},[S,F,k,E,v]),P=C=>C.dependencyIds.length,M=b.useMemo(()=>{const C=new Map,B=(R,G)=>{if(R.length>0){const he=R.filter($=>nn($.status)).length;return Ts(he,R.length)}return nn(G)?100:0};for(const R of e.filter(G=>G.type==="milestone")){const G=E.get(R.id)??[];C.set(R.id,B(G,R.status))}for(const R of v){const he=(k.get(R.id)??[]).flatMap(ie=>E.get(ie.id)??[]),$=S.get(R.id)??[];C.set(R.id,B([...$,...he],R.status))}return C},[S,k,e,E,v]);return i.jsxs("section",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] p-3",children:[i.jsx("div",{className:"mb-2 text-[11px] uppercase tracking-[0.08em] text-white/45",children:"Hierarchy table"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[1250px] border-separate border-spacing-y-1",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-[0.08em] text-white/35",children:[i.jsx("th",{className:"px-2 py-1.5",children:"Item"}),i.jsx("th",{className:"px-2 py-1.5",children:"Status"}),i.jsx("th",{className:"px-2 py-1.5",children:"Progress"}),i.jsx("th",{className:"px-2 py-1.5",children:"Priority"}),i.jsx("th",{className:"px-2 py-1.5",children:"ETA"}),i.jsx("th",{className:"px-2 py-1.5",children:"Duration (h)"}),i.jsx("th",{className:"px-2 py-1.5",children:"Budget ($)"}),i.jsx("th",{className:"px-2 py-1.5",children:"Dependencies"}),i.jsx("th",{className:"px-2 py-1.5",children:"Assigned"})]})}),i.jsx("tbody",{children:A.map(({node:C,depth:B,canCollapse:R})=>{const G=s===C.id,he=a.has(C.id),$=C.assignedAgents.map(H=>H.name).join(", "),ie=C.dependencyIds.map(H=>{var L;return((L=g.get(H))==null?void 0:L.title)??H}).slice(0,3).join(", "),W=M.get(C.id);return i.jsxs("tr",{onClick:()=>{u(C.id),C.type==="workstream"&&d(C.id)},className:`group/row cursor-pointer rounded-lg border transition-colors ${G?"bg-[#BFFF00]/10":he?"bg-[#14B8A6]/10":"bg-white/[0.02] hover:bg-white/[0.07]"}`,children:[i.jsx("td",{className:"rounded-l-lg border border-white/[0.08] border-r-0 px-2 py-1.5",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{style:{width:B*14}}),R?i.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),_(L=>{const X=new Set(L);return X.has(C.id)?X.delete(C.id):X.add(C.id),X})},"aria-label":`${F.has(C.id)?"Collapse":"Expand"} ${C.type}: ${C.title}`,className:"rounded text-white/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[#BFFF00]/35 focus-visible:ring-offset-2 focus-visible:ring-offset-[#02040A]",children:F.has(C.id)?"▾":"▸"}):i.jsx("span",{className:"w-2.5"}),i.jsx(Ah,{type:C.type}),i.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),f(C)},"aria-label":`Open ${C.type} details: ${C.title}`,className:"max-w-[320px] truncate rounded text-[12px] text-white/85 hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-[#BFFF00]/35 focus-visible:ring-offset-2 focus-visible:ring-offset-[#02040A]",children:C.title}),C.type==="task"&&x&&!l&&i.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity ml-1",children:["not_started","todo","planned","pending","backlog"].includes(C.status.toLowerCase())?i.jsx("button",{type:"button",title:"Start",onClick:H=>{H.stopPropagation(),m(C,{status:"in_progress"})},"aria-label":`Start task: ${C.title}`,className:"flex items-center justify-center w-5 h-5 rounded text-white/40 transition-colors hover:text-[#BFFF00] hover:bg-white/[0.06] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#BFFF00]/35 focus-visible:ring-offset-2 focus-visible:ring-offset-[#02040A]",children:i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M8 5v14l11-7z"})})}):["in_progress","active"].includes(C.status.toLowerCase())?i.jsx("button",{type:"button",title:"Mark done",onClick:H=>{H.stopPropagation(),m(C,{status:"done"})},"aria-label":`Mark task done: ${C.title}`,className:"flex items-center justify-center w-5 h-5 rounded text-white/40 transition-colors hover:text-emerald-400 hover:bg-white/[0.06] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#BFFF00]/35 focus-visible:ring-offset-2 focus-visible:ring-offset-[#02040A]",children:i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:i.jsx("path",{d:"M20 6 9 17l-5-5"})})}):null})]})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l?i.jsx("select",{defaultValue:C.status,onClick:H=>H.stopPropagation(),onChange:H=>{m(C,{status:H.target.value})},className:"rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80",children:YS.map(H=>i.jsx("option",{value:H,children:H},H))}):i.jsx("span",{children:gn(C.status)})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:W!==void 0&&(C.type==="workstream"||C.type==="milestone")?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-1 w-[72px] rounded-full bg-white/[0.06] overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${W}%`,backgroundColor:C.type==="milestone"?q.teal:q.lime}})}),i.jsxs("span",{className:"text-[10px] text-white/60",style:{fontVariantNumeric:"tabular-nums"},children:[W,"%"]})]}):i.jsx("span",{className:"text-white/35",children:"—"})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l?i.jsx("input",{type:"number",min:1,max:100,defaultValue:C.priorityNum,onClick:H=>H.stopPropagation(),onBlur:H=>{const L=Number(H.currentTarget.value);Number.isFinite(L)&&m(C,{priority_num:L})},className:"w-[66px] rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80"}):i.jsxs("span",{children:["P",C.priorityNum]})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l?i.jsx("input",{type:"datetime-local",defaultValue:XS(C.etaEndAt),onClick:H=>H.stopPropagation(),onBlur:H=>{const L=H.currentTarget.value;m(C,{eta_end_at:L?new Date(L).toISOString():null})},className:"w-[170px] rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80"}):i.jsx("span",{children:C.etaEndAt?new Date(C.etaEndAt).toLocaleString():"—"})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l&&C.type!=="task"?i.jsx("input",{type:"number",min:0,step:.5,defaultValue:C.expectedDurationHours,onClick:H=>H.stopPropagation(),onBlur:H=>{const L=Number(H.currentTarget.value);Number.isFinite(L)&&m(C,{expected_duration_hours:L})},className:"w-[82px] rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80"}):i.jsx("span",{children:C.expectedDurationHours})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l&&C.type!=="task"?i.jsx("input",{type:"number",min:0,step:1,defaultValue:C.expectedBudgetUsd,onClick:H=>H.stopPropagation(),onBlur:H=>{const L=Number(H.currentTarget.value);Number.isFinite(L)&&m(C,{expected_budget_usd:L})},className:"w-[88px] rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80"}):i.jsxs("span",{children:["$",C.expectedBudgetUsd.toLocaleString(),l&&C.type==="task"?" (from task spec)":""]})}),i.jsx("td",{className:"border border-white/[0.08] border-l-0 border-r-0 px-2 py-1.5 text-[11px] text-white/75",children:l?i.jsx("div",{onClick:H=>H.stopPropagation(),children:i.jsx(GS,{dependencies:C.dependencyIds,allNodes:y,onSave:H=>void m(C,{depends_on:H})})}):i.jsx("div",{className:"max-w-[250px] truncate",children:P(C)>0?`${P(C)} · ${ie}`:"—"})}),i.jsx("td",{className:"rounded-r-lg border border-white/[0.08] border-l-0 px-2 py-1.5 text-[11px] text-white/75",children:l?i.jsx("input",{type:"text",defaultValue:$,placeholder:"Agent A, Agent B",onClick:H=>H.stopPropagation(),onBlur:H=>{const L=H.currentTarget.value.split(",").map(X=>X.trim()).filter(Boolean);m(C,{assigned_agent_names:L,assigned_agent_ids:L.map(X=>`name:${X}`),assignment_source:"manual"})},className:"w-[220px] rounded border border-white/[0.14] bg-white/[0.05] px-1.5 py-1 text-[10px] text-white/80"}):i.jsxs("div",{className:"flex items-center gap-1.5",children:[C.assignedAgents.length>0?C.assignedAgents.slice(0,3).map(H=>i.jsx("span",{className:"rounded-full border border-white/[0.12] bg-white/[0.04] px-2 py-0.5 text-[10px] text-white/70",children:H.name},`${C.id}:${H.id}`)):i.jsx("span",{className:"text-white/35",children:"Unassigned"}),C.assignedAgents.length>3&&i.jsxs("span",{className:"text-[10px] text-white/45",children:["+",C.assignedAgents.length-3]})]})})]},C.id)})})]})}),A.length===0&&i.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] px-4 py-6 text-center",children:[i.jsx("div",{className:"text-[12px] text-white/60",children:"No workstreams, milestones, or tasks yet"}),i.jsx("div",{className:"mt-1 text-[11px] text-white/35",children:"Create workstreams and tasks to see them here, or reconnect the OrgX API key."})]}),n.length>0&&i.jsxs("div",{className:"mt-2 text-[10px] text-white/35",children:["Showing ",A.length," rows and ",n.length," dependency links."]}),i.jsx("div",{className:"mt-1 text-[10px] text-white/30",children:"Workstream rows set dependency-map focus. Milestone/task rows highlight dependency path."})]})}function JS({recentTodoIds:e,nodesById:n,selectedNodeId:s,onSelectNode:a}){const l=e.map(u=>n.get(u)).filter(u=>!!u).slice(0,14);return l.length===0?null:i.jsxs("section",{className:"space-y-1.5 rounded-xl border border-white/[0.08] bg-white/[0.03] p-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("h4",{className:"text-[11px] uppercase tracking-[0.08em] text-white/45",children:"Next-up tasks"}),i.jsx("span",{className:"text-[10px] text-white/35",children:l.length})]}),i.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1",children:l.map(u=>i.jsxs("button",{type:"button",onClick:()=>a(u.id),className:`flex flex-shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-left transition-colors ${s===u.id?"border-[#BFFF00]/30 bg-[#BFFF00]/12":"border-white/[0.1] bg-white/[0.02] hover:bg-white/[0.08]"}`,children:[i.jsx(Ah,{type:u.type}),i.jsx("span",{className:"max-w-[220px] truncate text-[11px] text-white/80",children:u.title}),i.jsxs("span",{className:"rounded-full px-1.5 py-0.5 text-[9px]",style:{backgroundColor:`${q.amber}22`,color:`${q.amber}`},children:["P",u.priorityNum]})]},u.id))})]})}function e5(e){if(!e)return{priorityNum:60,priorityLabel:null};const n=e.trim().toLowerCase();if(n==="urgent"||n==="p0")return{priorityNum:10,priorityLabel:"urgent"};if(n==="high"||n==="p1")return{priorityNum:25,priorityLabel:"high"};if(n==="medium"||n==="p2")return{priorityNum:50,priorityLabel:"medium"};if(n==="low"||n==="p3"||n==="p4")return{priorityNum:75,priorityLabel:"low"};const s=Number(n.replace(/^p/,""));return Number.isFinite(s)?{priorityNum:Math.max(1,Math.min(100,Math.round(s))),priorityLabel:null}:{priorityNum:60,priorityLabel:null}}function t5(e){const n=e.toLowerCase();return["todo","not_started","planned","pending","backlog"].includes(n)}function n5(e){const n=e.toLowerCase();return["in_progress","active","running","queued"].includes(n)}function r5(e,n){const s={id:e.id,type:"initiative",title:e.name,status:e.rawStatus??e.status,parentId:null,initiativeId:e.id,workstreamId:null,milestoneId:null,priorityNum:60,priorityLabel:null,dependencyIds:[],dueDate:e.targetDate??null,etaEndAt:e.targetDate??null,expectedDurationHours:40,expectedBudgetUsd:1500,assignedAgents:[],updatedAt:e.updatedAt??e.createdAt??null},l=(n.workstreams.length>0?n.workstreams:(e.workstreams??[]).map(g=>({id:g.id,name:g.name,summary:null,status:g.status,progress:null,initiativeId:e.id,createdAt:null}))).map(g=>({id:g.id,type:"workstream",title:g.name,status:g.status,parentId:e.id,initiativeId:e.id,workstreamId:g.id,milestoneId:null,priorityNum:50,priorityLabel:"medium",dependencyIds:[],dueDate:null,etaEndAt:null,expectedDurationHours:16,expectedBudgetUsd:300,assignedAgents:[],updatedAt:g.createdAt})),u=new Set(l.map(g=>g.id)),d=n.milestones.map(g=>({id:g.id,type:"milestone",title:g.title,status:g.status,parentId:g.workstreamId&&u.has(g.workstreamId)?g.workstreamId:e.id,initiativeId:e.id,workstreamId:g.workstreamId&&u.has(g.workstreamId)?g.workstreamId:null,milestoneId:g.id,priorityNum:50,priorityLabel:"medium",dependencyIds:[],dueDate:g.dueDate,etaEndAt:g.dueDate,expectedDurationHours:6,expectedBudgetUsd:120,assignedAgents:[],updatedAt:g.createdAt})),f=new Set(d.map(g=>g.id)),m=n.tasks.map(g=>{const y=e5(g.priority),v=g.milestoneId&&f.has(g.milestoneId),k=g.workstreamId&&u.has(g.workstreamId);return{id:g.id,type:"task",title:g.title,status:g.status,parentId:v?g.milestoneId:k?g.workstreamId:e.id,initiativeId:e.id,workstreamId:k?g.workstreamId:null,milestoneId:v?g.milestoneId:null,priorityNum:y.priorityNum,priorityLabel:y.priorityLabel,dependencyIds:[],dueDate:g.dueDate,etaEndAt:g.dueDate,expectedDurationHours:2,expectedBudgetUsd:40,assignedAgents:[],updatedAt:g.createdAt}}),x=m.filter(g=>["todo","not_started","planned","pending","backlog"].includes(g.status.toLowerCase())).sort((g,y)=>{const v=g.priorityNum-y.priorityNum;if(v!==0)return v;const k=g.etaEndAt?Date.parse(g.etaEndAt):1/0,E=y.etaEndAt?Date.parse(y.etaEndAt):1/0;if(k!==E)return k-E;const S=g.updatedAt?Date.parse(g.updatedAt):0;return(y.updatedAt?Date.parse(y.updatedAt):0)-S}).map(g=>g.id);return{nodes:[s,...l,...d,...m],edges:[],recentTodos:x}}function s5(e,n){if(!e)return new Set;const s=new Map(n.map(d=>[d.id,d])),a=new Map;for(const d of n)for(const f of d.dependencyIds){const m=a.get(f)??[];m.push(d.id),a.set(f,m)}const l=new Set,u=[e];for(;u.length>0;){const d=u.shift();if(l.has(d))continue;l.add(d);const f=s.get(d);if(f){for(const m of f.dependencyIds)l.has(m)||u.push(m);for(const m of a.get(d)??[])l.has(m)||u.push(m)}}return l}function i5(e,n){return{id:e.id,name:e.title,summary:null,status:e.status,progress:null,initiativeId:n.id,createdAt:e.updatedAt}}function o5(e,n){return{id:e.id,title:e.title,description:null,status:e.status,dueDate:e.dueDate,initiativeId:n.id,workstreamId:e.workstreamId,createdAt:e.updatedAt}}function a5(e,n){return{id:e.id,title:e.title,description:null,status:e.status,priority:e.priorityLabel??`p${e.priorityNum}`,dueDate:e.dueDate,initiativeId:n.id,milestoneId:e.milestoneId,workstreamId:e.workstreamId,createdAt:e.updatedAt}}function l5({initiative:e}){var re;const{expandedInitiatives:n,toggleExpanded:s,openModal:a,agentEntityMap:l,authToken:u,embedMode:d,mutations:f}=Ds(),[m,x]=b.useState(!1),[g,y]=b.useState(null),[v,k]=b.useState(null),E=n.has(e.id),{graph:S,isLoading:j,degraded:F,error:_}=zS({initiativeId:e.id,authToken:u,embedMode:d,enabled:E}),{details:A,isLoading:P,error:M}=Jo({initiativeId:e.id,authToken:u,embedMode:d,enabled:E}),C=US({initiativeId:e.id,authToken:u,embedMode:d,enabled:E}),B=b.useMemo(()=>r5(e,A),[e,A]),R=!!(S&&S.nodes.length>0),G=B.nodes.length>0,he=!R&&G,$=he?B.nodes:R?(S==null?void 0:S.nodes)??[]:B.nodes,ie=he?B.edges:R?(S==null?void 0:S.edges)??[]:B.edges,W=he?B.recentTodos:R?(S==null?void 0:S.recentTodos)??[]:B.recentTodos,H=F.some(ne=>/401|unauthorized/i.test(ne))||!!(_&&/401|unauthorized/i.test(_))||!!(M&&/401|unauthorized/i.test(M)),L=_&&/unknown api endpoint/i.test(_)?"Graph API unavailable. Showing session-derived data.":_,X=M,te=[...F,...L?[L]:[],...X?[`Entity data partially unavailable: ${X}`]:[],...H?["OrgX auth is missing or expired in this local plugin instance. Reconnect in onboarding to load full workstreams/milestones/tasks."]:[]],Y=b.useMemo(()=>new Map($.map(ne=>[ne.id,ne])),[$]),Z=b.useMemo(()=>s5(g,$),[g,$]);b.useEffect(()=>{var ne;E&&!g&&$.length>0&&y(((ne=$[0])==null?void 0:ne.id)??null)},[E,$,g]);const V=((S==null?void 0:S.initiative.assignedAgents)??[]).map(ne=>({id:ne.id,name:ne.name,confidence:"high"})),N=l.get(e.id)??[],z=V.length>0?V:N,fe=$.filter(ne=>ne.type==="task"),se=fe.filter(ne=>n5(ne.status)).length,xe=fe.filter(ne=>t5(ne.status)).length,de=fe.filter(ne=>nn(ne.status)).length,ge=e.status==="active"&&se===0&&xe>0?"paused":e.status,ae=fe.length>0?fe:$.some(ne=>ne.type==="milestone")?$.filter(ne=>ne.type==="milestone"):$.filter(ne=>ne.type==="workstream"),_e=Math.round(ae.reduce((ne,ve)=>ne+(ve.expectedDurationHours||0),0)*10)/10,Ue=Math.round(ae.reduce((ne,ve)=>ne+(ve.expectedBudgetUsd||0),0)*100)/100,ee=$.filter(ne=>ne.type==="milestone"),Ce=$.filter(ne=>ne.type==="workstream"),De=E&&(R||A.workstreams.length>0||A.milestones.length>0||A.tasks.length>0),Te=fe.length>0?Ts(de,fe.length):ee.length>0?Ts(ee.filter(ne=>nn(ne.status)).length,ee.length):De&&Ce.length>0?Ts(Ce.filter(ne=>nn(ne.status)).length,Ce.length):null,Ze=Wl(Te===null?e.health:Te),Ge=VS(e.targetDate),yn=Ge.tone==="danger"?"border-rose-400/35 bg-rose-500/10 text-rose-200":Ge.tone==="warning"?"border-amber-400/35 bg-amber-500/10 text-amber-200":Ge.tone==="success"?"border-emerald-400/35 bg-emerald-500/10 text-emerald-200":"border-white/[0.12] bg-white/[0.03] text-white/50",sn=ne=>{if(ne.type==="initiative"){a({type:"initiative",entity:e});return}if(ne.type==="workstream"){a({type:"workstream",entity:i5(ne,e),initiative:e});return}if(ne.type==="milestone"){a({type:"milestone",entity:o5(ne,e),initiative:e});return}a({type:"task",entity:a5(ne,e),initiative:e})},Kn=async(ne,ve)=>{await f.updateEntity.mutateAsync({type:ne.type,id:ne.id,...ve})},gt=ne=>ve=>{ve.stopPropagation(),f.entityAction.mutate({type:"initiative",id:e.id,action:ne})};return i.jsxs("div",{id:`initiative-${e.id}`,className:`glass-panel soft-shadow rounded-2xl overflow-hidden border-l-2 transition-colors ${E?"border-l-[#BFFF00]/60":"border-l-transparent"}`,children:[i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":E,onClick:()=>s(e.id),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),s(e.id))},className:"group flex w-full cursor-pointer items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-white/[0.04]",children:[i.jsx(Oe.div,{animate:{rotate:E?90:0},transition:{type:"spring",stiffness:400,damping:25},className:"flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-md transition-colors group-hover:bg-white/[0.06]",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"text-white/40",children:i.jsx("path",{d:"m9 18 6-6-6-6"})})}),i.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${ge==="active"?"status-breathe":""}`,style:{backgroundColor:l0(ge)}}),i.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),a({type:"initiative",entity:e})},className:"text-[14px] font-semibold text-white hover:text-white/80 truncate transition-colors",children:e.name}),i.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border uppercase tracking-[0.08em] flex-shrink-0 ${Py[ge]}`,children:gn(ge)}),i.jsx("span",{className:`hidden md:inline-flex text-[10px] px-2 py-0.5 rounded-full border tracking-[0.06em] flex-shrink-0 ${yn}`,title:e.targetDate?new Date(e.targetDate).toLocaleDateString():"No target date",children:Ge.label}),i.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[i.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),(C.isRunning?C.stop:C.start)().catch(Ae=>{console.warn("[auto-continue] action failed",Ae)})},title:C.isRunning?"Stop auto-continue":"Start auto-continue (dispatch next-up tasks)",disabled:H||C.isStarting||C.isStopping,className:"flex items-center justify-center w-6 h-6 rounded-lg text-white/50 hover:text-white hover:bg-white/[0.08] transition-colors disabled:opacity-30 disabled:hover:bg-transparent",children:C.isRunning?i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"})}):i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M8 5v14l11-7z"})})}),ge==="active"&&i.jsx("button",{type:"button",onClick:gt("pause"),title:"Pause",className:"flex items-center justify-center w-6 h-6 rounded-lg text-white/50 hover:text-white hover:bg-white/[0.08] transition-colors",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[i.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),i.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]})}),ge==="paused"&&i.jsx("button",{type:"button",onClick:gt("resume"),title:"Resume",className:"flex items-center justify-center w-6 h-6 rounded-lg text-white/50 hover:text-white hover:bg-white/[0.08] transition-colors",children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M8 5v14l11-7z"})})}),i.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),a({type:"initiative",entity:e})},title:"Details",className:"flex items-center justify-center w-6 h-6 rounded-lg text-white/50 hover:text-white hover:bg-white/[0.08] transition-colors",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})})]}),i.jsx("div",{className:"flex-1 max-w-[200px] hidden sm:block",children:i.jsx("div",{className:"h-[2px] w-full rounded-full bg-white/[0.06] overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ze}%`,backgroundColor:l0(ge)}})})}),i.jsxs("span",{className:"text-[11px] text-white/40 flex-shrink-0 hidden sm:block",children:[Ze,"%"]}),i.jsx("div",{className:"flex-shrink-0 ml-auto",children:i.jsx(Ul,{agents:z,max:5})})]}),i.jsx(dr,{children:E&&i.jsx(Oe.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",stiffness:400,damping:35},className:"overflow-hidden",children:i.jsxs("div",{className:"px-4 pb-4 space-y-3 pt-3",children:[i.jsx("div",{className:"section-divider"}),j||!R&&P?i.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((ne,ve)=>i.jsx(zo,{className:"h-24 w-full rounded-xl"},`mc-loading-${ve}`))}):i.jsxs(i.Fragment,{children:[i.jsx(WS,{editMode:m,onToggleEditMode:()=>x(ne=>!ne)}),te.length>0&&i.jsxs("div",{className:"rounded-lg border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-[11px] text-amber-200/90",children:["Partial data: ",te.join(" | ")]}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-lg border border-white/[0.1] bg-white/[0.03] px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Next-Up Queue"}),i.jsxs("div",{className:"mt-1 text-[12px] text-white/85",children:[xe," todo • ",se," active"]})]}),i.jsxs("div",{className:"rounded-lg border border-white/[0.1] bg-white/[0.03] px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Expected Duration"}),i.jsxs("div",{className:"mt-1 text-[12px] text-white/85",children:[_e,"h"]})]}),i.jsxs("div",{className:"rounded-lg border border-white/[0.1] bg-white/[0.03] px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Expected Budget"}),i.jsxs("div",{className:"mt-1 text-[12px] text-white/85",children:["$",Ue.toLocaleString()]})]})]}),v&&i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-[#BFFF00]/25 bg-[#BFFF00]/10 px-3 py-1.5 text-[11px] text-[#D8FFA1]",children:[i.jsxs("span",{children:["Focused on workstream ",((re=Y.get(v))==null?void 0:re.title)??v]}),i.jsx("button",{type:"button",onClick:()=>k(null),className:"text-[10px] underline underline-offset-2",children:"Clear focus"})]}),i.jsx(HS,{nodes:$,edges:ie,selectedNodeId:g,focusedWorkstreamId:v,onSelectNode:ne=>{y(ne);const ve=Y.get(ne);(ve==null?void 0:ve.type)==="workstream"&&k(ve.id)}}),i.jsx(JS,{recentTodoIds:W,nodesById:Y,selectedNodeId:g,onSelectNode:ne=>{y(ne);const ve=Y.get(ne);(ve==null?void 0:ve.type)==="workstream"&&k(ve.id)}}),i.jsx(ZS,{nodes:$,edges:ie,selectedNodeId:g,highlightedNodeIds:Z,editMode:m,onSelectNode:y,onFocusWorkstream:k,onOpenNode:sn,onUpdateNode:Kn,mutations:f})]}),i.jsxs("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center justify-center gap-1.5 py-1.5 text-[10px] text-white/30 hover:text-white/60 transition-colors",children:[i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("path",{d:"m18 15-6-6-6 6"})}),"Collapse"]})]})})})]})}const c5={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},u5={hidden:{opacity:0,y:12},show:{opacity:1,y:0,transition:{type:"spring",stiffness:300,damping:30}}};function u0({initiatives:e}){return i.jsx(Oe.div,{variants:c5,initial:"hidden",animate:"show",className:"space-y-2",children:e.map(n=>i.jsx(Oe.div,{variants:u5,children:i.jsx(l5,{initiative:n})},n.id))})}function d5(){return i.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:i.jsx(Wn,{className:"max-w-sm p-8",children:i.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[i.jsx("div",{className:"relative flex items-center justify-center h-16 w-16 rounded-2xl",style:{backgroundColor:`${q.iris}1a`,border:`1px solid ${q.iris}33`},children:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:q.iris,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 6v6l4 2"})]})}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("h3",{className:"text-[14px] font-semibold text-white",children:"No initiatives yet"}),i.jsx("p",{className:"text-[12px] text-white/50 leading-relaxed",children:"Create initiatives in OrgX to see them here. Mission Control shows your full initiative hierarchy with workstreams, milestones, and tasks."})]})]})})})}function h5({initiative:e}){const{agentEntityMap:n,openModal:s,authToken:a,embedMode:l,mutations:u}=Ds(),d=n.get(e.id)??[],[f,m]=b.useState(!1),[x,g]=b.useState(""),{details:y,isLoading:v}=Jo({initiativeId:e.id,authToken:a,embedMode:l}),k=y.tasks.filter(j=>["active","in_progress"].includes(j.status.toLowerCase())).length,E=y.tasks.filter(j=>j.status.toLowerCase()==="blocked").length,S=y.tasks.filter(j=>nn(j.status)).length;return i.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[i.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h2",{className:"text-[16px] font-semibold text-white",children:e.name}),i.jsx("span",{className:`text-[10px] px-2.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${Py[e.status]}`,children:gn(e.status)})]}),e.description&&i.jsx("p",{className:"text-[13px] text-white/50 leading-relaxed",children:e.description}),d.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-white/30 uppercase tracking-wider",children:"Agents"}),i.jsx(Ul,{agents:d,max:6})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[i.jsx(yl,{label:"Workstreams",value:`${y.workstreams.length}`}),i.jsx(yl,{label:"Milestones",value:`${y.milestones.length}`}),i.jsx(yl,{label:"Active Tasks",value:`${k}`,accent:k>0?q.lime:void 0}),i.jsx(yl,{label:"Blocked",value:`${E}`,accent:E>0?q.red:void 0})]}),v?i.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((j,F)=>i.jsx(zo,{className:"h-14 w-full rounded-lg"},`init-detail-${F}`))}):i.jsxs(i.Fragment,{children:[y.workstreams.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(d0,{title:"Workstreams",count:y.workstreams.length}),y.workstreams.map(j=>{const F=y.tasks.filter(P=>P.workstreamId===j.id),_=F.filter(P=>nn(P.status)).length,A=F.length>0?Ts(_,F.length):typeof j.progress=="number"?Wl(j.progress<=1?j.progress*100:j.progress):nn(j.status)?100:null;return i.jsxs("button",{onClick:()=>s({type:"workstream",entity:j,initiative:e}),className:"w-full text-left rounded-xl border border-white/[0.08] bg-white/[0.03] p-3.5 transition-all hover:bg-white/[0.06] hover-lift",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[12px] text-white/90 break-words",children:j.name}),i.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${My(j.status)}`,children:gn(j.status)})]}),i.jsxs("div",{className:"mt-1.5 flex items-center gap-3 text-[10px] text-white/35 uppercase tracking-[0.08em]",children:[i.jsxs("span",{children:[F.length," tasks"]}),A!==null&&i.jsxs("span",{children:[A,"%"]})]})]},j.id)})]}),y.milestones.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(d0,{title:"Milestones",count:y.milestones.length}),y.milestones.map(j=>i.jsxs("button",{onClick:()=>s({type:"milestone",entity:j,initiative:e}),className:"w-full text-left rounded-xl border border-white/[0.08] bg-white/[0.03] p-3 transition-all hover:bg-white/[0.06] hover-lift",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[12px] text-white/90 break-words",children:j.title}),i.jsx("span",{className:"text-[10px] text-white/40 uppercase tracking-[0.08em]",children:gn(j.status)})]}),j.dueDate&&i.jsxs("span",{className:"text-[10px] text-white/30 mt-0.5 block",children:["Due: ",new Date(j.dueDate).toLocaleDateString()]})]},j.id))]}),i.jsxs("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/30 pt-2 border-t border-white/[0.06]",children:[y.tasks.length," total tasks · ",S," done"]})]})]}),i.jsx("div",{className:"border-t border-white/[0.06] bg-[#070b12]/85 px-6 py-3 backdrop-blur",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.status==="active"&&i.jsx("button",{onClick:()=>u.entityAction.mutate({type:"initiative",id:e.id,action:"pause"}),disabled:u.entityAction.isPending,className:"text-[11px] px-3 py-1.5 rounded-lg border transition-colors disabled:opacity-50",style:{backgroundColor:`${q.amber}20`,color:q.amber,borderColor:`${q.amber}30`},children:"Pause"}),e.status==="paused"&&i.jsx("button",{onClick:()=>u.entityAction.mutate({type:"initiative",id:e.id,action:"resume"}),disabled:u.entityAction.isPending,className:"text-[11px] px-3 py-1.5 rounded-lg border transition-colors disabled:opacity-50",style:{backgroundColor:q.lime,color:"#05060A",borderColor:`${q.lime}CC`},children:"Resume"}),i.jsx("div",{className:"flex-1"}),f?i.jsxs("form",{className:"flex flex-wrap items-center gap-2",onSubmit:j=>{j.preventDefault(),x.trim()&&u.createEntity.mutate({type:"workstream",title:x.trim(),initiative_id:e.id,status:"not_started"},{onSuccess:()=>{g(""),m(!1)}})},children:[i.jsx("input",{type:"text",value:x,onChange:j=>g(j.target.value),placeholder:"Workstream name...",autoFocus:!0,className:"text-[12px] bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-white/80 placeholder-white/30 w-[180px] outline-none focus:border-white/25"}),i.jsx("button",{type:"submit",disabled:!x.trim()||u.createEntity.isPending,className:"text-[11px] px-2.5 py-1 rounded-lg border disabled:opacity-50",style:{backgroundColor:`${q.lime}20`,color:q.lime,borderColor:`${q.lime}30`},children:"Add"}),i.jsx("button",{type:"button",onClick:()=>{m(!1),g("")},className:"text-[11px] px-2.5 py-1 rounded-lg bg-white/5 text-white/40 border border-white/10",children:"Cancel"})]}):i.jsx("button",{onClick:()=>m(!0),className:"text-[11px] px-3 py-1.5 rounded-lg border bg-white/5 text-white/50 border-white/10 hover:bg-white/10 transition-colors",children:"+ Workstream"})]})})]})}function yl({label:e,value:n,accent:s}){return i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",style:s?{borderTopColor:`${s}50`,borderTopWidth:2}:void 0,children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:e}),i.jsx("div",{className:"text-[15px] font-medium mt-0.5",style:{color:s??"rgba(255,255,255,0.8)"},children:n})]})}function d0({title:e,count:n}){return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-[0.08em] text-white/35",children:e}),i.jsx("span",{className:"text-[10px] text-white/30",children:n})]})}function f5({workstream:e,initiative:n}){const{agentEntityMap:s,openModal:a,authToken:l,embedMode:u,mutations:d}=Ds(),f=s.get(e.id)??s.get(n.id)??[],[m,x]=b.useState(!1),[g,y]=b.useState(""),{details:v,isLoading:k}=Jo({initiativeId:n.id,authToken:l,embedMode:u}),E=b.useMemo(()=>v.milestones.filter(A=>A.workstreamId===e.id),[v.milestones,e.id]),S=b.useMemo(()=>new Set(E.map(A=>A.id)),[E]),j=b.useMemo(()=>v.tasks.filter(A=>A.workstreamId===e.id||A.milestoneId!==null&&S.has(A.milestoneId)).sort((A,P)=>{const M=a0(A.status)-a0(P.status);if(M!==0)return M;const C=A.createdAt?Date.parse(A.createdAt):0;return(P.createdAt?Date.parse(P.createdAt):0)-C}),[v.tasks,S,e.id]),F=j.filter(A=>nn(A.status)).length,_=j.length>0?Ts(F,j.length):typeof e.progress=="number"?Wl(e.progress<=1?e.progress*100:e.progress):nn(e.status)?100:null;return i.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[i.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-6",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[i.jsx("button",{onClick:()=>a({type:"initiative",entity:n}),className:"break-words text-white/45 transition-colors hover:text-white",children:n.name}),i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-white/20",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),i.jsx("span",{className:"break-words font-medium text-white/70",children:e.name})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h2",{className:"text-[16px] font-semibold text-white",children:e.name}),i.jsx("span",{className:`text-[10px] px-2.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${My(e.status)}`,children:gn(e.status)})]}),e.summary&&i.jsx("p",{className:"text-[13px] text-white/50 leading-relaxed",children:e.summary}),f.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-white/30 uppercase tracking-wider",children:"Agents"}),i.jsx(Ul,{agents:f,max:6})]})]}),_!==null&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"text-[10px] text-white/30 uppercase tracking-wider",children:"Progress"}),i.jsxs("span",{className:"text-[12px] text-white/60",children:[_,"%"]})]}),i.jsx("div",{className:"h-1.5 w-full rounded-full bg-white/[0.06] overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${_}%`,backgroundColor:q.lime}})})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Tasks"}),i.jsx("div",{className:"text-[15px] font-medium text-white/80 mt-0.5",children:j.length})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Milestones"}),i.jsx("div",{className:"text-[15px] font-medium text-white/80 mt-0.5",children:E.length})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Progress"}),i.jsx("div",{className:"text-[15px] font-medium text-white/80 mt-0.5",children:_!==null?`${_}%`:"—"})]})]}),k?i.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((A,P)=>i.jsx(zo,{className:"h-12 w-full rounded-lg"},`ws-detail-${P}`))}):i.jsxs(i.Fragment,{children:[E.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-[0.08em] text-white/35",children:"Milestones"}),E.map(A=>i.jsx("button",{onClick:()=>a({type:"milestone",entity:A,initiative:n}),className:"w-full text-left rounded-xl border border-white/[0.08] bg-white/[0.03] p-3 transition-all hover:bg-white/[0.06] hover-lift",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[12px] text-white/90",children:A.title}),i.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${Fy(A.status)}`,children:gn(A.status)})]})},A.id))]}),j.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("span",{className:"text-[11px] uppercase tracking-[0.08em] text-white/35",children:["Tasks (",j.length,")"]}),j.map(A=>i.jsxs("button",{onClick:()=>a({type:"task",entity:A,initiative:n}),className:"w-full text-left rounded-xl border border-white/[0.08] bg-white/[0.03] p-3 transition-all hover:bg-white/[0.06] hover-lift",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[12px] text-white/90",children:A.title}),i.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full border uppercase tracking-[0.08em] flex-shrink-0 ${Ch(A.status)}`,children:gn(A.status)})]}),A.priority&&i.jsxs("span",{className:"text-[10px] text-white/30 mt-0.5 block uppercase tracking-wider",children:["Priority: ",A.priority]})]},A.id))]})]})]}),i.jsx("div",{className:"border-t border-white/[0.06] bg-[#070b12]/85 px-6 py-3 backdrop-blur",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.status==="not_started"&&i.jsx(ai,{label:"Start",color:q.lime,variant:"primary",onClick:()=>d.entityAction.mutate({type:"workstream",id:e.id,action:"start"}),disabled:d.entityAction.isPending}),e.status==="active"&&i.jsxs(i.Fragment,{children:[i.jsx(ai,{label:"Complete",color:q.teal,variant:"primary",onClick:()=>d.entityAction.mutate({type:"workstream",id:e.id,action:"complete"}),disabled:d.entityAction.isPending}),i.jsx(ai,{label:"Pause",color:q.amber,onClick:()=>d.entityAction.mutate({type:"workstream",id:e.id,action:"pause"}),disabled:d.entityAction.isPending}),i.jsx(ai,{label:"Block",color:q.red,variant:"destructive",onClick:()=>d.entityAction.mutate({type:"workstream",id:e.id,action:"block"}),disabled:d.entityAction.isPending})]}),(e.status==="paused"||e.status==="blocked")&&i.jsx(ai,{label:"Resume",color:q.lime,variant:"primary",onClick:()=>d.entityAction.mutate({type:"workstream",id:e.id,action:"resume"}),disabled:d.entityAction.isPending}),i.jsx("div",{className:"flex-1"}),m?i.jsxs("form",{className:"flex flex-wrap items-center gap-2",onSubmit:A=>{A.preventDefault(),g.trim()&&d.createEntity.mutate({type:"task",title:g.trim(),workstream_id:e.id,initiative_id:n.id,status:"todo"},{onSuccess:()=>{y(""),x(!1)}})},children:[i.jsx("input",{type:"text",value:g,onChange:A=>y(A.target.value),placeholder:"Task title...",autoFocus:!0,className:"text-[12px] bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-white/80 placeholder-white/30 w-[160px] outline-none focus:border-white/25"}),i.jsx(ai,{label:"Add",color:q.lime,onClick:()=>{},disabled:!g.trim()||d.createEntity.isPending}),i.jsx("button",{type:"button",onClick:()=>{x(!1),y("")},className:"text-[11px] px-2.5 py-1 rounded-lg bg-white/5 text-white/40 border border-white/10",children:"Cancel"})]}):i.jsx("button",{onClick:()=>x(!0),className:"text-[11px] px-3 py-1.5 rounded-lg border bg-white/5 text-white/50 border-white/10 hover:bg-white/10 transition-colors",children:"+ Task"})]})})]})}function ai({label:e,color:n,onClick:s,disabled:a,variant:l="secondary"}){const u=l==="primary"?{backgroundColor:n,color:"#05060A",borderColor:`${n}CC`}:l==="destructive"?{backgroundColor:`${n}14`,color:n,borderColor:`${n}40`}:{backgroundColor:`${n}20`,color:n,borderColor:`${n}30`};return i.jsx("button",{onClick:s,disabled:a,className:"rounded-lg border px-3 py-1.5 text-[11px] transition-colors disabled:opacity-50",style:u,children:e})}function p5({milestone:e,initiative:n}){var y;const{openModal:s,authToken:a,embedMode:l,mutations:u}=Ds(),{details:d}=Jo({initiativeId:n.id,authToken:a,embedMode:l}),f=d.tasks.filter(v=>v.milestoneId===e.id),m=e.status.toLowerCase()==="done"||e.status.toLowerCase()==="completed",x=f.filter(v=>nn(v.status)).length,g=f.length>0?Ts(x,f.length):m?100:0;return i.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[i.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-6",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[i.jsx("button",{onClick:()=>s({type:"initiative",entity:n}),className:"break-words text-white/45 transition-colors hover:text-white",children:n.name}),i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-white/20",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),i.jsx("span",{className:"break-words font-medium text-white/70",children:e.title})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-3 h-3 rounded-full border flex-shrink-0",style:{backgroundColor:m?`${q.teal}99`:"rgba(255,255,255,0.1)",borderColor:m?`${q.teal}66`:"rgba(255,255,255,0.2)"}}),i.jsx("h2",{className:"text-[16px] font-semibold text-white",children:e.title}),i.jsx("span",{className:`text-[10px] px-2.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${Fy(e.status)}`,children:gn(e.status)})]}),e.description&&i.jsx("p",{className:"text-[13px] text-white/50 leading-relaxed",children:e.description})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.dueDate&&i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Due Date"}),i.jsx("div",{className:"text-[13px] text-white/80 mt-0.5",children:new Date(e.dueDate).toLocaleDateString()})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Associated Tasks"}),i.jsx("div",{className:"text-[15px] font-medium text-white/80 mt-0.5",children:f.length})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Completion"}),i.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[i.jsx("div",{className:"h-1.5 flex-1 rounded-full bg-white/[0.06] overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${g}%`,backgroundColor:q.teal}})}),i.jsxs("div",{className:"text-[12px] text-white/75",style:{fontVariantNumeric:"tabular-nums"},children:[g,"%"]})]}),i.jsxs("div",{className:"mt-1 text-[10px] text-white/35",children:[x,"/",f.length," done"]})]})]}),f.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-[0.08em] text-white/35",children:"Tasks"}),f.map(v=>i.jsx("button",{onClick:()=>s({type:"task",entity:v,initiative:n}),className:"w-full text-left rounded-xl border border-white/[0.08] bg-white/[0.03] p-3 transition-all hover:bg-white/[0.06] hover-lift",children:i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[12px] text-white/90",children:v.title}),i.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full border uppercase tracking-[0.08em] flex-shrink-0 ${Ch(v.status)}`,children:gn(v.status)})]})},v.id))]})]}),i.jsx("div",{className:"border-t border-white/[0.06] bg-[#070b12]/85 px-6 py-3 backdrop-blur",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!m&&e.status.toLowerCase()==="planned"&&i.jsx("button",{onClick:()=>u.entityAction.mutate({type:"milestone",id:e.id,action:"start"}),disabled:u.entityAction.isPending,className:"text-[11px] px-3 py-1.5 rounded-lg border transition-colors disabled:opacity-50",style:{backgroundColor:q.lime,color:"#05060A",borderColor:`${q.lime}CC`},children:"Start"}),!m&&(e.status.toLowerCase()==="in_progress"||e.status.toLowerCase()==="at_risk")&&i.jsx("button",{onClick:()=>{const v=f.length===0||f.every(k=>nn(k.status));u.entityAction.mutate({type:"milestone",id:e.id,action:"complete",force:!v})},disabled:u.entityAction.isPending,className:"text-[11px] px-3 py-1.5 rounded-lg border transition-colors disabled:opacity-50",style:{backgroundColor:q.teal,color:"#05060A",borderColor:`${q.teal}CC`},children:f.length>0&&!f.every(v=>nn(v.status))?"Complete (force)":"Complete"}),m&&i.jsx("span",{className:"text-[11px] text-white/50",children:"Milestone is complete."}),u.entityAction.error&&i.jsx("span",{className:"text-[11px] ml-2",style:{color:`${q.red}b3`},children:(y=u.entityAction.error)==null?void 0:y.message})]})})]})}function m5({task:e,initiative:n}){var k,E;const{agentEntityMap:s,openModal:a,mutations:l,closeModal:u}=Ds(),d=s.get(e.id)??s.get(n.id)??[],[f,m]=b.useState(!1),x=e.status.toLowerCase(),g=S=>{l.entityAction.mutate({type:"task",id:e.id,action:S},{onSuccess:()=>u()})},y=()=>{l.deleteEntity.mutate({type:"task",id:e.id},{onSuccess:()=>u()})},v=l.entityAction.isPending||l.deleteEntity.isPending;return i.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[i.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-6",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[i.jsx("button",{onClick:()=>a({type:"initiative",entity:n}),className:"break-words text-white/45 transition-colors hover:text-white",children:n.name}),i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-white/20",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),i.jsx("span",{className:"break-words font-medium text-white/70",children:e.title})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx("h2",{className:"break-words text-[16px] font-semibold text-white",children:e.title}),i.jsx("span",{className:`text-[10px] px-2.5 py-0.5 rounded-full border uppercase tracking-[0.08em] ${Ch(e.status)}`,children:gn(e.status)})]}),e.description&&i.jsx(_o,{text:e.description,mode:"block",className:"text-[13px] text-white/50 leading-relaxed"}),d.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-white/30 uppercase tracking-wider",children:"Agents"}),i.jsx(Ul,{agents:d,max:4})]})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Status"}),i.jsx("div",{className:"text-[13px] text-white/80 mt-0.5",children:gn(e.status)})]}),i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Priority"}),i.jsx("div",{className:"text-[13px] text-white/80 mt-0.5",children:e.priority??"—"})]}),e.dueDate&&i.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-white/35",children:"Due Date"}),i.jsx("div",{className:"text-[13px] text-white/80 mt-0.5",children:new Date(e.dueDate).toLocaleDateString()})]})]}),(l.entityAction.error||l.deleteEntity.error)&&i.jsx("div",{className:"text-[11px] px-1",style:{color:`${q.red}b3`},children:((k=l.entityAction.error)==null?void 0:k.message)??((E=l.deleteEntity.error)==null?void 0:E.message)})]}),i.jsx("div",{className:"border-t border-white/[0.06] bg-[#070b12]/85 px-6 py-3 backdrop-blur",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x==="todo"&&i.jsx(No,{label:"Start",color:q.lime,variant:"primary",onClick:()=>g("start"),disabled:v}),(x==="in_progress"||x==="active")&&i.jsx(No,{label:"Complete",color:q.teal,variant:"primary",onClick:()=>g("complete"),disabled:v}),(x==="todo"||x==="in_progress"||x==="active")&&i.jsx(No,{label:"Block",color:q.red,variant:"destructive",onClick:()=>g("block"),disabled:v}),x==="blocked"&&i.jsx(No,{label:"Unblock",color:q.amber,onClick:()=>g("unblock"),disabled:v}),i.jsx("div",{className:"flex-1"}),f?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px]",style:{color:`${q.red}b3`},children:"Delete?"}),i.jsx(No,{label:"Yes",color:q.red,onClick:y,disabled:v}),i.jsx("button",{onClick:()=>m(!1),disabled:v,className:"text-[11px] px-3 py-1.5 rounded-lg border bg-white/5 text-white/50 border-white/10 hover:bg-white/10 transition-colors disabled:opacity-50",children:"No"})]}):i.jsx("button",{onClick:()=>m(!0),disabled:v,className:"text-[11px] px-3 py-1.5 rounded-lg border bg-white/5 text-white/40 border-white/10 transition-colors disabled:opacity-50",style:{"--hover-bg":`${q.red}20`},children:"Delete"})]})})]})}function No({label:e,color:n,onClick:s,disabled:a,variant:l="secondary"}){const u=l==="primary"?{backgroundColor:n,color:"#05060A",borderColor:`${n}CC`}:l==="destructive"?{backgroundColor:`${n}14`,color:n,borderColor:`${n}40`}:{backgroundColor:`${n}20`,color:n,borderColor:`${n}30`};return i.jsx("button",{onClick:s,disabled:a,className:"text-[11px] px-3 py-1.5 rounded-lg border transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:u,children:e})}function x5({target:e,onClose:n}){return i.jsx(_i,{open:e!==null,onClose:n,maxWidth:"max-w-3xl",children:e&&i.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[e.type==="initiative"&&i.jsx(h5,{initiative:e.entity}),e.type==="workstream"&&i.jsx(f5,{workstream:e.entity,initiative:e.initiative}),e.type==="milestone"&&i.jsx(p5,{milestone:e.entity,initiative:e.initiative}),e.type==="task"&&i.jsx(m5,{task:e.entity,initiative:e.initiative})]})})}function h0(e){return(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_")}function g5(e){return e.split("_").map(n=>n.slice(0,1).toUpperCase()+n.slice(1)).join(" ")}const rd=["active","in_progress","not_started","planned","blocked","at_risk","paused","completed","done","backlog","todo","pending","draft"],y5=[{value:"target",label:"Target date"},{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],v5=[{value:"any",label:"Any time"},{value:"missing",label:"No target date"},{value:"overdue",label:"Overdue"},{value:"today",label:"Today"},{value:"next_7_days",label:"Next 7 days"},{value:"next_30_days",label:"Next 30 days"},{value:"custom_range",label:"Custom range"}],w5=[{value:"any",label:"Any time"},{value:"missing",label:"No timestamp"},{value:"today",label:"Today"},{value:"past_7_days",label:"Past 7 days"},{value:"past_30_days",label:"Past 30 days"},{value:"custom_range",label:"Custom range"}];function b5({initiatives:e,visibleCount:n}){const{statusFilters:s,dateField:a,datePreset:l,dateStart:u,dateEnd:d,activeFilterCount:f,hasActiveFilters:m,groupBy:x,setGroupBy:g,sortBy:y,setSortBy:v,setStatusFilters:k,toggleStatusFilter:E,setDateField:S,setDatePreset:j,setDateStart:F,setDateEnd:_,clearFilters:A}=Ds(),[P,M]=b.useState(!1),C=b.useRef(null);b.useEffect(()=>{if(!P)return;const W=H=>{var X;const L=H.target;L&&((X=C.current)!=null&&X.contains(L)||M(!1))};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[P]);const B=b.useMemo(()=>{const W=new Map;for(const L of e){const X=new Set([h0(L.status),h0(L.rawStatus)]);for(const te of X)te&&W.set(te,(W.get(te)??0)+1)}for(const L of rd)W.has(L)||W.set(L,0);return Array.from(W.entries()).sort((L,X)=>{const te=rd.indexOf(L[0]),Y=rd.indexOf(X[0]);return te>=0&&Y>=0?te-Y:te>=0?-1:Y>=0?1:L[0].localeCompare(X[0])}).map(([L,X])=>({key:L,count:X}))},[e]),R=s.length,G=b.useMemo(()=>a==="target"?v5:w5,[a]);b.useEffect(()=>{G.some(W=>W.value===l)||j("any")},[l,G,j]);const he=f>0?`Filters (${f})`:"Filters",$=[{value:"none",label:"None"},{value:"status",label:"Status"},{value:"date",label:"Date"},{value:"category",label:"Category"}],ie=[{value:"default",label:"Default"},{value:"date_asc",label:"Date (earliest)"},{value:"date_desc",label:"Date (latest)"}];return i.jsxs("div",{ref:C,className:"relative flex items-center gap-2",children:[i.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/40",children:"Group"}),i.jsx("select",{value:x,onChange:W=>g(W.target.value),className:"h-8 rounded-lg border border-white/[0.12] bg-white/[0.03] px-2 text-[11px] text-white/75 focus:border-[#BFFF00]/40 focus:outline-none",children:$.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]}),i.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/40",children:"Sort"}),i.jsx("select",{value:y,onChange:W=>v(W.target.value),className:"h-8 rounded-lg border border-white/[0.12] bg-white/[0.03] px-2 text-[11px] text-white/75 focus:border-[#BFFF00]/40 focus:outline-none",children:ie.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]}),i.jsx("button",{type:"button",onClick:()=>M(W=>!W),className:`h-10 rounded-lg border px-3 text-[11px] uppercase tracking-[0.08em] transition-colors ${P||f>0?"border-[#BFFF00]/40 bg-[#BFFF00]/12 text-[#D8FFA1]":"border-white/[0.12] text-white/75 hover:border-white/[0.2] hover:text-white"}`,children:he}),i.jsxs("div",{className:"hidden lg:block text-[11px] text-white/55 whitespace-nowrap",children:[n,"/",e.length]}),m&&i.jsx("button",{type:"button",onClick:A,className:"h-10 rounded-lg border border-white/[0.12] px-2.5 text-[10px] uppercase tracking-[0.08em] text-white/70 transition-colors hover:border-white/[0.2] hover:text-white whitespace-nowrap",children:"Clear"}),i.jsx(dr,{children:P&&i.jsxs(Oe.div,{initial:{opacity:0,y:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.97},transition:{duration:.15},className:"absolute right-0 top-12 z-30 w-[340px] max-w-[92vw] rounded-xl border border-white/[0.12] bg-[#090d14]/95 p-3 shadow-[0_16px_40px_rgba(0,0,0,0.45)] backdrop-blur-xl",children:[i.jsxs("div",{className:"sm:hidden grid grid-cols-2 gap-2",children:[i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.1em] text-white/45",children:"Group"}),i.jsx("select",{value:x,onChange:W=>g(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none",children:$.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]}),i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.1em] text-white/45",children:"Sort"}),i.jsx("select",{value:y,onChange:W=>v(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none",children:ie.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]})]}),i.jsx("div",{className:"sm:hidden mt-3 border-t border-white/[0.08]"}),i.jsx("div",{className:"text-[10px] uppercase tracking-[0.1em] text-white/45",children:"Status"}),i.jsx("div",{className:"mt-2 max-h-44 space-y-1 overflow-auto pr-1",children:B.map(W=>{const H=s.includes(W.key);return i.jsxs("label",{className:"flex cursor-pointer items-center justify-between rounded-md border border-white/[0.08] bg-white/[0.02] px-2.5 py-1.5 text-[11px] text-white/80 hover:border-white/[0.14]",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",checked:H,onChange:()=>E(W.key),className:"h-3.5 w-3.5 accent-[#BFFF00]"}),i.jsx("span",{children:g5(W.key)})]}),i.jsx("span",{className:"text-[10px] text-white/50",children:W.count})]},W.key)})}),i.jsxs("div",{className:"mt-2 flex justify-between",children:[i.jsx("button",{type:"button",onClick:()=>k([]),className:`text-[10px] uppercase tracking-[0.08em] ${R>0?"text-white/70 hover:text-white":"text-white/35"}`,disabled:R===0,children:"Clear status"}),i.jsxs("div",{className:"text-[10px] text-white/45",children:[R," selected"]})]}),i.jsxs("div",{className:"mt-3 border-t border-white/[0.08] pt-3",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.1em] text-white/45",children:"Date"}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Field"}),i.jsx("select",{value:a,onChange:W=>S(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none",children:y5.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]}),i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Condition"}),i.jsx("select",{value:l,onChange:W=>j(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none",children:G.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))})]})]}),l==="custom_range"&&i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"Start"}),i.jsx("input",{type:"date",value:u,onChange:W=>F(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none"})]}),i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-white/45",children:"End"}),i.jsx("input",{type:"date",value:d,onChange:W=>_(W.target.value),className:"h-9 rounded-lg border border-white/[0.12] bg-black/30 px-2 text-[11px] text-white focus:border-[#BFFF00]/40 focus:outline-none"})]})]})]})]})})]})}function f0(e){return(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_")}function Rd(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function p0(e){if(!e)return null;const n=Date.parse(`${e}T00:00:00`);return Number.isFinite(n)?n:null}function k5(e,n){return n==="target"?e.targetDate??null:n==="created"?e.createdAt??null:e.updatedAt??e.createdAt??null}function j5(e,n){if(n==="status"){const s=new Map,a=["active","blocked","paused","completed"];for(const l of e){const u=l.status??"active",d=s.get(u)??[];d.push(l),s.set(u,d)}return a.filter(l=>s.has(l)).concat(Array.from(s.keys()).filter(l=>!a.includes(l))).map(l=>{var u;return{key:l,label:l.charAt(0).toUpperCase()+l.slice(1),count:((u=s.get(l))==null?void 0:u.length)??0,initiatives:s.get(l)??[]}})}if(n==="category"){const s=new Map;for(const a of e){const l=a.category??"Uncategorized",u=s.get(l)??[];u.push(a),s.set(l,u)}return Array.from(s.entries()).sort((a,l)=>a[0].localeCompare(l[0])).map(([a,l])=>({key:a,label:a,count:l.length,initiatives:l}))}if(n==="date"){const a=Rd(new Date),l=a+7*864e5,u=a+30*864e5,d={overdue:[],this_week:[],this_month:[],later:[],no_date:[]};for(const m of e){const x=m.targetDate?Date.parse(m.targetDate):null;x===null||!Number.isFinite(x)?d.no_date.push(m):x<a?d.overdue.push(m):x<l?d.this_week.push(m):x<u?d.this_month.push(m):d.later.push(m)}const f={overdue:"Overdue",this_week:"This Week",this_month:"This Month",later:"Later",no_date:"No Date"};return["overdue","this_week","this_month","later","no_date"].filter(m=>d[m].length>0).map(m=>({key:m,label:f[m],count:d[m].length,initiatives:d[m]}))}return[]}function So(e,n){return`${e}:${n}`}function N5(e){return`mc-group-${e}`.toLowerCase().replace(/[^a-z0-9_-]+/g,"-")}function S5(e,n){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}function C5({initiatives:e,activities:n,agents:s,isLoading:a,authToken:l,embedMode:u,initialInitiativeId:d,connection:f,lastSnapshotAt:m,error:x,hasApiKey:g,onOpenSettings:y,onRefresh:v}){const k=_S({activities:n,agents:s,initiatives:e});return i.jsx(OS,{agentEntityMap:k,authToken:l,embedMode:u,children:i.jsx(E5,{initiatives:e,isLoading:a,initialInitiativeId:d,connection:f,lastSnapshotAt:m,error:x,hasApiKey:g,onOpenSettings:y,onRefresh:v})})}function A5(e){if(!e)return"unknown";const n=Date.parse(e);if(!Number.isFinite(n))return"unknown";try{return new Date(n).toLocaleString()}catch{return"unknown"}}function E5({initiatives:e,isLoading:n,initialInitiativeId:s,connection:a,lastSnapshotAt:l,error:u,hasApiKey:d,onOpenSettings:f,onRefresh:m}){const{searchQuery:x,setSearchQuery:g,statusFilters:y,dateField:v,datePreset:k,dateStart:E,dateEnd:S,hasActiveFilters:j,groupBy:F,sortBy:_,expandedInitiatives:A,expandAll:P,collapseAll:M,modalTarget:C,closeModal:B,expandInitiative:R}=Ds(),G=b.useRef(!1),[he,$]=b.useState(new Set),ie=b.useMemo(()=>{const xe=Rd(new Date),de=x.toLowerCase().trim().split(/\s+/).filter(Boolean);return e.filter(ge=>{if(y.length>0&&![f0(ge.status),f0(ge.rawStatus)].filter(Boolean).some(Te=>y.includes(Te)))return!1;const ae=k5(ge,v),_e=ae?Date.parse(ae):Number.NaN,Ue=Number.isFinite(_e)?Rd(new Date(_e)):null,ee=Ue===null?null:Math.round((Ue-xe)/864e5);if(k==="missing"&&Ue!==null||k==="overdue"&&!(ee!==null&&ee<0)||k==="today"&&ee!==0||k==="next_7_days"&&!(ee!==null&&ee>=0&&ee<=7)||k==="next_30_days"&&!(ee!==null&&ee>=0&&ee<=30)||k==="past_7_days"&&!(ee!==null&&ee<=0&&ee>=-7)||k==="past_30_days"&&!(ee!==null&&ee<=0&&ee>=-30))return!1;if(k==="custom_range"){const De=p0(E),Te=p0(S);if(Ue===null||De!==null&&Ue<De||Te!==null&&Ue>Te)return!1}if(de.length===0)return!0;const Ce=[ge.name,ge.description??"",ge.status,ge.rawStatus??"",ge.category??""].join(" ").toLowerCase();return de.every(De=>Ce.includes(De))})},[e,x,y,v,k,E,S]),W=b.useMemo(()=>_==="default"?ie:[...ie].sort((se,xe)=>{const de=se.targetDate?Date.parse(se.targetDate):Number.NaN,ge=xe.targetDate?Date.parse(xe.targetDate):Number.NaN,ae=Number.isFinite(de),_e=Number.isFinite(ge);return!ae&&!_e?0:ae?_e?_==="date_asc"?de-ge:ge-de:-1:1}),[ie,_]),H=b.useMemo(()=>F!=="none"?j5(W,F):null,[W,F]),L=b.useMemo(()=>(H==null?void 0:H.map(se=>So(F,se.key)))??[],[F,H]),X=L.length>0&&L.every(se=>he.has(se)),te=b.useCallback(se=>{$(xe=>{const de=new Set(xe);return de.has(se)?de.delete(se):de.add(se),de})},[]);b.useEffect(()=>{if(!H||H.length===0){$(xe=>xe.size===0?xe:new Set);return}const se=new Set(H.map(xe=>So(F,xe.key)));$(xe=>{const de=new Set(Array.from(xe).filter(ge=>se.has(ge)));return de.size===0&&de.add(So(F,H[0].key)),S5(de,xe)?xe:de})},[F,H]),b.useEffect(()=>{if(s&&!G.current&&!n&&e.length>0){if(R(s),H){const se=H.find(xe=>xe.initiatives.some(de=>de.id===s));if(se){const xe=So(F,se.key);$(de=>{if(de.has(xe))return de;const ge=new Set(de);return ge.add(xe),ge})}}G.current=!0,requestAnimationFrame(()=>{const se=document.getElementById(`initiative-${s}`);se==null||se.scrollIntoView({behavior:"smooth",block:"start"})})}},[s,n,e.length,R,F,H]);const Y=W.length>0&&A.size>=W.length,Z=!!(!n&&(a==="reconnecting"||a==="disconnected"||u)),V=a==="disconnected"?"error":a==="reconnecting"||u?"warn":"info",N=d?a==="disconnected"?"Offline":a==="reconnecting"?"Reconnecting":u?"Live stream degraded":"Status":"Connect OrgX",z=d?u||(a==="disconnected"?"Mission Control is offline. Data may be stale until OrgX reconnects.":"Live data is recovering. Some sections may lag."):"No OrgX API key configured. Connect to see Mission Control live updates.",fe=V==="error"?"border-red-400/25 bg-red-500/10 text-red-100":V==="warn"?"border-amber-400/25 bg-amber-500/10 text-amber-100":"border-white/[0.08] bg-white/[0.03] text-white/70";return i.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"relative flex-1 min-h-0",children:[i.jsx("div",{className:"pointer-events-none absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-[#02040A] to-transparent z-10"}),i.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-[#02040A] to-transparent z-10"}),i.jsx("div",{className:"h-full overflow-y-auto overflow-x-hidden",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"sticky top-0 z-20 -mx-4 px-4 pt-4 pb-3 sm:-mx-6 sm:px-6 bg-[#02040A]/75 backdrop-blur",children:[Z&&i.jsx("div",{className:`mb-3 rounded-2xl border px-4 py-3 ${fe}`,children:i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-[220px]",children:[i.jsx("div",{className:"text-[12px] font-semibold tracking-[-0.01em]",children:N}),i.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed opacity-90",children:z}),i.jsxs("div",{className:"mt-1 text-[11px] opacity-70",children:["Last snapshot: ",A5(l)]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[m&&i.jsx("button",{type:"button",onClick:m,className:"h-9 rounded-full border border-white/[0.14] bg-white/[0.05] px-3 text-[11px] font-semibold text-white/80 transition-colors hover:bg-white/[0.1]",children:"Refresh"}),f&&i.jsx("button",{type:"button",onClick:f,className:"h-9 rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-3 text-[11px] font-semibold text-[#D8FFA1] transition-colors hover:bg-[#BFFF00]/20",children:"Settings"})]})]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("div",{className:"min-w-[220px] flex-1",children:i.jsx(Ey,{value:x,onChange:g,placeholder:"Search initiatives, status, or category..."})}),i.jsx(b5,{initiatives:e,visibleCount:ie.length}),W.length>0&&i.jsx("button",{type:"button",onClick:()=>{Y?M():P(W.map(se=>se.id))},className:"h-10 rounded-lg border border-white/[0.12] px-3 text-[11px] uppercase tracking-[0.08em] text-white/70 transition-colors hover:border-white/[0.2] hover:text-white whitespace-nowrap",children:Y?"Collapse All":"Expand All"}),H&&L.length>0&&i.jsx("button",{type:"button",onClick:()=>{$(X?new Set:new Set(L))},className:"h-10 rounded-lg border border-white/[0.12] px-3 text-[11px] uppercase tracking-[0.08em] text-white/70 transition-colors hover:border-white/[0.2] hover:text-white whitespace-nowrap",children:X?"Collapse Groups":"Expand Groups"})]})]}),n?i.jsx("div",{className:"space-y-3 pb-8",children:Array.from({length:4}).map((se,xe)=>i.jsxs("div",{className:"glass-panel soft-shadow rounded-2xl p-4",children:[i.jsx(zo,{className:"h-4 w-2/5 rounded"}),i.jsx(zo,{className:"h-1 w-full rounded mt-3"})]},`mc-skeleton-${xe}`))}):e.length===0?d?i.jsx("div",{className:"pb-8",children:i.jsx(d5,{})}):i.jsx("div",{className:"pb-8",children:i.jsxs("div",{className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-6 py-8 text-center",children:[i.jsx("div",{className:"text-[14px] font-semibold text-white/85",children:"Connect OrgX to get started"}),i.jsx("div",{className:"mt-1 text-[12px] text-white/55",children:"Mission Control shows your initiative hierarchy once a user-scoped API key is configured."}),f&&i.jsx("div",{className:"mt-4 flex items-center justify-center",children:i.jsx("button",{type:"button",onClick:f,className:"h-10 rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-4 text-[12px] font-semibold text-[#D8FFA1] transition-colors hover:bg-[#BFFF00]/20",children:"Open settings"})})]})}):W.length===0?i.jsxs("div",{className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-4 py-8 text-center pb-8",children:[i.jsx("div",{className:"text-[13px] font-medium text-white/85",children:"No initiatives match the current filters"}),i.jsx("div",{className:"mt-1 text-[12px] text-white/50",children:j?"Try adjusting status/date filters or clear them.":"Try a broader search phrase."})]}):H?i.jsx("div",{className:"space-y-4 pb-8",children:H.map(se=>{const xe=So(F,se.key),de=N5(xe),ge=he.has(xe);return i.jsxs("div",{children:[i.jsxs("button",{type:"button","aria-expanded":ge,"aria-controls":de,onClick:()=>te(xe),className:"mb-2 flex w-full items-center gap-2 rounded-lg border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-left transition-colors hover:border-white/[0.14] hover:bg-white/[0.04]",children:[i.jsx("span",{"aria-hidden":!0,className:`inline-flex h-5 w-5 items-center justify-center rounded-md border border-white/[0.1] bg-white/[0.03] text-[11px] text-white/55 transition-transform ${ge?"rotate-90":""}`,children:"▶"}),i.jsx("span",{className:"text-[12px] font-medium text-white/75",children:se.label}),i.jsx("span",{className:"rounded-full border border-white/[0.1] bg-white/[0.04] px-2 py-0.5 text-[10px] text-white/50",children:se.count}),i.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-[0.08em] text-white/45",children:ge?"Hide":"Show"})]}),ge&&i.jsx("div",{id:de,children:i.jsx(u0,{initiatives:se.initiatives})})]},se.key)})}):i.jsx("div",{className:"pb-8",children:i.jsx(u0,{initiatives:W})})]})})]}),i.jsx(x5,{target:C,onClose:B})]})}function T5(e){const n=(e??"").toLowerCase();return n==="completed"||n==="done"?"completed":n==="blocked"||n==="at_risk"?"blocked":n==="paused"||n==="hold"?"paused":"active"}function P5(e){const n=(e??"").toLowerCase();return!["deleted","archived","cancelled"].includes(n)}function M5(e){return{id:e.id,name:e.title,status:T5(e.status),rawStatus:e.status??null,category:void 0,health:Math.max(0,Math.min(100,Math.round(e.progress??0))),daysRemaining:0,targetDate:e.targetDate??e.dueDate??e.etaEndAt??null,createdAt:e.createdAt??null,updatedAt:e.updatedAt??null,activeAgents:0,totalAgents:0,description:void 0}}function F5(e){return Kr({queryKey:Es.liveInitiatives({limit:300}),queryFn:async()=>{const n=await fetch("/orgx/api/live/initiatives?limit=300");return n.ok?((await n.json()).initiatives??[]).filter(a=>P5(a.status)).map(M5):[]},enabled:e,staleTime:3e4})}function D5(e){switch(e){case"starting":return"Starting secure session...";case"awaiting_browser_auth":return"Waiting for browser approval...";case"pairing":return"Confirming connection...";case"manual_key":return"Manual API key";case"connected":return"Connected";case"error":return"Connection issue";default:return"Ready to connect"}}function I5(e){switch(e){case"config":return"Plugin config";case"environment":return"Env key";case"persisted":return"Saved key";case"openclaw-config-file":return"OpenClaw key";case"legacy-dev":return"Legacy key";default:return"No key"}}function _5(e){return e==="awaiting_browser_auth"||e==="pairing"||e==="starting"?"active":e==="error"?"error":e==="connected"?"active":"idle"}const m0={idle:"bg-white/40",active:"bg-[#BFFF00]",error:"bg-red-400"};function L5({state:e,isStarting:n,isSubmittingManual:s,onRefresh:a,onStartPairing:l,onSubmitManualKey:u,onBackToPairing:d,onUseManualKey:f,onDisconnect:m}){const x=e.status==="manual_key",g=e.status==="awaiting_browser_auth"||e.status==="pairing",y=_5(e.status),v=y==="active"&&e.status!=="connected",k=!!e.lastError,E=b.useMemo(()=>e.status==="connected"&&e.connectionVerified?"Live sync active.":g?"Approve pairing in your browser to complete the connection.":e.status==="starting"?"Starting a secure pairing session.":e.status==="error"?"Trouble reaching OrgX. Reconnect or try a manual key.":e.hasApiKey?"API key detected. Verify connection to enable live features.":"Connect OrgX to sync initiatives, tasks, activity, and decisions.",[g,e.connectionVerified,e.hasApiKey,e.status]);return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"mb-4",children:[i.jsx("h3",{className:"text-[15px] font-semibold text-white",children:"OrgX connection"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-white/55",children:E}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"chip inline-flex items-center gap-2",children:[i.jsxs("span",{className:"relative flex h-2 w-2",children:[v&&i.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${m0[y]} opacity-40`}),i.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${m0[y]}`})]}),i.jsx("span",{className:"text-white/80",children:D5(e.status)})]}),e.workspaceName&&i.jsx("span",{className:"chip",children:e.workspaceName}),e.keySource&&e.keySource!=="none"&&i.jsx("span",{className:"chip",children:I5(e.keySource)}),e.hasApiKey&&!e.connectionVerified&&i.jsx("span",{className:"chip text-amber-100/90",children:"key present, not verified"})]})]}),k&&i.jsx("div",{className:"mb-4 rounded-xl border border-rose-300/20 bg-rose-400/10 p-4 text-[12px] text-rose-100",children:e.lastError}),x?i.jsx(ky,{isSubmitting:s,onSubmit:u,onBack:d}):i.jsxs("div",{className:"rounded-2xl border border-white/[0.07] bg-white/[0.02] p-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>{l()},disabled:n,"data-modal-autofocus":"true",className:"inline-flex items-center gap-2 rounded-full bg-[#BFFF00] px-4 py-2 text-[12px] font-semibold text-black transition-colors hover:bg-[#d3ff42] disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting...":"Connect in browser"}),i.jsx("button",{type:"button",onClick:f,className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-4 py-2 text-[12px] font-semibold text-white/70 transition-colors hover:bg-white/[0.06]",children:"Use API key"}),e.hasApiKey&&i.jsx("button",{type:"button",onClick:()=>{m()},className:"rounded-full border border-rose-300/25 bg-rose-400/10 px-4 py-2 text-[12px] font-semibold text-rose-100/90 transition-colors hover:bg-rose-400/15",children:"Disconnect"}),i.jsx("button",{type:"button",onClick:()=>{a()},className:Ke("rounded-full border border-white/[0.12] bg-white/[0.03] px-4 py-2 text-[12px] font-semibold text-white/70 transition-colors hover:bg-white/[0.06]",n&&"opacity-60"),children:"Refresh status"}),i.jsx("a",{href:"https://www.useorgx.com/settings",target:"_blank",rel:"noreferrer",className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-4 py-2 text-[12px] font-semibold text-white/70 transition-colors hover:bg-white/[0.06]",title:"Manage keys and workspace settings at useorgx.com",children:"Open OrgX settings"})]}),e.connectUrl&&(g||e.status==="starting")&&i.jsxs("div",{className:"mt-4 rounded-xl border border-[#BFFF00]/20 bg-[#BFFF00]/[0.06] px-4 py-3",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-[0.1em] text-[#D8FFA1]",children:"Pairing pending"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-white/65",children:"Approve the connection in your browser to finish pairing."}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i.jsx("a",{href:e.connectUrl,target:"_blank",rel:"noopener noreferrer",className:"rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-3 py-1.5 text-[11px] font-semibold text-[#D8FFA1]",children:"Approve in browser"}),e.expiresAt&&i.jsxs("span",{className:"text-[11px] text-white/40",children:["Expires ",new Date(e.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})]})]}),i.jsxs("div",{className:"mt-4 rounded-2xl border border-white/[0.06] bg-white/[0.02] p-4",children:[i.jsx("p",{className:"text-[12px] font-semibold text-white/80",children:"Key guidance"}),i.jsxs("p",{className:"mt-1 text-[12px] leading-relaxed text-white/45",children:["Use a user-scoped key (",i.jsx("code",{className:"rounded bg-black/40 px-1",children:"oxk_..."}),") whenever possible. User keys do not require a separate userId header."]})]})]})}const Dy=[{id:"openai",label:"OpenAI",hint:"Used for GPT models.",envVar:"OPENAI_API_KEY"},{id:"anthropic",label:"Anthropic",hint:"Used for Claude models.",envVar:"ANTHROPIC_API_KEY"},{id:"openrouter",label:"OpenRouter",hint:"Used for multi-vendor routing.",envVar:"OPENROUTER_API_KEY"}];function x0(e){return e==="openai"?"openaiApiKey":e==="anthropic"?"anthropicApiKey":"openrouterApiKey"}function R5(e){var n;return((n=Dy.find(s=>s.id===e))==null?void 0:n.label)??e}function O5({authToken:e=null,embedMode:n=!1,enabled:s=!0}){const a=jy({authToken:e,embedMode:n,enabled:s}),l=a.status,u=a.health,[d,f]=b.useState({openai:"",anthropic:"",openrouter:""}),[m,x]=b.useState({openai:!1,anthropic:!1,openrouter:!1}),[g,y]=b.useState({openai:!1,anthropic:!1,openrouter:!1}),[v,k]=b.useState(null),[E,S]=b.useState(null);b.useEffect(()=>{s&&(f({openai:"",anthropic:"",openrouter:""}),x({openai:!1,anthropic:!1,openrouter:!1}),y({openai:!1,anthropic:!1,openrouter:!1}),k(null),S(null))},[s]);const j=b.useMemo(()=>l!=null&&l.ok?Number(l.providers.openai.configured)+Number(l.providers.anthropic.configured)+Number(l.providers.openrouter.configured):0,[l]),F=async P=>{if(!s)return;S(null);const M=d[P].trim();if(!m[P])return;if(!M){S(`Enter a ${R5(P)} API key or use "Clear" to remove the saved key.`);return}const C=x0(P);try{k(P),await a.update({[C]:M}),x(B=>({...B,[P]:!1})),f(B=>({...B,[P]:""})),y(B=>({...B,[P]:!1}))}finally{k(null)}},_=async P=>{S(null);const M=x0(P);try{k(P),await a.update({[M]:null}),x(C=>({...C,[P]:!1})),f(C=>({...C,[P]:""})),y(C=>({...C,[P]:!1}))}finally{k(null)}},A=async()=>{S(null),await a.probe()};return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"mb-4",children:[i.jsx("h3",{className:"text-[15px] font-semibold text-white",children:"Provider keys"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-white/55",children:"Bring your own provider keys. Keys are stored locally and used for OpenClaw agent launches."}),j===0?i.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full border border-amber-200/20 bg-amber-200/10 px-3 py-1 text-[11px] text-amber-100/85",children:[i.jsx("span",{className:"inline-flex h-1.5 w-1.5 rounded-full bg-amber-200/80"}),"No keys detected yet. You can also use env vars."]}):i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"chip",children:[j," / 3 configured"]}),(l==null?void 0:l.updatedAt)&&i.jsxs("span",{className:"text-[11px] text-white/35",children:["Updated ",new Date(l.updatedAt).toLocaleString()]})]})]}),(E||a.error)&&i.jsx("div",{className:"mb-4 rounded-xl border border-rose-300/20 bg-rose-400/10 p-4 text-[12px] text-rose-100",children:E??a.error}),i.jsxs("div",{className:"mb-4 rounded-2xl border border-white/[0.06] bg-white/[0.02] p-4",children:[i.jsx("p",{className:"text-[12px] font-semibold text-white/80",children:"Where keys come from"}),i.jsxs("p",{className:"mt-1 text-[12px] leading-relaxed text-white/45",children:["If you set an env var (e.g."," ",i.jsx("code",{className:"rounded bg-black/40 px-1",children:"OPENAI_API_KEY"}),"), it will be used unless a saved key overrides it."]})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4",children:Dy.map(P=>{var H,L;const M=(H=l==null?void 0:l.providers)==null?void 0:H[P.id],C=(L=u==null?void 0:u.providers)==null?void 0:L[P.id],B=(M==null?void 0:M.masked)??null,R=(M==null?void 0:M.source)??"none",G=R==="stored",he=v===P.id,$=m[P.id]&&d[P.id].trim().length>0&&!a.isSaving&&!he,ie=G&&!a.isSaving&&!he,W=G?"Update":"Save";return i.jsxs("div",{className:"rounded-2xl border border-white/[0.07] bg-white/[0.02] p-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("p",{className:"text-[13px] font-semibold text-white",children:P.label}),i.jsx("span",{className:Ke("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em]",M!=null&&M.configured?"border-emerald-300/25 bg-emerald-400/10 text-emerald-100":"border-white/[0.12] bg-white/[0.03] text-white/55"),children:M!=null&&M.configured?"Configured":"Missing"})]}),i.jsxs("p",{className:"mt-1 text-[12px] text-white/45",children:[P.hint," ",i.jsxs("span",{className:"text-white/30",children:["Env: ",i.jsx("code",{className:"rounded bg-black/40 px-1",children:P.envVar})]})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[R!=="none"&&i.jsxs("span",{className:"chip",children:["source: ",R]}),B&&i.jsxs("span",{className:"chip",children:["key: ",B]}),C&&i.jsx("span",{className:Ke("chip",C.ok?"text-emerald-100":"text-rose-100"),children:C.ok?`ready (${C.modelCount??0} models)`:"not ready"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>y(X=>({...X,[P.id]:!X[P.id]})),className:"rounded-lg border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08]",title:g[P.id]?"Hide key":"Show key",children:g[P.id]?"Hide":"Show"}),i.jsx("button",{type:"button",onClick:()=>void A(),className:"rounded-lg border border-white/[0.12] bg-white/[0.03] px-3 py-1.5 text-[11px] font-semibold text-white/70 transition-colors hover:bg-white/[0.08]",title:"Probe configured models",children:"Probe"})]})]}),i.jsxs("div",{className:"mt-3",children:[i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1.5 block text-[11px] font-medium uppercase tracking-[0.14em] text-white/40",children:"API key (stored locally)"}),i.jsx("input",{value:d[P.id],onChange:X=>{f(te=>({...te,[P.id]:X.target.value})),x(te=>({...te,[P.id]:!0})),E&&S(null)},type:g[P.id]?"text":"password",placeholder:`Paste ${P.label} key`,className:"w-full rounded-xl border border-white/[0.08] bg-black/30 px-3 py-2.5 font-mono text-[12px] text-white/80 placeholder:text-white/20 focus:border-[#BFFF00]/40 focus:outline-none"})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void F(P.id),disabled:!$,className:"rounded-full bg-[#BFFF00] px-4 py-2 text-[12px] font-semibold text-black transition-colors hover:bg-[#d3ff42] disabled:cursor-not-allowed disabled:opacity-40",children:he?"Saving...":W}),i.jsx("button",{type:"button",onClick:()=>void _(P.id),disabled:!ie,className:"rounded-full border border-white/[0.12] bg-white/[0.03] px-4 py-2 text-[12px] font-semibold text-white/70 transition-colors hover:bg-white/[0.06] disabled:cursor-not-allowed disabled:opacity-35",children:"Clear stored"}),i.jsx("span",{className:"text-[11px] text-white/40",children:m[P.id]?"Unsaved changes":" "})]})]})]},P.id)})})]})}function B5({open:e,onClose:n,activeTab:s,onChangeTab:a,onboarding:l,authToken:u=null,embedMode:d=!1}){return i.jsx(_i,{open:e,onClose:n,maxWidth:"max-w-4xl",children:i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"border-b border-white/[0.06] px-5 py-4 sm:px-6",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[15px] font-semibold text-white",children:"Settings"}),i.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-white/55",children:"OrgX connection and provider keys for agent launches."})]}),i.jsx("button",{type:"button",onClick:n,"aria-label":"Close settings",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-white/[0.12] bg-white/[0.03] text-white/70 transition-colors hover:bg-white/[0.08] hover:text-white",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M18 6L6 18"}),i.jsx("path",{d:"M6 6l12 12"})]})})]}),i.jsx("div",{className:"mt-4 inline-flex rounded-full border border-white/[0.10] bg-white/[0.03] p-0.5",role:"tablist","aria-label":"Settings tabs",children:[{id:"orgx",label:"OrgX"},{id:"providers",label:"Provider keys"}].map(f=>{const m=s===f.id;return i.jsx("button",{type:"button",role:"tab","aria-selected":m,onClick:()=>a(f.id),className:Ke("rounded-full px-3 py-1.5 text-[11px] font-semibold transition-colors",m?"border border-lime/25 bg-lime/[0.14] text-lime shadow-[0_0_16px_rgba(191,255,0,0.08)]":"border border-transparent text-white/60 hover:bg-white/[0.06] hover:text-white"),children:f.label},f.id)})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4 sm:px-6",children:s==="orgx"?i.jsx(L5,{state:l.state,isStarting:l.isStarting,isSubmittingManual:l.isSubmittingManual,onRefresh:l.refreshStatus,onStartPairing:l.startPairing,onSubmitManualKey:l.submitManualKey,onBackToPairing:l.backToPairing,onUseManualKey:l.setManualMode,onDisconnect:l.disconnect}):i.jsx(O5,{authToken:u,embedMode:d,enabled:e})})]})})}const g0={connected:"Live",reconnecting:"Reconnecting",disconnected:"Offline"},$5={connected:q.lime,reconnecting:q.amber,disconnected:q.red},sd="orgx.mission_control.welcome.dismissed",id="orgx.demo_mode",od="orgx.first_run_guide.shown_session",y0={blocked:0,pending:1,queued:2,running:3,failed:4,cancelled:5,completed:6,archived:7};function xi(e){if(!e)return 0;const n=Date.parse(e);return Number.isFinite(n)?n:0}function V5(e){const n=xi(e);if(!n)return"unknown";try{return new Date(n).toLocaleString()}catch{return"unknown"}}function v0(e,n){const s=y0[e.status]??99,a=y0[n.status]??99;return s!==a?s-a:xi(e.updatedAt??e.lastEventAt??e.startedAt)-xi(n.updatedAt??n.lastEventAt??n.startedAt)}function z5(){const e=I1();return e.showGate?i.jsx(vN,{state:e.state,isLoading:e.isLoading,isStarting:e.isStarting,isSubmittingManual:e.isSubmittingManual,onRefresh:e.refreshStatus,onStartPairing:e.startPairing,onSubmitManualKey:e.submitManualKey,onBackToPairing:e.backToPairing,onUseManualKey:e.setManualMode,onSkip:e.skipGate}):i.jsx(H5,{onboarding:e})}function U5(e){const n=e.toLowerCase();return/market|email|campaign|content|brand/.test(n)?"Marketing":/product|feature|ux|discovery/.test(n)?"Product":/engineer|infra|platform|api|backend|frontend|dev/.test(n)?"Engineering":"Program"}function W5(e){return e==="Marketing"?["Brief","Draft","Review","Ship"]:e==="Engineering"?["Spec","Dev","QA","Deploy"]:e==="Product"?["Brief","Define","Build","Ship"]:["Plan","Build","Review","Ship"]}function K5(){return i.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center rounded-lg border border-white/[0.12] bg-white/[0.04] p-0.5",children:i.jsx("img",{src:zl,alt:"OrgX",className:"h-full w-full rounded-md object-contain"})})}function H5({onboarding:e}){const[n,s]=b.useState(()=>{if(typeof window>"u")return!1;if(new URLSearchParams(window.location.search).get("demo")==="1")return!0;try{return window.localStorage.getItem(id)==="1"}catch{return!1}}),a=n||e.state.hasApiKey&&e.state.connectionVerified,{data:l,isLoading:u,error:d,refetch:f,approveDecision:m,approveAllDecisions:x}=P1({useMock:n,enabled:!0,enableDecisions:a}),g=a&&l.connection==="connected",[y,v]=b.useState(null),[k,E]=b.useState(null),[S,j]=b.useState(null),[F,_]=b.useState(!1),[A,P]=b.useState([]),M=b.useRef(null),C=b.useRef(null),[B,R]=b.useState({open:!1,tab:"orgx"}),[G,he]=b.useState(!1),[$,ie]=b.useState("agents"),[W,H]=b.useState("initiatives"),[L,X]=b.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(sd)==="1");b.useEffect(()=>{typeof window>"u"||(L?window.localStorage.setItem(sd,"1"):window.localStorage.removeItem(sd))},[L]),b.useEffect(()=>{if(!(typeof window>"u"))try{n?window.localStorage.setItem(id,"1"):window.localStorage.removeItem(id)}catch{}},[n]),b.useEffect(()=>{if(!(typeof window>"u")&&!G&&!kN()){try{if(window.sessionStorage.getItem(od)==="1")return}catch{}if(n||e.state.connectionVerified){he(!0);try{window.sessionStorage.setItem(od,"1")}catch{}}}},[n,G,e.state.connectionVerified]);const te=b.useCallback(J=>{R(ke=>({open:!0,tab:J??ke.tab}))},[]),Y=b.useCallback(()=>{te("orgx")},[te]),[Z,V]=b.useState(()=>{if(new URLSearchParams(window.location.search).get("view")==="mission-control")return"mission-control";try{if(localStorage.getItem("orgx-dashboard-view")==="mission-control")return"mission-control"}catch{}return"activity"}),N=b.useCallback(J=>{V(J);try{localStorage.setItem("orgx-dashboard-view",J)}catch{}},[]),{data:z}=Sy(Z==="mission-control"),{data:fe}=F5(Z==="mission-control"),[se,xe]=b.useState(null),[de,ge]=b.useState(""),[ae,_e]=b.useState(!1),Ue=b.useCallback((J,ke)=>{xe({type:J,initiativeId:ke}),ge(""),_e(!1)},[]),ee=b.useCallback(()=>{xe(null),ge(""),_e(!1)},[]),Ce=b.useCallback(()=>{E(null)},[]);b.useEffect(()=>{var me;const J=((me=l.sessions.nodes[0])==null?void 0:me.id)??null;if(!J){y!==null&&v(null);return}if(y===null){v(J);return}l.sessions.nodes.some(le=>le.id===y)||v(J)},[l.sessions.nodes,y]),b.useEffect(()=>{if(!k)return;l.sessions.nodes.some(ke=>ke.id===k)||E(null)},[k,l.sessions.nodes]);const De=b.useCallback(J=>{v(J),E(J)},[]),Te=b.useCallback(J=>{const ke=J.trim();if(!ke)return;const me=l.sessions.nodes.find(le=>le.runId===ke||le.id===ke)??null;me&&(De(me.id),j(`Focused session: ${me.title}`))},[l.sessions.nodes,De]),Ze=b.useMemo(()=>l.sessions.nodes.find(J=>J.id===k)??null,[k,l.sessions.nodes]),Ge=b.useMemo(()=>l.sessions.nodes.find(J=>J.id===y)??null,[l.sessions.nodes,y]),yn=b.useMemo(()=>l.sessions.nodes.filter(J=>["running","queued","pending"].includes(J.status)).length,[l.sessions.nodes]),sn=b.useMemo(()=>l.sessions.nodes.filter(J=>J.status==="blocked"||J.blockers.length>0).length,[l.sessions.nodes]),Kn=b.useMemo(()=>{const J=[{id:"sessions",label:"Sessions",value:l.sessions.nodes.length,color:q.teal},{id:"active",label:"Active",value:yn,color:yn>0?q.lime:q.textMuted},{id:"blocked",label:"Blocked",value:sn,color:sn>0?q.red:q.textMuted},{id:"decisions",label:"Decisions",value:g?l.decisions.length:0,color:g&&l.decisions.length>0?q.amber:q.textMuted},{id:"outbox",label:"Outbox",value:l.outbox.pendingTotal,color:l.outbox.replayStatus==="error"?q.red:l.outbox.pendingTotal>0?q.amber:q.textMuted}];return l.handoffs.length>0&&J.push({id:"handoffs",label:"Handoffs",value:l.handoffs.length,color:q.iris}),J},[yn,sn,l.decisions.length,l.handoffs.length,l.outbox.pendingTotal,l.outbox.replayStatus,l.sessions.nodes.length,g]),gt=b.useMemo(()=>{const J=[];return d&&J.push({id:`stream-error:${d}`,kind:"error",title:"Live stream degraded",message:d}),l.connection!=="connected"&&J.push({id:`connection:${l.connection}`,kind:l.connection==="disconnected"?"error":"info",title:l.connection==="disconnected"?"Connection lost":"Reconnecting",message:l.connection==="disconnected"?"Dashboard is offline. Some data may be stale.":"Live data is recovering. Some sections may be delayed."}),l.outbox.pendingTotal>0&&J.push({id:`outbox:pending:${l.outbox.pendingTotal}`,kind:"info",title:"Buffered updates pending",message:`${l.outbox.pendingTotal} event(s) queued for replay.`}),l.outbox.replayStatus==="error"&&l.outbox.lastReplayError&&J.push({id:`outbox:error:${l.outbox.lastReplayError}`,kind:"error",title:"Outbox replay failed",message:l.outbox.lastReplayError}),S&&J.push({id:`ops:${S}`,kind:"info",title:"Update",message:S}),J},[l.connection,l.outbox.lastReplayError,l.outbox.pendingTotal,l.outbox.replayStatus,d,S]);b.useEffect(()=>{const J=new Set(gt.map(ke=>ke.id));P(ke=>ke.filter(me=>J.has(me)))},[gt]);const re=b.useMemo(()=>gt.filter(J=>!A.includes(J.id)),[A,gt]),ne=b.useCallback(J=>{P(ke=>ke.includes(J)?ke:ke.concat(J))},[]),ve=b.useCallback(()=>{P(gt.map(J=>J.id))},[gt]);b.useEffect(()=>{if(!F)return;const J=me=>{var Be,Ve;const le=me.target;le&&((Be=C.current)!=null&&Be.contains(le)||(Ve=M.current)!=null&&Ve.contains(le)||_(!1))},ke=me=>{me.key==="Escape"&&_(!1)};return document.addEventListener("mousedown",J),document.addEventListener("touchstart",J),document.addEventListener("keydown",ke),()=>{document.removeEventListener("mousedown",J),document.removeEventListener("touchstart",J),document.removeEventListener("keydown",ke)}},[F]);const Ae=b.useMemo(()=>{var me;const J=new Map;for(const le of l.sessions.nodes){const Be=le.initiativeId??le.groupId??"unscoped",Ve=le.groupLabel&&le.groupLabel.trim().length>0?le.groupLabel:le.initiativeId??"Unscoped Initiative",St=U5(Ve),$e=J.get(Be)??{id:Be,name:Ve,category:St,progressTotal:0,progressCount:0,statusCounts:{},activeAgents:new Set,allAgents:new Set,workstreams:new Map,latestEpoch:0};if(le.progress!==null&&($e.progressTotal+=le.progress,$e.progressCount+=1),$e.statusCounts[le.status]=($e.statusCounts[le.status]??0)+1,le.agentName&&($e.allAgents.add(le.agentName),["running","queued","pending","blocked"].includes(le.status)&&$e.activeAgents.add(le.agentName)),le.workstreamId){const Tt=l.sessions.groups.find(Yr=>Yr.id===le.workstreamId),Xt=((me=Tt==null?void 0:Tt.label)==null?void 0:me.trim())||le.workstreamId;$e.workstreams.set(le.workstreamId,Xt)}$e.latestEpoch=Math.max($e.latestEpoch,xi(le.updatedAt??le.lastEventAt??le.startedAt)),J.set(Be,$e)}const ke=[];for(const le of J.values()){const Be=le.progressCount>0?Math.round(le.progressTotal/le.progressCount):le.statusCounts.completed?100:le.statusCounts.running?55:0,Ve=le.category,St=W5(Ve),$e=Math.round(Math.max(0,Math.min(100,Be))/100*(St.length-1)),Tt=(le.statusCounts.blocked??0)>0,Xt=(le.statusCounts.completed??0)>0&&(le.statusCounts.running??0)===0&&(le.statusCounts.queued??0)===0&&(le.statusCounts.pending??0)===0&&(le.statusCounts.blocked??0)===0,Yr=St.map((Hn,Rs)=>{let Qn="upcoming";return(Xt||Rs<$e)&&(Qn="completed"),Rs===$e&&!Xt&&(Qn=Tt?"warning":"current"),{name:Hn,status:Qn}});ke.push({id:le.id,name:le.name,status:Xt?"completed":Tt?"blocked":"active",rawStatus:Xt?"completed":Tt?"blocked":"active",category:Ve,health:Math.max(0,Math.min(100,Be)),phases:Yr,currentPhase:Xt?St.length-1:$e,daysRemaining:0,targetDate:null,createdAt:le.latestEpoch>0?new Date(le.latestEpoch).toISOString():null,updatedAt:le.latestEpoch>0?new Date(le.latestEpoch).toISOString():null,activeAgents:le.activeAgents.size,totalAgents:le.allAgents.size,avatars:Array.from(le.activeAgents).slice(0,3),description:`${le.workstreams.size} workstreams are active right now.`,workstreams:Array.from(le.workstreams.entries()).map(([Hn,Rs])=>({id:Hn,name:Rs,status:"active"}))})}return ke.sort((le,Be)=>{const Ve=le.status==="blocked"?0:le.status==="active"?1:2,St=Be.status==="blocked"?0:Be.status==="active"?1:2;return Ve!==St?Ve-St:Be.health-le.health})},[l.sessions.nodes,l.sessions.groups]),Xe=b.useMemo(()=>{const J=(me,le)=>{var Be,Ve;return{...me,...le,health:le.health>0?le.health:me.health,activeAgents:Math.max(me.activeAgents,le.activeAgents),totalAgents:Math.max(me.totalAgents,le.totalAgents),avatars:(Be=me.avatars)!=null&&Be.length?me.avatars:le.avatars,workstreams:(Ve=me.workstreams)!=null&&Ve.length?me.workstreams:le.workstreams,description:me.description??le.description,rawStatus:le.rawStatus??me.rawStatus??null,targetDate:le.targetDate??me.targetDate??null,createdAt:le.createdAt??me.createdAt??null,updatedAt:le.updatedAt??me.updatedAt??null}},ke=new Map;for(const me of Ae)ke.set(me.id,me);for(const me of[...z??[],...fe??[]]){const le=ke.get(me.id);ke.set(me.id,le?J(le,me):me)}return Array.from(ke.values()).sort((me,le)=>{const Be=Tt=>Tt==="blocked"?0:Tt==="active"?1:Tt==="paused"?2:3,Ve=Be(me.status)-Be(le.status);if(Ve!==0)return Ve;const St=xi(le.updatedAt)-xi(me.updatedAt);if(St!==0)return St;const $e=le.health-me.health;return $e!==0?$e:me.name.localeCompare(le.name)})},[Ae,z,fe]),yt=b.useMemo(()=>{if(!Ze)return null;const J=Ze.agentName,ke=Ze.title;if(J){const me=l.activity.find(le=>{var Be;return le.runId===Ze.runId&&((Be=le.summary)==null?void 0:Be.trim())});if(me!=null&&me.summary){const le=me.summary.trim().length>40?me.summary.trim().slice(0,40)+"…":me.summary.trim();return`${J}: ${le}`}return J}if(ke){const me=ke.replace(/^(telegram|slack|discord|whatsapp|email|sms):/,"").trim();if(me.length>0)return me}return ke??null},[l.activity,Ze]),vt=e.state.connectionVerified&&!L,vn=b.useCallback(async()=>{if(l.sessions.nodes.length===0){j("No sessions available to continue.");return}const J=[...l.sessions.nodes].sort(v0)[0];if(v(J.id),E(J.id),["blocked","pending","queued"].includes(J.status))try{await fetch(`/orgx/api/runs/${encodeURIComponent(J.runId)}/actions/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"continue_from_dashboard"})})}catch{}j(`Focused highest priority session: ${J.title}`),await f()},[l.sessions.nodes,f]),Mn=b.useCallback(async J=>{if(v(J.id),E(J.id),!["running","completed","archived"].includes(J.status))try{await fetch(`/orgx/api/runs/${encodeURIComponent(J.runId)}/actions/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"dispatch_from_dashboard"})})}catch{}j(`Dispatch requested: ${J.title}`),await f()},[f]),Nt=b.useCallback(async(J,ke,me={})=>{const le=await fetch(`/orgx/api/runs/${encodeURIComponent(J.runId)}/actions/${ke}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(me)});if(!le.ok){const Be=await le.json().catch(()=>null);throw new Error((Be==null?void 0:Be.error)??`${ke} failed (${le.status})`)}},[]),Fn=b.useCallback(async J=>{var Be;const ke=await fetch(`/orgx/api/runs/${encodeURIComponent(J.runId)}/checkpoints`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"dashboard_manual_checkpoint"})});if(!ke.ok){const Ve=await ke.json().catch(()=>null);throw new Error((Ve==null?void 0:Ve.error)??`Checkpoint creation failed (${ke.status})`)}const me=await ke.json().catch(()=>null),le=me&&"data"in me&&((Be=me.data)==null?void 0:Be.id)||me&&"id"in me&&me.id||null;j(le?`Checkpoint created: ${le.slice(0,8)}`:"Checkpoint created."),await f()},[f]),Is=b.useCallback(async J=>{await Nt(J,"pause",{reason:"pause_from_dashboard"}),j(`Pause requested: ${J.title}`),await f()},[f,Nt]),Gr=b.useCallback(async J=>{await Nt(J,"resume",{reason:"resume_from_dashboard"}),j(`Resume requested: ${J.title}`),await f()},[f,Nt]),_s=b.useCallback(async J=>{await Nt(J,"cancel",{reason:"cancel_from_dashboard"}),j(`Cancel requested: ${J.title}`),await f()},[f,Nt]),Li=b.useCallback(async J=>{var St;const ke=await fetch(`/orgx/api/runs/${encodeURIComponent(J.runId)}/checkpoints`,{method:"GET"});if(!ke.ok){const $e=await ke.json().catch(()=>null);throw new Error(($e==null?void 0:$e.error)??`Checkpoint list failed (${ke.status})`)}const me=await ke.json().catch(()=>null),Ve=(St=(Array.isArray(me)?me:Array.isArray(me==null?void 0:me.data)?me.data:[]).map($e=>({id:typeof $e.id=="string"?$e.id:"",createdAt:typeof $e.createdAt=="string"?$e.createdAt:typeof $e.created_at=="string"?$e.created_at:""})).filter($e=>$e.id.length>0).sort(($e,Tt)=>Date.parse(Tt.createdAt)-Date.parse($e.createdAt))[0])==null?void 0:St.id;if(!Ve)throw new Error("No checkpoint available for rollback.");await Nt(J,"rollback",{checkpointId:Ve,reason:"rollback_from_dashboard"}),j(`Rollback requested for ${J.title}.`),await f()},[f,Nt]),fr=b.useCallback(async()=>{var me;if(!se||de.trim().length===0||ae)return;_e(!0);const J=se.type,ke=de.trim();try{const le={type:J,title:ke,status:"active"};if(J==="workstream"){const Ve=se.initiativeId??(Ge==null?void 0:Ge.initiativeId)??((me=Ae[0])==null?void 0:me.id)??null;if(!Ve){j("Select an initiative first to start a workstream."),_e(!1);return}le.initiative_id=Ve,le.parentId=Ve}const Be=await fetch("/orgx/api/entities",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)});if(!Be.ok){const Ve=await Be.json().catch(()=>null);throw new Error((Ve==null?void 0:Ve.error)??`Failed to create ${J}.`)}j(`Created ${J}: ${ke}`),ee(),await f()}catch(le){j(le instanceof Error?le.message:`Failed to create ${J}.`),_e(!1)}},[ee,ae,se,de,Ae,f,Ge==null?void 0:Ge.initiativeId]),Ls=b.useCallback(()=>{Ue("initiative")},[Ue]),Xr=b.useCallback(J=>{Ue("workstream",J)},[Ue]),Ri=b.useCallback(()=>{var J;return Xr((Ge==null?void 0:Ge.initiativeId)??((J=Ae[0])==null?void 0:J.id)??null)},[Ae,Ge==null?void 0:Ge.initiativeId,Xr]),Oi=b.useCallback(J=>{const ke=[...l.sessions.nodes].filter(me=>(me.initiativeId??me.groupId)===J.id).sort(v0)[0];ke&&(v(ke.id),E(ke.id),j(`Focused initiative: ${J.name}`))},[l.sessions.nodes]);return u?i.jsxs("div",{className:"flex min-h-screen flex-col lg:h-screen",style:{backgroundColor:q.background},children:[i.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-2.5 sm:px-6",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"shimmer-skeleton h-6 w-6 rounded-lg"}),i.jsx("div",{className:"shimmer-skeleton h-5 w-28 rounded-md"}),i.jsx("div",{className:"shimmer-skeleton h-5 w-14 rounded-full"})]}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:Array.from({length:4}).map((J,ke)=>i.jsx("div",{className:"shimmer-skeleton h-7 w-24 rounded-full"},ke))})]}),i.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-4 p-4 sm:p-5 lg:grid-cols-12",children:[i.jsx("div",{className:"shimmer-skeleton min-h-[240px] rounded-2xl lg:col-span-3"}),i.jsx("div",{className:"shimmer-skeleton min-h-[240px] rounded-2xl lg:col-span-6"}),i.jsxs("div",{className:"flex flex-col gap-4 lg:col-span-3",children:[i.jsx("div",{className:"shimmer-skeleton h-40 rounded-2xl"}),i.jsx("div",{className:"shimmer-skeleton h-48 rounded-2xl"}),i.jsx("div",{className:"shimmer-skeleton flex-1 rounded-2xl",style:{minHeight:160}})]})]})]}):i.jsxs("div",{className:"relative flex min-h-screen flex-col lg:h-screen lg:min-h-0 lg:overflow-hidden",style:{backgroundColor:q.background},children:[typeof window<"u"&&window.location.port==="5173"&&i.jsx("div",{className:"absolute left-1/2 top-4 z-30 -translate-x-1/2",children:i.jsxs("div",{className:"rounded-full border border-white/[0.12] bg-white/[0.06] px-4 py-2 text-[11px] text-white/80 shadow-[0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur",children:["Dev preview on 5173. Installed plugin runs on OpenClaw port"," ",i.jsx("a",{href:"http://127.0.0.1:18789/orgx/live/",className:"text-white underline underline-offset-4 hover:text-white/60",children:"18789"}),"."]})}),i.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[i.jsx("div",{className:"ambient-orb orb-lime",style:{width:460,height:460,top:-180,left:-120}}),i.jsx("div",{className:"ambient-orb orb-teal",style:{width:520,height:520,top:-220,right:-180,animationDelay:"2s"}}),i.jsx("div",{className:"ambient-orb orb-iris",style:{width:420,height:420,bottom:-180,left:"30%",animationDelay:"4s"}}),i.jsx("div",{className:"grain-overlay absolute inset-0"})]}),i.jsxs("header",{className:"relative z-[180] border-b border-white/[0.06] px-4 py-1.5 sm:px-6",children:[i.jsxs("div",{className:"grid items-center gap-2.5 lg:grid-cols-[1fr_auto_1fr]",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx(K5,{}),i.jsxs("h1",{className:"text-[17px] font-semibold tracking-tight text-white",children:["OrgX",i.jsx("span",{className:"ml-1.5 text-white/50",children:"Live"})]}),i.jsx(n0,{color:$5[l.connection],pulse:l.connection==="connected",title:[`Status: ${g0[l.connection]??l.connection}`,l.connection==="connected"?"Meaning: receiving live updates.":l.connection==="reconnecting"?"Meaning: retrying live stream (data may be stale).":"Meaning: offline (data is stale).",`Last snapshot: ${V5(l.lastSnapshotAt)}`,d?`Error: ${d}`:null].filter(Boolean).join(`
57
+ `),children:g0[l.connection]??"Unknown"}),(l.outbox.pendingTotal>0||l.outbox.replayStatus==="error")&&i.jsxs(n0,{color:l.outbox.replayStatus==="error"?q.red:q.amber,pulse:l.outbox.pendingTotal>0&&l.outbox.replayStatus!=="error",children:["Outbox ",l.outbox.pendingTotal]})]}),i.jsx("div",{className:"hidden items-center justify-center lg:flex",children:i.jsxs("div",{className:"flex rounded-full border border-white/[0.1] bg-white/[0.03] p-0.5",role:"group","aria-label":"Dashboard view",children:[i.jsx("button",{type:"button",onClick:()=>N("activity"),"aria-pressed":Z==="activity",className:`rounded-full px-3 py-1 text-[12px] font-medium transition-all ${Z==="activity"?"bg-white/[0.1] text-white":"text-white/55 hover:text-white/85"}`,children:"Activity"}),i.jsx("button",{type:"button",onClick:()=>N("mission-control"),"aria-pressed":Z==="mission-control",className:`rounded-full px-3 py-1 text-[12px] font-medium transition-all ${Z==="mission-control"?"bg-white/[0.1] text-white":"text-white/55 hover:text-white/85"}`,children:"Mission Control"})]})}),i.jsxs("div",{className:"relative isolate flex items-center justify-end gap-2",children:[l.lastActivity&&i.jsxs("span",{className:"hidden text-[12px] text-white/45 xl:inline",children:["Last activity: ",l.lastActivity]}),l.outbox.pendingTotal>0&&i.jsxs("span",{className:"hidden text-[12px] text-white/45 xl:inline",children:["Replay: ",l.outbox.replayStatus]}),n&&i.jsx("button",{type:"button",onClick:()=>{s(!1),Y()},className:"hidden rounded-full border border-amber-200/25 bg-amber-200/10 px-3 py-1.5 text-[11px] font-semibold text-amber-100 transition-colors hover:bg-amber-200/15 sm:inline",title:"Exit demo mode",children:"Exit demo"}),i.jsxs("button",{type:"button",ref:M,onClick:()=>_(J=>!J),title:"Notifications","aria-haspopup":"dialog","aria-expanded":F,"aria-controls":"header-notifications-panel",className:"relative inline-flex h-8 w-8 items-center justify-center rounded-full border border-white/[0.1] bg-white/[0.03] text-white/80 transition-colors hover:bg-white/[0.08]",children:[i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M15 17h5l-1.4-1.4a2 2 0 0 1-.6-1.4V11a6 6 0 1 0-12 0v3.2c0 .53-.21 1.04-.59 1.42L4 17h5"}),i.jsx("path",{d:"M9 17a3 3 0 0 0 6 0"})]}),re.length>0&&i.jsx("span",{className:"absolute -right-1 -top-1 inline-flex min-h-[16px] min-w-[16px] items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-semibold text-white",children:re.length})]}),i.jsx("button",{type:"button",onClick:()=>te("orgx"),title:"Settings",className:"relative inline-flex h-8 w-8 items-center justify-center rounded-full border border-white/[0.1] bg-white/[0.03] text-white/80 transition-colors hover:bg-white/[0.08]",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"}),i.jsx("path",{d:"M19.4 15a1.8 1.8 0 0 0 .36 2l.05.05a2.2 2.2 0 0 1-1.56 3.76 2.2 2.2 0 0 1-1.56-.64l-.05-.05a1.8 1.8 0 0 0-2-.36 1.8 1.8 0 0 0-1.1 1.63V22a2.2 2.2 0 0 1-4.4 0v-.07a1.8 1.8 0 0 0-1.1-1.63 1.8 1.8 0 0 0-2 .36l-.05.05a2.2 2.2 0 1 1-3.12-3.12l.05-.05a1.8 1.8 0 0 0 .36-2 1.8 1.8 0 0 0-1.63-1.1H2a2.2 2.2 0 0 1 0-4.4h.07a1.8 1.8 0 0 0 1.63-1.1 1.8 1.8 0 0 0-.36-2l-.05-.05a2.2 2.2 0 1 1 3.12-3.12l.05.05a1.8 1.8 0 0 0 2 .36 1.8 1.8 0 0 0 1.1-1.63V2a2.2 2.2 0 0 1 4.4 0v.07a1.8 1.8 0 0 0 1.1 1.63 1.8 1.8 0 0 0 2-.36l.05-.05a2.2 2.2 0 0 1 3.12 3.12l-.05.05a1.8 1.8 0 0 0-.36 2 1.8 1.8 0 0 0 1.63 1.1H22a2.2 2.2 0 0 1 0 4.4h-.07a1.8 1.8 0 0 0-1.63 1.1z"})]})}),i.jsx("button",{type:"button",onClick:()=>{he(!0);try{window.sessionStorage.setItem(od,"1")}catch{}},title:"Help",className:"relative inline-flex h-8 w-8 items-center justify-center rounded-full border border-white/[0.1] bg-white/[0.03] text-white/80 transition-colors hover:bg-white/[0.08]",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M9.1 9a3 3 0 0 1 5.8 1c0 2-3 2-3 4"}),i.jsx("path",{d:"M12 17h.01"}),i.jsx("circle",{cx:"12",cy:"12",r:"9"})]})}),i.jsxs("button",{type:"button",onClick:f,className:"group inline-flex h-8 items-center gap-1.5 rounded-full border border-white/[0.1] bg-white/[0.03] px-3 text-[12px] text-white/80 transition-colors hover:bg-white/[0.08]",title:"Refresh data",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform group-hover:rotate-45",children:[i.jsx("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),i.jsx("path",{d:"M21 3v5h-5"})]}),i.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),F&&i.jsxs("div",{id:"header-notifications-panel",ref:C,role:"dialog","aria-label":"Notifications",className:"absolute right-0 top-[calc(100%+8px)] z-[320] w-[min(92vw,380px)] rounded-2xl border border-white/[0.12] bg-[#070a11]/95 p-2 shadow-[0_20px_50px_rgba(0,0,0,0.45)] backdrop-blur",children:[i.jsxs("div",{className:"mb-1.5 flex items-center justify-between px-2 py-1",children:[i.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.12em] text-white/55",children:"Notifications"}),i.jsxs("div",{className:"flex items-center gap-2",children:[re.length>0&&i.jsx("button",{type:"button",onClick:ve,className:"text-[11px] text-white/45 transition-colors hover:text-white/80",children:"Dismiss all"}),i.jsx("button",{type:"button",onClick:()=>_(!1),className:"rounded-md px-1.5 py-0.5 text-[11px] text-white/45 transition-colors hover:bg-white/[0.08] hover:text-white/80","aria-label":"Close notifications",children:"Close"})]})]}),i.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5 px-1.5",children:Kn.map(J=>i.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-[10px]",children:[i.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:J.color}}),i.jsx("span",{className:"uppercase tracking-[0.08em] text-white/45",children:J.label}),i.jsx("span",{className:"font-semibold text-white",style:{fontVariantNumeric:"tabular-nums"},children:J.value})]},J.id))}),re.length===0?i.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 text-[12px] text-white/45",children:"Everything looks clear."}):i.jsx("div",{className:"space-y-1.5",children:re.map(J=>i.jsx("div",{className:"rounded-xl border px-3 py-2",style:{borderColor:J.kind==="error"?"rgba(239,68,68,0.35)":"rgba(255,255,255,0.1)",backgroundColor:J.kind==="error"?"rgba(239,68,68,0.08)":"rgba(255,255,255,0.02)"},children:i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-[12px] font-semibold",style:{color:J.kind==="error"?"#fecaca":"#e2e8f0"},children:J.title}),i.jsx("p",{className:"mt-0.5 text-[12px] leading-snug text-white/65",children:J.message})]}),i.jsx("button",{type:"button",onClick:()=>ne(J.id),className:"shrink-0 rounded-md px-1.5 py-0.5 text-[11px] text-white/45 transition-colors hover:bg-white/[0.08] hover:text-white/80",title:"Dismiss",children:"Dismiss"})]})},J.id))})]})]})]}),i.jsx("div",{className:"mt-1.5 flex items-center justify-center lg:hidden",children:i.jsxs("div",{className:"flex rounded-full border border-white/[0.1] bg-white/[0.03] p-0.5",role:"group","aria-label":"Dashboard view",children:[i.jsx("button",{type:"button",onClick:()=>N("activity"),"aria-pressed":Z==="activity",className:`rounded-full px-3 py-1 text-[12px] font-medium transition-all ${Z==="activity"?"bg-white/[0.1] text-white":"text-white/55 hover:text-white/85"}`,children:"Activity"}),i.jsx("button",{type:"button",onClick:()=>N("mission-control"),"aria-pressed":Z==="mission-control",className:`rounded-full px-3 py-1 text-[12px] font-medium transition-all ${Z==="mission-control"?"bg-white/[0.1] text-white":"text-white/55 hover:text-white/85"}`,children:"Mission Control"})]})}),vt&&i.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2 rounded-lg border border-[#7C7CFF]/30 bg-[#7C7CFF]/10 px-3 py-2 text-[12px] text-[#E6E4FF]",children:[i.jsx("span",{children:"Mission Control now includes a dependency map plus expandable hierarchy rows for initiatives, workstreams, milestones, and tasks."}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>N("mission-control"),className:"rounded-full border border-[#BFFF00]/30 bg-[#BFFF00]/15 px-2.5 py-1 text-[11px] text-[#D8FFA1]",children:"Open"}),i.jsx("button",{type:"button",onClick:()=>X(!0),className:"text-[11px] text-white/65 underline underline-offset-2",children:"Dismiss"})]})]})]}),Z==="mission-control"?i.jsx("div",{className:"relative z-0 flex-1 min-h-0 flex flex-col overflow-hidden",children:i.jsx(C5,{initiatives:Xe,activities:[],agents:[],isLoading:u,authToken:null,embedMode:!1,connection:l.connection,lastSnapshotAt:l.lastSnapshotAt,error:d,hasApiKey:e.state.hasApiKey,onOpenSettings:()=>te("orgx"),onRefresh:f})}):i.jsxs("main",{className:"relative z-0 grid min-h-0 flex-1 grid-cols-1 gap-4 overflow-y-auto p-4 pb-20 sm:p-5 sm:pb-20 lg:grid-cols-12 lg:overflow-hidden lg:pb-5",children:[i.jsx("section",{className:`min-h-0 lg:col-span-3 lg:flex lg:flex-col lg:[&>section]:h-full ${$!=="agents"?"hidden lg:flex":""}`,children:i.jsx(QN,{sessions:l.sessions,activity:l.activity,selectedSessionId:y,onSelectSession:De,onReconnect:Y})}),i.jsx("section",{className:`min-h-0 lg:col-span-6 lg:flex lg:flex-col lg:[&>section]:h-full ${$!=="activity"?"hidden lg:flex":""}`,children:i.jsx(CS,{activity:l.activity,sessions:l.sessions.nodes,selectedRunIds:Ze?[Ze.runId,Ze.id]:[],selectedSessionLabel:yt,onClearSelection:Ce,onFocusRunId:Te})}),i.jsxs("section",{className:`flex min-h-0 flex-col gap-2 lg:col-span-3 lg:gap-2 ${$!=="decisions"&&$!=="initiatives"?"hidden lg:flex":""}`,children:[i.jsx("div",{className:`min-h-0 ${W==="initiatives"?"flex-1":"flex-shrink-0"} `,children:W==="initiatives"?i.jsx(IS,{initiatives:Ae,onInitiativeClick:Oi,onCreateInitiative:Ls,onCreateWorkstream:Ri}):i.jsx(Wn,{className:"card-enter",children:i.jsxs("button",{onClick:()=>H("initiatives"),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.03]",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Initiatives"}),Ae.length>0&&i.jsx("span",{className:"chip text-[10px]",children:Ae.length})]}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"-rotate-90 text-white/40",children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]})})}),i.jsx("div",{className:`min-h-0 ${W==="decisions"?"flex-1":"flex-shrink-0"} ${$==="initiatives"?"hidden lg:block":""}`,children:W==="decisions"?g?i.jsx(ES,{decisions:l.decisions,onApproveDecision:m,onApproveAll:x}):i.jsxs(Wn,{className:"flex h-full min-h-[220px] flex-col card-enter",children:[i.jsxs("div",{className:"space-y-2 border-b border-white/[0.06] px-4 py-3.5",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Decisions"}),i.jsx("p",{className:"text-[12px] text-white/45",children:"OrgX is not connected. Pending decision data is hidden in local-only mode."})]}),i.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-4 text-center",children:[i.jsx("p",{className:"text-[12px] text-white/45",children:"Connect OrgX to review and approve live decisions."}),i.jsx("button",{onClick:Y,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-1.5 text-[11px] font-semibold text-lime transition-colors hover:bg-lime/20",children:"Connect OrgX"})]})]}):i.jsx(Wn,{className:"card-enter",children:i.jsxs("button",{onClick:()=>H("decisions"),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.03]",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-white",children:"Decisions"}),g&&l.decisions.length>0&&i.jsx("span",{className:"chip text-[10px]",style:{borderColor:`${q.amber}44`,color:q.amber},children:l.decisions.length}),!g&&i.jsx("span",{className:"text-[10px] text-white/30",children:"disconnected"})]}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"-rotate-90 text-white/40",children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]})})}),i.jsx("div",{className:"hidden min-h-0 lg:flex lg:flex-1",children:i.jsx(XN,{session:Ge,activity:l.activity,initiatives:Ae,onContinueHighestPriority:vn,onDispatchSession:Mn,onPauseSession:Is,onResumeSession:Gr,onCancelSession:_s,onCreateCheckpoint:Fn,onRollbackSession:Li,onStartInitiative:Ls,onStartWorkstream:Xr})})]})]}),i.jsx(CN,{activeTab:$,onTabChange:ie,pendingDecisionCount:g?l.decisions.length:0}),i.jsxs(_i,{open:se!==null,onClose:ee,maxWidth:"max-w-sm",children:[i.jsxs("div",{className:"px-5 pt-5 pb-1",children:[i.jsx("h3",{className:"text-[15px] font-semibold text-white",children:(se==null?void 0:se.type)==="workstream"?"New Workstream":"New Initiative"}),i.jsx("p",{className:"mt-1 text-[12px] text-white/45",children:(se==null?void 0:se.type)==="workstream"?"Create a new workstream under the selected initiative.":"Create a new initiative to organize your work."})]}),i.jsxs("div",{className:"px-5 py-3",children:[i.jsx("label",{className:"mb-1.5 block text-[11px] uppercase tracking-[0.1em] text-white/45",children:"Name"}),i.jsx("input",{value:de,onChange:J=>ge(J.target.value),onKeyDown:J=>{J.key==="Enter"&&fr()},autoFocus:!0,placeholder:(se==null?void 0:se.type)==="workstream"?"e.g. User Onboarding Flow":"e.g. Q1 Product Launch",className:"w-full rounded-lg border border-white/[0.12] bg-black/30 px-3 py-2 text-[13px] text-white placeholder:text-white/30 focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/40"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-white/[0.06] px-5 py-3",children:[i.jsx("button",{onClick:ee,className:"rounded-md px-3 py-1.5 text-[12px] text-white/60 transition-colors hover:text-white",children:"Cancel"}),i.jsx("button",{onClick:fr,disabled:de.trim().length===0||ae,className:"rounded-md border border-lime/25 bg-lime/10 px-4 py-1.5 text-[12px] font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:ae?"Creating…":"Create"})]})]}),i.jsx(B5,{open:B.open,onClose:()=>R(J=>({...J,open:!1})),activeTab:B.tab,onChangeTab:J=>R(ke=>({...ke,tab:J})),onboarding:e,authToken:null,embedMode:!1}),i.jsx(NN,{open:G,onClose:()=>he(!1),onOpenSettings:()=>te("providers"),onOpenOrgxSettings:()=>te("orgx"),onOpenMissionControl:()=>{N("mission-control"),he(!1)},demoMode:n,connectionVerified:e.state.connectionVerified,hasSessions:l.sessions.nodes.length>0})]})}const Q5=new s1({defaultOptions:{queries:{staleTime:3e4,retry:1}}});Iw.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(i1,{client:Q5,children:i.jsx(z5,{})})}));