@agent-plan/server 0.2.25 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,318 +0,0 @@
1
- var iS=Object.defineProperty;var oS=(e,n,r)=>n in e?iS(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ma=(e,n,r)=>oS(e,typeof n!="symbol"?n+"":n,r);function cS(e,n){for(var r=0;r<n.length;r++){const s=n[r];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in e)){const c=Object.getOwnPropertyDescriptor(s,u);c&&Object.defineProperty(e,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const c of u)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function r(u){const c={};return u.integrity&&(c.integrity=u.integrity),u.referrerPolicy&&(c.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?c.credentials="include":u.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(u){if(u.ep)return;u.ep=!0;const c=r(u);fetch(u.href,c)}})();function uS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rh={exports:{}},vo={};/**
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 $x;function dS(){if($x)return vo;$x=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,u,c){var f=null;if(c!==void 0&&(f=""+c),u.key!==void 0&&(f=""+u.key),"key"in u){c={};for(var h in u)h!=="key"&&(c[h]=u[h])}else c=u;return u=c.ref,{$$typeof:e,type:s,key:f,ref:u!==void 0?u:null,props:c}}return vo.Fragment=n,vo.jsx=r,vo.jsxs=r,vo}var Bx;function fS(){return Bx||(Bx=1,Rh.exports=dS()),Rh.exports}var o=fS(),kh={exports:{}},at={};/**
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 Hx;function hS(){if(Hx)return at;Hx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),E=Symbol.iterator;function S(C){return C===null||typeof C!="object"?null:(C=E&&C[E]||C["@@iterator"],typeof C=="function"?C:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,R={};function z(C,B,K){this.props=C,this.context=B,this.refs=R,this.updater=K||w}z.prototype.isReactComponent={},z.prototype.setState=function(C,B){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,B,"setState")},z.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function I(){}I.prototype=z.prototype;function $(C,B,K){this.props=C,this.context=B,this.refs=R,this.updater=K||w}var Q=$.prototype=new I;Q.constructor=$,j(Q,z.prototype),Q.isPureReactComponent=!0;var J=Array.isArray;function ne(){}var M={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function fe(C,B,K){var ue=K.ref;return{$$typeof:e,type:C,key:B,ref:ue!==void 0?ue:null,props:K}}function pe(C,B){return fe(C.type,B,C.props)}function we(C){return typeof C=="object"&&C!==null&&C.$$typeof===e}function re(C){var B={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(K){return B[K]})}var je=/\/+/g;function Te(C,B){return typeof C=="object"&&C!==null&&C.key!=null?re(""+C.key):B.toString(36)}function ee(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(ne,ne):(C.status="pending",C.then(function(B){C.status==="pending"&&(C.status="fulfilled",C.value=B)},function(B){C.status==="pending"&&(C.status="rejected",C.reason=B)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function L(C,B,K,ue,ge){var ve=typeof C;(ve==="undefined"||ve==="boolean")&&(C=null);var Re=!1;if(C===null)Re=!0;else switch(ve){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(C.$$typeof){case e:case n:Re=!0;break;case y:return Re=C._init,L(Re(C._payload),B,K,ue,ge)}}if(Re)return ge=ge(C),Re=ue===""?"."+Te(C,0):ue,J(ge)?(K="",Re!=null&&(K=Re.replace(je,"$&/")+"/"),L(ge,B,K,"",function(Qe){return Qe})):ge!=null&&(we(ge)&&(ge=pe(ge,K+(ge.key==null||C&&C.key===ge.key?"":(""+ge.key).replace(je,"$&/")+"/")+Re)),B.push(ge)),1;Re=0;var He=ue===""?".":ue+":";if(J(C))for(var $e=0;$e<C.length;$e++)ue=C[$e],ve=He+Te(ue,$e),Re+=L(ue,B,K,ve,ge);else if($e=S(C),typeof $e=="function")for(C=$e.call(C),$e=0;!(ue=C.next()).done;)ue=ue.value,ve=He+Te(ue,$e++),Re+=L(ue,B,K,ve,ge);else if(ve==="object"){if(typeof C.then=="function")return L(ee(C),B,K,ue,ge);throw B=String(C),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return Re}function F(C,B,K){if(C==null)return C;var ue=[],ge=0;return L(C,ue,"","",function(ve){return B.call(K,ve,ge++)}),ue}function he(C){if(C._status===-1){var B=C._result;B=B(),B.then(function(K){(C._status===0||C._status===-1)&&(C._status=1,C._result=K)},function(K){(C._status===0||C._status===-1)&&(C._status=2,C._result=K)}),C._status===-1&&(C._status=0,C._result=B)}if(C._status===1)return C._result.default;throw C._result}var P=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=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(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},se={map:F,forEach:function(C,B,K){F(C,function(){B.apply(this,arguments)},K)},count:function(C){var B=0;return F(C,function(){B++}),B},toArray:function(C){return F(C,function(B){return B})||[]},only:function(C){if(!we(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return at.Activity=x,at.Children=se,at.Component=z,at.Fragment=r,at.Profiler=u,at.PureComponent=$,at.StrictMode=s,at.Suspense=p,at.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,at.__COMPILER_RUNTIME={__proto__:null,c:function(C){return M.H.useMemoCache(C)}},at.cache=function(C){return function(){return C.apply(null,arguments)}},at.cacheSignal=function(){return null},at.cloneElement=function(C,B,K){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var ue=j({},C.props),ge=C.key;if(B!=null)for(ve in B.key!==void 0&&(ge=""+B.key),B)!T.call(B,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&B.ref===void 0||(ue[ve]=B[ve]);var ve=arguments.length-2;if(ve===1)ue.children=K;else if(1<ve){for(var Re=Array(ve),He=0;He<ve;He++)Re[He]=arguments[He+2];ue.children=Re}return fe(C.type,ge,ue)},at.createContext=function(C){return C={$$typeof:f,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:c,_context:C},C},at.createElement=function(C,B,K){var ue,ge={},ve=null;if(B!=null)for(ue in B.key!==void 0&&(ve=""+B.key),B)T.call(B,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(ge[ue]=B[ue]);var Re=arguments.length-2;if(Re===1)ge.children=K;else if(1<Re){for(var He=Array(Re),$e=0;$e<Re;$e++)He[$e]=arguments[$e+2];ge.children=He}if(C&&C.defaultProps)for(ue in Re=C.defaultProps,Re)ge[ue]===void 0&&(ge[ue]=Re[ue]);return fe(C,ve,ge)},at.createRef=function(){return{current:null}},at.forwardRef=function(C){return{$$typeof:h,render:C}},at.isValidElement=we,at.lazy=function(C){return{$$typeof:y,_payload:{_status:-1,_result:C},_init:he}},at.memo=function(C,B){return{$$typeof:g,type:C,compare:B===void 0?null:B}},at.startTransition=function(C){var B=M.T,K={};M.T=K;try{var ue=C(),ge=M.S;ge!==null&&ge(K,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(ne,P)}catch(ve){P(ve)}finally{B!==null&&K.types!==null&&(B.types=K.types),M.T=B}},at.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},at.use=function(C){return M.H.use(C)},at.useActionState=function(C,B,K){return M.H.useActionState(C,B,K)},at.useCallback=function(C,B){return M.H.useCallback(C,B)},at.useContext=function(C){return M.H.useContext(C)},at.useDebugValue=function(){},at.useDeferredValue=function(C,B){return M.H.useDeferredValue(C,B)},at.useEffect=function(C,B){return M.H.useEffect(C,B)},at.useEffectEvent=function(C){return M.H.useEffectEvent(C)},at.useId=function(){return M.H.useId()},at.useImperativeHandle=function(C,B,K){return M.H.useImperativeHandle(C,B,K)},at.useInsertionEffect=function(C,B){return M.H.useInsertionEffect(C,B)},at.useLayoutEffect=function(C,B){return M.H.useLayoutEffect(C,B)},at.useMemo=function(C,B){return M.H.useMemo(C,B)},at.useOptimistic=function(C,B){return M.H.useOptimistic(C,B)},at.useReducer=function(C,B,K){return M.H.useReducer(C,B,K)},at.useRef=function(C){return M.H.useRef(C)},at.useState=function(C){return M.H.useState(C)},at.useSyncExternalStore=function(C,B,K){return M.H.useSyncExternalStore(C,B,K)},at.useTransition=function(){return M.H.useTransition()},at.version="19.2.7",at}var Ix;function ym(){return Ix||(Ix=1,kh.exports=hS()),kh.exports}var v=ym();const ca=uS(v),mS=cS({__proto__:null,default:ca},[v]);var Th={exports:{}},xo={},Ch={exports:{}},Ah={};/**
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 qx;function pS(){return qx||(qx=1,(function(e){function n(L,F){var he=L.length;L.push(F);e:for(;0<he;){var P=he-1>>>1,se=L[P];if(0<u(se,F))L[P]=F,L[he]=se,he=P;else break e}}function r(L){return L.length===0?null:L[0]}function s(L){if(L.length===0)return null;var F=L[0],he=L.pop();if(he!==F){L[0]=he;e:for(var P=0,se=L.length,C=se>>>1;P<C;){var B=2*(P+1)-1,K=L[B],ue=B+1,ge=L[ue];if(0>u(K,he))ue<se&&0>u(ge,K)?(L[P]=ge,L[ue]=he,P=ue):(L[P]=K,L[B]=he,P=B);else if(ue<se&&0>u(ge,he))L[P]=ge,L[ue]=he,P=ue;else break e}}return F}function u(L,F){var he=L.sortIndex-F.sortIndex;return he!==0?he:L.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var f=Date,h=f.now();e.unstable_now=function(){return f.now()-h}}var p=[],g=[],y=1,x=null,E=3,S=!1,w=!1,j=!1,R=!1,z=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function Q(L){for(var F=r(g);F!==null;){if(F.callback===null)s(g);else if(F.startTime<=L)s(g),F.sortIndex=F.expirationTime,n(p,F);else break;F=r(g)}}function J(L){if(j=!1,Q(L),!w)if(r(p)!==null)w=!0,ne||(ne=!0,re());else{var F=r(g);F!==null&&ee(J,F.startTime-L)}}var ne=!1,M=-1,T=5,fe=-1;function pe(){return R?!0:!(e.unstable_now()-fe<T)}function we(){if(R=!1,ne){var L=e.unstable_now();fe=L;var F=!0;try{e:{w=!1,j&&(j=!1,I(M),M=-1),S=!0;var he=E;try{t:{for(Q(L),x=r(p);x!==null&&!(x.expirationTime>L&&pe());){var P=x.callback;if(typeof P=="function"){x.callback=null,E=x.priorityLevel;var se=P(x.expirationTime<=L);if(L=e.unstable_now(),typeof se=="function"){x.callback=se,Q(L),F=!0;break t}x===r(p)&&s(p),Q(L)}else s(p);x=r(p)}if(x!==null)F=!0;else{var C=r(g);C!==null&&ee(J,C.startTime-L),F=!1}}break e}finally{x=null,E=he,S=!1}F=void 0}}finally{F?re():ne=!1}}}var re;if(typeof $=="function")re=function(){$(we)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,Te=je.port2;je.port1.onmessage=we,re=function(){Te.postMessage(null)}}else re=function(){z(we,0)};function ee(L,F){M=z(function(){L(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return E},e.unstable_next=function(L){switch(E){case 1:case 2:case 3:var F=3;break;default:F=E}var he=E;E=F;try{return L()}finally{E=he}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(L,F){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var he=E;E=L;try{return F()}finally{E=he}},e.unstable_scheduleCallback=function(L,F,he){var P=e.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?P+he:P):he=P,L){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=he+se,L={id:y++,callback:F,priorityLevel:L,startTime:he,expirationTime:se,sortIndex:-1},he>P?(L.sortIndex=he,n(g,L),r(p)===null&&L===r(g)&&(j?(I(M),M=-1):j=!0,ee(J,he-P))):(L.sortIndex=se,n(p,L),w||S||(w=!0,ne||(ne=!0,re()))),L},e.unstable_shouldYield=pe,e.unstable_wrapCallback=function(L){var F=E;return function(){var he=E;E=F;try{return L.apply(this,arguments)}finally{E=he}}}})(Ah)),Ah}var Px;function gS(){return Px||(Px=1,Ch.exports=pS()),Ch.exports}var Dh={exports:{}},sn={};/**
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 Fx;function vS(){if(Fx)return sn;Fx=1;var e=ym();function n(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)g+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},u=Symbol.for("react.portal");function c(p,g,y){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:x==null?null:""+x,children:p,containerInfo:g,implementation:y}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return sn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,sn.createPortal=function(p,g){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(n(299));return c(p,g,null,y)},sn.flushSync=function(p){var g=f.T,y=s.p;try{if(f.T=null,s.p=2,p)return p()}finally{f.T=g,s.p=y,s.d.f()}},sn.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))},sn.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},sn.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var y=g.as,x=h(y,g.crossOrigin),E=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;y==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:x,integrity:E,fetchPriority:S}):y==="script"&&s.d.X(p,{crossOrigin:x,integrity:E,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},sn.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var y=h(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:y,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)},sn.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var y=g.as,x=h(y,g.crossOrigin);s.d.L(p,y,{crossOrigin:x,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})}},sn.preloadModule=function(p,g){if(typeof p=="string")if(g){var y=h(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},sn.requestFormReset=function(p){s.d.r(p)},sn.unstable_batchedUpdates=function(p,g){return p(g)},sn.useFormState=function(p,g,y){return f.H.useFormState(p,g,y)},sn.useFormStatus=function(){return f.H.useHostTransitionStatus()},sn.version="19.2.7",sn}var Vx;function vb(){if(Vx)return Dh.exports;Vx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Dh.exports=vS(),Dh.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 Yx;function xS(){if(Yx)return xo;Yx=1;var e=gS(),n=ym(),r=vb();function s(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,l=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(l=a.return),t=a.return;while(t)}return a.tag===3?l:null}function f(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function h(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(s(188))}function g(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(s(188));return a!==t?null:t}for(var l=t,i=a;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(i=d.return,i!==null){l=i;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return p(d),t;if(m===i)return p(d),a;m=m.sibling}throw Error(s(188))}if(l.return!==i.return)l=d,i=m;else{for(var b=!1,N=d.child;N;){if(N===l){b=!0,l=d,i=m;break}if(N===i){b=!0,i=d,l=m;break}N=N.sibling}if(!b){for(N=m.child;N;){if(N===l){b=!0,l=m,i=d;break}if(N===i){b=!0,i=m,l=d;break}N=N.sibling}if(!b)throw Error(s(189))}}if(l.alternate!==i)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?t:a}function y(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=y(t),a!==null)return a;t=t.sibling}return null}var x=Object.assign,E=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),$=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),we=Symbol.iterator;function re(t){return t===null||typeof t!="object"?null:(t=we&&t[we]||t["@@iterator"],typeof t=="function"?t:null)}var je=Symbol.for("react.client.reference");function Te(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case z:return"Profiler";case R:return"StrictMode";case J:return"Suspense";case ne:return"SuspenseList";case fe:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case $:return t.displayName||"Context";case I:return(t._context.displayName||"Context")+".Consumer";case Q:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case M:return a=t.displayName||null,a!==null?a:Te(t.type)||"Memo";case T:a=t._payload,t=t._init;try{return Te(t(a))}catch{}}return null}var ee=Array.isArray,L=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},P=[],se=-1;function C(t){return{current:t}}function B(t){0>se||(t.current=P[se],P[se]=null,se--)}function K(t,a){se++,P[se]=t.current,t.current=a}var ue=C(null),ge=C(null),ve=C(null),Re=C(null);function He(t,a){switch(K(ve,a),K(ge,t),K(ue,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?ix(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=ix(a),t=ox(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}B(ue),K(ue,t)}function $e(){B(ue),B(ge),B(ve)}function Qe(t){t.memoizedState!==null&&K(Re,t);var a=ue.current,l=ox(a,t.type);a!==l&&(K(ge,t),K(ue,l))}function ia(t){ge.current===t&&(B(ue),B(ge)),Re.current===t&&(B(Re),ho._currentValue=he)}var $t,mt;function ce(t){if($t===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);$t=a&&a[1]||"",mt=-1<l.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+$t+t+mt}var qe=!1;function rt(t,a){if(!t||qe)return"";qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(a){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Z){var X=Z}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(Z){X=Z}t.call(oe.prototype)}}else{try{throw Error()}catch(Z){X=Z}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Z){if(Z&&X&&typeof Z.stack=="string")return[Z.stack,X.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 m=i.DetermineComponentFrameRoot(),b=m[0],N=m[1];if(b&&N){var D=b.split(`
44
- `),Y=N.split(`
45
- `);for(d=i=0;i<D.length&&!D[i].includes("DetermineComponentFrameRoot");)i++;for(;d<Y.length&&!Y[d].includes("DetermineComponentFrameRoot");)d++;if(i===D.length||d===Y.length)for(i=D.length-1,d=Y.length-1;1<=i&&0<=d&&D[i]!==Y[d];)d--;for(;1<=i&&0<=d;i--,d--)if(D[i]!==Y[d]){if(i!==1||d!==1)do if(i--,d--,0>d||D[i]!==Y[d]){var ae=`
46
- `+D[i].replace(" at new "," at ");return t.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",t.displayName)),ae}while(1<=i&&0<=d);break}}}finally{qe=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?ce(l):""}function Bt(t,a){switch(t.tag){case 26:case 27:case 5:return ce(t.type);case 16:return ce("Lazy");case 13:return t.child!==a&&a!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return rt(t.type,!1);case 11:return rt(t.type.render,!1);case 1:return rt(t.type,!0);case 31:return ce("Activity");default:return""}}function ga(t){try{var a="",l=null;do a+=Bt(t,l),l=t,t=t.return;while(t);return a}catch(i){return`
47
- Error generating stack: `+i.message+`
48
- `+i.stack}}var Rt=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,Kt=e.unstable_cancelCallback,$a=e.unstable_shouldYield,Ba=e.unstable_requestPaint,aa=e.unstable_now,fn=e.unstable_getCurrentPriorityLevel,hn=e.unstable_ImmediatePriority,Ja=e.unstable_UserBlockingPriority,Ha=e.unstable_NormalPriority,me=e.unstable_LowPriority,Ce=e.unstable_IdlePriority,Ae=e.log,Xe=e.unstable_setDisableYieldValue,Pe=null,te=null;function kt(t){if(typeof Ae=="function"&&Xe(t),te&&typeof te.setStrictMode=="function")try{te.setStrictMode(Pe,t)}catch{}}var Zt=Math.clz32?Math.clz32:qn,Pa=Math.log,va=Math.LN2;function qn(t){return t>>>=0,t===0?32:31-(Pa(t)/va|0)|0}var _e=256,xt=262144,yt=4194304;function St(t){var a=t&42;if(a!==0)return a;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ht(t,a,l){var i=t.pendingLanes;if(i===0)return 0;var d=0,m=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var N=i&134217727;return N!==0?(i=N&~m,i!==0?d=St(i):(b&=N,b!==0?d=St(b):l||(l=N&~t,l!==0&&(d=St(l))))):(N=i&~m,N!==0?d=St(N):b!==0?d=St(b):l||(l=i&~t,l!==0&&(d=St(l)))),d===0?0:a!==0&&a!==d&&(a&m)===0&&(m=d&-d,l=a&-a,m>=l||m===32&&(l&4194048)!==0)?a:d}function Tt(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function na(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Wt(){var t=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),t}function It(t){for(var a=[],l=0;31>l;l++)a.push(t);return a}function pt(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function et(t,a,l,i,d,m){var b=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var N=t.entanglements,D=t.expirationTimes,Y=t.hiddenUpdates;for(l=b&~l;0<l;){var ae=31-Zt(l),oe=1<<ae;N[ae]=0,D[ae]=-1;var X=Y[ae];if(X!==null)for(Y[ae]=null,ae=0;ae<X.length;ae++){var Z=X[ae];Z!==null&&(Z.lane&=-536870913)}l&=~oe}i!==0&&wa(t,i,0),m!==0&&d===0&&t.tag!==0&&(t.suspendedLanes|=m&~(b&~a))}function wa(t,a,l){t.pendingLanes|=a,t.suspendedLanes&=~a;var i=31-Zt(a);t.entangledLanes|=a,t.entanglements[i]=t.entanglements[i]|1073741824|l&261930}function Aa(t,a){var l=t.entangledLanes|=a;for(t=t.entanglements;l;){var i=31-Zt(l),d=1<<i;d&a|t[i]&a&&(t[i]|=a),l&=~d}}function A(t,a){var l=a&-a;return l=(l&42)!==0?1:_(l),(l&(t.suspendedLanes|a))!==0?0:l}function _(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function q(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function W(){var t=F.p;return t!==0?t:(t=window.event,t===void 0?32:Dx(t.type))}function ie(t,a){var l=F.p;try{return F.p=t,a()}finally{F.p=l}}var ke=Math.random().toString(36).slice(2),ye="__reactFiber$"+ke,De="__reactProps$"+ke,Ne="__reactContainer$"+ke,Le="__reactEvents$"+ke,Ue="__reactListeners$"+ke,Ke="__reactHandles$"+ke,Oe="__reactResources$"+ke,Je="__reactMarker$"+ke;function Fe(t){delete t[ye],delete t[De],delete t[Le],delete t[Ue],delete t[Ke]}function qt(t){var a=t[ye];if(a)return a;for(var l=t.parentNode;l;){if(a=l[Ne]||l[ye]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(t=px(t);t!==null;){if(l=t[ye])return l;t=px(t)}return a}t=l,l=t.parentNode}return null}function tt(t){if(t=t[ye]||t[Ne]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function dt(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(s(33))}function ot(t){var a=t[Oe];return a||(a=t[Oe]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ft(t){t[Je]=!0}var Jt=new Set,Fa={};function Sa(t,a){Da(t,a),Da(t+"Capture",a)}function Da(t,a){for(Fa[t]=a,t=0;t<a.length;t++)Jt.add(a[t])}var Oa=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]*$"),Va={},vn={};function fl(t){return Rt.call(vn,t)?!0:Rt.call(Va,t)?!1:Oa.test(t)?vn[t]=!0:(Va[t]=!0,!1)}function en(t,a,l){if(fl(a))if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var i=a.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+l)}}function vr(t,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+l)}}function Ze(t,a,l,i){if(i===null)t.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(a,l,""+i)}}function Nt(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ea(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function tn(t,a,l){var i=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,m=i.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return d.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(t,a,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Ma(t){if(!t._valueTracker){var a=ea(t)?"checked":"value";t._valueTracker=tn(t,a,""+t[a])}}function Mr(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var l=a.getValue(),i="";return t&&(i=ea(t)?t.checked?"true":"false":t.value),t=i,t!==l?(a.setValue(t),!0):!1}function jt(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Cn=/[\n"\\]/g;function Ya(t){return t.replace(Cn,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Ql(t,a,l,i,d,m,b,N){t.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?t.type=b:t.removeAttribute("type"),a!=null?b==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+Nt(a)):t.value!==""+Nt(a)&&(t.value=""+Nt(a)):b!=="submit"&&b!=="reset"||t.removeAttribute("value"),a!=null?Ct(t,b,Nt(a)):l!=null?Ct(t,b,Nt(l)):i!=null&&t.removeAttribute("value"),d==null&&m!=null&&(t.defaultChecked=!!m),d!=null&&(t.checked=d&&typeof d!="function"&&typeof d!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?t.name=""+Nt(N):t.removeAttribute("name")}function Ti(t,a,l,i,d,m,b,N){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.type=m),a!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||a!=null)){Ma(t);return}l=l!=null?""+Nt(l):"",a=a!=null?""+Nt(a):l,N||a===t.value||(t.value=a),t.defaultValue=a}i=i??d,i=typeof i!="function"&&typeof i!="symbol"&&!!i,t.checked=N?t.checked:!!i,t.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.name=b),Ma(t)}function Ct(t,a,l){a==="number"&&jt(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function xr(t,a,l,i){if(t=t.options,a){a={};for(var d=0;d<l.length;d++)a["$"+l[d]]=!0;for(l=0;l<t.length;l++)d=a.hasOwnProperty("$"+t[l].value),t[l].selected!==d&&(t[l].selected=d),d&&i&&(t[l].defaultSelected=!0)}else{for(l=""+Nt(l),a=null,d=0;d<t.length;d++){if(t[d].value===l){t[d].selected=!0,i&&(t[d].defaultSelected=!0);return}a!==null||t[d].disabled||(a=t[d])}a!==null&&(a.selected=!0)}}function cc(t,a,l){if(a!=null&&(a=""+Nt(a),a!==t.value&&(t.value=a),l==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=l!=null?""+Nt(l):""}function ir(t,a,l,i){if(a==null){if(i!=null){if(l!=null)throw Error(s(92));if(ee(i)){if(1<i.length)throw Error(s(93));i=i[0]}l=i}l==null&&(l=""),a=l}l=Nt(a),t.defaultValue=l,i=t.textContent,i===l&&i!==""&&i!==null&&(t.value=i),Ma(t)}function hl(t,a){if(a){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=a;return}}t.textContent=a}var Rd=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 Rs(t,a,l){var i=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":i?t.setProperty(a,l):typeof l!="number"||l===0||Rd.has(a)?a==="float"?t.cssFloat=l:t[a]=(""+l).trim():t[a]=l+"px"}function xn(t,a,l){if(a!=null&&typeof a!="object")throw Error(s(62));if(t=t.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||a!=null&&a.hasOwnProperty(i)||(i.indexOf("--")===0?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="");for(var d in a)i=a[d],a.hasOwnProperty(d)&&l[d]!==i&&Rs(t,d,i)}else for(var m in a)a.hasOwnProperty(m)&&Rs(t,m,a[m])}function Kl(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ks=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"]]),yn=/^[\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 ra(t){return yn.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function an(){}var An=null;function _r(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yr=null,Lr=null;function Ci(t){var a=tt(t);if(a&&(t=a.stateNode)){var l=t[De]||null;e:switch(t=a.stateNode,a.type){case"input":if(Ql(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ya(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var i=l[a];if(i!==t&&i.form===t.form){var d=i[De]||null;if(!d)throw Error(s(90));Ql(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(a=0;a<l.length;a++)i=l[a],i.form===t.form&&Mr(i)}break e;case"textarea":cc(t,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&xr(t,!!l.multiple,a,!1)}}}var br=!1;function Ai(t,a,l){if(br)return t(a,l);br=!0;try{var i=t(a);return i}finally{if(br=!1,(yr!==null||Lr!==null)&&(Kc(),yr&&(a=yr,t=Lr,Lr=yr=null,Ci(a),t)))for(a=0;a<t.length;a++)Ci(t[a])}}function Pn(t,a){var l=t.stateNode;if(l===null)return null;var i=l[De]||null;if(i===null)return null;l=i[a];e:switch(a){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)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(s(231,a,typeof l));return l}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Di=!1;if(or)try{var zr={};Object.defineProperty(zr,"passive",{get:function(){Di=!0}}),window.addEventListener("test",zr,zr),window.removeEventListener("test",zr,zr)}catch{Di=!1}var Fn=null,Oi=null,Ts=null;function uc(){if(Ts)return Ts;var t,a=Oi,l=a.length,i,d="value"in Fn?Fn.value:Fn.textContent,m=d.length;for(t=0;t<l&&a[t]===d[t];t++);var b=l-t;for(i=1;i<=b&&a[l-i]===d[m-i];i++);return Ts=d.slice(t,1<i?1-i:void 0)}function Cs(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Ur(){return!0}function dc(){return!1}function nn(t){function a(l,i,d,m,b){this._reactName=l,this._targetInst=d,this.type=i,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var N in t)t.hasOwnProperty(N)&&(l=t[N],this[N]=l?l(m):m[N]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Ur:dc,this.isPropagationStopped=dc,this}return x(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ur)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ur)},persist:function(){},isPersistent:Ur}),a}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Br=nn($r),Zl=x({},$r,{view:0,detail:0}),kd=nn(Zl),ml,Wl,Jl,Hr=x({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ln,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Jl&&(Jl&&t.type==="mousemove"?(ml=t.screenX-Jl.screenX,Wl=t.screenY-Jl.screenY):Wl=ml=0,Jl=t),ml)},movementY:function(t){return"movementY"in t?t.movementY:Wl}}),fc=nn(Hr),k=x({},Hr,{dataTransfer:0}),G=nn(k),Ee=x({},Zl,{relatedTarget:0}),be=nn(Ee),Ge=x({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),de=nn(Ge),xe=x({},$r,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Se=nn(xe),We=x({},$r,{data:0}),lt=nn(We),Be={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ea={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 rn(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Lt[t])?!!a[t]:!1}function ln(){return rn}var bn=x({},Zl,{key:function(t){if(t.key){var a=Be[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Cs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ea[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ln,charCode:function(t){return t.type==="keypress"?Cs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Cs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Na=nn(bn),ua=x({},Hr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zt=nn(ua),es=x({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ln}),wr=nn(es),Td=x({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),hc=nn(Td),mc=x({},Hr,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Cd=nn(mc),Ad=x({},$r,{newState:0,oldState:0}),T1=nn(Ad),C1=[9,13,27,32],Dd=or&&"CompositionEvent"in window,Mi=null;or&&"documentMode"in document&&(Mi=document.documentMode);var A1=or&&"TextEvent"in window&&!Mi,hp=or&&(!Dd||Mi&&8<Mi&&11>=Mi),mp=" ",pp=!1;function gp(t,a){switch(t){case"keyup":return C1.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var As=!1;function D1(t,a){switch(t){case"compositionend":return vp(a);case"keypress":return a.which!==32?null:(pp=!0,mp);case"textInput":return t=a.data,t===mp&&pp?null:t;default:return null}}function O1(t,a){if(As)return t==="compositionend"||!Dd&&gp(t,a)?(t=uc(),Ts=Oi=Fn=null,As=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return hp&&a.locale!=="ko"?null:a.data;default:return null}}var M1={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 xp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!M1[t.type]:a==="textarea"}function yp(t,a,l,i){yr?Lr?Lr.push(i):Lr=[i]:yr=i,a=nu(a,"onChange"),0<a.length&&(l=new Br("onChange","change",null,l,i),t.push({event:l,listeners:a}))}var _i=null,Li=null;function _1(t){tx(t,0)}function pc(t){var a=dt(t);if(Mr(a))return t}function bp(t,a){if(t==="change")return a}var wp=!1;if(or){var Od;if(or){var Md="oninput"in document;if(!Md){var Sp=document.createElement("div");Sp.setAttribute("oninput","return;"),Md=typeof Sp.oninput=="function"}Od=Md}else Od=!1;wp=Od&&(!document.documentMode||9<document.documentMode)}function Ep(){_i&&(_i.detachEvent("onpropertychange",Np),Li=_i=null)}function Np(t){if(t.propertyName==="value"&&pc(Li)){var a=[];yp(a,Li,t,_r(t)),Ai(_1,a)}}function L1(t,a,l){t==="focusin"?(Ep(),_i=a,Li=l,_i.attachEvent("onpropertychange",Np)):t==="focusout"&&Ep()}function z1(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return pc(Li)}function U1(t,a){if(t==="click")return pc(a)}function $1(t,a){if(t==="input"||t==="change")return pc(a)}function B1(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var Dn=typeof Object.is=="function"?Object.is:B1;function zi(t,a){if(Dn(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var l=Object.keys(t),i=Object.keys(a);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var d=l[i];if(!Rt.call(a,d)||!Dn(t[d],a[d]))return!1}return!0}function jp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rp(t,a){var l=jp(t);t=0;for(var i;l;){if(l.nodeType===3){if(i=t+l.textContent.length,t<=a&&i>=a)return{node:l,offset:a-t};t=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=jp(l)}}function kp(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?kp(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function Tp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=jt(t.document);a instanceof t.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)t=a.contentWindow;else break;a=jt(t.document)}return a}function _d(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var H1=or&&"documentMode"in document&&11>=document.documentMode,Ds=null,Ld=null,Ui=null,zd=!1;function Cp(t,a,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;zd||Ds==null||Ds!==jt(i)||(i=Ds,"selectionStart"in i&&_d(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}),Ui&&zi(Ui,i)||(Ui=i,i=nu(Ld,"onSelect"),0<i.length&&(a=new Br("onSelect","select",null,a,l),t.push({event:a,listeners:i}),a.target=Ds)))}function ts(t,a){var l={};return l[t.toLowerCase()]=a.toLowerCase(),l["Webkit"+t]="webkit"+a,l["Moz"+t]="moz"+a,l}var Os={animationend:ts("Animation","AnimationEnd"),animationiteration:ts("Animation","AnimationIteration"),animationstart:ts("Animation","AnimationStart"),transitionrun:ts("Transition","TransitionRun"),transitionstart:ts("Transition","TransitionStart"),transitioncancel:ts("Transition","TransitionCancel"),transitionend:ts("Transition","TransitionEnd")},Ud={},Ap={};or&&(Ap=document.createElement("div").style,"AnimationEvent"in window||(delete Os.animationend.animation,delete Os.animationiteration.animation,delete Os.animationstart.animation),"TransitionEvent"in window||delete Os.transitionend.transition);function as(t){if(Ud[t])return Ud[t];if(!Os[t])return t;var a=Os[t],l;for(l in a)if(a.hasOwnProperty(l)&&l in Ap)return Ud[t]=a[l];return t}var Dp=as("animationend"),Op=as("animationiteration"),Mp=as("animationstart"),I1=as("transitionrun"),q1=as("transitionstart"),P1=as("transitioncancel"),_p=as("transitionend"),Lp=new Map,$d="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(" ");$d.push("scrollEnd");function cr(t,a){Lp.set(t,a),Sa(a,[t])}var gc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Vn=[],Ms=0,Bd=0;function vc(){for(var t=Ms,a=Bd=Ms=0;a<t;){var l=Vn[a];Vn[a++]=null;var i=Vn[a];Vn[a++]=null;var d=Vn[a];Vn[a++]=null;var m=Vn[a];if(Vn[a++]=null,i!==null&&d!==null){var b=i.pending;b===null?d.next=d:(d.next=b.next,b.next=d),i.pending=d}m!==0&&zp(l,d,m)}}function xc(t,a,l,i){Vn[Ms++]=t,Vn[Ms++]=a,Vn[Ms++]=l,Vn[Ms++]=i,Bd|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function Hd(t,a,l,i){return xc(t,a,l,i),yc(t)}function ns(t,a){return xc(t,null,null,a),yc(t)}function zp(t,a,l){t.lanes|=l;var i=t.alternate;i!==null&&(i.lanes|=l);for(var d=!1,m=t.return;m!==null;)m.childLanes|=l,i=m.alternate,i!==null&&(i.childLanes|=l),m.tag===22&&(t=m.stateNode,t===null||t._visibility&1||(d=!0)),t=m,m=m.return;return t.tag===3?(m=t.stateNode,d&&a!==null&&(d=31-Zt(l),t=m.hiddenUpdates,i=t[d],i===null?t[d]=[a]:i.push(a),a.lane=l|536870912),m):null}function yc(t){if(50<lo)throw lo=0,Kf=null,Error(s(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var _s={};function F1(t,a,l,i){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,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 On(t,a,l,i){return new F1(t,a,l,i)}function Id(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ir(t,a){var l=t.alternate;return l===null?(l=On(t.tag,a,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=a,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,a=t.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Up(t,a){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,a=l.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function bc(t,a,l,i,d,m){var b=0;if(i=t,typeof t=="function")Id(t)&&(b=1);else if(typeof t=="string")b=Qw(t,l,ue.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case fe:return t=On(31,l,a,d),t.elementType=fe,t.lanes=m,t;case j:return rs(l.children,d,m,a);case R:b=8,d|=24;break;case z:return t=On(12,l,a,d|2),t.elementType=z,t.lanes=m,t;case J:return t=On(13,l,a,d),t.elementType=J,t.lanes=m,t;case ne:return t=On(19,l,a,d),t.elementType=ne,t.lanes=m,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case $:b=10;break e;case I:b=9;break e;case Q:b=11;break e;case M:b=14;break e;case T:b=16,i=null;break e}b=29,l=Error(s(130,t===null?"null":typeof t,"")),i=null}return a=On(b,l,a,d),a.elementType=t,a.type=i,a.lanes=m,a}function rs(t,a,l,i){return t=On(7,t,i,a),t.lanes=l,t}function qd(t,a,l){return t=On(6,t,null,a),t.lanes=l,t}function $p(t){var a=On(18,null,null,0);return a.stateNode=t,a}function Pd(t,a,l){return a=On(4,t.children!==null?t.children:[],t.key,a),a.lanes=l,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Bp=new WeakMap;function Yn(t,a){if(typeof t=="object"&&t!==null){var l=Bp.get(t);return l!==void 0?l:(a={value:t,source:a,stack:ga(a)},Bp.set(t,a),a)}return{value:t,source:a,stack:ga(a)}}var Ls=[],zs=0,wc=null,$i=0,Gn=[],Xn=0,pl=null,Sr=1,Er="";function qr(t,a){Ls[zs++]=$i,Ls[zs++]=wc,wc=t,$i=a}function Hp(t,a,l){Gn[Xn++]=Sr,Gn[Xn++]=Er,Gn[Xn++]=pl,pl=t;var i=Sr;t=Er;var d=32-Zt(i)-1;i&=~(1<<d),l+=1;var m=32-Zt(a)+d;if(30<m){var b=d-d%5;m=(i&(1<<b)-1).toString(32),i>>=b,d-=b,Sr=1<<32-Zt(a)+d|l<<d|i,Er=m+t}else Sr=1<<m|l<<d|i,Er=t}function Fd(t){t.return!==null&&(qr(t,1),Hp(t,1,0))}function Vd(t){for(;t===wc;)wc=Ls[--zs],Ls[zs]=null,$i=Ls[--zs],Ls[zs]=null;for(;t===pl;)pl=Gn[--Xn],Gn[Xn]=null,Er=Gn[--Xn],Gn[Xn]=null,Sr=Gn[--Xn],Gn[Xn]=null}function Ip(t,a){Gn[Xn++]=Sr,Gn[Xn++]=Er,Gn[Xn++]=pl,Sr=a.id,Er=a.overflow,pl=t}var Ga=null,la=null,Et=!1,gl=null,Qn=!1,Yd=Error(s(519));function vl(t){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bi(Yn(a,t)),Yd}function qp(t){var a=t.stateNode,l=t.type,i=t.memoizedProps;switch(a[ye]=t,a[De]=i,l){case"dialog":vt("cancel",a),vt("close",a);break;case"iframe":case"object":case"embed":vt("load",a);break;case"video":case"audio":for(l=0;l<io.length;l++)vt(io[l],a);break;case"source":vt("error",a);break;case"img":case"image":case"link":vt("error",a),vt("load",a);break;case"details":vt("toggle",a);break;case"input":vt("invalid",a),Ti(a,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":vt("invalid",a);break;case"textarea":vt("invalid",a),ir(a,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||i.suppressHydrationWarning===!0||lx(a.textContent,l)?(i.popover!=null&&(vt("beforetoggle",a),vt("toggle",a)),i.onScroll!=null&&vt("scroll",a),i.onScrollEnd!=null&&vt("scrollend",a),i.onClick!=null&&(a.onclick=an),a=!0):a=!1,a||vl(t,!0)}function Pp(t){for(Ga=t.return;Ga;)switch(Ga.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:Ga=Ga.return}}function Us(t){if(t!==Ga)return!1;if(!Et)return Pp(t),Et=!0,!1;var a=t.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||dh(t.type,t.memoizedProps)),l=!l),l&&la&&vl(t),Pp(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));la=mx(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));la=mx(t)}else a===27?(a=la,Dl(t.type)?(t=gh,gh=null,la=t):la=a):la=Ga?Zn(t.stateNode.nextSibling):null;return!0}function ls(){la=Ga=null,Et=!1}function Gd(){var t=gl;return t!==null&&(Nn===null?Nn=t:Nn.push.apply(Nn,t),gl=null),t}function Bi(t){gl===null?gl=[t]:gl.push(t)}var Xd=C(null),ss=null,Pr=null;function xl(t,a,l){K(Xd,a._currentValue),a._currentValue=l}function Fr(t){t._currentValue=Xd.current,B(Xd)}function Qd(t,a,l){for(;t!==null;){var i=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,i!==null&&(i.childLanes|=a)):i!==null&&(i.childLanes&a)!==a&&(i.childLanes|=a),t===l)break;t=t.return}}function Kd(t,a,l,i){var d=t.child;for(d!==null&&(d.return=t);d!==null;){var m=d.dependencies;if(m!==null){var b=d.child;m=m.firstContext;e:for(;m!==null;){var N=m;m=d;for(var D=0;D<a.length;D++)if(N.context===a[D]){m.lanes|=l,N=m.alternate,N!==null&&(N.lanes|=l),Qd(m.return,l,t),i||(b=null);break e}m=N.next}}else if(d.tag===18){if(b=d.return,b===null)throw Error(s(341));b.lanes|=l,m=b.alternate,m!==null&&(m.lanes|=l),Qd(b,l,t),b=null}else b=d.child;if(b!==null)b.return=d;else for(b=d;b!==null;){if(b===t){b=null;break}if(d=b.sibling,d!==null){d.return=b.return,b=d;break}b=b.return}d=b}}function $s(t,a,l,i){t=null;for(var d=a,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!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 N=d.type;Dn(d.pendingProps.value,b.value)||(t!==null?t.push(N):t=[N])}}else if(d===Re.current){if(b=d.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(t!==null?t.push(ho):t=[ho])}d=d.return}t!==null&&Kd(a,t,l,i),a.flags|=262144}function Sc(t){for(t=t.firstContext;t!==null;){if(!Dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function is(t){ss=t,Pr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Xa(t){return Fp(ss,t)}function Ec(t,a){return ss===null&&is(t),Fp(t,a)}function Fp(t,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Pr===null){if(t===null)throw Error(s(308));Pr=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else Pr=Pr.next=a;return l}var V1=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(l,i){t.push(i)}};this.abort=function(){a.aborted=!0,t.forEach(function(l){return l()})}},Y1=e.unstable_scheduleCallback,G1=e.unstable_NormalPriority,ja={$$typeof:$,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zd(){return{controller:new V1,data:new Map,refCount:0}}function Hi(t){t.refCount--,t.refCount===0&&Y1(G1,function(){t.controller.abort()})}var Ii=null,Wd=0,Bs=0,Hs=null;function X1(t,a){if(Ii===null){var l=Ii=[];Wd=0,Bs=ah(),Hs={status:"pending",value:void 0,then:function(i){l.push(i)}}}return Wd++,a.then(Vp,Vp),a}function Vp(){if(--Wd===0&&Ii!==null){Hs!==null&&(Hs.status="fulfilled");var t=Ii;Ii=null,Bs=0,Hs=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function Q1(t,a){var l=[],i={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return t.then(function(){i.status="fulfilled",i.value=a;for(var d=0;d<l.length;d++)(0,l[d])(a)},function(d){for(i.status="rejected",i.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),i}var Yp=L.S;L.S=function(t,a){Cv=aa(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&X1(t,a),Yp!==null&&Yp(t,a)};var os=C(null);function Jd(){var t=os.current;return t!==null?t:ta.pooledCache}function Nc(t,a){a===null?K(os,os.current):K(os,a.pool)}function Gp(){var t=Jd();return t===null?null:{parent:ja._currentValue,pool:t}}var Is=Error(s(460)),ef=Error(s(474)),jc=Error(s(542)),Rc={then:function(){}};function Xp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Qp(t,a,l){switch(l=t[l],l===void 0?t.push(a):l!==a&&(a.then(an,an),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Zp(t),t;default:if(typeof a.status=="string")a.then(an,an);else{if(t=ta,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=a,t.status="pending",t.then(function(i){if(a.status==="pending"){var d=a;d.status="fulfilled",d.value=i}},function(i){if(a.status==="pending"){var d=a;d.status="rejected",d.reason=i}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Zp(t),t}throw us=a,Is}}function cs(t){try{var a=t._init;return a(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(us=l,Is):l}}var us=null;function Kp(){if(us===null)throw Error(s(459));var t=us;return us=null,t}function Zp(t){if(t===Is||t===jc)throw Error(s(483))}var qs=null,qi=0;function kc(t){var a=qi;return qi+=1,qs===null&&(qs=[]),Qp(qs,t,a)}function Pi(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function Tc(t,a){throw a.$$typeof===E?Error(s(525)):(t=Object.prototype.toString.call(a),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Wp(t){function a(H,U){if(t){var V=H.deletions;V===null?(H.deletions=[U],H.flags|=16):V.push(U)}}function l(H,U){if(!t)return null;for(;U!==null;)a(H,U),U=U.sibling;return null}function i(H){for(var U=new Map;H!==null;)H.key!==null?U.set(H.key,H):U.set(H.index,H),H=H.sibling;return U}function d(H,U){return H=Ir(H,U),H.index=0,H.sibling=null,H}function m(H,U,V){return H.index=V,t?(V=H.alternate,V!==null?(V=V.index,V<U?(H.flags|=67108866,U):V):(H.flags|=67108866,U)):(H.flags|=1048576,U)}function b(H){return t&&H.alternate===null&&(H.flags|=67108866),H}function N(H,U,V,le){return U===null||U.tag!==6?(U=qd(V,H.mode,le),U.return=H,U):(U=d(U,V),U.return=H,U)}function D(H,U,V,le){var Ie=V.type;return Ie===j?ae(H,U,V.props.children,le,V.key):U!==null&&(U.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===T&&cs(Ie)===U.type)?(U=d(U,V.props),Pi(U,V),U.return=H,U):(U=bc(V.type,V.key,V.props,null,H.mode,le),Pi(U,V),U.return=H,U)}function Y(H,U,V,le){return U===null||U.tag!==4||U.stateNode.containerInfo!==V.containerInfo||U.stateNode.implementation!==V.implementation?(U=Pd(V,H.mode,le),U.return=H,U):(U=d(U,V.children||[]),U.return=H,U)}function ae(H,U,V,le,Ie){return U===null||U.tag!==7?(U=rs(V,H.mode,le,Ie),U.return=H,U):(U=d(U,V),U.return=H,U)}function oe(H,U,V){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=qd(""+U,H.mode,V),U.return=H,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case S:return V=bc(U.type,U.key,U.props,null,H.mode,V),Pi(V,U),V.return=H,V;case w:return U=Pd(U,H.mode,V),U.return=H,U;case T:return U=cs(U),oe(H,U,V)}if(ee(U)||re(U))return U=rs(U,H.mode,V,null),U.return=H,U;if(typeof U.then=="function")return oe(H,kc(U),V);if(U.$$typeof===$)return oe(H,Ec(H,U),V);Tc(H,U)}return null}function X(H,U,V,le){var Ie=U!==null?U.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Ie!==null?null:N(H,U,""+V,le);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===Ie?D(H,U,V,le):null;case w:return V.key===Ie?Y(H,U,V,le):null;case T:return V=cs(V),X(H,U,V,le)}if(ee(V)||re(V))return Ie!==null?null:ae(H,U,V,le,null);if(typeof V.then=="function")return X(H,U,kc(V),le);if(V.$$typeof===$)return X(H,U,Ec(H,V),le);Tc(H,V)}return null}function Z(H,U,V,le,Ie){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return H=H.get(V)||null,N(U,H,""+le,Ie);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return H=H.get(le.key===null?V:le.key)||null,D(U,H,le,Ie);case w:return H=H.get(le.key===null?V:le.key)||null,Y(U,H,le,Ie);case T:return le=cs(le),Z(H,U,V,le,Ie)}if(ee(le)||re(le))return H=H.get(V)||null,ae(U,H,le,Ie,null);if(typeof le.then=="function")return Z(H,U,V,kc(le),Ie);if(le.$$typeof===$)return Z(H,U,V,Ec(U,le),Ie);Tc(U,le)}return null}function Me(H,U,V,le){for(var Ie=null,At=null,ze=U,ct=U=0,wt=null;ze!==null&&ct<V.length;ct++){ze.index>ct?(wt=ze,ze=null):wt=ze.sibling;var Dt=X(H,ze,V[ct],le);if(Dt===null){ze===null&&(ze=wt);break}t&&ze&&Dt.alternate===null&&a(H,ze),U=m(Dt,U,ct),At===null?Ie=Dt:At.sibling=Dt,At=Dt,ze=wt}if(ct===V.length)return l(H,ze),Et&&qr(H,ct),Ie;if(ze===null){for(;ct<V.length;ct++)ze=oe(H,V[ct],le),ze!==null&&(U=m(ze,U,ct),At===null?Ie=ze:At.sibling=ze,At=ze);return Et&&qr(H,ct),Ie}for(ze=i(ze);ct<V.length;ct++)wt=Z(ze,H,ct,V[ct],le),wt!==null&&(t&&wt.alternate!==null&&ze.delete(wt.key===null?ct:wt.key),U=m(wt,U,ct),At===null?Ie=wt:At.sibling=wt,At=wt);return t&&ze.forEach(function(zl){return a(H,zl)}),Et&&qr(H,ct),Ie}function Ve(H,U,V,le){if(V==null)throw Error(s(151));for(var Ie=null,At=null,ze=U,ct=U=0,wt=null,Dt=V.next();ze!==null&&!Dt.done;ct++,Dt=V.next()){ze.index>ct?(wt=ze,ze=null):wt=ze.sibling;var zl=X(H,ze,Dt.value,le);if(zl===null){ze===null&&(ze=wt);break}t&&ze&&zl.alternate===null&&a(H,ze),U=m(zl,U,ct),At===null?Ie=zl:At.sibling=zl,At=zl,ze=wt}if(Dt.done)return l(H,ze),Et&&qr(H,ct),Ie;if(ze===null){for(;!Dt.done;ct++,Dt=V.next())Dt=oe(H,Dt.value,le),Dt!==null&&(U=m(Dt,U,ct),At===null?Ie=Dt:At.sibling=Dt,At=Dt);return Et&&qr(H,ct),Ie}for(ze=i(ze);!Dt.done;ct++,Dt=V.next())Dt=Z(ze,H,ct,Dt.value,le),Dt!==null&&(t&&Dt.alternate!==null&&ze.delete(Dt.key===null?ct:Dt.key),U=m(Dt,U,ct),At===null?Ie=Dt:At.sibling=Dt,At=Dt);return t&&ze.forEach(function(sS){return a(H,sS)}),Et&&qr(H,ct),Ie}function Xt(H,U,V,le){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case S:e:{for(var Ie=V.key;U!==null;){if(U.key===Ie){if(Ie=V.type,Ie===j){if(U.tag===7){l(H,U.sibling),le=d(U,V.props.children),le.return=H,H=le;break e}}else if(U.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===T&&cs(Ie)===U.type){l(H,U.sibling),le=d(U,V.props),Pi(le,V),le.return=H,H=le;break e}l(H,U);break}else a(H,U);U=U.sibling}V.type===j?(le=rs(V.props.children,H.mode,le,V.key),le.return=H,H=le):(le=bc(V.type,V.key,V.props,null,H.mode,le),Pi(le,V),le.return=H,H=le)}return b(H);case w:e:{for(Ie=V.key;U!==null;){if(U.key===Ie)if(U.tag===4&&U.stateNode.containerInfo===V.containerInfo&&U.stateNode.implementation===V.implementation){l(H,U.sibling),le=d(U,V.children||[]),le.return=H,H=le;break e}else{l(H,U);break}else a(H,U);U=U.sibling}le=Pd(V,H.mode,le),le.return=H,H=le}return b(H);case T:return V=cs(V),Xt(H,U,V,le)}if(ee(V))return Me(H,U,V,le);if(re(V)){if(Ie=re(V),typeof Ie!="function")throw Error(s(150));return V=Ie.call(V),Ve(H,U,V,le)}if(typeof V.then=="function")return Xt(H,U,kc(V),le);if(V.$$typeof===$)return Xt(H,U,Ec(H,V),le);Tc(H,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,U!==null&&U.tag===6?(l(H,U.sibling),le=d(U,V),le.return=H,H=le):(l(H,U),le=qd(V,H.mode,le),le.return=H,H=le),b(H)):l(H,U)}return function(H,U,V,le){try{qi=0;var Ie=Xt(H,U,V,le);return qs=null,Ie}catch(ze){if(ze===Is||ze===jc)throw ze;var At=On(29,ze,null,H.mode);return At.lanes=le,At.return=H,At}finally{}}}var ds=Wp(!0),Jp=Wp(!1),yl=!1;function tf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function af(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function bl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function wl(t,a,l){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,(Ot&2)!==0){var d=i.pending;return d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a,a=yc(t),zp(t,null,l),a}return xc(t,i,a,l),yc(t)}function Fi(t,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var i=a.lanes;i&=t.pendingLanes,l|=i,a.lanes=l,Aa(t,l)}}function nf(t,a){var l=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?d=m=b:m=m.next=b,l=l.next}while(l!==null);m===null?d=m=a:m=m.next=a}else d=m=a;l={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:i.shared,callbacks:i.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=a:t.next=a,l.lastBaseUpdate=a}var rf=!1;function Vi(){if(rf){var t=Hs;if(t!==null)throw t}}function Yi(t,a,l,i){rf=!1;var d=t.updateQueue;yl=!1;var m=d.firstBaseUpdate,b=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var D=N,Y=D.next;D.next=null,b===null?m=Y:b.next=Y,b=D;var ae=t.alternate;ae!==null&&(ae=ae.updateQueue,N=ae.lastBaseUpdate,N!==b&&(N===null?ae.firstBaseUpdate=Y:N.next=Y,ae.lastBaseUpdate=D))}if(m!==null){var oe=d.baseState;b=0,ae=Y=D=null,N=m;do{var X=N.lane&-536870913,Z=X!==N.lane;if(Z?(bt&X)===X:(i&X)===X){X!==0&&X===Bs&&(rf=!0),ae!==null&&(ae=ae.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Me=t,Ve=N;X=a;var Xt=l;switch(Ve.tag){case 1:if(Me=Ve.payload,typeof Me=="function"){oe=Me.call(Xt,oe,X);break e}oe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Ve.payload,X=typeof Me=="function"?Me.call(Xt,oe,X):Me,X==null)break e;oe=x({},oe,X);break e;case 2:yl=!0}}X=N.callback,X!==null&&(t.flags|=64,Z&&(t.flags|=8192),Z=d.callbacks,Z===null?d.callbacks=[X]:Z.push(X))}else Z={lane:X,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ae===null?(Y=ae=Z,D=oe):ae=ae.next=Z,b|=X;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;Z=N,N=Z.next,Z.next=null,d.lastBaseUpdate=Z,d.shared.pending=null}}while(!0);ae===null&&(D=oe),d.baseState=D,d.firstBaseUpdate=Y,d.lastBaseUpdate=ae,m===null&&(d.shared.lanes=0),Rl|=b,t.lanes=b,t.memoizedState=oe}}function eg(t,a){if(typeof t!="function")throw Error(s(191,t));t.call(a)}function tg(t,a){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)eg(l[t],a)}var Ps=C(null),Cc=C(0);function ag(t,a){t=Jr,K(Cc,t),K(Ps,a),Jr=t|a.baseLanes}function lf(){K(Cc,Jr),K(Ps,Ps.current)}function sf(){Jr=Cc.current,B(Ps),B(Cc)}var Mn=C(null),Kn=null;function Sl(t){var a=t.alternate;K(xa,xa.current&1),K(Mn,t),Kn===null&&(a===null||Ps.current!==null||a.memoizedState!==null)&&(Kn=t)}function of(t){K(xa,xa.current),K(Mn,t),Kn===null&&(Kn=t)}function ng(t){t.tag===22?(K(xa,xa.current),K(Mn,t),Kn===null&&(Kn=t)):El()}function El(){K(xa,xa.current),K(Mn,Mn.current)}function _n(t){B(Mn),Kn===t&&(Kn=null),B(xa)}var xa=C(0);function Ac(t){for(var a=t;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||mh(l)||ph(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Vr=0,it=null,Yt=null,Ra=null,Dc=!1,Fs=!1,fs=!1,Oc=0,Gi=0,Vs=null,K1=0;function fa(){throw Error(s(321))}function cf(t,a){if(a===null)return!1;for(var l=0;l<a.length&&l<t.length;l++)if(!Dn(t[l],a[l]))return!1;return!0}function uf(t,a,l,i,d,m){return Vr=m,it=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=t===null||t.memoizedState===null?Hg:jf,fs=!1,m=l(i,d),fs=!1,Fs&&(m=lg(a,l,i,d)),rg(t),m}function rg(t){L.H=Ki;var a=Yt!==null&&Yt.next!==null;if(Vr=0,Ra=Yt=it=null,Dc=!1,Gi=0,Vs=null,a)throw Error(s(300));t===null||ka||(t=t.dependencies,t!==null&&Sc(t)&&(ka=!0))}function lg(t,a,l,i){it=t;var d=0;do{if(Fs&&(Vs=null),Gi=0,Fs=!1,25<=d)throw Error(s(301));if(d+=1,Ra=Yt=null,t.updateQueue!=null){var m=t.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}L.H=Ig,m=a(l,i)}while(Fs);return m}function Z1(){var t=L.H,a=t.useState()[0];return a=typeof a.then=="function"?Xi(a):a,t=t.useState()[0],(Yt!==null?Yt.memoizedState:null)!==t&&(it.flags|=1024),a}function df(){var t=Oc!==0;return Oc=0,t}function ff(t,a,l){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~l}function hf(t){if(Dc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}Dc=!1}Vr=0,Ra=Yt=it=null,Fs=!1,Gi=Oc=0,Vs=null}function mn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ra===null?it.memoizedState=Ra=t:Ra=Ra.next=t,Ra}function ya(){if(Yt===null){var t=it.alternate;t=t!==null?t.memoizedState:null}else t=Yt.next;var a=Ra===null?it.memoizedState:Ra.next;if(a!==null)Ra=a,Yt=t;else{if(t===null)throw it.alternate===null?Error(s(467)):Error(s(310));Yt=t,t={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},Ra===null?it.memoizedState=Ra=t:Ra=Ra.next=t}return Ra}function Mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xi(t){var a=Gi;return Gi+=1,Vs===null&&(Vs=[]),t=Qp(Vs,t,a),a=it,(Ra===null?a.memoizedState:Ra.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?Hg:jf),t}function _c(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Xi(t);if(t.$$typeof===$)return Xa(t)}throw Error(s(438,String(t)))}function mf(t){var a=null,l=it.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var i=it.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(a={data:i.data.map(function(d){return d.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=Mc(),it.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(t),i=0;i<t;i++)l[i]=pe;return a.index++,l}function Yr(t,a){return typeof a=="function"?a(t):a}function Lc(t){var a=ya();return pf(a,Yt,t)}function pf(t,a,l){var i=t.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=l;var d=t.baseQueue,m=i.pending;if(m!==null){if(d!==null){var b=d.next;d.next=m.next,m.next=b}a.baseQueue=d=m,i.pending=null}if(m=t.baseState,d===null)t.memoizedState=m;else{a=d.next;var N=b=null,D=null,Y=a,ae=!1;do{var oe=Y.lane&-536870913;if(oe!==Y.lane?(bt&oe)===oe:(Vr&oe)===oe){var X=Y.revertLane;if(X===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),oe===Bs&&(ae=!0);else if((Vr&X)===X){Y=Y.next,X===Bs&&(ae=!0);continue}else oe={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},D===null?(N=D=oe,b=m):D=D.next=oe,it.lanes|=X,Rl|=X;oe=Y.action,fs&&l(m,oe),m=Y.hasEagerState?Y.eagerState:l(m,oe)}else X={lane:oe,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},D===null?(N=D=X,b=m):D=D.next=X,it.lanes|=oe,Rl|=oe;Y=Y.next}while(Y!==null&&Y!==a);if(D===null?b=m:D.next=N,!Dn(m,t.memoizedState)&&(ka=!0,ae&&(l=Hs,l!==null)))throw l;t.memoizedState=m,t.baseState=b,t.baseQueue=D,i.lastRenderedState=m}return d===null&&(i.lanes=0),[t.memoizedState,i.dispatch]}function gf(t){var a=ya(),l=a.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=t;var i=l.dispatch,d=l.pending,m=a.memoizedState;if(d!==null){l.pending=null;var b=d=d.next;do m=t(m,b.action),b=b.next;while(b!==d);Dn(m,a.memoizedState)||(ka=!0),a.memoizedState=m,a.baseQueue===null&&(a.baseState=m),l.lastRenderedState=m}return[m,i]}function sg(t,a,l){var i=it,d=ya(),m=Et;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=a();var b=!Dn((Yt||d).memoizedState,l);if(b&&(d.memoizedState=l,ka=!0),d=d.queue,yf(cg.bind(null,i,d,t),[t]),d.getSnapshot!==a||b||Ra!==null&&Ra.memoizedState.tag&1){if(i.flags|=2048,Ys(9,{destroy:void 0},og.bind(null,i,d,l,a),null),ta===null)throw Error(s(349));m||(Vr&127)!==0||ig(i,a,l)}return l}function ig(t,a,l){t.flags|=16384,t={getSnapshot:a,value:l},a=it.updateQueue,a===null?(a=Mc(),it.updateQueue=a,a.stores=[t]):(l=a.stores,l===null?a.stores=[t]:l.push(t))}function og(t,a,l,i){a.value=l,a.getSnapshot=i,ug(a)&&dg(t)}function cg(t,a,l){return l(function(){ug(a)&&dg(t)})}function ug(t){var a=t.getSnapshot;t=t.value;try{var l=a();return!Dn(t,l)}catch{return!0}}function dg(t){var a=ns(t,2);a!==null&&jn(a,t,2)}function vf(t){var a=mn();if(typeof t=="function"){var l=t;if(t=l(),fs){kt(!0);try{l()}finally{kt(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:t},a}function fg(t,a,l,i){return t.baseState=l,pf(t,Yt,typeof i=="function"?i:Yr)}function W1(t,a,l,i,d){if($c(t))throw Error(s(485));if(t=a.action,t!==null){var m={payload:d,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};L.T!==null?l(!0):m.isTransition=!1,i(m),l=a.pending,l===null?(m.next=a.pending=m,hg(a,m)):(m.next=l.next,a.pending=l.next=m)}}function hg(t,a){var l=a.action,i=a.payload,d=t.state;if(a.isTransition){var m=L.T,b={};L.T=b;try{var N=l(d,i),D=L.S;D!==null&&D(b,N),mg(t,a,N)}catch(Y){xf(t,a,Y)}finally{m!==null&&b.types!==null&&(m.types=b.types),L.T=m}}else try{m=l(d,i),mg(t,a,m)}catch(Y){xf(t,a,Y)}}function mg(t,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){pg(t,a,i)},function(i){return xf(t,a,i)}):pg(t,a,l)}function pg(t,a,l){a.status="fulfilled",a.value=l,gg(a),t.state=l,a=t.pending,a!==null&&(l=a.next,l===a?t.pending=null:(l=l.next,a.next=l,hg(t,l)))}function xf(t,a,l){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do a.status="rejected",a.reason=l,gg(a),a=a.next;while(a!==i)}t.action=null}function gg(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function vg(t,a){return a}function xg(t,a){if(Et){var l=ta.formState;if(l!==null){e:{var i=it;if(Et){if(la){t:{for(var d=la,m=Qn;d.nodeType!==8;){if(!m){d=null;break t}if(d=Zn(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){la=Zn(d.nextSibling),i=d.data==="F!";break e}}vl(i)}i=!1}i&&(a=l[0])}}return l=mn(),l.memoizedState=l.baseState=a,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vg,lastRenderedState:a},l.queue=i,l=Ug.bind(null,it,i),i.dispatch=l,i=vf(!1),m=Nf.bind(null,it,!1,i.queue),i=mn(),d={state:a,dispatch:null,action:t,pending:null},i.queue=d,l=W1.bind(null,it,d,m,l),d.dispatch=l,i.memoizedState=t,[a,l,!1]}function yg(t){var a=ya();return bg(a,Yt,t)}function bg(t,a,l){if(a=pf(t,a,vg)[0],t=Lc(Yr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var i=Xi(a)}catch(b){throw b===Is?jc:b}else i=a;a=ya();var d=a.queue,m=d.dispatch;return l!==a.memoizedState&&(it.flags|=2048,Ys(9,{destroy:void 0},J1.bind(null,d,l),null)),[i,m,t]}function J1(t,a){t.action=a}function wg(t){var a=ya(),l=Yt;if(l!==null)return bg(a,l,t);ya(),a=a.memoizedState,l=ya();var i=l.queue.dispatch;return l.memoizedState=t,[a,i,!1]}function Ys(t,a,l,i){return t={tag:t,create:l,deps:i,inst:a,next:null},a=it.updateQueue,a===null&&(a=Mc(),it.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=t.next=t:(i=l.next,l.next=t,t.next=i,a.lastEffect=t),t}function Sg(){return ya().memoizedState}function zc(t,a,l,i){var d=mn();it.flags|=t,d.memoizedState=Ys(1|a,{destroy:void 0},l,i===void 0?null:i)}function Uc(t,a,l,i){var d=ya();i=i===void 0?null:i;var m=d.memoizedState.inst;Yt!==null&&i!==null&&cf(i,Yt.memoizedState.deps)?d.memoizedState=Ys(a,m,l,i):(it.flags|=t,d.memoizedState=Ys(1|a,m,l,i))}function Eg(t,a){zc(8390656,8,t,a)}function yf(t,a){Uc(2048,8,t,a)}function ew(t){it.flags|=4;var a=it.updateQueue;if(a===null)a=Mc(),it.updateQueue=a,a.events=[t];else{var l=a.events;l===null?a.events=[t]:l.push(t)}}function Ng(t){var a=ya().memoizedState;return ew({ref:a,nextImpl:t}),function(){if((Ot&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function jg(t,a){return Uc(4,2,t,a)}function Rg(t,a){return Uc(4,4,t,a)}function kg(t,a){if(typeof a=="function"){t=t();var l=a(t);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function Tg(t,a,l){l=l!=null?l.concat([t]):null,Uc(4,4,kg.bind(null,a,t),l)}function bf(){}function Cg(t,a){var l=ya();a=a===void 0?null:a;var i=l.memoizedState;return a!==null&&cf(a,i[1])?i[0]:(l.memoizedState=[t,a],t)}function Ag(t,a){var l=ya();a=a===void 0?null:a;var i=l.memoizedState;if(a!==null&&cf(a,i[1]))return i[0];if(i=t(),fs){kt(!0);try{t()}finally{kt(!1)}}return l.memoizedState=[i,a],i}function wf(t,a,l){return l===void 0||(Vr&1073741824)!==0&&(bt&261930)===0?t.memoizedState=a:(t.memoizedState=l,t=Dv(),it.lanes|=t,Rl|=t,l)}function Dg(t,a,l,i){return Dn(l,a)?l:Ps.current!==null?(t=wf(t,l,i),Dn(t,a)||(ka=!0),t):(Vr&42)===0||(Vr&1073741824)!==0&&(bt&261930)===0?(ka=!0,t.memoizedState=l):(t=Dv(),it.lanes|=t,Rl|=t,a)}function Og(t,a,l,i,d){var m=F.p;F.p=m!==0&&8>m?m:8;var b=L.T,N={};L.T=N,Nf(t,!1,a,l);try{var D=d(),Y=L.S;if(Y!==null&&Y(N,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var ae=Q1(D,i);Qi(t,a,ae,Un(t))}else Qi(t,a,i,Un(t))}catch(oe){Qi(t,a,{then:function(){},status:"rejected",reason:oe},Un())}finally{F.p=m,b!==null&&N.types!==null&&(b.types=N.types),L.T=b}}function tw(){}function Sf(t,a,l,i){if(t.tag!==5)throw Error(s(476));var d=Mg(t).queue;Og(t,d,a,he,l===null?tw:function(){return _g(t),l(i)})}function Mg(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:he},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:l},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function _g(t){var a=Mg(t);a.next===null&&(a=t.alternate.memoizedState),Qi(t,a.next.queue,{},Un())}function Ef(){return Xa(ho)}function Lg(){return ya().memoizedState}function zg(){return ya().memoizedState}function aw(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var l=Un();t=bl(l);var i=wl(a,t,l);i!==null&&(jn(i,a,l),Fi(i,a,l)),a={cache:Zd()},t.payload=a;return}a=a.return}}function nw(t,a,l){var i=Un();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$c(t)?$g(a,l):(l=Hd(t,a,l,i),l!==null&&(jn(l,t,i),Bg(l,a,i)))}function Ug(t,a,l){var i=Un();Qi(t,a,l,i)}function Qi(t,a,l,i){var d={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if($c(t))$g(a,d);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=a.lastRenderedReducer,m!==null))try{var b=a.lastRenderedState,N=m(b,l);if(d.hasEagerState=!0,d.eagerState=N,Dn(N,b))return xc(t,a,d,0),ta===null&&vc(),!1}catch{}finally{}if(l=Hd(t,a,d,i),l!==null)return jn(l,t,i),Bg(l,a,i),!0}return!1}function Nf(t,a,l,i){if(i={lane:2,revertLane:ah(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},$c(t)){if(a)throw Error(s(479))}else a=Hd(t,l,i,2),a!==null&&jn(a,t,2)}function $c(t){var a=t.alternate;return t===it||a!==null&&a===it}function $g(t,a){Fs=Dc=!0;var l=t.pending;l===null?a.next=a:(a.next=l.next,l.next=a),t.pending=a}function Bg(t,a,l){if((l&4194048)!==0){var i=a.lanes;i&=t.pendingLanes,l|=i,a.lanes=l,Aa(t,l)}}var Ki={readContext:Xa,use:_c,useCallback:fa,useContext:fa,useEffect:fa,useImperativeHandle:fa,useLayoutEffect:fa,useInsertionEffect:fa,useMemo:fa,useReducer:fa,useRef:fa,useState:fa,useDebugValue:fa,useDeferredValue:fa,useTransition:fa,useSyncExternalStore:fa,useId:fa,useHostTransitionStatus:fa,useFormState:fa,useActionState:fa,useOptimistic:fa,useMemoCache:fa,useCacheRefresh:fa};Ki.useEffectEvent=fa;var Hg={readContext:Xa,use:_c,useCallback:function(t,a){return mn().memoizedState=[t,a===void 0?null:a],t},useContext:Xa,useEffect:Eg,useImperativeHandle:function(t,a,l){l=l!=null?l.concat([t]):null,zc(4194308,4,kg.bind(null,a,t),l)},useLayoutEffect:function(t,a){return zc(4194308,4,t,a)},useInsertionEffect:function(t,a){zc(4,2,t,a)},useMemo:function(t,a){var l=mn();a=a===void 0?null:a;var i=t();if(fs){kt(!0);try{t()}finally{kt(!1)}}return l.memoizedState=[i,a],i},useReducer:function(t,a,l){var i=mn();if(l!==void 0){var d=l(a);if(fs){kt(!0);try{l(a)}finally{kt(!1)}}}else d=a;return i.memoizedState=i.baseState=d,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:d},i.queue=t,t=t.dispatch=nw.bind(null,it,t),[i.memoizedState,t]},useRef:function(t){var a=mn();return t={current:t},a.memoizedState=t},useState:function(t){t=vf(t);var a=t.queue,l=Ug.bind(null,it,a);return a.dispatch=l,[t.memoizedState,l]},useDebugValue:bf,useDeferredValue:function(t,a){var l=mn();return wf(l,t,a)},useTransition:function(){var t=vf(!1);return t=Og.bind(null,it,t.queue,!0,!1),mn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,l){var i=it,d=mn();if(Et){if(l===void 0)throw Error(s(407));l=l()}else{if(l=a(),ta===null)throw Error(s(349));(bt&127)!==0||ig(i,a,l)}d.memoizedState=l;var m={value:l,getSnapshot:a};return d.queue=m,Eg(cg.bind(null,i,m,t),[t]),i.flags|=2048,Ys(9,{destroy:void 0},og.bind(null,i,m,l,a),null),l},useId:function(){var t=mn(),a=ta.identifierPrefix;if(Et){var l=Er,i=Sr;l=(i&~(1<<32-Zt(i)-1)).toString(32)+l,a="_"+a+"R_"+l,l=Oc++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=K1++,a="_"+a+"r_"+l.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Ef,useFormState:xg,useActionState:xg,useOptimistic:function(t){var a=mn();a.memoizedState=a.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Nf.bind(null,it,!0,l),l.dispatch=a,[t,a]},useMemoCache:mf,useCacheRefresh:function(){return mn().memoizedState=aw.bind(null,it)},useEffectEvent:function(t){var a=mn(),l={impl:t};return a.memoizedState=l,function(){if((Ot&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},jf={readContext:Xa,use:_c,useCallback:Cg,useContext:Xa,useEffect:yf,useImperativeHandle:Tg,useInsertionEffect:jg,useLayoutEffect:Rg,useMemo:Ag,useReducer:Lc,useRef:Sg,useState:function(){return Lc(Yr)},useDebugValue:bf,useDeferredValue:function(t,a){var l=ya();return Dg(l,Yt.memoizedState,t,a)},useTransition:function(){var t=Lc(Yr)[0],a=ya().memoizedState;return[typeof t=="boolean"?t:Xi(t),a]},useSyncExternalStore:sg,useId:Lg,useHostTransitionStatus:Ef,useFormState:yg,useActionState:yg,useOptimistic:function(t,a){var l=ya();return fg(l,Yt,t,a)},useMemoCache:mf,useCacheRefresh:zg};jf.useEffectEvent=Ng;var Ig={readContext:Xa,use:_c,useCallback:Cg,useContext:Xa,useEffect:yf,useImperativeHandle:Tg,useInsertionEffect:jg,useLayoutEffect:Rg,useMemo:Ag,useReducer:gf,useRef:Sg,useState:function(){return gf(Yr)},useDebugValue:bf,useDeferredValue:function(t,a){var l=ya();return Yt===null?wf(l,t,a):Dg(l,Yt.memoizedState,t,a)},useTransition:function(){var t=gf(Yr)[0],a=ya().memoizedState;return[typeof t=="boolean"?t:Xi(t),a]},useSyncExternalStore:sg,useId:Lg,useHostTransitionStatus:Ef,useFormState:wg,useActionState:wg,useOptimistic:function(t,a){var l=ya();return Yt!==null?fg(l,Yt,t,a):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:mf,useCacheRefresh:zg};Ig.useEffectEvent=Ng;function Rf(t,a,l,i){a=t.memoizedState,l=l(i,a),l=l==null?a:x({},a,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var kf={enqueueSetState:function(t,a,l){t=t._reactInternals;var i=Un(),d=bl(i);d.payload=a,l!=null&&(d.callback=l),a=wl(t,d,i),a!==null&&(jn(a,t,i),Fi(a,t,i))},enqueueReplaceState:function(t,a,l){t=t._reactInternals;var i=Un(),d=bl(i);d.tag=1,d.payload=a,l!=null&&(d.callback=l),a=wl(t,d,i),a!==null&&(jn(a,t,i),Fi(a,t,i))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var l=Un(),i=bl(l);i.tag=2,a!=null&&(i.callback=a),a=wl(t,i,l),a!==null&&(jn(a,t,l),Fi(a,t,l))}};function qg(t,a,l,i,d,m,b){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,m,b):a.prototype&&a.prototype.isPureReactComponent?!zi(l,i)||!zi(d,m):!0}function Pg(t,a,l,i){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,i),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,i),a.state!==t&&kf.enqueueReplaceState(a,a.state,null)}function hs(t,a){var l=a;if("ref"in a){l={};for(var i in a)i!=="ref"&&(l[i]=a[i])}if(t=t.defaultProps){l===a&&(l=x({},l));for(var d in t)l[d]===void 0&&(l[d]=t[d])}return l}function Fg(t){gc(t)}function Vg(t){console.error(t)}function Yg(t){gc(t)}function Bc(t,a){try{var l=t.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(i){setTimeout(function(){throw i})}}function Gg(t,a,l){try{var i=t.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Tf(t,a,l){return l=bl(l),l.tag=3,l.payload={element:null},l.callback=function(){Bc(t,a)},l}function Xg(t){return t=bl(t),t.tag=3,t}function Qg(t,a,l,i){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var m=i.value;t.payload=function(){return d(m)},t.callback=function(){Gg(a,l,i)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(t.callback=function(){Gg(a,l,i),typeof d!="function"&&(kl===null?kl=new Set([this]):kl.add(this));var N=i.stack;this.componentDidCatch(i.value,{componentStack:N!==null?N:""})})}function rw(t,a,l,i,d){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(a=l.alternate,a!==null&&$s(a,l,d,!0),l=Mn.current,l!==null){switch(l.tag){case 31:case 13:return Kn===null?Zc():l.alternate===null&&ha===0&&(ha=3),l.flags&=-257,l.flags|=65536,l.lanes=d,i===Rc?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([i]):a.add(i),Jf(t,i,d)),!1;case 22:return l.flags|=65536,i===Rc?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([i]):l.add(i)),Jf(t,i,d)),!1}throw Error(s(435,l.tag))}return Jf(t,i,d),Zc(),!1}if(Et)return a=Mn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=d,i!==Yd&&(t=Error(s(422),{cause:i}),Bi(Yn(t,l)))):(i!==Yd&&(a=Error(s(423),{cause:i}),Bi(Yn(a,l))),t=t.current.alternate,t.flags|=65536,d&=-d,t.lanes|=d,i=Yn(i,l),d=Tf(t.stateNode,i,d),nf(t,d),ha!==4&&(ha=2)),!1;var m=Error(s(520),{cause:i});if(m=Yn(m,l),ro===null?ro=[m]:ro.push(m),ha!==4&&(ha=2),a===null)return!0;i=Yn(i,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,t=d&-d,l.lanes|=t,t=Tf(l.stateNode,i,t),nf(l,t),!1;case 1:if(a=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(kl===null||!kl.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=Xg(d),Qg(d,t,l,i),nf(l,d),!1}l=l.return}while(l!==null);return!1}var Cf=Error(s(461)),ka=!1;function Qa(t,a,l,i){a.child=t===null?Jp(a,null,l,i):ds(a,t.child,l,i)}function Kg(t,a,l,i,d){l=l.render;var m=a.ref;if("ref"in i){var b={};for(var N in i)N!=="ref"&&(b[N]=i[N])}else b=i;return is(a),i=uf(t,a,l,b,m,d),N=df(),t!==null&&!ka?(ff(t,a,d),Gr(t,a,d)):(Et&&N&&Fd(a),a.flags|=1,Qa(t,a,i,d),a.child)}function Zg(t,a,l,i,d){if(t===null){var m=l.type;return typeof m=="function"&&!Id(m)&&m.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=m,Wg(t,a,m,i,d)):(t=bc(l.type,null,i,a,a.mode,d),t.ref=a.ref,t.return=a,a.child=t)}if(m=t.child,!Uf(t,d)){var b=m.memoizedProps;if(l=l.compare,l=l!==null?l:zi,l(b,i)&&t.ref===a.ref)return Gr(t,a,d)}return a.flags|=1,t=Ir(m,i),t.ref=a.ref,t.return=a,a.child=t}function Wg(t,a,l,i,d){if(t!==null){var m=t.memoizedProps;if(zi(m,i)&&t.ref===a.ref)if(ka=!1,a.pendingProps=i=m,Uf(t,d))(t.flags&131072)!==0&&(ka=!0);else return a.lanes=t.lanes,Gr(t,a,d)}return Af(t,a,l,i,d)}function Jg(t,a,l,i){var d=i.children,m=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((a.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,t!==null){for(i=a.child=t.child,d=0;i!==null;)d=d|i.lanes|i.childLanes,i=i.sibling;i=d&~m}else i=0,a.child=null;return ev(t,a,m,l,i)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&Nc(a,m!==null?m.cachePool:null),m!==null?ag(a,m):lf(),ng(a);else return i=a.lanes=536870912,ev(t,a,m!==null?m.baseLanes|l:l,l,i)}else m!==null?(Nc(a,m.cachePool),ag(a,m),El(),a.memoizedState=null):(t!==null&&Nc(a,null),lf(),El());return Qa(t,a,d,l),a.child}function Zi(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function ev(t,a,l,i,d){var m=Jd();return m=m===null?null:{parent:ja._currentValue,pool:m},a.memoizedState={baseLanes:l,cachePool:m},t!==null&&Nc(a,null),lf(),ng(a),t!==null&&$s(t,a,i,!0),a.childLanes=d,null}function Hc(t,a){return a=qc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function tv(t,a,l){return ds(a,t.child,null,l),t=Hc(a,a.pendingProps),t.flags|=2,_n(a),a.memoizedState=null,t}function lw(t,a,l){var i=a.pendingProps,d=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(Et){if(i.mode==="hidden")return t=Hc(a,i),a.lanes=536870912,Zi(null,t);if(of(a),(t=la)?(t=hx(t,Qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:pl!==null?{id:Sr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=$p(t),l.return=a,a.child=l,Ga=a,la=null)):t=null,t===null)throw vl(a);return a.lanes=536870912,null}return Hc(a,i)}var m=t.memoizedState;if(m!==null){var b=m.dehydrated;if(of(a),d)if(a.flags&256)a.flags&=-257,a=tv(t,a,l);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(s(558));else if(ka||$s(t,a,l,!1),d=(l&t.childLanes)!==0,ka||d){if(i=ta,i!==null&&(b=A(i,l),b!==0&&b!==m.retryLane))throw m.retryLane=b,ns(t,b),jn(i,t,b),Cf;Zc(),a=tv(t,a,l)}else t=m.treeContext,la=Zn(b.nextSibling),Ga=a,Et=!0,gl=null,Qn=!1,t!==null&&Ip(a,t),a=Hc(a,i),a.flags|=4096;return a}return t=Ir(t.child,{mode:i.mode,children:i.children}),t.ref=a.ref,a.child=t,t.return=a,t}function Ic(t,a){var l=a.ref;if(l===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(t===null||t.ref!==l)&&(a.flags|=4194816)}}function Af(t,a,l,i,d){return is(a),l=uf(t,a,l,i,void 0,d),i=df(),t!==null&&!ka?(ff(t,a,d),Gr(t,a,d)):(Et&&i&&Fd(a),a.flags|=1,Qa(t,a,l,d),a.child)}function av(t,a,l,i,d,m){return is(a),a.updateQueue=null,l=lg(a,i,l,d),rg(t),i=df(),t!==null&&!ka?(ff(t,a,m),Gr(t,a,m)):(Et&&i&&Fd(a),a.flags|=1,Qa(t,a,l,m),a.child)}function nv(t,a,l,i,d){if(is(a),a.stateNode===null){var m=_s,b=l.contextType;typeof b=="object"&&b!==null&&(m=Xa(b)),m=new l(i,m),a.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=kf,a.stateNode=m,m._reactInternals=a,m=a.stateNode,m.props=i,m.state=a.memoizedState,m.refs={},tf(a),b=l.contextType,m.context=typeof b=="object"&&b!==null?Xa(b):_s,m.state=a.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Rf(a,l,b,i),m.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&kf.enqueueReplaceState(m,m.state,null),Yi(a,i,m,d),Vi(),m.state=a.memoizedState),typeof m.componentDidMount=="function"&&(a.flags|=4194308),i=!0}else if(t===null){m=a.stateNode;var N=a.memoizedProps,D=hs(l,N);m.props=D;var Y=m.context,ae=l.contextType;b=_s,typeof ae=="object"&&ae!==null&&(b=Xa(ae));var oe=l.getDerivedStateFromProps;ae=typeof oe=="function"||typeof m.getSnapshotBeforeUpdate=="function",N=a.pendingProps!==N,ae||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(N||Y!==b)&&Pg(a,m,i,b),yl=!1;var X=a.memoizedState;m.state=X,Yi(a,i,m,d),Vi(),Y=a.memoizedState,N||X!==Y||yl?(typeof oe=="function"&&(Rf(a,l,oe,i),Y=a.memoizedState),(D=yl||qg(a,l,D,i,X,Y,b))?(ae||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(a.flags|=4194308)):(typeof m.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=i,a.memoizedState=Y),m.props=i,m.state=Y,m.context=b,i=D):(typeof m.componentDidMount=="function"&&(a.flags|=4194308),i=!1)}else{m=a.stateNode,af(t,a),b=a.memoizedProps,ae=hs(l,b),m.props=ae,oe=a.pendingProps,X=m.context,Y=l.contextType,D=_s,typeof Y=="object"&&Y!==null&&(D=Xa(Y)),N=l.getDerivedStateFromProps,(Y=typeof N=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==oe||X!==D)&&Pg(a,m,i,D),yl=!1,X=a.memoizedState,m.state=X,Yi(a,i,m,d),Vi();var Z=a.memoizedState;b!==oe||X!==Z||yl||t!==null&&t.dependencies!==null&&Sc(t.dependencies)?(typeof N=="function"&&(Rf(a,l,N,i),Z=a.memoizedState),(ae=yl||qg(a,l,ae,i,X,Z,D)||t!==null&&t.dependencies!==null&&Sc(t.dependencies))?(Y||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(i,Z,D),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(i,Z,D)),typeof m.componentDidUpdate=="function"&&(a.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===t.memoizedProps&&X===t.memoizedState||(a.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&X===t.memoizedState||(a.flags|=1024),a.memoizedProps=i,a.memoizedState=Z),m.props=i,m.state=Z,m.context=D,i=ae):(typeof m.componentDidUpdate!="function"||b===t.memoizedProps&&X===t.memoizedState||(a.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&X===t.memoizedState||(a.flags|=1024),i=!1)}return m=i,Ic(t,a),i=(a.flags&128)!==0,m||i?(m=a.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:m.render(),a.flags|=1,t!==null&&i?(a.child=ds(a,t.child,null,d),a.child=ds(a,null,l,d)):Qa(t,a,l,d),a.memoizedState=m.state,t=a.child):t=Gr(t,a,d),t}function rv(t,a,l,i){return ls(),a.flags|=256,Qa(t,a,l,i),a.child}var Df={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Of(t){return{baseLanes:t,cachePool:Gp()}}function Mf(t,a,l){return t=t!==null?t.childLanes&~l:0,a&&(t|=zn),t}function lv(t,a,l){var i=a.pendingProps,d=!1,m=(a.flags&128)!==0,b;if((b=m)||(b=t!==null&&t.memoizedState===null?!1:(xa.current&2)!==0),b&&(d=!0,a.flags&=-129),b=(a.flags&32)!==0,a.flags&=-33,t===null){if(Et){if(d?Sl(a):El(),(t=la)?(t=hx(t,Qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:pl!==null?{id:Sr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=$p(t),l.return=a,a.child=l,Ga=a,la=null)):t=null,t===null)throw vl(a);return ph(t)?a.lanes=32:a.lanes=536870912,null}var N=i.children;return i=i.fallback,d?(El(),d=a.mode,N=qc({mode:"hidden",children:N},d),i=rs(i,d,l,null),N.return=a,i.return=a,N.sibling=i,a.child=N,i=a.child,i.memoizedState=Of(l),i.childLanes=Mf(t,b,l),a.memoizedState=Df,Zi(null,i)):(Sl(a),_f(a,N))}var D=t.memoizedState;if(D!==null&&(N=D.dehydrated,N!==null)){if(m)a.flags&256?(Sl(a),a.flags&=-257,a=Lf(t,a,l)):a.memoizedState!==null?(El(),a.child=t.child,a.flags|=128,a=null):(El(),N=i.fallback,d=a.mode,i=qc({mode:"visible",children:i.children},d),N=rs(N,d,l,null),N.flags|=2,i.return=a,N.return=a,i.sibling=N,a.child=i,ds(a,t.child,null,l),i=a.child,i.memoizedState=Of(l),i.childLanes=Mf(t,b,l),a.memoizedState=Df,a=Zi(null,i));else if(Sl(a),ph(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var Y=b.dgst;b=Y,i=Error(s(419)),i.stack="",i.digest=b,Bi({value:i,source:null,stack:null}),a=Lf(t,a,l)}else if(ka||$s(t,a,l,!1),b=(l&t.childLanes)!==0,ka||b){if(b=ta,b!==null&&(i=A(b,l),i!==0&&i!==D.retryLane))throw D.retryLane=i,ns(t,i),jn(b,t,i),Cf;mh(N)||Zc(),a=Lf(t,a,l)}else mh(N)?(a.flags|=192,a.child=t.child,a=null):(t=D.treeContext,la=Zn(N.nextSibling),Ga=a,Et=!0,gl=null,Qn=!1,t!==null&&Ip(a,t),a=_f(a,i.children),a.flags|=4096);return a}return d?(El(),N=i.fallback,d=a.mode,D=t.child,Y=D.sibling,i=Ir(D,{mode:"hidden",children:i.children}),i.subtreeFlags=D.subtreeFlags&65011712,Y!==null?N=Ir(Y,N):(N=rs(N,d,l,null),N.flags|=2),N.return=a,i.return=a,i.sibling=N,a.child=i,Zi(null,i),i=a.child,N=t.child.memoizedState,N===null?N=Of(l):(d=N.cachePool,d!==null?(D=ja._currentValue,d=d.parent!==D?{parent:D,pool:D}:d):d=Gp(),N={baseLanes:N.baseLanes|l,cachePool:d}),i.memoizedState=N,i.childLanes=Mf(t,b,l),a.memoizedState=Df,Zi(t.child,i)):(Sl(a),l=t.child,t=l.sibling,l=Ir(l,{mode:"visible",children:i.children}),l.return=a,l.sibling=null,t!==null&&(b=a.deletions,b===null?(a.deletions=[t],a.flags|=16):b.push(t)),a.child=l,a.memoizedState=null,l)}function _f(t,a){return a=qc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function qc(t,a){return t=On(22,t,null,a),t.lanes=0,t}function Lf(t,a,l){return ds(a,t.child,null,l),t=_f(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function sv(t,a,l){t.lanes|=a;var i=t.alternate;i!==null&&(i.lanes|=a),Qd(t.return,a,l)}function zf(t,a,l,i,d,m){var b=t.memoizedState;b===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:d,treeForkCount:m}:(b.isBackwards=a,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=l,b.tailMode=d,b.treeForkCount=m)}function iv(t,a,l){var i=a.pendingProps,d=i.revealOrder,m=i.tail;i=i.children;var b=xa.current,N=(b&2)!==0;if(N?(b=b&1|2,a.flags|=128):b&=1,K(xa,b),Qa(t,a,i,l),i=Et?$i:0,!N&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&sv(t,l,a);else if(t.tag===19)sv(t,l,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(d){case"forwards":for(l=a.child,d=null;l!==null;)t=l.alternate,t!==null&&Ac(t)===null&&(d=l),l=l.sibling;l=d,l===null?(d=a.child,a.child=null):(d=l.sibling,l.sibling=null),zf(a,!1,d,l,m,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,d=a.child,a.child=null;d!==null;){if(t=d.alternate,t!==null&&Ac(t)===null){a.child=d;break}t=d.sibling,d.sibling=l,l=d,d=t}zf(a,!0,l,null,m,i);break;case"together":zf(a,!1,null,null,void 0,i);break;default:a.memoizedState=null}return a.child}function Gr(t,a,l){if(t!==null&&(a.dependencies=t.dependencies),Rl|=a.lanes,(l&a.childLanes)===0)if(t!==null){if($s(t,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(s(153));if(a.child!==null){for(t=a.child,l=Ir(t,t.pendingProps),a.child=l,l.return=a;t.sibling!==null;)t=t.sibling,l=l.sibling=Ir(t,t.pendingProps),l.return=a;l.sibling=null}return a.child}function Uf(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Sc(t)))}function sw(t,a,l){switch(a.tag){case 3:He(a,a.stateNode.containerInfo),xl(a,ja,t.memoizedState.cache),ls();break;case 27:case 5:Qe(a);break;case 4:He(a,a.stateNode.containerInfo);break;case 10:xl(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,of(a),null;break;case 13:var i=a.memoizedState;if(i!==null)return i.dehydrated!==null?(Sl(a),a.flags|=128,null):(l&a.child.childLanes)!==0?lv(t,a,l):(Sl(a),t=Gr(t,a,l),t!==null?t.sibling:null);Sl(a);break;case 19:var d=(t.flags&128)!==0;if(i=(l&a.childLanes)!==0,i||($s(t,a,l,!1),i=(l&a.childLanes)!==0),d){if(i)return iv(t,a,l);a.flags|=128}if(d=a.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),K(xa,xa.current),i)break;return null;case 22:return a.lanes=0,Jg(t,a,l,a.pendingProps);case 24:xl(a,ja,t.memoizedState.cache)}return Gr(t,a,l)}function ov(t,a,l){if(t!==null)if(t.memoizedProps!==a.pendingProps)ka=!0;else{if(!Uf(t,l)&&(a.flags&128)===0)return ka=!1,sw(t,a,l);ka=(t.flags&131072)!==0}else ka=!1,Et&&(a.flags&1048576)!==0&&Hp(a,$i,a.index);switch(a.lanes=0,a.tag){case 16:e:{var i=a.pendingProps;if(t=cs(a.elementType),a.type=t,typeof t=="function")Id(t)?(i=hs(t,i),a.tag=1,a=nv(null,a,t,i,l)):(a.tag=0,a=Af(null,a,t,i,l));else{if(t!=null){var d=t.$$typeof;if(d===Q){a.tag=11,a=Kg(null,a,t,i,l);break e}else if(d===M){a.tag=14,a=Zg(null,a,t,i,l);break e}}throw a=Te(t)||t,Error(s(306,a,""))}}return a;case 0:return Af(t,a,a.type,a.pendingProps,l);case 1:return i=a.type,d=hs(i,a.pendingProps),nv(t,a,i,d,l);case 3:e:{if(He(a,a.stateNode.containerInfo),t===null)throw Error(s(387));i=a.pendingProps;var m=a.memoizedState;d=m.element,af(t,a),Yi(a,i,null,l);var b=a.memoizedState;if(i=b.cache,xl(a,ja,i),i!==m.cache&&Kd(a,[ja],l,!0),Vi(),i=b.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:b.cache},a.updateQueue.baseState=m,a.memoizedState=m,a.flags&256){a=rv(t,a,i,l);break e}else if(i!==d){d=Yn(Error(s(424)),a),Bi(d),a=rv(t,a,i,l);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(la=Zn(t.firstChild),Ga=a,Et=!0,gl=null,Qn=!0,l=Jp(a,null,i,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ls(),i===d){a=Gr(t,a,l);break e}Qa(t,a,i,l)}a=a.child}return a;case 26:return Ic(t,a),t===null?(l=yx(a.type,null,a.pendingProps,null))?a.memoizedState=l:Et||(l=a.type,t=a.pendingProps,i=ru(ve.current).createElement(l),i[ye]=a,i[De]=t,Ka(i,l,t),ft(i),a.stateNode=i):a.memoizedState=yx(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Qe(a),t===null&&Et&&(i=a.stateNode=gx(a.type,a.pendingProps,ve.current),Ga=a,Qn=!0,d=la,Dl(a.type)?(gh=d,la=Zn(i.firstChild)):la=d),Qa(t,a,a.pendingProps.children,l),Ic(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&Et&&((d=i=la)&&(i=zw(i,a.type,a.pendingProps,Qn),i!==null?(a.stateNode=i,Ga=a,la=Zn(i.firstChild),Qn=!1,d=!0):d=!1),d||vl(a)),Qe(a),d=a.type,m=a.pendingProps,b=t!==null?t.memoizedProps:null,i=m.children,dh(d,m)?i=null:b!==null&&dh(d,b)&&(a.flags|=32),a.memoizedState!==null&&(d=uf(t,a,Z1,null,null,l),ho._currentValue=d),Ic(t,a),Qa(t,a,i,l),a.child;case 6:return t===null&&Et&&((t=l=la)&&(l=Uw(l,a.pendingProps,Qn),l!==null?(a.stateNode=l,Ga=a,la=null,t=!0):t=!1),t||vl(a)),null;case 13:return lv(t,a,l);case 4:return He(a,a.stateNode.containerInfo),i=a.pendingProps,t===null?a.child=ds(a,null,i,l):Qa(t,a,i,l),a.child;case 11:return Kg(t,a,a.type,a.pendingProps,l);case 7:return Qa(t,a,a.pendingProps,l),a.child;case 8:return Qa(t,a,a.pendingProps.children,l),a.child;case 12:return Qa(t,a,a.pendingProps.children,l),a.child;case 10:return i=a.pendingProps,xl(a,a.type,i.value),Qa(t,a,i.children,l),a.child;case 9:return d=a.type._context,i=a.pendingProps.children,is(a),d=Xa(d),i=i(d),a.flags|=1,Qa(t,a,i,l),a.child;case 14:return Zg(t,a,a.type,a.pendingProps,l);case 15:return Wg(t,a,a.type,a.pendingProps,l);case 19:return iv(t,a,l);case 31:return lw(t,a,l);case 22:return Jg(t,a,l,a.pendingProps);case 24:return is(a),i=Xa(ja),t===null?(d=Jd(),d===null&&(d=ta,m=Zd(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),a.memoizedState={parent:i,cache:d},tf(a),xl(a,ja,d)):((t.lanes&l)!==0&&(af(t,a),Yi(a,null,null,l),Vi()),d=t.memoizedState,m=a.memoizedState,d.parent!==i?(d={parent:i,cache:i},a.memoizedState=d,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=d),xl(a,ja,i)):(i=m.cache,xl(a,ja,i),i!==d.cache&&Kd(a,[ja],l,!0))),Qa(t,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Xr(t){t.flags|=4}function $f(t,a,l,i,d){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(d&335544128)===d)if(t.stateNode.complete)t.flags|=8192;else if(Lv())t.flags|=8192;else throw us=Rc,ef}else t.flags&=-16777217}function cv(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Nx(a))if(Lv())t.flags|=8192;else throw us=Rc,ef}function Pc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Wt():536870912,t.lanes|=a,Ks|=a)}function Wi(t,a){if(!Et)switch(t.tailMode){case"hidden":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function sa(t){var a=t.alternate!==null&&t.alternate.child===t.child,l=0,i=0;if(a)for(var d=t.child;d!==null;)l|=d.lanes|d.childLanes,i|=d.subtreeFlags&65011712,i|=d.flags&65011712,d.return=t,d=d.sibling;else for(d=t.child;d!==null;)l|=d.lanes|d.childLanes,i|=d.subtreeFlags,i|=d.flags,d.return=t,d=d.sibling;return t.subtreeFlags|=i,t.childLanes=l,a}function iw(t,a,l){var i=a.pendingProps;switch(Vd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sa(a),null;case 1:return sa(a),null;case 3:return l=a.stateNode,i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Fr(ja),$e(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(Us(a)?Xr(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Gd())),sa(a),null;case 26:var d=a.type,m=a.memoizedState;return t===null?(Xr(a),m!==null?(sa(a),cv(a,m)):(sa(a),$f(a,d,null,i,l))):m?m!==t.memoizedState?(Xr(a),sa(a),cv(a,m)):(sa(a),a.flags&=-16777217):(t=t.memoizedProps,t!==i&&Xr(a),sa(a),$f(a,d,t,i,l)),null;case 27:if(ia(a),l=ve.current,d=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==i&&Xr(a);else{if(!i){if(a.stateNode===null)throw Error(s(166));return sa(a),null}t=ue.current,Us(a)?qp(a):(t=gx(d,i,l),a.stateNode=t,Xr(a))}return sa(a),null;case 5:if(ia(a),d=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==i&&Xr(a);else{if(!i){if(a.stateNode===null)throw Error(s(166));return sa(a),null}if(m=ue.current,Us(a))qp(a);else{var b=ru(ve.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?m.multiple=!0:i.size&&(m.size=i.size);break;default:m=typeof i.is=="string"?b.createElement(d,{is:i.is}):b.createElement(d)}}m[ye]=a,m[De]=i;e:for(b=a.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===a)break e;for(;b.sibling===null;){if(b.return===null||b.return===a)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}a.stateNode=m;e:switch(Ka(m,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(a)}}return sa(a),$f(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,l),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==i&&Xr(a);else{if(typeof i!="string"&&a.stateNode===null)throw Error(s(166));if(t=ve.current,Us(a)){if(t=a.stateNode,l=a.memoizedProps,i=null,d=Ga,d!==null)switch(d.tag){case 27:case 5:i=d.memoizedProps}t[ye]=a,t=!!(t.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||lx(t.nodeValue,l)),t||vl(a,!0)}else t=ru(t).createTextNode(i),t[ye]=a,a.stateNode=t}return sa(a),null;case 31:if(l=a.memoizedState,t===null||t.memoizedState!==null){if(i=Us(a),l!==null){if(t===null){if(!i)throw Error(s(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[ye]=a}else ls(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sa(a),t=!1}else l=Gd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return a.flags&256?(_n(a),a):(_n(a),null);if((a.flags&128)!==0)throw Error(s(558))}return sa(a),null;case 13:if(i=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(d=Us(a),i!==null&&i.dehydrated!==null){if(t===null){if(!d)throw Error(s(318));if(d=a.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[ye]=a}else ls(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sa(a),d=!1}else d=Gd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=d),d=!0;if(!d)return a.flags&256?(_n(a),a):(_n(a),null)}return _n(a),(a.flags&128)!==0?(a.lanes=l,a):(l=i!==null,t=t!==null&&t.memoizedState!==null,l&&(i=a.child,d=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(d=i.alternate.memoizedState.cachePool.pool),m=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(m=i.memoizedState.cachePool.pool),m!==d&&(i.flags|=2048)),l!==t&&l&&(a.child.flags|=8192),Pc(a,a.updateQueue),sa(a),null);case 4:return $e(),t===null&&sh(a.stateNode.containerInfo),sa(a),null;case 10:return Fr(a.type),sa(a),null;case 19:if(B(xa),i=a.memoizedState,i===null)return sa(a),null;if(d=(a.flags&128)!==0,m=i.rendering,m===null)if(d)Wi(i,!1);else{if(ha!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(m=Ac(t),m!==null){for(a.flags|=128,Wi(i,!1),t=m.updateQueue,a.updateQueue=t,Pc(a,t),a.subtreeFlags=0,t=l,l=a.child;l!==null;)Up(l,t),l=l.sibling;return K(xa,xa.current&1|2),Et&&qr(a,i.treeForkCount),a.child}t=t.sibling}i.tail!==null&&aa()>Xc&&(a.flags|=128,d=!0,Wi(i,!1),a.lanes=4194304)}else{if(!d)if(t=Ac(m),t!==null){if(a.flags|=128,d=!0,t=t.updateQueue,a.updateQueue=t,Pc(a,t),Wi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!m.alternate&&!Et)return sa(a),null}else 2*aa()-i.renderingStartTime>Xc&&l!==536870912&&(a.flags|=128,d=!0,Wi(i,!1),a.lanes=4194304);i.isBackwards?(m.sibling=a.child,a.child=m):(t=i.last,t!==null?t.sibling=m:a.child=m,i.last=m)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=aa(),t.sibling=null,l=xa.current,K(xa,d?l&1|2:l&1),Et&&qr(a,i.treeForkCount),t):(sa(a),null);case 22:case 23:return _n(a),sf(),i=a.memoizedState!==null,t!==null?t.memoizedState!==null!==i&&(a.flags|=8192):i&&(a.flags|=8192),i?(l&536870912)!==0&&(a.flags&128)===0&&(sa(a),a.subtreeFlags&6&&(a.flags|=8192)):sa(a),l=a.updateQueue,l!==null&&Pc(a,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==l&&(a.flags|=2048),t!==null&&B(os),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Fr(ja),sa(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function ow(t,a){switch(Vd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Fr(ja),$e(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return ia(a),null;case 31:if(a.memoizedState!==null){if(_n(a),a.alternate===null)throw Error(s(340));ls()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(_n(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(s(340));ls()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return B(xa),null;case 4:return $e(),null;case 10:return Fr(a.type),null;case 22:case 23:return _n(a),sf(),t!==null&&B(os),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Fr(ja),null;case 25:return null;default:return null}}function uv(t,a){switch(Vd(a),a.tag){case 3:Fr(ja),$e();break;case 26:case 27:case 5:ia(a);break;case 4:$e();break;case 31:a.memoizedState!==null&&_n(a);break;case 13:_n(a);break;case 19:B(xa);break;case 10:Fr(a.type);break;case 22:case 23:_n(a),sf(),t!==null&&B(os);break;case 24:Fr(ja)}}function Ji(t,a){try{var l=a.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var d=i.next;l=d;do{if((l.tag&t)===t){i=void 0;var m=l.create,b=l.inst;i=m(),b.destroy=i}l=l.next}while(l!==d)}}catch(N){Ft(a,a.return,N)}}function Nl(t,a,l){try{var i=a.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var m=d.next;i=m;do{if((i.tag&t)===t){var b=i.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,d=a;var D=l,Y=N;try{Y()}catch(ae){Ft(d,D,ae)}}}i=i.next}while(i!==m)}}catch(ae){Ft(a,a.return,ae)}}function dv(t){var a=t.updateQueue;if(a!==null){var l=t.stateNode;try{tg(a,l)}catch(i){Ft(t,t.return,i)}}}function fv(t,a,l){l.props=hs(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(i){Ft(t,a,i)}}function eo(t,a){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var i=t.stateNode;break;case 30:i=t.stateNode;break;default:i=t.stateNode}typeof l=="function"?t.refCleanup=l(i):l.current=i}}catch(d){Ft(t,a,d)}}function Nr(t,a){var l=t.ref,i=t.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(d){Ft(t,a,d)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){Ft(t,a,d)}else l.current=null}function hv(t){var a=t.type,l=t.memoizedProps,i=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(d){Ft(t,t.return,d)}}function Bf(t,a,l){try{var i=t.stateNode;Aw(i,t.type,l,a),i[De]=a}catch(d){Ft(t,t.return,d)}}function mv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Dl(t.type)||t.tag===4}function Hf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||mv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Dl(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function If(t,a,l){var i=t.tag;if(i===5||i===6)t=t.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(t),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=an));else if(i!==4&&(i===27&&Dl(t.type)&&(l=t.stateNode,a=null),t=t.child,t!==null))for(If(t,a,l),t=t.sibling;t!==null;)If(t,a,l),t=t.sibling}function Fc(t,a,l){var i=t.tag;if(i===5||i===6)t=t.stateNode,a?l.insertBefore(t,a):l.appendChild(t);else if(i!==4&&(i===27&&Dl(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Fc(t,a,l),t=t.sibling;t!==null;)Fc(t,a,l),t=t.sibling}function pv(t){var a=t.stateNode,l=t.memoizedProps;try{for(var i=t.type,d=a.attributes;d.length;)a.removeAttributeNode(d[0]);Ka(a,i,l),a[ye]=t,a[De]=l}catch(m){Ft(t,t.return,m)}}var Qr=!1,Ta=!1,qf=!1,gv=typeof WeakSet=="function"?WeakSet:Set,Ia=null;function cw(t,a){if(t=t.containerInfo,ch=du,t=Tp(t),_d(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var d=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var b=0,N=-1,D=-1,Y=0,ae=0,oe=t,X=null;t:for(;;){for(var Z;oe!==l||d!==0&&oe.nodeType!==3||(N=b+d),oe!==m||i!==0&&oe.nodeType!==3||(D=b+i),oe.nodeType===3&&(b+=oe.nodeValue.length),(Z=oe.firstChild)!==null;)X=oe,oe=Z;for(;;){if(oe===t)break t;if(X===l&&++Y===d&&(N=b),X===m&&++ae===i&&(D=b),(Z=oe.nextSibling)!==null)break;oe=X,X=oe.parentNode}oe=Z}l=N===-1||D===-1?null:{start:N,end:D}}else l=null}l=l||{start:0,end:0}}else l=null;for(uh={focusedElem:t,selectionRange:l},du=!1,Ia=a;Ia!==null;)if(a=Ia,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,Ia=t;else for(;Ia!==null;){switch(a=Ia,m=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)d=t[l],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&m!==null){t=void 0,l=a,d=m.memoizedProps,m=m.memoizedState,i=l.stateNode;try{var Me=hs(l.type,d);t=i.getSnapshotBeforeUpdate(Me,m),i.__reactInternalSnapshotBeforeUpdate=t}catch(Ve){Ft(l,l.return,Ve)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,l=t.nodeType,l===9)hh(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":hh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=a.sibling,t!==null){t.return=a.return,Ia=t;break}Ia=a.return}}function vv(t,a,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Zr(t,l),i&4&&Ji(5,l);break;case 1:if(Zr(t,l),i&4)if(t=l.stateNode,a===null)try{t.componentDidMount()}catch(b){Ft(l,l.return,b)}else{var d=hs(l.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(d,a,t.__reactInternalSnapshotBeforeUpdate)}catch(b){Ft(l,l.return,b)}}i&64&&dv(l),i&512&&eo(l,l.return);break;case 3:if(Zr(t,l),i&64&&(t=l.updateQueue,t!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{tg(t,a)}catch(b){Ft(l,l.return,b)}}break;case 27:a===null&&i&4&&pv(l);case 26:case 5:Zr(t,l),a===null&&i&4&&hv(l),i&512&&eo(l,l.return);break;case 12:Zr(t,l);break;case 31:Zr(t,l),i&4&&bv(t,l);break;case 13:Zr(t,l),i&4&&wv(t,l),i&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=xw.bind(null,l),$w(t,l))));break;case 22:if(i=l.memoizedState!==null||Qr,!i){a=a!==null&&a.memoizedState!==null||Ta,d=Qr;var m=Ta;Qr=i,(Ta=a)&&!m?Wr(t,l,(l.subtreeFlags&8772)!==0):Zr(t,l),Qr=d,Ta=m}break;case 30:break;default:Zr(t,l)}}function xv(t){var a=t.alternate;a!==null&&(t.alternate=null,xv(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Fe(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var oa=null,wn=!1;function Kr(t,a,l){for(l=l.child;l!==null;)yv(t,a,l),l=l.sibling}function yv(t,a,l){if(te&&typeof te.onCommitFiberUnmount=="function")try{te.onCommitFiberUnmount(Pe,l)}catch{}switch(l.tag){case 26:Ta||Nr(l,a),Kr(t,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Ta||Nr(l,a);var i=oa,d=wn;Dl(l.type)&&(oa=l.stateNode,wn=!1),Kr(t,a,l),co(l.stateNode),oa=i,wn=d;break;case 5:Ta||Nr(l,a);case 6:if(i=oa,d=wn,oa=null,Kr(t,a,l),oa=i,wn=d,oa!==null)if(wn)try{(oa.nodeType===9?oa.body:oa.nodeName==="HTML"?oa.ownerDocument.body:oa).removeChild(l.stateNode)}catch(m){Ft(l,a,m)}else try{oa.removeChild(l.stateNode)}catch(m){Ft(l,a,m)}break;case 18:oa!==null&&(wn?(t=oa,dx(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),ri(t)):dx(oa,l.stateNode));break;case 4:i=oa,d=wn,oa=l.stateNode.containerInfo,wn=!0,Kr(t,a,l),oa=i,wn=d;break;case 0:case 11:case 14:case 15:Nl(2,l,a),Ta||Nl(4,l,a),Kr(t,a,l);break;case 1:Ta||(Nr(l,a),i=l.stateNode,typeof i.componentWillUnmount=="function"&&fv(l,a,i)),Kr(t,a,l);break;case 21:Kr(t,a,l);break;case 22:Ta=(i=Ta)||l.memoizedState!==null,Kr(t,a,l),Ta=i;break;default:Kr(t,a,l)}}function bv(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ri(t)}catch(l){Ft(a,a.return,l)}}}function wv(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ri(t)}catch(l){Ft(a,a.return,l)}}function uw(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new gv),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new gv),a;default:throw Error(s(435,t.tag))}}function Vc(t,a){var l=uw(t);a.forEach(function(i){if(!l.has(i)){l.add(i);var d=yw.bind(null,t,i);i.then(d,d)}})}function Sn(t,a){var l=a.deletions;if(l!==null)for(var i=0;i<l.length;i++){var d=l[i],m=t,b=a,N=b;e:for(;N!==null;){switch(N.tag){case 27:if(Dl(N.type)){oa=N.stateNode,wn=!1;break e}break;case 5:oa=N.stateNode,wn=!1;break e;case 3:case 4:oa=N.stateNode.containerInfo,wn=!0;break e}N=N.return}if(oa===null)throw Error(s(160));yv(m,b,d),oa=null,wn=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Sv(a,t),a=a.sibling}var ur=null;function Sv(t,a){var l=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Sn(a,t),En(t),i&4&&(Nl(3,t,t.return),Ji(3,t),Nl(5,t,t.return));break;case 1:Sn(a,t),En(t),i&512&&(Ta||l===null||Nr(l,l.return)),i&64&&Qr&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var d=ur;if(Sn(a,t),En(t),i&512&&(Ta||l===null||Nr(l,l.return)),i&4){var m=l!==null?l.memoizedState:null;if(i=t.memoizedState,l===null)if(i===null)if(t.stateNode===null){e:{i=t.type,l=t.memoizedProps,d=d.ownerDocument||d;t:switch(i){case"title":m=d.getElementsByTagName("title")[0],(!m||m[Je]||m[ye]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(i),d.head.insertBefore(m,d.querySelector("head > title"))),Ka(m,i,l),m[ye]=t,ft(m),i=m;break e;case"link":var b=Sx("link","href",d).get(i+(l.href||""));if(b){for(var N=0;N<b.length;N++)if(m=b[N],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(N,1);break t}}m=d.createElement(i),Ka(m,i,l),d.head.appendChild(m);break;case"meta":if(b=Sx("meta","content",d).get(i+(l.content||""))){for(N=0;N<b.length;N++)if(m=b[N],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(N,1);break t}}m=d.createElement(i),Ka(m,i,l),d.head.appendChild(m);break;default:throw Error(s(468,i))}m[ye]=t,ft(m),i=m}t.stateNode=i}else Ex(d,t.type,t.stateNode);else t.stateNode=wx(d,i,t.memoizedProps);else m!==i?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,i===null?Ex(d,t.type,t.stateNode):wx(d,i,t.memoizedProps)):i===null&&t.stateNode!==null&&Bf(t,t.memoizedProps,l.memoizedProps)}break;case 27:Sn(a,t),En(t),i&512&&(Ta||l===null||Nr(l,l.return)),l!==null&&i&4&&Bf(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Sn(a,t),En(t),i&512&&(Ta||l===null||Nr(l,l.return)),t.flags&32){d=t.stateNode;try{hl(d,"")}catch(Me){Ft(t,t.return,Me)}}i&4&&t.stateNode!=null&&(d=t.memoizedProps,Bf(t,d,l!==null?l.memoizedProps:d)),i&1024&&(qf=!0);break;case 6:if(Sn(a,t),En(t),i&4){if(t.stateNode===null)throw Error(s(162));i=t.memoizedProps,l=t.stateNode;try{l.nodeValue=i}catch(Me){Ft(t,t.return,Me)}}break;case 3:if(iu=null,d=ur,ur=lu(a.containerInfo),Sn(a,t),ur=d,En(t),i&4&&l!==null&&l.memoizedState.isDehydrated)try{ri(a.containerInfo)}catch(Me){Ft(t,t.return,Me)}qf&&(qf=!1,Ev(t));break;case 4:i=ur,ur=lu(t.stateNode.containerInfo),Sn(a,t),En(t),ur=i;break;case 12:Sn(a,t),En(t);break;case 31:Sn(a,t),En(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Vc(t,i)));break;case 13:Sn(a,t),En(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Gc=aa()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Vc(t,i)));break;case 22:d=t.memoizedState!==null;var D=l!==null&&l.memoizedState!==null,Y=Qr,ae=Ta;if(Qr=Y||d,Ta=ae||D,Sn(a,t),Ta=ae,Qr=Y,En(t),i&8192)e:for(a=t.stateNode,a._visibility=d?a._visibility&-2:a._visibility|1,d&&(l===null||D||Qr||Ta||ms(t)),l=null,a=t;;){if(a.tag===5||a.tag===26){if(l===null){D=l=a;try{if(m=D.stateNode,d)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=D.stateNode;var oe=D.memoizedProps.style,X=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;N.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(Me){Ft(D,D.return,Me)}}}else if(a.tag===6){if(l===null){D=a;try{D.stateNode.nodeValue=d?"":D.memoizedProps}catch(Me){Ft(D,D.return,Me)}}}else if(a.tag===18){if(l===null){D=a;try{var Z=D.stateNode;d?fx(Z,!0):fx(D.stateNode,!1)}catch(Me){Ft(D,D.return,Me)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}i&4&&(i=t.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Vc(t,l))));break;case 19:Sn(a,t),En(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Vc(t,i)));break;case 30:break;case 21:break;default:Sn(a,t),En(t)}}function En(t){var a=t.flags;if(a&2){try{for(var l,i=t.return;i!==null;){if(mv(i)){l=i;break}i=i.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,m=Hf(t);Fc(t,m,d);break;case 5:var b=l.stateNode;l.flags&32&&(hl(b,""),l.flags&=-33);var N=Hf(t);Fc(t,N,b);break;case 3:case 4:var D=l.stateNode.containerInfo,Y=Hf(t);If(t,Y,D);break;default:throw Error(s(161))}}catch(ae){Ft(t,t.return,ae)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function Ev(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;Ev(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Zr(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)vv(t,a.alternate,a),a=a.sibling}function ms(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Nl(4,a,a.return),ms(a);break;case 1:Nr(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&fv(a,a.return,l),ms(a);break;case 27:co(a.stateNode);case 26:case 5:Nr(a,a.return),ms(a);break;case 22:a.memoizedState===null&&ms(a);break;case 30:ms(a);break;default:ms(a)}t=t.sibling}}function Wr(t,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var i=a.alternate,d=t,m=a,b=m.flags;switch(m.tag){case 0:case 11:case 15:Wr(d,m,l),Ji(4,m);break;case 1:if(Wr(d,m,l),i=m,d=i.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(Y){Ft(i,i.return,Y)}if(i=m,d=i.updateQueue,d!==null){var N=i.stateNode;try{var D=d.shared.hiddenCallbacks;if(D!==null)for(d.shared.hiddenCallbacks=null,d=0;d<D.length;d++)eg(D[d],N)}catch(Y){Ft(i,i.return,Y)}}l&&b&64&&dv(m),eo(m,m.return);break;case 27:pv(m);case 26:case 5:Wr(d,m,l),l&&i===null&&b&4&&hv(m),eo(m,m.return);break;case 12:Wr(d,m,l);break;case 31:Wr(d,m,l),l&&b&4&&bv(d,m);break;case 13:Wr(d,m,l),l&&b&4&&wv(d,m);break;case 22:m.memoizedState===null&&Wr(d,m,l),eo(m,m.return);break;case 30:break;default:Wr(d,m,l)}a=a.sibling}}function Pf(t,a){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&Hi(l))}function Ff(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Hi(t))}function dr(t,a,l,i){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Nv(t,a,l,i),a=a.sibling}function Nv(t,a,l,i){var d=a.flags;switch(a.tag){case 0:case 11:case 15:dr(t,a,l,i),d&2048&&Ji(9,a);break;case 1:dr(t,a,l,i);break;case 3:dr(t,a,l,i),d&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Hi(t)));break;case 12:if(d&2048){dr(t,a,l,i),t=a.stateNode;try{var m=a.memoizedProps,b=m.id,N=m.onPostCommit;typeof N=="function"&&N(b,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(D){Ft(a,a.return,D)}}else dr(t,a,l,i);break;case 31:dr(t,a,l,i);break;case 13:dr(t,a,l,i);break;case 23:break;case 22:m=a.stateNode,b=a.alternate,a.memoizedState!==null?m._visibility&2?dr(t,a,l,i):to(t,a):m._visibility&2?dr(t,a,l,i):(m._visibility|=2,Gs(t,a,l,i,(a.subtreeFlags&10256)!==0||!1)),d&2048&&Pf(b,a);break;case 24:dr(t,a,l,i),d&2048&&Ff(a.alternate,a);break;default:dr(t,a,l,i)}}function Gs(t,a,l,i,d){for(d=d&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var m=t,b=a,N=l,D=i,Y=b.flags;switch(b.tag){case 0:case 11:case 15:Gs(m,b,N,D,d),Ji(8,b);break;case 23:break;case 22:var ae=b.stateNode;b.memoizedState!==null?ae._visibility&2?Gs(m,b,N,D,d):to(m,b):(ae._visibility|=2,Gs(m,b,N,D,d)),d&&Y&2048&&Pf(b.alternate,b);break;case 24:Gs(m,b,N,D,d),d&&Y&2048&&Ff(b.alternate,b);break;default:Gs(m,b,N,D,d)}a=a.sibling}}function to(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=t,i=a,d=i.flags;switch(i.tag){case 22:to(l,i),d&2048&&Pf(i.alternate,i);break;case 24:to(l,i),d&2048&&Ff(i.alternate,i);break;default:to(l,i)}a=a.sibling}}var ao=8192;function Xs(t,a,l){if(t.subtreeFlags&ao)for(t=t.child;t!==null;)jv(t,a,l),t=t.sibling}function jv(t,a,l){switch(t.tag){case 26:Xs(t,a,l),t.flags&ao&&t.memoizedState!==null&&Kw(l,ur,t.memoizedState,t.memoizedProps);break;case 5:Xs(t,a,l);break;case 3:case 4:var i=ur;ur=lu(t.stateNode.containerInfo),Xs(t,a,l),ur=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=ao,ao=16777216,Xs(t,a,l),ao=i):Xs(t,a,l));break;default:Xs(t,a,l)}}function Rv(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function no(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var i=a[l];Ia=i,Tv(i,t)}Rv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kv(t),t=t.sibling}function kv(t){switch(t.tag){case 0:case 11:case 15:no(t),t.flags&2048&&Nl(9,t,t.return);break;case 3:no(t);break;case 12:no(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Yc(t)):no(t);break;default:no(t)}}function Yc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var i=a[l];Ia=i,Tv(i,t)}Rv(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Nl(8,a,a.return),Yc(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,Yc(a));break;default:Yc(a)}t=t.sibling}}function Tv(t,a){for(;Ia!==null;){var l=Ia;switch(l.tag){case 0:case 11:case 15:Nl(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Hi(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,Ia=i;else e:for(l=t;Ia!==null;){i=Ia;var d=i.sibling,m=i.return;if(xv(i),i===l){Ia=null;break e}if(d!==null){d.return=m,Ia=d;break e}Ia=m}}}var dw={getCacheForType:function(t){var a=Xa(ja),l=a.data.get(t);return l===void 0&&(l=t(),a.data.set(t,l)),l},cacheSignal:function(){return Xa(ja).controller.signal}},fw=typeof WeakMap=="function"?WeakMap:Map,Ot=0,ta=null,gt=null,bt=0,Pt=0,Ln=null,jl=!1,Qs=!1,Vf=!1,Jr=0,ha=0,Rl=0,ps=0,Yf=0,zn=0,Ks=0,ro=null,Nn=null,Gf=!1,Gc=0,Cv=0,Xc=1/0,Qc=null,kl=null,_a=0,Tl=null,Zs=null,el=0,Xf=0,Qf=null,Av=null,lo=0,Kf=null;function Un(){return(Ot&2)!==0&&bt!==0?bt&-bt:L.T!==null?ah():W()}function Dv(){if(zn===0)if((bt&536870912)===0||Et){var t=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),zn=t}else zn=536870912;return t=Mn.current,t!==null&&(t.flags|=32),zn}function jn(t,a,l){(t===ta&&(Pt===2||Pt===9)||t.cancelPendingCommit!==null)&&(Ws(t,0),Cl(t,bt,zn,!1)),pt(t,l),((Ot&2)===0||t!==ta)&&(t===ta&&((Ot&2)===0&&(ps|=l),ha===4&&Cl(t,bt,zn,!1)),jr(t))}function Ov(t,a,l){if((Ot&6)!==0)throw Error(s(327));var i=!l&&(a&127)===0&&(a&t.expiredLanes)===0||Tt(t,a),d=i?pw(t,a):Wf(t,a,!0),m=i;do{if(d===0){Qs&&!i&&Cl(t,a,0,!1);break}else{if(l=t.current.alternate,m&&!hw(l)){d=Wf(t,a,!1),m=!1;continue}if(d===2){if(m=a,t.errorRecoveryDisabledLanes&m)var b=0;else b=t.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){a=b;e:{var N=t;d=ro;var D=N.current.memoizedState.isDehydrated;if(D&&(Ws(N,b).flags|=256),b=Wf(N,b,!1),b!==2){if(Vf&&!D){N.errorRecoveryDisabledLanes|=m,ps|=m,d=4;break e}m=Nn,Nn=d,m!==null&&(Nn===null?Nn=m:Nn.push.apply(Nn,m))}d=b}if(m=!1,d!==2)continue}}if(d===1){Ws(t,0),Cl(t,a,0,!0);break}e:{switch(i=t,m=d,m){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Cl(i,a,zn,!jl);break e;case 2:Nn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(d=Gc+300-aa(),10<d)){if(Cl(i,a,zn,!jl),Ht(i,0,!0)!==0)break e;el=a,i.timeoutHandle=cx(Mv.bind(null,i,l,Nn,Qc,Gf,a,zn,ps,Ks,jl,m,"Throttled",-0,0),d);break e}Mv(i,l,Nn,Qc,Gf,a,zn,ps,Ks,jl,m,null,-0,0)}}break}while(!0);jr(t)}function Mv(t,a,l,i,d,m,b,N,D,Y,ae,oe,X,Z){if(t.timeoutHandle=-1,oe=a.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:an},jv(a,m,oe);var Me=(m&62914560)===m?Gc-aa():(m&4194048)===m?Cv-aa():0;if(Me=Zw(oe,Me),Me!==null){el=m,t.cancelPendingCommit=Me(Iv.bind(null,t,a,m,l,i,d,b,N,D,ae,oe,null,X,Z)),Cl(t,m,b,!Y);return}}Iv(t,a,m,l,i,d,b,N,D)}function hw(t){for(var a=t;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var d=l[i],m=d.getSnapshot;d=d.value;try{if(!Dn(m(),d))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Cl(t,a,l,i){a&=~Yf,a&=~ps,t.suspendedLanes|=a,t.pingedLanes&=~a,i&&(t.warmLanes|=a),i=t.expirationTimes;for(var d=a;0<d;){var m=31-Zt(d),b=1<<m;i[m]=-1,d&=~b}l!==0&&wa(t,l,a)}function Kc(){return(Ot&6)===0?(so(0),!1):!0}function Zf(){if(gt!==null){if(Pt===0)var t=gt.return;else t=gt,Pr=ss=null,hf(t),qs=null,qi=0,t=gt;for(;t!==null;)uv(t.alternate,t),t=t.return;gt=null}}function Ws(t,a){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,Mw(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),el=0,Zf(),ta=t,gt=l=Ir(t.current,null),bt=a,Pt=0,Ln=null,jl=!1,Qs=Tt(t,a),Vf=!1,Ks=zn=Yf=ps=Rl=ha=0,Nn=ro=null,Gf=!1,(a&8)!==0&&(a|=a&32);var i=t.entangledLanes;if(i!==0)for(t=t.entanglements,i&=a;0<i;){var d=31-Zt(i),m=1<<d;a|=t[d],i&=~m}return Jr=a,vc(),l}function _v(t,a){it=null,L.H=Ki,a===Is||a===jc?(a=Kp(),Pt=3):a===ef?(a=Kp(),Pt=4):Pt=a===Cf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ln=a,gt===null&&(ha=1,Bc(t,Yn(a,t.current)))}function Lv(){var t=Mn.current;return t===null?!0:(bt&4194048)===bt?Kn===null:(bt&62914560)===bt||(bt&536870912)!==0?t===Kn:!1}function zv(){var t=L.H;return L.H=Ki,t===null?Ki:t}function Uv(){var t=L.A;return L.A=dw,t}function Zc(){ha=4,jl||(bt&4194048)!==bt&&Mn.current!==null||(Qs=!0),(Rl&134217727)===0&&(ps&134217727)===0||ta===null||Cl(ta,bt,zn,!1)}function Wf(t,a,l){var i=Ot;Ot|=2;var d=zv(),m=Uv();(ta!==t||bt!==a)&&(Qc=null,Ws(t,a)),a=!1;var b=ha;e:do try{if(Pt!==0&&gt!==null){var N=gt,D=Ln;switch(Pt){case 8:Zf(),b=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(a=!0);var Y=Pt;if(Pt=0,Ln=null,Js(t,N,D,Y),l&&Qs){b=0;break e}break;default:Y=Pt,Pt=0,Ln=null,Js(t,N,D,Y)}}mw(),b=ha;break}catch(ae){_v(t,ae)}while(!0);return a&&t.shellSuspendCounter++,Pr=ss=null,Ot=i,L.H=d,L.A=m,gt===null&&(ta=null,bt=0,vc()),b}function mw(){for(;gt!==null;)$v(gt)}function pw(t,a){var l=Ot;Ot|=2;var i=zv(),d=Uv();ta!==t||bt!==a?(Qc=null,Xc=aa()+500,Ws(t,a)):Qs=Tt(t,a);e:do try{if(Pt!==0&&gt!==null){a=gt;var m=Ln;t:switch(Pt){case 1:Pt=0,Ln=null,Js(t,a,m,1);break;case 2:case 9:if(Xp(m)){Pt=0,Ln=null,Bv(a);break}a=function(){Pt!==2&&Pt!==9||ta!==t||(Pt=7),jr(t)},m.then(a,a);break e;case 3:Pt=7;break e;case 4:Pt=5;break e;case 7:Xp(m)?(Pt=0,Ln=null,Bv(a)):(Pt=0,Ln=null,Js(t,a,m,7));break;case 5:var b=null;switch(gt.tag){case 26:b=gt.memoizedState;case 5:case 27:var N=gt;if(b?Nx(b):N.stateNode.complete){Pt=0,Ln=null;var D=N.sibling;if(D!==null)gt=D;else{var Y=N.return;Y!==null?(gt=Y,Wc(Y)):gt=null}break t}}Pt=0,Ln=null,Js(t,a,m,5);break;case 6:Pt=0,Ln=null,Js(t,a,m,6);break;case 8:Zf(),ha=6;break e;default:throw Error(s(462))}}gw();break}catch(ae){_v(t,ae)}while(!0);return Pr=ss=null,L.H=i,L.A=d,Ot=l,gt!==null?0:(ta=null,bt=0,vc(),ha)}function gw(){for(;gt!==null&&!$a();)$v(gt)}function $v(t){var a=ov(t.alternate,t,Jr);t.memoizedProps=t.pendingProps,a===null?Wc(t):gt=a}function Bv(t){var a=t,l=a.alternate;switch(a.tag){case 15:case 0:a=av(l,a,a.pendingProps,a.type,void 0,bt);break;case 11:a=av(l,a,a.pendingProps,a.type.render,a.ref,bt);break;case 5:hf(a);default:uv(l,a),a=gt=Up(a,Jr),a=ov(l,a,Jr)}t.memoizedProps=t.pendingProps,a===null?Wc(t):gt=a}function Js(t,a,l,i){Pr=ss=null,hf(a),qs=null,qi=0;var d=a.return;try{if(rw(t,d,a,l,bt)){ha=1,Bc(t,Yn(l,t.current)),gt=null;return}}catch(m){if(d!==null)throw gt=d,m;ha=1,Bc(t,Yn(l,t.current)),gt=null;return}a.flags&32768?(Et||i===1?t=!0:Qs||(bt&536870912)!==0?t=!1:(jl=t=!0,(i===2||i===9||i===3||i===6)&&(i=Mn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Hv(a,t)):Wc(a)}function Wc(t){var a=t;do{if((a.flags&32768)!==0){Hv(a,jl);return}t=a.return;var l=iw(a.alternate,a,Jr);if(l!==null){gt=l;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=t}while(a!==null);ha===0&&(ha=5)}function Hv(t,a){do{var l=ow(t.alternate,t);if(l!==null){l.flags&=32767,gt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(t=t.sibling,t!==null)){gt=t;return}gt=t=l}while(t!==null);ha=6,gt=null}function Iv(t,a,l,i,d,m,b,N,D){t.cancelPendingCommit=null;do Jc();while(_a!==0);if((Ot&6)!==0)throw Error(s(327));if(a!==null){if(a===t.current)throw Error(s(177));if(m=a.lanes|a.childLanes,m|=Bd,et(t,l,m,b,N,D),t===ta&&(gt=ta=null,bt=0),Zs=a,Tl=t,el=l,Xf=m,Qf=d,Av=i,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,bw(Ha,function(){return Yv(),null})):(t.callbackNode=null,t.callbackPriority=0),i=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||i){i=L.T,L.T=null,d=F.p,F.p=2,b=Ot,Ot|=4;try{cw(t,a,l)}finally{Ot=b,F.p=d,L.T=i}}_a=1,qv(),Pv(),Fv()}}function qv(){if(_a===1){_a=0;var t=Tl,a=Zs,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=L.T,L.T=null;var i=F.p;F.p=2;var d=Ot;Ot|=4;try{Sv(a,t);var m=uh,b=Tp(t.containerInfo),N=m.focusedElem,D=m.selectionRange;if(b!==N&&N&&N.ownerDocument&&kp(N.ownerDocument.documentElement,N)){if(D!==null&&_d(N)){var Y=D.start,ae=D.end;if(ae===void 0&&(ae=Y),"selectionStart"in N)N.selectionStart=Y,N.selectionEnd=Math.min(ae,N.value.length);else{var oe=N.ownerDocument||document,X=oe&&oe.defaultView||window;if(X.getSelection){var Z=X.getSelection(),Me=N.textContent.length,Ve=Math.min(D.start,Me),Xt=D.end===void 0?Ve:Math.min(D.end,Me);!Z.extend&&Ve>Xt&&(b=Xt,Xt=Ve,Ve=b);var H=Rp(N,Ve),U=Rp(N,Xt);if(H&&U&&(Z.rangeCount!==1||Z.anchorNode!==H.node||Z.anchorOffset!==H.offset||Z.focusNode!==U.node||Z.focusOffset!==U.offset)){var V=oe.createRange();V.setStart(H.node,H.offset),Z.removeAllRanges(),Ve>Xt?(Z.addRange(V),Z.extend(U.node,U.offset)):(V.setEnd(U.node,U.offset),Z.addRange(V))}}}}for(oe=[],Z=N;Z=Z.parentNode;)Z.nodeType===1&&oe.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<oe.length;N++){var le=oe[N];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}du=!!ch,uh=ch=null}finally{Ot=d,F.p=i,L.T=l}}t.current=a,_a=2}}function Pv(){if(_a===2){_a=0;var t=Tl,a=Zs,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=L.T,L.T=null;var i=F.p;F.p=2;var d=Ot;Ot|=4;try{vv(t,a.alternate,a)}finally{Ot=d,F.p=i,L.T=l}}_a=3}}function Fv(){if(_a===4||_a===3){_a=0,Ba();var t=Tl,a=Zs,l=el,i=Av;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?_a=5:(_a=0,Zs=Tl=null,Vv(t,t.pendingLanes));var d=t.pendingLanes;if(d===0&&(kl=null),q(l),a=a.stateNode,te&&typeof te.onCommitFiberRoot=="function")try{te.onCommitFiberRoot(Pe,a,void 0,(a.current.flags&128)===128)}catch{}if(i!==null){a=L.T,d=F.p,F.p=2,L.T=null;try{for(var m=t.onRecoverableError,b=0;b<i.length;b++){var N=i[b];m(N.value,{componentStack:N.stack})}}finally{L.T=a,F.p=d}}(el&3)!==0&&Jc(),jr(t),d=t.pendingLanes,(l&261930)!==0&&(d&42)!==0?t===Kf?lo++:(lo=0,Kf=t):lo=0,so(0)}}function Vv(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,Hi(a)))}function Jc(){return qv(),Pv(),Fv(),Yv()}function Yv(){if(_a!==5)return!1;var t=Tl,a=Xf;Xf=0;var l=q(el),i=L.T,d=F.p;try{F.p=32>l?32:l,L.T=null,l=Qf,Qf=null;var m=Tl,b=el;if(_a=0,Zs=Tl=null,el=0,(Ot&6)!==0)throw Error(s(331));var N=Ot;if(Ot|=4,kv(m.current),Nv(m,m.current,b,l),Ot=N,so(0,!1),te&&typeof te.onPostCommitFiberRoot=="function")try{te.onPostCommitFiberRoot(Pe,m)}catch{}return!0}finally{F.p=d,L.T=i,Vv(t,a)}}function Gv(t,a,l){a=Yn(l,a),a=Tf(t.stateNode,a,2),t=wl(t,a,2),t!==null&&(pt(t,2),jr(t))}function Ft(t,a,l){if(t.tag===3)Gv(t,t,l);else for(;a!==null;){if(a.tag===3){Gv(a,t,l);break}else if(a.tag===1){var i=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(kl===null||!kl.has(i))){t=Yn(l,t),l=Xg(2),i=wl(a,l,2),i!==null&&(Qg(l,i,a,t),pt(i,2),jr(i));break}}a=a.return}}function Jf(t,a,l){var i=t.pingCache;if(i===null){i=t.pingCache=new fw;var d=new Set;i.set(a,d)}else d=i.get(a),d===void 0&&(d=new Set,i.set(a,d));d.has(l)||(Vf=!0,d.add(l),t=vw.bind(null,t,a,l),a.then(t,t))}function vw(t,a,l){var i=t.pingCache;i!==null&&i.delete(a),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,ta===t&&(bt&l)===l&&(ha===4||ha===3&&(bt&62914560)===bt&&300>aa()-Gc?(Ot&2)===0&&Ws(t,0):Yf|=l,Ks===bt&&(Ks=0)),jr(t)}function Xv(t,a){a===0&&(a=Wt()),t=ns(t,a),t!==null&&(pt(t,a),jr(t))}function xw(t){var a=t.memoizedState,l=0;a!==null&&(l=a.retryLane),Xv(t,l)}function yw(t,a){var l=0;switch(t.tag){case 31:case 13:var i=t.stateNode,d=t.memoizedState;d!==null&&(l=d.retryLane);break;case 19:i=t.stateNode;break;case 22:i=t.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(a),Xv(t,l)}function bw(t,a){return _t(t,a)}var eu=null,ei=null,eh=!1,tu=!1,th=!1,Al=0;function jr(t){t!==ei&&t.next===null&&(ei===null?eu=ei=t:ei=ei.next=t),tu=!0,eh||(eh=!0,Sw())}function so(t,a){if(!th&&tu){th=!0;do for(var l=!1,i=eu;i!==null;){if(t!==0){var d=i.pendingLanes;if(d===0)var m=0;else{var b=i.suspendedLanes,N=i.pingedLanes;m=(1<<31-Zt(42|t)+1)-1,m&=d&~(b&~N),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,Wv(i,m))}else m=bt,m=Ht(i,i===ta?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(m&3)===0||Tt(i,m)||(l=!0,Wv(i,m));i=i.next}while(l);th=!1}}function ww(){Qv()}function Qv(){tu=eh=!1;var t=0;Al!==0&&Ow()&&(t=Al);for(var a=aa(),l=null,i=eu;i!==null;){var d=i.next,m=Kv(i,a);m===0?(i.next=null,l===null?eu=d:l.next=d,d===null&&(ei=l)):(l=i,(t!==0||(m&3)!==0)&&(tu=!0)),i=d}_a!==0&&_a!==5||so(t),Al!==0&&(Al=0)}function Kv(t,a){for(var l=t.suspendedLanes,i=t.pingedLanes,d=t.expirationTimes,m=t.pendingLanes&-62914561;0<m;){var b=31-Zt(m),N=1<<b,D=d[b];D===-1?((N&l)===0||(N&i)!==0)&&(d[b]=na(N,a)):D<=a&&(t.expiredLanes|=N),m&=~N}if(a=ta,l=bt,l=Ht(t,t===a?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i=t.callbackNode,l===0||t===a&&(Pt===2||Pt===9)||t.cancelPendingCommit!==null)return i!==null&&i!==null&&Kt(i),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||Tt(t,l)){if(a=l&-l,a===t.callbackPriority)return a;switch(i!==null&&Kt(i),q(l)){case 2:case 8:l=Ja;break;case 32:l=Ha;break;case 268435456:l=Ce;break;default:l=Ha}return i=Zv.bind(null,t),l=_t(l,i),t.callbackPriority=a,t.callbackNode=l,a}return i!==null&&i!==null&&Kt(i),t.callbackPriority=2,t.callbackNode=null,2}function Zv(t,a){if(_a!==0&&_a!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(Jc()&&t.callbackNode!==l)return null;var i=bt;return i=Ht(t,t===ta?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(Ov(t,i,a),Kv(t,aa()),t.callbackNode!=null&&t.callbackNode===l?Zv.bind(null,t):null)}function Wv(t,a){if(Jc())return null;Ov(t,a,!0)}function Sw(){_w(function(){(Ot&6)!==0?_t(hn,ww):Qv()})}function ah(){if(Al===0){var t=Bs;t===0&&(t=_e,_e<<=1,(_e&261888)===0&&(_e=256)),Al=t}return Al}function Jv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ra(""+t)}function ex(t,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,t.id&&l.setAttribute("form",t.id),a.parentNode.insertBefore(l,a),t=new FormData(t),l.parentNode.removeChild(l),t}function Ew(t,a,l,i,d){if(a==="submit"&&l&&l.stateNode===d){var m=Jv((d[De]||null).action),b=i.submitter;b&&(a=(a=b[De]||null)?Jv(a.formAction):b.getAttribute("formAction"),a!==null&&(m=a,b=null));var N=new Br("action","action",null,i,d);t.push({event:N,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Al!==0){var D=b?ex(d,b):new FormData(d);Sf(l,{pending:!0,data:D,method:d.method,action:m},null,D)}}else typeof m=="function"&&(N.preventDefault(),D=b?ex(d,b):new FormData(d),Sf(l,{pending:!0,data:D,method:d.method,action:m},m,D))},currentTarget:d}]})}}for(var nh=0;nh<$d.length;nh++){var rh=$d[nh],Nw=rh.toLowerCase(),jw=rh[0].toUpperCase()+rh.slice(1);cr(Nw,"on"+jw)}cr(Dp,"onAnimationEnd"),cr(Op,"onAnimationIteration"),cr(Mp,"onAnimationStart"),cr("dblclick","onDoubleClick"),cr("focusin","onFocus"),cr("focusout","onBlur"),cr(I1,"onTransitionRun"),cr(q1,"onTransitionStart"),cr(P1,"onTransitionCancel"),cr(_p,"onTransitionEnd"),Da("onMouseEnter",["mouseout","mouseover"]),Da("onMouseLeave",["mouseout","mouseover"]),Da("onPointerEnter",["pointerout","pointerover"]),Da("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="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(" "),Rw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(io));function tx(t,a){a=(a&4)!==0;for(var l=0;l<t.length;l++){var i=t[l],d=i.event;i=i.listeners;e:{var m=void 0;if(a)for(var b=i.length-1;0<=b;b--){var N=i[b],D=N.instance,Y=N.currentTarget;if(N=N.listener,D!==m&&d.isPropagationStopped())break e;m=N,d.currentTarget=Y;try{m(d)}catch(ae){gc(ae)}d.currentTarget=null,m=D}else for(b=0;b<i.length;b++){if(N=i[b],D=N.instance,Y=N.currentTarget,N=N.listener,D!==m&&d.isPropagationStopped())break e;m=N,d.currentTarget=Y;try{m(d)}catch(ae){gc(ae)}d.currentTarget=null,m=D}}}}function vt(t,a){var l=a[Le];l===void 0&&(l=a[Le]=new Set);var i=t+"__bubble";l.has(i)||(ax(a,t,2,!1),l.add(i))}function lh(t,a,l){var i=0;a&&(i|=4),ax(l,t,i,a)}var au="_reactListening"+Math.random().toString(36).slice(2);function sh(t){if(!t[au]){t[au]=!0,Jt.forEach(function(l){l!=="selectionchange"&&(Rw.has(l)||lh(l,!1,t),lh(l,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[au]||(a[au]=!0,lh("selectionchange",!1,a))}}function ax(t,a,l,i){switch(Dx(a)){case 2:var d=eS;break;case 8:d=tS;break;default:d=wh}l=d.bind(null,a,l,t),d=void 0,!Di||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(d=!0),i?d!==void 0?t.addEventListener(a,l,{capture:!0,passive:d}):t.addEventListener(a,l,!0):d!==void 0?t.addEventListener(a,l,{passive:d}):t.addEventListener(a,l,!1)}function ih(t,a,l,i,d){var m=i;if((a&1)===0&&(a&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var N=i.stateNode.containerInfo;if(N===d)break;if(b===4)for(b=i.return;b!==null;){var D=b.tag;if((D===3||D===4)&&b.stateNode.containerInfo===d)return;b=b.return}for(;N!==null;){if(b=qt(N),b===null)return;if(D=b.tag,D===5||D===6||D===26||D===27){i=m=b;continue e}N=N.parentNode}}i=i.return}Ai(function(){var Y=m,ae=_r(l),oe=[];e:{var X=Lp.get(t);if(X!==void 0){var Z=Br,Me=t;switch(t){case"keypress":if(Cs(l)===0)break e;case"keydown":case"keyup":Z=Na;break;case"focusin":Me="focus",Z=be;break;case"focusout":Me="blur",Z=be;break;case"beforeblur":case"afterblur":Z=be;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=fc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=G;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=wr;break;case Dp:case Op:case Mp:Z=de;break;case _p:Z=hc;break;case"scroll":case"scrollend":Z=kd;break;case"wheel":Z=Cd;break;case"copy":case"cut":case"paste":Z=Se;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=zt;break;case"toggle":case"beforetoggle":Z=T1}var Ve=(a&4)!==0,Xt=!Ve&&(t==="scroll"||t==="scrollend"),H=Ve?X!==null?X+"Capture":null:X;Ve=[];for(var U=Y,V;U!==null;){var le=U;if(V=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||V===null||H===null||(le=Pn(U,H),le!=null&&Ve.push(oo(U,le,V))),Xt)break;U=U.return}0<Ve.length&&(X=new Z(X,Me,null,l,ae),oe.push({event:X,listeners:Ve}))}}if((a&7)===0){e:{if(X=t==="mouseover"||t==="pointerover",Z=t==="mouseout"||t==="pointerout",X&&l!==An&&(Me=l.relatedTarget||l.fromElement)&&(qt(Me)||Me[Ne]))break e;if((Z||X)&&(X=ae.window===ae?ae:(X=ae.ownerDocument)?X.defaultView||X.parentWindow:window,Z?(Me=l.relatedTarget||l.toElement,Z=Y,Me=Me?qt(Me):null,Me!==null&&(Xt=c(Me),Ve=Me.tag,Me!==Xt||Ve!==5&&Ve!==27&&Ve!==6)&&(Me=null)):(Z=null,Me=Y),Z!==Me)){if(Ve=fc,le="onMouseLeave",H="onMouseEnter",U="mouse",(t==="pointerout"||t==="pointerover")&&(Ve=zt,le="onPointerLeave",H="onPointerEnter",U="pointer"),Xt=Z==null?X:dt(Z),V=Me==null?X:dt(Me),X=new Ve(le,U+"leave",Z,l,ae),X.target=Xt,X.relatedTarget=V,le=null,qt(ae)===Y&&(Ve=new Ve(H,U+"enter",Me,l,ae),Ve.target=V,Ve.relatedTarget=Xt,le=Ve),Xt=le,Z&&Me)t:{for(Ve=kw,H=Z,U=Me,V=0,le=H;le;le=Ve(le))V++;le=0;for(var Ie=U;Ie;Ie=Ve(Ie))le++;for(;0<V-le;)H=Ve(H),V--;for(;0<le-V;)U=Ve(U),le--;for(;V--;){if(H===U||U!==null&&H===U.alternate){Ve=H;break t}H=Ve(H),U=Ve(U)}Ve=null}else Ve=null;Z!==null&&nx(oe,X,Z,Ve,!1),Me!==null&&Xt!==null&&nx(oe,Xt,Me,Ve,!0)}}e:{if(X=Y?dt(Y):window,Z=X.nodeName&&X.nodeName.toLowerCase(),Z==="select"||Z==="input"&&X.type==="file")var At=bp;else if(xp(X))if(wp)At=$1;else{At=z1;var ze=L1}else Z=X.nodeName,!Z||Z.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?Y&&Kl(Y.elementType)&&(At=bp):At=U1;if(At&&(At=At(t,Y))){yp(oe,At,l,ae);break e}ze&&ze(t,X,Y),t==="focusout"&&Y&&X.type==="number"&&Y.memoizedProps.value!=null&&Ct(X,"number",X.value)}switch(ze=Y?dt(Y):window,t){case"focusin":(xp(ze)||ze.contentEditable==="true")&&(Ds=ze,Ld=Y,Ui=null);break;case"focusout":Ui=Ld=Ds=null;break;case"mousedown":zd=!0;break;case"contextmenu":case"mouseup":case"dragend":zd=!1,Cp(oe,l,ae);break;case"selectionchange":if(H1)break;case"keydown":case"keyup":Cp(oe,l,ae)}var ct;if(Dd)e:{switch(t){case"compositionstart":var wt="onCompositionStart";break e;case"compositionend":wt="onCompositionEnd";break e;case"compositionupdate":wt="onCompositionUpdate";break e}wt=void 0}else As?gp(t,l)&&(wt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(wt="onCompositionStart");wt&&(hp&&l.locale!=="ko"&&(As||wt!=="onCompositionStart"?wt==="onCompositionEnd"&&As&&(ct=uc()):(Fn=ae,Oi="value"in Fn?Fn.value:Fn.textContent,As=!0)),ze=nu(Y,wt),0<ze.length&&(wt=new lt(wt,t,null,l,ae),oe.push({event:wt,listeners:ze}),ct?wt.data=ct:(ct=vp(l),ct!==null&&(wt.data=ct)))),(ct=A1?D1(t,l):O1(t,l))&&(wt=nu(Y,"onBeforeInput"),0<wt.length&&(ze=new lt("onBeforeInput","beforeinput",null,l,ae),oe.push({event:ze,listeners:wt}),ze.data=ct)),Ew(oe,t,Y,l,ae)}tx(oe,a)})}function oo(t,a,l){return{instance:t,listener:a,currentTarget:l}}function nu(t,a){for(var l=a+"Capture",i=[];t!==null;){var d=t,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=Pn(t,l),d!=null&&i.unshift(oo(t,d,m)),d=Pn(t,a),d!=null&&i.push(oo(t,d,m))),t.tag===3)return i;t=t.return}return[]}function kw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function nx(t,a,l,i,d){for(var m=a._reactName,b=[];l!==null&&l!==i;){var N=l,D=N.alternate,Y=N.stateNode;if(N=N.tag,D!==null&&D===i)break;N!==5&&N!==26&&N!==27||Y===null||(D=Y,d?(Y=Pn(l,m),Y!=null&&b.unshift(oo(l,Y,D))):d||(Y=Pn(l,m),Y!=null&&b.push(oo(l,Y,D)))),l=l.return}b.length!==0&&t.push({event:a,listeners:b})}var Tw=/\r\n?/g,Cw=/\u0000|\uFFFD/g;function rx(t){return(typeof t=="string"?t:""+t).replace(Tw,`
49
- `).replace(Cw,"")}function lx(t,a){return a=rx(a),rx(t)===a}function Gt(t,a,l,i,d,m){switch(l){case"children":typeof i=="string"?a==="body"||a==="textarea"&&i===""||hl(t,i):(typeof i=="number"||typeof i=="bigint")&&a!=="body"&&hl(t,""+i);break;case"className":vr(t,"class",i);break;case"tabIndex":vr(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":vr(t,l,i);break;case"style":xn(t,i,m);break;case"data":if(a!=="object"){vr(t,"data",i);break}case"src":case"href":if(i===""&&(a!=="a"||l!=="href")){t.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(l);break}i=ra(""+i),t.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(l==="formAction"?(a!=="input"&&Gt(t,a,"name",d.name,d,null),Gt(t,a,"formEncType",d.formEncType,d,null),Gt(t,a,"formMethod",d.formMethod,d,null),Gt(t,a,"formTarget",d.formTarget,d,null)):(Gt(t,a,"encType",d.encType,d,null),Gt(t,a,"method",d.method,d,null),Gt(t,a,"target",d.target,d,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(l);break}i=ra(""+i),t.setAttribute(l,i);break;case"onClick":i!=null&&(t.onclick=an);break;case"onScroll":i!=null&&vt("scroll",t);break;case"onScrollEnd":i!=null&&vt("scrollend",t);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(l=i.__html,l!=null){if(d.children!=null)throw Error(s(60));t.innerHTML=l}}break;case"multiple":t.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}l=ra(""+i),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(l,""+i):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":i===!0?t.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(l,i):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?t.setAttribute(l,i):t.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?t.removeAttribute(l):t.setAttribute(l,i);break;case"popover":vt("beforetoggle",t),vt("toggle",t),en(t,"popover",i);break;case"xlinkActuate":Ze(t,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ze(t,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ze(t,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ze(t,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ze(t,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ze(t,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ze(t,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ze(t,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ze(t,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":en(t,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=ks.get(l)||l,en(t,l,i))}}function oh(t,a,l,i,d,m){switch(l){case"style":xn(t,i,m);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(l=i.__html,l!=null){if(d.children!=null)throw Error(s(60));t.innerHTML=l}}break;case"children":typeof i=="string"?hl(t,i):(typeof i=="number"||typeof i=="bigint")&&hl(t,""+i);break;case"onScroll":i!=null&&vt("scroll",t);break;case"onScrollEnd":i!=null&&vt("scrollend",t);break;case"onClick":i!=null&&(t.onclick=an);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fa.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),a=l.slice(2,d?l.length-7:void 0),m=t[De]||null,m=m!=null?m[l]:null,typeof m=="function"&&t.removeEventListener(a,m,d),typeof i=="function")){typeof m!="function"&&m!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(a,i,d);break e}l in t?t[l]=i:i===!0?t.setAttribute(l,""):en(t,l,i)}}}function Ka(t,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",t),vt("load",t);var i=!1,d=!1,m;for(m in l)if(l.hasOwnProperty(m)){var b=l[m];if(b!=null)switch(m){case"src":i=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Gt(t,a,m,b,l,null)}}d&&Gt(t,a,"srcSet",l.srcSet,l,null),i&&Gt(t,a,"src",l.src,l,null);return;case"input":vt("invalid",t);var N=m=b=d=null,D=null,Y=null;for(i in l)if(l.hasOwnProperty(i)){var ae=l[i];if(ae!=null)switch(i){case"name":d=ae;break;case"type":b=ae;break;case"checked":D=ae;break;case"defaultChecked":Y=ae;break;case"value":m=ae;break;case"defaultValue":N=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,a));break;default:Gt(t,a,i,ae,l,null)}}Ti(t,m,N,D,Y,b,d,!1);return;case"select":vt("invalid",t),i=b=m=null;for(d in l)if(l.hasOwnProperty(d)&&(N=l[d],N!=null))switch(d){case"value":m=N;break;case"defaultValue":b=N;break;case"multiple":i=N;default:Gt(t,a,d,N,l,null)}a=m,l=b,t.multiple=!!i,a!=null?xr(t,!!i,a,!1):l!=null&&xr(t,!!i,l,!0);return;case"textarea":vt("invalid",t),m=d=i=null;for(b in l)if(l.hasOwnProperty(b)&&(N=l[b],N!=null))switch(b){case"value":i=N;break;case"defaultValue":d=N;break;case"children":m=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:Gt(t,a,b,N,l,null)}ir(t,i,d,m);return;case"option":for(D in l)if(l.hasOwnProperty(D)&&(i=l[D],i!=null))switch(D){case"selected":t.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Gt(t,a,D,i,l,null)}return;case"dialog":vt("beforetoggle",t),vt("toggle",t),vt("cancel",t),vt("close",t);break;case"iframe":case"object":vt("load",t);break;case"video":case"audio":for(i=0;i<io.length;i++)vt(io[i],t);break;case"image":vt("error",t),vt("load",t);break;case"details":vt("toggle",t);break;case"embed":case"source":case"link":vt("error",t),vt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in l)if(l.hasOwnProperty(Y)&&(i=l[Y],i!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Gt(t,a,Y,i,l,null)}return;default:if(Kl(a)){for(ae in l)l.hasOwnProperty(ae)&&(i=l[ae],i!==void 0&&oh(t,a,ae,i,l,void 0));return}}for(N in l)l.hasOwnProperty(N)&&(i=l[N],i!=null&&Gt(t,a,N,i,l,null))}function Aw(t,a,l,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,b=null,N=null,D=null,Y=null,ae=null;for(Z in l){var oe=l[Z];if(l.hasOwnProperty(Z)&&oe!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":D=oe;default:i.hasOwnProperty(Z)||Gt(t,a,Z,null,i,oe)}}for(var X in i){var Z=i[X];if(oe=l[X],i.hasOwnProperty(X)&&(Z!=null||oe!=null))switch(X){case"type":m=Z;break;case"name":d=Z;break;case"checked":Y=Z;break;case"defaultChecked":ae=Z;break;case"value":b=Z;break;case"defaultValue":N=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(s(137,a));break;default:Z!==oe&&Gt(t,a,X,Z,i,oe)}}Ql(t,b,N,D,Y,ae,m,d);return;case"select":Z=b=N=X=null;for(m in l)if(D=l[m],l.hasOwnProperty(m)&&D!=null)switch(m){case"value":break;case"multiple":Z=D;default:i.hasOwnProperty(m)||Gt(t,a,m,null,i,D)}for(d in i)if(m=i[d],D=l[d],i.hasOwnProperty(d)&&(m!=null||D!=null))switch(d){case"value":X=m;break;case"defaultValue":N=m;break;case"multiple":b=m;default:m!==D&&Gt(t,a,d,m,i,D)}a=N,l=b,i=Z,X!=null?xr(t,!!l,X,!1):!!i!=!!l&&(a!=null?xr(t,!!l,a,!0):xr(t,!!l,l?[]:"",!1));return;case"textarea":Z=X=null;for(N in l)if(d=l[N],l.hasOwnProperty(N)&&d!=null&&!i.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Gt(t,a,N,null,i,d)}for(b in i)if(d=i[b],m=l[b],i.hasOwnProperty(b)&&(d!=null||m!=null))switch(b){case"value":X=d;break;case"defaultValue":Z=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&Gt(t,a,b,d,i,m)}cc(t,X,Z);return;case"option":for(var Me in l)if(X=l[Me],l.hasOwnProperty(Me)&&X!=null&&!i.hasOwnProperty(Me))switch(Me){case"selected":t.selected=!1;break;default:Gt(t,a,Me,null,i,X)}for(D in i)if(X=i[D],Z=l[D],i.hasOwnProperty(D)&&X!==Z&&(X!=null||Z!=null))switch(D){case"selected":t.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:Gt(t,a,D,X,i,Z)}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 l)X=l[Ve],l.hasOwnProperty(Ve)&&X!=null&&!i.hasOwnProperty(Ve)&&Gt(t,a,Ve,null,i,X);for(Y in i)if(X=i[Y],Z=l[Y],i.hasOwnProperty(Y)&&X!==Z&&(X!=null||Z!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,a));break;default:Gt(t,a,Y,X,i,Z)}return;default:if(Kl(a)){for(var Xt in l)X=l[Xt],l.hasOwnProperty(Xt)&&X!==void 0&&!i.hasOwnProperty(Xt)&&oh(t,a,Xt,void 0,i,X);for(ae in i)X=i[ae],Z=l[ae],!i.hasOwnProperty(ae)||X===Z||X===void 0&&Z===void 0||oh(t,a,ae,X,i,Z);return}}for(var H in l)X=l[H],l.hasOwnProperty(H)&&X!=null&&!i.hasOwnProperty(H)&&Gt(t,a,H,null,i,X);for(oe in i)X=i[oe],Z=l[oe],!i.hasOwnProperty(oe)||X===Z||X==null&&Z==null||Gt(t,a,oe,X,i,Z)}function sx(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var d=l[i],m=d.transferSize,b=d.initiatorType,N=d.duration;if(m&&N&&sx(b)){for(b=0,N=d.responseEnd,i+=1;i<l.length;i++){var D=l[i],Y=D.startTime;if(Y>N)break;var ae=D.transferSize,oe=D.initiatorType;ae&&sx(oe)&&(D=D.responseEnd,b+=ae*(D<N?1:(N-Y)/(D-Y)))}if(--i,a+=8*(m+b)/(d.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var ch=null,uh=null;function ru(t){return t.nodeType===9?t:t.ownerDocument}function ix(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ox(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function dh(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var fh=null;function Ow(){var t=window.event;return t&&t.type==="popstate"?t===fh?!1:(fh=t,!0):(fh=null,!1)}var cx=typeof setTimeout=="function"?setTimeout:void 0,Mw=typeof clearTimeout=="function"?clearTimeout:void 0,ux=typeof Promise=="function"?Promise:void 0,_w=typeof queueMicrotask=="function"?queueMicrotask:typeof ux<"u"?function(t){return ux.resolve(null).then(t).catch(Lw)}:cx;function Lw(t){setTimeout(function(){throw t})}function Dl(t){return t==="head"}function dx(t,a){var l=a,i=0;do{var d=l.nextSibling;if(t.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(i===0){t.removeChild(d),ri(a);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")co(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,co(l);for(var m=l.firstChild;m;){var b=m.nextSibling,N=m.nodeName;m[Je]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=b}}else l==="body"&&co(t.ownerDocument.body);l=d}while(l);ri(a)}function fx(t,a){var l=t;t=0;do{var i=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=i}while(l)}function hh(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":hh(l),Fe(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function zw(t,a,l,i){for(;t.nodeType===1;){var d=l;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!i&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(i){if(!t[Je])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(m=t.getAttribute("rel"),m==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(m!==d.rel||t.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||t.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||t.getAttribute("title")!==(d.title==null?null:d.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(m=t.getAttribute("src"),(m!==(d.src==null?null:d.src)||t.getAttribute("type")!==(d.type==null?null:d.type)||t.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&t.getAttribute("name")===m)return t}else return t;if(t=Zn(t.nextSibling),t===null)break}return null}function Uw(t,a,l){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=Zn(t.nextSibling),t===null))return null;return t}function hx(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Zn(t.nextSibling),t===null))return null;return t}function mh(t){return t.data==="$?"||t.data==="$~"}function ph(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function $w(t,a){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||l.readyState!=="loading")a();else{var i=function(){a(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),t._reactRetry=i}}function Zn(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var gh=null;function mx(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(a===0)return Zn(t.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}t=t.nextSibling}return null}function px(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return t;a--}else l!=="/$"&&l!=="/&"||a++}t=t.previousSibling}return null}function gx(t,a,l){switch(a=ru(l),t){case"html":if(t=a.documentElement,!t)throw Error(s(452));return t;case"head":if(t=a.head,!t)throw Error(s(453));return t;case"body":if(t=a.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function co(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Fe(t)}var Wn=new Map,vx=new Set;function lu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var tl=F.d;F.d={f:Bw,r:Hw,D:Iw,C:qw,L:Pw,m:Fw,X:Yw,S:Vw,M:Gw};function Bw(){var t=tl.f(),a=Kc();return t||a}function Hw(t){var a=tt(t);a!==null&&a.tag===5&&a.type==="form"?_g(a):tl.r(t)}var ti=typeof document>"u"?null:document;function xx(t,a,l){var i=ti;if(i&&typeof a=="string"&&a){var d=Ya(a);d='link[rel="'+t+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),vx.has(d)||(vx.add(d),t={rel:t,crossOrigin:l,href:a},i.querySelector(d)===null&&(a=i.createElement("link"),Ka(a,"link",t),ft(a),i.head.appendChild(a)))}}function Iw(t){tl.D(t),xx("dns-prefetch",t,null)}function qw(t,a){tl.C(t,a),xx("preconnect",t,a)}function Pw(t,a,l){tl.L(t,a,l);var i=ti;if(i&&t&&a){var d='link[rel="preload"][as="'+Ya(a)+'"]';a==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Ya(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Ya(l.imageSizes)+'"]')):d+='[href="'+Ya(t)+'"]';var m=d;switch(a){case"style":m=ai(t);break;case"script":m=ni(t)}Wn.has(m)||(t=x({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:t,as:a},l),Wn.set(m,t),i.querySelector(d)!==null||a==="style"&&i.querySelector(uo(m))||a==="script"&&i.querySelector(fo(m))||(a=i.createElement("link"),Ka(a,"link",t),ft(a),i.head.appendChild(a)))}}function Fw(t,a){tl.m(t,a);var l=ti;if(l&&t){var i=a&&typeof a.as=="string"?a.as:"script",d='link[rel="modulepreload"][as="'+Ya(i)+'"][href="'+Ya(t)+'"]',m=d;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=ni(t)}if(!Wn.has(m)&&(t=x({rel:"modulepreload",href:t},a),Wn.set(m,t),l.querySelector(d)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(fo(m)))return}i=l.createElement("link"),Ka(i,"link",t),ft(i),l.head.appendChild(i)}}}function Vw(t,a,l){tl.S(t,a,l);var i=ti;if(i&&t){var d=ot(i).hoistableStyles,m=ai(t);a=a||"default";var b=d.get(m);if(!b){var N={loading:0,preload:null};if(b=i.querySelector(uo(m)))N.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":a},l),(l=Wn.get(m))&&vh(t,l);var D=b=i.createElement("link");ft(D),Ka(D,"link",t),D._p=new Promise(function(Y,ae){D.onload=Y,D.onerror=ae}),D.addEventListener("load",function(){N.loading|=1}),D.addEventListener("error",function(){N.loading|=2}),N.loading|=4,su(b,a,i)}b={type:"stylesheet",instance:b,count:1,state:N},d.set(m,b)}}}function Yw(t,a){tl.X(t,a);var l=ti;if(l&&t){var i=ot(l).hoistableScripts,d=ni(t),m=i.get(d);m||(m=l.querySelector(fo(d)),m||(t=x({src:t,async:!0},a),(a=Wn.get(d))&&xh(t,a),m=l.createElement("script"),ft(m),Ka(m,"link",t),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(d,m))}}function Gw(t,a){tl.M(t,a);var l=ti;if(l&&t){var i=ot(l).hoistableScripts,d=ni(t),m=i.get(d);m||(m=l.querySelector(fo(d)),m||(t=x({src:t,async:!0,type:"module"},a),(a=Wn.get(d))&&xh(t,a),m=l.createElement("script"),ft(m),Ka(m,"link",t),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(d,m))}}function yx(t,a,l,i){var d=(d=ve.current)?lu(d):null;if(!d)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=ai(l.href),l=ot(d).hoistableStyles,i=l.get(a),i||(i={type:"style",instance:null,count:0,state:null},l.set(a,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=ai(l.href);var m=ot(d).hoistableStyles,b=m.get(t);if(b||(d=d.ownerDocument||d,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(t,b),(m=d.querySelector(uo(t)))&&!m._p&&(b.instance=m,b.state.loading=5),Wn.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Wn.set(t,l),m||Xw(d,t,l,b.state))),a&&i===null)throw Error(s(528,""));return b}if(a&&i!==null)throw Error(s(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ni(l),l=ot(d).hoistableScripts,i=l.get(a),i||(i={type:"script",instance:null,count:0,state:null},l.set(a,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function ai(t){return'href="'+Ya(t)+'"'}function uo(t){return'link[rel="stylesheet"]['+t+"]"}function bx(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function Xw(t,a,l,i){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?i.loading=1:(a=t.createElement("link"),i.preload=a,a.addEventListener("load",function(){return i.loading|=1}),a.addEventListener("error",function(){return i.loading|=2}),Ka(a,"link",l),ft(a),t.head.appendChild(a))}function ni(t){return'[src="'+Ya(t)+'"]'}function fo(t){return"script[async]"+t}function wx(t,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var i=t.querySelector('style[data-href~="'+Ya(l.href)+'"]');if(i)return a.instance=i,ft(i),i;var d=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(t.ownerDocument||t).createElement("style"),ft(i),Ka(i,"style",d),su(i,l.precedence,t),a.instance=i;case"stylesheet":d=ai(l.href);var m=t.querySelector(uo(d));if(m)return a.state.loading|=4,a.instance=m,ft(m),m;i=bx(l),(d=Wn.get(d))&&vh(i,d),m=(t.ownerDocument||t).createElement("link"),ft(m);var b=m;return b._p=new Promise(function(N,D){b.onload=N,b.onerror=D}),Ka(m,"link",i),a.state.loading|=4,su(m,l.precedence,t),a.instance=m;case"script":return m=ni(l.src),(d=t.querySelector(fo(m)))?(a.instance=d,ft(d),d):(i=l,(d=Wn.get(m))&&(i=x({},l),xh(i,d)),t=t.ownerDocument||t,d=t.createElement("script"),ft(d),Ka(d,"link",i),t.head.appendChild(d),a.instance=d);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(i=a.instance,a.state.loading|=4,su(i,l.precedence,t));return a.instance}function su(t,a,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=i.length?i[i.length-1]:null,m=d,b=0;b<i.length;b++){var N=i[b];if(N.dataset.precedence===a)m=N;else if(m!==d)break}m?m.parentNode.insertBefore(t,m.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(t,a.firstChild))}function vh(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function xh(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var iu=null;function Sx(t,a,l){if(iu===null){var i=new Map,d=iu=new Map;d.set(l,i)}else d=iu,i=d.get(l),i||(i=new Map,d.set(l,i));if(i.has(t))return i;for(i.set(t,null),l=l.getElementsByTagName(t),d=0;d<l.length;d++){var m=l[d];if(!(m[Je]||m[ye]||t==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(a)||"";b=t+b;var N=i.get(b);N?N.push(m):i.set(b,[m])}}return i}function Ex(t,a,l){t=t.ownerDocument||t,t.head.insertBefore(l,a==="title"?t.querySelector("head > title"):null)}function Qw(t,a,l){if(l===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Nx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Kw(t,a,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=ai(i.href),m=a.querySelector(uo(d));if(m){a=m._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=ou.bind(t),a.then(t,t)),l.state.loading|=4,l.instance=m,ft(m);return}m=a.ownerDocument||a,i=bx(i),(d=Wn.get(d))&&vh(i,d),m=m.createElement("link"),ft(m);var b=m;b._p=new Promise(function(N,D){b.onload=N,b.onerror=D}),Ka(m,"link",i),l.instance=m}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=ou.bind(t),a.addEventListener("load",l),a.addEventListener("error",l))}}var yh=0;function Zw(t,a){return t.stylesheets&&t.count===0&&uu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var i=setTimeout(function(){if(t.stylesheets&&uu(t,t.stylesheets),t.unsuspend){var m=t.unsuspend;t.unsuspend=null,m()}},6e4+a);0<t.imgBytes&&yh===0&&(yh=62500*Dw());var d=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&uu(t,t.stylesheets),t.unsuspend)){var m=t.unsuspend;t.unsuspend=null,m()}},(t.imgBytes>yh?50:800)+a);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(d)}}:null}function ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var cu=null;function uu(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,cu=new Map,a.forEach(Ww,t),cu=null,ou.call(t))}function Ww(t,a){if(!(a.state.loading&4)){var l=cu.get(t);if(l)var i=l.get(null);else{l=new Map,cu.set(t,l);for(var d=t.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var b=d[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),i=b)}i&&l.set(null,i)}d=a.instance,b=d.getAttribute("data-precedence"),m=l.get(b)||i,m===i&&l.set(null,d),l.set(b,d),this.count++,i=ou.bind(this),d.addEventListener("load",i),d.addEventListener("error",i),m?m.parentNode.insertBefore(d,m.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(d,t.firstChild)),a.state.loading|=4}}var ho={$$typeof:$,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Jw(t,a,l,i,d,m,b,N,D){this.tag=1,this.containerInfo=t,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=It(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=It(0),this.hiddenUpdates=It(null),this.identifierPrefix=i,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function jx(t,a,l,i,d,m,b,N,D,Y,ae,oe){return t=new Jw(t,a,l,b,D,Y,ae,oe,N),a=1,m===!0&&(a|=24),m=On(3,null,null,a),t.current=m,m.stateNode=t,a=Zd(),a.refCount++,t.pooledCache=a,a.refCount++,m.memoizedState={element:i,isDehydrated:l,cache:a},tf(m),t}function Rx(t){return t?(t=_s,t):_s}function kx(t,a,l,i,d,m){d=Rx(d),i.context===null?i.context=d:i.pendingContext=d,i=bl(a),i.payload={element:l},m=m===void 0?null:m,m!==null&&(i.callback=m),l=wl(t,i,a),l!==null&&(jn(l,t,a),Fi(l,t,a))}function Tx(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<a?l:a}}function bh(t,a){Tx(t,a),(t=t.alternate)&&Tx(t,a)}function Cx(t){if(t.tag===13||t.tag===31){var a=ns(t,67108864);a!==null&&jn(a,t,67108864),bh(t,67108864)}}function Ax(t){if(t.tag===13||t.tag===31){var a=Un();a=_(a);var l=ns(t,a);l!==null&&jn(l,t,a),bh(t,a)}}var du=!0;function eS(t,a,l,i){var d=L.T;L.T=null;var m=F.p;try{F.p=2,wh(t,a,l,i)}finally{F.p=m,L.T=d}}function tS(t,a,l,i){var d=L.T;L.T=null;var m=F.p;try{F.p=8,wh(t,a,l,i)}finally{F.p=m,L.T=d}}function wh(t,a,l,i){if(du){var d=Sh(i);if(d===null)ih(t,a,i,fu,l),Ox(t,i);else if(nS(d,t,a,l,i))i.stopPropagation();else if(Ox(t,i),a&4&&-1<aS.indexOf(t)){for(;d!==null;){var m=tt(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=St(m.pendingLanes);if(b!==0){var N=m;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var D=1<<31-Zt(b);N.entanglements[1]|=D,b&=~D}jr(m),(Ot&6)===0&&(Xc=aa()+500,so(0))}}break;case 31:case 13:N=ns(m,2),N!==null&&jn(N,m,2),Kc(),bh(m,2)}if(m=Sh(i),m===null&&ih(t,a,i,fu,l),m===d)break;d=m}d!==null&&i.stopPropagation()}else ih(t,a,i,null,l)}}function Sh(t){return t=_r(t),Eh(t)}var fu=null;function Eh(t){if(fu=null,t=qt(t),t!==null){var a=c(t);if(a===null)t=null;else{var l=a.tag;if(l===13){if(t=f(a),t!==null)return t;t=null}else if(l===31){if(t=h(a),t!==null)return t;t=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return fu=t,null}function Dx(t){switch(t){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(fn()){case hn:return 2;case Ja:return 8;case Ha:case me:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var Nh=!1,Ol=null,Ml=null,_l=null,mo=new Map,po=new Map,Ll=[],aS="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 Ox(t,a){switch(t){case"focusin":case"focusout":Ol=null;break;case"dragenter":case"dragleave":Ml=null;break;case"mouseover":case"mouseout":_l=null;break;case"pointerover":case"pointerout":mo.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(a.pointerId)}}function go(t,a,l,i,d,m){return t===null||t.nativeEvent!==m?(t={blockedOn:a,domEventName:l,eventSystemFlags:i,nativeEvent:m,targetContainers:[d]},a!==null&&(a=tt(a),a!==null&&Cx(a)),t):(t.eventSystemFlags|=i,a=t.targetContainers,d!==null&&a.indexOf(d)===-1&&a.push(d),t)}function nS(t,a,l,i,d){switch(a){case"focusin":return Ol=go(Ol,t,a,l,i,d),!0;case"dragenter":return Ml=go(Ml,t,a,l,i,d),!0;case"mouseover":return _l=go(_l,t,a,l,i,d),!0;case"pointerover":var m=d.pointerId;return mo.set(m,go(mo.get(m)||null,t,a,l,i,d)),!0;case"gotpointercapture":return m=d.pointerId,po.set(m,go(po.get(m)||null,t,a,l,i,d)),!0}return!1}function Mx(t){var a=qt(t.target);if(a!==null){var l=c(a);if(l!==null){if(a=l.tag,a===13){if(a=f(l),a!==null){t.blockedOn=a,ie(t.priority,function(){Ax(l)});return}}else if(a===31){if(a=h(l),a!==null){t.blockedOn=a,ie(t.priority,function(){Ax(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function hu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var l=Sh(t.nativeEvent);if(l===null){l=t.nativeEvent;var i=new l.constructor(l.type,l);An=i,l.target.dispatchEvent(i),An=null}else return a=tt(l),a!==null&&Cx(a),t.blockedOn=l,!1;a.shift()}return!0}function _x(t,a,l){hu(t)&&l.delete(a)}function rS(){Nh=!1,Ol!==null&&hu(Ol)&&(Ol=null),Ml!==null&&hu(Ml)&&(Ml=null),_l!==null&&hu(_l)&&(_l=null),mo.forEach(_x),po.forEach(_x)}function mu(t,a){t.blockedOn===a&&(t.blockedOn=null,Nh||(Nh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rS)))}var pu=null;function Lx(t){pu!==t&&(pu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){pu===t&&(pu=null);for(var a=0;a<t.length;a+=3){var l=t[a],i=t[a+1],d=t[a+2];if(typeof i!="function"){if(Eh(i||l)===null)continue;break}var m=tt(l);m!==null&&(t.splice(a,3),a-=3,Sf(m,{pending:!0,data:d,method:l.method,action:i},i,d))}}))}function ri(t){function a(D){return mu(D,t)}Ol!==null&&mu(Ol,t),Ml!==null&&mu(Ml,t),_l!==null&&mu(_l,t),mo.forEach(a),po.forEach(a);for(var l=0;l<Ll.length;l++){var i=Ll[l];i.blockedOn===t&&(i.blockedOn=null)}for(;0<Ll.length&&(l=Ll[0],l.blockedOn===null);)Mx(l),l.blockedOn===null&&Ll.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var d=l[i],m=l[i+1],b=d[De]||null;if(typeof m=="function")b||Lx(l);else if(b){var N=null;if(m&&m.hasAttribute("formAction")){if(d=m,b=m[De]||null)N=b.formAction;else if(Eh(d)!==null)continue}else N=b.action;typeof N=="function"?l[i+1]=N:(l.splice(i,3),i-=3),Lx(l)}}}function zx(){function t(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return d=b})},focusReset:"manual",scroll:"manual"})}function a(){d!==null&&(d(),d=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,d=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),d!==null&&(d(),d=null)}}}function jh(t){this._internalRoot=t}gu.prototype.render=jh.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(s(409));var l=a.current,i=Un();kx(l,i,t,a,null,null)},gu.prototype.unmount=jh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;kx(t.current,2,null,t,null,null),Kc(),a[Ne]=null}};function gu(t){this._internalRoot=t}gu.prototype.unstable_scheduleHydration=function(t){if(t){var a=W();t={blockedOn:null,target:t,priority:a};for(var l=0;l<Ll.length&&a!==0&&a<Ll[l].priority;l++);Ll.splice(l,0,t),l===0&&Mx(t)}};var Ux=n.version;if(Ux!=="19.2.7")throw Error(s(527,Ux,"19.2.7"));F.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=g(a),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var lS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vu.isDisabled&&vu.supportsFiber)try{Pe=vu.inject(lS),te=vu}catch{}}return xo.createRoot=function(t,a){if(!u(t))throw Error(s(299));var l=!1,i="",d=Fg,m=Vg,b=Yg;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(m=a.onCaughtError),a.onRecoverableError!==void 0&&(b=a.onRecoverableError)),a=jx(t,1,!1,null,null,l,i,null,d,m,b,zx),t[Ne]=a.current,sh(t),new jh(a)},xo.hydrateRoot=function(t,a,l){if(!u(t))throw Error(s(299));var i=!1,d="",m=Fg,b=Vg,N=Yg,D=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError),l.formState!==void 0&&(D=l.formState)),a=jx(t,1,!0,a,l??null,i,d,D,m,b,N,zx),a.context=Rx(null),l=a.current,i=Un(),i=_(i),d=bl(i),d.callback=null,wl(l,d,i),l=i,a.current.lanes=l,pt(a,l),jr(a),t[Ne]=a.current,sh(t),new gu(a)},xo.version="19.2.7",xo}var Gx;function yS(){if(Gx)return Th.exports;Gx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Th.exports=xS(),Th.exports}var bS=yS();/**
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 xb=e=>{throw TypeError(e)},yb=(e,n,r)=>n.has(e)||xb("Cannot "+r),Jn=(e,n,r)=>(yb(e,n,"read from private field"),r?r.call(e):n.get(e)),To=(e,n,r)=>n.has(e)?xb("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),Rr=(e,n,r,s)=>(yb(e,n,"write to private field"),n.set(e,r),r),nd=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,bm=/^[\\/]{2}/;function bb(e,n){return n+e.replace(/\\/g,"/")}var Xx="popstate";function Qx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function wS(e={}){function n(s,u){var g;let c=(g=u.state)==null?void 0:g.masked,{pathname:f,search:h,hash:p}=c||s.location;return Ho("",{pathname:f,search:h,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",c?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,u){return typeof u=="string"?u:Ar(u)}return ES(n,r,null,e)}function nt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function da(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function SS(){return Math.random().toString(36).substring(2,10)}function Kx(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ho(e,n,r=null,s,u){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Dr(n):n,state:r,key:n&&n.key||s||SS(),mask:u}}function Ar({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Dr(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function ES(e,n,r,s={}){let{window:u=document.defaultView,v5Compat:c=!1}=s,f=u.history,h="POP",p=null,g=y();g==null&&(g=0,f.replaceState({...f.state,idx:g},""));function y(){return(f.state||{idx:null}).idx}function x(){h="POP";let R=y(),z=R==null?null:R-g;g=R,p&&p({action:h,location:j.location,delta:z})}function E(R,z){h="PUSH";let I=Qx(R)?R:Ho(j.location,R,z);g=y()+1;let $=Kx(I,g),Q=j.createHref(I.mask||I);try{f.pushState($,"",Q)}catch(J){if(J instanceof DOMException&&J.name==="DataCloneError")throw J;u.location.assign(Q)}c&&p&&p({action:h,location:j.location,delta:1})}function S(R,z){h="REPLACE";let I=Qx(R)?R:Ho(j.location,R,z);g=y();let $=Kx(I,g),Q=j.createHref(I.mask||I);f.replaceState($,"",Q),c&&p&&p({action:h,location:j.location,delta:0})}function w(R){return wb(u,R)}let j={get action(){return h},get location(){return e(u,f)},listen(R){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(Xx,x),p=R,()=>{u.removeEventListener(Xx,x),p=null}},createHref(R){return n(u,R)},createURL:w,encodeLocation(R){let z=w(R);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:E,replace:S,go(R){return f.go(R)}};return j}function wb(e,n,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),nt(s,"No window.location.(origin|href) available to create URL");let u=typeof n=="string"?n:Ar(n);return u=u.replace(/ $/,"%20"),!r&&bm.test(u)&&(u=s+u),new URL(u,s)}var Co,Zx=class{constructor(e){if(To(this,Co,new Map),e)for(let[n,r]of e)this.set(n,r)}get(e){if(Jn(this,Co).has(e))return Jn(this,Co).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,n){Jn(this,Co).set(e,n)}};Co=new WeakMap;var NS=new Set(["lazy","caseSensitive","path","id","index","children"]);function jS(e){return NS.has(e)}var RS=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function kS(e){return RS.has(e)}function TS(e){return e.index===!0}function Io(e,n,r=[],s={},u=!1){return e.map((c,f)=>{let h=[...r,String(f)],p=typeof c.id=="string"?c.id:h.join("-");if(nt(c.index!==!0||!c.children,"Cannot specify children on an index route"),nt(u||!s[p],`Found a route id collision on id "${p}". Route id's must be globally unique within Data Router usages`),TS(c)){let g={...c,id:p};return s[p]=Wx(g,n(g)),g}else{let g={...c,id:p,children:void 0};return s[p]=Wx(g,n(g)),c.children&&(g.children=Io(c.children,n,h,s,u)),g}})}function Wx(e,n){return Object.assign(e,{...n,...typeof n.lazy=="object"&&n.lazy!=null?{lazy:{...e.lazy,...n.lazy}}:{}})}function Sb(e,n,r="/"){return hr(e,n,r,!1)}function hr(e,n,r,s,u){let c=typeof n=="string"?Dr(n):n,f=Hn(c.pathname||"/",r);if(f==null)return null;let h=u??_u(e),p=null,g=BS(f);for(let y=0;p==null&&y<h.length;++y)p=$S(h[y],g,s);return p}function Eb(e,n){let{route:r,pathname:s,params:u}=e;return{id:r.id,pathname:s,params:u,data:n[r.id],loaderData:n[r.id],handle:r.handle}}function _u(e){let n=Nb(e);return CS(n),n}function Nb(e,n=[],r=[],s="",u=!1){let c=(f,h,p=u,g)=>{let y={relativePath:g===void 0?f.path||"":g,caseSensitive:f.caseSensitive===!0,childrenIndex:h,route:f};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&p)return;nt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let x=nr([s,y.relativePath]),E=r.concat(y);f.children&&f.children.length>0&&(nt(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),Nb(f.children,n,E,x,p)),!(f.path==null&&!f.index)&&n.push({path:x,score:zS(x,f.index),routesMeta:E.map((S,w)=>{let[j,R]=kb(S.relativePath,S.caseSensitive,w===E.length-1);return{...S,matcher:j,compiledParams:R}})})};return e.forEach((f,h)=>{var p;if(f.path===""||!((p=f.path)!=null&&p.includes("?")))c(f,h);else for(let g of jb(f.path))c(f,h,!0,g)}),n}function jb(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,u=r.endsWith("?"),c=r.replace(/\?$/,"");if(s.length===0)return u?[c,""]:[c];let f=jb(s.join("/")),h=[];return h.push(...f.map(p=>p===""?c:[c,p].join("/"))),u&&h.push(...f),h.map(p=>e.startsWith("/")&&p===""?"/":p)}function CS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:US(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var AS=/^:[\w-]+$/,DS=3,OS=2,MS=1,_S=10,LS=-2,Jx=e=>e==="*";function zS(e,n){let r=e.split("/"),s=r.length;return r.some(Jx)&&(s+=LS),n&&(s+=OS),r.filter(u=>!Jx(u)).reduce((u,c)=>u+(AS.test(c)?DS:c===""?MS:_S),s)}function US(e,n){return e.length===n.length&&e.slice(0,-1).every((s,u)=>s===n[u])?e[e.length-1]-n[n.length-1]:0}function $S(e,n,r=!1){let{routesMeta:s}=e,u={},c="/",f=[];for(let h=0;h<s.length;++h){let p=s[h],g=h===s.length-1,y=c==="/"?n:n.slice(c.length)||"/",x={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},E=p.matcher&&p.compiledParams?Rb(x,y,p.matcher,p.compiledParams):qu(x,y),S=p.route;if(!E&&g&&r&&!s[s.length-1].route.index&&(E=qu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},y)),!E)return null;Object.assign(u,E.params),f.push({params:u,pathname:nr([c,E.pathname]),pathnameBase:qS(nr([c,E.pathnameBase])),route:S}),E.pathnameBase!=="/"&&(c=nr([c,E.pathnameBase]))}return f}function qu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=kb(e.path,e.caseSensitive,e.end);return Rb(e,n,r,s)}function Rb(e,n,r,s){let u=n.match(r);if(!u)return null;let c=u[0],f=c.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:s.reduce((g,{paramName:y,isOptional:x},E)=>{if(y==="*"){let w=h[E]||"";f=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const S=h[E];return x&&!S?g[y]=void 0:g[y]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:f,pattern:e}}function kb(e,n=!1,r=!0){da(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],u="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,h,p,g,y)=>{if(s.push({paramName:h,isOptional:p!=null}),p){let x=y.charAt(g+f.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),u+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?u+="\\/*$":e!==""&&e!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,n?void 0:"i"),s]}function BS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return da(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Hn(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function HS({basename:e,pathname:n}){return n==="/"?e:nr([e,n])}var wm=e=>nd.test(e);function IS(e,n="/"){let{pathname:r,search:s="",hash:u=""}=typeof e=="string"?Dr(e):e,c;return r?(r=Em(r),r.startsWith("/")?c=ey(r.substring(1),"/"):c=ey(r,n)):c=n,{pathname:c,search:PS(s),hash:FS(u)}}function ey(e,n){let r=Pu(n).split("/");return e.split("/").forEach(u=>{u===".."?r.length>1&&r.pop():u!=="."&&r.push(u)}),r.length>1?r.join("/"):"/"}function Oh(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Tb(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Sm(e){let n=Tb(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function rd(e,n,r,s=!1){let u;typeof e=="string"?u=Dr(e):(u={...e},nt(!u.pathname||!u.pathname.includes("?"),Oh("?","pathname","search",u)),nt(!u.pathname||!u.pathname.includes("#"),Oh("#","pathname","hash",u)),nt(!u.search||!u.search.includes("#"),Oh("#","search","hash",u)));let c=e===""||u.pathname==="",f=c?"/":u.pathname,h;if(f==null)h=r;else{let x=n.length-1;if(!s&&f.startsWith("..")){let E=f.split("/");for(;E[0]==="..";)E.shift(),x-=1;u.pathname=E.join("/")}h=x>=0?n[x]:"/"}let p=IS(u,h),g=f&&f!=="/"&&f.endsWith("/"),y=(c||f===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(g||y)&&(p.pathname+="/"),p}var Em=e=>e.replace(/[\\/]{2,}/g,"/"),nr=e=>Em(e.join("/")),Pu=e=>e.replace(/\/+$/,""),qS=e=>Pu(e).replace(/^\/*/,"/"),PS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,FS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,kn=(e,n=302)=>{let r=n;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let s=new Headers(r.headers);return s.set("Location",e),new Response(null,{...r,headers:s})},VS=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Xo=class{constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function xi(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Qo(e){let n=e.map(r=>r.route.path).filter(Boolean);return nr(n)||"/"}var Cb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ab(e,n){let r=e;if(typeof r!="string"||!nd.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,u=!1;if(Cb)try{let c=new URL(window.location.href),f=bm.test(r)?new URL(bb(r,c.protocol)):new URL(r),h=Hn(f.pathname,n);f.origin===c.origin&&h!=null?r=h+f.search+f.hash:u=!0}catch{da(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:u,to:r}}var Pl=Symbol("Uninstrumented");function YS(e,n){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(u=>u({id:n.id,index:n.index,path:n.path,instrument(c){let f=Object.keys(r);for(let h of f)c[h]&&r[h].push(c[h])}}));let s={};if(typeof n.lazy=="function"&&r.lazy.length>0){let u=hi(r.lazy,n.lazy,()=>{});u&&(s.lazy=u)}if(typeof n.lazy=="object"){let u=n.lazy;["middleware","loader","action"].forEach(c=>{let f=u[c],h=r[`lazy.${c}`];if(typeof f=="function"&&h.length>0){let p=hi(h,f,()=>{});p&&(s.lazy=Object.assign(s.lazy||{},{[c]:p}))}})}return["loader","action"].forEach(u=>{let c=n[u];if(typeof c=="function"&&r[u].length>0){let f=c[Pl]??c,h=hi(r[u],f,(...p)=>ty(p[0]));h&&(u==="loader"&&f.hydrate===!0&&(h.hydrate=!0),h[Pl]=f,s[u]=h)}}),n.middleware&&n.middleware.length>0&&r.middleware.length>0&&(s.middleware=n.middleware.map(u=>{let c=u[Pl]??u,f=hi(r.middleware,c,(...h)=>ty(h[0]));return f?(f[Pl]=c,f):u})),s}function GS(e,n){let r={navigate:[],fetch:[]};if(n.forEach(s=>s({instrument(u){let c=Object.keys(u);for(let f of c)u[f]&&r[f].push(u[f])}})),r.navigate.length>0){let s=e.navigate[Pl]??e.navigate,u=hi(r.navigate,s,(...c)=>{let[f,h]=c;return{to:typeof f=="number"||typeof f=="string"?f:f?Ar(f):".",...ay(e,h??{})}});u&&(u[Pl]=s,e.navigate=u)}if(r.fetch.length>0){let s=e.fetch[Pl]??e.fetch,u=hi(r.fetch,s,(...c)=>{let[f,,h,p]=c;return{href:h??".",fetcherKey:f,...ay(e,p??{})}});u&&(u[Pl]=s,e.fetch=u)}return e}function hi(e,n,r){return e.length===0?null:async(...s)=>{let u=await Db(e,r(...s),()=>n(...s),e.length-1);if(u.type==="error")throw u.value;return u.value}}async function Db(e,n,r,s){let u=e[s],c;if(u){let f,h=async()=>(f?console.error("You cannot call instrumented handlers more than once"):f=Db(e,n,r,s-1),c=await f,nt(c,"Expected a result"),c.type==="error"&&c.value instanceof Error?{status:"error",error:c.value}:{status:"success",error:void 0});try{await u(h,n)}catch(p){console.error("An instrumentation function threw an error:",p)}f||await h(),await f}else try{c={type:"success",value:await r()}}catch(f){c={type:"error",value:f}}return c||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function ty(e){let{request:n,context:r,params:s,pattern:u}=e;return{request:XS(n),params:{...s},pattern:u,context:QS(r)}}function ay(e,n){return{currentUrl:Ar(e.state.location),..."formMethod"in n?{formMethod:n.formMethod}:{},..."formEncType"in n?{formEncType:n.formEncType}:{},..."formData"in n?{formData:n.formData}:{},..."body"in n?{body:n.body}:{}}}function XS(e){return{method:e.method,url:e.url,headers:{get:(...n)=>e.headers.get(...n)}}}function QS(e){if(ZS(e)){let n={...e};return Object.freeze(n),n}else return{get:n=>e.get(n)}}var KS=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ZS(e){if(e===null||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||n===null||Object.getOwnPropertyNames(n).sort().join("\0")===KS}var Ob=["POST","PUT","PATCH","DELETE"],WS=new Set(Ob),JS=["GET",...Ob],eE=new Set(JS),Mb=new Set([301,302,303,307,308]),tE=new Set([307,308]),Mh={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},_b={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},yo={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},aE=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Lb="remix-router-transitions",zb=Symbol("ResetLoaderData"),vs,ui,$l,di,nE=class{constructor(e){To(this,vs),To(this,ui),To(this,$l),To(this,di),Rr(this,vs,e),Rr(this,ui,_u(e))}get stableRoutes(){return Jn(this,vs)}get activeRoutes(){return Jn(this,$l)??Jn(this,vs)}get branches(){return Jn(this,di)??Jn(this,ui)}get hasHMRRoutes(){return Jn(this,$l)!=null}setRoutes(e){Rr(this,vs,e),Rr(this,ui,_u(e))}setHmrRoutes(e){Rr(this,$l,e),Rr(this,di,_u(e))}commitHmrRoutes(){Jn(this,$l)&&(Rr(this,vs,Jn(this,$l)),Rr(this,ui,Jn(this,di)),Rr(this,$l,void 0),Rr(this,di,void 0))}};vs=new WeakMap;ui=new WeakMap;$l=new WeakMap;di=new WeakMap;function rE(e){const n=e.window?e.window:typeof window<"u"?window:void 0,r=typeof n<"u"&&typeof n.document<"u"&&typeof n.document.createElement<"u";nt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=e.hydrationRouteProperties||[],u=e.mapRouteProperties||aE,c=u;if(e.instrumentations){let A=e.instrumentations;c=_=>({...u(_),...YS(A.map(q=>q.route).filter(Boolean),_)})}let f={},h=new nE(Io(e.routes,c,void 0,f)),p=e.basename||"/";p.startsWith("/")||(p=`/${p}`);let g=e.dataStrategy||cE,y={...e.future},x=null,E=new Set,S=null,w=null,j=null,R=null,z=e.hydrationData!=null,I=hr(h.activeRoutes,e.history.location,p,!1,h.branches),$=!1,Q=null,J,ne;if(I==null&&!e.patchRoutesOnNavigation){let A=er(404,{pathname:e.history.location.pathname}),{matches:_,route:q}=xu(h.activeRoutes);J=!0,ne=!J,I=_,Q={[q.id]:A}}else if(I&&!e.hydrationData&&It(I,h.activeRoutes,e.history.location.pathname).active&&(I=null),I)if(I.some(A=>A.route.lazy))J=!1,ne=!J;else if(!I.some(A=>Nm(A.route)))J=!0,ne=!J;else{let A=e.hydrationData?e.hydrationData.loaderData:null,_=e.hydrationData?e.hydrationData.errors:null,q=I;if(_){let W=I.findIndex(ie=>_[ie.route.id]!==void 0);q=q.slice(0,W+1)}ne=!1,J=!0,q.forEach(W=>{let ie=Ub(W.route,A,_);ne=ne||ie.renderFallback,J=J&&!ie.shouldLoad})}else{J=!1,ne=!J,I=[];let A=It(null,h.activeRoutes,e.history.location.pathname);A.active&&A.matches&&($=!0,I=A.matches)}let M,T={historyAction:e.history.action,location:e.history.location,matches:I,initialized:J,renderFallback:ne,navigation:Mh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||Q,fetchers:new Map,blockers:new Map},fe="POP",pe=null,we=!1,re,je=!1,Te=new Map,ee=null,L=!1,F=!1,he=new Set,P=new Map,se=0,C=-1,B=new Map,K=new Set,ue=new Map,ge=new Map,ve=new Set,Re=new Map,He,$e=null;function Qe(){if(x=e.history.listen(({action:A,location:_,delta:q})=>{if(He){He(),He=void 0;return}da(Re.size===0||q!=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 W=yt({currentLocation:T.location,nextLocation:_,historyAction:A});if(W&&q!=null){let ie=new Promise(ke=>{He=ke});e.history.go(q*-1),xt(W,{state:"blocked",location:_,proceed(){xt(W,{state:"proceeding",proceed:void 0,reset:void 0,location:_}),ie.then(()=>e.history.go(q))},reset(){let ke=new Map(T.blockers);ke.set(W,yo),mt({blockers:ke})}}),pe==null||pe.resolve(),pe=null;return}return Bt(A,_)}),r){TE(n,Te);let A=()=>CE(n,Te);n.addEventListener("pagehide",A),ee=()=>n.removeEventListener("pagehide",A)}return T.initialized||Bt("POP",T.location,{initialHydration:!0}),M}function ia(){x&&x(),ee&&ee(),E.clear(),re&&re.abort(),T.fetchers.forEach((A,_)=>Pe(T.fetchers,_)),T.blockers.forEach((A,_)=>_e(_))}function $t(A){if(E.add(A),S){let{newErrors:_}=S;S=null,A(T,{deletedFetchers:[],newErrors:_,viewTransitionOpts:void 0,flushSync:!1})}return()=>E.delete(A)}function mt(A,_={}){A.matches&&(A.matches=A.matches.map(ie=>{let ke=f[ie.route.id],ye=ie.route;return ye.element!==ke.element||ye.errorElement!==ke.errorElement||ye.hydrateFallbackElement!==ke.hydrateFallbackElement?{...ie,route:ke}:ie})),T={...T,...A};let q=[],W=[];T.fetchers.forEach((ie,ke)=>{ie.state==="idle"&&(ve.has(ke)?q.push(ke):W.push(ke))}),ve.forEach(ie=>{!T.fetchers.has(ie)&&!P.has(ie)&&q.push(ie)}),E.size===0&&(S={newErrors:A.errors??null}),[...E].forEach(ie=>ie(T,{deletedFetchers:q,newErrors:A.errors??null,viewTransitionOpts:_.viewTransitionOpts,flushSync:_.flushSync===!0})),q.forEach(ie=>Pe(T.fetchers,ie)),W.forEach(ie=>T.fetchers.delete(ie))}function ce(A,_,{flushSync:q}={}){var Ue,Ke;let W=T.actionData!=null&&T.navigation.formMethod!=null&&cn(T.navigation.formMethod)&&T.navigation.state==="loading"&&((Ue=A.state)==null?void 0:Ue._isRedirect)!==!0,ie;_.actionData?Object.keys(_.actionData).length>0?ie=_.actionData:ie=null:W?ie=T.actionData:ie=null;let ke=_.loaderData?fy(T.loaderData,_.loaderData,_.matches||[],_.errors):T.loaderData,ye=T.blockers;ye.size>0&&(ye=new Map(ye),ye.forEach((Oe,Je)=>ye.set(Je,yo)));let De=L?!1:Wt(A,_.matches||T.matches),Ne=we===!0||T.navigation.formMethod!=null&&cn(T.navigation.formMethod)&&((Ke=A.state)==null?void 0:Ke._isRedirect)!==!0;h.commitHmrRoutes(),L||fe==="POP"||(fe==="PUSH"?e.history.push(A,A.state):fe==="REPLACE"&&e.history.replace(A,A.state));let Le;if(fe==="POP"){let Oe=Te.get(T.location.pathname);Oe&&Oe.has(A.pathname)?Le={currentLocation:T.location,nextLocation:A}:Te.has(A.pathname)&&(Le={currentLocation:A,nextLocation:T.location})}else if(je){let Oe=Te.get(T.location.pathname);Oe?Oe.add(A.pathname):(Oe=new Set([A.pathname]),Te.set(T.location.pathname,Oe)),Le={currentLocation:T.location,nextLocation:A}}mt({..._,actionData:ie,loaderData:ke,historyAction:fe,location:A,initialized:!0,renderFallback:!1,navigation:Mh,revalidation:"idle",restoreScrollPosition:De,preventScrollReset:Ne,blockers:ye},{viewTransitionOpts:Le,flushSync:q===!0}),fe="POP",we=!1,je=!1,L=!1,F=!1,pe==null||pe.resolve(),pe=null,$e==null||$e.resolve(),$e=null}async function qe(A,_){if(pe==null||pe.resolve(),pe=null,typeof A=="number"){pe||(pe=gy());let Fe=pe.promise;return e.history.go(A),Fe}let q=nm(T.location,T.matches,p,A,_==null?void 0:_.fromRouteId,_==null?void 0:_.relative),{path:W,submission:ie,error:ke}=ny(!1,q,_),ye;_!=null&&_.mask&&(ye={pathname:"",search:"",hash:"",...typeof _.mask=="string"?Dr(_.mask):{...T.location.mask,..._.mask}});let De=T.location,Ne=Ho(De,W,_&&_.state,void 0,ye);Ne={...Ne,...e.history.encodeLocation(Ne)};let Le=_&&_.replace!=null?_.replace:void 0,Ue="PUSH";Le===!0?Ue="REPLACE":Le===!1||ie!=null&&cn(ie.formMethod)&&ie.formAction===T.location.pathname+T.location.search&&(Ue="REPLACE");let Ke=_&&"preventScrollReset"in _?_.preventScrollReset===!0:void 0,Oe=(_&&_.flushSync)===!0,Je=yt({currentLocation:De,nextLocation:Ne,historyAction:Ue});if(Je){xt(Je,{state:"blocked",location:Ne,proceed(){xt(Je,{state:"proceeding",proceed:void 0,reset:void 0,location:Ne}),qe(A,_)},reset(){let Fe=new Map(T.blockers);Fe.set(Je,yo),mt({blockers:Fe})}});return}await Bt(Ue,Ne,{submission:ie,pendingError:ke,preventScrollReset:Ke,replace:_&&_.replace,enableViewTransition:_&&_.viewTransition,flushSync:Oe,callSiteDefaultShouldRevalidate:_&&_.defaultShouldRevalidate})}function rt(){$e||($e=gy()),Ha(),mt({revalidation:"loading"});let A=$e.promise;return T.navigation.state==="submitting"?A:T.navigation.state==="idle"?(Bt(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),A):(Bt(fe||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:je===!0}),A)}async function Bt(A,_,q){re&&re.abort(),re=null,fe=A,L=(q&&q.startUninterruptedRevalidation)===!0,na(T.location,T.matches),we=(q&&q.preventScrollReset)===!0,je=(q&&q.enableViewTransition)===!0;let W=h.activeRoutes,ie=q!=null&&q.initialHydration&&T.matches&&T.matches.length>0&&!$?T.matches:hr(W,_,p,!1,h.branches),ke=(q&&q.flushSync)===!0;if(ie&&T.initialized&&!F&&xE(T.location,_)&&!(q&&q.submission&&cn(q.submission.formMethod))){ce(_,{matches:ie},{flushSync:ke});return}let ye=It(ie,W,_.pathname);if(ye.active&&ye.matches&&(ie=ye.matches),!ie){let{error:tt,notFoundMatches:dt,route:ot}=St(_.pathname);ce(_,{matches:dt,loaderData:{},errors:{[ot.id]:tt}},{flushSync:ke});return}let De=q&&q.overrideNavigation?{...q.overrideNavigation,matches:ie,historyAction:A}:void 0;re=new AbortController;let Ne=fi(e.history,_,re.signal,q&&q.submission),Le=e.getContext?await e.getContext():new Zx,Ue;if(q&&q.pendingError)Ue=[ql(ie).route.id,{type:"error",error:q.pendingError}];else if(q&&q.submission&&cn(q.submission.formMethod)){let tt=await ga(Ne,_,q.submission,ie,A,Le,ye.active,q&&q.initialHydration===!0,{replace:q.replace,flushSync:ke});if(tt.shortCircuited)return;if(tt.pendingActionResult){let[dt,ot]=tt.pendingActionResult;if($n(ot)&&xi(ot.error)&&ot.error.status===404){re=null,ce(_,{matches:tt.matches,loaderData:{},errors:{[dt]:ot.error}});return}}ie=tt.matches||ie,Ue=tt.pendingActionResult,De=_h(_,ie,A,q.submission),ke=!1,ye.active=!1,Ne=fi(e.history,Ne.url,Ne.signal)}let{shortCircuited:Ke,matches:Oe,loaderData:Je,errors:Fe,workingFetchers:qt}=await Rt(Ne,_,ie,A,Le,ye.active,De,q&&q.submission,q&&q.fetcherSubmission,q&&q.replace,q&&q.initialHydration===!0,ke,Ue,q&&q.callSiteDefaultShouldRevalidate);Ke||(re=null,ce(_,{matches:Oe||ie,...hy(Ue),loaderData:Je,errors:Fe,...qt?{fetchers:qt}:{}}))}async function ga(A,_,q,W,ie,ke,ye,De,Ne={}){Ha();let Le=RE(_,W,ie,q);if(mt({navigation:Le},{flushSync:Ne.flushSync===!0}),ye){let Oe=await pt(W,_.pathname,A.signal);if(Oe.type==="aborted")return{shortCircuited:!0};if(Oe.type==="error"){if(Oe.partialMatches.length===0){let{matches:Fe,route:qt}=xu(h.activeRoutes);return{matches:Fe,pendingActionResult:[qt.id,{type:"error",error:Oe.error}]}}let Je=ql(Oe.partialMatches).route.id;return{matches:Oe.partialMatches,pendingActionResult:[Je,{type:"error",error:Oe.error}]}}else if(Oe.matches)W=Oe.matches;else{let{notFoundMatches:Je,error:Fe,route:qt}=St(_.pathname);return{matches:Je,pendingActionResult:[qt.id,{type:"error",error:Fe}]}}}let Ue,Ke=Lu(W,_);if(!Ke.route.action&&!Ke.route.lazy)Ue={type:"error",error:er(405,{method:A.method,pathname:_.pathname,routeId:Ke.route.id})};else{let Oe=gi(c,f,A,_,W,Ke,De?[]:s,ke),Je=await hn(A,_,Oe,ke,null);if(Ue=Je[Ke.route.id],!Ue){for(let Fe of W)if(Je[Fe.route.id]){Ue=Je[Fe.route.id];break}}if(A.signal.aborted)return{shortCircuited:!0}}if(xs(Ue)){let Oe;return Ne&&Ne.replace!=null?Oe=Ne.replace:Oe=cy(Ue.response.headers.get("Location"),new URL(A.url),p,e.history)===T.location.pathname+T.location.search,await fn(A,Ue,!0,{submission:q,replace:Oe}),{shortCircuited:!0}}if($n(Ue)){let Oe=ql(W,Ke.route.id);return(Ne&&Ne.replace)!==!0&&(fe="PUSH"),{matches:W,pendingActionResult:[Oe.route.id,Ue,Ke.route.id]}}return{matches:W,pendingActionResult:[Ke.route.id,Ue]}}async function Rt(A,_,q,W,ie,ke,ye,De,Ne,Le,Ue,Ke,Oe,Je){let Fe=ye||_h(_,q,W,De),qt=De||Ne||py(Fe),tt=!L&&!Ue;if(ke){if(tt){let Nt=_t(Oe);mt({navigation:Fe,...Nt!==void 0?{actionData:Nt}:{}},{flushSync:Ke})}let Ze=await pt(q,_.pathname,A.signal);if(Ze.type==="aborted")return{shortCircuited:!0};if(Ze.type==="error"){if(Ze.partialMatches.length===0){let{matches:ea,route:tn}=xu(h.activeRoutes);return{matches:ea,loaderData:{},errors:{[tn.id]:Ze.error}}}let Nt=ql(Ze.partialMatches).route.id;return{matches:Ze.partialMatches,loaderData:{},errors:{[Nt]:Ze.error}}}else if(Ze.matches)q=Ze.matches;else{let{error:Nt,notFoundMatches:ea,route:tn}=St(_.pathname);return{matches:ea,loaderData:{},errors:{[tn.id]:Nt}}}}let dt=h.activeRoutes,{dsMatches:ot,revalidatingFetchers:ft}=ry(A,ie,c,f,e.history,T,q,qt,_,Ue?[]:s,Ue===!0,F,he,ve,ue,K,dt,p,e.patchRoutesOnNavigation!=null,h.branches,Oe,Je);if(C=++se,!e.dataStrategy&&!ot.some(Ze=>Ze.shouldLoad)&&!ot.some(Ze=>Ze.route.middleware&&Ze.route.middleware.length>0)&&ft.length===0){let Ze=new Map(T.fetchers),Nt=Pa(Ze);return ce(_,{matches:q,loaderData:{},errors:Oe&&$n(Oe[1])?{[Oe[0]]:Oe[1].error}:null,...hy(Oe),...Nt?{fetchers:Ze}:{}},{flushSync:Ke}),{shortCircuited:!0}}if(tt){let Ze={};if(!ke){Ze.navigation=Fe;let Nt=_t(Oe);Nt!==void 0&&(Ze.actionData=Nt)}ft.length>0&&(Ze.fetchers=Kt(ft)),mt(Ze,{flushSync:Ke})}ft.forEach(Ze=>{kt(Ze.key),Ze.controller&&P.set(Ze.key,Ze.controller)});let Jt=()=>ft.forEach(Ze=>kt(Ze.key));re&&re.signal.addEventListener("abort",Jt);let{loaderResults:Fa,fetcherResults:Sa}=await Ja(ot,ft,A,_,ie);if(A.signal.aborted)return{shortCircuited:!0};re&&re.signal.removeEventListener("abort",Jt),ft.forEach(Ze=>P.delete(Ze.key));let Da=yu(Fa);if(Da)return await fn(A,Da.result,!0,{replace:Le}),{shortCircuited:!0};if(Da=yu(Sa),Da)return K.add(Da.key),await fn(A,Da.result,!0,{replace:Le}),{shortCircuited:!0};let Oa=new Map(T.fetchers),{loaderData:Va,errors:vn}=dy(T,q,Fa,Oe,ft,Sa,Oa);Ue&&T.errors&&(vn={...T.errors,...vn});let fl=Pa(Oa),en=va(C,Oa),vr=fl||en||ft.length>0;return{matches:q,loaderData:Va,errors:vn,...vr?{workingFetchers:Oa}:{}}}function _t(A){if(A&&!$n(A[1]))return{[A[0]]:A[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function Kt(A){let _=new Map(T.fetchers);return A.forEach(q=>{let W=_.get(q.key),ie=bo(void 0,W?W.data:void 0);_.set(q.key,ie)}),_}async function $a(A,_,q,W){kt(A);let ie=(W&&W.flushSync)===!0,ke=h.activeRoutes,ye=nm(T.location,T.matches,p,q,_,W==null?void 0:W.relative),De=hr(ke,ye,p,!1,h.branches),Ne=It(De,ke,ye);if(Ne.active&&Ne.matches&&(De=Ne.matches),!De){Ce(A,_,er(404,{pathname:ye}),{flushSync:ie});return}let{path:Le,submission:Ue,error:Ke}=ny(!0,ye,W);if(Ke){Ce(A,_,Ke,{flushSync:ie});return}let Oe=e.getContext?await e.getContext():new Zx,Je=(W&&W.preventScrollReset)===!0;if(Ue&&cn(Ue.formMethod)){await Ba(A,_,Le,De,Oe,Ne.active,ie,Je,Ue,W&&W.defaultShouldRevalidate);return}ue.set(A,{routeId:_,path:Le}),await aa(A,_,Le,De,Oe,Ne.active,ie,Je,Ue)}async function Ba(A,_,q,W,ie,ke,ye,De,Ne,Le){Ha(),ue.delete(A);let Ue=T.fetchers.get(A);me(A,kE(Ne,Ue),{flushSync:ye});let Ke=new AbortController,Oe=fi(e.history,q,Ke.signal,Ne);if(ke){let jt=await pt(W,new URL(Oe.url).pathname,Oe.signal,A);if(jt.type==="aborted")return;if(jt.type==="error"){Ce(A,_,jt.error,{flushSync:ye});return}else if(jt.matches)W=jt.matches;else{Ce(A,_,er(404,{pathname:q}),{flushSync:ye});return}}let Je=Lu(W,q);if(!Je.route.action&&!Je.route.lazy){let jt=er(405,{method:Ne.formMethod,pathname:q,routeId:_});Ce(A,_,jt,{flushSync:ye});return}P.set(A,Ke);let Fe=se,qt=gi(c,f,Oe,q,W,Je,s,ie),tt=await hn(Oe,q,qt,ie,A),dt=tt[Je.route.id];if(!dt){for(let jt of qt)if(tt[jt.route.id]){dt=tt[jt.route.id];break}}if(Oe.signal.aborted){P.get(A)===Ke&&P.delete(A);return}if(ve.has(A)){if(xs(dt)||$n(dt)){me(A,Tr(void 0));return}}else{if(xs(dt))if(P.delete(A),C>Fe){me(A,Tr(void 0));return}else return K.add(A),me(A,bo(Ne)),fn(Oe,dt,!1,{fetcherSubmission:Ne,preventScrollReset:De});if($n(dt)){Ce(A,_,dt.error);return}}let ot=T.navigation.location||T.location,ft=fi(e.history,ot,Ke.signal),Jt=h.activeRoutes,Fa=T.navigation.state!=="idle"?hr(Jt,T.navigation.location,p,!1,h.branches):T.matches;nt(Fa,"Didn't find any matches after fetcher action");let Sa=++se;B.set(A,Sa);let{dsMatches:Da,revalidatingFetchers:Oa}=ry(ft,ie,c,f,e.history,T,Fa,Ne,ot,s,!1,F,he,ve,ue,K,Jt,p,e.patchRoutesOnNavigation!=null,h.branches,[Je.route.id,dt],Le),Va=bo(Ne,dt.data),vn=new Map(T.fetchers);vn.set(A,Va),Oa.filter(jt=>jt.key!==A).forEach(jt=>{let Cn=jt.key,Ya=vn.get(Cn),Ql=bo(void 0,Ya?Ya.data:void 0);vn.set(Cn,Ql),kt(Cn),jt.controller&&P.set(Cn,jt.controller)}),mt({fetchers:vn});let fl=()=>Oa.forEach(jt=>kt(jt.key));Ke.signal.addEventListener("abort",fl);let{loaderResults:en,fetcherResults:vr}=await Ja(Da,Oa,ft,ot,ie);if(Ke.signal.aborted)return;Ke.signal.removeEventListener("abort",fl),B.delete(A),P.delete(A),Oa.forEach(jt=>P.delete(jt.key));let Ze=T.fetchers.has(A),Nt=jt=>{if(!Ze)return jt;let Cn=new Map(jt.fetchers);return Cn.set(A,Tr(dt.data)),{...jt,fetchers:Cn}},ea=yu(en);if(ea)return T=Nt(T),fn(ft,ea.result,!1,{preventScrollReset:De});if(ea=yu(vr),ea)return K.add(ea.key),T=Nt(T),fn(ft,ea.result,!1,{preventScrollReset:De});let tn=new Map(T.fetchers);Ze&&tn.set(A,Tr(dt.data));let{loaderData:Ma,errors:Mr}=dy(T,Fa,en,void 0,Oa,vr,tn);va(Sa,tn),T.navigation.state==="loading"&&Sa>C?(nt(fe,"Expected pending action"),re&&re.abort(),ce(T.navigation.location,{matches:Fa,loaderData:Ma,errors:Mr,fetchers:tn})):(mt({errors:Mr,loaderData:fy(T.loaderData,Ma,Fa,Mr),fetchers:tn}),F=!1)}async function aa(A,_,q,W,ie,ke,ye,De,Ne){let Le=T.fetchers.get(A);me(A,bo(Ne,Le?Le.data:void 0),{flushSync:ye});let Ue=new AbortController,Ke=fi(e.history,q,Ue.signal);if(ke){let dt=await pt(W,new URL(Ke.url).pathname,Ke.signal,A);if(dt.type==="aborted")return;if(dt.type==="error"){Ce(A,_,dt.error,{flushSync:ye});return}else if(dt.matches)W=dt.matches;else{Ce(A,_,er(404,{pathname:q}),{flushSync:ye});return}}let Oe=Lu(W,q);P.set(A,Ue);let Je=se,Fe=gi(c,f,Ke,q,W,Oe,s,ie),qt=await hn(Ke,q,Fe,ie,A),tt=qt[Oe.route.id];if(!tt){for(let dt of W)if(qt[dt.route.id]){tt=qt[dt.route.id];break}}if(P.get(A)===Ue&&P.delete(A),!Ke.signal.aborted){if(ve.has(A)){me(A,Tr(void 0));return}if(xs(tt))if(C>Je){me(A,Tr(void 0));return}else{K.add(A),await fn(Ke,tt,!1,{preventScrollReset:De});return}if($n(tt)){Ce(A,_,tt.error);return}me(A,Tr(tt.data))}}async function fn(A,_,q,{submission:W,fetcherSubmission:ie,preventScrollReset:ke,replace:ye}={}){q||(pe==null||pe.resolve(),pe=null),_.response.headers.has("X-Remix-Revalidate")&&(F=!0);let De=_.response.headers.get("Location");nt(De,"Expected a Location header on the redirect Response"),De=cy(De,new URL(A.url),p,e.history);let Ne=Ho(T.location,De,{_isRedirect:!0});if(r){let Fe=!1;if(_.response.headers.has("X-Remix-Reload-Document"))Fe=!0;else if(wm(De)){const qt=wb(n,De,!0);Fe=qt.origin!==n.location.origin||Hn(qt.pathname,p)==null}if(Fe){ye?n.location.replace(De):n.location.assign(De);return}}re=null;let Le=ye===!0||_.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Ue,formAction:Ke,formEncType:Oe}=T.navigation;!W&&!ie&&Ue&&Ke&&Oe&&(W=py(T.navigation));let Je=W||ie;if(tE.has(_.response.status)&&Je&&cn(Je.formMethod))await Bt(Le,Ne,{submission:{...Je,formAction:De},preventScrollReset:ke||we,enableViewTransition:q?je:void 0});else{let Fe=_h(Ne,[],Le,W);await Bt(Le,Ne,{overrideNavigation:Fe,fetcherSubmission:ie,preventScrollReset:ke||we,enableViewTransition:q?je:void 0})}}async function hn(A,_,q,W,ie){var De;let ke,ye={};try{ke=await dE(g,A,_,q,ie,W,!1)}catch(Ne){return q.filter(Le=>Le.shouldLoad).forEach(Le=>{ye[Le.route.id]={type:"error",error:Ne}}),ye}if(A.signal.aborted)return ye;if(!cn(A.method))for(let Ne of q){if(((De=ke[Ne.route.id])==null?void 0:De.type)==="error")break;!ke.hasOwnProperty(Ne.route.id)&&!T.loaderData.hasOwnProperty(Ne.route.id)&&(!T.errors||!T.errors.hasOwnProperty(Ne.route.id))&&Ne.shouldCallHandler()&&(ke[Ne.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ne.route.id}`)})}for(let[Ne,Le]of Object.entries(ke))if(SE(Le)){let Ue=Le.result;ye[Ne]={type:"redirect",response:pE(Ue,A,Ne,q,p)}}else ye[Ne]=await mE(Le);return ye}async function Ja(A,_,q,W,ie){let ke=hn(q,W,A,ie,null),ye=Promise.all(_.map(async Le=>{if(Le.matches&&Le.match&&Le.request&&Le.controller){let Ke=(await hn(Le.request,Le.path,Le.matches,ie,Le.key))[Le.match.route.id];return{[Le.key]:Ke}}else return Promise.resolve({[Le.key]:{type:"error",error:er(404,{pathname:Le.path})}})})),De=await ke,Ne=(await ye).reduce((Le,Ue)=>Object.assign(Le,Ue),{});return{loaderResults:De,fetcherResults:Ne}}function Ha(){F=!0,ue.forEach((A,_)=>{P.has(_)&&he.add(_),kt(_)})}function me(A,_,q={}){let W=new Map(T.fetchers);W.set(A,_),mt({fetchers:W},{flushSync:(q&&q.flushSync)===!0})}function Ce(A,_,q,W={}){let ie=ql(T.matches,_),ke=new Map(T.fetchers);Pe(ke,A),mt({errors:{[ie.route.id]:q},fetchers:ke},{flushSync:(W&&W.flushSync)===!0})}function Ae(A){return ge.set(A,(ge.get(A)||0)+1),ve.has(A)&&ve.delete(A),T.fetchers.get(A)||_b}function Xe(A,_){kt(A,_==null?void 0:_.reason),me(A,Tr(null))}function Pe(A,_){let q=T.fetchers.get(_);P.has(_)&&!(q&&q.state==="loading"&&B.has(_))&&kt(_),ue.delete(_),B.delete(_),K.delete(_),ve.delete(_),he.delete(_),A.delete(_)}function te(A){let _=(ge.get(A)||0)-1;_<=0?(ge.delete(A),ve.add(A)):ge.set(A,_),mt({fetchers:new Map(T.fetchers)})}function kt(A,_){let q=P.get(A);q&&(q.abort(_),P.delete(A))}function Zt(A,_){for(let q of A){let W=_.get(q);nt(W,`Expected fetcher: ${q}`);let ie=Tr(W.data);_.set(q,ie)}}function Pa(A){let _=[],q=!1;for(let W of K){let ie=A.get(W);nt(ie,`Expected fetcher: ${W}`),ie.state==="loading"&&(K.delete(W),_.push(W),q=!0)}return Zt(_,A),q}function va(A,_){let q=[];for(let[W,ie]of B)if(ie<A){let ke=_.get(W);nt(ke,`Expected fetcher: ${W}`),ke.state==="loading"&&(kt(W),B.delete(W),q.push(W))}return Zt(q,_),q.length>0}function qn(A,_){let q=T.blockers.get(A)||yo;return Re.get(A)!==_&&Re.set(A,_),q}function _e(A){T.blockers.delete(A),Re.delete(A)}function xt(A,_){let q=T.blockers.get(A)||yo;nt(q.state==="unblocked"&&_.state==="blocked"||q.state==="blocked"&&_.state==="blocked"||q.state==="blocked"&&_.state==="proceeding"||q.state==="blocked"&&_.state==="unblocked"||q.state==="proceeding"&&_.state==="unblocked",`Invalid blocker state transition: ${q.state} -> ${_.state}`);let W=new Map(T.blockers);W.set(A,_),mt({blockers:W})}function yt({currentLocation:A,nextLocation:_,historyAction:q}){if(Re.size===0)return;Re.size>1&&da(!1,"A router only supports one blocker at a time");let W=Array.from(Re.entries()),[ie,ke]=W[W.length-1],ye=T.blockers.get(ie);if(!(ye&&ye.state==="proceeding")&&ke({currentLocation:A,nextLocation:_,historyAction:q}))return ie}function St(A){let _=er(404,{pathname:A}),q=h.activeRoutes,{matches:W,route:ie}=xu(q);return{notFoundMatches:W,route:ie,error:_}}function Ht(A,_,q){if(w=A,R=_,j=q||null,!z&&T.navigation===Mh){z=!0;let W=Wt(T.location,T.matches);W!=null&&mt({restoreScrollPosition:W})}return()=>{w=null,R=null,j=null}}function Tt(A,_){return j&&j(A,_.map(W=>Eb(W,T.loaderData)))||A.key}function na(A,_){if(w&&R){let q=Tt(A,_);w[q]=R()}}function Wt(A,_){if(w){let q=Tt(A,_),W=w[q];if(typeof W=="number")return W}return null}function It(A,_,q){if(e.patchRoutesOnNavigation){let W=h.branches;if(A){if(Object.keys(A[0].params).length>0)return{active:!0,matches:hr(_,q,p,!0,W)}}else return{active:!0,matches:hr(_,q,p,!0,W)||[]}}return{active:!1,matches:null}}async function pt(A,_,q,W){if(!e.patchRoutesOnNavigation)return{type:"success",matches:A};let ie=A;for(;;){let ke=f;try{await e.patchRoutesOnNavigation({signal:q,path:_,matches:ie,fetcherKey:W,patch:(Le,Ue)=>{q.aborted||ly(Le,Ue,h,ke,c,!1)}})}catch(Le){return{type:"error",error:Le,partialMatches:ie}}if(q.aborted)return{type:"aborted"};let ye=h.branches,De=hr(h.activeRoutes,_,p,!1,ye),Ne=null;if(De){if(Object.keys(De[0].params).length===0)return{type:"success",matches:De};if(Ne=hr(h.activeRoutes,_,p,!0,ye),!(Ne&&ie.length<Ne.length&&et(ie,Ne.slice(0,ie.length))))return{type:"success",matches:De}}if(Ne||(Ne=hr(h.activeRoutes,_,p,!0,ye)),!Ne||et(ie,Ne))return{type:"success",matches:null};ie=Ne}}function et(A,_){return A.length===_.length&&A.every((q,W)=>q.route.id===_[W].route.id)}function wa(A){f={},h.setHmrRoutes(Io(A,c,void 0,f))}function Aa(A,_,q=!1){ly(A,_,h,f,c,q),h.hasHMRRoutes||mt({})}return M={get basename(){return p},get future(){return y},get state(){return T},get routes(){return h.stableRoutes},get branches(){return h.branches},get manifest(){return f},get window(){return n},initialize:Qe,subscribe:$t,enableScrollRestoration:Ht,navigate:qe,fetch:$a,revalidate:rt,createHref:A=>e.history.createHref(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:Ae,resetFetcher:Xe,deleteFetcher:te,dispose:ia,getBlocker:qn,deleteBlocker:_e,patchRoutes:Aa,_internalFetchControllers:P,_internalSetRoutes:wa,_internalSetStateDoNotUseOrYouWillBreakYourApp(A){mt(A)}},e.instrumentations&&(M=GS(M,e.instrumentations.map(A=>A.router).filter(Boolean))),M}function lE(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function nm(e,n,r,s,u,c){let f,h;if(u){f=[];for(let g of n)if(f.push(g),g.route.id===u){h=g;break}}else f=n,h=n[n.length-1];let p=rd(s||".",Sm(f),Hn(e.pathname,r)||e.pathname,c==="path");if(s==null&&(p.search=e.search,p.hash=e.hash),(s==null||s===""||s===".")&&h){let g=Rm(p.search);if(h.route.index&&!g)p.search=p.search?p.search.replace(/^\?/,"?index&"):"?index";else if(!h.route.index&&g){let y=new URLSearchParams(p.search),x=y.getAll("index");y.delete("index"),x.filter(S=>S).forEach(S=>y.append("index",S));let E=y.toString();p.search=E?`?${E}`:""}}return r!=="/"&&(p.pathname=HS({basename:r,pathname:p.pathname})),Ar(p)}function ny(e,n,r){if(!r||!lE(r))return{path:n};if(r.formMethod&&!jE(r.formMethod))return{path:n,error:er(405,{method:r.formMethod})};let s=()=>({path:n,error:er(400,{type:"invalid-body"})}),c=(r.formMethod||"get").toUpperCase(),f=Fb(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!cn(c))return s();let x=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((E,[S,w])=>`${E}${S}=${w}
59
- `,""):String(r.body);return{path:n,submission:{formMethod:c,formAction:f,formEncType:r.formEncType,formData:void 0,json:void 0,text:x}}}else if(r.formEncType==="application/json"){if(!cn(c))return s();try{let x=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:c,formAction:f,formEncType:r.formEncType,formData:void 0,json:x,text:void 0}}}catch{return s()}}}nt(typeof FormData=="function","FormData is not available in this environment");let h,p;if(r.formData)h=sm(r.formData),p=r.formData;else if(r.body instanceof FormData)h=sm(r.body),p=r.body;else if(r.body instanceof URLSearchParams)h=r.body,p=uy(h);else if(r.body==null)h=new URLSearchParams,p=new FormData;else try{h=new URLSearchParams(r.body),p=uy(h)}catch{return s()}let g={formMethod:c,formAction:f,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(cn(g.formMethod))return{path:n,submission:g};let y=Dr(n);return e&&y.search&&Rm(y.search)&&h.append("index",""),y.search=`?${h}`,{path:Ar(y),submission:g}}function ry(e,n,r,s,u,c,f,h,p,g,y,x,E,S,w,j,R,z,I,$,Q,J){var L;let ne=Q?$n(Q[1])?Q[1].error:Q[1].data:void 0,M=u.createURL(c.location),T=u.createURL(p),fe;if(y&&c.errors){let F=Object.keys(c.errors)[0];fe=f.findIndex(he=>he.route.id===F)}else if(Q&&$n(Q[1])){let F=Q[0];fe=f.findIndex(he=>he.route.id===F)-1}let pe=Q?Q[1].statusCode:void 0,we=pe&&pe>=400,re={currentUrl:M,currentParams:((L=c.matches[0])==null?void 0:L.params)||{},nextUrl:T,nextParams:f[0].params,...h,actionResult:ne,actionStatus:pe},je=Qo(f),Te=f.map((F,he)=>{let{route:P}=F,se=null;if(fe!=null&&he>fe)se=!1;else if(P.lazy)se=!0;else if(!Nm(P))se=!1;else if(y){let{shouldLoad:ue}=Ub(P,c.loaderData,c.errors);se=ue}else sE(c.loaderData,c.matches[he],F)&&(se=!0);if(se!==null)return rm(r,s,e,p,je,F,g,n,se);let C=!1;typeof J=="boolean"?C=J:we?C=!1:(x||M.pathname+M.search===T.pathname+T.search||M.search!==T.search||iE(c.matches[he],F))&&(C=!0);let B={...re,defaultShouldRevalidate:C},K=Oo(F,B);return rm(r,s,e,p,je,F,g,n,K,B,J)}),ee=[];return w.forEach((F,he)=>{if(y||!f.some(ve=>ve.route.id===F.routeId)||S.has(he))return;let P=c.fetchers.get(he),se=P&&P.state!=="idle"&&P.data===void 0,C=hr(R,F.path,z??"/",!1,$);if(!C){if(I&&se)return;ee.push({key:he,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(j.has(he))return;let B=Lu(C,F.path),K=new AbortController,ue=fi(u,F.path,K.signal),ge=null;if(E.has(he))E.delete(he),ge=gi(r,s,ue,F.path,C,B,g,n);else if(se)x&&(ge=gi(r,s,ue,F.path,C,B,g,n));else{let ve;typeof J=="boolean"?ve=J:we?ve=!1:ve=x;let Re={...re,defaultShouldRevalidate:ve};Oo(B,Re)&&(ge=gi(r,s,ue,F.path,C,B,g,n,Re))}ge&&ee.push({key:he,routeId:F.routeId,path:F.path,matches:ge,match:B,request:ue,controller:K})}),{dsMatches:Te,revalidatingFetchers:ee}}function Nm(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Ub(e,n,r){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Nm(e))return{shouldLoad:!1,renderFallback:!1};let s=n!=null&&e.id in n,u=r!=null&&r[e.id]!==void 0;if(!s&&u)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let c=!s&&!u;return{shouldLoad:c,renderFallback:c}}function sE(e,n,r){let s=!n||r.route.id!==n.route.id,u=!e.hasOwnProperty(r.route.id);return s||u}function iE(e,n){let r=e.route.path;return e.pathname!==n.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==n.params["*"]}function Oo(e,n){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(n);if(typeof r=="boolean")return r}return n.defaultShouldRevalidate}function ly(e,n,r,s,u,c){let f;if(e){let g=s[e];nt(g,`No route found to patch children into: routeId = ${e}`),g.children||(g.children=[]),f=g.children}else f=r.activeRoutes;let h=[],p=[];if(n.forEach(g=>{let y=f.find(x=>$b(g,x));y?p.push({existingRoute:y,newRoute:g}):h.push(g)}),h.length>0){let g=Io(h,u,[e||"_","patch",String((f==null?void 0:f.length)||"0")],s);f.push(...g)}if(c&&p.length>0)for(let g=0;g<p.length;g++){let{existingRoute:y,newRoute:x}=p[g],E=y,[S]=Io([x],u,[],{},!0);Object.assign(E,{element:S.element?S.element:E.element,errorElement:S.errorElement?S.errorElement:E.errorElement,hydrateFallbackElement:S.hydrateFallbackElement?S.hydrateFallbackElement:E.hydrateFallbackElement})}r.hasHMRRoutes||r.setRoutes([...r.activeRoutes])}function $b(e,n){var r;return"id"in e&&"id"in n&&e.id===n.id?!0:e.index===n.index&&e.path===n.path&&e.caseSensitive===n.caseSensitive?(!e.children||e.children.length===0)&&(!n.children||n.children.length===0)?!0:((r=e.children)==null?void 0:r.every((s,u)=>{var c;return(c=n.children)==null?void 0:c.some(f=>$b(s,f))}))??!1:!1}var sy=new WeakMap,Bb=({key:e,route:n,manifest:r,mapRouteProperties:s})=>{let u=r[n.id];if(nt(u,"No route found in manifest"),!u.lazy||typeof u.lazy!="object")return;let c=u.lazy[e];if(!c)return;let f=sy.get(u);f||(f={},sy.set(u,f));let h=f[e];if(h)return h;let p=(async()=>{let g=jS(e),x=u[e]!==void 0&&e!=="hasErrorBoundary";if(g)da(!g,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),f[e]=Promise.resolve();else if(x)da(!1,`Route "${u.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let E=await c();E!=null&&(Object.assign(u,{[e]:E}),Object.assign(u,s(u)))}typeof u.lazy=="object"&&(u.lazy[e]=void 0,Object.values(u.lazy).every(E=>E===void 0)&&(u.lazy=void 0))})();return f[e]=p,p},iy=new WeakMap;function oE(e,n,r,s,u){let c=r[e.id];if(nt(c,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let y=iy.get(c);if(y)return{lazyRoutePromise:y,lazyHandlerPromise:y};let x=(async()=>{nt(typeof e.lazy=="function","No lazy route function found");let E=await e.lazy(),S={};for(let w in E){let j=E[w];if(j===void 0)continue;let R=kS(w),I=c[w]!==void 0&&w!=="hasErrorBoundary";R?da(!R,"Route property "+w+" is not a supported property to be returned from a lazy route function. This property will be ignored."):I?da(!I,`Route "${c.id}" has a static property "${w}" defined but its lazy function is also returning a value for this property. The lazy route property "${w}" will be ignored.`):S[w]=j}Object.assign(c,S),Object.assign(c,{...s(c),lazy:void 0})})();return iy.set(c,x),x.catch(()=>{}),{lazyRoutePromise:x,lazyHandlerPromise:x}}let f=Object.keys(e.lazy),h=[],p;for(let y of f){if(u&&u.includes(y))continue;let x=Bb({key:y,route:e,manifest:r,mapRouteProperties:s});x&&(h.push(x),y===n&&(p=x))}let g=h.length>0?Promise.all(h).then(()=>{}):void 0;return g==null||g.catch(()=>{}),p==null||p.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:p}}async function oy(e){let n=e.matches.filter(u=>u.shouldLoad),r={};return(await Promise.all(n.map(u=>u.resolve()))).forEach((u,c)=>{r[n[c].route.id]=u}),r}async function cE(e){return e.matches.some(n=>n.route.middleware)?Hb(e,()=>oy(e)):oy(e)}function Hb(e,n){return uE(e,n,s=>{if(NE(s))throw s;return s},bE,r);function r(s,u,c){if(c)return Promise.resolve(Object.assign(c.value,{[u]:{type:"error",result:s}}));{let{matches:f}=e,h=Math.min(Math.max(f.findIndex(g=>g.route.id===u),0),Math.max(f.findIndex(g=>g.shouldCallHandler()),0)),p=ql(f,f[h].route.id).route.id;return Promise.resolve({[p]:{type:"error",result:s}})}}}async function uE(e,n,r,s,u){let{matches:c,...f}=e,h=c.flatMap(g=>g.route.middleware?g.route.middleware.map(y=>[g.route.id,y]):[]);return await Ib(f,h,n,r,s,u)}async function Ib(e,n,r,s,u,c,f=0){let{request:h}=e;if(h.signal.aborted)throw h.signal.reason??new Error(`Request aborted: ${h.method} ${h.url}`);let p=n[f];if(!p)return await r();let[g,y]=p,x,E=async()=>{if(x)throw new Error("You may only call `next()` once per middleware");try{return x={value:await Ib(e,n,r,s,u,c,f+1)},x.value}catch(S){return x={value:await c(S,g,x)},x.value}};try{let S=await y(e,E),w=S!=null?s(S):void 0;return u(w)?w:x?w??x.value:(x={value:await E()},x.value)}catch(S){return await c(S,g,x)}}function qb(e,n,r,s,u){let c=Bb({key:"middleware",route:s.route,manifest:n,mapRouteProperties:e}),f=oE(s.route,cn(r.method)?"action":"loader",n,e,u);return{middleware:c,route:f.lazyRoutePromise,handler:f.lazyHandlerPromise}}function rm(e,n,r,s,u,c,f,h,p,g=null,y){let x=!1,E=qb(e,n,r,c,f);return{...c,_lazyPromises:E,shouldLoad:p,shouldRevalidateArgs:g,shouldCallHandler(S){return x=!0,g?typeof y=="boolean"?Oo(c,{...g,defaultShouldRevalidate:y}):typeof S=="boolean"?Oo(c,{...g,defaultShouldRevalidate:S}):Oo(c,g):p},resolve(S){let{lazy:w,loader:j,middleware:R}=c.route,z=x||p||S&&!cn(r.method)&&(w||j),I=R&&R.length>0&&!j&&!w;return z&&(cn(r.method)||!I)?fE({request:r,path:s,pattern:u,match:c,lazyHandlerPromise:E==null?void 0:E.handler,lazyRoutePromise:E==null?void 0:E.route,handlerOverride:S,scopedContext:h}):Promise.resolve({type:"data",result:void 0})}}}function gi(e,n,r,s,u,c,f,h,p=null){return u.map(g=>g.route.id!==c.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:p,shouldCallHandler:()=>!1,_lazyPromises:qb(e,n,r,g,f),resolve:()=>Promise.resolve({type:"data",result:void 0})}:rm(e,n,r,s,Qo(u),g,f,h,!0,p))}async function dE(e,n,r,s,u,c,f){s.some(y=>{var x;return(x=y._lazyPromises)==null?void 0:x.middleware})&&await Promise.all(s.map(y=>{var x;return(x=y._lazyPromises)==null?void 0:x.middleware}));let h={request:n,url:Pb(n,r),pattern:Qo(s),params:s[0].params,context:c,matches:s},g=await e({...h,fetcherKey:u,runClientMiddleware:y=>{let x=h;return Hb(x,()=>y({...x,fetcherKey:u,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(y=>{var x,E;return[(x=y._lazyPromises)==null?void 0:x.handler,(E=y._lazyPromises)==null?void 0:E.route]}))}catch{}return g}async function fE({request:e,path:n,pattern:r,match:s,lazyHandlerPromise:u,lazyRoutePromise:c,handlerOverride:f,scopedContext:h}){let p,g,y=cn(e.method),x=y?"action":"loader",E=S=>{let w,j=new Promise((I,$)=>w=$);g=()=>w(),e.signal.addEventListener("abort",g);let R=I=>typeof S!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${x}" [routeId: ${s.route.id}]`)):S({request:e,url:Pb(e,n),pattern:r,params:s.params,context:h},...I!==void 0?[I]:[]),z=(async()=>{try{return{type:"data",result:await(f?f($=>R($)):R())}}catch(I){return{type:"error",result:I}}})();return Promise.race([z,j])};try{let S=y?s.route.action:s.route.loader;if(u||c)if(S){let w,[j]=await Promise.all([E(S).catch(R=>{w=R}),u,c]);if(w!==void 0)throw w;p=j}else{await u;let w=y?s.route.action:s.route.loader;if(w)[p]=await Promise.all([E(w),c]);else if(x==="action"){let j=new URL(e.url),R=j.pathname+j.search;throw er(405,{method:e.method,pathname:R,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(S)p=await E(S);else{let w=new URL(e.url),j=w.pathname+w.search;throw er(404,{pathname:j})}}catch(S){return{type:"error",result:S}}finally{g&&e.signal.removeEventListener("abort",g)}return p}async function hE(e){let n=e.headers.get("Content-Type");return n&&/\bapplication\/json\b/.test(n)?e.body==null?null:e.json():e.text()}async function mE(e){var s,u,c,f,h;let{result:n,type:r}=e;if(jm(n)){let p;try{p=await hE(n)}catch(g){return{type:"error",error:g}}return r==="error"?{type:"error",error:new Xo(n.status,n.statusText,p),statusCode:n.status,headers:n.headers}:{type:"data",data:p,statusCode:n.status,headers:n.headers}}return r==="error"?my(n)?n.data instanceof Error?{type:"error",error:n.data,statusCode:(s=n.init)==null?void 0:s.status,headers:(u=n.init)!=null&&u.headers?new Headers(n.init.headers):void 0}:{type:"error",error:yE(n),statusCode:xi(n)?n.status:void 0,headers:(c=n.init)!=null&&c.headers?new Headers(n.init.headers):void 0}:{type:"error",error:n,statusCode:xi(n)?n.status:void 0}:my(n)?{type:"data",data:n.data,statusCode:(f=n.init)==null?void 0:f.status,headers:(h=n.init)!=null&&h.headers?new Headers(n.init.headers):void 0}:{type:"data",data:n}}function pE(e,n,r,s,u){let c=e.headers.get("Location");if(nt(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!wm(c)){let f=s.slice(0,s.findIndex(h=>h.route.id===r)+1);c=nm(new URL(n.url),f,u,c),e.headers.set("Location",c)}return e}var gE=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function lm(e){try{return gE.includes(new URL(e).protocol)}catch{return!1}}function cy(e,n,r,s){if(wm(e)){let u=e,c=bm.test(u)?new URL(bb(u,n.protocol)):new URL(u);if(lm(c.toString()))throw new Error("Invalid redirect location");let f=Hn(c.pathname,r)!=null;if(c.origin===n.origin&&f)return Em(c.pathname)+c.search+c.hash}try{let u=s.createURL(e);if(lm(u.toString()))throw new Error("Invalid redirect location")}catch{}return e}function fi(e,n,r,s){let u=e.createURL(Fb(n)).toString(),c={signal:r};if(s&&cn(s.formMethod)){let{formMethod:f,formEncType:h}=s;c.method=f.toUpperCase(),h==="application/json"?(c.headers=new Headers({"Content-Type":h}),c.body=JSON.stringify(s.json)):h==="text/plain"?c.body=s.text:h==="application/x-www-form-urlencoded"&&s.formData?c.body=sm(s.formData):c.body=s.formData}return new Request(u,c)}function Pb(e,n){let r=new URL(e.url),s=typeof n=="string"?Dr(n):n;if(r.pathname=s.pathname||"/",s.search){let u=new URLSearchParams(s.search),c=u.getAll("index");u.delete("index");for(let f of c.filter(Boolean))u.append("index",f);r.search=u.size?`?${u.toString()}`:""}else r.search="";return r.hash=s.hash||"",r}function sm(e){let n=new URLSearchParams;for(let[r,s]of e.entries())n.append(r,typeof s=="string"?s:s.name);return n}function uy(e){let n=new FormData;for(let[r,s]of e.entries())n.append(r,s);return n}function vE(e,n,r,s=!1,u=!1){let c={},f=null,h,p=!1,g={},y=r&&$n(r[1])?r[1].error:void 0;return e.forEach(x=>{if(!(x.route.id in n))return;let E=x.route.id,S=n[E];if(nt(!xs(S),"Cannot handle redirect results in processLoaderData"),$n(S)){let w=S.error;if(y!==void 0&&(w=y,y=void 0),f=f||{},u)f[E]=w;else{let j=ql(e,E);f[j.route.id]==null&&(f[j.route.id]=w)}s||(c[E]=zb),p||(p=!0,h=xi(S.error)?S.error.status:500),S.headers&&(g[E]=S.headers)}else c[E]=S.data,S.statusCode&&S.statusCode!==200&&!p&&(h=S.statusCode),S.headers&&(g[E]=S.headers)}),y!==void 0&&r&&(f={[r[0]]:y},r[2]&&(c[r[2]]=void 0)),{loaderData:c,errors:f,statusCode:h||200,loaderHeaders:g}}function dy(e,n,r,s,u,c,f){let{loaderData:h,errors:p}=vE(n,r,s);return u.filter(g=>!g.matches||g.matches.some(y=>y.shouldLoad)).forEach(g=>{let{key:y,match:x,controller:E}=g;if(E&&E.signal.aborted)return;let S=c[y];if(nt(S,"Did not find corresponding fetcher result"),$n(S)){let w=ql(e.matches,x==null?void 0:x.route.id);p&&p[w.route.id]||(p={...p,[w.route.id]:S.error}),f.delete(y)}else if(xs(S))nt(!1,"Unhandled fetcher revalidation redirect");else{let w=Tr(S.data);f.set(y,w)}}),{loaderData:h,errors:p}}function fy(e,n,r,s){let u=Object.entries(n).filter(([,c])=>c!==zb).reduce((c,[f,h])=>(c[f]=h,c),{});for(let c of r){let f=c.route.id;if(!n.hasOwnProperty(f)&&e.hasOwnProperty(f)&&c.route.loader&&(u[f]=e[f]),s&&s.hasOwnProperty(f))break}return u}function hy(e){return e?$n(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ql(e,n){return(n?e.slice(0,e.findIndex(s=>s.route.id===n)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function xu(e){let n=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:n}],route:n}}function er(e,{pathname:n,routeId:r,method:s,type:u,message:c}={}){let f="Unknown Server Error",h="Unknown @remix-run/router error";return e===400?(f="Bad Request",s&&n&&r?h=`You made a ${s} request to "${n}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:u==="invalid-body"&&(h="Unable to encode submission body")):e===403?(f="Forbidden",h=`Route "${r}" does not match URL "${n}"`):e===404?(f="Not Found",h=`No route matches URL "${n}"`):e===405&&(f="Method Not Allowed",s&&n&&r?h=`You made a ${s.toUpperCase()} request to "${n}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:s&&(h=`Invalid request method "${s.toUpperCase()}"`)),new Xo(e||500,f,new Error(h),!0)}function yu(e){let n=Object.entries(e);for(let r=n.length-1;r>=0;r--){let[s,u]=n[r];if(xs(u))return{key:s,result:u}}}function Fb(e){let n=typeof e=="string"?Dr(e):e;return Ar({...n,hash:""})}function xE(e,n){return e.pathname!==n.pathname||e.search!==n.search?!1:e.hash===""?n.hash!=="":e.hash===n.hash?!0:n.hash!==""}function yE(e){var n,r;return new Xo(((n=e.init)==null?void 0:n.status)??500,((r=e.init)==null?void 0:r.statusText)??"Internal Server Error",e.data)}function bE(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([n,r])=>typeof n=="string"&&wE(r))}function wE(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function SE(e){return jm(e.result)&&Mb.has(e.result.status)}function $n(e){return e.type==="error"}function xs(e){return(e&&e.type)==="redirect"}function my(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function jm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function EE(e){return Mb.has(e)}function NE(e){return jm(e)&&EE(e.status)&&e.headers.has("Location")}function jE(e){return eE.has(e.toUpperCase())}function cn(e){return WS.has(e.toUpperCase())}function Rm(e){return new URLSearchParams(e).getAll("index").some(n=>n==="")}function Lu(e,n){let r=typeof n=="string"?Dr(n).search:n.search;if(e[e.length-1].route.index&&Rm(r||""))return e[e.length-1];let s=Tb(e);return s[s.length-1]}function py(e){let{formMethod:n,formAction:r,formEncType:s,text:u,formData:c,json:f}=e;if(!(!n||!r||!s)){if(u!=null)return{formMethod:n,formAction:r,formEncType:s,formData:void 0,json:void 0,text:u};if(c!=null)return{formMethod:n,formAction:r,formEncType:s,formData:c,json:void 0,text:void 0};if(f!==void 0)return{formMethod:n,formAction:r,formEncType:s,formData:void 0,json:f,text:void 0}}}function _h(e,n,r,s){return s?{state:"loading",location:e,matches:n,historyAction:r,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:e,matches:n,historyAction:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function RE(e,n,r,s){return{state:"submitting",location:e,matches:n,historyAction:r,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function bo(e,n){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:n}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function kE(e,n){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:n?n.data:void 0}}function Tr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function TE(e,n){try{let r=e.sessionStorage.getItem(Lb);if(r){let s=JSON.parse(r);for(let[u,c]of Object.entries(s||{}))c&&Array.isArray(c)&&n.set(u,new Set(c||[]))}}catch{}}function CE(e,n){if(n.size>0){let r={};for(let[s,u]of n)r[s]=[...u];try{e.sessionStorage.setItem(Lb,JSON.stringify(r))}catch(s){da(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function gy(){let e,n,r=new Promise((s,u)=>{e=async c=>{s(c);try{await r}catch{}},n=async c=>{u(c);try{await r}catch{}}});return{promise:r,resolve:e,reject:n}}var Es=v.createContext(null);Es.displayName="DataRouter";var wi=v.createContext(null);wi.displayName="DataRouterState";var Vb=v.createContext(!1);function Yb(){return v.useContext(Vb)}var km=v.createContext({isTransitioning:!1});km.displayName="ViewTransition";var Tm=v.createContext(new Map);Tm.displayName="Fetchers";var AE=v.createContext(null);AE.displayName="Await";var Tn=v.createContext(null);Tn.displayName="Navigation";var ld=v.createContext(null);ld.displayName="Location";var lr=v.createContext({outlet:null,matches:[],isDataRoute:!1});lr.displayName="Route";var Cm=v.createContext(null);Cm.displayName="RouteError";var Gb="REACT_ROUTER_ERROR",DE="REDIRECT",OE="ROUTE_ERROR_RESPONSE";function ME(e){if(e.startsWith(`${Gb}:${DE}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function _E(e){if(e.startsWith(`${Gb}:${OE}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Xo(n.status,n.statusText,n.data)}catch{}}function LE(e,{relative:n}={}){nt(Ko(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(Tn),{hash:u,pathname:c,search:f}=Zo(e,{relative:n}),h=c;return r!=="/"&&(h=c==="/"?r:nr([r,c])),s.createHref({pathname:h,search:f,hash:u})}function Ko(){return v.useContext(ld)!=null}function In(){return nt(Ko(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(ld).location}var Xb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Qb(e){v.useContext(Tn).static||v.useLayoutEffect(e)}function Or(){let{isDataRoute:e}=v.useContext(lr);return e?QE():zE()}function zE(){nt(Ko(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Es),{basename:n,navigator:r}=v.useContext(Tn),{matches:s}=v.useContext(lr),{pathname:u}=In(),c=JSON.stringify(Sm(s)),f=v.useRef(!1);return Qb(()=>{f.current=!0}),v.useCallback((p,g={})=>{if(da(f.current,Xb),!f.current)return;if(typeof p=="number"){r.go(p);return}let y=rd(p,JSON.parse(c),u,g.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:nr([n,y.pathname])),(g.replace?r.replace:r.push)(y,g.state,g)},[n,r,c,u,e])}var UE=v.createContext(null);function $E(e){let n=v.useContext(lr).outlet;return v.useMemo(()=>n&&v.createElement(UE.Provider,{value:e},n),[n,e])}function BE(){let{matches:e}=v.useContext(lr),n=e[e.length-1];return(n==null?void 0:n.params)??{}}function Zo(e,{relative:n}={}){let{matches:r}=v.useContext(lr),{pathname:s}=In(),u=JSON.stringify(Sm(r));return v.useMemo(()=>rd(e,JSON.parse(u),s,n==="path"),[e,u,s,n])}function HE(e,n,r){nt(Ko(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Tn),{matches:u}=v.useContext(lr),c=u[u.length-1],f=c?c.params:{},h=c?c.pathname:"/",p=c?c.pathnameBase:"/",g=c&&c.route;{let R=g&&g.path||"";e0(h,!g||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (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 y=In(),x;x=y;let E=x.pathname||"/",S=E;if(p!=="/"){let R=p.replace(/^\//,"").split("/");S="/"+E.replace(/^\//,"").split("/").slice(R.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(R=>Object.assign(R,{route:r.manifest[R.route.id]||R.route})):Sb(e,{pathname:S});return da(g||w!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),da(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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.`),VE(w&&w.map(R=>Object.assign({},R,{params:Object.assign({},f,R.params),pathname:nr([p,s.encodeLocation?s.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?p:nr([p,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,r)}function IE(){let e=Jb(),n=xi(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},f=null;return console.error("Error handled by React Router default ErrorBoundary:",e),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:c},"ErrorBoundary")," or"," ",v.createElement("code",{style:c},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},n),r?v.createElement("pre",{style:u},r):null,f)}var qE=v.createElement(IE,null),Kb=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=_E(e.digest);r&&(e=r)}let n=e!==void 0?v.createElement(lr.Provider,{value:this.props.routeContext},v.createElement(Cm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(PE,{error:e},n):n}};Kb.contextType=Vb;var Lh=new WeakMap;function PE({children:e,error:n}){let{basename:r}=v.useContext(Tn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=ME(n.digest);if(s){let u=Lh.get(n);if(u)throw u;let c=Ab(s.location,r),f=c.absoluteURL||c.to;if(lm(f))throw new Error("Invalid redirect location");if(Cb&&!Lh.get(n))if(c.isExternal||s.reloadDocument)window.location.href=f;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:s.replace}));throw Lh.set(n,h),h}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f}`})}}return e}function FE({routeContext:e,match:n,children:r}){let s=v.useContext(Es);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(lr.Provider,{value:e},r)}function VE(e,n=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let u=e,c=s==null?void 0:s.errors;if(c!=null){let y=u.findIndex(x=>x.route.id&&(c==null?void 0:c[x.route.id])!==void 0);nt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),u=u.slice(0,Math.min(u.length,y+1))}let f=!1,h=-1;if(r&&s){f=s.renderFallback;for(let y=0;y<u.length;y++){let x=u[y];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(h=y),x.route.id){let{loaderData:E,errors:S}=s,w=x.route.loader&&!E.hasOwnProperty(x.route.id)&&(!S||S[x.route.id]===void 0);if(x.route.lazy||w){r.isStatic&&(f=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let p=r==null?void 0:r.onError,g=s&&p?(y,x)=>{var E,S;p(y,{location:s.location,params:((S=(E=s.matches)==null?void 0:E[0])==null?void 0:S.params)??{},pattern:Qo(s.matches),errorInfo:x})}:void 0;return u.reduceRight((y,x,E)=>{let S,w=!1,j=null,R=null;s&&(S=c&&x.route.id?c[x.route.id]:void 0,j=x.route.errorElement||qE,f&&(h<0&&E===0?(e0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,R=null):h===E&&(w=!0,R=x.route.hydrateFallbackElement||null)));let z=n.concat(u.slice(0,E+1)),I=()=>{let $;return S?$=j:w?$=R:x.route.Component?$=v.createElement(x.route.Component,null):x.route.element?$=x.route.element:$=y,v.createElement(FE,{match:x,routeContext:{outlet:y,matches:z,isDataRoute:s!=null},children:$})};return s&&(x.route.ErrorBoundary||x.route.errorElement||E===0)?v.createElement(Kb,{location:s.location,revalidation:s.revalidation,component:j,error:S,children:I(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:g}):I()},null)}function Am(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Zb(e){let n=v.useContext(Es);return nt(n,Am(e)),n}function Si(e){let n=v.useContext(wi);return nt(n,Am(e)),n}function YE(e){let n=v.useContext(lr);return nt(n,Am(e)),n}function sd(e){let n=YE(e),r=n.matches[n.matches.length-1];return nt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function GE(){return sd("useRouteId")}function gr(){let e=Si("useNavigation");return v.useMemo(()=>{let{matches:n,historyAction:r,...s}=e.navigation;return s},[e.navigation])}function XE(){let e=Zb("useRevalidator"),n=Si("useRevalidator"),r=v.useCallback(async()=>{await e.router.revalidate()},[e.router]);return v.useMemo(()=>({revalidate:r,state:n.revalidation}),[r,n.revalidation])}function Wb(){let{matches:e,loaderData:n}=Si("useMatches");return v.useMemo(()=>e.map(r=>Eb(r,n)),[e,n])}function ol(){let e=Si("useLoaderData"),n=sd("useLoaderData");return e.loaderData[n]}function Ns(e){return Si("useRouteLoaderData").loaderData[e]}function Jb(){var s;let e=v.useContext(Cm),n=Si("useRouteError"),r=sd("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[r]}function QE(){let{router:e}=Zb("useNavigate"),n=sd("useNavigate"),r=v.useRef(!1);return Qb(()=>{r.current=!0}),v.useCallback(async(u,c={})=>{da(r.current,Xb),r.current&&(typeof u=="number"?await e.navigate(u):await e.navigate(u,{fromRouteId:n,...c}))},[e,n])}var vy={};function e0(e,n,r){!n&&!vy[e]&&(vy[e]=!0,da(!1,r))}var xy={};function yy(e,n){!e&&!xy[n]&&(xy[n]=!0,console.warn(n))}var KE="useOptimistic",by=mS[KE],ZE=()=>{};function WE(e){return by?by(e):[e,ZE]}function JE(e){let n={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&da(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(n,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&da(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(n,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&da(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(n,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),n}var eN=["HydrateFallback","hydrateFallbackElement"],tN=class{constructor(){this.status="pending",this.promise=new Promise((e,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}};function aN({router:e,flushSync:n,onError:r,useTransitions:s}){s=Yb()||s;let[c,f]=v.useState(e.state),[h,p]=WE(c),[g,y]=v.useState(),[x,E]=v.useState({isTransitioning:!1}),[S,w]=v.useState(),[j,R]=v.useState(),[z,I]=v.useState(),$=v.useRef(new Map),Q=v.useCallback((T,{deletedFetchers:fe,newErrors:pe,flushSync:we,viewTransitionOpts:re})=>{pe&&r&&Object.values(pe).forEach(Te=>{var ee;return r(Te,{location:T.location,params:((ee=T.matches[0])==null?void 0:ee.params)??{},pattern:Qo(T.matches)})}),T.fetchers.forEach((Te,ee)=>{Te.data!==void 0&&$.current.set(ee,Te.data)}),fe.forEach(Te=>$.current.delete(Te)),yy(we===!1||n!=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 je=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(yy(re==null||je,"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."),!re||!je){n&&we?n(()=>f(T)):s===!1?f(T):v.startTransition(()=>{s===!0&&p(Te=>wy(Te,T)),f(T)});return}if(n&&we){n(()=>{j&&(S==null||S.resolve(),j.skipTransition()),E({isTransitioning:!0,flushSync:!0,currentLocation:re.currentLocation,nextLocation:re.nextLocation})});let Te=e.window.document.startViewTransition(()=>{n(()=>f(T))});Te.finished.finally(()=>{n(()=>{w(void 0),R(void 0),y(void 0),E({isTransitioning:!1})})}),n(()=>R(Te));return}j?(S==null||S.resolve(),j.skipTransition(),I({state:T,currentLocation:re.currentLocation,nextLocation:re.nextLocation})):(y(T),E({isTransitioning:!0,flushSync:!1,currentLocation:re.currentLocation,nextLocation:re.nextLocation}))},[e.window,n,j,S,s,p,r]);v.useLayoutEffect(()=>e.subscribe(Q),[e,Q]),v.useEffect(()=>{x.isTransitioning&&!x.flushSync&&w(new tN)},[x]),v.useEffect(()=>{if(S&&g&&e.window){let T=g,fe=S.promise,pe=e.window.document.startViewTransition(async()=>{s===!1?f(T):v.startTransition(()=>{s===!0&&p(we=>wy(we,T)),f(T)}),await fe});pe.finished.finally(()=>{w(void 0),R(void 0),y(void 0),E({isTransitioning:!1})}),R(pe)}},[g,S,e.window,s,p]),v.useEffect(()=>{S&&g&&h.location.key===g.location.key&&S.resolve()},[S,j,h.location,g]),v.useEffect(()=>{!x.isTransitioning&&z&&(y(z.state),E({isTransitioning:!0,flushSync:!1,currentLocation:z.currentLocation,nextLocation:z.nextLocation}),I(void 0))},[x.isTransitioning,z]);let J=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:T=>e.navigate(T),push:(T,fe,pe)=>e.navigate(T,{state:fe,preventScrollReset:pe==null?void 0:pe.preventScrollReset}),replace:(T,fe,pe)=>e.navigate(T,{replace:!0,state:fe,preventScrollReset:pe==null?void 0:pe.preventScrollReset})}),[e]),ne=e.basename||"/",M=v.useMemo(()=>({router:e,navigator:J,static:!1,basename:ne,onError:r}),[e,J,ne,r]);return v.createElement(v.Fragment,null,v.createElement(Es.Provider,{value:M},v.createElement(wi.Provider,{value:h},v.createElement(Tm.Provider,{value:$.current},v.createElement(km.Provider,{value:x},v.createElement(lN,{basename:ne,location:h.location,navigationType:h.historyAction,navigator:J,useTransitions:s},v.createElement(nN,{routes:e.routes,manifest:e.manifest,future:e.future,state:h,isStatic:!1,onError:r})))))),null)}function wy(e,n){return{...e,navigation:n.navigation.state!=="idle"?n.navigation:e.navigation,revalidation:n.revalidation!=="idle"?n.revalidation:e.revalidation,actionData:n.navigation.state!=="submitting"?n.actionData:e.actionData,fetchers:n.fetchers}}var nN=v.memo(rN);function rN({routes:e,manifest:n,future:r,state:s,isStatic:u,onError:c}){return HE(e,void 0,{manifest:n,state:s,isStatic:u,onError:c})}function Ei(e){return $E(e.context)}function lN({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:u,static:c=!1,useTransitions:f}){nt(!Ko(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:h,navigator:u,static:c,useTransitions:f,future:{}}),[h,u,c,f]);typeof r=="string"&&(r=Dr(r));let{pathname:g="/",search:y="",hash:x="",state:E=null,key:S="default",mask:w}=r,j=v.useMemo(()=>{let R=Hn(g,h);return R==null?null:{location:{pathname:R,search:y,hash:x,state:E,key:S,mask:w},navigationType:s}},[h,g,y,x,E,S,s,w]);return da(j!=null,`<Router basename="${h}"> is not able to match the URL "${g}${y}${x}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:v.createElement(Tn.Provider,{value:p},v.createElement(ld.Provider,{children:n,value:j}))}var zu="get",Uu="application/x-www-form-urlencoded";function id(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function sN(e){return id(e)&&e.tagName.toLowerCase()==="button"}function iN(e){return id(e)&&e.tagName.toLowerCase()==="form"}function oN(e){return id(e)&&e.tagName.toLowerCase()==="input"}function cN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function uN(e,n){return e.button===0&&(!n||n==="_self")&&!cN(e)}function im(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let s=e[r];return n.concat(Array.isArray(s)?s.map(u=>[r,u]):[[r,s]])},[]))}function dN(e,n){let r=im(e);return n&&n.forEach((s,u)=>{r.has(u)||n.getAll(u).forEach(c=>{r.append(u,c)})}),r}var bu=null;function fN(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var hN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zh(e){return e!=null&&!hN.has(e)?(da(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Uu}"`),null):e}function mN(e,n){let r,s,u,c,f;if(iN(e)){let h=e.getAttribute("action");s=h?Hn(h,n):null,r=e.getAttribute("method")||zu,u=zh(e.getAttribute("enctype"))||Uu,c=new FormData(e)}else if(sN(e)||oN(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||h.getAttribute("action");if(s=p?Hn(p,n):null,r=e.getAttribute("formmethod")||h.getAttribute("method")||zu,u=zh(e.getAttribute("formenctype"))||zh(h.getAttribute("enctype"))||Uu,c=new FormData(h,e),!fN()){let{name:g,type:y,value:x}=e;if(y==="image"){let E=g?`${g}.`:"";c.append(`${E}x`,"0"),c.append(`${E}y`,"0")}else g&&c.append(g,x)}}else{if(id(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=zu,s=null,u=Uu,f=e}return c&&u==="text/plain"&&(f=c,c=void 0),{action:s,method:r.toLowerCase(),encType:u,formData:c,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var pN={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},gN=/[&><\u2028\u2029]/g;function Sy(e){return e.replace(gN,n=>pN[n])}function Dm(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function t0(e,n,r,s){let u=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${s}`:u.pathname=`${u.pathname}.${s}`:u.pathname==="/"?u.pathname=`_root.${s}`:n&&Hn(u.pathname,n)==="/"?u.pathname=`${Pu(n)}/_root.${s}`:u.pathname=`${Pu(u.pathname)}.${s}`,u}async function vN(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function xN(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function yN(e,n,r){let s=await Promise.all(e.map(async u=>{let c=n.routes[u.route.id];if(c){let f=await vN(c,r);return f.links?f.links():[]}return[]}));return EN(s.flat(1).filter(xN).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function Ey(e,n,r,s,u,c){let f=(p,g)=>r[g]?p.route.id!==r[g].route.id:!0,h=(p,g)=>{var y;return r[g].pathname!==p.pathname||((y=r[g].route.path)==null?void 0:y.endsWith("*"))&&r[g].params["*"]!==p.params["*"]};return c==="assets"?n.filter((p,g)=>f(p,g)||h(p,g)):c==="data"?n.filter((p,g)=>{var x;let y=s.routes[p.route.id];if(!y||!y.hasLoader)return!1;if(f(p,g)||h(p,g))return!0;if(p.route.shouldRevalidate){let E=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((x=r[0])==null?void 0:x.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof E=="boolean")return E}return!0}):[]}function bN(e,n,{includeHydrateFallback:r}={}){return wN(e.map(s=>{let u=n.routes[s.route.id];if(!u)return[];let c=[u.module];return u.clientActionModule&&(c=c.concat(u.clientActionModule)),u.clientLoaderModule&&(c=c.concat(u.clientLoaderModule)),r&&u.hydrateFallbackModule&&(c=c.concat(u.hydrateFallbackModule)),u.imports&&(c=c.concat(u.imports)),c}).flat(1))}function wN(e){return[...new Set(e)]}function SN(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function EN(e,n){let r=new Set;return new Set(n),e.reduce((s,u)=>{let c=JSON.stringify(SN(u));return r.has(c)||(r.add(c),s.push({key:c,link:u})),s},[])}function Om(){let e=v.useContext(Es);return Dm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function NN(){let e=v.useContext(wi);return Dm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var od=v.createContext(void 0);od.displayName="FrameworkContext";function cd(){let e=v.useContext(od);return Dm(e,"You must render this element inside a <HydratedRouter> element"),e}function jN(e,n){let r=v.useContext(od),[s,u]=v.useState(!1),[c,f]=v.useState(!1),{onFocus:h,onBlur:p,onMouseEnter:g,onMouseLeave:y,onTouchStart:x}=n,E=v.useRef(null);v.useEffect(()=>{if(e==="render"&&f(!0),e==="viewport"){let j=z=>{z.forEach(I=>{f(I.isIntersecting)})},R=new IntersectionObserver(j,{threshold:.5});return E.current&&R.observe(E.current),()=>{R.disconnect()}}},[e]),v.useEffect(()=>{if(s){let j=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(j)}}},[s]);let S=()=>{u(!0)},w=()=>{u(!1),f(!1)};return r?e!=="intent"?[c,E,{}]:[c,E,{onFocus:wo(h,S),onBlur:wo(p,w),onMouseEnter:wo(g,S),onMouseLeave:wo(y,w),onTouchStart:wo(x,S)}]:[!1,E,{}]}function wo(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function RN({page:e,...n}){let r=Yb(),{nonce:s}=cd(),{router:u}=Om(),c=v.useMemo(()=>Sb(u.routes,e,u.basename),[u.routes,e,u.basename]);return c?(n.nonce==null&&s&&(n={...n,nonce:s}),r?v.createElement(TN,{page:e,matches:c,...n}):v.createElement(CN,{page:e,matches:c,...n})):null}function kN(e){let{manifest:n,routeModules:r}=cd(),[s,u]=v.useState([]);return v.useEffect(()=>{let c=!1;return yN(e,n,r).then(f=>{c||u(f)}),()=>{c=!0}},[e,n,r]),s}function TN({page:e,matches:n,...r}){let s=In(),{future:u}=cd(),{basename:c}=Om(),f=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let h=t0(e,c,u.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let y of n)typeof y.route.shouldRevalidate=="function"?p=!0:g.push(y.route.id);return p&&g.length>0&&h.searchParams.set("_routes",g.join(",")),[h.pathname+h.search]},[c,u.v8_trailingSlashAwareDataRequests,e,s,n]);return v.createElement(v.Fragment,null,f.map(h=>v.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...r})))}function CN({page:e,matches:n,...r}){let s=In(),{future:u,manifest:c,routeModules:f}=cd(),{basename:h}=Om(),{loaderData:p,matches:g}=NN(),y=v.useMemo(()=>Ey(e,n,g,c,s,"data"),[e,n,g,c,s]),x=v.useMemo(()=>Ey(e,n,g,c,s,"assets"),[e,n,g,c,s]),E=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,R=!1;if(n.forEach(I=>{var Q;let $=c.routes[I.route.id];!$||!$.hasLoader||(!y.some(J=>J.route.id===I.route.id)&&I.route.id in p&&((Q=f[I.route.id])!=null&&Q.shouldRevalidate)||$.hasClientLoader?R=!0:j.add(I.route.id))}),j.size===0)return[];let z=t0(e,h,u.v8_trailingSlashAwareDataRequests,"data");return R&&j.size>0&&z.searchParams.set("_routes",n.filter(I=>j.has(I.route.id)).map(I=>I.route.id).join(",")),[z.pathname+z.search]},[h,u.v8_trailingSlashAwareDataRequests,p,s,c,y,n,e,f]),S=v.useMemo(()=>bN(x,c),[x,c]),w=kN(x);return v.createElement(v.Fragment,null,E.map(j=>v.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),S.map(j=>v.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),w.map(({key:j,link:R})=>v.createElement("link",{key:j,nonce:r.nonce,...R,crossOrigin:R.crossOrigin??r.crossOrigin})))}function AN(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var DN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{DN&&(window.__reactRouterVersion="7.18.0")}catch{}function ON(e,n){return rE({basename:n==null?void 0:n.basename,getContext:n==null?void 0:n.getContext,future:n==null?void 0:n.future,history:wS({window:n==null?void 0:n.window}),hydrationData:MN(),routes:e,mapRouteProperties:JE,hydrationRouteProperties:eN,dataStrategy:n==null?void 0:n.dataStrategy,patchRoutesOnNavigation:n==null?void 0:n.patchRoutesOnNavigation,window:n==null?void 0:n.window,instrumentations:n==null?void 0:n.instrumentations}).initialize()}function MN(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:_N(e.errors)}),e}function _N(e){if(!e)return null;let n=Object.entries(e),r={};for(let[s,u]of n)if(u&&u.__type==="RouteErrorResponse")r[s]=new Xo(u.status,u.statusText,u.data,u.internal===!0);else if(u&&u.__type==="Error"){if(typeof u.__subType=="string"&&VS.includes(u.__subType)){let c=window[u.__subType];if(typeof c=="function")try{let f=new c(u.message);f.stack="",r[s]=f}catch{}}if(r[s]==null){let c=new Error(u.message);c.stack="",r[s]=c}}else r[s]=u;return r}var Ye=v.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:u,reloadDocument:c,replace:f,mask:h,state:p,target:g,to:y,preventScrollReset:x,viewTransition:E,defaultShouldRevalidate:S,...w},j){let{basename:R,navigator:z,useTransitions:I}=v.useContext(Tn),$=typeof y=="string"&&nd.test(y),Q=Ab(y,R);y=Q.to;let J=LE(y,{relative:u}),ne=In(),M=null;if(h){let ee=rd(h,[],ne.mask?ne.mask.pathname:"/",!0);R!=="/"&&(ee.pathname=ee.pathname==="/"?R:nr([R,ee.pathname])),M=z.createHref(ee)}let[T,fe,pe]=jN(s,w),we=LN(y,{replace:f,mask:h,state:p,target:g,preventScrollReset:x,relative:u,viewTransition:E,defaultShouldRevalidate:S,useTransitions:I});function re(ee){n&&n(ee),ee.defaultPrevented||we(ee)}let je=!(Q.isExternal||c),Te=v.createElement("a",{...w,...pe,href:(je?M:void 0)||Q.absoluteURL||J,onClick:je?re:n,ref:AN(j,fe),target:g,"data-discover":!$&&r==="render"?"true":void 0});return T&&!$?v.createElement(v.Fragment,null,Te,v.createElement(RN,{page:J})):Te});Ye.displayName="Link";var om=v.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:u=!1,style:c,to:f,viewTransition:h,children:p,...g},y){let x=Zo(f,{relative:g.relative}),E=In(),S=v.useContext(wi),{navigator:w,basename:j}=v.useContext(Tn),R=S!=null&&IN(x)&&h===!0,z=w.encodeLocation?w.encodeLocation(x).pathname:x.pathname,I=E.pathname,$=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;r||(I=I.toLowerCase(),$=$?$.toLowerCase():null,z=z.toLowerCase()),$&&j&&($=Hn($,j)||$);const Q=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let J=I===z||!u&&I.startsWith(z)&&I.charAt(Q)==="/",ne=$!=null&&($===z||!u&&$.startsWith(z)&&$.charAt(z.length)==="/"),M={isActive:J,isPending:ne,isTransitioning:R},T=J?n:void 0,fe;typeof s=="function"?fe=s(M):fe=[s,J?"active":null,ne?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let pe=typeof c=="function"?c(M):c;return v.createElement(Ye,{...g,"aria-current":T,className:fe,ref:y,style:pe,to:f,viewTransition:h},typeof p=="function"?p(M):p)});om.displayName="NavLink";var Za=v.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:u,state:c,method:f=zu,action:h,onSubmit:p,relative:g,preventScrollReset:y,viewTransition:x,defaultShouldRevalidate:E,...S},w)=>{let{useTransitions:j}=v.useContext(Tn),R=Mm(),z=$N(h,{relative:g}),I=f.toLowerCase()==="get"?"get":"post",$=typeof h=="string"&&nd.test(h),Q=J=>{if(p&&p(J),J.defaultPrevented)return;J.preventDefault();let ne=J.nativeEvent.submitter,M=(ne==null?void 0:ne.getAttribute("formmethod"))||f,T=()=>R(ne||J.currentTarget,{fetcherKey:n,method:M,navigate:r,replace:u,state:c,relative:g,preventScrollReset:y,viewTransition:x,defaultShouldRevalidate:E});j&&r!==!1?v.startTransition(()=>T()):T()};return v.createElement("form",{ref:w,method:I,action:z,onSubmit:s?p:Q,...S,"data-discover":!$&&e==="render"?"true":void 0})});Za.displayName="Form";function a0({getKey:e,storageKey:n,...r}){let s=v.useContext(od),{basename:u}=v.useContext(Tn),c=In(),f=Wb();BN({getKey:e,storageKey:n});let h=v.useMemo(()=>{if(!s||!e)return null;let g=um(c,f,u,e);return g!==c.key?g:null},[]);if(!s||s.isSpaMode)return null;let p=((g,y)=>{if(!window.history.state||!window.history.state.key){let x=Math.random().toString(32).slice(2);window.history.replaceState({key:x},"")}try{let E=JSON.parse(sessionStorage.getItem(g)||"{}")[y||window.history.state.key];typeof E=="number"&&window.scrollTo(0,E)}catch(x){console.error(x),sessionStorage.removeItem(g)}}).toString();return r.nonce==null&&(s!=null&&s.nonce)&&(r.nonce=s.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${p})(${Sy(JSON.stringify(n||cm))}, ${Sy(JSON.stringify(h))})`}})}a0.displayName="ScrollRestoration";function n0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ud(e){let n=v.useContext(Es);return nt(n,n0(e)),n}function r0(e){let n=v.useContext(wi);return nt(n,n0(e)),n}function LN(e,{target:n,replace:r,mask:s,state:u,preventScrollReset:c,relative:f,viewTransition:h,defaultShouldRevalidate:p,useTransitions:g}={}){let y=Or(),x=In(),E=Zo(e,{relative:f});return v.useCallback(S=>{if(uN(S,n)){S.preventDefault();let w=r!==void 0?r:Ar(x)===Ar(E),j=()=>y(e,{replace:w,mask:s,state:u,preventScrollReset:c,relative:f,viewTransition:h,defaultShouldRevalidate:p});g?v.startTransition(()=>j()):j()}},[x,y,E,r,s,u,n,e,c,f,h,p,g])}function Wo(e){da(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 n=v.useRef(im(e)),r=v.useRef(!1),s=In(),u=v.useMemo(()=>dN(s.search,r.current?null:n.current),[s.search]),c=Or(),f=v.useCallback((h,p)=>{const g=im(typeof h=="function"?h(new URLSearchParams(u)):h);r.current=!0,c("?"+g,p)},[c,u]);return[u,f]}var zN=0,UN=()=>`__${String(++zN)}__`;function Mm(){let{router:e}=ud("useSubmit"),{basename:n}=v.useContext(Tn),r=GE(),s=e.fetch,u=e.navigate;return v.useCallback(async(c,f={})=>{let{action:h,method:p,encType:g,formData:y,body:x}=mN(c,n);if(f.navigate===!1){let E=f.fetcherKey||UN();await s(E,r,f.action||h,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:y,body:x,formMethod:f.method||p,formEncType:f.encType||g,flushSync:f.flushSync})}else await u(f.action||h,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:y,body:x,formMethod:f.method||p,formEncType:f.encType||g,replace:f.replace,state:f.state,fromRouteId:r,flushSync:f.flushSync,viewTransition:f.viewTransition})},[s,u,n,r])}function $N(e,{relative:n}={}){let{basename:r}=v.useContext(Tn),s=v.useContext(lr);nt(s,"useFormAction must be used inside a RouteContext");let[u]=s.matches.slice(-1),c={...Zo(e||".",{relative:n})},f=In();if(e==null){c.search=f.search;let h=new URLSearchParams(c.search),p=h.getAll("index");if(p.some(y=>y==="")){h.delete("index"),p.filter(x=>x).forEach(x=>h.append("index",x));let y=h.toString();c.search=y?`?${y}`:""}}return(!e||e===".")&&u.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:nr([r,c.pathname])),Ar(c)}function ws({key:e}={}){var J;let{router:n}=ud("useFetcher"),r=r0("useFetcher"),s=v.useContext(Tm),u=v.useContext(lr),c=(J=u.matches[u.matches.length-1])==null?void 0:J.route.id;nt(s,"useFetcher must be used inside a FetchersContext"),nt(u,"useFetcher must be used inside a RouteContext"),nt(c!=null,'useFetcher can only be used on routes that contain a unique "id"');let f=v.useId(),[h,p]=v.useState(e||f);e&&e!==h&&p(e);let{deleteFetcher:g,getFetcher:y,resetFetcher:x,fetch:E}=n;v.useEffect(()=>(y(h),()=>g(h)),[g,y,h]);let S=v.useCallback(async(ne,M)=>{nt(c,"No routeId available for fetcher.load()"),await E(h,c,ne,M)},[h,c,E]),w=Mm(),j=v.useCallback(async(ne,M)=>{await w(ne,{...M,navigate:!1,fetcherKey:h})},[h,w]),R=v.useCallback(ne=>x(h,ne),[x,h]),z=v.useMemo(()=>{let ne=v.forwardRef((M,T)=>v.createElement(Za,{...M,navigate:!1,fetcherKey:h,ref:T}));return ne.displayName="fetcher.Form",ne},[h]),I=r.fetchers.get(h)||_b,$=s.get(h);return v.useMemo(()=>({Form:z,submit:j,load:S,reset:R,...I,data:$}),[z,j,S,R,I,$])}var cm="react-router-scroll-positions",wu={};function um(e,n,r,s){let u=null;return s&&(r!=="/"?u=s({...e,pathname:Hn(e.pathname,r)||e.pathname},n):u=s(e,n)),u==null&&(u=e.key),u}function BN({getKey:e,storageKey:n}={}){let{router:r}=ud("useScrollRestoration"),{restoreScrollPosition:s,preventScrollReset:u}=r0("useScrollRestoration"),{basename:c}=v.useContext(Tn),f=In(),h=Wb(),p=gr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),HN(v.useCallback(()=>{if(p.state==="idle"){let g=um(f,h,c,e);wu[g]=window.scrollY}try{sessionStorage.setItem(n||cm,JSON.stringify(wu))}catch(g){da(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${g}).`)}window.history.scrollRestoration="auto"},[p.state,e,c,f,h,n])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let g=sessionStorage.getItem(n||cm);g&&(wu=JSON.parse(g))}catch{}},[n]),v.useLayoutEffect(()=>{let g=r==null?void 0:r.enableScrollRestoration(wu,()=>window.scrollY,e?(y,x)=>um(y,x,c,e):void 0);return()=>g&&g()},[r,c,e]),v.useLayoutEffect(()=>{if(s!==!1){if(typeof s=="number"){window.scrollTo(0,s);return}try{if(f.hash){let g=document.getElementById(decodeURIComponent(f.hash.slice(1)));if(g){g.scrollIntoView();return}}}catch{da(!1,`"${f.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}u!==!0&&window.scrollTo(0,0)}},[f,s,u]))}function HN(e,n){let{capture:r}={};v.useEffect(()=>{let s=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,s),()=>{window.removeEventListener("pagehide",e,s)}},[e,r])}function IN(e,{relative:n}={}){let r=v.useContext(km);nt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=ud("useViewTransitionState"),u=Zo(e,{relative:n});if(!r.isTransitioning)return!1;let c=Hn(r.currentLocation.pathname,s)||r.currentLocation.pathname,f=Hn(r.nextLocation.pathname,s)||r.nextLocation.pathname;return qu(u.pathname,f)!=null||qu(u.pathname,c)!=null}var ll=vb();function qN(e){return v.createElement(aN,{flushSync:ll.flushSync,...e})}/**
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 l0=(...e)=>e.filter((n,r,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===r).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 PN=e=>e.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 FN=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,s)=>s?s.toUpperCase():r.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 Ny=e=>{const n=FN(e);return n.charAt(0).toUpperCase()+n.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 Uh={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 VN=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1},YN=v.createContext({}),GN=()=>v.useContext(YN),XN=v.forwardRef(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:s,className:u="",children:c,iconNode:f,...h},p)=>{const{size:g=24,strokeWidth:y=2,absoluteStrokeWidth:x=!1,color:E="currentColor",className:S=""}=GN()??{},w=s??x?Number(r??y)*24/Number(n??g):r??y;return v.createElement("svg",{ref:p,...Uh,width:n??g??Uh.width,height:n??g??Uh.height,stroke:e??E,strokeWidth:w,className:l0("lucide",S,u),...!c&&!VN(h)&&{"aria-hidden":"true"},...h},[...f.map(([j,R])=>v.createElement(j,R)),...Array.isArray(c)?c:[c]])});/**
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 ut=(e,n)=>{const r=v.forwardRef(({className:s,...u},c)=>v.createElement(XN,{ref:c,iconNode:n,className:l0(`lucide-${PN(Ny(e))}`,`lucide-${e}`,s),...u}));return r.displayName=Ny(e),r};/**
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 QN=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],KN=ut("activity",QN);/**
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 ZN=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],WN=ut("arrow-down-right",ZN);/**
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 JN=[["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"}]],ej=ut("arrow-down-wide-narrow",JN);/**
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 tj=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],dd=ut("arrow-left",tj);/**
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 aj=[["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"}]],nj=ut("arrow-up-narrow-wide",aj);/**
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 rj=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],lj=ut("arrow-up-right",rj);/**
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 sj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],s0=ut("ban",sj);/**
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 ij=[["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"}]],oj=ut("chart-column",ij);/**
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 cj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],uj=ut("check",cj);/**
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 dj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],js=ut("chevron-down",dj);/**
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 fj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],i0=ut("chevron-right",fj);/**
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 hj=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],mj=ut("circle-check-big",hj);/**
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 pj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_m=ut("circle-check",pj);/**
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 gj=[["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"}]],vj=ut("circle-dashed",gj);/**
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 xj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],yj=ut("circle-minus",xj);/**
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 bj=[["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"}]],Lm=ut("circle-pause",bj);/**
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 wj=[["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"}]],o0=ut("circle-play",wj);/**
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 Sj=[["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"}]],Ej=ut("circle-x",Sj);/**
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 Nj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fd=ut("circle",Nj);/**
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 jj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Rj=ut("clock",jj);/**
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 kj=[["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"}]],Tj=ut("copy",kj);/**
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 Cj=[["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"}]],Aj=ut("download",Cj);/**
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 Dj=[["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"}]],Oj=ut("git-branch",Dj);/**
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 Mj=[["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"}]],_j=ut("grip-vertical",Mj);/**
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 Lj=[["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"}]],Fu=ut("layers",Lj);/**
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 zj=[["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"}]],Jo=ut("list-todo",zj);/**
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 Uj=[["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"}]],$j=ut("locate-fixed",Uj);/**
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 Bj=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Hj=ut("menu",Bj);/**
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 Ij=[["path",{d:"M5 12h14",key:"1ays0h"}]],qj=ut("minus",Ij);/**
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 Pj=[["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"}]],Fj=ut("moon",Pj);/**
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 Vj=[["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"}]],c0=ut("octagon-alert",Vj);/**
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 Yj=[["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"}]],Ss=ut("pencil",Yj);/**
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 Gj=[["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"}]],Xj=ut("play",Gj);/**
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 Qj=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],u0=ut("rotate-ccw",Qj);/**
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 Kj=[["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"}]],d0=ut("scroll-text",Kj);/**
272
- * @license lucide-react v1.21.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const Zj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Wj=ut("search",Zj);/**
277
- * @license lucide-react v1.21.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const Jj=[["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"}]],eR=ut("sun",Jj);/**
282
- * @license lucide-react v1.21.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */const tR=[["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"}]],aR=ut("timer-reset",tR);/**
287
- * @license lucide-react v1.21.0 - ISC
288
- *
289
- * This source code is licensed under the ISC license.
290
- * See the LICENSE file in the root directory of this source tree.
291
- */const nR=[["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"}]],yi=ut("trash-2",nR);/**
292
- * @license lucide-react v1.21.0 - ISC
293
- *
294
- * This source code is licensed under the ISC license.
295
- * See the LICENSE file in the root directory of this source tree.
296
- */const rR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],f0=ut("x",rR),lR="/api",sR=120,iR=40;function ec(e){return{...e,number:e.number??0,decisions:e.decisions??[],acceptedDecisions:e.acceptedDecisions??[],checklist:e.checklist??[],subtasks:e.subtasks??[],pauseSnapshot:e.pauseSnapshot??null,pauseHistory:e.pauseHistory??[],startedAt:e.startedAt??"",completedAt:e.completedAt??"",descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function hd(e){return{...e,discussedAt:e.discussedAt??"",contextReady:e.contextReady??!1,contextReadyReason:e.contextReadyReason??"",notes:e.notes??"",goals:e.goals??[],nonGoals:e.nonGoals??[],dependencies:e.dependencies??[],risks:e.risks??[],openQuestions:e.openQuestions??[],decisions:e.decisions??[],acceptedDecisions:e.acceptedDecisions??[],completionCriteria:e.completionCriteria??[],taskIds:e.taskIds??[],tasks:(e.tasks??[]).map(ec),linkedRequirements:e.linkedRequirements??[],handoff:e.handoff??"",handoffUpdatedAt:e.handoffUpdatedAt??"",descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function md(e){return{...e,number:e.number??0,discussedAt:e.discussedAt??"",contextReady:e.contextReady??!1,contextReadyReason:e.contextReadyReason??"",acceptedDecisions:e.acceptedDecisions??[],phaseIds:e.phaseIds??[],descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function h0(e){var n,r,s;return{...e,scope:e.scope??[],outOfScope:e.outOfScope??[],decisions:e.decisions??[],globalRules:e.globalRules??[],technologies:e.technologies??[],tools:e.tools??[],acceptedDecisions:e.acceptedDecisions??[],workDeviations:e.workDeviations??[],planRoot:e.planRoot??"",projectRoot:e.projectRoot??"",workflowRules:{beforePhaseStart:((n=e.workflowRules)==null?void 0:n.beforePhaseStart)??[],beforeTaskStart:((r=e.workflowRules)==null?void 0:r.beforeTaskStart)??[],afterPhaseComplete:((s=e.workflowRules)==null?void 0:s.afterPhaseComplete)??[]}}}function zm(e){return{...e,description:e.description??"",macroTasks:e.macroTasks??[],linkedPhaseIds:e.linkedPhaseIds??[]}}async function jy(e,n){const r={"Content-Type":"application/json","X-Planner-Source":"web-ui",...n==null?void 0:n.headers};try{return await fetch(`${lR}${e}`,{...n,headers:r})}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 Ut(e,n){let r=await jy(e,n),s=0;for(;r.status===503&&s<iR;)await new Promise(u=>setTimeout(u,sR)),s+=1,r=await jy(e,n);if(!r.ok){const u=await r.text().catch(()=>r.statusText);throw new Response(u||r.statusText,{status:r.status,statusText:r.statusText})}return r.json()}async function Um(){return h0(await Ut("/project"))}async function oR(e){return h0(await Ut("/project",{method:"PUT",body:JSON.stringify({...e,workDeviations:[]})}))}async function cR(){return Ut("/ui-config")}async function m0(){return(await Ut("/features")).map(md)}async function tc(e){return md(await Ut(`/features/${e}`))}async function uR(e){return md(await Ut("/features",{method:"POST",body:JSON.stringify(e)}))}async function p0(e){return md(await Ut(`/features/${e.id}`,{method:"PUT",body:JSON.stringify(e)}))}async function dR(e){return Ut(`/features/${e}`,{method:"DELETE"})}async function $m(){return(await Ut("/requirements")).requirements.map(zm)}async function fR(e){const n=new Date().toISOString();return zm(await Ut("/requirements",{method:"POST",body:JSON.stringify({...e,macroTasks:[],createdAt:n,updatedAt:n})}))}async function hR(e){return zm(await Ut(`/requirements/${e.id}`,{method:"PUT",body:JSON.stringify({...e,updatedAt:new Date().toISOString()})}))}async function mR(e){return Ut(`/requirements/${e}`,{method:"DELETE"})}async function pd(e){const n=e?`?featureId=${encodeURIComponent(e)}`:"";return(await Ut(`/phases${n}`)).map(hd)}async function gd(e){return hd(await Ut(`/phases/${e}`))}async function pR(e){return hd(await Ut("/phases",{method:"POST",body:JSON.stringify(e)}))}async function g0(e){return hd(await Ut(`/phases/${e.id}`,{method:"PUT",body:JSON.stringify(e)}))}async function gR(e){return Ut(`/phases/${e}`,{method:"DELETE"})}async function vR(e,n){return ec(await Ut(`/phases/${e}/tasks`,{method:"POST",body:JSON.stringify(n)}))}async function vd(e){return ec(await Ut(`/tasks/${e}`))}async function Bm(e){return ec(await Ut(`/tasks/${e.id}`,{method:"PUT",body:JSON.stringify(e)}))}async function xR(e){return ec(await Ut(`/tasks/${e}/start`,{method:"POST"}))}async function yR(e){return Ut(`/tasks/${e}`,{method:"DELETE"})}async function bR(){return Ut("/tasks/active")}async function wR(){const e=await Ut("/tasks/focus");return{active:e.active??[],pendingResume:e.pendingResume??[]}}async function dm(){return(await Ut("/handoffs")).handoffs??[]}async function SR(){return(await Ut("/handoffs/archive")).archived??[]}async function v0(e){return Ut(`/phases/${e}/handoff`,{method:"DELETE"})}async function ER(e=!1){return Ut(`/export?full=${e?"true":"false"}`)}async function NR(){return Ut("/repair",{method:"POST"})}async function $h(e,n,r,s){return Ut("/reorder",{method:"POST",body:JSON.stringify({kind:e,movedId:n,beforeId:r,afterId:s})})}function jR(){const[e,n]=v.useState(()=>{if(typeof window>"u")return"dark";const r=window.localStorage.getItem("plan-ui-theme");return r||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});return v.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),window.localStorage.setItem("plan-ui-theme",e)},[e]),{theme:e,toggleTheme:()=>n(r=>r==="dark"?"light":"dark")}}function RR({liveStatus:e}){const n=e==="live"?{label:"Live",className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",dotClassName:"bg-emerald-500"}:e==="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"}:e==="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 o.jsxs("span",{className:`inline-flex max-w-full min-h-7 items-center gap-1.5 rounded-[10px] border px-2 py-1 text-xs font-semibold sm:min-h-8 sm:rounded-[12px] sm:px-2.5 sm:py-1.5 sm:text-sm ${n.className}`,children:[o.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${n.dotClassName}`}),o.jsx("span",{className:"truncate",children:n.label})]})}function kR({projectName:e,projectRoot:n,planRoot:r,liveStatus:s}){const{theme:u,toggleTheme:c}=jR(),[f,h]=v.useState(!1),[p,g]=v.useState(null),[y,x]=v.useState(!1),E=[{to:"/features",label:"Features",icon:Fu},{to:"/requirements",label:"Requirements",icon:Jo},{to:"/handoff",label:"Handoff",icon:d0}];async function S(w){g(w?"full":"summary");try{const R=await ER(w),z=new Blob([R.markdown],{type:"text/markdown;charset=utf-8"}),I=URL.createObjectURL(z),$=document.createElement("a");$.href=I,$.download=w?"EXPORT-full.md":R.filePath||"EXPORT.md",document.body.appendChild($),$.click(),$.remove(),URL.revokeObjectURL(I),h(!1)}catch(R){window.alert(`Export failed: ${R instanceof Error?R.message:String(R)}`)}finally{g(null)}}return o.jsx("div",{className:"relative z-20 overflow-visible border-b border-[var(--border)] bg-[var(--surface-elevated)] backdrop-blur-xl backdrop-saturate-150",children:o.jsxs("div",{className:"page-container flex items-center gap-2 py-2 sm:gap-3 sm:py-2.5",children:[o.jsxs(Ye,{to:"/",title:n??e??"Agent Plan",className:"flex min-w-0 shrink items-center gap-2 sm:gap-2.5",children:[o.jsx("div",{className:"surface-card flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-[var(--border)] text-[var(--accent)] sm:h-9 sm:w-9",children:o.jsx(Fu,{className:"h-4 w-4"})}),o.jsx("span",{className:"truncate text-sm font-black tracking-tight sm:text-base",children:e??"Agent Plan"})]}),o.jsx("nav",{className:"ml-1 hidden items-center gap-1 md:flex",children:E.map(w=>o.jsxs(om,{to:w.to,"aria-label":w.label,className:({isActive:j})=>`inline-flex min-h-7 shrink-0 items-center gap-1.5 rounded-[10px] border px-2 py-1 text-xs font-semibold transition sm:min-h-8 sm:rounded-[12px] sm:px-3 sm:py-1.5 sm:text-sm ${j?"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:[o.jsx(w.icon,{className:"h-3.5 w-3.5 shrink-0 sm:h-4 sm:w-4"}),o.jsx("span",{children:w.label})]},w.to))}),o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 sm:gap-2",children:[o.jsx(RR,{liveStatus:s}),o.jsx("button",{type:"button",onClick:c,"aria-label":u==="dark"?"Switch to light theme":"Switch to dark theme",title:u==="dark"?"Switch to light theme":"Switch to dark theme",className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text-muted)] transition hover:text-[var(--text)] sm:h-9 sm:w-9 sm:rounded-[12px]",children:u==="dark"?o.jsx(eR,{className:"h-4 w-4"}):o.jsx(Fj,{className:"h-4 w-4"})}),o.jsxs("div",{className:"relative md:hidden",children:[o.jsx("button",{type:"button","aria-label":"Open menu","aria-haspopup":"menu","aria-expanded":y,onClick:()=>x(w=>!w),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text-muted)] transition hover:text-[var(--text)]",children:y?o.jsx(f0,{className:"h-4 w-4"}):o.jsx(Hj,{className:"h-4 w-4"})}),y?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-[150]","aria-hidden":"true",onClick:()=>x(!1)}),o.jsxs("div",{role:"menu",onKeyDown:w=>{w.key==="Escape"&&x(!1)},className:"absolute right-0 top-full z-[200] mt-2 w-52 overflow-hidden rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] p-1 shadow-xl",children:[E.map(w=>o.jsxs(om,{to:w.to,"aria-label":w.label,onClick:()=>x(!1),className:({isActive:j})=>`flex items-center gap-2 rounded-[10px] px-3 py-2 text-sm font-semibold transition ${j?"bg-[var(--accent-soft)] text-[var(--accent)]":"text-[var(--text)] hover:bg-[var(--accent-soft)]"}`,children:[o.jsx(w.icon,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{children:w.label})]},w.to)),o.jsx("div",{className:"my-1 h-px bg-[var(--border)]"}),o.jsxs("button",{type:"button",role:"menuitem",disabled:p!==null,onClick:()=>{x(!1),S(!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:["Export summary",p==="summary"?o.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]}),o.jsxs("button",{type:"button",role:"menuitem",disabled:p!==null,onClick:()=>{x(!1),S(!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:["Export full",p==="full"?o.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]})]})]}):null]}),o.jsxs("div",{className:"relative z-30 hidden md:block",children:[o.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":f,"aria-label":"Export",onClick:()=>h(w=>!w),className:"inline-flex min-h-7 items-center gap-1.5 rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] px-2 py-1 text-xs font-semibold text-[var(--text-muted)] transition hover:text-[var(--text)] sm:min-h-8 sm:rounded-[12px] sm:px-3 sm:py-1.5 sm:text-sm",children:[o.jsx(Aj,{className:"h-3.5 w-3.5 shrink-0 sm:h-4 sm:w-4"}),o.jsx("span",{children:"Export"}),o.jsx(js,{className:`h-3.5 w-3.5 shrink-0 transition-transform sm:h-4 sm:w-4 ${f?"rotate-180":""}`})]}),f?o.jsxs("div",{role:"menu",onKeyDown:w=>{var I;const j=Array.from(w.currentTarget.querySelectorAll("[role=menuitem]")).filter($=>!$.hasAttribute("disabled"));if(j.length===0)return;const R=j.indexOf(document.activeElement);let z=R;if(w.key==="ArrowDown")z=R===-1?0:(R+1)%j.length;else if(w.key==="ArrowUp")z=R===-1?j.length-1:(R-1+j.length)%j.length;else if(w.key==="Home")z=0;else if(w.key==="End")z=j.length-1;else return;w.preventDefault(),(I=j[z])==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:[o.jsxs("button",{type:"button",role:"menuitem",disabled:p!==null,onClick:()=>void S(!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",p==="summary"?o.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]}),o.jsxs("button",{type:"button",role:"menuitem",disabled:p!==null,onClick:()=>void S(!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",p==="full"?o.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]})]}):null]})]})]})})}function Ry(e,n,r){e.split(`
297
- `).forEach((u,c)=>{c>0&&n.push(o.jsx("br",{},`${r}-br-${c}`)),u&&n.push(u)})}function So(e,n){const r=[],s=/(\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*)/g;let u=0,c=null,f=0;for(;(c=s.exec(e))!==null;)c.index>u&&Ry(e.slice(u,c.index),r,`${n}-${f}`),c[2]&&c[3]?r.push(o.jsx("a",{href:c[3],target:"_blank",rel:"noreferrer",className:"font-semibold text-[var(--accent)] underline-offset-4 hover:underline",children:c[2]},`${n}-link-${f}`)):c[4]?r.push(o.jsx("strong",{className:"font-semibold text-[var(--text)]",children:c[4]},`${n}-strong-${f}`)):c[5]?r.push(o.jsx("code",{className:"rounded-md border border-[var(--border)] px-1.5 py-0.5 font-mono text-[0.95em] text-[var(--text)]",children:c[5]},`${n}-code-${f}`)):c[6]&&r.push(o.jsx("em",{className:"italic",children:c[6]},`${n}-em-${f}`)),u=s.lastIndex,f+=1;return u<e.length&&Ry(e.slice(u),r,`${n}-tail`),r}function TR(e,n){var u;const r=e.split(`
298
- `);if(e.startsWith("```")){const c=e.replace(/^```[a-zA-Z]*\n?/,"").replace(/```\s*$/,"");return o.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:o.jsx("code",{children:c})},`code-${n}`)}const s=e.match(/^(#{1,6})\s+(.+)$/);if(s&&s[2]){const c=((u=s[1])==null?void 0:u.length)??1,f=s[2],h=c<=2?"text-base font-bold text-[var(--text)]":"text-sm font-bold text-[var(--text)]";return o.jsx("p",{className:h,children:So(f,`h-${n}`)},`h-${n}`)}return r.every(c=>/^\s*>\s?/.test(c))?o.jsx("blockquote",{className:"border-l-2 border-[var(--accent)] pl-4 text-sm italic text-[var(--text-muted)]",children:r.map((c,f)=>o.jsx("div",{children:So(c.replace(/^\s*>\s?/,""),`bq-${n}-${f}`)},`bq-${n}-${f}`))},`bq-${n}`):/^\s*([-*_])\1{2,}\s*$/.test(e.trim())?o.jsx("hr",{className:"border-[var(--border)]"},`hr-${n}`):r.every(c=>/^\s*[-*]\s+/.test(c))?o.jsx("ul",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:r.map((c,f)=>o.jsx("li",{className:"list-disc",children:So(c.replace(/^\s*[-*]\s+/,""),`ul-${n}-${f}`)},`ul-${n}-${f}`))},`ul-${n}`):r.every(c=>/^\s*\d+\.\s+/.test(c))?o.jsx("ol",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)] list-decimal",children:r.map((c,f)=>o.jsx("li",{children:So(c.replace(/^\s*\d+\.\s+/,""),`ol-${n}-${f}`)},`ol-${n}-${f}`))},`ol-${n}`):o.jsx("p",{className:"text-sm leading-6 text-[var(--text-muted)] whitespace-pre-wrap",children:So(e,`p-${n}`)},`p-${n}`)}function ba({text:e,className:n=""}){if(!(e!=null&&e.trim()))return null;const r=e.trim().split(/\n\s*\n/).filter(Boolean);return o.jsx("div",{className:`formatted-text grid grid-cols-1 gap-3 ${n}`,children:r.map((s,u)=>TR(s,u))})}function sl(e){return String(e&&e>0?e:0).padStart(3,"0")}function cl({featureNum:e,phaseNum:n,taskNum:r}){const s=[];return e!==void 0&&s.push(`F${sl(e)}`),n!==void 0&&s.push(`P${sl(n)}`),r!==void 0&&s.push(`T${sl(r)}`),s.join("/")}async function CR(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="-1000px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();const r=document.execCommand("copy");return n.remove(),r}catch{return!1}}function x0({type:e,phaseNum:n,featureNum:r}){return e==="feature"?null:e==="phase"?r===void 0?null:o.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:o.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["F",sl(r)]})}):e==="task"?n===void 0?null:o.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:[o.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["P",sl(n)]}),r!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"w-[1px] bg-[var(--border)]"}),o.jsxs("span",{className:"px-2 py-1 text-[var(--text-subtle)]",children:["F",sl(r)]})]})]}):null}function rr({featureNum:e,phaseNum:n,taskNum:r,featureId:s,phaseId:u,taskId:c,featureName:f,phaseName:h,taskTitle:p}){const g=f?{title:f}:{},y=h?{title:h}:{},x=p?{title:p}:{},E=s?({children:j})=>o.jsx(Ye,{to:`/features/${s}`,...g,className:"entity-path-seg entity-path-seg--feature entity-path-seg--link",children:j}):({children:j})=>o.jsx("span",{className:"entity-path-seg entity-path-seg--feature",...g,children:j}),S=u?({children:j})=>o.jsx(Ye,{to:`/features/${s}/phases/${u}`,...y,className:"entity-path-seg entity-path-seg--phase entity-path-seg--link",children:j}):({children:j})=>o.jsx("span",{className:"entity-path-seg entity-path-seg--phase",...y,children:j}),w=c?({children:j})=>o.jsx(Ye,{to:`/features/${s}/phases/${u}/tasks/${c}`,...x,className:"entity-path-seg entity-path-seg--task entity-path-seg--link",children:j}):({children:j})=>o.jsx("span",{className:"entity-path-seg entity-path-seg--task",...x,children:j});return o.jsxs("span",{className:"entity-path-badge",children:[e!==void 0?o.jsxs(E,{children:["F",sl(e)]}):null,n!==void 0?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),o.jsxs(S,{children:["P",sl(n)]})]}):null,r!==void 0?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),o.jsxs(w,{children:["T",sl(r)]})]}):null]})}function sr({id:e,children:n}){const[r,s]=v.useState(!1);return o.jsxs("button",{type:"button",onClick:async u=>{u.preventDefault(),u.stopPropagation(),await CR(e)&&(s(!0),window.setTimeout(()=>s(!1),1200))},title:r?"Copied":`Copy ${e}`,"aria-label":r?"Copied":`Copy ${e}`,className:"copyable-id group inline-flex items-center gap-1.5",children:[n,o.jsx("span",{className:"copyable-id__icon","aria-hidden":"true",children:r?o.jsx(uj,{className:"h-3 w-3 text-emerald-500"}):o.jsx(Tj,{className:"h-3 w-3"})})]})}function ul({shortId:e}){return o.jsx(sr,{id:e,children:o.jsx("span",{className:"short-id-badge",children:e})})}function y0({featureNum:e,phaseNum:n,taskNum:r,featureId:s,phaseId:u,taskId:c,shortId:f,featureName:h,phaseName:p,taskTitle:g}){return o.jsxs(o.Fragment,{children:[o.jsx(rr,{featureNum:e,phaseNum:n,taskNum:r,featureId:s,phaseId:u,taskId:c,featureName:h,phaseName:p,taskTitle:g}),o.jsx(sr,{id:cl({featureNum:e,phaseNum:n,taskNum:r}),children:o.jsx("span",{className:"sr-only",children:"Copy path"})}),f?o.jsx(ul,{shortId:f}):null]})}function Hm({phaseId:e,updatedAt:n}){const r=`Phase handoff pending${n?` · updated ${new Date(n).toLocaleString()}`:""}`;return o.jsxs("a",{href:`/handoff#${e}`,className:"handoff-badge flex items-center gap-1 ml-2 shrink-0",title:r,"aria-label":r,children:[o.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:[o.jsx("path",{d:"M4 2h5l3 3v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"}),o.jsx("path",{d:"M9 2v3h3"}),o.jsx("path",{d:"M5.5 8h5M5.5 10.5h5"})]}),o.jsx("span",{className:"handoff-badge__label",children:"handoff"})]})}const fm={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 Vl(e){return fm[e]??fm.planned}function Vu(e,n,r){switch(n){case"bg":return`color-mix(in srgb, var(${e.colorVar}) ${e.bgOpacity}%, transparent)`;case"border":return`color-mix(in srgb, var(${e.colorVar}) ${e.borderOpacity}%, transparent)`}}function AR(e){const n=Vl(e);return{backgroundColor:Vu(n,"bg"),borderStyle:n.borderStyle,borderColor:Vu(n,"border"),borderWidth:"1px"}}function DR(e){const n=Vl(e);return{backgroundColor:Vu(n,"bg"),borderStyle:n.borderStyle,borderColor:Vu(n,"border"),borderWidth:"1px"}}function Im(e){const{pattern:n}=Vl(e);return n?n==="dashed"?`status-pattern-dashed status-pattern-dashed-${e}`:`status-pattern-${n}`:""}function b0(e){return`status-${e}`}function w0(e,n=30){return`color-mix(in srgb, var(${Vl(e).colorVar}) ${n}%, transparent)`}function S0(e){return e in fm?e:"planned"}function OR(e,n){const s=[Vl(e).label],u=[["done",n.done],["in-progress",n.inProgress],["planned",n.planned],["waiting",n.waiting],["blocked",n.blocked],["deferred",n.deferred],["canceled",n.canceled],["rejected",n.rejected]];for(const[c,f]of u)f>0&&s.push(`${f} ${c}`);return s.join(" · ")}const E0={circle:fd,"play-start":Xj,play:o0,clock:Rj,stop:c0,pause:Lm,check:_m,"check-mixed":mj,ban:s0,x:Ej};function MR({status:e,className:n=""}){const r=Vl(e),s=E0[r.icon]??fd;return o.jsx(s,{className:`h-4 w-4 shrink-0 ${n}`.trim(),"aria-hidden":"true"})}function ar({status:e}){const n=S0(e),r=Vl(n);return o.jsxs("span",{className:`status-chip ${b0(n)} ${Im(n)}`,title:r.description,"aria-label":r.description,children:[o.jsx(MR,{status:n,className:"h-3.5 w-3.5"}),o.jsx("span",{children:r.label})]})}function ac({status:e,breakdown:n,size:r="md",children:s}){const u=Vl(e),c=E0[u.icon]??fd,f=Im(e),h=n?OR(e,n):u.description,p=r==="sm"?"px-2 py-0.5 text-[10px]":"px-2.5 py-1 text-[11px]";return o.jsxs("span",{className:`status-chip ${b0(e)} ${f} ${p}`,title:h,"aria-label":h,children:[o.jsx(c,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:u.label}),s]})}function Yu({status:e,breakdown:n,doneTasks:r,totalTasks:s,recentlyChanged:u,className:c}){const f=r!=null&&s!=null;return o.jsxs("div",{className:c,children:[u?o.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?o.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",r,"/",s||0,")"]}):null,o.jsx(ac,{status:e,breakdown:n})]})}function N0({task:e}){const n=Or(),r=e.featureId?`/features/${e.featureId}/phases/${e.phaseId}/tasks/${e.id}`:"/features";return o.jsx("article",{className:`min-w-0 rounded-[12px] border bg-[var(--surface-card)] px-3 py-2 text-sm text-[var(--text)] ${e.pendingResume?"border-[var(--accent)]":"border-[var(--border)]"}`,children:o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[o.jsx(rr,{featureNum:e.featureNumber,phaseNum:e.phaseNumber,taskNum:e.number,featureId:e.featureId,phaseId:e.phaseId,taskId:e.id}),o.jsx(sr,{id:cl({featureNum:e.featureNumber,phaseNum:e.phaseNumber,taskNum:e.number}),children:o.jsx("span",{className:"sr-only",children:"Copy task path"})}),e.shortId?o.jsx(ul,{shortId:e.shortId}):null,o.jsx("span",{className:"shrink-0",children:o.jsx(ar,{status:e.status})}),o.jsx(Ye,{to:r,className:"min-w-0 flex-1 truncate font-medium hover:text-[var(--accent)]",children:e.title})]}),o.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),n(`/?locate=T${e.number}`)},"aria-label":`Locate T${e.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-white",children:o.jsx($j,{className:"h-4 w-4"})})]})})}function _R({taskFocus:e}){const n=v.useMemo(()=>{const r=s=>{const u=new Set;return s.filter(c=>u.has(c.id)?!1:(u.add(c.id),!0))};return{active:r(e.active),pendingResume:r(e.pendingResume)}},[e.active,e.pendingResume]);return n.active.length===0?null:o.jsx("div",{className:"relative z-10 border-t border-[var(--border)] bg-[var(--surface-elevated)]/95 backdrop-blur-xl",children:o.jsx("div",{className:"page-container grid gap-3 py-2.5",children:n.active.length>0?o.jsxs("section",{"aria-labelledby":"active-task-heading",className:"grid gap-1.5",children:[o.jsxs("h2",{id:"active-task-heading",className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Active tasks (",n.active.length,")"]}),n.active.map(r=>o.jsx(N0,{task:r},r.id))]}):null})})}function LR({project:e,taskFocus:n,serverInfo:r}){const s=gr(),[u,c]=v.useState("connecting");return v.useEffect(()=>{const f=h=>{var g;const p=(g=h.detail)==null?void 0:g.status;p&&c(p)};return window.addEventListener("agent-plan:ws-status",f),()=>window.removeEventListener("agent-plan:ws-status",f)},[]),o.jsxs("div",{className:"page-shell",children:[o.jsxs("header",{className:"sticky top-0 z-30 overflow-visible",children:[o.jsx(kR,{projectName:e==null?void 0:e.name,projectRoot:e==null?void 0:e.projectRoot,planRoot:e==null?void 0:e.planRoot,liveStatus:u}),o.jsx(_R,{taskFocus:n})]}),o.jsxs("div",{className:"page-container py-8",children:[o.jsxs("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-end md:justify-between md:gap-6",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Current project"}),o.jsx("h1",{className:"text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:o.jsx(Ye,{to:"/",className:"hover:text-[var(--accent)]",children:(e==null?void 0:e.name)??"Agent Plan"})}),e!=null&&e.projectRoot?o.jsx("p",{className:"mt-2 truncate font-mono text-xs text-[var(--text-subtle)]",title:e.projectRoot,children:e.projectRoot}):null,r?o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",children:[o.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 font-semibold uppercase tracking-[0.12em] ${r.mode==="lan"?"bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] text-[var(--accent)]":"bg-[var(--surface-elevated)] text-[var(--text-muted)]"}`,children:[o.jsx("span",{"aria-hidden":"true",className:"inline-block h-1.5 w-1.5 rounded-full bg-current"}),r.mode==="lan"?"LAN visible":"Local only"]}),o.jsx("a",{href:r.localUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:r.localUrl}),r.lanUrl?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[var(--text-subtle)]",children:"·"}),o.jsx("a",{href:r.lanUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:r.lanUrl})]}):null]}):null,e!=null&&e.description?o.jsx(ba,{text:e.description,className:"mt-2 max-w-3xl"}):null]}),s.state!=="idle"?o.jsx("div",{className:"text-sm font-semibold text-[var(--accent)]",children:"Updating…"}):null]}),o.jsx(Ei,{})]})]})}const Rn=32,j0=4,zR=Math.PI*1.2;function R0(){if(typeof document>"u")return"#7b68ee";const e=document.createElement("div");e.style.color="var(--accent, #7b68ee)",document.body.appendChild(e);const n=getComputedStyle(e).color||"#7b68ee";return e.remove(),n}function UR(){const e=document.createElement("canvas");e.width=Rn,e.height=Rn;const n=e.getContext("2d");if(!n)return"";const r=R0();return n.beginPath(),n.arc(Rn/2,Rn/2,Rn/2-j0,0,Math.PI*2),n.fillStyle=r,n.fill(),n.fillStyle="#ffffff",n.font="bold 16px system-ui, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("A",Rn/2,Rn/2+1),e.toDataURL("image/png")}function $R(e,n){const r=e.getContext("2d");if(!r)return"";const s=R0();r.clearRect(0,0,Rn,Rn);const u=Rn/2,c=Rn/2,f=Rn/2-j0;return r.beginPath(),r.arc(u,c,f,0,Math.PI*2),r.fillStyle=s,r.globalAlpha=.85,r.fill(),r.globalAlpha=1,r.beginPath(),r.arc(u,c,f-3,n,n+zR),r.strokeStyle="#ffffff",r.lineWidth=3,r.lineCap="round",r.stroke(),r.fillStyle="#ffffff",r.font="bold 14px system-ui, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("A",u,c+1),e.toDataURL("image/png")}function BR(){let e=document.querySelector("link[rel~='icon']");return e||(e=document.createElement("link"),e.rel="icon",e.type="image/png",document.head.appendChild(e)),e}function HR(e){const n=v.useRef(null),r=v.useRef(null),s=v.useRef(null),u=v.useRef(0);v.useEffect(()=>{if(n.current||(n.current=BR()),s.current||(s.current=UR()),!r.current){const h=document.createElement("canvas");h.width=Rn,h.height=Rn,r.current=h}const c=n.current;if(!e){c.href=s.current;return}const f=window.setInterval(()=>{document.hidden||(u.current+=Math.PI/10,c.href=$R(r.current,u.current))},100);return()=>{window.clearInterval(f),c.href=s.current}},[e])}const Ao={create:{key:"n",primary:!0},edit:{key:"e",primary:!0},delete:{key:"d",primary:!0},submit:{key:"Enter",primary:!0}},k0=v.createContext(Ao);function T0(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)}function IR(e){return typeof e!="string"}function qR(e){return{create:(e==null?void 0:e.create)??Ao.create,edit:(e==null?void 0:e.edit)??Ao.edit,delete:(e==null?void 0:e.delete)??Ao.delete,submit:(e==null?void 0:e.submit)??Ao.submit}}function PR(e){const n=[],r=T0();e.primary&&n.push(r?"⌘":"Ctrl"),e.meta&&n.push(r?"⌘":"Meta"),e.ctrl&&n.push(r?"⌃":"Ctrl"),e.shift&&n.push(r?"⇧":"Shift"),e.alt&&n.push(r?"⌥":"Alt");const s=e.key==="Backspace"?r?"⌫":"Backspace":e.key==="Enter"?r?"↩":"Enter":e.key.length===1?e.key.toUpperCase():e.key;return n.push(s),r?n.join(""):n.join("+")}function FR(e){return e instanceof HTMLElement?!!e.closest("input, textarea, select, [contenteditable='true']"):!1}function VR(e,n){const r=n.key.length===1?n.key.toLowerCase():n.key,s=e.key.length===1?e.key.toLowerCase():e.key,u=T0(),c=n.meta??(n.primary?u:!1),f=n.ctrl??(n.primary?!u:!1);return s===r&&!!c===e.metaKey&&!!f===e.ctrlKey&&!!n.shift===e.shiftKey&&!!n.alt===e.altKey}function YR({shortcuts:e,children:n}){return v.createElement(k0.Provider,{value:qR(e)},n)}function C0(e){const n=v.useContext(k0);if(e)return IR(e)?e:n[e]}function Ca(e,n,r){const s=C0(e);v.useEffect(()=>{if(!s||(r==null?void 0:r.enabled)===!1)return;const u=c=>{!(r!=null&&r.allowInEditable)&&FR(c.target)||VR(c,s)&&(c.preventDefault(),n())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n,r==null?void 0:r.allowInEditable,r==null?void 0:r.enabled,s])}const GR=1500,XR=80,QR=12e3,KR=5e3;function ZR(){const{revalidate:e}=XE(),n=v.useRef(null),r=v.useRef(null),s=v.useRef(null),u=v.useRef(null),c=v.useRef(null);return v.useEffect(()=>{let f=!0;const h=Q=>{window.dispatchEvent(new CustomEvent("agent-plan:ws-status",{detail:{status:Q}}))},p=()=>{r.current!==null&&(window.clearTimeout(r.current),r.current=null)},g=()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},y=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},x=()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},E=()=>{g(),s.current=window.setTimeout(()=>{e()},XR)},S=()=>{!f||r.current!==null||(h("reconnecting"),r.current=window.setTimeout(()=>{r.current=null,R()},GR))},w=()=>{x(),y();const Q=n.current;if(n.current=null,Q&&(Q.readyState===WebSocket.OPEN||Q.readyState===WebSocket.CONNECTING))try{Q.close()}catch{}},j=()=>{x(),y(),u.current=window.setInterval(()=>{const Q=n.current;if(!(!Q||Q.readyState!==WebSocket.OPEN)){try{Q.send(JSON.stringify({type:"ping"}))}catch{w(),S();return}y(),c.current=window.setTimeout(()=>{w(),S()},KR)}},QR)},R=()=>{if(!f)return;const Q=n.current;if(Q&&(Q.readyState===WebSocket.OPEN||Q.readyState===WebSocket.CONNECTING))return;h(r.current!==null?"reconnecting":"connecting"),p();const J=window.location.protocol==="https:"?"wss":"ws",ne=new WebSocket(`${J}://${window.location.host}/ws`);n.current=ne,ne.onopen=()=>{p(),h("live"),j()},ne.onmessage=M=>{y();try{const T=JSON.parse(M.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":E();break;default:break}}catch{}},ne.onclose=()=>{x(),y(),n.current===ne&&(n.current=null),f&&S()},ne.onerror=()=>{try{ne.close()}catch{}}},z=()=>{const Q=n.current;(!Q||Q.readyState===WebSocket.CLOSED||Q.readyState===WebSocket.CLOSING)&&R()},I=()=>{document.visibilityState==="visible"&&z()},$=()=>{z()};return h("connecting"),R(),window.addEventListener("online",$),document.addEventListener("visibilitychange",I),()=>{f=!1,h("disconnected"),window.removeEventListener("online",$),document.removeEventListener("visibilitychange",I),p(),g(),x(),y(),w()}},[e]),null}async function WR(){const[e,n,r]=await Promise.all([Um(),cR(),wR()]);return{project:e,uiConfig:n,taskFocus:r}}function JR(){const{project:e,uiConfig:n,taskFocus:r}=ol();return v.useEffect(()=>{var f,h;const s=(f=e==null?void 0:e.name)==null?void 0:f.trim(),u=(h=e==null?void 0:e.projectRoot)==null?void 0:h.trim(),c=u?u.split(/[/\\]/).filter(Boolean).pop():void 0;s?c&&c!==s?document.title=`${s} · ${c}`:document.title=`${s} · Agent Plan`:document.title="Agent Plan"},[e==null?void 0:e.name,e==null?void 0:e.projectRoot]),HR(r.active.length>0),o.jsxs(YR,{shortcuts:n.shortcuts,children:[o.jsx(ZR,{}),o.jsx(a0,{getKey:s=>s.pathname}),o.jsx(LR,{project:e,taskFocus:r,serverInfo:n.server})]})}function e2(){const e=Jb(),n=xi(e),r=n&&e.status===503,s=n?r?"Planner web UI disconnected":`Request failed (${e.status})`:"Planner web UI unavailable",u=n?e.data||e.statusText:e instanceof Error?e.message:"The planner web UI could not reach its local server.";return v.useEffect(()=>{document.title="Agent Plan"},[]),o.jsx("div",{className:"page-shell min-h-screen",children:o.jsx("div",{className:"page-container flex min-h-screen items-center justify-center py-12",children:o.jsxs("div",{className:"surface-card max-w-2xl rounded-[24px] px-8 py-8",children:[o.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Agent Plan"}),o.jsx("h1",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:s}),o.jsx("p",{className:"mt-4 text-sm text-[var(--text-muted)]",children:String(u)}),o.jsx("div",{className:"mt-6 grid gap-2 text-sm text-[var(--text-muted)]",children:r?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:"Possible cause: Pi was closed or the local planner web server stopped."}),o.jsx("p",{children:"What to do:"}),o.jsxs("ul",{className:"grid gap-1 pl-5",children:[o.jsxs("li",{className:"list-disc",children:["restart Pi or run ",o.jsx("code",{children:"planner-web start"})]}),o.jsx("li",{className:"list-disc",children:"reopen this planner UI from the new session if needed"}),o.jsx("li",{className:"list-disc",children:"then reload this page"})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{children:"The request reached the planner server, but the server rejected it."}),o.jsx("p",{children:"Fix the validation issue above, then try again."})]})}),o.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:o.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 t2(){const[e,n,r]=await Promise.all([m0(),pd(),bR()]);return{features:e,phases:n,activeTasks:r}}function a2({shortcut:e}){const n=C0(e);return n?o.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:PR(n)}):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 ht({variant:e="secondary",className:n="",children:r,shortcut:s,...u}){return o.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[e]} ${n}`,...u,children:[o.jsx("span",{className:"inline-flex items-center gap-1.5 sm:gap-2",children:r}),s?o.jsx(a2,{shortcut:s}):null]})}function Vt({className:e="",children:n,...r}){return o.jsx("div",{className:`surface-card p-6 ${e}`,...r,children:n})}function r2({decisions:e}){return e.length===0?null:o.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[o.jsxs("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:["Accepted decisions (",e.length,")"]}),o.jsx("div",{className:"mt-4 grid gap-3",children:e.map(n=>o.jsxs("div",{className:"rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3",children:[o.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:n.title}),n.decision?o.jsxs("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Decision:"})," ",o.jsx(ba,{text:n.decision})]}):null,n.rationale?o.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Rationale:"})," ",o.jsx(ba,{text:n.rationale})]}):null,n.implementationNotes?o.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Implementation:"})," ",o.jsx(ba,{text:n.implementationNotes})]}):null]},n.id))})]})}function l2({project:e}){var y,x,E;const n=e.scope??[],r=e.outOfScope??[],s=e.technologies??[],u=e.tools??[],c=e.globalRules??[],f=e.decisions??[],h=e.acceptedDecisions??[],p={beforePhaseStart:((y=e.workflowRules)==null?void 0:y.beforePhaseStart)??[],beforeTaskStart:((x=e.workflowRules)==null?void 0:x.beforeTaskStart)??[],afterPhaseComplete:((E=e.workflowRules)==null?void 0:E.afterPhaseComplete)??[]};return n.length>0||r.length>0||s.length>0||u.length>0||c.length>0||f.length>0||h.length>0||p.beforePhaseStart.length>0||p.beforeTaskStart.length>0||p.afterPhaseComplete.length>0?o.jsx(Vt,{className:"grid gap-4",children:o.jsxs("details",{className:"group",children:[o.jsx("summary",{className:"cursor-pointer select-none text-lg font-bold text-[var(--text)]",children:"AI Consolidated Context"}),o.jsxs("div",{className:"mt-4 grid gap-4",children:[n.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"In scope"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:n.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,r.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Out of scope"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:r.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,s.length>0||u.length>0?o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Technologies"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:s.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,u.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Tools"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:u.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null]}):null,c.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Global rules"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:c.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,p.beforePhaseStart.length>0||p.beforeTaskStart.length>0||p.afterPhaseComplete.length>0?o.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[o.jsx("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:"Workflow rules"}),o.jsxs("div",{className:"mt-4 grid gap-4 text-sm text-[var(--text-muted)]",children:[p.beforePhaseStart.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"Before phase start"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.beforePhaseStart.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,p.beforeTaskStart.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"Before task start"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.beforeTaskStart.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,p.afterPhaseComplete.length>0?o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold text-[var(--text)]",children:"After phase complete"}),o.jsx("ul",{className:"mt-2 grid gap-2 pl-5",children:p.afterPhaseComplete.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null]})]}):null,f.length>0?o.jsxs("details",{className:"group rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:[o.jsxs("summary",{className:"cursor-pointer select-none font-semibold text-[var(--text)]",children:["Legacy decisions (",f.length,")"]}),o.jsx("ul",{className:"mt-4 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:f.map(S=>o.jsx("li",{className:"list-disc",children:S},S))})]}):null,o.jsx(r2,{decisions:h})]})]})}):null}function s2(e){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}function i2({features:e,phases:n}){const r=v.useMemo(()=>{const s=new Map(e.map(u=>[u.id,u.name]));return n.flatMap(u=>u.tasks.filter(c=>c.status==="done").map(c=>({task:c,phase:u,feature:e.find(f=>f.id===u.featureId),featureName:u.featureId?s.get(u.featureId)??u.featureId:"Unlinked feature",completedAt:c.completedAt||c.updatedAt}))).sort((u,c)=>c.completedAt.localeCompare(u.completedAt)).slice(0,3)},[e,n]);return o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Latest completed tasks"}),o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Most recently completed tasks, ordered by completion timestamp."})]}),o.jsx("div",{className:"grid gap-3",children:r.length>0?r.map(({task:s,phase:u,feature:c,featureName:f,completedAt:h})=>o.jsxs("div",{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:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(y0,{featureNum:c==null?void 0:c.number,phaseNum:u.number,taskNum:s.number,featureId:c==null?void 0:c.id,phaseId:u.id,taskId:s.id,shortId:s.shortId,featureName:c==null?void 0:c.name,phaseName:u.title,taskTitle:s.title}),o.jsx("span",{className:"ml-auto shrink-0",children:o.jsx(ar,{status:s.status})})]}),o.jsx(Ye,{to:u.featureId?`/features/${u.featureId}/phases/${u.id}/tasks/${s.id}`:"/features",className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:s.title}),o.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[o.jsx(x0,{type:"phase",featureNum:c==null?void 0:c.number}),o.jsxs("span",{className:"min-w-0 truncate",children:[f," · ",u.title]})]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Completed ",s2(h)]})]},s.id)):o.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No completed tasks yet."})})]})}const ky=1440*60*1e3;function o2(e){const n=Date.now()-new Date(e).getTime();if(n<0)return"just now";const r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;const s=Math.floor(r/60);return s<60?`${s}m ago`:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function c2({features:e,phases:n}){const[,r]=v.useState(0),s=Date.now(),u=v.useMemo(()=>{const c=new Map(e.map(f=>[f.id,f.name]));return n.flatMap(f=>f.tasks.map(h=>({task:h,phase:f,feature:e.find(p=>p.id===f.featureId),featureName:f.featureId?c.get(f.featureId)??f.featureId:"Unlinked feature",createdAt:h.createdAt}))).filter(f=>{const h=new Date(f.createdAt).getTime();return Number.isFinite(h)&&s-h<ky&&s-h>=0&&f.task.status==="planned"&&!f.task.startedAt}).sort((f,h)=>h.createdAt.localeCompare(f.createdAt)).slice(0,10)},[e,n,s]);return v.useEffect(()=>{if(u.length===0)return;const c=u.reduce((h,p)=>{const g=new Date(p.createdAt).getTime()+ky-Date.now();return Math.min(h,g)},1/0);if(!Number.isFinite(c)||c<=0)return;const f=window.setTimeout(()=>r(h=>h+1),c+50);return()=>window.clearTimeout(f)},[u]),u.length===0?null:o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"New Added Tasks"}),o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Tasks created in the last 24 hours."})]}),o.jsx("div",{className:"grid gap-3",children:u.map(({task:c,phase:f,feature:h,featureName:p,createdAt:g})=>o.jsxs("div",{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:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(y0,{featureNum:h==null?void 0:h.number,phaseNum:f.number,taskNum:c.number,featureId:h==null?void 0:h.id,phaseId:f.id,taskId:c.id,shortId:c.shortId,featureName:h==null?void 0:h.name,phaseName:f.title,taskTitle:c.title}),o.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"}),o.jsx("span",{className:"ml-auto shrink-0",children:o.jsx(ar,{status:c.status})})]}),o.jsx(Ye,{to:f.featureId?`/features/${f.featureId}/phases/${f.id}/tasks/${c.id}`:"/features",className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:c.title}),o.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[o.jsx(x0,{type:"phase",featureNum:h==null?void 0:h.number}),o.jsxs("span",{className:"min-w-0 truncate",children:[p," · ",f.title]})]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Added ",o2(g)]})]},c.id))})]})}const u2=new Set(["in-progress"]),d2=new Set(["planned","waiting","blocked","deferred"]),f2=new Set(["done","canceled","rejected"]);function A0(e){return e==="discovery"?"in-progress":e==="draft"?"planned":e}function h2(e){const n={planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0};for(const r of e)switch(r){case"planned":n.planned++;break;case"in-progress":n.inProgress++;break;case"waiting":n.waiting++;break;case"blocked":n.blocked++;break;case"deferred":n.deferred++;break;case"done":n.done++;break;case"canceled":n.canceled++;break;case"rejected":n.rejected++;break}return n}function m2(){return{planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0}}function D0(e){const n=e,r=h2(n),s=n.length;if(s===0)return{displayStatus:"planned",breakdown:m2(),hasStarted:!1,totalChildren:0,meaningfulChildren:0};const u=n.filter(g=>g!=="canceled"&&g!=="rejected"),c=u.length,f=u.some(g=>g!=="planned");if(u.some(g=>u2.has(g)))return{displayStatus:"in-progress",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c};if(n.every(g=>f2.has(g)))return n.every(g=>g==="done")?{displayStatus:"done",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:n.every(g=>g==="canceled")?{displayStatus:"canceled",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:n.every(g=>g==="rejected")?{displayStatus:"rejected",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:{displayStatus:"closed",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c};const h=u.filter(g=>d2.has(g));return h.length>0&&h.every(g=>g==="waiting")?{displayStatus:"waiting",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="blocked")?{displayStatus:"blocked",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="deferred")?{displayStatus:"deferred",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="planned")&&!f?{displayStatus:"planned",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}:{displayStatus:"started",breakdown:r,hasStarted:f,totalChildren:s,meaningfulChildren:c}}function qm(e){const n=e.map(r=>A0(r.status));return D0(n)}function Pm(e){const n=e.map(r=>A0(r.status));return D0(n)}function O0(e){return Pm(e)}function M0(e){return qm(e)}const Do={key:"priority",direction:"asc"},p2=4200;function g2(e){return e.reduce((n,r)=>n+r.tasks.length,0)}function v2(e){return e.reduce((n,r)=>n+r.tasks.filter(s=>s.status==="done").length,0)}function x2(e){return String(e&&e>0?e:0).padStart(3,"0")}const y2={draft:0,discovery:1,planned:2,waiting:3,blocked:4,deferred:5,"in-progress":7,done:8,canceled:9,rejected:10};function Ty(e,n){if(n==="title")return"name"in e?e.name:e.title;if(n==="status")return y2[e.status]??99;if(n==="startedAt"){if("startedAt"in e){const r=e.startedAt;return r?new Date(r).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(n==="completedAt"){if("completedAt"in e){const r=e.completedAt;return r?new Date(r).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(n==="shortId")return e.shortId??"";if(n==="priority"||n==="number")return e[n]??0;if(n==="createdAt"||n==="updatedAt"){const r=e[n];return r?new Date(r).getTime():0}return 0}function Mo(e,n,r,s){const u=Ty(e,r),c=Ty(n,r);let f;return typeof u=="number"&&typeof c=="number"?f=u-c:f=String(u).localeCompare(String(c)),f===0&&(f=(e.priority??0)-(n.priority??0)||e.number-n.number||e.createdAt.localeCompare(n.createdAt)),s==="desc"?-f:f}function b2(e,n,r=Do){const s=new Map;for(const u of n){if(!u.featureId)continue;const c=s.get(u.featureId)??[];c.push(u),s.set(u.featureId,c)}return e.map(u=>{const c=s.get(u.id)??[],f=c.reduce((y,x)=>y+x.tasks.length,0),h=c.reduce((y,x)=>y+x.tasks.filter(E=>E.status==="done").length,0),p=c.map(y=>{const x=[...y.tasks].sort((S,w)=>Mo(S,w,r.key,r.direction)),E=x.some(S=>S.status==="in-progress");return{phase:y,totalTasks:y.tasks.length,doneTasks:y.tasks.filter(S=>S.status==="done").length,allTasks:x,hasActiveTask:E,display:qm(x)}}),g=p.some(({phase:y,allTasks:x})=>y.status==="in-progress"||y.status==="discovery"||x.some(E=>E.status==="in-progress"));return{feature:u,totalTasks:f,doneTasks:h,allPhases:p.sort((y,x)=>Mo(y.phase,x.phase,r.key,r.direction)),hasActiveTask:p.some(y=>y.hasActiveTask),isActive:g,display:Pm(p.map(y=>y.phase))}}).sort((u,c)=>Mo(u.feature,c.feature,r.key,r.direction))}function Su({title:e,value:n,valueSuffix:r,subtitle:s,icon:u,valueClassName:c,iconClassName:f}){return o.jsxs(Vt,{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:e}),o.jsxs("div",{className:"mt-2 flex items-end gap-2",children:[o.jsx("p",{className:`text-3xl font-black tracking-tight ${c??"text-[var(--text)]"}`,children:n}),r?o.jsx("span",{className:"pb-1 text-sm font-semibold text-[var(--text-muted)]",children:r}):null]}),o.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:s})]}),o.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:u})]})}function Cy(e){return e>=80?"text-emerald-600 dark:text-emerald-400":e>=30?"text-amber-600 dark:text-amber-400":"text-rose-600 dark:text-rose-400"}function w2({features:e,phases:n}){const r=new Map;for(const x of n)x.featureId&&r.set(x.featureId,[...r.get(x.featureId)??[],x]);const s=e.filter(x=>{const E=r.get(x.id)??[];return Pm(E).displayStatus==="done"}).length,u=Math.max(e.length-s,0),c=n.filter(x=>qm(x.tasks).displayStatus==="done").length,f=Math.max(n.length-c,0),h=g2(n),p=v2(n),g=Math.max(h-p,0),y=h>0?Math.round(p/h*100):0;return o.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[o.jsx(Su,{title:"Features",value:String(e.length),valueSuffix:"total",subtitle:o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[s," done"]}),o.jsx("span",{children:" · "}),o.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[u," left"]})]}),icon:o.jsx(Fu,{className:"h-4 w-4"})}),o.jsx(Su,{title:"Phases",value:String(n.length),valueSuffix:"total",subtitle:o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[c," done"]}),o.jsx("span",{children:" · "}),o.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[f," left"]})]}),icon:o.jsx(oj,{className:"h-4 w-4"})}),o.jsx(Su,{title:"Tasks",value:String(h),valueSuffix:"total",subtitle:o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[p," done"]}),o.jsx("span",{children:" · "}),o.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[g," left"]})]}),icon:o.jsx(Jo,{className:"h-4 w-4"})}),o.jsx(Su,{title:"Completion",value:`${y}%`,subtitle:"Task completion rate",valueClassName:Cy(y),iconClassName:Cy(y),icon:o.jsx(_m,{className:"h-4 w-4"})})]})}const S2=["done","canceled","rejected"],E2=["planned","in-progress","blocked","waiting","deferred"],N2=1440*60*1e3,j2=10;function _o(e){return S2.includes(e)}function Gu(e){return E2.includes(e)}const _0=[{label:"0-7d",minDays:0,maxDays:7},{label:"8-14d",minDays:8,maxDays:14},{label:"15-30d",minDays:15,maxDays:30},{label:"31-60d",minDays:31,maxDays:60},{label:"61+d",minDays:61,maxDays:null}];function R2(e){const n=[];for(const r of e)r.tasks&&n.push(...r.tasks);return n}function Bl(e){if(!e)return null;const n=Date.parse(e);return Number.isNaN(n)?null:new Date(n).toISOString().slice(0,j2)}function mi(e){return Date.parse(`${e}T00:00:00.000Z`)}function L0(e,n){const r=Date.parse(e.date),s=Date.parse(n.date);return r!==s&&!Number.isNaN(r)&&!Number.isNaN(s)?r-s:e.id<n.id?-1:e.id>n.id?1:0}function k2(e,n){const r=Bl(e.createdAt),s=mi(n),u=[...e.statusLog??[]].sort(L0);let c=null;for(const f of u){const h=_o(f.fromStatus);if(!_o(f.toStatus)&&h){const g=Bl(f.date);g&&mi(g)<=s&&(c=g)}}return c??r}function Eu(e,n){return n>0?e/n:0}function T2(){return{deletedTasksNotRepresented:!0,legacyHistoryFallbackUsed:!1,notes:["Deleted tasks are absent from the current persisted planner files, so they never appear in any series, count, or backlog total."]}}function C2(){return _0.map(e=>({...e,count:0,taskIds:[]}))}function Ay(e,n){const r=e.filter(c=>c.kind==="added").length,s=e.filter(c=>c.kind==="closed").length,u=e.filter(c=>c.kind==="reopened").length;return{addedTotal:r,closedTotal:s,reopenedTotal:u,netBacklog:r+u-s,activeDays:n,addRatePerActiveDay:Eu(r,n),closeRatePerActiveDay:Eu(s,n),reopenRatePerActiveDay:Eu(u,n),closureRatio:Eu(s,r)}}function z0(e){return{currentOpen:e.filter(n=>Gu(n.status)).length,currentTotal:e.length,currentDone:e.filter(n=>n.status==="done").length,currentCanceled:e.filter(n=>n.status==="canceled").length,currentRejected:e.filter(n=>n.status==="rejected").length}}function A2(e,n,r){const s={addedTotal:0,closedTotal:0,reopenedTotal:0,netBacklog:0,activeDays:0,addRatePerActiveDay:0,closeRatePerActiveDay:0,reopenRatePerActiveDay:0,closureRatio:0};return{windowDays:e,asOf:null,calendarRange:null,dailyPoints:[],cumulativePoints:[],agingBuckets:C2(),summary:{...s,...z0(n)},allTime:s,currentOpenIds:n.filter(u=>Gu(u.status)).map(u=>u.id).sort(),windowAddedIds:[],windowClosedIds:[],windowReopenedIds:[],limitations:r}}function D2(e,n={}){const r=n.windowDays??21,s=T2(),u=new Set(s.notes),c=ee=>{u.add(ee),s.legacyHistoryFallbackUsed=!0},f=[];for(const ee of e){const L=Bl(ee.createdAt);L&&f.push({day:L,kind:"added",taskId:ee.id});const F=[...ee.statusLog??[]].sort(L0);let he=null;for(const se of F){const C=_o(se.fromStatus),B=_o(se.toStatus),K=Bl(se.date);K&&(B&&!C?f.push({day:K,kind:"closed",taskId:ee.id}):!B&&C&&f.push({day:K,kind:"reopened",taskId:ee.id}),he=B)}const P=_o(ee.status);if(P&&he!==!0){const se=Bl(ee.completedAt)??Bl(ee.updatedAt)??L;se&&f.push({day:se,kind:"closed",taskId:ee.id}),c("A terminal task's history does not record a closure; a close was inferred from completedAt/updatedAt/createdAt.")}else if(!P&&he===!0){const se=Bl(ee.updatedAt)??L;se&&f.push({day:se,kind:"reopened",taskId:ee.id}),c("A task whose history ends in a terminal status is currently open; a reopen was inferred from updatedAt/createdAt.")}}if(f.length===0)return s.notes=[...u],A2(r,e,s);const h=f.map(ee=>ee.day).reduce((ee,L)=>L>ee?L:ee),p=n.asOf&&Bl(n.asOf)||h,g=mi(p),y=f.filter(ee=>mi(ee.day)<=g),x=[...new Set(y.map(ee=>ee.day))].sort(),E=new Map;for(const ee of y){const L=E.get(ee.day)??{added:0,closed:0,reopened:0,addedIds:new Set,closedIds:new Set,reopenedIds:new Set};ee.kind==="added"?(L.added+=1,L.addedIds.add(ee.taskId)):ee.kind==="closed"?(L.closed+=1,L.closedIds.add(ee.taskId)):(L.reopened+=1,L.reopenedIds.add(ee.taskId)),E.set(ee.day,L)}const S=[];let w=0,j=0,R=0;for(const ee of x){const L=E.get(ee)??{added:0,closed:0,reopened:0,addedIds:new Set,closedIds:new Set,reopenedIds:new Set};w+=L.added,j+=L.closed,R+=L.reopened;const F=j-R,he=w+R-j;S.push({date:ee,added:L.added,closed:L.closed,reopened:L.reopened,netBacklog:he,cumulativeScope:w,cumulativeCompletion:F,addedTaskIds:[...L.addedIds].sort(),closedTaskIds:[...L.closedIds].sort(),reopenedTaskIds:[...L.reopenedIds].sort()})}const z=S.slice(Math.max(0,S.length-r)),I=new Set(z.map(ee=>ee.date)),$=y.filter(ee=>I.has(ee.day)),Q=z[0],J=z[z.length-1],ne=Q&&J?{start:Q.date,end:J.date}:null,M=_0.map(ee=>({...ee,count:0,taskIds:new Set}));for(const ee of e){if(!Gu(ee.status))continue;const L=k2(ee,p);if(!L||mi(L)>g)continue;const F=Math.max(0,Math.floor((g-mi(L))/N2)),he=M.find(P=>F>=P.minDays&&(P.maxDays===null||F<=P.maxDays));he&&(he.count+=1,he.taskIds.add(ee.id))}const T=M.map(ee=>({...ee,taskIds:[...ee.taskIds].sort()})),fe={...Ay($,z.length),...z0(e)},pe=Ay(y,x.length),we=e.filter(ee=>Gu(ee.status)).map(ee=>ee.id).sort(),re=[...new Set($.filter(ee=>ee.kind==="added").map(ee=>ee.taskId))].sort(),je=[...new Set($.filter(ee=>ee.kind==="closed").map(ee=>ee.taskId))].sort(),Te=[...new Set($.filter(ee=>ee.kind==="reopened").map(ee=>ee.taskId))].sort();return r>x.length&&u.add(`Requested ${r}-active-day window exceeds the ${x.length} active days available at or before asOf; the window was clamped to all available active days.`),s.notes=[...u],{windowDays:r,asOf:p,calendarRange:ne,dailyPoints:z,cumulativePoints:S,agingBuckets:T,summary:fe,allTime:pe,currentOpenIds:we,windowAddedIds:re,windowClosedIds:je,windowReopenedIds:Te,limitations:s}}const bs=184,bi=16,Xu=16,Fm=30,pn=34;function U0(e){return 420}function $0(e,n,r){const s=r-pn-Xu;return n<=1?pn+s/2:pn+e/(n-1)*s}function qo(e,n){const r=bs-bi-Fm;return bi+r-e/Math.max(n,1)*r}function B0(e){return e<=3?new Set(Array.from({length:e},(n,r)=>r)):new Set([0,Math.floor((e-1)/2),e-1])}function H0(e){return e.slice(5)}function Po({title:e,description:n,children:r}){return o.jsxs("article",{className:"min-w-0 max-w-full overflow-hidden [contain:inline-size] rounded-xl border border-[var(--border)] bg-[var(--surface-elevated)] p-3",children:[o.jsx("h3",{className:"text-sm font-bold text-[var(--text)]",children:e}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:n}),o.jsx("div",{className:"mt-3",children:r})]})}function al(e,n,r){return`${n} ${n===1?"task":"tasks"} ${e} on ${r}`}function O2({points:e,onSelect:n}){if(e.length===0)return o.jsx(Po,{title:"Added vs Closed",description:"Task-flow events by active UTC day.",children:o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No active-day flow data."})});const r=U0(e.length),s=Math.max(1,...e.flatMap(p=>[p.added,p.closed])),u=bs-Fm,c=(r-pn-Xu)/Math.max(e.length,1),f=Math.max(1.5,Math.min(10,c*.28)),h=B0(e.length);return o.jsxs(Po,{title:"Added vs Closed",description:"Solid bars are additions; striped bars are closures. Reopens and net change are available in the data table.",children:[o.jsxs("div",{className:"flex items-center gap-4 text-xs font-semibold text-[var(--text-muted)]","aria-hidden":"true",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2.5 w-4 rounded-sm bg-[var(--accent)]"}),"Added (solid)"]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2.5 w-4 rounded-sm border border-[var(--text-muted)] bg-[repeating-linear-gradient(135deg,var(--text-muted)_0_1px,transparent_1px_3px)]"}),"Closed (striped)"]})]}),o.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5","data-responsive-chart":"horizontal-scroll",children:o.jsxs("svg",{width:"100%",viewBox:`0 0 ${r} ${bs}`,"data-coordinate-width":r,className:"block h-auto max-h-[184px] max-w-full",role:"img","aria-labelledby":"flow-chart-title flow-chart-desc",children:[o.jsx("title",{id:"flow-chart-title",children:"Added versus closed tasks by active UTC day"}),o.jsx("desc",{id:"flow-chart-desc",children:"Grouped bars use solid shapes for additions and striped shapes for closures. Exact values are provided in an accessible table."}),o.jsx("defs",{children:o.jsx("pattern",{id:"flow-closed-stripes",width:"4",height:"4",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:o.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:"currentColor",strokeWidth:"2"})})}),o.jsx("line",{x1:pn,y1:bi,x2:pn,y2:u,stroke:"var(--border-strong)"}),o.jsx("line",{x1:pn,y1:u,x2:r-Xu,y2:u,stroke:"var(--border-strong)"}),o.jsx("text",{x:pn-6,y:bi+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:s}),o.jsx("text",{x:pn-6,y:u+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:"0"}),e.map((p,g)=>{const y=pn+(g+.5)*c,x=qo(p.added,s),E=qo(p.closed,s);return o.jsxs("g",{children:[o.jsx("title",{children:`${p.date}: ${p.added} added, ${p.closed} closed, ${p.reopened} reopened, net backlog ${p.netBacklog}`}),n&&p.addedTaskIds.length>0?o.jsx("g",{role:"button",tabIndex:0,"aria-label":`Filter Work Tree to ${al("added",p.addedTaskIds.length,p.date)}`,className:"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>n({key:`added:${p.date}`,label:al("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}),onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),n({key:`added:${p.date}`,label:al("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}))},children:o.jsx("rect",{x:y-f-1,y:x,width:f,height:Math.max(2,u-x),rx:"1.5",fill:"var(--accent)"})}):o.jsx("rect",{x:y-f-1,y:x,width:f,height:Math.max(0,u-x),rx:"1.5",fill:"var(--accent)"}),n&&p.closedTaskIds.length>0?o.jsx("g",{role:"button",tabIndex:0,"aria-label":`Filter Work Tree to ${al("closed",p.closedTaskIds.length,p.date)}`,className:"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>n({key:`closed:${p.date}`,label:al("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}),onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),n({key:`closed:${p.date}`,label:al("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}))},children:o.jsx("rect",{x:y+1,y:E,width:f,height:Math.max(2,u-E),rx:"1.5",fill:"url(#flow-closed-stripes)",stroke:"var(--text-muted)",strokeWidth:"0.5"})}):o.jsx("rect",{x:y+1,y:E,width:f,height:Math.max(0,u-E),rx:"1.5",fill:"url(#flow-closed-stripes)",stroke:"var(--text-muted)",strokeWidth:"0.5"}),h.has(g)?o.jsx("text",{x:y,y:bs-9,textAnchor:"middle",className:"fill-[var(--text-subtle)] text-[10px]",children:H0(p.date)}):null]},p.date)})]})}),o.jsxs("details",{className:"mt-2 min-w-0 max-w-full overflow-hidden [contain:inline-size] text-xs text-[var(--text-muted)]",children:[o.jsx("summary",{className:"cursor-pointer font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"View exact flow data"}),o.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",children:o.jsxs("table",{className:"w-full table-fixed border-collapse text-left",children:[o.jsx("caption",{className:"sr-only",children:"Exact added, closed, reopened, and net backlog values by active UTC day"}),o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-[var(--border)]",children:[o.jsx("th",{className:"px-2 py-1",children:"Date"}),o.jsx("th",{className:"px-2 py-1",children:"Added"}),o.jsx("th",{className:"px-2 py-1",children:"Closed"}),o.jsx("th",{className:"px-2 py-1",children:"Reopened"}),o.jsx("th",{className:"px-2 py-1",children:"Net backlog"})]})}),o.jsx("tbody",{children:e.map(p=>o.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0",children:[o.jsx("th",{className:"px-2 py-1 font-mono font-medium",children:p.date}),o.jsx("td",{className:"px-2 py-1",children:n&&p.addedTaskIds.length>0?o.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>n({key:`added:${p.date}`,label:al("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}),children:p.added}):p.added}),o.jsx("td",{className:"px-2 py-1",children:n&&p.closedTaskIds.length>0?o.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>n({key:`closed:${p.date}`,label:al("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}),children:p.closed}):p.closed}),o.jsx("td",{className:"px-2 py-1",children:n&&p.reopenedTaskIds.length>0?o.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>n({key:`reopened:${p.date}`,label:al("reopened",p.reopenedTaskIds.length,p.date),taskIds:p.reopenedTaskIds}),children:p.reopened}):p.reopened}),o.jsx("td",{className:"px-2 py-1",children:p.netBacklog})]},p.date))})]})})]})]})}function Dy(e,n,r,s){return e.map((u,c)=>`${c===0?"M":"L"} ${$0(c,e.length,n).toFixed(2)} ${qo(Math.max(0,r(u)),s).toFixed(2)}`).join(" ")}function M2({points:e}){if(e.length===0)return o.jsx(Po,{title:"Scope vs Completion",description:"Cumulative burn-up across the selected active days.",children:o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No cumulative flow data."})});const n=U0(e.length),r=Math.max(1,...e.flatMap(h=>[h.cumulativeScope,h.cumulativeCompletion])),s=bs-Fm,u=B0(e.length),c=Dy(e,n,h=>h.cumulativeScope,r),f=Dy(e,n,h=>h.cumulativeCompletion,r);return o.jsxs(Po,{title:"Scope vs Completion",description:"The solid scope line and dashed completion line expose the open-backlog gap without relying on color.",children:[o.jsxs("div",{className:"flex items-center gap-4 text-xs font-semibold text-[var(--text-muted)]","aria-hidden":"true",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-0.5 w-5 bg-[var(--accent)]"}),"Scope (solid)"]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"w-5 border-t-2 border-dashed border-[var(--color-status-done)]"}),"Completion (dashed)"]})]}),o.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5","data-responsive-chart":"horizontal-scroll",children:o.jsxs("svg",{width:"100%",viewBox:`0 0 ${n} ${bs}`,"data-coordinate-width":n,className:"block h-auto max-h-[184px] max-w-full",role:"img","aria-labelledby":"burnup-chart-title burnup-chart-desc",children:[o.jsx("title",{id:"burnup-chart-title",children:"Cumulative scope versus completion"}),o.jsx("desc",{id:"burnup-chart-desc",children:"A solid scope line and dashed completion line show the cumulative open-backlog gap. Exact values are provided in an accessible table."}),o.jsx("line",{x1:pn,y1:bi,x2:pn,y2:s,stroke:"var(--border-strong)"}),o.jsx("line",{x1:pn,y1:s,x2:n-Xu,y2:s,stroke:"var(--border-strong)"}),o.jsx("text",{x:pn-6,y:bi+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:r}),o.jsx("text",{x:pn-6,y:s+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:"0"}),o.jsx("path",{d:c,fill:"none",stroke:"var(--accent)",strokeWidth:"2.5"}),o.jsx("path",{d:f,fill:"none",stroke:"var(--color-status-done)",strokeWidth:"2.5",strokeDasharray:"6 4"}),e.map((h,p)=>{const g=$0(p,e.length,n);return o.jsxs("g",{children:[o.jsx("title",{children:`${h.date}: cumulative scope ${h.cumulativeScope}, cumulative completion ${h.cumulativeCompletion}, open backlog ${h.netBacklog}`}),o.jsx("circle",{cx:g,cy:qo(h.cumulativeScope,r),r:"2.5",fill:"var(--accent)"}),o.jsx("rect",{x:g-2.5,y:qo(Math.max(0,h.cumulativeCompletion),r)-2.5,width:"5",height:"5",fill:"var(--color-status-done)"}),u.has(p)?o.jsx("text",{x:g,y:bs-9,textAnchor:"middle",className:"fill-[var(--text-subtle)] text-[10px]",children:H0(h.date)}):null]},h.date)})]})}),o.jsx("div",{className:"sr-only",children:o.jsxs("table",{children:[o.jsx("caption",{children:"Exact cumulative scope, completion, and open backlog values by active UTC day"}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Date"}),o.jsx("th",{children:"Scope"}),o.jsx("th",{children:"Completion"}),o.jsx("th",{children:"Open backlog"})]})}),o.jsx("tbody",{children:e.map(h=>o.jsxs("tr",{children:[o.jsx("th",{children:h.date}),o.jsx("td",{children:h.cumulativeScope}),o.jsx("td",{children:h.cumulativeCompletion}),o.jsx("td",{children:h.netBacklog})]},h.date))})]})})]})}function _2({analytics:e,onSelect:n}){const r=Math.max(1,...e.agingBuckets.map(u=>u.count)),s=e.agingBuckets.reduce((u,c)=>u+c.count,0);return o.jsxs(Po,{title:"Open-task aging",description:"Whole UTC days since creation or the latest reopen.",children:[s===0?o.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"No open tasks have an aging anchor at this cutoff."}):null,o.jsx("ul",{className:"grid gap-2","aria-label":"Open-task aging buckets",children:e.agingBuckets.map(u=>{const c=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-semibold text-[var(--text-muted)]",children:u.label}),o.jsx("span",{className:"h-3 overflow-hidden rounded-full border border-[var(--border)] bg-[var(--surface-card)]",children:o.jsx("span",{className:"block h-full rounded-full bg-[var(--accent)]",style:{width:`${u.count/r*100}%`}})}),o.jsx("span",{className:"text-right font-bold tabular-nums text-[var(--text)]","aria-label":`${u.count} tasks`,children:u.count})]});return o.jsx("li",{children:n&&u.taskIds.length>0?o.jsx("button",{type:"button",className:"grid w-full grid-cols-[3.75rem_minmax(0,1fr)_2rem] items-center gap-2 rounded-lg text-xs hover:bg-[var(--accent-soft)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]","aria-label":`Filter Work Tree to ${u.count} ${u.count===1?"task":"tasks"} aged ${u.label}`,onClick:()=>n({key:`aging:${u.label}`,label:`${u.count} ${u.count===1?"task":"tasks"} aged ${u.label}`,taskIds:u.taskIds}),children:c}):o.jsx("div",{className:"grid grid-cols-[3.75rem_minmax(0,1fr)_2rem] items-center gap-2 text-xs",children:c})},u.label)})}),o.jsx("div",{className:"sr-only",children:o.jsxs("table",{children:[o.jsx("caption",{children:"Exact open-task aging bucket counts"}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Age"}),o.jsx("th",{children:"Open tasks"})]})}),o.jsx("tbody",{children:e.agingBuckets.map(u=>o.jsxs("tr",{children:[o.jsx("th",{children:u.label}),o.jsx("td",{children:u.count})]},u.label))})]})})]})}function L2({analytics:e,onSelect:n}){const r=n?{onSelect:n}:{};return o.jsxs("div",{className:"grid min-w-0 max-w-full overflow-hidden gap-3 xl:grid-cols-2",children:[o.jsx(O2,{points:e.dailyPoints,...r}),o.jsx(M2,{points:e.dailyPoints}),o.jsx("div",{className:"min-w-0 xl:col-span-2",children:o.jsx(_2,{analytics:e,...r})})]})}const z2=[7,21,60];function U2(e){return e>0?`+${e}`:String(e)}function Nu(e){return e.toFixed(1)}function $2(e){return`${(e*100).toFixed(0)}%`}function B2(e){const{netBacklog:n,activeDays:r}=e.summary;if(r===0)return"No task-flow activity is recorded for this period.";if(n>0)return`Backlog grew by ${n} ${n===1?"task":"tasks"} across the selected active days.`;if(n<0){const s=Math.abs(n);return`Backlog shrank by ${s} ${s===1?"task":"tasks"} across the selected active days.`}return"Backlog stayed level across the selected active days."}function H2({value:e}){return e>0?o.jsx(lj,{className:"h-4 w-4","aria-hidden":"true"}):e<0?o.jsx(WN,{className:"h-4 w-4","aria-hidden":"true"}):o.jsx(qj,{className:"h-4 w-4","aria-hidden":"true"})}function gs({label:e,value:n,detail:r,valueClassName:s="text-[var(--text)]",onSelect:u,selected:c}){return o.jsxs("div",{className:`min-w-28 rounded-xl border bg-[var(--surface-elevated)] px-3 py-2.5 ${c?"border-[var(--accent)] ring-1 ring-[var(--accent)]":"border-[var(--border)]"}`,children:[o.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:e}),o.jsx("dd",{className:`mt-1 text-xl font-black tracking-tight ${s}`,children:u?o.jsx("button",{type:"button","aria-pressed":c,"aria-label":`Filter Work Tree by ${e}`,onClick:u,className:"rounded-md underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:n}):n}),r?o.jsx("p",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:r}):null]})}function I2({phases:e,asOf:n,activeDrilldown:r,onDrilldown:s,onClearDrilldown:u}){const[c,f]=v.useState(21),h=v.useMemo(()=>R2(e),[e]),p=n??new Date().toISOString().slice(0,10),g=v.useMemo(()=>D2(h,{windowDays:c,asOf:p}),[p,h,c]),y=g.summary.netBacklog>0?"text-rose-600 dark:text-rose-400":g.summary.netBacklog<0?"text-emerald-600 dark:text-emerald-400":"text-[var(--text)]",x=g.limitations.notes.join(" "),E=(S,w,j)=>s&&j.length>0?()=>s({key:S,label:w,taskIds:j}):null;return o.jsx(Vt,{className:"min-w-0 overflow-hidden [contain:inline-size]",children:o.jsxs("section",{"aria-labelledby":"flow-backlog-heading",className:"grid min-w-0 max-w-full gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(KN,{className:"h-4 w-4 text-[var(--accent)]","aria-hidden":"true"}),o.jsx("h2",{id:"flow-backlog-heading",className:"text-lg font-bold text-[var(--text)]",children:"Flow & Backlog"})]}),o.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]","aria-live":"polite",children:B2(g)})]}),o.jsx("div",{role:"group","aria-label":"Active-day period",className:"flex w-full min-w-0 items-center gap-1 overflow-x-auto [contain:inline-size] sm:w-auto sm:max-w-full sm:shrink-0 rounded-xl border border-[var(--border)] bg-[var(--surface-card)] p-1 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",children:z2.map(S=>o.jsxs("button",{type:"button","aria-label":`${S} active days`,"aria-pressed":c===S,onClick:()=>f(S),className:`h-8 shrink-0 rounded-lg px-2.5 text-xs font-bold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--surface)] ${c===S?"bg-[var(--accent)] text-white":"text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"}`,children:[o.jsx("span",{children:S}),o.jsx("span",{className:"hidden sm:inline",children:" active days"})]},S))})]}),o.jsx("p",{className:"text-xs text-[var(--text-subtle)]",children:g.calendarRange?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"UTC range "}),o.jsx("time",{dateTime:g.calendarRange.start,children:g.calendarRange.start}),o.jsx("span",{children:" – "}),o.jsx("time",{dateTime:g.calendarRange.end,children:g.calendarRange.end}),o.jsxs("span",{children:[" · ",g.summary.activeDays," active ",g.summary.activeDays===1?"day":"days"]})]}):"No UTC activity range is available."}),o.jsxs("dl",{className:"grid min-w-0 grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8",children:[o.jsx(gs,{label:"Added",value:String(g.summary.addedTotal),detail:`${Nu(g.summary.addRatePerActiveDay)} / active day`,onSelect:E("window-added",`${g.windowAddedIds.length} ${g.windowAddedIds.length===1?"task":"tasks"} added in the selected window`,g.windowAddedIds),selected:(r==null?void 0:r.key)==="window-added"}),o.jsx(gs,{label:"Closed",value:String(g.summary.closedTotal),detail:`${Nu(g.summary.closeRatePerActiveDay)} / active day`,onSelect:E("window-closed",`${g.windowClosedIds.length} ${g.windowClosedIds.length===1?"task":"tasks"} closed in the selected window`,g.windowClosedIds),selected:(r==null?void 0:r.key)==="window-closed"}),g.summary.reopenedTotal>0?o.jsx(gs,{label:"Reopened",value:String(g.summary.reopenedTotal),onSelect:E("window-reopened",`${g.windowReopenedIds.length} ${g.windowReopenedIds.length===1?"task":"tasks"} reopened in the selected window`,g.windowReopenedIds),selected:(r==null?void 0:r.key)==="window-reopened"}):null,o.jsxs("div",{className:"min-w-28 rounded-xl border border-[var(--border)] bg-[var(--surface-elevated)] px-3 py-2.5",children:[o.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Net change"}),o.jsxs("dd",{className:`mt-1 flex items-center gap-1 text-xl font-black tracking-tight ${y}`,children:[o.jsx(H2,{value:g.summary.netBacklog}),U2(g.summary.netBacklog)]})]}),o.jsx(gs,{label:"Open now",value:String(g.summary.currentOpen),detail:`${g.summary.currentTotal} total`,onSelect:E("current-open",`${g.currentOpenIds.length} currently open ${g.currentOpenIds.length===1?"task":"tasks"}`,g.currentOpenIds),selected:(r==null?void 0:r.key)==="current-open"}),o.jsx(gs,{label:"Add rate",value:Nu(g.summary.addRatePerActiveDay),detail:"per active day",onSelect:null,selected:!1}),o.jsx(gs,{label:"Close rate",value:Nu(g.summary.closeRatePerActiveDay),detail:"per active day",onSelect:null,selected:!1}),o.jsx(gs,{label:"Closure ratio",value:$2(g.summary.closureRatio),detail:"closed / added",onSelect:null,selected:!1})]}),o.jsx(L2,{analytics:g,...s?{onSelect:s}:{}}),r?o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-[var(--accent)] bg-[var(--accent-soft)] px-3 py-2 text-sm",role:"status",children:[o.jsxs("span",{className:"font-semibold text-[var(--text)]",children:["Work Tree filter: ",r.label]}),u?o.jsx("button",{type:"button",onClick:u,className:"rounded-lg px-2 py-1 text-xs font-bold text-[var(--accent)] underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"Clear analytics filter"}):null]}):null,o.jsx("p",{className:"text-xs text-[var(--text-subtle)]",title:x,children:"Current planner files exclude deleted tasks; legacy gaps are inferred from available timestamps."})]})})}function q2(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return v.useMemo(()=>s=>{n.forEach(u=>u(s))},n)}const xd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ni(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function Vm(e){return"nodeType"in e}function gn(e){var n,r;return e?Ni(e)?e:Vm(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function Ym(e){const{Document:n}=gn(e);return e instanceof n}function nc(e){return Ni(e)?!1:e instanceof gn(e).HTMLElement}function I0(e){return e instanceof gn(e).SVGElement}function ji(e){return e?Ni(e)?e.document:Vm(e)?Ym(e)?e:nc(e)||I0(e)?e.ownerDocument:document:document:document}const mr=xd?v.useLayoutEffect:v.useEffect;function yd(e){const n=v.useRef(e);return mr(()=>{n.current=e}),v.useCallback(function(){for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];return n.current==null?void 0:n.current(...s)},[])}function P2(){const e=v.useRef(null),n=v.useCallback((s,u)=>{e.current=setInterval(s,u)},[]),r=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Fo(e,n){n===void 0&&(n=[e]);const r=v.useRef(e);return mr(()=>{r.current!==e&&(r.current=e)},n),r}function rc(e,n){const r=v.useRef();return v.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...n])}function Qu(e){const n=yd(e),r=v.useRef(null),s=v.useCallback(u=>{u!==r.current&&(n==null||n(u,r.current)),r.current=u},[]);return[r,s]}function Ku(e){const n=v.useRef();return v.useEffect(()=>{n.current=e},[e]),n.current}let Bh={};function lc(e,n){return v.useMemo(()=>{if(n)return n;const r=Bh[e]==null?0:Bh[e]+1;return Bh[e]=r,e+"-"+r},[e,n])}function q0(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),u=1;u<r;u++)s[u-1]=arguments[u];return s.reduce((c,f)=>{const h=Object.entries(f);for(const[p,g]of h){const y=c[p];y!=null&&(c[p]=y+e*g)}return c},{...n})}}const vi=q0(1),Zu=q0(-1);function F2(e){return"clientX"in e&&"clientY"in e}function bd(e){if(!e)return!1;const{KeyboardEvent:n}=gn(e.target);return n&&e instanceof n}function V2(e){if(!e)return!1;const{TouchEvent:n}=gn(e.target);return n&&e instanceof n}function Wu(e){if(V2(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return F2(e)?{x:e.clientX,y:e.clientY}:null}const Fl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Fl.Translate.toString(e),Fl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:s}=e;return n+" "+r+"ms "+s}}}),Oy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Y2(e){return e.matches(Oy)?e:e.querySelector(Oy)}const G2={display:"none"};function X2(e){let{id:n,value:r}=e;return ca.createElement("div",{id:n,style:G2},r)}function Q2(e){let{id:n,announcement:r,ariaLiveType:s="assertive"}=e;const u={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 ca.createElement("div",{id:n,style:u,role:"status","aria-live":s,"aria-atomic":!0},r)}function K2(){const[e,n]=v.useState("");return{announce:v.useCallback(s=>{s!=null&&n(s)},[]),announcement:e}}const P0=v.createContext(null);function Z2(e){const n=v.useContext(P0);v.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function W2(){const[e]=v.useState(()=>new Set),n=v.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[v.useCallback(s=>{let{type:u,event:c}=s;e.forEach(f=>{var h;return(h=f[u])==null?void 0:h.call(f,c)})},[e]),n]}const J2={draggable:`
299
- To pick up a draggable item, press the space bar.
300
- While dragging, use the arrow keys to move the item.
301
- Press space again to drop the item in its new position, or press escape to cancel.
302
- `},ek={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function tk(e){let{announcements:n=ek,container:r,hiddenTextDescribedById:s,screenReaderInstructions:u=J2}=e;const{announce:c,announcement:f}=K2(),h=lc("DndLiveRegion"),[p,g]=v.useState(!1);if(v.useEffect(()=>{g(!0)},[]),Z2(v.useMemo(()=>({onDragStart(x){let{active:E}=x;c(n.onDragStart({active:E}))},onDragMove(x){let{active:E,over:S}=x;n.onDragMove&&c(n.onDragMove({active:E,over:S}))},onDragOver(x){let{active:E,over:S}=x;c(n.onDragOver({active:E,over:S}))},onDragEnd(x){let{active:E,over:S}=x;c(n.onDragEnd({active:E,over:S}))},onDragCancel(x){let{active:E,over:S}=x;c(n.onDragCancel({active:E,over:S}))}}),[c,n])),!p)return null;const y=ca.createElement(ca.Fragment,null,ca.createElement(X2,{id:s,value:u.draggable}),ca.createElement(Q2,{id:h,announcement:f}));return r?ll.createPortal(y,r):y}var za;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(za||(za={}));function Ju(){}function ak(e,n){return v.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function nk(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return v.useMemo(()=>[...n].filter(s=>s!=null),[...n])}const pr=Object.freeze({x:0,y:0});function rk(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function lk(e,n){const r=Wu(e);if(!r)return"0 0";const s={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return s.x+"% "+s.y+"%"}function sk(e,n){let{data:{value:r}}=e,{data:{value:s}}=n;return r-s}function ik(e,n){let{data:{value:r}}=e,{data:{value:s}}=n;return s-r}function ok(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function My(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ck=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:s}=e;const u=My(n,n.left,n.top),c=[];for(const f of s){const{id:h}=f,p=r.get(h);if(p){const g=rk(My(p),u);c.push({id:h,data:{droppableContainer:f,value:g}})}}return c.sort(sk)};function uk(e,n){const r=Math.max(n.top,e.top),s=Math.max(n.left,e.left),u=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),f=u-s,h=c-r;if(s<u&&r<c){const p=n.width*n.height,g=e.width*e.height,y=f*h,x=y/(p+g-y);return Number(x.toFixed(4))}return 0}const dk=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:s}=e;const u=[];for(const c of s){const{id:f}=c,h=r.get(f);if(h){const p=uk(h,n);p>0&&u.push({id:f,data:{droppableContainer:c,value:p}})}}return u.sort(ik)};function fk(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function F0(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:pr}function hk(e){return function(r){for(var s=arguments.length,u=new Array(s>1?s-1:0),c=1;c<s;c++)u[c-1]=arguments[c];return u.reduce((f,h)=>({...f,top:f.top+e*h.y,bottom:f.bottom+e*h.y,left:f.left+e*h.x,right:f.right+e*h.x}),{...r})}}const mk=hk(1);function V0(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function pk(e,n,r){const s=V0(n);if(!s)return e;const{scaleX:u,scaleY:c,x:f,y:h}=s,p=e.left-f-(1-u)*parseFloat(r),g=e.top-h-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),y=u?e.width/u:e.width,x=c?e.height/c:e.height;return{width:y,height:x,top:g,right:p+y,bottom:g+x,left:p}}const gk={ignoreTransform:!1};function Ri(e,n){n===void 0&&(n=gk);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:g,transformOrigin:y}=gn(e).getComputedStyle(e);g&&(r=pk(r,g,y))}const{top:s,left:u,width:c,height:f,bottom:h,right:p}=r;return{top:s,left:u,width:c,height:f,bottom:h,right:p}}function _y(e){return Ri(e,{ignoreTransform:!0})}function vk(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function xk(e,n){return n===void 0&&(n=gn(e).getComputedStyle(e)),n.position==="fixed"}function yk(e,n){n===void 0&&(n=gn(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(u=>{const c=n[u];return typeof c=="string"?r.test(c):!1})}function Gm(e,n){const r=[];function s(u){if(n!=null&&r.length>=n||!u)return r;if(Ym(u)&&u.scrollingElement!=null&&!r.includes(u.scrollingElement))return r.push(u.scrollingElement),r;if(!nc(u)||I0(u)||r.includes(u))return r;const c=gn(e).getComputedStyle(u);return u!==e&&yk(u,c)&&r.push(u),xk(u,c)?r:s(u.parentNode)}return e?s(e):r}function Y0(e){const[n]=Gm(e,1);return n??null}function Hh(e){return!xd||!e?null:Ni(e)?e:Vm(e)?Ym(e)||e===ji(e).scrollingElement?window:nc(e)?e:null:null}function G0(e){return Ni(e)?e.scrollX:e.scrollLeft}function X0(e){return Ni(e)?e.scrollY:e.scrollTop}function hm(e){return{x:G0(e),y:X0(e)}}var qa;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(qa||(qa={}));function Q0(e){return!xd||!e?!1:e===document.scrollingElement}function K0(e){const n={x:0,y:0},r=Q0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},u=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,f=e.scrollTop>=s.y,h=e.scrollLeft>=s.x;return{isTop:u,isLeft:c,isBottom:f,isRight:h,maxScroll:s,minScroll:n}}const bk={x:.2,y:.2};function wk(e,n,r,s,u){let{top:c,left:f,right:h,bottom:p}=r;s===void 0&&(s=10),u===void 0&&(u=bk);const{isTop:g,isBottom:y,isLeft:x,isRight:E}=K0(e),S={x:0,y:0},w={x:0,y:0},j={height:n.height*u.y,width:n.width*u.x};return!g&&c<=n.top+j.height?(S.y=qa.Backward,w.y=s*Math.abs((n.top+j.height-c)/j.height)):!y&&p>=n.bottom-j.height&&(S.y=qa.Forward,w.y=s*Math.abs((n.bottom-j.height-p)/j.height)),!E&&h>=n.right-j.width?(S.x=qa.Forward,w.x=s*Math.abs((n.right-j.width-h)/j.width)):!x&&f<=n.left+j.width&&(S.x=qa.Backward,w.x=s*Math.abs((n.left+j.width-f)/j.width)),{direction:S,speed:w}}function Sk(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:f}=window;return{top:0,left:0,right:c,bottom:f,width:c,height:f}}const{top:n,left:r,right:s,bottom:u}=e.getBoundingClientRect();return{top:n,left:r,right:s,bottom:u,width:e.clientWidth,height:e.clientHeight}}function Z0(e){return e.reduce((n,r)=>vi(n,hm(r)),pr)}function Ek(e){return e.reduce((n,r)=>n+G0(r),0)}function Nk(e){return e.reduce((n,r)=>n+X0(r),0)}function W0(e,n){if(n===void 0&&(n=Ri),!e)return;const{top:r,left:s,bottom:u,right:c}=n(e);Y0(e)&&(u<=0||c<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const jk=[["x",["left","right"],Ek],["y",["top","bottom"],Nk]];class Xm{constructor(n,r){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=Gm(r),u=Z0(s);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,f,h]of jk)for(const p of f)Object.defineProperty(this,p,{get:()=>{const g=h(s),y=u[c]-g;return this.rect[p]+y},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Lo{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=n}add(n,r,s){var u;(u=this.target)==null||u.addEventListener(n,r,s),this.listeners.push([n,r,s])}}function Rk(e){const{EventTarget:n}=gn(e);return e instanceof n?e:ji(e)}function Ih(e,n){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+s**2)>n:"x"in n&&"y"in n?r>n.x&&s>n.y:"x"in n?r>n.x:"y"in n?s>n.y:!1}var tr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(tr||(tr={}));function Ly(e){e.preventDefault()}function kk(e){e.stopPropagation()}var Mt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Mt||(Mt={}));const J0={start:[Mt.Space,Mt.Enter],cancel:[Mt.Esc],end:[Mt.Space,Mt.Enter,Mt.Tab]},Tk=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case Mt.Right:return{...r,x:r.x+25};case Mt.Left:return{...r,x:r.x-25};case Mt.Down:return{...r,y:r.y+25};case Mt.Up:return{...r,y:r.y-25}}};class e1{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new Lo(ji(r)),this.windowListeners=new Lo(gn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(tr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,s=n.node.current;s&&W0(s),r(pr)}handleKeyDown(n){if(bd(n)){const{active:r,context:s,options:u}=this.props,{keyboardCodes:c=J0,coordinateGetter:f=Tk,scrollBehavior:h="smooth"}=u,{code:p}=n;if(c.end.includes(p)){this.handleEnd(n);return}if(c.cancel.includes(p)){this.handleCancel(n);return}const{collisionRect:g}=s.current,y=g?{x:g.left,y:g.top}:pr;this.referenceCoordinates||(this.referenceCoordinates=y);const x=f(n,{active:r,context:s.current,currentCoordinates:y});if(x){const E=Zu(x,y),S={x:0,y:0},{scrollableAncestors:w}=s.current;for(const j of w){const R=n.code,{isTop:z,isRight:I,isLeft:$,isBottom:Q,maxScroll:J,minScroll:ne}=K0(j),M=Sk(j),T={x:Math.min(R===Mt.Right?M.right-M.width/2:M.right,Math.max(R===Mt.Right?M.left:M.left+M.width/2,x.x)),y:Math.min(R===Mt.Down?M.bottom-M.height/2:M.bottom,Math.max(R===Mt.Down?M.top:M.top+M.height/2,x.y))},fe=R===Mt.Right&&!I||R===Mt.Left&&!$,pe=R===Mt.Down&&!Q||R===Mt.Up&&!z;if(fe&&T.x!==x.x){const we=j.scrollLeft+E.x,re=R===Mt.Right&&we<=J.x||R===Mt.Left&&we>=ne.x;if(re&&!E.y){j.scrollTo({left:we,behavior:h});return}re?S.x=j.scrollLeft-we:S.x=R===Mt.Right?j.scrollLeft-J.x:j.scrollLeft-ne.x,S.x&&j.scrollBy({left:-S.x,behavior:h});break}else if(pe&&T.y!==x.y){const we=j.scrollTop+E.y,re=R===Mt.Down&&we<=J.y||R===Mt.Up&&we>=ne.y;if(re&&!E.x){j.scrollTo({top:we,behavior:h});return}re?S.y=j.scrollTop-we:S.y=R===Mt.Down?j.scrollTop-J.y:j.scrollTop-ne.y,S.y&&j.scrollBy({top:-S.y,behavior:h});break}}this.handleMove(n,vi(Zu(x,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:s}=this.props;n.preventDefault(),s(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}e1.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:s=J0,onActivation:u}=n,{active:c}=r;const{code:f}=e.nativeEvent;if(s.start.includes(f)){const h=c.activatorNode.current;return h&&e.target!==h?!1:(e.preventDefault(),u==null||u({event:e.nativeEvent}),!0)}return!1}}];function zy(e){return!!(e&&"distance"in e)}function Uy(e){return!!(e&&"delay"in e)}class Qm{constructor(n,r,s){var u;s===void 0&&(s=Rk(n.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=n,this.events=r;const{event:c}=n,{target:f}=c;this.props=n,this.events=r,this.document=ji(f),this.documentListeners=new Lo(this.document),this.listeners=new Lo(s),this.windowListeners=new Lo(gn(f)),this.initialCoordinates=(u=Wu(c))!=null?u:pr,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:n,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.DragStart,Ly),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),this.windowListeners.add(tr.ContextMenu,Ly),this.documentListeners.add(tr.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Uy(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(zy(r)){this.handlePending(r);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(n,r){const{active:s,onPending:u}=this.props;u(s,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(tr.Click,kk,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(tr.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:s,initialCoordinates:u,props:c}=this,{onMove:f,options:{activationConstraint:h}}=c;if(!u)return;const p=(r=Wu(n))!=null?r:pr,g=Zu(u,p);if(!s&&h){if(zy(h)){if(h.tolerance!=null&&Ih(g,h.tolerance))return this.handleCancel();if(Ih(g,h.distance))return this.handleStart()}if(Uy(h)&&Ih(g,h.tolerance))return this.handleCancel();this.handlePending(h,g);return}n.cancelable&&n.preventDefault(),f(p)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===Mt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const Ck={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Km extends Qm{constructor(n){const{event:r}=n,s=ji(r.target);super(n,Ck,s)}}Km.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:s}=n;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const Ak={move:{name:"mousemove"},end:{name:"mouseup"}};var mm;(function(e){e[e.RightClick=2]="RightClick"})(mm||(mm={}));class Dk extends Qm{constructor(n){super(n,Ak,ji(n.event.target))}}Dk.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:s}=n;return r.button===mm.RightClick?!1:(s==null||s({event:r}),!0)}}];const qh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ok extends Qm{constructor(n){super(n,qh)}static setup(){return window.addEventListener(qh.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(qh.move.name,n)};function n(){}}}Ok.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:s}=n;const{touches:u}=r;return u.length>1?!1:(s==null||s({event:r}),!0)}}];var zo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(zo||(zo={}));var ed;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ed||(ed={}));function Mk(e){let{acceleration:n,activator:r=zo.Pointer,canScroll:s,draggingRect:u,enabled:c,interval:f=5,order:h=ed.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:y,delta:x,threshold:E}=e;const S=Lk({delta:x,disabled:!c}),[w,j]=P2(),R=v.useRef({x:0,y:0}),z=v.useRef({x:0,y:0}),I=v.useMemo(()=>{switch(r){case zo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case zo.DraggableRect:return u}},[r,u,p]),$=v.useRef(null),Q=v.useCallback(()=>{const ne=$.current;if(!ne)return;const M=R.current.x*z.current.x,T=R.current.y*z.current.y;ne.scrollBy(M,T)},[]),J=v.useMemo(()=>h===ed.TreeOrder?[...g].reverse():g,[h,g]);v.useEffect(()=>{if(!c||!g.length||!I){j();return}for(const ne of J){if((s==null?void 0:s(ne))===!1)continue;const M=g.indexOf(ne),T=y[M];if(!T)continue;const{direction:fe,speed:pe}=wk(ne,T,I,n,E);for(const we of["x","y"])S[we][fe[we]]||(pe[we]=0,fe[we]=0);if(pe.x>0||pe.y>0){j(),$.current=ne,w(Q,f),R.current=pe,z.current=fe;return}}R.current={x:0,y:0},z.current={x:0,y:0},j()},[n,Q,s,j,c,f,JSON.stringify(I),JSON.stringify(S),w,g,J,y,JSON.stringify(E)])}const _k={x:{[qa.Backward]:!1,[qa.Forward]:!1},y:{[qa.Backward]:!1,[qa.Forward]:!1}};function Lk(e){let{delta:n,disabled:r}=e;const s=Ku(n);return rc(u=>{if(r||!s||!u)return _k;const c={x:Math.sign(n.x-s.x),y:Math.sign(n.y-s.y)};return{x:{[qa.Backward]:u.x[qa.Backward]||c.x===-1,[qa.Forward]:u.x[qa.Forward]||c.x===1},y:{[qa.Backward]:u.y[qa.Backward]||c.y===-1,[qa.Forward]:u.y[qa.Forward]||c.y===1}}},[r,n,s])}function zk(e,n){const r=n!=null?e.get(n):void 0,s=r?r.node.current:null;return rc(u=>{var c;return n==null?null:(c=s??u)!=null?c:null},[s,n])}function Uk(e,n){return v.useMemo(()=>e.reduce((r,s)=>{const{sensor:u}=s,c=u.activators.map(f=>({eventName:f.eventName,handler:n(f.handler,s)}));return[...r,...c]},[]),[e,n])}var Vo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Vo||(Vo={}));var pm;(function(e){e.Optimized="optimized"})(pm||(pm={}));const $y=new Map;function $k(e,n){let{dragging:r,dependencies:s,config:u}=n;const[c,f]=v.useState(null),{frequency:h,measure:p,strategy:g}=u,y=v.useRef(e),x=R(),E=Fo(x),S=v.useCallback(function(z){z===void 0&&(z=[]),!E.current&&f(I=>I===null?z:I.concat(z.filter($=>!I.includes($))))},[E]),w=v.useRef(null),j=rc(z=>{if(x&&!r)return $y;if(!z||z===$y||y.current!==e||c!=null){const I=new Map;for(let $ of e){if(!$)continue;if(c&&c.length>0&&!c.includes($.id)&&$.rect.current){I.set($.id,$.rect.current);continue}const Q=$.node.current,J=Q?new Xm(p(Q),Q):null;$.rect.current=J,J&&I.set($.id,J)}return I}return z},[e,c,r,x,p]);return v.useEffect(()=>{y.current=e},[e]),v.useEffect(()=>{x||S()},[r,x]),v.useEffect(()=>{c&&c.length>0&&f(null)},[JSON.stringify(c)]),v.useEffect(()=>{x||typeof h!="number"||w.current!==null||(w.current=setTimeout(()=>{S(),w.current=null},h))},[h,x,S,...s]),{droppableRects:j,measureDroppableContainers:S,measuringScheduled:c!=null};function R(){switch(g){case Vo.Always:return!1;case Vo.BeforeDragging:return r;default:return!r}}}function Zm(e,n){return rc(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function Bk(e,n){return Zm(e,n)}function Hk(e){let{callback:n,disabled:r}=e;const s=yd(n),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(s)},[s,r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function wd(e){let{callback:n,disabled:r}=e;const s=yd(n),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(s)},[r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function Ik(e){return new Xm(Ri(e),e)}function By(e,n,r){n===void 0&&(n=Ik);const[s,u]=v.useState(null);function c(){u(p=>{if(!e)return null;if(e.isConnected===!1){var g;return(g=p??r)!=null?g:null}const y=n(e);return JSON.stringify(p)===JSON.stringify(y)?p:y})}const f=Hk({callback(p){if(e)for(const g of p){const{type:y,target:x}=g;if(y==="childList"&&x instanceof HTMLElement&&x.contains(e)){c();break}}}}),h=wd({callback:c});return mr(()=>{c(),e?(h==null||h.observe(e),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(h==null||h.disconnect(),f==null||f.disconnect())},[e]),s}function qk(e){const n=Zm(e);return F0(e,n)}const Hy=[];function Pk(e){const n=v.useRef(e),r=rc(s=>e?s&&s!==Hy&&e&&n.current&&e.parentNode===n.current.parentNode?s:Gm(e):Hy,[e]);return v.useEffect(()=>{n.current=e},[e]),r}function Fk(e){const[n,r]=v.useState(null),s=v.useRef(e),u=v.useCallback(c=>{const f=Hh(c.target);f&&r(h=>h?(h.set(f,hm(f)),new Map(h)):null)},[]);return v.useEffect(()=>{const c=s.current;if(e!==c){f(c);const h=e.map(p=>{const g=Hh(p);return g?(g.addEventListener("scroll",u,{passive:!0}),[g,hm(g)]):null}).filter(p=>p!=null);r(h.length?new Map(h):null),s.current=e}return()=>{f(e),f(c)};function f(h){h.forEach(p=>{const g=Hh(p);g==null||g.removeEventListener("scroll",u)})}},[u,e]),v.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,f)=>vi(c,f),pr):Z0(e):pr,[e,n])}function Iy(e,n){n===void 0&&(n=[]);const r=v.useRef(null);return v.useEffect(()=>{r.current=null},n),v.useEffect(()=>{const s=e!==pr;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?Zu(e,r.current):pr}function Vk(e){v.useEffect(()=>{if(!xd)return;const n=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function Yk(e,n){return v.useMemo(()=>e.reduce((r,s)=>{let{eventName:u,handler:c}=s;return r[u]=f=>{c(f,n)},r},{}),[e,n])}function t1(e){return v.useMemo(()=>e?vk(e):null,[e])}const qy=[];function Gk(e,n){n===void 0&&(n=Ri);const[r]=e,s=t1(r?gn(r):null),[u,c]=v.useState(qy);function f(){c(()=>e.length?e.map(p=>Q0(p)?s:new Xm(n(p),p)):qy)}const h=wd({callback:f});return mr(()=>{h==null||h.disconnect(),f(),e.forEach(p=>h==null?void 0:h.observe(p))},[e]),u}function a1(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return nc(n)?n:e}function Xk(e){let{measure:n}=e;const[r,s]=v.useState(null),u=v.useCallback(g=>{for(const{target:y}of g)if(nc(y)){s(x=>{const E=n(y);return x?{...x,width:E.width,height:E.height}:E});break}},[n]),c=wd({callback:u}),f=v.useCallback(g=>{const y=a1(g);c==null||c.disconnect(),y&&(c==null||c.observe(y)),s(y?n(y):null)},[n,c]),[h,p]=Qu(f);return v.useMemo(()=>({nodeRef:h,rect:r,setRef:p}),[r,h,p])}const Qk=[{sensor:Km,options:{}},{sensor:e1,options:{}}],Kk={current:{}},$u={draggable:{measure:_y},droppable:{measure:_y,strategy:Vo.WhileDragging,frequency:pm.Optimized},dragOverlay:{measure:Ri}};class Uo extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,s;return(r=(s=this.get(n))==null?void 0:s.node.current)!=null?r:void 0}}const Zk={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Uo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ju},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$u,measureDroppableContainers:Ju,windowRect:null,measuringScheduled:!1},n1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ju,draggableNodes:new Map,over:null,measureDroppableContainers:Ju},sc=v.createContext(n1),r1=v.createContext(Zk);function Wk(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Uo}}}function Jk(e,n){switch(n.type){case za.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case za.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case za.DragEnd:case za.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case za.RegisterDroppable:{const{element:r}=n,{id:s}=r,u=new Uo(e.droppable.containers);return u.set(s,r),{...e,droppable:{...e.droppable,containers:u}}}case za.SetDroppableDisabled:{const{id:r,key:s,disabled:u}=n,c=e.droppable.containers.get(r);if(!c||s!==c.key)return e;const f=new Uo(e.droppable.containers);return f.set(r,{...c,disabled:u}),{...e,droppable:{...e.droppable,containers:f}}}case za.UnregisterDroppable:{const{id:r,key:s}=n,u=e.droppable.containers.get(r);if(!u||s!==u.key)return e;const c=new Uo(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function eT(e){let{disabled:n}=e;const{active:r,activatorEvent:s,draggableNodes:u}=v.useContext(sc),c=Ku(s),f=Ku(r==null?void 0:r.id);return v.useEffect(()=>{if(!n&&!s&&c&&f!=null){if(!bd(c)||document.activeElement===c.target)return;const h=u.get(f);if(!h)return;const{activatorNode:p,node:g}=h;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const y of[p.current,g.current]){if(!y)continue;const x=Y2(y);if(x){x.focus();break}}})}},[s,n,u,f,c]),null}function l1(e,n){let{transform:r,...s}=n;return e!=null&&e.length?e.reduce((u,c)=>c({transform:u,...s}),r):r}function tT(e){return v.useMemo(()=>({draggable:{...$u.draggable,...e==null?void 0:e.draggable},droppable:{...$u.droppable,...e==null?void 0:e.droppable},dragOverlay:{...$u.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function aT(e){let{activeNode:n,measure:r,initialRect:s,config:u=!0}=e;const c=v.useRef(!1),{x:f,y:h}=typeof u=="boolean"?{x:u,y:u}:u;mr(()=>{if(!f&&!h||!n){c.current=!1;return}if(c.current||!s)return;const g=n==null?void 0:n.node.current;if(!g||g.isConnected===!1)return;const y=r(g),x=F0(y,s);if(f||(x.x=0),h||(x.y=0),c.current=!0,Math.abs(x.x)>0||Math.abs(x.y)>0){const E=Y0(g);E&&E.scrollBy({top:x.y,left:x.x})}},[n,f,h,s,r])}const Sd=v.createContext({...pr,scaleX:1,scaleY:1});var Hl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Hl||(Hl={}));const nT=v.memo(function(n){var r,s,u,c;let{id:f,accessibility:h,autoScroll:p=!0,children:g,sensors:y=Qk,collisionDetection:x=dk,measuring:E,modifiers:S,...w}=n;const j=v.useReducer(Jk,void 0,Wk),[R,z]=j,[I,$]=W2(),[Q,J]=v.useState(Hl.Uninitialized),ne=Q===Hl.Initialized,{draggable:{active:M,nodes:T,translate:fe},droppable:{containers:pe}}=R,we=M!=null?T.get(M):null,re=v.useRef({initial:null,translated:null}),je=v.useMemo(()=>{var yt;return M!=null?{id:M,data:(yt=we==null?void 0:we.data)!=null?yt:Kk,rect:re}:null},[M,we]),Te=v.useRef(null),[ee,L]=v.useState(null),[F,he]=v.useState(null),P=Fo(w,Object.values(w)),se=lc("DndDescribedBy",f),C=v.useMemo(()=>pe.getEnabled(),[pe]),B=tT(E),{droppableRects:K,measureDroppableContainers:ue,measuringScheduled:ge}=$k(C,{dragging:ne,dependencies:[fe.x,fe.y],config:B.droppable}),ve=zk(T,M),Re=v.useMemo(()=>F?Wu(F):null,[F]),He=xt(),$e=Bk(ve,B.draggable.measure);aT({activeNode:M!=null?T.get(M):null,config:He.layoutShiftCompensation,initialRect:$e,measure:B.draggable.measure});const Qe=By(ve,B.draggable.measure,$e),ia=By(ve?ve.parentElement:null),$t=v.useRef({activatorEvent:null,active:null,activeNode:ve,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:pe,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),mt=pe.getNodeFor((r=$t.current.over)==null?void 0:r.id),ce=Xk({measure:B.dragOverlay.measure}),qe=(s=ce.nodeRef.current)!=null?s:ve,rt=ne?(u=ce.rect)!=null?u:Qe:null,Bt=!!(ce.nodeRef.current&&ce.rect),ga=qk(Bt?null:Qe),Rt=t1(qe?gn(qe):null),_t=Pk(ne?mt??ve:null),Kt=Gk(_t),$a=l1(S,{transform:{x:fe.x-ga.x,y:fe.y-ga.y,scaleX:1,scaleY:1},activatorEvent:F,active:je,activeNodeRect:Qe,containerNodeRect:ia,draggingNodeRect:rt,over:$t.current.over,overlayNodeRect:ce.rect,scrollableAncestors:_t,scrollableAncestorRects:Kt,windowRect:Rt}),Ba=Re?vi(Re,fe):null,aa=Fk(_t),fn=Iy(aa),hn=Iy(aa,[Qe]),Ja=vi($a,fn),Ha=rt?mk(rt,$a):null,me=je&&Ha?x({active:je,collisionRect:Ha,droppableRects:K,droppableContainers:C,pointerCoordinates:Ba}):null,Ce=ok(me,"id"),[Ae,Xe]=v.useState(null),Pe=Bt?$a:vi($a,hn),te=fk(Pe,(c=Ae==null?void 0:Ae.rect)!=null?c:null,Qe),kt=v.useRef(null),Zt=v.useCallback((yt,St)=>{let{sensor:Ht,options:Tt}=St;if(Te.current==null)return;const na=T.get(Te.current);if(!na)return;const Wt=yt.nativeEvent,It=new Ht({active:Te.current,activeNode:na,event:Wt,options:Tt,context:$t,onAbort(et){if(!T.get(et))return;const{onDragAbort:Aa}=P.current,A={id:et};Aa==null||Aa(A),I({type:"onDragAbort",event:A})},onPending(et,wa,Aa,A){if(!T.get(et))return;const{onDragPending:q}=P.current,W={id:et,constraint:wa,initialCoordinates:Aa,offset:A};q==null||q(W),I({type:"onDragPending",event:W})},onStart(et){const wa=Te.current;if(wa==null)return;const Aa=T.get(wa);if(!Aa)return;const{onDragStart:A}=P.current,_={activatorEvent:Wt,active:{id:wa,data:Aa.data,rect:re}};ll.unstable_batchedUpdates(()=>{A==null||A(_),J(Hl.Initializing),z({type:za.DragStart,initialCoordinates:et,active:wa}),I({type:"onDragStart",event:_}),L(kt.current),he(Wt)})},onMove(et){z({type:za.DragMove,coordinates:et})},onEnd:pt(za.DragEnd),onCancel:pt(za.DragCancel)});kt.current=It;function pt(et){return async function(){const{active:Aa,collisions:A,over:_,scrollAdjustedTranslate:q}=$t.current;let W=null;if(Aa&&q){const{cancelDrop:ie}=P.current;W={activatorEvent:Wt,active:Aa,collisions:A,delta:q,over:_},et===za.DragEnd&&typeof ie=="function"&&await Promise.resolve(ie(W))&&(et=za.DragCancel)}Te.current=null,ll.unstable_batchedUpdates(()=>{z({type:et}),J(Hl.Uninitialized),Xe(null),L(null),he(null),kt.current=null;const ie=et===za.DragEnd?"onDragEnd":"onDragCancel";if(W){const ke=P.current[ie];ke==null||ke(W),I({type:ie,event:W})}})}}},[T]),Pa=v.useCallback((yt,St)=>(Ht,Tt)=>{const na=Ht.nativeEvent,Wt=T.get(Tt);if(Te.current!==null||!Wt||na.dndKit||na.defaultPrevented)return;const It={active:Wt};yt(Ht,St.options,It)===!0&&(na.dndKit={capturedBy:St.sensor},Te.current=Tt,Zt(Ht,St))},[T,Zt]),va=Uk(y,Pa);Vk(y),mr(()=>{Qe&&Q===Hl.Initializing&&J(Hl.Initialized)},[Qe,Q]),v.useEffect(()=>{const{onDragMove:yt}=P.current,{active:St,activatorEvent:Ht,collisions:Tt,over:na}=$t.current;if(!St||!Ht)return;const Wt={active:St,activatorEvent:Ht,collisions:Tt,delta:{x:Ja.x,y:Ja.y},over:na};ll.unstable_batchedUpdates(()=>{yt==null||yt(Wt),I({type:"onDragMove",event:Wt})})},[Ja.x,Ja.y]),v.useEffect(()=>{const{active:yt,activatorEvent:St,collisions:Ht,droppableContainers:Tt,scrollAdjustedTranslate:na}=$t.current;if(!yt||Te.current==null||!St||!na)return;const{onDragOver:Wt}=P.current,It=Tt.get(Ce),pt=It&&It.rect.current?{id:It.id,rect:It.rect.current,data:It.data,disabled:It.disabled}:null,et={active:yt,activatorEvent:St,collisions:Ht,delta:{x:na.x,y:na.y},over:pt};ll.unstable_batchedUpdates(()=>{Xe(pt),Wt==null||Wt(et),I({type:"onDragOver",event:et})})},[Ce]),mr(()=>{$t.current={activatorEvent:F,active:je,activeNode:ve,collisionRect:Ha,collisions:me,droppableRects:K,draggableNodes:T,draggingNode:qe,draggingNodeRect:rt,droppableContainers:pe,over:Ae,scrollableAncestors:_t,scrollAdjustedTranslate:Ja},re.current={initial:rt,translated:Ha}},[je,ve,me,Ha,T,qe,rt,K,pe,Ae,_t,Ja]),Mk({...He,delta:fe,draggingRect:Ha,pointerCoordinates:Ba,scrollableAncestors:_t,scrollableAncestorRects:Kt});const qn=v.useMemo(()=>({active:je,activeNode:ve,activeNodeRect:Qe,activatorEvent:F,collisions:me,containerNodeRect:ia,dragOverlay:ce,draggableNodes:T,droppableContainers:pe,droppableRects:K,over:Ae,measureDroppableContainers:ue,scrollableAncestors:_t,scrollableAncestorRects:Kt,measuringConfiguration:B,measuringScheduled:ge,windowRect:Rt}),[je,ve,Qe,F,me,ia,ce,T,pe,K,Ae,ue,_t,Kt,B,ge,Rt]),_e=v.useMemo(()=>({activatorEvent:F,activators:va,active:je,activeNodeRect:Qe,ariaDescribedById:{draggable:se},dispatch:z,draggableNodes:T,over:Ae,measureDroppableContainers:ue}),[F,va,je,Qe,z,se,T,Ae,ue]);return ca.createElement(P0.Provider,{value:$},ca.createElement(sc.Provider,{value:_e},ca.createElement(r1.Provider,{value:qn},ca.createElement(Sd.Provider,{value:te},g)),ca.createElement(eT,{disabled:(h==null?void 0:h.restoreFocus)===!1})),ca.createElement(tk,{...h,hiddenTextDescribedById:se}));function xt(){const yt=(ee==null?void 0:ee.autoScrollEnabled)===!1,St=typeof p=="object"?p.enabled===!1:p===!1,Ht=ne&&!yt&&!St;return typeof p=="object"?{...p,enabled:Ht}:{enabled:Ht}}}),rT=v.createContext(null),Py="button",lT="Draggable";function sT(e){let{id:n,data:r,disabled:s=!1,attributes:u}=e;const c=lc(lT),{activators:f,activatorEvent:h,active:p,activeNodeRect:g,ariaDescribedById:y,draggableNodes:x,over:E}=v.useContext(sc),{role:S=Py,roleDescription:w="draggable",tabIndex:j=0}=u??{},R=(p==null?void 0:p.id)===n,z=v.useContext(R?Sd:rT),[I,$]=Qu(),[Q,J]=Qu(),ne=Yk(f,n),M=Fo(r);mr(()=>(x.set(n,{id:n,key:c,node:I,activatorNode:Q,data:M}),()=>{const fe=x.get(n);fe&&fe.key===c&&x.delete(n)}),[x,n]);const T=v.useMemo(()=>({role:S,tabIndex:j,"aria-disabled":s,"aria-pressed":R&&S===Py?!0:void 0,"aria-roledescription":w,"aria-describedby":y.draggable}),[s,S,j,R,w,y.draggable]);return{active:p,activatorEvent:h,activeNodeRect:g,attributes:T,isDragging:R,listeners:s?void 0:ne,node:I,over:E,setNodeRef:$,setActivatorNodeRef:J,transform:z}}function s1(){return v.useContext(r1)}const iT="Droppable",oT={timeout:25};function cT(e){let{data:n,disabled:r=!1,id:s,resizeObserverConfig:u}=e;const c=lc(iT),{active:f,dispatch:h,over:p,measureDroppableContainers:g}=v.useContext(sc),y=v.useRef({disabled:r}),x=v.useRef(!1),E=v.useRef(null),S=v.useRef(null),{disabled:w,updateMeasurementsFor:j,timeout:R}={...oT,...u},z=Fo(j??s),I=v.useCallback(()=>{if(!x.current){x.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(z.current)?z.current:[z.current]),S.current=null},R)},[R]),$=wd({callback:I,disabled:w||!f}),Q=v.useCallback((T,fe)=>{$&&(fe&&($.unobserve(fe),x.current=!1),T&&$.observe(T))},[$]),[J,ne]=Qu(Q),M=Fo(n);return v.useEffect(()=>{!$||!J.current||($.disconnect(),x.current=!1,$.observe(J.current))},[J,$]),v.useEffect(()=>(h({type:za.RegisterDroppable,element:{id:s,key:c,disabled:r,node:J,rect:E,data:M}}),()=>h({type:za.UnregisterDroppable,key:c,id:s})),[s]),v.useEffect(()=>{r!==y.current.disabled&&(h({type:za.SetDroppableDisabled,id:s,key:c,disabled:r}),y.current.disabled=r)},[s,c,r,h]),{active:f,rect:E,isOver:(p==null?void 0:p.id)===s,node:J,over:p,setNodeRef:ne}}function uT(e){let{animation:n,children:r}=e;const[s,u]=v.useState(null),[c,f]=v.useState(null),h=Ku(r);return!r&&!s&&h&&u(h),mr(()=>{if(!c)return;const p=s==null?void 0:s.key,g=s==null?void 0:s.props.id;if(p==null||g==null){u(null);return}Promise.resolve(n(g,c)).then(()=>{u(null)})},[n,s,c]),ca.createElement(ca.Fragment,null,r,s?v.cloneElement(s,{ref:f}):null)}const dT={x:0,y:0,scaleX:1,scaleY:1};function fT(e){let{children:n}=e;return ca.createElement(sc.Provider,{value:n1},ca.createElement(Sd.Provider,{value:dT},n))}const hT={position:"fixed",touchAction:"none"},mT=e=>bd(e)?"transform 250ms ease":void 0,pT=v.forwardRef((e,n)=>{let{as:r,activatorEvent:s,adjustScale:u,children:c,className:f,rect:h,style:p,transform:g,transition:y=mT}=e;if(!h)return null;const x=u?g:{...g,scaleX:1,scaleY:1},E={...hT,width:h.width,height:h.height,top:h.top,left:h.left,transform:Fl.Transform.toString(x),transformOrigin:u&&s?lk(s,h):void 0,transition:typeof y=="function"?y(s):y,...p};return ca.createElement(r,{className:f,style:E,ref:n},c)}),gT=e=>n=>{let{active:r,dragOverlay:s}=n;const u={},{styles:c,className:f}=e;if(c!=null&&c.active)for(const[h,p]of Object.entries(c.active))p!==void 0&&(u[h]=r.node.style.getPropertyValue(h),r.node.style.setProperty(h,p));if(c!=null&&c.dragOverlay)for(const[h,p]of Object.entries(c.dragOverlay))p!==void 0&&s.node.style.setProperty(h,p);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&s.node.classList.add(f.dragOverlay),function(){for(const[p,g]of Object.entries(u))r.node.style.setProperty(p,g);f!=null&&f.active&&r.node.classList.remove(f.active)}},vT=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:Fl.Transform.toString(n)},{transform:Fl.Transform.toString(r)}]},xT={duration:250,easing:"ease",keyframes:vT,sideEffects:gT({styles:{active:{opacity:"0"}}})};function yT(e){let{config:n,draggableNodes:r,droppableContainers:s,measuringConfiguration:u}=e;return yd((c,f)=>{if(n===null)return;const h=r.get(c);if(!h)return;const p=h.node.current;if(!p)return;const g=a1(f);if(!g)return;const{transform:y}=gn(f).getComputedStyle(f),x=V0(y);if(!x)return;const E=typeof n=="function"?n:bT(n);return W0(p,u.draggable.measure),E({active:{id:c,data:h.data,node:p,rect:u.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:f,rect:u.dragOverlay.measure(g)},droppableContainers:s,measuringConfiguration:u,transform:x})})}function bT(e){const{duration:n,easing:r,sideEffects:s,keyframes:u}={...xT,...e};return c=>{let{active:f,dragOverlay:h,transform:p,...g}=c;if(!n)return;const y={x:h.rect.left-f.rect.left,y:h.rect.top-f.rect.top},x={scaleX:p.scaleX!==1?f.rect.width*p.scaleX/h.rect.width:1,scaleY:p.scaleY!==1?f.rect.height*p.scaleY/h.rect.height:1},E={x:p.x-y.x,y:p.y-y.y,...x},S=u({...g,active:f,dragOverlay:h,transform:{initial:p,final:E}}),[w]=S,j=S[S.length-1];if(JSON.stringify(w)===JSON.stringify(j))return;const R=s==null?void 0:s({active:f,dragOverlay:h,...g}),z=h.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(I=>{z.onfinish=()=>{R==null||R(),I()}})}}let Fy=0;function wT(e){return v.useMemo(()=>{if(e!=null)return Fy++,Fy},[e])}const ST=ca.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:s,style:u,transition:c,modifiers:f,wrapperElement:h="div",className:p,zIndex:g=999}=e;const{activatorEvent:y,active:x,activeNodeRect:E,containerNodeRect:S,draggableNodes:w,droppableContainers:j,dragOverlay:R,over:z,measuringConfiguration:I,scrollableAncestors:$,scrollableAncestorRects:Q,windowRect:J}=s1(),ne=v.useContext(Sd),M=wT(x==null?void 0:x.id),T=l1(f,{activatorEvent:y,active:x,activeNodeRect:E,containerNodeRect:S,draggingNodeRect:R.rect,over:z,overlayNodeRect:R.rect,scrollableAncestors:$,scrollableAncestorRects:Q,transform:ne,windowRect:J}),fe=Zm(E),pe=yT({config:s,draggableNodes:w,droppableContainers:j,measuringConfiguration:I}),we=fe?R.setRef:void 0;return ca.createElement(fT,null,ca.createElement(uT,{animation:pe},x&&M?ca.createElement(pT,{key:M,id:x.id,ref:we,as:h,activatorEvent:y,adjustScale:n,className:p,transition:c,rect:fe,style:{zIndex:g,...u},transform:T},r):null))});function $o(e,n,r){const s=e.slice();return s.splice(r<0?s.length+r:r,0,s.splice(n,1)[0]),s}function ET(e,n){return e.reduce((r,s,u)=>{const c=n.get(s);return c&&(r[u]=c),r},Array(e.length))}function ju(e){return e!==null&&e>=0}function NT(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function jT(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const i1=e=>{let{rects:n,activeIndex:r,overIndex:s,index:u}=e;const c=$o(n,s,r),f=n[u],h=c[u];return!h||!f?null:{x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height}},Ru={scaleX:1,scaleY:1},Wm=e=>{var n;let{activeIndex:r,activeNodeRect:s,index:u,rects:c,overIndex:f}=e;const h=(n=c[r])!=null?n:s;if(!h)return null;if(u===r){const g=c[f];return g?{x:0,y:r<f?g.top+g.height-(h.top+h.height):g.top-h.top,...Ru}:null}const p=RT(c,u,r);return u>r&&u<=f?{x:0,y:-h.height-p,...Ru}:u<r&&u>=f?{x:0,y:h.height+p,...Ru}:{x:0,y:0,...Ru}};function RT(e,n,r){const s=e[n],u=e[n-1],c=e[n+1];return s?r<n?u?s.top-(u.top+u.height):c?c.top-(s.top+s.height):0:c?c.top-(s.top+s.height):u?s.top-(u.top+u.height):0:0}const o1="Sortable",c1=ca.createContext({activeIndex:-1,containerId:o1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:i1,disabled:{draggable:!1,droppable:!1}});function Jm(e){let{children:n,id:r,items:s,strategy:u=i1,disabled:c=!1}=e;const{active:f,dragOverlay:h,droppableRects:p,over:g,measureDroppableContainers:y}=s1(),x=lc(o1,r),E=h.rect!==null,S=v.useMemo(()=>s.map(ne=>typeof ne=="object"&&"id"in ne?ne.id:ne),[s]),w=f!=null,j=f?S.indexOf(f.id):-1,R=g?S.indexOf(g.id):-1,z=v.useRef(S),I=!NT(S,z.current),$=R!==-1&&j===-1||I,Q=jT(c);mr(()=>{I&&w&&y(S)},[I,S,w,y]),v.useEffect(()=>{z.current=S},[S]);const J=v.useMemo(()=>({activeIndex:j,containerId:x,disabled:Q,disableTransforms:$,items:S,overIndex:R,useDragOverlay:E,sortedRects:ET(S,p),strategy:u}),[j,x,Q.draggable,Q.droppable,$,S,R,p,E,u]);return ca.createElement(c1.Provider,{value:J},n)}const kT=e=>{let{id:n,items:r,activeIndex:s,overIndex:u}=e;return $o(r,s,u).indexOf(n)},TT=e=>{let{containerId:n,isSorting:r,wasDragging:s,index:u,items:c,newIndex:f,previousItems:h,previousContainerId:p,transition:g}=e;return!g||!s||h!==c&&u===f?!1:r?!0:f!==u&&n===p},CT={duration:200,easing:"ease"},u1="transform",AT=Fl.Transition.toString({property:u1,duration:0,easing:"linear"}),DT={roleDescription:"sortable"};function OT(e){let{disabled:n,index:r,node:s,rect:u}=e;const[c,f]=v.useState(null),h=v.useRef(r);return mr(()=>{if(!n&&r!==h.current&&s.current){const p=u.current;if(p){const g=Ri(s.current,{ignoreTransform:!0}),y={x:p.left-g.left,y:p.top-g.top,scaleX:p.width/g.width,scaleY:p.height/g.height};(y.x||y.y)&&f(y)}}r!==h.current&&(h.current=r)},[n,r,s,u]),v.useEffect(()=>{c&&f(null)},[c]),c}function MT(e){let{animateLayoutChanges:n=TT,attributes:r,disabled:s,data:u,getNewIndex:c=kT,id:f,strategy:h,resizeObserverConfig:p,transition:g=CT}=e;const{items:y,containerId:x,activeIndex:E,disabled:S,disableTransforms:w,sortedRects:j,overIndex:R,useDragOverlay:z,strategy:I}=v.useContext(c1),$=_T(s,S),Q=y.indexOf(f),J=v.useMemo(()=>({sortable:{containerId:x,index:Q,items:y},...u}),[x,u,Q,y]),ne=v.useMemo(()=>y.slice(y.indexOf(f)),[y,f]),{rect:M,node:T,isOver:fe,setNodeRef:pe}=cT({id:f,data:J,disabled:$.droppable,resizeObserverConfig:{updateMeasurementsFor:ne,...p}}),{active:we,activatorEvent:re,activeNodeRect:je,attributes:Te,setNodeRef:ee,listeners:L,isDragging:F,over:he,setActivatorNodeRef:P,transform:se}=sT({id:f,data:J,attributes:{...DT,...r},disabled:$.draggable}),C=q2(pe,ee),B=!!we,K=B&&!w&&ju(E)&&ju(R),ue=!z&&F,ge=ue&&K?se:null,Re=K?ge??(h??I)({rects:j,activeNodeRect:je,activeIndex:E,overIndex:R,index:Q}):null,He=ju(E)&&ju(R)?c({id:f,items:y,activeIndex:E,overIndex:R}):Q,$e=we==null?void 0:we.id,Qe=v.useRef({activeId:$e,items:y,newIndex:He,containerId:x}),ia=y!==Qe.current.items,$t=n({active:we,containerId:x,isDragging:F,isSorting:B,id:f,index:Q,items:y,newIndex:Qe.current.newIndex,previousItems:Qe.current.items,previousContainerId:Qe.current.containerId,transition:g,wasDragging:Qe.current.activeId!=null}),mt=OT({disabled:!$t,index:Q,node:T,rect:M});return v.useEffect(()=>{B&&Qe.current.newIndex!==He&&(Qe.current.newIndex=He),x!==Qe.current.containerId&&(Qe.current.containerId=x),y!==Qe.current.items&&(Qe.current.items=y)},[B,He,x,y]),v.useEffect(()=>{if($e===Qe.current.activeId)return;if($e!=null&&Qe.current.activeId==null){Qe.current.activeId=$e;return}const qe=setTimeout(()=>{Qe.current.activeId=$e},50);return()=>clearTimeout(qe)},[$e]),{active:we,activeIndex:E,attributes:Te,data:J,rect:M,index:Q,newIndex:He,items:y,isOver:fe,isSorting:B,isDragging:F,listeners:L,node:T,overIndex:R,over:he,setNodeRef:C,setActivatorNodeRef:P,setDroppableNodeRef:pe,setDraggableNodeRef:ee,transform:mt??Re,transition:ce()};function ce(){if(mt||ia&&Qe.current.newIndex===Q)return AT;if(!(ue&&!bd(re)||!g)&&(B||$t))return Fl.Transition.toString({...g,property:u1})}}function _T(e,n){var r,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:n.droppable}}Mt.Down,Mt.Right,Mt.Up,Mt.Left;const LT=[{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 ep({sort:e,onChange:n,label:r="Sort by"}){return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{htmlFor:"sort-control",className:"hidden text-xs text-[var(--text-muted)] sm:inline",children:r}),o.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:[o.jsxs("div",{className:"relative",children:[o.jsx("select",{id:"sort-control",value:e.key,onChange:s=>n({key:s.target.value,direction:e.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:LT.map(s=>o.jsx("option",{value:s.value,children:s.label},s.value))}),o.jsx(js,{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"})]}),o.jsx("button",{type:"button",onClick:()=>n({key:e.key,direction:e.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: ${e.direction}`,title:`Sort direction: ${e.direction}`,children:e.direction==="asc"?o.jsx(nj,{className:"h-3.5 w-3.5","aria-hidden":"true"}):o.jsx(ej,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})}const Ed=[{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"}],Nd=[{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"}],tp=[{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"}],td=tp,d1=[{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"}],Eo=Ed.map(e=>e.value),No=Nd.map(e=>e.value),jo=tp.map(e=>e.value);function Ph(e,n,r){if(e.includes(n)){const s=e.filter(u=>u!==n);return s.length===0?[...r]:s}return[...e,n]}function li(e,n){return n.includes(e)}function fr(e,n){return`agent-plan:dashboard:${e}:${n}`}function Fh(e,n,r){if(typeof window>"u")return n;try{const s=window.localStorage.getItem(e);if(!s)return n;const u=JSON.parse(s);if(!Array.isArray(u))return n;const c=`${e}-schema`,f=r.slice().sort().join(",");if(window.localStorage.getItem(c)!==f)return window.localStorage.setItem(c,f),n;const p=u.filter(g=>typeof g=="string"&&r.includes(g));return p.length>0?p:n}catch{return n}}function Vh(e,n,r){typeof window>"u"||(window.localStorage.setItem(e,JSON.stringify(n)),window.localStorage.setItem(`${e}-schema`,r.slice().sort().join(",")))}function Yh(e,n){if(typeof window>"u")return n;const r=window.localStorage.getItem(e);return r===null?n:r==="true"}const Vy={featureNumbers:null,phaseNumbers:null,taskNumbers:null,shortIds:null,status:null,featureStatus:null,phaseStatus:null,text:null},Yy=/^(feature-status|phase-status|feature|phase|task|id|status|title):(.*)$/i;function f1(e){return e.split(",").map(n=>n.trim()).filter(n=>n.length>0)}function zT(e){return new Set(f1(e).map(n=>Number(n)).filter(n=>Number.isFinite(n)&&n>0))}function Gy(e){const n=e.toUpperCase();return n==="AND"||n==="OR"}function Gh(e,n){const r=e??new Set;for(const s of zT(n))r.add(s);return r}function UT(e,n){const r=e??new Set;for(const s of f1(n).map(u=>u.toUpperCase()))r.add(s);return r}function $T(e){const n=e.trim();if(!n)return{...Vy};const r={...Vy},s=[],u=[];let c=0;for(;c<n.length;){const h=n[c];if(h==='"'){const p=n.indexOf('"',c+1);if(p===-1){u.push(n.slice(c+1));break}u.push(n.slice(c+1,p)),c=p+1}else if(h===" ")c+=1;else{let p=c;for(;p<n.length&&n[p]!==" ";)p+=1;u.push(n.slice(c,p)),c=p}}let f=0;for(;f<u.length;){const h=u[f];if(Gy(h)){f+=1;continue}const p=h.match(Yy);if(p){const g=(p[1]??"").toLowerCase();let y=p[2]??"";if(y.trim()===""&&f+1<u.length){let x=f+1;for(;x<u.length&&Gy(u[x]);)x+=1;x<u.length&&!u[x].match(Yy)&&(y=u[x],f=x)}if(g==="feature"){const x=Gh(r.featureNumbers,y);x.size&&(r.featureNumbers=x)}else if(g==="phase"){const x=Gh(r.phaseNumbers,y);x.size&&(r.phaseNumbers=x)}else if(g==="task"){const x=Gh(r.taskNumbers,y);x.size&&(r.taskNumbers=x)}else if(g==="id"){const x=UT(r.shortIds,y);x.size&&(r.shortIds=x)}else g==="status"?y.trim()&&(r.status=y.toLowerCase()):g==="feature-status"?y.trim()&&(r.featureStatus=y.toLowerCase()):g==="phase-status"?y.trim()&&(r.phaseStatus=y.toLowerCase()):g==="title"&&y.trim()&&(r.text=y.toLowerCase())}else s.push(h.toLowerCase());f+=1}return s.length>0&&!r.text&&(r.text=s.join(" ")),r}function BT(e){return!!(e.featureNumbers||e.phaseNumbers||e.taskNumbers||e.shortIds||e.status||e.featureStatus||e.phaseStatus||e.text)}function h1(e){const n=r=>String(r).padStart(3,"0");return[e.task.title,e.task.shortName??"",e.task.shortId??"",String(e.task.number),`T${n(e.task.number)}`,e.task.description??"",e.task.notes??"",e.phase.title,e.phase.slug??"",e.phase.shortId??"",String(e.phase.number),`P${n(e.phase.number)}`,e.phase.description??"",e.phase.summary??"",e.phase.notes??"",e.feature.name,e.feature.shortId??"",String(e.feature.number),`F${n(e.feature.number)}`,e.feature.description??""].join(" ").toLowerCase()}function HT(e,n,r){if(e.featureNumbers&&!e.featureNumbers.has(n.feature.number)||e.phaseNumbers&&!e.phaseNumbers.has(n.phase.number)||e.taskNumbers&&!e.taskNumbers.has(n.task.number)||e.shortIds&&!(e.shortIds.has(n.task.shortId??"")||e.shortIds.has(n.phase.shortId??"")||e.shortIds.has(n.feature.shortId??""))||e.status&&n.task.status!==e.status||e.featureStatus&&n.feature.status!==e.featureStatus||e.phaseStatus&&n.phase.status!==e.phaseStatus)return!1;if(e.text){const s=e.text;if(!(r??h1(n)).includes(s))return!1}return!0}function IT({features:e,phases:n,projectStorageScope:r}){const s=fr(r,"show-all-features"),u=fr(r,"tree-open-mode"),c=fr(r,"expanded-features"),f=fr(r,"expanded-phases"),h=fr(r,"feature-status-filters"),p=fr(r,"phase-status-filters"),g=fr(r,"task-status-filters"),y=fr(r,"hide-done"),x=fr(r,"hide-planned"),E=fr(r,"only-active-branches"),S=fr(r,"work-tree-sort"),[w,j]=v.useState(""),[R,z]=v.useState(()=>{if(typeof window>"u")return Do;try{const me=window.localStorage.getItem(S);if(!me)return Do;const Ce=JSON.parse(me);if(Ce.key&&Ce.direction)return{key:Ce.key,direction:Ce.direction}}catch{}return Do}),I=v.useMemo(()=>b2(e,n,R),[e,n,R]),$=v.useMemo(()=>$T(w),[w]),Q=BT($),J=v.useMemo(()=>{if(!Q||!$.text)return null;const me=new Map;for(const Ce of I)for(const Ae of Ce.allPhases)for(const Xe of Ae.allTasks)me.set(Xe.id,h1({feature:Ce.feature,phase:Ae.phase,task:Xe}));return me},[Q,$.text,I]),{matchedTaskIds:ne,matchedFeatureIds:M,matchedPhaseIds:T}=v.useMemo(()=>{const me=new Set,Ce=new Set,Ae=new Set;if(!Q)return{matchedTaskIds:me,matchedFeatureIds:Ce,matchedPhaseIds:Ae};for(const Xe of I)for(const Pe of Xe.allPhases)for(const te of Pe.allTasks)HT($,{feature:Xe.feature,phase:Pe.phase,task:te},J==null?void 0:J.get(te.id))&&(me.add(te.id),Ce.add(Xe.feature.id),Ae.add(Pe.phase.id));return{matchedTaskIds:me,matchedFeatureIds:Ce,matchedPhaseIds:Ae}},[Q,$,I,J]),[fe,pe]=v.useState(()=>{if(typeof window>"u")return!0;const me=window.localStorage.getItem(s);return me===null?!0:me==="true"}),[we,re]=v.useState(()=>{if(typeof window>"u")return"all";const me=window.localStorage.getItem(u);return me==="smart"||me==="none"||me==="all"?me:"all"}),[je,Te]=v.useState(()=>{if(typeof window>"u")return[];try{const me=window.localStorage.getItem(c);return me?JSON.parse(me):[]}catch{return[]}}),[ee,L]=v.useState(()=>{if(typeof window>"u")return[];try{const me=window.localStorage.getItem(f);return me?JSON.parse(me):[]}catch{return[]}}),[F,he]=v.useState(()=>Fh(h,Eo,Eo)),[P,se]=v.useState(()=>Fh(p,No,No)),[C,B]=v.useState(()=>Fh(g,jo,jo)),[K,ue]=v.useState(()=>Yh(y,!1)),[ge,ve]=v.useState(()=>Yh(x,!1)),[Re,He]=v.useState(()=>Yh(E,!1)),[$e,Qe]=v.useState([]),[ia,$t]=v.useState([]),[mt,ce]=v.useState([]),qe=v.useRef({});v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(s,String(fe))},[fe,s]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u,we)},[we,u]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(c,JSON.stringify(je))},[je,c]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(f,JSON.stringify(ee))},[ee,f]),v.useEffect(()=>{typeof window>"u"||Vh(h,F,Eo)},[F,h]),v.useEffect(()=>{typeof window>"u"||Vh(p,P,No)},[P,p]),v.useEffect(()=>{typeof window>"u"||Vh(g,C,jo)},[C,g]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(y,String(K))},[K,y]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(x,String(ge))},[ge,x]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(E,String(Re))},[Re,E]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(S,JSON.stringify(R))},[R,S]),v.useEffect(()=>()=>{Object.values(qe.current).forEach(me=>window.clearTimeout(me)),qe.current={}},[]);const rt=v.useMemo(()=>{let me=[...F];return K&&(me=me.filter(Ce=>Ce!=="done")),ge&&(me=me.filter(Ce=>Ce!=="planned")),me},[F,K,ge]),Bt=v.useMemo(()=>{let me=[...P];return K&&(me=me.filter(Ce=>Ce!=="done")),ge&&(me=me.filter(Ce=>Ce!=="planned"&&Ce!=="draft")),me},[P,K,ge]),ga=v.useMemo(()=>{let me=[...C];return K&&(me=me.filter(Ce=>Ce!=="done")),ge&&(me=me.filter(Ce=>Ce!=="planned")),me},[C,K,ge]),Rt=v.useMemo(()=>{if(Q)return I.filter(Ae=>li(Ae.feature.status,rt)).map(Ae=>({...Ae,allPhases:Ae.allPhases.filter(Xe=>li(Xe.phase.status,Bt)).map(Xe=>({...Xe,allTasks:Xe.allTasks.filter(Pe=>ne.has(Pe.id)&&li(Pe.status,ga))})).filter(Xe=>Xe.allTasks.length>0)})).filter(Ae=>Ae.allPhases.length>0);const me=!fe||Re;return(fe?I:I.filter(Ae=>Ae.isActive)).filter(({feature:Ae})=>li(Ae.status,rt)).map(Ae=>({...Ae,allPhases:Ae.allPhases.filter(({phase:Xe,hasActiveTask:Pe})=>li(Xe.status,Bt)?me?Xe.status==="in-progress"||Xe.status==="discovery"||Pe:!0:!1).map(Xe=>({...Xe,allTasks:Xe.allTasks.filter(Pe=>!!li(Pe.status,ga))})).filter(Xe=>Xe.allTasks.length>0||fe||!me)})).filter(({hasActiveTask:Ae,allPhases:Xe})=>me?Ae||Xe.some(Pe=>Pe.hasActiveTask):Xe.length>0||fe)},[Q,ne,I,rt,Bt,ga,Re,fe]);v.useEffect(()=>{if(we==="none"){Te([]),L([]);return}if(we==="all"){Te(Rt.filter(({feature:Ae})=>Ae.status!=="done").map(({feature:Ae})=>Ae.id)),L(Rt.flatMap(({allPhases:Ae})=>Ae.map(({phase:Xe})=>Xe.id)));return}const me=new Set(Rt.map(({feature:Ae})=>Ae.id)),Ce=new Set(Rt.flatMap(({allPhases:Ae})=>Ae.map(({phase:Xe})=>Xe.id)));Te(Ae=>Ae.filter(Xe=>me.has(Xe))),L(Ae=>Ae.filter(Xe=>Ce.has(Xe)))},[Rt,we]),v.useEffect(()=>{Q&&(re("smart"),Te(Array.from(M)),L(Array.from(T)))},[Q,M,T]);const _t=me=>{re("smart"),Te(Ce=>Ce.includes(me)?Ce.filter(Ae=>Ae!==me):[...Ce,me])},Kt=me=>{re("smart"),L(Ce=>Ce.includes(me)?Ce.filter(Ae=>Ae!==me):[...Ce,me])},$a=()=>{re("smart"),Te(Rt.map(({feature:me})=>me.id)),L(Rt.flatMap(({allPhases:me})=>me.map(({phase:Ce})=>Ce.id)))},Ba=()=>{re("smart"),Te([]),L([])},aa=v.useMemo(()=>{const me=new Set(Rt.map(({feature:Pe})=>Pe.id)),Ce=new Set(Rt.flatMap(({allPhases:Pe})=>Pe.map(({phase:te})=>te.id)));if(me.size===0)return!1;const Ae=Array.from(me).every(Pe=>je.includes(Pe)),Xe=Array.from(Ce).every(Pe=>ee.includes(Pe));return Ae&&Xe},[Rt,je,ee]);return v.useEffect(()=>{const me=(Ae,Xe)=>{const Pe=Xe.filter(te=>!!te);for(const te of Pe){const kt=`${Ae}:${te}`,Zt=Ae==="feature"?Qe:Ae==="phase"?$t:ce;Zt(Pa=>Pa.includes(te)?Pa:[...Pa,te]),qe.current[kt]!==void 0&&window.clearTimeout(qe.current[kt]),qe.current[kt]=window.setTimeout(()=>{Zt(Pa=>Pa.filter(va=>va!==te)),delete qe.current[kt]},p2)}},Ce=Ae=>{var te,kt,Zt,Pa,va,qn;const Pe=Ae.detail;if(Pe!=null&&Pe.type){if(Pe.type==="features-updated"){const _e=((te=Pe.data)==null?void 0:te.featureId)??((kt=Pe.data)==null?void 0:kt.id);me("feature",[_e]),_e&&(re("smart"),Te(xt=>xt.includes(_e)?xt:[...xt,_e]));return}if(Pe.type==="phases-updated"){const _e=(Zt=Pe.data)==null?void 0:Zt.featureId,xt=((Pa=Pe.data)==null?void 0:Pa.phaseId)??((va=Pe.data)==null?void 0:va.id);me("phase",[xt]),me("feature",[_e]),me("task",[(qn=Pe.data)==null?void 0:qn.taskId]),re("smart"),_e&&Te(yt=>yt.includes(_e)?yt:[...yt,_e]),xt&&L(yt=>yt.includes(xt)?yt:[...yt,xt])}}};return window.addEventListener("agent-plan:ws-event",Ce),()=>{window.removeEventListener("agent-plan:ws-event",Ce)}},[]),{workTree:I,displayedWorkTree:Rt,treeOpenMode:we,setTreeOpenMode:re,expandAll:$a,collapseAll:Ba,isAllExpanded:aa,expandedFeatureIds:je,expandedPhaseIds:ee,setExpandedFeatureIds:Te,setExpandedPhaseIds:L,toggleExpandedFeature:_t,toggleExpandedPhase:Kt,recentFeatureIds:$e,recentPhaseIds:ia,recentTaskIds:mt,setRecentTaskIds:ce,showAllFeatures:fe,setShowAllFeatures:pe,featureStatusFilters:F,phaseStatusFilters:P,taskStatusFilters:C,hideDone:K,setHideDone:ue,hidePlanned:ge,setHidePlanned:ve,onlyActiveBranches:Re,setOnlyActiveBranches:He,resetFilters:()=>{j(""),pe(!0),ue(!1),ve(!1),he(Eo),se(No),B(jo),He(!1),z(Do),re("all")},toggleFeatureStatusFilter:me=>he(Ce=>Ph(Ce,me,Eo)),togglePhaseStatusFilter:me=>se(Ce=>Ph(Ce,me,No)),toggleTaskStatusFilter:me=>B(Ce=>Ph(Ce,me,jo)),searchQuery:w,setSearchQuery:j,searchActive:Q,matchedTaskIds:ne,matchedFeatureIds:M,matchedPhaseIds:T,sort:R,setSort:z}}function ki({id:e,status:n,variant:r="header",className:s,children:u,ariaLabel:c}){const f=r==="surface"?AR(n):DR(n),h=Im(n),p=["status-item",r==="surface"?"status-item--surface":"status-item--header",h,s??""].filter(Boolean).join(" ");return o.jsx("div",{id:e,className:p,style:f,"aria-label":c,"data-status":n,children:u})}function il(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}function dl({value:e,className:n=""}){if(!e)return null;const r=`Last updated ${il(e)}`;return o.jsx("time",{dateTime:e,title:r,"aria-label":r,className:`text-[11px] text-[var(--text-subtle)] ${n}`.trim(),children:r})}const m1=v.createContext(null);function ap({id:e,children:n}){const r=MT({id:e}),s={transform:Fl.Transform.toString(r.transform),transition:r.transition};return o.jsx(m1.Provider,{value:r,children:o.jsx("div",{ref:r.setNodeRef,style:s,className:r.isDragging?"ap-sortable--dragging":"",children:n})})}function np(){const e=v.useContext(m1);return e?o.jsx("button",{type:"button",className:"drag-handle","aria-label":"Drag to reorder",title:"Drag to reorder",...e.listeners,...e.attributes,children:o.jsx(_j,{className:"h-4 w-4"})}):null}function p1({phaseId:e,phaseTitle:n,count:r,className:s=""}){if(r<1)return null;const u=`${r} linked requirement${r===1?"":"s"} for phase ${n}`;return o.jsxs(Ye,{to:`/requirements#phase-${e}`,"aria-label":u,title:u,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:[o.jsx(Jo,{"aria-hidden":"true",className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{"aria-hidden":"true",children:r})]})}const rp="mt-1 block min-w-0 break-words font-mono text-sm font-semibold leading-snug [overflow-wrap:anywhere]";function qT(){return o.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 Xy({status:e,doneTasks:n,totalTasks:r,recentlyChanged:s,className:u}){const c=n!=null&&r!=null;return o.jsxs("div",{className:u,children:[s?o.jsx(qT,{}):null,c?o.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",n,"/",r||0,")"]}):null,o.jsx("span",{className:"shrink-0",children:o.jsx(ar,{status:e})})]})}function PT({entry:e,expanded:n,recentlyChanged:r,onToggle:s,isPhaseExpanded:u,onTogglePhase:c,isPhaseRecentlyChanged:f,isTaskRecentlyChanged:h,highlightedTaskIds:p,resumeRequiredIds:g=new Set}){const{feature:y,totalTasks:x,doneTasks:E,allPhases:S,hasActiveTask:w}=e;return o.jsxs("div",{className:`surface-card min-w-0 rounded-[10px] px-3 py-3 transition-colors sm:px-4 ${r?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[o.jsxs(ki,{status:e.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 ${r?"bg-[color:color-mix(in_srgb,var(--accent)_10%,transparent)]":""}`,children:[o.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[o.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),s()},onPointerDown:j=>j.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":n?`Collapse feature ${y.name}`:`Expand feature ${y.name}`,"aria-expanded":n,children:o.jsx(i0,{className:`h-4 w-4 transition ${n?"rotate-90":"rotate-0"}`})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(np,{}),o.jsx(rr,{featureNum:y.number,featureId:y.id}),o.jsx(sr,{id:cl({featureNum:y.number}),children:o.jsx("span",{className:"sr-only",children:"Copy feature path"})}),y.shortId?o.jsx(ul,{shortId:y.shortId}):null,w?o.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),o.jsx(Yu,{status:e.display.displayStatus,breakdown:e.display.breakdown,doneTasks:E,totalTasks:x,recentlyChanged:r,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),o.jsx(Ye,{to:`/features/${y.id}`,className:`entity-link--feature ${rp} underline-offset-4 hover:underline`,children:y.name}),o.jsx(dl,{value:y.updatedAt,className:"mt-1 block"})]})]}),o.jsx(Yu,{status:e.display.displayStatus,breakdown:e.display.breakdown,doneTasks:E,totalTasks:x,recentlyChanged:r,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),n&&S.length>0?o.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:w0(e.display.displayStatus)},children:o.jsx(Jm,{items:S.map(j=>j.phase.id),strategy:Wm,children:S.map(j=>o.jsx(ap,{id:j.phase.id,children:o.jsx(FT,{feature:y,phaseEntry:j,expanded:u(j.phase.id),recentlyChanged:f(j.phase.id),onToggle:()=>c(j.phase.id),isTaskRecentlyChanged:h,highlightedTaskIds:p,resumeRequiredIds:g})},j.phase.id))})}):null]})}function FT({feature:e,phaseEntry:n,expanded:r,recentlyChanged:s,onToggle:u,isTaskRecentlyChanged:c,highlightedTaskIds:f,resumeRequiredIds:h=new Set}){var S;const{phase:p,totalTasks:g,doneTasks:y,allTasks:x,hasActiveTask:E}=n;return o.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:[o.jsxs(ki,{status:n.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:[o.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[o.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),u()},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":r?`Collapse phase ${p.title}`:`Expand phase ${p.title}`,"aria-expanded":r,children:o.jsx(i0,{className:`h-4 w-4 transition ${r?"rotate-90":"rotate-0"}`})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(np,{}),o.jsx(rr,{featureNum:e==null?void 0:e.number,phaseNum:p.number,featureId:e.id,phaseId:p.id}),o.jsx(sr,{id:cl({featureNum:e==null?void 0:e.number,phaseNum:p.number}),children:o.jsx("span",{className:"sr-only",children:"Copy phase path"})}),p.shortId?o.jsx(ul,{shortId:p.shortId}):null,p.handoff?o.jsx(Hm,{phaseId:p.id,updatedAt:p.handoffUpdatedAt}):null,o.jsx(p1,{phaseId:p.id,phaseTitle:p.title,count:((S=p.linkedRequirements)==null?void 0:S.length)??0}),E?o.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),o.jsx(Yu,{status:n.display.displayStatus,breakdown:n.display.breakdown,doneTasks:y,totalTasks:g,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),o.jsx(Ye,{to:`/features/${e.id}/phases/${p.id}`,className:`entity-link--phase ${rp} underline-offset-4 hover:underline`,children:p.title}),o.jsx(dl,{value:p.updatedAt,className:"mt-1 block"})]})]}),o.jsx(Yu,{status:n.display.displayStatus,breakdown:n.display.breakdown,doneTasks:y,totalTasks:g,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),r?x.length>0?o.jsx("div",{className:"ml-1.5 grid grid-cols-1 gap-1 border-l pl-3 sm:ml-4 sm:pl-4",style:{borderLeftColor:w0(n.display.displayStatus)},children:o.jsx(Jm,{items:x.map(w=>w.id),strategy:Wm,children:x.map(w=>o.jsx(ap,{id:w.id,children:o.jsx(VT,{feature:e,phase:p,task:w,recentlyChanged:c(w.id),highlighted:f==null?void 0:f.has(w.id),resumeRequiredIds:h})},w.id))})}):o.jsx("p",{className:"ml-1.5 text-xs italic text-[var(--text-subtle)] sm:ml-4",children:"No tasks"}):null]})}function VT({feature:e,phase:n,task:r,recentlyChanged:s,highlighted:u,resumeRequiredIds:c=new Set}){return o.jsxs(ki,{id:`task-row-${r.number}`,status:r.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)]":""} ${u?"ap-search-hit":""}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(np,{}),o.jsx(rr,{featureNum:e==null?void 0:e.number,phaseNum:n.number,taskNum:r.number,featureId:e.id,phaseId:n.id,taskId:r.id}),o.jsx(sr,{id:cl({featureNum:e==null?void 0:e.number,phaseNum:n.number,taskNum:r.number}),children:o.jsx("span",{className:"sr-only",children:"Copy task path"})}),r.shortId?o.jsx(ul,{shortId:r.shortId}):null,r.status==="in-progress"?o.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null,c!=null&&c.has(r.id)?o.jsx("span",{title:"Paused and ready for resume — resume this task before starting new work.","aria-label":"Resume required",className:"inline-flex items-center text-[var(--accent)]",children:o.jsx(u0,{className:"h-3.5 w-3.5"})}):null]}),o.jsx(Xy,{status:r.status,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),o.jsx(Ye,{to:`/features/${e.id}/phases/${n.id}/tasks/${r.id}`,className:`entity-link--task ${rp} underline-offset-4 hover:underline`,children:r.title}),o.jsx(dl,{value:r.updatedAt,className:"mt-1 block"})]}),o.jsx(Xy,{status:r.status,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]})}var O=(function(e){return e.FIELD_NAME="FIELD_NAME",e.COLON="COLON",e.VALUE="VALUE",e.QUOTED_VALUE="QUOTED_VALUE",e.AND="AND",e.OR="OR",e.NOT="NOT",e.COMPARISON_OP="COMPARISON_OP",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.SAVED_SEARCH="SAVED_SEARCH",e.HISTORY_REF="HISTORY_REF",e.PREFIX_OP="PREFIX_OP",e.WILDCARD="WILDCARD",e.REGEX="REGEX",e.RANGE="RANGE",e.TILDE="TILDE",e.BOOST="BOOST",e.WHITESPACE="WHITESPACE",e.UNKNOWN="UNKNOWN",e})({}),on=(function(e){return e[e.EXPECT_TERM=0]="EXPECT_TERM",e[e.EXPECT_VALUE=1]="EXPECT_VALUE",e})(on||{}),pi=class{constructor(e,n){ma(this,"input");ma(this,"pos");ma(this,"state");ma(this,"tokens");ma(this,"options");this.input=e,this.pos=0,this.state=on.EXPECT_TERM,this.tokens=[],this.options=n||{}}tokenize(){for(this.tokens=[],this.pos=0,this.state=on.EXPECT_TERM;this.pos<this.input.length;)this.state===on.EXPECT_VALUE?this.readValue():this.readTerm();return this.tokens}peek(){return this.input[this.pos]}peekAt(e){return this.input[this.pos+e]}advance(){return this.input[this.pos++]}isWhitespace(e){return e===" "||e===" "||e===`
303
- `||e==="\r"}isAlpha(e){return/[a-zA-Z_]/.test(e)}isAlphaNumeric(e){return/[a-zA-Z0-9_.\-]/.test(e)}readWhitespace(){const e=this.pos;for(;this.pos<this.input.length&&this.isWhitespace(this.peek());)this.advance();this.tokens.push({type:O.WHITESPACE,value:this.input.slice(e,this.pos),start:e,end:this.pos})}readQuotedString(){const e=this.pos,n=this.advance();for(;this.pos<this.input.length;){const r=this.advance();if(r==="\\"&&this.pos<this.input.length)this.advance();else if(r===n)break}this.tokens.push({type:O.QUOTED_VALUE,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.tryReadModifier(),this.state=on.EXPECT_TERM}readTerm(){const e=this.peek();if(this.isWhitespace(e)){this.readWhitespace();return}if(e==='"'){this.readQuotedString();return}if(e==="("){this.tokens.push({type:O.LPAREN,value:"(",start:this.pos,end:this.pos+1}),this.advance();return}if(e===")"){this.tokens.push({type:O.RPAREN,value:")",start:this.pos,end:this.pos+1}),this.advance();return}if(e==="~"||e==="^"){const r=this.pos,s=e==="~"?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(r,this.pos),start:r,end:this.pos});return}if(e==="["||e==="{"){this.readRangeValue();return}if(e==="#"&&this.options.savedSearches){this.readSavedSearch();return}if(e==="!"&&this.options.historySearch){this.readHistoryRef();return}if(e==="-"||e==="+"){const r=this.peekAt(1);if(r&&(this.isAlpha(r)||r==='"'||r==="("||r==="#"||r==="!"||r==="["||r==="{")||!r||r===")"||r===" "||r===" "||r===`
304
- `||r==="\r"){this.tokens.push({type:O.PREFIX_OP,value:e,start:this.pos,end:this.pos+1}),this.advance();return}}if(e==="&"&&this.peekAt(1)==="&"){this.tokens.push({type:O.AND,value:"&&",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if(e==="|"&&this.peekAt(1)==="|"){this.tokens.push({type:O.OR,value:"||",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if((e===">"||e==="<")&&this.state===on.EXPECT_TERM){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos}),this.state=on.EXPECT_VALUE;return}if(e==="/"){this.readRegex();return}const n=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>n&&this.tokens.push({type:O.FIELD_NAME,value:this.input.slice(n,this.pos),start:n,end:this.pos}),this.tokens.push({type:O.COLON,value:":",start:this.pos,end:this.pos+1}),this.advance(),this.state=on.EXPECT_VALUE;return}this.advance()}if(this.pos>n){const r=this.input.slice(n,this.pos),s=r.toUpperCase();s==="AND"?this.tokens.push({type:O.AND,value:r,start:n,end:this.pos}):s==="OR"?this.tokens.push({type:O.OR,value:r,start:n,end:this.pos}):s==="NOT"?this.tokens.push({type:O.NOT,value:r,start:n,end:this.pos}):r.includes("*")||r.includes("?")?this.tokens.push({type:O.WILDCARD,value:r,start:n,end:this.pos}):this.tokens.push({type:O.VALUE,value:r,start:n,end:this.pos}),this.tryReadModifier()}}readValue(){const e=this.peek();if(this.isWhitespace(e)){this.readWhitespace(),this.state=on.EXPECT_TERM;return}if(e==='"'){this.readQuotedString(),this.state=on.EXPECT_TERM;return}if(e==="("||e===")"){this.state=on.EXPECT_TERM,this.readTerm();return}if(e===">"||e==="<"){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos});return}if(e==="["||e==="{"){this.readRangeValue();return}if(e==="/"){this.readRegex(),this.state=on.EXPECT_TERM;return}const n=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>n){const r=this.input.slice(n,this.pos);r.includes("*")||r.includes("?")?this.tokens.push({type:O.WILDCARD,value:r,start:n,end:this.pos}):this.tokens.push({type:O.VALUE,value:r,start:n,end:this.pos}),this.tryReadModifier()}this.state=on.EXPECT_TERM}readRangeValue(){const e=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(e,this.pos),start:e,end:this.pos}),this.state=on.EXPECT_TERM}tryReadModifier(){for(;this.pos<this.input.length&&(this.peek()==="~"||this.peek()==="^");){const e=this.pos,n=this.advance()==="~"?O.TILDE:O.BOOST;for(;this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:n,value:this.input.slice(e,this.pos),start:e,end:this.pos})}}readRegex(){const e=this.pos;for(this.advance();this.pos<this.input.length;){const n=this.peek();if(n==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(n==="/"){this.advance(),this.tokens.push({type:O.REGEX,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.tryReadModifier(),this.state=on.EXPECT_TERM;return}this.advance()}this.tokens.push({type:O.VALUE,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.state=on.EXPECT_TERM}readSavedSearch(){const e=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(e,this.pos),start:e,end:this.pos})}readHistoryRef(){const e=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(e,this.pos),start:e,end:this.pos})}},ys=class{constructor(e){ma(this,"tokens");ma(this,"pos");ma(this,"nonWsTokens");ma(this,"errors",[]);this.tokens=e,this.nonWsTokens=e.filter(n=>n.type!==O.WHITESPACE),this.pos=0}getErrors(){return this.errors}isUnclosedQuote(e){if(e.type!==O.QUOTED_VALUE)return!1;const n=e.value;if(n.length<2)return!0;const r=n[0];return n[n.length-1]!==r}stripQuotes(e){const n=e.value;return this.isUnclosedQuote(e)?n.slice(1):n.slice(1,-1)}checkUnclosedQuote(e){this.isUnclosedQuote(e)&&this.errors.push({type:"Error",value:e.value[0],message:"Missing closing quote",start:e.start,end:e.start+1})}parse(){if(this.nonWsTokens.length===0)return null;let e=this.parseOr();for(;this.peek();){const n=this.peek();if(n.type===O.RPAREN)this.advance(),this.errors.push({type:"Error",value:n.value,message:"Unexpected closing parenthesis",start:n.start,end:n.end});else{const r=this.parseOr();e={type:"BooleanExpr",operator:"AND",left:e,right:r,implicit:!0,start:e.start,end:r.end}}}return e}peek(){return this.nonWsTokens[this.pos]}advance(){return this.nonWsTokens[this.pos++]}match(e){var n;if(((n=this.peek())==null?void 0:n.type)===e)return this.advance()}parseOr(){var n;let e=this.parseAnd();for(;((n=this.peek())==null?void 0:n.type)===O.OR;){const r=this.advance(),s=this.parseAnd();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after OR",start:r.start,end:r.end});break}e={type:"BooleanExpr",operator:"OR",left:e,right:s,sourceOperator:r.value,start:e.start,end:s.end}}return e}parseAnd(){let e=this.parseNot();for(;;){const n=this.peek();if(!n)break;if(n.type===O.AND){const r=this.advance(),s=this.parseNot();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after AND",start:r.start,end:r.end});break}e={type:"BooleanExpr",operator:"AND",left:e,right:s,sourceOperator:r.value,start:e.start,end:s.end}}else{if(n.type===O.OR||n.type===O.RPAREN)break;{const r=this.parseNot();e={type:"BooleanExpr",operator:"AND",left:e,right:r,implicit:!0,start:e.start,end:r.end}}}}return e}parseNot(){var e;if(((e=this.peek())==null?void 0:e.type)===O.NOT){const n=this.advance(),r=this.parsePrimary();return r.type==="Error"&&r.value===""?(this.errors.push({type:"Error",value:n.value,message:"Missing search term after NOT",start:n.start,end:n.end}),r):{type:"Not",expression:r,sourceOperator:n.value,start:n.start,end:r.end}}return this.parsePrimary()}applyGroupBoost(e){var n;if(((n=this.peek())==null?void 0:n.type)===O.BOOST){const r=this.advance(),s=r.value.slice(1),u=parseFloat(s);e.boost=isNaN(u)?1:u,e.end=r.end}return e}applyModifiers(e){var n,r;if(e.type!=="BareTerm"&&e.type!=="FieldValue")return e;if(((n=this.peek())==null?void 0:n.type)===O.TILDE){const s=this.advance(),u=s.value.slice(1),c=parseInt(u,10);e.quoted?e.proximity=isNaN(c)?0:c:e.fuzzy=isNaN(c)?0:c,e.end=s.end}if(((r=this.peek())==null?void 0:r.type)===O.BOOST){const s=this.advance(),u=s.value.slice(1),c=parseFloat(u);e.boost=isNaN(c)?1:c,e.end=s.end}return e}parseRangeBound(e,n){const r=e.length-e.trimStart().length,s=e.trim();return s.startsWith('"')&&s.endsWith('"')&&s.length>=2?{value:s.slice(1,-1),quoted:!0,valueStart:n+r,valueEnd:n+r+s.length}:s.startsWith('"')?{value:s.slice(1),quoted:!0,valueStart:n+r,valueEnd:n+r+s.length}:{value:s,quoted:!1,valueStart:n+r,valueEnd:n+r+s.length}}parseRange(e){const n=e.value,r=n[0],s=r==="[",u=n[n.length-1],c=u==="]"||u==="}",f=u==="]";c||this.errors.push({type:"Error",value:r,message:"Unclosed range expression",start:e.start,end:e.start+1});const h=c?n.slice(1,-1):n.slice(1),p=h.match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/),g=e.start+1;if(!p){this.errors.push({type:"Error",value:n,message:"Range expression missing TO keyword",start:e.start,end:e.end});const S=this.parseRangeBound(h,g);return{type:"Range",lower:S.value,upper:"",lowerInclusive:s,upperInclusive:c?f:!0,lowerQuoted:S.quoted,upperQuoted:!1,lowerStart:S.valueStart,lowerEnd:S.valueEnd,upperStart:e.end,upperEnd:e.end,start:e.start,end:e.end}}const y=this.parseRangeBound(p[1],g),x=g+p[1].length+(h.length-p[1].length-p[2].length),E=this.parseRangeBound(p[2],x);return{type:"Range",lower:y.value,upper:E.value,lowerInclusive:s,upperInclusive:c?f:!0,lowerQuoted:y.quoted,upperQuoted:E.quoted,lowerStart:y.valueStart,lowerEnd:y.valueEnd,upperStart:E.valueStart,upperEnd:E.valueEnd,start:e.start,end:e.end}}parsePrimary(){var r,s,u;const e=this.peek();if(!e)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(e.type===O.AND){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected AND",start:c.start,end:c.end}),this.parsePrimary()}if(e.type===O.OR){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected OR",start:c.start,end:c.end}),this.parsePrimary()}if(e.type===O.PREFIX_OP){const c=this.advance(),f=this.parsePrimary();return c.value==="-"?{type:"Not",expression:f,sourceOperator:c.value,start:c.start,end:f.end}:{...f,start:c.start}}if(e.type===O.LPAREN){const c=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const g=this.match(O.RPAREN);g||this.errors.push({type:"Error",value:c.value,message:"Unclosed parenthesis",start:c.start,end:c.end});const y={type:"Group",expression:{type:"BareTerm",value:"",quoted:!1,start:c.end,end:c.end},start:c.start,end:g?g.end:c.end};return this.applyGroupBoost(y)}const f=this.parseOr(),h=this.match(O.RPAREN);h||this.errors.push({type:"Error",value:c.value,message:"Missing closing parenthesis",start:c.start,end:c.end});const p={type:"Group",expression:f,start:c.start,end:h?h.end:f.end};return this.applyGroupBoost(p)}if(e.type===O.SAVED_SEARCH){const c=this.advance();return{type:"SavedSearch",name:c.value.slice(1),start:c.start,end:c.end}}if(e.type===O.HISTORY_REF){const c=this.advance();return{type:"HistoryRef",ref:c.value.slice(1),start:c.start,end:c.end}}if(e.type===O.FIELD_NAME){const c=this.advance(),f=this.match(O.COLON);if(f){let h=":";const p=this.match(O.COMPARISON_OP);if(p&&(h=p.value),((r=this.peek())==null?void 0:r.type)===O.LPAREN){const y=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const w=this.match(O.RPAREN);w||this.errors.push({type:"Error",value:y.value,message:"Unclosed parenthesis",start:y.start,end:y.end});const j={type:"FieldGroup",field:c.value,expression:{type:"BareTerm",value:"",quoted:!1,start:y.end,end:y.end},start:c.start,end:w?w.end:y.end};return this.applyGroupBoost(j)}const x=this.parseOr(),E=this.match(O.RPAREN);E||this.errors.push({type:"Error",value:y.value,message:"Missing closing parenthesis",start:y.start,end:y.end});const S={type:"FieldGroup",field:c.value,expression:x,start:c.start,end:E?E.end:x.end};return this.applyGroupBoost(S)}if(((s=this.peek())==null?void 0:s.type)===O.RANGE){const y=this.advance(),x=this.parseRange(y);return x.field=c.value,x.start=c.start,x}if(((u=this.peek())==null?void 0:u.type)===O.REGEX){const y=this.advance();return{type:"Regex",pattern:y.value.slice(1,-1),start:c.start,end:y.end}}const g=this.peek();if(g&&(g.type===O.VALUE||g.type===O.QUOTED_VALUE||g.type===O.WILDCARD)){const y=this.advance(),x=y.type===O.QUOTED_VALUE;x&&this.checkUnclosedQuote(y);const E=x?this.stripQuotes(y):y.value;return this.applyModifiers({type:"FieldValue",field:c.value,operator:h,value:E,quoted:x,start:c.start,end:y.end})}return{type:"FieldValue",field:c.value,operator:h,value:"",quoted:!1,start:c.start,end:p?p.end:f.end}}return{type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end}}if(e.type===O.COMPARISON_OP){const c=this.advance(),f=this.peek();if(f&&(f.type===O.VALUE||f.type===O.QUOTED_VALUE)){const h=this.advance();return{type:"BareTerm",value:c.value+h.value,quoted:!1,start:c.start,end:h.end}}return{type:"Error",value:c.value,message:"Comparison operator without value",start:c.start,end:c.end}}if(e.type===O.QUOTED_VALUE){const c=this.advance();return this.checkUnclosedQuote(c),this.applyModifiers({type:"BareTerm",value:this.stripQuotes(c),quoted:!0,start:c.start,end:c.end})}if(e.type===O.WILDCARD){const c=this.advance();return this.applyModifiers({type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end})}if(e.type===O.RANGE){const c=this.advance();return this.parseRange(c)}if(e.type===O.REGEX){const c=this.advance();return{type:"Regex",pattern:c.value.slice(1,-1),start:c.start,end:c.end}}if(e.type===O.VALUE){const c=this.advance();return this.applyModifiers({type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end})}if(e.type===O.RPAREN){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected closing parenthesis",start:c.start,end:c.end}),{type:"Error",value:c.value,message:"Unexpected closing parenthesis",start:c.start,end:c.end}}const n=this.advance();return{type:"Error",value:n.value,message:`Unexpected token: ${n.value}`,start:n.start,end:n.end}}static getCursorContext(e,n){let r,s;for(const c of e)if(c.type!==O.WHITESPACE){if(n>=c.start&&n<=c.end){r=c;break}c.end<=n&&(s=c)}const u=c=>{let f=0;for(let h=c;h>=0;h--){const p=e[h];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=h-1;g>=0;g--)if(e[g].type!==O.WHITESPACE){if(e[g].type===O.COLON){for(let y=g-1;y>=0;y--)if(e[y].type!==O.WHITESPACE){if(e[y].type===O.FIELD_NAME)return e[y].value;break}}break}}}}return""};if((r==null?void 0:r.type)===O.COLON){let c="";const f=e.indexOf(r);for(let h=f-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){c=e[h].value;break}if(e[h].type!==O.WHITESPACE)break}if(!c&&n===r.start)return{type:"FIELD_NAME",partial:"",token:r};if(n===r.end){for(let h=f+1;h<e.length;h++)if(e[h].type!==O.WHITESPACE){if(e[h].type===O.VALUE||e[h].type===O.QUOTED_VALUE||e[h].type===O.WILDCARD||e[h].type===O.RANGE)return{type:"FIELD_VALUE",partial:e[h].type===O.QUOTED_VALUE?e[h].value.slice(1,e[h].value.endsWith('"')||e[h].value.endsWith("'")?-1:void 0):e[h].value,fieldName:c,token:e[h]};break}}return{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}}if((r==null?void 0:r.type)===O.SAVED_SEARCH)return{type:"SAVED_SEARCH",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===O.HISTORY_REF)return{type:"HISTORY_REF",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===O.RANGE){const c=e.indexOf(r);let f="";for(let h=c-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){f=e[h].value;break}if(!(e[h].type===O.WHITESPACE||e[h].type===O.COLON))break}return{type:"RANGE",partial:"",fieldName:f,token:r}}if((s==null?void 0:s.type)===O.COLON||(s==null?void 0:s.type)===O.COMPARISON_OP){const c=e.indexOf(s);let f="";for(let h=c-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){f=e[h].value;break}if(!(e[h].type===O.WHITESPACE||e[h].type===O.COLON||e[h].type===O.COMPARISON_OP))break}return r&&(r.type===O.VALUE||r.type===O.QUOTED_VALUE||r.type===O.WILDCARD)?{type:"FIELD_VALUE",partial:r.type===O.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:f,token:r}:{type:"FIELD_VALUE",partial:"",fieldName:f,token:s}}if((r==null?void 0:r.type)===O.VALUE||(r==null?void 0:r.type)===O.QUOTED_VALUE||(r==null?void 0:r.type)===O.WILDCARD){const c=e.indexOf(r);for(let f=c-1;f>=0;f--)if(e[f].type!==O.WHITESPACE){if(e[f].type===O.COLON||e[f].type===O.COMPARISON_OP){let h="";for(let p=f-1;p>=0;p--){if(e[p].type===O.FIELD_NAME){h=e[p].value;break}if(!(e[p].type===O.WHITESPACE||e[p].type===O.COLON||e[p].type===O.COMPARISON_OP))break}return{type:"FIELD_VALUE",partial:r.type===O.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:h,token:r}}break}}if((r==null?void 0:r.type)===O.QUOTED_VALUE)return{type:"FIELD_NAME",partial:r.value,token:r};if((r==null?void 0:r.type)===O.FIELD_NAME||(r==null?void 0:r.type)===O.VALUE){const c=u(e.indexOf(r));return c?{type:"FIELD_VALUE",partial:r.value,fieldName:c,token:r}:{type:"FIELD_NAME",partial:r.value,token:r}}if((s==null?void 0:s.type)===O.PREFIX_OP){const c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,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 c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(e.length===0||e.every(c=>c.type===O.WHITESPACE))return{type:"EMPTY",partial:""};if((r==null?void 0:r.type)===O.LPAREN||(s==null?void 0:s.type)===O.LPAREN){const c=(r==null?void 0:r.type)===O.LPAREN?r:s,f=u(e.indexOf(c));return f?{type:"FIELD_VALUE",partial:"",fieldName:f,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if((r==null?void 0:r.type)===O.TILDE||(r==null?void 0:r.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 c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}:{type:"OPERATOR",partial:""}}return{type:"FIELD_NAME",partial:"",token:void 0}}};function gm(e,n){if(n<e.start||n>e.end)return null;if(e.type==="BooleanExpr"){const r=gm(e.left,n);if(r)return r;const s=gm(e.right,n);return s||null}return e}function YT(e,n,r){if(!e)return null;const s=gm(e,r);if(!s)return null;let u=s.start,c=s.end;const f=n.slice(c).match(/^(\s+(?:AND|OR|&&|\|\|)\s+|\s+)(?=\S)/i);if(f)return c+=f[0].length,{start:u,end:c};const h=n.slice(0,u).match(/(\s+(?:AND|OR|&&|\|\|)\s+|\s+)$/i);return h&&h.index!==void 0&&h.index>0&&(u-=h[0].length),{start:u,end:c}}var GT={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:{}},XT={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"},QT=["AND","OR","NOT"];function Qy(e){return e.replace(/\r\n/g,`
305
- `).replace(/\r/g,`
306
- `).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,n=>String.fromCharCode(n.charCodeAt(0)-65248))}var Ky={"(":")","[":"]",'"':'"',"'":"'"};function KT(e,n,r,s,u){const c=e.slice(0,n),f=e.slice(n,r),h=e.slice(r);return{newValue:c+s+f+u+h,newCursorPos:r+2,newSelStart:n+1,newSelEnd:r+1}}function ZT(e){if(!e.textContent)return"";const n=[];function r(s){var u;if(s.nodeType===Node.TEXT_NODE)n.push(s.textContent||"");else if(s.nodeName==="BR")(u=s.hasAttribute)!=null&&u.call(s,"data-sentinel")||n.push(`
307
- `);else for(let c=0;c<s.childNodes.length;c++)r(s.childNodes[c])}return r(e),n.join("")}function Zy(e,n,r){let s=-1,u=-1;for(let c=0;c<e.length;c++){const f=e[c];n>=f.start&&n<=f.end&&(s=c),u===-1&&r>=f.start&&r<=f.end&&(u=c)}return[s,u]}function WT(e,n,r){if(e){let s=e.end;if(e.type===O.FIELD_NAME&&r){const u=r.indexOf(e);if(u>=0){for(let c=u+1;c<r.length;c++)if(r[c].type!==O.WHITESPACE){r[c].type===O.COLON&&(s=r[c].end);break}}}return{start:e.start,end:s}}return{start:n,end:n}}var Xh=class g1{constructor(n,r=[],s=[],u=10,c={}){ma(this,"fields");ma(this,"fieldMap");ma(this,"savedSearches");ma(this,"searchHistory");ma(this,"maxSuggestions");ma(this,"options");ma(this,"defaultFieldName");ma(this,"defaultFieldShowFieldSuggs",!1);this.fields=n,this.fieldMap=new Map(n.map(f=>[f.name,f]));for(const f of n)if(f.aliases)for(const h of f.aliases)this.fieldMap.set(h,f);this.savedSearches=r,this.searchHistory=s,this.maxSuggestions=u,this.options={showSavedSearchHint:c.showSavedSearchHint??!1,showHistoryHint:c.showHistoryHint??!1}}resolveField(n){return this.fieldMap.get(n)}updateSavedSearches(n){this.savedSearches=n}updateSearchHistory(n){this.searchHistory=n}setDefaultField(n){this.defaultFieldName=n==null?void 0:n.name,this.defaultFieldShowFieldSuggs=(n==null?void 0:n.showFieldSuggestions)??!1}getSuggestions(n,r){let s=ys.getCursorContext(n,r);const u=WT(s.token,r,n);if(this.defaultFieldName&&(s.type==="FIELD_NAME"||s.type==="EMPTY")){s={...s,type:"FIELD_VALUE",fieldName:this.defaultFieldName};const c=this.resolveField(this.defaultFieldName);if((c==null?void 0:c.type)==="date")return{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s};const f=this.getValueSuggestions(c,s.partial,u.start,u.end);if(this.defaultFieldShowFieldSuggs){const h=this.getFieldSuggestions(s.partial,u.start,u.end);return{suggestions:[...f,...h],showDatePicker:!1,context:s}}return{suggestions:f,showDatePicker:!1,context:s}}switch(s.type){case"FIELD_NAME":case"EMPTY":{const c=this.getFieldSuggestions(s.partial,u.start,u.end),f=!s.partial&&c.length>0?this.getSpecialHints(u.start,u.end):[];return{suggestions:this.sortByPriority([...c,...f]),showDatePicker:!1,context:s}}case"FIELD_VALUE":{const c=s.fieldName?this.resolveField(s.fieldName):void 0;return(c==null?void 0:c.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s}:{suggestions:this.getValueSuggestions(c,s.partial,u.start,u.end),showDatePicker:!1,context:s}}case"OPERATOR":{const c=this.getOperatorSuggestions(s.partial,u.start,u.end),f=this.getFieldSuggestions("",u.start,u.end),h=this.getSpecialHints(u.start,u.end);return{suggestions:this.sortByPriority([...c,...f,...h]),showDatePicker:!1,context:s}}case"SAVED_SEARCH":return{suggestions:this.getSavedSearchSuggestions(s.partial,u.start,u.end),showDatePicker:!1,context:s};case"HISTORY_REF":return{suggestions:this.getHistorySuggestions(s.partial,u.start,u.end),showDatePicker:!1,context:s};case"RANGE":{const c=s.fieldName?this.resolveField(s.fieldName):void 0;return(c==null?void 0:c.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s}:{suggestions:[],showDatePicker:!1,context:s}}default:return{suggestions:[],showDatePicker:!1,context:s}}}getFieldSuggestions(n,r,s){const u=n.toLowerCase();return this.fields.filter(c=>!c.hide).map(c=>{const f=c.name.toLowerCase(),h=(c.label||"").toLowerCase(),p=(c.aliases||[]).map(y=>y.toLowerCase());let g=0;return f.startsWith(u)?g=4:h.startsWith(u)||p.some(y=>y.startsWith(u))?g=3:f.includes(u)?g=2:(h.includes(u)||p.some(y=>y.includes(u)))&&(g=1),{field:c,score:g}}).filter(c=>c.score>0).sort((c,f)=>f.score-c.score).slice(0,this.maxSuggestions).map(c=>({text:c.field.name+":",label:c.field.label||c.field.name,description:c.field.description,type:c.field.type,replaceStart:r,replaceEnd:s,matchPartial:n,priority:10}))}getValueSuggestions(n,r,s,u){if(!n)return[];if(n.type==="boolean")return["true","false"].filter(c=>c.startsWith(r.toLowerCase())).map(c=>({text:c,label:c,type:"boolean",replaceStart:s,replaceEnd:u,matchPartial:r}));if(n.placeholder!==!1){const c=n.placeholder||{number:"Enter a number",ip:"Enter an IP address"}[n.type];if(c)return[{text:"",label:c,type:"hint",replaceStart:s,replaceEnd:u}]}return[]}getOperatorSuggestions(n,r,s){const u=n.toLowerCase();return QT.filter(c=>c.toLowerCase().startsWith(u)).map(c=>({text:c+" ",label:c,description:c==="AND"?"Both conditions must match":c==="OR"?"Either condition must match":"Negate the following condition",type:"operator",replaceStart:r,replaceEnd:s,matchPartial:n,priority:30}))}sortByPriority(n){return n.sort((r,s)=>(s.priority??0)-(r.priority??0))}getSpecialHints(n,r){const s=[],u=this.savedSearches.length>0||this.options.hasSavedSearchProvider,c=this.searchHistory.length>0||this.options.hasHistoryProvider;return this.options.showSavedSearchHint&&u&&s.push({text:"#",label:"#saved-search",description:"Type # to use a saved search",type:"hint",replaceStart:n,replaceEnd:r,priority:20}),this.options.showHistoryHint&&c&&s.push({text:"!",label:"!history",description:"Type ! to search history",type:"hint",replaceStart:n,replaceEnd:r,priority:20}),s}getSavedSearchSuggestions(n,r,s){return this.savedSearches.slice(0,this.maxSuggestions).map(u=>({text:u.query,label:u.label||u.query,description:u.description,type:"savedSearch",replaceStart:r,replaceEnd:s,matchPartial:n,sourceData:u}))}getHistorySuggestions(n,r,s){return this.searchHistory.slice(0,this.maxSuggestions).map(u=>({text:g1.wrapHistoryQuery(u.query),label:u.label||u.query,description:u.description,type:"history",replaceStart:r,replaceEnd:s,matchPartial:n,sourceData:u}))}static wrapHistoryQuery(n){try{const r=new ys(new pi(n).tokenize()).parse();if(r&&r.type==="BooleanExpr")return"("+n+")"}catch{}return n}};function ku(e){if(e==="")return null;const n=Number(e);return isNaN(n)?`"${e}" is not a valid number`:null}var JT=[/^\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 eC(e){for(const n of JT)if(n.test(e))return!0;return!isNaN(Date.parse(e))}function Qh(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function tC(e){if(/^now$/i.test(e))return new Date;const n=e.match(/^now([+-])(\d+)([dhms])$/i);if(n){const u=new Date,c=n[1]==="+"?1:-1,f=parseInt(n[2],10);switch(n[3].toLowerCase()){case"d":u.setDate(u.getDate()+c*f);break;case"h":u.setHours(u.getHours()+c*f);break;case"m":u.setMinutes(u.getMinutes()+c*f);break;case"s":u.setSeconds(u.getSeconds()+c*f);break}return u}const r=e.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(r)return new Date(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10));const s=new Date(e);return isNaN(s.getTime())?null:s}function Wy(e,n){return new Date(e,n+1,0).getDate()}function aC(e,n){return new Date(e,n,1).getDay()}function Ro(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function Jy(e,n,r){if(!n||!r)return!1;const s=e.getTime(),u=n.getTime(),c=r.getTime();return s>=Math.min(u,c)&&s<=Math.max(u,c)}var nC=["January","February","March","April","May","June","July","August","September","October","November","December"];function rC(e){return nC[e]}function Tu(e,n){if(e==="")return null;const r=e.match(/^[\[{](.+)\s+TO\s+(.+)[\]}]$/i);if(r){const s=Kh(r[1].trim(),n);if(s)return`Range start: ${s}`;const u=Kh(r[2].trim(),n);return u?`Range end: ${u}`:null}return Kh(e,n)}function Kh(e,n){return/^now(\/[dhms])?$/i.test(e)||/^now[+-]\d+[dhms](\/[dhms])?$/i.test(e)||n&&n(e)!==null||eC(e)?null:`"${e}" is not a valid date. Use YYYY-MM-DD, relative (now-7d), or ISO 8601.`}function Cu(e){return e==null?null:typeof e=="string"?{message:e,severity:"error"}:e}var Au={SYNTAX_ERROR:0,INVALID_VALUE:1,UNKNOWN_FIELD:2,AMBIGUOUS_PRECEDENCE:3,CUSTOM:4};function Du(e){if(e.length<=1)return e;const n=[...e].sort((s,u)=>{const c=Au[s.type??"SYNTAX_ERROR"],f=Au[u.type??"SYNTAX_ERROR"];return c!==f?c-f:s.start-u.start}),r=[];for(const s of n)r.some(u=>Au[u.type??"SYNTAX_ERROR"]<Au[s.type??"SYNTAX_ERROR"]&&u.start<=s.start&&u.end>=s.end)||r.push(s);return r}var eb=class{constructor(e){ma(this,"fields");this.fields=new Map(e.map(n=>[n.name,n]));for(const n of e)if(n.aliases)for(const r of n.aliases)this.fields.set(r,n)}validate(e,n,r,s){if(!e)return[];const u=[],c=s?this.fields.get(s):void 0;return this.walkNode(e,u,n,r,c),this.checkAmbiguousPrecedence(e,u),u}walkNode(e,n,r,s,u){switch(e.type){case"BareTerm":if(e.fuzzy!==void 0&&e.fuzzy>2&&n.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${e.fuzzy})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),e.proximity!==void 0&&e.proximity<0&&n.push({message:`Proximity value must be non-negative (got ${e.proximity})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),e.boost!==void 0&&e.boost<=0&&n.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),u&&e.value!==""){let c=null;switch(u.type){case"number":c=ku(e.value);break;case"date":c=Tu(e.value,s);break;case"boolean":e.value!=="true"&&e.value!=="false"&&(c=`Expected "true" or "false", got "${e.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(e.value)&&!e.value.includes("*")&&(c=`"${e.value}" is not a valid IP address`);break}c&&n.push({message:c,start:e.start,end:e.end,field:u.name,type:"INVALID_VALUE"})}if(r&&e.value!==""){const c=Cu(r({value:e.value,position:"bare_term",quoted:e.quoted,fieldName:u==null?void 0:u.name,fieldConfig:u}));c&&n.push({message:c.message,start:e.start,end:e.end,severity:c.severity,type:"CUSTOM"})}break;case"Regex":break;case"Range":if(this.validateEmptyRangeBounds(e,n),e.field&&e.field!=="*"){const c=this.fields.get(e.field);c?this.validateRangeBounds(c,e,n,r,s):n.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"})}break;case"FieldValue":{if(e.field==="*")return;if(e.value===""){const h=e.operator===":"?":":e.operator;n.push({message:`Missing value after "${e.field}${h}"`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"});return}const c=this.fields.get(e.field);if(!c){n.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"});return}e.fuzzy!==void 0&&e.fuzzy>2&&n.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${e.fuzzy})`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"}),e.boost!==void 0&&e.boost<=0&&n.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"});let f=null;switch(c.type){case"number":f=ku(e.value);break;case"date":f=Tu(e.value,s);break;case"boolean":e.value!=="true"&&e.value!=="false"&&(f=`Expected "true" or "false", got "${e.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(e.value)&&!e.value.includes("*")&&(f=`"${e.value}" is not a valid IP address`);break}if(e.operator!==":"&&c.type!=="number"&&c.type!=="date"&&(f=`Comparison operator "${e.operator}" is not valid for ${c.type} fields`),!f&&r){const h=Cu(r({value:e.value,position:"field_value",fieldName:c.name,fieldConfig:c,quoted:e.quoted,operator:e.operator!==":"?e.operator:void 0}));if(h){const p=e.end-e.value.length;n.push({message:h.message,start:p,end:e.end,field:e.field,severity:h.severity,type:"CUSTOM"})}}if(f){const h=e.end-e.value.length,p=e.operator!==":"&&c.type!=="number"&&c.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";n.push({message:f,start:h,end:e.end,field:e.field,type:p})}break}case"FieldGroup":if(e.field==="*")this.walkNode(e.expression,n,r,s,u);else{const c=this.fields.get(e.field);c?this.walkFieldGroup(e.expression,c,n,r,s):n.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"})}e.boost!==void 0&&e.boost<=0&&n.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break;case"BooleanExpr":this.walkNode(e.left,n,r,s,u),this.walkNode(e.right,n,r,s,u);break;case"Group":this.walkNode(e.expression,n,r,s,u),e.boost!==void 0&&e.boost<=0&&n.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break;case"Not":this.walkNode(e.expression,n,r,s,u);break;case"Error":n.push({message:e.message,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break}}walkFieldGroup(e,n,r,s,u){switch(e.type){case"BareTerm":if(e.value==="")return;this.validateFieldValue(n,e.value,e.quoted,":",e.start,e.end,r,s,u);break;case"FieldValue":this.walkNode(e,r,s,u);break;case"Range":this.validateRangeBounds(n,e,r,s,u);break;case"BooleanExpr":this.walkFieldGroup(e.left,n,r,s,u),this.walkFieldGroup(e.right,n,r,s,u);break;case"Group":this.walkFieldGroup(e.expression,n,r,s,u);break;case"Not":this.walkFieldGroup(e.expression,n,r,s,u);break;default:this.walkNode(e,r,s,u);break}}validateFieldValue(e,n,r,s,u,c,f,h,p){let g=null;switch(e.type){case"number":g=ku(n);break;case"date":g=Tu(n,p);break;case"boolean":n!=="true"&&n!=="false"&&(g=`Expected "true" or "false", got "${n}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(n)&&!n.includes("*")&&(g=`"${n}" is not a valid IP address`);break}if(s!==":"&&e.type!=="number"&&e.type!=="date"&&(g=`Comparison operator "${s}" is not valid for ${e.type} fields`),!g&&h){const y=Cu(h({value:n,position:"field_group_term",fieldName:e.name,fieldConfig:e,quoted:r,operator:s!==":"?s:void 0}));y&&f.push({message:y.message,start:u,end:c,field:e.name,severity:y.severity,type:"CUSTOM"})}if(g){const y=s!==":"&&e.type!=="number"&&e.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";f.push({message:g,start:u,end:c,field:e.name,type:y})}}validateEmptyRangeBounds(e,n){e.lower!=="*"&&e.lower.trim()===""&&n.push({message:"Missing lower bound in range",start:e.start,end:e.start+1,field:e.field,type:"SYNTAX_ERROR"}),e.upper!=="*"&&e.upper.trim()===""&&n.push({message:"Missing upper bound in range",start:e.end-1,end:e.end,field:e.field,type:"SYNTAX_ERROR"})}validateRangeBounds(e,n,r,s,u){const c=[];n.lower!=="*"&&n.lower.trim()!==""&&c.push({value:n.lower,label:"Range start",start:n.lowerStart,end:n.lowerEnd,position:"range_start",inclusive:n.lowerInclusive}),n.upper!=="*"&&n.upper.trim()!==""&&c.push({value:n.upper,label:"Range end",start:n.upperStart,end:n.upperEnd,position:"range_end",inclusive:n.upperInclusive});for(const f of c){let h=null;switch(e.type){case"number":h=ku(f.value),h&&(h=`${f.label}: ${h}`);break;case"date":h=Tu(f.value,u),h&&(h=`${f.label}: ${h}`);break;case"boolean":h="Range queries are not supported for boolean fields";break}if(!h&&s){const p=Cu(s({value:f.value,position:f.position,fieldName:e.name,fieldConfig:e,quoted:!1,inclusive:f.inclusive}));p&&r.push({message:p.message,start:f.start,end:f.end,field:e.name,severity:p.severity,type:"CUSTOM"})}if(h){const p=e.type==="boolean"?"SYNTAX_ERROR":"INVALID_VALUE";r.push({message:h,start:f.start,end:f.end,field:e.name,type:p})}}}checkAmbiguousPrecedence(e,n){const r=new Set;this.findAndFlagAmbiguity(e,n,r)}findAndFlagAmbiguity(e,n,r){if(e.type==="BooleanExpr"&&!r.has(e)){const s=new Set,u=[];this.collectBoolOps(e,s,u),s.size>1&&(n.push({message:"Ambiguous precedence: mix of AND and OR without parentheses. Add parentheses to clarify.",start:e.start,end:e.end,severity:"warning",type:"AMBIGUOUS_PRECEDENCE"}),u.forEach(c=>r.add(c))),this.collectLeaves(e).forEach(c=>this.findAndFlagAmbiguity(c,n,r))}else e.type==="Group"||e.type==="FieldGroup"?this.findAndFlagAmbiguity(e.expression,n,r):e.type==="Not"?this.findAndFlagAmbiguity(e.expression,n,r):e.type==="BooleanExpr"&&this.collectLeaves(e).forEach(s=>this.findAndFlagAmbiguity(s,n,r))}collectBoolOps(e,n,r){e.type==="BooleanExpr"&&(n.add(e.operator),r.push(e),this.collectBoolOps(e.left,n,r),this.collectBoolOps(e.right,n,r))}collectLeaves(e){return e.type!=="BooleanExpr"?[e]:[...this.collectLeaves(e.left),...this.collectLeaves(e.right)]}};function Bn(...e){return e.filter(Boolean).join(" ")}function ic(e){return{...GT,...e}}function oc(e){return{...XT,...e}}function lC(e,n){return{position:"relative",display:"flex",flexDirection:"column",width:"100%",...n}}function sC(e,n){return{flex:1,minHeight:n.inputMinHeight,padding:n.inputPadding,borderWidth:n.inputBorderWidth,borderStyle:"solid",borderColor:n.inputBorderColor,borderRadius:n.inputBorderRadius,outline:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,lineHeight:n.lineHeight,backgroundColor:e.background,color:e.text,caretColor:e.cursor,whiteSpace:"pre-wrap",wordWrap:"break-word",overflowWrap:"break-word",overflow:"auto",cursor:"text"}}function iC(e){return{borderColor:e.inputFocusBorderColor,boxShadow:e.inputFocusShadow}}function oC(e,n){const r=n.inputPadding.split(/\s+/),s=r[0]||"8px";return{position:"absolute",top:s,left:r.length>=4?r[3]:r.length>=2?r[1]:s,right:r.length>=4||r.length>=2?r[1]:s,color:e.placeholder,pointerEvents:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,lineHeight:n.lineHeight,userSelect:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}function v1(e,n){return{position:"absolute",zIndex:n.dropdownZIndex,backgroundColor:e.background,border:`1px solid ${n.dropdownBorderColor}`,borderRadius:n.dropdownBorderRadius,boxShadow:n.dropdownShadow,maxHeight:n.dropdownMaxHeight,overflowY:"auto",width:"max-content",minWidth:n.dropdownMinWidth,maxWidth:n.dropdownMaxWidth,padding:"4px 0"}}function tb(e,n,r){return{padding:r.dropdownItemPadding,cursor:"pointer",fontSize:r.dropdownItemFontSize,fontFamily:r.fontFamily,backgroundColor:e?n.dropdownSelected:"transparent",color:e?"#ffffff":n.text,display:"flex",alignItems:"center",gap:r.dropdownItemContentGap,lineHeight:"1.4"}}function si(e){return{flex:1,fontWeight:500}}function Zh(e){return{fontSize:"11px",opacity:.7,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0}}function cC(e,n){return{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:e?n.typeBadgeSelectedBg:n.typeBadgeBg,color:e?n.typeBadgeSelectedColor:n.typeBadgeColor,flexShrink:0}}function uC(e,n){return{container:{padding:"12px",backgroundColor:e.background,minWidth:"280px",fontFamily:n.fontFamily},header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},navButton:{backgroundColor:"transparent",border:"none",cursor:"pointer",fontSize:"16px",padding:"4px 8px",color:e.text,borderRadius:"4px"},monthLabel:{fontWeight:600,fontSize:n.fontSize,color:e.text},weekDays:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},weekDay:{textAlign:"center",fontSize:"11px",color:e.placeholder,padding:"4px",fontWeight:600},days:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},day:{textAlign:"center",padding:"6px",cursor:"pointer",fontSize:n.dropdownItemFontSize,borderRadius:"4px",color:e.text,border:"none",backgroundColor:"transparent"},dayHover:{backgroundColor:e.dropdownHover},daySelected:{backgroundColor:e.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:n.typeBadgeBg,borderRadius:"6px"},rangeToggleButton:{flex:1,padding:"4px 8px",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontWeight:500,backgroundColor:"transparent",color:e.text},rangeToggleButtonActive:{backgroundColor:e.background,boxShadow:"0 1px 2px rgba(0,0,0,0.1)"},quickOptions:{borderTop:`1px solid ${n.dropdownBorderColor}`,marginTop:"8px",paddingTop:"8px"},quickOption:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:e.dropdownSelected,borderRadius:"4px"}}}var dC={delimiter:"regexDelimiter",charClass:"regexCharClass",groupOpen:"regexGroup",groupClose:"regexGroup",escape:"regexEscape",quantifier:"regexQuantifier",anchor:"regexAnchor",alternation:"regexAlternation",text:"regexText"};function fC(e){const n=[];let r=0,s="";function u(){s&&(n.push({type:"text",text:s}),s="")}e.startsWith("/")&&(n.push({type:"delimiter",text:"/"}),r=1);const c=e.lastIndexOf("/"),f=c>0?c:e.length;for(;r<f;){const h=e[r];if(h==="\\"&&r+1<f){u(),n.push({type:"escape",text:e.slice(r,r+2)}),r+=2;continue}if(h==="["){u();let p=r+1;for(p<f&&e[p]==="^"&&p++,p<f&&e[p]==="]"&&p++;p<f&&e[p]!=="]";)e[p]==="\\"&&p+1<f&&p++,p++;p<f&&p++,n.push({type:"charClass",text:e.slice(r,p)}),r=p;continue}if(h==="("){u();let p="(";if(r+1<f&&e[r+1]==="?"){let g=r+2;for(;g<f&&g<r+4&&/[:<>=!]/.test(e[g]);)g++;p=e.slice(r,g)}n.push({type:"groupOpen",text:p}),r+=p.length;continue}if(h===")"){u(),n.push({type:"groupClose",text:")"}),r++;continue}if(h==="+"||h==="*"||h==="?"){u();let p=h;r+1<f&&e[r+1]==="?"&&(p+="?"),n.push({type:"quantifier",text:p}),r+=p.length;continue}if(h==="{"){u();let p=r+1;for(;p<f&&e[p]!=="}";)p++;p<f&&p++,n.push({type:"quantifier",text:e.slice(r,p)}),r=p;continue}if(h==="^"||h==="$"){u(),n.push({type:"anchor",text:h}),r++;continue}if(h==="|"){u(),n.push({type:"alternation",text:"|"}),r++;continue}s+=h,r++}return u(),c>0&&c<e.length&&n.push({type:"delimiter",text:"/"}),n}function hC(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mC(e,n,r){const s=fC(e.value).map(u=>{const c=n[dC[u.type]]||n.regexText,f=u.type==="delimiter"?"600":"normal";return`<span class="ei-regex-part ei-regex-part--${u.type}" style="color:${c};font-weight:${f}">${hC(u.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--regex${r?" "+r:""}`}" data-token-start="${e.start}" data-token-end="${e.end}">${s}</span>`}var pC={bracket:"paren",toKeyword:"booleanOp",bareValue:"fieldValue",quotedValue:"quoted",wildcard:"wildcard",whitespace:"text"};function gC(e){const n=[];let r=0;r<e.length&&(e[r]==="["||e[r]==="{")&&(n.push({type:"bracket",text:e[r]}),r++);const s=e.length-1,u=s>=0&&(e[s]==="]"||e[s]==="}"),c=u?s:e.length;for(;r<c;){const f=e[r];if(f===" "||f===" "){let p=r;for(;p<c&&(e[p]===" "||e[p]===" ");)p++;n.push({type:"whitespace",text:e.slice(r,p)}),r=p;continue}if((f==="T"||f==="t")&&r+1<c&&(e[r+1]==="O"||e[r+1]==="o")){const p=r===0||e[r-1]===" "||e[r-1]===" "||e[r-1]==="["||e[r-1]==="{",g=r+2>=c||e[r+2]===" "||e[r+2]===" ";if(p&&g){n.push({type:"toKeyword",text:e.slice(r,r+2)}),r+=2;continue}}if(f==='"'){let p=r+1;for(;p<c&&e[p]!=='"';)e[p]==="\\"&&p+1<c&&p++,p++;p<c&&p++,n.push({type:"quotedValue",text:e.slice(r,p)}),r=p;continue}if(f==="*"){n.push({type:"wildcard",text:"*"}),r++;continue}let h=r;for(;h<c&&e[h]!==" "&&e[h]!==" "&&e[h]!=='"';)h++;if(h>r){const p=e.slice(r,h);n.push({type:"bareValue",text:p}),r=h}else n.push({type:"bareValue",text:f}),r++}return u&&n.push({type:"bracket",text:e[s]}),n}function ab(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vC(e,n,r){const s=gC(e.value).map(u=>{if(u.type==="whitespace")return ab(u.text);const c=n[pC[u.type]]||n.fieldValue,f=u.type==="toKeyword"||u.type==="bracket"?"600":"normal";return`<span class="ei-range-part ei-range-part--${u.type}" style="color:${c};font-weight:${f}">${ab(u.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--range${r?" "+r:""}`}" data-token-start="${e.start}" data-token-end="${e.end}">${s}</span>`}function x1(e,n){if(n<0)return null;const r=e.filter(c=>c.type===O.LPAREN||c.type===O.RPAREN);if(r.length===0)return null;const s=r.find(c=>c.end===n);if(s){const c=nb(r,s);if(c)return c}const u=r.find(c=>c.start===n);if(u){const c=nb(r,u);if(c)return c}return null}function nb(e,n){if(n.type===O.LPAREN){const r=e.indexOf(n);let s=0;for(let u=r;u<e.length;u++)if(e[u].type===O.LPAREN?s++:e[u].type===O.RPAREN&&s--,s===0)return{openStart:n.start,closeStart:e[u].start}}else{const r=e.indexOf(n);let s=0;for(let u=r;u>=0;u--)if(e[u].type===O.RPAREN?s++:e[u].type===O.LPAREN&&s--,s===0)return{openStart:e[u].start,closeStart:n.start}}return null}var xC={[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"},yC={[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 ii(e,n,r){const s=ic(n);if(e.length===0)return"";const u=(r==null?void 0:r.cursorOffset)!==void 0?x1(e,r.cursorOffset):null,c=n==null?void 0:n.valueTypes,f=r==null?void 0:r.fieldTypeMap;let h;if(c&&f){h=new Array(e.length);let g,y=!1;const x=[];for(let E=0;E<e.length;E++){const S=e[E];S.type===O.FIELD_NAME?(g=S.value,y=!1):S.type===O.COLON&&g?y=!0:S.type===O.WHITESPACE||(S.type===O.LPAREN?(y&&g?x.push(f.get(g.toLowerCase())):x.push(void 0),g=void 0,y=!1):S.type===O.RPAREN?(x.pop(),g=void 0,y=!1):S.type===O.VALUE||S.type===O.QUOTED_VALUE||S.type===O.RANGE||S.type===O.REGEX||S.type===O.WILDCARD?(y&&g?h[E]=f.get(g.toLowerCase()):x.length>0&&(h[E]=x[x.length-1]),g=void 0,y=!1):(S.type===O.AND||S.type===O.OR||(S.type,O.NOT),g=void 0,y=!1))}}let p=e.map((g,y)=>{let x=s[yC[g.type]||"text"]||s.text;if(c&&h){const j=h[y];j&&c[j]&&(x=c[j])}const E=bC(g.value);if(g.type===O.WHITESPACE)return E.replace(/\n/g,"<br>");if(g.type===O.REGEX)return mC(g,s,r==null?void 0:r.tokenClassName);if(g.type===O.RANGE)return vC(g,s,r==null?void 0:r.tokenClassName);let S="normal";(g.type===O.AND||g.type===O.OR||g.type===O.NOT)&&(S="600"),g.type===O.FIELD_NAME&&(S="500");let w="";return u&&(g.type===O.LPAREN||g.type===O.RPAREN)&&(g.start===u.openStart||g.start===u.closeStart)&&(S="700",w=`background-color:${s.matchedParenBg};border-radius:2px;`),`<span class="${`ei-token ei-token--${xC[g.type]}${r!=null&&r.tokenClassName?" "+r.tokenClassName:""}`}" style="color:${x};font-weight:${S};${w}" data-token-start="${g.start}" data-token-end="${g.end}">${E}</span>`}).join("");return p.endsWith("<br>")&&(p+="<br data-sentinel>"),p}function bC(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}if(typeof document<"u"){const e="elastic-input-keyframes";if(!document.getElementById(e)){const n=document.createElement("style");n.id=e,n.textContent="@keyframes elastic-input-spin { to { transform: rotate(360deg); } }",document.head.appendChild(n)}}function rb(e,n,r){if(!n||n.length===0)return e;const s=e.toLowerCase(),u=n.toLowerCase(),c=s.indexOf(u);if(c===-1)return e;const f=e.slice(0,c),h=e.slice(c,c+n.length),p=e.slice(c+n.length),g={fontWeight:700,textDecoration:"underline",textDecorationColor:r?"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},h),p)}function wC({suggestions:e,selectedIndex:n,onSelect:r,position:s,colors:u,styles:c,visible:f,fixedWidth:h,renderHistoryItem:p,renderSavedSearchItem:g,renderDropdownHeader:y,cursorContext:x,listRefCallback:E,renderType:S,classNames:w}){const j=v.useRef(null),R=v.useRef(null);v.useEffect(()=>{const M=document.createElement("div");return document.body.appendChild(M),j.current=M,()=>{document.body.removeChild(M),j.current=null}},[]);const z=y&&x?y(x):null,I=z!=null;if(v.useEffect(()=>{if(R.current){const M=I?n+1:n,T=R.current.children[M];T&&T.scrollIntoView({block:"nearest"})}},[n,I]),!j.current||!f||e.length===0||!s)return null;const $=ic(u),Q=oc(c),J={...v1($,Q),top:`${s.top}px`,left:`${s.left}px`,...h!=null?{width:`${h}px`,minWidth:"unset",maxWidth:"unset"}:{}},ne=v.createElement("div",{className:Bn("ei-dropdown",w==null?void 0:w.dropdown),style:J,ref:M=>{R.current=M,E==null||E(M)},onMouseDown:M=>M.preventDefault()},I&&v.createElement("div",{className:Bn("ei-dropdown-header",w==null?void 0:w.dropdownHeader),style:{padding:Q.dropdownItemPadding||"4px 10px",fontSize:"11px",color:$.placeholder,borderBottom:`1px solid ${$.dropdownHover}`,userSelect:"none"}},z),e.map((M,T)=>{const fe=T===n,pe=tb(fe,$,Q),we=(L,F,he)=>({key:T,className:Bn("ei-dropdown-item",L,fe&&"ei-dropdown-item--selected",w==null?void 0:w.dropdownItem),style:{...pe,...F},title:he,onClick:()=>r(M),onMouseEnter:P=>{P.currentTarget.style.backgroundColor=fe?$.dropdownSelected:$.dropdownHover},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=fe?$.dropdownSelected:"transparent"}}),re=L=>{if(S===!1||!M.type||M.type==="hint")return null;const F=typeof S=="function"?S(M.type,{text:M.text,label:M.label,description:M.description,type:M.type}):M.type;return F!=null?v.createElement("span",{className:"ei-dropdown-item-type",style:{...cC(fe,Q),...L}},F):null},je={flexDirection:"column",alignItems:"flex-start"},Te={display:"flex",alignItems:"center",gap:Q.dropdownItemContentGap,width:"100%"};if(M.type==="hint"&&(M.text==="#"||M.text==="!"))return v.createElement("div",{...we("ei-dropdown-item--hint",{opacity:fe?1:.7}),onMouseEnter:L=>{L.currentTarget.style.backgroundColor=fe?$.dropdownSelected:$.dropdownHover,L.currentTarget.style.opacity="1"},onMouseLeave:L=>{L.currentTarget.style.backgroundColor=fe?$.dropdownSelected:"transparent",L.currentTarget.style.opacity=fe?"1":"0.7"}},v.createElement("span",{className:"ei-dropdown-item-label",style:si()},M.label),M.description&&v.createElement("span",{className:"ei-dropdown-item-desc",style:Zh()},M.description));if(M.type==="error")return v.createElement("div",{key:T,className:Bn("ei-dropdown-item","ei-dropdown-item--error",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.8}},v.createElement("span",{className:"ei-dropdown-item-label",style:{...si(),color:$.error}},M.label||"Error loading suggestions"));if(M.type==="noResults")return v.createElement("div",{key:T,className:Bn("ei-dropdown-item","ei-dropdown-item--no-results",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.7}},M.customContent);if(M.type==="loading")return v.createElement("div",{key:T,className:Bn("ei-dropdown-item","ei-dropdown-item--loading",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.6,justifyContent:"center"}},v.createElement("span",{className:"ei-dropdown-item-label",style:{...si(),fontStyle:"italic"}},M.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:`${$.placeholder} transparent ${$.placeholder} transparent`,borderRadius:"50%"}}));if(M.type==="hint"){const L=tb(!1,$,Q);return v.createElement("div",{key:T,className:Bn("ei-dropdown-item","ei-dropdown-item--hint",w==null?void 0:w.dropdownItem),style:{...L,cursor:"default",opacity:M.customContent?1:.6}},M.customContent?M.customContent:v.createElement("span",{className:"ei-dropdown-item-label",style:si()},M.label))}if(M.type==="history"&&p&&M.sourceData){const L=p(M.sourceData,fe);if(L!=null)return v.createElement("div",we("ei-dropdown-item--history",je),L)}if(M.type==="savedSearch"&&g&&M.sourceData){const L=g(M.sourceData,fe);if(L!=null)return v.createElement("div",we("ei-dropdown-item--saved-search"),L)}if((M.type==="history"||M.type==="savedSearch")&&M.description!=null){const L=M.type==="history"?"ei-dropdown-item--history":"ei-dropdown-item--saved-search";let F;const he=M.text.startsWith("(")&&M.text.endsWith(")")?M.text.slice(1,-1):M.text;return M.label!==he&&(F=M.text),v.createElement("div",we(L,je,F),v.createElement("span",{className:"ei-dropdown-item-label",style:{...si(),width:"100%",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"normal",wordBreak:"break-all"}},rb(M.label,M.matchPartial,fe)),v.createElement("span",{style:Te},v.createElement("span",{className:"ei-dropdown-item-desc",style:{...Zh(),flex:1}},M.description),re({marginLeft:"auto"})))}const ee=M.type==="savedSearch"?"ei-dropdown-item--saved-search":void 0;return v.createElement("div",we(ee),v.createElement("span",{className:"ei-dropdown-item-label",style:si()},rb(M.label,M.matchPartial,fe)),M.description&&v.createElement("span",{className:"ei-dropdown-item-desc",style:Zh()},M.description),re())}));return ll.createPortal(ne,j.current)}var SC=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Wh(e){return Math.floor(e/10)*10}function EC({onSelect:e,colors:n,styles:r,initialMode:s,initialStart:u,initialEnd:c,presets:f,className:h}){const p=s==="range"&&c?c:u??new Date,[g,y]=v.useState(s??"single"),[x,E]=v.useState("days"),[S,w]=v.useState(p.getFullYear()),[j,R]=v.useState(p.getMonth()),[z,I]=v.useState(u??null),[$,Q]=v.useState(c??null),[J,ne]=v.useState(null),M=ic(n),T=uC(M,oc(r)),fe=()=>{x==="days"?j===0?(R(11),w(ce=>ce-1)):R(ce=>ce-1):w(x==="months"?ce=>ce-1:ce=>ce-10)},pe=()=>{x==="days"?j===11?(R(0),w(ce=>ce+1)):R(ce=>ce+1):w(x==="months"?ce=>ce+1:ce=>ce+10)},we=()=>{w(x==="days"?ce=>ce-1:x==="months"?ce=>ce-10:ce=>ce-100)},re=()=>{w(x==="days"?ce=>ce+1:x==="months"?ce=>ce+10:ce=>ce+100)},je=()=>{x==="days"?E("months"):x==="months"&&E("years")},Te=ce=>{R(ce),E("days")},ee=ce=>{w(ce),E("months")},L=ce=>{if(g==="single"){e(Qh(ce));return}if(!z||$)I(ce),Q(null),ne(null);else{const[qe,rt]=z<=ce?[z,ce]:[ce,z];I(qe),Q(rt),ne(null),e(`[${Qh(qe)} TO ${Qh(rt)}]`)}},F=z&&!$?J:$,he=ce=>{y(ce),I(null),Q(null),ne(null)},P=x==="days"?`${rC(j)} ${S}`:x==="months"?`${S}`:`${Wh(S)}–${Wh(S)+9}`,se=x!=="years",C=new Date,B=Wy(S,j),K=aC(S,j),ue=["Su","Mo","Tu","We","Th","Fr","Sa"],ge=[],ve=(ce,qe,rt)=>{const Bt=Ro(ce,C),ga=z&&Ro(ce,z),Rt=F&&Ro(ce,F),_t=Jy(ce,z,F),Kt=ga||Rt,$a={...T.day,...rt?T.dayOtherMonth:{},...Bt?T.dayToday:{},..._t?T.dayInRange:{},...Kt?T.daySelected:{}},Ba=g==="range"&&z&&!$;return v.createElement("button",{key:qe,className:"ei-datepicker-day",style:$a,onClick:()=>L(ce),onMouseEnter:aa=>{Ba?ne(ce):Kt||(aa.currentTarget.style.backgroundColor=M.dropdownHover)},onMouseLeave:aa=>{!Ba&&!Kt&&(aa.currentTarget.style.backgroundColor=_t?"rgba(9, 105, 218, 0.1)":"transparent")}},ce.getDate())};if(K>0){const ce=Wy(S,j-1);for(let qe=K-1;qe>=0;qe--){const rt=ce-qe,Bt=new Date(S,j-1,rt);ge.push(ve(Bt,`prev${rt}`,!0))}}for(let ce=1;ce<=B;ce++){const qe=new Date(S,j,ce);ge.push(ve(qe,String(ce),!1))}const Re=ge.length%7;if(Re>0){const ce=7-Re;for(let qe=1;qe<=ce;qe++){const rt=new Date(S,j+1,qe);ge.push(ve(rt,`next${qe}`,!0))}}const He={...T.day,padding:"10px 4px",fontSize:"13px"},$e={...He,...T.dayToday},Qe=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"}],ia={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px"},$t=ce=>{ce.currentTarget.style.backgroundColor="#eef1f5"},mt=ce=>{ce.currentTarget.style.backgroundColor="transparent"};return v.createElement("div",{className:Bn("ei-datepicker",h),style:T.container,onMouseDown:ce=>ce.preventDefault(),onMouseLeave:()=>ne(null)},v.createElement("div",{className:"ei-datepicker-toggle",style:T.rangeToggle},["single","range"].map(ce=>v.createElement("button",{key:ce,style:{...T.rangeToggleButton,...g===ce?T.rangeToggleButtonActive:{}},onClick:()=>he(ce)},ce.charAt(0).toUpperCase()+ce.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:we,onMouseEnter:$t,onMouseLeave:mt},"«"),v.createElement("button",{style:T.navButton,onClick:fe,onMouseEnter:$t,onMouseLeave:mt},"‹")),v.createElement("button",{style:{...T.monthLabel,backgroundColor:"transparent",border:"none",cursor:se?"pointer":"default",padding:"2px 8px",borderRadius:"4px"},onClick:se?je:void 0,onMouseEnter:ce=>{se&&(ce.currentTarget.style.backgroundColor="#eef1f5")},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor="transparent"}},P),v.createElement("div",{style:{display:"flex",alignItems:"center",gap:"2px"}},v.createElement("button",{style:T.navButton,onClick:pe,onMouseEnter:$t,onMouseLeave:mt},"›"),v.createElement("button",{style:T.navButton,onClick:re,onMouseEnter:$t,onMouseLeave:mt},"»"))),x==="days"&&v.createElement(v.Fragment,null,v.createElement("div",{style:T.weekDays},ue.map(ce=>v.createElement("div",{key:ce,style:T.weekDay},ce))),v.createElement("div",{className:"ei-datepicker-days",style:T.days},ge)),x==="months"&&v.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},SC.map((ce,qe)=>{const rt=new Date(S,qe,1),Bt=Jy(rt,z,F),ga=z&&Ro(new Date(z.getFullYear(),z.getMonth(),1),rt)||F&&Ro(new Date(F.getFullYear(),F.getMonth(),1),rt),Rt=qe===C.getMonth()&&S===C.getFullYear(),_t=g==="range"&&z&&!$;return v.createElement("button",{key:ce,style:{...Rt?$e:He,...Bt?T.dayInRange:{},...ga?T.daySelected:{}},onClick:()=>Te(qe),onMouseEnter:Kt=>{_t?ne(rt):ga||(Kt.currentTarget.style.backgroundColor=M.dropdownHover)},onMouseLeave:Kt=>{!_t&&!ga&&(Kt.currentTarget.style.backgroundColor=Bt?"rgba(9, 105, 218, 0.1)":"transparent")}},ce)})),x==="years"&&v.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},Array.from({length:12},(ce,qe)=>{const rt=Wh(S)-1+qe,Bt=qe===0||qe===11,ga=rt===C.getFullYear(),Rt=new Date(rt,0,1),_t=z&&F&&rt>=Math.min(z.getFullYear(),F.getFullYear())&&rt<=Math.max(z.getFullYear(),F.getFullYear()),Kt=z&&z.getFullYear()===rt||F&&F.getFullYear()===rt,$a=g==="range"&&z&&!$;return v.createElement("button",{key:rt,style:{...ga?$e:He,...Bt?T.dayOtherMonth:{},..._t?T.dayInRange:{},...Kt?T.daySelected:{}},onClick:()=>ee(rt),onMouseEnter:Ba=>{$a?ne(Rt):Kt||(Ba.currentTarget.style.backgroundColor=M.dropdownHover)},onMouseLeave:Ba=>{!$a&&!Kt&&(Ba.currentTarget.style.backgroundColor=_t?"rgba(9, 105, 218, 0.1)":"transparent")}},rt)})),(()=>{const ce=Qe.filter(qe=>!qe.type||qe.type===g);return ce.length>0&&v.createElement("div",{className:"ei-datepicker-presets",style:{...T.quickOptions,...ia}},ce.map(qe=>v.createElement("button",{key:`${qe.type??"both"}-${qe.value}`,style:T.quickOption,onClick:()=>e(qe.value)},qe.label)))})())}var NC=30,jC=150;function lb(e,n){let r=0;const s=u=>{if(u.nodeType===Node.TEXT_NODE){const c=(u.textContent||"").length;return r+c>=n?{node:u,offset:n-r}:(r+=c,null)}if(u.nodeName==="BR"){if(r+1>=n){const c=u.parentNode;if(c)return{node:c,offset:Array.from(c.childNodes).indexOf(u)+1}}return r+=1,null}for(let c=0;c<u.childNodes.length;c++){const f=s(u.childNodes[c]);if(f)return f}return null};return s(e)}function RC(e,n,r){const s=lb(e,n),u=lb(e,r);if(!s||!u)return[];const c=document.createRange();c.setStart(s.node,s.offset),c.setEnd(u.node,u.offset);const f=e.getBoundingClientRect(),h=c.getClientRects();if(h.length===0)return[];const p=[];for(let g=0;g<h.length;g++){const y=h[g];y.width<1||p.push({left:y.left-f.left,top:y.top-f.top,width:Math.max(y.width,6),height:y.height})}return p}function kC(e,n,r){if(!n||e.length===0)return[];const s=[];let u=0;for(const c of e){if(u>=NC)break;if(r>=c.start&&r<=c.end)continue;const f=RC(n,c.start,c.end);for(const h of f)s.push({left:h.left,top:h.top,width:h.width,height:h.height,error:c});u++}return s}var sb=28,ib=4;function TC(e){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='${e.replace("#","%23")}' fill='none' stroke-width='0.8'/%3E%3C/svg%3E")`}function CC({errors:e,editorRef:n,cursorOffset:r,colors:s,styles:u,containerRef:c,classNames:f}){const[h,p]=v.useState(null),[g,y]=v.useState({x:0,clientY:0}),[x,E]=v.useState([]),S=v.useRef([]),w=v.useRef(null),j=v.useRef(null);if(v.useEffect(()=>{if(j.current&&clearTimeout(j.current),e.length===0){E([]),S.current=[],p(null);return}return j.current=setTimeout(()=>{const $=kC(e,n,r);E($),S.current=$},jC),()=>{j.current&&clearTimeout(j.current)}},[e,n,r]),v.useEffect(()=>{const $=c;if(!$||!n)return;const Q=M=>{const T=n.getBoundingClientRect(),fe=M.clientX-T.left,pe=M.clientY-T.top;let we=-1;for(let re=0;re<S.current.length;re++){const je=S.current[re];if(fe>=je.left&&fe<=je.left+je.width&&pe>=je.top&&pe<=je.top+je.height+6){we=re;break}}we>=0?(p(we),y({x:fe,clientY:M.clientY})):p(null)},J=()=>{p(null)},ne=new AbortController;return $.addEventListener("mousemove",Q,{signal:ne.signal}),$.addEventListener("mouseleave",J,{signal:ne.signal}),()=>ne.abort()},[c,n]),v.useEffect(()=>{const $=w.current;if(!$||h==null)return;const Q=$.getBoundingClientRect();if(Q.right>window.innerWidth-8){const J=Q.right-window.innerWidth+8;$.style.transform=`translateX(-${J}px)`}else $.style.transform=""}),x.length===0)return null;const R=ic(s),z=oc(u),I=h!=null?x[h]:null;return v.createElement(v.Fragment,null,x.map(($,Q)=>{const J=$.error.severity==="warning",ne=TC(J?R.warning:R.error),M=$.top+$.height-2;return v.createElement("div",{key:`wave-${Q}`,className:Bn("ei-squiggly",J?"ei-squiggly--warning":"ei-squiggly--error",f==null?void 0:f.squiggly),style:{position:"absolute",left:`${$.left}px`,top:`${M}px`,width:`${$.width}px`,height:"4px",zIndex:1,backgroundImage:ne,backgroundRepeat:"repeat-x",backgroundPosition:"left top",backgroundSize:"auto 4px",pointerEvents:"none"}})}),I!=null&&(()=>{const $=I.error.severity==="warning"?R.warning:R.error,Q=n==null?void 0:n.getBoundingClientRect(),J=((Q==null?void 0:Q.left)??0)+g.x,ne=((Q==null?void 0:Q.top)??0)+I.top+I.height+2,M=((Q==null?void 0:Q.top)??0)+I.top,T=window.innerHeight-g.clientY<sb+20?M-sb-ib:ne+ib;return ll.createPortal(v.createElement("div",{ref:w,className:Bn("ei-tooltip",f==null?void 0:f.tooltip),style:{position:"fixed",top:`${T}px`,left:`${J}px`,zIndex:z.dropdownZIndex,backgroundColor:R.background,color:$,border:`1px solid ${$}`,borderRadius:"4px",padding:"4px 8px",fontSize:"12px",fontFamily:z.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 Yo(e,n,r){let s=0,u=!1;function c(f){var h;if(u)return!0;if(f===n){if(f.nodeType===Node.TEXT_NODE)s+=r;else for(let p=0;p<r&&p<f.childNodes.length;p++)if(c(f.childNodes[p]))return!0;return u=!0,!0}if(f.nodeType===Node.TEXT_NODE)return s+=(f.textContent||"").length,!1;if(f.nodeName==="BR")return(h=f.hasAttribute)!=null&&h.call(f,"data-sentinel")||(s+=1),!1;for(let p=0;p<f.childNodes.length;p++)if(c(f.childNodes[p]))return!0;return!1}return c(e),s}function Ul(e){const n=window.getSelection();if(!n||n.rangeCount===0)return 0;const r=n.getRangeAt(0);return Yo(e,r.startContainer,r.startOffset)}function kr(e){const n=window.getSelection();if(!n||n.rangeCount===0)return{start:0,end:0};const r=n.getRangeAt(0);return{start:Yo(e,r.startContainer,r.startOffset),end:Yo(e,r.endContainer,r.endOffset)}}function rl(e,n){const r=window.getSelection();if(!r)return;const s=vm(e,n);if(!s)return;const u=document.createRange();u.setStart(s.node,s.offset),u.collapse(!0),r.removeAllRanges(),r.addRange(u)}function nl(e,n,r){if(n===r){rl(e,n);return}const s=window.getSelection();if(!s)return;const u=vm(e,n),c=vm(e,r);if(!u||!c)return;const f=document.createRange();f.setStart(u.node,u.offset),f.setEnd(c.node,c.offset),s.removeAllRanges(),s.addRange(f)}function vm(e,n){let r=0;function s(f){var h;if(f.nodeType===Node.TEXT_NODE){const p=(f.textContent||"").length;return r+p>=n?{node:f,offset:n-r}:(r+=p,null)}if(f.nodeName==="BR"){if((h=f.hasAttribute)!=null&&h.call(f,"data-sentinel"))return null;if(r+1>=n){const p=f.parentNode;if(p)return{node:p,offset:Array.from(p.childNodes).indexOf(f)+1}}return r+=1,null}for(let p=0;p<f.childNodes.length;p++){const g=s(f.childNodes[p]);if(g)return g}return null}const u=s(e);if(u)return u;const c=y1(e);return c?{node:c,offset:(c.textContent||"").length}:{node:e,offset:0}}function y1(e){if(e.nodeType===Node.TEXT_NODE)return e;for(let n=e.childNodes.length-1;n>=0;n--){const r=y1(e.childNodes[n]);if(r)return r}return null}function AC(e){const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);r.deleteContents();const s=document.createTextNode(e);r.insertNode(s),r.setStartAfter(s),r.collapse(!0),n.removeAllRanges(),n.addRange(r)}function DC(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0);n.deleteContents();const r=document.createElement("br");n.insertNode(r),n.setStartAfter(r),n.collapse(!0),e.removeAllRanges(),e.addRange(n)}function Ou(e){var h;const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);let s=r.getBoundingClientRect();if(s.width===0&&s.height===0){const p=document.createElement("span");p.textContent="​",r.insertNode(p),s=p.getBoundingClientRect(),(h=p.parentNode)==null||h.removeChild(p),n.removeAllRanges(),n.addRange(r)}const u=e.getBoundingClientRect(),c=s.top-u.top+e.scrollTop,f=s.bottom-u.top+e.scrollTop;f>e.scrollTop+e.clientHeight?e.scrollTop=f-e.clientHeight:c<e.scrollTop&&(e.scrollTop=c)}function Jh(){var s,u;const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0),r=n.getBoundingClientRect();if(r.width===0&&r.height===0||n.collapsed&&n.startContainer.nodeType===Node.ELEMENT_NODE&&n.startOffset>0&&((s=n.startContainer.childNodes[n.startOffset-1])==null?void 0:s.nodeName)==="BR"){const c=document.createElement("span");c.textContent="​",n.insertNode(c);const f=c.getBoundingClientRect();return(u=c.parentNode)==null||u.removeChild(c),e.removeAllRanges(),e.addRange(n),f}return r}function ob(e,n){return Math.min(e,n)}function em(e,n,r){const s=window.innerHeight,u=window.innerWidth;let c=e.bottom+window.scrollY+4,f=e.left+window.scrollX;return e.bottom+n+4>s&&(c=e.top+window.scrollY-n-4),f+r>u&&(f=u-r-8),f<8&&(f=8),{top:c,left:f}}var OC=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD]);function MC(e,n,r){for(const s of e)if(n>=s.start&&n<=s.end&&OC.has(s.type))return n===s.start&&r===s.end?null:{start:s.start,end:s.end};return null}var _C=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD,O.FIELD_NAME,O.RANGE,O.SAVED_SEARCH,O.HISTORY_REF,O.REGEX]);function LC(e,n,r){const s=[];for(const u of n)if(r>=u.start&&r<=u.end&&_C.has(u.type)){s.push({start:u.start,end:u.end});break}return e&&Bu(e,r,s),zC(s)}function Bu(e,n,r){if(n<e.start||n>e.end)return!1;let s=!1;switch(e.type){case"BooleanExpr":s=Bu(e.left,n,r)||s,s=Bu(e.right,n,r)||s;break;case"Group":case"Not":case"FieldGroup":s=Bu(e.expression,n,r)||s;break}return r.push({start:e.start,end:e.end}),!0}function zC(e){e.sort((r,s)=>r.end-r.start-(s.end-s.start)||r.start-s.start);const n=[];for(const r of e){const s=n[n.length-1];s&&s.start===r.start&&s.end===r.end||n.push(r)}return n}var UC=60,$C=" ";function BC(e,n){const r=(n==null?void 0:n.maxLineLength)??UC,s=(n==null?void 0:n.indent)??$C,u={whitespace:n==null?void 0:n.whitespaceOperator,and:n==null?void 0:n.andOperator,or:n==null?void 0:n.orOperator,not:n==null?void 0:n.notOperator};let c;return typeof e=="string"?c=new ys(new pi(e,{savedSearches:!0,historySearch:!0}).tokenize()).parse():c=e,c?Iu(c,0,r,s,u):""}function HC(e,n){return e.implicit?n.whitespace??"":e.operator==="AND"?n.and??e.sourceOperator??"AND":n.or??e.sourceOperator??"OR"}function b1(e,n){const r=n.not??e.sourceOperator??"NOT";return{op:r,sep:/^[a-zA-Z]/.test(r)?" ":""}}function Cr(e,n){switch(e.type){case"FieldValue":{const r=e.quoted?`"${e.value}"`:e.value,s=e.operator===":"?":":`:${e.operator}`;let u=`${e.field}${s}${r}`;return e.fuzzy!=null&&(u+=`~${e.fuzzy}`),e.proximity!=null&&(u+=`~${e.proximity}`),e.boost!=null&&(u+=`^${e.boost}`),u}case"BareTerm":{let r=e.quoted?`"${e.value}"`:e.value;return e.fuzzy!=null&&(r+=`~${e.fuzzy}`),e.proximity!=null&&(r+=`~${e.proximity}`),e.boost!=null&&(r+=`^${e.boost}`),r}case"Range":{const r=e.lowerInclusive?"[":"{",s=e.upperInclusive?"]":"}",u=`${r}${e.lowerQuoted?`"${e.lower}"`:e.lower} TO ${e.upperQuoted?`"${e.upper}"`:e.upper}${s}`;return e.field?`${e.field}:${u}`:u}case"Regex":return`/${e.pattern}/`;case"SavedSearch":return`#${e.name}`;case"HistoryRef":return`!${e.ref}`;case"Not":{const{op:r,sep:s}=b1(e,n);return`${r}${s}${Cr(e.expression,n)}`}case"Group":{let r=`(${Cr(e.expression,n)})`;return e.boost!=null&&(r+=`^${e.boost}`),r}case"FieldGroup":{let r=`${e.field}:(${Cr(e.expression,n)})`;return e.boost!=null&&(r+=`^${e.boost}`),r}case"BooleanExpr":{const r=HC(e,n),s=r?` ${r} `:" ";return`${Cr(e.left,n)}${s}${Cr(e.right,n)}`}case"Error":return e.value}}function IC(e){const n=e.operator,r=!!e.implicit,s=[],u=c=>{c.type==="BooleanExpr"&&c.operator===n&&!!c.implicit===r?(u(c.left),u(c.right)):s.push(c)};return u(e),{operator:n,implicit:r,sourceOperator:e.sourceOperator,operands:s}}function Hu(e){return e.type==="Group"||e.type==="FieldGroup"?!0:e.type==="BooleanExpr"?Hu(e.left)||Hu(e.right):e.type==="Not"?Hu(e.expression):!1}var qC={and:"AND",or:"OR",not:"NOT"};function PC(e,n){return!!(Cr(e,qC).length>n||Hu(e))}function Iu(e,n,r,s,u){const c=s.repeat(n);switch(e.type){case"BooleanExpr":{const{operator:f,implicit:h,sourceOperator:p,operands:g}=IC(e),y=h?u.whitespace??"":f==="AND"?u.and??p??"AND":u.or??p??"OR",x=y?` ${y} `:" ",E=g.map(S=>Cr(S,u)).join(x);return E.length<=r?E:g.map((S,w)=>{const j=Iu(S,n,r,s,u);return w===0?j:y?`${c}${y} ${j}`:`${c}${j}`}).join(`
308
- `)}case"Group":{if(!PC(e.expression,r)){let h=`(${Cr(e.expression,u)})`;return e.boost!=null&&(h+=`^${e.boost}`),h}let f=`(
309
- ${FC(Iu(e.expression,n+1,r,s,u),n+1,s)}
310
- ${c})`;return e.boost!=null&&(f+=`^${e.boost}`),f}case"FieldGroup":{let f=`${e.field}:(${Cr(e.expression,u)})`;return e.boost!=null&&(f+=`^${e.boost}`),f}case"Not":{const{op:f,sep:h}=b1(e,u);return`${f}${h}${Iu(e.expression,n,r,s,u)}`}default:return Cr(e,u)}}function FC(e,n,r){const s=r.repeat(n);return e.split(`
311
- `).map(u=>u.startsWith(s)?u:s+u).join(`
312
- `)}function VC(e){return e?Bo(e):[]}function cb(e){return e.type==="BooleanExpr"}function Bo(e){switch(e.type){case"BooleanExpr":return xm(e);case"Group":{const n=[],r=e.expression;return cb(r)?(n.push({start:e.start,end:e.end}),n.push(...Bo(r)),n.push({start:e.start,end:e.end})):n.push({start:e.start,end:e.end}),n}case"FieldGroup":{const n=[];n.push({start:e.start,end:e.end});const r=e.expression;return cb(r)&&n.push(...Bo(r)),n}case"Not":{const n=[];return n.push({start:e.start,end:e.end}),n.push(...Bo(e.expression)),n}case"FieldValue":case"BareTerm":case"SavedSearch":case"HistoryRef":case"Regex":case"Range":case"Error":return[{start:e.start,end:e.end}]}}function xm(e){return e.type==="BooleanExpr"?[...xm(e.left),...xm(e.right)]:Bo(e)}function YC(e,n,r,s){if(e.length===0)return null;if(n>=0&&n<e.length){const u=s==="forward"?n+1:n-1;return u>=0&&u<e.length?{stop:e[u],index:u}:null}if(s==="forward"){for(let u=0;u<e.length;u++)if(e[u].start>=r)return{stop:e[u],index:u};return{stop:e[e.length-1],index:e.length-1}}else{for(let u=e.length-1;u>=0;u--)if(e[u].end<=r)return{stop:e[u],index:u};return{stop:e[0],index:0}}}var GC=class{constructor(e=100){ma(this,"stack",[]);ma(this,"index",-1);ma(this,"maxSize");this.maxSize=e}push(e){if(this.index>=0&&this.stack[this.index].value===e.value){this.stack[this.index].cursorPos=e.cursorPos;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push(e),this.stack.length>this.maxSize&&this.stack.shift(),this.index=this.stack.length-1}replaceCurrent(e){this.index>=0?this.stack[this.index]=e:this.push(e)}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 XC(e,n){const r=s=>(n==null?void 0:n(s))??tC(s);if(e.type==="RANGE"&&e.token){const s=e.token.value,u=(s.endsWith("]")||s.endsWith("}")?s.slice(1,-1):s.slice(1)).match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/);if(u)return{mode:"range",start:r(u[1].trim()),end:r(u[2].trim())}}if(e.type==="FIELD_VALUE"&&e.partial){const s=r(e.partial);if(s)return{mode:"single",start:s,end:null}}return null}function QC(e,n){var r,s,u,c;return((e==null?void 0:e.mode)??"single")!==((n==null?void 0:n.mode)??"single")||(((r=e==null?void 0:e.start)==null?void 0:r.getTime())??0)!==(((s=n==null?void 0:n.start)==null?void 0:s.getTime())??0)?!0:(((u=e==null?void 0:e.end)==null?void 0:u.getTime())??0)!==(((c=n==null?void 0:n.end)==null?void 0:c.getTime())??0)}function KC({position:e,colors:n,onSelect:r,colorConfig:s,styleConfig:u,datePickerInit:c,fixedWidth:f,datePresets:h,datePickerClassName:p}){const g=v.useRef(null),[y,x]=v.useState(!1);if(v.useEffect(()=>{const w=document.createElement("div");return document.body.appendChild(w),g.current=w,x(!0),()=>{document.body.removeChild(w),g.current=null}},[]),!y||!g.current)return null;const E=oc(u),S={position:"absolute",zIndex:E.dropdownZIndex,...v1(n,E),top:`${e.top}px`,left:`${e.left}px`,maxHeight:"none",overflowY:"visible",...f!=null?{width:`${f}px`,minWidth:"unset",maxWidth:"unset"}:{}};return ll.createPortal(v.createElement("div",{className:"ei-datepicker-portal",style:S,onMouseDown:w=>w.preventDefault()},v.createElement(EC,{onSelect:r,colors:s,styles:u,initialMode:c==null?void 0:c.mode,initialStart:c==null?void 0:c.start,initialEnd:c==null?void 0:c.end,presets:h,className:p})),g.current)}function ZC(e){const{fields:n,onSearch:r,onChange:s,onValidationChange:u,value:c,defaultValue:f,savedSearches:h,searchHistory:p,fetchSuggestions:g,colors:y,styles:x,placeholder:E,className:S,classNames:w,style:j,dropdown:R,features:z,inputRef:I,datePresets:$,onKeyDown:Q,onFocus:J,onBlur:ne,onTab:M,validateValue:T,parseDate:fe,plainModeLength:pe,interceptPaste:we,defaultField:re,trailingSpaceOnAccept:je=!0,collapseOnBlur:Te=!1}=e,ee=typeof re=="string"?{name:re,showFieldSuggestions:!1}:re?{showFieldSuggestions:!1,...re}:void 0,L=ee==null?void 0:ee.name,F=(R==null?void 0:R.open)??(R==null?void 0:R.mode)??"always",he=typeof F=="function",P=he?null:F,se=(R==null?void 0:R.alignToInput)??!1,C=R==null?void 0:R.maxSuggestions,B=C||10,K=R==null?void 0:R.suggestDebounceMs,ue=parseInt((x==null?void 0:x.dropdownMaxHeight)||"300",10)||300,ge=(z==null?void 0:z.savedSearches)??!!h,ve=(z==null?void 0:z.historySearch)??!!p,Re=(R==null?void 0:R.showSavedSearchHint)??ge,He=(R==null?void 0:R.showHistoryHint)??ve,$e=(R==null?void 0:R.showOperators)!==!1,Qe=(he||P!=="input")&&(R==null?void 0:R.onNavigation)!==!1,ia=(R==null?void 0:R.navigationDelay)??0,$t=(R==null?void 0:R.loadingDelay)??0,mt=R==null?void 0:R.renderFieldHint,ce=R==null?void 0:R.renderHistoryItem,qe=R==null?void 0:R.renderSavedSearchItem,rt=R==null?void 0:R.renderHeader,Bt=R==null?void 0:R.renderNoResults,ga=R==null?void 0:R.renderType,Rt=(R==null?void 0:R.autoSelect)??!1,_t=(R==null?void 0:R.homeEndKeys)??!1,Kt=(z==null?void 0:z.multiline)!==!1,$a=(z==null?void 0:z.smartSelectAll)??!1,Ba=(z==null?void 0:z.expandSelection)??!1,aa=(z==null?void 0:z.wildcardWrap)??!1,fn=(z==null?void 0:z.clauseNavigation)??!1,hn=z==null?void 0:z.formatQuery,Ja=!!hn,Ha=typeof hn=="object"?hn:void 0,me=v.useMemo(()=>({savedSearches:ge,historySearch:ve}),[ge,ve]),Ce=Array.isArray(n)?n:[],[Ae,Xe]=v.useState(Ce);v.useEffect(()=>{if(Array.isArray(n)){Xe(n);return}let k=!1;return n().then(G=>{k||Xe(G)}),()=>{k=!0}},[n]);const Pe=v.useMemo(()=>{const k=new Map;for(const G of Ae)if(k.set(G.name.toLowerCase(),G.type),G.aliases)for(const Ee of G.aliases)k.set(Ee.toLowerCase(),G.type);return k},[Ae]),te=v.useRef(null),[kt,Zt]=v.useState(null),Pa=v.useCallback(k=>{te.current=k,Zt(k)},[]),va=v.useRef(null),qn=v.useRef(null),_e=v.useRef(c||f||""),xt=v.useRef(null),yt=v.useRef(!1),St=v.useRef(!1),Ht=v.useRef(new GC),Tt=v.useRef(null),na=v.useRef(new Set),Wt=v.useRef(null),It=v.useRef(null),pt=v.useRef(null),et=v.useRef(null),wa=v.useRef(!1),Aa=v.useRef(null),A=v.useRef(null),_=v.useRef(null),q=v.useRef("input"),W=v.useRef(null),ie=v.useRef(-1),ke=v.useRef(()=>{}),ye=v.useRef(new Xh(Ce,[],[],C||10,{showSavedSearchHint:Re,showHistoryHint:He,hasSavedSearchProvider:typeof h=="function",hasHistoryProvider:typeof p=="function"}));ye.current.setDefaultField(ee);const De=v.useRef(new eb(Ce)),Ne=v.useRef(T);Ne.current=T;const[Le,Ue]=v.useState([]),[Ke,Oe]=v.useState(null),[Je,Fe]=v.useState([]),[qt,tt]=v.useState(-1),[dt,ot]=v.useState(!1),[ft,Jt]=v.useState(!1),[Fa,Sa]=v.useState(null),[Da,Oa]=v.useState([]),[Va,vn]=v.useState(!1),[fl,en]=v.useState(!_e.current),[vr,Ze]=v.useState(pe!=null&&_e.current.length>=pe),[Nt,ea]=v.useState(0),[tn,Ma]=v.useState(0),[Mr,jt]=v.useState(""),[Cn,Ya]=v.useState(null),[Ql,Ti]=v.useState(null),Ct=v.useRef({tokens:Le,ast:Ke,suggestions:Je,selectedSuggestionIndex:qt,showDropdown:dt,showDatePicker:ft,cursorOffset:Nt,selectionEnd:tn,autocompleteContext:Mr,validationErrors:Da,cursorContext:Cn});Ct.current={tokens:Le,ast:Ke,suggestions:Je,selectedSuggestionIndex:qt,showDropdown:dt,showDatePicker:ft,cursorOffset:Nt,selectionEnd:tn,autocompleteContext:Mr,validationErrors:Da,cursorContext:Cn};const xr=v.useCallback((k,G)=>{if(se&&va.current){const be=va.current.getBoundingClientRect();return{top:be.bottom+window.scrollY+4,left:be.left+window.scrollX}}const Ee=Jh();return Ee?em(Ee,k,G):null},[se]),cc=v.useCallback(()=>{if(!(!se||!va.current))return va.current.getBoundingClientRect().width},[se]),ir=v.useCallback((k,G,Ee="dropdown")=>{const be=Ee==="datePicker"?k:ob(k,ue);if(se&&Ee!=="datePicker"){ot(!0),Sa(xr(be,G));return}const Ge=requestAnimationFrame(()=>{na.current.delete(Ge),Ee==="datePicker"?Jt(!0):ot(!0);const de=Jh();Sa(de?em(de,be,G):null)});na.current.add(Ge)},[se,xr,ue]),hl=80,Rd=60,Rs=v.useCallback((k,G)=>{if(!te.current)return;const Ee=ii(k,y,{cursorOffset:G,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=Ee,document.activeElement===te.current&&rl(te.current,G)},[y]),xn=v.useCallback((k,G)=>{const Ee=pe!=null&&k.length>=pe;if(Ze(Ee),Ee){if(Ue([]),Oe(null),Oa([]),en(k.length===0),Fe([]),Ct.current.tokens=[],ot(!1),Jt(!1),te.current){const Se=Ul(te.current);te.current.querySelector("span")&&(te.current.textContent=k,rl(te.current,Se)),ea(Se),Ma(Se)}s&&s(k,null),u&&u([]);return}const be=new pi(k,me).tokenize(),Ge=new ys(be),de=Ge.parse(),xe=Du([...Ge.getErrors().map(Se=>({message:Se.message,start:Se.start,end:Se.end,type:"SYNTAX_ERROR"})),...De.current.validate(de,Ne.current,fe,L)]);if(te.current){const Se=Ul(te.current);G&&be.length>hl?(It.current&&clearTimeout(It.current),It.current=setTimeout(()=>{It.current=null,te.current&&Rs(be,Ul(te.current))},Rd)):(It.current&&(clearTimeout(It.current),It.current=null),Rs(be,Se)),Ue(be),Oe(de),Oa(xe),en(k.length===0),ea(Se),Ma(Se),Ct.current.tokens=be,G&&ke.current(be,Se)}else Ue(be),Oe(de),Oa(xe),en(k.length===0),Ct.current.tokens=be;s&&s(k,de),u&&u(xe)},[y,s,u,Rs,pe]),Kl=v.useCallback((k,G)=>{if(!mt||G.type!=="FIELD_VALUE"||!G.fieldName)return k;const Ee=ye.current.resolveField(G.fieldName);if(!Ee)return k;const be=mt(Ee,G.partial);return be==null?k:k.some(Ge=>Ge.type==="hint")?k.map(Ge=>Ge.type==="hint"?{...Ge,customContent:be}:Ge):[{text:"",label:"",type:"hint",customContent:be,replaceStart:G.start??0,replaceEnd:G.end??0},...k]},[mt]),ks=v.useCallback(k=>{if(!Bt)return!1;const G=Bt({cursorContext:k,partial:k.partial});return G==null?!1:(Fe([{text:"",label:"",type:"noResults",customContent:G,replaceStart:0,replaceEnd:0}]),tt(-1),Jt(!1),ir(32,300),!0)},[Bt]),yn=v.useCallback((k,G,Ee)=>{var Se,We,lt;const be=ye.current.getSuggestions(k,G);$e||(be.suggestions=be.suggestions.filter(Be=>Be.type!=="operator"));const Ge=be.context.type;if(Ya(be.context),he){if(F({trigger:q.current,context:be.context,suggestions:be.suggestions,isOpen:Ct.current.showDropdown||Ct.current.showDatePicker,value:_e.current,selectionStart:G,selectionEnd:Ee??G})===!1){ot(!1),Jt(!1),Fe([]);return}}else{if(P==="never"){ot(!1),Jt(!1),Fe([]);return}if(P==="manual"){if(_.current&&_.current!==Ge){_.current=null,ot(!1),Jt(!1),Fe([]);return}if(!_.current){ot(!1),Jt(!1),Fe([]);return}}if(P==="input"&&q.current!=="input"&&q.current!=="ctrlSpace"){ot(!1),Jt(!1),Fe([]);return}if(P==="always"&&k.some(Be=>(Be.type===O.AND||Be.type===O.OR||Be.type===O.NOT||Be.type===O.TILDE||Be.type===O.BOOST)&&G>=Be.start&&G<=Be.end)){ot(!1),Jt(!1),Fe([]);return}}const de=be.context.fieldName?ye.current.resolveField(be.context.fieldName):void 0,xe=!!(g&&be.context.type==="FIELD_VALUE"&&be.context.fieldName&&(de==null?void 0:de.type)!=="boolean"&&(de==null?void 0:de.suggestions)!==!1)||typeof h=="function"&&be.context.type==="SAVED_SEARCH"||typeof p=="function"&&be.context.type==="HISTORY_REF";if(be.showDatePicker){wa.current=!1,(Se=Wt.current)==null||Se.abort(),xt.current&&clearTimeout(xt.current),et.current&&(clearTimeout(et.current),et.current=null);const Be=XC(be.context,fe),Ea=Aa.current;Aa.current=Be,Ti(Be);const Lt=be.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:G,end:G},Ct.current.showDatePicker&&QC(Ea,Be)&&Jt(!1),Fe([]),se||ot(!1),jt(Ge),ir(350,300,"datePicker");return}if(xe){const Be=be.context.token,Ea=Be?Be.start:G,Lt=Be?Be.end:G,rn=()=>{et.current=null,Fe([{text:"",label:"Searching...",type:"loading",replaceStart:Ea,replaceEnd:Lt}]),se||ot(!1),Jt(!1),tt(-1),ir(32,300)};et.current&&clearTimeout(et.current),$t>0?et.current=setTimeout(rn,$t):rn(),jt(Ge)}else{wa.current=!1,(We=Wt.current)==null||We.abort(),xt.current&&clearTimeout(xt.current),et.current&&(clearTimeout(et.current),et.current=null);const Be=Kl(be.suggestions,be.context);Be.length>0?(Fe(Be),se||ot(!1),Jt(!1),tt(be.context.partial||Rt?0:-1),jt(Ge),ir(Be.length*32,300)):(jt(Ge),ks(be.context)||(ot(!1),Jt(!1),Fe([])))}if(xe){const Be=be.context.partial,Ea=K||200;wa.current=!0,xt.current&&clearTimeout(xt.current),(lt=Wt.current)==null||lt.abort();const Lt=new AbortController;Wt.current=Lt,xt.current=setTimeout(async()=>{const rn=be.context.token,ln=rn?rn.start:G,bn=rn?rn.end:G;try{let Na;if(be.context.type==="SAVED_SEARCH"&&typeof h=="function"){const ua=await h(Be);if(Lt.signal.aborted)return;Na=ua.map(zt=>({text:zt.query,label:zt.label||zt.query,description:zt.description,type:"savedSearch",replaceStart:ln,replaceEnd:bn,matchPartial:Be,sourceData:zt}))}else if(be.context.type==="HISTORY_REF"&&typeof p=="function"){const ua=await p(Be);if(Lt.signal.aborted)return;Na=ua.map(zt=>({text:Xh.wrapHistoryQuery(zt.query),label:zt.label||zt.query,description:zt.description,type:"history",replaceStart:ln,replaceEnd:bn,matchPartial:Be,sourceData:zt}))}else{const ua=be.context.fieldName,zt=ye.current.resolveField(ua),es=await g(zt?zt.name:ua,Be);if(Lt.signal.aborted)return;Na=es.map(wr=>({text:wr.text,label:wr.label||wr.text,description:wr.description,type:wr.type,replaceStart:ln,replaceEnd:bn,matchPartial:Be}))}if(et.current&&(clearTimeout(et.current),et.current=null),Na=Na.slice(0,B),Na.length>0){if(ee!=null&&ee.showFieldSuggestions){const ua=ye.current.getFieldSuggestions(Be,ln,bn);Na=[...Na,...ua].slice(0,B)}Fe(Na),tt(Be||Rt?0:-1),ir(Na.length*32,300)}else{const ua=ye.current.getSuggestions(Ct.current.tokens,Ct.current.cursorOffset);if(!(Be&&ks(ua.context))){const zt=Kl(ua.suggestions.filter(es=>es.type==="hint"),ua.context);zt.length>0?(Fe(zt),tt(ua.context.partial||Rt?0:-1),ir(zt.length*32,300)):ks(ua.context)||(ot(!1),Fe([]))}}}catch(Na){et.current&&(clearTimeout(et.current),et.current=null),Lt.signal.aborted||(Fe([{text:"",label:Na instanceof Error?Na.message:"Error loading suggestions",type:"error",replaceStart:ln,replaceEnd:bn}]),tt(-1),ir(32,300),wa.current=!1)}},Ea)}},[g,h,p,K,Kl,xr,ir,se,F,he,P,$e,B,$t,Rt,ks]);ke.current=yn;const ra=v.useCallback(()=>{var k;ot(!1),Jt(!1),Ti(null),Aa.current=null,A.current=null,Fe([]),tt(-1),wa.current=!1,(k=Wt.current)==null||k.abort(),xt.current&&(clearTimeout(xt.current),xt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null),_.current=null},[]),an=v.useCallback((k,G,Ee)=>{if(pt.current&&(clearTimeout(pt.current),pt.current=null),!Qe){(Ct.current.showDropdown||Ct.current.showDatePicker)&&ra();return}q.current="navigation",ia>0?pt.current=setTimeout(()=>{pt.current=null,yn(k,G,Ee)},ia):yn(k,G,Ee)},[Qe,ia,yn,ra]),An=v.useCallback((k,G,Ee)=>{_e.current=k,Tt.current&&(clearTimeout(Tt.current),Tt.current=null),Ht.current.push({value:k,cursorPos:G});const be=new pi(k,me).tokenize(),Ge=new ys(be),de=Ge.parse(),xe=Du([...Ge.getErrors().map(Se=>({message:Se.message,start:Se.start,end:Se.end,type:"SYNTAX_ERROR"})),...De.current.validate(de,Ne.current,fe,L)]);if(te.current){const Se=ii(be,y,{cursorOffset:G,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=Se,rl(te.current,G)}if(Ue(be),Oe(de),Oa(xe),en(k.length===0),ea(G),Ma(G),ot(!1),Jt(!1),s&&s(k,de),u&&u(xe),Ee){const Se=requestAnimationFrame(()=>{na.current.delete(Se),Ee(be,de)});na.current.add(Se)}},[y,s,u]),_r=v.useCallback((k,G="Enter",Ee,be)=>{if(!k)return;const Ge=Ct.current,de=Ge.autocompleteContext,xe=de==="FIELD_VALUE"||de==="SAVED_SEARCH"||de==="HISTORY_REF";if(xe&&(q.current="navigation"),k.type==="hint"&&(k.text==="#"||k.text==="!")){const ua=k.text,zt=k.replaceStart,es=Math.max(k.replaceEnd,Ge.selectionEnd),wr=_e.current.slice(0,zt),Td=_e.current.slice(es),hc=wr+ua+Td,mc=wr.length+ua.length;An(hc,mc,(Cd,Ad)=>{Ee?Ee(hc,Ad):yn(Cd,mc)});return}if(k.type==="hint")return;const Se=Ge.autocompleteContext==="FIELD_VALUE",We=Math.min(k.replaceStart,Ge.cursorOffset),lt=Math.max(k.replaceEnd,Ge.selectionEnd),Be=_e.current.slice(0,We),Ea=_e.current.slice(lt);let Lt="",rn=Ea;xe&&je&&(Ea.length===0?Lt=" ":/^[ \t\r\n]+$/.test(Ea)&&!Ea.startsWith("\\ ")&&(Lt=" ",rn=""));const ln=Be+k.text+Lt+rn,bn=Be.length+k.text.length+Lt.length,Na=G==="Enter"&&Se;An(ln,bn,(ua,zt)=>{Ee?Ee(ln,zt):Na?r&&r(ln,zt,be):yn(ua,bn)})},[An,yn,r,je]);v.useEffect(()=>{Array.isArray(h)&&ye.current.updateSavedSearches(h),Array.isArray(p)&&ye.current.updateSearchHistory(p)},[h,p]),v.useEffect(()=>{ye.current=new Xh(Ae,[],[],C||10,{showSavedSearchHint:Re,showHistoryHint:He,hasSavedSearchProvider:typeof h=="function",hasHistoryProvider:typeof p=="function"}),ye.current.setDefaultField(ee),De.current=new eb(Ae),Array.isArray(h)&&ye.current.updateSavedSearches(h),Array.isArray(p)&&ye.current.updateSearchHistory(p),_e.current&&xn(_e.current,!1)},[Ae,C,Re,He]),v.useEffect(()=>{I&&I({getValue:()=>_e.current,setValue:k=>{_e.current=k,xn(k,!1)},focus:()=>{var k;return(k=te.current)==null?void 0:k.focus()},blur:()=>{var k;return(k=te.current)==null?void 0:k.blur()},getAST:()=>Ct.current.ast,getValidationErrors:()=>Ct.current.validationErrors,setSelection:(k,G)=>{te.current&&(te.current.focus(),nl(te.current,k,G),ea(k),Ma(G))}})},[I,xn]),v.useEffect(()=>{const k=_e.current;Ht.current.push({value:k,cursorPos:k.length}),k&&xn(k,!1)},[]),v.useEffect(()=>{c!==void 0&&c!==_e.current&&(_e.current=c,xn(c,!1))},[c,xn]),v.useEffect(()=>()=>{var k;xt.current&&clearTimeout(xt.current),It.current&&clearTimeout(It.current),pt.current&&clearTimeout(pt.current),et.current&&clearTimeout(et.current),na.current.forEach(G=>cancelAnimationFrame(G)),na.current.clear(),(k=Wt.current)==null||k.abort()},[]),v.useEffect(()=>{if(he){const k=Ct.current;k.cursorContext&&F({trigger:"modeChange",context:k.cursorContext,suggestions:k.suggestions,isOpen:k.showDropdown||k.showDatePicker,value:_e.current,selectionStart:k.cursorOffset,selectionEnd:k.selectionEnd})===!1&&(ot(!1),Jt(!1),Fe([]))}else P==="never"&&(ot(!1),Jt(!1),Fe([]));_.current=null},[F]);const yr=v.useRef(!1);v.useLayoutEffect(()=>{if(yr.current){yr.current=!1;return}const k=qn.current;if(!k||!Fa)return;const G=k.getBoundingClientRect(),Ee=window.innerWidth;if(G.right>Ee-8){const be=G.right-Ee+8;yr.current=!0,Sa(Ge=>Ge&&{...Ge,left:Math.max(8,Ge.left-be)})}},[Fa,dt,ft,Je]),v.useEffect(()=>{const k=()=>{const G=Ct.current;if(!(!G.showDropdown&&!G.showDatePicker))if(G.showDropdown&&se&&va.current){const Ee=va.current.getBoundingClientRect();Sa({top:Ee.bottom+window.scrollY+4,left:Ee.left+window.scrollX})}else{const Ee=Jh();Ee&&Sa(em(Ee,G.showDatePicker?350:ob(G.suggestions.length*32,ue),300))}};return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[se,ue]),v.useEffect(()=>{const k=te.current;if(!k)return;const G=()=>{(Ct.current.showDropdown||Ct.current.showDatePicker)&&ra()};return k.addEventListener("scroll",G),()=>k.removeEventListener("scroll",G)},[ra]);const Lr=v.useRef(null),Ci=v.useRef(y);v.useEffect(()=>{if(!te.current)return;const k=Ct.current.tokens;if(k.length===0||Va&&tn!==Nt)return;const G=Va?Nt:-1,Ee=y!==Ci.current;Ci.current=y;const be=x1(k,G),Ge=be?`${be.openStart},${be.closeStart}`:null;if(Ge===Lr.current&&!Ee)return;Lr.current=Ge;const de=Va?Ul(te.current):-1,xe=ii(k,y,{cursorOffset:G,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=xe,Va&&de>=0&&rl(te.current,de)},[Nt,tn,Va,y]);const br=Te&&!Va,Ai=v.useRef(br);v.useEffect(()=>{if(!te.current)return;const k=Ai.current;if(Ai.current=br,k!==br)if(br)te.current.innerHTML=te.current.innerHTML.replace(/<br\s*\/?>/gi," ");else{const G=Ct.current.tokens;if(G.length>0){const Ee=Va?Ul(te.current):-1,be=ii(G,y,{cursorOffset:Ee,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=be,Va&&Ee>=0&&rl(te.current,Ee)}}},[br,y]);const Pn=v.useCallback(()=>{if(yt.current||!te.current)return;W.current=null,ie.current=-1,pt.current&&(clearTimeout(pt.current),pt.current=null);let k=ZT(te.current);if(k===_e.current)return;let G=Ul(te.current);const Ee=Qy(k);Ee!==k&&(k=Ee,G=Math.min(G,k.length)),_e.current=k;const be=Ht.current,Ge=be.current();if(Ge&&Math.abs(k.length-Ge.value.length)<=2&&Tt.current?be.replaceCurrent({value:k,cursorPos:G}):be.push({value:k,cursorPos:G}),Tt.current&&clearTimeout(Tt.current),Tt.current=setTimeout(()=>{Tt.current=null},300),q.current="input",!he&&P==="input"){const de=G>0?k[G-1]:"";if(!de||de.trim()===""){xn(k,!1),ra(),te.current&&Ou(te.current);return}}xn(k,!0),te.current&&Ou(te.current)},[xn,he,P,ra]),or=v.useCallback(()=>{yt.current=!0},[]),Di=v.useCallback(()=>{yt.current=!1,Pn()},[Pn]),zr=v.useCallback(k=>{if(!k)return;_e.current=k.value;const G=new pi(k.value,me).tokenize(),Ee=new ys(G),be=Ee.parse(),Ge=Du([...Ee.getErrors().map(xe=>({message:xe.message,start:xe.start,end:xe.end,type:"SYNTAX_ERROR"})),...De.current.validate(be,Ne.current,fe,L)]),de=k.selStart!=null&&k.selStart!==k.cursorPos;if(te.current){const xe=ii(G,y,{cursorOffset:k.cursorPos,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=xe,de?nl(te.current,k.selStart,k.cursorPos):rl(te.current,k.cursorPos)}Ue(G),Oe(be),Oa(Ge),en(k.value.length===0),ea(de?k.selStart:k.cursorPos),Ma(k.cursorPos),ra(),s&&s(k.value,be),u&&u(Ge)},[y,s,u,ra]),Fn=v.useCallback(()=>{const k=qn.current;if(!k)return 10;const G=k.clientHeight,Ee=k.querySelectorAll(".ei-dropdown-item")[0];if(!Ee)return 10;const be=Ee.offsetHeight;return be<=0?10:Math.max(1,Math.floor(G/be))},[]),Oi=v.useCallback(k=>{var be,Ge;if(Q&&Q(k),k.defaultPrevented)return;const G=Ct.current,Ee=k.nativeEvent.code;if(Ja&&Ee==="KeyF"&&k.altKey&&k.shiftKey&&!k.ctrlKey&&!k.metaKey){k.preventDefault();const de=BC(_e.current,Ha);de!==_e.current&&An(de,de.length);return}if(te.current&&te.current.childNodes.length>40){const de=window.getSelection();if(de!=null&&!de.isCollapsed){const xe=kr(te.current);if(xe.end-xe.start>20){const Se=k.key==="Backspace"||k.key==="Delete"||k.key==="x"&&(k.ctrlKey||k.metaKey),We=!k.ctrlKey&&!k.metaKey&&!k.altKey&&k.key.length===1;(Se||We)&&(te.current.textContent=_e.current,nl(te.current,xe.start,xe.end))}}}{let de=null,xe=null;if(Ky[k.key])de=k.key,xe=Ky[k.key];else if(aa&&k.key==="*"&&te.current){const Se=kr(te.current);if(Se.start!==Se.end){const[We,lt]=Zy(G.tokens,Se.start,Se.end);if(We>=0&&We===lt){const Be=G.tokens[We];(Be.type===O.VALUE||Be.type===O.WILDCARD)&&(de="*",xe="*")}}}if(de&&xe&&te.current){const Se=kr(te.current);if(Se.start!==Se.end){k.preventDefault();const{newValue:We,newSelStart:lt,newSelEnd:Be}=KT(_e.current,Se.start,Se.end,de,xe),Ea=Ht.current,Lt=Ea.current();Lt&&Lt.value===_e.current&&(Lt.selStart=Se.start,Lt.cursorPos=Se.end),_e.current=We,Tt.current&&(clearTimeout(Tt.current),Tt.current=null),Ea.push({value:We,cursorPos:Be,selStart:lt});const rn=new pi(We,me).tokenize(),ln=new ys(rn),bn=ln.parse(),Na=Du([...ln.getErrors().map(zt=>({message:zt.message,start:zt.start,end:zt.end,type:"SYNTAX_ERROR"})),...De.current.validate(bn,Ne.current,fe,L)]),ua=ii(rn,y,{cursorOffset:Be,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});te.current.innerHTML=ua,nl(te.current,lt,Be),Ue(rn),Oe(bn),Oa(Na),en(!1),ea(lt),Ma(Be),ra(),s&&s(We,bn),u&&u(Na);return}}}if(k.key==="z"&&(k.ctrlKey||k.metaKey)&&!k.shiftKey){k.preventDefault(),zr(Ht.current.undo());return}if(k.key==="y"&&(k.ctrlKey||k.metaKey)||k.key==="z"&&(k.ctrlKey||k.metaKey)&&k.shiftKey){k.preventDefault(),zr(Ht.current.redo());return}if(k.key==="a"&&(k.ctrlKey||k.metaKey)&&$a&&te.current){const de=kr(te.current),xe=MC(G.tokens,de.start,de.end);if(xe){k.preventDefault(),nl(te.current,xe.start,xe.end),ea(xe.start),Ma(xe.end);return}}if(Ba&&k.altKey&&k.shiftKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&te.current){const de=Ee==="ArrowRight";let xe=W.current;if(!xe){const We=kr(te.current),lt=LC(G.ast,G.tokens,We.start);if(lt.length===0)return;xe={ranges:lt,level:-1},W.current=xe}const Se=de?Math.min(xe.level+1,xe.ranges.length-1):Math.max(xe.level-1,-1);if(Se===xe.level)return;if(xe.level=Se,Se<0){const We=kr(te.current);rl(te.current,We.start),W.current=null}else{k.preventDefault();const We=xe.ranges[Se];nl(te.current,We.start,We.end),ea(We.start),Ma(We.end)}return}if(W.current=null,fn&&k.ctrlKey&&k.altKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&te.current){k.preventDefault();const de=Ee==="ArrowRight"?"forward":"backward",xe=VC(G.ast),Se=kr(te.current),We=de==="forward"?Se.end:Se.start,lt=YC(xe,ie.current,We,de);lt&&(ie.current=lt.index,nl(te.current,lt.stop.start,lt.stop.end),ea(lt.stop.start),Ma(lt.stop.end));return}if(ie.current=-1,k.key===" "&&(k.ctrlKey||k.metaKey)){k.preventDefault(),q.current="ctrlSpace",!he&&P==="manual"&&(_.current=ye.current.getSuggestions(G.tokens,G.cursorOffset).context.type),yn(G.tokens,G.cursorOffset);return}if(k.key==="Enter"&&(k.ctrlKey||k.metaKey)){k.preventDefault(),ra(),r&&r(_e.current,G.ast,k);return}if(k.key==="Enter"&&k.shiftKey&&Kt){k.preventDefault(),DC();const de=te.current?Ul(te.current):_e.current.length+1,xe=_e.current,Se=xe.slice(0,de-1)+`
313
- `+xe.slice(de-1);_e.current=Se,W.current=null,pt.current&&(clearTimeout(pt.current),pt.current=null),q.current="input",Ht.current.push({value:Se,cursorPos:de}),xn(Se,!0),te.current&&Ou(te.current);return}if((k.key==="Backspace"||k.key==="Delete")&&te.current&&!te.current.textContent){const de=_e.current;if(!de)return;const{start:xe,end:Se}=kr(te.current);let We,lt;if(xe!==Se)We=de.slice(0,xe)+de.slice(Se),lt=xe;else if(k.key==="Backspace"&&xe>0)We=de.slice(0,xe-1)+de.slice(xe),lt=xe-1;else if(k.key==="Delete"&&xe<de.length)We=de.slice(0,xe)+de.slice(xe+1),lt=xe;else return;k.preventDefault(),_e.current=We,W.current=null,pt.current&&(clearTimeout(pt.current),pt.current=null),q.current="input",Ht.current.push({value:We,cursorPos:lt}),rl(te.current,lt),xn(We,!0),te.current&&Ou(te.current);return}if(St.current=!1,G.showDropdown&&G.suggestions.length>0)switch(k.key){case"ArrowDown":k.preventDefault(),St.current=!0,tt(de=>de>=G.suggestions.length-1?0:de+1);return;case"ArrowUp":k.preventDefault(),St.current=!0,tt(de=>de<=0?G.suggestions.length-1:de-1);return;case"PageDown":{k.preventDefault(),St.current=!0;const de=Fn();tt(xe=>Math.min(xe+de,G.suggestions.length-1));return}case"PageUp":{k.preventDefault(),St.current=!0;const de=Fn();tt(xe=>Math.max(xe-de,0));return}case"Home":if(_t&&G.selectedSuggestionIndex>=0){k.preventDefault(),St.current=!0,tt(0);return}break;case"End":if(_t&&G.selectedSuggestionIndex>=0){k.preventDefault(),St.current=!0,tt(G.suggestions.length-1);return}break;case"Enter":if(G.selectedSuggestionIndex>=0){const de=G.suggestions[G.selectedSuggestionIndex];if(de.type==="loading"||de.type==="error"){k.preventDefault(),ra(),r&&r(_e.current,G.ast,k);return}if(de.type==="hint"&&de.text!=="#"&&de.text!=="!"){k.preventDefault(),ra();const xe=_e.current,Se=G.cursorOffset;if(Se<=xe.length&&xe[Se]!==" "){const We=xe.slice(0,Se),lt=xe.slice(Se),Be=We+" "+lt;An(Be,Se+1,()=>{r&&r(Be,G.ast,k)})}else r&&r(xe,G.ast,k);return}k.preventDefault(),_r(de,"Enter",void 0,k);return}k.preventDefault(),ra(),r&&r(_e.current,G.ast,k);return;case"Tab":if(M){k.preventDefault();const de=G.selectedSuggestionIndex>=0?G.suggestions[G.selectedSuggestionIndex]:null,xe=de&&de.type!=="loading"&&de.type!=="error"&&!(de.type==="hint"&&de.text!=="#"&&de.text!=="!")?de:null,Se=M({suggestion:xe,cursorContext:G.cursorContext||{type:"EMPTY",partial:""},query:_e.current});Se.accept&&xe?_r(xe,"Tab",(We,lt)=>{var Be;Se.submit&&r&&r(We,lt,k),Se.blur&&((Be=te.current)==null||Be.blur())},k):(ra(),Se.submit&&r&&r(_e.current,G.ast,k),Se.blur&&((be=te.current)==null||be.blur()));return}if(G.selectedSuggestionIndex>=0){const de=G.suggestions[G.selectedSuggestionIndex];if(de.type==="hint"&&de.text!=="#"&&de.text!=="!"){k.preventDefault(),ra();const xe=_e.current,Se=G.cursorOffset;if(Se<=xe.length&&xe[Se]!==" "){const We=xe.slice(0,Se),lt=xe.slice(Se),Be=We+" "+lt,Ea=Se+1;An(Be,Ea,Lt=>{yn(Lt,Ea)})}return}k.preventDefault(),_r(de,"Tab",void 0,k);return}break;case"Escape":k.preventDefault(),ra();return}if(k.key==="Tab"&&M){k.preventDefault();const de=M({suggestion:null,cursorContext:G.cursorContext||{type:"EMPTY",partial:""},query:_e.current});de.submit&&r&&r(_e.current,G.ast,k),de.blur&&((Ge=te.current)==null||Ge.blur());return}if(G.showDatePicker&&k.key==="Escape"){k.preventDefault(),ra();return}if(k.key==="Enter"&&!G.showDropdown&&!G.showDatePicker){k.preventDefault(),r&&r(_e.current,G.ast,k);return}},[r,ra,_r,An,zr,Kt,he,P,yn,Q,M,$a,Ba,fn,_t,Fn,Ja]),Ts=v.useCallback(k=>{if(St.current){St.current=!1;return}if(["ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(k.key)){if(!te.current)return;const G=kr(te.current);ea(G.start),Ma(G.end),an(Ct.current.tokens,G.start,G.end)}},[an]),uc=v.useCallback(()=>{vn(!0),J==null||J();const k=requestAnimationFrame(()=>{if(na.current.delete(k),te.current){const G=Ct.current.tokens,Ee=G.length>0?Ul(te.current):0;ea(Ee),Ma(Ee),an(G,Ee)}});na.current.add(k)},[Pn,an,J]),Cs=v.useCallback(()=>{var k;vn(!1),ot(!1),Jt(!1),Fe([]),wa.current=!1,(k=Wt.current)==null||k.abort(),xt.current&&(clearTimeout(xt.current),xt.current=null),et.current&&(clearTimeout(et.current),et.current=null),ea(-1),ne==null||ne()},[ne]),Ur=v.useRef(!1),dc=v.useCallback(k=>{if(!te.current||k.detail!==2&&k.detail!==3)return;if(k.detail===3){if(!Ct.current.ast)return;const Se=document.caretRangeFromPoint(k.clientX,k.clientY);if(!Se)return;const We=Yo(te.current,Se.startContainer,Se.startOffset),lt=YT(Ct.current.ast,_e.current,We);if(!lt||lt.start>=lt.end)return;k.preventDefault(),Ur.current=!0,nl(te.current,lt.start,lt.end);return}k.preventDefault(),Ur.current=!0;const G=document.caretRangeFromPoint(k.clientX,k.clientY);if(!G)return;const Ee=Yo(te.current,G.startContainer,G.startOffset),be=_e.current,Ge=Se=>!/[\s:()[\]{}"<>!,;|&=~^+\-*/\\]/.test(Se);let de=Ee;for(;de>0&&Ge(be[de-1]);)de--;let xe=Ee;for(;xe<be.length&&Ge(be[xe]);)xe++;de<xe&&nl(te.current,de,xe)},[]),nn=v.useCallback(k=>{Ur.current&&(k.preventDefault(),Ur.current=!1)},[]),$r=v.useCallback(()=>{if(!te.current)return;const k=kr(te.current);if(ea(k.start),Ma(k.end),k.start!==k.end){const[G,Ee]=Zy(Ct.current.tokens,k.start,k.end);if(G!==Ee){ra();return}}an(Ct.current.tokens,k.start,k.end)},[an,ra]),Br=v.useCallback(k=>{Tt.current&&(clearTimeout(Tt.current),Tt.current=null),AC(k),Pn()},[Pn]),Zl=v.useCallback(k=>{k.preventDefault();const G=Qy(k.clipboardData.getData("text/plain"));if(we){const Ee=we(G,k);Ee!=null&&typeof(Ee==null?void 0:Ee.then)=="function"?Ee.then(be=>{be!=null&&Br(be)}).catch(()=>{}):Ee!=null&&Br(Ee)}else Br(G)},[we,Br]),kd=v.useCallback(k=>{q.current="navigation";const G=Ct.current,Ee=A.current,be=Ee?Ee.start:G.cursorOffset,Ge=Ee?Ee.end:G.cursorOffset,de=_e.current.slice(0,be),xe=_e.current.slice(Ge);let Se="",We=xe;je&&k.length>0&&(xe.length===0?Se=" ":/^[ \t\r\n]+$/.test(xe)&&!xe.startsWith("\\ ")&&(Se=" ",We=""));const lt=de+k+Se+We,Be=de.length+k.length+Se.length;An(lt,Be,Ea=>{te.current&&te.current.focus(),yn(Ea,Be)})},[An,yn,je]),ml=ic(y),Wl=oc(x),Jl=lC(ml,j),Hr={...sC(ml,Wl),...Va?iC(Wl):{}};br&&(Hr.whiteSpace="nowrap",Hr.overflow="hidden",Hr.textOverflow="ellipsis");const fc=oC(ml,Wl);return v.createElement("div",{ref:va,style:Jl,className:Bn("ei-container",S,w==null?void 0:w.container)},v.createElement("div",{ref:Pa,contentEditable:!0,suppressContentEditableWarning:!0,className:Bn("ei-editor",w==null?void 0:w.editor),style:Hr,onInput:Pn,onKeyDown:Oi,onKeyUp:Ts,onMouseDown:dc,onMouseUp:nn,onFocus:uc,onBlur:Cs,onClick:$r,onPaste:Zl,onCompositionStart:or,onCompositionEnd:Di,spellCheck:!1}),fl&&!Va?v.createElement("div",{className:Bn("ei-placeholder",w==null?void 0:w.placeholder),style:fc},E):null,v.createElement(CC,{errors:Da,editorRef:kt,cursorOffset:Nt,colors:y,styles:x,containerRef:va.current,classNames:w?{squiggly:w.squiggly,tooltip:w.tooltip}:void 0}),v.createElement(wC,{suggestions:Je,selectedIndex:qt,onSelect:k=>_r(k,"Tab"),position:Fa,colors:y,styles:x,visible:dt,fixedWidth:cc(),renderHistoryItem:ce,renderSavedSearchItem:qe,renderDropdownHeader:rt,cursorContext:Cn,listRefCallback:k=>{qn.current=k},renderType:ga,classNames:w?{dropdown:w.dropdown,dropdownHeader:w.dropdownHeader,dropdownItem:w.dropdownItem}:void 0}),ft&&Fa?v.createElement(KC,{position:Fa,colors:ml,onSelect:kd,colorConfig:y,styleConfig:x,datePickerInit:Ql,fixedWidth:void 0,datePresets:$,datePickerClassName:w==null?void 0:w.datePicker}):null)}const WC=["planned","in-progress","done","blocked","canceled","rejected","deferred","waiting"];function ub(e){var u;const n=window.getSelection();if(!n||n.rangeCount===0)return((u=e.textContent)==null?void 0:u.length)??0;const r=n.getRangeAt(0),s=r.cloneRange();return s.selectNodeContents(e),s.setEnd(r.endContainer,r.endOffset),s.toString().length}function JC(e){return n=>{if(!(n.ctrlKey&&!n.metaKey&&!n.altKey))return;const r=n.key.toLowerCase(),s=n.currentTarget,u=s.isContentEditable?s:s.querySelector("[contenteditable='true'], [contenteditable]")??s,c=e.current;if(r==="h"&&c){n.preventDefault();const h=c.getValue();let p=ub(u);(p<0||p>h.length)&&(p=h.length),p>0&&(c.setValue(h.slice(0,p-1)+h.slice(p)),c.setSelection(p-1,p-1));return}if(r==="u"&&c){n.preventDefault();const h=c.getValue();let p=ub(u);if((p<0||p>h.length)&&(p=h.length),p===0)return;let g=p;for(;g>0&&/\s/.test(h[g-1]??"");)g--;if(g===p)for(;g>0&&!/\s/.test(h[g-1]??"");)g--;g<p&&(c.setValue(h.slice(0,g)+h.slice(p)),c.setSelection(g,g));return}const f=r==="j"?"ArrowDown":r==="k"?"ArrowUp":null;f&&(n.preventDefault(),u.dispatchEvent(new KeyboardEvent("keydown",{key:f,bubbles:!0,cancelable:!0})))}}function tm(e){return String(e>0?e:0).padStart(3,"0")}function eA({features:e,phases:n,query:r,onQuery:s}){const u=v.useRef(null),c=JC(u),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"}],[]),h=v.useMemo(()=>{const x=[...new Set(e.map(R=>R.number))].sort((R,z)=>R-z),E=[...new Set(n.map(R=>R.number))].sort((R,z)=>R-z),S=[...new Set(n.flatMap(R=>R.tasks.map(z=>z.number)))].sort((R,z)=>R-z),w=[...new Set([...e.map(R=>R.shortId),...n.flatMap(R=>[R.shortId,...R.tasks.map(z=>z.shortId)])].filter(Boolean))],j=[...new Set(n.flatMap(R=>R.tasks.map(z=>z.title)))];return{featureNums:x,phaseNums:E,taskNums:S,shortIds:w,titles:j}},[e,n]),p=v.useCallback(async(x,E)=>{const S=E.toLowerCase();return x==="feature"?h.featureNums.filter(w=>String(w).startsWith(E)).slice(0,20).map(w=>({text:String(w),label:`F${tm(w)}`})):x==="phase"?h.phaseNums.filter(w=>String(w).startsWith(E)).slice(0,20).map(w=>({text:String(w),label:`P${tm(w)}`})):x==="task"?h.taskNums.filter(w=>String(w).startsWith(E)).slice(0,20).map(w=>({text:String(w),label:`T${tm(w)}`})):x==="id"?h.shortIds.filter(w=>w.toLowerCase().startsWith(S)).slice(0,20).map(w=>({text:w,label:w})):x==="status"||x==="feature-status"||x==="phase-status"?WC.filter(w=>w.startsWith(S)).map(w=>({text:w,label:w})):x==="title"?h.titles.filter(w=>w.toLowerCase().includes(S)).slice(0,20).map(w=>({text:w,label:w.length>44?w.slice(0,44)+"…":w})):[]},[h]),g=v.useCallback(x=>s(x),[s]),y=v.useCallback(x=>{u.current=x},[]);return o.jsx("div",{className:"search-bar",children:o.jsx(ZC,{fields:f,value:r,onChange:g,onSearch:g,fetchSuggestions:p,onKeyDown:c,inputRef:y,placeholder:"Search Work Tree… e.g. feature:1 id:UUXD1 title:auth status:in-progress"})})}function db(){const e=new URL(window.location.href);e.searchParams.has("locate")&&(e.searchParams.delete("locate"),window.history.replaceState(window.history.state,"",`${e.pathname}${e.search}${e.hash}`))}function tA(e,n){if(Object.keys(n).length===0)return e;const r=c=>{const f=n[c];return f?new Map(f.map((h,p)=>[h,p])):null},s=r("__features__");return(s?[...e].sort((c,f)=>(s.get(c.feature.id)??1/0)-(s.get(f.feature.id)??1/0)):e).map(c=>{const f=r(`phase-scope:${c.feature.id}`),h=f?[...c.allPhases].sort((p,g)=>(f.get(p.phase.id)??1/0)-(f.get(g.phase.id)??1/0)):c.allPhases;return{...c,allPhases:h.map(p=>{const g=r(`task-scope:${p.phase.id}`),y=g?[...p.allTasks].sort((x,E)=>(g.get(x.id)??1/0)-(g.get(E.id)??1/0)):p.allTasks;return{...p,allTasks:y}})}})}function oi({active:e=!1,disabled:n=!1,onClick:r,children:s}){return o.jsx("button",{type:"button",disabled:n,onClick:r,className:`inline-flex h-7 min-h-7 shrink-0 items-center justify-center whitespace-nowrap rounded-[9px] border px-2 py-1 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] sm:h-8 sm:min-h-8 sm:rounded-[10px] sm:px-2.5 ${e?"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)]"} ${n?"cursor-not-allowed opacity-60":""}`,children:s})}function aA({features:e,phases:n,activeTasks:r,projectStorageScope:s,resumeRequiredIds:u=new Set,analyticsFilter:c=null,onClearAnalyticsFilter:f}){const h=IT({features:e,phases:n,projectStorageScope:s}),p=v.useMemo(()=>c?h.displayedWorkTree.map(P=>({...P,allPhases:P.allPhases.map(se=>({...se,allTasks:se.allTasks.filter(C=>c.taskIds.has(C.id))})).filter(se=>se.allTasks.length>0)})).filter(P=>P.allPhases.length>0):h.displayedWorkTree,[c,h.displayedWorkTree]),g=v.useMemo(()=>new Set(p.map(P=>P.feature.id)),[p]),y=v.useMemo(()=>new Set(p.flatMap(P=>P.allPhases.map(se=>se.phase.id))),[p]),x=v.useMemo(()=>p.reduce((P,se)=>P+se.allPhases.reduce((C,B)=>C+B.allTasks.length,0),0),[p]),[E,S]=v.useState({});v.useEffect(()=>{S({})},[p]);const w=v.useMemo(()=>tA(p,E),[p,E]),[j,R]=v.useState(!1),[z,I]=v.useState(null),[$,Q]=v.useState(null),J=P=>Q(String(P.active.id)),[ne,M]=v.useState(0);v.useEffect(()=>{const P=document.querySelector("header");if(!P)return;const se=()=>M(P.offsetHeight);se();const C=new ResizeObserver(se);return C.observe(P),window.addEventListener("resize",se),()=>{C.disconnect(),window.removeEventListener("resize",se)}},[]),v.useEffect(()=>{const P=window.setTimeout(()=>{const se=document.querySelector(".ap-search-sticky"),C=document.querySelector("header");if(!se||!C)return;const B=se.getBoundingClientRect();if(B.top<0){const K=B.top+window.scrollY-C.offsetHeight;window.scrollTo({top:Math.max(0,K),behavior:"smooth"})}},60);return()=>window.clearTimeout(P)},[h.searchQuery,h.hideDone,h.hidePlanned,h.onlyActiveBranches]);const T=nk(ak(Km,{activationConstraint:{distance:5}})),fe=async P=>{const{active:se,over:C}=P;if(Q(null),!C||se.id===C.id)return;const B=String(se.id),K=String(C.id),ue=w.map(ge=>ge.feature.id);if(ue.includes(B)&&ue.includes(K)){const ge=$o(ue,ue.indexOf(B),ue.indexOf(K)),ve=ge.indexOf(B),Re=ve>0?ge[ve-1]??null:null,He=ve<ge.length-1?ge[ve+1]??null:null;S($e=>({...$e,__features__:ge})),await $h("feature",B,Re,He).catch(()=>{});return}for(const ge of w){const ve=ge.allPhases.map(Re=>Re.phase.id);if(ve.includes(B)&&ve.includes(K)){const Re=$o(ve,ve.indexOf(B),ve.indexOf(K)),He=Re.indexOf(B),$e=He>0?Re[He-1]??null:null,Qe=He<Re.length-1?Re[He+1]??null:null;S(ia=>({...ia,[`phase-scope:${ge.feature.id}`]:Re})),await $h("phase",B,$e,Qe).catch(()=>{});return}}for(const ge of w)for(const ve of ge.allPhases){const Re=ve.allTasks.map(He=>He.id);if(Re.includes(B)&&Re.includes(K)){const He=$o(Re,Re.indexOf(B),Re.indexOf(K)),$e=He.indexOf(B),Qe=$e>0?He[$e-1]??null:null,ia=$e<He.length-1?He[$e+1]??null:null;S($t=>({...$t,[`task-scope:${ve.phase.id}`]:He})),await $h("task",B,Qe,ia).catch(()=>{});return}}},pe=P=>c?y.has(P):h.expandedPhaseIds.includes(P),we=P=>h.recentPhaseIds.includes(P),re=P=>h.recentTaskIds.includes(P),[je]=Wo(),[Te,ee]=v.useState(null),L=je.get("locate"),F=L?parseInt(L.replace(/^T/i,""),10):null;v.useEffect(()=>{if(F==null||Number.isNaN(F))return;const P=n.flatMap(K=>K.tasks.map(ue=>({t:ue,p:K}))).find(({t:K})=>K.number===F);if(!P){if(n.length===0)return;db();return}const{t:se,p:C}=P;if(h.onlyActiveBranches&&h.setOnlyActiveBranches(!1),h.hideDone&&h.setHideDone(!1),h.searchQuery&&h.setSearchQuery(""),h.setTreeOpenMode("smart"),C.featureId){const K=C.featureId;h.expandedFeatureIds.includes(K)||h.setExpandedFeatureIds(ue=>ue.includes(K)?ue:[...ue,K])}h.expandedPhaseIds.includes(C.id)||h.setExpandedPhaseIds(K=>K.includes(C.id)?K:[...K,C.id]);const B=document.getElementById(`task-row-${F}`);if(B){const K=document.querySelector("header"),ue=document.querySelector(".ap-search-sticky"),ge=((K==null?void 0:K.offsetHeight)??0)+((ue==null?void 0:ue.offsetHeight)??0)+12,ve=B.getBoundingClientRect().top+window.scrollY-ge;window.scrollTo({top:Math.max(0,ve),behavior:"smooth"}),ee(se.id);const Re=window.setTimeout(()=>ee(null),2500);return db(),()=>window.clearTimeout(Re)}},[F,n,h.expandedFeatureIds,h.expandedPhaseIds,h.onlyActiveBranches,h.hideDone,h.searchQuery,h.treeOpenMode]);const he=()=>{if(!$)return null;for(const P of w){if(P.feature.id===$)return o.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(rr,{featureNum:P.feature.number}),o.jsx(ar,{status:P.feature.status})]}),o.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:P.feature.name})]});for(const se of P.allPhases){if(se.phase.id===$)return o.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(rr,{featureNum:P.feature.number,phaseNum:se.phase.number}),o.jsx(ar,{status:se.phase.status})]}),o.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:se.phase.title})]});for(const C of se.allTasks)if(C.id===$)return o.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(rr,{featureNum:P.feature.number,phaseNum:se.phase.number,taskNum:C.number}),o.jsx(ar,{status:C.status})]}),o.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:C.title})]})}}return null};return o.jsxs(Vt,{className:"grid gap-4",children:[o.jsx("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Work Tree"}),o.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?o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-[var(--accent)] bg-[var(--accent-soft)] px-3 py-2","data-analytics-work-tree-filter":!0,role:"status",children:[o.jsxs("p",{className:"text-sm text-[var(--text)]",children:[o.jsx("span",{className:"font-bold",children:"Analytics filter:"})," ",c.label,". Showing ",x," of ",c.taskIds.size," selected ",c.taskIds.size===1?"task":"tasks"," after current Work Tree filters."]}),f?o.jsx("button",{type:"button",onClick:f,className:"rounded-lg px-2 py-1 text-xs font-bold text-[var(--accent)] underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"Clear analytics filter"}):null]}):null,o.jsxs("div",{className:"ap-search-sticky z-20 grid gap-2",style:{top:ne},children:[o.jsx(eA,{features:e,phases:n,query:h.searchQuery,onQuery:h.setSearchQuery}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ep,{sort:h.sort,onChange:h.setSort}),o.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5 overflow-x-auto rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 sm:gap-2 sm:rounded-[14px] sm:px-3 sm:py-2",children:[o.jsx(oi,{active:h.isAllExpanded,onClick:()=>h.isAllExpanded?h.collapseAll():h.expandAll(),children:h.isAllExpanded?"Collapse all":"Expand all"}),o.jsx(oi,{active:h.hideDone,onClick:()=>h.setHideDone(P=>!P),children:"Hide done"}),o.jsx(oi,{active:h.hidePlanned,onClick:()=>h.setHidePlanned(P=>!P),children:"Hide planned"}),o.jsx(oi,{active:h.onlyActiveBranches,onClick:()=>h.setOnlyActiveBranches(P=>!P),children:"Only active"}),o.jsx(oi,{onClick:h.resetFilters,children:"Reset"}),o.jsx(oi,{disabled:j,onClick:async()=>{R(!0),I(null);try{const P=await NR(),se=P.migrated,C=P.integrity.duplicatePhaseIds.length,B=P.integrity.danglingPhaseIds.length;I(`Repair done: renamed ${se.renamed}, repaired ${se.repaired} refs, inferred ${se.inferred}, archived ${P.handoffs.archived} stale handoff(s). Integrity: ${C} duplicate, ${B} dangling.`)}catch(P){I(`Repair failed: ${P instanceof Error?P.message:String(P)}`)}finally{R(!1)}},children:j?"Repairing…":"Repair"})]})]}),h.searchActive?o.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:[h.matchedTaskIds.size," match",h.matchedTaskIds.size===1?"":"es"," — clear the box to reset."]}):null,z?o.jsx("span",{className:"text-xs text-[var(--text-muted)] sm:truncate",children:z}):null]}),o.jsx("div",{className:"grid gap-3",children:w.length>0?o.jsxs(nT,{sensors:T,collisionDetection:ck,onDragStart:J,onDragEnd:fe,children:[o.jsx(Jm,{items:w.map(P=>P.feature.id),strategy:Wm,children:w.map(P=>o.jsx(ap,{id:P.feature.id,children:o.jsx(PT,{entry:P,expanded:c?g.has(P.feature.id):h.expandedFeatureIds.includes(P.feature.id),recentlyChanged:h.recentFeatureIds.includes(P.feature.id),onToggle:()=>h.toggleExpandedFeature(P.feature.id),isPhaseExpanded:pe,onTogglePhase:h.toggleExpandedPhase,isPhaseRecentlyChanged:we,isTaskRecentlyChanged:re,highlightedTaskIds:(()=>{const se=h.searchActive?h.matchedTaskIds:void 0;if(!Te)return se;const C=new Set(se??[]);return C.add(Te),C})(),resumeRequiredIds:u})},P.feature.id))}),o.jsx(ST,{dropAnimation:{duration:150,easing:"ease"},children:he()})]}):c?o.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No selected analytics tasks match the current Work Tree filters."}):r.length>0?r.map(P=>{const se=P.featureId?`/features/${P.featureId}/phases/${P.phaseId}/tasks/${P.id}`:"/features";return o.jsxs(Ye,{to:se,className:"surface-card grid gap-1 px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-[var(--text)]",children:[P.status==="in-progress"?o.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null,o.jsxs("span",{className:"truncate",children:["T",x2(P.number)," — ",P.title]})]}),o.jsx(ar,{status:P.status})]}),o.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:P.phaseId})]},P.id)}):o.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No work items match the current filters."})})]})}function nA({tasks:e}){return e.length?o.jsxs("section",{"aria-labelledby":"resume-required-heading",className:"grid grid-cols-1 gap-3",children:[o.jsxs("h2",{id:"resume-required-heading",className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--accent)]",children:["Resume required (",e.length,")"]}),o.jsx("div",{className:"grid gap-2",children:e.map(n=>o.jsx(N0,{task:n},n.id))})]}):null}function rA(){const{features:e,phases:n,activeTasks:r}=ol(),{project:s,taskFocus:u}=Ns("root"),c=v.useMemo(()=>new Set((u.pendingResume??[]).map(E=>E.id)),[u.pendingResume]),[f,h]=v.useState(null),p=v.useMemo(()=>new Set((f==null?void 0:f.taskIds)??[]),[f]),g=Or(),y=()=>g("/project/edit");Ca("edit",y);const x=s.projectRoot||s.planRoot||s.name||"default";return o.jsxs("div",{className:"grid grid-cols-1 gap-8",children:[o.jsxs(Vt,{className:"grid grid-cols-1 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("h2",{className:"min-w-0 text-lg font-bold text-[var(--text)]",children:"Project Goal"}),o.jsxs(ht,{type:"button",shortcut:"edit",onClick:y,className:"shrink-0",children:[o.jsx(Ss,{className:"h-4 w-4"}),"Edit project"]})]}),s.goal?o.jsx(ba,{text:s.goal,className:"max-w-4xl"}):o.jsx("p",{className:"max-w-4xl text-sm text-[var(--text-muted)]",children:"Add a project goal to define the main objective."})]}),o.jsx(l2,{project:s}),o.jsx(w2,{features:e,phases:n}),o.jsx(I2,{phases:n,activeDrilldown:f,onDrilldown:h,onClearDrilldown:()=>h(null)}),o.jsx(nA,{tasks:u.pendingResume}),o.jsx(aA,{features:e,phases:n,activeTasks:r,projectStorageScope:x,resumeRequiredIds:c,analyticsFilter:f?{label:f.label,taskIds:p}:null,onClearAnalyticsFilter:()=>h(null)}),o.jsx(i2,{features:e,phases:n}),o.jsx(c2,{features:e,phases:n})]})}async function lA(){const[e,n]=await Promise.all([m0(),pd()]);return{features:e,phases:n}}function Go(){return{active:0,planned:0,done:0,blocked:0,canceled:0}}function ad(e){const n=[];return e.active&&n.push(`${e.active} active`),e.planned&&n.push(`${e.planned} planned`),e.done&&n.push(`${e.done} done`),e.blocked&&n.push(`${e.blocked} blocked`),e.canceled&&n.push(`${e.canceled} canceled`),n.join(" · ")}function sA(e){const n=Go();for(const r of e){if(r.status==="in-progress"||r.status==="discovery"){n.active+=1;continue}if(r.status==="planned"||r.status==="draft"){n.planned+=1;continue}if(r.status==="done"){n.done+=1;continue}if(r.status==="blocked"){n.blocked+=1;continue}r.status==="canceled"&&(n.canceled+=1)}return n}function w1(e){const n=Go();for(const r of e){if(r.status==="in-progress"){n.active+=1;continue}if(r.status==="planned"){n.planned+=1;continue}if(r.status==="done"){n.done+=1;continue}if(r.status==="blocked"){n.blocked+=1;continue}r.status==="canceled"&&(n.canceled+=1)}return n}function iA(e){const n=Go();for(const r of e){if(r.status==="in-progress"){n.active+=1;continue}if(r.status==="planned"){n.planned+=1;continue}if(r.status==="done"){n.done+=1;continue}if(r.status==="blocked"){n.blocked+=1;continue}r.status==="canceled"&&(n.canceled+=1)}return n}function oA({feature:e,phases:n,phasesCount:r,tasksCount:s,phaseSummary:u,taskSummary:c,activity:f}){var z;const h=ws(),p=ws(),y=((z=h.formData)==null?void 0:z.get("status"))??e.status,x=h.state!=="idle",E=p.state!=="idle",S=ad(u),w=ad(c),j=O0(n??[]),R=e.description||(f?`${f.doneTasks}/${s} done · ${f.remainingTasks} left${f.blockedTasks?` · ${f.blockedTasks} blocked`:""}`:"");return o.jsxs(ki,{variant:"surface",status:j.displayStatus,className:"px-4 py-2",children:[o.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:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 xl:contents",children:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rr,{featureNum:e.number,featureId:e.id}),o.jsx(sr,{id:cl({featureNum:e.number}),children:o.jsx("span",{className:"sr-only",children:"Copy feature path"})}),e.shortId?o.jsx(ul,{shortId:e.shortId}):null,o.jsx("span",{className:"shrink-0",children:o.jsx(ac,{status:j.displayStatus,breakdown:j.breakdown})})]}),o.jsx(Ye,{to:`/features/${e.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:e.name})]}),o.jsxs("div",{className:"flex items-center gap-2 self-end xl:hidden",children:[o.jsx(Ye,{to:`/features/${e.id}/edit`,"aria-label":`Edit feature ${e.name}`,children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(p.Form,{method:"post",action:`/features/${e.id}/delete`,onSubmit:I=>{window.confirm(`Delete feature “${e.name}”? This cannot be undone.`)||I.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:E||x,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${e.name}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]})]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[o.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[r," phases"]}),S?o.jsx("div",{className:"mt-0.5 break-words",children:S}):null]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[o.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[s," tasks"]}),w?o.jsx("div",{className:"mt-0.5 break-words",children:w}):null]}),o.jsx(h.Form,{method:"post",action:`/features/${e.id}/status`,className:"w-full xl:w-auto",children:o.jsxs("div",{className:"relative",children:[o.jsx("select",{name:"status",value:y,disabled:x||E,"aria-busy":x,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:I=>h.submit(I.currentTarget.form),children:Ed.map(I=>o.jsx("option",{value:I.value,children:I.label},I.value))}),o.jsx(js,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),o.jsx(Ye,{to:`/features/${e.id}/edit`,"aria-label":`Edit feature ${e.name}`,className:"hidden xl:block",children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(p.Form,{method:"post",action:`/features/${e.id}/delete`,className:"hidden xl:block",onSubmit:I=>{window.confirm(`Delete feature “${e.name}”? This cannot be undone.`)||I.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:E||x,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${e.name}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]}),o.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:o.jsx(dl,{value:e.updatedAt})}),R?o.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:R}):null]})}const cA={feature:{label:"Feature",Icon:Fu},phase:{label:"Phase",Icon:Oj},task:{label:"Task",Icon:Jo},requirement:{label:"Requirement",Icon:d0}};function S1({kind:e,label:n}){const{Icon:r,label:s}=cA[e];return o.jsxs("span",{className:`entity-badge entity-badge--${e}`,children:[o.jsx(r,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:n??s})]})}function dn({className:e="",...n}){return o.jsx("input",{className:`field-control ${e}`,...n})}function Yl({className:e="",...n}){return o.jsx("select",{className:`field-control ${e}`,...n})}function E1({query:e,status:n,statusOptions:r,placeholder:s,clearTo:u,resultsLabel:c}){const f=Mm(),h=((r==null?void 0:r.length)??0)>0;return o.jsxs(Za,{method:"get",className:`surface-card grid gap-3 p-3 md:items-end sm:p-4 ${h?"md:grid-cols-[minmax(0,1fr)_200px_auto_auto]":"md:grid-cols-[minmax(0,1fr)_auto_auto]"}`,children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"list-filter-query",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Name"}),o.jsx(dn,{id:"list-filter-query",name:"q",defaultValue:e,placeholder:s,className:"min-h-9 py-2 sm:min-h-11 sm:py-2.5",onChange:p=>f(p.currentTarget.form)})]}),h?o.jsxs("div",{children:[o.jsx("label",{htmlFor:"list-filter-status",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Status"}),o.jsxs("div",{className:"relative",children:[o.jsxs(Yl,{id:"list-filter-status",name:"status",defaultValue:n,className:"min-h-9 appearance-none py-2 sm:min-h-11 sm:py-2.5 pr-8",children:[o.jsx("option",{value:"",children:"All statuses"}),r==null?void 0:r.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))]}),o.jsx(js,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--text-muted)]"})]})]}):null,o.jsx(ht,{type:"submit",variant:"secondary",children:"Apply filters"}),o.jsx(Ye,{to:u,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"}),o.jsx("div",{className:`text-sm text-[var(--text-muted)] ${h?"md:col-span-4":"md:col-span-3"}`,children:c})]})}function N1(e,n,r){return n.status&&e.status!==n.status?!1:n.onlyActive?r.includes(e.status):!(n.hideDone&&e.status==="done"||n.hidePlanned&&e.status==="planned")}function jd(e,n){const r=e.trim().toLowerCase();return r?n.some(s=>s==null?void 0:s.toLowerCase().includes(r)):!0}function uA(e){const n=new Map;for(const f of e)f.featureId&&n.set(f.featureId,[...n.get(f.featureId)??[],f]);const r=new Map,s=new Map,u=new Map,c=new Map;for(const[f,h]of n)r.set(f,h.length),s.set(f,h.reduce((p,g)=>p+g.tasks.length,0)),u.set(f,sA(h)),c.set(f,w1(h.flatMap(p=>p.tasks)));return{phasesByFeature:n,phasesCountByFeature:r,tasksCountByFeature:s,phaseSummaryByFeature:u,taskSummaryByFeature:c}}function dA(){var S,w;const{features:e,phases:n}=ol(),{phasesByFeature:r,phasesCountByFeature:s,tasksCountByFeature:u,phaseSummaryByFeature:c,taskSummaryByFeature:f}=uA(n),h=Or(),[p]=Wo(),g=((S=p.get("q"))==null?void 0:S.trim())??"",y=((w=p.get("status"))==null?void 0:w.trim())??"",x=v.useCallback(()=>h("new"),[h]);Ca("create",x);const E=v.useMemo(()=>e.filter(j=>(!y||j.status===y)&&jd(g,[j.name,j.id,j.description])),[e,g,y]);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Vt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{children:[o.jsx(S1,{kind:"feature",label:"Features"}),o.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."})]}),o.jsx(Ye,{to:"new",children:o.jsx(ht,{type:"button",variant:"primary",shortcut:"create",children:"Create feature"})})]}),o.jsx(E1,{query:g,status:y,statusOptions:Ed,placeholder:"Search feature name, id, or description",clearTo:"/features",resultsLabel:E.length===e.length?`${e.length} features`:`${E.length} of ${e.length} features`}),o.jsx("div",{className:"grid gap-3",children:e.length===0?o.jsxs(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No features yet. ",o.jsx(Ye,{to:"/features/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first feature"})]}):E.length>0?E.map(j=>o.jsx(oA,{feature:j,phases:r.get(j.id),phasesCount:s.get(j.id)??0,tasksCount:u.get(j.id)??0,phaseSummary:c.get(j.id)??Go(),taskSummary:f.get(j.id)??Go()},j.id)):o.jsx(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No features match the current filters."})})]}),o.jsx(Ei,{})]})}async function fA(){const[e,n]=await Promise.all([$m(),pd()]);return{requirements:e,phases:n}}function ko(...e){return e.filter(Boolean).join(" ")}function hA(){return o.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:o.jsx(js,{className:"h-5 w-5"})})}function un({title:e,subtitle:n,leading:r,actions:s,defaultOpen:u=!0,count:c,className:f,summaryClassName:h,contentClassName:p,titleClassName:g,subtitleClassName:y,children:x}){return o.jsxs("details",{className:ko("group mt-4 overflow-hidden rounded-[10px] border border-[var(--border)]",f),open:u,children:[o.jsxs("summary",{className:ko("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",h),children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[r?o.jsx("div",{className:"shrink-0 pt-0.5",children:r}):null,o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:ko("flex flex-wrap items-center gap-2 text-sm font-semibold",g),children:[e,c!==void 0?o.jsxs("span",{className:"text-[var(--text-subtle)]",children:["(",c,")"]}):null]}),n?o.jsx("div",{className:ko("mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",y),children:n}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s,o.jsx(hA,{})]})]}),o.jsx("div",{className:ko("border-t border-[var(--border)] bg-[var(--surface)] p-4",p),children:x})]})}function mA(e,n){const r=new Set(n.map(c=>c.id)),s=n.map(c=>({phase:c,requirements:e.filter(f=>f.linkedPhaseIds.includes(c.id))})).filter(c=>c.requirements.length>0).sort((c,f)=>c.phase.priority-f.phase.priority||c.phase.number-f.phase.number),u=e.filter(c=>!c.linkedPhaseIds.some(f=>r.has(f)));return{phaseGroups:s,unlinkedRequirements:u}}function fb(e){return`P${String(e.number??0).padStart(3,"0")}`}function hb({requirement:e}){return o.jsx(Vt,{className:"overflow-hidden p-0",children:o.jsx(un,{defaultOpen:!1,title:o.jsx("h2",{className:"min-w-0 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:e.title}),count:e.linkedPhaseIds.length,subtitle:o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[e.linkedPhaseIds.length," linked phase",e.linkedPhaseIds.length===1?"":"s"]}),e.linkedPhaseIds.length>0&&e.macroTasks.length>0?o.jsx("span",{className:"mx-2 text-[var(--text-subtle)]",children:"•"}):null,e.macroTasks.length>0?o.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[e.macroTasks.length," macro task",e.macroTasks.length===1?"":"s"]}):null]}),contentClassName:"grid gap-4",summaryClassName:"hover:bg-[var(--surface-elevated)]/65",children:o.jsxs("div",{className:"flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[o.jsx("div",{className:"min-w-0",children:e.description?o.jsx("p",{className:"min-w-0 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.description}):null}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:justify-end",children:[o.jsx(Ye,{to:`${e.id}/edit`,children:o.jsx(ht,{type:"button",variant:"secondary",children:"Edit"})}),o.jsx(Za,{method:"post",action:`/requirements/${e.id}/delete`,onSubmit:n=>{window.confirm(`Delete requirement "${e.title}"?`)||n.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",children:"Delete"})})]})]})})})}function pA(){var y;const{requirements:e,phases:n}=ol(),r=Or(),[s]=Wo(),u=((y=s.get("q"))==null?void 0:y.trim())??"",c=v.useCallback(()=>r("new"),[r]);Ca("create",c);const f=v.useMemo(()=>new Map(n.map(x=>[x.id,x])),[n]),h=v.useMemo(()=>e.filter(x=>{const E=x.linkedPhaseIds.map(S=>{const w=f.get(S);return w?`${fb(w)} ${w.title} ${w.summary}`:S});return jd(u,[x.title,x.description,x.id,...E])}),[e,f,u]),{phaseGroups:p,unlinkedRequirements:g}=v.useMemo(()=>mA(h,n),[h,n]);return v.useEffect(()=>{const x=window.location.hash.slice(1);x&&requestAnimationFrame(()=>{var E;return(E=document.getElementById(x))==null?void 0:E.scrollIntoView({block:"start"})})},[p]),o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Vt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{children:[o.jsx(S1,{kind:"requirement",label:"Requirements"}),o.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."})]}),o.jsx(Ye,{to:"new",children:o.jsx(ht,{type:"button",variant:"primary",shortcut:"create",children:"Create requirement"})})]}),o.jsx(E1,{query:u,placeholder:"Search requirement title, description, id, or linked phase",clearTo:"/requirements",resultsLabel:h.length===e.length?`${e.length} requirements`:`${h.length} of ${e.length} requirements`}),o.jsx("div",{className:"grid gap-6",children:e.length===0?o.jsxs(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No requirements yet. ",o.jsx(Ye,{to:"/requirements/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first requirement"})]}):h.length>0?o.jsxs(o.Fragment,{children:[p.map(({phase:x,requirements:E})=>{const S=x.featureId?`/features/${x.featureId}/phases/${x.id}`:"/features";return o.jsxs("section",{id:`phase-${x.id}`,className:"scroll-mt-28","aria-labelledby":`phase-${x.id}-heading`,children:[o.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Linked phase"}),o.jsxs(Ye,{id:`phase-${x.id}-heading`,to:S,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:[fb(x)," — ",x.title]})]}),o.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:[E.length," requirement",E.length===1?"":"s"]})]}),o.jsx("div",{className:"grid gap-3",children:E.map(w=>o.jsx(hb,{requirement:w},w.id))})]},x.id)}),g.length>0?o.jsxs("section",{id:"unlinked-requirements",className:"scroll-mt-28","aria-labelledby":"unlinked-requirements-heading",children:[o.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Unlinked"}),o.jsx("h2",{id:"unlinked-requirements-heading",className:"text-base font-black text-[var(--text)]",children:"Requirements without a valid phase"})]}),o.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})]}),o.jsx("div",{className:"grid gap-3",children:g.map(x=>o.jsx(hb,{requirement:x},x.id))})]}):null]}):o.jsx(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No requirements match the current filters."})})]}),o.jsx(Ei,{})]})}async function gA({params:e}){const n=e.featureId;if(!n)throw new Response("featureId required",{status:400});const[r,s]=await Promise.all([tc(n),pd(n)]);return{feature:r,phases:s}}function vA({featureId:e,feature:n,phase:r}){var x,E;const s=ws(),u=ws(),f=((x=s.formData)==null?void 0:x.get("status"))??r.status,h=s.state!=="idle",p=u.state!=="idle",g=ad(w1(r.tasks)),y=M0(r.tasks);return o.jsxs(ki,{variant:"surface",status:y.displayStatus,className:"px-4 py-2",children:[o.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,150px)_124px_44px_44px] lg:items-center",children:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rr,{featureNum:n.number,phaseNum:r.number,featureId:n.id,phaseId:r.id}),o.jsx(sr,{id:cl({featureNum:n.number,phaseNum:r.number}),children:o.jsx("span",{className:"sr-only",children:"Copy phase path"})}),r.shortId?o.jsx(ul,{shortId:r.shortId}):null,r.handoff?o.jsx(Hm,{phaseId:r.id,updatedAt:r.handoffUpdatedAt}):null,o.jsx(p1,{phaseId:r.id,phaseTitle:r.title,count:((E=r.linkedRequirements)==null?void 0:E.length)??0}),o.jsx("span",{className:"shrink-0",children:o.jsx(ac,{status:y.displayStatus,breakdown:y.breakdown})})]}),o.jsx(Ye,{to:`/features/${e}/phases/${r.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:r.title})]}),o.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[o.jsx(Ye,{to:`/features/${e}/phases/${r.id}/edit`,"aria-label":`Edit phase ${r.title}`,children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(u.Form,{method:"post",action:`/features/${e}/phases/${r.id}/delete`,onSubmit:S=>{window.confirm(`Delete phase “${r.title}”? This cannot be undone.`)||S.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:p||h,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${r.title}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]})]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[o.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[r.tasks.length," tasks"]}),g?o.jsx("div",{className:"mt-0.5 break-words",children:g}):null]}),o.jsx(s.Form,{method:"post",action:`/features/${e}/phases/${r.id}/status`,className:"w-full lg:w-auto",children:o.jsxs("div",{className:"relative",children:[o.jsx("select",{name:"status",value:f,disabled:h||p,"aria-busy":h,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:S=>s.submit(S.currentTarget.form),children:Nd.map(S=>o.jsx("option",{value:S.value,children:S.label},S.value))}),o.jsx(js,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),o.jsx(Ye,{to:`/features/${e}/phases/${r.id}/edit`,"aria-label":`Edit phase ${r.title}`,className:"hidden lg:block",children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(u.Form,{method:"post",action:`/features/${e}/phases/${r.id}/delete`,className:"hidden lg:block",onSubmit:S=>{window.confirm(`Delete phase “${r.title}”? This cannot be undone.`)||S.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:p||h,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${r.title}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]}),o.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:o.jsx(dl,{value:r.updatedAt})}),r.summary?o.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:r.summary}):null]})}function lp({items:e,className:n="",stacked:r=!1}){return r?o.jsx("nav",{"aria-label":"Breadcrumb",className:`grid gap-1 text-sm ${n}`,children:e.map((s,u)=>{const c=u===e.length-1,f=s.to&&!c?o.jsx(Ye,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline break-words min-w-0",children:s.label}):o.jsx("span",{className:`break-words min-w-0 ${c?"text-[var(--text)] font-semibold":"text-[var(--text-muted)]"}`,children:s.label});return o.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[s.kind?o.jsxs("span",{className:"shrink-0 text-[var(--text-subtle)] font-medium",children:[s.kind,":"]}):null,o.jsx("span",{className:"min-w-0",children:f})]},`${s.label}-${u}`)})}):o.jsx("nav",{"aria-label":"Breadcrumb",className:`flex flex-wrap items-center gap-2 text-sm ${n}`,children:e.map((s,u)=>{const c=u===e.length-1,f=s.to&&!c?o.jsx(Ye,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline",children:s.label}):o.jsx("span",{className:c?"text-[var(--text)]":"text-[var(--text-muted)]",children:s.label});return o.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[u>0?o.jsx("span",{className:"text-[var(--text-subtle)]",children:"/"}):null,o.jsx("span",{className:"min-w-0 break-words",children:f})]},`${s.label}-${u}`)})})}function sp({featureNum:e,phaseNum:n,taskNum:r,featureId:s,phaseId:u,taskId:c,shortId:f,children:h}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(rr,{featureNum:e,phaseNum:n,taskNum:r,featureId:s,phaseId:u,taskId:c}),o.jsx(sr,{id:cl({featureNum:e,phaseNum:n,taskNum:r}),children:o.jsx("span",{className:"sr-only",children:"Copy path"})}),f?o.jsx(ul,{shortId:f}):null,h]})}function La({className:e="",children:n,...r}){return o.jsx("div",{className:`surface-card p-4 ${e}`,...r,children:n})}function mb(...e){return e.filter(Boolean).join(" ")}function ip({items:e,className:n}){const r=e.filter(s=>s.visible!==!1);return r.length===0?null:o.jsx("div",{className:mb("grid gap-4 md:grid-cols-2 xl:grid-cols-4",n),children:r.map(s=>o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:s.label}),o.jsx("div",{className:mb("mt-2 text-sm font-semibold break-words text-[var(--text)] [overflow-wrap:anywhere]",s.valueClassName),children:s.value})]},s.label))})}function op(e){return e&&e>0?`P${e}`:""}function xA(e,n){return!e&&!n?"":`${e||"Start not set"} → ${n||"End not set"}`}const yA=250;function Mu(e){return`inline-flex h-9 min-h-9 shrink-0 items-center justify-center whitespace-nowrap rounded-[9px] border px-2 py-1 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] sm:h-9 sm:min-h-9 sm:rounded-[10px] sm:px-2.5 ${e?"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)]"}`}function j1({entityKind:e,statusOptions:n,value:r,onChange:s,sortSlot:u}){const[c,f]=v.useState(r.query),h=v.useRef(null),p=v.useRef(r);p.current=r,v.useEffect(()=>{f(r.query)},[r.query]),v.useEffect(()=>()=>{h.current!==null&&window.clearTimeout(h.current)},[]);const g=j=>{h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{s({...p.current,query:j})},yA)},y=j=>{f(j),g(j)},x=j=>{s({...p.current,[j]:!p.current[j]})},E=j=>{s({...p.current,status:j})},S=()=>{h.current!==null&&window.clearTimeout(h.current),f(""),s({query:"",status:"",hideDone:!1,hidePlanned:!1,onlyActive:!1})},w=((n==null?void 0:n.length)??0)>0;return o.jsxs("div",{className:"surface-card flex flex-col gap-3 p-3 sm:p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[o.jsxs("div",{className:"min-w-[180px] flex-1",children:[o.jsx("label",{htmlFor:"detail-filter-query",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Search"}),o.jsx(dn,{id:"detail-filter-query",value:c,onChange:j=>y(j.target.value),placeholder:e==="task"?"Search task title, number, or shortId":"Search phase title, number, or shortId",className:"h-9 py-2"})]}),u]}),o.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[w?o.jsxs("div",{children:[o.jsx("label",{htmlFor:"detail-filter-status",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Status"}),o.jsx("div",{className:"flex items-center rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 sm:rounded-[14px] sm:px-3 sm:py-2",children:o.jsxs(Yl,{id:"detail-filter-status",value:r.status,onChange:j=>E(j.target.value),className:"h-9 appearance-none border-0 bg-transparent py-0 pr-8",children:[o.jsx("option",{value:"",children:"All statuses"}),n==null?void 0:n.map(j=>o.jsx("option",{value:j.value,children:j.label},j.value))]})})]}):null,o.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5 overflow-x-auto rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 sm:gap-2 sm:rounded-[14px] sm:px-3 sm:py-2",children:[o.jsx("button",{type:"button",onClick:()=>x("hideDone"),className:Mu(r.hideDone),children:"Hide Done"}),o.jsx("button",{type:"button",onClick:()=>x("hidePlanned"),className:Mu(r.hidePlanned),children:"Hide Planned"}),o.jsx("button",{type:"button",onClick:()=>x("onlyActive"),className:Mu(r.onlyActive),children:"Only active"}),o.jsx("button",{type:"button",onClick:S,className:Mu(!1),children:"Clear"})]})]})]})}function cp({decisions:e}){return e.length===0?null:o.jsxs("details",{className:"group mt-4",children:[o.jsx("summary",{className:"flex cursor-pointer select-none items-center gap-2 font-semibold text-[var(--text)]",children:o.jsxs("span",{children:["Accepted decisions (",e.length,")"]})}),o.jsx("div",{className:"mt-2 grid gap-3",children:e.map(n=>o.jsxs("div",{className:"surface-card px-4 py-3",children:[o.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:n.title}),n.decision?o.jsxs("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Decision:"}),o.jsx(ba,{text:n.decision,className:"mt-1"})]}):null,n.rationale?o.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Rationale:"}),o.jsx(ba,{text:n.rationale,className:"mt-1"})]}):null,n.implementationNotes?o.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Implementation:"}),o.jsx(ba,{text:n.implementationNotes,className:"mt-1"})]}):null]},n.id))})]})}const bA={draft:vj,discovery:Wj,planned:Jo,"in-progress":o0,done:_m,blocked:c0,waiting:Lm,deferred:aR,canceled:s0,rejected:yj};function am(e){return e.split(/[-\s]+/).filter(Boolean).map(n=>n==="and"?"and":n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function pb(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(e))}catch{return e}}const wA=new Set(["canceled","rejected"]);function up({statusLog:e,currentStatus:n,backbone:r,createdAt:s,updatedAt:u,startedAt:c,completedAt:f}){const h=[];if(e.length===0){const w=r.indexOf(n);if(w>=0)for(let j=0;j<=w;j++)h.push(r[j]);else h.push(n)}else{const w=e[0];w&&h.push(w.fromStatus);for(const j of e)h[h.length-1]!==j.toStatus&&h.push(j.toStatus)}h[h.length-1]!==n&&h.push(n);const p=new Set(h),g=n==="done"||wA.has(n),y=w=>{var R,z;if(e.length>0){if(w===((R=e[0])==null?void 0:R.fromStatus))return((z=e[0])==null?void 0:z.date)??"";for(const I of e)if(I.toStatus===w)return I.date;return""}const j=r[0];return w===j?s??"":w==="in-progress"?c??u??"":w==="done"?f??u??"":""},x=[...h];if(!g){const w=r.indexOf(n);if(w>=0&&w+1<r.length){const j=r[w+1];p.has(j)||x.push(j)}}const E=e.length===0?x.filter((w,j)=>j===0||w===n||!!y(w)):x,S=w=>p.has(w)?w===n&&!g?"current":"completed":"pending";return o.jsx("ol",{className:"status-stepper",role:"list","aria-label":"Status progress",children:E.map((w,j)=>{const R=S(w),z=bA[w]??fd,I=p.has(w),$=y(w),Q=$?`${am(w)} — ${pb($)}`:am(w),J=j===0?null:I?"traveled":"pending";return o.jsxs("li",{className:`status-step status-step--${R}`,role:"listitem","aria-current":R==="current"?"step":void 0,style:{"--step-color":`var(--color-status-${w})`},children:[J?o.jsx("span",{className:`status-connector status-connector--${J}`,"aria-hidden":"true"}):null,o.jsx("span",{className:"status-node",title:Q,children:o.jsx(z,{className:"status-node-icon"})}),o.jsx("span",{className:"status-step-label",children:am(w)}),$?o.jsx("span",{className:"status-step-date",children:pb($)}):null]},`${w}-${j}`)})})}function gb(e){return e.split(/[-\s]+/).filter(Boolean).map(n=>n==="and"?"and":n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function SA(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(e))}catch{return e}}function EA(e,n,r,s,u){if(e.length>0)return e.map(h=>({date:h.date,fromStatus:h.fromStatus,toStatus:h.toStatus,inferred:!1}));const c=r.indexOf(n);if(c<0)return[];const f=[];for(let h=1;h<=c;h++){const p=r[h-1],g=r[h],y=g==="in-progress"?s??"":g==="done"?u??"":"";f.push({date:y,fromStatus:p,toStatus:g,inferred:!0})}return f}function dp({statusLog:e,currentStatus:n,backbone:r,startedAt:s,completedAt:u}){const c=EA(e??[],n??"",r??[],s,u);return o.jsx(un,{title:"Status history",count:c.length,defaultOpen:c.length>0,contentClassName:"grid gap-2.5",children:c.length===0?o.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No status changes recorded."}):c.map((f,h)=>o.jsxs("div",{className:"text-sm flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-xs font-mono text-[var(--text-subtle)]",children:SA(f.date)}),o.jsx("span",{className:"font-semibold text-[var(--text-muted)]",children:gb(f.fromStatus)}),o.jsx("span",{className:"text-[var(--text-subtle)]",children:"→"}),o.jsx("span",{className:"font-semibold text-[var(--text)]",children:gb(f.toStatus)})]},h))})}function NA(e){return e.reduce((n,r)=>n+r.tasks.length,0)}function jA(e){let n=0,r=0,s=0,u=0;for(const c of e)for(const f of c.tasks)f.status==="in-progress"&&(n+=1),f.status==="done"&&(r+=1),f.status==="blocked"&&(s+=1),["done","canceled"].includes(f.status)||(u+=1);return{inProgress:n,done:r,blocked:s,remaining:u}}function RA(e){return e.find(n=>["in-progress","discovery","planned","draft"].includes(n.status))}function kA(){var J,ne;const{feature:e,phases:n}=ol(),r=e.acceptedDecisions??[],s=NA(n),u=jA(n),c=RA(n),f=O0(n),[h,p]=Wo(),g=((J=h.get("sort"))==null?void 0:J.trim())??"priority",y=((ne=h.get("dir"))==null?void 0:ne.trim())??"asc",[x,E]=v.useState(()=>{var M,T;return{query:((M=h.get("q"))==null?void 0:M.trim())??"",status:((T=h.get("status"))==null?void 0:T.trim())??"",hideDone:h.get("hideDone")==="1",hidePlanned:h.get("hidePlanned")==="1",onlyActive:h.get("onlyActive")==="1"}});v.useEffect(()=>{const M=new URL(window.location.href),T=(fe,pe,we="1")=>{pe?M.searchParams.set(fe,we):M.searchParams.delete(fe)};T("q",x.query.trim()!=="",x.query.trim()),T("status",x.status!=="",x.status),T("hideDone",x.hideDone),T("hidePlanned",x.hidePlanned),T("onlyActive",x.onlyActive),window.history.replaceState(window.history.state,"",`${M.pathname}${M.search}${M.hash}`)},[x]);const S={key:g==="priority"||g==="number"||g==="createdAt"||g==="updatedAt"||g==="title"||g==="shortId"||g==="status"||g==="startedAt"||g==="completedAt"?g:"priority",direction:y==="desc"?"desc":"asc"},w=v.useMemo(()=>[...n].sort((M,T)=>Mo(M,T,S.key,S.direction)),[n,S]),j=v.useMemo(()=>w.filter(M=>N1(M,x,["in-progress","discovery"])&&jd(x.query,[M.title,String(M.number),M.shortId])),[w,x]),R=Or(),z=v.useRef(null),I=v.useCallback(()=>R("edit"),[R]),$=v.useCallback(()=>R("phases/new"),[R]),Q=v.useCallback(()=>{var M;(M=z.current)==null||M.requestSubmit()},[]);return Ca("edit",I),Ca("create",$),Ca("delete",Q),o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Ye,{to:"/features",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[o.jsx(dd,{className:"h-4 w-4"})," Back to features"]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx(lp,{stacked:!0,items:[{label:e.name,kind:"Feature"}]}),o.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:o.jsx(sp,{featureNum:e.number,featureId:e.id,shortId:e.shortId,children:o.jsx(ac,{status:f.displayStatus,breakdown:f.breakdown})})}),o.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:e.name}),e.description?o.jsx(un,{title:o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Description"}),o.jsx(dl,{value:e.descriptionUpdatedAt})]}),children:o.jsx(ba,{text:e.description,className:"plan-description max-w-4xl"})}):null,o.jsx("div",{className:"mt-4",children:o.jsx(up,{statusLog:e.statusLog??[],currentStatus:e.status,backbone:["planned","in-progress","done"],createdAt:e.createdAt,updatedAt:e.updatedAt})}),o.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[o.jsx(Ye,{to:"edit",children:o.jsx(ht,{type:"button",shortcut:"edit",children:"Edit feature"})}),o.jsx(Za,{ref:z,method:"post",action:`/features/${e.id}/delete`,className:"inline-flex",onSubmit:M=>{window.confirm(`Delete feature "${e.name}"?`)||M.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete feature"})})]})]}),o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),o.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(c==null?void 0:c.title)||"No active phase"})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Phases"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:n.length})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:s})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),o.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(c==null?void 0:c.title)||"No active phase"})]})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.inProgress})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.remaining})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.done})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:u.blocked})]})]}),o.jsx(ip,{items:[{label:"Entity last updated",value:il(e.updatedAt),visible:!!e.updatedAt},{label:"Priority",value:op(e.priority),visible:e.priority>0},{label:"Timeline",value:xA(e.startDate,e.endDate),visible:!!(e.startDate||e.endDate)}]}),e.workDone||e.workRemaining?o.jsx(un,{title:"Planning notes",defaultOpen:!1,children:o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.workDone?o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work done"}),o.jsx(ba,{text:e.workDone,className:"mt-2"})]}):null,e.workRemaining?o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work remaining"}),o.jsx(ba,{text:e.workRemaining,className:"mt-2"})]}):null]})}):null,r.length>0?o.jsx(cp,{decisions:r}):null,o.jsx(dp,{statusLog:e.statusLog??[],currentStatus:e.status,backbone:["planned","in-progress","done"]})]}),o.jsxs(Vt,{className:"grid gap-5",children:[o.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Phases (",n.length,")"]}),o.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this feature's phases."})]}),o.jsx(Ye,{to:"phases/new",children:o.jsx(ht,{type:"button",variant:"primary",shortcut:"create",children:"Create phase"})})]}),o.jsx(j1,{entityKind:"phase",statusOptions:Nd,value:x,onChange:E,sortSlot:o.jsx(ep,{sort:S,onChange:M=>p(T=>(T.set("sort",M.key),T.set("dir",M.direction),T))})}),o.jsx("div",{className:"grid gap-3",children:n.length===0?o.jsxs(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No phases yet. ",o.jsx(Ye,{to:`/features/${e.id}/phases/new`,className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a phase"})]}):j.length>0?j.map(M=>o.jsx(vA,{featureId:e.id,feature:e,phase:M},M.id)):o.jsx(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No phases match the current filters."})})]}),o.jsx(Ei,{})]})}async function TA({params:e}){const{featureId:n,phaseId:r}=e;if(!n||!r)throw new Response("featureId and phaseId required",{status:400});const[s,u,c]=await Promise.all([tc(n),gd(r),$m()]),f=c.filter(h=>h.linkedPhaseIds.includes(r));return{feature:s,phase:{...u,linkedRequirements:f}}}function CA({featureId:e,featureNum:n,phaseId:r,phaseNum:s,task:u}){var S;const c=ws(),f=ws(),p=((S=c.formData)==null?void 0:S.get("status"))??u.status,g=c.state!=="idle",y=f.state!=="idle",x=ad(iA(u.subtasks)),E=S0(p);return o.jsxs(ki,{variant:"surface",status:E,className:"px-4 py-2",children:[o.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,168px)_124px_44px_44px] lg:items-center",children:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[o.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rr,{featureNum:n,phaseNum:s,taskNum:u.number,featureId:e,phaseId:r,taskId:u.id}),o.jsx(sr,{id:cl({featureNum:n,phaseNum:s,taskNum:u.number}),children:o.jsx("span",{className:"sr-only",children:"Copy task path"})}),u.shortId?o.jsx(ul,{shortId:u.shortId}):null,o.jsx("span",{className:"shrink-0",children:o.jsx(ar,{status:p})})]}),o.jsx(Ye,{to:`/features/${e}/phases/${r}/tasks/${u.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:u.title})]}),o.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[o.jsx(Ye,{to:`/features/${e}/phases/${r}/tasks/${u.id}/edit`,"aria-label":`Edit task ${u.title}`,children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(f.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/delete`,onSubmit:w=>{window.confirm(`Delete task “${u.title}”? This cannot be undone.`)||w.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:y||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${u.title}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]})]}),o.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[o.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[u.subtasks.length," subtasks · ",u.checklist.length," checklist"]}),x?o.jsx("div",{className:"mt-0.5 break-words",children:x}):o.jsx("div",{className:"mt-0.5 break-words",children:"No subtask statuses yet"})]}),o.jsx(c.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/status`,className:"w-full lg:w-auto",children:o.jsxs("div",{className:"relative",children:[o.jsx("select",{name:"status",value:p,disabled:g||y||!!u.pauseSnapshot,"aria-busy":g,title:u.pauseSnapshot?"Resume checkpointed work through task_start so its checkpoint is preserved.":void 0,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:w=>c.submit(w.currentTarget.form),children:td.map(w=>o.jsx("option",{value:w.value,children:w.label},w.value))}),o.jsx(js,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),o.jsx(Ye,{to:`/features/${e}/phases/${r}/tasks/${u.id}/edit`,"aria-label":`Edit task ${u.title}`,className:"hidden lg:block",children:o.jsx(ht,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:o.jsx(Ss,{className:"h-3.5 w-3.5"})})}),o.jsx(f.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/delete`,className:"hidden lg:block",onSubmit:w=>{window.confirm(`Delete task “${u.title}”? This cannot be undone.`)||w.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",disabled:y||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${u.title}`,children:o.jsx(yi,{className:"h-4 w-4"})})})]}),o.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-[var(--text-subtle)]",children:[o.jsx(dl,{value:u.updatedAt}),u.startedAt?o.jsxs("span",{children:["Started ",il(u.startedAt)]}):null,u.completedAt?o.jsxs("span",{children:["Completed ",il(u.completedAt)]}):null]}),u.description?o.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:u.description}):null]})}function AA(e){let n=0,r=0,s=0,u=0;for(const c of e.tasks)c.status==="in-progress"&&(n+=1),c.status==="done"&&(r+=1),c.status==="blocked"&&(s+=1),["done","canceled"].includes(c.status)||(u+=1);return{inProgress:n,done:r,blocked:s,remaining:u}}function DA(){var pe,we;const{feature:e,phase:n}=ol(),r=n.decisions??[],s=n.acceptedDecisions??[],u=n.linkedRequirements??[],c=AA(n),f=M0(n.tasks),[h,p]=Wo(),g=((pe=h.get("sort"))==null?void 0:pe.trim())??"priority",y=((we=h.get("dir"))==null?void 0:we.trim())??"asc",[x,E]=v.useState(()=>{var re,je;return{query:((re=h.get("q"))==null?void 0:re.trim())??"",status:((je=h.get("status"))==null?void 0:je.trim())??"",hideDone:h.get("hideDone")==="1",hidePlanned:h.get("hidePlanned")==="1",onlyActive:h.get("onlyActive")==="1"}});v.useEffect(()=>{const re=new URL(window.location.href),je=(Te,ee,L="1")=>{ee?re.searchParams.set(Te,L):re.searchParams.delete(Te)};je("q",x.query.trim()!=="",x.query.trim()),je("status",x.status!=="",x.status),je("hideDone",x.hideDone),je("hidePlanned",x.hidePlanned),je("onlyActive",x.onlyActive),window.history.replaceState(window.history.state,"",`${re.pathname}${re.search}${re.hash}`)},[x]);const S={key:g==="priority"||g==="number"||g==="createdAt"||g==="updatedAt"||g==="title"||g==="shortId"||g==="status"||g==="startedAt"||g==="completedAt"?g:"priority",direction:y==="desc"?"desc":"asc"},w=v.useMemo(()=>[...n.tasks].sort((re,je)=>Mo(re,je,S.key,S.direction)),[n.tasks,S]),j=v.useMemo(()=>w.filter(re=>N1(re,x,["in-progress"])&&jd(x.query,[re.title,String(re.number),re.shortId])),[w,x]),R=Or(),z=v.useRef(null),[I,$]=v.useState(n.handoff??""),[Q,J]=v.useState(!1),ne=v.useCallback(()=>R("edit"),[R]),M=v.useCallback(()=>R("tasks/new"),[R]),T=v.useCallback(()=>{var re;(re=z.current)==null||re.requestSubmit()},[]),fe=v.useCallback(async()=>{if(window.confirm("Clear this phase's handoff?")){J(!0);try{await v0(n.id),$("")}catch{}finally{J(!1)}}},[n.id]);return Ca("edit",ne),Ca("create",M),Ca("delete",T),o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Ye,{to:`/features/${e.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[o.jsx(dd,{className:"h-4 w-4"})," Back to feature"]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx(lp,{stacked:!0,items:[{label:e.name,to:`/features/${e.id}`,kind:"Feature"},{label:n.title,kind:"Phase"}]}),o.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:o.jsxs(sp,{featureNum:e.number,phaseNum:n.number,featureId:e.id,phaseId:n.id,shortId:n.shortId,children:[I?o.jsx(Hm,{phaseId:n.id,updatedAt:n.handoffUpdatedAt}):null,o.jsx(ac,{status:f.displayStatus,breakdown:f.breakdown})]})}),o.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:n.title}),n.summary?o.jsx(ba,{text:n.summary,className:"mt-3 max-w-4xl"}):null,o.jsx(up,{statusLog:n.statusLog??[],currentStatus:n.status,backbone:["draft","discovery","planned","in-progress","done"],createdAt:n.createdAt,updatedAt:n.updatedAt}),o.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[o.jsx(Ye,{to:"edit",children:o.jsx(ht,{type:"button",shortcut:"edit",children:"Edit phase"})}),o.jsx(Za,{ref:z,method:"post",action:`/features/${e.id}/phases/${n.id}/delete`,className:"inline-flex",onSubmit:re=>{window.confirm(`Delete phase "${n.title}"?`)||re.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete phase"})})]})]}),o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:n.tasks.length})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.inProgress})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.remaining})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.done})]})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.blocked})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Goals"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:n.goals.length})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Dependencies"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:n.dependencies.length})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Completion criteria"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:n.completionCriteria.length})]})]}),o.jsx(ip,{items:[{label:"Entity last updated",value:il(n.updatedAt),visible:!!n.updatedAt},{label:"Priority",value:op(n.priority),visible:n.priority>0},{label:"Linked requirements",value:u.length,visible:u.length>0,valueClassName:"text-2xl font-black"},{label:"Risks",value:n.risks.length,visible:n.risks.length>0,valueClassName:"text-2xl font-black"},{label:"Open questions",value:n.openQuestions.length,visible:n.openQuestions.length>0,valueClassName:"text-2xl font-black"}]}),n.notes?o.jsx(un,{title:"Notes",defaultOpen:!1,children:o.jsx(ba,{text:n.notes,className:"plan-description"})}):null,o.jsx(un,{title:"Linked requirements",count:u.length,defaultOpen:!1,children:u.length>0?o.jsx("div",{className:"grid gap-3",children:u.map(re=>o.jsx("div",{className:"min-w-0 rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:o.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ar,{status:re.status}),re.macroTasks.length>0?o.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]}),o.jsx("h3",{className:"mt-2 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:re.title}),re.description?o.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:re.description}):null]}),o.jsx(Ye,{to:`/requirements#phase-${n.id}`,className:"text-sm font-semibold text-[var(--accent)] hover:underline sm:shrink-0",children:"Open phase requirements →"})]})},re.id))}):o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No linked requirements yet."})}),n.description?o.jsx(un,{title:o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Description"}),o.jsx(dl,{value:n.descriptionUpdatedAt})]}),children:o.jsx(ba,{text:n.description,className:"plan-description"})}):null,r.length>0?o.jsx(un,{title:"Decisions",count:r.length,defaultOpen:!1,children:o.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:r.map((re,je)=>o.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:o.jsx(ba,{text:re})},je))})}):null,s.length>0?o.jsx(cp,{decisions:s}):null,o.jsx(dp,{statusLog:n.statusLog??[],currentStatus:n.status,backbone:["draft","discovery","planned","in-progress","done"]})]}),I?o.jsx(Vt,{className:"grid gap-4",children:o.jsx(un,{title:"Handoff",actions:o.jsx("button",{type:"button",onClick:fe,disabled:Q,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:Q?"Clearing…":"Clear handoff"}),children:o.jsx("div",{className:"rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-5 py-5",children:o.jsx(ba,{text:I,className:"formatted-text max-w-none"})})})}):null,o.jsxs(Vt,{className:"grid gap-5",children:[o.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Tasks (",n.tasks.length,")"]}),o.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this phase's tasks."})]}),o.jsx(Ye,{to:"tasks/new",children:o.jsx(ht,{type:"button",variant:"primary",shortcut:"create",children:"Create task"})})]}),o.jsx(j1,{entityKind:"task",statusOptions:tp,value:x,onChange:E,sortSlot:o.jsx(ep,{sort:S,onChange:re=>p(je=>(je.set("sort",re.key),je.set("dir",re.direction),je))})}),o.jsx("div",{className:"grid gap-3",children:n.tasks.length===0?o.jsxs(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No tasks yet. ",o.jsx(Ye,{to:"tasks/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a task"})]}):j.length>0?j.map(re=>o.jsx(CA,{featureId:e.id,featureNum:e.number,phaseId:n.id,phaseNum:n.number,task:re},re.id)):o.jsx(Vt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No tasks match the current filters."})})]}),o.jsx(Ei,{})]})}async function OA({params:e}){const{featureId:n,phaseId:r,taskId:s}=e;if(!n||!r||!s)throw new Response("featureId, phaseId and taskId required",{status:400});const[u,c,f,h]=await Promise.all([tc(n),gd(r),vd(s),Um()]),p=f.status!=="done"&&f.status!=="canceled"&&f.status!=="rejected"&&(!!f.pauseSnapshot||h.workDeviations.some(g=>g.resumeTaskId===f.id&&(g.state==="resume-required"||g.state==="resolved")));return{feature:u,phase:c,task:f,pendingResume:p}}function MA({snapshot:e,pendingResume:n=!1}){const r=v.useId(),s=n?u0:Lm;return o.jsxs("section",{"aria-labelledby":r,"aria-live":n?"polite":void 0,className:`rounded-[14px] border px-4 py-3 ${n?"border-[var(--accent)] bg-[var(--accent-soft)]":"border-[var(--border)] bg-[var(--surface-elevated)]"}`,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(s,{className:"h-4 w-4 shrink-0 text-[var(--accent)]","aria-hidden":"true"}),o.jsx("h3",{id:r,className:"text-sm font-bold text-[var(--text)]",children:"Resume checkpoint"}),o.jsx("span",{className:"ml-auto text-[10px] font-semibold uppercase tracking-[0.14em] text-[var(--text-subtle)]",children:il(e.pausedAt)})]}),o.jsxs("dl",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Checkpoint reason"}),o.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.reason})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Work checkpoint"}),o.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.whatWasBeingDone})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Resume from"}),o.jsx("dd",{className:"mt-1 font-mono text-xs text-[var(--text)] [overflow-wrap:anywhere]",children:e.resumeLocation})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"How to resume"}),o.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.howToResume})]})]})]})}function _A({featureId:e,phaseId:n,taskId:r,item:s}){const u=ws(),c=u.formData?u.formData.get("checked")==="true":s.checked,f=u.state!=="idle";return o.jsxs("div",{className:"surface-card flex items-start gap-3 px-4 py-3",children:[o.jsx("input",{type:"checkbox",checked:c,onChange:()=>u.submit({checked:s.checked?"false":"true"},{method:"post",action:`/features/${e}/phases/${n}/tasks/${r}/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}`}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("span",{className:"checklist-num",children:s.number})," ",o.jsx("span",{className:`text-sm ${c?"text-[var(--text-muted)] line-through":"font-medium text-[var(--text)]"}`,children:s.title})]})]})}function LA(){var E,S;const{feature:e,phase:n,task:r,pendingResume:s}=ol(),u=r.status==="planned"||r.status==="waiting",c=r.decisions??[],f=r.acceptedDecisions??[],h=r.checklist??[],p=Or(),g=v.useRef(null),y=v.useCallback(()=>p("edit"),[p]),x=v.useCallback(()=>{var w;(w=g.current)==null||w.requestSubmit()},[]);return Ca("edit",y),Ca("delete",x),o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Ye,{to:`/features/${e.id}/phases/${n.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[o.jsx(dd,{className:"h-4 w-4"})," Back to phase"]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx(lp,{stacked:!0,items:[{label:e.name,to:`/features/${e.id}`,kind:"Feature"},{label:n.title,to:`/features/${e.id}/phases/${n.id}`,kind:"Phase"},{label:r.title,kind:"Task"}]}),o.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:o.jsx(sp,{featureNum:e.number,phaseNum:n.number,taskNum:r.number,featureId:e.id,phaseId:n.id,taskId:r.id,shortId:r.shortId,children:o.jsx(ar,{status:r.status})})}),o.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:r.title}),o.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[u?o.jsx(Za,{method:"post",action:`/features/${e.id}/phases/${n.id}/tasks/${r.id}/start`,className:"inline-flex",children:o.jsx(ht,{type:"submit",variant:"primary",children:r.pauseSnapshot||s?"Resume task":"Start task"})}):null,o.jsx(Ye,{to:"edit",children:o.jsx(ht,{type:"button",shortcut:"edit",children:"Edit task"})}),o.jsx(Za,{ref:g,method:"post",action:`/features/${e.id}/phases/${n.id}/tasks/${r.id}/delete`,className:"inline-flex",onSubmit:w=>{window.confirm(`Delete task "${r.title}"?`)||w.preventDefault()},children:o.jsx(ht,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete task"})})]})]}),o.jsx(up,{statusLog:r.statusLog??[],currentStatus:r.status,backbone:["planned","in-progress","done"],createdAt:r.createdAt,updatedAt:r.updatedAt,startedAt:r.startedAt,completedAt:r.completedAt}),r.pauseSnapshot?o.jsx(MA,{snapshot:r.pauseSnapshot,pendingResume:s}):null,o.jsxs(Vt,{className:"grid gap-4",children:[r.description?o.jsx(un,{title:o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Description"}),o.jsx(dl,{value:r.descriptionUpdatedAt})]}),children:o.jsx(ba,{text:r.description,className:"plan-description"})}):null,r.notes?o.jsx(un,{title:"Notes",defaultOpen:!1,children:o.jsx(ba,{text:r.notes})}):null,o.jsx(dp,{statusLog:r.statusLog??[],currentStatus:r.status,backbone:["planned","in-progress","done"],startedAt:r.startedAt,completedAt:r.completedAt}),c.length>0?o.jsx(un,{title:"Decisions",count:c.length,defaultOpen:!1,children:o.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:c.map((w,j)=>o.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:o.jsx(ba,{text:w})},j))})}):null,f.length>0?o.jsx(cp,{decisions:f}):null,o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Checklist items"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:h.length})]}),o.jsxs(La,{children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Subtasks"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:((E=r.subtasks)==null?void 0:E.length)??0})]})]}),o.jsx(ip,{items:[{label:"Entity last updated",value:il(r.updatedAt),visible:!!r.updatedAt},{label:"Priority",value:op(r.priority),visible:r.priority>0},{label:"Short name",value:r.shortName,visible:!!r.shortName},{label:"Started",value:il(r.startedAt),visible:!!r.startedAt},{label:"Completed",value:il(r.completedAt),visible:!!r.completedAt},{label:"Phase",value:n.title}]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsx("div",{children:o.jsxs("h3",{className:"text-sm font-bold text-[var(--text)]",children:["Steps (",h.length,")"]})}),h.length?o.jsx("div",{className:"grid gap-2",children:h.map(w=>o.jsx(_A,{featureId:e.id,phaseId:n.id,taskId:r.id,item:w},w.id))}):o.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No steps defined."})]}),(S=r.subtasks)!=null&&S.length?o.jsx(un,{title:"Subtasks",count:r.subtasks.length,defaultOpen:!1,contentClassName:"grid gap-2",children:r.subtasks.map(w=>o.jsxs("div",{className:"surface-card flex items-center justify-between gap-4 px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:w.title}),o.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:w.id})]}),o.jsx(ar,{status:w.status})]},w.id))}):null]}),o.jsx(Ei,{})]})}const zA=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Gl({title:e,description:n,children:r}){const s=Or(),u=v.useRef(null),c=v.useRef(null);return v.useEffect(()=>{var g;const f=u.current;if(!f)return;const h=document.activeElement;(g=c.current)==null||g.focus();const p=y=>{if(y.key==="Escape"){y.preventDefault(),s(-1);return}if(y.key!=="Tab")return;const x=Array.from(f.querySelectorAll(zA)).filter(j=>j.offsetParent!==null);if(x.length===0){y.preventDefault(),f.focus();return}const E=x[0],S=x[x.length-1],w=document.activeElement;y.shiftKey?(w===E||!f.contains(w))&&(y.preventDefault(),S.focus()):w===S&&(y.preventDefault(),E.focus())};return window.addEventListener("keydown",p),()=>{var y;window.removeEventListener("keydown",p),(y=h==null?void 0:h.focus)==null||y.call(h)}},[s]),o.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto p-4 md:p-6",children:[o.jsx("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>s(-1),"aria-hidden":"true",tabIndex:-1}),o.jsx("div",{className:"relative z-10 flex min-h-full items-start justify-center",children:o.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":e,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:[o.jsxs("div",{className:"mb-6 flex shrink-0 items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:e}),n?o.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:n}):null]}),o.jsx("button",{ref:c,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:o.jsx(f0,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:r})]})})]})}function Xl({className:e="",children:n,...r}){return o.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 ${e}`,...r,children:n})}function st({label:e,children:n}){return o.jsxs("label",{className:"grid gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--text-muted)]",children:e}),n]})}function pa(e){return o.jsx("textarea",{className:"field-control field-textarea",...e})}function UA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return Ca("submit",s,{allowInEditable:!0}),o.jsx(Gl,{title:"Create feature",description:"Top-level container for phases and tasks.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Feature name",children:o.jsx(dn,{name:"name",placeholder:"Products page implementation",required:!0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",placeholder:"Short context for the feature"})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Creating…":"Create feature"})})]})})}function $A(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var f;return(f=r.current)==null?void 0:f.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const c=Ns("feature-detail").feature;return o.jsx(Gl,{title:"Edit feature",description:"Update metadata, planning notes and timeline.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Name",children:o.jsx(dn,{name:"name",defaultValue:c.name,required:!0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",defaultValue:c.description})}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[o.jsx(st,{label:"Start date",children:o.jsx(dn,{type:"date",name:"startDate",defaultValue:c.startDate})}),o.jsx(st,{label:"End date",children:o.jsx(dn,{type:"date",name:"endDate",defaultValue:c.endDate})})]}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:c.status,children:Ed.map(f=>o.jsx("option",{value:f.value,children:f.label},f.value))})}),o.jsx(st,{label:"Priority",children:o.jsx(dn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),o.jsx(un,{title:"Planning notes",subtitle:"Optional agent-maintained notes for progress tracking.",defaultOpen:!1,className:"mt-0",children:o.jsxs("div",{className:"grid gap-4",children:[o.jsx(st,{label:"Work done",children:o.jsx(pa,{name:"workDone",defaultValue:c.workDone})}),o.jsx(st,{label:"Work remaining",children:o.jsx(pa,{name:"workRemaining",defaultValue:c.workRemaining})})]})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Saving…":"Save feature"})})]})})}function BA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return Ca("submit",s,{allowInEditable:!0}),o.jsx(Gl,{title:"Create phase",description:"A phase belongs to the current feature.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Phase title",children:o.jsx(dn,{name:"title",placeholder:"API creation",required:!0})}),o.jsx(st,{label:"Summary",children:o.jsx(pa,{name:"summary",placeholder:"Brief phase summary"})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",placeholder:"Initial implementation notes"})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Creating…":"Create phase"})})]})})}function ci(e){return e.join(`
314
- `)}function HA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var f;return(f=r.current)==null?void 0:f.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const c=Ns("phase-detail").phase;return o.jsx(Gl,{title:"Edit phase",description:"Update scope, constraints and delivery criteria.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Title",children:o.jsx(dn,{name:"title",defaultValue:c.title,required:!0})}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:c.status,children:Nd.map(f=>o.jsx("option",{value:f.value,children:f.label},f.value))})}),o.jsx(st,{label:"Priority",children:o.jsx(dn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),o.jsx(st,{label:"Summary",children:o.jsx(pa,{name:"summary",defaultValue:c.summary})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",defaultValue:c.description})}),o.jsx(st,{label:"Goals (one per line)",children:o.jsx(pa,{name:"goals",defaultValue:ci(c.goals)})}),o.jsx(st,{label:"Non-goals (one per line)",children:o.jsx(pa,{name:"nonGoals",defaultValue:ci(c.nonGoals)})}),o.jsx(st,{label:"Dependencies (one per line)",children:o.jsx(pa,{name:"dependencies",defaultValue:ci(c.dependencies)})}),o.jsx(st,{label:"Risks (one per line)",children:o.jsx(pa,{name:"risks",defaultValue:ci(c.risks)})}),o.jsx(st,{label:"Open questions (one per line)",children:o.jsx(pa,{name:"openQuestions",defaultValue:ci(c.openQuestions)})}),o.jsx(st,{label:"Completion criteria (one per line)",children:o.jsx(pa,{name:"completionCriteria",defaultValue:ci(c.completionCriteria)})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Saving…":"Save phase"})})]})})}function IA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return Ca("submit",s,{allowInEditable:!0}),o.jsx(Gl,{title:"Create task",description:"A task belongs to the current phase.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Task title",children:o.jsx(dn,{name:"title",placeholder:"Custom fetcher integration",required:!0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",placeholder:"Initial task context"})}),o.jsx(st,{label:"Checklist (one per line)",children:o.jsx(pa,{name:"checklist",placeholder:`Step one
315
- Step two
316
- Step three`})}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:"planned",children:td.map(u=>o.jsx("option",{value:u.value,children:u.label},u.value))})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Creating…":"Create task"})})]})})}function qA(e){return e.map(n=>n.title).join(`
317
- `)}function PA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var h;return(h=r.current)==null?void 0:h.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const c=Ns("task-detail").task,f=c.status==="in-progress"?td:td.filter(h=>h.value!=="in-progress");return o.jsx(Gl,{title:"Edit task",description:"Update execution details and checklist items.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Title",children:o.jsx(dn,{name:"title",defaultValue:c.title,required:!0})}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:c.status,disabled:!!c.pauseSnapshot,title:c.pauseSnapshot?"Resume checkpointed work through task_start so its checkpoint is preserved.":void 0,children:f.map(h=>o.jsx("option",{value:h.value,children:h.label},h.value))})}),o.jsx(st,{label:"Priority",children:o.jsx(dn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",defaultValue:c.description})}),o.jsx(st,{label:"Checklist (one per line)",children:o.jsx(pa,{name:"checklist",defaultValue:qA(c.checklist)})}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Saving…":"Save task"})})]})})}function FA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const{project:u}=Ns("root");return o.jsxs("div",{className:"grid gap-8",children:[o.jsxs(Ye,{to:"/",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[o.jsx(dd,{className:"h-4 w-4"})," Back to dashboard"]}),o.jsxs(Vt,{className:"grid gap-5",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:"Edit project overview"}),o.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."})]}),o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Project name",children:o.jsx(dn,{name:"name",defaultValue:u.name,placeholder:"Project name",required:!0})}),o.jsx(st,{label:"Short description",children:o.jsx(pa,{name:"description",defaultValue:u.description,placeholder:"Summarize the project in a few lines for the dashboard overview"})}),o.jsx(st,{label:"Project goal",children:o.jsx(pa,{name:"goal",defaultValue:u.goal,placeholder:"Define the main objective, success criteria, and overall direction of the project"})}),o.jsxs("div",{className:"flex justify-end gap-3",children:[o.jsx(Ye,{to:"/",children:o.jsx(ht,{type:"button",variant:"ghost",children:"Cancel"})}),o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Saving…":"Save project overview"})]})]})]})]})}function VA(e){return`P${String(e.number??0).padStart(3,"0")}`}function R1({phases:e,selectedIds:n=[]}){const r=new Set(n);return o.jsx(st,{label:"Linked phases",children:e.length===0?o.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."}):o.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-[var(--border)] bg-[var(--surface-elevated)] p-3",children:[o.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Select the phases that directly implement or track this requirement."}),o.jsx("div",{className:"grid gap-2 max-h-[32dvh] overflow-y-auto pr-1",children:e.map(s=>o.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:[o.jsx("input",{type:"checkbox",name:"linkedPhaseIds",value:s.id,defaultChecked:r.has(s.id),className:"mt-0.5 h-4 w-4 shrink-0 accent-[var(--accent)]"}),o.jsxs("span",{className:"min-w-0",children:[o.jsxs("span",{className:"block font-semibold",children:[VA(s)," — ",s.title]}),s.summary?o.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-muted)]",children:s.summary}):null]})]},s.id))})]})})}function YA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const{phases:u}=Ns("requirements");return o.jsx(Gl,{title:"Create requirement",description:"Capture a top-level outcome that phases can implement and track.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Requirement title",children:o.jsx(dn,{name:"title",placeholder:"Self-hosted Claude Code plugin marketplace distribution",required:!0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",placeholder:"Describe the user/business outcome this requirement represents"})}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:"planned",children:d1.map(c=>o.jsx("option",{value:c.value,children:c.label},c.value))})}),o.jsx(R1,{phases:u}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Creating…":"Create requirement"})})]})})}function GA(){const n=gr().state!=="idle",r=v.useRef(null),s=v.useCallback(()=>{var p;return(p=r.current)==null?void 0:p.requestSubmit()},[]);Ca("submit",s,{allowInEditable:!0});const{requirementId:u}=BE(),{phases:c,requirements:f}=Ns("requirements"),h=f.find(p=>p.id===u);return h?o.jsx(Gl,{title:"Edit requirement",description:"Update status, scope notes, and linked delivery phases.",children:o.jsxs(Za,{ref:r,method:"post",className:"grid gap-4",children:[o.jsx(st,{label:"Requirement title",children:o.jsx(dn,{name:"title",defaultValue:h.title,required:!0})}),o.jsx(st,{label:"Description",children:o.jsx(pa,{name:"description",defaultValue:h.description})}),o.jsx(st,{label:"Status",children:o.jsx(Yl,{name:"status",defaultValue:h.status,children:d1.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})}),o.jsx(R1,{phases:c,selectedIds:h.linkedPhaseIds}),o.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."}),o.jsx(Xl,{children:o.jsx(ht,{type:"submit",variant:"primary",disabled:n,shortcut:"submit",children:n?"Saving…":"Save requirement"})})]})}):null}function Wa(e,n){const r=e.get(n);if(typeof r!="string"||r.trim()==="")throw new Response(`Missing field: ${n}`,{status:400});return r.trim()}function Ua(e,n){const r=e.get(n);return typeof r=="string"?r.trim():""}function fp(e,n){const r=e.get(n);if(typeof r!="string")return 0;const s=r.trim();if(s==="")return 0;const u=Number(s);return Number.isFinite(u)?u:0}function Il(e,n){return Ua(e,n).split(`
318
- `).map(r=>r.trim()).filter(Boolean)}function Qt(e,n){const r=e[n];if(!r)throw new Response(`Missing route param: ${n}`,{status:400});return r}async function XA({request:e}){const n=await e.formData();return await uR({name:Wa(n,"name"),description:Ua(n,"description")}),kn("/features")}async function QA({request:e,params:n}){const r=Qt(n,"featureId"),s=await tc(r),u=await e.formData();return await p0({...s,name:Wa(u,"name"),description:Ua(u,"description"),startDate:Ua(u,"startDate"),endDate:Ua(u,"endDate"),status:Wa(u,"status"),priority:fp(u,"priority"),workDone:Ua(u,"workDone"),workRemaining:Ua(u,"workRemaining")}),kn(`/features/${r}`)}async function KA({params:e}){return await dR(Qt(e,"featureId")),kn("/features")}async function ZA({request:e,params:n}){const r=Qt(n,"featureId"),s=await tc(r),u=await e.formData();return await p0({...s,status:Wa(u,"status")}),null}async function WA({request:e,params:n}){const r=Qt(n,"featureId"),s=await e.formData();return await pR({featureId:r,title:Wa(s,"title"),summary:Ua(s,"summary"),description:Ua(s,"description")}),kn(`/features/${r}`)}async function JA({request:e,params:n}){const r=Qt(n,"featureId"),s=Qt(n,"phaseId"),u=await gd(s),c=await e.formData();return await g0({...u,title:Wa(c,"title"),status:Wa(c,"status"),priority:fp(c,"priority"),summary:Ua(c,"summary"),description:Ua(c,"description"),goals:Il(c,"goals"),nonGoals:Il(c,"nonGoals"),dependencies:Il(c,"dependencies"),risks:Il(c,"risks"),openQuestions:Il(c,"openQuestions"),completionCriteria:Il(c,"completionCriteria")}),kn(`/features/${r}/phases/${s}`)}async function eD({params:e}){const n=Qt(e,"featureId"),r=Qt(e,"phaseId");return await gR(r),kn(`/features/${n}`)}async function tD({request:e,params:n}){const r=Qt(n,"phaseId"),s=await gd(r),u=await e.formData();return await g0({...s,status:Wa(u,"status")}),null}async function aD({request:e,params:n}){const r=Qt(n,"featureId"),s=Qt(n,"phaseId"),u=await e.formData(),c=Il(u,"checklist");return await vR(s,{title:Wa(u,"title"),description:Ua(u,"description"),status:Ua(u,"status")||"planned",...c.length?{checklist:c}:{}}),kn(`/features/${r}/phases/${s}`)}function nD(e,n){const r=new Map(e.map(u=>[u.id,u])),s=new Map(e.map(u=>[u.title.trim().toLowerCase(),u]));return n.map((u,c)=>{var p;const f=u.trim().toLowerCase(),h=r.get(((p=e[c])==null?void 0:p.id)??"")??s.get(f);return h?{...h,number:c+1,title:u.trim()}:{id:`check-${c+1}-${f.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}`,number:c+1,title:u.trim(),checked:!1}})}async function rD({request:e,params:n}){const r=Qt(n,"featureId"),s=Qt(n,"phaseId"),u=Qt(n,"taskId"),c=await vd(u),f=await e.formData(),h=Wa(f,"status");if(h==="in-progress"&&c.status!=="in-progress")throw new Response("Use Start task or Resume task to enter in-progress.",{status:400});return await Bm({...c,phaseId:s,title:Wa(f,"title"),status:h,priority:fp(f,"priority"),description:Ua(f,"description"),checklist:nD(c.checklist,Il(f,"checklist"))}),kn(`/features/${r}/phases/${s}/tasks/${u}`)}async function lD({params:e}){const n=Qt(e,"featureId"),r=Qt(e,"phaseId"),s=Qt(e,"taskId");return await yR(s),kn(`/features/${n}/phases/${r}`)}async function sD({request:e,params:n}){const r=Qt(n,"phaseId"),s=Qt(n,"taskId"),u=await vd(s),c=await e.formData();return await Bm({...u,phaseId:r,status:Wa(c,"status")}),null}async function iD({params:e}){const n=Qt(e,"featureId"),r=Qt(e,"phaseId"),s=Qt(e,"taskId");return await xR(s),kn(`/features/${n}/phases/${r}/tasks/${s}`)}async function oD({request:e}){const n=await Um(),r=await e.formData();return await oR({...n,name:Ua(r,"name")||n.name,description:Ua(r,"description"),goal:Ua(r,"goal")}),kn("/")}async function cD({request:e}){const n=await e.formData();return await fR({id:crypto.randomUUID(),title:Wa(n,"title"),description:Ua(n,"description"),status:Wa(n,"status"),linkedPhaseIds:n.getAll("linkedPhaseIds").filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean)}),kn("/requirements")}async function uD({request:e,params:n}){const r=Qt(n,"requirementId"),s=(await $m()).find(c=>c.id===r);if(!s)throw new Response(`Requirement not found: ${r}`,{status:404});const u=await e.formData();return await hR({...s,title:Wa(u,"title"),description:Ua(u,"description"),status:Wa(u,"status"),linkedPhaseIds:u.getAll("linkedPhaseIds").filter(c=>typeof c=="string").map(c=>c.trim()).filter(Boolean)}),kn("/requirements")}async function dD({params:e}){return await mR(Qt(e,"requirementId")),kn("/requirements")}function fD(e){if(!e)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}async function hD(){return{handoffs:await dm()}}function mD(){const{handoffs:e}=ol(),[n,r]=v.useState(e),[s,u]=v.useState(null),[c,f]=v.useState(""),h=In();async function p(g){if(!(s||!window.confirm(`Clear handoff for ${g.compositeRef}?`))){u(g.phaseId),f("");try{await v0(g.phaseId),r(x=>x.filter(E=>E.phaseId!==g.phaseId)),dm().then(r).catch(()=>{})}catch(x){const E=x instanceof Response?await x.text().catch(()=>""):x instanceof Error?x.message:String(x);f(E||`Failed to clear handoff for ${g.compositeRef}.`)}finally{u(null)}}}return v.useEffect(()=>{const g=y=>{const x=y.detail;((x==null?void 0:x.type)==="handoffUpdated"||(x==null?void 0:x.type)==="handoffCleared")&&dm().then(r).catch(()=>{})};return window.addEventListener("agent-plan:ws-event",g),()=>window.removeEventListener("agent-plan:ws-event",g)},[]),v.useEffect(()=>{if(!h.hash)return;const g=h.hash.slice(1),y=document.getElementById(g);y&&y.scrollIntoView({behavior:"smooth",block:"start"})},[h.hash,n]),n.length===0?o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[o.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),o.jsx(Ye,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Pending entity-scoped handoffs on non-completed phases."})]}),c?o.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:c}):null,o.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No pending phase handoffs."})]}):o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[o.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),o.jsx(Ye,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),o.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Pending entity-scoped handoffs on non-completed phases. ",n.length," pending."]})]}),c?o.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:c}):null,n.map(g=>o.jsx("section",{id:g.phaseId,className:"scroll-mt-20",children:o.jsx(Vt,{className:"overflow-hidden p-0",children:o.jsx(un,{defaultOpen:!1,title:o.jsxs(o.Fragment,{children:[o.jsx(sr,{id:g.compositeRef,children:g.compositeRef}),o.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:o.jsxs(o.Fragment,{children:[o.jsx(ht,{type:"button",variant:"danger",className:"min-h-8 px-2.5 py-1 text-xs sm:min-h-9",disabled:s===g.phaseId,onClick:y=>{y.preventDefault(),y.stopPropagation(),p(g)},children:s===g.phaseId?"Clearing…":"Clear"}),o.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:y=>y.stopPropagation(),children:g.featureId?"Open phase →":"Browse features →"})]}),contentClassName:"px-5 py-5",children:g.firstLine?o.jsx(ba,{text:g.content,className:"formatted-text max-w-none"}):o.jsx("p",{className:"text-sm italic text-[var(--text-muted)]",children:"Empty handoff content."})})})},g.phaseId))]})}function pD(e){if(!e)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}async function gD(){return{archived:await SR()}}function vD(){const{archived:e}=ol();return e.length===0?o.jsxs(Vt,{className:"grid gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),o.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Completed, superseded, and manually cleared handoffs."})]}),o.jsx(Ye,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),o.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No archived handoffs."})]}):o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),o.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:[e.length," archived entries. These are history, not pending resume context."]})]}),o.jsx(Ye,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),e.map(n=>o.jsx(Vt,{className:"overflow-hidden p-0",children:o.jsxs(un,{defaultOpen:!1,title:o.jsxs(o.Fragment,{children:[o.jsx(sr,{id:n.compositeRef,children:n.compositeRef}),o.jsxs("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:["Archived ",pD(n.archivedAt)]})]}),subtitle:n.firstLine||"Empty archived handoff.",contentClassName:"px-5 py-5",children:[o.jsxs("div",{className:"mb-3 flex flex-wrap gap-2 text-xs text-[var(--text-muted)]",children:[o.jsxs("span",{children:["Reason: ",n.reason||"unknown"]}),o.jsxs("span",{className:"break-all",children:["File: ",n.file]})]}),o.jsx(ba,{text:n.content||"(archive file unavailable)",className:"formatted-text max-w-none"})]})},`${n.phaseId}:${n.file}`))]})}async function xD({request:e,params:n}){Qt(n,"featureId");const r=Qt(n,"phaseId"),s=Qt(n,"taskId"),u=Qt(n,"itemId"),c=await e.formData(),f=Wa(c,"checked")==="true",h=await vd(s);return await Bm({...h,phaseId:r,checklist:h.checklist.map(p=>p.id===u?{...p,checked:f}:p)}),Response.json({ok:!0,taskId:s,itemId:u,checked:f})}const yD=ON([{id:"root",path:"/",loader:WR,element:o.jsx(JR,{}),errorElement:o.jsx(e2,{}),children:[{index:!0,loader:t2,element:o.jsx(rA,{})},{path:"features",id:"features",loader:lA,element:o.jsx(dA,{}),children:[{path:"new",element:o.jsx(UA,{}),action:XA}]},{path:"features/:featureId",id:"feature-detail",loader:gA,element:o.jsx(kA,{}),children:[{path:"edit",element:o.jsx($A,{}),action:QA},{path:"phases/new",element:o.jsx(BA,{}),action:WA}]},{path:"requirements",id:"requirements",loader:fA,element:o.jsx(pA,{}),children:[{path:"new",element:o.jsx(YA,{}),action:cD},{path:":requirementId/edit",element:o.jsx(GA,{}),action:uD}]},{path:"project/edit",element:o.jsx(FA,{}),action:oD},{path:"handoff",loader:hD,element:o.jsx(mD,{})},{path:"handoff/archive",loader:gD,element:o.jsx(vD,{})},{path:"features/:featureId/delete",action:KA},{path:"requirements/:requirementId/delete",action:dD},{path:"features/:featureId/status",action:ZA},{path:"features/:featureId/phases/:phaseId",id:"phase-detail",loader:TA,element:o.jsx(DA,{}),children:[{path:"edit",element:o.jsx(HA,{}),action:JA},{path:"tasks/new",element:o.jsx(IA,{}),action:aD}]},{path:"features/:featureId/phases/:phaseId/delete",action:eD},{path:"features/:featureId/phases/:phaseId/status",action:tD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId",id:"task-detail",loader:OA,element:o.jsx(LA,{}),children:[{path:"edit",element:o.jsx(PA,{}),action:rD}]},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/delete",action:lD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/start",action:iD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/status",action:sD},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/checklist/:itemId/toggle",action:xD}]}]),k1=document.getElementById("root");if(!k1)throw new Error("#root not found");bS.createRoot(k1).render(o.jsx(v.StrictMode,{children:o.jsx(qN,{router:yD})}));