@agent-plan/server 0.2.19-next.2 → 0.2.19-next.21

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.
@@ -0,0 +1,293 @@
1
+ var RS=Object.defineProperty;var jS=(t,a,l)=>a in t?RS(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l;var hn=(t,a,l)=>jS(t,typeof a!="symbol"?a+"":a,l);function TS(t,a){for(var l=0;l<a.length;l++){const s=a[l];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in t)){const u=Object.getOwnPropertyDescriptor(s,o);u&&Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function l(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(o){if(o.ep)return;o.ep=!0;const u=l(o);fetch(o.href,u)}})();function CS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var oh={exports:{}},so={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var gy;function DS(){if(gy)return so;gy=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function l(s,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:t,type:s,key:f,ref:o!==void 0?o:null,props:u}}return so.Fragment=a,so.jsx=l,so.jsxs=l,so}var vy;function AS(){return vy||(vy=1,oh.exports=DS()),oh.exports}var c=AS(),uh={exports:{}},et={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var yy;function kS(){if(yy)return et;yy=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),N=Symbol.iterator;function w(C){return C===null||typeof C!="object"?null:(C=N&&C[N]||C["@@iterator"],typeof C=="function"?C:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,R={};function L(C,V,ne){this.props=C,this.context=V,this.refs=R,this.updater=ne||S}L.prototype.isReactComponent={},L.prototype.setState=function(C,V){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,V,"setState")},L.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function I(){}I.prototype=L.prototype;function q(C,V,ne){this.props=C,this.context=V,this.refs=R,this.updater=ne||S}var X=q.prototype=new I;X.constructor=q,D(X,L.prototype),X.isPureReactComponent=!0;var W=Array.isArray;function ae(){}var z={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function ee(C,V,ne){var me=ne.ref;return{$$typeof:t,type:C,key:V,ref:me!==void 0?me:null,props:ne}}function fe(C,V){return ee(C.type,V,C.props)}function be(C){return typeof C=="object"&&C!==null&&C.$$typeof===t}function ye(C){var V={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(ne){return V[ne]})}var te=/\/+/g;function re(C,V){return typeof C=="object"&&C!==null&&C.key!=null?ye(""+C.key):V.toString(36)}function ge(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(ae,ae):(C.status="pending",C.then(function(V){C.status==="pending"&&(C.status="fulfilled",C.value=V)},function(V){C.status==="pending"&&(C.status="rejected",C.reason=V)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function U(C,V,ne,me,Ne){var je=typeof C;(je==="undefined"||je==="boolean")&&(C=null);var ze=!1;if(C===null)ze=!0;else switch(je){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(C.$$typeof){case t:case a:ze=!0;break;case x:return ze=C._init,U(ze(C._payload),V,ne,me,Ne)}}if(ze)return Ne=Ne(C),ze=me===""?"."+re(C,0):me,W(Ne)?(ne="",ze!=null&&(ne=ze.replace(te,"$&/")+"/"),U(Ne,V,ne,"",function(nt){return nt})):Ne!=null&&(be(Ne)&&(Ne=fe(Ne,ne+(Ne.key==null||C&&C.key===Ne.key?"":(""+Ne.key).replace(te,"$&/")+"/")+ze)),V.push(Ne)),1;ze=0;var ut=me===""?".":me+":";if(W(C))for(var Ge=0;Ge<C.length;Ge++)me=C[Ge],je=ut+re(me,Ge),ze+=U(me,V,ne,je,Ne);else if(Ge=w(C),typeof Ge=="function")for(C=Ge.call(C),Ge=0;!(me=C.next()).done;)me=me.value,je=ut+re(me,Ge++),ze+=U(me,V,ne,je,Ne);else if(je==="object"){if(typeof C.then=="function")return U(ge(C),V,ne,me,Ne);throw V=String(C),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ze}function B(C,V,ne){if(C==null)return C;var me=[],Ne=0;return U(C,me,"","",function(je){return V.call(ne,je,Ne++)}),me}function ue(C){if(C._status===-1){var V=C._result;V=V(),V.then(function(ne){(C._status===0||C._status===-1)&&(C._status=1,C._result=ne)},function(ne){(C._status===0||C._status===-1)&&(C._status=2,C._result=ne)}),C._status===-1&&(C._status=0,C._result=V)}if(C._status===1)return C._result.default;throw C._result}var de=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},we={map:B,forEach:function(C,V,ne){B(C,function(){V.apply(this,arguments)},ne)},count:function(C){var V=0;return B(C,function(){V++}),V},toArray:function(C){return B(C,function(V){return V})||[]},only:function(C){if(!be(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return et.Activity=y,et.Children=we,et.Component=L,et.Fragment=l,et.Profiler=o,et.PureComponent=q,et.StrictMode=s,et.Suspense=p,et.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,et.__COMPILER_RUNTIME={__proto__:null,c:function(C){return z.H.useMemoCache(C)}},et.cache=function(C){return function(){return C.apply(null,arguments)}},et.cacheSignal=function(){return null},et.cloneElement=function(C,V,ne){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var me=D({},C.props),Ne=C.key;if(V!=null)for(je in V.key!==void 0&&(Ne=""+V.key),V)!T.call(V,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&V.ref===void 0||(me[je]=V[je]);var je=arguments.length-2;if(je===1)me.children=ne;else if(1<je){for(var ze=Array(je),ut=0;ut<je;ut++)ze[ut]=arguments[ut+2];me.children=ze}return ee(C.type,Ne,me)},et.createContext=function(C){return C={$$typeof:f,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:u,_context:C},C},et.createElement=function(C,V,ne){var me,Ne={},je=null;if(V!=null)for(me in V.key!==void 0&&(je=""+V.key),V)T.call(V,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Ne[me]=V[me]);var ze=arguments.length-2;if(ze===1)Ne.children=ne;else if(1<ze){for(var ut=Array(ze),Ge=0;Ge<ze;Ge++)ut[Ge]=arguments[Ge+2];Ne.children=ut}if(C&&C.defaultProps)for(me in ze=C.defaultProps,ze)Ne[me]===void 0&&(Ne[me]=ze[me]);return ee(C,je,Ne)},et.createRef=function(){return{current:null}},et.forwardRef=function(C){return{$$typeof:m,render:C}},et.isValidElement=be,et.lazy=function(C){return{$$typeof:x,_payload:{_status:-1,_result:C},_init:ue}},et.memo=function(C,V){return{$$typeof:g,type:C,compare:V===void 0?null:V}},et.startTransition=function(C){var V=z.T,ne={};z.T=ne;try{var me=C(),Ne=z.S;Ne!==null&&Ne(ne,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(ae,de)}catch(je){de(je)}finally{V!==null&&ne.types!==null&&(V.types=ne.types),z.T=V}},et.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},et.use=function(C){return z.H.use(C)},et.useActionState=function(C,V,ne){return z.H.useActionState(C,V,ne)},et.useCallback=function(C,V){return z.H.useCallback(C,V)},et.useContext=function(C){return z.H.useContext(C)},et.useDebugValue=function(){},et.useDeferredValue=function(C,V){return z.H.useDeferredValue(C,V)},et.useEffect=function(C,V){return z.H.useEffect(C,V)},et.useEffectEvent=function(C){return z.H.useEffectEvent(C)},et.useId=function(){return z.H.useId()},et.useImperativeHandle=function(C,V,ne){return z.H.useImperativeHandle(C,V,ne)},et.useInsertionEffect=function(C,V){return z.H.useInsertionEffect(C,V)},et.useLayoutEffect=function(C,V){return z.H.useLayoutEffect(C,V)},et.useMemo=function(C,V){return z.H.useMemo(C,V)},et.useOptimistic=function(C,V){return z.H.useOptimistic(C,V)},et.useReducer=function(C,V,ne){return z.H.useReducer(C,V,ne)},et.useRef=function(C){return z.H.useRef(C)},et.useState=function(C){return z.H.useState(C)},et.useSyncExternalStore=function(C,V,ne){return z.H.useSyncExternalStore(C,V,ne)},et.useTransition=function(){return z.H.useTransition()},et.version="19.2.7",et}var xy;function Jh(){return xy||(xy=1,uh.exports=kS()),uh.exports}var v=Jh();const un=CS(v),OS=TS({__proto__:null,default:un},[v]);var ch={exports:{}},io={},dh={exports:{}},fh={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var by;function MS(){return by||(by=1,(function(t){function a(U,B){var ue=U.length;U.push(B);e:for(;0<ue;){var de=ue-1>>>1,we=U[de];if(0<o(we,B))U[de]=B,U[ue]=we,ue=de;else break e}}function l(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var B=U[0],ue=U.pop();if(ue!==B){U[0]=ue;e:for(var de=0,we=U.length,C=we>>>1;de<C;){var V=2*(de+1)-1,ne=U[V],me=V+1,Ne=U[me];if(0>o(ne,ue))me<we&&0>o(Ne,ne)?(U[de]=Ne,U[me]=ue,de=me):(U[de]=ne,U[V]=ue,de=V);else if(me<we&&0>o(Ne,ue))U[de]=Ne,U[me]=ue,de=me;else break e}}return B}function o(U,B){var ue=U.sortIndex-B.sortIndex;return ue!==0?ue:U.id-B.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var p=[],g=[],x=1,y=null,N=3,w=!1,S=!1,D=!1,R=!1,L=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function X(U){for(var B=l(g);B!==null;){if(B.callback===null)s(g);else if(B.startTime<=U)s(g),B.sortIndex=B.expirationTime,a(p,B);else break;B=l(g)}}function W(U){if(D=!1,X(U),!S)if(l(p)!==null)S=!0,ae||(ae=!0,ye());else{var B=l(g);B!==null&&ge(W,B.startTime-U)}}var ae=!1,z=-1,T=5,ee=-1;function fe(){return R?!0:!(t.unstable_now()-ee<T)}function be(){if(R=!1,ae){var U=t.unstable_now();ee=U;var B=!0;try{e:{S=!1,D&&(D=!1,I(z),z=-1),w=!0;var ue=N;try{t:{for(X(U),y=l(p);y!==null&&!(y.expirationTime>U&&fe());){var de=y.callback;if(typeof de=="function"){y.callback=null,N=y.priorityLevel;var we=de(y.expirationTime<=U);if(U=t.unstable_now(),typeof we=="function"){y.callback=we,X(U),B=!0;break t}y===l(p)&&s(p),X(U)}else s(p);y=l(p)}if(y!==null)B=!0;else{var C=l(g);C!==null&&ge(W,C.startTime-U),B=!1}}break e}finally{y=null,N=ue,w=!1}B=void 0}}finally{B?ye():ae=!1}}}var ye;if(typeof q=="function")ye=function(){q(be)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,re=te.port2;te.port1.onmessage=be,ye=function(){re.postMessage(null)}}else ye=function(){L(be,0)};function ge(U,B){z=L(function(){U(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(U){U.callback=null},t.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<U?Math.floor(1e3/U):5},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_next=function(U){switch(N){case 1:case 2:case 3:var B=3;break;default:B=N}var ue=N;N=B;try{return U()}finally{N=ue}},t.unstable_requestPaint=function(){R=!0},t.unstable_runWithPriority=function(U,B){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var ue=N;N=U;try{return B()}finally{N=ue}},t.unstable_scheduleCallback=function(U,B,ue){var de=t.unstable_now();switch(typeof ue=="object"&&ue!==null?(ue=ue.delay,ue=typeof ue=="number"&&0<ue?de+ue:de):ue=de,U){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=ue+we,U={id:x++,callback:B,priorityLevel:U,startTime:ue,expirationTime:we,sortIndex:-1},ue>de?(U.sortIndex=ue,a(g,U),l(p)===null&&U===l(g)&&(D?(I(z),z=-1):D=!0,ge(W,ue-de))):(U.sortIndex=we,a(p,U),S||w||(S=!0,ae||(ae=!0,ye()))),U},t.unstable_shouldYield=fe,t.unstable_wrapCallback=function(U){var B=N;return function(){var ue=N;N=B;try{return U.apply(this,arguments)}finally{N=ue}}}})(fh)),fh}var Sy;function _S(){return Sy||(Sy=1,dh.exports=MS()),dh.exports}var hh={exports:{}},sa={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var wy;function LS(){if(wy)return sa;wy=1;var t=Jh();function a(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var s={d:{f:l,r:function(){throw Error(a(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,g,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:g,implementation:x}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return sa.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,sa.createPortal=function(p,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(a(299));return u(p,g,null,x)},sa.flushSync=function(p){var g=f.T,x=s.p;try{if(f.T=null,s.p=2,p)return p()}finally{f.T=g,s.p=x,s.d.f()}},sa.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,s.d.C(p,g))},sa.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},sa.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var x=g.as,y=m(x,g.crossOrigin),N=typeof g.integrity=="string"?g.integrity:void 0,w=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:N,fetchPriority:w}):x==="script"&&s.d.X(p,{crossOrigin:y,integrity:N,fetchPriority:w,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},sa.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=m(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&s.d.M(p)},sa.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,y=m(x,g.crossOrigin);s.d.L(p,x,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},sa.preloadModule=function(p,g){if(typeof p=="string")if(g){var x=m(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},sa.requestFormReset=function(p){s.d.r(p)},sa.unstable_batchedUpdates=function(p,g){return p(g)},sa.useFormState=function(p,g,x){return f.H.useFormState(p,g,x)},sa.useFormStatus=function(){return f.H.useHostTransitionStatus()},sa.version="19.2.7",sa}var Ey;function Xx(){if(Ey)return hh.exports;Ey=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),hh.exports=LS(),hh.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Ny;function zS(){if(Ny)return io;Ny=1;var t=_S(),a=Jh(),l=Xx();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(s(188))}function g(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(s(188));return n!==e?null:e}for(var r=e,i=n;;){var d=r.return;if(d===null)break;var h=d.alternate;if(h===null){if(i=d.return,i!==null){r=i;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===r)return p(d),e;if(h===i)return p(d),n;h=h.sibling}throw Error(s(188))}if(r.return!==i.return)r=d,i=h;else{for(var b=!1,E=d.child;E;){if(E===r){b=!0,r=d,i=h;break}if(E===i){b=!0,i=d,r=h;break}E=E.sibling}if(!b){for(E=h.child;E;){if(E===r){b=!0,r=h,i=d;break}if(E===i){b=!0,i=h,r=d;break}E=E.sibling}if(!b)throw Error(s(189))}}if(r.alternate!==i)throw Error(s(190))}if(r.tag!==3)throw Error(s(188));return r.stateNode.current===r?e:n}function x(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=x(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,N=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),q=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function ye(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case L:return"Profiler";case R:return"StrictMode";case W:return"Suspense";case ae:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case q:return e.displayName||"Context";case I:return(e._context.displayName||"Context")+".Consumer";case X:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return n=e.displayName||null,n!==null?n:re(e.type)||"Memo";case T:n=e._payload,e=e._init;try{return re(e(n))}catch{}}return null}var ge=Array.isArray,U=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],we=-1;function C(e){return{current:e}}function V(e){0>we||(e.current=de[we],de[we]=null,we--)}function ne(e,n){we++,de[we]=e.current,e.current=n}var me=C(null),Ne=C(null),je=C(null),ze=C(null);function ut(e,n){switch(ne(je,n),ne(Ne,e),ne(me,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Hv(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Hv(n),e=$v(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(me),ne(me,e)}function Ge(){V(me),V(Ne),V(je)}function nt(e){e.memoizedState!==null&&ne(ze,e);var n=me.current,r=$v(n,e.type);n!==r&&(ne(Ne,e),ne(me,r))}function Sn(e){Ne.current===e&&(V(me),V(Ne)),ze.current===e&&(V(ze),no._currentValue=ue)}var Xt,ft;function oe(e){if(Xt===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);Xt=n&&n[1]||"",ft=-1<r.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Xt+e+ft}var $e=!1;function at(e,n){if(!e||$e)return"";$e=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var G=Q}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(Q){G=Q}e.call(ie.prototype)}}else{try{throw Error()}catch(Q){G=Q}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&G&&typeof Q.stack=="string")return[Q.stack,G.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=i.DetermineComponentFrameRoot(),b=h[0],E=h[1];if(b&&E){var k=b.split(`
44
+ `),F=E.split(`
45
+ `);for(d=i=0;i<k.length&&!k[i].includes("DetermineComponentFrameRoot");)i++;for(;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;if(i===k.length||d===F.length)for(i=k.length-1,d=F.length-1;1<=i&&0<=d&&k[i]!==F[d];)d--;for(;1<=i&&0<=d;i--,d--)if(k[i]!==F[d]){if(i!==1||d!==1)do if(i--,d--,0>d||k[i]!==F[d]){var J=`
46
+ `+k[i].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=i&&0<=d);break}}}finally{$e=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?oe(r):""}function Ut(e,n){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe("Lazy");case 13:return e.child!==n&&n!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("SuspenseList");case 0:case 15:return at(e.type,!1);case 11:return at(e.type.render,!1);case 1:return at(e.type,!0);case 31:return oe("Activity");default:return""}}function pn(e){try{var n="",r=null;do n+=Ut(e,r),r=e,e=e.return;while(e);return n}catch(i){return`
47
+ Error generating stack: `+i.message+`
48
+ `+i.stack}}var jt=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Qt=t.unstable_cancelCallback,Hn=t.unstable_shouldYield,$n=t.unstable_requestPaint,tn=t.unstable_now,da=t.unstable_getCurrentPriorityLevel,fa=t.unstable_ImmediatePriority,Wn=t.unstable_UserBlockingPriority,qn=t.unstable_NormalPriority,he=t.unstable_LowPriority,Ce=t.unstable_IdlePriority,De=t.log,Pe=t.unstable_setDisableYieldValue,qe=null,Z=null;function Tt(e){if(typeof De=="function"&&Pe(e),Z&&typeof Z.setStrictMode=="function")try{Z.setStrictMode(qe,e)}catch{}}var Kt=Math.clz32?Math.clz32:Ba,Yn=Math.log,gn=Math.LN2;function Ba(e){return e>>>=0,e===0?32:31-(Yn(e)/gn|0)|0}var Me=256,vt=262144,yt=4194304;function St(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Bt(e,n,r){var i=e.pendingLanes;if(i===0)return 0;var d=0,h=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var E=i&134217727;return E!==0?(i=E&~h,i!==0?d=St(i):(b&=E,b!==0?d=St(b):r||(r=E&~e,r!==0&&(d=St(r))))):(E=i&~h,E!==0?d=St(E):b!==0?d=St(b):r||(r=i&~e,r!==0&&(d=St(r)))),d===0?0:n!==0&&n!==d&&(n&h)===0&&(h=d&-d,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:d}function Ct(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function nn(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zt(){var e=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),e}function Ht(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function ht(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,n,r,i,d,h){var b=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var E=e.entanglements,k=e.expirationTimes,F=e.hiddenUpdates;for(r=b&~r;0<r;){var J=31-Kt(r),ie=1<<J;E[J]=0,k[J]=-1;var G=F[J];if(G!==null)for(F[J]=null,J=0;J<G.length;J++){var Q=G[J];Q!==null&&(Q.lane&=-536870913)}r&=~ie}i!==0&&wn(e,i,0),h!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=h&~(b&~n))}function wn(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-Kt(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function kn(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var i=31-Kt(r),d=1<<i;d&n|e[i]&n&&(e[i]|=n),r&=~d}}function A(e,n){var r=n&-n;return r=(r&42)!==0?1:M(r),(r&(e.suspendedLanes|n))!==0?0:r}function M(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function K(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:uy(e.type))}function se(e,n){var r=B.p;try{return B.p=e,n()}finally{B.p=r}}var Te=Math.random().toString(36).slice(2),ve="__reactFiber$"+Te,Ae="__reactProps$"+Te,Re="__reactContainer$"+Te,_e="__reactEvents$"+Te,Ue="__reactListeners$"+Te,Xe="__reactHandles$"+Te,ke="__reactResources$"+Te,Ze="__reactMarker$"+Te;function Ie(e){delete e[ve],delete e[Ae],delete e[_e],delete e[Ue],delete e[Xe]}function $t(e){var n=e[ve];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Re]||r[ve]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Gv(e);e!==null;){if(r=e[ve])return r;e=Gv(e)}return n}e=r,r=e.parentNode}return null}function We(e){if(e=e[ve]||e[Re]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function ct(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function it(e){var n=e[ke];return n||(n=e[ke]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function dt(e){e[Ze]=!0}var Jt=new Set,Fn={};function En(e,n){On(e,n),On(e+"Capture",n)}function On(e,n){for(Fn[e]=n,e=0;e<n.length;e++)Jt.add(n[e])}var Mn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Pn={},ga={};function sl(e){return jt.call(ga,e)?!0:jt.call(Pn,e)?!1:Mn.test(e)?ga[e]=!0:(Pn[e]=!0,!1)}function ea(e,n,r){if(sl(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var i=n.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function hr(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Qe(e,n,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+i)}}function Nt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wt(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function ta(e,n,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,h=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(b){r=""+b,h.call(this,b)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(b){r=""+b},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function _n(e){if(!e._valueTracker){var n=Wt(e)?"checked":"value";e._valueTracker=ta(e,n,""+e[n])}}function Mr(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),i="";return e&&(i=Wt(e)?e.checked?"true":"false":e.value),e=i,e!==r?(n.setValue(e),!0):!1}function Rt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ja=/[\n"\\]/g;function Gn(e){return e.replace(ja,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ql(e,n,r,i,d,h,b,E){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),n!=null?b==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Nt(n)):e.value!==""+Nt(n)&&(e.value=""+Nt(n)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),n!=null?Dt(e,b,Nt(n)):r!=null?Dt(e,b,Nt(r)):i!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+Nt(E):e.removeAttribute("name")}function yi(e,n,r,i,d,h,b,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){_n(e);return}r=r!=null?""+Nt(r):"",n=n!=null?""+Nt(n):r,E||n===e.value||(e.value=n),e.defaultValue=n}i=i??d,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=E?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),_n(e)}function Dt(e,n,r){n==="number"&&Rt(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function mr(e,n,r,i){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&i&&(e[r].defaultSelected=!0)}else{for(r=""+Nt(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,i&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function Jo(e,n,r){if(n!=null&&(n=""+Nt(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+Nt(r):""}function nr(e,n,r,i){if(n==null){if(i!=null){if(r!=null)throw Error(s(92));if(ge(i)){if(1<i.length)throw Error(s(93));i=i[0]}r=i}r==null&&(r=""),n=r}r=Nt(n),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),_n(e)}function il(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var od=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xs(e,n,r){var i=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":i?e.setProperty(n,r):typeof r!="number"||r===0||od.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function va(e,n,r){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||n!=null&&n.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var d in n)i=n[d],n.hasOwnProperty(d)&&r[d]!==i&&xs(e,d,i)}else for(var h in n)n.hasOwnProperty(h)&&xs(e,h,n[h])}function Il(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bs=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ya=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function an(e){return ya.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function na(){}var Ta=null;function _r(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pr=null,Lr=null;function xi(e){var n=We(e);if(n&&(e=n.stateNode)){var r=e[Ae]||null;e:switch(e=n.stateNode,n.type){case"input":if(ql(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Gn(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var i=r[n];if(i!==e&&i.form===e.form){var d=i[Ae]||null;if(!d)throw Error(s(90));ql(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)i=r[n],i.form===e.form&&Mr(i)}break e;case"textarea":Jo(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&mr(e,!!r.multiple,n,!1)}}}var gr=!1;function bi(e,n,r){if(gr)return e(n,r);gr=!0;try{var i=e(n);return i}finally{if(gr=!1,(pr!==null||Lr!==null)&&(Hu(),pr&&(n=pr,e=Lr,Lr=pr=null,xi(n),e)))for(n=0;n<e.length;n++)xi(e[n])}}function Ha(e,n){var r=e.stateNode;if(r===null)return null;var i=r[Ae]||null;if(i===null)return null;r=i[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(s(231,n,typeof r));return r}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Si=!1;if(ar)try{var zr={};Object.defineProperty(zr,"passive",{get:function(){Si=!0}}),window.addEventListener("test",zr,zr),window.removeEventListener("test",zr,zr)}catch{Si=!1}var $a=null,wi=null,Ss=null;function Wo(){if(Ss)return Ss;var e,n=wi,r=n.length,i,d="value"in $a?$a.value:$a.textContent,h=d.length;for(e=0;e<r&&n[e]===d[e];e++);var b=r-e;for(i=1;i<=b&&n[r-i]===d[h-i];i++);return Ss=d.slice(e,1<i?1-i:void 0)}function ws(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ur(){return!0}function eu(){return!1}function aa(e){function n(r,i,d,h,b){this._reactName=r,this._targetInst=d,this.type=i,this.nativeEvent=h,this.target=b,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(r=e[E],this[E]=r?r(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Ur:eu,this.isPropagationStopped=eu,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ur)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ur)},persist:function(){},isPersistent:Ur}),n}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hr=aa(Br),Vl=y({},Br,{view:0,detail:0}),ud=aa(Vl),ol,Yl,Fl,$r=y({},Vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:la,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Fl&&(Fl&&e.type==="mousemove"?(ol=e.screenX-Fl.screenX,Yl=e.screenY-Fl.screenY):Yl=ol=0,Fl=e),ol)},movementY:function(e){return"movementY"in e?e.movementY:Yl}}),tu=aa($r),j=y({},$r,{dataTransfer:0}),P=aa(j),Ee=y({},Vl,{relatedTarget:0}),xe=aa(Ee),Fe=y({},Br,{animationName:0,elapsedTime:0,pseudoElement:0}),ce=aa(Fe),pe=y({},Br,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Se=aa(pe),Ke=y({},Br,{data:0}),rt=aa(Ke),Be={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nn={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"},Lt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ra(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Lt[e])?!!n[e]:!1}function la(){return ra}var xa=y({},Vl,{key:function(e){if(e.key){var n=Be[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ws(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:la,charCode:function(e){return e.type==="keypress"?ws(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ws(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rn=aa(xa),cn=y({},$r,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zt=aa(cn),Pl=y({},Vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:la}),vr=aa(Pl),cd=y({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0}),nu=aa(cd),au=y({},$r,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),dd=aa(au),fd=y({},Br,{newState:0,oldState:0}),P0=aa(fd),G0=[9,13,27,32],hd=ar&&"CompositionEvent"in window,Ei=null;ar&&"documentMode"in document&&(Ei=document.documentMode);var X0=ar&&"TextEvent"in window&&!Ei,Fm=ar&&(!hd||Ei&&8<Ei&&11>=Ei),Pm=" ",Gm=!1;function Xm(e,n){switch(e){case"keyup":return G0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Es=!1;function Q0(e,n){switch(e){case"compositionend":return Qm(n);case"keypress":return n.which!==32?null:(Gm=!0,Pm);case"textInput":return e=n.data,e===Pm&&Gm?null:e;default:return null}}function K0(e,n){if(Es)return e==="compositionend"||!hd&&Xm(e,n)?(e=Wo(),Ss=wi=$a=null,Es=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Fm&&n.locale!=="ko"?null:n.data;default:return null}}var Z0={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 Km(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Z0[e.type]:n==="textarea"}function Zm(e,n,r,i){pr?Lr?Lr.push(i):Lr=[i]:pr=i,n=Pu(n,"onChange"),0<n.length&&(r=new Hr("onChange","change",null,r,i),e.push({event:r,listeners:n}))}var Ni=null,Ri=null;function J0(e){Mv(e,0)}function ru(e){var n=ct(e);if(Mr(n))return e}function Jm(e,n){if(e==="change")return n}var Wm=!1;if(ar){var md;if(ar){var pd="oninput"in document;if(!pd){var ep=document.createElement("div");ep.setAttribute("oninput","return;"),pd=typeof ep.oninput=="function"}md=pd}else md=!1;Wm=md&&(!document.documentMode||9<document.documentMode)}function tp(){Ni&&(Ni.detachEvent("onpropertychange",np),Ri=Ni=null)}function np(e){if(e.propertyName==="value"&&ru(Ri)){var n=[];Zm(n,Ri,e,_r(e)),bi(J0,n)}}function W0(e,n,r){e==="focusin"?(tp(),Ni=n,Ri=r,Ni.attachEvent("onpropertychange",np)):e==="focusout"&&tp()}function e1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ru(Ri)}function t1(e,n){if(e==="click")return ru(n)}function n1(e,n){if(e==="input"||e==="change")return ru(n)}function a1(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Ca=typeof Object.is=="function"?Object.is:a1;function ji(e,n){if(Ca(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),i=Object.keys(n);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var d=r[i];if(!jt.call(n,d)||!Ca(e[d],n[d]))return!1}return!0}function ap(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function rp(e,n){var r=ap(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=n&&i>=n)return{node:r,offset:n-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ap(r)}}function lp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?lp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function sp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Rt(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=Rt(e.document)}return n}function gd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var r1=ar&&"documentMode"in document&&11>=document.documentMode,Ns=null,vd=null,Ti=null,yd=!1;function ip(e,n,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;yd||Ns==null||Ns!==Rt(i)||(i=Ns,"selectionStart"in i&&gd(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ti&&ji(Ti,i)||(Ti=i,i=Pu(vd,"onSelect"),0<i.length&&(n=new Hr("onSelect","select",null,n,r),e.push({event:n,listeners:i}),n.target=Ns)))}function Gl(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var Rs={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionrun:Gl("Transition","TransitionRun"),transitionstart:Gl("Transition","TransitionStart"),transitioncancel:Gl("Transition","TransitionCancel"),transitionend:Gl("Transition","TransitionEnd")},xd={},op={};ar&&(op=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function Xl(e){if(xd[e])return xd[e];if(!Rs[e])return e;var n=Rs[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in op)return xd[e]=n[r];return e}var up=Xl("animationend"),cp=Xl("animationiteration"),dp=Xl("animationstart"),l1=Xl("transitionrun"),s1=Xl("transitionstart"),i1=Xl("transitioncancel"),fp=Xl("transitionend"),hp=new Map,bd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");bd.push("scrollEnd");function rr(e,n){hp.set(e,n),En(n,[e])}var lu=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},qa=[],js=0,Sd=0;function su(){for(var e=js,n=Sd=js=0;n<e;){var r=qa[n];qa[n++]=null;var i=qa[n];qa[n++]=null;var d=qa[n];qa[n++]=null;var h=qa[n];if(qa[n++]=null,i!==null&&d!==null){var b=i.pending;b===null?d.next=d:(d.next=b.next,b.next=d),i.pending=d}h!==0&&mp(r,d,h)}}function iu(e,n,r,i){qa[js++]=e,qa[js++]=n,qa[js++]=r,qa[js++]=i,Sd|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function wd(e,n,r,i){return iu(e,n,r,i),ou(e)}function Ql(e,n){return iu(e,null,null,n),ou(e)}function mp(e,n,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var d=!1,h=e.return;h!==null;)h.childLanes|=r,i=h.alternate,i!==null&&(i.childLanes|=r),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(d=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,d&&n!==null&&(d=31-Kt(r),e=h.hiddenUpdates,i=e[d],i===null?e[d]=[n]:i.push(n),n.lane=r|536870912),h):null}function ou(e){if(50<Qi)throw Qi=0,Of=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ts={};function o1(e,n,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Da(e,n,r,i){return new o1(e,n,r,i)}function Ed(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qr(e,n){var r=e.alternate;return r===null?(r=Da(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function pp(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function uu(e,n,r,i,d,h){var b=0;if(i=e,typeof e=="function")Ed(e)&&(b=1);else if(typeof e=="string")b=hS(e,r,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=Da(31,r,n,d),e.elementType=ee,e.lanes=h,e;case D:return Kl(r.children,d,h,n);case R:b=8,d|=24;break;case L:return e=Da(12,r,n,d|2),e.elementType=L,e.lanes=h,e;case W:return e=Da(13,r,n,d),e.elementType=W,e.lanes=h,e;case ae:return e=Da(19,r,n,d),e.elementType=ae,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:b=10;break e;case I:b=9;break e;case X:b=11;break e;case z:b=14;break e;case T:b=16,i=null;break e}b=29,r=Error(s(130,e===null?"null":typeof e,"")),i=null}return n=Da(b,r,n,d),n.elementType=e,n.type=i,n.lanes=h,n}function Kl(e,n,r,i){return e=Da(7,e,i,n),e.lanes=r,e}function Nd(e,n,r){return e=Da(6,e,null,n),e.lanes=r,e}function gp(e){var n=Da(18,null,null,0);return n.stateNode=e,n}function Rd(e,n,r){return n=Da(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var vp=new WeakMap;function Ia(e,n){if(typeof e=="object"&&e!==null){var r=vp.get(e);return r!==void 0?r:(n={value:e,source:n,stack:pn(n)},vp.set(e,n),n)}return{value:e,source:n,stack:pn(n)}}var Cs=[],Ds=0,cu=null,Ci=0,Va=[],Ya=0,ul=null,yr=1,xr="";function Ir(e,n){Cs[Ds++]=Ci,Cs[Ds++]=cu,cu=e,Ci=n}function yp(e,n,r){Va[Ya++]=yr,Va[Ya++]=xr,Va[Ya++]=ul,ul=e;var i=yr;e=xr;var d=32-Kt(i)-1;i&=~(1<<d),r+=1;var h=32-Kt(n)+d;if(30<h){var b=d-d%5;h=(i&(1<<b)-1).toString(32),i>>=b,d-=b,yr=1<<32-Kt(n)+d|r<<d|i,xr=h+e}else yr=1<<h|r<<d|i,xr=e}function jd(e){e.return!==null&&(Ir(e,1),yp(e,1,0))}function Td(e){for(;e===cu;)cu=Cs[--Ds],Cs[Ds]=null,Ci=Cs[--Ds],Cs[Ds]=null;for(;e===ul;)ul=Va[--Ya],Va[Ya]=null,xr=Va[--Ya],Va[Ya]=null,yr=Va[--Ya],Va[Ya]=null}function xp(e,n){Va[Ya++]=yr,Va[Ya++]=xr,Va[Ya++]=ul,yr=n.id,xr=n.overflow,ul=e}var Xn=null,rn=null,wt=!1,cl=null,Fa=!1,Cd=Error(s(519));function dl(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Di(Ia(n,e)),Cd}function bp(e){var n=e.stateNode,r=e.type,i=e.memoizedProps;switch(n[ve]=e,n[Ae]=i,r){case"dialog":pt("cancel",n),pt("close",n);break;case"iframe":case"object":case"embed":pt("load",n);break;case"video":case"audio":for(r=0;r<Zi.length;r++)pt(Zi[r],n);break;case"source":pt("error",n);break;case"img":case"image":case"link":pt("error",n),pt("load",n);break;case"details":pt("toggle",n);break;case"input":pt("invalid",n),yi(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":pt("invalid",n);break;case"textarea":pt("invalid",n),nr(n,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||i.suppressHydrationWarning===!0||Uv(n.textContent,r)?(i.popover!=null&&(pt("beforetoggle",n),pt("toggle",n)),i.onScroll!=null&&pt("scroll",n),i.onScrollEnd!=null&&pt("scrollend",n),i.onClick!=null&&(n.onclick=na),n=!0):n=!1,n||dl(e,!0)}function Sp(e){for(Xn=e.return;Xn;)switch(Xn.tag){case 5:case 31:case 13:Fa=!1;return;case 27:case 3:Fa=!0;return;default:Xn=Xn.return}}function As(e){if(e!==Xn)return!1;if(!wt)return Sp(e),wt=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Gf(e.type,e.memoizedProps)),r=!r),r&&rn&&dl(e),Sp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));rn=Pv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));rn=Pv(e)}else n===27?(n=rn,Rl(e.type)?(e=Jf,Jf=null,rn=e):rn=n):rn=Xn?Ga(e.stateNode.nextSibling):null;return!0}function Zl(){rn=Xn=null,wt=!1}function Dd(){var e=cl;return e!==null&&(Ea===null?Ea=e:Ea.push.apply(Ea,e),cl=null),e}function Di(e){cl===null?cl=[e]:cl.push(e)}var Ad=C(null),Jl=null,Vr=null;function fl(e,n,r){ne(Ad,n._currentValue),n._currentValue=r}function Yr(e){e._currentValue=Ad.current,V(Ad)}function kd(e,n,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===r)break;e=e.return}}function Od(e,n,r,i){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var h=d.dependencies;if(h!==null){var b=d.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=d;for(var k=0;k<n.length;k++)if(E.context===n[k]){h.lanes|=r,E=h.alternate,E!==null&&(E.lanes|=r),kd(h.return,r,e),i||(b=null);break e}h=E.next}}else if(d.tag===18){if(b=d.return,b===null)throw Error(s(341));b.lanes|=r,h=b.alternate,h!==null&&(h.lanes|=r),kd(b,r,e),b=null}else b=d.child;if(b!==null)b.return=d;else for(b=d;b!==null;){if(b===e){b=null;break}if(d=b.sibling,d!==null){d.return=b.return,b=d;break}b=b.return}d=b}}function ks(e,n,r,i){e=null;for(var d=n,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var b=d.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var E=d.type;Ca(d.pendingProps.value,b.value)||(e!==null?e.push(E):e=[E])}}else if(d===ze.current){if(b=d.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(no):e=[no])}d=d.return}e!==null&&Od(n,e,r,i),n.flags|=262144}function du(e){for(e=e.firstContext;e!==null;){if(!Ca(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wl(e){Jl=e,Vr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qn(e){return wp(Jl,e)}function fu(e,n){return Jl===null&&Wl(e),wp(e,n)}function wp(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},Vr===null){if(e===null)throw Error(s(308));Vr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Vr=Vr.next=n;return r}var u1=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},c1=t.unstable_scheduleCallback,d1=t.unstable_NormalPriority,jn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Md(){return{controller:new u1,data:new Map,refCount:0}}function Ai(e){e.refCount--,e.refCount===0&&c1(d1,function(){e.controller.abort()})}var ki=null,_d=0,Os=0,Ms=null;function f1(e,n){if(ki===null){var r=ki=[];_d=0,Os=Bf(),Ms={status:"pending",value:void 0,then:function(i){r.push(i)}}}return _d++,n.then(Ep,Ep),n}function Ep(){if(--_d===0&&ki!==null){Ms!==null&&(Ms.status="fulfilled");var e=ki;ki=null,Os=0,Ms=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function h1(e,n){var r=[],i={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){i.status="fulfilled",i.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(i.status="rejected",i.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),i}var Np=U.S;U.S=function(e,n){iv=tn(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&f1(e,n),Np!==null&&Np(e,n)};var es=C(null);function Ld(){var e=es.current;return e!==null?e:en.pooledCache}function hu(e,n){n===null?ne(es,es.current):ne(es,n.pool)}function Rp(){var e=Ld();return e===null?null:{parent:jn._currentValue,pool:e}}var _s=Error(s(460)),zd=Error(s(474)),mu=Error(s(542)),pu={then:function(){}};function jp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Tp(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(na,na),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Dp(e),e;default:if(typeof n.status=="string")n.then(na,na);else{if(e=en,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(i){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=i}},function(i){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=i}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Dp(e),e}throw ns=n,_s}}function ts(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(ns=r,_s):r}}var ns=null;function Cp(){if(ns===null)throw Error(s(459));var e=ns;return ns=null,e}function Dp(e){if(e===_s||e===mu)throw Error(s(483))}var Ls=null,Oi=0;function gu(e){var n=Oi;return Oi+=1,Ls===null&&(Ls=[]),Tp(Ls,e,n)}function Mi(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function vu(e,n){throw n.$$typeof===N?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Ap(e){function n(H,_){if(e){var Y=H.deletions;Y===null?(H.deletions=[_],H.flags|=16):Y.push(_)}}function r(H,_){if(!e)return null;for(;_!==null;)n(H,_),_=_.sibling;return null}function i(H){for(var _=new Map;H!==null;)H.key!==null?_.set(H.key,H):_.set(H.index,H),H=H.sibling;return _}function d(H,_){return H=qr(H,_),H.index=0,H.sibling=null,H}function h(H,_,Y){return H.index=Y,e?(Y=H.alternate,Y!==null?(Y=Y.index,Y<_?(H.flags|=67108866,_):Y):(H.flags|=67108866,_)):(H.flags|=1048576,_)}function b(H){return e&&H.alternate===null&&(H.flags|=67108866),H}function E(H,_,Y,le){return _===null||_.tag!==6?(_=Nd(Y,H.mode,le),_.return=H,_):(_=d(_,Y),_.return=H,_)}function k(H,_,Y,le){var He=Y.type;return He===D?J(H,_,Y.props.children,le,Y.key):_!==null&&(_.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===T&&ts(He)===_.type)?(_=d(_,Y.props),Mi(_,Y),_.return=H,_):(_=uu(Y.type,Y.key,Y.props,null,H.mode,le),Mi(_,Y),_.return=H,_)}function F(H,_,Y,le){return _===null||_.tag!==4||_.stateNode.containerInfo!==Y.containerInfo||_.stateNode.implementation!==Y.implementation?(_=Rd(Y,H.mode,le),_.return=H,_):(_=d(_,Y.children||[]),_.return=H,_)}function J(H,_,Y,le,He){return _===null||_.tag!==7?(_=Kl(Y,H.mode,le,He),_.return=H,_):(_=d(_,Y),_.return=H,_)}function ie(H,_,Y){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Nd(""+_,H.mode,Y),_.return=H,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case w:return Y=uu(_.type,_.key,_.props,null,H.mode,Y),Mi(Y,_),Y.return=H,Y;case S:return _=Rd(_,H.mode,Y),_.return=H,_;case T:return _=ts(_),ie(H,_,Y)}if(ge(_)||ye(_))return _=Kl(_,H.mode,Y,null),_.return=H,_;if(typeof _.then=="function")return ie(H,gu(_),Y);if(_.$$typeof===q)return ie(H,fu(H,_),Y);vu(H,_)}return null}function G(H,_,Y,le){var He=_!==null?_.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return He!==null?null:E(H,_,""+Y,le);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case w:return Y.key===He?k(H,_,Y,le):null;case S:return Y.key===He?F(H,_,Y,le):null;case T:return Y=ts(Y),G(H,_,Y,le)}if(ge(Y)||ye(Y))return He!==null?null:J(H,_,Y,le,null);if(typeof Y.then=="function")return G(H,_,gu(Y),le);if(Y.$$typeof===q)return G(H,_,fu(H,Y),le);vu(H,Y)}return null}function Q(H,_,Y,le,He){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return H=H.get(Y)||null,E(_,H,""+le,He);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case w:return H=H.get(le.key===null?Y:le.key)||null,k(_,H,le,He);case S:return H=H.get(le.key===null?Y:le.key)||null,F(_,H,le,He);case T:return le=ts(le),Q(H,_,Y,le,He)}if(ge(le)||ye(le))return H=H.get(Y)||null,J(_,H,le,He,null);if(typeof le.then=="function")return Q(H,_,Y,gu(le),He);if(le.$$typeof===q)return Q(H,_,Y,fu(_,le),He);vu(_,le)}return null}function Oe(H,_,Y,le){for(var He=null,At=null,Le=_,ot=_=0,bt=null;Le!==null&&ot<Y.length;ot++){Le.index>ot?(bt=Le,Le=null):bt=Le.sibling;var kt=G(H,Le,Y[ot],le);if(kt===null){Le===null&&(Le=bt);break}e&&Le&&kt.alternate===null&&n(H,Le),_=h(kt,_,ot),At===null?He=kt:At.sibling=kt,At=kt,Le=bt}if(ot===Y.length)return r(H,Le),wt&&Ir(H,ot),He;if(Le===null){for(;ot<Y.length;ot++)Le=ie(H,Y[ot],le),Le!==null&&(_=h(Le,_,ot),At===null?He=Le:At.sibling=Le,At=Le);return wt&&Ir(H,ot),He}for(Le=i(Le);ot<Y.length;ot++)bt=Q(Le,H,ot,Y[ot],le),bt!==null&&(e&&bt.alternate!==null&&Le.delete(bt.key===null?ot:bt.key),_=h(bt,_,ot),At===null?He=bt:At.sibling=bt,At=bt);return e&&Le.forEach(function(Al){return n(H,Al)}),wt&&Ir(H,ot),He}function Ve(H,_,Y,le){if(Y==null)throw Error(s(151));for(var He=null,At=null,Le=_,ot=_=0,bt=null,kt=Y.next();Le!==null&&!kt.done;ot++,kt=Y.next()){Le.index>ot?(bt=Le,Le=null):bt=Le.sibling;var Al=G(H,Le,kt.value,le);if(Al===null){Le===null&&(Le=bt);break}e&&Le&&Al.alternate===null&&n(H,Le),_=h(Al,_,ot),At===null?He=Al:At.sibling=Al,At=Al,Le=bt}if(kt.done)return r(H,Le),wt&&Ir(H,ot),He;if(Le===null){for(;!kt.done;ot++,kt=Y.next())kt=ie(H,kt.value,le),kt!==null&&(_=h(kt,_,ot),At===null?He=kt:At.sibling=kt,At=kt);return wt&&Ir(H,ot),He}for(Le=i(Le);!kt.done;ot++,kt=Y.next())kt=Q(Le,H,ot,kt.value,le),kt!==null&&(e&&kt.alternate!==null&&Le.delete(kt.key===null?ot:kt.key),_=h(kt,_,ot),At===null?He=kt:At.sibling=kt,At=kt);return e&&Le.forEach(function(NS){return n(H,NS)}),wt&&Ir(H,ot),He}function Ft(H,_,Y,le){if(typeof Y=="object"&&Y!==null&&Y.type===D&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case w:e:{for(var He=Y.key;_!==null;){if(_.key===He){if(He=Y.type,He===D){if(_.tag===7){r(H,_.sibling),le=d(_,Y.props.children),le.return=H,H=le;break e}}else if(_.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===T&&ts(He)===_.type){r(H,_.sibling),le=d(_,Y.props),Mi(le,Y),le.return=H,H=le;break e}r(H,_);break}else n(H,_);_=_.sibling}Y.type===D?(le=Kl(Y.props.children,H.mode,le,Y.key),le.return=H,H=le):(le=uu(Y.type,Y.key,Y.props,null,H.mode,le),Mi(le,Y),le.return=H,H=le)}return b(H);case S:e:{for(He=Y.key;_!==null;){if(_.key===He)if(_.tag===4&&_.stateNode.containerInfo===Y.containerInfo&&_.stateNode.implementation===Y.implementation){r(H,_.sibling),le=d(_,Y.children||[]),le.return=H,H=le;break e}else{r(H,_);break}else n(H,_);_=_.sibling}le=Rd(Y,H.mode,le),le.return=H,H=le}return b(H);case T:return Y=ts(Y),Ft(H,_,Y,le)}if(ge(Y))return Oe(H,_,Y,le);if(ye(Y)){if(He=ye(Y),typeof He!="function")throw Error(s(150));return Y=He.call(Y),Ve(H,_,Y,le)}if(typeof Y.then=="function")return Ft(H,_,gu(Y),le);if(Y.$$typeof===q)return Ft(H,_,fu(H,Y),le);vu(H,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,_!==null&&_.tag===6?(r(H,_.sibling),le=d(_,Y),le.return=H,H=le):(r(H,_),le=Nd(Y,H.mode,le),le.return=H,H=le),b(H)):r(H,_)}return function(H,_,Y,le){try{Oi=0;var He=Ft(H,_,Y,le);return Ls=null,He}catch(Le){if(Le===_s||Le===mu)throw Le;var At=Da(29,Le,null,H.mode);return At.lanes=le,At.return=H,At}finally{}}}var as=Ap(!0),kp=Ap(!1),hl=!1;function Ud(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ml(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function pl(e,n,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Ot&2)!==0){var d=i.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),i.pending=n,n=ou(e),mp(e,null,r),n}return iu(e,i,n,r),ou(e)}function _i(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var i=n.lanes;i&=e.pendingLanes,r|=i,n.lanes=r,kn(e,r)}}function Hd(e,n){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var d=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var b={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?d=h=b:h=h.next=b,r=r.next}while(r!==null);h===null?d=h=n:h=h.next=n}else d=h=n;r={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var $d=!1;function Li(){if($d){var e=Ms;if(e!==null)throw e}}function zi(e,n,r,i){$d=!1;var d=e.updateQueue;hl=!1;var h=d.firstBaseUpdate,b=d.lastBaseUpdate,E=d.shared.pending;if(E!==null){d.shared.pending=null;var k=E,F=k.next;k.next=null,b===null?h=F:b.next=F,b=k;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==b&&(E===null?J.firstBaseUpdate=F:E.next=F,J.lastBaseUpdate=k))}if(h!==null){var ie=d.baseState;b=0,J=F=k=null,E=h;do{var G=E.lane&-536870913,Q=G!==E.lane;if(Q?(xt&G)===G:(i&G)===G){G!==0&&G===Os&&($d=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Oe=e,Ve=E;G=n;var Ft=r;switch(Ve.tag){case 1:if(Oe=Ve.payload,typeof Oe=="function"){ie=Oe.call(Ft,ie,G);break e}ie=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Ve.payload,G=typeof Oe=="function"?Oe.call(Ft,ie,G):Oe,G==null)break e;ie=y({},ie,G);break e;case 2:hl=!0}}G=E.callback,G!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=d.callbacks,Q===null?d.callbacks=[G]:Q.push(G))}else Q={lane:G,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(F=J=Q,k=ie):J=J.next=Q,b|=G;if(E=E.next,E===null){if(E=d.shared.pending,E===null)break;Q=E,E=Q.next,Q.next=null,d.lastBaseUpdate=Q,d.shared.pending=null}}while(!0);J===null&&(k=ie),d.baseState=k,d.firstBaseUpdate=F,d.lastBaseUpdate=J,h===null&&(d.shared.lanes=0),bl|=b,e.lanes=b,e.memoizedState=ie}}function Op(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function Mp(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Op(r[e],n)}var zs=C(null),yu=C(0);function _p(e,n){e=Wr,ne(yu,e),ne(zs,n),Wr=e|n.baseLanes}function qd(){ne(yu,Wr),ne(zs,zs.current)}function Id(){Wr=yu.current,V(zs),V(yu)}var Aa=C(null),Pa=null;function gl(e){var n=e.alternate;ne(vn,vn.current&1),ne(Aa,e),Pa===null&&(n===null||zs.current!==null||n.memoizedState!==null)&&(Pa=e)}function Vd(e){ne(vn,vn.current),ne(Aa,e),Pa===null&&(Pa=e)}function Lp(e){e.tag===22?(ne(vn,vn.current),ne(Aa,e),Pa===null&&(Pa=e)):vl()}function vl(){ne(vn,vn.current),ne(Aa,Aa.current)}function ka(e){V(Aa),Pa===e&&(Pa=null),V(vn)}var vn=C(0);function xu(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Kf(r)||Zf(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Fr=0,st=null,Vt=null,Tn=null,bu=!1,Us=!1,rs=!1,Su=0,Ui=0,Bs=null,m1=0;function dn(){throw Error(s(321))}function Yd(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!Ca(e[r],n[r]))return!1;return!0}function Fd(e,n,r,i,d,h){return Fr=h,st=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,U.H=e===null||e.memoizedState===null?yg:sf,rs=!1,h=r(i,d),rs=!1,Us&&(h=Up(n,r,i,d)),zp(e),h}function zp(e){U.H=$i;var n=Vt!==null&&Vt.next!==null;if(Fr=0,Tn=Vt=st=null,bu=!1,Ui=0,Bs=null,n)throw Error(s(300));e===null||Cn||(e=e.dependencies,e!==null&&du(e)&&(Cn=!0))}function Up(e,n,r,i){st=e;var d=0;do{if(Us&&(Bs=null),Ui=0,Us=!1,25<=d)throw Error(s(301));if(d+=1,Tn=Vt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}U.H=xg,h=n(r,i)}while(Us);return h}function p1(){var e=U.H,n=e.useState()[0];return n=typeof n.then=="function"?Bi(n):n,e=e.useState()[0],(Vt!==null?Vt.memoizedState:null)!==e&&(st.flags|=1024),n}function Pd(){var e=Su!==0;return Su=0,e}function Gd(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function Xd(e){if(bu){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}bu=!1}Fr=0,Tn=Vt=st=null,Us=!1,Ui=Su=0,Bs=null}function ha(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tn===null?st.memoizedState=Tn=e:Tn=Tn.next=e,Tn}function yn(){if(Vt===null){var e=st.alternate;e=e!==null?e.memoizedState:null}else e=Vt.next;var n=Tn===null?st.memoizedState:Tn.next;if(n!==null)Tn=n,Vt=e;else{if(e===null)throw st.alternate===null?Error(s(467)):Error(s(310));Vt=e,e={memoizedState:Vt.memoizedState,baseState:Vt.baseState,baseQueue:Vt.baseQueue,queue:Vt.queue,next:null},Tn===null?st.memoizedState=Tn=e:Tn=Tn.next=e}return Tn}function wu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bi(e){var n=Ui;return Ui+=1,Bs===null&&(Bs=[]),e=Tp(Bs,e,n),n=st,(Tn===null?n.memoizedState:Tn.next)===null&&(n=n.alternate,U.H=n===null||n.memoizedState===null?yg:sf),e}function Eu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Bi(e);if(e.$$typeof===q)return Qn(e)}throw Error(s(438,String(e)))}function Qd(e){var n=null,r=st.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var i=st.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(n={data:i.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=wu(),st.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),i=0;i<e;i++)r[i]=fe;return n.index++,r}function Pr(e,n){return typeof n=="function"?n(e):n}function Nu(e){var n=yn();return Kd(n,Vt,e)}function Kd(e,n,r){var i=e.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=r;var d=e.baseQueue,h=i.pending;if(h!==null){if(d!==null){var b=d.next;d.next=h.next,h.next=b}n.baseQueue=d=h,i.pending=null}if(h=e.baseState,d===null)e.memoizedState=h;else{n=d.next;var E=b=null,k=null,F=n,J=!1;do{var ie=F.lane&-536870913;if(ie!==F.lane?(xt&ie)===ie:(Fr&ie)===ie){var G=F.revertLane;if(G===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ie===Os&&(J=!0);else if((Fr&G)===G){F=F.next,G===Os&&(J=!0);continue}else ie={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},k===null?(E=k=ie,b=h):k=k.next=ie,st.lanes|=G,bl|=G;ie=F.action,rs&&r(h,ie),h=F.hasEagerState?F.eagerState:r(h,ie)}else G={lane:ie,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},k===null?(E=k=G,b=h):k=k.next=G,st.lanes|=ie,bl|=ie;F=F.next}while(F!==null&&F!==n);if(k===null?b=h:k.next=E,!Ca(h,e.memoizedState)&&(Cn=!0,J&&(r=Ms,r!==null)))throw r;e.memoizedState=h,e.baseState=b,e.baseQueue=k,i.lastRenderedState=h}return d===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Zd(e){var n=yn(),r=n.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=e;var i=r.dispatch,d=r.pending,h=n.memoizedState;if(d!==null){r.pending=null;var b=d=d.next;do h=e(h,b.action),b=b.next;while(b!==d);Ca(h,n.memoizedState)||(Cn=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),r.lastRenderedState=h}return[h,i]}function Bp(e,n,r){var i=st,d=yn(),h=wt;if(h){if(r===void 0)throw Error(s(407));r=r()}else r=n();var b=!Ca((Vt||d).memoizedState,r);if(b&&(d.memoizedState=r,Cn=!0),d=d.queue,ef(qp.bind(null,i,d,e),[e]),d.getSnapshot!==n||b||Tn!==null&&Tn.memoizedState.tag&1){if(i.flags|=2048,Hs(9,{destroy:void 0},$p.bind(null,i,d,r,n),null),en===null)throw Error(s(349));h||(Fr&127)!==0||Hp(i,n,r)}return r}function Hp(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=st.updateQueue,n===null?(n=wu(),st.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function $p(e,n,r,i){n.value=r,n.getSnapshot=i,Ip(n)&&Vp(e)}function qp(e,n,r){return r(function(){Ip(n)&&Vp(e)})}function Ip(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!Ca(e,r)}catch{return!0}}function Vp(e){var n=Ql(e,2);n!==null&&Na(n,e,2)}function Jd(e){var n=ha();if(typeof e=="function"){var r=e;if(e=r(),rs){Tt(!0);try{r()}finally{Tt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:e},n}function Yp(e,n,r,i){return e.baseState=r,Kd(e,Vt,typeof i=="function"?i:Pr)}function g1(e,n,r,i,d){if(Tu(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){h.listeners.push(b)}};U.T!==null?r(!0):h.isTransition=!1,i(h),r=n.pending,r===null?(h.next=n.pending=h,Fp(n,h)):(h.next=r.next,n.pending=r.next=h)}}function Fp(e,n){var r=n.action,i=n.payload,d=e.state;if(n.isTransition){var h=U.T,b={};U.T=b;try{var E=r(d,i),k=U.S;k!==null&&k(b,E),Pp(e,n,E)}catch(F){Wd(e,n,F)}finally{h!==null&&b.types!==null&&(h.types=b.types),U.T=h}}else try{h=r(d,i),Pp(e,n,h)}catch(F){Wd(e,n,F)}}function Pp(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){Gp(e,n,i)},function(i){return Wd(e,n,i)}):Gp(e,n,r)}function Gp(e,n,r){n.status="fulfilled",n.value=r,Xp(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,Fp(e,r)))}function Wd(e,n,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=r,Xp(n),n=n.next;while(n!==i)}e.action=null}function Xp(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Qp(e,n){return n}function Kp(e,n){if(wt){var r=en.formState;if(r!==null){e:{var i=st;if(wt){if(rn){t:{for(var d=rn,h=Fa;d.nodeType!==8;){if(!h){d=null;break t}if(d=Ga(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){rn=Ga(d.nextSibling),i=d.data==="F!";break e}}dl(i)}i=!1}i&&(n=r[0])}}return r=ha(),r.memoizedState=r.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qp,lastRenderedState:n},r.queue=i,r=pg.bind(null,st,i),i.dispatch=r,i=Jd(!1),h=lf.bind(null,st,!1,i.queue),i=ha(),d={state:n,dispatch:null,action:e,pending:null},i.queue=d,r=g1.bind(null,st,d,h,r),d.dispatch=r,i.memoizedState=e,[n,r,!1]}function Zp(e){var n=yn();return Jp(n,Vt,e)}function Jp(e,n,r){if(n=Kd(e,n,Qp)[0],e=Nu(Pr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=Bi(n)}catch(b){throw b===_s?mu:b}else i=n;n=yn();var d=n.queue,h=d.dispatch;return r!==n.memoizedState&&(st.flags|=2048,Hs(9,{destroy:void 0},v1.bind(null,d,r),null)),[i,h,e]}function v1(e,n){e.action=n}function Wp(e){var n=yn(),r=Vt;if(r!==null)return Jp(n,r,e);yn(),n=n.memoizedState,r=yn();var i=r.queue.dispatch;return r.memoizedState=e,[n,i,!1]}function Hs(e,n,r,i){return e={tag:e,create:r,deps:i,inst:n,next:null},n=st.updateQueue,n===null&&(n=wu(),st.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,n.lastEffect=e),e}function eg(){return yn().memoizedState}function Ru(e,n,r,i){var d=ha();st.flags|=e,d.memoizedState=Hs(1|n,{destroy:void 0},r,i===void 0?null:i)}function ju(e,n,r,i){var d=yn();i=i===void 0?null:i;var h=d.memoizedState.inst;Vt!==null&&i!==null&&Yd(i,Vt.memoizedState.deps)?d.memoizedState=Hs(n,h,r,i):(st.flags|=e,d.memoizedState=Hs(1|n,h,r,i))}function tg(e,n){Ru(8390656,8,e,n)}function ef(e,n){ju(2048,8,e,n)}function y1(e){st.flags|=4;var n=st.updateQueue;if(n===null)n=wu(),st.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function ng(e){var n=yn().memoizedState;return y1({ref:n,nextImpl:e}),function(){if((Ot&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function ag(e,n){return ju(4,2,e,n)}function rg(e,n){return ju(4,4,e,n)}function lg(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function sg(e,n,r){r=r!=null?r.concat([e]):null,ju(4,4,lg.bind(null,n,e),r)}function tf(){}function ig(e,n){var r=yn();n=n===void 0?null:n;var i=r.memoizedState;return n!==null&&Yd(n,i[1])?i[0]:(r.memoizedState=[e,n],e)}function og(e,n){var r=yn();n=n===void 0?null:n;var i=r.memoizedState;if(n!==null&&Yd(n,i[1]))return i[0];if(i=e(),rs){Tt(!0);try{e()}finally{Tt(!1)}}return r.memoizedState=[i,n],i}function nf(e,n,r){return r===void 0||(Fr&1073741824)!==0&&(xt&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=uv(),st.lanes|=e,bl|=e,r)}function ug(e,n,r,i){return Ca(r,n)?r:zs.current!==null?(e=nf(e,r,i),Ca(e,n)||(Cn=!0),e):(Fr&42)===0||(Fr&1073741824)!==0&&(xt&261930)===0?(Cn=!0,e.memoizedState=r):(e=uv(),st.lanes|=e,bl|=e,n)}function cg(e,n,r,i,d){var h=B.p;B.p=h!==0&&8>h?h:8;var b=U.T,E={};U.T=E,lf(e,!1,n,r);try{var k=d(),F=U.S;if(F!==null&&F(E,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var J=h1(k,i);Hi(e,n,J,_a(e))}else Hi(e,n,i,_a(e))}catch(ie){Hi(e,n,{then:function(){},status:"rejected",reason:ie},_a())}finally{B.p=h,b!==null&&E.types!==null&&(b.types=E.types),U.T=b}}function x1(){}function af(e,n,r,i){if(e.tag!==5)throw Error(s(476));var d=dg(e).queue;cg(e,d,n,ue,r===null?x1:function(){return fg(e),r(i)})}function dg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:ue},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function fg(e){var n=dg(e);n.next===null&&(n=e.alternate.memoizedState),Hi(e,n.next.queue,{},_a())}function rf(){return Qn(no)}function hg(){return yn().memoizedState}function mg(){return yn().memoizedState}function b1(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=_a();e=ml(r);var i=pl(n,e,r);i!==null&&(Na(i,n,r),_i(i,n,r)),n={cache:Md()},e.payload=n;return}n=n.return}}function S1(e,n,r){var i=_a();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Tu(e)?gg(n,r):(r=wd(e,n,r,i),r!==null&&(Na(r,e,i),vg(r,n,i)))}function pg(e,n,r){var i=_a();Hi(e,n,r,i)}function Hi(e,n,r,i){var d={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Tu(e))gg(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var b=n.lastRenderedState,E=h(b,r);if(d.hasEagerState=!0,d.eagerState=E,Ca(E,b))return iu(e,n,d,0),en===null&&su(),!1}catch{}finally{}if(r=wd(e,n,d,i),r!==null)return Na(r,e,i),vg(r,n,i),!0}return!1}function lf(e,n,r,i){if(i={lane:2,revertLane:Bf(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Tu(e)){if(n)throw Error(s(479))}else n=wd(e,r,i,2),n!==null&&Na(n,e,2)}function Tu(e){var n=e.alternate;return e===st||n!==null&&n===st}function gg(e,n){Us=bu=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function vg(e,n,r){if((r&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,r|=i,n.lanes=r,kn(e,r)}}var $i={readContext:Qn,use:Eu,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useLayoutEffect:dn,useInsertionEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useSyncExternalStore:dn,useId:dn,useHostTransitionStatus:dn,useFormState:dn,useActionState:dn,useOptimistic:dn,useMemoCache:dn,useCacheRefresh:dn};$i.useEffectEvent=dn;var yg={readContext:Qn,use:Eu,useCallback:function(e,n){return ha().memoizedState=[e,n===void 0?null:n],e},useContext:Qn,useEffect:tg,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,Ru(4194308,4,lg.bind(null,n,e),r)},useLayoutEffect:function(e,n){return Ru(4194308,4,e,n)},useInsertionEffect:function(e,n){Ru(4,2,e,n)},useMemo:function(e,n){var r=ha();n=n===void 0?null:n;var i=e();if(rs){Tt(!0);try{e()}finally{Tt(!1)}}return r.memoizedState=[i,n],i},useReducer:function(e,n,r){var i=ha();if(r!==void 0){var d=r(n);if(rs){Tt(!0);try{r(n)}finally{Tt(!1)}}}else d=n;return i.memoizedState=i.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},i.queue=e,e=e.dispatch=S1.bind(null,st,e),[i.memoizedState,e]},useRef:function(e){var n=ha();return e={current:e},n.memoizedState=e},useState:function(e){e=Jd(e);var n=e.queue,r=pg.bind(null,st,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:tf,useDeferredValue:function(e,n){var r=ha();return nf(r,e,n)},useTransition:function(){var e=Jd(!1);return e=cg.bind(null,st,e.queue,!0,!1),ha().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var i=st,d=ha();if(wt){if(r===void 0)throw Error(s(407));r=r()}else{if(r=n(),en===null)throw Error(s(349));(xt&127)!==0||Hp(i,n,r)}d.memoizedState=r;var h={value:r,getSnapshot:n};return d.queue=h,tg(qp.bind(null,i,h,e),[e]),i.flags|=2048,Hs(9,{destroy:void 0},$p.bind(null,i,h,r,n),null),r},useId:function(){var e=ha(),n=en.identifierPrefix;if(wt){var r=xr,i=yr;r=(i&~(1<<32-Kt(i)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Su++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=m1++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:rf,useFormState:Kp,useActionState:Kp,useOptimistic:function(e){var n=ha();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=lf.bind(null,st,!0,r),r.dispatch=n,[e,n]},useMemoCache:Qd,useCacheRefresh:function(){return ha().memoizedState=b1.bind(null,st)},useEffectEvent:function(e){var n=ha(),r={impl:e};return n.memoizedState=r,function(){if((Ot&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}},sf={readContext:Qn,use:Eu,useCallback:ig,useContext:Qn,useEffect:ef,useImperativeHandle:sg,useInsertionEffect:ag,useLayoutEffect:rg,useMemo:og,useReducer:Nu,useRef:eg,useState:function(){return Nu(Pr)},useDebugValue:tf,useDeferredValue:function(e,n){var r=yn();return ug(r,Vt.memoizedState,e,n)},useTransition:function(){var e=Nu(Pr)[0],n=yn().memoizedState;return[typeof e=="boolean"?e:Bi(e),n]},useSyncExternalStore:Bp,useId:hg,useHostTransitionStatus:rf,useFormState:Zp,useActionState:Zp,useOptimistic:function(e,n){var r=yn();return Yp(r,Vt,e,n)},useMemoCache:Qd,useCacheRefresh:mg};sf.useEffectEvent=ng;var xg={readContext:Qn,use:Eu,useCallback:ig,useContext:Qn,useEffect:ef,useImperativeHandle:sg,useInsertionEffect:ag,useLayoutEffect:rg,useMemo:og,useReducer:Zd,useRef:eg,useState:function(){return Zd(Pr)},useDebugValue:tf,useDeferredValue:function(e,n){var r=yn();return Vt===null?nf(r,e,n):ug(r,Vt.memoizedState,e,n)},useTransition:function(){var e=Zd(Pr)[0],n=yn().memoizedState;return[typeof e=="boolean"?e:Bi(e),n]},useSyncExternalStore:Bp,useId:hg,useHostTransitionStatus:rf,useFormState:Wp,useActionState:Wp,useOptimistic:function(e,n){var r=yn();return Vt!==null?Yp(r,Vt,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Qd,useCacheRefresh:mg};xg.useEffectEvent=ng;function of(e,n,r,i){n=e.memoizedState,r=r(i,n),r=r==null?n:y({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var uf={enqueueSetState:function(e,n,r){e=e._reactInternals;var i=_a(),d=ml(i);d.payload=n,r!=null&&(d.callback=r),n=pl(e,d,i),n!==null&&(Na(n,e,i),_i(n,e,i))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var i=_a(),d=ml(i);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=pl(e,d,i),n!==null&&(Na(n,e,i),_i(n,e,i))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=_a(),i=ml(r);i.tag=2,n!=null&&(i.callback=n),n=pl(e,i,r),n!==null&&(Na(n,e,r),_i(n,e,r))}};function bg(e,n,r,i,d,h,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,h,b):n.prototype&&n.prototype.isPureReactComponent?!ji(r,i)||!ji(d,h):!0}function Sg(e,n,r,i){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,i),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,i),n.state!==e&&uf.enqueueReplaceState(n,n.state,null)}function ls(e,n){var r=n;if("ref"in n){r={};for(var i in n)i!=="ref"&&(r[i]=n[i])}if(e=e.defaultProps){r===n&&(r=y({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function wg(e){lu(e)}function Eg(e){console.error(e)}function Ng(e){lu(e)}function Cu(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function Rg(e,n,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function cf(e,n,r){return r=ml(r),r.tag=3,r.payload={element:null},r.callback=function(){Cu(e,n)},r}function jg(e){return e=ml(e),e.tag=3,e}function Tg(e,n,r,i){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var h=i.value;e.payload=function(){return d(h)},e.callback=function(){Rg(n,r,i)}}var b=r.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Rg(n,r,i),typeof d!="function"&&(Sl===null?Sl=new Set([this]):Sl.add(this));var E=i.stack;this.componentDidCatch(i.value,{componentStack:E!==null?E:""})})}function w1(e,n,r,i,d){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=r.alternate,n!==null&&ks(n,r,d,!0),r=Aa.current,r!==null){switch(r.tag){case 31:case 13:return Pa===null?$u():r.alternate===null&&fn===0&&(fn=3),r.flags&=-257,r.flags|=65536,r.lanes=d,i===pu?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([i]):n.add(i),Lf(e,i,d)),!1;case 22:return r.flags|=65536,i===pu?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([i]):r.add(i)),Lf(e,i,d)),!1}throw Error(s(435,r.tag))}return Lf(e,i,d),$u(),!1}if(wt)return n=Aa.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,i!==Cd&&(e=Error(s(422),{cause:i}),Di(Ia(e,r)))):(i!==Cd&&(n=Error(s(423),{cause:i}),Di(Ia(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,i=Ia(i,r),d=cf(e.stateNode,i,d),Hd(e,d),fn!==4&&(fn=2)),!1;var h=Error(s(520),{cause:i});if(h=Ia(h,r),Xi===null?Xi=[h]:Xi.push(h),fn!==4&&(fn=2),n===null)return!0;i=Ia(i,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=cf(r.stateNode,i,e),Hd(r,e),!1;case 1:if(n=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Sl===null||!Sl.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=jg(d),Tg(d,e,r,i),Hd(r,d),!1}r=r.return}while(r!==null);return!1}var df=Error(s(461)),Cn=!1;function Kn(e,n,r,i){n.child=e===null?kp(n,null,r,i):as(n,e.child,r,i)}function Cg(e,n,r,i,d){r=r.render;var h=n.ref;if("ref"in i){var b={};for(var E in i)E!=="ref"&&(b[E]=i[E])}else b=i;return Wl(n),i=Fd(e,n,r,b,h,d),E=Pd(),e!==null&&!Cn?(Gd(e,n,d),Gr(e,n,d)):(wt&&E&&jd(n),n.flags|=1,Kn(e,n,i,d),n.child)}function Dg(e,n,r,i,d){if(e===null){var h=r.type;return typeof h=="function"&&!Ed(h)&&h.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=h,Ag(e,n,h,i,d)):(e=uu(r.type,null,i,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!xf(e,d)){var b=h.memoizedProps;if(r=r.compare,r=r!==null?r:ji,r(b,i)&&e.ref===n.ref)return Gr(e,n,d)}return n.flags|=1,e=qr(h,i),e.ref=n.ref,e.return=n,n.child=e}function Ag(e,n,r,i,d){if(e!==null){var h=e.memoizedProps;if(ji(h,i)&&e.ref===n.ref)if(Cn=!1,n.pendingProps=i=h,xf(e,d))(e.flags&131072)!==0&&(Cn=!0);else return n.lanes=e.lanes,Gr(e,n,d)}return ff(e,n,r,i,d)}function kg(e,n,r,i){var d=i.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,e!==null){for(i=n.child=e.child,d=0;i!==null;)d=d|i.lanes|i.childLanes,i=i.sibling;i=d&~h}else i=0,n.child=null;return Og(e,n,h,r,i)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&hu(n,h!==null?h.cachePool:null),h!==null?_p(n,h):qd(),Lp(n);else return i=n.lanes=536870912,Og(e,n,h!==null?h.baseLanes|r:r,r,i)}else h!==null?(hu(n,h.cachePool),_p(n,h),vl(),n.memoizedState=null):(e!==null&&hu(n,null),qd(),vl());return Kn(e,n,d,r),n.child}function qi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Og(e,n,r,i,d){var h=Ld();return h=h===null?null:{parent:jn._currentValue,pool:h},n.memoizedState={baseLanes:r,cachePool:h},e!==null&&hu(n,null),qd(),Lp(n),e!==null&&ks(e,n,i,!0),n.childLanes=d,null}function Du(e,n){return n=ku({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Mg(e,n,r){return as(n,e.child,null,r),e=Du(n,n.pendingProps),e.flags|=2,ka(n),n.memoizedState=null,e}function E1(e,n,r){var i=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(wt){if(i.mode==="hidden")return e=Du(n,i),n.lanes=536870912,qi(null,e);if(Vd(n),(e=rn)?(e=Fv(e,Fa),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ul!==null?{id:yr,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},r=gp(e),r.return=n,n.child=r,Xn=n,rn=null)):e=null,e===null)throw dl(n);return n.lanes=536870912,null}return Du(n,i)}var h=e.memoizedState;if(h!==null){var b=h.dehydrated;if(Vd(n),d)if(n.flags&256)n.flags&=-257,n=Mg(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(Cn||ks(e,n,r,!1),d=(r&e.childLanes)!==0,Cn||d){if(i=en,i!==null&&(b=A(i,r),b!==0&&b!==h.retryLane))throw h.retryLane=b,Ql(e,b),Na(i,e,b),df;$u(),n=Mg(e,n,r)}else e=h.treeContext,rn=Ga(b.nextSibling),Xn=n,wt=!0,cl=null,Fa=!1,e!==null&&xp(n,e),n=Du(n,i),n.flags|=4096;return n}return e=qr(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Au(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(s(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function ff(e,n,r,i,d){return Wl(n),r=Fd(e,n,r,i,void 0,d),i=Pd(),e!==null&&!Cn?(Gd(e,n,d),Gr(e,n,d)):(wt&&i&&jd(n),n.flags|=1,Kn(e,n,r,d),n.child)}function _g(e,n,r,i,d,h){return Wl(n),n.updateQueue=null,r=Up(n,i,r,d),zp(e),i=Pd(),e!==null&&!Cn?(Gd(e,n,h),Gr(e,n,h)):(wt&&i&&jd(n),n.flags|=1,Kn(e,n,r,h),n.child)}function Lg(e,n,r,i,d){if(Wl(n),n.stateNode===null){var h=Ts,b=r.contextType;typeof b=="object"&&b!==null&&(h=Qn(b)),h=new r(i,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=uf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=i,h.state=n.memoizedState,h.refs={},Ud(n),b=r.contextType,h.context=typeof b=="object"&&b!==null?Qn(b):Ts,h.state=n.memoizedState,b=r.getDerivedStateFromProps,typeof b=="function"&&(of(n,r,b,i),h.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(b=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),b!==h.state&&uf.enqueueReplaceState(h,h.state,null),zi(n,i,h,d),Li(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,k=ls(r,E);h.props=k;var F=h.context,J=r.contextType;b=Ts,typeof J=="object"&&J!==null&&(b=Qn(J));var ie=r.getDerivedStateFromProps;J=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||F!==b)&&Sg(n,h,i,b),hl=!1;var G=n.memoizedState;h.state=G,zi(n,i,h,d),Li(),F=n.memoizedState,E||G!==F||hl?(typeof ie=="function"&&(of(n,r,ie,i),F=n.memoizedState),(k=hl||bg(n,r,k,i,G,F,b))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=i,n.memoizedState=F),h.props=i,h.state=F,h.context=b,i=k):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{h=n.stateNode,Bd(e,n),b=n.memoizedProps,J=ls(r,b),h.props=J,ie=n.pendingProps,G=h.context,F=r.contextType,k=Ts,typeof F=="object"&&F!==null&&(k=Qn(F)),E=r.getDerivedStateFromProps,(F=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(b!==ie||G!==k)&&Sg(n,h,i,k),hl=!1,G=n.memoizedState,h.state=G,zi(n,i,h,d),Li();var Q=n.memoizedState;b!==ie||G!==Q||hl||e!==null&&e.dependencies!==null&&du(e.dependencies)?(typeof E=="function"&&(of(n,r,E,i),Q=n.memoizedState),(J=hl||bg(n,r,J,i,G,Q,k)||e!==null&&e.dependencies!==null&&du(e.dependencies))?(F||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(i,Q,k),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(i,Q,k)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=i,n.memoizedState=Q),h.props=i,h.state=Q,h.context=k,i=J):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),i=!1)}return h=i,Au(e,n),i=(n.flags&128)!==0,h||i?(h=n.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&i?(n.child=as(n,e.child,null,d),n.child=as(n,null,r,d)):Kn(e,n,r,d),n.memoizedState=h.state,e=n.child):e=Gr(e,n,d),e}function zg(e,n,r,i){return Zl(),n.flags|=256,Kn(e,n,r,i),n.child}var hf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mf(e){return{baseLanes:e,cachePool:Rp()}}function pf(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=Ma),e}function Ug(e,n,r){var i=n.pendingProps,d=!1,h=(n.flags&128)!==0,b;if((b=h)||(b=e!==null&&e.memoizedState===null?!1:(vn.current&2)!==0),b&&(d=!0,n.flags&=-129),b=(n.flags&32)!==0,n.flags&=-33,e===null){if(wt){if(d?gl(n):vl(),(e=rn)?(e=Fv(e,Fa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ul!==null?{id:yr,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},r=gp(e),r.return=n,n.child=r,Xn=n,rn=null)):e=null,e===null)throw dl(n);return Zf(e)?n.lanes=32:n.lanes=536870912,null}var E=i.children;return i=i.fallback,d?(vl(),d=n.mode,E=ku({mode:"hidden",children:E},d),i=Kl(i,d,r,null),E.return=n,i.return=n,E.sibling=i,n.child=E,i=n.child,i.memoizedState=mf(r),i.childLanes=pf(e,b,r),n.memoizedState=hf,qi(null,i)):(gl(n),gf(n,E))}var k=e.memoizedState;if(k!==null&&(E=k.dehydrated,E!==null)){if(h)n.flags&256?(gl(n),n.flags&=-257,n=vf(e,n,r)):n.memoizedState!==null?(vl(),n.child=e.child,n.flags|=128,n=null):(vl(),E=i.fallback,d=n.mode,i=ku({mode:"visible",children:i.children},d),E=Kl(E,d,r,null),E.flags|=2,i.return=n,E.return=n,i.sibling=E,n.child=i,as(n,e.child,null,r),i=n.child,i.memoizedState=mf(r),i.childLanes=pf(e,b,r),n.memoizedState=hf,n=qi(null,i));else if(gl(n),Zf(E)){if(b=E.nextSibling&&E.nextSibling.dataset,b)var F=b.dgst;b=F,i=Error(s(419)),i.stack="",i.digest=b,Di({value:i,source:null,stack:null}),n=vf(e,n,r)}else if(Cn||ks(e,n,r,!1),b=(r&e.childLanes)!==0,Cn||b){if(b=en,b!==null&&(i=A(b,r),i!==0&&i!==k.retryLane))throw k.retryLane=i,Ql(e,i),Na(b,e,i),df;Kf(E)||$u(),n=vf(e,n,r)}else Kf(E)?(n.flags|=192,n.child=e.child,n=null):(e=k.treeContext,rn=Ga(E.nextSibling),Xn=n,wt=!0,cl=null,Fa=!1,e!==null&&xp(n,e),n=gf(n,i.children),n.flags|=4096);return n}return d?(vl(),E=i.fallback,d=n.mode,k=e.child,F=k.sibling,i=qr(k,{mode:"hidden",children:i.children}),i.subtreeFlags=k.subtreeFlags&65011712,F!==null?E=qr(F,E):(E=Kl(E,d,r,null),E.flags|=2),E.return=n,i.return=n,i.sibling=E,n.child=i,qi(null,i),i=n.child,E=e.child.memoizedState,E===null?E=mf(r):(d=E.cachePool,d!==null?(k=jn._currentValue,d=d.parent!==k?{parent:k,pool:k}:d):d=Rp(),E={baseLanes:E.baseLanes|r,cachePool:d}),i.memoizedState=E,i.childLanes=pf(e,b,r),n.memoizedState=hf,qi(e.child,i)):(gl(n),r=e.child,e=r.sibling,r=qr(r,{mode:"visible",children:i.children}),r.return=n,r.sibling=null,e!==null&&(b=n.deletions,b===null?(n.deletions=[e],n.flags|=16):b.push(e)),n.child=r,n.memoizedState=null,r)}function gf(e,n){return n=ku({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ku(e,n){return e=Da(22,e,null,n),e.lanes=0,e}function vf(e,n,r){return as(n,e.child,null,r),e=gf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Bg(e,n,r){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),kd(e.return,n,r)}function yf(e,n,r,i,d,h){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:d,treeForkCount:h}:(b.isBackwards=n,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=r,b.tailMode=d,b.treeForkCount=h)}function Hg(e,n,r){var i=n.pendingProps,d=i.revealOrder,h=i.tail;i=i.children;var b=vn.current,E=(b&2)!==0;if(E?(b=b&1|2,n.flags|=128):b&=1,ne(vn,b),Kn(e,n,i,r),i=wt?Ci:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Bg(e,r,n);else if(e.tag===19)Bg(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&xu(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),yf(n,!1,d,r,h,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&xu(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}yf(n,!0,r,null,h,i);break;case"together":yf(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function Gr(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),bl|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(ks(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,r=qr(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=qr(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function xf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&du(e)))}function N1(e,n,r){switch(n.tag){case 3:ut(n,n.stateNode.containerInfo),fl(n,jn,e.memoizedState.cache),Zl();break;case 27:case 5:nt(n);break;case 4:ut(n,n.stateNode.containerInfo);break;case 10:fl(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Vd(n),null;break;case 13:var i=n.memoizedState;if(i!==null)return i.dehydrated!==null?(gl(n),n.flags|=128,null):(r&n.child.childLanes)!==0?Ug(e,n,r):(gl(n),e=Gr(e,n,r),e!==null?e.sibling:null);gl(n);break;case 19:var d=(e.flags&128)!==0;if(i=(r&n.childLanes)!==0,i||(ks(e,n,r,!1),i=(r&n.childLanes)!==0),d){if(i)return Hg(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ne(vn,vn.current),i)break;return null;case 22:return n.lanes=0,kg(e,n,r,n.pendingProps);case 24:fl(n,jn,e.memoizedState.cache)}return Gr(e,n,r)}function $g(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)Cn=!0;else{if(!xf(e,r)&&(n.flags&128)===0)return Cn=!1,N1(e,n,r);Cn=(e.flags&131072)!==0}else Cn=!1,wt&&(n.flags&1048576)!==0&&yp(n,Ci,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=ts(n.elementType),n.type=e,typeof e=="function")Ed(e)?(i=ls(e,i),n.tag=1,n=Lg(null,n,e,i,r)):(n.tag=0,n=ff(null,n,e,i,r));else{if(e!=null){var d=e.$$typeof;if(d===X){n.tag=11,n=Cg(null,n,e,i,r);break e}else if(d===z){n.tag=14,n=Dg(null,n,e,i,r);break e}}throw n=re(e)||e,Error(s(306,n,""))}}return n;case 0:return ff(e,n,n.type,n.pendingProps,r);case 1:return i=n.type,d=ls(i,n.pendingProps),Lg(e,n,i,d,r);case 3:e:{if(ut(n,n.stateNode.containerInfo),e===null)throw Error(s(387));i=n.pendingProps;var h=n.memoizedState;d=h.element,Bd(e,n),zi(n,i,null,r);var b=n.memoizedState;if(i=b.cache,fl(n,jn,i),i!==h.cache&&Od(n,[jn],r,!0),Li(),i=b.element,h.isDehydrated)if(h={element:i,isDehydrated:!1,cache:b.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=zg(e,n,i,r);break e}else if(i!==d){d=Ia(Error(s(424)),n),Di(d),n=zg(e,n,i,r);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(rn=Ga(e.firstChild),Xn=n,wt=!0,cl=null,Fa=!0,r=kp(n,null,i,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(Zl(),i===d){n=Gr(e,n,r);break e}Kn(e,n,i,r)}n=n.child}return n;case 26:return Au(e,n),e===null?(r=Zv(n.type,null,n.pendingProps,null))?n.memoizedState=r:wt||(r=n.type,e=n.pendingProps,i=Gu(je.current).createElement(r),i[ve]=n,i[Ae]=e,Zn(i,r,e),dt(i),n.stateNode=i):n.memoizedState=Zv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return nt(n),e===null&&wt&&(i=n.stateNode=Xv(n.type,n.pendingProps,je.current),Xn=n,Fa=!0,d=rn,Rl(n.type)?(Jf=d,rn=Ga(i.firstChild)):rn=d),Kn(e,n,n.pendingProps.children,r),Au(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&wt&&((d=i=rn)&&(i=eS(i,n.type,n.pendingProps,Fa),i!==null?(n.stateNode=i,Xn=n,rn=Ga(i.firstChild),Fa=!1,d=!0):d=!1),d||dl(n)),nt(n),d=n.type,h=n.pendingProps,b=e!==null?e.memoizedProps:null,i=h.children,Gf(d,h)?i=null:b!==null&&Gf(d,b)&&(n.flags|=32),n.memoizedState!==null&&(d=Fd(e,n,p1,null,null,r),no._currentValue=d),Au(e,n),Kn(e,n,i,r),n.child;case 6:return e===null&&wt&&((e=r=rn)&&(r=tS(r,n.pendingProps,Fa),r!==null?(n.stateNode=r,Xn=n,rn=null,e=!0):e=!1),e||dl(n)),null;case 13:return Ug(e,n,r);case 4:return ut(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=as(n,null,i,r):Kn(e,n,i,r),n.child;case 11:return Cg(e,n,n.type,n.pendingProps,r);case 7:return Kn(e,n,n.pendingProps,r),n.child;case 8:return Kn(e,n,n.pendingProps.children,r),n.child;case 12:return Kn(e,n,n.pendingProps.children,r),n.child;case 10:return i=n.pendingProps,fl(n,n.type,i.value),Kn(e,n,i.children,r),n.child;case 9:return d=n.type._context,i=n.pendingProps.children,Wl(n),d=Qn(d),i=i(d),n.flags|=1,Kn(e,n,i,r),n.child;case 14:return Dg(e,n,n.type,n.pendingProps,r);case 15:return Ag(e,n,n.type,n.pendingProps,r);case 19:return Hg(e,n,r);case 31:return E1(e,n,r);case 22:return kg(e,n,r,n.pendingProps);case 24:return Wl(n),i=Qn(jn),e===null?(d=Ld(),d===null&&(d=en,h=Md(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),n.memoizedState={parent:i,cache:d},Ud(n),fl(n,jn,d)):((e.lanes&r)!==0&&(Bd(e,n),zi(n,null,null,r),Li()),d=e.memoizedState,h=n.memoizedState,d.parent!==i?(d={parent:i,cache:i},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),fl(n,jn,i)):(i=h.cache,fl(n,jn,i),i!==d.cache&&Od(n,[jn],r,!0))),Kn(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function Xr(e){e.flags|=4}function bf(e,n,r,i,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(hv())e.flags|=8192;else throw ns=pu,zd}else e.flags&=-16777217}function qg(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ny(n))if(hv())e.flags|=8192;else throw ns=pu,zd}function Ou(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Zt():536870912,e.lanes|=n,Vs|=n)}function Ii(e,n){if(!wt)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function ln(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,i|=d.subtreeFlags&65011712,i|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,i|=d.subtreeFlags,i|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=i,e.childLanes=r,n}function R1(e,n,r){var i=n.pendingProps;switch(Td(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ln(n),null;case 1:return ln(n),null;case 3:return r=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Yr(jn),Ge(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(As(n)?Xr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Dd())),ln(n),null;case 26:var d=n.type,h=n.memoizedState;return e===null?(Xr(n),h!==null?(ln(n),qg(n,h)):(ln(n),bf(n,d,null,i,r))):h?h!==e.memoizedState?(Xr(n),ln(n),qg(n,h)):(ln(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&Xr(n),ln(n),bf(n,d,e,i,r)),null;case 27:if(Sn(n),r=je.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Xr(n);else{if(!i){if(n.stateNode===null)throw Error(s(166));return ln(n),null}e=me.current,As(n)?bp(n):(e=Xv(d,i,r),n.stateNode=e,Xr(n))}return ln(n),null;case 5:if(Sn(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Xr(n);else{if(!i){if(n.stateNode===null)throw Error(s(166));return ln(n),null}if(h=me.current,As(n))bp(n);else{var b=Gu(je.current);switch(h){case 1:h=b.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=b.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=b.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?h.multiple=!0:i.size&&(h.size=i.size);break;default:h=typeof i.is=="string"?b.createElement(d,{is:i.is}):b.createElement(d)}}h[ve]=n,h[Ae]=i;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)h.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=h;e:switch(Zn(h,d,i),d){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Xr(n)}}return ln(n),bf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&Xr(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(s(166));if(e=je.current,As(n)){if(e=n.stateNode,r=n.memoizedProps,i=null,d=Xn,d!==null)switch(d.tag){case 27:case 5:i=d.memoizedProps}e[ve]=n,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||Uv(e.nodeValue,r)),e||dl(n,!0)}else e=Gu(e).createTextNode(i),e[ve]=n,n.stateNode=e}return ln(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(i=As(n),r!==null){if(e===null){if(!i)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[ve]=n}else Zl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ln(n),e=!1}else r=Dd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(ka(n),n):(ka(n),null);if((n.flags&128)!==0)throw Error(s(558))}return ln(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=As(n),i!==null&&i.dehydrated!==null){if(e===null){if(!d)throw Error(s(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[ve]=n}else Zl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ln(n),d=!1}else d=Dd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(ka(n),n):(ka(n),null)}return ka(n),(n.flags&128)!==0?(n.lanes=r,n):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=n.child,d=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(d=i.alternate.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==d&&(i.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),Ou(n,n.updateQueue),ln(n),null);case 4:return Ge(),e===null&&If(n.stateNode.containerInfo),ln(n),null;case 10:return Yr(n.type),ln(n),null;case 19:if(V(vn),i=n.memoizedState,i===null)return ln(n),null;if(d=(n.flags&128)!==0,h=i.rendering,h===null)if(d)Ii(i,!1);else{if(fn!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=xu(e),h!==null){for(n.flags|=128,Ii(i,!1),e=h.updateQueue,n.updateQueue=e,Ou(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)pp(r,e),r=r.sibling;return ne(vn,vn.current&1|2),wt&&Ir(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&tn()>Uu&&(n.flags|=128,d=!0,Ii(i,!1),n.lanes=4194304)}else{if(!d)if(e=xu(h),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Ou(n,e),Ii(i,!0),i.tail===null&&i.tailMode==="hidden"&&!h.alternate&&!wt)return ln(n),null}else 2*tn()-i.renderingStartTime>Uu&&r!==536870912&&(n.flags|=128,d=!0,Ii(i,!1),n.lanes=4194304);i.isBackwards?(h.sibling=n.child,n.child=h):(e=i.last,e!==null?e.sibling=h:n.child=h,i.last=h)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=tn(),e.sibling=null,r=vn.current,ne(vn,d?r&1|2:r&1),wt&&Ir(n,i.treeForkCount),e):(ln(n),null);case 22:case 23:return ka(n),Id(),i=n.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(n.flags|=8192):i&&(n.flags|=8192),i?(r&536870912)!==0&&(n.flags&128)===0&&(ln(n),n.subtreeFlags&6&&(n.flags|=8192)):ln(n),r=n.updateQueue,r!==null&&Ou(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048),e!==null&&V(es),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Yr(jn),ln(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function j1(e,n){switch(Td(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Yr(jn),Ge(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Sn(n),null;case 31:if(n.memoizedState!==null){if(ka(n),n.alternate===null)throw Error(s(340));Zl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(ka(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Zl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return V(vn),null;case 4:return Ge(),null;case 10:return Yr(n.type),null;case 22:case 23:return ka(n),Id(),e!==null&&V(es),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Yr(jn),null;case 25:return null;default:return null}}function Ig(e,n){switch(Td(n),n.tag){case 3:Yr(jn),Ge();break;case 26:case 27:case 5:Sn(n);break;case 4:Ge();break;case 31:n.memoizedState!==null&&ka(n);break;case 13:ka(n);break;case 19:V(vn);break;case 10:Yr(n.type);break;case 22:case 23:ka(n),Id(),e!==null&&V(es);break;case 24:Yr(jn)}}function Vi(e,n){try{var r=n.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var d=i.next;r=d;do{if((r.tag&e)===e){i=void 0;var h=r.create,b=r.inst;i=h(),b.destroy=i}r=r.next}while(r!==d)}}catch(E){It(n,n.return,E)}}function yl(e,n,r){try{var i=n.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var h=d.next;i=h;do{if((i.tag&e)===e){var b=i.inst,E=b.destroy;if(E!==void 0){b.destroy=void 0,d=n;var k=r,F=E;try{F()}catch(J){It(d,k,J)}}}i=i.next}while(i!==h)}}catch(J){It(n,n.return,J)}}function Vg(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{Mp(n,r)}catch(i){It(e,e.return,i)}}}function Yg(e,n,r){r.props=ls(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){It(e,n,i)}}function Yi(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(d){It(e,n,d)}}function br(e,n){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(d){It(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){It(e,n,d)}else r.current=null}function Fg(e){var n=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(d){It(e,e.return,d)}}function Sf(e,n,r){try{var i=e.stateNode;X1(i,e.type,r,n),i[Ae]=n}catch(d){It(e,e.return,d)}}function Pg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Rl(e.type)||e.tag===4}function wf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Pg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Rl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ef(e,n,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=na));else if(i!==4&&(i===27&&Rl(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Ef(e,n,r),e=e.sibling;e!==null;)Ef(e,n,r),e=e.sibling}function Mu(e,n,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(i!==4&&(i===27&&Rl(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Mu(e,n,r),e=e.sibling;e!==null;)Mu(e,n,r),e=e.sibling}function Gg(e){var n=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Zn(n,i,r),n[ve]=e,n[Ae]=r}catch(h){It(e,e.return,h)}}var Qr=!1,Dn=!1,Nf=!1,Xg=typeof WeakSet=="function"?WeakSet:Set,In=null;function T1(e,n){if(e=e.containerInfo,Ff=ec,e=sp(e),gd(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var d=i.anchorOffset,h=i.focusNode;i=i.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var b=0,E=-1,k=-1,F=0,J=0,ie=e,G=null;t:for(;;){for(var Q;ie!==r||d!==0&&ie.nodeType!==3||(E=b+d),ie!==h||i!==0&&ie.nodeType!==3||(k=b+i),ie.nodeType===3&&(b+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)G=ie,ie=Q;for(;;){if(ie===e)break t;if(G===r&&++F===d&&(E=b),G===h&&++J===i&&(k=b),(Q=ie.nextSibling)!==null)break;ie=G,G=ie.parentNode}ie=Q}r=E===-1||k===-1?null:{start:E,end:k}}else r=null}r=r||{start:0,end:0}}else r=null;for(Pf={focusedElem:e,selectionRange:r},ec=!1,In=n;In!==null;)if(n=In,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,In=e;else for(;In!==null;){switch(n=In,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,r=n,d=h.memoizedProps,h=h.memoizedState,i=r.stateNode;try{var Oe=ls(r.type,d);e=i.getSnapshotBeforeUpdate(Oe,h),i.__reactInternalSnapshotBeforeUpdate=e}catch(Ve){It(r,r.return,Ve)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)Qf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,In=e;break}In=n.return}}function Qg(e,n,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:Zr(e,r),i&4&&Vi(5,r);break;case 1:if(Zr(e,r),i&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(b){It(r,r.return,b)}else{var d=ls(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(b){It(r,r.return,b)}}i&64&&Vg(r),i&512&&Yi(r,r.return);break;case 3:if(Zr(e,r),i&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{Mp(e,n)}catch(b){It(r,r.return,b)}}break;case 27:n===null&&i&4&&Gg(r);case 26:case 5:Zr(e,r),n===null&&i&4&&Fg(r),i&512&&Yi(r,r.return);break;case 12:Zr(e,r);break;case 31:Zr(e,r),i&4&&Jg(e,r);break;case 13:Zr(e,r),i&4&&Wg(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=z1.bind(null,r),nS(e,r))));break;case 22:if(i=r.memoizedState!==null||Qr,!i){n=n!==null&&n.memoizedState!==null||Dn,d=Qr;var h=Dn;Qr=i,(Dn=n)&&!h?Jr(e,r,(r.subtreeFlags&8772)!==0):Zr(e,r),Qr=d,Dn=h}break;case 30:break;default:Zr(e,r)}}function Kg(e){var n=e.alternate;n!==null&&(e.alternate=null,Kg(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ie(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var on=null,ba=!1;function Kr(e,n,r){for(r=r.child;r!==null;)Zg(e,n,r),r=r.sibling}function Zg(e,n,r){if(Z&&typeof Z.onCommitFiberUnmount=="function")try{Z.onCommitFiberUnmount(qe,r)}catch{}switch(r.tag){case 26:Dn||br(r,n),Kr(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Dn||br(r,n);var i=on,d=ba;Rl(r.type)&&(on=r.stateNode,ba=!1),Kr(e,n,r),Wi(r.stateNode),on=i,ba=d;break;case 5:Dn||br(r,n);case 6:if(i=on,d=ba,on=null,Kr(e,n,r),on=i,ba=d,on!==null)if(ba)try{(on.nodeType===9?on.body:on.nodeName==="HTML"?on.ownerDocument.body:on).removeChild(r.stateNode)}catch(h){It(r,n,h)}else try{on.removeChild(r.stateNode)}catch(h){It(r,n,h)}break;case 18:on!==null&&(ba?(e=on,Vv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Zs(e)):Vv(on,r.stateNode));break;case 4:i=on,d=ba,on=r.stateNode.containerInfo,ba=!0,Kr(e,n,r),on=i,ba=d;break;case 0:case 11:case 14:case 15:yl(2,r,n),Dn||yl(4,r,n),Kr(e,n,r);break;case 1:Dn||(br(r,n),i=r.stateNode,typeof i.componentWillUnmount=="function"&&Yg(r,n,i)),Kr(e,n,r);break;case 21:Kr(e,n,r);break;case 22:Dn=(i=Dn)||r.memoizedState!==null,Kr(e,n,r),Dn=i;break;default:Kr(e,n,r)}}function Jg(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zs(e)}catch(r){It(n,n.return,r)}}}function Wg(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zs(e)}catch(r){It(n,n.return,r)}}function C1(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Xg),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Xg),n;default:throw Error(s(435,e.tag))}}function _u(e,n){var r=C1(e);n.forEach(function(i){if(!r.has(i)){r.add(i);var d=U1.bind(null,e,i);i.then(d,d)}})}function Sa(e,n){var r=n.deletions;if(r!==null)for(var i=0;i<r.length;i++){var d=r[i],h=e,b=n,E=b;e:for(;E!==null;){switch(E.tag){case 27:if(Rl(E.type)){on=E.stateNode,ba=!1;break e}break;case 5:on=E.stateNode,ba=!1;break e;case 3:case 4:on=E.stateNode.containerInfo,ba=!0;break e}E=E.return}if(on===null)throw Error(s(160));Zg(h,b,d),on=null,ba=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ev(n,e),n=n.sibling}var lr=null;function ev(e,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sa(n,e),wa(e),i&4&&(yl(3,e,e.return),Vi(3,e),yl(5,e,e.return));break;case 1:Sa(n,e),wa(e),i&512&&(Dn||r===null||br(r,r.return)),i&64&&Qr&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var d=lr;if(Sa(n,e),wa(e),i&512&&(Dn||r===null||br(r,r.return)),i&4){var h=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(i){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Ze]||h[ve]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(i),d.head.insertBefore(h,d.querySelector("head > title"))),Zn(h,i,r),h[ve]=e,dt(h),i=h;break e;case"link":var b=ey("link","href",d).get(i+(r.href||""));if(b){for(var E=0;E<b.length;E++)if(h=b[E],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){b.splice(E,1);break t}}h=d.createElement(i),Zn(h,i,r),d.head.appendChild(h);break;case"meta":if(b=ey("meta","content",d).get(i+(r.content||""))){for(E=0;E<b.length;E++)if(h=b[E],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){b.splice(E,1);break t}}h=d.createElement(i),Zn(h,i,r),d.head.appendChild(h);break;default:throw Error(s(468,i))}h[ve]=e,dt(h),i=h}e.stateNode=i}else ty(d,e.type,e.stateNode);else e.stateNode=Wv(d,i,e.memoizedProps);else h!==i?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,i===null?ty(d,e.type,e.stateNode):Wv(d,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Sf(e,e.memoizedProps,r.memoizedProps)}break;case 27:Sa(n,e),wa(e),i&512&&(Dn||r===null||br(r,r.return)),r!==null&&i&4&&Sf(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Sa(n,e),wa(e),i&512&&(Dn||r===null||br(r,r.return)),e.flags&32){d=e.stateNode;try{il(d,"")}catch(Oe){It(e,e.return,Oe)}}i&4&&e.stateNode!=null&&(d=e.memoizedProps,Sf(e,d,r!==null?r.memoizedProps:d)),i&1024&&(Nf=!0);break;case 6:if(Sa(n,e),wa(e),i&4){if(e.stateNode===null)throw Error(s(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(Oe){It(e,e.return,Oe)}}break;case 3:if(Ku=null,d=lr,lr=Xu(n.containerInfo),Sa(n,e),lr=d,wa(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Zs(n.containerInfo)}catch(Oe){It(e,e.return,Oe)}Nf&&(Nf=!1,tv(e));break;case 4:i=lr,lr=Xu(e.stateNode.containerInfo),Sa(n,e),wa(e),lr=i;break;case 12:Sa(n,e),wa(e);break;case 31:Sa(n,e),wa(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_u(e,i)));break;case 13:Sa(n,e),wa(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(zu=tn()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_u(e,i)));break;case 22:d=e.memoizedState!==null;var k=r!==null&&r.memoizedState!==null,F=Qr,J=Dn;if(Qr=F||d,Dn=J||k,Sa(n,e),Dn=J,Qr=F,wa(e),i&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||k||Qr||Dn||ss(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){k=r=n;try{if(h=k.stateNode,d)b=h.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{E=k.stateNode;var ie=k.memoizedProps.style,G=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;E.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(Oe){It(k,k.return,Oe)}}}else if(n.tag===6){if(r===null){k=n;try{k.stateNode.nodeValue=d?"":k.memoizedProps}catch(Oe){It(k,k.return,Oe)}}}else if(n.tag===18){if(r===null){k=n;try{var Q=k.stateNode;d?Yv(Q,!0):Yv(k.stateNode,!1)}catch(Oe){It(k,k.return,Oe)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,_u(e,r))));break;case 19:Sa(n,e),wa(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_u(e,i)));break;case 30:break;case 21:break;default:Sa(n,e),wa(e)}}function wa(e){var n=e.flags;if(n&2){try{for(var r,i=e.return;i!==null;){if(Pg(i)){r=i;break}i=i.return}if(r==null)throw Error(s(160));switch(r.tag){case 27:var d=r.stateNode,h=wf(e);Mu(e,h,d);break;case 5:var b=r.stateNode;r.flags&32&&(il(b,""),r.flags&=-33);var E=wf(e);Mu(e,E,b);break;case 3:case 4:var k=r.stateNode.containerInfo,F=wf(e);Ef(e,F,k);break;default:throw Error(s(161))}}catch(J){It(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function tv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;tv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Zr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Qg(e,n.alternate,n),n=n.sibling}function ss(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:yl(4,n,n.return),ss(n);break;case 1:br(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Yg(n,n.return,r),ss(n);break;case 27:Wi(n.stateNode);case 26:case 5:br(n,n.return),ss(n);break;case 22:n.memoizedState===null&&ss(n);break;case 30:ss(n);break;default:ss(n)}e=e.sibling}}function Jr(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var i=n.alternate,d=e,h=n,b=h.flags;switch(h.tag){case 0:case 11:case 15:Jr(d,h,r),Vi(4,h);break;case 1:if(Jr(d,h,r),i=h,d=i.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(F){It(i,i.return,F)}if(i=h,d=i.updateQueue,d!==null){var E=i.stateNode;try{var k=d.shared.hiddenCallbacks;if(k!==null)for(d.shared.hiddenCallbacks=null,d=0;d<k.length;d++)Op(k[d],E)}catch(F){It(i,i.return,F)}}r&&b&64&&Vg(h),Yi(h,h.return);break;case 27:Gg(h);case 26:case 5:Jr(d,h,r),r&&i===null&&b&4&&Fg(h),Yi(h,h.return);break;case 12:Jr(d,h,r);break;case 31:Jr(d,h,r),r&&b&4&&Jg(d,h);break;case 13:Jr(d,h,r),r&&b&4&&Wg(d,h);break;case 22:h.memoizedState===null&&Jr(d,h,r),Yi(h,h.return);break;case 30:break;default:Jr(d,h,r)}n=n.sibling}}function Rf(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&Ai(r))}function jf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ai(e))}function sr(e,n,r,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)nv(e,n,r,i),n=n.sibling}function nv(e,n,r,i){var d=n.flags;switch(n.tag){case 0:case 11:case 15:sr(e,n,r,i),d&2048&&Vi(9,n);break;case 1:sr(e,n,r,i);break;case 3:sr(e,n,r,i),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ai(e)));break;case 12:if(d&2048){sr(e,n,r,i),e=n.stateNode;try{var h=n.memoizedProps,b=h.id,E=h.onPostCommit;typeof E=="function"&&E(b,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(k){It(n,n.return,k)}}else sr(e,n,r,i);break;case 31:sr(e,n,r,i);break;case 13:sr(e,n,r,i);break;case 23:break;case 22:h=n.stateNode,b=n.alternate,n.memoizedState!==null?h._visibility&2?sr(e,n,r,i):Fi(e,n):h._visibility&2?sr(e,n,r,i):(h._visibility|=2,$s(e,n,r,i,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Rf(b,n);break;case 24:sr(e,n,r,i),d&2048&&jf(n.alternate,n);break;default:sr(e,n,r,i)}}function $s(e,n,r,i,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,b=n,E=r,k=i,F=b.flags;switch(b.tag){case 0:case 11:case 15:$s(h,b,E,k,d),Vi(8,b);break;case 23:break;case 22:var J=b.stateNode;b.memoizedState!==null?J._visibility&2?$s(h,b,E,k,d):Fi(h,b):(J._visibility|=2,$s(h,b,E,k,d)),d&&F&2048&&Rf(b.alternate,b);break;case 24:$s(h,b,E,k,d),d&&F&2048&&jf(b.alternate,b);break;default:$s(h,b,E,k,d)}n=n.sibling}}function Fi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,i=n,d=i.flags;switch(i.tag){case 22:Fi(r,i),d&2048&&Rf(i.alternate,i);break;case 24:Fi(r,i),d&2048&&jf(i.alternate,i);break;default:Fi(r,i)}n=n.sibling}}var Pi=8192;function qs(e,n,r){if(e.subtreeFlags&Pi)for(e=e.child;e!==null;)av(e,n,r),e=e.sibling}function av(e,n,r){switch(e.tag){case 26:qs(e,n,r),e.flags&Pi&&e.memoizedState!==null&&mS(r,lr,e.memoizedState,e.memoizedProps);break;case 5:qs(e,n,r);break;case 3:case 4:var i=lr;lr=Xu(e.stateNode.containerInfo),qs(e,n,r),lr=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Pi,Pi=16777216,qs(e,n,r),Pi=i):qs(e,n,r));break;default:qs(e,n,r)}}function rv(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Gi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];In=i,sv(i,e)}rv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lv(e),e=e.sibling}function lv(e){switch(e.tag){case 0:case 11:case 15:Gi(e),e.flags&2048&&yl(9,e,e.return);break;case 3:Gi(e);break;case 12:Gi(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Lu(e)):Gi(e);break;default:Gi(e)}}function Lu(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];In=i,sv(i,e)}rv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:yl(8,n,n.return),Lu(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,Lu(n));break;default:Lu(n)}e=e.sibling}}function sv(e,n){for(;In!==null;){var r=In;switch(r.tag){case 0:case 11:case 15:yl(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Ai(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,In=i;else e:for(r=e;In!==null;){i=In;var d=i.sibling,h=i.return;if(Kg(i),i===r){In=null;break e}if(d!==null){d.return=h,In=d;break e}In=h}}}var D1={getCacheForType:function(e){var n=Qn(jn),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return Qn(jn).controller.signal}},A1=typeof WeakMap=="function"?WeakMap:Map,Ot=0,en=null,mt=null,xt=0,qt=0,Oa=null,xl=!1,Is=!1,Tf=!1,Wr=0,fn=0,bl=0,is=0,Cf=0,Ma=0,Vs=0,Xi=null,Ea=null,Df=!1,zu=0,iv=0,Uu=1/0,Bu=null,Sl=null,Ln=0,wl=null,Ys=null,el=0,Af=0,kf=null,ov=null,Qi=0,Of=null;function _a(){return(Ot&2)!==0&&xt!==0?xt&-xt:U.T!==null?Bf():K()}function uv(){if(Ma===0)if((xt&536870912)===0||wt){var e=vt;vt<<=1,(vt&3932160)===0&&(vt=262144),Ma=e}else Ma=536870912;return e=Aa.current,e!==null&&(e.flags|=32),Ma}function Na(e,n,r){(e===en&&(qt===2||qt===9)||e.cancelPendingCommit!==null)&&(Fs(e,0),El(e,xt,Ma,!1)),ht(e,r),((Ot&2)===0||e!==en)&&(e===en&&((Ot&2)===0&&(is|=r),fn===4&&El(e,xt,Ma,!1)),Sr(e))}function cv(e,n,r){if((Ot&6)!==0)throw Error(s(327));var i=!r&&(n&127)===0&&(n&e.expiredLanes)===0||Ct(e,n),d=i?M1(e,n):_f(e,n,!0),h=i;do{if(d===0){Is&&!i&&El(e,n,0,!1);break}else{if(r=e.current.alternate,h&&!k1(r)){d=_f(e,n,!1),h=!1;continue}if(d===2){if(h=n,e.errorRecoveryDisabledLanes&h)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){n=b;e:{var E=e;d=Xi;var k=E.current.memoizedState.isDehydrated;if(k&&(Fs(E,b).flags|=256),b=_f(E,b,!1),b!==2){if(Tf&&!k){E.errorRecoveryDisabledLanes|=h,is|=h,d=4;break e}h=Ea,Ea=d,h!==null&&(Ea===null?Ea=h:Ea.push.apply(Ea,h))}d=b}if(h=!1,d!==2)continue}}if(d===1){Fs(e,0),El(e,n,0,!0);break}e:{switch(i=e,h=d,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:El(i,n,Ma,!xl);break e;case 2:Ea=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(d=zu+300-tn(),10<d)){if(El(i,n,Ma,!xl),Bt(i,0,!0)!==0)break e;el=n,i.timeoutHandle=qv(dv.bind(null,i,r,Ea,Bu,Df,n,Ma,is,Vs,xl,h,"Throttled",-0,0),d);break e}dv(i,r,Ea,Bu,Df,n,Ma,is,Vs,xl,h,null,-0,0)}}break}while(!0);Sr(e)}function dv(e,n,r,i,d,h,b,E,k,F,J,ie,G,Q){if(e.timeoutHandle=-1,ie=n.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:na},av(n,h,ie);var Oe=(h&62914560)===h?zu-tn():(h&4194048)===h?iv-tn():0;if(Oe=pS(ie,Oe),Oe!==null){el=h,e.cancelPendingCommit=Oe(xv.bind(null,e,n,h,r,i,d,b,E,k,J,ie,null,G,Q)),El(e,h,b,!F);return}}xv(e,n,h,r,i,d,b,E,k)}function k1(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var d=r[i],h=d.getSnapshot;d=d.value;try{if(!Ca(h(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function El(e,n,r,i){n&=~Cf,n&=~is,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var d=n;0<d;){var h=31-Kt(d),b=1<<h;i[h]=-1,d&=~b}r!==0&&wn(e,r,n)}function Hu(){return(Ot&6)===0?(Ki(0),!1):!0}function Mf(){if(mt!==null){if(qt===0)var e=mt.return;else e=mt,Vr=Jl=null,Xd(e),Ls=null,Oi=0,e=mt;for(;e!==null;)Ig(e.alternate,e),e=e.return;mt=null}}function Fs(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Z1(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),el=0,Mf(),en=e,mt=r=qr(e.current,null),xt=n,qt=0,Oa=null,xl=!1,Is=Ct(e,n),Tf=!1,Vs=Ma=Cf=is=bl=fn=0,Ea=Xi=null,Df=!1,(n&8)!==0&&(n|=n&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=n;0<i;){var d=31-Kt(i),h=1<<d;n|=e[d],i&=~h}return Wr=n,su(),r}function fv(e,n){st=null,U.H=$i,n===_s||n===mu?(n=Cp(),qt=3):n===zd?(n=Cp(),qt=4):qt=n===df?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Oa=n,mt===null&&(fn=1,Cu(e,Ia(n,e.current)))}function hv(){var e=Aa.current;return e===null?!0:(xt&4194048)===xt?Pa===null:(xt&62914560)===xt||(xt&536870912)!==0?e===Pa:!1}function mv(){var e=U.H;return U.H=$i,e===null?$i:e}function pv(){var e=U.A;return U.A=D1,e}function $u(){fn=4,xl||(xt&4194048)!==xt&&Aa.current!==null||(Is=!0),(bl&134217727)===0&&(is&134217727)===0||en===null||El(en,xt,Ma,!1)}function _f(e,n,r){var i=Ot;Ot|=2;var d=mv(),h=pv();(en!==e||xt!==n)&&(Bu=null,Fs(e,n)),n=!1;var b=fn;e:do try{if(qt!==0&&mt!==null){var E=mt,k=Oa;switch(qt){case 8:Mf(),b=6;break e;case 3:case 2:case 9:case 6:Aa.current===null&&(n=!0);var F=qt;if(qt=0,Oa=null,Ps(e,E,k,F),r&&Is){b=0;break e}break;default:F=qt,qt=0,Oa=null,Ps(e,E,k,F)}}O1(),b=fn;break}catch(J){fv(e,J)}while(!0);return n&&e.shellSuspendCounter++,Vr=Jl=null,Ot=i,U.H=d,U.A=h,mt===null&&(en=null,xt=0,su()),b}function O1(){for(;mt!==null;)gv(mt)}function M1(e,n){var r=Ot;Ot|=2;var i=mv(),d=pv();en!==e||xt!==n?(Bu=null,Uu=tn()+500,Fs(e,n)):Is=Ct(e,n);e:do try{if(qt!==0&&mt!==null){n=mt;var h=Oa;t:switch(qt){case 1:qt=0,Oa=null,Ps(e,n,h,1);break;case 2:case 9:if(jp(h)){qt=0,Oa=null,vv(n);break}n=function(){qt!==2&&qt!==9||en!==e||(qt=7),Sr(e)},h.then(n,n);break e;case 3:qt=7;break e;case 4:qt=5;break e;case 7:jp(h)?(qt=0,Oa=null,vv(n)):(qt=0,Oa=null,Ps(e,n,h,7));break;case 5:var b=null;switch(mt.tag){case 26:b=mt.memoizedState;case 5:case 27:var E=mt;if(b?ny(b):E.stateNode.complete){qt=0,Oa=null;var k=E.sibling;if(k!==null)mt=k;else{var F=E.return;F!==null?(mt=F,qu(F)):mt=null}break t}}qt=0,Oa=null,Ps(e,n,h,5);break;case 6:qt=0,Oa=null,Ps(e,n,h,6);break;case 8:Mf(),fn=6;break e;default:throw Error(s(462))}}_1();break}catch(J){fv(e,J)}while(!0);return Vr=Jl=null,U.H=i,U.A=d,Ot=r,mt!==null?0:(en=null,xt=0,su(),fn)}function _1(){for(;mt!==null&&!Hn();)gv(mt)}function gv(e){var n=$g(e.alternate,e,Wr);e.memoizedProps=e.pendingProps,n===null?qu(e):mt=n}function vv(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=_g(r,n,n.pendingProps,n.type,void 0,xt);break;case 11:n=_g(r,n,n.pendingProps,n.type.render,n.ref,xt);break;case 5:Xd(n);default:Ig(r,n),n=mt=pp(n,Wr),n=$g(r,n,Wr)}e.memoizedProps=e.pendingProps,n===null?qu(e):mt=n}function Ps(e,n,r,i){Vr=Jl=null,Xd(n),Ls=null,Oi=0;var d=n.return;try{if(w1(e,d,n,r,xt)){fn=1,Cu(e,Ia(r,e.current)),mt=null;return}}catch(h){if(d!==null)throw mt=d,h;fn=1,Cu(e,Ia(r,e.current)),mt=null;return}n.flags&32768?(wt||i===1?e=!0:Is||(xt&536870912)!==0?e=!1:(xl=e=!0,(i===2||i===9||i===3||i===6)&&(i=Aa.current,i!==null&&i.tag===13&&(i.flags|=16384))),yv(n,e)):qu(n)}function qu(e){var n=e;do{if((n.flags&32768)!==0){yv(n,xl);return}e=n.return;var r=R1(n.alternate,n,Wr);if(r!==null){mt=r;return}if(n=n.sibling,n!==null){mt=n;return}mt=n=e}while(n!==null);fn===0&&(fn=5)}function yv(e,n){do{var r=j1(e.alternate,e);if(r!==null){r.flags&=32767,mt=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){mt=e;return}mt=e=r}while(e!==null);fn=6,mt=null}function xv(e,n,r,i,d,h,b,E,k){e.cancelPendingCommit=null;do Iu();while(Ln!==0);if((Ot&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=Sd,Je(e,r,h,b,E,k),e===en&&(mt=en=null,xt=0),Ys=n,wl=e,el=r,Af=h,kf=d,ov=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,B1(qn,function(){return Nv(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=U.T,U.T=null,d=B.p,B.p=2,b=Ot,Ot|=4;try{T1(e,n,r)}finally{Ot=b,B.p=d,U.T=i}}Ln=1,bv(),Sv(),wv()}}function bv(){if(Ln===1){Ln=0;var e=wl,n=Ys,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=U.T,U.T=null;var i=B.p;B.p=2;var d=Ot;Ot|=4;try{ev(n,e);var h=Pf,b=sp(e.containerInfo),E=h.focusedElem,k=h.selectionRange;if(b!==E&&E&&E.ownerDocument&&lp(E.ownerDocument.documentElement,E)){if(k!==null&&gd(E)){var F=k.start,J=k.end;if(J===void 0&&(J=F),"selectionStart"in E)E.selectionStart=F,E.selectionEnd=Math.min(J,E.value.length);else{var ie=E.ownerDocument||document,G=ie&&ie.defaultView||window;if(G.getSelection){var Q=G.getSelection(),Oe=E.textContent.length,Ve=Math.min(k.start,Oe),Ft=k.end===void 0?Ve:Math.min(k.end,Oe);!Q.extend&&Ve>Ft&&(b=Ft,Ft=Ve,Ve=b);var H=rp(E,Ve),_=rp(E,Ft);if(H&&_&&(Q.rangeCount!==1||Q.anchorNode!==H.node||Q.anchorOffset!==H.offset||Q.focusNode!==_.node||Q.focusOffset!==_.offset)){var Y=ie.createRange();Y.setStart(H.node,H.offset),Q.removeAllRanges(),Ve>Ft?(Q.addRange(Y),Q.extend(_.node,_.offset)):(Y.setEnd(_.node,_.offset),Q.addRange(Y))}}}}for(ie=[],Q=E;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ie.length;E++){var le=ie[E];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}ec=!!Ff,Pf=Ff=null}finally{Ot=d,B.p=i,U.T=r}}e.current=n,Ln=2}}function Sv(){if(Ln===2){Ln=0;var e=wl,n=Ys,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=U.T,U.T=null;var i=B.p;B.p=2;var d=Ot;Ot|=4;try{Qg(e,n.alternate,n)}finally{Ot=d,B.p=i,U.T=r}}Ln=3}}function wv(){if(Ln===4||Ln===3){Ln=0,$n();var e=wl,n=Ys,r=el,i=ov;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ln=5:(Ln=0,Ys=wl=null,Ev(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Sl=null),$(r),n=n.stateNode,Z&&typeof Z.onCommitFiberRoot=="function")try{Z.onCommitFiberRoot(qe,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=U.T,d=B.p,B.p=2,U.T=null;try{for(var h=e.onRecoverableError,b=0;b<i.length;b++){var E=i[b];h(E.value,{componentStack:E.stack})}}finally{U.T=n,B.p=d}}(el&3)!==0&&Iu(),Sr(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===Of?Qi++:(Qi=0,Of=e):Qi=0,Ki(0)}}function Ev(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Ai(n)))}function Iu(){return bv(),Sv(),wv(),Nv()}function Nv(){if(Ln!==5)return!1;var e=wl,n=Af;Af=0;var r=$(el),i=U.T,d=B.p;try{B.p=32>r?32:r,U.T=null,r=kf,kf=null;var h=wl,b=el;if(Ln=0,Ys=wl=null,el=0,(Ot&6)!==0)throw Error(s(331));var E=Ot;if(Ot|=4,lv(h.current),nv(h,h.current,b,r),Ot=E,Ki(0,!1),Z&&typeof Z.onPostCommitFiberRoot=="function")try{Z.onPostCommitFiberRoot(qe,h)}catch{}return!0}finally{B.p=d,U.T=i,Ev(e,n)}}function Rv(e,n,r){n=Ia(r,n),n=cf(e.stateNode,n,2),e=pl(e,n,2),e!==null&&(ht(e,2),Sr(e))}function It(e,n,r){if(e.tag===3)Rv(e,e,r);else for(;n!==null;){if(n.tag===3){Rv(n,e,r);break}else if(n.tag===1){var i=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Sl===null||!Sl.has(i))){e=Ia(r,e),r=jg(2),i=pl(n,r,2),i!==null&&(Tg(r,i,n,e),ht(i,2),Sr(i));break}}n=n.return}}function Lf(e,n,r){var i=e.pingCache;if(i===null){i=e.pingCache=new A1;var d=new Set;i.set(n,d)}else d=i.get(n),d===void 0&&(d=new Set,i.set(n,d));d.has(r)||(Tf=!0,d.add(r),e=L1.bind(null,e,n,r),n.then(e,e))}function L1(e,n,r){var i=e.pingCache;i!==null&&i.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,en===e&&(xt&r)===r&&(fn===4||fn===3&&(xt&62914560)===xt&&300>tn()-zu?(Ot&2)===0&&Fs(e,0):Cf|=r,Vs===xt&&(Vs=0)),Sr(e)}function jv(e,n){n===0&&(n=Zt()),e=Ql(e,n),e!==null&&(ht(e,n),Sr(e))}function z1(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),jv(e,r)}function U1(e,n){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(n),jv(e,r)}function B1(e,n){return _t(e,n)}var Vu=null,Gs=null,zf=!1,Yu=!1,Uf=!1,Nl=0;function Sr(e){e!==Gs&&e.next===null&&(Gs===null?Vu=Gs=e:Gs=Gs.next=e),Yu=!0,zf||(zf=!0,$1())}function Ki(e,n){if(!Uf&&Yu){Uf=!0;do for(var r=!1,i=Vu;i!==null;){if(e!==0){var d=i.pendingLanes;if(d===0)var h=0;else{var b=i.suspendedLanes,E=i.pingedLanes;h=(1<<31-Kt(42|e)+1)-1,h&=d&~(b&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Av(i,h))}else h=xt,h=Bt(i,i===en?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(h&3)===0||Ct(i,h)||(r=!0,Av(i,h));i=i.next}while(r);Uf=!1}}function H1(){Tv()}function Tv(){Yu=zf=!1;var e=0;Nl!==0&&K1()&&(e=Nl);for(var n=tn(),r=null,i=Vu;i!==null;){var d=i.next,h=Cv(i,n);h===0?(i.next=null,r===null?Vu=d:r.next=d,d===null&&(Gs=r)):(r=i,(e!==0||(h&3)!==0)&&(Yu=!0)),i=d}Ln!==0&&Ln!==5||Ki(e),Nl!==0&&(Nl=0)}function Cv(e,n){for(var r=e.suspendedLanes,i=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var b=31-Kt(h),E=1<<b,k=d[b];k===-1?((E&r)===0||(E&i)!==0)&&(d[b]=nn(E,n)):k<=n&&(e.expiredLanes|=E),h&=~E}if(n=en,r=xt,r=Bt(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===n&&(qt===2||qt===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Qt(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Ct(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(i!==null&&Qt(i),$(r)){case 2:case 8:r=Wn;break;case 32:r=qn;break;case 268435456:r=Ce;break;default:r=qn}return i=Dv.bind(null,e),r=_t(r,i),e.callbackPriority=n,e.callbackNode=r,n}return i!==null&&i!==null&&Qt(i),e.callbackPriority=2,e.callbackNode=null,2}function Dv(e,n){if(Ln!==0&&Ln!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Iu()&&e.callbackNode!==r)return null;var i=xt;return i=Bt(e,e===en?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(cv(e,i,n),Cv(e,tn()),e.callbackNode!=null&&e.callbackNode===r?Dv.bind(null,e):null)}function Av(e,n){if(Iu())return null;cv(e,n,!0)}function $1(){J1(function(){(Ot&6)!==0?_t(fa,H1):Tv()})}function Bf(){if(Nl===0){var e=Os;e===0&&(e=Me,Me<<=1,(Me&261888)===0&&(Me=256)),Nl=e}return Nl}function kv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:an(""+e)}function Ov(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function q1(e,n,r,i,d){if(n==="submit"&&r&&r.stateNode===d){var h=kv((d[Ae]||null).action),b=i.submitter;b&&(n=(n=b[Ae]||null)?kv(n.formAction):b.getAttribute("formAction"),n!==null&&(h=n,b=null));var E=new Hr("action","action",null,i,d);e.push({event:E,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Nl!==0){var k=b?Ov(d,b):new FormData(d);af(r,{pending:!0,data:k,method:d.method,action:h},null,k)}}else typeof h=="function"&&(E.preventDefault(),k=b?Ov(d,b):new FormData(d),af(r,{pending:!0,data:k,method:d.method,action:h},h,k))},currentTarget:d}]})}}for(var Hf=0;Hf<bd.length;Hf++){var $f=bd[Hf],I1=$f.toLowerCase(),V1=$f[0].toUpperCase()+$f.slice(1);rr(I1,"on"+V1)}rr(up,"onAnimationEnd"),rr(cp,"onAnimationIteration"),rr(dp,"onAnimationStart"),rr("dblclick","onDoubleClick"),rr("focusin","onFocus"),rr("focusout","onBlur"),rr(l1,"onTransitionRun"),rr(s1,"onTransitionStart"),rr(i1,"onTransitionCancel"),rr(fp,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),En("onBeforeInput",["compositionend","keypress","textInput","paste"]),En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zi="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(" "),Y1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zi));function Mv(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],d=i.event;i=i.listeners;e:{var h=void 0;if(n)for(var b=i.length-1;0<=b;b--){var E=i[b],k=E.instance,F=E.currentTarget;if(E=E.listener,k!==h&&d.isPropagationStopped())break e;h=E,d.currentTarget=F;try{h(d)}catch(J){lu(J)}d.currentTarget=null,h=k}else for(b=0;b<i.length;b++){if(E=i[b],k=E.instance,F=E.currentTarget,E=E.listener,k!==h&&d.isPropagationStopped())break e;h=E,d.currentTarget=F;try{h(d)}catch(J){lu(J)}d.currentTarget=null,h=k}}}}function pt(e,n){var r=n[_e];r===void 0&&(r=n[_e]=new Set);var i=e+"__bubble";r.has(i)||(_v(n,e,2,!1),r.add(i))}function qf(e,n,r){var i=0;n&&(i|=4),_v(r,e,i,n)}var Fu="_reactListening"+Math.random().toString(36).slice(2);function If(e){if(!e[Fu]){e[Fu]=!0,Jt.forEach(function(r){r!=="selectionchange"&&(Y1.has(r)||qf(r,!1,e),qf(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Fu]||(n[Fu]=!0,qf("selectionchange",!1,n))}}function _v(e,n,r,i){switch(uy(n)){case 2:var d=yS;break;case 8:d=xS;break;default:d=ah}r=d.bind(null,n,r,e),d=void 0,!Si||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),i?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function Vf(e,n,r,i,d){var h=i;if((n&1)===0&&(n&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var E=i.stateNode.containerInfo;if(E===d)break;if(b===4)for(b=i.return;b!==null;){var k=b.tag;if((k===3||k===4)&&b.stateNode.containerInfo===d)return;b=b.return}for(;E!==null;){if(b=$t(E),b===null)return;if(k=b.tag,k===5||k===6||k===26||k===27){i=h=b;continue e}E=E.parentNode}}i=i.return}bi(function(){var F=h,J=_r(r),ie=[];e:{var G=hp.get(e);if(G!==void 0){var Q=Hr,Oe=e;switch(e){case"keypress":if(ws(r)===0)break e;case"keydown":case"keyup":Q=Rn;break;case"focusin":Oe="focus",Q=xe;break;case"focusout":Oe="blur",Q=xe;break;case"beforeblur":case"afterblur":Q=xe;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=tu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=P;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=vr;break;case up:case cp:case dp:Q=ce;break;case fp:Q=nu;break;case"scroll":case"scrollend":Q=ud;break;case"wheel":Q=dd;break;case"copy":case"cut":case"paste":Q=Se;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=zt;break;case"toggle":case"beforetoggle":Q=P0}var Ve=(n&4)!==0,Ft=!Ve&&(e==="scroll"||e==="scrollend"),H=Ve?G!==null?G+"Capture":null:G;Ve=[];for(var _=F,Y;_!==null;){var le=_;if(Y=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Y===null||H===null||(le=Ha(_,H),le!=null&&Ve.push(Ji(_,le,Y))),Ft)break;_=_.return}0<Ve.length&&(G=new Q(G,Oe,null,r,J),ie.push({event:G,listeners:Ve}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",G&&r!==Ta&&(Oe=r.relatedTarget||r.fromElement)&&($t(Oe)||Oe[Re]))break e;if((Q||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,Q?(Oe=r.relatedTarget||r.toElement,Q=F,Oe=Oe?$t(Oe):null,Oe!==null&&(Ft=u(Oe),Ve=Oe.tag,Oe!==Ft||Ve!==5&&Ve!==27&&Ve!==6)&&(Oe=null)):(Q=null,Oe=F),Q!==Oe)){if(Ve=tu,le="onMouseLeave",H="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(Ve=zt,le="onPointerLeave",H="onPointerEnter",_="pointer"),Ft=Q==null?G:ct(Q),Y=Oe==null?G:ct(Oe),G=new Ve(le,_+"leave",Q,r,J),G.target=Ft,G.relatedTarget=Y,le=null,$t(J)===F&&(Ve=new Ve(H,_+"enter",Oe,r,J),Ve.target=Y,Ve.relatedTarget=Ft,le=Ve),Ft=le,Q&&Oe)t:{for(Ve=F1,H=Q,_=Oe,Y=0,le=H;le;le=Ve(le))Y++;le=0;for(var He=_;He;He=Ve(He))le++;for(;0<Y-le;)H=Ve(H),Y--;for(;0<le-Y;)_=Ve(_),le--;for(;Y--;){if(H===_||_!==null&&H===_.alternate){Ve=H;break t}H=Ve(H),_=Ve(_)}Ve=null}else Ve=null;Q!==null&&Lv(ie,G,Q,Ve,!1),Oe!==null&&Ft!==null&&Lv(ie,Ft,Oe,Ve,!0)}}e:{if(G=F?ct(F):window,Q=G.nodeName&&G.nodeName.toLowerCase(),Q==="select"||Q==="input"&&G.type==="file")var At=Jm;else if(Km(G))if(Wm)At=n1;else{At=e1;var Le=W0}else Q=G.nodeName,!Q||Q.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?F&&Il(F.elementType)&&(At=Jm):At=t1;if(At&&(At=At(e,F))){Zm(ie,At,r,J);break e}Le&&Le(e,G,F),e==="focusout"&&F&&G.type==="number"&&F.memoizedProps.value!=null&&Dt(G,"number",G.value)}switch(Le=F?ct(F):window,e){case"focusin":(Km(Le)||Le.contentEditable==="true")&&(Ns=Le,vd=F,Ti=null);break;case"focusout":Ti=vd=Ns=null;break;case"mousedown":yd=!0;break;case"contextmenu":case"mouseup":case"dragend":yd=!1,ip(ie,r,J);break;case"selectionchange":if(r1)break;case"keydown":case"keyup":ip(ie,r,J)}var ot;if(hd)e:{switch(e){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Es?Xm(e,r)&&(bt="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(bt="onCompositionStart");bt&&(Fm&&r.locale!=="ko"&&(Es||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Es&&(ot=Wo()):($a=J,wi="value"in $a?$a.value:$a.textContent,Es=!0)),Le=Pu(F,bt),0<Le.length&&(bt=new rt(bt,e,null,r,J),ie.push({event:bt,listeners:Le}),ot?bt.data=ot:(ot=Qm(r),ot!==null&&(bt.data=ot)))),(ot=X0?Q0(e,r):K0(e,r))&&(bt=Pu(F,"onBeforeInput"),0<bt.length&&(Le=new rt("onBeforeInput","beforeinput",null,r,J),ie.push({event:Le,listeners:bt}),Le.data=ot)),q1(ie,e,F,r,J)}Mv(ie,n)})}function Ji(e,n,r){return{instance:e,listener:n,currentTarget:r}}function Pu(e,n){for(var r=n+"Capture",i=[];e!==null;){var d=e,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Ha(e,r),d!=null&&i.unshift(Ji(e,d,h)),d=Ha(e,n),d!=null&&i.push(Ji(e,d,h))),e.tag===3)return i;e=e.return}return[]}function F1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Lv(e,n,r,i,d){for(var h=n._reactName,b=[];r!==null&&r!==i;){var E=r,k=E.alternate,F=E.stateNode;if(E=E.tag,k!==null&&k===i)break;E!==5&&E!==26&&E!==27||F===null||(k=F,d?(F=Ha(r,h),F!=null&&b.unshift(Ji(r,F,k))):d||(F=Ha(r,h),F!=null&&b.push(Ji(r,F,k)))),r=r.return}b.length!==0&&e.push({event:n,listeners:b})}var P1=/\r\n?/g,G1=/\u0000|\uFFFD/g;function zv(e){return(typeof e=="string"?e:""+e).replace(P1,`
49
+ `).replace(G1,"")}function Uv(e,n){return n=zv(n),zv(e)===n}function Yt(e,n,r,i,d,h){switch(r){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||il(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&il(e,""+i);break;case"className":hr(e,"class",i);break;case"tabIndex":hr(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":hr(e,r,i);break;case"style":va(e,i,h);break;case"data":if(n!=="object"){hr(e,"data",i);break}case"src":case"href":if(i===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=an(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(n!=="input"&&Yt(e,n,"name",d.name,d,null),Yt(e,n,"formEncType",d.formEncType,d,null),Yt(e,n,"formMethod",d.formMethod,d,null),Yt(e,n,"formTarget",d.formTarget,d,null)):(Yt(e,n,"encType",d.encType,d,null),Yt(e,n,"method",d.method,d,null),Yt(e,n,"target",d.target,d,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=an(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=na);break;case"onScroll":i!=null&&pt("scroll",e);break;case"onScrollEnd":i!=null&&pt("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=an(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":pt("beforetoggle",e),pt("toggle",e),ea(e,"popover",i);break;case"xlinkActuate":Qe(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Qe(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Qe(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Qe(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Qe(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Qe(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Qe(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Qe(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Qe(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ea(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=bs.get(r)||r,ea(e,r,i))}}function Yf(e,n,r,i,d,h){switch(r){case"style":va(e,i,h);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"children":typeof i=="string"?il(e,i):(typeof i=="number"||typeof i=="bigint")&&il(e,""+i);break;case"onScroll":i!=null&&pt("scroll",e);break;case"onScrollEnd":i!=null&&pt("scrollend",e);break;case"onClick":i!=null&&(e.onclick=na);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fn.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),h=e[Ae]||null,h=h!=null?h[r]:null,typeof h=="function"&&e.removeEventListener(n,h,d),typeof i=="function")){typeof h!="function"&&h!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,i,d);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):ea(e,r,i)}}}function Zn(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pt("error",e),pt("load",e);var i=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var b=r[h];if(b!=null)switch(h){case"src":i=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Yt(e,n,h,b,r,null)}}d&&Yt(e,n,"srcSet",r.srcSet,r,null),i&&Yt(e,n,"src",r.src,r,null);return;case"input":pt("invalid",e);var E=h=b=d=null,k=null,F=null;for(i in r)if(r.hasOwnProperty(i)){var J=r[i];if(J!=null)switch(i){case"name":d=J;break;case"type":b=J;break;case"checked":k=J;break;case"defaultChecked":F=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,n));break;default:Yt(e,n,i,J,r,null)}}yi(e,h,E,k,F,b,d,!1);return;case"select":pt("invalid",e),i=b=h=null;for(d in r)if(r.hasOwnProperty(d)&&(E=r[d],E!=null))switch(d){case"value":h=E;break;case"defaultValue":b=E;break;case"multiple":i=E;default:Yt(e,n,d,E,r,null)}n=h,r=b,e.multiple=!!i,n!=null?mr(e,!!i,n,!1):r!=null&&mr(e,!!i,r,!0);return;case"textarea":pt("invalid",e),h=d=i=null;for(b in r)if(r.hasOwnProperty(b)&&(E=r[b],E!=null))switch(b){case"value":i=E;break;case"defaultValue":d=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Yt(e,n,b,E,r,null)}nr(e,i,d,h);return;case"option":for(k in r)if(r.hasOwnProperty(k)&&(i=r[k],i!=null))switch(k){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Yt(e,n,k,i,r,null)}return;case"dialog":pt("beforetoggle",e),pt("toggle",e),pt("cancel",e),pt("close",e);break;case"iframe":case"object":pt("load",e);break;case"video":case"audio":for(i=0;i<Zi.length;i++)pt(Zi[i],e);break;case"image":pt("error",e),pt("load",e);break;case"details":pt("toggle",e);break;case"embed":case"source":case"link":pt("error",e),pt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in r)if(r.hasOwnProperty(F)&&(i=r[F],i!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Yt(e,n,F,i,r,null)}return;default:if(Il(n)){for(J in r)r.hasOwnProperty(J)&&(i=r[J],i!==void 0&&Yf(e,n,J,i,r,void 0));return}}for(E in r)r.hasOwnProperty(E)&&(i=r[E],i!=null&&Yt(e,n,E,i,r,null))}function X1(e,n,r,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,b=null,E=null,k=null,F=null,J=null;for(Q in r){var ie=r[Q];if(r.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":k=ie;default:i.hasOwnProperty(Q)||Yt(e,n,Q,null,i,ie)}}for(var G in i){var Q=i[G];if(ie=r[G],i.hasOwnProperty(G)&&(Q!=null||ie!=null))switch(G){case"type":h=Q;break;case"name":d=Q;break;case"checked":F=Q;break;case"defaultChecked":J=Q;break;case"value":b=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,n));break;default:Q!==ie&&Yt(e,n,G,Q,i,ie)}}ql(e,b,E,k,F,J,h,d);return;case"select":Q=b=E=G=null;for(h in r)if(k=r[h],r.hasOwnProperty(h)&&k!=null)switch(h){case"value":break;case"multiple":Q=k;default:i.hasOwnProperty(h)||Yt(e,n,h,null,i,k)}for(d in i)if(h=i[d],k=r[d],i.hasOwnProperty(d)&&(h!=null||k!=null))switch(d){case"value":G=h;break;case"defaultValue":E=h;break;case"multiple":b=h;default:h!==k&&Yt(e,n,d,h,i,k)}n=E,r=b,i=Q,G!=null?mr(e,!!r,G,!1):!!i!=!!r&&(n!=null?mr(e,!!r,n,!0):mr(e,!!r,r?[]:"",!1));return;case"textarea":Q=G=null;for(E in r)if(d=r[E],r.hasOwnProperty(E)&&d!=null&&!i.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Yt(e,n,E,null,i,d)}for(b in i)if(d=i[b],h=r[b],i.hasOwnProperty(b)&&(d!=null||h!=null))switch(b){case"value":G=d;break;case"defaultValue":Q=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==h&&Yt(e,n,b,d,i,h)}Jo(e,G,Q);return;case"option":for(var Oe in r)if(G=r[Oe],r.hasOwnProperty(Oe)&&G!=null&&!i.hasOwnProperty(Oe))switch(Oe){case"selected":e.selected=!1;break;default:Yt(e,n,Oe,null,i,G)}for(k in i)if(G=i[k],Q=r[k],i.hasOwnProperty(k)&&G!==Q&&(G!=null||Q!=null))switch(k){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:Yt(e,n,k,G,i,Q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ve in r)G=r[Ve],r.hasOwnProperty(Ve)&&G!=null&&!i.hasOwnProperty(Ve)&&Yt(e,n,Ve,null,i,G);for(F in i)if(G=i[F],Q=r[F],i.hasOwnProperty(F)&&G!==Q&&(G!=null||Q!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,n));break;default:Yt(e,n,F,G,i,Q)}return;default:if(Il(n)){for(var Ft in r)G=r[Ft],r.hasOwnProperty(Ft)&&G!==void 0&&!i.hasOwnProperty(Ft)&&Yf(e,n,Ft,void 0,i,G);for(J in i)G=i[J],Q=r[J],!i.hasOwnProperty(J)||G===Q||G===void 0&&Q===void 0||Yf(e,n,J,G,i,Q);return}}for(var H in r)G=r[H],r.hasOwnProperty(H)&&G!=null&&!i.hasOwnProperty(H)&&Yt(e,n,H,null,i,G);for(ie in i)G=i[ie],Q=r[ie],!i.hasOwnProperty(ie)||G===Q||G==null&&Q==null||Yt(e,n,ie,G,i,Q)}function Bv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Q1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var d=r[i],h=d.transferSize,b=d.initiatorType,E=d.duration;if(h&&E&&Bv(b)){for(b=0,E=d.responseEnd,i+=1;i<r.length;i++){var k=r[i],F=k.startTime;if(F>E)break;var J=k.transferSize,ie=k.initiatorType;J&&Bv(ie)&&(k=k.responseEnd,b+=J*(k<E?1:(E-F)/(k-F)))}if(--i,n+=8*(h+b)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ff=null,Pf=null;function Gu(e){return e.nodeType===9?e:e.ownerDocument}function Hv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function $v(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Gf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Xf=null;function K1(){var e=window.event;return e&&e.type==="popstate"?e===Xf?!1:(Xf=e,!0):(Xf=null,!1)}var qv=typeof setTimeout=="function"?setTimeout:void 0,Z1=typeof clearTimeout=="function"?clearTimeout:void 0,Iv=typeof Promise=="function"?Promise:void 0,J1=typeof queueMicrotask=="function"?queueMicrotask:typeof Iv<"u"?function(e){return Iv.resolve(null).then(e).catch(W1)}:qv;function W1(e){setTimeout(function(){throw e})}function Rl(e){return e==="head"}function Vv(e,n){var r=n,i=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(d),Zs(n);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")Wi(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Wi(r);for(var h=r.firstChild;h;){var b=h.nextSibling,E=h.nodeName;h[Ze]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=b}}else r==="body"&&Wi(e.ownerDocument.body);r=d}while(r);Zs(n)}function Yv(e,n){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function Qf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Qf(r),Ie(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function eS(e,n,r,i){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ze])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Ga(e.nextSibling),e===null)break}return null}function tS(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Ga(e.nextSibling),e===null))return null;return e}function Fv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ga(e.nextSibling),e===null))return null;return e}function Kf(e){return e.data==="$?"||e.data==="$~"}function Zf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function nS(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var i=function(){n(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Ga(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Jf=null;function Pv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return Ga(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Gv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Xv(e,n,r){switch(n=Gu(r),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Wi(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ie(e)}var Xa=new Map,Qv=new Set;function Xu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var tl=B.d;B.d={f:aS,r:rS,D:lS,C:sS,L:iS,m:oS,X:cS,S:uS,M:dS};function aS(){var e=tl.f(),n=Hu();return e||n}function rS(e){var n=We(e);n!==null&&n.tag===5&&n.type==="form"?fg(n):tl.r(e)}var Xs=typeof document>"u"?null:document;function Kv(e,n,r){var i=Xs;if(i&&typeof n=="string"&&n){var d=Gn(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Qv.has(d)||(Qv.add(d),e={rel:e,crossOrigin:r,href:n},i.querySelector(d)===null&&(n=i.createElement("link"),Zn(n,"link",e),dt(n),i.head.appendChild(n)))}}function lS(e){tl.D(e),Kv("dns-prefetch",e,null)}function sS(e,n){tl.C(e,n),Kv("preconnect",e,n)}function iS(e,n,r){tl.L(e,n,r);var i=Xs;if(i&&e&&n){var d='link[rel="preload"][as="'+Gn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+Gn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+Gn(r.imageSizes)+'"]')):d+='[href="'+Gn(e)+'"]';var h=d;switch(n){case"style":h=Qs(e);break;case"script":h=Ks(e)}Xa.has(h)||(e=y({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),Xa.set(h,e),i.querySelector(d)!==null||n==="style"&&i.querySelector(eo(h))||n==="script"&&i.querySelector(to(h))||(n=i.createElement("link"),Zn(n,"link",e),dt(n),i.head.appendChild(n)))}}function oS(e,n){tl.m(e,n);var r=Xs;if(r&&e){var i=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Gn(i)+'"][href="'+Gn(e)+'"]',h=d;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ks(e)}if(!Xa.has(h)&&(e=y({rel:"modulepreload",href:e},n),Xa.set(h,e),r.querySelector(d)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(to(h)))return}i=r.createElement("link"),Zn(i,"link",e),dt(i),r.head.appendChild(i)}}}function uS(e,n,r){tl.S(e,n,r);var i=Xs;if(i&&e){var d=it(i).hoistableStyles,h=Qs(e);n=n||"default";var b=d.get(h);if(!b){var E={loading:0,preload:null};if(b=i.querySelector(eo(h)))E.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},r),(r=Xa.get(h))&&Wf(e,r);var k=b=i.createElement("link");dt(k),Zn(k,"link",e),k._p=new Promise(function(F,J){k.onload=F,k.onerror=J}),k.addEventListener("load",function(){E.loading|=1}),k.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Qu(b,n,i)}b={type:"stylesheet",instance:b,count:1,state:E},d.set(h,b)}}}function cS(e,n){tl.X(e,n);var r=Xs;if(r&&e){var i=it(r).hoistableScripts,d=Ks(e),h=i.get(d);h||(h=r.querySelector(to(d)),h||(e=y({src:e,async:!0},n),(n=Xa.get(d))&&eh(e,n),h=r.createElement("script"),dt(h),Zn(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function dS(e,n){tl.M(e,n);var r=Xs;if(r&&e){var i=it(r).hoistableScripts,d=Ks(e),h=i.get(d);h||(h=r.querySelector(to(d)),h||(e=y({src:e,async:!0,type:"module"},n),(n=Xa.get(d))&&eh(e,n),h=r.createElement("script"),dt(h),Zn(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function Zv(e,n,r,i){var d=(d=je.current)?Xu(d):null;if(!d)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=Qs(r.href),r=it(d).hoistableStyles,i=r.get(n),i||(i={type:"style",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Qs(r.href);var h=it(d).hoistableStyles,b=h.get(e);if(b||(d=d.ownerDocument||d,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,b),(h=d.querySelector(eo(e)))&&!h._p&&(b.instance=h,b.state.loading=5),Xa.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Xa.set(e,r),h||fS(d,e,r,b.state))),n&&i===null)throw Error(s(528,""));return b}if(n&&i!==null)throw Error(s(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ks(r),r=it(d).hoistableScripts,i=r.get(n),i||(i={type:"script",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Qs(e){return'href="'+Gn(e)+'"'}function eo(e){return'link[rel="stylesheet"]['+e+"]"}function Jv(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function fS(e,n,r,i){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?i.loading=1:(n=e.createElement("link"),i.preload=n,n.addEventListener("load",function(){return i.loading|=1}),n.addEventListener("error",function(){return i.loading|=2}),Zn(n,"link",r),dt(n),e.head.appendChild(n))}function Ks(e){return'[src="'+Gn(e)+'"]'}function to(e){return"script[async]"+e}function Wv(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+Gn(r.href)+'"]');if(i)return n.instance=i,dt(i),i;var d=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),dt(i),Zn(i,"style",d),Qu(i,r.precedence,e),n.instance=i;case"stylesheet":d=Qs(r.href);var h=e.querySelector(eo(d));if(h)return n.state.loading|=4,n.instance=h,dt(h),h;i=Jv(r),(d=Xa.get(d))&&Wf(i,d),h=(e.ownerDocument||e).createElement("link"),dt(h);var b=h;return b._p=new Promise(function(E,k){b.onload=E,b.onerror=k}),Zn(h,"link",i),n.state.loading|=4,Qu(h,r.precedence,e),n.instance=h;case"script":return h=Ks(r.src),(d=e.querySelector(to(h)))?(n.instance=d,dt(d),d):(i=r,(d=Xa.get(h))&&(i=y({},r),eh(i,d)),e=e.ownerDocument||e,d=e.createElement("script"),dt(d),Zn(d,"link",i),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(i=n.instance,n.state.loading|=4,Qu(i,r.precedence,e));return n.instance}function Qu(e,n,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=i.length?i[i.length-1]:null,h=d,b=0;b<i.length;b++){var E=i[b];if(E.dataset.precedence===n)h=E;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Wf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function eh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ku=null;function ey(e,n,r){if(Ku===null){var i=new Map,d=Ku=new Map;d.set(r,i)}else d=Ku,i=d.get(r),i||(i=new Map,d.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var h=r[d];if(!(h[Ze]||h[ve]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var b=h.getAttribute(n)||"";b=e+b;var E=i.get(b);E?E.push(h):i.set(b,[h])}}return i}function ty(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function hS(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function ny(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function mS(e,n,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=Qs(i.href),h=n.querySelector(eo(d));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Zu.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=h,dt(h);return}h=n.ownerDocument||n,i=Jv(i),(d=Xa.get(d))&&Wf(i,d),h=h.createElement("link"),dt(h);var b=h;b._p=new Promise(function(E,k){b.onload=E,b.onerror=k}),Zn(h,"link",i),r.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Zu.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var th=0;function pS(e,n){return e.stylesheets&&e.count===0&&Wu(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&Wu(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&th===0&&(th=62500*Q1());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Wu(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>th?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(d)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ju=null;function Wu(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ju=new Map,n.forEach(gS,e),Ju=null,Zu.call(e))}function gS(e,n){if(!(n.state.loading&4)){var r=Ju.get(e);if(r)var i=r.get(null);else{r=new Map,Ju.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var b=d[h];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(r.set(b.dataset.precedence,b),i=b)}i&&r.set(null,i)}d=n.instance,b=d.getAttribute("data-precedence"),h=r.get(b)||i,h===i&&r.set(null,d),r.set(b,d),this.count++,i=Zu.bind(this),d.addEventListener("load",i),d.addEventListener("error",i),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var no={$$typeof:q,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function vS(e,n,r,i,d,h,b,E,k){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ht(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ht(0),this.hiddenUpdates=Ht(null),this.identifierPrefix=i,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function ay(e,n,r,i,d,h,b,E,k,F,J,ie){return e=new vS(e,n,r,b,k,F,J,ie,E),n=1,h===!0&&(n|=24),h=Da(3,null,null,n),e.current=h,h.stateNode=e,n=Md(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:i,isDehydrated:r,cache:n},Ud(h),e}function ry(e){return e?(e=Ts,e):Ts}function ly(e,n,r,i,d,h){d=ry(d),i.context===null?i.context=d:i.pendingContext=d,i=ml(n),i.payload={element:r},h=h===void 0?null:h,h!==null&&(i.callback=h),r=pl(e,i,n),r!==null&&(Na(r,e,n),_i(r,e,n))}function sy(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function nh(e,n){sy(e,n),(e=e.alternate)&&sy(e,n)}function iy(e){if(e.tag===13||e.tag===31){var n=Ql(e,67108864);n!==null&&Na(n,e,67108864),nh(e,67108864)}}function oy(e){if(e.tag===13||e.tag===31){var n=_a();n=M(n);var r=Ql(e,n);r!==null&&Na(r,e,n),nh(e,n)}}var ec=!0;function yS(e,n,r,i){var d=U.T;U.T=null;var h=B.p;try{B.p=2,ah(e,n,r,i)}finally{B.p=h,U.T=d}}function xS(e,n,r,i){var d=U.T;U.T=null;var h=B.p;try{B.p=8,ah(e,n,r,i)}finally{B.p=h,U.T=d}}function ah(e,n,r,i){if(ec){var d=rh(i);if(d===null)Vf(e,n,i,tc,r),cy(e,i);else if(SS(d,e,n,r,i))i.stopPropagation();else if(cy(e,i),n&4&&-1<bS.indexOf(e)){for(;d!==null;){var h=We(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var b=St(h.pendingLanes);if(b!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;b;){var k=1<<31-Kt(b);E.entanglements[1]|=k,b&=~k}Sr(h),(Ot&6)===0&&(Uu=tn()+500,Ki(0))}}break;case 31:case 13:E=Ql(h,2),E!==null&&Na(E,h,2),Hu(),nh(h,2)}if(h=rh(i),h===null&&Vf(e,n,i,tc,r),h===d)break;d=h}d!==null&&i.stopPropagation()}else Vf(e,n,i,null,r)}}function rh(e){return e=_r(e),lh(e)}var tc=null;function lh(e){if(tc=null,e=$t(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return tc=e,null}function uy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(da()){case fa:return 2;case Wn:return 8;case qn:case he:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var sh=!1,jl=null,Tl=null,Cl=null,ao=new Map,ro=new Map,Dl=[],bS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function cy(e,n){switch(e){case"focusin":case"focusout":jl=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Cl=null;break;case"pointerover":case"pointerout":ao.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(n.pointerId)}}function lo(e,n,r,i,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:r,eventSystemFlags:i,nativeEvent:h,targetContainers:[d]},n!==null&&(n=We(n),n!==null&&iy(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function SS(e,n,r,i,d){switch(n){case"focusin":return jl=lo(jl,e,n,r,i,d),!0;case"dragenter":return Tl=lo(Tl,e,n,r,i,d),!0;case"mouseover":return Cl=lo(Cl,e,n,r,i,d),!0;case"pointerover":var h=d.pointerId;return ao.set(h,lo(ao.get(h)||null,e,n,r,i,d)),!0;case"gotpointercapture":return h=d.pointerId,ro.set(h,lo(ro.get(h)||null,e,n,r,i,d)),!0}return!1}function dy(e){var n=$t(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,se(e.priority,function(){oy(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,se(e.priority,function(){oy(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function nc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=rh(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);Ta=i,r.target.dispatchEvent(i),Ta=null}else return n=We(r),n!==null&&iy(n),e.blockedOn=r,!1;n.shift()}return!0}function fy(e,n,r){nc(e)&&r.delete(n)}function wS(){sh=!1,jl!==null&&nc(jl)&&(jl=null),Tl!==null&&nc(Tl)&&(Tl=null),Cl!==null&&nc(Cl)&&(Cl=null),ao.forEach(fy),ro.forEach(fy)}function ac(e,n){e.blockedOn===n&&(e.blockedOn=null,sh||(sh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,wS)))}var rc=null;function hy(e){rc!==e&&(rc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){rc===e&&(rc=null);for(var n=0;n<e.length;n+=3){var r=e[n],i=e[n+1],d=e[n+2];if(typeof i!="function"){if(lh(i||r)===null)continue;break}var h=We(r);h!==null&&(e.splice(n,3),n-=3,af(h,{pending:!0,data:d,method:r.method,action:i},i,d))}}))}function Zs(e){function n(k){return ac(k,e)}jl!==null&&ac(jl,e),Tl!==null&&ac(Tl,e),Cl!==null&&ac(Cl,e),ao.forEach(n),ro.forEach(n);for(var r=0;r<Dl.length;r++){var i=Dl[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Dl.length&&(r=Dl[0],r.blockedOn===null);)dy(r),r.blockedOn===null&&Dl.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var d=r[i],h=r[i+1],b=d[Ae]||null;if(typeof h=="function")b||hy(r);else if(b){var E=null;if(h&&h.hasAttribute("formAction")){if(d=h,b=h[Ae]||null)E=b.formAction;else if(lh(d)!==null)continue}else E=b.action;typeof E=="function"?r[i+1]=E:(r.splice(i,3),i-=3),hy(r)}}}function my(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(b){return d=b})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function ih(e){this._internalRoot=e}lc.prototype.render=ih.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var r=n.current,i=_a();ly(r,i,e,n,null,null)},lc.prototype.unmount=ih.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;ly(e.current,2,null,e,null,null),Hu(),n[Re]=null}};function lc(e){this._internalRoot=e}lc.prototype.unstable_scheduleHydration=function(e){if(e){var n=K();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Dl.length&&n!==0&&n<Dl[r].priority;r++);Dl.splice(r,0,e),r===0&&dy(e)}};var py=a.version;if(py!=="19.2.7")throw Error(s(527,py,"19.2.7"));B.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=g(n),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var ES={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{qe=sc.inject(ES),Z=sc}catch{}}return io.createRoot=function(e,n){if(!o(e))throw Error(s(299));var r=!1,i="",d=wg,h=Eg,b=Ng;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError)),n=ay(e,1,!1,null,null,r,i,null,d,h,b,my),e[Re]=n.current,If(e),new ih(n)},io.hydrateRoot=function(e,n,r){if(!o(e))throw Error(s(299));var i=!1,d="",h=wg,b=Eg,E=Ng,k=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(b=r.onCaughtError),r.onRecoverableError!==void 0&&(E=r.onRecoverableError),r.formState!==void 0&&(k=r.formState)),n=ay(e,1,!0,n,r??null,i,d,k,h,b,E,my),n.context=ry(null),r=n.current,i=_a(),i=M(i),d=ml(i),d.callback=null,pl(r,d,i),r=i,n.current.lanes=r,ht(n,r),Sr(n),e[Re]=n.current,If(e),new lc(n)},io.version="19.2.7",io}var Ry;function US(){if(Ry)return ch.exports;Ry=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),ch.exports=zS(),ch.exports}var BS=US();/**
50
+ * react-router v7.18.0
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var Qx=t=>{throw TypeError(t)},Kx=(t,a,l)=>a.has(t)||Qx("Cannot "+l),Qa=(t,a,l)=>(Kx(t,a,"read from private field"),l?l.call(t):a.get(t)),yo=(t,a,l)=>a.has(t)?Qx("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,l),wr=(t,a,l,s)=>(Kx(t,a,"write to private field"),a.set(t,l),l),Hc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Wh=/^[\\/]{2}/;function Zx(t,a){return a+t.replace(/\\/g,"/")}var jy="popstate";function Ty(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function HS(t={}){function a(s,o){var g;let u=(g=o.state)==null?void 0:g.masked,{pathname:f,search:m,hash:p}=u||s.location;return Do("",{pathname:f,search:m,hash:p},o.state&&o.state.usr||null,o.state&&o.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function l(s,o){return typeof o=="string"?o:Cr(o)}return qS(a,l,null,t)}function tt(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function bn(t,a){if(!t){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function $S(){return Math.random().toString(36).substring(2,10)}function Cy(t,a){return{usr:t.state,key:t.key,idx:a,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Do(t,a,l=null,s,o){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof a=="string"?Dr(a):a,state:l,key:a&&a.key||s||$S(),mask:o}}function Cr({pathname:t="/",search:a="",hash:l=""}){return a&&a!=="?"&&(t+=a.charAt(0)==="?"?a:"?"+a),l&&l!=="#"&&(t+=l.charAt(0)==="#"?l:"#"+l),t}function Dr(t){let a={};if(t){let l=t.indexOf("#");l>=0&&(a.hash=t.substring(l),t=t.substring(0,l));let s=t.indexOf("?");s>=0&&(a.search=t.substring(s),t=t.substring(0,s)),t&&(a.pathname=t)}return a}function qS(t,a,l,s={}){let{window:o=document.defaultView,v5Compat:u=!1}=s,f=o.history,m="POP",p=null,g=x();g==null&&(g=0,f.replaceState({...f.state,idx:g},""));function x(){return(f.state||{idx:null}).idx}function y(){m="POP";let R=x(),L=R==null?null:R-g;g=R,p&&p({action:m,location:D.location,delta:L})}function N(R,L){m="PUSH";let I=Ty(R)?R:Do(D.location,R,L);g=x()+1;let q=Cy(I,g),X=D.createHref(I.mask||I);try{f.pushState(q,"",X)}catch(W){if(W instanceof DOMException&&W.name==="DataCloneError")throw W;o.location.assign(X)}u&&p&&p({action:m,location:D.location,delta:1})}function w(R,L){m="REPLACE";let I=Ty(R)?R:Do(D.location,R,L);g=x();let q=Cy(I,g),X=D.createHref(I.mask||I);f.replaceState(q,"",X),u&&p&&p({action:m,location:D.location,delta:0})}function S(R){return Jx(o,R)}let D={get action(){return m},get location(){return t(o,f)},listen(R){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(jy,y),p=R,()=>{o.removeEventListener(jy,y),p=null}},createHref(R){return a(o,R)},createURL:S,encodeLocation(R){let L=S(R);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:N,replace:w,go(R){return f.go(R)}};return D}function Jx(t,a,l=!1){let s="http://localhost";t&&(s=t.location.origin!=="null"?t.location.origin:t.location.href),tt(s,"No window.location.(origin|href) available to create URL");let o=typeof a=="string"?a:Cr(a);return o=o.replace(/ $/,"%20"),!l&&Wh.test(o)&&(o=s+o),new URL(o,s)}var xo,Dy=class{constructor(t){if(yo(this,xo,new Map),t)for(let[a,l]of t)this.set(a,l)}get(t){if(Qa(this,xo).has(t))return Qa(this,xo).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,a){Qa(this,xo).set(t,a)}};xo=new WeakMap;var IS=new Set(["lazy","caseSensitive","path","id","index","children"]);function VS(t){return IS.has(t)}var YS=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function FS(t){return YS.has(t)}function PS(t){return t.index===!0}function Ao(t,a,l=[],s={},o=!1){return t.map((u,f)=>{let m=[...l,String(f)],p=typeof u.id=="string"?u.id:m.join("-");if(tt(u.index!==!0||!u.children,"Cannot specify children on an index route"),tt(o||!s[p],`Found a route id collision on id "${p}". Route id's must be globally unique within Data Router usages`),PS(u)){let g={...u,id:p};return s[p]=Ay(g,a(g)),g}else{let g={...u,id:p,children:void 0};return s[p]=Ay(g,a(g)),u.children&&(g.children=Ao(u.children,a,m,s,o)),g}})}function Ay(t,a){return Object.assign(t,{...a,...typeof a.lazy=="object"&&a.lazy!=null?{lazy:{...t.lazy,...a.lazy}}:{}})}function Wx(t,a,l="/"){return or(t,a,l,!1)}function or(t,a,l,s,o){let u=typeof a=="string"?Dr(a):a,f=Wa(u.pathname||"/",l);if(f==null)return null;let m=o??xc(t),p=null,g=rw(f);for(let x=0;p==null&&x<m.length;++x)p=aw(m[x],g,s);return p}function GS(t,a){let{route:l,pathname:s,params:o}=t;return{id:l.id,pathname:s,params:o,data:a[l.id],loaderData:a[l.id],handle:l.handle}}function xc(t){let a=eb(t);return XS(a),a}function eb(t,a=[],l=[],s="",o=!1){let u=(f,m,p=o,g)=>{let x={relativePath:g===void 0?f.path||"":g,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(s)&&p)return;tt(x.relativePath.startsWith(s),`Absolute route path "${x.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(s.length)}let y=Ja([s,x.relativePath]),N=l.concat(x);f.children&&f.children.length>0&&(tt(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),eb(f.children,a,N,y,p)),!(f.path==null&&!f.index)&&a.push({path:y,score:tw(y,f.index),routesMeta:N.map((w,S)=>{let[D,R]=ab(w.relativePath,w.caseSensitive,S===N.length-1);return{...w,matcher:D,compiledParams:R}})})};return t.forEach((f,m)=>{var p;if(f.path===""||!((p=f.path)!=null&&p.includes("?")))u(f,m);else for(let g of tb(f.path))u(f,m,!0,g)}),a}function tb(t){let a=t.split("/");if(a.length===0)return[];let[l,...s]=a,o=l.endsWith("?"),u=l.replace(/\?$/,"");if(s.length===0)return o?[u,""]:[u];let f=tb(s.join("/")),m=[];return m.push(...f.map(p=>p===""?u:[u,p].join("/"))),o&&m.push(...f),m.map(p=>t.startsWith("/")&&p===""?"/":p)}function XS(t){t.sort((a,l)=>a.score!==l.score?l.score-a.score:nw(a.routesMeta.map(s=>s.childrenIndex),l.routesMeta.map(s=>s.childrenIndex)))}var QS=/^:[\w-]+$/,KS=3,ZS=2,JS=1,WS=10,ew=-2,ky=t=>t==="*";function tw(t,a){let l=t.split("/"),s=l.length;return l.some(ky)&&(s+=ew),a&&(s+=ZS),l.filter(o=>!ky(o)).reduce((o,u)=>o+(QS.test(u)?KS:u===""?JS:WS),s)}function nw(t,a){return t.length===a.length&&t.slice(0,-1).every((s,o)=>s===a[o])?t[t.length-1]-a[a.length-1]:0}function aw(t,a,l=!1){let{routesMeta:s}=t,o={},u="/",f=[];for(let m=0;m<s.length;++m){let p=s[m],g=m===s.length-1,x=u==="/"?a:a.slice(u.length)||"/",y={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},N=p.matcher&&p.compiledParams?nb(y,x,p.matcher,p.compiledParams):Tc(y,x),w=p.route;if(!N&&g&&l&&!s[s.length-1].route.index&&(N=Tc({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},x)),!N)return null;Object.assign(o,N.params),f.push({params:o,pathname:Ja([u,N.pathname]),pathnameBase:iw(Ja([u,N.pathnameBase])),route:w}),N.pathnameBase!=="/"&&(u=Ja([u,N.pathnameBase]))}return f}function Tc(t,a){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[l,s]=ab(t.path,t.caseSensitive,t.end);return nb(t,a,l,s)}function nb(t,a,l,s){let o=a.match(l);if(!o)return null;let u=o[0],f=u.replace(/(.)\/+$/,"$1"),m=o.slice(1);return{params:s.reduce((g,{paramName:x,isOptional:y},N)=>{if(x==="*"){let S=m[N]||"";f=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const w=m[N];return y&&!w?g[x]=void 0:g[x]=(w||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:t}}function ab(t,a=!1,l=!0){bn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let s=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,m,p,g,x)=>{if(s.push({paramName:m,isOptional:p!=null}),p){let y=x.charAt(g+f.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(s.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,a?void 0:"i"),s]}function rw(t){try{return t.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return bn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),t}}function Wa(t,a){if(a==="/")return t;if(!t.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,s=t.charAt(l);return s&&s!=="/"?null:t.slice(l)||"/"}function lw({basename:t,pathname:a}){return a==="/"?t:Ja([t,a])}var em=t=>Hc.test(t);function sw(t,a="/"){let{pathname:l,search:s="",hash:o=""}=typeof t=="string"?Dr(t):t,u;return l?(l=nm(l),l.startsWith("/")?u=Oy(l.substring(1),"/"):u=Oy(l,a)):u=a,{pathname:u,search:ow(s),hash:uw(o)}}function Oy(t,a){let l=Cc(a).split("/");return t.split("/").forEach(o=>{o===".."?l.length>1&&l.pop():o!=="."&&l.push(o)}),l.length>1?l.join("/"):"/"}function mh(t,a,l,s){return`Cannot include a '${t}' character in a manually specified \`to.${a}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${l}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function rb(t){return t.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function tm(t){let a=rb(t);return a.map((l,s)=>s===a.length-1?l.pathname:l.pathnameBase)}function $c(t,a,l,s=!1){let o;typeof t=="string"?o=Dr(t):(o={...t},tt(!o.pathname||!o.pathname.includes("?"),mh("?","pathname","search",o)),tt(!o.pathname||!o.pathname.includes("#"),mh("#","pathname","hash",o)),tt(!o.search||!o.search.includes("#"),mh("#","search","hash",o)));let u=t===""||o.pathname==="",f=u?"/":o.pathname,m;if(f==null)m=l;else{let y=a.length-1;if(!s&&f.startsWith("..")){let N=f.split("/");for(;N[0]==="..";)N.shift(),y-=1;o.pathname=N.join("/")}m=y>=0?a[y]:"/"}let p=sw(o,m),g=f&&f!=="/"&&f.endsWith("/"),x=(u||f===".")&&l.endsWith("/");return!p.pathname.endsWith("/")&&(g||x)&&(p.pathname+="/"),p}var nm=t=>t.replace(/[\\/]{2,}/g,"/"),Ja=t=>nm(t.join("/")),Cc=t=>t.replace(/\/+$/,""),iw=t=>Cc(t).replace(/^\/*/,"/"),ow=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,uw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Ua=(t,a=302)=>{let l=a;typeof l=="number"?l={status:l}:typeof l.status>"u"&&(l.status=302);let s=new Headers(l.headers);return s.set("Location",t),new Response(null,{...l,headers:s})},cw=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],zo=class{constructor(t,a,l,s=!1){this.status=t,this.statusText=a||"",this.internal=s,l instanceof Error?(this.data=l.toString(),this.error=l):this.data=l}};function ci(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Uo(t){let a=t.map(l=>l.route.path).filter(Boolean);return Ja(a)||"/"}var lb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function sb(t,a){let l=t;if(typeof l!="string"||!Hc.test(l))return{absoluteURL:void 0,isExternal:!1,to:l};let s=l,o=!1;if(lb)try{let u=new URL(window.location.href),f=Wh.test(l)?new URL(Zx(l,u.protocol)):new URL(l),m=Wa(f.pathname,a);f.origin===u.origin&&m!=null?l=m+f.search+f.hash:o=!0}catch{bn(!1,`<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:l}}var zl=Symbol("Uninstrumented");function dw(t,a){let l={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(o=>o({id:a.id,index:a.index,path:a.path,instrument(u){let f=Object.keys(l);for(let m of f)u[m]&&l[m].push(u[m])}}));let s={};if(typeof a.lazy=="function"&&l.lazy.length>0){let o=si(l.lazy,a.lazy,()=>{});o&&(s.lazy=o)}if(typeof a.lazy=="object"){let o=a.lazy;["middleware","loader","action"].forEach(u=>{let f=o[u],m=l[`lazy.${u}`];if(typeof f=="function"&&m.length>0){let p=si(m,f,()=>{});p&&(s.lazy=Object.assign(s.lazy||{},{[u]:p}))}})}return["loader","action"].forEach(o=>{let u=a[o];if(typeof u=="function"&&l[o].length>0){let f=u[zl]??u,m=si(l[o],f,(...p)=>My(p[0]));m&&(o==="loader"&&f.hydrate===!0&&(m.hydrate=!0),m[zl]=f,s[o]=m)}}),a.middleware&&a.middleware.length>0&&l.middleware.length>0&&(s.middleware=a.middleware.map(o=>{let u=o[zl]??o,f=si(l.middleware,u,(...m)=>My(m[0]));return f?(f[zl]=u,f):o})),s}function fw(t,a){let l={navigate:[],fetch:[]};if(a.forEach(s=>s({instrument(o){let u=Object.keys(o);for(let f of u)o[f]&&l[f].push(o[f])}})),l.navigate.length>0){let s=t.navigate[zl]??t.navigate,o=si(l.navigate,s,(...u)=>{let[f,m]=u;return{to:typeof f=="number"||typeof f=="string"?f:f?Cr(f):".",..._y(t,m??{})}});o&&(o[zl]=s,t.navigate=o)}if(l.fetch.length>0){let s=t.fetch[zl]??t.fetch,o=si(l.fetch,s,(...u)=>{let[f,,m,p]=u;return{href:m??".",fetcherKey:f,..._y(t,p??{})}});o&&(o[zl]=s,t.fetch=o)}return t}function si(t,a,l){return t.length===0?null:async(...s)=>{let o=await ib(t,l(...s),()=>a(...s),t.length-1);if(o.type==="error")throw o.value;return o.value}}async function ib(t,a,l,s){let o=t[s],u;if(o){let f,m=async()=>(f?console.error("You cannot call instrumented handlers more than once"):f=ib(t,a,l,s-1),u=await f,tt(u,"Expected a result"),u.type==="error"&&u.value instanceof Error?{status:"error",error:u.value}:{status:"success",error:void 0});try{await o(m,a)}catch(p){console.error("An instrumentation function threw an error:",p)}f||await m(),await f}else try{u={type:"success",value:await l()}}catch(f){u={type:"error",value:f}}return u||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function My(t){let{request:a,context:l,params:s,pattern:o}=t;return{request:hw(a),params:{...s},pattern:o,context:mw(l)}}function _y(t,a){return{currentUrl:Cr(t.state.location),..."formMethod"in a?{formMethod:a.formMethod}:{},..."formEncType"in a?{formEncType:a.formEncType}:{},..."formData"in a?{formData:a.formData}:{},..."body"in a?{body:a.body}:{}}}function hw(t){return{method:t.method,url:t.url,headers:{get:(...a)=>t.headers.get(...a)}}}function mw(t){if(gw(t)){let a={...t};return Object.freeze(a),a}else return{get:a=>t.get(a)}}var pw=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gw(t){if(t===null||typeof t!="object")return!1;const a=Object.getPrototypeOf(t);return a===Object.prototype||a===null||Object.getOwnPropertyNames(a).sort().join("\0")===pw}var ob=["POST","PUT","PATCH","DELETE"],vw=new Set(ob),yw=["GET",...ob],xw=new Set(yw),ub=new Set([301,302,303,307,308]),bw=new Set([307,308]),ph={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},cb={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},oo={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Sw=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),db="remix-router-transitions",fb=Symbol("ResetLoaderData"),os,ai,Ol,ri,ww=class{constructor(t){yo(this,os),yo(this,ai),yo(this,Ol),yo(this,ri),wr(this,os,t),wr(this,ai,xc(t))}get stableRoutes(){return Qa(this,os)}get activeRoutes(){return Qa(this,Ol)??Qa(this,os)}get branches(){return Qa(this,ri)??Qa(this,ai)}get hasHMRRoutes(){return Qa(this,Ol)!=null}setRoutes(t){wr(this,os,t),wr(this,ai,xc(t))}setHmrRoutes(t){wr(this,Ol,t),wr(this,ri,xc(t))}commitHmrRoutes(){Qa(this,Ol)&&(wr(this,os,Qa(this,Ol)),wr(this,ai,Qa(this,ri)),wr(this,Ol,void 0),wr(this,ri,void 0))}};os=new WeakMap;ai=new WeakMap;Ol=new WeakMap;ri=new WeakMap;function Ew(t){const a=t.window?t.window:typeof window<"u"?window:void 0,l=typeof a<"u"&&typeof a.document<"u"&&typeof a.document.createElement<"u";tt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=t.hydrationRouteProperties||[],o=t.mapRouteProperties||Sw,u=o;if(t.instrumentations){let A=t.instrumentations;u=M=>({...o(M),...dw(A.map($=>$.route).filter(Boolean),M)})}let f={},m=new ww(Ao(t.routes,u,void 0,f)),p=t.basename||"/";p.startsWith("/")||(p=`/${p}`);let g=t.dataStrategy||Cw,x={...t.future},y=null,N=new Set,w=null,S=null,D=null,R=null,L=t.hydrationData!=null,I=or(m.activeRoutes,t.history.location,p,!1,m.branches),q=!1,X=null,W,ae;if(I==null&&!t.patchRoutesOnNavigation){let A=Ka(404,{pathname:t.history.location.pathname}),{matches:M,route:$}=ic(m.activeRoutes);W=!0,ae=!W,I=M,X={[$.id]:A}}else if(I&&!t.hydrationData&&Ht(I,m.activeRoutes,t.history.location.pathname).active&&(I=null),I)if(I.some(A=>A.route.lazy))W=!1,ae=!W;else if(!I.some(A=>am(A.route)))W=!0,ae=!W;else{let A=t.hydrationData?t.hydrationData.loaderData:null,M=t.hydrationData?t.hydrationData.errors:null,$=I;if(M){let K=I.findIndex(se=>M[se.route.id]!==void 0);$=$.slice(0,K+1)}ae=!1,W=!0,$.forEach(K=>{let se=hb(K.route,A,M);ae=ae||se.renderFallback,W=W&&!se.shouldLoad})}else{W=!1,ae=!W,I=[];let A=Ht(null,m.activeRoutes,t.history.location.pathname);A.active&&A.matches&&(q=!0,I=A.matches)}let z,T={historyAction:t.history.action,location:t.history.location,matches:I,initialized:W,renderFallback:ae,navigation:ph,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||X,fetchers:new Map,blockers:new Map},ee="POP",fe=null,be=!1,ye,te=!1,re=new Map,ge=null,U=!1,B=!1,ue=new Set,de=new Map,we=0,C=-1,V=new Map,ne=new Set,me=new Map,Ne=new Map,je=new Set,ze=new Map,ut,Ge=null;function nt(){if(y=t.history.listen(({action:A,location:M,delta:$})=>{if(ut){ut(),ut=void 0;return}bn(ze.size===0||$!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let K=yt({currentLocation:T.location,nextLocation:M,historyAction:A});if(K&&$!=null){let se=new Promise(Te=>{ut=Te});t.history.go($*-1),vt(K,{state:"blocked",location:M,proceed(){vt(K,{state:"proceeding",proceed:void 0,reset:void 0,location:M}),se.then(()=>t.history.go($))},reset(){let Te=new Map(T.blockers);Te.set(K,oo),ft({blockers:Te})}}),fe==null||fe.resolve(),fe=null;return}return Ut(A,M)}),l){Gw(a,re);let A=()=>Xw(a,re);a.addEventListener("pagehide",A),ge=()=>a.removeEventListener("pagehide",A)}return T.initialized||Ut("POP",T.location,{initialHydration:!0}),z}function Sn(){y&&y(),ge&&ge(),N.clear(),ye&&ye.abort(),T.fetchers.forEach((A,M)=>qe(T.fetchers,M)),T.blockers.forEach((A,M)=>Me(M))}function Xt(A){if(N.add(A),w){let{newErrors:M}=w;w=null,A(T,{deletedFetchers:[],newErrors:M,viewTransitionOpts:void 0,flushSync:!1})}return()=>N.delete(A)}function ft(A,M={}){A.matches&&(A.matches=A.matches.map(se=>{let Te=f[se.route.id],ve=se.route;return ve.element!==Te.element||ve.errorElement!==Te.errorElement||ve.hydrateFallbackElement!==Te.hydrateFallbackElement?{...se,route:Te}:se})),T={...T,...A};let $=[],K=[];T.fetchers.forEach((se,Te)=>{se.state==="idle"&&(je.has(Te)?$.push(Te):K.push(Te))}),je.forEach(se=>{!T.fetchers.has(se)&&!de.has(se)&&$.push(se)}),N.size===0&&(w={newErrors:A.errors??null}),[...N].forEach(se=>se(T,{deletedFetchers:$,newErrors:A.errors??null,viewTransitionOpts:M.viewTransitionOpts,flushSync:M.flushSync===!0})),$.forEach(se=>qe(T.fetchers,se)),K.forEach(se=>T.fetchers.delete(se))}function oe(A,M,{flushSync:$}={}){var Ue,Xe;let K=T.actionData!=null&&T.navigation.formMethod!=null&&oa(T.navigation.formMethod)&&T.navigation.state==="loading"&&((Ue=A.state)==null?void 0:Ue._isRedirect)!==!0,se;M.actionData?Object.keys(M.actionData).length>0?se=M.actionData:se=null:K?se=T.actionData:se=null;let Te=M.loaderData?Yy(T.loaderData,M.loaderData,M.matches||[],M.errors):T.loaderData,ve=T.blockers;ve.size>0&&(ve=new Map(ve),ve.forEach((ke,Ze)=>ve.set(Ze,oo)));let Ae=U?!1:Zt(A,M.matches||T.matches),Re=be===!0||T.navigation.formMethod!=null&&oa(T.navigation.formMethod)&&((Xe=A.state)==null?void 0:Xe._isRedirect)!==!0;m.commitHmrRoutes(),U||ee==="POP"||(ee==="PUSH"?t.history.push(A,A.state):ee==="REPLACE"&&t.history.replace(A,A.state));let _e;if(ee==="POP"){let ke=re.get(T.location.pathname);ke&&ke.has(A.pathname)?_e={currentLocation:T.location,nextLocation:A}:re.has(A.pathname)&&(_e={currentLocation:A,nextLocation:T.location})}else if(te){let ke=re.get(T.location.pathname);ke?ke.add(A.pathname):(ke=new Set([A.pathname]),re.set(T.location.pathname,ke)),_e={currentLocation:T.location,nextLocation:A}}ft({...M,actionData:se,loaderData:Te,historyAction:ee,location:A,initialized:!0,renderFallback:!1,navigation:ph,revalidation:"idle",restoreScrollPosition:Ae,preventScrollReset:Re,blockers:ve},{viewTransitionOpts:_e,flushSync:$===!0}),ee="POP",be=!1,te=!1,U=!1,B=!1,fe==null||fe.resolve(),fe=null,Ge==null||Ge.resolve(),Ge=null}async function $e(A,M){if(fe==null||fe.resolve(),fe=null,typeof A=="number"){fe||(fe=Xy());let Ie=fe.promise;return t.history.go(A),Ie}let $=Hh(T.location,T.matches,p,A,M==null?void 0:M.fromRouteId,M==null?void 0:M.relative),{path:K,submission:se,error:Te}=Ly(!1,$,M),ve;M!=null&&M.mask&&(ve={pathname:"",search:"",hash:"",...typeof M.mask=="string"?Dr(M.mask):{...T.location.mask,...M.mask}});let Ae=T.location,Re=Do(Ae,K,M&&M.state,void 0,ve);Re={...Re,...t.history.encodeLocation(Re)};let _e=M&&M.replace!=null?M.replace:void 0,Ue="PUSH";_e===!0?Ue="REPLACE":_e===!1||se!=null&&oa(se.formMethod)&&se.formAction===T.location.pathname+T.location.search&&(Ue="REPLACE");let Xe=M&&"preventScrollReset"in M?M.preventScrollReset===!0:void 0,ke=(M&&M.flushSync)===!0,Ze=yt({currentLocation:Ae,nextLocation:Re,historyAction:Ue});if(Ze){vt(Ze,{state:"blocked",location:Re,proceed(){vt(Ze,{state:"proceeding",proceed:void 0,reset:void 0,location:Re}),$e(A,M)},reset(){let Ie=new Map(T.blockers);Ie.set(Ze,oo),ft({blockers:Ie})}});return}await Ut(Ue,Re,{submission:se,pendingError:Te,preventScrollReset:Xe,replace:M&&M.replace,enableViewTransition:M&&M.viewTransition,flushSync:ke,callSiteDefaultShouldRevalidate:M&&M.defaultShouldRevalidate})}function at(){Ge||(Ge=Xy()),qn(),ft({revalidation:"loading"});let A=Ge.promise;return T.navigation.state==="submitting"?A:T.navigation.state==="idle"?(Ut(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),A):(Ut(ee||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:te===!0}),A)}async function Ut(A,M,$){ye&&ye.abort(),ye=null,ee=A,U=($&&$.startUninterruptedRevalidation)===!0,nn(T.location,T.matches),be=($&&$.preventScrollReset)===!0,te=($&&$.enableViewTransition)===!0;let K=m.activeRoutes,se=$!=null&&$.initialHydration&&T.matches&&T.matches.length>0&&!q?T.matches:or(K,M,p,!1,m.branches),Te=($&&$.flushSync)===!0;if(se&&T.initialized&&!B&&Uw(T.location,M)&&!($&&$.submission&&oa($.submission.formMethod))){oe(M,{matches:se},{flushSync:Te});return}let ve=Ht(se,K,M.pathname);if(ve.active&&ve.matches&&(se=ve.matches),!se){let{error:We,notFoundMatches:ct,route:it}=St(M.pathname);oe(M,{matches:ct,loaderData:{},errors:{[it.id]:We}},{flushSync:Te});return}let Ae=$&&$.overrideNavigation?{...$.overrideNavigation,matches:se,historyAction:A}:void 0;ye=new AbortController;let Re=li(t.history,M,ye.signal,$&&$.submission),_e=t.getContext?await t.getContext():new Dy,Ue;if($&&$.pendingError)Ue=[Ll(se).route.id,{type:"error",error:$.pendingError}];else if($&&$.submission&&oa($.submission.formMethod)){let We=await pn(Re,M,$.submission,se,A,_e,ve.active,$&&$.initialHydration===!0,{replace:$.replace,flushSync:Te});if(We.shortCircuited)return;if(We.pendingActionResult){let[ct,it]=We.pendingActionResult;if(La(it)&&ci(it.error)&&it.error.status===404){ye=null,oe(M,{matches:We.matches,loaderData:{},errors:{[ct]:it.error}});return}}se=We.matches||se,Ue=We.pendingActionResult,Ae=gh(M,se,A,$.submission),Te=!1,ve.active=!1,Re=li(t.history,Re.url,Re.signal)}let{shortCircuited:Xe,matches:ke,loaderData:Ze,errors:Ie,workingFetchers:$t}=await jt(Re,M,se,A,_e,ve.active,Ae,$&&$.submission,$&&$.fetcherSubmission,$&&$.replace,$&&$.initialHydration===!0,Te,Ue,$&&$.callSiteDefaultShouldRevalidate);Xe||(ye=null,oe(M,{matches:ke||se,...Fy(Ue),loaderData:Ze,errors:Ie,...$t?{fetchers:$t}:{}}))}async function pn(A,M,$,K,se,Te,ve,Ae,Re={}){qn();let _e=Fw(M,K,se,$);if(ft({navigation:_e},{flushSync:Re.flushSync===!0}),ve){let ke=await ht(K,M.pathname,A.signal);if(ke.type==="aborted")return{shortCircuited:!0};if(ke.type==="error"){if(ke.partialMatches.length===0){let{matches:Ie,route:$t}=ic(m.activeRoutes);return{matches:Ie,pendingActionResult:[$t.id,{type:"error",error:ke.error}]}}let Ze=Ll(ke.partialMatches).route.id;return{matches:ke.partialMatches,pendingActionResult:[Ze,{type:"error",error:ke.error}]}}else if(ke.matches)K=ke.matches;else{let{notFoundMatches:Ze,error:Ie,route:$t}=St(M.pathname);return{matches:Ze,pendingActionResult:[$t.id,{type:"error",error:Ie}]}}}let Ue,Xe=bc(K,M);if(!Xe.route.action&&!Xe.route.lazy)Ue={type:"error",error:Ka(405,{method:A.method,pathname:M.pathname,routeId:Xe.route.id})};else{let ke=oi(u,f,A,M,K,Xe,Ae?[]:s,Te),Ze=await fa(A,M,ke,Te,null);if(Ue=Ze[Xe.route.id],!Ue){for(let Ie of K)if(Ze[Ie.route.id]){Ue=Ze[Ie.route.id];break}}if(A.signal.aborted)return{shortCircuited:!0}}if(us(Ue)){let ke;return Re&&Re.replace!=null?ke=Re.replace:ke=qy(Ue.response.headers.get("Location"),new URL(A.url),p,t.history)===T.location.pathname+T.location.search,await da(A,Ue,!0,{submission:$,replace:ke}),{shortCircuited:!0}}if(La(Ue)){let ke=Ll(K,Xe.route.id);return(Re&&Re.replace)!==!0&&(ee="PUSH"),{matches:K,pendingActionResult:[ke.route.id,Ue,Xe.route.id]}}return{matches:K,pendingActionResult:[Xe.route.id,Ue]}}async function jt(A,M,$,K,se,Te,ve,Ae,Re,_e,Ue,Xe,ke,Ze){let Ie=ve||gh(M,$,K,Ae),$t=Ae||Re||Gy(Ie),We=!U&&!Ue;if(Te){if(We){let Nt=_t(ke);ft({navigation:Ie,...Nt!==void 0?{actionData:Nt}:{}},{flushSync:Xe})}let Qe=await ht($,M.pathname,A.signal);if(Qe.type==="aborted")return{shortCircuited:!0};if(Qe.type==="error"){if(Qe.partialMatches.length===0){let{matches:Wt,route:ta}=ic(m.activeRoutes);return{matches:Wt,loaderData:{},errors:{[ta.id]:Qe.error}}}let Nt=Ll(Qe.partialMatches).route.id;return{matches:Qe.partialMatches,loaderData:{},errors:{[Nt]:Qe.error}}}else if(Qe.matches)$=Qe.matches;else{let{error:Nt,notFoundMatches:Wt,route:ta}=St(M.pathname);return{matches:Wt,loaderData:{},errors:{[ta.id]:Nt}}}}let ct=m.activeRoutes,{dsMatches:it,revalidatingFetchers:dt}=zy(A,se,u,f,t.history,T,$,$t,M,Ue?[]:s,Ue===!0,B,ue,je,me,ne,ct,p,t.patchRoutesOnNavigation!=null,m.branches,ke,Ze);if(C=++we,!t.dataStrategy&&!it.some(Qe=>Qe.shouldLoad)&&!it.some(Qe=>Qe.route.middleware&&Qe.route.middleware.length>0)&&dt.length===0){let Qe=new Map(T.fetchers),Nt=Yn(Qe);return oe(M,{matches:$,loaderData:{},errors:ke&&La(ke[1])?{[ke[0]]:ke[1].error}:null,...Fy(ke),...Nt?{fetchers:Qe}:{}},{flushSync:Xe}),{shortCircuited:!0}}if(We){let Qe={};if(!Te){Qe.navigation=Ie;let Nt=_t(ke);Nt!==void 0&&(Qe.actionData=Nt)}dt.length>0&&(Qe.fetchers=Qt(dt)),ft(Qe,{flushSync:Xe})}dt.forEach(Qe=>{Tt(Qe.key),Qe.controller&&de.set(Qe.key,Qe.controller)});let Jt=()=>dt.forEach(Qe=>Tt(Qe.key));ye&&ye.signal.addEventListener("abort",Jt);let{loaderResults:Fn,fetcherResults:En}=await Wn(it,dt,A,M,se);if(A.signal.aborted)return{shortCircuited:!0};ye&&ye.signal.removeEventListener("abort",Jt),dt.forEach(Qe=>de.delete(Qe.key));let On=oc(Fn);if(On)return await da(A,On.result,!0,{replace:_e}),{shortCircuited:!0};if(On=oc(En),On)return ne.add(On.key),await da(A,On.result,!0,{replace:_e}),{shortCircuited:!0};let Mn=new Map(T.fetchers),{loaderData:Pn,errors:ga}=Vy(T,$,Fn,ke,dt,En,Mn);Ue&&T.errors&&(ga={...T.errors,...ga});let sl=Yn(Mn),ea=gn(C,Mn),hr=sl||ea||dt.length>0;return{matches:$,loaderData:Pn,errors:ga,...hr?{workingFetchers:Mn}:{}}}function _t(A){if(A&&!La(A[1]))return{[A[0]]:A[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function Qt(A){let M=new Map(T.fetchers);return A.forEach($=>{let K=M.get($.key),se=uo(void 0,K?K.data:void 0);M.set($.key,se)}),M}async function Hn(A,M,$,K){Tt(A);let se=(K&&K.flushSync)===!0,Te=m.activeRoutes,ve=Hh(T.location,T.matches,p,$,M,K==null?void 0:K.relative),Ae=or(Te,ve,p,!1,m.branches),Re=Ht(Ae,Te,ve);if(Re.active&&Re.matches&&(Ae=Re.matches),!Ae){Ce(A,M,Ka(404,{pathname:ve}),{flushSync:se});return}let{path:_e,submission:Ue,error:Xe}=Ly(!0,ve,K);if(Xe){Ce(A,M,Xe,{flushSync:se});return}let ke=t.getContext?await t.getContext():new Dy,Ze=(K&&K.preventScrollReset)===!0;if(Ue&&oa(Ue.formMethod)){await $n(A,M,_e,Ae,ke,Re.active,se,Ze,Ue,K&&K.defaultShouldRevalidate);return}me.set(A,{routeId:M,path:_e}),await tn(A,M,_e,Ae,ke,Re.active,se,Ze,Ue)}async function $n(A,M,$,K,se,Te,ve,Ae,Re,_e){qn(),me.delete(A);let Ue=T.fetchers.get(A);he(A,Pw(Re,Ue),{flushSync:ve});let Xe=new AbortController,ke=li(t.history,$,Xe.signal,Re);if(Te){let Rt=await ht(K,new URL(ke.url).pathname,ke.signal,A);if(Rt.type==="aborted")return;if(Rt.type==="error"){Ce(A,M,Rt.error,{flushSync:ve});return}else if(Rt.matches)K=Rt.matches;else{Ce(A,M,Ka(404,{pathname:$}),{flushSync:ve});return}}let Ze=bc(K,$);if(!Ze.route.action&&!Ze.route.lazy){let Rt=Ka(405,{method:Re.formMethod,pathname:$,routeId:M});Ce(A,M,Rt,{flushSync:ve});return}de.set(A,Xe);let Ie=we,$t=oi(u,f,ke,$,K,Ze,s,se),We=await fa(ke,$,$t,se,A),ct=We[Ze.route.id];if(!ct){for(let Rt of $t)if(We[Rt.route.id]){ct=We[Rt.route.id];break}}if(ke.signal.aborted){de.get(A)===Xe&&de.delete(A);return}if(je.has(A)){if(us(ct)||La(ct)){he(A,Nr(void 0));return}}else{if(us(ct))if(de.delete(A),C>Ie){he(A,Nr(void 0));return}else return ne.add(A),he(A,uo(Re)),da(ke,ct,!1,{fetcherSubmission:Re,preventScrollReset:Ae});if(La(ct)){Ce(A,M,ct.error);return}}let it=T.navigation.location||T.location,dt=li(t.history,it,Xe.signal),Jt=m.activeRoutes,Fn=T.navigation.state!=="idle"?or(Jt,T.navigation.location,p,!1,m.branches):T.matches;tt(Fn,"Didn't find any matches after fetcher action");let En=++we;V.set(A,En);let{dsMatches:On,revalidatingFetchers:Mn}=zy(dt,se,u,f,t.history,T,Fn,Re,it,s,!1,B,ue,je,me,ne,Jt,p,t.patchRoutesOnNavigation!=null,m.branches,[Ze.route.id,ct],_e),Pn=uo(Re,ct.data),ga=new Map(T.fetchers);ga.set(A,Pn),Mn.filter(Rt=>Rt.key!==A).forEach(Rt=>{let ja=Rt.key,Gn=ga.get(ja),ql=uo(void 0,Gn?Gn.data:void 0);ga.set(ja,ql),Tt(ja),Rt.controller&&de.set(ja,Rt.controller)}),ft({fetchers:ga});let sl=()=>Mn.forEach(Rt=>Tt(Rt.key));Xe.signal.addEventListener("abort",sl);let{loaderResults:ea,fetcherResults:hr}=await Wn(On,Mn,dt,it,se);if(Xe.signal.aborted)return;Xe.signal.removeEventListener("abort",sl),V.delete(A),de.delete(A),Mn.forEach(Rt=>de.delete(Rt.key));let Qe=T.fetchers.has(A),Nt=Rt=>{if(!Qe)return Rt;let ja=new Map(Rt.fetchers);return ja.set(A,Nr(ct.data)),{...Rt,fetchers:ja}},Wt=oc(ea);if(Wt)return T=Nt(T),da(dt,Wt.result,!1,{preventScrollReset:Ae});if(Wt=oc(hr),Wt)return ne.add(Wt.key),T=Nt(T),da(dt,Wt.result,!1,{preventScrollReset:Ae});let ta=new Map(T.fetchers);Qe&&ta.set(A,Nr(ct.data));let{loaderData:_n,errors:Mr}=Vy(T,Fn,ea,void 0,Mn,hr,ta);gn(En,ta),T.navigation.state==="loading"&&En>C?(tt(ee,"Expected pending action"),ye&&ye.abort(),oe(T.navigation.location,{matches:Fn,loaderData:_n,errors:Mr,fetchers:ta})):(ft({errors:Mr,loaderData:Yy(T.loaderData,_n,Fn,Mr),fetchers:ta}),B=!1)}async function tn(A,M,$,K,se,Te,ve,Ae,Re){let _e=T.fetchers.get(A);he(A,uo(Re,_e?_e.data:void 0),{flushSync:ve});let Ue=new AbortController,Xe=li(t.history,$,Ue.signal);if(Te){let ct=await ht(K,new URL(Xe.url).pathname,Xe.signal,A);if(ct.type==="aborted")return;if(ct.type==="error"){Ce(A,M,ct.error,{flushSync:ve});return}else if(ct.matches)K=ct.matches;else{Ce(A,M,Ka(404,{pathname:$}),{flushSync:ve});return}}let ke=bc(K,$);de.set(A,Ue);let Ze=we,Ie=oi(u,f,Xe,$,K,ke,s,se),$t=await fa(Xe,$,Ie,se,A),We=$t[ke.route.id];if(!We){for(let ct of K)if($t[ct.route.id]){We=$t[ct.route.id];break}}if(de.get(A)===Ue&&de.delete(A),!Xe.signal.aborted){if(je.has(A)){he(A,Nr(void 0));return}if(us(We))if(C>Ze){he(A,Nr(void 0));return}else{ne.add(A),await da(Xe,We,!1,{preventScrollReset:Ae});return}if(La(We)){Ce(A,M,We.error);return}he(A,Nr(We.data))}}async function da(A,M,$,{submission:K,fetcherSubmission:se,preventScrollReset:Te,replace:ve}={}){$||(fe==null||fe.resolve(),fe=null),M.response.headers.has("X-Remix-Revalidate")&&(B=!0);let Ae=M.response.headers.get("Location");tt(Ae,"Expected a Location header on the redirect Response"),Ae=qy(Ae,new URL(A.url),p,t.history);let Re=Do(T.location,Ae,{_isRedirect:!0});if(l){let Ie=!1;if(M.response.headers.has("X-Remix-Reload-Document"))Ie=!0;else if(em(Ae)){const $t=Jx(a,Ae,!0);Ie=$t.origin!==a.location.origin||Wa($t.pathname,p)==null}if(Ie){ve?a.location.replace(Ae):a.location.assign(Ae);return}}ye=null;let _e=ve===!0||M.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Ue,formAction:Xe,formEncType:ke}=T.navigation;!K&&!se&&Ue&&Xe&&ke&&(K=Gy(T.navigation));let Ze=K||se;if(bw.has(M.response.status)&&Ze&&oa(Ze.formMethod))await Ut(_e,Re,{submission:{...Ze,formAction:Ae},preventScrollReset:Te||be,enableViewTransition:$?te:void 0});else{let Ie=gh(Re,[],_e,K);await Ut(_e,Re,{overrideNavigation:Ie,fetcherSubmission:se,preventScrollReset:Te||be,enableViewTransition:$?te:void 0})}}async function fa(A,M,$,K,se){var Ae;let Te,ve={};try{Te=await Aw(g,A,M,$,se,K,!1)}catch(Re){return $.filter(_e=>_e.shouldLoad).forEach(_e=>{ve[_e.route.id]={type:"error",error:Re}}),ve}if(A.signal.aborted)return ve;if(!oa(A.method))for(let Re of $){if(((Ae=Te[Re.route.id])==null?void 0:Ae.type)==="error")break;!Te.hasOwnProperty(Re.route.id)&&!T.loaderData.hasOwnProperty(Re.route.id)&&(!T.errors||!T.errors.hasOwnProperty(Re.route.id))&&Re.shouldCallHandler()&&(Te[Re.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Re.route.id}`)})}for(let[Re,_e]of Object.entries(Te))if(qw(_e)){let Ue=_e.result;ve[Re]={type:"redirect",response:_w(Ue,A,Re,$,p)}}else ve[Re]=await Mw(_e);return ve}async function Wn(A,M,$,K,se){let Te=fa($,K,A,se,null),ve=Promise.all(M.map(async _e=>{if(_e.matches&&_e.match&&_e.request&&_e.controller){let Xe=(await fa(_e.request,_e.path,_e.matches,se,_e.key))[_e.match.route.id];return{[_e.key]:Xe}}else return Promise.resolve({[_e.key]:{type:"error",error:Ka(404,{pathname:_e.path})}})})),Ae=await Te,Re=(await ve).reduce((_e,Ue)=>Object.assign(_e,Ue),{});return{loaderResults:Ae,fetcherResults:Re}}function qn(){B=!0,me.forEach((A,M)=>{de.has(M)&&ue.add(M),Tt(M)})}function he(A,M,$={}){let K=new Map(T.fetchers);K.set(A,M),ft({fetchers:K},{flushSync:($&&$.flushSync)===!0})}function Ce(A,M,$,K={}){let se=Ll(T.matches,M),Te=new Map(T.fetchers);qe(Te,A),ft({errors:{[se.route.id]:$},fetchers:Te},{flushSync:(K&&K.flushSync)===!0})}function De(A){return Ne.set(A,(Ne.get(A)||0)+1),je.has(A)&&je.delete(A),T.fetchers.get(A)||cb}function Pe(A,M){Tt(A,M==null?void 0:M.reason),he(A,Nr(null))}function qe(A,M){let $=T.fetchers.get(M);de.has(M)&&!($&&$.state==="loading"&&V.has(M))&&Tt(M),me.delete(M),V.delete(M),ne.delete(M),je.delete(M),ue.delete(M),A.delete(M)}function Z(A){let M=(Ne.get(A)||0)-1;M<=0?(Ne.delete(A),je.add(A)):Ne.set(A,M),ft({fetchers:new Map(T.fetchers)})}function Tt(A,M){let $=de.get(A);$&&($.abort(M),de.delete(A))}function Kt(A,M){for(let $ of A){let K=M.get($);tt(K,`Expected fetcher: ${$}`);let se=Nr(K.data);M.set($,se)}}function Yn(A){let M=[],$=!1;for(let K of ne){let se=A.get(K);tt(se,`Expected fetcher: ${K}`),se.state==="loading"&&(ne.delete(K),M.push(K),$=!0)}return Kt(M,A),$}function gn(A,M){let $=[];for(let[K,se]of V)if(se<A){let Te=M.get(K);tt(Te,`Expected fetcher: ${K}`),Te.state==="loading"&&(Tt(K),V.delete(K),$.push(K))}return Kt($,M),$.length>0}function Ba(A,M){let $=T.blockers.get(A)||oo;return ze.get(A)!==M&&ze.set(A,M),$}function Me(A){T.blockers.delete(A),ze.delete(A)}function vt(A,M){let $=T.blockers.get(A)||oo;tt($.state==="unblocked"&&M.state==="blocked"||$.state==="blocked"&&M.state==="blocked"||$.state==="blocked"&&M.state==="proceeding"||$.state==="blocked"&&M.state==="unblocked"||$.state==="proceeding"&&M.state==="unblocked",`Invalid blocker state transition: ${$.state} -> ${M.state}`);let K=new Map(T.blockers);K.set(A,M),ft({blockers:K})}function yt({currentLocation:A,nextLocation:M,historyAction:$}){if(ze.size===0)return;ze.size>1&&bn(!1,"A router only supports one blocker at a time");let K=Array.from(ze.entries()),[se,Te]=K[K.length-1],ve=T.blockers.get(se);if(!(ve&&ve.state==="proceeding")&&Te({currentLocation:A,nextLocation:M,historyAction:$}))return se}function St(A){let M=Ka(404,{pathname:A}),$=m.activeRoutes,{matches:K,route:se}=ic($);return{notFoundMatches:K,route:se,error:M}}function Bt(A,M,$){if(S=A,R=M,D=$||null,!L&&T.navigation===ph){L=!0;let K=Zt(T.location,T.matches);K!=null&&ft({restoreScrollPosition:K})}return()=>{S=null,R=null,D=null}}function Ct(A,M){return D&&D(A,M.map(K=>GS(K,T.loaderData)))||A.key}function nn(A,M){if(S&&R){let $=Ct(A,M);S[$]=R()}}function Zt(A,M){if(S){let $=Ct(A,M),K=S[$];if(typeof K=="number")return K}return null}function Ht(A,M,$){if(t.patchRoutesOnNavigation){let K=m.branches;if(A){if(Object.keys(A[0].params).length>0)return{active:!0,matches:or(M,$,p,!0,K)}}else return{active:!0,matches:or(M,$,p,!0,K)||[]}}return{active:!1,matches:null}}async function ht(A,M,$,K){if(!t.patchRoutesOnNavigation)return{type:"success",matches:A};let se=A;for(;;){let Te=f;try{await t.patchRoutesOnNavigation({signal:$,path:M,matches:se,fetcherKey:K,patch:(_e,Ue)=>{$.aborted||Uy(_e,Ue,m,Te,u,!1)}})}catch(_e){return{type:"error",error:_e,partialMatches:se}}if($.aborted)return{type:"aborted"};let ve=m.branches,Ae=or(m.activeRoutes,M,p,!1,ve),Re=null;if(Ae){if(Object.keys(Ae[0].params).length===0)return{type:"success",matches:Ae};if(Re=or(m.activeRoutes,M,p,!0,ve),!(Re&&se.length<Re.length&&Je(se,Re.slice(0,se.length))))return{type:"success",matches:Ae}}if(Re||(Re=or(m.activeRoutes,M,p,!0,ve)),!Re||Je(se,Re))return{type:"success",matches:null};se=Re}}function Je(A,M){return A.length===M.length&&A.every(($,K)=>$.route.id===M[K].route.id)}function wn(A){f={},m.setHmrRoutes(Ao(A,u,void 0,f))}function kn(A,M,$=!1){Uy(A,M,m,f,u,$),m.hasHMRRoutes||ft({})}return z={get basename(){return p},get future(){return x},get state(){return T},get routes(){return m.stableRoutes},get branches(){return m.branches},get manifest(){return f},get window(){return a},initialize:nt,subscribe:Xt,enableScrollRestoration:Bt,navigate:$e,fetch:Hn,revalidate:at,createHref:A=>t.history.createHref(A),encodeLocation:A=>t.history.encodeLocation(A),getFetcher:De,resetFetcher:Pe,deleteFetcher:Z,dispose:Sn,getBlocker:Ba,deleteBlocker:Me,patchRoutes:kn,_internalFetchControllers:de,_internalSetRoutes:wn,_internalSetStateDoNotUseOrYouWillBreakYourApp(A){ft(A)}},t.instrumentations&&(z=fw(z,t.instrumentations.map(A=>A.router).filter(Boolean))),z}function Nw(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Hh(t,a,l,s,o,u){let f,m;if(o){f=[];for(let g of a)if(f.push(g),g.route.id===o){m=g;break}}else f=a,m=a[a.length-1];let p=$c(s||".",tm(f),Wa(t.pathname,l)||t.pathname,u==="path");if(s==null&&(p.search=t.search,p.hash=t.hash),(s==null||s===""||s===".")&&m){let g=lm(p.search);if(m.route.index&&!g)p.search=p.search?p.search.replace(/^\?/,"?index&"):"?index";else if(!m.route.index&&g){let x=new URLSearchParams(p.search),y=x.getAll("index");x.delete("index"),y.filter(w=>w).forEach(w=>x.append("index",w));let N=x.toString();p.search=N?`?${N}`:""}}return l!=="/"&&(p.pathname=lw({basename:l,pathname:p.pathname})),Cr(p)}function Ly(t,a,l){if(!l||!Nw(l))return{path:a};if(l.formMethod&&!Yw(l.formMethod))return{path:a,error:Ka(405,{method:l.formMethod})};let s=()=>({path:a,error:Ka(400,{type:"invalid-body"})}),u=(l.formMethod||"get").toUpperCase(),f=bb(a);if(l.body!==void 0){if(l.formEncType==="text/plain"){if(!oa(u))return s();let y=typeof l.body=="string"?l.body:l.body instanceof FormData||l.body instanceof URLSearchParams?Array.from(l.body.entries()).reduce((N,[w,S])=>`${N}${w}=${S}
59
+ `,""):String(l.body);return{path:a,submission:{formMethod:u,formAction:f,formEncType:l.formEncType,formData:void 0,json:void 0,text:y}}}else if(l.formEncType==="application/json"){if(!oa(u))return s();try{let y=typeof l.body=="string"?JSON.parse(l.body):l.body;return{path:a,submission:{formMethod:u,formAction:f,formEncType:l.formEncType,formData:void 0,json:y,text:void 0}}}catch{return s()}}}tt(typeof FormData=="function","FormData is not available in this environment");let m,p;if(l.formData)m=Ih(l.formData),p=l.formData;else if(l.body instanceof FormData)m=Ih(l.body),p=l.body;else if(l.body instanceof URLSearchParams)m=l.body,p=Iy(m);else if(l.body==null)m=new URLSearchParams,p=new FormData;else try{m=new URLSearchParams(l.body),p=Iy(m)}catch{return s()}let g={formMethod:u,formAction:f,formEncType:l&&l.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(oa(g.formMethod))return{path:a,submission:g};let x=Dr(a);return t&&x.search&&lm(x.search)&&m.append("index",""),x.search=`?${m}`,{path:Cr(x),submission:g}}function zy(t,a,l,s,o,u,f,m,p,g,x,y,N,w,S,D,R,L,I,q,X,W){var U;let ae=X?La(X[1])?X[1].error:X[1].data:void 0,z=o.createURL(u.location),T=o.createURL(p),ee;if(x&&u.errors){let B=Object.keys(u.errors)[0];ee=f.findIndex(ue=>ue.route.id===B)}else if(X&&La(X[1])){let B=X[0];ee=f.findIndex(ue=>ue.route.id===B)-1}let fe=X?X[1].statusCode:void 0,be=fe&&fe>=400,ye={currentUrl:z,currentParams:((U=u.matches[0])==null?void 0:U.params)||{},nextUrl:T,nextParams:f[0].params,...m,actionResult:ae,actionStatus:fe},te=Uo(f),re=f.map((B,ue)=>{let{route:de}=B,we=null;if(ee!=null&&ue>ee)we=!1;else if(de.lazy)we=!0;else if(!am(de))we=!1;else if(x){let{shouldLoad:me}=hb(de,u.loaderData,u.errors);we=me}else Rw(u.loaderData,u.matches[ue],B)&&(we=!0);if(we!==null)return $h(l,s,t,p,te,B,g,a,we);let C=!1;typeof W=="boolean"?C=W:be?C=!1:(y||z.pathname+z.search===T.pathname+T.search||z.search!==T.search||jw(u.matches[ue],B))&&(C=!0);let V={...ye,defaultShouldRevalidate:C},ne=wo(B,V);return $h(l,s,t,p,te,B,g,a,ne,V,W)}),ge=[];return S.forEach((B,ue)=>{if(x||!f.some(je=>je.route.id===B.routeId)||w.has(ue))return;let de=u.fetchers.get(ue),we=de&&de.state!=="idle"&&de.data===void 0,C=or(R,B.path,L??"/",!1,q);if(!C){if(I&&we)return;ge.push({key:ue,routeId:B.routeId,path:B.path,matches:null,match:null,request:null,controller:null});return}if(D.has(ue))return;let V=bc(C,B.path),ne=new AbortController,me=li(o,B.path,ne.signal),Ne=null;if(N.has(ue))N.delete(ue),Ne=oi(l,s,me,B.path,C,V,g,a);else if(we)y&&(Ne=oi(l,s,me,B.path,C,V,g,a));else{let je;typeof W=="boolean"?je=W:be?je=!1:je=y;let ze={...ye,defaultShouldRevalidate:je};wo(V,ze)&&(Ne=oi(l,s,me,B.path,C,V,g,a,ze))}Ne&&ge.push({key:ue,routeId:B.routeId,path:B.path,matches:Ne,match:V,request:me,controller:ne})}),{dsMatches:re,revalidatingFetchers:ge}}function am(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function hb(t,a,l){if(t.lazy)return{shouldLoad:!0,renderFallback:!0};if(!am(t))return{shouldLoad:!1,renderFallback:!1};let s=a!=null&&t.id in a,o=l!=null&&l[t.id]!==void 0;if(!s&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof t.loader=="function"&&t.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let u=!s&&!o;return{shouldLoad:u,renderFallback:u}}function Rw(t,a,l){let s=!a||l.route.id!==a.route.id,o=!t.hasOwnProperty(l.route.id);return s||o}function jw(t,a){let l=t.route.path;return t.pathname!==a.pathname||l!=null&&l.endsWith("*")&&t.params["*"]!==a.params["*"]}function wo(t,a){if(t.route.shouldRevalidate){let l=t.route.shouldRevalidate(a);if(typeof l=="boolean")return l}return a.defaultShouldRevalidate}function Uy(t,a,l,s,o,u){let f;if(t){let g=s[t];tt(g,`No route found to patch children into: routeId = ${t}`),g.children||(g.children=[]),f=g.children}else f=l.activeRoutes;let m=[],p=[];if(a.forEach(g=>{let x=f.find(y=>mb(g,y));x?p.push({existingRoute:x,newRoute:g}):m.push(g)}),m.length>0){let g=Ao(m,o,[t||"_","patch",String((f==null?void 0:f.length)||"0")],s);f.push(...g)}if(u&&p.length>0)for(let g=0;g<p.length;g++){let{existingRoute:x,newRoute:y}=p[g],N=x,[w]=Ao([y],o,[],{},!0);Object.assign(N,{element:w.element?w.element:N.element,errorElement:w.errorElement?w.errorElement:N.errorElement,hydrateFallbackElement:w.hydrateFallbackElement?w.hydrateFallbackElement:N.hydrateFallbackElement})}l.hasHMRRoutes||l.setRoutes([...l.activeRoutes])}function mb(t,a){var l;return"id"in t&&"id"in a&&t.id===a.id?!0:t.index===a.index&&t.path===a.path&&t.caseSensitive===a.caseSensitive?(!t.children||t.children.length===0)&&(!a.children||a.children.length===0)?!0:((l=t.children)==null?void 0:l.every((s,o)=>{var u;return(u=a.children)==null?void 0:u.some(f=>mb(s,f))}))??!1:!1}var By=new WeakMap,pb=({key:t,route:a,manifest:l,mapRouteProperties:s})=>{let o=l[a.id];if(tt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let u=o.lazy[t];if(!u)return;let f=By.get(o);f||(f={},By.set(o,f));let m=f[t];if(m)return m;let p=(async()=>{let g=VS(t),y=o[t]!==void 0&&t!=="hasErrorBoundary";if(g)bn(!g,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),f[t]=Promise.resolve();else if(y)bn(!1,`Route "${o.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let N=await u();N!=null&&(Object.assign(o,{[t]:N}),Object.assign(o,s(o)))}typeof o.lazy=="object"&&(o.lazy[t]=void 0,Object.values(o.lazy).every(N=>N===void 0)&&(o.lazy=void 0))})();return f[t]=p,p},Hy=new WeakMap;function Tw(t,a,l,s,o){let u=l[t.id];if(tt(u,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let x=Hy.get(u);if(x)return{lazyRoutePromise:x,lazyHandlerPromise:x};let y=(async()=>{tt(typeof t.lazy=="function","No lazy route function found");let N=await t.lazy(),w={};for(let S in N){let D=N[S];if(D===void 0)continue;let R=FS(S),I=u[S]!==void 0&&S!=="hasErrorBoundary";R?bn(!R,"Route property "+S+" is not a supported property to be returned from a lazy route function. This property will be ignored."):I?bn(!I,`Route "${u.id}" has a static property "${S}" defined but its lazy function is also returning a value for this property. The lazy route property "${S}" will be ignored.`):w[S]=D}Object.assign(u,w),Object.assign(u,{...s(u),lazy:void 0})})();return Hy.set(u,y),y.catch(()=>{}),{lazyRoutePromise:y,lazyHandlerPromise:y}}let f=Object.keys(t.lazy),m=[],p;for(let x of f){if(o&&o.includes(x))continue;let y=pb({key:x,route:t,manifest:l,mapRouteProperties:s});y&&(m.push(y),x===a&&(p=y))}let g=m.length>0?Promise.all(m).then(()=>{}):void 0;return g==null||g.catch(()=>{}),p==null||p.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:p}}async function $y(t){let a=t.matches.filter(o=>o.shouldLoad),l={};return(await Promise.all(a.map(o=>o.resolve()))).forEach((o,u)=>{l[a[u].route.id]=o}),l}async function Cw(t){return t.matches.some(a=>a.route.middleware)?gb(t,()=>$y(t)):$y(t)}function gb(t,a){return Dw(t,a,s=>{if(Vw(s))throw s;return s},Hw,l);function l(s,o,u){if(u)return Promise.resolve(Object.assign(u.value,{[o]:{type:"error",result:s}}));{let{matches:f}=t,m=Math.min(Math.max(f.findIndex(g=>g.route.id===o),0),Math.max(f.findIndex(g=>g.shouldCallHandler()),0)),p=Ll(f,f[m].route.id).route.id;return Promise.resolve({[p]:{type:"error",result:s}})}}}async function Dw(t,a,l,s,o){let{matches:u,...f}=t,m=u.flatMap(g=>g.route.middleware?g.route.middleware.map(x=>[g.route.id,x]):[]);return await vb(f,m,a,l,s,o)}async function vb(t,a,l,s,o,u,f=0){let{request:m}=t;if(m.signal.aborted)throw m.signal.reason??new Error(`Request aborted: ${m.method} ${m.url}`);let p=a[f];if(!p)return await l();let[g,x]=p,y,N=async()=>{if(y)throw new Error("You may only call `next()` once per middleware");try{return y={value:await vb(t,a,l,s,o,u,f+1)},y.value}catch(w){return y={value:await u(w,g,y)},y.value}};try{let w=await x(t,N),S=w!=null?s(w):void 0;return o(S)?S:y?S??y.value:(y={value:await N()},y.value)}catch(w){return await u(w,g,y)}}function yb(t,a,l,s,o){let u=pb({key:"middleware",route:s.route,manifest:a,mapRouteProperties:t}),f=Tw(s.route,oa(l.method)?"action":"loader",a,t,o);return{middleware:u,route:f.lazyRoutePromise,handler:f.lazyHandlerPromise}}function $h(t,a,l,s,o,u,f,m,p,g=null,x){let y=!1,N=yb(t,a,l,u,f);return{...u,_lazyPromises:N,shouldLoad:p,shouldRevalidateArgs:g,shouldCallHandler(w){return y=!0,g?typeof x=="boolean"?wo(u,{...g,defaultShouldRevalidate:x}):typeof w=="boolean"?wo(u,{...g,defaultShouldRevalidate:w}):wo(u,g):p},resolve(w){let{lazy:S,loader:D,middleware:R}=u.route,L=y||p||w&&!oa(l.method)&&(S||D),I=R&&R.length>0&&!D&&!S;return L&&(oa(l.method)||!I)?kw({request:l,path:s,pattern:o,match:u,lazyHandlerPromise:N==null?void 0:N.handler,lazyRoutePromise:N==null?void 0:N.route,handlerOverride:w,scopedContext:m}):Promise.resolve({type:"data",result:void 0})}}}function oi(t,a,l,s,o,u,f,m,p=null){return o.map(g=>g.route.id!==u.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:p,shouldCallHandler:()=>!1,_lazyPromises:yb(t,a,l,g,f),resolve:()=>Promise.resolve({type:"data",result:void 0})}:$h(t,a,l,s,Uo(o),g,f,m,!0,p))}async function Aw(t,a,l,s,o,u,f){s.some(x=>{var y;return(y=x._lazyPromises)==null?void 0:y.middleware})&&await Promise.all(s.map(x=>{var y;return(y=x._lazyPromises)==null?void 0:y.middleware}));let m={request:a,url:xb(a,l),pattern:Uo(s),params:s[0].params,context:u,matches:s},g=await t({...m,fetcherKey:o,runClientMiddleware:x=>{let y=m;return gb(y,()=>x({...y,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(x=>{var y,N;return[(y=x._lazyPromises)==null?void 0:y.handler,(N=x._lazyPromises)==null?void 0:N.route]}))}catch{}return g}async function kw({request:t,path:a,pattern:l,match:s,lazyHandlerPromise:o,lazyRoutePromise:u,handlerOverride:f,scopedContext:m}){let p,g,x=oa(t.method),y=x?"action":"loader",N=w=>{let S,D=new Promise((I,q)=>S=q);g=()=>S(),t.signal.addEventListener("abort",g);let R=I=>typeof w!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${y}" [routeId: ${s.route.id}]`)):w({request:t,url:xb(t,a),pattern:l,params:s.params,context:m},...I!==void 0?[I]:[]),L=(async()=>{try{return{type:"data",result:await(f?f(q=>R(q)):R())}}catch(I){return{type:"error",result:I}}})();return Promise.race([L,D])};try{let w=x?s.route.action:s.route.loader;if(o||u)if(w){let S,[D]=await Promise.all([N(w).catch(R=>{S=R}),o,u]);if(S!==void 0)throw S;p=D}else{await o;let S=x?s.route.action:s.route.loader;if(S)[p]=await Promise.all([N(S),u]);else if(y==="action"){let D=new URL(t.url),R=D.pathname+D.search;throw Ka(405,{method:t.method,pathname:R,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(w)p=await N(w);else{let S=new URL(t.url),D=S.pathname+S.search;throw Ka(404,{pathname:D})}}catch(w){return{type:"error",result:w}}finally{g&&t.signal.removeEventListener("abort",g)}return p}async function Ow(t){let a=t.headers.get("Content-Type");return a&&/\bapplication\/json\b/.test(a)?t.body==null?null:t.json():t.text()}async function Mw(t){var s,o,u,f,m;let{result:a,type:l}=t;if(rm(a)){let p;try{p=await Ow(a)}catch(g){return{type:"error",error:g}}return l==="error"?{type:"error",error:new zo(a.status,a.statusText,p),statusCode:a.status,headers:a.headers}:{type:"data",data:p,statusCode:a.status,headers:a.headers}}return l==="error"?Py(a)?a.data instanceof Error?{type:"error",error:a.data,statusCode:(s=a.init)==null?void 0:s.status,headers:(o=a.init)!=null&&o.headers?new Headers(a.init.headers):void 0}:{type:"error",error:Bw(a),statusCode:ci(a)?a.status:void 0,headers:(u=a.init)!=null&&u.headers?new Headers(a.init.headers):void 0}:{type:"error",error:a,statusCode:ci(a)?a.status:void 0}:Py(a)?{type:"data",data:a.data,statusCode:(f=a.init)==null?void 0:f.status,headers:(m=a.init)!=null&&m.headers?new Headers(a.init.headers):void 0}:{type:"data",data:a}}function _w(t,a,l,s,o){let u=t.headers.get("Location");if(tt(u,"Redirects returned/thrown from loaders/actions must have a Location header"),!em(u)){let f=s.slice(0,s.findIndex(m=>m.route.id===l)+1);u=Hh(new URL(a.url),f,o,u),t.headers.set("Location",u)}return t}var Lw=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function qh(t){try{return Lw.includes(new URL(t).protocol)}catch{return!1}}function qy(t,a,l,s){if(em(t)){let o=t,u=Wh.test(o)?new URL(Zx(o,a.protocol)):new URL(o);if(qh(u.toString()))throw new Error("Invalid redirect location");let f=Wa(u.pathname,l)!=null;if(u.origin===a.origin&&f)return nm(u.pathname)+u.search+u.hash}try{let o=s.createURL(t);if(qh(o.toString()))throw new Error("Invalid redirect location")}catch{}return t}function li(t,a,l,s){let o=t.createURL(bb(a)).toString(),u={signal:l};if(s&&oa(s.formMethod)){let{formMethod:f,formEncType:m}=s;u.method=f.toUpperCase(),m==="application/json"?(u.headers=new Headers({"Content-Type":m}),u.body=JSON.stringify(s.json)):m==="text/plain"?u.body=s.text:m==="application/x-www-form-urlencoded"&&s.formData?u.body=Ih(s.formData):u.body=s.formData}return new Request(o,u)}function xb(t,a){let l=new URL(t.url),s=typeof a=="string"?Dr(a):a;if(l.pathname=s.pathname||"/",s.search){let o=new URLSearchParams(s.search),u=o.getAll("index");o.delete("index");for(let f of u.filter(Boolean))o.append("index",f);l.search=o.size?`?${o.toString()}`:""}else l.search="";return l.hash=s.hash||"",l}function Ih(t){let a=new URLSearchParams;for(let[l,s]of t.entries())a.append(l,typeof s=="string"?s:s.name);return a}function Iy(t){let a=new FormData;for(let[l,s]of t.entries())a.append(l,s);return a}function zw(t,a,l,s=!1,o=!1){let u={},f=null,m,p=!1,g={},x=l&&La(l[1])?l[1].error:void 0;return t.forEach(y=>{if(!(y.route.id in a))return;let N=y.route.id,w=a[N];if(tt(!us(w),"Cannot handle redirect results in processLoaderData"),La(w)){let S=w.error;if(x!==void 0&&(S=x,x=void 0),f=f||{},o)f[N]=S;else{let D=Ll(t,N);f[D.route.id]==null&&(f[D.route.id]=S)}s||(u[N]=fb),p||(p=!0,m=ci(w.error)?w.error.status:500),w.headers&&(g[N]=w.headers)}else u[N]=w.data,w.statusCode&&w.statusCode!==200&&!p&&(m=w.statusCode),w.headers&&(g[N]=w.headers)}),x!==void 0&&l&&(f={[l[0]]:x},l[2]&&(u[l[2]]=void 0)),{loaderData:u,errors:f,statusCode:m||200,loaderHeaders:g}}function Vy(t,a,l,s,o,u,f){let{loaderData:m,errors:p}=zw(a,l,s);return o.filter(g=>!g.matches||g.matches.some(x=>x.shouldLoad)).forEach(g=>{let{key:x,match:y,controller:N}=g;if(N&&N.signal.aborted)return;let w=u[x];if(tt(w,"Did not find corresponding fetcher result"),La(w)){let S=Ll(t.matches,y==null?void 0:y.route.id);p&&p[S.route.id]||(p={...p,[S.route.id]:w.error}),f.delete(x)}else if(us(w))tt(!1,"Unhandled fetcher revalidation redirect");else{let S=Nr(w.data);f.set(x,S)}}),{loaderData:m,errors:p}}function Yy(t,a,l,s){let o=Object.entries(a).filter(([,u])=>u!==fb).reduce((u,[f,m])=>(u[f]=m,u),{});for(let u of l){let f=u.route.id;if(!a.hasOwnProperty(f)&&t.hasOwnProperty(f)&&u.route.loader&&(o[f]=t[f]),s&&s.hasOwnProperty(f))break}return o}function Fy(t){return t?La(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Ll(t,a){return(a?t.slice(0,t.findIndex(s=>s.route.id===a)+1):[...t]).reverse().find(s=>s.route.hasErrorBoundary===!0)||t[0]}function ic(t){let a=t.length===1?t[0]:t.find(l=>l.index||!l.path||l.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:a}],route:a}}function Ka(t,{pathname:a,routeId:l,method:s,type:o,message:u}={}){let f="Unknown Server Error",m="Unknown @remix-run/router error";return t===400?(f="Bad Request",s&&a&&l?m=`You made a ${s} request to "${a}" but did not provide a \`loader\` for route "${l}", so there is no way to handle the request.`:o==="invalid-body"&&(m="Unable to encode submission body")):t===403?(f="Forbidden",m=`Route "${l}" does not match URL "${a}"`):t===404?(f="Not Found",m=`No route matches URL "${a}"`):t===405&&(f="Method Not Allowed",s&&a&&l?m=`You made a ${s.toUpperCase()} request to "${a}" but did not provide an \`action\` for route "${l}", so there is no way to handle the request.`:s&&(m=`Invalid request method "${s.toUpperCase()}"`)),new zo(t||500,f,new Error(m),!0)}function oc(t){let a=Object.entries(t);for(let l=a.length-1;l>=0;l--){let[s,o]=a[l];if(us(o))return{key:s,result:o}}}function bb(t){let a=typeof t=="string"?Dr(t):t;return Cr({...a,hash:""})}function Uw(t,a){return t.pathname!==a.pathname||t.search!==a.search?!1:t.hash===""?a.hash!=="":t.hash===a.hash?!0:a.hash!==""}function Bw(t){var a,l;return new zo(((a=t.init)==null?void 0:a.status)??500,((l=t.init)==null?void 0:l.statusText)??"Internal Server Error",t.data)}function Hw(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([a,l])=>typeof a=="string"&&$w(l))}function $w(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function qw(t){return rm(t.result)&&ub.has(t.result.status)}function La(t){return t.type==="error"}function us(t){return(t&&t.type)==="redirect"}function Py(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function rm(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Iw(t){return ub.has(t)}function Vw(t){return rm(t)&&Iw(t.status)&&t.headers.has("Location")}function Yw(t){return xw.has(t.toUpperCase())}function oa(t){return vw.has(t.toUpperCase())}function lm(t){return new URLSearchParams(t).getAll("index").some(a=>a==="")}function bc(t,a){let l=typeof a=="string"?Dr(a).search:a.search;if(t[t.length-1].route.index&&lm(l||""))return t[t.length-1];let s=rb(t);return s[s.length-1]}function Gy(t){let{formMethod:a,formAction:l,formEncType:s,text:o,formData:u,json:f}=t;if(!(!a||!l||!s)){if(o!=null)return{formMethod:a,formAction:l,formEncType:s,formData:void 0,json:void 0,text:o};if(u!=null)return{formMethod:a,formAction:l,formEncType:s,formData:u,json:void 0,text:void 0};if(f!==void 0)return{formMethod:a,formAction:l,formEncType:s,formData:void 0,json:f,text:void 0}}}function gh(t,a,l,s){return s?{state:"loading",location:t,matches:a,historyAction:l,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:t,matches:a,historyAction:l,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Fw(t,a,l,s){return{state:"submitting",location:t,matches:a,historyAction:l,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function uo(t,a){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:a}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:a}}function Pw(t,a){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:a?a.data:void 0}}function Nr(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Gw(t,a){try{let l=t.sessionStorage.getItem(db);if(l){let s=JSON.parse(l);for(let[o,u]of Object.entries(s||{}))u&&Array.isArray(u)&&a.set(o,new Set(u||[]))}}catch{}}function Xw(t,a){if(a.size>0){let l={};for(let[s,o]of a)l[s]=[...o];try{t.sessionStorage.setItem(db,JSON.stringify(l))}catch(s){bn(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function Xy(){let t,a,l=new Promise((s,o)=>{t=async u=>{s(u);try{await l}catch{}},a=async u=>{o(u);try{await l}catch{}}});return{promise:l,resolve:t,reject:a}}var hs=v.createContext(null);hs.displayName="DataRouter";var fi=v.createContext(null);fi.displayName="DataRouterState";var Sb=v.createContext(!1);function wb(){return v.useContext(Sb)}var sm=v.createContext({isTransitioning:!1});sm.displayName="ViewTransition";var im=v.createContext(new Map);im.displayName="Fetchers";var Qw=v.createContext(null);Qw.displayName="Await";var er=v.createContext(null);er.displayName="Navigation";var qc=v.createContext(null);qc.displayName="Location";var tr=v.createContext({outlet:null,matches:[],isDataRoute:!1});tr.displayName="Route";var om=v.createContext(null);om.displayName="RouteError";var Eb="REACT_ROUTER_ERROR",Kw="REDIRECT",Zw="ROUTE_ERROR_RESPONSE";function Jw(t){if(t.startsWith(`${Eb}:${Kw}:{`))try{let a=JSON.parse(t.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function Ww(t){if(t.startsWith(`${Eb}:${Zw}:{`))try{let a=JSON.parse(t.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new zo(a.status,a.statusText,a.data)}catch{}}function eE(t,{relative:a}={}){tt(Bo(),"useHref() may be used only in the context of a <Router> component.");let{basename:l,navigator:s}=v.useContext(er),{hash:o,pathname:u,search:f}=Ho(t,{relative:a}),m=u;return l!=="/"&&(m=u==="/"?l:Ja([l,u])),s.createHref({pathname:m,search:f,hash:o})}function Bo(){return v.useContext(qc)!=null}function fr(){return tt(Bo(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(qc).location}var Nb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Rb(t){v.useContext(er).static||v.useLayoutEffect(t)}function Ar(){let{isDataRoute:t}=v.useContext(tr);return t?mE():tE()}function tE(){tt(Bo(),"useNavigate() may be used only in the context of a <Router> component.");let t=v.useContext(hs),{basename:a,navigator:l}=v.useContext(er),{matches:s}=v.useContext(tr),{pathname:o}=fr(),u=JSON.stringify(tm(s)),f=v.useRef(!1);return Rb(()=>{f.current=!0}),v.useCallback((p,g={})=>{if(bn(f.current,Nb),!f.current)return;if(typeof p=="number"){l.go(p);return}let x=$c(p,JSON.parse(u),o,g.relative==="path");t==null&&a!=="/"&&(x.pathname=x.pathname==="/"?a:Ja([a,x.pathname])),(g.replace?l.replace:l.push)(x,g.state,g)},[a,l,u,o,t])}var nE=v.createContext(null);function aE(t){let a=v.useContext(tr).outlet;return v.useMemo(()=>a&&v.createElement(nE.Provider,{value:t},a),[a,t])}function rE(){let{matches:t}=v.useContext(tr),a=t[t.length-1];return(a==null?void 0:a.params)??{}}function Ho(t,{relative:a}={}){let{matches:l}=v.useContext(tr),{pathname:s}=fr(),o=JSON.stringify(tm(l));return v.useMemo(()=>$c(t,JSON.parse(o),s,a==="path"),[t,o,s,a])}function lE(t,a,l){tt(Bo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(er),{matches:o}=v.useContext(tr),u=o[o.length-1],f=u?u.params:{},m=u?u.pathname:"/",p=u?u.pathnameBase:"/",g=u&&u.route;{let R=g&&g.path||"";Db(m,!g||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
+
61
+ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let x=fr(),y;y=x;let N=y.pathname||"/",w=N;if(p!=="/"){let R=p.replace(/^\//,"").split("/");w="/"+N.replace(/^\//,"").split("/").slice(R.length).join("/")}let S=l&&l.state.matches.length?l.state.matches.map(R=>Object.assign(R,{route:l.manifest[R.route.id]||R.route})):Wx(t,{pathname:w});return bn(g||S!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),bn(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),cE(S&&S.map(R=>Object.assign({},R,{params:Object.assign({},f,R.params),pathname:Ja([p,s.encodeLocation?s.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?p:Ja([p,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),o,l)}function sE(){let t=Cb(),a=ci(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),l=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},u={padding:"2px 4px",backgroundColor:s},f=null;return console.error("Error handled by React Router default ErrorBoundary:",t),f=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:u},"ErrorBoundary")," or"," ",v.createElement("code",{style:u},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},a),l?v.createElement("pre",{style:o},l):null,f)}var iE=v.createElement(sE,null),jb=class extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,a){return a.location!==t.location||a.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:a.error,location:a.location,revalidation:t.revalidation||a.revalidation}}componentDidCatch(t,a){this.props.onError?this.props.onError(t,a):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const l=Ww(t.digest);l&&(t=l)}let a=t!==void 0?v.createElement(tr.Provider,{value:this.props.routeContext},v.createElement(om.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?v.createElement(oE,{error:t},a):a}};jb.contextType=Sb;var vh=new WeakMap;function oE({children:t,error:a}){let{basename:l}=v.useContext(er);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let s=Jw(a.digest);if(s){let o=vh.get(a);if(o)throw o;let u=sb(s.location,l),f=u.absoluteURL||u.to;if(qh(f))throw new Error("Invalid redirect location");if(lb&&!vh.get(a))if(u.isExternal||s.reloadDocument)window.location.href=f;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw vh.set(a,m),m}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f}`})}}return t}function uE({routeContext:t,match:a,children:l}){let s=v.useContext(hs);return s&&s.static&&s.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=a.route.id),v.createElement(tr.Provider,{value:t},l)}function cE(t,a=[],l){let s=l==null?void 0:l.state;if(t==null){if(!s)return null;if(s.errors)t=s.matches;else if(a.length===0&&!s.initialized&&s.matches.length>0)t=s.matches;else return null}let o=t,u=s==null?void 0:s.errors;if(u!=null){let x=o.findIndex(y=>y.route.id&&(u==null?void 0:u[y.route.id])!==void 0);tt(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),o=o.slice(0,Math.min(o.length,x+1))}let f=!1,m=-1;if(l&&s){f=s.renderFallback;for(let x=0;x<o.length;x++){let y=o[x];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(m=x),y.route.id){let{loaderData:N,errors:w}=s,S=y.route.loader&&!N.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||S){l.isStatic&&(f=!0),m>=0?o=o.slice(0,m+1):o=[o[0]];break}}}}let p=l==null?void 0:l.onError,g=s&&p?(x,y)=>{var N,w;p(x,{location:s.location,params:((w=(N=s.matches)==null?void 0:N[0])==null?void 0:w.params)??{},pattern:Uo(s.matches),errorInfo:y})}:void 0;return o.reduceRight((x,y,N)=>{let w,S=!1,D=null,R=null;s&&(w=u&&y.route.id?u[y.route.id]:void 0,D=y.route.errorElement||iE,f&&(m<0&&N===0?(Db("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,R=null):m===N&&(S=!0,R=y.route.hydrateFallbackElement||null)));let L=a.concat(o.slice(0,N+1)),I=()=>{let q;return w?q=D:S?q=R:y.route.Component?q=v.createElement(y.route.Component,null):y.route.element?q=y.route.element:q=x,v.createElement(uE,{match:y,routeContext:{outlet:x,matches:L,isDataRoute:s!=null},children:q})};return s&&(y.route.ErrorBoundary||y.route.errorElement||N===0)?v.createElement(jb,{location:s.location,revalidation:s.revalidation,component:D,error:w,children:I(),routeContext:{outlet:null,matches:L,isDataRoute:!0},onError:g}):I()},null)}function um(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tb(t){let a=v.useContext(hs);return tt(a,um(t)),a}function $o(t){let a=v.useContext(fi);return tt(a,um(t)),a}function dE(t){let a=v.useContext(tr);return tt(a,um(t)),a}function Ic(t){let a=dE(t),l=a.matches[a.matches.length-1];return tt(l.route.id,`${t} can only be used on routes that contain a unique "id"`),l.route.id}function fE(){return Ic("useRouteId")}function kr(){let t=$o("useNavigation");return v.useMemo(()=>{let{matches:a,historyAction:l,...s}=t.navigation;return s},[t.navigation])}function hE(){let t=Tb("useRevalidator"),a=$o("useRevalidator"),l=v.useCallback(async()=>{await t.router.revalidate()},[t.router]);return v.useMemo(()=>({revalidate:l,state:a.revalidation}),[l,a.revalidation])}function ll(){let t=$o("useLoaderData"),a=Ic("useLoaderData");return t.loaderData[a]}function ms(t){return $o("useRouteLoaderData").loaderData[t]}function Cb(){var s;let t=v.useContext(om),a=$o("useRouteError"),l=Ic("useRouteError");return t!==void 0?t:(s=a.errors)==null?void 0:s[l]}function mE(){let{router:t}=Tb("useNavigate"),a=Ic("useNavigate"),l=v.useRef(!1);return Rb(()=>{l.current=!0}),v.useCallback(async(o,u={})=>{bn(l.current,Nb),l.current&&(typeof o=="number"?await t.navigate(o):await t.navigate(o,{fromRouteId:a,...u}))},[t,a])}var Qy={};function Db(t,a,l){!a&&!Qy[t]&&(Qy[t]=!0,bn(!1,l))}var Ky={};function Zy(t,a){!t&&!Ky[a]&&(Ky[a]=!0,console.warn(a))}var pE="useOptimistic",Jy=OS[pE],gE=()=>{};function vE(t){return Jy?Jy(t):[t,gE]}function yE(t){let a={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&bn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(a,{element:v.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&bn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(a,{hydrateFallbackElement:v.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&bn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(a,{errorElement:v.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),a}var xE=["HydrateFallback","hydrateFallbackElement"],bE=class{constructor(){this.status="pending",this.promise=new Promise((t,a)=>{this.resolve=l=>{this.status==="pending"&&(this.status="resolved",t(l))},this.reject=l=>{this.status==="pending"&&(this.status="rejected",a(l))}})}};function SE({router:t,flushSync:a,onError:l,useTransitions:s}){s=wb()||s;let[u,f]=v.useState(t.state),[m,p]=vE(u),[g,x]=v.useState(),[y,N]=v.useState({isTransitioning:!1}),[w,S]=v.useState(),[D,R]=v.useState(),[L,I]=v.useState(),q=v.useRef(new Map),X=v.useCallback((T,{deletedFetchers:ee,newErrors:fe,flushSync:be,viewTransitionOpts:ye})=>{fe&&l&&Object.values(fe).forEach(re=>{var ge;return l(re,{location:T.location,params:((ge=T.matches[0])==null?void 0:ge.params)??{},pattern:Uo(T.matches)})}),T.fetchers.forEach((re,ge)=>{re.data!==void 0&&q.current.set(ge,re.data)}),ee.forEach(re=>q.current.delete(re)),Zy(be===!1||a!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let te=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(Zy(ye==null||te,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!ye||!te){a&&be?a(()=>f(T)):s===!1?f(T):v.startTransition(()=>{s===!0&&p(re=>Wy(re,T)),f(T)});return}if(a&&be){a(()=>{D&&(w==null||w.resolve(),D.skipTransition()),N({isTransitioning:!0,flushSync:!0,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation})});let re=t.window.document.startViewTransition(()=>{a(()=>f(T))});re.finished.finally(()=>{a(()=>{S(void 0),R(void 0),x(void 0),N({isTransitioning:!1})})}),a(()=>R(re));return}D?(w==null||w.resolve(),D.skipTransition(),I({state:T,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation})):(x(T),N({isTransitioning:!0,flushSync:!1,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation}))},[t.window,a,D,w,s,p,l]);v.useLayoutEffect(()=>t.subscribe(X),[t,X]),v.useEffect(()=>{y.isTransitioning&&!y.flushSync&&S(new bE)},[y]),v.useEffect(()=>{if(w&&g&&t.window){let T=g,ee=w.promise,fe=t.window.document.startViewTransition(async()=>{s===!1?f(T):v.startTransition(()=>{s===!0&&p(be=>Wy(be,T)),f(T)}),await ee});fe.finished.finally(()=>{S(void 0),R(void 0),x(void 0),N({isTransitioning:!1})}),R(fe)}},[g,w,t.window,s,p]),v.useEffect(()=>{w&&g&&m.location.key===g.location.key&&w.resolve()},[w,D,m.location,g]),v.useEffect(()=>{!y.isTransitioning&&L&&(x(L.state),N({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}),I(void 0))},[y.isTransitioning,L]);let W=v.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:T=>t.navigate(T),push:(T,ee,fe)=>t.navigate(T,{state:ee,preventScrollReset:fe==null?void 0:fe.preventScrollReset}),replace:(T,ee,fe)=>t.navigate(T,{replace:!0,state:ee,preventScrollReset:fe==null?void 0:fe.preventScrollReset})}),[t]),ae=t.basename||"/",z=v.useMemo(()=>({router:t,navigator:W,static:!1,basename:ae,onError:l}),[t,W,ae,l]);return v.createElement(v.Fragment,null,v.createElement(hs.Provider,{value:z},v.createElement(fi.Provider,{value:m},v.createElement(im.Provider,{value:q.current},v.createElement(sm.Provider,{value:y},v.createElement(NE,{basename:ae,location:m.location,navigationType:m.historyAction,navigator:W,useTransitions:s},v.createElement(wE,{routes:t.routes,manifest:t.manifest,future:t.future,state:m,isStatic:!1,onError:l})))))),null)}function Wy(t,a){return{...t,navigation:a.navigation.state!=="idle"?a.navigation:t.navigation,revalidation:a.revalidation!=="idle"?a.revalidation:t.revalidation,actionData:a.navigation.state!=="submitting"?a.actionData:t.actionData,fetchers:a.fetchers}}var wE=v.memo(EE);function EE({routes:t,manifest:a,future:l,state:s,isStatic:o,onError:u}){return lE(t,void 0,{manifest:a,state:s,isStatic:o,onError:u})}function hi(t){return aE(t.context)}function NE({basename:t="/",children:a=null,location:l,navigationType:s="POP",navigator:o,static:u=!1,useTransitions:f}){tt(!Bo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=t.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:m,navigator:o,static:u,useTransitions:f,future:{}}),[m,o,u,f]);typeof l=="string"&&(l=Dr(l));let{pathname:g="/",search:x="",hash:y="",state:N=null,key:w="default",mask:S}=l,D=v.useMemo(()=>{let R=Wa(g,m);return R==null?null:{location:{pathname:R,search:x,hash:y,state:N,key:w,mask:S},navigationType:s}},[m,g,x,y,N,w,s,S]);return bn(D!=null,`<Router basename="${m}"> is not able to match the URL "${g}${x}${y}" because it does not start with the basename, so the <Router> won't render anything.`),D==null?null:v.createElement(er.Provider,{value:p},v.createElement(qc.Provider,{children:a,value:D}))}var Sc="get",wc="application/x-www-form-urlencoded";function Vc(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function RE(t){return Vc(t)&&t.tagName.toLowerCase()==="button"}function jE(t){return Vc(t)&&t.tagName.toLowerCase()==="form"}function TE(t){return Vc(t)&&t.tagName.toLowerCase()==="input"}function CE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function DE(t,a){return t.button===0&&(!a||a==="_self")&&!CE(t)}function Vh(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((a,l)=>{let s=t[l];return a.concat(Array.isArray(s)?s.map(o=>[l,o]):[[l,s]])},[]))}function AE(t,a){let l=Vh(t);return a&&a.forEach((s,o)=>{l.has(o)||a.getAll(o).forEach(u=>{l.append(o,u)})}),l}var uc=null;function kE(){if(uc===null)try{new FormData(document.createElement("form"),0),uc=!1}catch{uc=!0}return uc}var OE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yh(t){return t!=null&&!OE.has(t)?(bn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wc}"`),null):t}function ME(t,a){let l,s,o,u,f;if(jE(t)){let m=t.getAttribute("action");s=m?Wa(m,a):null,l=t.getAttribute("method")||Sc,o=yh(t.getAttribute("enctype"))||wc,u=new FormData(t)}else if(RE(t)||TE(t)&&(t.type==="submit"||t.type==="image")){let m=t.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=t.getAttribute("formaction")||m.getAttribute("action");if(s=p?Wa(p,a):null,l=t.getAttribute("formmethod")||m.getAttribute("method")||Sc,o=yh(t.getAttribute("formenctype"))||yh(m.getAttribute("enctype"))||wc,u=new FormData(m,t),!kE()){let{name:g,type:x,value:y}=t;if(x==="image"){let N=g?`${g}.`:"";u.append(`${N}x`,"0"),u.append(`${N}y`,"0")}else g&&u.append(g,y)}}else{if(Vc(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');l=Sc,s=null,o=wc,f=t}return u&&o==="text/plain"&&(f=u,u=void 0),{action:s,method:l.toLowerCase(),encType:o,formData:u,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function cm(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Ab(t,a,l,s){let o=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return l?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:a&&Wa(o.pathname,a)==="/"?o.pathname=`${Cc(a)}/_root.${s}`:o.pathname=`${Cc(o.pathname)}.${s}`,o}async function _E(t,a){if(t.id in a)return a[t.id];try{let l=await import(t.module);return a[t.id]=l,l}catch(l){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(l),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function LE(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function zE(t,a,l){let s=await Promise.all(t.map(async o=>{let u=a.routes[o.route.id];if(u){let f=await _E(u,l);return f.links?f.links():[]}return[]}));return $E(s.flat(1).filter(LE).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function ex(t,a,l,s,o,u){let f=(p,g)=>l[g]?p.route.id!==l[g].route.id:!0,m=(p,g)=>{var x;return l[g].pathname!==p.pathname||((x=l[g].route.path)==null?void 0:x.endsWith("*"))&&l[g].params["*"]!==p.params["*"]};return u==="assets"?a.filter((p,g)=>f(p,g)||m(p,g)):u==="data"?a.filter((p,g)=>{var y;let x=s.routes[p.route.id];if(!x||!x.hasLoader)return!1;if(f(p,g)||m(p,g))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((y=l[0])==null?void 0:y.params)||{},nextUrl:new URL(t,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function UE(t,a,{includeHydrateFallback:l}={}){return BE(t.map(s=>{let o=a.routes[s.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),l&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function BE(t){return[...new Set(t)]}function HE(t){let a={},l=Object.keys(t).sort();for(let s of l)a[s]=t[s];return a}function $E(t,a){let l=new Set;return new Set(a),t.reduce((s,o)=>{let u=JSON.stringify(HE(o));return l.has(u)||(l.add(u),s.push({key:u,link:o})),s},[])}function dm(){let t=v.useContext(hs);return cm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function qE(){let t=v.useContext(fi);return cm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var fm=v.createContext(void 0);fm.displayName="FrameworkContext";function Yc(){let t=v.useContext(fm);return cm(t,"You must render this element inside a <HydratedRouter> element"),t}function IE(t,a){let l=v.useContext(fm),[s,o]=v.useState(!1),[u,f]=v.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:g,onMouseLeave:x,onTouchStart:y}=a,N=v.useRef(null);v.useEffect(()=>{if(t==="render"&&f(!0),t==="viewport"){let D=L=>{L.forEach(I=>{f(I.isIntersecting)})},R=new IntersectionObserver(D,{threshold:.5});return N.current&&R.observe(N.current),()=>{R.disconnect()}}},[t]),v.useEffect(()=>{if(s){let D=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(D)}}},[s]);let w=()=>{o(!0)},S=()=>{o(!1),f(!1)};return l?t!=="intent"?[u,N,{}]:[u,N,{onFocus:co(m,w),onBlur:co(p,S),onMouseEnter:co(g,w),onMouseLeave:co(x,S),onTouchStart:co(y,w)}]:[!1,N,{}]}function co(t,a){return l=>{t&&t(l),l.defaultPrevented||a(l)}}function VE({page:t,...a}){let l=wb(),{nonce:s}=Yc(),{router:o}=dm(),u=v.useMemo(()=>Wx(o.routes,t,o.basename),[o.routes,t,o.basename]);return u?(a.nonce==null&&s&&(a={...a,nonce:s}),l?v.createElement(FE,{page:t,matches:u,...a}):v.createElement(PE,{page:t,matches:u,...a})):null}function YE(t){let{manifest:a,routeModules:l}=Yc(),[s,o]=v.useState([]);return v.useEffect(()=>{let u=!1;return zE(t,a,l).then(f=>{u||o(f)}),()=>{u=!0}},[t,a,l]),s}function FE({page:t,matches:a,...l}){let s=fr(),{future:o}=Yc(),{basename:u}=dm(),f=v.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let m=Ab(t,u,o.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let x of a)typeof x.route.shouldRevalidate=="function"?p=!0:g.push(x.route.id);return p&&g.length>0&&m.searchParams.set("_routes",g.join(",")),[m.pathname+m.search]},[u,o.v8_trailingSlashAwareDataRequests,t,s,a]);return v.createElement(v.Fragment,null,f.map(m=>v.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...l})))}function PE({page:t,matches:a,...l}){let s=fr(),{future:o,manifest:u,routeModules:f}=Yc(),{basename:m}=dm(),{loaderData:p,matches:g}=qE(),x=v.useMemo(()=>ex(t,a,g,u,s,"data"),[t,a,g,u,s]),y=v.useMemo(()=>ex(t,a,g,u,s,"assets"),[t,a,g,u,s]),N=v.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let D=new Set,R=!1;if(a.forEach(I=>{var X;let q=u.routes[I.route.id];!q||!q.hasLoader||(!x.some(W=>W.route.id===I.route.id)&&I.route.id in p&&((X=f[I.route.id])!=null&&X.shouldRevalidate)||q.hasClientLoader?R=!0:D.add(I.route.id))}),D.size===0)return[];let L=Ab(t,m,o.v8_trailingSlashAwareDataRequests,"data");return R&&D.size>0&&L.searchParams.set("_routes",a.filter(I=>D.has(I.route.id)).map(I=>I.route.id).join(",")),[L.pathname+L.search]},[m,o.v8_trailingSlashAwareDataRequests,p,s,u,x,a,t,f]),w=v.useMemo(()=>UE(y,u),[y,u]),S=YE(y);return v.createElement(v.Fragment,null,N.map(D=>v.createElement("link",{key:D,rel:"prefetch",as:"fetch",href:D,...l})),w.map(D=>v.createElement("link",{key:D,rel:"modulepreload",href:D,...l})),S.map(({key:D,link:R})=>v.createElement("link",{key:D,nonce:l.nonce,...R,crossOrigin:R.crossOrigin??l.crossOrigin})))}function GE(...t){return a=>{t.forEach(l=>{typeof l=="function"?l(a):l!=null&&(l.current=a)})}}var XE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{XE&&(window.__reactRouterVersion="7.18.0")}catch{}function QE(t,a){return Ew({basename:a==null?void 0:a.basename,getContext:a==null?void 0:a.getContext,future:a==null?void 0:a.future,history:HS({window:a==null?void 0:a.window}),hydrationData:KE(),routes:t,mapRouteProperties:yE,hydrationRouteProperties:xE,dataStrategy:a==null?void 0:a.dataStrategy,patchRoutesOnNavigation:a==null?void 0:a.patchRoutesOnNavigation,window:a==null?void 0:a.window,instrumentations:a==null?void 0:a.instrumentations}).initialize()}function KE(){let t=window==null?void 0:window.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:ZE(t.errors)}),t}function ZE(t){if(!t)return null;let a=Object.entries(t),l={};for(let[s,o]of a)if(o&&o.__type==="RouteErrorResponse")l[s]=new zo(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&cw.includes(o.__subType)){let u=window[o.__subType];if(typeof u=="function")try{let f=new u(o.message);f.stack="",l[s]=f}catch{}}if(l[s]==null){let u=new Error(o.message);u.stack="",l[s]=u}}else l[s]=o;return l}var Ye=v.forwardRef(function({onClick:a,discover:l="render",prefetch:s="none",relative:o,reloadDocument:u,replace:f,mask:m,state:p,target:g,to:x,preventScrollReset:y,viewTransition:N,defaultShouldRevalidate:w,...S},D){let{basename:R,navigator:L,useTransitions:I}=v.useContext(er),q=typeof x=="string"&&Hc.test(x),X=sb(x,R);x=X.to;let W=eE(x,{relative:o}),ae=fr(),z=null;if(m){let ge=$c(m,[],ae.mask?ae.mask.pathname:"/",!0);R!=="/"&&(ge.pathname=ge.pathname==="/"?R:Ja([R,ge.pathname])),z=L.createHref(ge)}let[T,ee,fe]=IE(s,S),be=WE(x,{replace:f,mask:m,state:p,target:g,preventScrollReset:y,relative:o,viewTransition:N,defaultShouldRevalidate:w,useTransitions:I});function ye(ge){a&&a(ge),ge.defaultPrevented||be(ge)}let te=!(X.isExternal||u),re=v.createElement("a",{...S,...fe,href:(te?z:void 0)||X.absoluteURL||W,onClick:te?ye:a,ref:GE(D,ee),target:g,"data-discover":!q&&l==="render"?"true":void 0});return T&&!q?v.createElement(v.Fragment,null,re,v.createElement(VE,{page:W})):re});Ye.displayName="Link";var kb=v.forwardRef(function({"aria-current":a="page",caseSensitive:l=!1,className:s="",end:o=!1,style:u,to:f,viewTransition:m,children:p,...g},x){let y=Ho(f,{relative:g.relative}),N=fr(),w=v.useContext(fi),{navigator:S,basename:D}=v.useContext(er),R=w!=null&&aN(y)&&m===!0,L=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,I=N.pathname,q=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;l||(I=I.toLowerCase(),q=q?q.toLowerCase():null,L=L.toLowerCase()),q&&D&&(q=Wa(q,D)||q);const X=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let W=I===L||!o&&I.startsWith(L)&&I.charAt(X)==="/",ae=q!=null&&(q===L||!o&&q.startsWith(L)&&q.charAt(L.length)==="/"),z={isActive:W,isPending:ae,isTransitioning:R},T=W?a:void 0,ee;typeof s=="function"?ee=s(z):ee=[s,W?"active":null,ae?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let fe=typeof u=="function"?u(z):u;return v.createElement(Ye,{...g,"aria-current":T,className:ee,ref:x,style:fe,to:f,viewTransition:m},typeof p=="function"?p(z):p)});kb.displayName="NavLink";var ca=v.forwardRef(({discover:t="render",fetcherKey:a,navigate:l,reloadDocument:s,replace:o,state:u,method:f=Sc,action:m,onSubmit:p,relative:g,preventScrollReset:x,viewTransition:y,defaultShouldRevalidate:N,...w},S)=>{let{useTransitions:D}=v.useContext(er),R=mm(),L=nN(m,{relative:g}),I=f.toLowerCase()==="get"?"get":"post",q=typeof m=="string"&&Hc.test(m),X=W=>{if(p&&p(W),W.defaultPrevented)return;W.preventDefault();let ae=W.nativeEvent.submitter,z=(ae==null?void 0:ae.getAttribute("formmethod"))||f,T=()=>R(ae||W.currentTarget,{fetcherKey:a,method:z,navigate:l,replace:o,state:u,relative:g,preventScrollReset:x,viewTransition:y,defaultShouldRevalidate:N});D&&l!==!1?v.startTransition(()=>T()):T()};return v.createElement("form",{ref:S,method:I,action:L,onSubmit:s?p:X,...w,"data-discover":!q&&t==="render"?"true":void 0})});ca.displayName="Form";function Ob(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hm(t){let a=v.useContext(hs);return tt(a,Ob(t)),a}function JE(t){let a=v.useContext(fi);return tt(a,Ob(t)),a}function WE(t,{target:a,replace:l,mask:s,state:o,preventScrollReset:u,relative:f,viewTransition:m,defaultShouldRevalidate:p,useTransitions:g}={}){let x=Ar(),y=fr(),N=Ho(t,{relative:f});return v.useCallback(w=>{if(DE(w,a)){w.preventDefault();let S=l!==void 0?l:Cr(y)===Cr(N),D=()=>x(t,{replace:S,mask:s,state:o,preventScrollReset:u,relative:f,viewTransition:m,defaultShouldRevalidate:p});g?v.startTransition(()=>D()):D()}},[y,x,N,l,s,o,a,t,u,f,m,p,g])}function qo(t){bn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let a=v.useRef(Vh(t)),l=v.useRef(!1),s=fr(),o=v.useMemo(()=>AE(s.search,l.current?null:a.current),[s.search]),u=Ar(),f=v.useCallback((m,p)=>{const g=Vh(typeof m=="function"?m(new URLSearchParams(o)):m);l.current=!0,u("?"+g,p)},[u,o]);return[o,f]}var eN=0,tN=()=>`__${String(++eN)}__`;function mm(){let{router:t}=hm("useSubmit"),{basename:a}=v.useContext(er),l=fE(),s=t.fetch,o=t.navigate;return v.useCallback(async(u,f={})=>{let{action:m,method:p,encType:g,formData:x,body:y}=ME(u,a);if(f.navigate===!1){let N=f.fetcherKey||tN();await s(N,l,f.action||m,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:x,body:y,formMethod:f.method||p,formEncType:f.encType||g,flushSync:f.flushSync})}else await o(f.action||m,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:x,body:y,formMethod:f.method||p,formEncType:f.encType||g,replace:f.replace,state:f.state,fromRouteId:l,flushSync:f.flushSync,viewTransition:f.viewTransition})},[s,o,a,l])}function nN(t,{relative:a}={}){let{basename:l}=v.useContext(er),s=v.useContext(tr);tt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),u={...Ho(t||".",{relative:a})},f=fr();if(t==null){u.search=f.search;let m=new URLSearchParams(u.search),p=m.getAll("index");if(p.some(x=>x==="")){m.delete("index"),p.filter(y=>y).forEach(y=>m.append("index",y));let x=m.toString();u.search=x?`?${x}`:""}}return(!t||t===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(u.pathname=u.pathname==="/"?l:Ja([l,u.pathname])),Cr(u)}function ds({key:t}={}){var W;let{router:a}=hm("useFetcher"),l=JE("useFetcher"),s=v.useContext(im),o=v.useContext(tr),u=(W=o.matches[o.matches.length-1])==null?void 0:W.route.id;tt(s,"useFetcher must be used inside a FetchersContext"),tt(o,"useFetcher must be used inside a RouteContext"),tt(u!=null,'useFetcher can only be used on routes that contain a unique "id"');let f=v.useId(),[m,p]=v.useState(t||f);t&&t!==m&&p(t);let{deleteFetcher:g,getFetcher:x,resetFetcher:y,fetch:N}=a;v.useEffect(()=>(x(m),()=>g(m)),[g,x,m]);let w=v.useCallback(async(ae,z)=>{tt(u,"No routeId available for fetcher.load()"),await N(m,u,ae,z)},[m,u,N]),S=mm(),D=v.useCallback(async(ae,z)=>{await S(ae,{...z,navigate:!1,fetcherKey:m})},[m,S]),R=v.useCallback(ae=>y(m,ae),[y,m]),L=v.useMemo(()=>{let ae=v.forwardRef((z,T)=>v.createElement(ca,{...z,navigate:!1,fetcherKey:m,ref:T}));return ae.displayName="fetcher.Form",ae},[m]),I=l.fetchers.get(m)||cb,q=s.get(m);return v.useMemo(()=>({Form:L,submit:D,load:w,reset:R,...I,data:q}),[L,D,w,R,I,q])}function aN(t,{relative:a}={}){let l=v.useContext(sm);tt(l!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=hm("useViewTransitionState"),o=Ho(t,{relative:a});if(!l.isTransitioning)return!1;let u=Wa(l.currentLocation.pathname,s)||l.currentLocation.pathname,f=Wa(l.nextLocation.pathname,s)||l.nextLocation.pathname;return Tc(o.pathname,f)!=null||Tc(o.pathname,u)!=null}var rl=Xx();function rN(t){return v.createElement(SE,{flushSync:rl.flushSync,...t})}/**
62
+ * @license lucide-react v1.21.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const Mb=(...t)=>t.filter((a,l,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===l).join(" ").trim();/**
67
+ * @license lucide-react v1.21.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const lN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
72
+ * @license lucide-react v1.21.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const sN=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,s)=>s?s.toUpperCase():l.toLowerCase());/**
77
+ * @license lucide-react v1.21.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const tx=t=>{const a=sN(t);return a.charAt(0).toUpperCase()+a.slice(1)};/**
82
+ * @license lucide-react v1.21.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */var xh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
87
+ * @license lucide-react v1.21.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const iN=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},oN=v.createContext({}),uN=()=>v.useContext(oN),cN=v.forwardRef(({color:t,size:a,strokeWidth:l,absoluteStrokeWidth:s,className:o="",children:u,iconNode:f,...m},p)=>{const{size:g=24,strokeWidth:x=2,absoluteStrokeWidth:y=!1,color:N="currentColor",className:w=""}=uN()??{},S=s??y?Number(l??x)*24/Number(a??g):l??x;return v.createElement("svg",{ref:p,...xh,width:a??g??xh.width,height:a??g??xh.height,stroke:t??N,strokeWidth:S,className:Mb("lucide",w,o),...!u&&!iN(m)&&{"aria-hidden":"true"},...m},[...f.map(([D,R])=>v.createElement(D,R)),...Array.isArray(u)?u:[u]])});/**
92
+ * @license lucide-react v1.21.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const Et=(t,a)=>{const l=v.forwardRef(({className:s,...o},u)=>v.createElement(cN,{ref:u,iconNode:a,className:Mb(`lucide-${lN(tx(t))}`,`lucide-${t}`,s),...o}));return l.displayName=tx(t),l};/**
97
+ * @license lucide-react v1.21.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const dN=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],fN=Et("arrow-down-wide-narrow",dN);/**
102
+ * @license lucide-react v1.21.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const hN=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fc=Et("arrow-left",hN);/**
107
+ * @license lucide-react v1.21.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const mN=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],pN=Et("arrow-up-narrow-wide",mN);/**
112
+ * @license lucide-react v1.21.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const gN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],_b=Et("ban",gN);/**
117
+ * @license lucide-react v1.21.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const vN=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],yN=Et("chart-column",vN);/**
122
+ * @license lucide-react v1.21.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const xN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lb=Et("check",xN);/**
127
+ * @license lucide-react v1.21.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const bN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ps=Et("chevron-down",bN);/**
132
+ * @license lucide-react v1.21.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const SN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zb=Et("chevron-right",SN);/**
137
+ * @license lucide-react v1.21.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const wN=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],EN=Et("circle-check-big",wN);/**
142
+ * @license lucide-react v1.21.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const NN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pm=Et("circle-check",NN);/**
147
+ * @license lucide-react v1.21.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const RN=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],jN=Et("circle-dashed",RN);/**
152
+ * @license lucide-react v1.21.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const TN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],CN=Et("circle-minus",TN);/**
157
+ * @license lucide-react v1.21.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const DN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],Ub=Et("circle-pause",DN);/**
162
+ * @license lucide-react v1.21.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const AN=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Bb=Et("circle-play",AN);/**
167
+ * @license lucide-react v1.21.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const kN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ON=Et("circle-x",kN);/**
172
+ * @license lucide-react v1.21.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const MN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Pc=Et("circle",MN);/**
177
+ * @license lucide-react v1.21.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const _N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],LN=Et("clock",_N);/**
182
+ * @license lucide-react v1.21.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const zN=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Hb=Et("copy",zN);/**
187
+ * @license lucide-react v1.21.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const UN=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],BN=Et("download",UN);/**
192
+ * @license lucide-react v1.21.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const HN=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],$N=Et("git-branch",HN);/**
197
+ * @license lucide-react v1.21.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const qN=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],IN=Et("grip-vertical",qN);/**
202
+ * @license lucide-react v1.21.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const VN=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],YN=Et("house",VN);/**
207
+ * @license lucide-react v1.21.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const FN=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Dc=Et("layers",FN);/**
212
+ * @license lucide-react v1.21.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const PN=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Io=Et("list-todo",PN);/**
217
+ * @license lucide-react v1.21.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const GN=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],XN=Et("locate-fixed",GN);/**
222
+ * @license lucide-react v1.21.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const QN=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],KN=Et("moon",QN);/**
227
+ * @license lucide-react v1.21.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const ZN=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],$b=Et("octagon-alert",ZN);/**
232
+ * @license lucide-react v1.21.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const JN=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],fs=Et("pencil",JN);/**
237
+ * @license lucide-react v1.21.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const WN=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],eR=Et("play",WN);/**
242
+ * @license lucide-react v1.21.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const tR=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],qb=Et("scroll-text",tR);/**
247
+ * @license lucide-react v1.21.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const nR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],aR=Et("search",nR);/**
252
+ * @license lucide-react v1.21.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const rR=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],lR=Et("sun",rR);/**
257
+ * @license lucide-react v1.21.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const sR=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]],iR=Et("timer-reset",sR);/**
262
+ * @license lucide-react v1.21.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const oR=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],di=Et("trash-2",oR);/**
267
+ * @license lucide-react v1.21.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const uR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],cR=Et("x",uR),dR="/api",fR=120,hR=40;function Gc(t){return{...t,number:t.number??0,decisions:t.decisions??[],acceptedDecisions:t.acceptedDecisions??[],checklist:t.checklist??[],subtasks:t.subtasks??[],startedAt:t.startedAt??"",completedAt:t.completedAt??""}}function Xc(t){return{...t,discussedAt:t.discussedAt??"",contextReady:t.contextReady??!1,contextReadyReason:t.contextReadyReason??"",notes:t.notes??"",goals:t.goals??[],nonGoals:t.nonGoals??[],dependencies:t.dependencies??[],risks:t.risks??[],openQuestions:t.openQuestions??[],decisions:t.decisions??[],acceptedDecisions:t.acceptedDecisions??[],completionCriteria:t.completionCriteria??[],taskIds:t.taskIds??[],tasks:(t.tasks??[]).map(Gc),linkedRequirements:t.linkedRequirements??[],handoff:t.handoff??"",handoffUpdatedAt:t.handoffUpdatedAt??""}}function Qc(t){return{...t,number:t.number??0,discussedAt:t.discussedAt??"",contextReady:t.contextReady??!1,contextReadyReason:t.contextReadyReason??"",acceptedDecisions:t.acceptedDecisions??[],phaseIds:t.phaseIds??[]}}function Ib(t){var a,l,s;return{...t,scope:t.scope??[],outOfScope:t.outOfScope??[],decisions:t.decisions??[],globalRules:t.globalRules??[],technologies:t.technologies??[],tools:t.tools??[],acceptedDecisions:t.acceptedDecisions??[],planRoot:t.planRoot??"",projectRoot:t.projectRoot??"",workflowRules:{beforePhaseStart:((a=t.workflowRules)==null?void 0:a.beforePhaseStart)??[],beforeTaskStart:((l=t.workflowRules)==null?void 0:l.beforeTaskStart)??[],afterPhaseComplete:((s=t.workflowRules)==null?void 0:s.afterPhaseComplete)??[]}}}function gm(t){return{...t,description:t.description??"",macroTasks:t.macroTasks??[],linkedPhaseIds:t.linkedPhaseIds??[]}}async function nx(t,a){try{return await fetch(`${dR}${t}`,{headers:{"Content-Type":"application/json"},...a})}catch{throw new Response("Planner web server unavailable. Pi or planner-web may have stopped. Restart the planner web UI or Pi, then reload this page.",{status:503,statusText:"Planner web server unavailable"})}}async function Gt(t,a){let l=await nx(t,a),s=0;for(;l.status===503&&s<hR;)await new Promise(o=>setTimeout(o,fR)),s+=1,l=await nx(t,a);if(!l.ok){const o=await l.text().catch(()=>l.statusText);throw new Response(o||l.statusText,{status:l.status,statusText:l.statusText})}return l.json()}async function Vb(){return Ib(await Gt("/project"))}async function mR(t){return Ib(await Gt("/project",{method:"PUT",body:JSON.stringify(t)}))}async function pR(){return Gt("/ui-config")}async function Yb(){return(await Gt("/features")).map(Qc)}async function Vo(t){return Qc(await Gt(`/features/${t}`))}async function gR(t){return Qc(await Gt("/features",{method:"POST",body:JSON.stringify(t)}))}async function Fb(t){return Qc(await Gt(`/features/${t.id}`,{method:"PUT",body:JSON.stringify(t)}))}async function vR(t){return Gt(`/features/${t}`,{method:"DELETE"})}async function vm(){return(await Gt("/requirements")).requirements.map(gm)}async function yR(t){const a=new Date().toISOString();return gm(await Gt("/requirements",{method:"POST",body:JSON.stringify({...t,macroTasks:[],createdAt:a,updatedAt:a})}))}async function xR(t){return gm(await Gt(`/requirements/${t.id}`,{method:"PUT",body:JSON.stringify({...t,updatedAt:new Date().toISOString()})}))}async function bR(t){return Gt(`/requirements/${t}`,{method:"DELETE"})}async function Kc(t){const a=t?`?featureId=${encodeURIComponent(t)}`:"";return(await Gt(`/phases${a}`)).map(Xc)}async function Zc(t){return Xc(await Gt(`/phases/${t}`))}async function SR(t){return Xc(await Gt("/phases",{method:"POST",body:JSON.stringify(t)}))}async function Pb(t){return Xc(await Gt(`/phases/${t.id}`,{method:"PUT",body:JSON.stringify(t)}))}async function wR(t){return Gt(`/phases/${t}`,{method:"DELETE"})}async function ER(t,a){return Gc(await Gt(`/phases/${t}/tasks`,{method:"POST",body:JSON.stringify(a)}))}async function Jc(t){return Gc(await Gt(`/tasks/${t}`))}async function ym(t){return Gc(await Gt(`/tasks/${t.id}`,{method:"PUT",body:JSON.stringify(t)}))}async function NR(t){return Gt(`/tasks/${t}`,{method:"DELETE"})}async function Gb(){return Gt("/tasks/active")}async function Yh(){return(await Gt("/handoffs")).handoffs??[]}async function RR(){return(await Gt("/handoffs/archive")).archived??[]}async function Xb(t){return Gt(`/phases/${t}/handoff`,{method:"DELETE"})}async function jR(t=!1){return Gt(`/export?full=${t?"true":"false"}`)}async function TR(){return Gt("/repair",{method:"POST"})}async function bh(t,a,l,s){return Gt("/reorder",{method:"POST",body:JSON.stringify({kind:t,movedId:a,beforeId:l,afterId:s})})}function CR(){const[t,a]=v.useState(()=>{if(typeof window>"u")return"dark";const l=window.localStorage.getItem("plan-ui-theme");return l||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});return v.useEffect(()=>{document.documentElement.setAttribute("data-theme",t),window.localStorage.setItem("plan-ui-theme",t)},[t]),{theme:t,toggleTheme:()=>a(l=>l==="dark"?"light":"dark")}}function DR({liveStatus:t}){const a=t==="live"?{label:"Live",className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",dotClassName:"bg-emerald-500"}:t==="reconnecting"?{label:"Reconnecting…",className:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400",dotClassName:"bg-amber-500 animate-pulse"}:t==="disconnected"?{label:"Disconnected",className:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-400",dotClassName:"bg-rose-500"}:{label:"Connecting…",className:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-400",dotClassName:"bg-sky-500 animate-pulse"};return c.jsxs("span",{className:`inline-flex min-h-9 items-center gap-2 rounded-[12px] border px-2.5 py-1.5 text-sm font-semibold sm:min-h-11 sm:rounded-[14px] sm:px-3 sm:py-2 ${a.className}`,children:[c.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${a.dotClassName}`}),c.jsx("span",{className:"hidden sm:inline",children:a.label})]})}function AR({projectName:t,projectRoot:a,planRoot:l,liveStatus:s}){const{theme:o,toggleTheme:u}=CR(),[f,m]=v.useState(!1),[p,g]=v.useState(!1),[x,y]=v.useState(null),N=[{to:"/",label:"Dashboard",icon:YN},{to:"/features",label:"Features",icon:Dc},{to:"/requirements",label:"Requirements",icon:Io},{to:"/handoff",label:"Handoff",icon:qb}];async function w(S){y(S?"full":"summary");try{const R=await jR(S),L=new Blob([R.markdown],{type:"text/markdown;charset=utf-8"}),I=URL.createObjectURL(L),q=document.createElement("a");q.href=I,q.download=S?"EXPORT-full.md":R.filePath||"EXPORT.md",document.body.appendChild(q),q.click(),q.remove(),URL.revokeObjectURL(I),g(!1)}catch(R){window.alert(`Export failed: ${R instanceof Error?R.message:String(R)}`)}finally{y(null)}}return c.jsx("div",{className:"relative z-20 overflow-visible border-b border-[var(--border)] bg-[var(--surface-elevated)] backdrop-blur-xl backdrop-saturate-150",children:c.jsxs("div",{className:"page-container flex flex-col gap-3 py-2.5 md:flex-row md:items-center md:justify-between sm:gap-4 sm:py-3",children:[c.jsxs(Ye,{to:"/",className:"flex min-w-0 items-center gap-3",children:[c.jsx("div",{className:"surface-card flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-[var(--border)] text-[var(--accent)]",children:c.jsx(Dc,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("div",{className:"truncate text-sm font-black tracking-tight",children:t??"Agent Plan"})}),a?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"truncate text-[11px] text-[var(--text-subtle)]",title:a,children:a}),c.jsx("button",{type:"button",onClick:async S=>{S.preventDefault(),S.stopPropagation(),a&&(await navigator.clipboard.writeText(a).catch(()=>{}),m(!0),window.setTimeout(()=>m(!1),1200))},className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] transition hover:text-[var(--text)]",title:f?"Copied":"Copy project path","aria-label":f?"Copied":"Copy project path",children:f?c.jsx(Lb,{className:"h-3.5 w-3.5"}):c.jsx(Hb,{className:"h-3.5 w-3.5"})})]}):null]})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 sm:gap-3",children:[c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:c.jsx(DR,{liveStatus:s})}),c.jsx("nav",{className:"flex items-center gap-1.5 sm:gap-2",children:N.map(S=>c.jsxs(kb,{to:S.to,end:S.to==="/",className:({isActive:D})=>`inline-flex min-h-9 items-center gap-2 rounded-[12px] border px-2.5 py-1.5 text-sm font-semibold transition sm:min-h-11 sm:rounded-[14px] sm:px-3 sm:py-2 sm:px-4 ${D?"border-transparent bg-[var(--accent-soft)] text-[var(--accent)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"}`,children:[c.jsx(S.icon,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:S.label})]},S.to))}),c.jsxs("div",{className:"relative z-30",children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":p,onClick:()=>g(S=>!S),className:"inline-flex min-h-9 items-center gap-2 rounded-[12px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] px-2.5 py-1.5 text-sm font-semibold text-[var(--text-muted)] transition hover:text-[var(--text)] sm:min-h-11 sm:rounded-[14px] sm:px-3 sm:py-2 sm:px-4",children:[c.jsx(BN,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Export"}),c.jsx(ps,{className:`h-4 w-4 transition-transform ${p?"rotate-180":""}`})]}),p?c.jsxs("div",{role:"menu",onKeyDown:S=>{var I;const D=Array.from(S.currentTarget.querySelectorAll("[role=menuitem]")).filter(q=>!q.hasAttribute("disabled"));if(D.length===0)return;const R=D.indexOf(document.activeElement);let L=R;if(S.key==="ArrowDown")L=R===-1?0:(R+1)%D.length;else if(S.key==="ArrowUp")L=R===-1?D.length-1:(R-1+D.length)%D.length;else if(S.key==="Home")L=0;else if(S.key==="End")L=D.length-1;else return;S.preventDefault(),(I=D[L])==null||I.focus()},className:"absolute right-0 top-full z-[200] mt-2 min-w-44 overflow-hidden rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] p-1 shadow-xl",children:[c.jsxs("button",{type:"button",role:"menuitem",disabled:x!==null,onClick:()=>void w(!1),className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Summary",x==="summary"?c.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]}),c.jsxs("button",{type:"button",role:"menuitem",disabled:x!==null,onClick:()=>void w(!0),className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Full",x==="full"?c.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]})]}):null]}),c.jsx("button",{type:"button",onClick:u,"aria-label":o==="dark"?"Switch to light theme":"Switch to dark theme",title:o==="dark"?"Switch to light theme":"Switch to dark theme",className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[12px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text-muted)] transition hover:text-[var(--text)] sm:h-11 sm:w-11 sm:rounded-[14px]",children:o==="dark"?c.jsx(lR,{className:"h-4 w-4"}):c.jsx(KN,{className:"h-4 w-4"})})]})]})})}function ax(t,a,l){t.split(`
272
+ `).forEach((o,u)=>{u>0&&a.push(c.jsx("br",{},`${l}-br-${u}`)),o&&a.push(o)})}function fo(t,a){const l=[],s=/(\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*)/g;let o=0,u=null,f=0;for(;(u=s.exec(t))!==null;)u.index>o&&ax(t.slice(o,u.index),l,`${a}-${f}`),u[2]&&u[3]?l.push(c.jsx("a",{href:u[3],target:"_blank",rel:"noreferrer",className:"font-semibold text-[var(--accent)] underline-offset-4 hover:underline",children:u[2]},`${a}-link-${f}`)):u[4]?l.push(c.jsx("strong",{className:"font-semibold text-[var(--text)]",children:u[4]},`${a}-strong-${f}`)):u[5]?l.push(c.jsx("code",{className:"rounded-md border border-[var(--border)] px-1.5 py-0.5 font-mono text-[0.95em] text-[var(--text)]",children:u[5]},`${a}-code-${f}`)):u[6]&&l.push(c.jsx("em",{className:"italic",children:u[6]},`${a}-em-${f}`)),o=s.lastIndex,f+=1;return o<t.length&&ax(t.slice(o),l,`${a}-tail`),l}function kR(t,a){var o;const l=t.split(`
273
+ `);if(t.startsWith("```")){const u=t.replace(/^```[a-zA-Z]*\n?/,"").replace(/```\s*$/,"");return c.jsx("pre",{className:"overflow-x-auto rounded-lg border border-[var(--border)] bg-[var(--surface-elevated)] p-3 text-sm font-mono text-[var(--text)]",children:c.jsx("code",{children:u})},`code-${a}`)}const s=t.match(/^(#{1,6})\s+(.+)$/);if(s&&s[2]){const u=((o=s[1])==null?void 0:o.length)??1,f=s[2],m=u<=2?"text-base font-bold text-[var(--text)]":"text-sm font-bold text-[var(--text)]";return c.jsx("p",{className:m,children:fo(f,`h-${a}`)},`h-${a}`)}return l.every(u=>/^\s*>\s?/.test(u))?c.jsx("blockquote",{className:"border-l-2 border-[var(--accent)] pl-4 text-sm italic text-[var(--text-muted)]",children:l.map((u,f)=>c.jsx("div",{children:fo(u.replace(/^\s*>\s?/,""),`bq-${a}-${f}`)},`bq-${a}-${f}`))},`bq-${a}`):/^\s*([-*_])\1{2,}\s*$/.test(t.trim())?c.jsx("hr",{className:"border-[var(--border)]"},`hr-${a}`):l.every(u=>/^\s*[-*]\s+/.test(u))?c.jsx("ul",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:l.map((u,f)=>c.jsx("li",{className:"list-disc",children:fo(u.replace(/^\s*[-*]\s+/,""),`ul-${a}-${f}`)},`ul-${a}-${f}`))},`ul-${a}`):l.every(u=>/^\s*\d+\.\s+/.test(u))?c.jsx("ol",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)] list-decimal",children:l.map((u,f)=>c.jsx("li",{children:fo(u.replace(/^\s*\d+\.\s+/,""),`ol-${a}-${f}`)},`ol-${a}-${f}`))},`ol-${a}`):c.jsx("p",{className:"text-sm leading-6 text-[var(--text-muted)] whitespace-pre-wrap",children:fo(t,`p-${a}`)},`p-${a}`)}function xn({text:t,className:a=""}){if(!(t!=null&&t.trim()))return null;const l=t.trim().split(/\n\s*\n/).filter(Boolean);return c.jsx("div",{className:`formatted-text grid grid-cols-1 gap-3 ${a}`,children:l.map((s,o)=>kR(s,o))})}const rx={feature:{soft:"rgba(139, 92, 246, 0.16)",strong:"var(--color-entity-feature)"},phase:{soft:"rgba(6, 182, 212, 0.16)",strong:"var(--color-entity-phase)"},task:{soft:"rgba(16, 185, 129, 0.16)",strong:"var(--color-entity-task)"}};function jr(t){return String(t&&t>0?t:0).padStart(3,"0")}function gs({featureNum:t,phaseNum:a,taskNum:l}){const s=[];return t!==void 0&&s.push(`F${jr(t)}`),a!==void 0&&s.push(`P${jr(a)}`),l!==void 0&&s.push(`T${jr(l)}`),s.join("/")}async function OR(t){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(t),!0}catch{}try{const a=document.createElement("textarea");a.value=t,a.style.position="fixed",a.style.top="-1000px",a.style.opacity="0",document.body.appendChild(a),a.focus(),a.select();const l=document.execCommand("copy");return a.remove(),l}catch{return!1}}function xm({type:t,number:a}){const l=rx[t]||rx.task,s=(l==null?void 0:l.soft)||"transparent",o=(l==null?void 0:l.strong)||"inherit";return c.jsxs("span",{className:"shrink-0 inline-flex items-center justify-center font-mono text-[11px] font-bold leading-none px-2 py-1 rounded-md transition-colors",style:{backgroundColor:s,color:o},children:[t?t.charAt(0).toUpperCase():"?",jr(a)]})}function ko({type:t,phaseNum:a,featureNum:l}){return t==="feature"?null:t==="phase"?l===void 0?null:c.jsx("div",{className:"shrink-0 inline-flex items-stretch font-mono text-[10.5px] font-semibold rounded-md overflow-hidden border border-[var(--border)] bg-[var(--surface-elevated)]",children:c.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["F",jr(l)]})}):t==="task"?a===void 0?null:c.jsxs("div",{className:"shrink-0 inline-flex items-stretch font-mono text-[10.5px] font-semibold rounded-md overflow-hidden border border-[var(--border)] bg-[var(--surface-elevated)]",children:[c.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["P",jr(a)]}),l!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"w-[1px] bg-[var(--border)]"}),c.jsxs("span",{className:"px-2 py-1 text-[var(--text-subtle)]",children:["F",jr(l)]})]})]}):null}function Tr({featureNum:t,phaseNum:a,taskNum:l,featureId:s,phaseId:o,taskId:u}){const f=s?({children:g})=>c.jsx(Ye,{to:`/features/${s}`,className:"entity-path-seg entity-path-seg--feature entity-path-seg--link",children:g}):({children:g})=>c.jsx("span",{className:"entity-path-seg entity-path-seg--feature",children:g}),m=o?({children:g})=>c.jsx(Ye,{to:`/features/${s}/phases/${o}`,className:"entity-path-seg entity-path-seg--phase entity-path-seg--link",children:g}):({children:g})=>c.jsx("span",{className:"entity-path-seg entity-path-seg--phase",children:g}),p=u?({children:g})=>c.jsx(Ye,{to:`/features/${s}/phases/${o}/tasks/${u}`,className:"entity-path-seg entity-path-seg--task entity-path-seg--link",children:g}):({children:g})=>c.jsx("span",{className:"entity-path-seg entity-path-seg--task",children:g});return c.jsxs("span",{className:"entity-path-badge",children:[t!==void 0?c.jsxs(f,{children:["F",jr(t)]}):null,a!==void 0?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),c.jsxs(m,{children:["P",jr(a)]})]}):null,l!==void 0?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),c.jsxs(p,{children:["T",jr(l)]})]}):null]})}function Or({id:t,children:a}){const[l,s]=v.useState(!1);return c.jsxs("button",{type:"button",onClick:async o=>{o.preventDefault(),o.stopPropagation(),await OR(t)&&(s(!0),window.setTimeout(()=>s(!1),1200))},title:l?"Copied":`Copy ${t}`,"aria-label":l?"Copied":`Copy ${t}`,className:"copyable-id group inline-flex items-center gap-1.5",children:[a,c.jsx("span",{className:"copyable-id__icon","aria-hidden":"true",children:l?c.jsx(Lb,{className:"h-3 w-3 text-emerald-500"}):c.jsx(Hb,{className:"h-3 w-3"})})]})}function vs({shortId:t}){return c.jsx(Or,{id:t,children:c.jsx("span",{className:"short-id-badge",children:t})})}function bm({phaseId:t,updatedAt:a}){const l=`Phase handoff pending${a?` · updated ${new Date(a).toLocaleString()}`:""}`;return c.jsxs("a",{href:`/handoff#${t}`,className:"handoff-badge flex items-center gap-1 ml-2 shrink-0",title:l,"aria-label":l,children:[c.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M4 2h5l3 3v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"}),c.jsx("path",{d:"M9 2v3h3"}),c.jsx("path",{d:"M5.5 8h5M5.5 10.5h5"})]}),c.jsx("span",{className:"handoff-badge__label",children:"handoff"})]})}function MR({activeTasks:t}){const a=Ar(),l=v.useMemo(()=>{const s=new Set;return t.filter(o=>{const u=`${o.id}-${o.title}-${o.phaseId}`;return s.has(u)?!1:(s.add(u),!0)})},[t]);return l.length===0?null:c.jsx("div",{className:"relative z-10 border-t border-[var(--border)] bg-[var(--surface-elevated)]/95 backdrop-blur-xl",children:c.jsx("div",{className:"page-container py-2.5",children:c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["In-progress tasks (",l.length,")"]}),c.jsx("div",{className:"grid grid-cols-1 max-h-[35vh] gap-1.5 overflow-y-auto pr-1",children:l.map(s=>{const o=s.featureId?`/features/${s.featureId}/phases/${s.phaseId}/tasks/${s.id}`:"/features";return c.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-[10px] border border-[var(--border)] bg-[var(--surface-card)] px-3 py-2 text-sm text-[var(--text)] transition-colors hover:border-[var(--accent)] hover:bg-[var(--accent-soft)] hover:text-[var(--accent)]",children:[c.jsxs(Ye,{to:o,className:"flex min-w-0 flex-1 items-center gap-2",children:[s.status==="in-progress"?c.jsx("span",{"aria-hidden":"true",className:"inline-block h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]","aria-label":"In progress"}):null,c.jsx(xm,{type:"task",number:s.number}),c.jsx(ko,{type:"task",phaseNum:s.phaseNumber,featureNum:s.featureNumber}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:s.title})]}),c.jsx("button",{type:"button",onClick:u=>{u.preventDefault(),u.stopPropagation(),a(`/?locate=T${s.number}`)},"aria-label":`Locate T${s.number} in work tree`,title:"Locate in work tree",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] text-[var(--text-subtle)] transition-colors hover:bg-[var(--accent)] hover:text-[var(--text)]",children:c.jsx(XN,{className:"h-4 w-4"})})]},s.id)})})]})})})}function _R({project:t,activeTasks:a,serverInfo:l}){const s=kr(),[o,u]=v.useState("connecting");return v.useEffect(()=>{const f=m=>{var g;const p=(g=m.detail)==null?void 0:g.status;p&&u(p)};return window.addEventListener("agent-plan:ws-status",f),()=>window.removeEventListener("agent-plan:ws-status",f)},[]),c.jsxs("div",{className:"page-shell",children:[c.jsxs("header",{className:"sticky top-0 z-30 overflow-visible",children:[c.jsx(AR,{projectName:t==null?void 0:t.name,projectRoot:t==null?void 0:t.projectRoot,planRoot:t==null?void 0:t.planRoot,liveStatus:o}),c.jsx(MR,{activeTasks:a})]}),c.jsxs("div",{className:"page-container py-8",children:[c.jsxs("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-end md:justify-between md:gap-6",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Current project"}),c.jsx("h1",{className:"text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:c.jsx(Ye,{to:"/",className:"hover:text-[var(--accent)]",children:(t==null?void 0:t.name)??"Agent Plan"})}),t!=null&&t.projectRoot?c.jsx("p",{className:"mt-2 truncate font-mono text-xs text-[var(--text-subtle)]",title:t.projectRoot,children:t.projectRoot}):null,l?c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",children:[c.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 font-semibold uppercase tracking-[0.12em] ${l.mode==="lan"?"bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] text-[var(--accent)]":"bg-[var(--surface-elevated)] text-[var(--text-muted)]"}`,children:[c.jsx("span",{"aria-hidden":"true",className:"inline-block h-1.5 w-1.5 rounded-full bg-current"}),l.mode==="lan"?"LAN visible":"Local only"]}),c.jsx("a",{href:l.localUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:l.localUrl}),l.lanUrl?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[var(--text-subtle)]",children:"·"}),c.jsx("a",{href:l.lanUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:l.lanUrl})]}):null]}):null,t!=null&&t.description?c.jsx(xn,{text:t.description,className:"mt-2 max-w-3xl"}):null]}),s.state!=="idle"?c.jsx("div",{className:"text-sm font-semibold text-[var(--accent)]",children:"Updating…"}):null]}),c.jsx(hi,{})]})]})}const Ra=32,Qb=4,LR=Math.PI*1.2;function Kb(){if(typeof document>"u")return"#7b68ee";const t=document.createElement("div");t.style.color="var(--accent, #7b68ee)",document.body.appendChild(t);const a=getComputedStyle(t).color||"#7b68ee";return t.remove(),a}function zR(){const t=document.createElement("canvas");t.width=Ra,t.height=Ra;const a=t.getContext("2d");if(!a)return"";const l=Kb();return a.beginPath(),a.arc(Ra/2,Ra/2,Ra/2-Qb,0,Math.PI*2),a.fillStyle=l,a.fill(),a.fillStyle="#ffffff",a.font="bold 16px system-ui, sans-serif",a.textAlign="center",a.textBaseline="middle",a.fillText("A",Ra/2,Ra/2+1),t.toDataURL("image/png")}function UR(t,a){const l=t.getContext("2d");if(!l)return"";const s=Kb();l.clearRect(0,0,Ra,Ra);const o=Ra/2,u=Ra/2,f=Ra/2-Qb;return l.beginPath(),l.arc(o,u,f,0,Math.PI*2),l.fillStyle=s,l.globalAlpha=.85,l.fill(),l.globalAlpha=1,l.beginPath(),l.arc(o,u,f-3,a,a+LR),l.strokeStyle="#ffffff",l.lineWidth=3,l.lineCap="round",l.stroke(),l.fillStyle="#ffffff",l.font="bold 14px system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.fillText("A",o,u+1),t.toDataURL("image/png")}function BR(){let t=document.querySelector("link[rel~='icon']");return t||(t=document.createElement("link"),t.rel="icon",t.type="image/png",document.head.appendChild(t)),t}function HR(t){const a=v.useRef(null),l=v.useRef(null),s=v.useRef(null),o=v.useRef(0);v.useEffect(()=>{if(a.current||(a.current=BR()),s.current||(s.current=zR()),!l.current){const m=document.createElement("canvas");m.width=Ra,m.height=Ra,l.current=m}const u=a.current;if(!t){u.href=s.current;return}const f=window.setInterval(()=>{document.hidden||(o.current+=Math.PI/10,u.href=UR(l.current,o.current))},100);return()=>{window.clearInterval(f),u.href=s.current}},[t])}const bo={create:{key:"n",primary:!0},edit:{key:"e",primary:!0},delete:{key:"d",primary:!0},submit:{key:"Enter",primary:!0}},Zb=v.createContext(bo);function Jb(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)}function $R(t){return typeof t!="string"}function qR(t){return{create:(t==null?void 0:t.create)??bo.create,edit:(t==null?void 0:t.edit)??bo.edit,delete:(t==null?void 0:t.delete)??bo.delete,submit:(t==null?void 0:t.submit)??bo.submit}}function IR(t){const a=[],l=Jb();t.primary&&a.push(l?"⌘":"Ctrl"),t.meta&&a.push(l?"⌘":"Meta"),t.ctrl&&a.push(l?"⌃":"Ctrl"),t.shift&&a.push(l?"⇧":"Shift"),t.alt&&a.push(l?"⌥":"Alt");const s=t.key==="Backspace"?l?"⌫":"Backspace":t.key==="Enter"?l?"↩":"Enter":t.key.length===1?t.key.toUpperCase():t.key;return a.push(s),l?a.join(""):a.join("+")}function VR(t){return t instanceof HTMLElement?!!t.closest("input, textarea, select, [contenteditable='true']"):!1}function YR(t,a){const l=a.key.length===1?a.key.toLowerCase():a.key,s=t.key.length===1?t.key.toLowerCase():t.key,o=Jb(),u=a.meta??(a.primary?o:!1),f=a.ctrl??(a.primary?!o:!1);return s===l&&!!u===t.metaKey&&!!f===t.ctrlKey&&!!a.shift===t.shiftKey&&!!a.alt===t.altKey}function FR({shortcuts:t,children:a}){return v.createElement(Zb.Provider,{value:qR(t)},a)}function Wb(t){const a=v.useContext(Zb);if(t)return $R(t)?t:a[t]}function An(t,a,l){const s=Wb(t);v.useEffect(()=>{if(!s||(l==null?void 0:l.enabled)===!1)return;const o=u=>{!(l!=null&&l.allowInEditable)&&VR(u.target)||YR(u,s)&&(u.preventDefault(),a())};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a,l==null?void 0:l.allowInEditable,l==null?void 0:l.enabled,s])}const PR=1500,GR=80,XR=12e3,QR=5e3;function KR(){const{revalidate:t}=hE(),a=v.useRef(null),l=v.useRef(null),s=v.useRef(null),o=v.useRef(null),u=v.useRef(null);return v.useEffect(()=>{let f=!0;const m=X=>{window.dispatchEvent(new CustomEvent("agent-plan:ws-status",{detail:{status:X}}))},p=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},g=()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},x=()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},y=()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},N=()=>{g(),s.current=window.setTimeout(()=>{t()},GR)},w=()=>{!f||l.current!==null||(m("reconnecting"),l.current=window.setTimeout(()=>{l.current=null,R()},PR))},S=()=>{y(),x();const X=a.current;if(a.current=null,X&&(X.readyState===WebSocket.OPEN||X.readyState===WebSocket.CONNECTING))try{X.close()}catch{}},D=()=>{y(),x(),o.current=window.setInterval(()=>{const X=a.current;if(!(!X||X.readyState!==WebSocket.OPEN)){try{X.send(JSON.stringify({type:"ping"}))}catch{S(),w();return}x(),u.current=window.setTimeout(()=>{S(),w()},QR)}},XR)},R=()=>{if(!f)return;const X=a.current;if(X&&(X.readyState===WebSocket.OPEN||X.readyState===WebSocket.CONNECTING))return;m(l.current!==null?"reconnecting":"connecting"),p();const W=window.location.protocol==="https:"?"wss":"ws",ae=new WebSocket(`${W}://${window.location.host}/ws`);a.current=ae,ae.onopen=()=>{p(),m("live"),D()},ae.onmessage=z=>{x();try{const T=JSON.parse(z.data);if(!T.type||T.type==="pong"||T.type==="connected")return;switch(window.dispatchEvent(new CustomEvent("agent-plan:ws-event",{detail:T})),T.type){case"project-updated":case"features-updated":case"phases-updated":case"requirements-updated":case"plan-rendered":case"file-changed":case"handoffUpdated":case"handoffCleared":N();break;default:break}}catch{}},ae.onclose=()=>{y(),x(),a.current===ae&&(a.current=null),f&&w()},ae.onerror=()=>{try{ae.close()}catch{}}},L=()=>{const X=a.current;(!X||X.readyState===WebSocket.CLOSED||X.readyState===WebSocket.CLOSING)&&R()},I=()=>{document.visibilityState==="visible"&&L()},q=()=>{L()};return m("connecting"),R(),window.addEventListener("online",q),document.addEventListener("visibilitychange",I),()=>{f=!1,m("disconnected"),window.removeEventListener("online",q),document.removeEventListener("visibilitychange",I),p(),g(),y(),x(),S()}},[t]),null}async function ZR(){const[t,a,l]=await Promise.all([Vb(),pR(),Gb()]);return{project:t,uiConfig:a,activeTasks:l}}function JR(){const{project:t,uiConfig:a,activeTasks:l}=ll();return v.useEffect(()=>{var f,m;const s=(f=t==null?void 0:t.name)==null?void 0:f.trim(),o=(m=t==null?void 0:t.projectRoot)==null?void 0:m.trim(),u=o?o.split(/[/\\]/).filter(Boolean).pop():void 0;s?u&&u!==s?document.title=`${s} · ${u}`:document.title=`${s} · Agent Plan`:document.title="Agent Plan"},[t==null?void 0:t.name,t==null?void 0:t.projectRoot]),HR(l.length>0),c.jsxs(FR,{shortcuts:a.shortcuts,children:[c.jsx(KR,{}),c.jsx(_R,{project:t,activeTasks:l,serverInfo:a.server})]})}function WR(){const t=Cb(),a=ci(t),l=a&&t.status===503,s=a?l?"Planner web UI disconnected":`Request failed (${t.status})`:"Planner web UI unavailable",o=a?t.data||t.statusText:t instanceof Error?t.message:"The planner web UI could not reach its local server.";return v.useEffect(()=>{document.title="Agent Plan"},[]),c.jsx("div",{className:"page-shell min-h-screen",children:c.jsx("div",{className:"page-container flex min-h-screen items-center justify-center py-12",children:c.jsxs("div",{className:"surface-card max-w-2xl rounded-[24px] px-8 py-8",children:[c.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Agent Plan"}),c.jsx("h1",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:s}),c.jsx("p",{className:"mt-4 text-sm text-[var(--text-muted)]",children:String(o)}),c.jsx("div",{className:"mt-6 grid gap-2 text-sm text-[var(--text-muted)]",children:l?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:"Possible cause: Pi was closed or the local planner web server stopped."}),c.jsx("p",{children:"What to do:"}),c.jsxs("ul",{className:"grid gap-1 pl-5",children:[c.jsxs("li",{className:"list-disc",children:["restart Pi or run ",c.jsx("code",{children:"planner-web start"})]}),c.jsx("li",{className:"list-disc",children:"reopen this planner UI from the new session if needed"}),c.jsx("li",{className:"list-disc",children:"then reload this page"})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:"The request reached the planner server, but the server rejected it."}),c.jsx("p",{children:"Fix the validation issue above, then try again."})]})}),c.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:c.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"inline-flex min-h-9 items-center whitespace-nowrap rounded-[12px] bg-[var(--accent)] px-3 py-1.5 text-sm font-semibold text-white transition hover:opacity-90 sm:min-h-11 sm:rounded-[14px] sm:px-4 sm:py-2",children:"Reload page"})})]})})})}async function e2(){const[t,a,l]=await Promise.all([Yb(),Kc(),Gb()]);return{features:t,phases:a,activeTasks:l}}function t2({shortcut:t}){const a=Wb(t);return a?c.jsx("span",{className:"hidden rounded-md border border-[var(--border-strong)] bg-[var(--surface-elevated)] px-2 py-0.5 text-[11px] font-bold tracking-wide text-[var(--text-muted)] sm:inline-block",children:IR(a)}):null}const n2={primary:"border-transparent bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)]",secondary:"border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]",ghost:"border-transparent bg-transparent text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]",danger:"border-transparent bg-[var(--danger-soft)] text-[var(--color-status-blocked)] hover:bg-[color-mix(in_srgb,var(--danger-soft)_88%,black_12%)]"};function gt({variant:t="secondary",className:a="",children:l,shortcut:s,...o}){return c.jsxs("button",{className:`inline-flex min-h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-[12px] border px-3 py-1.5 text-sm font-semibold transition-colors motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface)] disabled:cursor-not-allowed disabled:opacity-60 sm:min-h-11 sm:rounded-[14px] sm:px-4 sm:py-2 sm:gap-2 ${n2[t]} ${a}`,...o,children:[c.jsx("span",{className:"inline-flex items-center gap-1.5 sm:gap-2",children:l}),s?c.jsx(t2,{shortcut:s}):null]})}function Pt({className:t="",children:a,...l}){return c.jsx("div",{className:`surface-card p-6 ${t}`,...l,children:a})}function a2({decisions:t}){return t.length===0?null:c.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[c.jsxs("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:["Accepted decisions (",t.length,")"]}),c.jsx("div",{className:"mt-4 grid gap-3",children:t.map(a=>c.jsxs("div",{className:"rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3",children:[c.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:a.title}),a.decision?c.jsxs("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Decision:"})," ",c.jsx(xn,{text:a.decision})]}):null,a.rationale?c.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Rationale:"})," ",c.jsx(xn,{text:a.rationale})]}):null,a.implementationNotes?c.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Implementation:"})," ",c.jsx(xn,{text:a.implementationNotes})]}):null]},a.id))})]})}function r2({project:t}){var x,y,N;const a=t.scope??[],l=t.outOfScope??[],s=t.technologies??[],o=t.tools??[],u=t.globalRules??[],f=t.decisions??[],m=t.acceptedDecisions??[],p={beforePhaseStart:((x=t.workflowRules)==null?void 0:x.beforePhaseStart)??[],beforeTaskStart:((y=t.workflowRules)==null?void 0:y.beforeTaskStart)??[],afterPhaseComplete:((N=t.workflowRules)==null?void 0:N.afterPhaseComplete)??[]};return a.length>0||l.length>0||s.length>0||o.length>0||u.length>0||f.length>0||m.length>0||p.beforePhaseStart.length>0||p.beforeTaskStart.length>0||p.afterPhaseComplete.length>0?c.jsx(Pt,{className:"grid gap-4",children:c.jsxs("details",{className:"group",children:[c.jsx("summary",{className:"cursor-pointer select-none text-lg font-bold text-[var(--text)]",children:"AI Consolidated Context"}),c.jsxs("div",{className:"mt-4 grid gap-4",children:[a.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"In scope"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:a.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,l.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Out of scope"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:l.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,s.length>0||o.length>0?c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Technologies"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:s.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,o.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Tools"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:o.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null]}):null,u.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Global rules"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:u.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,p.beforePhaseStart.length>0||p.beforeTaskStart.length>0||p.afterPhaseComplete.length>0?c.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[c.jsx("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:"Workflow rules"}),c.jsxs("div",{className:"mt-4 grid gap-4 text-sm text-[var(--text-muted)]",children:[p.beforePhaseStart.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"Before phase start"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.beforePhaseStart.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,p.beforeTaskStart.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"Before task start"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.beforeTaskStart.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,p.afterPhaseComplete.length>0?c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"After phase complete"}),c.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.afterPhaseComplete.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null]})]}):null,f.length>0?c.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[c.jsxs("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:["Legacy decisions (",f.length,")"]}),c.jsx("ul",{className:"mt-4 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:f.map(w=>c.jsx("li",{className:"list-disc",children:w},w))})]}):null,c.jsx(a2,{decisions:m})]})]})}):null}const Fh={planned:{colorVar:"--color-status-planned",icon:"circle",pattern:"",label:"Planned",description:"Not started",borderStyle:"solid",bgOpacity:10,borderOpacity:30},started:{colorVar:"--color-status-started",icon:"play-start",pattern:"dashed",label:"Started",description:"Begun but not active now",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},"in-progress":{colorVar:"--color-status-in-progress",icon:"play",pattern:"pulse",label:"In progress",description:"Active now",borderStyle:"solid",bgOpacity:12,borderOpacity:30},waiting:{colorVar:"--color-status-waiting",icon:"clock",pattern:"dashed",label:"Waiting",description:"Waiting on a dependency",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},blocked:{colorVar:"--color-status-blocked",icon:"stop",pattern:"",label:"Blocked",description:"Impediment",borderStyle:"solid",bgOpacity:12,borderOpacity:30},deferred:{colorVar:"--color-status-deferred",icon:"pause",pattern:"dashed",label:"Deferred",description:"Postponed",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},done:{colorVar:"--color-status-done",icon:"check",pattern:"",label:"Done",description:"Completed",borderStyle:"solid",bgOpacity:14,borderOpacity:30},closed:{colorVar:"--color-status-closed",icon:"check-mixed",pattern:"",label:"Closed",description:"Closed with mixed outcomes",borderStyle:"solid",bgOpacity:14,borderOpacity:30},canceled:{colorVar:"--color-status-canceled",icon:"ban",pattern:"hatch",label:"Canceled",description:"Canceled",borderStyle:"solid",bgOpacity:8,borderOpacity:30},rejected:{colorVar:"--color-status-rejected",icon:"x",pattern:"crosshatch",label:"Rejected",description:"Rejected",borderStyle:"solid",bgOpacity:10,borderOpacity:30}};function Bl(t){return Fh[t]??Fh.planned}function Ac(t,a,l){switch(a){case"bg":return`color-mix(in srgb, var(${t.colorVar}) ${t.bgOpacity}%, transparent)`;case"border":return`color-mix(in srgb, var(${t.colorVar}) ${t.borderOpacity}%, transparent)`}}function l2(t){const a=Bl(t);return{backgroundColor:Ac(a,"bg"),borderStyle:a.borderStyle,borderColor:Ac(a,"border"),borderWidth:"1px"}}function s2(t){const a=Bl(t);return{backgroundColor:Ac(a,"bg"),borderStyle:a.borderStyle,borderColor:Ac(a,"border"),borderWidth:"1px"}}function Sm(t){const{pattern:a}=Bl(t);return a?a==="dashed"?`status-pattern-dashed status-pattern-dashed-${t}`:`status-pattern-${a}`:""}function e0(t){return`status-${t}`}function t0(t,a=30){return`color-mix(in srgb, var(${Bl(t).colorVar}) ${a}%, transparent)`}function n0(t){return t in Fh?t:"planned"}function i2(t,a){const s=[Bl(t).label],o=[["done",a.done],["in-progress",a.inProgress],["planned",a.planned],["waiting",a.waiting],["blocked",a.blocked],["deferred",a.deferred],["canceled",a.canceled],["rejected",a.rejected]];for(const[u,f]of o)f>0&&s.push(`${f} ${u}`);return s.join(" · ")}const a0={circle:Pc,"play-start":eR,play:Bb,clock:LN,stop:$b,pause:Ub,check:pm,"check-mixed":EN,ban:_b,x:ON};function o2({status:t,className:a=""}){const l=Bl(t),s=a0[l.icon]??Pc;return c.jsx(s,{className:`h-4 w-4 shrink-0 ${a}`.trim(),"aria-hidden":"true"})}function ur({status:t}){const a=n0(t),l=Bl(a);return c.jsxs("span",{className:`status-chip ${e0(a)} ${Sm(a)}`,title:l.description,"aria-label":l.description,children:[c.jsx(o2,{status:a,className:"h-3.5 w-3.5"}),c.jsx("span",{children:l.label})]})}function Yo({status:t,breakdown:a,size:l="md",children:s}){const o=Bl(t),u=a0[o.icon]??Pc,f=Sm(t),m=a?i2(t,a):o.description,p=l==="sm"?"px-2 py-0.5 text-[10px]":"px-2.5 py-1 text-[11px]";return c.jsxs("span",{className:`status-chip ${e0(t)} ${f} ${p}`,title:m,"aria-label":m,children:[c.jsx(u,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:o.label}),s]})}function kc({status:t,breakdown:a,doneTasks:l,totalTasks:s,recentlyChanged:o,className:u}){const f=l!=null&&s!=null;return c.jsxs("div",{className:u,children:[o?c.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"}):null,f?c.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",l,"/",s||0,")"]}):null,c.jsx(Yo,{status:t,breakdown:a})]})}function u2(t){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}}function c2({features:t,phases:a}){const l=v.useMemo(()=>{const s=new Map(t.map(o=>[o.id,o.name]));return a.flatMap(o=>o.tasks.filter(u=>u.status==="done").map(u=>({task:u,phase:o,feature:t.find(f=>f.id===o.featureId),featureName:o.featureId?s.get(o.featureId)??o.featureId:"Unlinked feature",completedAt:u.completedAt||u.updatedAt}))).sort((o,u)=>u.completedAt.localeCompare(o.completedAt)).slice(0,3)},[t,a]);return c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Latest completed tasks"}),c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Most recently completed tasks, ordered by completion timestamp."})]}),c.jsx("div",{className:"grid gap-3",children:l.length>0?l.map(({task:s,phase:o,feature:u,featureName:f,completedAt:m})=>c.jsxs(Ye,{to:o.featureId?`/features/${o.featureId}/phases/${o.id}/tasks/${s.id}`:"/features",className:"surface-card grid min-w-0 grid-cols-1 gap-1 px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(xm,{type:"task",number:s.number}),c.jsx(ko,{type:"task",phaseNum:o.number,featureNum:u==null?void 0:u.number}),c.jsx("span",{className:"shrink-0",children:c.jsx(ur,{status:s.status})})]}),c.jsx("span",{className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:s.title}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[c.jsx(ko,{type:"phase",featureNum:u==null?void 0:u.number}),c.jsxs("span",{className:"min-w-0 truncate",children:[f," · ",o.title]})]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Completed ",u2(m)]})]},s.id)):c.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No completed tasks yet."})})]})}const lx=1440*60*1e3;function d2(t){const a=Date.now()-new Date(t).getTime();if(a<0)return"just now";const l=Math.floor(a/1e3);if(l<60)return`${l}s ago`;const s=Math.floor(l/60);return s<60?`${s}m ago`:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}function f2({features:t,phases:a}){const[,l]=v.useState(0),s=Date.now(),o=v.useMemo(()=>{const u=new Map(t.map(f=>[f.id,f.name]));return a.flatMap(f=>f.tasks.map(m=>({task:m,phase:f,feature:t.find(p=>p.id===f.featureId),featureName:f.featureId?u.get(f.featureId)??f.featureId:"Unlinked feature",createdAt:m.createdAt}))).filter(f=>{const m=new Date(f.createdAt).getTime();return Number.isFinite(m)&&s-m<lx&&s-m>=0&&f.task.status==="planned"&&!f.task.startedAt}).sort((f,m)=>m.createdAt.localeCompare(f.createdAt)).slice(0,10)},[t,a,s]);return v.useEffect(()=>{if(o.length===0)return;const u=o.reduce((m,p)=>{const g=new Date(p.createdAt).getTime()+lx-Date.now();return Math.min(m,g)},1/0);if(!Number.isFinite(u)||u<=0)return;const f=window.setTimeout(()=>l(m=>m+1),u+50);return()=>window.clearTimeout(f)},[o]),o.length===0?null:c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"New Added Tasks"}),c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Tasks created in the last 24 hours."})]}),c.jsx("div",{className:"grid gap-3",children:o.map(({task:u,phase:f,feature:m,featureName:p,createdAt:g})=>c.jsxs(Ye,{to:f.featureId?`/features/${f.featureId}/phases/${f.id}/tasks/${u.id}`:"/features",className:"surface-card grid min-w-0 grid-cols-1 gap-1 border-[color:color-mix(in_srgb,var(--color-status-done)_0%,transparent)] px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(xm,{type:"task",number:u.number}),c.jsx(ko,{type:"task",phaseNum:f.number,featureNum:m==null?void 0:m.number}),c.jsx("span",{className:"inline-flex items-center rounded-full bg-[color:color-mix(in_srgb,var(--accent)_18%,transparent)] px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-[var(--accent)]",children:"New"}),c.jsx("span",{className:"shrink-0",children:c.jsx(ur,{status:u.status})})]}),c.jsx("span",{className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:u.title}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[c.jsx(ko,{type:"phase",featureNum:m==null?void 0:m.number}),c.jsxs("span",{className:"min-w-0 truncate",children:[p," · ",f.title]})]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Added ",d2(g)]})]},u.id))})]})}const h2=new Set(["in-progress"]),m2=new Set(["planned","waiting","blocked","deferred"]),p2=new Set(["done","canceled","rejected"]);function r0(t){return t==="discovery"?"in-progress":t==="draft"?"planned":t}function g2(t){const a={planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0};for(const l of t)switch(l){case"planned":a.planned++;break;case"in-progress":a.inProgress++;break;case"waiting":a.waiting++;break;case"blocked":a.blocked++;break;case"deferred":a.deferred++;break;case"done":a.done++;break;case"canceled":a.canceled++;break;case"rejected":a.rejected++;break}return a}function v2(){return{planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0}}function l0(t){const a=t,l=g2(a),s=a.length;if(s===0)return{displayStatus:"planned",breakdown:v2(),hasStarted:!1,totalChildren:0,meaningfulChildren:0};const o=a.filter(g=>g!=="canceled"&&g!=="rejected"),u=o.length,f=o.some(g=>g!=="planned");if(o.some(g=>h2.has(g)))return{displayStatus:"in-progress",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u};if(a.every(g=>p2.has(g)))return a.every(g=>g==="done")?{displayStatus:"done",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:a.every(g=>g==="canceled")?{displayStatus:"canceled",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:a.every(g=>g==="rejected")?{displayStatus:"rejected",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:{displayStatus:"closed",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u};const m=o.filter(g=>m2.has(g));return m.length>0&&m.every(g=>g==="waiting")?{displayStatus:"waiting",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:m.length>0&&m.every(g=>g==="blocked")?{displayStatus:"blocked",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:m.length>0&&m.every(g=>g==="deferred")?{displayStatus:"deferred",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:m.length>0&&m.every(g=>g==="planned")&&!f?{displayStatus:"planned",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}:{displayStatus:"started",breakdown:l,hasStarted:f,totalChildren:s,meaningfulChildren:u}}function wm(t){const a=t.map(l=>r0(l.status));return l0(a)}function Em(t){const a=t.map(l=>r0(l.status));return l0(a)}function s0(t){return Em(t)}function i0(t){return wm(t)}const So={key:"priority",direction:"asc"},y2=4200;function x2(t){return t.reduce((a,l)=>a+l.tasks.length,0)}function b2(t){return t.reduce((a,l)=>a+l.tasks.filter(s=>s.status==="done").length,0)}function S2(t){return String(t&&t>0?t:0).padStart(3,"0")}const w2={draft:0,discovery:1,planned:2,waiting:3,blocked:4,deferred:5,"in-progress":6,done:7,canceled:8,rejected:9};function sx(t,a){if(a==="title")return"name"in t?t.name:t.title;if(a==="status")return w2[t.status]??99;if(a==="startedAt"){if("startedAt"in t){const l=t.startedAt;return l?new Date(l).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(a==="completedAt"){if("completedAt"in t){const l=t.completedAt;return l?new Date(l).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(a==="shortId")return t.shortId??"";if(a==="priority"||a==="number")return t[a]??0;if(a==="createdAt"||a==="updatedAt"){const l=t[a];return l?new Date(l).getTime():0}return 0}function Eo(t,a,l,s){const o=sx(t,l),u=sx(a,l);let f;return typeof o=="number"&&typeof u=="number"?f=o-u:f=String(o).localeCompare(String(u)),f===0&&(f=(t.priority??0)-(a.priority??0)||t.number-a.number||t.createdAt.localeCompare(a.createdAt)),s==="desc"?-f:f}function E2(t,a,l=So){const s=new Map;for(const o of a){if(!o.featureId)continue;const u=s.get(o.featureId)??[];u.push(o),s.set(o.featureId,u)}return t.map(o=>{const u=s.get(o.id)??[],f=u.reduce((x,y)=>x+y.tasks.length,0),m=u.reduce((x,y)=>x+y.tasks.filter(N=>N.status==="done").length,0),p=u.map(x=>{const y=[...x.tasks].sort((w,S)=>Eo(w,S,l.key,l.direction)),N=y.some(w=>w.status==="in-progress");return{phase:x,totalTasks:x.tasks.length,doneTasks:x.tasks.filter(w=>w.status==="done").length,allTasks:y,hasActiveTask:N,display:wm(y)}}),g=p.some(({phase:x,allTasks:y})=>x.status==="in-progress"||x.status==="discovery"||y.some(N=>N.status==="in-progress"));return{feature:o,totalTasks:f,doneTasks:m,allPhases:p.sort((x,y)=>Eo(x.phase,y.phase,l.key,l.direction)),hasActiveTask:p.some(x=>x.hasActiveTask),isActive:g,display:Em(p.map(x=>x.phase))}}).sort((o,u)=>Eo(o.feature,u.feature,l.key,l.direction))}function cc({title:t,value:a,valueSuffix:l,subtitle:s,icon:o,valueClassName:u,iconClassName:f}){return c.jsxs(Pt,{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:t}),c.jsxs("div",{className:"mt-2 flex items-end gap-2",children:[c.jsx("p",{className:`text-3xl font-black tracking-tight ${u??"text-[var(--text)]"}`,children:a}),l?c.jsx("span",{className:"pb-1 text-sm font-semibold text-[var(--text-muted)]",children:l}):null]}),c.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:s})]}),c.jsx("div",{className:`surface-card flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border border-[var(--border)] bg-[var(--accent-soft)] ${f??"text-[var(--accent)]"}`,children:o})]})}function ix(t){return t>=80?"text-emerald-600 dark:text-emerald-400":t>=30?"text-amber-600 dark:text-amber-400":"text-rose-600 dark:text-rose-400"}function N2({features:t,phases:a}){const l=new Map;for(const y of a)y.featureId&&l.set(y.featureId,[...l.get(y.featureId)??[],y]);const s=t.filter(y=>{const N=l.get(y.id)??[];return Em(N).displayStatus==="done"}).length,o=Math.max(t.length-s,0),u=a.filter(y=>wm(y.tasks).displayStatus==="done").length,f=Math.max(a.length-u,0),m=x2(a),p=b2(a),g=Math.max(m-p,0),x=m>0?Math.round(p/m*100):0;return c.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[c.jsx(cc,{title:"Features",value:String(t.length),valueSuffix:"total",subtitle:c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[s," done"]}),c.jsx("span",{children:" · "}),c.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[o," left"]})]}),icon:c.jsx(Dc,{className:"h-4 w-4"})}),c.jsx(cc,{title:"Phases",value:String(a.length),valueSuffix:"total",subtitle:c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[u," done"]}),c.jsx("span",{children:" · "}),c.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[f," left"]})]}),icon:c.jsx(yN,{className:"h-4 w-4"})}),c.jsx(cc,{title:"Tasks",value:String(m),valueSuffix:"total",subtitle:c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[p," done"]}),c.jsx("span",{children:" · "}),c.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[g," left"]})]}),icon:c.jsx(Io,{className:"h-4 w-4"})}),c.jsx(cc,{title:"Completion",value:`${x}%`,subtitle:"Task completion rate",valueClassName:ix(x),iconClassName:ix(x),icon:c.jsx(pm,{className:"h-4 w-4"})})]})}function R2(){for(var t=arguments.length,a=new Array(t),l=0;l<t;l++)a[l]=arguments[l];return v.useMemo(()=>s=>{a.forEach(o=>o(s))},a)}const Wc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mi(t){const a=Object.prototype.toString.call(t);return a==="[object Window]"||a==="[object global]"}function Nm(t){return"nodeType"in t}function pa(t){var a,l;return t?mi(t)?t:Nm(t)&&(a=(l=t.ownerDocument)==null?void 0:l.defaultView)!=null?a:window:window}function Rm(t){const{Document:a}=pa(t);return t instanceof a}function Fo(t){return mi(t)?!1:t instanceof pa(t).HTMLElement}function o0(t){return t instanceof pa(t).SVGElement}function pi(t){return t?mi(t)?t.document:Nm(t)?Rm(t)?t:Fo(t)||o0(t)?t.ownerDocument:document:document:document}const cr=Wc?v.useLayoutEffect:v.useEffect;function ed(t){const a=v.useRef(t);return cr(()=>{a.current=t}),v.useCallback(function(){for(var l=arguments.length,s=new Array(l),o=0;o<l;o++)s[o]=arguments[o];return a.current==null?void 0:a.current(...s)},[])}function j2(){const t=v.useRef(null),a=v.useCallback((s,o)=>{t.current=setInterval(s,o)},[]),l=v.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[a,l]}function Oo(t,a){a===void 0&&(a=[t]);const l=v.useRef(t);return cr(()=>{l.current!==t&&(l.current=t)},a),l}function Po(t,a){const l=v.useRef();return v.useMemo(()=>{const s=t(l.current);return l.current=s,s},[...a])}function Oc(t){const a=ed(t),l=v.useRef(null),s=v.useCallback(o=>{o!==l.current&&(a==null||a(o,l.current)),l.current=o},[]);return[l,s]}function Mc(t){const a=v.useRef();return v.useEffect(()=>{a.current=t},[t]),a.current}let Sh={};function Go(t,a){return v.useMemo(()=>{if(a)return a;const l=Sh[t]==null?0:Sh[t]+1;return Sh[t]=l,t+"-"+l},[t,a])}function u0(t){return function(a){for(var l=arguments.length,s=new Array(l>1?l-1:0),o=1;o<l;o++)s[o-1]=arguments[o];return s.reduce((u,f)=>{const m=Object.entries(f);for(const[p,g]of m){const x=u[p];x!=null&&(u[p]=x+t*g)}return u},{...a})}}const ui=u0(1),_c=u0(-1);function T2(t){return"clientX"in t&&"clientY"in t}function td(t){if(!t)return!1;const{KeyboardEvent:a}=pa(t.target);return a&&t instanceof a}function C2(t){if(!t)return!1;const{TouchEvent:a}=pa(t.target);return a&&t instanceof a}function Lc(t){if(C2(t)){if(t.touches&&t.touches.length){const{clientX:a,clientY:l}=t.touches[0];return{x:a,y:l}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:a,clientY:l}=t.changedTouches[0];return{x:a,y:l}}}return T2(t)?{x:t.clientX,y:t.clientY}:null}const Ul=Object.freeze({Translate:{toString(t){if(!t)return;const{x:a,y:l}=t;return"translate3d("+(a?Math.round(a):0)+"px, "+(l?Math.round(l):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:a,scaleY:l}=t;return"scaleX("+a+") scaleY("+l+")"}},Transform:{toString(t){if(t)return[Ul.Translate.toString(t),Ul.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:a,duration:l,easing:s}=t;return a+" "+l+"ms "+s}}}),ox="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function D2(t){return t.matches(ox)?t:t.querySelector(ox)}const A2={display:"none"};function k2(t){let{id:a,value:l}=t;return un.createElement("div",{id:a,style:A2},l)}function O2(t){let{id:a,announcement:l,ariaLiveType:s="assertive"}=t;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return un.createElement("div",{id:a,style:o,role:"status","aria-live":s,"aria-atomic":!0},l)}function M2(){const[t,a]=v.useState("");return{announce:v.useCallback(s=>{s!=null&&a(s)},[]),announcement:t}}const c0=v.createContext(null);function _2(t){const a=v.useContext(c0);v.useEffect(()=>{if(!a)throw new Error("useDndMonitor must be used within a children of <DndContext>");return a(t)},[t,a])}function L2(){const[t]=v.useState(()=>new Set),a=v.useCallback(s=>(t.add(s),()=>t.delete(s)),[t]);return[v.useCallback(s=>{let{type:o,event:u}=s;t.forEach(f=>{var m;return(m=f[o])==null?void 0:m.call(f,u)})},[t]),a]}const z2={draggable:`
274
+ To pick up a draggable item, press the space bar.
275
+ While dragging, use the arrow keys to move the item.
276
+ Press space again to drop the item in its new position, or press escape to cancel.
277
+ `},U2={onDragStart(t){let{active:a}=t;return"Picked up draggable item "+a.id+"."},onDragOver(t){let{active:a,over:l}=t;return l?"Draggable item "+a.id+" was moved over droppable area "+l.id+".":"Draggable item "+a.id+" is no longer over a droppable area."},onDragEnd(t){let{active:a,over:l}=t;return l?"Draggable item "+a.id+" was dropped over droppable area "+l.id:"Draggable item "+a.id+" was dropped."},onDragCancel(t){let{active:a}=t;return"Dragging was cancelled. Draggable item "+a.id+" was dropped."}};function B2(t){let{announcements:a=U2,container:l,hiddenTextDescribedById:s,screenReaderInstructions:o=z2}=t;const{announce:u,announcement:f}=M2(),m=Go("DndLiveRegion"),[p,g]=v.useState(!1);if(v.useEffect(()=>{g(!0)},[]),_2(v.useMemo(()=>({onDragStart(y){let{active:N}=y;u(a.onDragStart({active:N}))},onDragMove(y){let{active:N,over:w}=y;a.onDragMove&&u(a.onDragMove({active:N,over:w}))},onDragOver(y){let{active:N,over:w}=y;u(a.onDragOver({active:N,over:w}))},onDragEnd(y){let{active:N,over:w}=y;u(a.onDragEnd({active:N,over:w}))},onDragCancel(y){let{active:N,over:w}=y;u(a.onDragCancel({active:N,over:w}))}}),[u,a])),!p)return null;const x=un.createElement(un.Fragment,null,un.createElement(k2,{id:s,value:o.draggable}),un.createElement(O2,{id:m,announcement:f}));return l?rl.createPortal(x,l):x}var Un;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Un||(Un={}));function zc(){}function H2(t,a){return v.useMemo(()=>({sensor:t,options:a??{}}),[t,a])}function $2(){for(var t=arguments.length,a=new Array(t),l=0;l<t;l++)a[l]=arguments[l];return v.useMemo(()=>[...a].filter(s=>s!=null),[...a])}const dr=Object.freeze({x:0,y:0});function q2(t,a){return Math.sqrt(Math.pow(t.x-a.x,2)+Math.pow(t.y-a.y,2))}function I2(t,a){const l=Lc(t);if(!l)return"0 0";const s={x:(l.x-a.left)/a.width*100,y:(l.y-a.top)/a.height*100};return s.x+"% "+s.y+"%"}function V2(t,a){let{data:{value:l}}=t,{data:{value:s}}=a;return l-s}function Y2(t,a){let{data:{value:l}}=t,{data:{value:s}}=a;return s-l}function F2(t,a){if(!t||t.length===0)return null;const[l]=t;return l[a]}function ux(t,a,l){return a===void 0&&(a=t.left),l===void 0&&(l=t.top),{x:a+t.width*.5,y:l+t.height*.5}}const P2=t=>{let{collisionRect:a,droppableRects:l,droppableContainers:s}=t;const o=ux(a,a.left,a.top),u=[];for(const f of s){const{id:m}=f,p=l.get(m);if(p){const g=q2(ux(p),o);u.push({id:m,data:{droppableContainer:f,value:g}})}}return u.sort(V2)};function G2(t,a){const l=Math.max(a.top,t.top),s=Math.max(a.left,t.left),o=Math.min(a.left+a.width,t.left+t.width),u=Math.min(a.top+a.height,t.top+t.height),f=o-s,m=u-l;if(s<o&&l<u){const p=a.width*a.height,g=t.width*t.height,x=f*m,y=x/(p+g-x);return Number(y.toFixed(4))}return 0}const X2=t=>{let{collisionRect:a,droppableRects:l,droppableContainers:s}=t;const o=[];for(const u of s){const{id:f}=u,m=l.get(f);if(m){const p=G2(m,a);p>0&&o.push({id:f,data:{droppableContainer:u,value:p}})}}return o.sort(Y2)};function Q2(t,a,l){return{...t,scaleX:a&&l?a.width/l.width:1,scaleY:a&&l?a.height/l.height:1}}function d0(t,a){return t&&a?{x:t.left-a.left,y:t.top-a.top}:dr}function K2(t){return function(l){for(var s=arguments.length,o=new Array(s>1?s-1:0),u=1;u<s;u++)o[u-1]=arguments[u];return o.reduce((f,m)=>({...f,top:f.top+t*m.y,bottom:f.bottom+t*m.y,left:f.left+t*m.x,right:f.right+t*m.x}),{...l})}}const Z2=K2(1);function f0(t){if(t.startsWith("matrix3d(")){const a=t.slice(9,-1).split(/, /);return{x:+a[12],y:+a[13],scaleX:+a[0],scaleY:+a[5]}}else if(t.startsWith("matrix(")){const a=t.slice(7,-1).split(/, /);return{x:+a[4],y:+a[5],scaleX:+a[0],scaleY:+a[3]}}return null}function J2(t,a,l){const s=f0(a);if(!s)return t;const{scaleX:o,scaleY:u,x:f,y:m}=s,p=t.left-f-(1-o)*parseFloat(l),g=t.top-m-(1-u)*parseFloat(l.slice(l.indexOf(" ")+1)),x=o?t.width/o:t.width,y=u?t.height/u:t.height;return{width:x,height:y,top:g,right:p+x,bottom:g+y,left:p}}const W2={ignoreTransform:!1};function gi(t,a){a===void 0&&(a=W2);let l=t.getBoundingClientRect();if(a.ignoreTransform){const{transform:g,transformOrigin:x}=pa(t).getComputedStyle(t);g&&(l=J2(l,g,x))}const{top:s,left:o,width:u,height:f,bottom:m,right:p}=l;return{top:s,left:o,width:u,height:f,bottom:m,right:p}}function cx(t){return gi(t,{ignoreTransform:!0})}function ej(t){const a=t.innerWidth,l=t.innerHeight;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}function tj(t,a){return a===void 0&&(a=pa(t).getComputedStyle(t)),a.position==="fixed"}function nj(t,a){a===void 0&&(a=pa(t).getComputedStyle(t));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=a[o];return typeof u=="string"?l.test(u):!1})}function jm(t,a){const l=[];function s(o){if(a!=null&&l.length>=a||!o)return l;if(Rm(o)&&o.scrollingElement!=null&&!l.includes(o.scrollingElement))return l.push(o.scrollingElement),l;if(!Fo(o)||o0(o)||l.includes(o))return l;const u=pa(t).getComputedStyle(o);return o!==t&&nj(o,u)&&l.push(o),tj(o,u)?l:s(o.parentNode)}return t?s(t):l}function h0(t){const[a]=jm(t,1);return a??null}function wh(t){return!Wc||!t?null:mi(t)?t:Nm(t)?Rm(t)||t===pi(t).scrollingElement?window:Fo(t)?t:null:null}function m0(t){return mi(t)?t.scrollX:t.scrollLeft}function p0(t){return mi(t)?t.scrollY:t.scrollTop}function Ph(t){return{x:m0(t),y:p0(t)}}var Vn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Vn||(Vn={}));function g0(t){return!Wc||!t?!1:t===document.scrollingElement}function v0(t){const a={x:0,y:0},l=g0(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},s={x:t.scrollWidth-l.width,y:t.scrollHeight-l.height},o=t.scrollTop<=a.y,u=t.scrollLeft<=a.x,f=t.scrollTop>=s.y,m=t.scrollLeft>=s.x;return{isTop:o,isLeft:u,isBottom:f,isRight:m,maxScroll:s,minScroll:a}}const aj={x:.2,y:.2};function rj(t,a,l,s,o){let{top:u,left:f,right:m,bottom:p}=l;s===void 0&&(s=10),o===void 0&&(o=aj);const{isTop:g,isBottom:x,isLeft:y,isRight:N}=v0(t),w={x:0,y:0},S={x:0,y:0},D={height:a.height*o.y,width:a.width*o.x};return!g&&u<=a.top+D.height?(w.y=Vn.Backward,S.y=s*Math.abs((a.top+D.height-u)/D.height)):!x&&p>=a.bottom-D.height&&(w.y=Vn.Forward,S.y=s*Math.abs((a.bottom-D.height-p)/D.height)),!N&&m>=a.right-D.width?(w.x=Vn.Forward,S.x=s*Math.abs((a.right-D.width-m)/D.width)):!y&&f<=a.left+D.width&&(w.x=Vn.Backward,S.x=s*Math.abs((a.left+D.width-f)/D.width)),{direction:w,speed:S}}function lj(t){if(t===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:a,left:l,right:s,bottom:o}=t.getBoundingClientRect();return{top:a,left:l,right:s,bottom:o,width:t.clientWidth,height:t.clientHeight}}function y0(t){return t.reduce((a,l)=>ui(a,Ph(l)),dr)}function sj(t){return t.reduce((a,l)=>a+m0(l),0)}function ij(t){return t.reduce((a,l)=>a+p0(l),0)}function x0(t,a){if(a===void 0&&(a=gi),!t)return;const{top:l,left:s,bottom:o,right:u}=a(t);h0(t)&&(o<=0||u<=0||l>=window.innerHeight||s>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const oj=[["x",["left","right"],sj],["y",["top","bottom"],ij]];class Tm{constructor(a,l){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=jm(l),o=y0(s);this.rect={...a},this.width=a.width,this.height=a.height;for(const[u,f,m]of oj)for(const p of f)Object.defineProperty(this,p,{get:()=>{const g=m(s),x=o[u]-g;return this.rect[p]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class No{constructor(a){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(l=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...l)})},this.target=a}add(a,l,s){var o;(o=this.target)==null||o.addEventListener(a,l,s),this.listeners.push([a,l,s])}}function uj(t){const{EventTarget:a}=pa(t);return t instanceof a?t:pi(t)}function Eh(t,a){const l=Math.abs(t.x),s=Math.abs(t.y);return typeof a=="number"?Math.sqrt(l**2+s**2)>a:"x"in a&&"y"in a?l>a.x&&s>a.y:"x"in a?l>a.x:"y"in a?s>a.y:!1}var Za;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Za||(Za={}));function dx(t){t.preventDefault()}function cj(t){t.stopPropagation()}var Mt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Mt||(Mt={}));const b0={start:[Mt.Space,Mt.Enter],cancel:[Mt.Esc],end:[Mt.Space,Mt.Enter,Mt.Tab]},dj=(t,a)=>{let{currentCoordinates:l}=a;switch(t.code){case Mt.Right:return{...l,x:l.x+25};case Mt.Left:return{...l,x:l.x-25};case Mt.Down:return{...l,y:l.y+25};case Mt.Up:return{...l,y:l.y-25}}};class S0{constructor(a){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=a;const{event:{target:l}}=a;this.props=a,this.listeners=new No(pi(l)),this.windowListeners=new No(pa(l)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Za.Resize,this.handleCancel),this.windowListeners.add(Za.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Za.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:a,onStart:l}=this.props,s=a.node.current;s&&x0(s),l(dr)}handleKeyDown(a){if(td(a)){const{active:l,context:s,options:o}=this.props,{keyboardCodes:u=b0,coordinateGetter:f=dj,scrollBehavior:m="smooth"}=o,{code:p}=a;if(u.end.includes(p)){this.handleEnd(a);return}if(u.cancel.includes(p)){this.handleCancel(a);return}const{collisionRect:g}=s.current,x=g?{x:g.left,y:g.top}:dr;this.referenceCoordinates||(this.referenceCoordinates=x);const y=f(a,{active:l,context:s.current,currentCoordinates:x});if(y){const N=_c(y,x),w={x:0,y:0},{scrollableAncestors:S}=s.current;for(const D of S){const R=a.code,{isTop:L,isRight:I,isLeft:q,isBottom:X,maxScroll:W,minScroll:ae}=v0(D),z=lj(D),T={x:Math.min(R===Mt.Right?z.right-z.width/2:z.right,Math.max(R===Mt.Right?z.left:z.left+z.width/2,y.x)),y:Math.min(R===Mt.Down?z.bottom-z.height/2:z.bottom,Math.max(R===Mt.Down?z.top:z.top+z.height/2,y.y))},ee=R===Mt.Right&&!I||R===Mt.Left&&!q,fe=R===Mt.Down&&!X||R===Mt.Up&&!L;if(ee&&T.x!==y.x){const be=D.scrollLeft+N.x,ye=R===Mt.Right&&be<=W.x||R===Mt.Left&&be>=ae.x;if(ye&&!N.y){D.scrollTo({left:be,behavior:m});return}ye?w.x=D.scrollLeft-be:w.x=R===Mt.Right?D.scrollLeft-W.x:D.scrollLeft-ae.x,w.x&&D.scrollBy({left:-w.x,behavior:m});break}else if(fe&&T.y!==y.y){const be=D.scrollTop+N.y,ye=R===Mt.Down&&be<=W.y||R===Mt.Up&&be>=ae.y;if(ye&&!N.x){D.scrollTo({top:be,behavior:m});return}ye?w.y=D.scrollTop-be:w.y=R===Mt.Down?D.scrollTop-W.y:D.scrollTop-ae.y,w.y&&D.scrollBy({top:-w.y,behavior:m});break}}this.handleMove(a,ui(_c(y,this.referenceCoordinates),w))}}}handleMove(a,l){const{onMove:s}=this.props;a.preventDefault(),s(l)}handleEnd(a){const{onEnd:l}=this.props;a.preventDefault(),this.detach(),l()}handleCancel(a){const{onCancel:l}=this.props;a.preventDefault(),this.detach(),l()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}S0.activators=[{eventName:"onKeyDown",handler:(t,a,l)=>{let{keyboardCodes:s=b0,onActivation:o}=a,{active:u}=l;const{code:f}=t.nativeEvent;if(s.start.includes(f)){const m=u.activatorNode.current;return m&&t.target!==m?!1:(t.preventDefault(),o==null||o({event:t.nativeEvent}),!0)}return!1}}];function fx(t){return!!(t&&"distance"in t)}function hx(t){return!!(t&&"delay"in t)}class Cm{constructor(a,l,s){var o;s===void 0&&(s=uj(a.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=a,this.events=l;const{event:u}=a,{target:f}=u;this.props=a,this.events=l,this.document=pi(f),this.documentListeners=new No(this.document),this.listeners=new No(s),this.windowListeners=new No(pa(f)),this.initialCoordinates=(o=Lc(u))!=null?o:dr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:a,props:{options:{activationConstraint:l,bypassActivationConstraint:s}}}=this;if(this.listeners.add(a.move.name,this.handleMove,{passive:!1}),this.listeners.add(a.end.name,this.handleEnd),a.cancel&&this.listeners.add(a.cancel.name,this.handleCancel),this.windowListeners.add(Za.Resize,this.handleCancel),this.windowListeners.add(Za.DragStart,dx),this.windowListeners.add(Za.VisibilityChange,this.handleCancel),this.windowListeners.add(Za.ContextMenu,dx),this.documentListeners.add(Za.Keydown,this.handleKeydown),l){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(hx(l)){this.timeoutId=setTimeout(this.handleStart,l.delay),this.handlePending(l);return}if(fx(l)){this.handlePending(l);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(a,l){const{active:s,onPending:o}=this.props;o(s,a,this.initialCoordinates,l)}handleStart(){const{initialCoordinates:a}=this,{onStart:l}=this.props;a&&(this.activated=!0,this.documentListeners.add(Za.Click,cj,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Za.SelectionChange,this.removeTextSelection),l(a))}handleMove(a){var l;const{activated:s,initialCoordinates:o,props:u}=this,{onMove:f,options:{activationConstraint:m}}=u;if(!o)return;const p=(l=Lc(a))!=null?l:dr,g=_c(o,p);if(!s&&m){if(fx(m)){if(m.tolerance!=null&&Eh(g,m.tolerance))return this.handleCancel();if(Eh(g,m.distance))return this.handleStart()}if(hx(m)&&Eh(g,m.tolerance))return this.handleCancel();this.handlePending(m,g);return}a.cancelable&&a.preventDefault(),f(p)}handleEnd(){const{onAbort:a,onEnd:l}=this.props;this.detach(),this.activated||a(this.props.active),l()}handleCancel(){const{onAbort:a,onCancel:l}=this.props;this.detach(),this.activated||a(this.props.active),l()}handleKeydown(a){a.code===Mt.Esc&&this.handleCancel()}removeTextSelection(){var a;(a=this.document.getSelection())==null||a.removeAllRanges()}}const fj={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Dm extends Cm{constructor(a){const{event:l}=a,s=pi(l.target);super(a,fj,s)}}Dm.activators=[{eventName:"onPointerDown",handler:(t,a)=>{let{nativeEvent:l}=t,{onActivation:s}=a;return!l.isPrimary||l.button!==0?!1:(s==null||s({event:l}),!0)}}];const hj={move:{name:"mousemove"},end:{name:"mouseup"}};var Gh;(function(t){t[t.RightClick=2]="RightClick"})(Gh||(Gh={}));class mj extends Cm{constructor(a){super(a,hj,pi(a.event.target))}}mj.activators=[{eventName:"onMouseDown",handler:(t,a)=>{let{nativeEvent:l}=t,{onActivation:s}=a;return l.button===Gh.RightClick?!1:(s==null||s({event:l}),!0)}}];const Nh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class pj extends Cm{constructor(a){super(a,Nh)}static setup(){return window.addEventListener(Nh.move.name,a,{capture:!1,passive:!1}),function(){window.removeEventListener(Nh.move.name,a)};function a(){}}}pj.activators=[{eventName:"onTouchStart",handler:(t,a)=>{let{nativeEvent:l}=t,{onActivation:s}=a;const{touches:o}=l;return o.length>1?!1:(s==null||s({event:l}),!0)}}];var Ro;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Ro||(Ro={}));var Uc;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Uc||(Uc={}));function gj(t){let{acceleration:a,activator:l=Ro.Pointer,canScroll:s,draggingRect:o,enabled:u,interval:f=5,order:m=Uc.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:x,delta:y,threshold:N}=t;const w=yj({delta:y,disabled:!u}),[S,D]=j2(),R=v.useRef({x:0,y:0}),L=v.useRef({x:0,y:0}),I=v.useMemo(()=>{switch(l){case Ro.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Ro.DraggableRect:return o}},[l,o,p]),q=v.useRef(null),X=v.useCallback(()=>{const ae=q.current;if(!ae)return;const z=R.current.x*L.current.x,T=R.current.y*L.current.y;ae.scrollBy(z,T)},[]),W=v.useMemo(()=>m===Uc.TreeOrder?[...g].reverse():g,[m,g]);v.useEffect(()=>{if(!u||!g.length||!I){D();return}for(const ae of W){if((s==null?void 0:s(ae))===!1)continue;const z=g.indexOf(ae),T=x[z];if(!T)continue;const{direction:ee,speed:fe}=rj(ae,T,I,a,N);for(const be of["x","y"])w[be][ee[be]]||(fe[be]=0,ee[be]=0);if(fe.x>0||fe.y>0){D(),q.current=ae,S(X,f),R.current=fe,L.current=ee;return}}R.current={x:0,y:0},L.current={x:0,y:0},D()},[a,X,s,D,u,f,JSON.stringify(I),JSON.stringify(w),S,g,W,x,JSON.stringify(N)])}const vj={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function yj(t){let{delta:a,disabled:l}=t;const s=Mc(a);return Po(o=>{if(l||!s||!o)return vj;const u={x:Math.sign(a.x-s.x),y:Math.sign(a.y-s.y)};return{x:{[Vn.Backward]:o.x[Vn.Backward]||u.x===-1,[Vn.Forward]:o.x[Vn.Forward]||u.x===1},y:{[Vn.Backward]:o.y[Vn.Backward]||u.y===-1,[Vn.Forward]:o.y[Vn.Forward]||u.y===1}}},[l,a,s])}function xj(t,a){const l=a!=null?t.get(a):void 0,s=l?l.node.current:null;return Po(o=>{var u;return a==null?null:(u=s??o)!=null?u:null},[s,a])}function bj(t,a){return v.useMemo(()=>t.reduce((l,s)=>{const{sensor:o}=s,u=o.activators.map(f=>({eventName:f.eventName,handler:a(f.handler,s)}));return[...l,...u]},[]),[t,a])}var Mo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Mo||(Mo={}));var Xh;(function(t){t.Optimized="optimized"})(Xh||(Xh={}));const mx=new Map;function Sj(t,a){let{dragging:l,dependencies:s,config:o}=a;const[u,f]=v.useState(null),{frequency:m,measure:p,strategy:g}=o,x=v.useRef(t),y=R(),N=Oo(y),w=v.useCallback(function(L){L===void 0&&(L=[]),!N.current&&f(I=>I===null?L:I.concat(L.filter(q=>!I.includes(q))))},[N]),S=v.useRef(null),D=Po(L=>{if(y&&!l)return mx;if(!L||L===mx||x.current!==t||u!=null){const I=new Map;for(let q of t){if(!q)continue;if(u&&u.length>0&&!u.includes(q.id)&&q.rect.current){I.set(q.id,q.rect.current);continue}const X=q.node.current,W=X?new Tm(p(X),X):null;q.rect.current=W,W&&I.set(q.id,W)}return I}return L},[t,u,l,y,p]);return v.useEffect(()=>{x.current=t},[t]),v.useEffect(()=>{y||w()},[l,y]),v.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),v.useEffect(()=>{y||typeof m!="number"||S.current!==null||(S.current=setTimeout(()=>{w(),S.current=null},m))},[m,y,w,...s]),{droppableRects:D,measureDroppableContainers:w,measuringScheduled:u!=null};function R(){switch(g){case Mo.Always:return!1;case Mo.BeforeDragging:return l;default:return!l}}}function Am(t,a){return Po(l=>t?l||(typeof a=="function"?a(t):t):null,[a,t])}function wj(t,a){return Am(t,a)}function Ej(t){let{callback:a,disabled:l}=t;const s=ed(a),o=v.useMemo(()=>{if(l||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(s)},[s,l]);return v.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function nd(t){let{callback:a,disabled:l}=t;const s=ed(a),o=v.useMemo(()=>{if(l||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(s)},[l]);return v.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Nj(t){return new Tm(gi(t),t)}function px(t,a,l){a===void 0&&(a=Nj);const[s,o]=v.useState(null);function u(){o(p=>{if(!t)return null;if(t.isConnected===!1){var g;return(g=p??l)!=null?g:null}const x=a(t);return JSON.stringify(p)===JSON.stringify(x)?p:x})}const f=Ej({callback(p){if(t)for(const g of p){const{type:x,target:y}=g;if(x==="childList"&&y instanceof HTMLElement&&y.contains(t)){u();break}}}}),m=nd({callback:u});return cr(()=>{u(),t?(m==null||m.observe(t),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(m==null||m.disconnect(),f==null||f.disconnect())},[t]),s}function Rj(t){const a=Am(t);return d0(t,a)}const gx=[];function jj(t){const a=v.useRef(t),l=Po(s=>t?s&&s!==gx&&t&&a.current&&t.parentNode===a.current.parentNode?s:jm(t):gx,[t]);return v.useEffect(()=>{a.current=t},[t]),l}function Tj(t){const[a,l]=v.useState(null),s=v.useRef(t),o=v.useCallback(u=>{const f=wh(u.target);f&&l(m=>m?(m.set(f,Ph(f)),new Map(m)):null)},[]);return v.useEffect(()=>{const u=s.current;if(t!==u){f(u);const m=t.map(p=>{const g=wh(p);return g?(g.addEventListener("scroll",o,{passive:!0}),[g,Ph(g)]):null}).filter(p=>p!=null);l(m.length?new Map(m):null),s.current=t}return()=>{f(t),f(u)};function f(m){m.forEach(p=>{const g=wh(p);g==null||g.removeEventListener("scroll",o)})}},[o,t]),v.useMemo(()=>t.length?a?Array.from(a.values()).reduce((u,f)=>ui(u,f),dr):y0(t):dr,[t,a])}function vx(t,a){a===void 0&&(a=[]);const l=v.useRef(null);return v.useEffect(()=>{l.current=null},a),v.useEffect(()=>{const s=t!==dr;s&&!l.current&&(l.current=t),!s&&l.current&&(l.current=null)},[t]),l.current?_c(t,l.current):dr}function Cj(t){v.useEffect(()=>{if(!Wc)return;const a=t.map(l=>{let{sensor:s}=l;return s.setup==null?void 0:s.setup()});return()=>{for(const l of a)l==null||l()}},t.map(a=>{let{sensor:l}=a;return l}))}function Dj(t,a){return v.useMemo(()=>t.reduce((l,s)=>{let{eventName:o,handler:u}=s;return l[o]=f=>{u(f,a)},l},{}),[t,a])}function w0(t){return v.useMemo(()=>t?ej(t):null,[t])}const yx=[];function Aj(t,a){a===void 0&&(a=gi);const[l]=t,s=w0(l?pa(l):null),[o,u]=v.useState(yx);function f(){u(()=>t.length?t.map(p=>g0(p)?s:new Tm(a(p),p)):yx)}const m=nd({callback:f});return cr(()=>{m==null||m.disconnect(),f(),t.forEach(p=>m==null?void 0:m.observe(p))},[t]),o}function E0(t){if(!t)return null;if(t.children.length>1)return t;const a=t.children[0];return Fo(a)?a:t}function kj(t){let{measure:a}=t;const[l,s]=v.useState(null),o=v.useCallback(g=>{for(const{target:x}of g)if(Fo(x)){s(y=>{const N=a(x);return y?{...y,width:N.width,height:N.height}:N});break}},[a]),u=nd({callback:o}),f=v.useCallback(g=>{const x=E0(g);u==null||u.disconnect(),x&&(u==null||u.observe(x)),s(x?a(x):null)},[a,u]),[m,p]=Oc(f);return v.useMemo(()=>({nodeRef:m,rect:l,setRef:p}),[l,m,p])}const Oj=[{sensor:Dm,options:{}},{sensor:S0,options:{}}],Mj={current:{}},Ec={draggable:{measure:cx},droppable:{measure:cx,strategy:Mo.WhileDragging,frequency:Xh.Optimized},dragOverlay:{measure:gi}};class jo extends Map{get(a){var l;return a!=null&&(l=super.get(a))!=null?l:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(a=>{let{disabled:l}=a;return!l})}getNodeFor(a){var l,s;return(l=(s=this.get(a))==null?void 0:s.node.current)!=null?l:void 0}}const _j={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ec,measureDroppableContainers:zc,windowRect:null,measuringScheduled:!1},N0={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:zc,draggableNodes:new Map,over:null,measureDroppableContainers:zc},Xo=v.createContext(N0),R0=v.createContext(_j);function Lj(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jo}}}function zj(t,a){switch(a.type){case Un.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:a.initialCoordinates,active:a.active}};case Un.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:a.coordinates.x-t.draggable.initialCoordinates.x,y:a.coordinates.y-t.draggable.initialCoordinates.y}}};case Un.DragEnd:case Un.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Un.RegisterDroppable:{const{element:l}=a,{id:s}=l,o=new jo(t.droppable.containers);return o.set(s,l),{...t,droppable:{...t.droppable,containers:o}}}case Un.SetDroppableDisabled:{const{id:l,key:s,disabled:o}=a,u=t.droppable.containers.get(l);if(!u||s!==u.key)return t;const f=new jo(t.droppable.containers);return f.set(l,{...u,disabled:o}),{...t,droppable:{...t.droppable,containers:f}}}case Un.UnregisterDroppable:{const{id:l,key:s}=a,o=t.droppable.containers.get(l);if(!o||s!==o.key)return t;const u=new jo(t.droppable.containers);return u.delete(l),{...t,droppable:{...t.droppable,containers:u}}}default:return t}}function Uj(t){let{disabled:a}=t;const{active:l,activatorEvent:s,draggableNodes:o}=v.useContext(Xo),u=Mc(s),f=Mc(l==null?void 0:l.id);return v.useEffect(()=>{if(!a&&!s&&u&&f!=null){if(!td(u)||document.activeElement===u.target)return;const m=o.get(f);if(!m)return;const{activatorNode:p,node:g}=m;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const x of[p.current,g.current]){if(!x)continue;const y=D2(x);if(y){y.focus();break}}})}},[s,a,o,f,u]),null}function j0(t,a){let{transform:l,...s}=a;return t!=null&&t.length?t.reduce((o,u)=>u({transform:o,...s}),l):l}function Bj(t){return v.useMemo(()=>({draggable:{...Ec.draggable,...t==null?void 0:t.draggable},droppable:{...Ec.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Ec.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function Hj(t){let{activeNode:a,measure:l,initialRect:s,config:o=!0}=t;const u=v.useRef(!1),{x:f,y:m}=typeof o=="boolean"?{x:o,y:o}:o;cr(()=>{if(!f&&!m||!a){u.current=!1;return}if(u.current||!s)return;const g=a==null?void 0:a.node.current;if(!g||g.isConnected===!1)return;const x=l(g),y=d0(x,s);if(f||(y.x=0),m||(y.y=0),u.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const N=h0(g);N&&N.scrollBy({top:y.y,left:y.x})}},[a,f,m,s,l])}const ad=v.createContext({...dr,scaleX:1,scaleY:1});var Ml;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Ml||(Ml={}));const $j=v.memo(function(a){var l,s,o,u;let{id:f,accessibility:m,autoScroll:p=!0,children:g,sensors:x=Oj,collisionDetection:y=X2,measuring:N,modifiers:w,...S}=a;const D=v.useReducer(zj,void 0,Lj),[R,L]=D,[I,q]=L2(),[X,W]=v.useState(Ml.Uninitialized),ae=X===Ml.Initialized,{draggable:{active:z,nodes:T,translate:ee},droppable:{containers:fe}}=R,be=z!=null?T.get(z):null,ye=v.useRef({initial:null,translated:null}),te=v.useMemo(()=>{var yt;return z!=null?{id:z,data:(yt=be==null?void 0:be.data)!=null?yt:Mj,rect:ye}:null},[z,be]),re=v.useRef(null),[ge,U]=v.useState(null),[B,ue]=v.useState(null),de=Oo(S,Object.values(S)),we=Go("DndDescribedBy",f),C=v.useMemo(()=>fe.getEnabled(),[fe]),V=Bj(N),{droppableRects:ne,measureDroppableContainers:me,measuringScheduled:Ne}=Sj(C,{dragging:ae,dependencies:[ee.x,ee.y],config:V.droppable}),je=xj(T,z),ze=v.useMemo(()=>B?Lc(B):null,[B]),ut=vt(),Ge=wj(je,V.draggable.measure);Hj({activeNode:z!=null?T.get(z):null,config:ut.layoutShiftCompensation,initialRect:Ge,measure:V.draggable.measure});const nt=px(je,V.draggable.measure,Ge),Sn=px(je?je.parentElement:null),Xt=v.useRef({activatorEvent:null,active:null,activeNode:je,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:fe,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ft=fe.getNodeFor((l=Xt.current.over)==null?void 0:l.id),oe=kj({measure:V.dragOverlay.measure}),$e=(s=oe.nodeRef.current)!=null?s:je,at=ae?(o=oe.rect)!=null?o:nt:null,Ut=!!(oe.nodeRef.current&&oe.rect),pn=Rj(Ut?null:nt),jt=w0($e?pa($e):null),_t=jj(ae?ft??je:null),Qt=Aj(_t),Hn=j0(w,{transform:{x:ee.x-pn.x,y:ee.y-pn.y,scaleX:1,scaleY:1},activatorEvent:B,active:te,activeNodeRect:nt,containerNodeRect:Sn,draggingNodeRect:at,over:Xt.current.over,overlayNodeRect:oe.rect,scrollableAncestors:_t,scrollableAncestorRects:Qt,windowRect:jt}),$n=ze?ui(ze,ee):null,tn=Tj(_t),da=vx(tn),fa=vx(tn,[nt]),Wn=ui(Hn,da),qn=at?Z2(at,Hn):null,he=te&&qn?y({active:te,collisionRect:qn,droppableRects:ne,droppableContainers:C,pointerCoordinates:$n}):null,Ce=F2(he,"id"),[De,Pe]=v.useState(null),qe=Ut?Hn:ui(Hn,fa),Z=Q2(qe,(u=De==null?void 0:De.rect)!=null?u:null,nt),Tt=v.useRef(null),Kt=v.useCallback((yt,St)=>{let{sensor:Bt,options:Ct}=St;if(re.current==null)return;const nn=T.get(re.current);if(!nn)return;const Zt=yt.nativeEvent,Ht=new Bt({active:re.current,activeNode:nn,event:Zt,options:Ct,context:Xt,onAbort(Je){if(!T.get(Je))return;const{onDragAbort:kn}=de.current,A={id:Je};kn==null||kn(A),I({type:"onDragAbort",event:A})},onPending(Je,wn,kn,A){if(!T.get(Je))return;const{onDragPending:$}=de.current,K={id:Je,constraint:wn,initialCoordinates:kn,offset:A};$==null||$(K),I({type:"onDragPending",event:K})},onStart(Je){const wn=re.current;if(wn==null)return;const kn=T.get(wn);if(!kn)return;const{onDragStart:A}=de.current,M={activatorEvent:Zt,active:{id:wn,data:kn.data,rect:ye}};rl.unstable_batchedUpdates(()=>{A==null||A(M),W(Ml.Initializing),L({type:Un.DragStart,initialCoordinates:Je,active:wn}),I({type:"onDragStart",event:M}),U(Tt.current),ue(Zt)})},onMove(Je){L({type:Un.DragMove,coordinates:Je})},onEnd:ht(Un.DragEnd),onCancel:ht(Un.DragCancel)});Tt.current=Ht;function ht(Je){return async function(){const{active:kn,collisions:A,over:M,scrollAdjustedTranslate:$}=Xt.current;let K=null;if(kn&&$){const{cancelDrop:se}=de.current;K={activatorEvent:Zt,active:kn,collisions:A,delta:$,over:M},Je===Un.DragEnd&&typeof se=="function"&&await Promise.resolve(se(K))&&(Je=Un.DragCancel)}re.current=null,rl.unstable_batchedUpdates(()=>{L({type:Je}),W(Ml.Uninitialized),Pe(null),U(null),ue(null),Tt.current=null;const se=Je===Un.DragEnd?"onDragEnd":"onDragCancel";if(K){const Te=de.current[se];Te==null||Te(K),I({type:se,event:K})}})}}},[T]),Yn=v.useCallback((yt,St)=>(Bt,Ct)=>{const nn=Bt.nativeEvent,Zt=T.get(Ct);if(re.current!==null||!Zt||nn.dndKit||nn.defaultPrevented)return;const Ht={active:Zt};yt(Bt,St.options,Ht)===!0&&(nn.dndKit={capturedBy:St.sensor},re.current=Ct,Kt(Bt,St))},[T,Kt]),gn=bj(x,Yn);Cj(x),cr(()=>{nt&&X===Ml.Initializing&&W(Ml.Initialized)},[nt,X]),v.useEffect(()=>{const{onDragMove:yt}=de.current,{active:St,activatorEvent:Bt,collisions:Ct,over:nn}=Xt.current;if(!St||!Bt)return;const Zt={active:St,activatorEvent:Bt,collisions:Ct,delta:{x:Wn.x,y:Wn.y},over:nn};rl.unstable_batchedUpdates(()=>{yt==null||yt(Zt),I({type:"onDragMove",event:Zt})})},[Wn.x,Wn.y]),v.useEffect(()=>{const{active:yt,activatorEvent:St,collisions:Bt,droppableContainers:Ct,scrollAdjustedTranslate:nn}=Xt.current;if(!yt||re.current==null||!St||!nn)return;const{onDragOver:Zt}=de.current,Ht=Ct.get(Ce),ht=Ht&&Ht.rect.current?{id:Ht.id,rect:Ht.rect.current,data:Ht.data,disabled:Ht.disabled}:null,Je={active:yt,activatorEvent:St,collisions:Bt,delta:{x:nn.x,y:nn.y},over:ht};rl.unstable_batchedUpdates(()=>{Pe(ht),Zt==null||Zt(Je),I({type:"onDragOver",event:Je})})},[Ce]),cr(()=>{Xt.current={activatorEvent:B,active:te,activeNode:je,collisionRect:qn,collisions:he,droppableRects:ne,draggableNodes:T,draggingNode:$e,draggingNodeRect:at,droppableContainers:fe,over:De,scrollableAncestors:_t,scrollAdjustedTranslate:Wn},ye.current={initial:at,translated:qn}},[te,je,he,qn,T,$e,at,ne,fe,De,_t,Wn]),gj({...ut,delta:ee,draggingRect:qn,pointerCoordinates:$n,scrollableAncestors:_t,scrollableAncestorRects:Qt});const Ba=v.useMemo(()=>({active:te,activeNode:je,activeNodeRect:nt,activatorEvent:B,collisions:he,containerNodeRect:Sn,dragOverlay:oe,draggableNodes:T,droppableContainers:fe,droppableRects:ne,over:De,measureDroppableContainers:me,scrollableAncestors:_t,scrollableAncestorRects:Qt,measuringConfiguration:V,measuringScheduled:Ne,windowRect:jt}),[te,je,nt,B,he,Sn,oe,T,fe,ne,De,me,_t,Qt,V,Ne,jt]),Me=v.useMemo(()=>({activatorEvent:B,activators:gn,active:te,activeNodeRect:nt,ariaDescribedById:{draggable:we},dispatch:L,draggableNodes:T,over:De,measureDroppableContainers:me}),[B,gn,te,nt,L,we,T,De,me]);return un.createElement(c0.Provider,{value:q},un.createElement(Xo.Provider,{value:Me},un.createElement(R0.Provider,{value:Ba},un.createElement(ad.Provider,{value:Z},g)),un.createElement(Uj,{disabled:(m==null?void 0:m.restoreFocus)===!1})),un.createElement(B2,{...m,hiddenTextDescribedById:we}));function vt(){const yt=(ge==null?void 0:ge.autoScrollEnabled)===!1,St=typeof p=="object"?p.enabled===!1:p===!1,Bt=ae&&!yt&&!St;return typeof p=="object"?{...p,enabled:Bt}:{enabled:Bt}}}),qj=v.createContext(null),xx="button",Ij="Draggable";function Vj(t){let{id:a,data:l,disabled:s=!1,attributes:o}=t;const u=Go(Ij),{activators:f,activatorEvent:m,active:p,activeNodeRect:g,ariaDescribedById:x,draggableNodes:y,over:N}=v.useContext(Xo),{role:w=xx,roleDescription:S="draggable",tabIndex:D=0}=o??{},R=(p==null?void 0:p.id)===a,L=v.useContext(R?ad:qj),[I,q]=Oc(),[X,W]=Oc(),ae=Dj(f,a),z=Oo(l);cr(()=>(y.set(a,{id:a,key:u,node:I,activatorNode:X,data:z}),()=>{const ee=y.get(a);ee&&ee.key===u&&y.delete(a)}),[y,a]);const T=v.useMemo(()=>({role:w,tabIndex:D,"aria-disabled":s,"aria-pressed":R&&w===xx?!0:void 0,"aria-roledescription":S,"aria-describedby":x.draggable}),[s,w,D,R,S,x.draggable]);return{active:p,activatorEvent:m,activeNodeRect:g,attributes:T,isDragging:R,listeners:s?void 0:ae,node:I,over:N,setNodeRef:q,setActivatorNodeRef:W,transform:L}}function T0(){return v.useContext(R0)}const Yj="Droppable",Fj={timeout:25};function Pj(t){let{data:a,disabled:l=!1,id:s,resizeObserverConfig:o}=t;const u=Go(Yj),{active:f,dispatch:m,over:p,measureDroppableContainers:g}=v.useContext(Xo),x=v.useRef({disabled:l}),y=v.useRef(!1),N=v.useRef(null),w=v.useRef(null),{disabled:S,updateMeasurementsFor:D,timeout:R}={...Fj,...o},L=Oo(D??s),I=v.useCallback(()=>{if(!y.current){y.current=!0;return}w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{g(Array.isArray(L.current)?L.current:[L.current]),w.current=null},R)},[R]),q=nd({callback:I,disabled:S||!f}),X=v.useCallback((T,ee)=>{q&&(ee&&(q.unobserve(ee),y.current=!1),T&&q.observe(T))},[q]),[W,ae]=Oc(X),z=Oo(a);return v.useEffect(()=>{!q||!W.current||(q.disconnect(),y.current=!1,q.observe(W.current))},[W,q]),v.useEffect(()=>(m({type:Un.RegisterDroppable,element:{id:s,key:u,disabled:l,node:W,rect:N,data:z}}),()=>m({type:Un.UnregisterDroppable,key:u,id:s})),[s]),v.useEffect(()=>{l!==x.current.disabled&&(m({type:Un.SetDroppableDisabled,id:s,key:u,disabled:l}),x.current.disabled=l)},[s,u,l,m]),{active:f,rect:N,isOver:(p==null?void 0:p.id)===s,node:W,over:p,setNodeRef:ae}}function Gj(t){let{animation:a,children:l}=t;const[s,o]=v.useState(null),[u,f]=v.useState(null),m=Mc(l);return!l&&!s&&m&&o(m),cr(()=>{if(!u)return;const p=s==null?void 0:s.key,g=s==null?void 0:s.props.id;if(p==null||g==null){o(null);return}Promise.resolve(a(g,u)).then(()=>{o(null)})},[a,s,u]),un.createElement(un.Fragment,null,l,s?v.cloneElement(s,{ref:f}):null)}const Xj={x:0,y:0,scaleX:1,scaleY:1};function Qj(t){let{children:a}=t;return un.createElement(Xo.Provider,{value:N0},un.createElement(ad.Provider,{value:Xj},a))}const Kj={position:"fixed",touchAction:"none"},Zj=t=>td(t)?"transform 250ms ease":void 0,Jj=v.forwardRef((t,a)=>{let{as:l,activatorEvent:s,adjustScale:o,children:u,className:f,rect:m,style:p,transform:g,transition:x=Zj}=t;if(!m)return null;const y=o?g:{...g,scaleX:1,scaleY:1},N={...Kj,width:m.width,height:m.height,top:m.top,left:m.left,transform:Ul.Transform.toString(y),transformOrigin:o&&s?I2(s,m):void 0,transition:typeof x=="function"?x(s):x,...p};return un.createElement(l,{className:f,style:N,ref:a},u)}),Wj=t=>a=>{let{active:l,dragOverlay:s}=a;const o={},{styles:u,className:f}=t;if(u!=null&&u.active)for(const[m,p]of Object.entries(u.active))p!==void 0&&(o[m]=l.node.style.getPropertyValue(m),l.node.style.setProperty(m,p));if(u!=null&&u.dragOverlay)for(const[m,p]of Object.entries(u.dragOverlay))p!==void 0&&s.node.style.setProperty(m,p);return f!=null&&f.active&&l.node.classList.add(f.active),f!=null&&f.dragOverlay&&s.node.classList.add(f.dragOverlay),function(){for(const[p,g]of Object.entries(o))l.node.style.setProperty(p,g);f!=null&&f.active&&l.node.classList.remove(f.active)}},eT=t=>{let{transform:{initial:a,final:l}}=t;return[{transform:Ul.Transform.toString(a)},{transform:Ul.Transform.toString(l)}]},tT={duration:250,easing:"ease",keyframes:eT,sideEffects:Wj({styles:{active:{opacity:"0"}}})};function nT(t){let{config:a,draggableNodes:l,droppableContainers:s,measuringConfiguration:o}=t;return ed((u,f)=>{if(a===null)return;const m=l.get(u);if(!m)return;const p=m.node.current;if(!p)return;const g=E0(f);if(!g)return;const{transform:x}=pa(f).getComputedStyle(f),y=f0(x);if(!y)return;const N=typeof a=="function"?a:aT(a);return x0(p,o.draggable.measure),N({active:{id:u,data:m.data,node:p,rect:o.draggable.measure(p)},draggableNodes:l,dragOverlay:{node:f,rect:o.dragOverlay.measure(g)},droppableContainers:s,measuringConfiguration:o,transform:y})})}function aT(t){const{duration:a,easing:l,sideEffects:s,keyframes:o}={...tT,...t};return u=>{let{active:f,dragOverlay:m,transform:p,...g}=u;if(!a)return;const x={x:m.rect.left-f.rect.left,y:m.rect.top-f.rect.top},y={scaleX:p.scaleX!==1?f.rect.width*p.scaleX/m.rect.width:1,scaleY:p.scaleY!==1?f.rect.height*p.scaleY/m.rect.height:1},N={x:p.x-x.x,y:p.y-x.y,...y},w=o({...g,active:f,dragOverlay:m,transform:{initial:p,final:N}}),[S]=w,D=w[w.length-1];if(JSON.stringify(S)===JSON.stringify(D))return;const R=s==null?void 0:s({active:f,dragOverlay:m,...g}),L=m.node.animate(w,{duration:a,easing:l,fill:"forwards"});return new Promise(I=>{L.onfinish=()=>{R==null||R(),I()}})}}let bx=0;function rT(t){return v.useMemo(()=>{if(t!=null)return bx++,bx},[t])}const lT=un.memo(t=>{let{adjustScale:a=!1,children:l,dropAnimation:s,style:o,transition:u,modifiers:f,wrapperElement:m="div",className:p,zIndex:g=999}=t;const{activatorEvent:x,active:y,activeNodeRect:N,containerNodeRect:w,draggableNodes:S,droppableContainers:D,dragOverlay:R,over:L,measuringConfiguration:I,scrollableAncestors:q,scrollableAncestorRects:X,windowRect:W}=T0(),ae=v.useContext(ad),z=rT(y==null?void 0:y.id),T=j0(f,{activatorEvent:x,active:y,activeNodeRect:N,containerNodeRect:w,draggingNodeRect:R.rect,over:L,overlayNodeRect:R.rect,scrollableAncestors:q,scrollableAncestorRects:X,transform:ae,windowRect:W}),ee=Am(N),fe=nT({config:s,draggableNodes:S,droppableContainers:D,measuringConfiguration:I}),be=ee?R.setRef:void 0;return un.createElement(Qj,null,un.createElement(Gj,{animation:fe},y&&z?un.createElement(Jj,{key:z,id:y.id,ref:be,as:m,activatorEvent:x,adjustScale:a,className:p,transition:u,rect:ee,style:{zIndex:g,...o},transform:T},l):null))});function To(t,a,l){const s=t.slice();return s.splice(l<0?s.length+l:l,0,s.splice(a,1)[0]),s}function sT(t,a){return t.reduce((l,s,o)=>{const u=a.get(s);return u&&(l[o]=u),l},Array(t.length))}function dc(t){return t!==null&&t>=0}function iT(t,a){if(t===a)return!0;if(t.length!==a.length)return!1;for(let l=0;l<t.length;l++)if(t[l]!==a[l])return!1;return!0}function oT(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const C0=t=>{let{rects:a,activeIndex:l,overIndex:s,index:o}=t;const u=To(a,s,l),f=a[o],m=u[o];return!m||!f?null:{x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height}},fc={scaleX:1,scaleY:1},km=t=>{var a;let{activeIndex:l,activeNodeRect:s,index:o,rects:u,overIndex:f}=t;const m=(a=u[l])!=null?a:s;if(!m)return null;if(o===l){const g=u[f];return g?{x:0,y:l<f?g.top+g.height-(m.top+m.height):g.top-m.top,...fc}:null}const p=uT(u,o,l);return o>l&&o<=f?{x:0,y:-m.height-p,...fc}:o<l&&o>=f?{x:0,y:m.height+p,...fc}:{x:0,y:0,...fc}};function uT(t,a,l){const s=t[a],o=t[a-1],u=t[a+1];return s?l<a?o?s.top-(o.top+o.height):u?u.top-(s.top+s.height):0:u?u.top-(s.top+s.height):o?s.top-(o.top+o.height):0:0}const D0="Sortable",A0=un.createContext({activeIndex:-1,containerId:D0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:C0,disabled:{draggable:!1,droppable:!1}});function Om(t){let{children:a,id:l,items:s,strategy:o=C0,disabled:u=!1}=t;const{active:f,dragOverlay:m,droppableRects:p,over:g,measureDroppableContainers:x}=T0(),y=Go(D0,l),N=m.rect!==null,w=v.useMemo(()=>s.map(ae=>typeof ae=="object"&&"id"in ae?ae.id:ae),[s]),S=f!=null,D=f?w.indexOf(f.id):-1,R=g?w.indexOf(g.id):-1,L=v.useRef(w),I=!iT(w,L.current),q=R!==-1&&D===-1||I,X=oT(u);cr(()=>{I&&S&&x(w)},[I,w,S,x]),v.useEffect(()=>{L.current=w},[w]);const W=v.useMemo(()=>({activeIndex:D,containerId:y,disabled:X,disableTransforms:q,items:w,overIndex:R,useDragOverlay:N,sortedRects:sT(w,p),strategy:o}),[D,y,X.draggable,X.droppable,q,w,R,p,N,o]);return un.createElement(A0.Provider,{value:W},a)}const cT=t=>{let{id:a,items:l,activeIndex:s,overIndex:o}=t;return To(l,s,o).indexOf(a)},dT=t=>{let{containerId:a,isSorting:l,wasDragging:s,index:o,items:u,newIndex:f,previousItems:m,previousContainerId:p,transition:g}=t;return!g||!s||m!==u&&o===f?!1:l?!0:f!==o&&a===p},fT={duration:200,easing:"ease"},k0="transform",hT=Ul.Transition.toString({property:k0,duration:0,easing:"linear"}),mT={roleDescription:"sortable"};function pT(t){let{disabled:a,index:l,node:s,rect:o}=t;const[u,f]=v.useState(null),m=v.useRef(l);return cr(()=>{if(!a&&l!==m.current&&s.current){const p=o.current;if(p){const g=gi(s.current,{ignoreTransform:!0}),x={x:p.left-g.left,y:p.top-g.top,scaleX:p.width/g.width,scaleY:p.height/g.height};(x.x||x.y)&&f(x)}}l!==m.current&&(m.current=l)},[a,l,s,o]),v.useEffect(()=>{u&&f(null)},[u]),u}function gT(t){let{animateLayoutChanges:a=dT,attributes:l,disabled:s,data:o,getNewIndex:u=cT,id:f,strategy:m,resizeObserverConfig:p,transition:g=fT}=t;const{items:x,containerId:y,activeIndex:N,disabled:w,disableTransforms:S,sortedRects:D,overIndex:R,useDragOverlay:L,strategy:I}=v.useContext(A0),q=vT(s,w),X=x.indexOf(f),W=v.useMemo(()=>({sortable:{containerId:y,index:X,items:x},...o}),[y,o,X,x]),ae=v.useMemo(()=>x.slice(x.indexOf(f)),[x,f]),{rect:z,node:T,isOver:ee,setNodeRef:fe}=Pj({id:f,data:W,disabled:q.droppable,resizeObserverConfig:{updateMeasurementsFor:ae,...p}}),{active:be,activatorEvent:ye,activeNodeRect:te,attributes:re,setNodeRef:ge,listeners:U,isDragging:B,over:ue,setActivatorNodeRef:de,transform:we}=Vj({id:f,data:W,attributes:{...mT,...l},disabled:q.draggable}),C=R2(fe,ge),V=!!be,ne=V&&!S&&dc(N)&&dc(R),me=!L&&B,Ne=me&&ne?we:null,ze=ne?Ne??(m??I)({rects:D,activeNodeRect:te,activeIndex:N,overIndex:R,index:X}):null,ut=dc(N)&&dc(R)?u({id:f,items:x,activeIndex:N,overIndex:R}):X,Ge=be==null?void 0:be.id,nt=v.useRef({activeId:Ge,items:x,newIndex:ut,containerId:y}),Sn=x!==nt.current.items,Xt=a({active:be,containerId:y,isDragging:B,isSorting:V,id:f,index:X,items:x,newIndex:nt.current.newIndex,previousItems:nt.current.items,previousContainerId:nt.current.containerId,transition:g,wasDragging:nt.current.activeId!=null}),ft=pT({disabled:!Xt,index:X,node:T,rect:z});return v.useEffect(()=>{V&&nt.current.newIndex!==ut&&(nt.current.newIndex=ut),y!==nt.current.containerId&&(nt.current.containerId=y),x!==nt.current.items&&(nt.current.items=x)},[V,ut,y,x]),v.useEffect(()=>{if(Ge===nt.current.activeId)return;if(Ge!=null&&nt.current.activeId==null){nt.current.activeId=Ge;return}const $e=setTimeout(()=>{nt.current.activeId=Ge},50);return()=>clearTimeout($e)},[Ge]),{active:be,activeIndex:N,attributes:re,data:W,rect:z,index:X,newIndex:ut,items:x,isOver:ee,isSorting:V,isDragging:B,listeners:U,node:T,overIndex:R,over:ue,setNodeRef:C,setActivatorNodeRef:de,setDroppableNodeRef:fe,setDraggableNodeRef:ge,transform:ft??ze,transition:oe()};function oe(){if(ft||Sn&&nt.current.newIndex===X)return hT;if(!(me&&!td(ye)||!g)&&(V||Xt))return Ul.Transition.toString({...g,property:k0})}}function vT(t,a){var l,s;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(l=t==null?void 0:t.draggable)!=null?l:a.draggable,droppable:(s=t==null?void 0:t.droppable)!=null?s:a.droppable}}Mt.Down,Mt.Right,Mt.Up,Mt.Left;const yT=[{value:"priority",label:"Priority"},{value:"number",label:"Number"},{value:"createdAt",label:"Created date"},{value:"updatedAt",label:"Updated date"},{value:"title",label:"Title"},{value:"shortId",label:"Short ID"},{value:"status",label:"Status"},{value:"startedAt",label:"Started"},{value:"completedAt",label:"Completed"}];function Mm({sort:t,onChange:a,label:l="Sort by"}){return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("label",{htmlFor:"sort-control",className:"hidden text-xs text-[var(--text-muted)] sm:inline",children:l}),c.jsxs("div",{className:"inline-flex h-9 items-center gap-1 rounded-lg border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1 shadow-sm",children:[c.jsxs("div",{className:"relative",children:[c.jsx("select",{id:"sort-control",value:t.key,onChange:s=>a({key:s.target.value,direction:t.direction}),className:"h-7 w-full min-w-[7.5rem] cursor-pointer appearance-none border-0 bg-transparent pr-6 pl-1 text-xs font-medium text-[var(--text)] outline-none hover:text-[var(--accent)] sm:w-auto",children:yT.map(s=>c.jsx("option",{value:s.value,children:s.label},s.value))}),c.jsx(ps,{className:"pointer-events-none absolute right-0 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]","aria-hidden":"true"})]}),c.jsx("button",{type:"button",onClick:()=>a({key:t.key,direction:t.direction==="asc"?"desc":"asc"}),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[var(--text-muted)] transition hover:bg-[var(--surface-strong)] hover:text-[var(--text)]","aria-label":`Sort direction: ${t.direction}`,title:`Sort direction: ${t.direction}`,children:t.direction==="asc"?c.jsx(pN,{className:"h-3.5 w-3.5","aria-hidden":"true"}):c.jsx(fN,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})}const rd=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],ld=[{value:"draft",label:"Draft"},{value:"discovery",label:"Discovery"},{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],Qo=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],O0=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],ho=rd.map(t=>t.value),mo=ld.map(t=>t.value),po=Qo.map(t=>t.value);function Rh(t,a,l){if(t.includes(a)){const s=t.filter(o=>o!==a);return s.length===0?[...l]:s}return[...t,a]}function Js(t,a){return a.includes(t)}function ir(t,a){return`agent-plan:dashboard:${t}:${a}`}function jh(t,a,l){if(typeof window>"u")return a;try{const s=window.localStorage.getItem(t);if(!s)return a;const o=JSON.parse(s);if(!Array.isArray(o))return a;const u=`${t}-schema`,f=l.slice().sort().join(",");if(window.localStorage.getItem(u)!==f)return window.localStorage.setItem(u,f),a;const p=o.filter(g=>typeof g=="string"&&l.includes(g));return p.length>0?p:a}catch{return a}}function Th(t,a,l){typeof window>"u"||(window.localStorage.setItem(t,JSON.stringify(a)),window.localStorage.setItem(`${t}-schema`,l.slice().sort().join(",")))}function Ch(t,a){if(typeof window>"u")return a;const l=window.localStorage.getItem(t);return l===null?a:l==="true"}const Sx={featureNumbers:null,phaseNumbers:null,taskNumbers:null,shortIds:null,status:null,featureStatus:null,phaseStatus:null,text:null},wx=/^(feature-status|phase-status|feature|phase|task|id|status|title):(.*)$/i;function M0(t){return t.split(",").map(a=>a.trim()).filter(a=>a.length>0)}function xT(t){return new Set(M0(t).map(a=>Number(a)).filter(a=>Number.isFinite(a)&&a>0))}function Ex(t){const a=t.toUpperCase();return a==="AND"||a==="OR"}function Dh(t,a){const l=t??new Set;for(const s of xT(a))l.add(s);return l}function bT(t,a){const l=t??new Set;for(const s of M0(a).map(o=>o.toUpperCase()))l.add(s);return l}function ST(t){const a=t.trim();if(!a)return{...Sx};const l={...Sx},s=[],o=[];let u=0;for(;u<a.length;){const m=a[u];if(m==='"'){const p=a.indexOf('"',u+1);if(p===-1){o.push(a.slice(u+1));break}o.push(a.slice(u+1,p)),u=p+1}else if(m===" ")u+=1;else{let p=u;for(;p<a.length&&a[p]!==" ";)p+=1;o.push(a.slice(u,p)),u=p}}let f=0;for(;f<o.length;){const m=o[f];if(Ex(m)){f+=1;continue}const p=m.match(wx);if(p){const g=(p[1]??"").toLowerCase();let x=p[2]??"";if(x.trim()===""&&f+1<o.length){let y=f+1;for(;y<o.length&&Ex(o[y]);)y+=1;y<o.length&&!o[y].match(wx)&&(x=o[y],f=y)}if(g==="feature"){const y=Dh(l.featureNumbers,x);y.size&&(l.featureNumbers=y)}else if(g==="phase"){const y=Dh(l.phaseNumbers,x);y.size&&(l.phaseNumbers=y)}else if(g==="task"){const y=Dh(l.taskNumbers,x);y.size&&(l.taskNumbers=y)}else if(g==="id"){const y=bT(l.shortIds,x);y.size&&(l.shortIds=y)}else g==="status"?x.trim()&&(l.status=x.toLowerCase()):g==="feature-status"?x.trim()&&(l.featureStatus=x.toLowerCase()):g==="phase-status"?x.trim()&&(l.phaseStatus=x.toLowerCase()):g==="title"&&x.trim()&&(l.text=x.toLowerCase())}else s.push(m.toLowerCase());f+=1}return s.length>0&&!l.text&&(l.text=s.join(" ")),l}function wT(t){return!!(t.featureNumbers||t.phaseNumbers||t.taskNumbers||t.shortIds||t.status||t.featureStatus||t.phaseStatus||t.text)}function _0(t){const a=l=>String(l).padStart(3,"0");return[t.task.title,t.task.shortName??"",t.task.shortId??"",String(t.task.number),`T${a(t.task.number)}`,t.task.description??"",t.task.notes??"",t.phase.title,t.phase.slug??"",t.phase.shortId??"",String(t.phase.number),`P${a(t.phase.number)}`,t.phase.description??"",t.phase.summary??"",t.phase.notes??"",t.feature.name,t.feature.shortId??"",String(t.feature.number),`F${a(t.feature.number)}`,t.feature.description??""].join(" ").toLowerCase()}function ET(t,a,l){if(t.featureNumbers&&!t.featureNumbers.has(a.feature.number)||t.phaseNumbers&&!t.phaseNumbers.has(a.phase.number)||t.taskNumbers&&!t.taskNumbers.has(a.task.number)||t.shortIds&&!(t.shortIds.has(a.task.shortId??"")||t.shortIds.has(a.phase.shortId??"")||t.shortIds.has(a.feature.shortId??""))||t.status&&a.task.status!==t.status||t.featureStatus&&a.feature.status!==t.featureStatus||t.phaseStatus&&a.phase.status!==t.phaseStatus)return!1;if(t.text){const s=t.text;if(!(l??_0(a)).includes(s))return!1}return!0}function NT({features:t,phases:a,projectStorageScope:l}){const s=ir(l,"show-all-features"),o=ir(l,"tree-open-mode"),u=ir(l,"expanded-features"),f=ir(l,"expanded-phases"),m=ir(l,"feature-status-filters"),p=ir(l,"phase-status-filters"),g=ir(l,"task-status-filters"),x=ir(l,"hide-done"),y=ir(l,"hide-planned"),N=ir(l,"only-active-branches"),w=ir(l,"work-tree-sort"),[S,D]=v.useState(""),[R,L]=v.useState(()=>{if(typeof window>"u")return So;try{const he=window.localStorage.getItem(w);if(!he)return So;const Ce=JSON.parse(he);if(Ce.key&&Ce.direction)return{key:Ce.key,direction:Ce.direction}}catch{}return So}),I=v.useMemo(()=>E2(t,a,R),[t,a,R]),q=v.useMemo(()=>ST(S),[S]),X=wT(q),W=v.useMemo(()=>{if(!X||!q.text)return null;const he=new Map;for(const Ce of I)for(const De of Ce.allPhases)for(const Pe of De.allTasks)he.set(Pe.id,_0({feature:Ce.feature,phase:De.phase,task:Pe}));return he},[X,q.text,I]),{matchedTaskIds:ae,matchedFeatureIds:z,matchedPhaseIds:T}=v.useMemo(()=>{const he=new Set,Ce=new Set,De=new Set;if(!X)return{matchedTaskIds:he,matchedFeatureIds:Ce,matchedPhaseIds:De};for(const Pe of I)for(const qe of Pe.allPhases)for(const Z of qe.allTasks)ET(q,{feature:Pe.feature,phase:qe.phase,task:Z},W==null?void 0:W.get(Z.id))&&(he.add(Z.id),Ce.add(Pe.feature.id),De.add(qe.phase.id));return{matchedTaskIds:he,matchedFeatureIds:Ce,matchedPhaseIds:De}},[X,q,I,W]),[ee,fe]=v.useState(()=>{if(typeof window>"u")return!0;const he=window.localStorage.getItem(s);return he===null?!0:he==="true"}),[be,ye]=v.useState(()=>{if(typeof window>"u")return"all";const he=window.localStorage.getItem(o);return he==="smart"||he==="none"||he==="all"?he:"all"}),[te,re]=v.useState(()=>{if(typeof window>"u")return[];try{const he=window.localStorage.getItem(u);return he?JSON.parse(he):[]}catch{return[]}}),[ge,U]=v.useState(()=>{if(typeof window>"u")return[];try{const he=window.localStorage.getItem(f);return he?JSON.parse(he):[]}catch{return[]}}),[B,ue]=v.useState(()=>jh(m,ho,ho)),[de,we]=v.useState(()=>jh(p,mo,mo)),[C,V]=v.useState(()=>jh(g,po,po)),[ne,me]=v.useState(()=>Ch(x,!1)),[Ne,je]=v.useState(()=>Ch(y,!1)),[ze,ut]=v.useState(()=>Ch(N,!1)),[Ge,nt]=v.useState([]),[Sn,Xt]=v.useState([]),[ft,oe]=v.useState([]),$e=v.useRef({});v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(s,String(ee))},[ee,s]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(o,be)},[be,o]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u,JSON.stringify(te))},[te,u]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(f,JSON.stringify(ge))},[ge,f]),v.useEffect(()=>{typeof window>"u"||Th(m,B,ho)},[B,m]),v.useEffect(()=>{typeof window>"u"||Th(p,de,mo)},[de,p]),v.useEffect(()=>{typeof window>"u"||Th(g,C,po)},[C,g]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(x,String(ne))},[ne,x]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(y,String(Ne))},[Ne,y]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(N,String(ze))},[ze,N]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(w,JSON.stringify(R))},[R,w]),v.useEffect(()=>()=>{Object.values($e.current).forEach(he=>window.clearTimeout(he)),$e.current={}},[]);const at=v.useMemo(()=>{let he=[...B];return ne&&(he=he.filter(Ce=>Ce!=="done")),Ne&&(he=he.filter(Ce=>Ce!=="planned")),he},[B,ne,Ne]),Ut=v.useMemo(()=>{let he=[...de];return ne&&(he=he.filter(Ce=>Ce!=="done")),Ne&&(he=he.filter(Ce=>Ce!=="planned"&&Ce!=="draft")),he},[de,ne,Ne]),pn=v.useMemo(()=>{let he=[...C];return ne&&(he=he.filter(Ce=>Ce!=="done")),Ne&&(he=he.filter(Ce=>Ce!=="planned")),he},[C,ne,Ne]),jt=v.useMemo(()=>{if(X)return I.filter(De=>Js(De.feature.status,at)).map(De=>({...De,allPhases:De.allPhases.filter(Pe=>Js(Pe.phase.status,Ut)).map(Pe=>({...Pe,allTasks:Pe.allTasks.filter(qe=>ae.has(qe.id)&&Js(qe.status,pn))})).filter(Pe=>Pe.allTasks.length>0)})).filter(De=>De.allPhases.length>0);const he=!ee||ze;return(ee?I:I.filter(De=>De.isActive)).filter(({feature:De})=>Js(De.status,at)).map(De=>({...De,allPhases:De.allPhases.filter(({phase:Pe,hasActiveTask:qe})=>Js(Pe.status,Ut)?he?Pe.status==="in-progress"||Pe.status==="discovery"||qe:!0:!1).map(Pe=>({...Pe,allTasks:Pe.allTasks.filter(qe=>!!Js(qe.status,pn))})).filter(Pe=>Pe.allTasks.length>0||ee||!he)})).filter(({hasActiveTask:De,allPhases:Pe})=>he?De||Pe.some(qe=>qe.hasActiveTask):Pe.length>0||ee)},[X,ae,I,at,Ut,pn,ze,ee]);v.useEffect(()=>{if(be==="none"){re([]),U([]);return}if(be==="all"){re(jt.filter(({feature:De})=>De.status!=="done").map(({feature:De})=>De.id)),U(jt.flatMap(({allPhases:De})=>De.map(({phase:Pe})=>Pe.id)));return}const he=new Set(jt.map(({feature:De})=>De.id)),Ce=new Set(jt.flatMap(({allPhases:De})=>De.map(({phase:Pe})=>Pe.id)));re(De=>De.filter(Pe=>he.has(Pe))),U(De=>De.filter(Pe=>Ce.has(Pe)))},[jt,be]),v.useEffect(()=>{X&&(ye("smart"),re(Array.from(z)),U(Array.from(T)))},[X,z,T]);const _t=he=>{ye("smart"),re(Ce=>Ce.includes(he)?Ce.filter(De=>De!==he):[...Ce,he])},Qt=he=>{ye("smart"),U(Ce=>Ce.includes(he)?Ce.filter(De=>De!==he):[...Ce,he])},Hn=()=>{ye("smart"),re(jt.map(({feature:he})=>he.id)),U(jt.flatMap(({allPhases:he})=>he.map(({phase:Ce})=>Ce.id)))},$n=()=>{ye("smart"),re([]),U([])},tn=v.useMemo(()=>{const he=new Set(jt.map(({feature:qe})=>qe.id)),Ce=new Set(jt.flatMap(({allPhases:qe})=>qe.map(({phase:Z})=>Z.id)));if(he.size===0)return!1;const De=Array.from(he).every(qe=>te.includes(qe)),Pe=Array.from(Ce).every(qe=>ge.includes(qe));return De&&Pe},[jt,te,ge]);return v.useEffect(()=>{const he=(De,Pe)=>{const qe=Pe.filter(Z=>!!Z);for(const Z of qe){const Tt=`${De}:${Z}`,Kt=De==="feature"?nt:De==="phase"?Xt:oe;Kt(Yn=>Yn.includes(Z)?Yn:[...Yn,Z]),$e.current[Tt]!==void 0&&window.clearTimeout($e.current[Tt]),$e.current[Tt]=window.setTimeout(()=>{Kt(Yn=>Yn.filter(gn=>gn!==Z)),delete $e.current[Tt]},y2)}},Ce=De=>{var Z,Tt,Kt,Yn,gn,Ba;const qe=De.detail;if(qe!=null&&qe.type){if(qe.type==="features-updated"){const Me=((Z=qe.data)==null?void 0:Z.featureId)??((Tt=qe.data)==null?void 0:Tt.id);he("feature",[Me]),Me&&(ye("smart"),re(vt=>vt.includes(Me)?vt:[...vt,Me]));return}if(qe.type==="phases-updated"){const Me=(Kt=qe.data)==null?void 0:Kt.featureId,vt=((Yn=qe.data)==null?void 0:Yn.phaseId)??((gn=qe.data)==null?void 0:gn.id);he("phase",[vt]),he("feature",[Me]),he("task",[(Ba=qe.data)==null?void 0:Ba.taskId]),ye("smart"),Me&&re(yt=>yt.includes(Me)?yt:[...yt,Me]),vt&&U(yt=>yt.includes(vt)?yt:[...yt,vt])}}};return window.addEventListener("agent-plan:ws-event",Ce),()=>{window.removeEventListener("agent-plan:ws-event",Ce)}},[]),{workTree:I,displayedWorkTree:jt,treeOpenMode:be,setTreeOpenMode:ye,expandAll:Hn,collapseAll:$n,isAllExpanded:tn,expandedFeatureIds:te,expandedPhaseIds:ge,setExpandedFeatureIds:re,setExpandedPhaseIds:U,toggleExpandedFeature:_t,toggleExpandedPhase:Qt,recentFeatureIds:Ge,recentPhaseIds:Sn,recentTaskIds:ft,setRecentTaskIds:oe,showAllFeatures:ee,setShowAllFeatures:fe,featureStatusFilters:B,phaseStatusFilters:de,taskStatusFilters:C,hideDone:ne,setHideDone:me,hidePlanned:Ne,setHidePlanned:je,onlyActiveBranches:ze,setOnlyActiveBranches:ut,resetFilters:()=>{D(""),fe(!0),me(!1),je(!1),ue(ho),we(mo),V(po),ut(!1),L(So),ye("all")},toggleFeatureStatusFilter:he=>ue(Ce=>Rh(Ce,he,ho)),togglePhaseStatusFilter:he=>we(Ce=>Rh(Ce,he,mo)),toggleTaskStatusFilter:he=>V(Ce=>Rh(Ce,he,po)),searchQuery:S,setSearchQuery:D,searchActive:X,matchedTaskIds:ae,matchedFeatureIds:z,matchedPhaseIds:T,sort:R,setSort:L}}function vi({id:t,status:a,variant:l="header",className:s,children:o,ariaLabel:u}){const f=l==="surface"?l2(a):s2(a),m=Sm(a),p=["status-item",l==="surface"?"status-item--surface":"status-item--header",m,s??""].filter(Boolean).join(" ");return c.jsx("div",{id:t,className:p,style:f,"aria-label":u,"data-status":a,children:o})}const L0=v.createContext(null);function _m({id:t,children:a}){const l=gT({id:t}),s={transform:Ul.Transform.toString(l.transform),transition:l.transition};return c.jsx(L0.Provider,{value:l,children:c.jsx("div",{ref:l.setNodeRef,style:s,className:l.isDragging?"ap-sortable--dragging":"",children:a})})}function Lm(){const t=v.useContext(L0);return t?c.jsx("button",{type:"button",className:"drag-handle","aria-label":"Drag to reorder",title:"Drag to reorder",...t.listeners,...t.attributes,children:c.jsx(IN,{className:"h-4 w-4"})}):null}function z0({phaseId:t,phaseTitle:a,count:l,className:s=""}){if(l<1)return null;const o=`${l} linked requirement${l===1?"":"s"} for phase ${a}`;return c.jsxs(Ye,{to:`/requirements#phase-${t}`,"aria-label":o,title:o,className:`inline-flex min-h-7 items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--surface-elevated)] px-1.5 text-xs font-semibold text-[var(--text-muted)] transition hover:border-[var(--accent)] hover:text-[var(--accent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] ${s}`,children:[c.jsx(Io,{"aria-hidden":"true",className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{"aria-hidden":"true",children:l})]})}const zm="mt-1 block min-w-0 break-words font-mono text-sm font-semibold leading-snug [overflow-wrap:anywhere]";function RT(){return c.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"})}function Nx({status:t,doneTasks:a,totalTasks:l,recentlyChanged:s,className:o}){const u=a!=null&&l!=null;return c.jsxs("div",{className:o,children:[s?c.jsx(RT,{}):null,u?c.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",a,"/",l||0,")"]}):null,c.jsx("span",{className:"shrink-0",children:c.jsx(ur,{status:t})})]})}function jT({entry:t,expanded:a,recentlyChanged:l,onToggle:s,isPhaseExpanded:o,onTogglePhase:u,isPhaseRecentlyChanged:f,isTaskRecentlyChanged:m,highlightedTaskIds:p}){const{feature:g,totalTasks:x,doneTasks:y,allPhases:N,hasActiveTask:w}=t;return c.jsxs("div",{className:`surface-card min-w-0 rounded-[10px] px-3 py-3 transition-colors sm:px-4 ${l?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[c.jsxs(vi,{status:t.display.displayStatus,variant:"header",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${l?"bg-[color:color-mix(in_srgb,var(--accent)_10%,transparent)]":""}`,children:[c.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[c.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),s()},onPointerDown:S=>S.stopPropagation(),className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":a?`Collapse feature ${g.name}`:`Expand feature ${g.name}`,"aria-expanded":a,children:c.jsx(zb,{className:`h-4 w-4 transition ${a?"rotate-90":"rotate-0"}`})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Lm,{}),c.jsx(Tr,{featureNum:g.number,featureId:g.id}),c.jsx(Or,{id:gs({featureNum:g.number}),children:c.jsx("span",{className:"sr-only",children:"Copy feature path"})}),g.shortId?c.jsx(vs,{shortId:g.shortId}):null,w?c.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),c.jsx(kc,{status:t.display.displayStatus,breakdown:t.display.breakdown,doneTasks:y,totalTasks:x,recentlyChanged:l,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),c.jsx(Ye,{to:`/features/${g.id}`,className:`entity-link--feature ${zm} underline-offset-4 hover:underline`,children:g.name})]})]}),c.jsx(kc,{status:t.display.displayStatus,breakdown:t.display.breakdown,doneTasks:y,totalTasks:x,recentlyChanged:l,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),a&&N.length>0?c.jsx("div",{className:"mt-2 ml-1.5 grid grid-cols-1 gap-2 border-l pl-3 sm:ml-4 sm:pl-4",style:{borderLeftColor:t0(t.display.displayStatus)},children:c.jsx(Om,{items:N.map(S=>S.phase.id),strategy:km,children:N.map(S=>c.jsx(_m,{id:S.phase.id,children:c.jsx(TT,{feature:g,phaseEntry:S,expanded:o(S.phase.id),recentlyChanged:f(S.phase.id),onToggle:()=>u(S.phase.id),isTaskRecentlyChanged:m,highlightedTaskIds:p})},S.phase.id))})}):null]})}function TT({feature:t,phaseEntry:a,expanded:l,recentlyChanged:s,onToggle:o,isTaskRecentlyChanged:u,highlightedTaskIds:f}){var N;const{phase:m,totalTasks:p,doneTasks:g,allTasks:x,hasActiveTask:y}=a;return c.jsxs("div",{className:`work-tree-row grid min-w-0 grid-cols-1 gap-2 rounded-[10px] p-3 transition-colors ${s?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[c.jsxs(vi,{status:a.display.displayStatus,variant:"header",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${s?"bg-[color:color-mix(in_srgb,var(--accent)_8%,transparent)]":""}`,children:[c.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[c.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),o()},onPointerDown:w=>w.stopPropagation(),className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":l?`Collapse phase ${m.title}`:`Expand phase ${m.title}`,"aria-expanded":l,children:c.jsx(zb,{className:`h-4 w-4 transition ${l?"rotate-90":"rotate-0"}`})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Lm,{}),c.jsx(Tr,{featureNum:t==null?void 0:t.number,phaseNum:m.number,featureId:t.id,phaseId:m.id}),c.jsx(Or,{id:gs({featureNum:t==null?void 0:t.number,phaseNum:m.number}),children:c.jsx("span",{className:"sr-only",children:"Copy phase path"})}),m.shortId?c.jsx(vs,{shortId:m.shortId}):null,m.handoff?c.jsx(bm,{phaseId:m.id,updatedAt:m.handoffUpdatedAt}):null,c.jsx(z0,{phaseId:m.id,phaseTitle:m.title,count:((N=m.linkedRequirements)==null?void 0:N.length)??0}),y?c.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),c.jsx(kc,{status:a.display.displayStatus,breakdown:a.display.breakdown,doneTasks:g,totalTasks:p,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),c.jsx(Ye,{to:`/features/${t.id}/phases/${m.id}`,className:`entity-link--phase ${zm} underline-offset-4 hover:underline`,children:m.title})]})]}),c.jsx(kc,{status:a.display.displayStatus,breakdown:a.display.breakdown,doneTasks:g,totalTasks:p,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),l?x.length>0?c.jsx("div",{className:"ml-1.5 grid grid-cols-1 gap-1 border-l pl-3 sm:ml-4 sm:pl-4",style:{borderLeftColor:t0(a.display.displayStatus)},children:c.jsx(Om,{items:x.map(w=>w.id),strategy:km,children:x.map(w=>c.jsx(_m,{id:w.id,children:c.jsx(CT,{feature:t,phase:m,task:w,recentlyChanged:u(w.id),highlighted:f==null?void 0:f.has(w.id)})},w.id))})}):c.jsx("p",{className:"ml-1.5 text-xs italic text-[var(--text-subtle)] sm:ml-4",children:"No tasks"}):null]})}function CT({feature:t,phase:a,task:l,recentlyChanged:s,highlighted:o}){return c.jsxs(vi,{id:`task-row-${l.number}`,status:l.status,variant:"surface",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-2 py-2 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${s?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""} ${o?"ap-search-hit":""}`,children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Lm,{}),c.jsx(Tr,{featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:l.number,featureId:t.id,phaseId:a.id,taskId:l.id}),c.jsx(Or,{id:gs({featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:l.number}),children:c.jsx("span",{className:"sr-only",children:"Copy task path"})}),l.shortId?c.jsx(vs,{shortId:l.shortId}):null,l.status==="in-progress"?c.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),c.jsx(Nx,{status:l.status,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),c.jsx(Ye,{to:`/features/${t.id}/phases/${a.id}/tasks/${l.id}`,className:`entity-link--task ${zm} underline-offset-4 hover:underline`,children:l.title})]}),c.jsx(Nx,{status:l.status,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]})}var O=(function(t){return t.FIELD_NAME="FIELD_NAME",t.COLON="COLON",t.VALUE="VALUE",t.QUOTED_VALUE="QUOTED_VALUE",t.AND="AND",t.OR="OR",t.NOT="NOT",t.COMPARISON_OP="COMPARISON_OP",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.SAVED_SEARCH="SAVED_SEARCH",t.HISTORY_REF="HISTORY_REF",t.PREFIX_OP="PREFIX_OP",t.WILDCARD="WILDCARD",t.REGEX="REGEX",t.RANGE="RANGE",t.TILDE="TILDE",t.BOOST="BOOST",t.WHITESPACE="WHITESPACE",t.UNKNOWN="UNKNOWN",t})({}),ia=(function(t){return t[t.EXPECT_TERM=0]="EXPECT_TERM",t[t.EXPECT_VALUE=1]="EXPECT_VALUE",t})(ia||{}),ii=class{constructor(t,a){hn(this,"input");hn(this,"pos");hn(this,"state");hn(this,"tokens");hn(this,"options");this.input=t,this.pos=0,this.state=ia.EXPECT_TERM,this.tokens=[],this.options=a||{}}tokenize(){for(this.tokens=[],this.pos=0,this.state=ia.EXPECT_TERM;this.pos<this.input.length;)this.state===ia.EXPECT_VALUE?this.readValue():this.readTerm();return this.tokens}peek(){return this.input[this.pos]}peekAt(t){return this.input[this.pos+t]}advance(){return this.input[this.pos++]}isWhitespace(t){return t===" "||t===" "||t===`
278
+ `||t==="\r"}isAlpha(t){return/[a-zA-Z_]/.test(t)}isAlphaNumeric(t){return/[a-zA-Z0-9_.\-]/.test(t)}readWhitespace(){const t=this.pos;for(;this.pos<this.input.length&&this.isWhitespace(this.peek());)this.advance();this.tokens.push({type:O.WHITESPACE,value:this.input.slice(t,this.pos),start:t,end:this.pos})}readQuotedString(){const t=this.pos,a=this.advance();for(;this.pos<this.input.length;){const l=this.advance();if(l==="\\"&&this.pos<this.input.length)this.advance();else if(l===a)break}this.tokens.push({type:O.QUOTED_VALUE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.tryReadModifier(),this.state=ia.EXPECT_TERM}readTerm(){const t=this.peek();if(this.isWhitespace(t)){this.readWhitespace();return}if(t==='"'){this.readQuotedString();return}if(t==="("){this.tokens.push({type:O.LPAREN,value:"(",start:this.pos,end:this.pos+1}),this.advance();return}if(t===")"){this.tokens.push({type:O.RPAREN,value:")",start:this.pos,end:this.pos+1}),this.advance();return}if(t==="~"||t==="^"){const l=this.pos,s=t==="~"?O.TILDE:O.BOOST;for(this.advance();this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:s,value:this.input.slice(l,this.pos),start:l,end:this.pos});return}if(t==="["||t==="{"){this.readRangeValue();return}if(t==="#"&&this.options.savedSearches){this.readSavedSearch();return}if(t==="!"&&this.options.historySearch){this.readHistoryRef();return}if(t==="-"||t==="+"){const l=this.peekAt(1);if(l&&(this.isAlpha(l)||l==='"'||l==="("||l==="#"||l==="!"||l==="["||l==="{")||!l||l===")"||l===" "||l===" "||l===`
279
+ `||l==="\r"){this.tokens.push({type:O.PREFIX_OP,value:t,start:this.pos,end:this.pos+1}),this.advance();return}}if(t==="&"&&this.peekAt(1)==="&"){this.tokens.push({type:O.AND,value:"&&",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if(t==="|"&&this.peekAt(1)==="|"){this.tokens.push({type:O.OR,value:"||",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if((t===">"||t==="<")&&this.state===ia.EXPECT_TERM){const l=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(l,this.pos),start:l,end:this.pos}),this.state=ia.EXPECT_VALUE;return}if(t==="/"){this.readRegex();return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!=="("&&this.peek()!==")"&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^"&&!(this.peek()==="&"&&this.peekAt(1)==="&")&&!(this.peek()==="|"&&this.peekAt(1)==="|");){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(this.peek()===":"){this.pos>a&&this.tokens.push({type:O.FIELD_NAME,value:this.input.slice(a,this.pos),start:a,end:this.pos}),this.tokens.push({type:O.COLON,value:":",start:this.pos,end:this.pos+1}),this.advance(),this.state=ia.EXPECT_VALUE;return}this.advance()}if(this.pos>a){const l=this.input.slice(a,this.pos),s=l.toUpperCase();s==="AND"?this.tokens.push({type:O.AND,value:l,start:a,end:this.pos}):s==="OR"?this.tokens.push({type:O.OR,value:l,start:a,end:this.pos}):s==="NOT"?this.tokens.push({type:O.NOT,value:l,start:a,end:this.pos}):l.includes("*")||l.includes("?")?this.tokens.push({type:O.WILDCARD,value:l,start:a,end:this.pos}):this.tokens.push({type:O.VALUE,value:l,start:a,end:this.pos}),this.tryReadModifier()}}readValue(){const t=this.peek();if(this.isWhitespace(t)){this.readWhitespace(),this.state=ia.EXPECT_TERM;return}if(t==='"'){this.readQuotedString(),this.state=ia.EXPECT_TERM;return}if(t==="("||t===")"){this.state=ia.EXPECT_TERM,this.readTerm();return}if(t===">"||t==="<"){const l=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(l,this.pos),start:l,end:this.pos});return}if(t==="["||t==="{"){this.readRangeValue();return}if(t==="/"){this.readRegex(),this.state=ia.EXPECT_TERM;return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!==")"&&this.peek()!=="("&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^";){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}this.advance()}if(this.pos>a){const l=this.input.slice(a,this.pos);l.includes("*")||l.includes("?")?this.tokens.push({type:O.WILDCARD,value:l,start:a,end:this.pos}):this.tokens.push({type:O.VALUE,value:l,start:a,end:this.pos}),this.tryReadModifier()}this.state=ia.EXPECT_TERM}readRangeValue(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.peek()!=="]"&&this.peek()!=="}";)this.advance();this.pos<this.input.length&&(this.peek()==="]"||this.peek()==="}")&&this.advance(),this.tokens.push({type:O.RANGE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.state=ia.EXPECT_TERM}tryReadModifier(){for(;this.pos<this.input.length&&(this.peek()==="~"||this.peek()==="^");){const t=this.pos,a=this.advance()==="~"?O.TILDE:O.BOOST;for(;this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:a,value:this.input.slice(t,this.pos),start:t,end:this.pos})}}readRegex(){const t=this.pos;for(this.advance();this.pos<this.input.length;){const a=this.peek();if(a==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(a==="/"){this.advance(),this.tokens.push({type:O.REGEX,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.tryReadModifier(),this.state=ia.EXPECT_TERM;return}this.advance()}this.tokens.push({type:O.VALUE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.state=ia.EXPECT_TERM}readSavedSearch(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:O.SAVED_SEARCH,value:this.input.slice(t,this.pos),start:t,end:this.pos})}readHistoryRef(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:O.HISTORY_REF,value:this.input.slice(t,this.pos),start:t,end:this.pos})}},cs=class{constructor(t){hn(this,"tokens");hn(this,"pos");hn(this,"nonWsTokens");hn(this,"errors",[]);this.tokens=t,this.nonWsTokens=t.filter(a=>a.type!==O.WHITESPACE),this.pos=0}getErrors(){return this.errors}isUnclosedQuote(t){if(t.type!==O.QUOTED_VALUE)return!1;const a=t.value;if(a.length<2)return!0;const l=a[0];return a[a.length-1]!==l}stripQuotes(t){const a=t.value;return this.isUnclosedQuote(t)?a.slice(1):a.slice(1,-1)}checkUnclosedQuote(t){this.isUnclosedQuote(t)&&this.errors.push({type:"Error",value:t.value[0],message:"Missing closing quote",start:t.start,end:t.start+1})}parse(){if(this.nonWsTokens.length===0)return null;let t=this.parseOr();for(;this.peek();){const a=this.peek();if(a.type===O.RPAREN)this.advance(),this.errors.push({type:"Error",value:a.value,message:"Unexpected closing parenthesis",start:a.start,end:a.end});else{const l=this.parseOr();t={type:"BooleanExpr",operator:"AND",left:t,right:l,implicit:!0,start:t.start,end:l.end}}}return t}peek(){return this.nonWsTokens[this.pos]}advance(){return this.nonWsTokens[this.pos++]}match(t){var a;if(((a=this.peek())==null?void 0:a.type)===t)return this.advance()}parseOr(){var a;let t=this.parseAnd();for(;((a=this.peek())==null?void 0:a.type)===O.OR;){const l=this.advance(),s=this.parseAnd();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:l.value,message:"Missing search term after OR",start:l.start,end:l.end});break}t={type:"BooleanExpr",operator:"OR",left:t,right:s,sourceOperator:l.value,start:t.start,end:s.end}}return t}parseAnd(){let t=this.parseNot();for(;;){const a=this.peek();if(!a)break;if(a.type===O.AND){const l=this.advance(),s=this.parseNot();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:l.value,message:"Missing search term after AND",start:l.start,end:l.end});break}t={type:"BooleanExpr",operator:"AND",left:t,right:s,sourceOperator:l.value,start:t.start,end:s.end}}else{if(a.type===O.OR||a.type===O.RPAREN)break;{const l=this.parseNot();t={type:"BooleanExpr",operator:"AND",left:t,right:l,implicit:!0,start:t.start,end:l.end}}}}return t}parseNot(){var t;if(((t=this.peek())==null?void 0:t.type)===O.NOT){const a=this.advance(),l=this.parsePrimary();return l.type==="Error"&&l.value===""?(this.errors.push({type:"Error",value:a.value,message:"Missing search term after NOT",start:a.start,end:a.end}),l):{type:"Not",expression:l,sourceOperator:a.value,start:a.start,end:l.end}}return this.parsePrimary()}applyGroupBoost(t){var a;if(((a=this.peek())==null?void 0:a.type)===O.BOOST){const l=this.advance(),s=l.value.slice(1),o=parseFloat(s);t.boost=isNaN(o)?1:o,t.end=l.end}return t}applyModifiers(t){var a,l;if(t.type!=="BareTerm"&&t.type!=="FieldValue")return t;if(((a=this.peek())==null?void 0:a.type)===O.TILDE){const s=this.advance(),o=s.value.slice(1),u=parseInt(o,10);t.quoted?t.proximity=isNaN(u)?0:u:t.fuzzy=isNaN(u)?0:u,t.end=s.end}if(((l=this.peek())==null?void 0:l.type)===O.BOOST){const s=this.advance(),o=s.value.slice(1),u=parseFloat(o);t.boost=isNaN(u)?1:u,t.end=s.end}return t}parseRangeBound(t,a){const l=t.length-t.trimStart().length,s=t.trim();return s.startsWith('"')&&s.endsWith('"')&&s.length>=2?{value:s.slice(1,-1),quoted:!0,valueStart:a+l,valueEnd:a+l+s.length}:s.startsWith('"')?{value:s.slice(1),quoted:!0,valueStart:a+l,valueEnd:a+l+s.length}:{value:s,quoted:!1,valueStart:a+l,valueEnd:a+l+s.length}}parseRange(t){const a=t.value,l=a[0],s=l==="[",o=a[a.length-1],u=o==="]"||o==="}",f=o==="]";u||this.errors.push({type:"Error",value:l,message:"Unclosed range expression",start:t.start,end:t.start+1});const m=u?a.slice(1,-1):a.slice(1),p=m.match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/),g=t.start+1;if(!p){this.errors.push({type:"Error",value:a,message:"Range expression missing TO keyword",start:t.start,end:t.end});const w=this.parseRangeBound(m,g);return{type:"Range",lower:w.value,upper:"",lowerInclusive:s,upperInclusive:u?f:!0,lowerQuoted:w.quoted,upperQuoted:!1,lowerStart:w.valueStart,lowerEnd:w.valueEnd,upperStart:t.end,upperEnd:t.end,start:t.start,end:t.end}}const x=this.parseRangeBound(p[1],g),y=g+p[1].length+(m.length-p[1].length-p[2].length),N=this.parseRangeBound(p[2],y);return{type:"Range",lower:x.value,upper:N.value,lowerInclusive:s,upperInclusive:u?f:!0,lowerQuoted:x.quoted,upperQuoted:N.quoted,lowerStart:x.valueStart,lowerEnd:x.valueEnd,upperStart:N.valueStart,upperEnd:N.valueEnd,start:t.start,end:t.end}}parsePrimary(){var l,s,o;const t=this.peek();if(!t)return{type:"Error",value:"",message:"Unexpected end of input",start:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0,end:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0};if(t.type===O.AND){const u=this.advance();return this.errors.push({type:"Error",value:u.value,message:"Unexpected AND",start:u.start,end:u.end}),this.parsePrimary()}if(t.type===O.OR){const u=this.advance();return this.errors.push({type:"Error",value:u.value,message:"Unexpected OR",start:u.start,end:u.end}),this.parsePrimary()}if(t.type===O.PREFIX_OP){const u=this.advance(),f=this.parsePrimary();return u.value==="-"?{type:"Not",expression:f,sourceOperator:u.value,start:u.start,end:f.end}:{...f,start:u.start}}if(t.type===O.LPAREN){const u=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const g=this.match(O.RPAREN);g||this.errors.push({type:"Error",value:u.value,message:"Unclosed parenthesis",start:u.start,end:u.end});const x={type:"Group",expression:{type:"BareTerm",value:"",quoted:!1,start:u.end,end:u.end},start:u.start,end:g?g.end:u.end};return this.applyGroupBoost(x)}const f=this.parseOr(),m=this.match(O.RPAREN);m||this.errors.push({type:"Error",value:u.value,message:"Missing closing parenthesis",start:u.start,end:u.end});const p={type:"Group",expression:f,start:u.start,end:m?m.end:f.end};return this.applyGroupBoost(p)}if(t.type===O.SAVED_SEARCH){const u=this.advance();return{type:"SavedSearch",name:u.value.slice(1),start:u.start,end:u.end}}if(t.type===O.HISTORY_REF){const u=this.advance();return{type:"HistoryRef",ref:u.value.slice(1),start:u.start,end:u.end}}if(t.type===O.FIELD_NAME){const u=this.advance(),f=this.match(O.COLON);if(f){let m=":";const p=this.match(O.COMPARISON_OP);if(p&&(m=p.value),((l=this.peek())==null?void 0:l.type)===O.LPAREN){const x=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const S=this.match(O.RPAREN);S||this.errors.push({type:"Error",value:x.value,message:"Unclosed parenthesis",start:x.start,end:x.end});const D={type:"FieldGroup",field:u.value,expression:{type:"BareTerm",value:"",quoted:!1,start:x.end,end:x.end},start:u.start,end:S?S.end:x.end};return this.applyGroupBoost(D)}const y=this.parseOr(),N=this.match(O.RPAREN);N||this.errors.push({type:"Error",value:x.value,message:"Missing closing parenthesis",start:x.start,end:x.end});const w={type:"FieldGroup",field:u.value,expression:y,start:u.start,end:N?N.end:y.end};return this.applyGroupBoost(w)}if(((s=this.peek())==null?void 0:s.type)===O.RANGE){const x=this.advance(),y=this.parseRange(x);return y.field=u.value,y.start=u.start,y}if(((o=this.peek())==null?void 0:o.type)===O.REGEX){const x=this.advance();return{type:"Regex",pattern:x.value.slice(1,-1),start:u.start,end:x.end}}const g=this.peek();if(g&&(g.type===O.VALUE||g.type===O.QUOTED_VALUE||g.type===O.WILDCARD)){const x=this.advance(),y=x.type===O.QUOTED_VALUE;y&&this.checkUnclosedQuote(x);const N=y?this.stripQuotes(x):x.value;return this.applyModifiers({type:"FieldValue",field:u.value,operator:m,value:N,quoted:y,start:u.start,end:x.end})}return{type:"FieldValue",field:u.value,operator:m,value:"",quoted:!1,start:u.start,end:p?p.end:f.end}}return{type:"BareTerm",value:u.value,quoted:!1,start:u.start,end:u.end}}if(t.type===O.COMPARISON_OP){const u=this.advance(),f=this.peek();if(f&&(f.type===O.VALUE||f.type===O.QUOTED_VALUE)){const m=this.advance();return{type:"BareTerm",value:u.value+m.value,quoted:!1,start:u.start,end:m.end}}return{type:"Error",value:u.value,message:"Comparison operator without value",start:u.start,end:u.end}}if(t.type===O.QUOTED_VALUE){const u=this.advance();return this.checkUnclosedQuote(u),this.applyModifiers({type:"BareTerm",value:this.stripQuotes(u),quoted:!0,start:u.start,end:u.end})}if(t.type===O.WILDCARD){const u=this.advance();return this.applyModifiers({type:"BareTerm",value:u.value,quoted:!1,start:u.start,end:u.end})}if(t.type===O.RANGE){const u=this.advance();return this.parseRange(u)}if(t.type===O.REGEX){const u=this.advance();return{type:"Regex",pattern:u.value.slice(1,-1),start:u.start,end:u.end}}if(t.type===O.VALUE){const u=this.advance();return this.applyModifiers({type:"BareTerm",value:u.value,quoted:!1,start:u.start,end:u.end})}if(t.type===O.RPAREN){const u=this.advance();return this.errors.push({type:"Error",value:u.value,message:"Unexpected closing parenthesis",start:u.start,end:u.end}),{type:"Error",value:u.value,message:"Unexpected closing parenthesis",start:u.start,end:u.end}}const a=this.advance();return{type:"Error",value:a.value,message:`Unexpected token: ${a.value}`,start:a.start,end:a.end}}static getCursorContext(t,a){let l,s;for(const u of t)if(u.type!==O.WHITESPACE){if(a>=u.start&&a<=u.end){l=u;break}u.end<=a&&(s=u)}const o=u=>{let f=0;for(let m=u;m>=0;m--){const p=t[m];if(p.type!==O.WHITESPACE){if(p.type===O.RPAREN){f++;continue}if(p.type===O.LPAREN){if(f>0){f--;continue}for(let g=m-1;g>=0;g--)if(t[g].type!==O.WHITESPACE){if(t[g].type===O.COLON){for(let x=g-1;x>=0;x--)if(t[x].type!==O.WHITESPACE){if(t[x].type===O.FIELD_NAME)return t[x].value;break}}break}}}}return""};if((l==null?void 0:l.type)===O.COLON){let u="";const f=t.indexOf(l);for(let m=f-1;m>=0;m--){if(t[m].type===O.FIELD_NAME){u=t[m].value;break}if(t[m].type!==O.WHITESPACE)break}if(!u&&a===l.start)return{type:"FIELD_NAME",partial:"",token:l};if(a===l.end){for(let m=f+1;m<t.length;m++)if(t[m].type!==O.WHITESPACE){if(t[m].type===O.VALUE||t[m].type===O.QUOTED_VALUE||t[m].type===O.WILDCARD||t[m].type===O.RANGE)return{type:"FIELD_VALUE",partial:t[m].type===O.QUOTED_VALUE?t[m].value.slice(1,t[m].value.endsWith('"')||t[m].value.endsWith("'")?-1:void 0):t[m].value,fieldName:u,token:t[m]};break}}return{type:"FIELD_VALUE",partial:"",fieldName:u,token:void 0}}if((l==null?void 0:l.type)===O.SAVED_SEARCH)return{type:"SAVED_SEARCH",partial:l.value.slice(1),token:l};if((l==null?void 0:l.type)===O.HISTORY_REF)return{type:"HISTORY_REF",partial:l.value.slice(1),token:l};if((l==null?void 0:l.type)===O.RANGE){const u=t.indexOf(l);let f="";for(let m=u-1;m>=0;m--){if(t[m].type===O.FIELD_NAME){f=t[m].value;break}if(!(t[m].type===O.WHITESPACE||t[m].type===O.COLON))break}return{type:"RANGE",partial:"",fieldName:f,token:l}}if((s==null?void 0:s.type)===O.COLON||(s==null?void 0:s.type)===O.COMPARISON_OP){const u=t.indexOf(s);let f="";for(let m=u-1;m>=0;m--){if(t[m].type===O.FIELD_NAME){f=t[m].value;break}if(!(t[m].type===O.WHITESPACE||t[m].type===O.COLON||t[m].type===O.COMPARISON_OP))break}return l&&(l.type===O.VALUE||l.type===O.QUOTED_VALUE||l.type===O.WILDCARD)?{type:"FIELD_VALUE",partial:l.type===O.QUOTED_VALUE?l.value.slice(1,l.value.endsWith('"')||l.value.endsWith("'")?-1:void 0):l.value,fieldName:f,token:l}:{type:"FIELD_VALUE",partial:"",fieldName:f,token:s}}if((l==null?void 0:l.type)===O.VALUE||(l==null?void 0:l.type)===O.QUOTED_VALUE||(l==null?void 0:l.type)===O.WILDCARD){const u=t.indexOf(l);for(let f=u-1;f>=0;f--)if(t[f].type!==O.WHITESPACE){if(t[f].type===O.COLON||t[f].type===O.COMPARISON_OP){let m="";for(let p=f-1;p>=0;p--){if(t[p].type===O.FIELD_NAME){m=t[p].value;break}if(!(t[p].type===O.WHITESPACE||t[p].type===O.COLON||t[p].type===O.COMPARISON_OP))break}return{type:"FIELD_VALUE",partial:l.type===O.QUOTED_VALUE?l.value.slice(1,l.value.endsWith('"')||l.value.endsWith("'")?-1:void 0):l.value,fieldName:m,token:l}}break}}if((l==null?void 0:l.type)===O.QUOTED_VALUE)return{type:"FIELD_NAME",partial:l.value,token:l};if((l==null?void 0:l.type)===O.FIELD_NAME||(l==null?void 0:l.type)===O.VALUE){const u=o(t.indexOf(l));return u?{type:"FIELD_VALUE",partial:l.value,fieldName:u,token:l}:{type:"FIELD_NAME",partial:l.value,token:l}}if((s==null?void 0:s.type)===O.PREFIX_OP){const u=o(t.indexOf(s));return u?{type:"FIELD_VALUE",partial:"",fieldName:u,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(s&&(s.type===O.AND||s.type===O.OR||s.type===O.NOT)){const u=o(t.indexOf(s));return u?{type:"FIELD_VALUE",partial:"",fieldName:u,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(t.length===0||t.every(u=>u.type===O.WHITESPACE))return{type:"EMPTY",partial:""};if((l==null?void 0:l.type)===O.LPAREN||(s==null?void 0:s.type)===O.LPAREN){const u=(l==null?void 0:l.type)===O.LPAREN?l:s,f=o(t.indexOf(u));return f?{type:"FIELD_VALUE",partial:"",fieldName:f,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if((l==null?void 0:l.type)===O.TILDE||(l==null?void 0:l.type)===O.BOOST)return{type:"OPERATOR",partial:""};if(s&&(s.type===O.VALUE||s.type===O.QUOTED_VALUE||s.type===O.RPAREN||s.type===O.RANGE||s.type===O.TILDE||s.type===O.BOOST)){const u=o(t.indexOf(s));return u?{type:"FIELD_VALUE",partial:"",fieldName:u,token:void 0}:{type:"OPERATOR",partial:""}}return{type:"FIELD_NAME",partial:"",token:void 0}}};function Qh(t,a){if(a<t.start||a>t.end)return null;if(t.type==="BooleanExpr"){const l=Qh(t.left,a);if(l)return l;const s=Qh(t.right,a);return s||null}return t}function DT(t,a,l){if(!t)return null;const s=Qh(t,l);if(!s)return null;let o=s.start,u=s.end;const f=a.slice(u).match(/^(\s+(?:AND|OR|&&|\|\|)\s+|\s+)(?=\S)/i);if(f)return u+=f[0].length,{start:o,end:u};const m=a.slice(0,o).match(/(\s+(?:AND|OR|&&|\|\|)\s+|\s+)$/i);return m&&m.index!==void 0&&m.index>0&&(o-=m[0].length),{start:o,end:u}}var AT={fieldName:"#0550ae",fieldValue:"#1a7f37",operator:"#cf222e",booleanOp:"#8250df",quoted:"#0a3069",paren:"#656d76",savedSearch:"#bf8700",historyRef:"#6639ba",wildcard:"#953800",error:"#cf222e",background:"#ffffff",text:"#1f2328",placeholder:"#656d76",cursor:"#1f2328",dropdownSelected:"#0969da",dropdownHover:"#f6f8fa",regexDelimiter:"#cf222e",regexCharClass:"#0550ae",regexGroup:"#656d76",regexEscape:"#953800",regexQuantifier:"#8250df",regexAnchor:"#cf222e",regexAlternation:"#8250df",regexText:"#0a3069",matchedParenBg:"#fff3cd",warning:"#d4a72c",valueTypes:{}},kT={fontFamily:"'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace",fontSize:"14px",lineHeight:"1.5",inputMinHeight:"40px",inputPadding:"8px 12px",inputBorderWidth:"2px",inputBorderColor:"#d0d7de",inputBorderRadius:"8px",inputFocusBorderColor:"#0969da",inputFocusShadow:"0 0 0 3px rgba(9, 105, 218, 0.3)",dropdownBorderColor:"#d0d7de",dropdownBorderRadius:"8px",dropdownShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",dropdownMaxHeight:"300px",dropdownMinWidth:"200px",dropdownMaxWidth:"400px",dropdownZIndex:99999,dropdownItemPadding:"6px 12px",dropdownItemFontSize:"13px",dropdownItemContentGap:"8px",typeBadgeBg:"#eef1f5",typeBadgeSelectedBg:"rgba(255,255,255,0.2)",typeBadgeColor:"#656d76",typeBadgeSelectedColor:"#ffffff"},OT=["AND","OR","NOT"];function Rx(t){return t.replace(/\r\n/g,`
280
+ `).replace(/\r/g,`
281
+ `).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036\u00AB\u00BB]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\u2013\u2014]/g,"-").replace(/\u2026/g,"...").replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\uFF01-\uFF5E]/g,a=>String.fromCharCode(a.charCodeAt(0)-65248))}var jx={"(":")","[":"]",'"':'"',"'":"'"};function MT(t,a,l,s,o){const u=t.slice(0,a),f=t.slice(a,l),m=t.slice(l);return{newValue:u+s+f+o+m,newCursorPos:l+2,newSelStart:a+1,newSelEnd:l+1}}function _T(t){if(!t.textContent)return"";const a=[];function l(s){var o;if(s.nodeType===Node.TEXT_NODE)a.push(s.textContent||"");else if(s.nodeName==="BR")(o=s.hasAttribute)!=null&&o.call(s,"data-sentinel")||a.push(`
282
+ `);else for(let u=0;u<s.childNodes.length;u++)l(s.childNodes[u])}return l(t),a.join("")}function Tx(t,a,l){let s=-1,o=-1;for(let u=0;u<t.length;u++){const f=t[u];a>=f.start&&a<=f.end&&(s=u),o===-1&&l>=f.start&&l<=f.end&&(o=u)}return[s,o]}function LT(t,a,l){if(t){let s=t.end;if(t.type===O.FIELD_NAME&&l){const o=l.indexOf(t);if(o>=0){for(let u=o+1;u<l.length;u++)if(l[u].type!==O.WHITESPACE){l[u].type===O.COLON&&(s=l[u].end);break}}}return{start:t.start,end:s}}return{start:a,end:a}}var Ah=class U0{constructor(a,l=[],s=[],o=10,u={}){hn(this,"fields");hn(this,"fieldMap");hn(this,"savedSearches");hn(this,"searchHistory");hn(this,"maxSuggestions");hn(this,"options");hn(this,"defaultFieldName");hn(this,"defaultFieldShowFieldSuggs",!1);this.fields=a,this.fieldMap=new Map(a.map(f=>[f.name,f]));for(const f of a)if(f.aliases)for(const m of f.aliases)this.fieldMap.set(m,f);this.savedSearches=l,this.searchHistory=s,this.maxSuggestions=o,this.options={showSavedSearchHint:u.showSavedSearchHint??!1,showHistoryHint:u.showHistoryHint??!1}}resolveField(a){return this.fieldMap.get(a)}updateSavedSearches(a){this.savedSearches=a}updateSearchHistory(a){this.searchHistory=a}setDefaultField(a){this.defaultFieldName=a==null?void 0:a.name,this.defaultFieldShowFieldSuggs=(a==null?void 0:a.showFieldSuggestions)??!1}getSuggestions(a,l){let s=cs.getCursorContext(a,l);const o=LT(s.token,l,a);if(this.defaultFieldName&&(s.type==="FIELD_NAME"||s.type==="EMPTY")){s={...s,type:"FIELD_VALUE",fieldName:this.defaultFieldName};const u=this.resolveField(this.defaultFieldName);if((u==null?void 0:u.type)==="date")return{suggestions:[],showDatePicker:!0,dateFieldName:u.name,context:s};const f=this.getValueSuggestions(u,s.partial,o.start,o.end);if(this.defaultFieldShowFieldSuggs){const m=this.getFieldSuggestions(s.partial,o.start,o.end);return{suggestions:[...f,...m],showDatePicker:!1,context:s}}return{suggestions:f,showDatePicker:!1,context:s}}switch(s.type){case"FIELD_NAME":case"EMPTY":{const u=this.getFieldSuggestions(s.partial,o.start,o.end),f=!s.partial&&u.length>0?this.getSpecialHints(o.start,o.end):[];return{suggestions:this.sortByPriority([...u,...f]),showDatePicker:!1,context:s}}case"FIELD_VALUE":{const u=s.fieldName?this.resolveField(s.fieldName):void 0;return(u==null?void 0:u.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:u.name,context:s}:{suggestions:this.getValueSuggestions(u,s.partial,o.start,o.end),showDatePicker:!1,context:s}}case"OPERATOR":{const u=this.getOperatorSuggestions(s.partial,o.start,o.end),f=this.getFieldSuggestions("",o.start,o.end),m=this.getSpecialHints(o.start,o.end);return{suggestions:this.sortByPriority([...u,...f,...m]),showDatePicker:!1,context:s}}case"SAVED_SEARCH":return{suggestions:this.getSavedSearchSuggestions(s.partial,o.start,o.end),showDatePicker:!1,context:s};case"HISTORY_REF":return{suggestions:this.getHistorySuggestions(s.partial,o.start,o.end),showDatePicker:!1,context:s};case"RANGE":{const u=s.fieldName?this.resolveField(s.fieldName):void 0;return(u==null?void 0:u.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:u.name,context:s}:{suggestions:[],showDatePicker:!1,context:s}}default:return{suggestions:[],showDatePicker:!1,context:s}}}getFieldSuggestions(a,l,s){const o=a.toLowerCase();return this.fields.filter(u=>!u.hide).map(u=>{const f=u.name.toLowerCase(),m=(u.label||"").toLowerCase(),p=(u.aliases||[]).map(x=>x.toLowerCase());let g=0;return f.startsWith(o)?g=4:m.startsWith(o)||p.some(x=>x.startsWith(o))?g=3:f.includes(o)?g=2:(m.includes(o)||p.some(x=>x.includes(o)))&&(g=1),{field:u,score:g}}).filter(u=>u.score>0).sort((u,f)=>f.score-u.score).slice(0,this.maxSuggestions).map(u=>({text:u.field.name+":",label:u.field.label||u.field.name,description:u.field.description,type:u.field.type,replaceStart:l,replaceEnd:s,matchPartial:a,priority:10}))}getValueSuggestions(a,l,s,o){if(!a)return[];if(a.type==="boolean")return["true","false"].filter(u=>u.startsWith(l.toLowerCase())).map(u=>({text:u,label:u,type:"boolean",replaceStart:s,replaceEnd:o,matchPartial:l}));if(a.placeholder!==!1){const u=a.placeholder||{number:"Enter a number",ip:"Enter an IP address"}[a.type];if(u)return[{text:"",label:u,type:"hint",replaceStart:s,replaceEnd:o}]}return[]}getOperatorSuggestions(a,l,s){const o=a.toLowerCase();return OT.filter(u=>u.toLowerCase().startsWith(o)).map(u=>({text:u+" ",label:u,description:u==="AND"?"Both conditions must match":u==="OR"?"Either condition must match":"Negate the following condition",type:"operator",replaceStart:l,replaceEnd:s,matchPartial:a,priority:30}))}sortByPriority(a){return a.sort((l,s)=>(s.priority??0)-(l.priority??0))}getSpecialHints(a,l){const s=[],o=this.savedSearches.length>0||this.options.hasSavedSearchProvider,u=this.searchHistory.length>0||this.options.hasHistoryProvider;return this.options.showSavedSearchHint&&o&&s.push({text:"#",label:"#saved-search",description:"Type # to use a saved search",type:"hint",replaceStart:a,replaceEnd:l,priority:20}),this.options.showHistoryHint&&u&&s.push({text:"!",label:"!history",description:"Type ! to search history",type:"hint",replaceStart:a,replaceEnd:l,priority:20}),s}getSavedSearchSuggestions(a,l,s){return this.savedSearches.slice(0,this.maxSuggestions).map(o=>({text:o.query,label:o.label||o.query,description:o.description,type:"savedSearch",replaceStart:l,replaceEnd:s,matchPartial:a,sourceData:o}))}getHistorySuggestions(a,l,s){return this.searchHistory.slice(0,this.maxSuggestions).map(o=>({text:U0.wrapHistoryQuery(o.query),label:o.label||o.query,description:o.description,type:"history",replaceStart:l,replaceEnd:s,matchPartial:a,sourceData:o}))}static wrapHistoryQuery(a){try{const l=new cs(new ii(a).tokenize()).parse();if(l&&l.type==="BooleanExpr")return"("+a+")"}catch{}return a}};function hc(t){if(t==="")return null;const a=Number(t);return isNaN(a)?`"${t}" is not a valid number`:null}var zT=[/^\d{4}-\d{2}-\d{2}$/,/^\d{4}\/\d{2}\/\d{2}$/,/^\d{2}\/\d{2}\/\d{4}$/,/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,/^now$/i,/^now[+-]\d+[dhms]$/i];function UT(t){for(const a of zT)if(a.test(t))return!0;return!isNaN(Date.parse(t))}function kh(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function BT(t){if(/^now$/i.test(t))return new Date;const a=t.match(/^now([+-])(\d+)([dhms])$/i);if(a){const o=new Date,u=a[1]==="+"?1:-1,f=parseInt(a[2],10);switch(a[3].toLowerCase()){case"d":o.setDate(o.getDate()+u*f);break;case"h":o.setHours(o.getHours()+u*f);break;case"m":o.setMinutes(o.getMinutes()+u*f);break;case"s":o.setSeconds(o.getSeconds()+u*f);break}return o}const l=t.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(l)return new Date(parseInt(l[1],10),parseInt(l[2],10)-1,parseInt(l[3],10));const s=new Date(t);return isNaN(s.getTime())?null:s}function Cx(t,a){return new Date(t,a+1,0).getDate()}function HT(t,a){return new Date(t,a,1).getDay()}function go(t,a){return t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate()}function Dx(t,a,l){if(!a||!l)return!1;const s=t.getTime(),o=a.getTime(),u=l.getTime();return s>=Math.min(o,u)&&s<=Math.max(o,u)}var $T=["January","February","March","April","May","June","July","August","September","October","November","December"];function qT(t){return $T[t]}function mc(t,a){if(t==="")return null;const l=t.match(/^[\[{](.+)\s+TO\s+(.+)[\]}]$/i);if(l){const s=Oh(l[1].trim(),a);if(s)return`Range start: ${s}`;const o=Oh(l[2].trim(),a);return o?`Range end: ${o}`:null}return Oh(t,a)}function Oh(t,a){return/^now(\/[dhms])?$/i.test(t)||/^now[+-]\d+[dhms](\/[dhms])?$/i.test(t)||a&&a(t)!==null||UT(t)?null:`"${t}" is not a valid date. Use YYYY-MM-DD, relative (now-7d), or ISO 8601.`}function pc(t){return t==null?null:typeof t=="string"?{message:t,severity:"error"}:t}var gc={SYNTAX_ERROR:0,INVALID_VALUE:1,UNKNOWN_FIELD:2,AMBIGUOUS_PRECEDENCE:3,CUSTOM:4};function vc(t){if(t.length<=1)return t;const a=[...t].sort((s,o)=>{const u=gc[s.type??"SYNTAX_ERROR"],f=gc[o.type??"SYNTAX_ERROR"];return u!==f?u-f:s.start-o.start}),l=[];for(const s of a)l.some(o=>gc[o.type??"SYNTAX_ERROR"]<gc[s.type??"SYNTAX_ERROR"]&&o.start<=s.start&&o.end>=s.end)||l.push(s);return l}var Ax=class{constructor(t){hn(this,"fields");this.fields=new Map(t.map(a=>[a.name,a]));for(const a of t)if(a.aliases)for(const l of a.aliases)this.fields.set(l,a)}validate(t,a,l,s){if(!t)return[];const o=[],u=s?this.fields.get(s):void 0;return this.walkNode(t,o,a,l,u),this.checkAmbiguousPrecedence(t,o),o}walkNode(t,a,l,s,o){switch(t.type){case"BareTerm":if(t.fuzzy!==void 0&&t.fuzzy>2&&a.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${t.fuzzy})`,start:t.start,end:t.end,type:"SYNTAX_ERROR"}),t.proximity!==void 0&&t.proximity<0&&a.push({message:`Proximity value must be non-negative (got ${t.proximity})`,start:t.start,end:t.end,type:"SYNTAX_ERROR"}),t.boost!==void 0&&t.boost<=0&&a.push({message:`Boost value must be positive (got ${t.boost})`,start:t.start,end:t.end,type:"SYNTAX_ERROR"}),o&&t.value!==""){let u=null;switch(o.type){case"number":u=hc(t.value);break;case"date":u=mc(t.value,s);break;case"boolean":t.value!=="true"&&t.value!=="false"&&(u=`Expected "true" or "false", got "${t.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(t.value)&&!t.value.includes("*")&&(u=`"${t.value}" is not a valid IP address`);break}u&&a.push({message:u,start:t.start,end:t.end,field:o.name,type:"INVALID_VALUE"})}if(l&&t.value!==""){const u=pc(l({value:t.value,position:"bare_term",quoted:t.quoted,fieldName:o==null?void 0:o.name,fieldConfig:o}));u&&a.push({message:u.message,start:t.start,end:t.end,severity:u.severity,type:"CUSTOM"})}break;case"Regex":break;case"Range":if(this.validateEmptyRangeBounds(t,a),t.field&&t.field!=="*"){const u=this.fields.get(t.field);u?this.validateRangeBounds(u,t,a,l,s):a.push({message:`Unknown field: "${t.field}"`,start:t.start,end:t.start+t.field.length,field:t.field,type:"UNKNOWN_FIELD"})}break;case"FieldValue":{if(t.field==="*")return;if(t.value===""){const m=t.operator===":"?":":t.operator;a.push({message:`Missing value after "${t.field}${m}"`,start:t.start,end:t.end,field:t.field,type:"SYNTAX_ERROR"});return}const u=this.fields.get(t.field);if(!u){a.push({message:`Unknown field: "${t.field}"`,start:t.start,end:t.start+t.field.length,field:t.field,type:"UNKNOWN_FIELD"});return}t.fuzzy!==void 0&&t.fuzzy>2&&a.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${t.fuzzy})`,start:t.start,end:t.end,field:t.field,type:"SYNTAX_ERROR"}),t.boost!==void 0&&t.boost<=0&&a.push({message:`Boost value must be positive (got ${t.boost})`,start:t.start,end:t.end,field:t.field,type:"SYNTAX_ERROR"});let f=null;switch(u.type){case"number":f=hc(t.value);break;case"date":f=mc(t.value,s);break;case"boolean":t.value!=="true"&&t.value!=="false"&&(f=`Expected "true" or "false", got "${t.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(t.value)&&!t.value.includes("*")&&(f=`"${t.value}" is not a valid IP address`);break}if(t.operator!==":"&&u.type!=="number"&&u.type!=="date"&&(f=`Comparison operator "${t.operator}" is not valid for ${u.type} fields`),!f&&l){const m=pc(l({value:t.value,position:"field_value",fieldName:u.name,fieldConfig:u,quoted:t.quoted,operator:t.operator!==":"?t.operator:void 0}));if(m){const p=t.end-t.value.length;a.push({message:m.message,start:p,end:t.end,field:t.field,severity:m.severity,type:"CUSTOM"})}}if(f){const m=t.end-t.value.length,p=t.operator!==":"&&u.type!=="number"&&u.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";a.push({message:f,start:m,end:t.end,field:t.field,type:p})}break}case"FieldGroup":if(t.field==="*")this.walkNode(t.expression,a,l,s,o);else{const u=this.fields.get(t.field);u?this.walkFieldGroup(t.expression,u,a,l,s):a.push({message:`Unknown field: "${t.field}"`,start:t.start,end:t.start+t.field.length,field:t.field,type:"UNKNOWN_FIELD"})}t.boost!==void 0&&t.boost<=0&&a.push({message:`Boost value must be positive (got ${t.boost})`,start:t.start,end:t.end,type:"SYNTAX_ERROR"});break;case"BooleanExpr":this.walkNode(t.left,a,l,s,o),this.walkNode(t.right,a,l,s,o);break;case"Group":this.walkNode(t.expression,a,l,s,o),t.boost!==void 0&&t.boost<=0&&a.push({message:`Boost value must be positive (got ${t.boost})`,start:t.start,end:t.end,type:"SYNTAX_ERROR"});break;case"Not":this.walkNode(t.expression,a,l,s,o);break;case"Error":a.push({message:t.message,start:t.start,end:t.end,type:"SYNTAX_ERROR"});break}}walkFieldGroup(t,a,l,s,o){switch(t.type){case"BareTerm":if(t.value==="")return;this.validateFieldValue(a,t.value,t.quoted,":",t.start,t.end,l,s,o);break;case"FieldValue":this.walkNode(t,l,s,o);break;case"Range":this.validateRangeBounds(a,t,l,s,o);break;case"BooleanExpr":this.walkFieldGroup(t.left,a,l,s,o),this.walkFieldGroup(t.right,a,l,s,o);break;case"Group":this.walkFieldGroup(t.expression,a,l,s,o);break;case"Not":this.walkFieldGroup(t.expression,a,l,s,o);break;default:this.walkNode(t,l,s,o);break}}validateFieldValue(t,a,l,s,o,u,f,m,p){let g=null;switch(t.type){case"number":g=hc(a);break;case"date":g=mc(a,p);break;case"boolean":a!=="true"&&a!=="false"&&(g=`Expected "true" or "false", got "${a}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(a)&&!a.includes("*")&&(g=`"${a}" is not a valid IP address`);break}if(s!==":"&&t.type!=="number"&&t.type!=="date"&&(g=`Comparison operator "${s}" is not valid for ${t.type} fields`),!g&&m){const x=pc(m({value:a,position:"field_group_term",fieldName:t.name,fieldConfig:t,quoted:l,operator:s!==":"?s:void 0}));x&&f.push({message:x.message,start:o,end:u,field:t.name,severity:x.severity,type:"CUSTOM"})}if(g){const x=s!==":"&&t.type!=="number"&&t.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";f.push({message:g,start:o,end:u,field:t.name,type:x})}}validateEmptyRangeBounds(t,a){t.lower!=="*"&&t.lower.trim()===""&&a.push({message:"Missing lower bound in range",start:t.start,end:t.start+1,field:t.field,type:"SYNTAX_ERROR"}),t.upper!=="*"&&t.upper.trim()===""&&a.push({message:"Missing upper bound in range",start:t.end-1,end:t.end,field:t.field,type:"SYNTAX_ERROR"})}validateRangeBounds(t,a,l,s,o){const u=[];a.lower!=="*"&&a.lower.trim()!==""&&u.push({value:a.lower,label:"Range start",start:a.lowerStart,end:a.lowerEnd,position:"range_start",inclusive:a.lowerInclusive}),a.upper!=="*"&&a.upper.trim()!==""&&u.push({value:a.upper,label:"Range end",start:a.upperStart,end:a.upperEnd,position:"range_end",inclusive:a.upperInclusive});for(const f of u){let m=null;switch(t.type){case"number":m=hc(f.value),m&&(m=`${f.label}: ${m}`);break;case"date":m=mc(f.value,o),m&&(m=`${f.label}: ${m}`);break;case"boolean":m="Range queries are not supported for boolean fields";break}if(!m&&s){const p=pc(s({value:f.value,position:f.position,fieldName:t.name,fieldConfig:t,quoted:!1,inclusive:f.inclusive}));p&&l.push({message:p.message,start:f.start,end:f.end,field:t.name,severity:p.severity,type:"CUSTOM"})}if(m){const p=t.type==="boolean"?"SYNTAX_ERROR":"INVALID_VALUE";l.push({message:m,start:f.start,end:f.end,field:t.name,type:p})}}}checkAmbiguousPrecedence(t,a){const l=new Set;this.findAndFlagAmbiguity(t,a,l)}findAndFlagAmbiguity(t,a,l){if(t.type==="BooleanExpr"&&!l.has(t)){const s=new Set,o=[];this.collectBoolOps(t,s,o),s.size>1&&(a.push({message:"Ambiguous precedence: mix of AND and OR without parentheses. Add parentheses to clarify.",start:t.start,end:t.end,severity:"warning",type:"AMBIGUOUS_PRECEDENCE"}),o.forEach(u=>l.add(u))),this.collectLeaves(t).forEach(u=>this.findAndFlagAmbiguity(u,a,l))}else t.type==="Group"||t.type==="FieldGroup"?this.findAndFlagAmbiguity(t.expression,a,l):t.type==="Not"?this.findAndFlagAmbiguity(t.expression,a,l):t.type==="BooleanExpr"&&this.collectLeaves(t).forEach(s=>this.findAndFlagAmbiguity(s,a,l))}collectBoolOps(t,a,l){t.type==="BooleanExpr"&&(a.add(t.operator),l.push(t),this.collectBoolOps(t.left,a,l),this.collectBoolOps(t.right,a,l))}collectLeaves(t){return t.type!=="BooleanExpr"?[t]:[...this.collectLeaves(t.left),...this.collectLeaves(t.right)]}};function za(...t){return t.filter(Boolean).join(" ")}function Ko(t){return{...AT,...t}}function Zo(t){return{...kT,...t}}function IT(t,a){return{position:"relative",display:"flex",flexDirection:"column",width:"100%",...a}}function VT(t,a){return{flex:1,minHeight:a.inputMinHeight,padding:a.inputPadding,borderWidth:a.inputBorderWidth,borderStyle:"solid",borderColor:a.inputBorderColor,borderRadius:a.inputBorderRadius,outline:"none",fontSize:a.fontSize,fontFamily:a.fontFamily,lineHeight:a.lineHeight,backgroundColor:t.background,color:t.text,caretColor:t.cursor,whiteSpace:"pre-wrap",wordWrap:"break-word",overflowWrap:"break-word",overflow:"auto",cursor:"text"}}function YT(t){return{borderColor:t.inputFocusBorderColor,boxShadow:t.inputFocusShadow}}function FT(t,a){const l=a.inputPadding.split(/\s+/),s=l[0]||"8px";return{position:"absolute",top:s,left:l.length>=4?l[3]:l.length>=2?l[1]:s,right:l.length>=4||l.length>=2?l[1]:s,color:t.placeholder,pointerEvents:"none",fontSize:a.fontSize,fontFamily:a.fontFamily,lineHeight:a.lineHeight,userSelect:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}function B0(t,a){return{position:"absolute",zIndex:a.dropdownZIndex,backgroundColor:t.background,border:`1px solid ${a.dropdownBorderColor}`,borderRadius:a.dropdownBorderRadius,boxShadow:a.dropdownShadow,maxHeight:a.dropdownMaxHeight,overflowY:"auto",width:"max-content",minWidth:a.dropdownMinWidth,maxWidth:a.dropdownMaxWidth,padding:"4px 0"}}function kx(t,a,l){return{padding:l.dropdownItemPadding,cursor:"pointer",fontSize:l.dropdownItemFontSize,fontFamily:l.fontFamily,backgroundColor:t?a.dropdownSelected:"transparent",color:t?"#ffffff":a.text,display:"flex",alignItems:"center",gap:l.dropdownItemContentGap,lineHeight:"1.4"}}function Ws(t){return{flex:1,fontWeight:500}}function Mh(t){return{fontSize:"11px",opacity:.7,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0}}function PT(t,a){return{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:t?a.typeBadgeSelectedBg:a.typeBadgeBg,color:t?a.typeBadgeSelectedColor:a.typeBadgeColor,flexShrink:0}}function GT(t,a){return{container:{padding:"12px",backgroundColor:t.background,minWidth:"280px",fontFamily:a.fontFamily},header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},navButton:{backgroundColor:"transparent",border:"none",cursor:"pointer",fontSize:"16px",padding:"4px 8px",color:t.text,borderRadius:"4px"},monthLabel:{fontWeight:600,fontSize:a.fontSize,color:t.text},weekDays:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},weekDay:{textAlign:"center",fontSize:"11px",color:t.placeholder,padding:"4px",fontWeight:600},days:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},day:{textAlign:"center",padding:"6px",cursor:"pointer",fontSize:a.dropdownItemFontSize,borderRadius:"4px",color:t.text,border:"none",backgroundColor:"transparent"},dayHover:{backgroundColor:t.dropdownHover},daySelected:{backgroundColor:t.dropdownSelected,color:"#ffffff"},dayInRange:{backgroundColor:"rgba(9, 105, 218, 0.1)"},dayOtherMonth:{opacity:.45},dayToday:{fontWeight:700,textDecoration:"underline"},rangeToggle:{display:"flex",gap:"4px",marginBottom:"8px",padding:"2px",backgroundColor:a.typeBadgeBg,borderRadius:"6px"},rangeToggleButton:{flex:1,padding:"4px 8px",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontWeight:500,backgroundColor:"transparent",color:t.text},rangeToggleButtonActive:{backgroundColor:t.background,boxShadow:"0 1px 2px rgba(0,0,0,0.1)"},quickOptions:{borderTop:`1px solid ${a.dropdownBorderColor}`,marginTop:"8px",paddingTop:"8px"},quickOption:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:t.dropdownSelected,borderRadius:"4px"}}}var XT={delimiter:"regexDelimiter",charClass:"regexCharClass",groupOpen:"regexGroup",groupClose:"regexGroup",escape:"regexEscape",quantifier:"regexQuantifier",anchor:"regexAnchor",alternation:"regexAlternation",text:"regexText"};function QT(t){const a=[];let l=0,s="";function o(){s&&(a.push({type:"text",text:s}),s="")}t.startsWith("/")&&(a.push({type:"delimiter",text:"/"}),l=1);const u=t.lastIndexOf("/"),f=u>0?u:t.length;for(;l<f;){const m=t[l];if(m==="\\"&&l+1<f){o(),a.push({type:"escape",text:t.slice(l,l+2)}),l+=2;continue}if(m==="["){o();let p=l+1;for(p<f&&t[p]==="^"&&p++,p<f&&t[p]==="]"&&p++;p<f&&t[p]!=="]";)t[p]==="\\"&&p+1<f&&p++,p++;p<f&&p++,a.push({type:"charClass",text:t.slice(l,p)}),l=p;continue}if(m==="("){o();let p="(";if(l+1<f&&t[l+1]==="?"){let g=l+2;for(;g<f&&g<l+4&&/[:<>=!]/.test(t[g]);)g++;p=t.slice(l,g)}a.push({type:"groupOpen",text:p}),l+=p.length;continue}if(m===")"){o(),a.push({type:"groupClose",text:")"}),l++;continue}if(m==="+"||m==="*"||m==="?"){o();let p=m;l+1<f&&t[l+1]==="?"&&(p+="?"),a.push({type:"quantifier",text:p}),l+=p.length;continue}if(m==="{"){o();let p=l+1;for(;p<f&&t[p]!=="}";)p++;p<f&&p++,a.push({type:"quantifier",text:t.slice(l,p)}),l=p;continue}if(m==="^"||m==="$"){o(),a.push({type:"anchor",text:m}),l++;continue}if(m==="|"){o(),a.push({type:"alternation",text:"|"}),l++;continue}s+=m,l++}return o(),u>0&&u<t.length&&a.push({type:"delimiter",text:"/"}),a}function KT(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ZT(t,a,l){const s=QT(t.value).map(o=>{const u=a[XT[o.type]]||a.regexText,f=o.type==="delimiter"?"600":"normal";return`<span class="ei-regex-part ei-regex-part--${o.type}" style="color:${u};font-weight:${f}">${KT(o.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--regex${l?" "+l:""}`}" data-token-start="${t.start}" data-token-end="${t.end}">${s}</span>`}var JT={bracket:"paren",toKeyword:"booleanOp",bareValue:"fieldValue",quotedValue:"quoted",wildcard:"wildcard",whitespace:"text"};function WT(t){const a=[];let l=0;l<t.length&&(t[l]==="["||t[l]==="{")&&(a.push({type:"bracket",text:t[l]}),l++);const s=t.length-1,o=s>=0&&(t[s]==="]"||t[s]==="}"),u=o?s:t.length;for(;l<u;){const f=t[l];if(f===" "||f===" "){let p=l;for(;p<u&&(t[p]===" "||t[p]===" ");)p++;a.push({type:"whitespace",text:t.slice(l,p)}),l=p;continue}if((f==="T"||f==="t")&&l+1<u&&(t[l+1]==="O"||t[l+1]==="o")){const p=l===0||t[l-1]===" "||t[l-1]===" "||t[l-1]==="["||t[l-1]==="{",g=l+2>=u||t[l+2]===" "||t[l+2]===" ";if(p&&g){a.push({type:"toKeyword",text:t.slice(l,l+2)}),l+=2;continue}}if(f==='"'){let p=l+1;for(;p<u&&t[p]!=='"';)t[p]==="\\"&&p+1<u&&p++,p++;p<u&&p++,a.push({type:"quotedValue",text:t.slice(l,p)}),l=p;continue}if(f==="*"){a.push({type:"wildcard",text:"*"}),l++;continue}let m=l;for(;m<u&&t[m]!==" "&&t[m]!==" "&&t[m]!=='"';)m++;if(m>l){const p=t.slice(l,m);a.push({type:"bareValue",text:p}),l=m}else a.push({type:"bareValue",text:f}),l++}return o&&a.push({type:"bracket",text:t[s]}),a}function Ox(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function eC(t,a,l){const s=WT(t.value).map(o=>{if(o.type==="whitespace")return Ox(o.text);const u=a[JT[o.type]]||a.fieldValue,f=o.type==="toKeyword"||o.type==="bracket"?"600":"normal";return`<span class="ei-range-part ei-range-part--${o.type}" style="color:${u};font-weight:${f}">${Ox(o.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--range${l?" "+l:""}`}" data-token-start="${t.start}" data-token-end="${t.end}">${s}</span>`}function H0(t,a){if(a<0)return null;const l=t.filter(u=>u.type===O.LPAREN||u.type===O.RPAREN);if(l.length===0)return null;const s=l.find(u=>u.end===a);if(s){const u=Mx(l,s);if(u)return u}const o=l.find(u=>u.start===a);if(o){const u=Mx(l,o);if(u)return u}return null}function Mx(t,a){if(a.type===O.LPAREN){const l=t.indexOf(a);let s=0;for(let o=l;o<t.length;o++)if(t[o].type===O.LPAREN?s++:t[o].type===O.RPAREN&&s--,s===0)return{openStart:a.start,closeStart:t[o].start}}else{const l=t.indexOf(a);let s=0;for(let o=l;o>=0;o--)if(t[o].type===O.RPAREN?s++:t[o].type===O.LPAREN&&s--,s===0)return{openStart:t[o].start,closeStart:a.start}}return null}var tC={[O.FIELD_NAME]:"field-name",[O.COLON]:"colon",[O.VALUE]:"value",[O.QUOTED_VALUE]:"quoted-value",[O.AND]:"and",[O.OR]:"or",[O.NOT]:"not",[O.COMPARISON_OP]:"comparison-op",[O.LPAREN]:"lparen",[O.RPAREN]:"rparen",[O.SAVED_SEARCH]:"saved-search",[O.HISTORY_REF]:"history-ref",[O.PREFIX_OP]:"prefix-op",[O.WILDCARD]:"wildcard",[O.REGEX]:"regex",[O.RANGE]:"range",[O.TILDE]:"tilde",[O.BOOST]:"boost",[O.WHITESPACE]:"whitespace",[O.UNKNOWN]:"unknown"},nC={[O.FIELD_NAME]:"fieldName",[O.COLON]:"operator",[O.VALUE]:"fieldValue",[O.QUOTED_VALUE]:"quoted",[O.AND]:"booleanOp",[O.OR]:"booleanOp",[O.NOT]:"booleanOp",[O.COMPARISON_OP]:"operator",[O.LPAREN]:"paren",[O.RPAREN]:"paren",[O.SAVED_SEARCH]:"savedSearch",[O.HISTORY_REF]:"historyRef",[O.PREFIX_OP]:"operator",[O.WILDCARD]:"wildcard",[O.REGEX]:"quoted",[O.RANGE]:"fieldValue",[O.TILDE]:"operator",[O.BOOST]:"operator",[O.WHITESPACE]:"text",[O.UNKNOWN]:"error"};function ei(t,a,l){const s=Ko(a);if(t.length===0)return"";const o=(l==null?void 0:l.cursorOffset)!==void 0?H0(t,l.cursorOffset):null,u=a==null?void 0:a.valueTypes,f=l==null?void 0:l.fieldTypeMap;let m;if(u&&f){m=new Array(t.length);let g,x=!1;const y=[];for(let N=0;N<t.length;N++){const w=t[N];w.type===O.FIELD_NAME?(g=w.value,x=!1):w.type===O.COLON&&g?x=!0:w.type===O.WHITESPACE||(w.type===O.LPAREN?(x&&g?y.push(f.get(g.toLowerCase())):y.push(void 0),g=void 0,x=!1):w.type===O.RPAREN?(y.pop(),g=void 0,x=!1):w.type===O.VALUE||w.type===O.QUOTED_VALUE||w.type===O.RANGE||w.type===O.REGEX||w.type===O.WILDCARD?(x&&g?m[N]=f.get(g.toLowerCase()):y.length>0&&(m[N]=y[y.length-1]),g=void 0,x=!1):(w.type===O.AND||w.type===O.OR||(w.type,O.NOT),g=void 0,x=!1))}}let p=t.map((g,x)=>{let y=s[nC[g.type]||"text"]||s.text;if(u&&m){const D=m[x];D&&u[D]&&(y=u[D])}const N=aC(g.value);if(g.type===O.WHITESPACE)return N.replace(/\n/g,"<br>");if(g.type===O.REGEX)return ZT(g,s,l==null?void 0:l.tokenClassName);if(g.type===O.RANGE)return eC(g,s,l==null?void 0:l.tokenClassName);let w="normal";(g.type===O.AND||g.type===O.OR||g.type===O.NOT)&&(w="600"),g.type===O.FIELD_NAME&&(w="500");let S="";return o&&(g.type===O.LPAREN||g.type===O.RPAREN)&&(g.start===o.openStart||g.start===o.closeStart)&&(w="700",S=`background-color:${s.matchedParenBg};border-radius:2px;`),`<span class="${`ei-token ei-token--${tC[g.type]}${l!=null&&l.tokenClassName?" "+l.tokenClassName:""}`}" style="color:${y};font-weight:${w};${S}" data-token-start="${g.start}" data-token-end="${g.end}">${N}</span>`}).join("");return p.endsWith("<br>")&&(p+="<br data-sentinel>"),p}function aC(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}if(typeof document<"u"){const t="elastic-input-keyframes";if(!document.getElementById(t)){const a=document.createElement("style");a.id=t,a.textContent="@keyframes elastic-input-spin { to { transform: rotate(360deg); } }",document.head.appendChild(a)}}function _x(t,a,l){if(!a||a.length===0)return t;const s=t.toLowerCase(),o=a.toLowerCase(),u=s.indexOf(o);if(u===-1)return t;const f=t.slice(0,u),m=t.slice(u,u+a.length),p=t.slice(u+a.length),g={fontWeight:700,textDecoration:"underline",textDecorationColor:l?"rgba(255,255,255,0.6)":"#0969da",textUnderlineOffset:"2px"};return v.createElement(v.Fragment,null,f,v.createElement("span",{className:"ei-highlight-match",style:g},m),p)}function rC({suggestions:t,selectedIndex:a,onSelect:l,position:s,colors:o,styles:u,visible:f,fixedWidth:m,renderHistoryItem:p,renderSavedSearchItem:g,renderDropdownHeader:x,cursorContext:y,listRefCallback:N,renderType:w,classNames:S}){const D=v.useRef(null),R=v.useRef(null);v.useEffect(()=>{const z=document.createElement("div");return document.body.appendChild(z),D.current=z,()=>{document.body.removeChild(z),D.current=null}},[]);const L=x&&y?x(y):null,I=L!=null;if(v.useEffect(()=>{if(R.current){const z=I?a+1:a,T=R.current.children[z];T&&T.scrollIntoView({block:"nearest"})}},[a,I]),!D.current||!f||t.length===0||!s)return null;const q=Ko(o),X=Zo(u),W={...B0(q,X),top:`${s.top}px`,left:`${s.left}px`,...m!=null?{width:`${m}px`,minWidth:"unset",maxWidth:"unset"}:{}},ae=v.createElement("div",{className:za("ei-dropdown",S==null?void 0:S.dropdown),style:W,ref:z=>{R.current=z,N==null||N(z)},onMouseDown:z=>z.preventDefault()},I&&v.createElement("div",{className:za("ei-dropdown-header",S==null?void 0:S.dropdownHeader),style:{padding:X.dropdownItemPadding||"4px 10px",fontSize:"11px",color:q.placeholder,borderBottom:`1px solid ${q.dropdownHover}`,userSelect:"none"}},L),t.map((z,T)=>{const ee=T===a,fe=kx(ee,q,X),be=(U,B,ue)=>({key:T,className:za("ei-dropdown-item",U,ee&&"ei-dropdown-item--selected",S==null?void 0:S.dropdownItem),style:{...fe,...B},title:ue,onClick:()=>l(z),onMouseEnter:de=>{de.currentTarget.style.backgroundColor=ee?q.dropdownSelected:q.dropdownHover},onMouseLeave:de=>{de.currentTarget.style.backgroundColor=ee?q.dropdownSelected:"transparent"}}),ye=U=>{if(w===!1||!z.type||z.type==="hint")return null;const B=typeof w=="function"?w(z.type,{text:z.text,label:z.label,description:z.description,type:z.type}):z.type;return B!=null?v.createElement("span",{className:"ei-dropdown-item-type",style:{...PT(ee,X),...U}},B):null},te={flexDirection:"column",alignItems:"flex-start"},re={display:"flex",alignItems:"center",gap:X.dropdownItemContentGap,width:"100%"};if(z.type==="hint"&&(z.text==="#"||z.text==="!"))return v.createElement("div",{...be("ei-dropdown-item--hint",{opacity:ee?1:.7}),onMouseEnter:U=>{U.currentTarget.style.backgroundColor=ee?q.dropdownSelected:q.dropdownHover,U.currentTarget.style.opacity="1"},onMouseLeave:U=>{U.currentTarget.style.backgroundColor=ee?q.dropdownSelected:"transparent",U.currentTarget.style.opacity=ee?"1":"0.7"}},v.createElement("span",{className:"ei-dropdown-item-label",style:Ws()},z.label),z.description&&v.createElement("span",{className:"ei-dropdown-item-desc",style:Mh()},z.description));if(z.type==="error")return v.createElement("div",{key:T,className:za("ei-dropdown-item","ei-dropdown-item--error",S==null?void 0:S.dropdownItem),style:{...fe,cursor:"default",opacity:.8}},v.createElement("span",{className:"ei-dropdown-item-label",style:{...Ws(),color:q.error}},z.label||"Error loading suggestions"));if(z.type==="noResults")return v.createElement("div",{key:T,className:za("ei-dropdown-item","ei-dropdown-item--no-results",S==null?void 0:S.dropdownItem),style:{...fe,cursor:"default",opacity:.7}},z.customContent);if(z.type==="loading")return v.createElement("div",{key:T,className:za("ei-dropdown-item","ei-dropdown-item--loading",S==null?void 0:S.dropdownItem),style:{...fe,cursor:"default",opacity:.6,justifyContent:"center"}},v.createElement("span",{className:"ei-dropdown-item-label",style:{...Ws(),fontStyle:"italic"}},z.label||"Searching..."),v.createElement("span",{className:"ei-dropdown-spinner",style:{marginLeft:"6px",display:"inline-block",animation:"elastic-input-spin 1s linear infinite",width:"14px",height:"14px",border:"2px solid",borderColor:`${q.placeholder} transparent ${q.placeholder} transparent`,borderRadius:"50%"}}));if(z.type==="hint"){const U=kx(!1,q,X);return v.createElement("div",{key:T,className:za("ei-dropdown-item","ei-dropdown-item--hint",S==null?void 0:S.dropdownItem),style:{...U,cursor:"default",opacity:z.customContent?1:.6}},z.customContent?z.customContent:v.createElement("span",{className:"ei-dropdown-item-label",style:Ws()},z.label))}if(z.type==="history"&&p&&z.sourceData){const U=p(z.sourceData,ee);if(U!=null)return v.createElement("div",be("ei-dropdown-item--history",te),U)}if(z.type==="savedSearch"&&g&&z.sourceData){const U=g(z.sourceData,ee);if(U!=null)return v.createElement("div",be("ei-dropdown-item--saved-search"),U)}if((z.type==="history"||z.type==="savedSearch")&&z.description!=null){const U=z.type==="history"?"ei-dropdown-item--history":"ei-dropdown-item--saved-search";let B;const ue=z.text.startsWith("(")&&z.text.endsWith(")")?z.text.slice(1,-1):z.text;return z.label!==ue&&(B=z.text),v.createElement("div",be(U,te,B),v.createElement("span",{className:"ei-dropdown-item-label",style:{...Ws(),width:"100%",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"normal",wordBreak:"break-all"}},_x(z.label,z.matchPartial,ee)),v.createElement("span",{style:re},v.createElement("span",{className:"ei-dropdown-item-desc",style:{...Mh(),flex:1}},z.description),ye({marginLeft:"auto"})))}const ge=z.type==="savedSearch"?"ei-dropdown-item--saved-search":void 0;return v.createElement("div",be(ge),v.createElement("span",{className:"ei-dropdown-item-label",style:Ws()},_x(z.label,z.matchPartial,ee)),z.description&&v.createElement("span",{className:"ei-dropdown-item-desc",style:Mh()},z.description),ye())}));return rl.createPortal(ae,D.current)}var lC=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _h(t){return Math.floor(t/10)*10}function sC({onSelect:t,colors:a,styles:l,initialMode:s,initialStart:o,initialEnd:u,presets:f,className:m}){const p=s==="range"&&u?u:o??new Date,[g,x]=v.useState(s??"single"),[y,N]=v.useState("days"),[w,S]=v.useState(p.getFullYear()),[D,R]=v.useState(p.getMonth()),[L,I]=v.useState(o??null),[q,X]=v.useState(u??null),[W,ae]=v.useState(null),z=Ko(a),T=GT(z,Zo(l)),ee=()=>{y==="days"?D===0?(R(11),S(oe=>oe-1)):R(oe=>oe-1):S(y==="months"?oe=>oe-1:oe=>oe-10)},fe=()=>{y==="days"?D===11?(R(0),S(oe=>oe+1)):R(oe=>oe+1):S(y==="months"?oe=>oe+1:oe=>oe+10)},be=()=>{S(y==="days"?oe=>oe-1:y==="months"?oe=>oe-10:oe=>oe-100)},ye=()=>{S(y==="days"?oe=>oe+1:y==="months"?oe=>oe+10:oe=>oe+100)},te=()=>{y==="days"?N("months"):y==="months"&&N("years")},re=oe=>{R(oe),N("days")},ge=oe=>{S(oe),N("months")},U=oe=>{if(g==="single"){t(kh(oe));return}if(!L||q)I(oe),X(null),ae(null);else{const[$e,at]=L<=oe?[L,oe]:[oe,L];I($e),X(at),ae(null),t(`[${kh($e)} TO ${kh(at)}]`)}},B=L&&!q?W:q,ue=oe=>{x(oe),I(null),X(null),ae(null)},de=y==="days"?`${qT(D)} ${w}`:y==="months"?`${w}`:`${_h(w)}–${_h(w)+9}`,we=y!=="years",C=new Date,V=Cx(w,D),ne=HT(w,D),me=["Su","Mo","Tu","We","Th","Fr","Sa"],Ne=[],je=(oe,$e,at)=>{const Ut=go(oe,C),pn=L&&go(oe,L),jt=B&&go(oe,B),_t=Dx(oe,L,B),Qt=pn||jt,Hn={...T.day,...at?T.dayOtherMonth:{},...Ut?T.dayToday:{},..._t?T.dayInRange:{},...Qt?T.daySelected:{}},$n=g==="range"&&L&&!q;return v.createElement("button",{key:$e,className:"ei-datepicker-day",style:Hn,onClick:()=>U(oe),onMouseEnter:tn=>{$n?ae(oe):Qt||(tn.currentTarget.style.backgroundColor=z.dropdownHover)},onMouseLeave:tn=>{!$n&&!Qt&&(tn.currentTarget.style.backgroundColor=_t?"rgba(9, 105, 218, 0.1)":"transparent")}},oe.getDate())};if(ne>0){const oe=Cx(w,D-1);for(let $e=ne-1;$e>=0;$e--){const at=oe-$e,Ut=new Date(w,D-1,at);Ne.push(je(Ut,`prev${at}`,!0))}}for(let oe=1;oe<=V;oe++){const $e=new Date(w,D,oe);Ne.push(je($e,String(oe),!1))}const ze=Ne.length%7;if(ze>0){const oe=7-ze;for(let $e=1;$e<=oe;$e++){const at=new Date(w,D+1,$e);Ne.push(je(at,`next${$e}`,!0))}}const ut={...T.day,padding:"10px 4px",fontSize:"13px"},Ge={...ut,...T.dayToday},nt=f??[{label:"Today",value:"[now/d TO now]",type:"range"},{label:"Yesterday",value:"[now-1d/d TO now/d]",type:"range"},{label:"Last 7 days",value:"[now-7d TO now]",type:"range"},{label:"Last 30 days",value:"[now-30d TO now]",type:"range"},{label:"Last 90 days",value:"[now-90d TO now]",type:"range"},{label:"Last 1 year",value:"[now-365d TO now]",type:"range"}],Sn={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px"},Xt=oe=>{oe.currentTarget.style.backgroundColor="#eef1f5"},ft=oe=>{oe.currentTarget.style.backgroundColor="transparent"};return v.createElement("div",{className:za("ei-datepicker",m),style:T.container,onMouseDown:oe=>oe.preventDefault(),onMouseLeave:()=>ae(null)},v.createElement("div",{className:"ei-datepicker-toggle",style:T.rangeToggle},["single","range"].map(oe=>v.createElement("button",{key:oe,style:{...T.rangeToggleButton,...g===oe?T.rangeToggleButtonActive:{}},onClick:()=>ue(oe)},oe.charAt(0).toUpperCase()+oe.slice(1)))),v.createElement("div",{className:"ei-datepicker-header",style:T.header},v.createElement("div",{style:{display:"flex",alignItems:"center",gap:"2px"}},v.createElement("button",{style:T.navButton,onClick:be,onMouseEnter:Xt,onMouseLeave:ft},"«"),v.createElement("button",{style:T.navButton,onClick:ee,onMouseEnter:Xt,onMouseLeave:ft},"‹")),v.createElement("button",{style:{...T.monthLabel,backgroundColor:"transparent",border:"none",cursor:we?"pointer":"default",padding:"2px 8px",borderRadius:"4px"},onClick:we?te:void 0,onMouseEnter:oe=>{we&&(oe.currentTarget.style.backgroundColor="#eef1f5")},onMouseLeave:oe=>{oe.currentTarget.style.backgroundColor="transparent"}},de),v.createElement("div",{style:{display:"flex",alignItems:"center",gap:"2px"}},v.createElement("button",{style:T.navButton,onClick:fe,onMouseEnter:Xt,onMouseLeave:ft},"›"),v.createElement("button",{style:T.navButton,onClick:ye,onMouseEnter:Xt,onMouseLeave:ft},"»"))),y==="days"&&v.createElement(v.Fragment,null,v.createElement("div",{style:T.weekDays},me.map(oe=>v.createElement("div",{key:oe,style:T.weekDay},oe))),v.createElement("div",{className:"ei-datepicker-days",style:T.days},Ne)),y==="months"&&v.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},lC.map((oe,$e)=>{const at=new Date(w,$e,1),Ut=Dx(at,L,B),pn=L&&go(new Date(L.getFullYear(),L.getMonth(),1),at)||B&&go(new Date(B.getFullYear(),B.getMonth(),1),at),jt=$e===C.getMonth()&&w===C.getFullYear(),_t=g==="range"&&L&&!q;return v.createElement("button",{key:oe,style:{...jt?Ge:ut,...Ut?T.dayInRange:{},...pn?T.daySelected:{}},onClick:()=>re($e),onMouseEnter:Qt=>{_t?ae(at):pn||(Qt.currentTarget.style.backgroundColor=z.dropdownHover)},onMouseLeave:Qt=>{!_t&&!pn&&(Qt.currentTarget.style.backgroundColor=Ut?"rgba(9, 105, 218, 0.1)":"transparent")}},oe)})),y==="years"&&v.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},Array.from({length:12},(oe,$e)=>{const at=_h(w)-1+$e,Ut=$e===0||$e===11,pn=at===C.getFullYear(),jt=new Date(at,0,1),_t=L&&B&&at>=Math.min(L.getFullYear(),B.getFullYear())&&at<=Math.max(L.getFullYear(),B.getFullYear()),Qt=L&&L.getFullYear()===at||B&&B.getFullYear()===at,Hn=g==="range"&&L&&!q;return v.createElement("button",{key:at,style:{...pn?Ge:ut,...Ut?T.dayOtherMonth:{},..._t?T.dayInRange:{},...Qt?T.daySelected:{}},onClick:()=>ge(at),onMouseEnter:$n=>{Hn?ae(jt):Qt||($n.currentTarget.style.backgroundColor=z.dropdownHover)},onMouseLeave:$n=>{!Hn&&!Qt&&($n.currentTarget.style.backgroundColor=_t?"rgba(9, 105, 218, 0.1)":"transparent")}},at)})),(()=>{const oe=nt.filter($e=>!$e.type||$e.type===g);return oe.length>0&&v.createElement("div",{className:"ei-datepicker-presets",style:{...T.quickOptions,...Sn}},oe.map($e=>v.createElement("button",{key:`${$e.type??"both"}-${$e.value}`,style:T.quickOption,onClick:()=>t($e.value)},$e.label)))})())}var iC=30,oC=150;function Lx(t,a){let l=0;const s=o=>{if(o.nodeType===Node.TEXT_NODE){const u=(o.textContent||"").length;return l+u>=a?{node:o,offset:a-l}:(l+=u,null)}if(o.nodeName==="BR"){if(l+1>=a){const u=o.parentNode;if(u)return{node:u,offset:Array.from(u.childNodes).indexOf(o)+1}}return l+=1,null}for(let u=0;u<o.childNodes.length;u++){const f=s(o.childNodes[u]);if(f)return f}return null};return s(t)}function uC(t,a,l){const s=Lx(t,a),o=Lx(t,l);if(!s||!o)return[];const u=document.createRange();u.setStart(s.node,s.offset),u.setEnd(o.node,o.offset);const f=t.getBoundingClientRect(),m=u.getClientRects();if(m.length===0)return[];const p=[];for(let g=0;g<m.length;g++){const x=m[g];x.width<1||p.push({left:x.left-f.left,top:x.top-f.top,width:Math.max(x.width,6),height:x.height})}return p}function cC(t,a,l){if(!a||t.length===0)return[];const s=[];let o=0;for(const u of t){if(o>=iC)break;if(l>=u.start&&l<=u.end)continue;const f=uC(a,u.start,u.end);for(const m of f)s.push({left:m.left,top:m.top,width:m.width,height:m.height,error:u});o++}return s}var zx=28,Ux=4;function dC(t){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4' viewBox='0 0 8 4'%3E%3Cpath d='M0 2 Q2 0 4 2 Q6 4 8 2' stroke='${t.replace("#","%23")}' fill='none' stroke-width='0.8'/%3E%3C/svg%3E")`}function fC({errors:t,editorRef:a,cursorOffset:l,colors:s,styles:o,containerRef:u,classNames:f}){const[m,p]=v.useState(null),[g,x]=v.useState({x:0,clientY:0}),[y,N]=v.useState([]),w=v.useRef([]),S=v.useRef(null),D=v.useRef(null);if(v.useEffect(()=>{if(D.current&&clearTimeout(D.current),t.length===0){N([]),w.current=[],p(null);return}return D.current=setTimeout(()=>{const q=cC(t,a,l);N(q),w.current=q},oC),()=>{D.current&&clearTimeout(D.current)}},[t,a,l]),v.useEffect(()=>{const q=u;if(!q||!a)return;const X=z=>{const T=a.getBoundingClientRect(),ee=z.clientX-T.left,fe=z.clientY-T.top;let be=-1;for(let ye=0;ye<w.current.length;ye++){const te=w.current[ye];if(ee>=te.left&&ee<=te.left+te.width&&fe>=te.top&&fe<=te.top+te.height+6){be=ye;break}}be>=0?(p(be),x({x:ee,clientY:z.clientY})):p(null)},W=()=>{p(null)},ae=new AbortController;return q.addEventListener("mousemove",X,{signal:ae.signal}),q.addEventListener("mouseleave",W,{signal:ae.signal}),()=>ae.abort()},[u,a]),v.useEffect(()=>{const q=S.current;if(!q||m==null)return;const X=q.getBoundingClientRect();if(X.right>window.innerWidth-8){const W=X.right-window.innerWidth+8;q.style.transform=`translateX(-${W}px)`}else q.style.transform=""}),y.length===0)return null;const R=Ko(s),L=Zo(o),I=m!=null?y[m]:null;return v.createElement(v.Fragment,null,y.map((q,X)=>{const W=q.error.severity==="warning",ae=dC(W?R.warning:R.error),z=q.top+q.height-2;return v.createElement("div",{key:`wave-${X}`,className:za("ei-squiggly",W?"ei-squiggly--warning":"ei-squiggly--error",f==null?void 0:f.squiggly),style:{position:"absolute",left:`${q.left}px`,top:`${z}px`,width:`${q.width}px`,height:"4px",zIndex:1,backgroundImage:ae,backgroundRepeat:"repeat-x",backgroundPosition:"left top",backgroundSize:"auto 4px",pointerEvents:"none"}})}),I!=null&&(()=>{const q=I.error.severity==="warning"?R.warning:R.error,X=a==null?void 0:a.getBoundingClientRect(),W=((X==null?void 0:X.left)??0)+g.x,ae=((X==null?void 0:X.top)??0)+I.top+I.height+2,z=((X==null?void 0:X.top)??0)+I.top,T=window.innerHeight-g.clientY<zx+20?z-zx-Ux:ae+Ux;return rl.createPortal(v.createElement("div",{ref:S,className:za("ei-tooltip",f==null?void 0:f.tooltip),style:{position:"fixed",top:`${T}px`,left:`${W}px`,zIndex:L.dropdownZIndex,backgroundColor:R.background,color:q,border:`1px solid ${q}`,borderRadius:"4px",padding:"4px 8px",fontSize:"12px",fontFamily:L.fontFamily,lineHeight:"1.4",whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"90vw"}},I.error.message),document.body)})())}function _o(t,a,l){let s=0,o=!1;function u(f){var m;if(o)return!0;if(f===a){if(f.nodeType===Node.TEXT_NODE)s+=l;else for(let p=0;p<l&&p<f.childNodes.length;p++)if(u(f.childNodes[p]))return!0;return o=!0,!0}if(f.nodeType===Node.TEXT_NODE)return s+=(f.textContent||"").length,!1;if(f.nodeName==="BR")return(m=f.hasAttribute)!=null&&m.call(f,"data-sentinel")||(s+=1),!1;for(let p=0;p<f.childNodes.length;p++)if(u(f.childNodes[p]))return!0;return!1}return u(t),s}function kl(t){const a=window.getSelection();if(!a||a.rangeCount===0)return 0;const l=a.getRangeAt(0);return _o(t,l.startContainer,l.startOffset)}function Er(t){const a=window.getSelection();if(!a||a.rangeCount===0)return{start:0,end:0};const l=a.getRangeAt(0);return{start:_o(t,l.startContainer,l.startOffset),end:_o(t,l.endContainer,l.endOffset)}}function al(t,a){const l=window.getSelection();if(!l)return;const s=Kh(t,a);if(!s)return;const o=document.createRange();o.setStart(s.node,s.offset),o.collapse(!0),l.removeAllRanges(),l.addRange(o)}function nl(t,a,l){if(a===l){al(t,a);return}const s=window.getSelection();if(!s)return;const o=Kh(t,a),u=Kh(t,l);if(!o||!u)return;const f=document.createRange();f.setStart(o.node,o.offset),f.setEnd(u.node,u.offset),s.removeAllRanges(),s.addRange(f)}function Kh(t,a){let l=0;function s(f){var m;if(f.nodeType===Node.TEXT_NODE){const p=(f.textContent||"").length;return l+p>=a?{node:f,offset:a-l}:(l+=p,null)}if(f.nodeName==="BR"){if((m=f.hasAttribute)!=null&&m.call(f,"data-sentinel"))return null;if(l+1>=a){const p=f.parentNode;if(p)return{node:p,offset:Array.from(p.childNodes).indexOf(f)+1}}return l+=1,null}for(let p=0;p<f.childNodes.length;p++){const g=s(f.childNodes[p]);if(g)return g}return null}const o=s(t);if(o)return o;const u=$0(t);return u?{node:u,offset:(u.textContent||"").length}:{node:t,offset:0}}function $0(t){if(t.nodeType===Node.TEXT_NODE)return t;for(let a=t.childNodes.length-1;a>=0;a--){const l=$0(t.childNodes[a]);if(l)return l}return null}function hC(t){const a=window.getSelection();if(!a||a.rangeCount===0)return;const l=a.getRangeAt(0);l.deleteContents();const s=document.createTextNode(t);l.insertNode(s),l.setStartAfter(s),l.collapse(!0),a.removeAllRanges(),a.addRange(l)}function mC(){const t=window.getSelection();if(!t||t.rangeCount===0)return;const a=t.getRangeAt(0);a.deleteContents();const l=document.createElement("br");a.insertNode(l),a.setStartAfter(l),a.collapse(!0),t.removeAllRanges(),t.addRange(a)}function yc(t){var m;const a=window.getSelection();if(!a||a.rangeCount===0)return;const l=a.getRangeAt(0);let s=l.getBoundingClientRect();if(s.width===0&&s.height===0){const p=document.createElement("span");p.textContent="​",l.insertNode(p),s=p.getBoundingClientRect(),(m=p.parentNode)==null||m.removeChild(p),a.removeAllRanges(),a.addRange(l)}const o=t.getBoundingClientRect(),u=s.top-o.top+t.scrollTop,f=s.bottom-o.top+t.scrollTop;f>t.scrollTop+t.clientHeight?t.scrollTop=f-t.clientHeight:u<t.scrollTop&&(t.scrollTop=u)}function Lh(){var s,o;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0),l=a.getBoundingClientRect();if(l.width===0&&l.height===0||a.collapsed&&a.startContainer.nodeType===Node.ELEMENT_NODE&&a.startOffset>0&&((s=a.startContainer.childNodes[a.startOffset-1])==null?void 0:s.nodeName)==="BR"){const u=document.createElement("span");u.textContent="​",a.insertNode(u);const f=u.getBoundingClientRect();return(o=u.parentNode)==null||o.removeChild(u),t.removeAllRanges(),t.addRange(a),f}return l}function Bx(t,a){return Math.min(t,a)}function zh(t,a,l){const s=window.innerHeight,o=window.innerWidth;let u=t.bottom+window.scrollY+4,f=t.left+window.scrollX;return t.bottom+a+4>s&&(u=t.top+window.scrollY-a-4),f+l>o&&(f=o-l-8),f<8&&(f=8),{top:u,left:f}}var pC=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD]);function gC(t,a,l){for(const s of t)if(a>=s.start&&a<=s.end&&pC.has(s.type))return a===s.start&&l===s.end?null:{start:s.start,end:s.end};return null}var vC=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD,O.FIELD_NAME,O.RANGE,O.SAVED_SEARCH,O.HISTORY_REF,O.REGEX]);function yC(t,a,l){const s=[];for(const o of a)if(l>=o.start&&l<=o.end&&vC.has(o.type)){s.push({start:o.start,end:o.end});break}return t&&Nc(t,l,s),xC(s)}function Nc(t,a,l){if(a<t.start||a>t.end)return!1;let s=!1;switch(t.type){case"BooleanExpr":s=Nc(t.left,a,l)||s,s=Nc(t.right,a,l)||s;break;case"Group":case"Not":case"FieldGroup":s=Nc(t.expression,a,l)||s;break}return l.push({start:t.start,end:t.end}),!0}function xC(t){t.sort((l,s)=>l.end-l.start-(s.end-s.start)||l.start-s.start);const a=[];for(const l of t){const s=a[a.length-1];s&&s.start===l.start&&s.end===l.end||a.push(l)}return a}var bC=60,SC=" ";function wC(t,a){const l=(a==null?void 0:a.maxLineLength)??bC,s=(a==null?void 0:a.indent)??SC,o={whitespace:a==null?void 0:a.whitespaceOperator,and:a==null?void 0:a.andOperator,or:a==null?void 0:a.orOperator,not:a==null?void 0:a.notOperator};let u;return typeof t=="string"?u=new cs(new ii(t,{savedSearches:!0,historySearch:!0}).tokenize()).parse():u=t,u?jc(u,0,l,s,o):""}function EC(t,a){return t.implicit?a.whitespace??"":t.operator==="AND"?a.and??t.sourceOperator??"AND":a.or??t.sourceOperator??"OR"}function q0(t,a){const l=a.not??t.sourceOperator??"NOT";return{op:l,sep:/^[a-zA-Z]/.test(l)?" ":""}}function Rr(t,a){switch(t.type){case"FieldValue":{const l=t.quoted?`"${t.value}"`:t.value,s=t.operator===":"?":":`:${t.operator}`;let o=`${t.field}${s}${l}`;return t.fuzzy!=null&&(o+=`~${t.fuzzy}`),t.proximity!=null&&(o+=`~${t.proximity}`),t.boost!=null&&(o+=`^${t.boost}`),o}case"BareTerm":{let l=t.quoted?`"${t.value}"`:t.value;return t.fuzzy!=null&&(l+=`~${t.fuzzy}`),t.proximity!=null&&(l+=`~${t.proximity}`),t.boost!=null&&(l+=`^${t.boost}`),l}case"Range":{const l=t.lowerInclusive?"[":"{",s=t.upperInclusive?"]":"}",o=`${l}${t.lowerQuoted?`"${t.lower}"`:t.lower} TO ${t.upperQuoted?`"${t.upper}"`:t.upper}${s}`;return t.field?`${t.field}:${o}`:o}case"Regex":return`/${t.pattern}/`;case"SavedSearch":return`#${t.name}`;case"HistoryRef":return`!${t.ref}`;case"Not":{const{op:l,sep:s}=q0(t,a);return`${l}${s}${Rr(t.expression,a)}`}case"Group":{let l=`(${Rr(t.expression,a)})`;return t.boost!=null&&(l+=`^${t.boost}`),l}case"FieldGroup":{let l=`${t.field}:(${Rr(t.expression,a)})`;return t.boost!=null&&(l+=`^${t.boost}`),l}case"BooleanExpr":{const l=EC(t,a),s=l?` ${l} `:" ";return`${Rr(t.left,a)}${s}${Rr(t.right,a)}`}case"Error":return t.value}}function NC(t){const a=t.operator,l=!!t.implicit,s=[],o=u=>{u.type==="BooleanExpr"&&u.operator===a&&!!u.implicit===l?(o(u.left),o(u.right)):s.push(u)};return o(t),{operator:a,implicit:l,sourceOperator:t.sourceOperator,operands:s}}function Rc(t){return t.type==="Group"||t.type==="FieldGroup"?!0:t.type==="BooleanExpr"?Rc(t.left)||Rc(t.right):t.type==="Not"?Rc(t.expression):!1}var RC={and:"AND",or:"OR",not:"NOT"};function jC(t,a){return!!(Rr(t,RC).length>a||Rc(t))}function jc(t,a,l,s,o){const u=s.repeat(a);switch(t.type){case"BooleanExpr":{const{operator:f,implicit:m,sourceOperator:p,operands:g}=NC(t),x=m?o.whitespace??"":f==="AND"?o.and??p??"AND":o.or??p??"OR",y=x?` ${x} `:" ",N=g.map(w=>Rr(w,o)).join(y);return N.length<=l?N:g.map((w,S)=>{const D=jc(w,a,l,s,o);return S===0?D:x?`${u}${x} ${D}`:`${u}${D}`}).join(`
283
+ `)}case"Group":{if(!jC(t.expression,l)){let m=`(${Rr(t.expression,o)})`;return t.boost!=null&&(m+=`^${t.boost}`),m}let f=`(
284
+ ${TC(jc(t.expression,a+1,l,s,o),a+1,s)}
285
+ ${u})`;return t.boost!=null&&(f+=`^${t.boost}`),f}case"FieldGroup":{let f=`${t.field}:(${Rr(t.expression,o)})`;return t.boost!=null&&(f+=`^${t.boost}`),f}case"Not":{const{op:f,sep:m}=q0(t,o);return`${f}${m}${jc(t.expression,a,l,s,o)}`}default:return Rr(t,o)}}function TC(t,a,l){const s=l.repeat(a);return t.split(`
286
+ `).map(o=>o.startsWith(s)?o:s+o).join(`
287
+ `)}function CC(t){return t?Co(t):[]}function Hx(t){return t.type==="BooleanExpr"}function Co(t){switch(t.type){case"BooleanExpr":return Zh(t);case"Group":{const a=[],l=t.expression;return Hx(l)?(a.push({start:t.start,end:t.end}),a.push(...Co(l)),a.push({start:t.start,end:t.end})):a.push({start:t.start,end:t.end}),a}case"FieldGroup":{const a=[];a.push({start:t.start,end:t.end});const l=t.expression;return Hx(l)&&a.push(...Co(l)),a}case"Not":{const a=[];return a.push({start:t.start,end:t.end}),a.push(...Co(t.expression)),a}case"FieldValue":case"BareTerm":case"SavedSearch":case"HistoryRef":case"Regex":case"Range":case"Error":return[{start:t.start,end:t.end}]}}function Zh(t){return t.type==="BooleanExpr"?[...Zh(t.left),...Zh(t.right)]:Co(t)}function DC(t,a,l,s){if(t.length===0)return null;if(a>=0&&a<t.length){const o=s==="forward"?a+1:a-1;return o>=0&&o<t.length?{stop:t[o],index:o}:null}if(s==="forward"){for(let o=0;o<t.length;o++)if(t[o].start>=l)return{stop:t[o],index:o};return{stop:t[t.length-1],index:t.length-1}}else{for(let o=t.length-1;o>=0;o--)if(t[o].end<=l)return{stop:t[o],index:o};return{stop:t[0],index:0}}}var AC=class{constructor(t=100){hn(this,"stack",[]);hn(this,"index",-1);hn(this,"maxSize");this.maxSize=t}push(t){if(this.index>=0&&this.stack[this.index].value===t.value){this.stack[this.index].cursorPos=t.cursorPos;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push(t),this.stack.length>this.maxSize&&this.stack.shift(),this.index=this.stack.length-1}replaceCurrent(t){this.index>=0?this.stack[this.index]=t:this.push(t)}undo(){return this.index<=0?null:(this.index--,this.stack[this.index])}redo(){return this.index>=this.stack.length-1?null:(this.index++,this.stack[this.index])}canUndo(){return this.index>0}canRedo(){return this.index<this.stack.length-1}current(){return this.index>=0?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}get length(){return this.stack.length}};function kC(t,a){const l=s=>(a==null?void 0:a(s))??BT(s);if(t.type==="RANGE"&&t.token){const s=t.token.value,o=(s.endsWith("]")||s.endsWith("}")?s.slice(1,-1):s.slice(1)).match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/);if(o)return{mode:"range",start:l(o[1].trim()),end:l(o[2].trim())}}if(t.type==="FIELD_VALUE"&&t.partial){const s=l(t.partial);if(s)return{mode:"single",start:s,end:null}}return null}function OC(t,a){var l,s,o,u;return((t==null?void 0:t.mode)??"single")!==((a==null?void 0:a.mode)??"single")||(((l=t==null?void 0:t.start)==null?void 0:l.getTime())??0)!==(((s=a==null?void 0:a.start)==null?void 0:s.getTime())??0)?!0:(((o=t==null?void 0:t.end)==null?void 0:o.getTime())??0)!==(((u=a==null?void 0:a.end)==null?void 0:u.getTime())??0)}function MC({position:t,colors:a,onSelect:l,colorConfig:s,styleConfig:o,datePickerInit:u,fixedWidth:f,datePresets:m,datePickerClassName:p}){const g=v.useRef(null),[x,y]=v.useState(!1);if(v.useEffect(()=>{const S=document.createElement("div");return document.body.appendChild(S),g.current=S,y(!0),()=>{document.body.removeChild(S),g.current=null}},[]),!x||!g.current)return null;const N=Zo(o),w={position:"absolute",zIndex:N.dropdownZIndex,...B0(a,N),top:`${t.top}px`,left:`${t.left}px`,maxHeight:"none",overflowY:"visible",...f!=null?{width:`${f}px`,minWidth:"unset",maxWidth:"unset"}:{}};return rl.createPortal(v.createElement("div",{className:"ei-datepicker-portal",style:w,onMouseDown:S=>S.preventDefault()},v.createElement(sC,{onSelect:l,colors:s,styles:o,initialMode:u==null?void 0:u.mode,initialStart:u==null?void 0:u.start,initialEnd:u==null?void 0:u.end,presets:m,className:p})),g.current)}function _C(t){const{fields:a,onSearch:l,onChange:s,onValidationChange:o,value:u,defaultValue:f,savedSearches:m,searchHistory:p,fetchSuggestions:g,colors:x,styles:y,placeholder:N,className:w,classNames:S,style:D,dropdown:R,features:L,inputRef:I,datePresets:q,onKeyDown:X,onFocus:W,onBlur:ae,onTab:z,validateValue:T,parseDate:ee,plainModeLength:fe,interceptPaste:be,defaultField:ye,trailingSpaceOnAccept:te=!0,collapseOnBlur:re=!1}=t,ge=typeof ye=="string"?{name:ye,showFieldSuggestions:!1}:ye?{showFieldSuggestions:!1,...ye}:void 0,U=ge==null?void 0:ge.name,B=(R==null?void 0:R.open)??(R==null?void 0:R.mode)??"always",ue=typeof B=="function",de=ue?null:B,we=(R==null?void 0:R.alignToInput)??!1,C=R==null?void 0:R.maxSuggestions,V=C||10,ne=R==null?void 0:R.suggestDebounceMs,me=parseInt((y==null?void 0:y.dropdownMaxHeight)||"300",10)||300,Ne=(L==null?void 0:L.savedSearches)??!!m,je=(L==null?void 0:L.historySearch)??!!p,ze=(R==null?void 0:R.showSavedSearchHint)??Ne,ut=(R==null?void 0:R.showHistoryHint)??je,Ge=(R==null?void 0:R.showOperators)!==!1,nt=(ue||de!=="input")&&(R==null?void 0:R.onNavigation)!==!1,Sn=(R==null?void 0:R.navigationDelay)??0,Xt=(R==null?void 0:R.loadingDelay)??0,ft=R==null?void 0:R.renderFieldHint,oe=R==null?void 0:R.renderHistoryItem,$e=R==null?void 0:R.renderSavedSearchItem,at=R==null?void 0:R.renderHeader,Ut=R==null?void 0:R.renderNoResults,pn=R==null?void 0:R.renderType,jt=(R==null?void 0:R.autoSelect)??!1,_t=(R==null?void 0:R.homeEndKeys)??!1,Qt=(L==null?void 0:L.multiline)!==!1,Hn=(L==null?void 0:L.smartSelectAll)??!1,$n=(L==null?void 0:L.expandSelection)??!1,tn=(L==null?void 0:L.wildcardWrap)??!1,da=(L==null?void 0:L.clauseNavigation)??!1,fa=L==null?void 0:L.formatQuery,Wn=!!fa,qn=typeof fa=="object"?fa:void 0,he=v.useMemo(()=>({savedSearches:Ne,historySearch:je}),[Ne,je]),Ce=Array.isArray(a)?a:[],[De,Pe]=v.useState(Ce);v.useEffect(()=>{if(Array.isArray(a)){Pe(a);return}let j=!1;return a().then(P=>{j||Pe(P)}),()=>{j=!0}},[a]);const qe=v.useMemo(()=>{const j=new Map;for(const P of De)if(j.set(P.name.toLowerCase(),P.type),P.aliases)for(const Ee of P.aliases)j.set(Ee.toLowerCase(),P.type);return j},[De]),Z=v.useRef(null),[Tt,Kt]=v.useState(null),Yn=v.useCallback(j=>{Z.current=j,Kt(j)},[]),gn=v.useRef(null),Ba=v.useRef(null),Me=v.useRef(u||f||""),vt=v.useRef(null),yt=v.useRef(!1),St=v.useRef(!1),Bt=v.useRef(new AC),Ct=v.useRef(null),nn=v.useRef(new Set),Zt=v.useRef(null),Ht=v.useRef(null),ht=v.useRef(null),Je=v.useRef(null),wn=v.useRef(!1),kn=v.useRef(null),A=v.useRef(null),M=v.useRef(null),$=v.useRef("input"),K=v.useRef(null),se=v.useRef(-1),Te=v.useRef(()=>{}),ve=v.useRef(new Ah(Ce,[],[],C||10,{showSavedSearchHint:ze,showHistoryHint:ut,hasSavedSearchProvider:typeof m=="function",hasHistoryProvider:typeof p=="function"}));ve.current.setDefaultField(ge);const Ae=v.useRef(new Ax(Ce)),Re=v.useRef(T);Re.current=T;const[_e,Ue]=v.useState([]),[Xe,ke]=v.useState(null),[Ze,Ie]=v.useState([]),[$t,We]=v.useState(-1),[ct,it]=v.useState(!1),[dt,Jt]=v.useState(!1),[Fn,En]=v.useState(null),[On,Mn]=v.useState([]),[Pn,ga]=v.useState(!1),[sl,ea]=v.useState(!Me.current),[hr,Qe]=v.useState(fe!=null&&Me.current.length>=fe),[Nt,Wt]=v.useState(0),[ta,_n]=v.useState(0),[Mr,Rt]=v.useState(""),[ja,Gn]=v.useState(null),[ql,yi]=v.useState(null),Dt=v.useRef({tokens:_e,ast:Xe,suggestions:Ze,selectedSuggestionIndex:$t,showDropdown:ct,showDatePicker:dt,cursorOffset:Nt,selectionEnd:ta,autocompleteContext:Mr,validationErrors:On,cursorContext:ja});Dt.current={tokens:_e,ast:Xe,suggestions:Ze,selectedSuggestionIndex:$t,showDropdown:ct,showDatePicker:dt,cursorOffset:Nt,selectionEnd:ta,autocompleteContext:Mr,validationErrors:On,cursorContext:ja};const mr=v.useCallback((j,P)=>{if(we&&gn.current){const xe=gn.current.getBoundingClientRect();return{top:xe.bottom+window.scrollY+4,left:xe.left+window.scrollX}}const Ee=Lh();return Ee?zh(Ee,j,P):null},[we]),Jo=v.useCallback(()=>{if(!(!we||!gn.current))return gn.current.getBoundingClientRect().width},[we]),nr=v.useCallback((j,P,Ee="dropdown")=>{const xe=Ee==="datePicker"?j:Bx(j,me);if(we&&Ee!=="datePicker"){it(!0),En(mr(xe,P));return}const Fe=requestAnimationFrame(()=>{nn.current.delete(Fe),Ee==="datePicker"?Jt(!0):it(!0);const ce=Lh();En(ce?zh(ce,xe,P):null)});nn.current.add(Fe)},[we,mr,me]),il=80,od=60,xs=v.useCallback((j,P)=>{if(!Z.current)return;const Ee=ei(j,x,{cursorOffset:P,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=Ee,document.activeElement===Z.current&&al(Z.current,P)},[x]),va=v.useCallback((j,P)=>{const Ee=fe!=null&&j.length>=fe;if(Qe(Ee),Ee){if(Ue([]),ke(null),Mn([]),ea(j.length===0),Ie([]),Dt.current.tokens=[],it(!1),Jt(!1),Z.current){const Se=kl(Z.current);Z.current.querySelector("span")&&(Z.current.textContent=j,al(Z.current,Se)),Wt(Se),_n(Se)}s&&s(j,null),o&&o([]);return}const xe=new ii(j,he).tokenize(),Fe=new cs(xe),ce=Fe.parse(),pe=vc([...Fe.getErrors().map(Se=>({message:Se.message,start:Se.start,end:Se.end,type:"SYNTAX_ERROR"})),...Ae.current.validate(ce,Re.current,ee,U)]);if(Z.current){const Se=kl(Z.current);P&&xe.length>il?(Ht.current&&clearTimeout(Ht.current),Ht.current=setTimeout(()=>{Ht.current=null,Z.current&&xs(xe,kl(Z.current))},od)):(Ht.current&&(clearTimeout(Ht.current),Ht.current=null),xs(xe,Se)),Ue(xe),ke(ce),Mn(pe),ea(j.length===0),Wt(Se),_n(Se),Dt.current.tokens=xe,P&&Te.current(xe,Se)}else Ue(xe),ke(ce),Mn(pe),ea(j.length===0),Dt.current.tokens=xe;s&&s(j,ce),o&&o(pe)},[x,s,o,xs,fe]),Il=v.useCallback((j,P)=>{if(!ft||P.type!=="FIELD_VALUE"||!P.fieldName)return j;const Ee=ve.current.resolveField(P.fieldName);if(!Ee)return j;const xe=ft(Ee,P.partial);return xe==null?j:j.some(Fe=>Fe.type==="hint")?j.map(Fe=>Fe.type==="hint"?{...Fe,customContent:xe}:Fe):[{text:"",label:"",type:"hint",customContent:xe,replaceStart:P.start??0,replaceEnd:P.end??0},...j]},[ft]),bs=v.useCallback(j=>{if(!Ut)return!1;const P=Ut({cursorContext:j,partial:j.partial});return P==null?!1:(Ie([{text:"",label:"",type:"noResults",customContent:P,replaceStart:0,replaceEnd:0}]),We(-1),Jt(!1),nr(32,300),!0)},[Ut]),ya=v.useCallback((j,P,Ee)=>{var Se,Ke,rt;const xe=ve.current.getSuggestions(j,P);Ge||(xe.suggestions=xe.suggestions.filter(Be=>Be.type!=="operator"));const Fe=xe.context.type;if(Gn(xe.context),ue){if(B({trigger:$.current,context:xe.context,suggestions:xe.suggestions,isOpen:Dt.current.showDropdown||Dt.current.showDatePicker,value:Me.current,selectionStart:P,selectionEnd:Ee??P})===!1){it(!1),Jt(!1),Ie([]);return}}else{if(de==="never"){it(!1),Jt(!1),Ie([]);return}if(de==="manual"){if(M.current&&M.current!==Fe){M.current=null,it(!1),Jt(!1),Ie([]);return}if(!M.current){it(!1),Jt(!1),Ie([]);return}}if(de==="input"&&$.current!=="input"&&$.current!=="ctrlSpace"){it(!1),Jt(!1),Ie([]);return}if(de==="always"&&j.some(Be=>(Be.type===O.AND||Be.type===O.OR||Be.type===O.NOT||Be.type===O.TILDE||Be.type===O.BOOST)&&P>=Be.start&&P<=Be.end)){it(!1),Jt(!1),Ie([]);return}}const ce=xe.context.fieldName?ve.current.resolveField(xe.context.fieldName):void 0,pe=!!(g&&xe.context.type==="FIELD_VALUE"&&xe.context.fieldName&&(ce==null?void 0:ce.type)!=="boolean"&&(ce==null?void 0:ce.suggestions)!==!1)||typeof m=="function"&&xe.context.type==="SAVED_SEARCH"||typeof p=="function"&&xe.context.type==="HISTORY_REF";if(xe.showDatePicker){wn.current=!1,(Se=Zt.current)==null||Se.abort(),vt.current&&clearTimeout(vt.current),Je.current&&(clearTimeout(Je.current),Je.current=null);const Be=kC(xe.context,ee),Nn=kn.current;kn.current=Be,yi(Be);const Lt=xe.context.token;Lt&&(Lt.type==="COLON"||Lt.type==="COMPARISON_OP")?A.current={start:Lt.end,end:Lt.end}:Lt?A.current={start:Lt.start,end:Lt.end}:A.current={start:P,end:P},Dt.current.showDatePicker&&OC(Nn,Be)&&Jt(!1),Ie([]),we||it(!1),Rt(Fe),nr(350,300,"datePicker");return}if(pe){const Be=xe.context.token,Nn=Be?Be.start:P,Lt=Be?Be.end:P,ra=()=>{Je.current=null,Ie([{text:"",label:"Searching...",type:"loading",replaceStart:Nn,replaceEnd:Lt}]),we||it(!1),Jt(!1),We(-1),nr(32,300)};Je.current&&clearTimeout(Je.current),Xt>0?Je.current=setTimeout(ra,Xt):ra(),Rt(Fe)}else{wn.current=!1,(Ke=Zt.current)==null||Ke.abort(),vt.current&&clearTimeout(vt.current),Je.current&&(clearTimeout(Je.current),Je.current=null);const Be=Il(xe.suggestions,xe.context);Be.length>0?(Ie(Be),we||it(!1),Jt(!1),We(xe.context.partial||jt?0:-1),Rt(Fe),nr(Be.length*32,300)):(Rt(Fe),bs(xe.context)||(it(!1),Jt(!1),Ie([])))}if(pe){const Be=xe.context.partial,Nn=ne||200;wn.current=!0,vt.current&&clearTimeout(vt.current),(rt=Zt.current)==null||rt.abort();const Lt=new AbortController;Zt.current=Lt,vt.current=setTimeout(async()=>{const ra=xe.context.token,la=ra?ra.start:P,xa=ra?ra.end:P;try{let Rn;if(xe.context.type==="SAVED_SEARCH"&&typeof m=="function"){const cn=await m(Be);if(Lt.signal.aborted)return;Rn=cn.map(zt=>({text:zt.query,label:zt.label||zt.query,description:zt.description,type:"savedSearch",replaceStart:la,replaceEnd:xa,matchPartial:Be,sourceData:zt}))}else if(xe.context.type==="HISTORY_REF"&&typeof p=="function"){const cn=await p(Be);if(Lt.signal.aborted)return;Rn=cn.map(zt=>({text:Ah.wrapHistoryQuery(zt.query),label:zt.label||zt.query,description:zt.description,type:"history",replaceStart:la,replaceEnd:xa,matchPartial:Be,sourceData:zt}))}else{const cn=xe.context.fieldName,zt=ve.current.resolveField(cn),Pl=await g(zt?zt.name:cn,Be);if(Lt.signal.aborted)return;Rn=Pl.map(vr=>({text:vr.text,label:vr.label||vr.text,description:vr.description,type:vr.type,replaceStart:la,replaceEnd:xa,matchPartial:Be}))}if(Je.current&&(clearTimeout(Je.current),Je.current=null),Rn=Rn.slice(0,V),Rn.length>0){if(ge!=null&&ge.showFieldSuggestions){const cn=ve.current.getFieldSuggestions(Be,la,xa);Rn=[...Rn,...cn].slice(0,V)}Ie(Rn),We(Be||jt?0:-1),nr(Rn.length*32,300)}else{const cn=ve.current.getSuggestions(Dt.current.tokens,Dt.current.cursorOffset);if(!(Be&&bs(cn.context))){const zt=Il(cn.suggestions.filter(Pl=>Pl.type==="hint"),cn.context);zt.length>0?(Ie(zt),We(cn.context.partial||jt?0:-1),nr(zt.length*32,300)):bs(cn.context)||(it(!1),Ie([]))}}}catch(Rn){Je.current&&(clearTimeout(Je.current),Je.current=null),Lt.signal.aborted||(Ie([{text:"",label:Rn instanceof Error?Rn.message:"Error loading suggestions",type:"error",replaceStart:la,replaceEnd:xa}]),We(-1),nr(32,300),wn.current=!1)}},Nn)}},[g,m,p,ne,Il,mr,nr,we,B,ue,de,Ge,V,Xt,jt,bs]);Te.current=ya;const an=v.useCallback(()=>{var j;it(!1),Jt(!1),yi(null),kn.current=null,A.current=null,Ie([]),We(-1),wn.current=!1,(j=Zt.current)==null||j.abort(),vt.current&&(clearTimeout(vt.current),vt.current=null),ht.current&&(clearTimeout(ht.current),ht.current=null),M.current=null},[]),na=v.useCallback((j,P,Ee)=>{if(ht.current&&(clearTimeout(ht.current),ht.current=null),!nt){(Dt.current.showDropdown||Dt.current.showDatePicker)&&an();return}$.current="navigation",Sn>0?ht.current=setTimeout(()=>{ht.current=null,ya(j,P,Ee)},Sn):ya(j,P,Ee)},[nt,Sn,ya,an]),Ta=v.useCallback((j,P,Ee)=>{Me.current=j,Ct.current&&(clearTimeout(Ct.current),Ct.current=null),Bt.current.push({value:j,cursorPos:P});const xe=new ii(j,he).tokenize(),Fe=new cs(xe),ce=Fe.parse(),pe=vc([...Fe.getErrors().map(Se=>({message:Se.message,start:Se.start,end:Se.end,type:"SYNTAX_ERROR"})),...Ae.current.validate(ce,Re.current,ee,U)]);if(Z.current){const Se=ei(xe,x,{cursorOffset:P,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=Se,al(Z.current,P)}if(Ue(xe),ke(ce),Mn(pe),ea(j.length===0),Wt(P),_n(P),it(!1),Jt(!1),s&&s(j,ce),o&&o(pe),Ee){const Se=requestAnimationFrame(()=>{nn.current.delete(Se),Ee(xe,ce)});nn.current.add(Se)}},[x,s,o]),_r=v.useCallback((j,P="Enter",Ee,xe)=>{if(!j)return;const Fe=Dt.current,ce=Fe.autocompleteContext,pe=ce==="FIELD_VALUE"||ce==="SAVED_SEARCH"||ce==="HISTORY_REF";if(pe&&($.current="navigation"),j.type==="hint"&&(j.text==="#"||j.text==="!")){const cn=j.text,zt=j.replaceStart,Pl=Math.max(j.replaceEnd,Fe.selectionEnd),vr=Me.current.slice(0,zt),cd=Me.current.slice(Pl),nu=vr+cn+cd,au=vr.length+cn.length;Ta(nu,au,(dd,fd)=>{Ee?Ee(nu,fd):ya(dd,au)});return}if(j.type==="hint")return;const Se=Fe.autocompleteContext==="FIELD_VALUE",Ke=Math.min(j.replaceStart,Fe.cursorOffset),rt=Math.max(j.replaceEnd,Fe.selectionEnd),Be=Me.current.slice(0,Ke),Nn=Me.current.slice(rt);let Lt="",ra=Nn;pe&&te&&(Nn.length===0?Lt=" ":/^[ \t\r\n]+$/.test(Nn)&&!Nn.startsWith("\\ ")&&(Lt=" ",ra=""));const la=Be+j.text+Lt+ra,xa=Be.length+j.text.length+Lt.length,Rn=P==="Enter"&&Se;Ta(la,xa,(cn,zt)=>{Ee?Ee(la,zt):Rn?l&&l(la,zt,xe):ya(cn,xa)})},[Ta,ya,l,te]);v.useEffect(()=>{Array.isArray(m)&&ve.current.updateSavedSearches(m),Array.isArray(p)&&ve.current.updateSearchHistory(p)},[m,p]),v.useEffect(()=>{ve.current=new Ah(De,[],[],C||10,{showSavedSearchHint:ze,showHistoryHint:ut,hasSavedSearchProvider:typeof m=="function",hasHistoryProvider:typeof p=="function"}),ve.current.setDefaultField(ge),Ae.current=new Ax(De),Array.isArray(m)&&ve.current.updateSavedSearches(m),Array.isArray(p)&&ve.current.updateSearchHistory(p),Me.current&&va(Me.current,!1)},[De,C,ze,ut]),v.useEffect(()=>{I&&I({getValue:()=>Me.current,setValue:j=>{Me.current=j,va(j,!1)},focus:()=>{var j;return(j=Z.current)==null?void 0:j.focus()},blur:()=>{var j;return(j=Z.current)==null?void 0:j.blur()},getAST:()=>Dt.current.ast,getValidationErrors:()=>Dt.current.validationErrors,setSelection:(j,P)=>{Z.current&&(Z.current.focus(),nl(Z.current,j,P),Wt(j),_n(P))}})},[I,va]),v.useEffect(()=>{const j=Me.current;Bt.current.push({value:j,cursorPos:j.length}),j&&va(j,!1)},[]),v.useEffect(()=>{u!==void 0&&u!==Me.current&&(Me.current=u,va(u,!1))},[u,va]),v.useEffect(()=>()=>{var j;vt.current&&clearTimeout(vt.current),Ht.current&&clearTimeout(Ht.current),ht.current&&clearTimeout(ht.current),Je.current&&clearTimeout(Je.current),nn.current.forEach(P=>cancelAnimationFrame(P)),nn.current.clear(),(j=Zt.current)==null||j.abort()},[]),v.useEffect(()=>{if(ue){const j=Dt.current;j.cursorContext&&B({trigger:"modeChange",context:j.cursorContext,suggestions:j.suggestions,isOpen:j.showDropdown||j.showDatePicker,value:Me.current,selectionStart:j.cursorOffset,selectionEnd:j.selectionEnd})===!1&&(it(!1),Jt(!1),Ie([]))}else de==="never"&&(it(!1),Jt(!1),Ie([]));M.current=null},[B]);const pr=v.useRef(!1);v.useLayoutEffect(()=>{if(pr.current){pr.current=!1;return}const j=Ba.current;if(!j||!Fn)return;const P=j.getBoundingClientRect(),Ee=window.innerWidth;if(P.right>Ee-8){const xe=P.right-Ee+8;pr.current=!0,En(Fe=>Fe&&{...Fe,left:Math.max(8,Fe.left-xe)})}},[Fn,ct,dt,Ze]),v.useEffect(()=>{const j=()=>{const P=Dt.current;if(!(!P.showDropdown&&!P.showDatePicker))if(P.showDropdown&&we&&gn.current){const Ee=gn.current.getBoundingClientRect();En({top:Ee.bottom+window.scrollY+4,left:Ee.left+window.scrollX})}else{const Ee=Lh();Ee&&En(zh(Ee,P.showDatePicker?350:Bx(P.suggestions.length*32,me),300))}};return window.addEventListener("resize",j),window.addEventListener("scroll",j,!0),()=>{window.removeEventListener("resize",j),window.removeEventListener("scroll",j,!0)}},[we,me]),v.useEffect(()=>{const j=Z.current;if(!j)return;const P=()=>{(Dt.current.showDropdown||Dt.current.showDatePicker)&&an()};return j.addEventListener("scroll",P),()=>j.removeEventListener("scroll",P)},[an]);const Lr=v.useRef(null),xi=v.useRef(x);v.useEffect(()=>{if(!Z.current)return;const j=Dt.current.tokens;if(j.length===0||Pn&&ta!==Nt)return;const P=Pn?Nt:-1,Ee=x!==xi.current;xi.current=x;const xe=H0(j,P),Fe=xe?`${xe.openStart},${xe.closeStart}`:null;if(Fe===Lr.current&&!Ee)return;Lr.current=Fe;const ce=Pn?kl(Z.current):-1,pe=ei(j,x,{cursorOffset:P,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=pe,Pn&&ce>=0&&al(Z.current,ce)},[Nt,ta,Pn,x]);const gr=re&&!Pn,bi=v.useRef(gr);v.useEffect(()=>{if(!Z.current)return;const j=bi.current;if(bi.current=gr,j!==gr)if(gr)Z.current.innerHTML=Z.current.innerHTML.replace(/<br\s*\/?>/gi," ");else{const P=Dt.current.tokens;if(P.length>0){const Ee=Pn?kl(Z.current):-1,xe=ei(P,x,{cursorOffset:Ee,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=xe,Pn&&Ee>=0&&al(Z.current,Ee)}}},[gr,x]);const Ha=v.useCallback(()=>{if(yt.current||!Z.current)return;K.current=null,se.current=-1,ht.current&&(clearTimeout(ht.current),ht.current=null);let j=_T(Z.current);if(j===Me.current)return;let P=kl(Z.current);const Ee=Rx(j);Ee!==j&&(j=Ee,P=Math.min(P,j.length)),Me.current=j;const xe=Bt.current,Fe=xe.current();if(Fe&&Math.abs(j.length-Fe.value.length)<=2&&Ct.current?xe.replaceCurrent({value:j,cursorPos:P}):xe.push({value:j,cursorPos:P}),Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(()=>{Ct.current=null},300),$.current="input",!ue&&de==="input"){const ce=P>0?j[P-1]:"";if(!ce||ce.trim()===""){va(j,!1),an(),Z.current&&yc(Z.current);return}}va(j,!0),Z.current&&yc(Z.current)},[va,ue,de,an]),ar=v.useCallback(()=>{yt.current=!0},[]),Si=v.useCallback(()=>{yt.current=!1,Ha()},[Ha]),zr=v.useCallback(j=>{if(!j)return;Me.current=j.value;const P=new ii(j.value,he).tokenize(),Ee=new cs(P),xe=Ee.parse(),Fe=vc([...Ee.getErrors().map(pe=>({message:pe.message,start:pe.start,end:pe.end,type:"SYNTAX_ERROR"})),...Ae.current.validate(xe,Re.current,ee,U)]),ce=j.selStart!=null&&j.selStart!==j.cursorPos;if(Z.current){const pe=ei(P,x,{cursorOffset:j.cursorPos,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=pe,ce?nl(Z.current,j.selStart,j.cursorPos):al(Z.current,j.cursorPos)}Ue(P),ke(xe),Mn(Fe),ea(j.value.length===0),Wt(ce?j.selStart:j.cursorPos),_n(j.cursorPos),an(),s&&s(j.value,xe),o&&o(Fe)},[x,s,o,an]),$a=v.useCallback(()=>{const j=Ba.current;if(!j)return 10;const P=j.clientHeight,Ee=j.querySelectorAll(".ei-dropdown-item")[0];if(!Ee)return 10;const xe=Ee.offsetHeight;return xe<=0?10:Math.max(1,Math.floor(P/xe))},[]),wi=v.useCallback(j=>{var xe,Fe;if(X&&X(j),j.defaultPrevented)return;const P=Dt.current,Ee=j.nativeEvent.code;if(Wn&&Ee==="KeyF"&&j.altKey&&j.shiftKey&&!j.ctrlKey&&!j.metaKey){j.preventDefault();const ce=wC(Me.current,qn);ce!==Me.current&&Ta(ce,ce.length);return}if(Z.current&&Z.current.childNodes.length>40){const ce=window.getSelection();if(ce!=null&&!ce.isCollapsed){const pe=Er(Z.current);if(pe.end-pe.start>20){const Se=j.key==="Backspace"||j.key==="Delete"||j.key==="x"&&(j.ctrlKey||j.metaKey),Ke=!j.ctrlKey&&!j.metaKey&&!j.altKey&&j.key.length===1;(Se||Ke)&&(Z.current.textContent=Me.current,nl(Z.current,pe.start,pe.end))}}}{let ce=null,pe=null;if(jx[j.key])ce=j.key,pe=jx[j.key];else if(tn&&j.key==="*"&&Z.current){const Se=Er(Z.current);if(Se.start!==Se.end){const[Ke,rt]=Tx(P.tokens,Se.start,Se.end);if(Ke>=0&&Ke===rt){const Be=P.tokens[Ke];(Be.type===O.VALUE||Be.type===O.WILDCARD)&&(ce="*",pe="*")}}}if(ce&&pe&&Z.current){const Se=Er(Z.current);if(Se.start!==Se.end){j.preventDefault();const{newValue:Ke,newSelStart:rt,newSelEnd:Be}=MT(Me.current,Se.start,Se.end,ce,pe),Nn=Bt.current,Lt=Nn.current();Lt&&Lt.value===Me.current&&(Lt.selStart=Se.start,Lt.cursorPos=Se.end),Me.current=Ke,Ct.current&&(clearTimeout(Ct.current),Ct.current=null),Nn.push({value:Ke,cursorPos:Be,selStart:rt});const ra=new ii(Ke,he).tokenize(),la=new cs(ra),xa=la.parse(),Rn=vc([...la.getErrors().map(zt=>({message:zt.message,start:zt.start,end:zt.end,type:"SYNTAX_ERROR"})),...Ae.current.validate(xa,Re.current,ee,U)]),cn=ei(ra,x,{cursorOffset:Be,tokenClassName:S==null?void 0:S.token,fieldTypeMap:qe});Z.current.innerHTML=cn,nl(Z.current,rt,Be),Ue(ra),ke(xa),Mn(Rn),ea(!1),Wt(rt),_n(Be),an(),s&&s(Ke,xa),o&&o(Rn);return}}}if(j.key==="z"&&(j.ctrlKey||j.metaKey)&&!j.shiftKey){j.preventDefault(),zr(Bt.current.undo());return}if(j.key==="y"&&(j.ctrlKey||j.metaKey)||j.key==="z"&&(j.ctrlKey||j.metaKey)&&j.shiftKey){j.preventDefault(),zr(Bt.current.redo());return}if(j.key==="a"&&(j.ctrlKey||j.metaKey)&&Hn&&Z.current){const ce=Er(Z.current),pe=gC(P.tokens,ce.start,ce.end);if(pe){j.preventDefault(),nl(Z.current,pe.start,pe.end),Wt(pe.start),_n(pe.end);return}}if($n&&j.altKey&&j.shiftKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&Z.current){const ce=Ee==="ArrowRight";let pe=K.current;if(!pe){const Ke=Er(Z.current),rt=yC(P.ast,P.tokens,Ke.start);if(rt.length===0)return;pe={ranges:rt,level:-1},K.current=pe}const Se=ce?Math.min(pe.level+1,pe.ranges.length-1):Math.max(pe.level-1,-1);if(Se===pe.level)return;if(pe.level=Se,Se<0){const Ke=Er(Z.current);al(Z.current,Ke.start),K.current=null}else{j.preventDefault();const Ke=pe.ranges[Se];nl(Z.current,Ke.start,Ke.end),Wt(Ke.start),_n(Ke.end)}return}if(K.current=null,da&&j.ctrlKey&&j.altKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&Z.current){j.preventDefault();const ce=Ee==="ArrowRight"?"forward":"backward",pe=CC(P.ast),Se=Er(Z.current),Ke=ce==="forward"?Se.end:Se.start,rt=DC(pe,se.current,Ke,ce);rt&&(se.current=rt.index,nl(Z.current,rt.stop.start,rt.stop.end),Wt(rt.stop.start),_n(rt.stop.end));return}if(se.current=-1,j.key===" "&&(j.ctrlKey||j.metaKey)){j.preventDefault(),$.current="ctrlSpace",!ue&&de==="manual"&&(M.current=ve.current.getSuggestions(P.tokens,P.cursorOffset).context.type),ya(P.tokens,P.cursorOffset);return}if(j.key==="Enter"&&(j.ctrlKey||j.metaKey)){j.preventDefault(),an(),l&&l(Me.current,P.ast,j);return}if(j.key==="Enter"&&j.shiftKey&&Qt){j.preventDefault(),mC();const ce=Z.current?kl(Z.current):Me.current.length+1,pe=Me.current,Se=pe.slice(0,ce-1)+`
288
+ `+pe.slice(ce-1);Me.current=Se,K.current=null,ht.current&&(clearTimeout(ht.current),ht.current=null),$.current="input",Bt.current.push({value:Se,cursorPos:ce}),va(Se,!0),Z.current&&yc(Z.current);return}if((j.key==="Backspace"||j.key==="Delete")&&Z.current&&!Z.current.textContent){const ce=Me.current;if(!ce)return;const{start:pe,end:Se}=Er(Z.current);let Ke,rt;if(pe!==Se)Ke=ce.slice(0,pe)+ce.slice(Se),rt=pe;else if(j.key==="Backspace"&&pe>0)Ke=ce.slice(0,pe-1)+ce.slice(pe),rt=pe-1;else if(j.key==="Delete"&&pe<ce.length)Ke=ce.slice(0,pe)+ce.slice(pe+1),rt=pe;else return;j.preventDefault(),Me.current=Ke,K.current=null,ht.current&&(clearTimeout(ht.current),ht.current=null),$.current="input",Bt.current.push({value:Ke,cursorPos:rt}),al(Z.current,rt),va(Ke,!0),Z.current&&yc(Z.current);return}if(St.current=!1,P.showDropdown&&P.suggestions.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),St.current=!0,We(ce=>ce>=P.suggestions.length-1?0:ce+1);return;case"ArrowUp":j.preventDefault(),St.current=!0,We(ce=>ce<=0?P.suggestions.length-1:ce-1);return;case"PageDown":{j.preventDefault(),St.current=!0;const ce=$a();We(pe=>Math.min(pe+ce,P.suggestions.length-1));return}case"PageUp":{j.preventDefault(),St.current=!0;const ce=$a();We(pe=>Math.max(pe-ce,0));return}case"Home":if(_t&&P.selectedSuggestionIndex>=0){j.preventDefault(),St.current=!0,We(0);return}break;case"End":if(_t&&P.selectedSuggestionIndex>=0){j.preventDefault(),St.current=!0,We(P.suggestions.length-1);return}break;case"Enter":if(P.selectedSuggestionIndex>=0){const ce=P.suggestions[P.selectedSuggestionIndex];if(ce.type==="loading"||ce.type==="error"){j.preventDefault(),an(),l&&l(Me.current,P.ast,j);return}if(ce.type==="hint"&&ce.text!=="#"&&ce.text!=="!"){j.preventDefault(),an();const pe=Me.current,Se=P.cursorOffset;if(Se<=pe.length&&pe[Se]!==" "){const Ke=pe.slice(0,Se),rt=pe.slice(Se),Be=Ke+" "+rt;Ta(Be,Se+1,()=>{l&&l(Be,P.ast,j)})}else l&&l(pe,P.ast,j);return}j.preventDefault(),_r(ce,"Enter",void 0,j);return}j.preventDefault(),an(),l&&l(Me.current,P.ast,j);return;case"Tab":if(z){j.preventDefault();const ce=P.selectedSuggestionIndex>=0?P.suggestions[P.selectedSuggestionIndex]:null,pe=ce&&ce.type!=="loading"&&ce.type!=="error"&&!(ce.type==="hint"&&ce.text!=="#"&&ce.text!=="!")?ce:null,Se=z({suggestion:pe,cursorContext:P.cursorContext||{type:"EMPTY",partial:""},query:Me.current});Se.accept&&pe?_r(pe,"Tab",(Ke,rt)=>{var Be;Se.submit&&l&&l(Ke,rt,j),Se.blur&&((Be=Z.current)==null||Be.blur())},j):(an(),Se.submit&&l&&l(Me.current,P.ast,j),Se.blur&&((xe=Z.current)==null||xe.blur()));return}if(P.selectedSuggestionIndex>=0){const ce=P.suggestions[P.selectedSuggestionIndex];if(ce.type==="hint"&&ce.text!=="#"&&ce.text!=="!"){j.preventDefault(),an();const pe=Me.current,Se=P.cursorOffset;if(Se<=pe.length&&pe[Se]!==" "){const Ke=pe.slice(0,Se),rt=pe.slice(Se),Be=Ke+" "+rt,Nn=Se+1;Ta(Be,Nn,Lt=>{ya(Lt,Nn)})}return}j.preventDefault(),_r(ce,"Tab",void 0,j);return}break;case"Escape":j.preventDefault(),an();return}if(j.key==="Tab"&&z){j.preventDefault();const ce=z({suggestion:null,cursorContext:P.cursorContext||{type:"EMPTY",partial:""},query:Me.current});ce.submit&&l&&l(Me.current,P.ast,j),ce.blur&&((Fe=Z.current)==null||Fe.blur());return}if(P.showDatePicker&&j.key==="Escape"){j.preventDefault(),an();return}if(j.key==="Enter"&&!P.showDropdown&&!P.showDatePicker){j.preventDefault(),l&&l(Me.current,P.ast,j);return}},[l,an,_r,Ta,zr,Qt,ue,de,ya,X,z,Hn,$n,da,_t,$a,Wn]),Ss=v.useCallback(j=>{if(St.current){St.current=!1;return}if(["ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(j.key)){if(!Z.current)return;const P=Er(Z.current);Wt(P.start),_n(P.end),na(Dt.current.tokens,P.start,P.end)}},[na]),Wo=v.useCallback(()=>{ga(!0),W==null||W();const j=requestAnimationFrame(()=>{if(nn.current.delete(j),Z.current){const P=Dt.current.tokens,Ee=P.length>0?kl(Z.current):0;Wt(Ee),_n(Ee),na(P,Ee)}});nn.current.add(j)},[Ha,na,W]),ws=v.useCallback(()=>{var j;ga(!1),it(!1),Jt(!1),Ie([]),wn.current=!1,(j=Zt.current)==null||j.abort(),vt.current&&(clearTimeout(vt.current),vt.current=null),Je.current&&(clearTimeout(Je.current),Je.current=null),Wt(-1),ae==null||ae()},[ae]),Ur=v.useRef(!1),eu=v.useCallback(j=>{if(!Z.current||j.detail!==2&&j.detail!==3)return;if(j.detail===3){if(!Dt.current.ast)return;const Se=document.caretRangeFromPoint(j.clientX,j.clientY);if(!Se)return;const Ke=_o(Z.current,Se.startContainer,Se.startOffset),rt=DT(Dt.current.ast,Me.current,Ke);if(!rt||rt.start>=rt.end)return;j.preventDefault(),Ur.current=!0,nl(Z.current,rt.start,rt.end);return}j.preventDefault(),Ur.current=!0;const P=document.caretRangeFromPoint(j.clientX,j.clientY);if(!P)return;const Ee=_o(Z.current,P.startContainer,P.startOffset),xe=Me.current,Fe=Se=>!/[\s:()[\]{}"<>!,;|&=~^+\-*/\\]/.test(Se);let ce=Ee;for(;ce>0&&Fe(xe[ce-1]);)ce--;let pe=Ee;for(;pe<xe.length&&Fe(xe[pe]);)pe++;ce<pe&&nl(Z.current,ce,pe)},[]),aa=v.useCallback(j=>{Ur.current&&(j.preventDefault(),Ur.current=!1)},[]),Br=v.useCallback(()=>{if(!Z.current)return;const j=Er(Z.current);if(Wt(j.start),_n(j.end),j.start!==j.end){const[P,Ee]=Tx(Dt.current.tokens,j.start,j.end);if(P!==Ee){an();return}}na(Dt.current.tokens,j.start,j.end)},[na,an]),Hr=v.useCallback(j=>{Ct.current&&(clearTimeout(Ct.current),Ct.current=null),hC(j),Ha()},[Ha]),Vl=v.useCallback(j=>{j.preventDefault();const P=Rx(j.clipboardData.getData("text/plain"));if(be){const Ee=be(P,j);Ee!=null&&typeof(Ee==null?void 0:Ee.then)=="function"?Ee.then(xe=>{xe!=null&&Hr(xe)}).catch(()=>{}):Ee!=null&&Hr(Ee)}else Hr(P)},[be,Hr]),ud=v.useCallback(j=>{$.current="navigation";const P=Dt.current,Ee=A.current,xe=Ee?Ee.start:P.cursorOffset,Fe=Ee?Ee.end:P.cursorOffset,ce=Me.current.slice(0,xe),pe=Me.current.slice(Fe);let Se="",Ke=pe;te&&j.length>0&&(pe.length===0?Se=" ":/^[ \t\r\n]+$/.test(pe)&&!pe.startsWith("\\ ")&&(Se=" ",Ke=""));const rt=ce+j+Se+Ke,Be=ce.length+j.length+Se.length;Ta(rt,Be,Nn=>{Z.current&&Z.current.focus(),ya(Nn,Be)})},[Ta,ya,te]),ol=Ko(x),Yl=Zo(y),Fl=IT(ol,D),$r={...VT(ol,Yl),...Pn?YT(Yl):{}};gr&&($r.whiteSpace="nowrap",$r.overflow="hidden",$r.textOverflow="ellipsis");const tu=FT(ol,Yl);return v.createElement("div",{ref:gn,style:Fl,className:za("ei-container",w,S==null?void 0:S.container)},v.createElement("div",{ref:Yn,contentEditable:!0,suppressContentEditableWarning:!0,className:za("ei-editor",S==null?void 0:S.editor),style:$r,onInput:Ha,onKeyDown:wi,onKeyUp:Ss,onMouseDown:eu,onMouseUp:aa,onFocus:Wo,onBlur:ws,onClick:Br,onPaste:Vl,onCompositionStart:ar,onCompositionEnd:Si,spellCheck:!1}),sl&&!Pn?v.createElement("div",{className:za("ei-placeholder",S==null?void 0:S.placeholder),style:tu},N):null,v.createElement(fC,{errors:On,editorRef:Tt,cursorOffset:Nt,colors:x,styles:y,containerRef:gn.current,classNames:S?{squiggly:S.squiggly,tooltip:S.tooltip}:void 0}),v.createElement(rC,{suggestions:Ze,selectedIndex:$t,onSelect:j=>_r(j,"Tab"),position:Fn,colors:x,styles:y,visible:ct,fixedWidth:Jo(),renderHistoryItem:oe,renderSavedSearchItem:$e,renderDropdownHeader:at,cursorContext:ja,listRefCallback:j=>{Ba.current=j},renderType:pn,classNames:S?{dropdown:S.dropdown,dropdownHeader:S.dropdownHeader,dropdownItem:S.dropdownItem}:void 0}),dt&&Fn?v.createElement(MC,{position:Fn,colors:ol,onSelect:ud,colorConfig:x,styleConfig:y,datePickerInit:ql,fixedWidth:void 0,datePresets:q,datePickerClassName:S==null?void 0:S.datePicker}):null)}const LC=["planned","in-progress","done","blocked","canceled","rejected","deferred","waiting"];function $x(t){var o;const a=window.getSelection();if(!a||a.rangeCount===0)return((o=t.textContent)==null?void 0:o.length)??0;const l=a.getRangeAt(0),s=l.cloneRange();return s.selectNodeContents(t),s.setEnd(l.endContainer,l.endOffset),s.toString().length}function zC(t){return a=>{if(!(a.ctrlKey&&!a.metaKey&&!a.altKey))return;const l=a.key.toLowerCase(),s=a.currentTarget,o=s.isContentEditable?s:s.querySelector("[contenteditable='true'], [contenteditable]")??s,u=t.current;if(l==="h"&&u){a.preventDefault();const m=u.getValue();let p=$x(o);(p<0||p>m.length)&&(p=m.length),p>0&&(u.setValue(m.slice(0,p-1)+m.slice(p)),u.setSelection(p-1,p-1));return}if(l==="u"&&u){a.preventDefault();const m=u.getValue();let p=$x(o);if((p<0||p>m.length)&&(p=m.length),p===0)return;let g=p;for(;g>0&&/\s/.test(m[g-1]??"");)g--;if(g===p)for(;g>0&&!/\s/.test(m[g-1]??"");)g--;g<p&&(u.setValue(m.slice(0,g)+m.slice(p)),u.setSelection(g,g));return}const f=l==="j"?"ArrowDown":l==="k"?"ArrowUp":null;f&&(a.preventDefault(),o.dispatchEvent(new KeyboardEvent("keydown",{key:f,bubbles:!0,cancelable:!0})))}}function Uh(t){return String(t>0?t:0).padStart(3,"0")}function UC({features:t,phases:a,query:l,onQuery:s}){const o=v.useRef(null),u=zC(o),f=v.useMemo(()=>[{name:"feature",label:"Feature",type:"number",description:"Feature number, e.g. 1 (F001)"},{name:"phase",label:"Phase",type:"number",description:"Phase number, e.g. 2 (P002)"},{name:"task",label:"Task",type:"number",description:"Task number, e.g. 10 (T010). Comma-list supported."},{name:"id",label:"Short ID",type:"string",description:"Global 5-char short id, e.g. UUXD1"},{name:"status",label:"Status",type:"string",description:"Task status"},{name:"feature-status",label:"Feature status",type:"string",description:"Status of the feature"},{name:"phase-status",label:"Phase status",type:"string",description:"Status of the phase"},{name:"title",label:"Title",type:"string",description:"Substring match on title"}],[]),m=v.useMemo(()=>{const y=[...new Set(t.map(R=>R.number))].sort((R,L)=>R-L),N=[...new Set(a.map(R=>R.number))].sort((R,L)=>R-L),w=[...new Set(a.flatMap(R=>R.tasks.map(L=>L.number)))].sort((R,L)=>R-L),S=[...new Set([...t.map(R=>R.shortId),...a.flatMap(R=>[R.shortId,...R.tasks.map(L=>L.shortId)])].filter(Boolean))],D=[...new Set(a.flatMap(R=>R.tasks.map(L=>L.title)))];return{featureNums:y,phaseNums:N,taskNums:w,shortIds:S,titles:D}},[t,a]),p=v.useCallback(async(y,N)=>{const w=N.toLowerCase();return y==="feature"?m.featureNums.filter(S=>String(S).startsWith(N)).slice(0,20).map(S=>({text:String(S),label:`F${Uh(S)}`})):y==="phase"?m.phaseNums.filter(S=>String(S).startsWith(N)).slice(0,20).map(S=>({text:String(S),label:`P${Uh(S)}`})):y==="task"?m.taskNums.filter(S=>String(S).startsWith(N)).slice(0,20).map(S=>({text:String(S),label:`T${Uh(S)}`})):y==="id"?m.shortIds.filter(S=>S.toLowerCase().startsWith(w)).slice(0,20).map(S=>({text:S,label:S})):y==="status"||y==="feature-status"||y==="phase-status"?LC.filter(S=>S.startsWith(w)).map(S=>({text:S,label:S})):y==="title"?m.titles.filter(S=>S.toLowerCase().includes(w)).slice(0,20).map(S=>({text:S,label:S.length>44?S.slice(0,44)+"…":S})):[]},[m]),g=v.useCallback(y=>s(y),[s]),x=v.useCallback(y=>{o.current=y},[]);return c.jsx("div",{className:"search-bar",children:c.jsx(_C,{fields:f,value:l,onChange:g,onSearch:g,fetchSuggestions:p,onKeyDown:u,inputRef:x,placeholder:"Search Work Tree… e.g. feature:1 id:UUXD1 title:auth status:in-progress"})})}function BC(t,a){if(Object.keys(a).length===0)return t;const l=u=>{const f=a[u];return f?new Map(f.map((m,p)=>[m,p])):null},s=l("__features__");return(s?[...t].sort((u,f)=>(s.get(u.feature.id)??1/0)-(s.get(f.feature.id)??1/0)):t).map(u=>{const f=l(`phase-scope:${u.feature.id}`),m=f?[...u.allPhases].sort((p,g)=>(f.get(p.phase.id)??1/0)-(f.get(g.phase.id)??1/0)):u.allPhases;return{...u,allPhases:m.map(p=>{const g=l(`task-scope:${p.phase.id}`),x=g?[...p.allTasks].sort((y,N)=>(g.get(y.id)??1/0)-(g.get(N.id)??1/0)):p.allTasks;return{...p,allTasks:x}})}})}function ti({active:t=!1,disabled:a=!1,onClick:l,children:s}){return c.jsx("button",{type:"button",disabled:a,onClick:l,className:`inline-flex h-8 min-h-8 w-full items-center justify-center rounded-[10px] border px-2.5 py-1 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] ${t?"border-transparent bg-[var(--accent)] text-white":"border-[var(--border)] bg-[var(--surface-card)] text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"} ${a?"cursor-not-allowed opacity-60":""}`,children:s})}function HC({features:t,phases:a,activeTasks:l,projectStorageScope:s}){const o=NT({features:t,phases:a,projectStorageScope:s}),[u,f]=v.useState({});v.useEffect(()=>{f({})},[o.displayedWorkTree]);const m=v.useMemo(()=>BC(o.displayedWorkTree,u),[o.displayedWorkTree,u]),[p,g]=v.useState(!1),[x,y]=v.useState(null),[N,w]=v.useState(null),S=te=>w(String(te.active.id)),[D,R]=v.useState(0);v.useEffect(()=>{const te=document.querySelector("header");if(!te)return;const re=()=>R(te.offsetHeight);re();const ge=new ResizeObserver(re);return ge.observe(te),window.addEventListener("resize",re),()=>{ge.disconnect(),window.removeEventListener("resize",re)}},[]),v.useEffect(()=>{const te=window.setTimeout(()=>{const re=document.querySelector(".ap-search-sticky"),ge=document.querySelector("header");if(!re||!ge)return;const U=re.getBoundingClientRect();if(U.top<0){const B=U.top+window.scrollY-ge.offsetHeight;window.scrollTo({top:Math.max(0,B),behavior:"smooth"})}},60);return()=>window.clearTimeout(te)},[o.searchQuery,o.hideDone,o.hidePlanned,o.onlyActiveBranches]);const L=$2(H2(Dm,{activationConstraint:{distance:5}})),I=async te=>{const{active:re,over:ge}=te;if(w(null),!ge||re.id===ge.id)return;const U=String(re.id),B=String(ge.id),ue=m.map(de=>de.feature.id);if(ue.includes(U)&&ue.includes(B)){const de=To(ue,ue.indexOf(U),ue.indexOf(B)),we=de.indexOf(U),C=we>0?de[we-1]??null:null,V=we<de.length-1?de[we+1]??null:null;f(ne=>({...ne,__features__:de})),await bh("feature",U,C,V).catch(()=>{});return}for(const de of m){const we=de.allPhases.map(C=>C.phase.id);if(we.includes(U)&&we.includes(B)){const C=To(we,we.indexOf(U),we.indexOf(B)),V=C.indexOf(U),ne=V>0?C[V-1]??null:null,me=V<C.length-1?C[V+1]??null:null;f(Ne=>({...Ne,[`phase-scope:${de.feature.id}`]:C})),await bh("phase",U,ne,me).catch(()=>{});return}}for(const de of m)for(const we of de.allPhases){const C=we.allTasks.map(V=>V.id);if(C.includes(U)&&C.includes(B)){const V=To(C,C.indexOf(U),C.indexOf(B)),ne=V.indexOf(U),me=ne>0?V[ne-1]??null:null,Ne=ne<V.length-1?V[ne+1]??null:null;f(je=>({...je,[`task-scope:${we.phase.id}`]:V})),await bh("task",U,me,Ne).catch(()=>{});return}}},q=te=>o.expandedPhaseIds.includes(te),X=te=>o.recentPhaseIds.includes(te),W=te=>o.recentTaskIds.includes(te),[ae,z]=qo(),[T,ee]=v.useState(null),fe=ae.get("locate"),be=fe?parseInt(fe.replace(/^T/i,""),10):null;v.useEffect(()=>{if(be==null||Number.isNaN(be))return;const te=a.flatMap(B=>B.tasks.map(ue=>({t:ue,p:B}))).find(({t:B})=>B.number===be);if(!te){z(B=>(B.delete("locate"),B),{replace:!0});return}const{t:re,p:ge}=te;if(o.onlyActiveBranches&&o.setOnlyActiveBranches(!1),o.hideDone&&o.setHideDone(!1),o.searchQuery&&o.setSearchQuery(""),o.setTreeOpenMode("smart"),ge.featureId){const B=ge.featureId;o.expandedFeatureIds.includes(B)||o.setExpandedFeatureIds(ue=>ue.includes(B)?ue:[...ue,B])}o.expandedPhaseIds.includes(ge.id)||o.setExpandedPhaseIds(B=>B.includes(ge.id)?B:[...B,ge.id]);const U=document.getElementById(`task-row-${be}`);if(U){const B=document.querySelector("header"),ue=document.querySelector(".ap-search-sticky"),de=((B==null?void 0:B.offsetHeight)??0)+((ue==null?void 0:ue.offsetHeight)??0)+12,we=U.getBoundingClientRect().top+window.scrollY-de;window.scrollTo({top:Math.max(0,we),behavior:"smooth"}),ee(re.id);const C=window.setTimeout(()=>ee(null),2500);return z(V=>(V.delete("locate"),V),{replace:!0}),()=>window.clearTimeout(C)}},[be,a,o.expandedFeatureIds,o.expandedPhaseIds,o.onlyActiveBranches,o.hideDone,o.searchQuery,o.treeOpenMode]);const ye=()=>{if(!N)return null;for(const te of m){if(te.feature.id===N)return c.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Tr,{featureNum:te.feature.number}),c.jsx(ur,{status:te.feature.status})]}),c.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:te.feature.name})]});for(const re of te.allPhases){if(re.phase.id===N)return c.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Tr,{featureNum:te.feature.number,phaseNum:re.phase.number}),c.jsx(ur,{status:re.phase.status})]}),c.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:re.phase.title})]});for(const ge of re.allTasks)if(ge.id===N)return c.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Tr,{featureNum:te.feature.number,phaseNum:re.phase.number,taskNum:ge.number}),c.jsx(ur,{status:ge.status})]}),c.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:ge.title})]})}}return null};return c.jsxs(Pt,{className:"grid gap-4",children:[c.jsx("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Work Tree"}),c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Collapsible feature → phase → task tree. Click a feature or phase row to collapse/expand."})]})}),c.jsxs("div",{className:"ap-search-sticky z-20 grid gap-3",style:{top:D},children:[c.jsx(UC,{features:t,phases:a,query:o.searchQuery,onQuery:o.setSearchQuery}),c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsx(Mm,{sort:o.sort,onChange:o.setSort}),o.searchActive?c.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:[o.matchedTaskIds.size," match",o.matchedTaskIds.size===1?"":"es"," — clear the box to reset."]}):null]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2 rounded-[14px] border border-[var(--border)] bg-[var(--surface-card)] px-3 py-2 sm:grid-cols-3 sm:rounded-[18px] sm:px-4 sm:py-3 lg:grid-cols-6",children:[c.jsx(ti,{active:o.isAllExpanded,onClick:()=>o.isAllExpanded?o.collapseAll():o.expandAll(),children:o.isAllExpanded?"Collapse all":"Expand all"}),c.jsx(ti,{active:o.hideDone,onClick:()=>o.setHideDone(te=>!te),children:"Hide done"}),c.jsx(ti,{active:o.hidePlanned,onClick:()=>o.setHidePlanned(te=>!te),children:"Hide planned"}),c.jsx(ti,{active:o.onlyActiveBranches,onClick:()=>o.setOnlyActiveBranches(te=>!te),children:"Only active"}),c.jsx(ti,{onClick:o.resetFilters,children:"Reset"}),c.jsx(ti,{disabled:p,onClick:async()=>{g(!0),y(null);try{const te=await TR(),re=te.migrated,ge=te.integrity.duplicatePhaseIds.length,U=te.integrity.danglingPhaseIds.length;y(`Repair done: renamed ${re.renamed}, repaired ${re.repaired} refs, inferred ${re.inferred}, archived ${te.handoffs.archived} stale handoff(s). Integrity: ${ge} duplicate, ${U} dangling.`)}catch(te){y(`Repair failed: ${te instanceof Error?te.message:String(te)}`)}finally{g(!1)}},children:p?"Repairing…":"Repair"}),x?c.jsx("span",{className:"hidden text-xs text-[var(--text-muted)] sm:inline sm:truncate",children:x}):null]})]}),c.jsx("div",{className:"grid gap-3",children:m.length>0?c.jsxs($j,{sensors:L,collisionDetection:P2,onDragStart:S,onDragEnd:I,children:[c.jsx(Om,{items:m.map(te=>te.feature.id),strategy:km,children:m.map(te=>c.jsx(_m,{id:te.feature.id,children:c.jsx(jT,{entry:te,expanded:o.expandedFeatureIds.includes(te.feature.id),recentlyChanged:o.recentFeatureIds.includes(te.feature.id),onToggle:()=>o.toggleExpandedFeature(te.feature.id),isPhaseExpanded:q,onTogglePhase:o.toggleExpandedPhase,isPhaseRecentlyChanged:X,isTaskRecentlyChanged:W,highlightedTaskIds:(()=>{const re=o.searchActive?o.matchedTaskIds:void 0;if(!T)return re;const ge=new Set(re??[]);return ge.add(T),ge})()})},te.feature.id))}),c.jsx(lT,{dropAnimation:{duration:150,easing:"ease"},children:ye()})]}):l.length>0?l.map(te=>{const re=te.featureId?`/features/${te.featureId}/phases/${te.phaseId}/tasks/${te.id}`:"/features";return c.jsxs(Ye,{to:re,className:"surface-card grid gap-1 px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-[var(--text)]",children:[te.status==="in-progress"?c.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null,c.jsxs("span",{className:"truncate",children:["T",S2(te.number)," — ",te.title]})]}),c.jsx(ur,{status:te.status})]}),c.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:te.phaseId})]},te.id)}):c.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No work items match the current filters."})})]})}function $C(){const{features:t,phases:a,activeTasks:l}=ll(),{project:s}=ms("root"),o=Ar(),u=()=>o("/project/edit");An("edit",u);const f=s.projectRoot||s.planRoot||s.name||"default";return c.jsxs("div",{className:"grid grid-cols-1 gap-8",children:[c.jsxs(Pt,{className:"grid grid-cols-1 gap-4",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsx("h2",{className:"min-w-0 text-lg font-bold text-[var(--text)]",children:"Project Goal"}),c.jsxs(gt,{type:"button",shortcut:"edit",onClick:u,className:"shrink-0",children:[c.jsx(fs,{className:"h-4 w-4"}),"Edit project"]})]}),s.goal?c.jsx(xn,{text:s.goal,className:"max-w-4xl"}):c.jsx("p",{className:"max-w-4xl text-sm text-[var(--text-muted)]",children:"Add a project goal to define the main objective."})]}),c.jsx(r2,{project:s}),c.jsx(N2,{features:t,phases:a}),c.jsx(HC,{features:t,phases:a,activeTasks:l,projectStorageScope:f}),c.jsx(c2,{features:t,phases:a}),c.jsx(f2,{features:t,phases:a})]})}async function qC(){const[t,a]=await Promise.all([Yb(),Kc()]);return{features:t,phases:a}}function Lo(){return{active:0,planned:0,done:0,blocked:0,canceled:0}}function Bc(t){const a=[];return t.active&&a.push(`${t.active} active`),t.planned&&a.push(`${t.planned} planned`),t.done&&a.push(`${t.done} done`),t.blocked&&a.push(`${t.blocked} blocked`),t.canceled&&a.push(`${t.canceled} canceled`),a.join(" · ")}function IC(t){const a=Lo();for(const l of t){if(l.status==="in-progress"||l.status==="discovery"){a.active+=1;continue}if(l.status==="planned"||l.status==="draft"){a.planned+=1;continue}if(l.status==="done"){a.done+=1;continue}if(l.status==="blocked"){a.blocked+=1;continue}l.status==="canceled"&&(a.canceled+=1)}return a}function I0(t){const a=Lo();for(const l of t){if(l.status==="in-progress"){a.active+=1;continue}if(l.status==="planned"){a.planned+=1;continue}if(l.status==="done"){a.done+=1;continue}if(l.status==="blocked"){a.blocked+=1;continue}l.status==="canceled"&&(a.canceled+=1)}return a}function VC(t){const a=Lo();for(const l of t){if(l.status==="in-progress"){a.active+=1;continue}if(l.status==="planned"){a.planned+=1;continue}if(l.status==="done"){a.done+=1;continue}if(l.status==="blocked"){a.blocked+=1;continue}l.status==="canceled"&&(a.canceled+=1)}return a}function YC({feature:t,phases:a,phasesCount:l,tasksCount:s,phaseSummary:o,taskSummary:u,activity:f}){var L;const m=ds(),p=ds(),x=((L=m.formData)==null?void 0:L.get("status"))??t.status,y=m.state!=="idle",N=p.state!=="idle",w=Bc(o),S=Bc(u),D=s0(a??[]),R=t.description||(f?`${f.doneTasks}/${s} done · ${f.remainingTasks} left${f.blockedTasks?` · ${f.blockedTasks} blocked`:""}`:"");return c.jsxs(vi,{variant:"surface",status:D.displayStatus,className:"px-4 py-2",children:[c.jsxs("div",{className:"grid gap-2 xl:grid-cols-[minmax(0,1fr)_minmax(0,132px)_minmax(0,152px)_124px_44px_44px] xl:items-center",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 xl:contents",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Tr,{featureNum:t.number,featureId:t.id}),c.jsx(Or,{id:gs({featureNum:t.number}),children:c.jsx("span",{className:"sr-only",children:"Copy feature path"})}),t.shortId?c.jsx(vs,{shortId:t.shortId}):null,c.jsx("span",{className:"shrink-0",children:c.jsx(Yo,{status:D.displayStatus,breakdown:D.breakdown})})]}),c.jsx(Ye,{to:`/features/${t.id}`,className:"entity-link--feature min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:t.name})]}),c.jsxs("div",{className:"flex items-center gap-2 self-end xl:hidden",children:[c.jsx(Ye,{to:`/features/${t.id}/edit`,"aria-label":`Edit feature ${t.name}`,children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(p.Form,{method:"post",action:`/features/${t.id}/delete`,onSubmit:I=>{window.confirm(`Delete feature “${t.name}”? This cannot be undone.`)||I.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:N||y,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${t.name}`,children:c.jsx(di,{className:"h-4 w-4"})})})]})]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[c.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[l," phases"]}),w?c.jsx("div",{className:"mt-0.5 break-words",children:w}):null]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[c.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[s," tasks"]}),S?c.jsx("div",{className:"mt-0.5 break-words",children:S}):null]}),c.jsx(m.Form,{method:"post",action:`/features/${t.id}/status`,className:"w-full xl:w-auto",children:c.jsxs("div",{className:"relative",children:[c.jsx("select",{name:"status",value:x,disabled:y||N,"aria-busy":y,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:I=>m.submit(I.currentTarget.form),children:rd.map(I=>c.jsx("option",{value:I.value,children:I.label},I.value))}),c.jsx(ps,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),c.jsx(Ye,{to:`/features/${t.id}/edit`,"aria-label":`Edit feature ${t.name}`,className:"hidden xl:block",children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(p.Form,{method:"post",action:`/features/${t.id}/delete`,className:"hidden xl:block",onSubmit:I=>{window.confirm(`Delete feature “${t.name}”? This cannot be undone.`)||I.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:N||y,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${t.name}`,children:c.jsx(di,{className:"h-4 w-4"})})})]}),R?c.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:R}):null]})}const FC={feature:{label:"Feature",Icon:Dc},phase:{label:"Phase",Icon:$N},task:{label:"Task",Icon:Io},requirement:{label:"Requirement",Icon:qb}};function V0({kind:t,label:a}){const{Icon:l,label:s}=FC[t];return c.jsxs("span",{className:`entity-badge entity-badge--${t}`,children:[c.jsx(l,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:a??s})]})}function ma({className:t="",...a}){return c.jsx("input",{className:`field-control ${t}`,...a})}function ys({className:t="",...a}){return c.jsx("select",{className:`field-control ${t}`,...a})}function sd({query:t,status:a,statusOptions:l,placeholder:s,clearTo:o,resultsLabel:u}){const f=mm(),m=((l==null?void 0:l.length)??0)>0;return c.jsxs(ca,{method:"get",className:`surface-card grid gap-3 p-3 md:items-end sm:p-4 ${m?"md:grid-cols-[minmax(0,1fr)_200px_auto_auto]":"md:grid-cols-[minmax(0,1fr)_auto_auto]"}`,children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:"list-filter-query",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Name"}),c.jsx(ma,{id:"list-filter-query",name:"q",defaultValue:t,placeholder:s,className:"min-h-9 py-2 sm:min-h-11 sm:py-2.5",onChange:p=>f(p.currentTarget.form)})]}),m?c.jsxs("div",{children:[c.jsx("label",{htmlFor:"list-filter-status",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Status"}),c.jsxs("div",{className:"relative",children:[c.jsxs(ys,{id:"list-filter-status",name:"status",defaultValue:a,className:"min-h-9 appearance-none py-2 sm:min-h-11 sm:py-2.5 pr-8",children:[c.jsx("option",{value:"",children:"All statuses"}),l==null?void 0:l.map(p=>c.jsx("option",{value:p.value,children:p.label},p.value))]}),c.jsx(ps,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--text-muted)]"})]})]}):null,c.jsx(gt,{type:"submit",variant:"secondary",children:"Apply filters"}),c.jsx(Ye,{to:o,className:"inline-flex min-h-9 items-center justify-center rounded-[12px] px-3 text-sm font-semibold text-[var(--text-muted)] transition hover:bg-[var(--accent-soft)] hover:text-[var(--text)] sm:min-h-11 sm:rounded-[14px]",children:"Clear"}),c.jsx("div",{className:`text-sm text-[var(--text-muted)] ${m?"md:col-span-4":"md:col-span-3"}`,children:u})]})}function id(t,a){const l=t.trim().toLowerCase();return l?a.some(s=>s==null?void 0:s.toLowerCase().includes(l)):!0}function PC(t){const a=new Map;for(const f of t)f.featureId&&a.set(f.featureId,[...a.get(f.featureId)??[],f]);const l=new Map,s=new Map,o=new Map,u=new Map;for(const[f,m]of a)l.set(f,m.length),s.set(f,m.reduce((p,g)=>p+g.tasks.length,0)),o.set(f,IC(m)),u.set(f,I0(m.flatMap(p=>p.tasks)));return{phasesByFeature:a,phasesCountByFeature:l,tasksCountByFeature:s,phaseSummaryByFeature:o,taskSummaryByFeature:u}}function GC(){var w,S;const{features:t,phases:a}=ll(),{phasesByFeature:l,phasesCountByFeature:s,tasksCountByFeature:o,phaseSummaryByFeature:u,taskSummaryByFeature:f}=PC(a),m=Ar(),[p]=qo(),g=((w=p.get("q"))==null?void 0:w.trim())??"",x=((S=p.get("status"))==null?void 0:S.trim())??"",y=v.useCallback(()=>m("new"),[m]);An("create",y);const N=v.useMemo(()=>t.filter(D=>(!x||D.status===x)&&id(g,[D.name,D.id,D.description])),[t,g,x]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Pt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[c.jsxs("div",{children:[c.jsx(V0,{kind:"feature",label:"Features"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter by name or status, then inspect child phases and tasks directly from the rows."})]}),c.jsx(Ye,{to:"new",children:c.jsx(gt,{type:"button",variant:"primary",shortcut:"create",children:"Create feature"})})]}),c.jsx(sd,{query:g,status:x,statusOptions:rd,placeholder:"Search feature name, id, or description",clearTo:"/features",resultsLabel:N.length===t.length?`${t.length} features`:`${N.length} of ${t.length} features`}),c.jsx("div",{className:"grid gap-3",children:t.length===0?c.jsxs(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No features yet. ",c.jsx(Ye,{to:"/features/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first feature"})]}):N.length>0?N.map(D=>c.jsx(YC,{feature:D,phases:l.get(D.id),phasesCount:s.get(D.id)??0,tasksCount:o.get(D.id)??0,phaseSummary:u.get(D.id)??Lo(),taskSummary:f.get(D.id)??Lo()},D.id)):c.jsx(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No features match the current filters."})})]}),c.jsx(hi,{})]})}async function XC(){const[t,a]=await Promise.all([vm(),Kc()]);return{requirements:t,phases:a}}function vo(...t){return t.filter(Boolean).join(" ")}function QC(){return c.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text)] shadow-sm transition group-open:rotate-180 group-hover:border-[var(--accent)] group-hover:text-[var(--accent)]",children:c.jsx(ps,{className:"h-5 w-5"})})}function ua({title:t,subtitle:a,leading:l,actions:s,defaultOpen:o=!0,count:u,className:f,summaryClassName:m,contentClassName:p,titleClassName:g,subtitleClassName:x,children:y}){return c.jsxs("details",{className:vo("group mt-4 overflow-hidden rounded-[10px] border border-[var(--border)]",f),open:o,children:[c.jsxs("summary",{className:vo("flex min-w-0 list-none cursor-pointer items-start justify-between gap-3 bg-[var(--surface-elevated)] p-4 text-left text-[var(--text)] transition-colors select-none hover:bg-[var(--surface-strong)] [&::-webkit-details-marker]:hidden",m),children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[l?c.jsx("div",{className:"shrink-0 pt-0.5",children:l}):null,c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:vo("flex flex-wrap items-center gap-2 text-sm font-semibold",g),children:[t,u!==void 0?c.jsxs("span",{className:"text-[var(--text-subtle)]",children:["(",u,")"]}):null]}),a?c.jsx("div",{className:vo("mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",x),children:a}):null]})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s,c.jsx(QC,{})]})]}),c.jsx("div",{className:vo("border-t border-[var(--border)] bg-[var(--surface)] p-4",p),children:y})]})}function KC(t,a){const l=new Set(a.map(u=>u.id)),s=a.map(u=>({phase:u,requirements:t.filter(f=>f.linkedPhaseIds.includes(u.id))})).filter(u=>u.requirements.length>0).sort((u,f)=>u.phase.priority-f.phase.priority||u.phase.number-f.phase.number),o=t.filter(u=>!u.linkedPhaseIds.some(f=>l.has(f)));return{phaseGroups:s,unlinkedRequirements:o}}function qx(t){return`P${String(t.number??0).padStart(3,"0")}`}function Ix({requirement:t}){return c.jsx(Pt,{className:"overflow-hidden p-0",children:c.jsx(ua,{defaultOpen:!1,title:c.jsx("h2",{className:"min-w-0 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:t.title}),count:t.linkedPhaseIds.length,subtitle:c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[t.linkedPhaseIds.length," linked phase",t.linkedPhaseIds.length===1?"":"s"]}),t.linkedPhaseIds.length>0&&t.macroTasks.length>0?c.jsx("span",{className:"mx-2 text-[var(--text-subtle)]",children:"•"}):null,t.macroTasks.length>0?c.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[t.macroTasks.length," macro task",t.macroTasks.length===1?"":"s"]}):null]}),contentClassName:"grid gap-4",summaryClassName:"hover:bg-[var(--surface-elevated)]/65",children:c.jsxs("div",{className:"flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[c.jsx("div",{className:"min-w-0",children:t.description?c.jsx("p",{className:"min-w-0 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:t.description}):null}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:justify-end",children:[c.jsx(Ye,{to:`${t.id}/edit`,children:c.jsx(gt,{type:"button",variant:"secondary",children:"Edit"})}),c.jsx(ca,{method:"post",action:`/requirements/${t.id}/delete`,onSubmit:a=>{window.confirm(`Delete requirement "${t.title}"?`)||a.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",children:"Delete"})})]})]})})})}function ZC(){var x;const{requirements:t,phases:a}=ll(),l=Ar(),[s]=qo(),o=((x=s.get("q"))==null?void 0:x.trim())??"",u=v.useCallback(()=>l("new"),[l]);An("create",u);const f=v.useMemo(()=>new Map(a.map(y=>[y.id,y])),[a]),m=v.useMemo(()=>t.filter(y=>{const N=y.linkedPhaseIds.map(w=>{const S=f.get(w);return S?`${qx(S)} ${S.title} ${S.summary}`:w});return id(o,[y.title,y.description,y.id,...N])}),[t,f,o]),{phaseGroups:p,unlinkedRequirements:g}=v.useMemo(()=>KC(m,a),[m,a]);return v.useEffect(()=>{const y=window.location.hash.slice(1);y&&requestAnimationFrame(()=>{var N;return(N=document.getElementById(y))==null?void 0:N.scrollIntoView({block:"start"})})},[p]),c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Pt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[c.jsxs("div",{children:[c.jsx(V0,{kind:"requirement",label:"Requirements"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Track top-level outcomes independently from features, grouped below by the phases that deliver them."})]}),c.jsx(Ye,{to:"new",children:c.jsx(gt,{type:"button",variant:"primary",shortcut:"create",children:"Create requirement"})})]}),c.jsx(sd,{query:o,placeholder:"Search requirement title, description, id, or linked phase",clearTo:"/requirements",resultsLabel:m.length===t.length?`${t.length} requirements`:`${m.length} of ${t.length} requirements`}),c.jsx("div",{className:"grid gap-6",children:t.length===0?c.jsxs(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No requirements yet. ",c.jsx(Ye,{to:"/requirements/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first requirement"})]}):m.length>0?c.jsxs(c.Fragment,{children:[p.map(({phase:y,requirements:N})=>{const w=y.featureId?`/features/${y.featureId}/phases/${y.id}`:"/features";return c.jsxs("section",{id:`phase-${y.id}`,className:"scroll-mt-28","aria-labelledby":`phase-${y.id}-heading`,children:[c.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Linked phase"}),c.jsxs(Ye,{id:`phase-${y.id}-heading`,to:w,className:"min-w-0 break-words text-base font-black text-[var(--text)] underline-offset-4 hover:text-[var(--accent)] hover:underline [overflow-wrap:anywhere]",children:[qx(y)," — ",y.title]})]}),c.jsxs("span",{className:"shrink-0 rounded-full bg-[var(--surface-elevated)] px-2.5 py-1 text-xs font-semibold text-[var(--text-muted)]",children:[N.length," requirement",N.length===1?"":"s"]})]}),c.jsx("div",{className:"grid gap-3",children:N.map(S=>c.jsx(Ix,{requirement:S},S.id))})]},y.id)}),g.length>0?c.jsxs("section",{id:"unlinked-requirements",className:"scroll-mt-28","aria-labelledby":"unlinked-requirements-heading",children:[c.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Unlinked"}),c.jsx("h2",{id:"unlinked-requirements-heading",className:"text-base font-black text-[var(--text)]",children:"Requirements without a valid phase"})]}),c.jsx("span",{className:"shrink-0 rounded-full bg-[var(--surface-elevated)] px-2.5 py-1 text-xs font-semibold text-[var(--text-muted)]",children:g.length})]}),c.jsx("div",{className:"grid gap-3",children:g.map(y=>c.jsx(Ix,{requirement:y},y.id))})]}):null]}):c.jsx(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No requirements match the current filters."})})]}),c.jsx(hi,{})]})}async function JC({params:t}){const a=t.featureId;if(!a)throw new Response("featureId required",{status:400});const[l,s]=await Promise.all([Vo(a),Kc(a)]);return{feature:l,phases:s}}function WC({featureId:t,feature:a,phase:l}){var y,N;const s=ds(),o=ds(),f=((y=s.formData)==null?void 0:y.get("status"))??l.status,m=s.state!=="idle",p=o.state!=="idle",g=Bc(I0(l.tasks)),x=i0(l.tasks);return c.jsxs(vi,{variant:"surface",status:x.displayStatus,className:"px-4 py-2",children:[c.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,150px)_124px_44px_44px] lg:items-center",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Tr,{featureNum:a.number,phaseNum:l.number,featureId:a.id,phaseId:l.id}),c.jsx(Or,{id:gs({featureNum:a.number,phaseNum:l.number}),children:c.jsx("span",{className:"sr-only",children:"Copy phase path"})}),l.shortId?c.jsx(vs,{shortId:l.shortId}):null,l.handoff?c.jsx(bm,{phaseId:l.id,updatedAt:l.handoffUpdatedAt}):null,c.jsx(z0,{phaseId:l.id,phaseTitle:l.title,count:((N=l.linkedRequirements)==null?void 0:N.length)??0}),c.jsx("span",{className:"shrink-0",children:c.jsx(Yo,{status:x.displayStatus,breakdown:x.breakdown})})]}),c.jsx(Ye,{to:`/features/${t}/phases/${l.id}`,className:"entity-link--phase min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:l.title})]}),c.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[c.jsx(Ye,{to:`/features/${t}/phases/${l.id}/edit`,"aria-label":`Edit phase ${l.title}`,children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(o.Form,{method:"post",action:`/features/${t}/phases/${l.id}/delete`,onSubmit:w=>{window.confirm(`Delete phase “${l.title}”? This cannot be undone.`)||w.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:p||m,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${l.title}`,children:c.jsx(di,{className:"h-4 w-4"})})})]})]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[c.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[l.tasks.length," tasks"]}),g?c.jsx("div",{className:"mt-0.5 break-words",children:g}):null]}),c.jsx(s.Form,{method:"post",action:`/features/${t}/phases/${l.id}/status`,className:"w-full lg:w-auto",children:c.jsxs("div",{className:"relative",children:[c.jsx("select",{name:"status",value:f,disabled:m||p,"aria-busy":m,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:w=>s.submit(w.currentTarget.form),children:ld.map(w=>c.jsx("option",{value:w.value,children:w.label},w.value))}),c.jsx(ps,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),c.jsx(Ye,{to:`/features/${t}/phases/${l.id}/edit`,"aria-label":`Edit phase ${l.title}`,className:"hidden lg:block",children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(o.Form,{method:"post",action:`/features/${t}/phases/${l.id}/delete`,className:"hidden lg:block",onSubmit:w=>{window.confirm(`Delete phase “${l.title}”? This cannot be undone.`)||w.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:p||m,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${l.title}`,children:c.jsx(di,{className:"h-4 w-4"})})})]}),l.summary?c.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:l.summary}):null]})}function Um({items:t,className:a="",stacked:l=!1}){return l?c.jsx("nav",{"aria-label":"Breadcrumb",className:`grid gap-1 text-sm ${a}`,children:t.map((s,o)=>{const u=o===t.length-1,f=s.to&&!u?c.jsx(Ye,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline break-words min-w-0",children:s.label}):c.jsx("span",{className:`break-words min-w-0 ${u?"text-[var(--text)] font-semibold":"text-[var(--text-muted)]"}`,children:s.label});return c.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[s.kind?c.jsxs("span",{className:"shrink-0 text-[var(--text-subtle)] font-medium",children:[s.kind,":"]}):null,c.jsx("span",{className:"min-w-0",children:f})]},`${s.label}-${o}`)})}):c.jsx("nav",{"aria-label":"Breadcrumb",className:`flex flex-wrap items-center gap-2 text-sm ${a}`,children:t.map((s,o)=>{const u=o===t.length-1,f=s.to&&!u?c.jsx(Ye,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline",children:s.label}):c.jsx("span",{className:u?"text-[var(--text)]":"text-[var(--text-muted)]",children:s.label});return c.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[o>0?c.jsx("span",{className:"text-[var(--text-subtle)]",children:"/"}):null,c.jsx("span",{className:"min-w-0 break-words",children:f})]},`${s.label}-${o}`)})})}function Bm({featureNum:t,phaseNum:a,taskNum:l,featureId:s,phaseId:o,taskId:u,shortId:f,children:m}){return c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Tr,{featureNum:t,phaseNum:a,taskNum:l,featureId:s,phaseId:o,taskId:u}),c.jsx(Or,{id:gs({featureNum:t,phaseNum:a,taskNum:l}),children:c.jsx("span",{className:"sr-only",children:"Copy path"})}),f?c.jsx(vs,{shortId:f}):null,m]})}function zn({className:t="",children:a,...l}){return c.jsx("div",{className:`surface-card p-4 ${t}`,...l,children:a})}function Vx(...t){return t.filter(Boolean).join(" ")}function Hm({items:t,className:a}){const l=t.filter(s=>s.visible!==!1);return l.length===0?null:c.jsx("div",{className:Vx("grid gap-4 md:grid-cols-2 xl:grid-cols-4",a),children:l.map(s=>c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:s.label}),c.jsx("div",{className:Vx("mt-2 text-sm font-semibold break-words text-[var(--text)] [overflow-wrap:anywhere]",s.valueClassName),children:s.value})]},s.label))})}function $m(t){return t&&t>0?`P${t}`:""}function eD(t,a){return!t&&!a?"":`${t||"Start not set"} → ${a||"End not set"}`}function qm({decisions:t}){return t.length===0?null:c.jsxs("details",{className:"group mt-4",children:[c.jsx("summary",{className:"flex cursor-pointer select-none items-center gap-2 font-semibold text-[var(--text)]",children:c.jsxs("span",{children:["Accepted decisions (",t.length,")"]})}),c.jsx("div",{className:"mt-2 grid gap-3",children:t.map(a=>c.jsxs("div",{className:"surface-card px-4 py-3",children:[c.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:a.title}),a.decision?c.jsxs("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Decision:"}),c.jsx(xn,{text:a.decision,className:"mt-1"})]}):null,a.rationale?c.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Rationale:"}),c.jsx(xn,{text:a.rationale,className:"mt-1"})]}):null,a.implementationNotes?c.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Implementation:"}),c.jsx(xn,{text:a.implementationNotes,className:"mt-1"})]}):null]},a.id))})]})}const tD={draft:jN,discovery:aR,planned:Io,"in-progress":Bb,done:pm,blocked:$b,waiting:Ub,deferred:iR,canceled:_b,rejected:CN};function Bh(t){return t.split(/[-\s]+/).filter(Boolean).map(a=>a==="and"?"and":a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function Yx(t){if(!t)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(t))}catch{return t}}const nD=new Set(["canceled","rejected"]);function Im({statusLog:t,currentStatus:a,backbone:l,createdAt:s,updatedAt:o,startedAt:u,completedAt:f}){const m=[];if(t.length===0){const S=l.indexOf(a);if(S>=0)for(let D=0;D<=S;D++)m.push(l[D]);else m.push(a)}else{const S=t[0];S&&m.push(S.fromStatus);for(const D of t)m[m.length-1]!==D.toStatus&&m.push(D.toStatus)}m[m.length-1]!==a&&m.push(a);const p=new Set(m),g=a==="done"||nD.has(a),x=S=>{var R,L;if(t.length>0){if(S===((R=t[0])==null?void 0:R.fromStatus))return((L=t[0])==null?void 0:L.date)??"";for(const I of t)if(I.toStatus===S)return I.date;return""}const D=l[0];return S===D?s??"":S==="in-progress"?u??o??"":S==="done"?f??o??"":""},y=[...m];if(!g){const S=l.indexOf(a);if(S>=0&&S+1<l.length){const D=l[S+1];p.has(D)||y.push(D)}}const N=t.length===0?y.filter((S,D)=>D===0||S===a||!!x(S)):y,w=S=>p.has(S)?S===a&&!g?"current":"completed":"pending";return c.jsx("ol",{className:"status-stepper",role:"list","aria-label":"Status progress",children:N.map((S,D)=>{const R=w(S),L=tD[S]??Pc,I=p.has(S),q=x(S),X=q?`${Bh(S)} — ${Yx(q)}`:Bh(S),W=D===0?null:I?"traveled":"pending";return c.jsxs("li",{className:`status-step status-step--${R}`,role:"listitem","aria-current":R==="current"?"step":void 0,style:{"--step-color":`var(--color-status-${S})`},children:[W?c.jsx("span",{className:`status-connector status-connector--${W}`,"aria-hidden":"true"}):null,c.jsx("span",{className:"status-node",title:X,children:c.jsx(L,{className:"status-node-icon"})}),c.jsx("span",{className:"status-step-label",children:Bh(S)}),q?c.jsx("span",{className:"status-step-date",children:Yx(q)}):null]},`${S}-${D}`)})})}function Fx(t){return t.split(/[-\s]+/).filter(Boolean).map(a=>a==="and"?"and":a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function aD(t){if(!t)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(t))}catch{return t}}function rD(t,a,l,s,o){if(t.length>0)return t.map(m=>({date:m.date,fromStatus:m.fromStatus,toStatus:m.toStatus,inferred:!1}));const u=l.indexOf(a);if(u<0)return[];const f=[];for(let m=1;m<=u;m++){const p=l[m-1],g=l[m],x=g==="in-progress"?s??"":g==="done"?o??"":"";f.push({date:x,fromStatus:p,toStatus:g,inferred:!0})}return f}function Vm({statusLog:t,currentStatus:a,backbone:l,startedAt:s,completedAt:o}){const u=rD(t??[],a??"",l??[],s,o);return c.jsx(ua,{title:"Status history",count:u.length,defaultOpen:u.length>0,contentClassName:"grid gap-2.5",children:u.length===0?c.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No status changes recorded."}):u.map((f,m)=>c.jsxs("div",{className:"text-sm flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-xs font-mono text-[var(--text-subtle)]",children:aD(f.date)}),c.jsx("span",{className:"font-semibold text-[var(--text-muted)]",children:Fx(f.fromStatus)}),c.jsx("span",{className:"text-[var(--text-subtle)]",children:"→"}),c.jsx("span",{className:"font-semibold text-[var(--text)]",children:Fx(f.toStatus)})]},m))})}function lD(t){return t.reduce((a,l)=>a+l.tasks.length,0)}function sD(t){let a=0,l=0,s=0,o=0;for(const u of t)for(const f of u.tasks)f.status==="in-progress"&&(a+=1),f.status==="done"&&(l+=1),f.status==="blocked"&&(s+=1),["done","canceled"].includes(f.status)||(o+=1);return{inProgress:a,done:l,blocked:s,remaining:o}}function iD(t){return t.find(a=>["in-progress","discovery","planned","draft"].includes(a.status))}function oD(){var W,ae,z,T;const{feature:t,phases:a}=ll(),l=t.acceptedDecisions??[],s=lD(a),o=sD(a),u=iD(a),f=s0(a),[m,p]=qo(),g=((W=m.get("q"))==null?void 0:W.trim())??"",x=((ae=m.get("status"))==null?void 0:ae.trim())??"",y=((z=m.get("sort"))==null?void 0:z.trim())??"priority",N=((T=m.get("dir"))==null?void 0:T.trim())??"asc",w={key:y==="priority"||y==="number"||y==="createdAt"||y==="updatedAt"||y==="title"||y==="shortId"||y==="status"||y==="startedAt"||y==="completedAt"?y:"priority",direction:N==="desc"?"desc":"asc"},S=v.useMemo(()=>[...a].sort((ee,fe)=>Eo(ee,fe,w.key,w.direction)),[a,w]),D=v.useMemo(()=>S.filter(ee=>(!x||ee.status===x)&&id(g,[ee.title,ee.id,ee.summary,ee.description])),[S,g,x]),R=Ar(),L=v.useRef(null),I=v.useCallback(()=>R("edit"),[R]),q=v.useCallback(()=>R("phases/new"),[R]),X=v.useCallback(()=>{var ee;(ee=L.current)==null||ee.requestSubmit()},[]);return An("edit",I),An("create",q),An("delete",X),c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Ye,{to:"/features",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[c.jsx(Fc,{className:"h-4 w-4"})," Back to features"]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx(Um,{stacked:!0,items:[{label:t.name,kind:"Feature"}]}),c.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:c.jsx(Bm,{featureNum:t.number,featureId:t.id,shortId:t.shortId,children:c.jsx(Yo,{status:f.displayStatus,breakdown:f.breakdown})})}),c.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:t.name}),t.description?c.jsx(ua,{title:"Description",children:c.jsx(xn,{text:t.description,className:"plan-description max-w-4xl"})}):null,c.jsx("div",{className:"mt-4",children:c.jsx(Im,{statusLog:t.statusLog??[],currentStatus:t.status,backbone:["planned","in-progress","done"],createdAt:t.createdAt,updatedAt:t.updatedAt})}),c.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[c.jsx(Ye,{to:"edit",children:c.jsx(gt,{type:"button",shortcut:"edit",children:"Edit feature"})}),c.jsx(ca,{ref:L,method:"post",action:`/features/${t.id}/delete`,className:"inline-flex",onSubmit:ee=>{window.confirm(`Delete feature "${t.name}"?`)||ee.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete feature"})})]})]}),c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),c.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(u==null?void 0:u.title)||"No active phase"})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Phases"}),c.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:a.length})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),c.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:s})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),c.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(u==null?void 0:u.title)||"No active phase"})]})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:o.inProgress})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:o.remaining})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:o.done})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:o.blocked})]})]}),c.jsx(Hm,{items:[{label:"Priority",value:$m(t.priority),visible:t.priority>0},{label:"Timeline",value:eD(t.startDate,t.endDate),visible:!!(t.startDate||t.endDate)}]}),t.workDone||t.workRemaining?c.jsx(ua,{title:"Planning notes",defaultOpen:!1,children:c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.workDone?c.jsxs("div",{children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work done"}),c.jsx(xn,{text:t.workDone,className:"mt-2"})]}):null,t.workRemaining?c.jsxs("div",{children:[c.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work remaining"}),c.jsx(xn,{text:t.workRemaining,className:"mt-2"})]}):null]})}):null,l.length>0?c.jsx(qm,{decisions:l}):null,c.jsx(Vm,{statusLog:t.statusLog??[],currentStatus:t.status,backbone:["planned","in-progress","done"]})]}),c.jsxs(Pt,{className:"grid gap-5",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Phases"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this feature's phases."})]}),c.jsx(Ye,{to:"phases/new",children:c.jsx(gt,{type:"button",variant:"primary",shortcut:"create",children:"Create phase"})})]}),c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[c.jsx(Mm,{sort:w,onChange:ee=>p(fe=>(fe.set("sort",ee.key),fe.set("dir",ee.direction),fe))}),c.jsx(sd,{query:g,status:x,statusOptions:ld,placeholder:"Search phase title, id, or summary",clearTo:`/features/${t.id}`,resultsLabel:D.length===a.length?`${a.length} phases`:`${D.length} of ${a.length} phases`})]}),c.jsx("div",{className:"grid gap-3",children:a.length===0?c.jsxs(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No phases yet. ",c.jsx(Ye,{to:`/features/${t.id}/phases/new`,className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a phase"})]}):D.length>0?D.map(ee=>c.jsx(WC,{featureId:t.id,feature:t,phase:ee},ee.id)):c.jsx(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No phases match the current filters."})})]}),c.jsx(hi,{})]})}async function uD({params:t}){const{featureId:a,phaseId:l}=t;if(!a||!l)throw new Response("featureId and phaseId required",{status:400});const[s,o,u]=await Promise.all([Vo(a),Zc(l),vm()]),f=u.filter(m=>m.linkedPhaseIds.includes(l));return{feature:s,phase:{...o,linkedRequirements:f}}}function Px(t){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}}function cD({featureId:t,featureNum:a,phaseId:l,phaseNum:s,task:o}){var w;const u=ds(),f=ds(),p=((w=u.formData)==null?void 0:w.get("status"))??o.status,g=u.state!=="idle",x=f.state!=="idle",y=Bc(VC(o.subtasks)),N=n0(p);return c.jsxs(vi,{variant:"surface",status:N,className:"px-4 py-2",children:[c.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,168px)_124px_44px_44px] lg:items-center",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Tr,{featureNum:a,phaseNum:s,taskNum:o.number,featureId:t,phaseId:l,taskId:o.id}),c.jsx(Or,{id:gs({featureNum:a,phaseNum:s,taskNum:o.number}),children:c.jsx("span",{className:"sr-only",children:"Copy task path"})}),o.shortId?c.jsx(vs,{shortId:o.shortId}):null,c.jsx("span",{className:"shrink-0",children:c.jsx(ur,{status:p})})]}),c.jsx(Ye,{to:`/features/${t}/phases/${l}/tasks/${o.id}`,className:"entity-link--task min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:o.title})]}),c.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[c.jsx(Ye,{to:`/features/${t}/phases/${l}/tasks/${o.id}/edit`,"aria-label":`Edit task ${o.title}`,children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(f.Form,{method:"post",action:`/features/${t}/phases/${l}/tasks/${o.id}/delete`,onSubmit:S=>{window.confirm(`Delete task “${o.title}”? This cannot be undone.`)||S.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:x||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${o.title}`,children:c.jsx(di,{className:"h-4 w-4"})})})]})]}),c.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[c.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[o.subtasks.length," subtasks · ",o.checklist.length," checklist"]}),y?c.jsx("div",{className:"mt-0.5 break-words",children:y}):c.jsx("div",{className:"mt-0.5 break-words",children:"No subtask statuses yet"})]}),c.jsx(u.Form,{method:"post",action:`/features/${t}/phases/${l}/tasks/${o.id}/status`,className:"w-full lg:w-auto",children:c.jsxs("div",{className:"relative",children:[c.jsx("select",{name:"status",value:p,disabled:g||x,"aria-busy":g,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:S=>u.submit(S.currentTarget.form),children:Qo.map(S=>c.jsx("option",{value:S.value,children:S.label},S.value))}),c.jsx(ps,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),c.jsx(Ye,{to:`/features/${t}/phases/${l}/tasks/${o.id}/edit`,"aria-label":`Edit task ${o.title}`,className:"hidden lg:block",children:c.jsx(gt,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:c.jsx(fs,{className:"h-3.5 w-3.5"})})}),c.jsx(f.Form,{method:"post",action:`/features/${t}/phases/${l}/tasks/${o.id}/delete`,className:"hidden lg:block",onSubmit:S=>{window.confirm(`Delete task “${o.title}”? This cannot be undone.`)||S.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",disabled:x||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${o.title}`,children:c.jsx(di,{className:"h-4 w-4"})})})]}),c.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-[var(--text-subtle)]",children:[o.startedAt?c.jsxs("span",{children:["Started ",Px(o.startedAt)]}):null,o.completedAt?c.jsxs("span",{children:["Completed ",Px(o.completedAt)]}):null]}),o.description?c.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:o.description}):null]})}function dD(t){let a=0,l=0,s=0,o=0;for(const u of t.tasks)u.status==="in-progress"&&(a+=1),u.status==="done"&&(l+=1),u.status==="blocked"&&(s+=1),["done","canceled"].includes(u.status)||(o+=1);return{inProgress:a,done:l,blocked:s,remaining:o}}function fD(){var fe,be,ye,te;const{feature:t,phase:a}=ll(),l=a.decisions??[],s=a.acceptedDecisions??[],o=a.linkedRequirements??[],u=dD(a),f=i0(a.tasks),[m,p]=qo(),g=((fe=m.get("q"))==null?void 0:fe.trim())??"",x=((be=m.get("status"))==null?void 0:be.trim())??"",y=((ye=m.get("sort"))==null?void 0:ye.trim())??"priority",N=((te=m.get("dir"))==null?void 0:te.trim())??"asc",w={key:y==="priority"||y==="number"||y==="createdAt"||y==="updatedAt"||y==="title"||y==="shortId"||y==="status"||y==="startedAt"||y==="completedAt"?y:"priority",direction:N==="desc"?"desc":"asc"},S=v.useMemo(()=>[...a.tasks].sort((re,ge)=>Eo(re,ge,w.key,w.direction)),[a.tasks,w]),D=v.useMemo(()=>S.filter(re=>(!x||re.status===x)&&id(g,[re.title,re.id,re.description,re.shortName])),[S,g,x]),R=Ar(),L=v.useRef(null),[I,q]=v.useState(a.handoff??""),[X,W]=v.useState(!1),ae=v.useCallback(()=>R("edit"),[R]),z=v.useCallback(()=>R("tasks/new"),[R]),T=v.useCallback(()=>{var re;(re=L.current)==null||re.requestSubmit()},[]),ee=v.useCallback(async()=>{if(window.confirm("Clear this phase's handoff?")){W(!0);try{await Xb(a.id),q("")}catch{}finally{W(!1)}}},[a.id]);return An("edit",ae),An("create",z),An("delete",T),c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Ye,{to:`/features/${t.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[c.jsx(Fc,{className:"h-4 w-4"})," Back to feature"]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx(Um,{stacked:!0,items:[{label:t.name,to:`/features/${t.id}`,kind:"Feature"},{label:a.title,kind:"Phase"}]}),c.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:c.jsxs(Bm,{featureNum:t.number,phaseNum:a.number,featureId:t.id,phaseId:a.id,shortId:a.shortId,children:[I?c.jsx(bm,{phaseId:a.id,updatedAt:a.handoffUpdatedAt}):null,c.jsx(Yo,{status:f.displayStatus,breakdown:f.breakdown})]})}),c.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:a.title}),a.summary?c.jsx(xn,{text:a.summary,className:"mt-3 max-w-4xl"}):null,c.jsx(Im,{statusLog:a.statusLog??[],currentStatus:a.status,backbone:["draft","discovery","planned","in-progress","done"],createdAt:a.createdAt,updatedAt:a.updatedAt}),c.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[c.jsx(Ye,{to:"edit",children:c.jsx(gt,{type:"button",shortcut:"edit",children:"Edit phase"})}),c.jsx(Ye,{to:"tasks/new",children:c.jsx(gt,{type:"button",variant:"primary",shortcut:"create",children:"Create task"})}),c.jsx(ca,{ref:L,method:"post",action:`/features/${t.id}/phases/${a.id}/delete`,className:"inline-flex",onSubmit:re=>{window.confirm(`Delete phase "${a.title}"?`)||re.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete phase"})})]})]}),c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),c.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:a.tasks.length})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.inProgress})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.remaining})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.done})]})]}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.blocked})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Goals"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.goals.length})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Dependencies"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.dependencies.length})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Completion criteria"}),c.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.completionCriteria.length})]})]}),c.jsx(Hm,{items:[{label:"Priority",value:$m(a.priority),visible:a.priority>0},{label:"Linked requirements",value:o.length,visible:o.length>0,valueClassName:"text-2xl font-black"},{label:"Risks",value:a.risks.length,visible:a.risks.length>0,valueClassName:"text-2xl font-black"},{label:"Open questions",value:a.openQuestions.length,visible:a.openQuestions.length>0,valueClassName:"text-2xl font-black"}]}),a.notes?c.jsx(ua,{title:"Notes",defaultOpen:!1,children:c.jsx(xn,{text:a.notes,className:"plan-description"})}):null,c.jsx(ua,{title:"Linked requirements",count:o.length,defaultOpen:!1,children:o.length>0?c.jsx("div",{className:"grid gap-3",children:o.map(re=>c.jsx("div",{className:"min-w-0 rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:c.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(ur,{status:re.status}),re.macroTasks.length>0?c.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[re.macroTasks.length," macro task",re.macroTasks.length===1?"":"s"]}):null]}),c.jsx("h3",{className:"mt-2 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:re.title}),re.description?c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:re.description}):null]}),c.jsx(Ye,{to:`/requirements#phase-${a.id}`,className:"text-sm font-semibold text-[var(--accent)] hover:underline sm:shrink-0",children:"Open phase requirements →"})]})},re.id))}):c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No linked requirements yet."})}),a.description?c.jsx(ua,{title:"Description",children:c.jsx(xn,{text:a.description,className:"plan-description"})}):null,l.length>0?c.jsx(ua,{title:"Decisions",count:l.length,defaultOpen:!1,children:c.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:l.map((re,ge)=>c.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:c.jsx(xn,{text:re})},ge))})}):null,s.length>0?c.jsx(qm,{decisions:s}):null,c.jsx(Vm,{statusLog:a.statusLog??[],currentStatus:a.status,backbone:["draft","discovery","planned","in-progress","done"]})]}),I?c.jsx(Pt,{className:"grid gap-4",children:c.jsx(ua,{title:"Handoff",actions:c.jsx("button",{type:"button",onClick:ee,disabled:X,className:"rounded-lg border border-[var(--border)] px-3 py-1.5 text-sm text-[var(--text-muted)] hover:bg-[var(--surface-card)] disabled:opacity-60",children:X?"Clearing…":"Clear handoff"}),children:c.jsx("div",{className:"rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-5 py-5",children:c.jsx(xn,{text:I,className:"formatted-text max-w-none"})})})}):null,c.jsxs(Pt,{className:"grid gap-5",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this phase's tasks."})]}),c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[c.jsx(Mm,{sort:w,onChange:re=>p(ge=>(ge.set("sort",re.key),ge.set("dir",re.direction),ge))}),c.jsx(sd,{query:g,status:x,statusOptions:Qo,placeholder:"Search task title, id, or description",clearTo:`/features/${t.id}/phases/${a.id}`,resultsLabel:D.length===a.tasks.length?`${a.tasks.length} tasks`:`${D.length} of ${a.tasks.length} tasks`})]}),c.jsx("div",{className:"grid gap-3",children:a.tasks.length===0?c.jsxs(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No tasks yet. ",c.jsx(Ye,{to:"tasks/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a task"})]}):D.length>0?D.map(re=>c.jsx(cD,{featureId:t.id,featureNum:t.number,phaseId:a.id,phaseNum:a.number,task:re},re.id)):c.jsx(Pt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No tasks match the current filters."})})]}),c.jsx(hi,{})]})}async function hD({params:t}){const{featureId:a,phaseId:l,taskId:s}=t;if(!a||!l||!s)throw new Response("featureId, phaseId and taskId required",{status:400});const[o,u,f]=await Promise.all([Vo(a),Zc(l),Jc(s)]);return{feature:o,phase:u,task:f}}function Gx(t){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}}function mD({featureId:t,phaseId:a,taskId:l,item:s}){const o=ds(),u=o.formData?o.formData.get("checked")==="true":s.checked,f=o.state!=="idle";return c.jsxs("div",{className:"surface-card flex items-start gap-3 px-4 py-3",children:[c.jsx("input",{type:"checkbox",checked:u,onChange:()=>o.submit({checked:s.checked?"false":"true"},{method:"post",action:`/features/${t}/phases/${a}/tasks/${l}/checklist/${s.id}/toggle`}),disabled:f,className:"mt-0.5 h-4 w-4 shrink-0 accent-[var(--accent)]","aria-label":`Toggle checklist item ${s.title}`}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("span",{className:"checklist-num",children:s.number})," ",c.jsx("span",{className:`text-sm ${u?"text-[var(--text-muted)] line-through":"font-medium text-[var(--text)]"}`,children:s.title})]})]})}function pD(){var x,y;const{feature:t,phase:a,task:l}=ll(),s=l.decisions??[],o=l.acceptedDecisions??[],u=l.checklist??[],f=Ar(),m=v.useRef(null),p=v.useCallback(()=>f("edit"),[f]),g=v.useCallback(()=>{var N;(N=m.current)==null||N.requestSubmit()},[]);return An("edit",p),An("delete",g),c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Ye,{to:`/features/${t.id}/phases/${a.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[c.jsx(Fc,{className:"h-4 w-4"})," Back to phase"]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx(Um,{stacked:!0,items:[{label:t.name,to:`/features/${t.id}`,kind:"Feature"},{label:a.title,to:`/features/${t.id}/phases/${a.id}`,kind:"Phase"},{label:l.title,kind:"Task"}]}),c.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:c.jsx(Bm,{featureNum:t.number,phaseNum:a.number,taskNum:l.number,featureId:t.id,phaseId:a.id,taskId:l.id,shortId:l.shortId,children:c.jsx(ur,{status:l.status})})}),c.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:l.title}),c.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[c.jsx(Ye,{to:"edit",children:c.jsx(gt,{type:"button",shortcut:"edit",children:"Edit task"})}),c.jsx(ca,{ref:m,method:"post",action:`/features/${t.id}/phases/${a.id}/tasks/${l.id}/delete`,className:"inline-flex",onSubmit:N=>{window.confirm(`Delete task "${l.title}"?`)||N.preventDefault()},children:c.jsx(gt,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete task"})})]})]}),c.jsx(Im,{statusLog:l.statusLog??[],currentStatus:l.status,backbone:["planned","in-progress","done"],createdAt:l.createdAt,updatedAt:l.updatedAt,startedAt:l.startedAt,completedAt:l.completedAt}),c.jsxs(Pt,{className:"grid gap-4",children:[l.description?c.jsx(ua,{title:"Description",children:c.jsx(xn,{text:l.description,className:"plan-description"})}):null,l.notes?c.jsx(ua,{title:"Notes",defaultOpen:!1,children:c.jsx(xn,{text:l.notes})}):null,c.jsx(Vm,{statusLog:l.statusLog??[],currentStatus:l.status,backbone:["planned","in-progress","done"],startedAt:l.startedAt,completedAt:l.completedAt}),s.length>0?c.jsx(ua,{title:"Decisions",count:s.length,defaultOpen:!1,children:c.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:s.map((N,w)=>c.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:c.jsx(xn,{text:N})},w))})}):null,o.length>0?c.jsx(qm,{decisions:o}):null,c.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Checklist items"}),c.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:u.length})]}),c.jsxs(zn,{children:[c.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Subtasks"}),c.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:((x=l.subtasks)==null?void 0:x.length)??0})]})]}),c.jsx(Hm,{items:[{label:"Priority",value:$m(l.priority),visible:l.priority>0},{label:"Short name",value:l.shortName,visible:!!l.shortName},{label:"Started",value:Gx(l.startedAt),visible:!!l.startedAt},{label:"Completed",value:Gx(l.completedAt),visible:!!l.completedAt},{label:"Phase",value:a.title}]}),c.jsxs("div",{className:"grid gap-3",children:[c.jsx("div",{children:c.jsxs("h3",{className:"text-sm font-bold text-[var(--text)]",children:["Steps (",u.length,")"]})}),u.length?c.jsx("div",{className:"grid gap-2",children:u.map(N=>c.jsx(mD,{featureId:t.id,phaseId:a.id,taskId:l.id,item:N},N.id))}):c.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No steps defined."})]}),(y=l.subtasks)!=null&&y.length?c.jsx(ua,{title:"Subtasks",count:l.subtasks.length,defaultOpen:!1,contentClassName:"grid gap-2",children:l.subtasks.map(N=>c.jsxs("div",{className:"surface-card flex items-center justify-between gap-4 px-4 py-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:N.title}),c.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:N.id})]}),c.jsx(ur,{status:N.status})]},N.id))}):null]}),c.jsx(hi,{})]})}const gD=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Hl({title:t,description:a,children:l}){const s=Ar(),o=v.useRef(null),u=v.useRef(null);return v.useEffect(()=>{var g;const f=o.current;if(!f)return;const m=document.activeElement;(g=u.current)==null||g.focus();const p=x=>{if(x.key==="Escape"){x.preventDefault(),s(-1);return}if(x.key!=="Tab")return;const y=Array.from(f.querySelectorAll(gD)).filter(D=>D.offsetParent!==null);if(y.length===0){x.preventDefault(),f.focus();return}const N=y[0],w=y[y.length-1],S=document.activeElement;x.shiftKey?(S===N||!f.contains(S))&&(x.preventDefault(),w.focus()):S===w&&(x.preventDefault(),N.focus())};return window.addEventListener("keydown",p),()=>{var x;window.removeEventListener("keydown",p),(x=m==null?void 0:m.focus)==null||x.call(m)}},[s]),c.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto p-4 md:p-6",children:[c.jsx("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>s(-1),"aria-label":"Close modal",tabIndex:-1}),c.jsx("div",{className:"relative z-10 flex min-h-full items-start justify-center",children:c.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,className:"surface-panel flex max-h-[calc(100vh-2rem)] w-full max-w-2xl flex-col overflow-hidden p-6 outline-none md:max-h-[calc(100vh-3rem)] md:p-8",children:[c.jsxs("div",{className:"mb-6 flex shrink-0 items-start justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:t}),a?c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:a}):null]}),c.jsx("button",{ref:u,type:"button",onClick:()=>s(-1),className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border border-[var(--border-strong)] text-[var(--text-muted)] transition hover:text-[var(--text)]","aria-label":"Close modal",children:c.jsx(cR,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:l})]})})]})}function $l({className:t="",children:a,...l}){return c.jsx("div",{className:`sticky bottom-0 mt-2 flex justify-end gap-3 border-t border-[var(--border)] bg-[var(--surface)] px-1 pt-4 pb-1 backdrop-blur-xl ${t}`,...l,children:a})}function lt({label:t,children:a}){return c.jsxs("label",{className:"grid gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-[var(--text-muted)]",children:t}),a]})}function mn(t){return c.jsx("textarea",{className:"field-control field-textarea",...t})}function vD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var o;return(o=l.current)==null?void 0:o.requestSubmit()},[]);return An("submit",s,{allowInEditable:!0}),c.jsx(Hl,{title:"Create feature",description:"Top-level container for phases and tasks.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Feature name",children:c.jsx(ma,{name:"name",placeholder:"Products page implementation",required:!0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",placeholder:"Short context for the feature"})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create feature"})})]})})}function yD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var f;return(f=l.current)==null?void 0:f.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const u=ms("feature-detail").feature;return c.jsx(Hl,{title:"Edit feature",description:"Update metadata, planning notes and timeline.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Name",children:c.jsx(ma,{name:"name",defaultValue:u.name,required:!0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",defaultValue:u.description})}),c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsx(lt,{label:"Start date",children:c.jsx(ma,{type:"date",name:"startDate",defaultValue:u.startDate})}),c.jsx(lt,{label:"End date",children:c.jsx(ma,{type:"date",name:"endDate",defaultValue:u.endDate})})]}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:u.status,children:rd.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))})}),c.jsx(lt,{label:"Priority",children:c.jsx(ma,{type:"number",name:"priority",defaultValue:u.priority??0,min:0})}),c.jsx(ua,{title:"Planning notes",subtitle:"Optional agent-maintained notes for progress tracking.",defaultOpen:!1,className:"mt-0",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsx(lt,{label:"Work done",children:c.jsx(mn,{name:"workDone",defaultValue:u.workDone})}),c.jsx(lt,{label:"Work remaining",children:c.jsx(mn,{name:"workRemaining",defaultValue:u.workRemaining})})]})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save feature"})})]})})}function xD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var o;return(o=l.current)==null?void 0:o.requestSubmit()},[]);return An("submit",s,{allowInEditable:!0}),c.jsx(Hl,{title:"Create phase",description:"A phase belongs to the current feature.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Phase title",children:c.jsx(ma,{name:"title",placeholder:"API creation",required:!0})}),c.jsx(lt,{label:"Summary",children:c.jsx(mn,{name:"summary",placeholder:"Brief phase summary"})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",placeholder:"Initial implementation notes"})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create phase"})})]})})}function ni(t){return t.join(`
289
+ `)}function bD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var f;return(f=l.current)==null?void 0:f.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const u=ms("phase-detail").phase;return c.jsx(Hl,{title:"Edit phase",description:"Update scope, constraints and delivery criteria.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Title",children:c.jsx(ma,{name:"title",defaultValue:u.title,required:!0})}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:u.status,children:ld.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))})}),c.jsx(lt,{label:"Priority",children:c.jsx(ma,{type:"number",name:"priority",defaultValue:u.priority??0,min:0})}),c.jsx(lt,{label:"Summary",children:c.jsx(mn,{name:"summary",defaultValue:u.summary})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",defaultValue:u.description})}),c.jsx(lt,{label:"Goals (one per line)",children:c.jsx(mn,{name:"goals",defaultValue:ni(u.goals)})}),c.jsx(lt,{label:"Non-goals (one per line)",children:c.jsx(mn,{name:"nonGoals",defaultValue:ni(u.nonGoals)})}),c.jsx(lt,{label:"Dependencies (one per line)",children:c.jsx(mn,{name:"dependencies",defaultValue:ni(u.dependencies)})}),c.jsx(lt,{label:"Risks (one per line)",children:c.jsx(mn,{name:"risks",defaultValue:ni(u.risks)})}),c.jsx(lt,{label:"Open questions (one per line)",children:c.jsx(mn,{name:"openQuestions",defaultValue:ni(u.openQuestions)})}),c.jsx(lt,{label:"Completion criteria (one per line)",children:c.jsx(mn,{name:"completionCriteria",defaultValue:ni(u.completionCriteria)})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save phase"})})]})})}function SD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var o;return(o=l.current)==null?void 0:o.requestSubmit()},[]);return An("submit",s,{allowInEditable:!0}),c.jsx(Hl,{title:"Create task",description:"A task belongs to the current phase.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Task title",children:c.jsx(ma,{name:"title",placeholder:"Custom fetcher integration",required:!0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",placeholder:"Initial task context"})}),c.jsx(lt,{label:"Checklist (one per line)",children:c.jsx(mn,{name:"checklist",placeholder:`Step one
290
+ Step two
291
+ Step three`})}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:"planned",children:Qo.map(o=>c.jsx("option",{value:o.value,children:o.label},o.value))})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create task"})})]})})}function wD(t){return t.map(a=>a.title).join(`
292
+ `)}function ED(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var f;return(f=l.current)==null?void 0:f.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const u=ms("task-detail").task;return c.jsx(Hl,{title:"Edit task",description:"Update execution details and checklist items.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Title",children:c.jsx(ma,{name:"title",defaultValue:u.title,required:!0})}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:u.status,children:Qo.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))})}),c.jsx(lt,{label:"Priority",children:c.jsx(ma,{type:"number",name:"priority",defaultValue:u.priority??0,min:0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",defaultValue:u.description})}),c.jsx(lt,{label:"Checklist (one per line)",children:c.jsx(mn,{name:"checklist",defaultValue:wD(u.checklist)})}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save task"})})]})})}function ND(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var u;return(u=l.current)==null?void 0:u.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const{project:o}=ms("root");return c.jsxs("div",{className:"grid gap-8",children:[c.jsxs(Ye,{to:"/",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[c.jsx(Fc,{className:"h-4 w-4"})," Back to dashboard"]}),c.jsxs(Pt,{className:"grid gap-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:"Edit project overview"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Update the short dashboard summary and the longer project goal without changing the rest of the project metadata."})]}),c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Project name",children:c.jsx(ma,{name:"name",defaultValue:o.name,placeholder:"Project name",required:!0})}),c.jsx(lt,{label:"Short description",children:c.jsx(mn,{name:"description",defaultValue:o.description,placeholder:"Summarize the project in a few lines for the dashboard overview"})}),c.jsx(lt,{label:"Project goal",children:c.jsx(mn,{name:"goal",defaultValue:o.goal,placeholder:"Define the main objective, success criteria, and overall direction of the project"})}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx(Ye,{to:"/",children:c.jsx(gt,{type:"button",variant:"ghost",children:"Cancel"})}),c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save project overview"})]})]})]})]})}function RD(t){return`P${String(t.number??0).padStart(3,"0")}`}function Y0({phases:t,selectedIds:a=[]}){const l=new Set(a);return c.jsx(lt,{label:"Linked phases",children:t.length===0?c.jsx("div",{className:"rounded-[14px] border border-dashed border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3 text-sm text-[var(--text-muted)]",children:"No phases available yet. Create phases first if you want to link this requirement to delivery work."}):c.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-[var(--border)] bg-[var(--surface-elevated)] p-3",children:[c.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Select the phases that directly implement or track this requirement."}),c.jsx("div",{className:"grid gap-2 max-h-[32dvh] overflow-y-auto pr-1",children:t.map(s=>c.jsxs("label",{className:"flex items-start gap-3 rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-3 py-2 text-sm text-[var(--text)] transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[c.jsx("input",{type:"checkbox",name:"linkedPhaseIds",value:s.id,defaultChecked:l.has(s.id),className:"mt-0.5 h-4 w-4 shrink-0 accent-[var(--accent)]"}),c.jsxs("span",{className:"min-w-0",children:[c.jsxs("span",{className:"block font-semibold",children:[RD(s)," — ",s.title]}),s.summary?c.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-muted)]",children:s.summary}):null]})]},s.id))})]})})}function jD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var u;return(u=l.current)==null?void 0:u.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const{phases:o}=ms("requirements");return c.jsx(Hl,{title:"Create requirement",description:"Capture a top-level outcome that phases can implement and track.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Requirement title",children:c.jsx(ma,{name:"title",placeholder:"Self-hosted Claude Code plugin marketplace distribution",required:!0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",placeholder:"Describe the user/business outcome this requirement represents"})}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:"planned",children:O0.map(u=>c.jsx("option",{value:u.value,children:u.label},u.value))})}),c.jsx(Y0,{phases:o}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create requirement"})})]})})}function TD(){const a=kr().state!=="idle",l=v.useRef(null),s=v.useCallback(()=>{var p;return(p=l.current)==null?void 0:p.requestSubmit()},[]);An("submit",s,{allowInEditable:!0});const{requirementId:o}=rE(),{phases:u,requirements:f}=ms("requirements"),m=f.find(p=>p.id===o);return m?c.jsx(Hl,{title:"Edit requirement",description:"Update status, scope notes, and linked delivery phases.",children:c.jsxs(ca,{ref:l,method:"post",className:"grid gap-4",children:[c.jsx(lt,{label:"Requirement title",children:c.jsx(ma,{name:"title",defaultValue:m.title,required:!0})}),c.jsx(lt,{label:"Description",children:c.jsx(mn,{name:"description",defaultValue:m.description})}),c.jsx(lt,{label:"Status",children:c.jsx(ys,{name:"status",defaultValue:m.status,children:O0.map(p=>c.jsx("option",{value:p.value,children:p.label},p.value))})}),c.jsx(Y0,{phases:u,selectedIds:m.linkedPhaseIds}),c.jsx("div",{className:"rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3 text-sm text-[var(--text-muted)]",children:"Macro tasks are preserved automatically on save. This screen does not edit the nested macro-task list yet."}),c.jsx($l,{children:c.jsx(gt,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save requirement"})})]})}):null}function Jn(t,a){const l=t.get(a);if(typeof l!="string"||l.trim()==="")throw new Response(`Missing field: ${a}`,{status:400});return l.trim()}function Bn(t,a){const l=t.get(a);return typeof l=="string"?l.trim():""}function Ym(t,a){const l=t.get(a);if(typeof l!="string")return 0;const s=l.trim();if(s==="")return 0;const o=Number(s);return Number.isFinite(o)?o:0}function _l(t,a){return Bn(t,a).split(`
293
+ `).map(l=>l.trim()).filter(Boolean)}function sn(t,a){const l=t[a];if(!l)throw new Response(`Missing route param: ${a}`,{status:400});return l}async function CD({request:t}){const a=await t.formData();return await gR({name:Jn(a,"name"),description:Bn(a,"description")}),Ua("/features")}async function DD({request:t,params:a}){const l=sn(a,"featureId"),s=await Vo(l),o=await t.formData();return await Fb({...s,name:Jn(o,"name"),description:Bn(o,"description"),startDate:Bn(o,"startDate"),endDate:Bn(o,"endDate"),status:Jn(o,"status"),priority:Ym(o,"priority"),workDone:Bn(o,"workDone"),workRemaining:Bn(o,"workRemaining")}),Ua(`/features/${l}`)}async function AD({params:t}){return await vR(sn(t,"featureId")),Ua("/features")}async function kD({request:t,params:a}){const l=sn(a,"featureId"),s=await Vo(l),o=await t.formData();return await Fb({...s,status:Jn(o,"status")}),null}async function OD({request:t,params:a}){const l=sn(a,"featureId"),s=await t.formData();return await SR({featureId:l,title:Jn(s,"title"),summary:Bn(s,"summary"),description:Bn(s,"description")}),Ua(`/features/${l}`)}async function MD({request:t,params:a}){const l=sn(a,"featureId"),s=sn(a,"phaseId"),o=await Zc(s),u=await t.formData();return await Pb({...o,title:Jn(u,"title"),status:Jn(u,"status"),priority:Ym(u,"priority"),summary:Bn(u,"summary"),description:Bn(u,"description"),goals:_l(u,"goals"),nonGoals:_l(u,"nonGoals"),dependencies:_l(u,"dependencies"),risks:_l(u,"risks"),openQuestions:_l(u,"openQuestions"),completionCriteria:_l(u,"completionCriteria")}),Ua(`/features/${l}/phases/${s}`)}async function _D({params:t}){const a=sn(t,"featureId"),l=sn(t,"phaseId");return await wR(l),Ua(`/features/${a}`)}async function LD({request:t,params:a}){const l=sn(a,"phaseId"),s=await Zc(l),o=await t.formData();return await Pb({...s,status:Jn(o,"status")}),null}async function zD({request:t,params:a}){const l=sn(a,"featureId"),s=sn(a,"phaseId"),o=await t.formData(),u=_l(o,"checklist");return await ER(s,{title:Jn(o,"title"),description:Bn(o,"description"),status:Bn(o,"status")||"planned",...u.length?{checklist:u}:{}}),Ua(`/features/${l}/phases/${s}`)}function UD(t,a){const l=new Map(t.map(o=>[o.id,o])),s=new Map(t.map(o=>[o.title.trim().toLowerCase(),o]));return a.map((o,u)=>{var p;const f=o.trim().toLowerCase(),m=l.get(((p=t[u])==null?void 0:p.id)??"")??s.get(f);return m?{...m,number:u+1,title:o.trim()}:{id:`check-${u+1}-${f.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}`,number:u+1,title:o.trim(),checked:!1}})}async function BD({request:t,params:a}){const l=sn(a,"featureId"),s=sn(a,"phaseId"),o=sn(a,"taskId"),u=await Jc(o),f=await t.formData();return await ym({...u,phaseId:s,title:Jn(f,"title"),status:Jn(f,"status"),priority:Ym(f,"priority"),description:Bn(f,"description"),checklist:UD(u.checklist,_l(f,"checklist"))}),Ua(`/features/${l}/phases/${s}/tasks/${o}`)}async function HD({params:t}){const a=sn(t,"featureId"),l=sn(t,"phaseId"),s=sn(t,"taskId");return await NR(s),Ua(`/features/${a}/phases/${l}`)}async function $D({request:t,params:a}){const l=sn(a,"phaseId"),s=sn(a,"taskId"),o=await Jc(s),u=await t.formData();return await ym({...o,phaseId:l,status:Jn(u,"status")}),null}async function qD({request:t}){const a=await Vb(),l=await t.formData();return await mR({...a,name:Bn(l,"name")||a.name,description:Bn(l,"description"),goal:Bn(l,"goal")}),Ua("/")}async function ID({request:t}){const a=await t.formData();return await yR({id:crypto.randomUUID(),title:Jn(a,"title"),description:Bn(a,"description"),status:Jn(a,"status"),linkedPhaseIds:a.getAll("linkedPhaseIds").filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean)}),Ua("/requirements")}async function VD({request:t,params:a}){const l=sn(a,"requirementId"),s=(await vm()).find(u=>u.id===l);if(!s)throw new Response(`Requirement not found: ${l}`,{status:404});const o=await t.formData();return await xR({...s,title:Jn(o,"title"),description:Bn(o,"description"),status:Jn(o,"status"),linkedPhaseIds:o.getAll("linkedPhaseIds").filter(u=>typeof u=="string").map(u=>u.trim()).filter(Boolean)}),Ua("/requirements")}async function YD({params:t}){return await bR(sn(t,"requirementId")),Ua("/requirements")}function FD(t){if(!t)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}}async function PD(){return{handoffs:await Yh()}}function GD(){const{handoffs:t}=ll(),[a,l]=v.useState(t),[s,o]=v.useState(null),[u,f]=v.useState(""),m=fr();async function p(g){if(!(s||!window.confirm(`Clear handoff for ${g.compositeRef}?`))){o(g.phaseId),f("");try{await Xb(g.phaseId),l(y=>y.filter(N=>N.phaseId!==g.phaseId)),Yh().then(l).catch(()=>{})}catch(y){const N=y instanceof Error?y.message:String(y);f(N||`Failed to clear handoff for ${g.compositeRef}.`)}finally{o(null)}}}return v.useEffect(()=>{const g=x=>{const y=x.detail;((y==null?void 0:y.type)==="handoffUpdated"||(y==null?void 0:y.type)==="handoffCleared")&&Yh().then(l).catch(()=>{})};return window.addEventListener("agent-plan:ws-event",g),()=>window.removeEventListener("agent-plan:ws-event",g)},[]),v.useEffect(()=>{if(!m.hash)return;const g=m.hash.slice(1),x=document.getElementById(g);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},[m.hash,a]),a.length===0?c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[c.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),c.jsx(Ye,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Pending entity-scoped handoffs on non-completed phases."})]}),u?c.jsx("p",{className:"rounded-[12px] border border-[var(--danger-soft)] bg-[var(--danger-soft)]/50 px-3 py-2 text-sm text-[var(--color-status-blocked)]",children:u}):null,c.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No pending phase handoffs."})]}):c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[c.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),c.jsx(Ye,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),c.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Pending entity-scoped handoffs on non-completed phases. ",a.length," pending."]})]}),u?c.jsx("p",{className:"rounded-[12px] border border-[var(--danger-soft)] bg-[var(--danger-soft)]/50 px-3 py-2 text-sm text-[var(--color-status-blocked)]",children:u}):null,a.map(g=>c.jsx("section",{id:g.phaseId,className:"scroll-mt-20",children:c.jsx(Pt,{className:"overflow-hidden p-0",children:c.jsx(ua,{defaultOpen:!1,title:c.jsxs(c.Fragment,{children:[c.jsx(Or,{id:g.compositeRef,children:g.compositeRef}),c.jsxs("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:["Updated ",FD(g.updatedAt)]})]}),subtitle:g.firstLine||"Empty handoff content.",summaryClassName:"hover:bg-[var(--surface-hover)]/60 focus-visible:bg-[var(--surface-hover)]/60",actions:c.jsxs(c.Fragment,{children:[c.jsx(gt,{type:"button",variant:"danger",className:"min-h-8 px-2.5 py-1 text-xs sm:min-h-9",disabled:s===g.phaseId,onClick:x=>{x.preventDefault(),x.stopPropagation(),p(g)},children:s===g.phaseId?"Clearing…":"Clear"}),c.jsx(Ye,{to:g.featureId?`/features/${g.featureId}/phases/${g.phaseId}`:"/features",className:"text-xs text-[var(--text-muted)] underline-offset-2 hover:text-[var(--text)] hover:underline",onClick:x=>x.stopPropagation(),children:g.featureId?"Open phase →":"Browse features →"})]}),contentClassName:"px-5 py-5",children:g.firstLine?c.jsx(xn,{text:g.content,className:"formatted-text max-w-none"}):c.jsx("p",{className:"text-sm italic text-[var(--text-muted)]",children:"Empty handoff content."})})})},g.phaseId))]})}function XD(t){if(!t)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}}async function QD(){return{archived:await RR()}}function KD(){const{archived:t}=ll();return t.length===0?c.jsxs(Pt,{className:"grid gap-4",children:[c.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),c.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Completed, superseded, and manually cleared handoffs."})]}),c.jsx(Ye,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),c.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No archived handoffs."})]}):c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),c.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:[t.length," archived entries. These are history, not pending resume context."]})]}),c.jsx(Ye,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),t.map(a=>c.jsx(Pt,{className:"overflow-hidden p-0",children:c.jsxs(ua,{defaultOpen:!1,title:c.jsxs(c.Fragment,{children:[c.jsx(Or,{id:a.compositeRef,children:a.compositeRef}),c.jsxs("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:["Archived ",XD(a.archivedAt)]})]}),subtitle:a.firstLine||"Empty archived handoff.",contentClassName:"px-5 py-5",children:[c.jsxs("div",{className:"mb-3 flex flex-wrap gap-2 text-xs text-[var(--text-muted)]",children:[c.jsxs("span",{children:["Reason: ",a.reason||"unknown"]}),c.jsxs("span",{className:"break-all",children:["File: ",a.file]})]}),c.jsx(xn,{text:a.content||"(archive file unavailable)",className:"formatted-text max-w-none"})]})},`${a.phaseId}:${a.file}`))]})}async function ZD({request:t,params:a}){sn(a,"featureId");const l=sn(a,"phaseId"),s=sn(a,"taskId"),o=sn(a,"itemId"),u=await t.formData(),f=Jn(u,"checked")==="true",m=await Jc(s);return await ym({...m,phaseId:l,checklist:m.checklist.map(p=>p.id===o?{...p,checked:f}:p)}),Response.json({ok:!0,taskId:s,itemId:o,checked:f})}const JD=QE([{id:"root",path:"/",loader:ZR,element:c.jsx(JR,{}),errorElement:c.jsx(WR,{}),children:[{index:!0,loader:e2,element:c.jsx($C,{})},{path:"features",id:"features",loader:qC,element:c.jsx(GC,{}),children:[{path:"new",element:c.jsx(vD,{}),action:CD}]},{path:"features/:featureId",id:"feature-detail",loader:JC,element:c.jsx(oD,{}),children:[{path:"edit",element:c.jsx(yD,{}),action:DD},{path:"phases/new",element:c.jsx(xD,{}),action:OD}]},{path:"requirements",id:"requirements",loader:XC,element:c.jsx(ZC,{}),children:[{path:"new",element:c.jsx(jD,{}),action:ID},{path:":requirementId/edit",element:c.jsx(TD,{}),action:VD}]},{path:"project/edit",element:c.jsx(ND,{}),action:qD},{path:"handoff",loader:PD,element:c.jsx(GD,{})},{path:"handoff/archive",loader:QD,element:c.jsx(KD,{})},{path:"features/:featureId/delete",action:AD},{path:"requirements/:requirementId/delete",action:YD},{path:"features/:featureId/status",action:kD},{path:"features/:featureId/phases/:phaseId",id:"phase-detail",loader:uD,element:c.jsx(fD,{}),children:[{path:"edit",element:c.jsx(bD,{}),action:MD},{path:"tasks/new",element:c.jsx(SD,{}),action:zD}]},{path:"features/:featureId/phases/:phaseId/delete",action:_D},{path:"features/:featureId/phases/:phaseId/status",action:LD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId",id:"task-detail",loader:hD,element:c.jsx(pD,{}),children:[{path:"edit",element:c.jsx(ED,{}),action:BD}]},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/delete",action:HD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/status",action:$D},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/checklist/:itemId/toggle",action:ZD}]}]),F0=document.getElementById("root");if(!F0)throw new Error("#root not found");BS.createRoot(F0).render(c.jsx(v.StrictMode,{children:c.jsx(rN,{router:JD})}));