@siming-org/server 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-T7QAGG73.js → chunk-XVFWTF42.js} +373 -47
- package/dist/index.js +1 -1
- package/dist/main.js +30 -1
- package/package.json +2 -2
- package/web-dist/assets/index-BDVtljmz.css +1 -0
- package/web-dist/assets/index-D9vR6Pjw.js +122 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-B_ZlCIgd.css +0 -1
- package/web-dist/assets/index-hBW7IJvz.js +0 -121
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
function h3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function V0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yx={exports:{}},hd={};var dR;function p3(){if(dR)return hd;dR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var l=null;if(i!==void 0&&(l=""+i),o.key!==void 0&&(l=""+o.key),"key"in o){i={};for(var c in o)c!=="key"&&(i[c]=o[c])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:l,ref:o!==void 0?o:null,props:i}}return hd.Fragment=t,hd.jsx=n,hd.jsxs=n,hd}var fR;function m3(){return fR||(fR=1,yx.exports=p3()),yx.exports}var h=m3(),vx={exports:{}},jt={};var hR;function g3(){if(hR)return jt;hR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function v($){return $===null||typeof $!="object"?null:($=y&&$[y]||$["@@iterator"],typeof $=="function"?$:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,S={};function _($,F,Q){this.props=$,this.context=F,this.refs=S,this.updater=Q||x}_.prototype.isReactComponent={},_.prototype.setState=function($,F){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,F,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function j(){}j.prototype=_.prototype;function R($,F,Q){this.props=$,this.context=F,this.refs=S,this.updater=Q||x}var N=R.prototype=new j;N.constructor=R,E(N,_.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function k(){}var M={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function L($,F,Q){var X=Q.ref;return{$$typeof:e,type:$,key:F,ref:X!==void 0?X:null,props:Q}}function G($,F){return L($.type,F,$.props)}function B($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function V($){var F={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Q){return F[Q]})}var q=/\/+/g;function I($,F){return typeof $=="object"&&$!==null&&$.key!=null?V(""+$.key):F.toString(36)}function z($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(k,k):($.status="pending",$.then(function(F){$.status==="pending"&&($.status="fulfilled",$.value=F)},function(F){$.status==="pending"&&($.status="rejected",$.reason=F)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function A($,F,Q,X,ne){var te=typeof $;(te==="undefined"||te==="boolean")&&($=null);var J=!1;if($===null)J=!0;else switch(te){case"bigint":case"string":case"number":J=!0;break;case"object":switch($.$$typeof){case e:case t:J=!0;break;case p:return J=$._init,A(J($._payload),F,Q,X,ne)}}if(J)return ne=ne($),J=X===""?"."+I($,0):X,O(ne)?(Q="",J!=null&&(Q=J.replace(q,"$&/")+"/"),A(ne,F,Q,"",function(ye){return ye})):ne!=null&&(B(ne)&&(ne=G(ne,Q+(ne.key==null||$&&$.key===ne.key?"":(""+ne.key).replace(q,"$&/")+"/")+J)),F.push(ne)),1;J=0;var K=X===""?".":X+":";if(O($))for(var re=0;re<$.length;re++)X=$[re],te=K+I(X,re),J+=A(X,F,Q,te,ne);else if(re=v($),typeof re=="function")for($=re.call($),re=0;!(X=$.next()).done;)X=X.value,te=K+I(X,re++),J+=A(X,F,Q,te,ne);else if(te==="object"){if(typeof $.then=="function")return A(z($),F,Q,X,ne);throw F=String($),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return J}function P($,F,Q){if($==null)return $;var X=[],ne=0;return A($,X,"","",function(te){return F.call(Q,te,ne++)}),X}function U($){if($._status===-1){var F=$._result;F=F(),F.then(function(Q){($._status===0||$._status===-1)&&($._status=1,$._result=Q)},function(Q){($._status===0||$._status===-1)&&($._status=2,$._result=Q)}),$._status===-1&&($._status=0,$._result=F)}if($._status===1)return $._result.default;throw $._result}var H=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},Y={map:P,forEach:function($,F,Q){P($,function(){F.apply(this,arguments)},Q)},count:function($){var F=0;return P($,function(){F++}),F},toArray:function($){return P($,function(F){return F})||[]},only:function($){if(!B($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return jt.Activity=g,jt.Children=Y,jt.Component=_,jt.Fragment=n,jt.Profiler=o,jt.PureComponent=R,jt.StrictMode=r,jt.Suspense=f,jt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,jt.__COMPILER_RUNTIME={__proto__:null,c:function($){return M.H.useMemoCache($)}},jt.cache=function($){return function(){return $.apply(null,arguments)}},jt.cacheSignal=function(){return null},jt.cloneElement=function($,F,Q){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var X=E({},$.props),ne=$.key;if(F!=null)for(te in F.key!==void 0&&(ne=""+F.key),F)!T.call(F,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&F.ref===void 0||(X[te]=F[te]);var te=arguments.length-2;if(te===1)X.children=Q;else if(1<te){for(var J=Array(te),K=0;K<te;K++)J[K]=arguments[K+2];X.children=J}return L($.type,ne,X)},jt.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:i,_context:$},$},jt.createElement=function($,F,Q){var X,ne={},te=null;if(F!=null)for(X in F.key!==void 0&&(te=""+F.key),F)T.call(F,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(ne[X]=F[X]);var J=arguments.length-2;if(J===1)ne.children=Q;else if(1<J){for(var K=Array(J),re=0;re<J;re++)K[re]=arguments[re+2];ne.children=K}if($&&$.defaultProps)for(X in J=$.defaultProps,J)ne[X]===void 0&&(ne[X]=J[X]);return L($,te,ne)},jt.createRef=function(){return{current:null}},jt.forwardRef=function($){return{$$typeof:c,render:$}},jt.isValidElement=B,jt.lazy=function($){return{$$typeof:p,_payload:{_status:-1,_result:$},_init:U}},jt.memo=function($,F){return{$$typeof:d,type:$,compare:F===void 0?null:F}},jt.startTransition=function($){var F=M.T,Q={};M.T=Q;try{var X=$(),ne=M.S;ne!==null&&ne(Q,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(k,H)}catch(te){H(te)}finally{F!==null&&Q.types!==null&&(F.types=Q.types),M.T=F}},jt.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},jt.use=function($){return M.H.use($)},jt.useActionState=function($,F,Q){return M.H.useActionState($,F,Q)},jt.useCallback=function($,F){return M.H.useCallback($,F)},jt.useContext=function($){return M.H.useContext($)},jt.useDebugValue=function(){},jt.useDeferredValue=function($,F){return M.H.useDeferredValue($,F)},jt.useEffect=function($,F){return M.H.useEffect($,F)},jt.useEffectEvent=function($){return M.H.useEffectEvent($)},jt.useId=function(){return M.H.useId()},jt.useImperativeHandle=function($,F,Q){return M.H.useImperativeHandle($,F,Q)},jt.useInsertionEffect=function($,F){return M.H.useInsertionEffect($,F)},jt.useLayoutEffect=function($,F){return M.H.useLayoutEffect($,F)},jt.useMemo=function($,F){return M.H.useMemo($,F)},jt.useOptimistic=function($,F){return M.H.useOptimistic($,F)},jt.useReducer=function($,F,Q){return M.H.useReducer($,F,Q)},jt.useRef=function($){return M.H.useRef($)},jt.useState=function($){return M.H.useState($)},jt.useSyncExternalStore=function($,F,Q){return M.H.useSyncExternalStore($,F,Q)},jt.useTransition=function(){return M.H.useTransition()},jt.version="19.2.8",jt}var pR;function yf(){return pR||(pR=1,vx.exports=g3()),vx.exports}var b=yf();const Ee=V0(b),Cl=h3({__proto__:null,default:Ee},[b]);var xx={exports:{}},pd={},bx={exports:{}},wx={};var mR;function y3(){return mR||(mR=1,(function(e){function t(A,P){var U=A.length;A.push(P);e:for(;0<U;){var H=U-1>>>1,Y=A[H];if(0<o(Y,P))A[H]=P,A[U]=Y,U=H;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var P=A[0],U=A.pop();if(U!==P){A[0]=U;e:for(var H=0,Y=A.length,$=Y>>>1;H<$;){var F=2*(H+1)-1,Q=A[F],X=F+1,ne=A[X];if(0>o(Q,U))X<Y&&0>o(ne,Q)?(A[H]=ne,A[X]=U,H=X):(A[H]=Q,A[F]=U,H=F);else if(X<Y&&0>o(ne,U))A[H]=ne,A[X]=U,H=X;else break e}}return P}function o(A,P){var U=A.sortIndex-P.sortIndex;return U!==0?U:A.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var f=[],d=[],p=1,g=null,y=3,v=!1,x=!1,E=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function N(A){for(var P=n(d);P!==null;){if(P.callback===null)r(d);else if(P.startTime<=A)r(d),P.sortIndex=P.expirationTime,t(f,P);else break;P=n(d)}}function O(A){if(E=!1,N(A),!x)if(n(f)!==null)x=!0,k||(k=!0,V());else{var P=n(d);P!==null&&z(O,P.startTime-A)}}var k=!1,M=-1,T=5,L=-1;function G(){return S?!0:!(e.unstable_now()-L<T)}function B(){if(S=!1,k){var A=e.unstable_now();L=A;var P=!0;try{e:{x=!1,E&&(E=!1,j(M),M=-1),v=!0;var U=y;try{t:{for(N(A),g=n(f);g!==null&&!(g.expirationTime>A&&G());){var H=g.callback;if(typeof H=="function"){g.callback=null,y=g.priorityLevel;var Y=H(g.expirationTime<=A);if(A=e.unstable_now(),typeof Y=="function"){g.callback=Y,N(A),P=!0;break t}g===n(f)&&r(f),N(A)}else r(f);g=n(f)}if(g!==null)P=!0;else{var $=n(d);$!==null&&z(O,$.startTime-A),P=!1}}break e}finally{g=null,y=U,v=!1}P=void 0}}finally{P?V():k=!1}}}var V;if(typeof R=="function")V=function(){R(B)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,I=q.port2;q.port1.onmessage=B,V=function(){I.postMessage(null)}}else V=function(){_(B,0)};function z(A,P){M=_(function(){A(e.unstable_now())},P)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(A){switch(y){case 1:case 2:case 3:var P=3;break;default:P=y}var U=y;y=P;try{return A()}finally{y=U}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(A,P){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var U=y;y=A;try{return P()}finally{y=U}},e.unstable_scheduleCallback=function(A,P,U){var H=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,A){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=U+Y,A={id:p++,callback:P,priorityLevel:A,startTime:U,expirationTime:Y,sortIndex:-1},U>H?(A.sortIndex=U,t(d,A),n(f)===null&&A===n(d)&&(E?(j(M),M=-1):E=!0,z(O,U-H))):(A.sortIndex=Y,t(f,A),x||v||(x=!0,k||(k=!0,V()))),A},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(A){var P=y;return function(){var U=y;y=P;try{return A.apply(this,arguments)}finally{y=U}}}})(wx)),wx}var gR;function v3(){return gR||(gR=1,bx.exports=y3()),bx.exports}var Sx={exports:{}},$r={};var yR;function x3(){if(yR)return $r;yR=1;var e=yf();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function i(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return $r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,$r.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return i(f,d,null,p)},$r.flushSync=function(f){var d=l.T,p=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=p,r.d.f()}},$r.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},$r.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},$r.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:v}):p==="script"&&r.d.X(f,{crossOrigin:g,integrity:y,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},$r.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},$r.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},$r.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},$r.requestFormReset=function(f){r.d.r(f)},$r.unstable_batchedUpdates=function(f,d){return f(d)},$r.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},$r.useFormStatus=function(){return l.H.useHostTransitionStatus()},$r.version="19.2.8",$r}var vR;function eM(){if(vR)return Sx.exports;vR=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(t){console.error(t)}}return e(),Sx.exports=x3(),Sx.exports}var xR;function b3(){if(xR)return pd;xR=1;var e=v3(),t=yf(),n=eM();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function i(s){var a=s,u=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(u=a.return),s=a.return;while(s)}return a.tag===3?u:null}function l(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function c(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function f(s){if(i(s)!==s)throw Error(r(188))}function d(s){var a=s.alternate;if(!a){if(a=i(s),a===null)throw Error(r(188));return a!==s?null:s}for(var u=s,m=a;;){var w=u.return;if(w===null)break;var C=w.alternate;if(C===null){if(m=w.return,m!==null){u=m;continue}break}if(w.child===C.child){for(C=w.child;C;){if(C===u)return f(w),s;if(C===m)return f(w),a;C=C.sibling}throw Error(r(188))}if(u.return!==m.return)u=w,m=C;else{for(var D=!1,Z=w.child;Z;){if(Z===u){D=!0,u=w,m=C;break}if(Z===m){D=!0,m=w,u=C;break}Z=Z.sibling}if(!D){for(Z=C.child;Z;){if(Z===u){D=!0,u=C,m=w;break}if(Z===m){D=!0,m=C,u=w;break}Z=Z.sibling}if(!D)throw Error(r(189))}}if(u.alternate!==m)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?s:a}function p(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=p(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),R=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function V(s){return s===null||typeof s!="object"?null:(s=B&&s[B]||s["@@iterator"],typeof s=="function"?s:null)}var q=Symbol.for("react.client.reference");function I(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===q?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case E:return"Fragment";case _:return"Profiler";case S:return"StrictMode";case O:return"Suspense";case k:return"SuspenseList";case L:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case R:return s.displayName||"Context";case j:return(s._context.displayName||"Context")+".Consumer";case N:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case M:return a=s.displayName||null,a!==null?a:I(s.type)||"Memo";case T:a=s._payload,s=s._init;try{return I(s(a))}catch{}}return null}var z=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},H=[],Y=-1;function $(s){return{current:s}}function F(s){0>Y||(s.current=H[Y],H[Y]=null,Y--)}function Q(s,a){Y++,H[Y]=s.current,s.current=a}var X=$(null),ne=$(null),te=$(null),J=$(null);function K(s,a){switch(Q(te,a),Q(ne,s),Q(X,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?D_(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=D_(a),s=P_(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}F(X),Q(X,s)}function re(){F(X),F(ne),F(te)}function ye(s){s.memoizedState!==null&&Q(J,s);var a=X.current,u=P_(a,s.type);a!==u&&(Q(ne,s),Q(X,u))}function fe(s){ne.current===s&&(F(X),F(ne)),J.current===s&&(F(J),cd._currentValue=U)}var ue,he;function Re(s){if(ue===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);ue=a&&a[1]||"",he=-1<u.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ue+s+he}var ze=!1;function Ue(s,a){if(!s||ze)return"";ze=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var Te=function(){throw Error()};if(Object.defineProperty(Te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Te,[])}catch(we){var ve=we}Reflect.construct(s,[],Te)}else{try{Te.call()}catch(we){ve=we}s.call(Te.prototype)}}else{try{throw Error()}catch(we){ve=we}(Te=s())&&typeof Te.catch=="function"&&Te.catch(function(){})}}catch(we){if(we&&ve&&typeof we.stack=="string")return[we.stack,ve.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=m.DetermineComponentFrameRoot(),D=C[0],Z=C[1];if(D&&Z){var oe=D.split(`
|
|
4
|
+
`),ge=Z.split(`
|
|
5
|
+
`);for(w=m=0;m<oe.length&&!oe[m].includes("DetermineComponentFrameRoot");)m++;for(;w<ge.length&&!ge[w].includes("DetermineComponentFrameRoot");)w++;if(m===oe.length||w===ge.length)for(m=oe.length-1,w=ge.length-1;1<=m&&0<=w&&oe[m]!==ge[w];)w--;for(;1<=m&&0<=w;m--,w--)if(oe[m]!==ge[w]){if(m!==1||w!==1)do if(m--,w--,0>w||oe[m]!==ge[w]){var _e=`
|
|
6
|
+
`+oe[m].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=m&&0<=w);break}}}finally{ze=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Re(u):""}function Ae(s,a){switch(s.tag){case 26:case 27:case 5:return Re(s.type);case 16:return Re("Lazy");case 13:return s.child!==a&&a!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ue(s.type,!1);case 11:return Ue(s.type.render,!1);case 1:return Ue(s.type,!0);case 31:return Re("Activity");default:return""}}function Qe(s){try{var a="",u=null;do a+=Ae(s,u),u=s,s=s.return;while(s);return a}catch(m){return`
|
|
7
|
+
Error generating stack: `+m.message+`
|
|
8
|
+
`+m.stack}}var De=Object.prototype.hasOwnProperty,Le=e.unstable_scheduleCallback,Fe=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,et=e.unstable_requestPaint,me=e.unstable_now,xe=e.unstable_getCurrentPriorityLevel,We=e.unstable_ImmediatePriority,Oe=e.unstable_UserBlockingPriority,Ie=e.unstable_NormalPriority,at=e.unstable_LowPriority,it=e.unstable_IdlePriority,$t=e.log,W=e.unstable_setDisableYieldValue,ie=null,ae=null;function Se(s){if(typeof $t=="function"&&W(s),ae&&typeof ae.setStrictMode=="function")try{ae.setStrictMode(ie,s)}catch{}}var be=Math.clz32?Math.clz32:$e,Ve=Math.log,Me=Math.LN2;function $e(s){return s>>>=0,s===0?32:31-(Ve(s)/Me|0)|0}var He=256,Xe=262144,Je=4194304;function bt(s){var a=s&42;if(a!==0)return a;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Mt(s,a,u){var m=s.pendingLanes;if(m===0)return 0;var w=0,C=s.suspendedLanes,D=s.pingedLanes;s=s.warmLanes;var Z=m&134217727;return Z!==0?(m=Z&~C,m!==0?w=bt(m):(D&=Z,D!==0?w=bt(D):u||(u=Z&~s,u!==0&&(w=bt(u))))):(Z=m&~C,Z!==0?w=bt(Z):D!==0?w=bt(D):u||(u=m&~s,u!==0&&(w=bt(u)))),w===0?0:a!==0&&a!==w&&(a&C)===0&&(C=w&-w,u=a&-a,C>=u||C===32&&(u&4194048)!==0)?a:w}function kt(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function nt(s,a){switch(s){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 s=Je;return Je<<=1,(Je&62914560)===0&&(Je=4194304),s}function Dt(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function St(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function In(s,a,u,m,w,C){var D=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var Z=s.entanglements,oe=s.expirationTimes,ge=s.hiddenUpdates;for(u=D&~u;0<u;){var _e=31-be(u),Te=1<<_e;Z[_e]=0,oe[_e]=-1;var ve=ge[_e];if(ve!==null)for(ge[_e]=null,_e=0;_e<ve.length;_e++){var we=ve[_e];we!==null&&(we.lane&=-536870913)}u&=~Te}m!==0&&Qt(s,m,0),C!==0&&w===0&&s.tag!==0&&(s.suspendedLanes|=C&~(D&~a))}function Qt(s,a,u){s.pendingLanes|=a,s.suspendedLanes&=~a;var m=31-be(a);s.entangledLanes|=a,s.entanglements[m]=s.entanglements[m]|1073741824|u&261930}function wn(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var m=31-be(u),w=1<<m;w&a|s[m]&a&&(s[m]|=a),u&=~w}}function ee(s,a){var u=a&-a;return u=(u&42)!==0?1:se(u),(u&(s.suspendedLanes|a))!==0?0:u}function se(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function ce(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ce(){var s=P.p;return s!==0?s:(s=window.event,s===void 0?32:oR(s.type))}function Ne(s,a){var u=P.p;try{return P.p=s,a()}finally{P.p=u}}var Ze=Math.random().toString(36).slice(2),Be="__reactFiber$"+Ze,Ge="__reactProps$"+Ze,Ke="__reactContainer$"+Ze,lt="__reactEvents$"+Ze,ht="__reactListeners$"+Ze,Rt="__reactHandles$"+Ze,vt="__reactResources$"+Ze,Pt="__reactMarker$"+Ze;function Wt(s){delete s[Be],delete s[Ge],delete s[lt],delete s[ht],delete s[Rt]}function Sn(s){var a=s[Be];if(a)return a;for(var u=s.parentNode;u;){if(a=u[Ke]||u[Be]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=U_(s);s!==null;){if(u=s[Be])return u;s=U_(s)}return a}s=u,u=s.parentNode}return null}function en(s){if(s=s[Be]||s[Ke]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Bt(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function Fn(s){var a=s[vt];return a||(a=s[vt]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Kt(s){s[Pt]=!0}var xs=new Set,uo={};function Lr(s,a){Cr(s,a),Cr(s+"Capture",a)}function Cr(s,a){for(uo[s]=a,s=0;s<a.length;s++)xs.add(a[s])}var Kr=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]*$"),Ni={},Xr={};function Ti(s){return De.call(Xr,s)?!0:De.call(Ni,s)?!1:Kr.test(s)?Xr[s]=!0:(Ni[s]=!0,!1)}function Zo(s,a,u){if(Ti(a))if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+u)}}function Go(s,a,u){if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+u)}}function Et(s,a,u,m){if(m===null)s.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(a,u,""+m)}}function dn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ur(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function fo(s,a,u){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var w=m.get,C=m.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return w.call(this)},set:function(D){u=""+D,C.call(this,D)}}),Object.defineProperty(s,a,{enumerable:m.enumerable}),{getValue:function(){return u},setValue:function(D){u=""+D},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Oi(s){if(!s._valueTracker){var a=Ur(s)?"checked":"value";s._valueTracker=fo(s,a,""+s[a])}}function Ys(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),m="";return s&&(m=Ur(s)?s.checked?"true":"false":s.value),s=m,s!==u?(a.setValue(s),!0):!1}function rn(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var No=/[\n"\\]/g;function _r(s){return s.replace(No,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Ma(s,a,u,m,w,C,D,Z){s.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?s.type=D:s.removeAttribute("type"),a!=null?D==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+dn(a)):s.value!==""+dn(a)&&(s.value=""+dn(a)):D!=="submit"&&D!=="reset"||s.removeAttribute("value"),a!=null?Cu(s,D,dn(a)):u!=null?Cu(s,D,dn(u)):m!=null&&s.removeAttribute("value"),w==null&&C!=null&&(s.defaultChecked=!!C),w!=null&&(s.checked=w&&typeof w!="function"&&typeof w!="symbol"),Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?s.name=""+dn(Z):s.removeAttribute("name")}function Dl(s,a,u,m,w,C,D,Z){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.type=C),a!=null||u!=null){if(!(C!=="submit"&&C!=="reset"||a!=null)){Oi(s);return}u=u!=null?""+dn(u):"",a=a!=null?""+dn(a):u,Z||a===s.value||(s.value=a),s.defaultValue=a}m=m??w,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=Z?s.checked:!!m,s.defaultChecked=!!m,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(s.name=D),Oi(s)}function Cu(s,a,u){a==="number"&&rn(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Mi(s,a,u,m){if(s=s.options,a){a={};for(var w=0;w<u.length;w++)a["$"+u[w]]=!0;for(u=0;u<s.length;u++)w=a.hasOwnProperty("$"+s[u].value),s[u].selected!==w&&(s[u].selected=w),w&&m&&(s[u].defaultSelected=!0)}else{for(u=""+dn(u),a=null,w=0;w<s.length;w++){if(s[w].value===u){s[w].selected=!0,m&&(s[w].defaultSelected=!0);return}a!==null||s[w].disabled||(a=s[w])}a!==null&&(a.selected=!0)}}function _u(s,a,u){if(a!=null&&(a=""+dn(a),a!==s.value&&(s.value=a),u==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=u!=null?""+dn(u):""}function OE(s,a,u,m){if(a==null){if(m!=null){if(u!=null)throw Error(r(92));if(z(m)){if(1<m.length)throw Error(r(93));m=m[0]}u=m}u==null&&(u=""),a=u}u=dn(a),s.defaultValue=u,m=s.textContent,m===u&&m!==""&&m!==null&&(s.value=m),Oi(s)}function Pl(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var lL=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 ME(s,a,u){var m=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?m?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":m?s.setProperty(a,u):typeof u!="number"||u===0||lL.has(a)?a==="float"?s.cssFloat=u:s[a]=(""+u).trim():s[a]=u+"px"}function kE(s,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,u!=null){for(var m in u)!u.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var w in a)m=a[w],a.hasOwnProperty(w)&&u[w]!==m&&ME(s,w,m)}else for(var C in a)a.hasOwnProperty(C)&&ME(s,C,a[C])}function hy(s){if(s.indexOf("-")===-1)return!1;switch(s){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 cL=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"]]),uL=/^[\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 Jf(s){return uL.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Zs(){}var py=null;function my(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Il=null,zl=null;function AE(s){var a=en(s);if(a&&(s=a.stateNode)){var u=s[Ge]||null;e:switch(s=a.stateNode,a.type){case"input":if(Ma(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+_r(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var m=u[a];if(m!==s&&m.form===s.form){var w=m[Ge]||null;if(!w)throw Error(r(90));Ma(m,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(a=0;a<u.length;a++)m=u[a],m.form===s.form&&Ys(m)}break e;case"textarea":_u(s,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Mi(s,!!u.multiple,a,!1)}}}var gy=!1;function DE(s,a,u){if(gy)return s(a,u);gy=!0;try{var m=s(a);return m}finally{if(gy=!1,(Il!==null||zl!==null)&&(Fh(),Il&&(a=Il,s=zl,zl=Il=null,AE(a),s)))for(a=0;a<s.length;a++)AE(s[a])}}function Ru(s,a){var u=s.stateNode;if(u===null)return null;var m=u[Ge]||null;if(m===null)return null;u=m[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":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yy=!1;if(Gs)try{var ju={};Object.defineProperty(ju,"passive",{get:function(){yy=!0}}),window.addEventListener("test",ju,ju),window.removeEventListener("test",ju,ju)}catch{yy=!1}var ki=null,vy=null,eh=null;function PE(){if(eh)return eh;var s,a=vy,u=a.length,m,w="value"in ki?ki.value:ki.textContent,C=w.length;for(s=0;s<u&&a[s]===w[s];s++);var D=u-s;for(m=1;m<=D&&a[u-m]===w[C-m];m++);return eh=w.slice(s,1<m?1-m:void 0)}function th(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function nh(){return!0}function IE(){return!1}function Qr(s){function a(u,m,w,C,D){this._reactName=u,this._targetInst=w,this.type=m,this.nativeEvent=C,this.target=D,this.currentTarget=null;for(var Z in s)s.hasOwnProperty(Z)&&(u=s[Z],this[Z]=u?u(C):C[Z]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?nh:IE,this.isPropagationStopped=IE,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=nh)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=nh)},persist:function(){},isPersistent:nh}),a}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rh=Qr(ka),Nu=g({},ka,{view:0,detail:0}),dL=Qr(Nu),xy,by,Tu,oh=g({},Nu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sy,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Tu&&(Tu&&s.type==="mousemove"?(xy=s.screenX-Tu.screenX,by=s.screenY-Tu.screenY):by=xy=0,Tu=s),xy)},movementY:function(s){return"movementY"in s?s.movementY:by}}),zE=Qr(oh),fL=g({},oh,{dataTransfer:0}),hL=Qr(fL),pL=g({},Nu,{relatedTarget:0}),wy=Qr(pL),mL=g({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),gL=Qr(mL),yL=g({},ka,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),vL=Qr(yL),xL=g({},ka,{data:0}),LE=Qr(xL),bL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wL={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"},SL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function EL(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=SL[s])?!!a[s]:!1}function Sy(){return EL}var CL=g({},Nu,{key:function(s){if(s.key){var a=bL[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=th(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?wL[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sy,charCode:function(s){return s.type==="keypress"?th(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?th(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),_L=Qr(CL),RL=g({},oh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$E=Qr(RL),jL=g({},Nu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sy}),NL=Qr(jL),TL=g({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),OL=Qr(TL),ML=g({},oh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),kL=Qr(ML),AL=g({},ka,{newState:0,oldState:0}),DL=Qr(AL),PL=[9,13,27,32],Ey=Gs&&"CompositionEvent"in window,Ou=null;Gs&&"documentMode"in document&&(Ou=document.documentMode);var IL=Gs&&"TextEvent"in window&&!Ou,FE=Gs&&(!Ey||Ou&&8<Ou&&11>=Ou),VE=" ",UE=!1;function HE(s,a){switch(s){case"keyup":return PL.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function BE(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ll=!1;function zL(s,a){switch(s){case"compositionend":return BE(a);case"keypress":return a.which!==32?null:(UE=!0,VE);case"textInput":return s=a.data,s===VE&&UE?null:s;default:return null}}function LL(s,a){if(Ll)return s==="compositionend"||!Ey&&HE(s,a)?(s=PE(),eh=vy=ki=null,Ll=!1,s):null;switch(s){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 FE&&a.locale!=="ko"?null:a.data;default:return null}}var $L={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 qE(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!$L[s.type]:a==="textarea"}function YE(s,a,u,m){Il?zl?zl.push(m):zl=[m]:Il=m,a=Zh(a,"onChange"),0<a.length&&(u=new rh("onChange","change",null,u,m),s.push({event:u,listeners:a}))}var Mu=null,ku=null;function FL(s){N_(s,0)}function sh(s){var a=Bt(s);if(Ys(a))return s}function ZE(s,a){if(s==="change")return a}var GE=!1;if(Gs){var Cy;if(Gs){var _y="oninput"in document;if(!_y){var KE=document.createElement("div");KE.setAttribute("oninput","return;"),_y=typeof KE.oninput=="function"}Cy=_y}else Cy=!1;GE=Cy&&(!document.documentMode||9<document.documentMode)}function XE(){Mu&&(Mu.detachEvent("onpropertychange",QE),ku=Mu=null)}function QE(s){if(s.propertyName==="value"&&sh(ku)){var a=[];YE(a,ku,s,my(s)),DE(FL,a)}}function VL(s,a,u){s==="focusin"?(XE(),Mu=a,ku=u,Mu.attachEvent("onpropertychange",QE)):s==="focusout"&&XE()}function UL(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return sh(ku)}function HL(s,a){if(s==="click")return sh(a)}function BL(s,a){if(s==="input"||s==="change")return sh(a)}function qL(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ho=typeof Object.is=="function"?Object.is:qL;function Au(s,a){if(ho(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),m=Object.keys(a);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var w=u[m];if(!De.call(a,w)||!ho(s[w],a[w]))return!1}return!0}function WE(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function JE(s,a){var u=WE(s);s=0;for(var m;u;){if(u.nodeType===3){if(m=s+u.textContent.length,s<=a&&m>=a)return{node:u,offset:a-s};s=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=WE(u)}}function e1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?e1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function t1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=rn(s.document);a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=rn(s.document)}return a}function Ry(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var YL=Gs&&"documentMode"in document&&11>=document.documentMode,$l=null,jy=null,Du=null,Ny=!1;function n1(s,a,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Ny||$l==null||$l!==rn(m)||(m=$l,"selectionStart"in m&&Ry(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Du&&Au(Du,m)||(Du=m,m=Zh(jy,"onSelect"),0<m.length&&(a=new rh("onSelect","select",null,a,u),s.push({event:a,listeners:m}),a.target=$l)))}function Aa(s,a){var u={};return u[s.toLowerCase()]=a.toLowerCase(),u["Webkit"+s]="webkit"+a,u["Moz"+s]="moz"+a,u}var Fl={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionrun:Aa("Transition","TransitionRun"),transitionstart:Aa("Transition","TransitionStart"),transitioncancel:Aa("Transition","TransitionCancel"),transitionend:Aa("Transition","TransitionEnd")},Ty={},r1={};Gs&&(r1=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function Da(s){if(Ty[s])return Ty[s];if(!Fl[s])return s;var a=Fl[s],u;for(u in a)if(a.hasOwnProperty(u)&&u in r1)return Ty[s]=a[u];return s}var o1=Da("animationend"),s1=Da("animationiteration"),i1=Da("animationstart"),ZL=Da("transitionrun"),GL=Da("transitionstart"),KL=Da("transitioncancel"),a1=Da("transitionend"),l1=new Map,Oy="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(" ");Oy.push("scrollEnd");function Ko(s,a){l1.set(s,a),Lr(a,[s])}var ih=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},To=[],Vl=0,My=0;function ah(){for(var s=Vl,a=My=Vl=0;a<s;){var u=To[a];To[a++]=null;var m=To[a];To[a++]=null;var w=To[a];To[a++]=null;var C=To[a];if(To[a++]=null,m!==null&&w!==null){var D=m.pending;D===null?w.next=w:(w.next=D.next,D.next=w),m.pending=w}C!==0&&c1(u,w,C)}}function lh(s,a,u,m){To[Vl++]=s,To[Vl++]=a,To[Vl++]=u,To[Vl++]=m,My|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function ky(s,a,u,m){return lh(s,a,u,m),ch(s)}function Pa(s,a){return lh(s,null,null,a),ch(s)}function c1(s,a,u){s.lanes|=u;var m=s.alternate;m!==null&&(m.lanes|=u);for(var w=!1,C=s.return;C!==null;)C.childLanes|=u,m=C.alternate,m!==null&&(m.childLanes|=u),C.tag===22&&(s=C.stateNode,s===null||s._visibility&1||(w=!0)),s=C,C=C.return;return s.tag===3?(C=s.stateNode,w&&a!==null&&(w=31-be(u),s=C.hiddenUpdates,m=s[w],m===null?s[w]=[a]:m.push(a),a.lane=u|536870912),C):null}function ch(s){if(50<nd)throw nd=0,Vv=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var Ul={};function XL(s,a,u,m){this.tag=s,this.key=u,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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function po(s,a,u,m){return new XL(s,a,u,m)}function Ay(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ks(s,a){var u=s.alternate;return u===null?(u=po(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function u1(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function uh(s,a,u,m,w,C){var D=0;if(m=s,typeof s=="function")Ay(s)&&(D=1);else if(typeof s=="string")D=t3(s,u,X.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case L:return s=po(31,u,a,w),s.elementType=L,s.lanes=C,s;case E:return Ia(u.children,w,C,a);case S:D=8,w|=24;break;case _:return s=po(12,u,a,w|2),s.elementType=_,s.lanes=C,s;case O:return s=po(13,u,a,w),s.elementType=O,s.lanes=C,s;case k:return s=po(19,u,a,w),s.elementType=k,s.lanes=C,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case R:D=10;break e;case j:D=9;break e;case N:D=11;break e;case M:D=14;break e;case T:D=16,m=null;break e}D=29,u=Error(r(130,s===null?"null":typeof s,"")),m=null}return a=po(D,u,a,w),a.elementType=s,a.type=m,a.lanes=C,a}function Ia(s,a,u,m){return s=po(7,s,m,a),s.lanes=u,s}function Dy(s,a,u){return s=po(6,s,null,a),s.lanes=u,s}function d1(s){var a=po(18,null,null,0);return a.stateNode=s,a}function Py(s,a,u){return a=po(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var f1=new WeakMap;function Oo(s,a){if(typeof s=="object"&&s!==null){var u=f1.get(s);return u!==void 0?u:(a={value:s,source:a,stack:Qe(a)},f1.set(s,a),a)}return{value:s,source:a,stack:Qe(a)}}var Hl=[],Bl=0,dh=null,Pu=0,Mo=[],ko=0,Ai=null,bs=1,ws="";function Xs(s,a){Hl[Bl++]=Pu,Hl[Bl++]=dh,dh=s,Pu=a}function h1(s,a,u){Mo[ko++]=bs,Mo[ko++]=ws,Mo[ko++]=Ai,Ai=s;var m=bs;s=ws;var w=32-be(m)-1;m&=~(1<<w),u+=1;var C=32-be(a)+w;if(30<C){var D=w-w%5;C=(m&(1<<D)-1).toString(32),m>>=D,w-=D,bs=1<<32-be(a)+w|u<<w|m,ws=C+s}else bs=1<<C|u<<w|m,ws=s}function Iy(s){s.return!==null&&(Xs(s,1),h1(s,1,0))}function zy(s){for(;s===dh;)dh=Hl[--Bl],Hl[Bl]=null,Pu=Hl[--Bl],Hl[Bl]=null;for(;s===Ai;)Ai=Mo[--ko],Mo[ko]=null,ws=Mo[--ko],Mo[ko]=null,bs=Mo[--ko],Mo[ko]=null}function p1(s,a){Mo[ko++]=bs,Mo[ko++]=ws,Mo[ko++]=Ai,bs=a.id,ws=a.overflow,Ai=s}var Rr=null,On=null,Xt=!1,Di=null,Ao=!1,Ly=Error(r(519));function Pi(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Iu(Oo(a,s)),Ly}function m1(s){var a=s.stateNode,u=s.type,m=s.memoizedProps;switch(a[Be]=s,a[Ge]=m,u){case"dialog":Ut("cancel",a),Ut("close",a);break;case"iframe":case"object":case"embed":Ut("load",a);break;case"video":case"audio":for(u=0;u<od.length;u++)Ut(od[u],a);break;case"source":Ut("error",a);break;case"img":case"image":case"link":Ut("error",a),Ut("load",a);break;case"details":Ut("toggle",a);break;case"input":Ut("invalid",a),Dl(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":Ut("invalid",a);break;case"textarea":Ut("invalid",a),OE(a,m.value,m.defaultValue,m.children)}u=m.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||m.suppressHydrationWarning===!0||k_(a.textContent,u)?(m.popover!=null&&(Ut("beforetoggle",a),Ut("toggle",a)),m.onScroll!=null&&Ut("scroll",a),m.onScrollEnd!=null&&Ut("scrollend",a),m.onClick!=null&&(a.onclick=Zs),a=!0):a=!1,a||Pi(s,!0)}function g1(s){for(Rr=s.return;Rr;)switch(Rr.tag){case 5:case 31:case 13:Ao=!1;return;case 27:case 3:Ao=!0;return;default:Rr=Rr.return}}function ql(s){if(s!==Rr)return!1;if(!Xt)return g1(s),Xt=!0,!1;var a=s.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||nx(s.type,s.memoizedProps)),u=!u),u&&On&&Pi(s),g1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));On=V_(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));On=V_(s)}else a===27?(a=On,Ki(s.type)?(s=ax,ax=null,On=s):On=a):On=Rr?Po(s.stateNode.nextSibling):null;return!0}function za(){On=Rr=null,Xt=!1}function $y(){var s=Di;return s!==null&&(to===null?to=s:to.push.apply(to,s),Di=null),s}function Iu(s){Di===null?Di=[s]:Di.push(s)}var Fy=$(null),La=null,Qs=null;function Ii(s,a,u){Q(Fy,a._currentValue),a._currentValue=u}function Ws(s){s._currentValue=Fy.current,F(Fy)}function Vy(s,a,u){for(;s!==null;){var m=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),s===u)break;s=s.return}}function Uy(s,a,u,m){var w=s.child;for(w!==null&&(w.return=s);w!==null;){var C=w.dependencies;if(C!==null){var D=w.child;C=C.firstContext;e:for(;C!==null;){var Z=C;C=w;for(var oe=0;oe<a.length;oe++)if(Z.context===a[oe]){C.lanes|=u,Z=C.alternate,Z!==null&&(Z.lanes|=u),Vy(C.return,u,s),m||(D=null);break e}C=Z.next}}else if(w.tag===18){if(D=w.return,D===null)throw Error(r(341));D.lanes|=u,C=D.alternate,C!==null&&(C.lanes|=u),Vy(D,u,s),D=null}else D=w.child;if(D!==null)D.return=w;else for(D=w;D!==null;){if(D===s){D=null;break}if(w=D.sibling,w!==null){w.return=D.return,D=w;break}D=D.return}w=D}}function Yl(s,a,u,m){s=null;for(var w=a,C=!1;w!==null;){if(!C){if((w.flags&524288)!==0)C=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var D=w.alternate;if(D===null)throw Error(r(387));if(D=D.memoizedProps,D!==null){var Z=w.type;ho(w.pendingProps.value,D.value)||(s!==null?s.push(Z):s=[Z])}}else if(w===J.current){if(D=w.alternate,D===null)throw Error(r(387));D.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(s!==null?s.push(cd):s=[cd])}w=w.return}s!==null&&Uy(a,s,u,m),a.flags|=262144}function fh(s){for(s=s.firstContext;s!==null;){if(!ho(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function $a(s){La=s,Qs=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function jr(s){return y1(La,s)}function hh(s,a){return La===null&&$a(s),y1(s,a)}function y1(s,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Qs===null){if(s===null)throw Error(r(308));Qs=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Qs=Qs.next=a;return u}var QL=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(u,m){s.push(m)}};this.abort=function(){a.aborted=!0,s.forEach(function(u){return u()})}},WL=e.unstable_scheduleCallback,JL=e.unstable_NormalPriority,sr={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hy(){return{controller:new QL,data:new Map,refCount:0}}function zu(s){s.refCount--,s.refCount===0&&WL(JL,function(){s.controller.abort()})}var Lu=null,By=0,Zl=0,Gl=null;function e4(s,a){if(Lu===null){var u=Lu=[];By=0,Zl=Zv(),Gl={status:"pending",value:void 0,then:function(m){u.push(m)}}}return By++,a.then(v1,v1),a}function v1(){if(--By===0&&Lu!==null){Gl!==null&&(Gl.status="fulfilled");var s=Lu;Lu=null,Zl=0,Gl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function t4(s,a){var u=[],m={status:"pending",value:null,reason:null,then:function(w){u.push(w)}};return s.then(function(){m.status="fulfilled",m.value=a;for(var w=0;w<u.length;w++)(0,u[w])(a)},function(w){for(m.status="rejected",m.reason=w,w=0;w<u.length;w++)(0,u[w])(void 0)}),m}var x1=A.S;A.S=function(s,a){n_=me(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&e4(s,a),x1!==null&&x1(s,a)};var Fa=$(null);function qy(){var s=Fa.current;return s!==null?s:En.pooledCache}function ph(s,a){a===null?Q(Fa,Fa.current):Q(Fa,a.pool)}function b1(){var s=qy();return s===null?null:{parent:sr._currentValue,pool:s}}var Kl=Error(r(460)),Yy=Error(r(474)),mh=Error(r(542)),gh={then:function(){}};function w1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function S1(s,a,u){switch(u=s[u],u===void 0?s.push(a):u!==a&&(a.then(Zs,Zs),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,C1(s),s;default:if(typeof a.status=="string")a.then(Zs,Zs);else{if(s=En,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(m){if(a.status==="pending"){var w=a;w.status="fulfilled",w.value=m}},function(m){if(a.status==="pending"){var w=a;w.status="rejected",w.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,C1(s),s}throw Ua=a,Kl}}function Va(s){try{var a=s._init;return a(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ua=u,Kl):u}}var Ua=null;function E1(){if(Ua===null)throw Error(r(459));var s=Ua;return Ua=null,s}function C1(s){if(s===Kl||s===mh)throw Error(r(483))}var Xl=null,$u=0;function yh(s){var a=$u;return $u+=1,Xl===null&&(Xl=[]),S1(Xl,s,a)}function Fu(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function vh(s,a){throw a.$$typeof===y?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function _1(s){function a(de,le){if(s){var pe=de.deletions;pe===null?(de.deletions=[le],de.flags|=16):pe.push(le)}}function u(de,le){if(!s)return null;for(;le!==null;)a(de,le),le=le.sibling;return null}function m(de){for(var le=new Map;de!==null;)de.key!==null?le.set(de.key,de):le.set(de.index,de),de=de.sibling;return le}function w(de,le){return de=Ks(de,le),de.index=0,de.sibling=null,de}function C(de,le,pe){return de.index=pe,s?(pe=de.alternate,pe!==null?(pe=pe.index,pe<le?(de.flags|=67108866,le):pe):(de.flags|=67108866,le)):(de.flags|=1048576,le)}function D(de){return s&&de.alternate===null&&(de.flags|=67108866),de}function Z(de,le,pe,je){return le===null||le.tag!==6?(le=Dy(pe,de.mode,je),le.return=de,le):(le=w(le,pe),le.return=de,le)}function oe(de,le,pe,je){var pt=pe.type;return pt===E?_e(de,le,pe.props.children,je,pe.key):le!==null&&(le.elementType===pt||typeof pt=="object"&&pt!==null&&pt.$$typeof===T&&Va(pt)===le.type)?(le=w(le,pe.props),Fu(le,pe),le.return=de,le):(le=uh(pe.type,pe.key,pe.props,null,de.mode,je),Fu(le,pe),le.return=de,le)}function ge(de,le,pe,je){return le===null||le.tag!==4||le.stateNode.containerInfo!==pe.containerInfo||le.stateNode.implementation!==pe.implementation?(le=Py(pe,de.mode,je),le.return=de,le):(le=w(le,pe.children||[]),le.return=de,le)}function _e(de,le,pe,je,pt){return le===null||le.tag!==7?(le=Ia(pe,de.mode,je,pt),le.return=de,le):(le=w(le,pe),le.return=de,le)}function Te(de,le,pe){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=Dy(""+le,de.mode,pe),le.return=de,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case v:return pe=uh(le.type,le.key,le.props,null,de.mode,pe),Fu(pe,le),pe.return=de,pe;case x:return le=Py(le,de.mode,pe),le.return=de,le;case T:return le=Va(le),Te(de,le,pe)}if(z(le)||V(le))return le=Ia(le,de.mode,pe,null),le.return=de,le;if(typeof le.then=="function")return Te(de,yh(le),pe);if(le.$$typeof===R)return Te(de,hh(de,le),pe);vh(de,le)}return null}function ve(de,le,pe,je){var pt=le!==null?le.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return pt!==null?null:Z(de,le,""+pe,je);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:return pe.key===pt?oe(de,le,pe,je):null;case x:return pe.key===pt?ge(de,le,pe,je):null;case T:return pe=Va(pe),ve(de,le,pe,je)}if(z(pe)||V(pe))return pt!==null?null:_e(de,le,pe,je,null);if(typeof pe.then=="function")return ve(de,le,yh(pe),je);if(pe.$$typeof===R)return ve(de,le,hh(de,pe),je);vh(de,pe)}return null}function we(de,le,pe,je,pt){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return de=de.get(pe)||null,Z(le,de,""+je,pt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case v:return de=de.get(je.key===null?pe:je.key)||null,oe(le,de,je,pt);case x:return de=de.get(je.key===null?pe:je.key)||null,ge(le,de,je,pt);case T:return je=Va(je),we(de,le,pe,je,pt)}if(z(je)||V(je))return de=de.get(pe)||null,_e(le,de,je,pt,null);if(typeof je.then=="function")return we(de,le,pe,yh(je),pt);if(je.$$typeof===R)return we(de,le,pe,hh(le,je),pt);vh(le,je)}return null}function st(de,le,pe,je){for(var pt=null,tn=null,ct=le,At=le=0,Yt=null;ct!==null&&At<pe.length;At++){ct.index>At?(Yt=ct,ct=null):Yt=ct.sibling;var nn=ve(de,ct,pe[At],je);if(nn===null){ct===null&&(ct=Yt);break}s&&ct&&nn.alternate===null&&a(de,ct),le=C(nn,le,At),tn===null?pt=nn:tn.sibling=nn,tn=nn,ct=Yt}if(At===pe.length)return u(de,ct),Xt&&Xs(de,At),pt;if(ct===null){for(;At<pe.length;At++)ct=Te(de,pe[At],je),ct!==null&&(le=C(ct,le,At),tn===null?pt=ct:tn.sibling=ct,tn=ct);return Xt&&Xs(de,At),pt}for(ct=m(ct);At<pe.length;At++)Yt=we(ct,de,At,pe[At],je),Yt!==null&&(s&&Yt.alternate!==null&&ct.delete(Yt.key===null?At:Yt.key),le=C(Yt,le,At),tn===null?pt=Yt:tn.sibling=Yt,tn=Yt);return s&&ct.forEach(function(ea){return a(de,ea)}),Xt&&Xs(de,At),pt}function xt(de,le,pe,je){if(pe==null)throw Error(r(151));for(var pt=null,tn=null,ct=le,At=le=0,Yt=null,nn=pe.next();ct!==null&&!nn.done;At++,nn=pe.next()){ct.index>At?(Yt=ct,ct=null):Yt=ct.sibling;var ea=ve(de,ct,nn.value,je);if(ea===null){ct===null&&(ct=Yt);break}s&&ct&&ea.alternate===null&&a(de,ct),le=C(ea,le,At),tn===null?pt=ea:tn.sibling=ea,tn=ea,ct=Yt}if(nn.done)return u(de,ct),Xt&&Xs(de,At),pt;if(ct===null){for(;!nn.done;At++,nn=pe.next())nn=Te(de,nn.value,je),nn!==null&&(le=C(nn,le,At),tn===null?pt=nn:tn.sibling=nn,tn=nn);return Xt&&Xs(de,At),pt}for(ct=m(ct);!nn.done;At++,nn=pe.next())nn=we(ct,de,At,nn.value,je),nn!==null&&(s&&nn.alternate!==null&&ct.delete(nn.key===null?At:nn.key),le=C(nn,le,At),tn===null?pt=nn:tn.sibling=nn,tn=nn);return s&&ct.forEach(function(f3){return a(de,f3)}),Xt&&Xs(de,At),pt}function gn(de,le,pe,je){if(typeof pe=="object"&&pe!==null&&pe.type===E&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var pt=pe.key;le!==null;){if(le.key===pt){if(pt=pe.type,pt===E){if(le.tag===7){u(de,le.sibling),je=w(le,pe.props.children),je.return=de,de=je;break e}}else if(le.elementType===pt||typeof pt=="object"&&pt!==null&&pt.$$typeof===T&&Va(pt)===le.type){u(de,le.sibling),je=w(le,pe.props),Fu(je,pe),je.return=de,de=je;break e}u(de,le);break}else a(de,le);le=le.sibling}pe.type===E?(je=Ia(pe.props.children,de.mode,je,pe.key),je.return=de,de=je):(je=uh(pe.type,pe.key,pe.props,null,de.mode,je),Fu(je,pe),je.return=de,de=je)}return D(de);case x:e:{for(pt=pe.key;le!==null;){if(le.key===pt)if(le.tag===4&&le.stateNode.containerInfo===pe.containerInfo&&le.stateNode.implementation===pe.implementation){u(de,le.sibling),je=w(le,pe.children||[]),je.return=de,de=je;break e}else{u(de,le);break}else a(de,le);le=le.sibling}je=Py(pe,de.mode,je),je.return=de,de=je}return D(de);case T:return pe=Va(pe),gn(de,le,pe,je)}if(z(pe))return st(de,le,pe,je);if(V(pe)){if(pt=V(pe),typeof pt!="function")throw Error(r(150));return pe=pt.call(pe),xt(de,le,pe,je)}if(typeof pe.then=="function")return gn(de,le,yh(pe),je);if(pe.$$typeof===R)return gn(de,le,hh(de,pe),je);vh(de,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,le!==null&&le.tag===6?(u(de,le.sibling),je=w(le,pe),je.return=de,de=je):(u(de,le),je=Dy(pe,de.mode,je),je.return=de,de=je),D(de)):u(de,le)}return function(de,le,pe,je){try{$u=0;var pt=gn(de,le,pe,je);return Xl=null,pt}catch(ct){if(ct===Kl||ct===mh)throw ct;var tn=po(29,ct,null,de.mode);return tn.lanes=je,tn.return=de,tn}}}var Ha=_1(!0),R1=_1(!1),zi=!1;function Zy(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gy(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Li(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function $i(s,a,u){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(on&2)!==0){var w=m.pending;return w===null?a.next=a:(a.next=w.next,w.next=a),m.pending=a,a=ch(s),c1(s,null,u),a}return lh(s,m,a,u),ch(s)}function Vu(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,wn(s,u)}}function Ky(s,a){var u=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var w=null,C=null;if(u=u.firstBaseUpdate,u!==null){do{var D={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};C===null?w=C=D:C=C.next=D,u=u.next}while(u!==null);C===null?w=C=a:C=C.next=a}else w=C=a;u={baseState:m.baseState,firstBaseUpdate:w,lastBaseUpdate:C,shared:m.shared,callbacks:m.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}var Xy=!1;function Uu(){if(Xy){var s=Gl;if(s!==null)throw s}}function Hu(s,a,u,m){Xy=!1;var w=s.updateQueue;zi=!1;var C=w.firstBaseUpdate,D=w.lastBaseUpdate,Z=w.shared.pending;if(Z!==null){w.shared.pending=null;var oe=Z,ge=oe.next;oe.next=null,D===null?C=ge:D.next=ge,D=oe;var _e=s.alternate;_e!==null&&(_e=_e.updateQueue,Z=_e.lastBaseUpdate,Z!==D&&(Z===null?_e.firstBaseUpdate=ge:Z.next=ge,_e.lastBaseUpdate=oe))}if(C!==null){var Te=w.baseState;D=0,_e=ge=oe=null,Z=C;do{var ve=Z.lane&-536870913,we=ve!==Z.lane;if(we?(qt&ve)===ve:(m&ve)===ve){ve!==0&&ve===Zl&&(Xy=!0),_e!==null&&(_e=_e.next={lane:0,tag:Z.tag,payload:Z.payload,callback:null,next:null});e:{var st=s,xt=Z;ve=a;var gn=u;switch(xt.tag){case 1:if(st=xt.payload,typeof st=="function"){Te=st.call(gn,Te,ve);break e}Te=st;break e;case 3:st.flags=st.flags&-65537|128;case 0:if(st=xt.payload,ve=typeof st=="function"?st.call(gn,Te,ve):st,ve==null)break e;Te=g({},Te,ve);break e;case 2:zi=!0}}ve=Z.callback,ve!==null&&(s.flags|=64,we&&(s.flags|=8192),we=w.callbacks,we===null?w.callbacks=[ve]:we.push(ve))}else we={lane:ve,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},_e===null?(ge=_e=we,oe=Te):_e=_e.next=we,D|=ve;if(Z=Z.next,Z===null){if(Z=w.shared.pending,Z===null)break;we=Z,Z=we.next,we.next=null,w.lastBaseUpdate=we,w.shared.pending=null}}while(!0);_e===null&&(oe=Te),w.baseState=oe,w.firstBaseUpdate=ge,w.lastBaseUpdate=_e,C===null&&(w.shared.lanes=0),Bi|=D,s.lanes=D,s.memoizedState=Te}}function j1(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function N1(s,a){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)j1(u[s],a)}var Ql=$(null),xh=$(0);function T1(s,a){s=ai,Q(xh,s),Q(Ql,a),ai=s|a.baseLanes}function Qy(){Q(xh,ai),Q(Ql,Ql.current)}function Wy(){ai=xh.current,F(Ql),F(xh)}var mo=$(null),Do=null;function Fi(s){var a=s.alternate;Q(Qn,Qn.current&1),Q(mo,s),Do===null&&(a===null||Ql.current!==null||a.memoizedState!==null)&&(Do=s)}function Jy(s){Q(Qn,Qn.current),Q(mo,s),Do===null&&(Do=s)}function O1(s){s.tag===22?(Q(Qn,Qn.current),Q(mo,s),Do===null&&(Do=s)):Vi()}function Vi(){Q(Qn,Qn.current),Q(mo,mo.current)}function go(s){F(mo),Do===s&&(Do=null),F(Qn)}var Qn=$(0);function bh(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||sx(u)||ix(u)))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===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Js=0,Tt=null,pn=null,ir=null,wh=!1,Wl=!1,Ba=!1,Sh=0,Bu=0,Jl=null,n4=0;function Zn(){throw Error(r(321))}function ev(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!ho(s[u],a[u]))return!1;return!0}function tv(s,a,u,m,w,C){return Js=C,Tt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=s===null||s.memoizedState===null?hC:gv,Ba=!1,C=u(m,w),Ba=!1,Wl&&(C=k1(a,u,m,w)),M1(s),C}function M1(s){A.H=Zu;var a=pn!==null&&pn.next!==null;if(Js=0,ir=pn=Tt=null,wh=!1,Bu=0,Jl=null,a)throw Error(r(300));s===null||ar||(s=s.dependencies,s!==null&&fh(s)&&(ar=!0))}function k1(s,a,u,m){Tt=s;var w=0;do{if(Wl&&(Jl=null),Bu=0,Wl=!1,25<=w)throw Error(r(301));if(w+=1,ir=pn=null,s.updateQueue!=null){var C=s.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}A.H=pC,C=a(u,m)}while(Wl);return C}function r4(){var s=A.H,a=s.useState()[0];return a=typeof a.then=="function"?qu(a):a,s=s.useState()[0],(pn!==null?pn.memoizedState:null)!==s&&(Tt.flags|=1024),a}function nv(){var s=Sh!==0;return Sh=0,s}function rv(s,a,u){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~u}function ov(s){if(wh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}wh=!1}Js=0,ir=pn=Tt=null,Wl=!1,Bu=Sh=0,Jl=null}function Hr(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ir===null?Tt.memoizedState=ir=s:ir=ir.next=s,ir}function Wn(){if(pn===null){var s=Tt.alternate;s=s!==null?s.memoizedState:null}else s=pn.next;var a=ir===null?Tt.memoizedState:ir.next;if(a!==null)ir=a,pn=s;else{if(s===null)throw Tt.alternate===null?Error(r(467)):Error(r(310));pn=s,s={memoizedState:pn.memoizedState,baseState:pn.baseState,baseQueue:pn.baseQueue,queue:pn.queue,next:null},ir===null?Tt.memoizedState=ir=s:ir=ir.next=s}return ir}function Eh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qu(s){var a=Bu;return Bu+=1,Jl===null&&(Jl=[]),s=S1(Jl,s,a),a=Tt,(ir===null?a.memoizedState:ir.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?hC:gv),s}function Ch(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return qu(s);if(s.$$typeof===R)return jr(s)}throw Error(r(438,String(s)))}function sv(s){var a=null,u=Tt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var m=Tt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(w){return w.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Eh(),Tt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(s),m=0;m<s;m++)u[m]=G;return a.index++,u}function ei(s,a){return typeof a=="function"?a(s):a}function _h(s){var a=Wn();return iv(a,pn,s)}function iv(s,a,u){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=u;var w=s.baseQueue,C=m.pending;if(C!==null){if(w!==null){var D=w.next;w.next=C.next,C.next=D}a.baseQueue=w=C,m.pending=null}if(C=s.baseState,w===null)s.memoizedState=C;else{a=w.next;var Z=D=null,oe=null,ge=a,_e=!1;do{var Te=ge.lane&-536870913;if(Te!==ge.lane?(qt&Te)===Te:(Js&Te)===Te){var ve=ge.revertLane;if(ve===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),Te===Zl&&(_e=!0);else if((Js&ve)===ve){ge=ge.next,ve===Zl&&(_e=!0);continue}else Te={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Z=oe=Te,D=C):oe=oe.next=Te,Tt.lanes|=ve,Bi|=ve;Te=ge.action,Ba&&u(C,Te),C=ge.hasEagerState?ge.eagerState:u(C,Te)}else ve={lane:Te,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Z=oe=ve,D=C):oe=oe.next=ve,Tt.lanes|=Te,Bi|=Te;ge=ge.next}while(ge!==null&&ge!==a);if(oe===null?D=C:oe.next=Z,!ho(C,s.memoizedState)&&(ar=!0,_e&&(u=Gl,u!==null)))throw u;s.memoizedState=C,s.baseState=D,s.baseQueue=oe,m.lastRenderedState=C}return w===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function av(s){var a=Wn(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=s;var m=u.dispatch,w=u.pending,C=a.memoizedState;if(w!==null){u.pending=null;var D=w=w.next;do C=s(C,D.action),D=D.next;while(D!==w);ho(C,a.memoizedState)||(ar=!0),a.memoizedState=C,a.baseQueue===null&&(a.baseState=C),u.lastRenderedState=C}return[C,m]}function A1(s,a,u){var m=Tt,w=Wn(),C=Xt;if(C){if(u===void 0)throw Error(r(407));u=u()}else u=a();var D=!ho((pn||w).memoizedState,u);if(D&&(w.memoizedState=u,ar=!0),w=w.queue,uv(I1.bind(null,m,w,s),[s]),w.getSnapshot!==a||D||ir!==null&&ir.memoizedState.tag&1){if(m.flags|=2048,ec(9,{destroy:void 0},P1.bind(null,m,w,u,a),null),En===null)throw Error(r(349));C||(Js&127)!==0||D1(m,a,u)}return u}function D1(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=Tt.updateQueue,a===null?(a=Eh(),Tt.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function P1(s,a,u,m){a.value=u,a.getSnapshot=m,z1(a)&&L1(s)}function I1(s,a,u){return u(function(){z1(a)&&L1(s)})}function z1(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!ho(s,u)}catch{return!0}}function L1(s){var a=Pa(s,2);a!==null&&no(a,s,2)}function lv(s){var a=Hr();if(typeof s=="function"){var u=s;if(s=u(),Ba){Se(!0);try{u()}finally{Se(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:s},a}function $1(s,a,u,m){return s.baseState=u,iv(s,pn,typeof m=="function"?m:ei)}function o4(s,a,u,m,w){if(Nh(s))throw Error(r(485));if(s=a.action,s!==null){var C={payload:w,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){C.listeners.push(D)}};A.T!==null?u(!0):C.isTransition=!1,m(C),u=a.pending,u===null?(C.next=a.pending=C,F1(a,C)):(C.next=u.next,a.pending=u.next=C)}}function F1(s,a){var u=a.action,m=a.payload,w=s.state;if(a.isTransition){var C=A.T,D={};A.T=D;try{var Z=u(w,m),oe=A.S;oe!==null&&oe(D,Z),V1(s,a,Z)}catch(ge){cv(s,a,ge)}finally{C!==null&&D.types!==null&&(C.types=D.types),A.T=C}}else try{C=u(w,m),V1(s,a,C)}catch(ge){cv(s,a,ge)}}function V1(s,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){U1(s,a,m)},function(m){return cv(s,a,m)}):U1(s,a,u)}function U1(s,a,u){a.status="fulfilled",a.value=u,H1(a),s.state=u,a=s.pending,a!==null&&(u=a.next,u===a?s.pending=null:(u=u.next,a.next=u,F1(s,u)))}function cv(s,a,u){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=u,H1(a),a=a.next;while(a!==m)}s.action=null}function H1(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function B1(s,a){return a}function q1(s,a){if(Xt){var u=En.formState;if(u!==null){e:{var m=Tt;if(Xt){if(On){t:{for(var w=On,C=Ao;w.nodeType!==8;){if(!C){w=null;break t}if(w=Po(w.nextSibling),w===null){w=null;break t}}C=w.data,w=C==="F!"||C==="F"?w:null}if(w){On=Po(w.nextSibling),m=w.data==="F!";break e}}Pi(m)}m=!1}m&&(a=u[0])}}return u=Hr(),u.memoizedState=u.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B1,lastRenderedState:a},u.queue=m,u=uC.bind(null,Tt,m),m.dispatch=u,m=lv(!1),C=mv.bind(null,Tt,!1,m.queue),m=Hr(),w={state:a,dispatch:null,action:s,pending:null},m.queue=w,u=o4.bind(null,Tt,w,C,u),w.dispatch=u,m.memoizedState=s,[a,u,!1]}function Y1(s){var a=Wn();return Z1(a,pn,s)}function Z1(s,a,u){if(a=iv(s,a,B1)[0],s=_h(ei)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=qu(a)}catch(D){throw D===Kl?mh:D}else m=a;a=Wn();var w=a.queue,C=w.dispatch;return u!==a.memoizedState&&(Tt.flags|=2048,ec(9,{destroy:void 0},s4.bind(null,w,u),null)),[m,C,s]}function s4(s,a){s.action=a}function G1(s){var a=Wn(),u=pn;if(u!==null)return Z1(a,u,s);Wn(),a=a.memoizedState,u=Wn();var m=u.queue.dispatch;return u.memoizedState=s,[a,m,!1]}function ec(s,a,u,m){return s={tag:s,create:u,deps:m,inst:a,next:null},a=Tt.updateQueue,a===null&&(a=Eh(),Tt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=s.next=s:(m=u.next,u.next=s,s.next=m,a.lastEffect=s),s}function K1(){return Wn().memoizedState}function Rh(s,a,u,m){var w=Hr();Tt.flags|=s,w.memoizedState=ec(1|a,{destroy:void 0},u,m===void 0?null:m)}function jh(s,a,u,m){var w=Wn();m=m===void 0?null:m;var C=w.memoizedState.inst;pn!==null&&m!==null&&ev(m,pn.memoizedState.deps)?w.memoizedState=ec(a,C,u,m):(Tt.flags|=s,w.memoizedState=ec(1|a,C,u,m))}function X1(s,a){Rh(8390656,8,s,a)}function uv(s,a){jh(2048,8,s,a)}function i4(s){Tt.flags|=4;var a=Tt.updateQueue;if(a===null)a=Eh(),Tt.updateQueue=a,a.events=[s];else{var u=a.events;u===null?a.events=[s]:u.push(s)}}function Q1(s){var a=Wn().memoizedState;return i4({ref:a,nextImpl:s}),function(){if((on&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function W1(s,a){return jh(4,2,s,a)}function J1(s,a){return jh(4,4,s,a)}function eC(s,a){if(typeof a=="function"){s=s();var u=a(s);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function tC(s,a,u){u=u!=null?u.concat([s]):null,jh(4,4,eC.bind(null,a,s),u)}function dv(){}function nC(s,a){var u=Wn();a=a===void 0?null:a;var m=u.memoizedState;return a!==null&&ev(a,m[1])?m[0]:(u.memoizedState=[s,a],s)}function rC(s,a){var u=Wn();a=a===void 0?null:a;var m=u.memoizedState;if(a!==null&&ev(a,m[1]))return m[0];if(m=s(),Ba){Se(!0);try{s()}finally{Se(!1)}}return u.memoizedState=[m,a],m}function fv(s,a,u){return u===void 0||(Js&1073741824)!==0&&(qt&261930)===0?s.memoizedState=a:(s.memoizedState=u,s=o_(),Tt.lanes|=s,Bi|=s,u)}function oC(s,a,u,m){return ho(u,a)?u:Ql.current!==null?(s=fv(s,u,m),ho(s,a)||(ar=!0),s):(Js&42)===0||(Js&1073741824)!==0&&(qt&261930)===0?(ar=!0,s.memoizedState=u):(s=o_(),Tt.lanes|=s,Bi|=s,a)}function sC(s,a,u,m,w){var C=P.p;P.p=C!==0&&8>C?C:8;var D=A.T,Z={};A.T=Z,mv(s,!1,a,u);try{var oe=w(),ge=A.S;if(ge!==null&&ge(Z,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var _e=t4(oe,m);Yu(s,a,_e,xo(s))}else Yu(s,a,m,xo(s))}catch(Te){Yu(s,a,{then:function(){},status:"rejected",reason:Te},xo())}finally{P.p=C,D!==null&&Z.types!==null&&(D.types=Z.types),A.T=D}}function a4(){}function hv(s,a,u,m){if(s.tag!==5)throw Error(r(476));var w=iC(s).queue;sC(s,w,a,U,u===null?a4:function(){return aC(s),u(m)})}function iC(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:U},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function aC(s){var a=iC(s);a.next===null&&(a=s.alternate.memoizedState),Yu(s,a.next.queue,{},xo())}function pv(){return jr(cd)}function lC(){return Wn().memoizedState}function cC(){return Wn().memoizedState}function l4(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=xo();s=Li(u);var m=$i(a,s,u);m!==null&&(no(m,a,u),Vu(m,a,u)),a={cache:Hy()},s.payload=a;return}a=a.return}}function c4(s,a,u){var m=xo();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Nh(s)?dC(a,u):(u=ky(s,a,u,m),u!==null&&(no(u,s,m),fC(u,a,m)))}function uC(s,a,u){var m=xo();Yu(s,a,u,m)}function Yu(s,a,u,m){var w={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Nh(s))dC(a,w);else{var C=s.alternate;if(s.lanes===0&&(C===null||C.lanes===0)&&(C=a.lastRenderedReducer,C!==null))try{var D=a.lastRenderedState,Z=C(D,u);if(w.hasEagerState=!0,w.eagerState=Z,ho(Z,D))return lh(s,a,w,0),En===null&&ah(),!1}catch{}if(u=ky(s,a,w,m),u!==null)return no(u,s,m),fC(u,a,m),!0}return!1}function mv(s,a,u,m){if(m={lane:2,revertLane:Zv(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Nh(s)){if(a)throw Error(r(479))}else a=ky(s,u,m,2),a!==null&&no(a,s,2)}function Nh(s){var a=s.alternate;return s===Tt||a!==null&&a===Tt}function dC(s,a){Wl=wh=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function fC(s,a,u){if((u&4194048)!==0){var m=a.lanes;m&=s.pendingLanes,u|=m,a.lanes=u,wn(s,u)}}var Zu={readContext:jr,use:Ch,useCallback:Zn,useContext:Zn,useEffect:Zn,useImperativeHandle:Zn,useLayoutEffect:Zn,useInsertionEffect:Zn,useMemo:Zn,useReducer:Zn,useRef:Zn,useState:Zn,useDebugValue:Zn,useDeferredValue:Zn,useTransition:Zn,useSyncExternalStore:Zn,useId:Zn,useHostTransitionStatus:Zn,useFormState:Zn,useActionState:Zn,useOptimistic:Zn,useMemoCache:Zn,useCacheRefresh:Zn};Zu.useEffectEvent=Zn;var hC={readContext:jr,use:Ch,useCallback:function(s,a){return Hr().memoizedState=[s,a===void 0?null:a],s},useContext:jr,useEffect:X1,useImperativeHandle:function(s,a,u){u=u!=null?u.concat([s]):null,Rh(4194308,4,eC.bind(null,a,s),u)},useLayoutEffect:function(s,a){return Rh(4194308,4,s,a)},useInsertionEffect:function(s,a){Rh(4,2,s,a)},useMemo:function(s,a){var u=Hr();a=a===void 0?null:a;var m=s();if(Ba){Se(!0);try{s()}finally{Se(!1)}}return u.memoizedState=[m,a],m},useReducer:function(s,a,u){var m=Hr();if(u!==void 0){var w=u(a);if(Ba){Se(!0);try{u(a)}finally{Se(!1)}}}else w=a;return m.memoizedState=m.baseState=w,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:w},m.queue=s,s=s.dispatch=c4.bind(null,Tt,s),[m.memoizedState,s]},useRef:function(s){var a=Hr();return s={current:s},a.memoizedState=s},useState:function(s){s=lv(s);var a=s.queue,u=uC.bind(null,Tt,a);return a.dispatch=u,[s.memoizedState,u]},useDebugValue:dv,useDeferredValue:function(s,a){var u=Hr();return fv(u,s,a)},useTransition:function(){var s=lv(!1);return s=sC.bind(null,Tt,s.queue,!0,!1),Hr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,u){var m=Tt,w=Hr();if(Xt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),En===null)throw Error(r(349));(qt&127)!==0||D1(m,a,u)}w.memoizedState=u;var C={value:u,getSnapshot:a};return w.queue=C,X1(I1.bind(null,m,C,s),[s]),m.flags|=2048,ec(9,{destroy:void 0},P1.bind(null,m,C,u,a),null),u},useId:function(){var s=Hr(),a=En.identifierPrefix;if(Xt){var u=ws,m=bs;u=(m&~(1<<32-be(m)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Sh++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=n4++,a="_"+a+"r_"+u.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:pv,useFormState:q1,useActionState:q1,useOptimistic:function(s){var a=Hr();a.memoizedState=a.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=mv.bind(null,Tt,!0,u),u.dispatch=a,[s,a]},useMemoCache:sv,useCacheRefresh:function(){return Hr().memoizedState=l4.bind(null,Tt)},useEffectEvent:function(s){var a=Hr(),u={impl:s};return a.memoizedState=u,function(){if((on&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},gv={readContext:jr,use:Ch,useCallback:nC,useContext:jr,useEffect:uv,useImperativeHandle:tC,useInsertionEffect:W1,useLayoutEffect:J1,useMemo:rC,useReducer:_h,useRef:K1,useState:function(){return _h(ei)},useDebugValue:dv,useDeferredValue:function(s,a){var u=Wn();return oC(u,pn.memoizedState,s,a)},useTransition:function(){var s=_h(ei)[0],a=Wn().memoizedState;return[typeof s=="boolean"?s:qu(s),a]},useSyncExternalStore:A1,useId:lC,useHostTransitionStatus:pv,useFormState:Y1,useActionState:Y1,useOptimistic:function(s,a){var u=Wn();return $1(u,pn,s,a)},useMemoCache:sv,useCacheRefresh:cC};gv.useEffectEvent=Q1;var pC={readContext:jr,use:Ch,useCallback:nC,useContext:jr,useEffect:uv,useImperativeHandle:tC,useInsertionEffect:W1,useLayoutEffect:J1,useMemo:rC,useReducer:av,useRef:K1,useState:function(){return av(ei)},useDebugValue:dv,useDeferredValue:function(s,a){var u=Wn();return pn===null?fv(u,s,a):oC(u,pn.memoizedState,s,a)},useTransition:function(){var s=av(ei)[0],a=Wn().memoizedState;return[typeof s=="boolean"?s:qu(s),a]},useSyncExternalStore:A1,useId:lC,useHostTransitionStatus:pv,useFormState:G1,useActionState:G1,useOptimistic:function(s,a){var u=Wn();return pn!==null?$1(u,pn,s,a):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:sv,useCacheRefresh:cC};pC.useEffectEvent=Q1;function yv(s,a,u,m){a=s.memoizedState,u=u(m,a),u=u==null?a:g({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var vv={enqueueSetState:function(s,a,u){s=s._reactInternals;var m=xo(),w=Li(m);w.payload=a,u!=null&&(w.callback=u),a=$i(s,w,m),a!==null&&(no(a,s,m),Vu(a,s,m))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var m=xo(),w=Li(m);w.tag=1,w.payload=a,u!=null&&(w.callback=u),a=$i(s,w,m),a!==null&&(no(a,s,m),Vu(a,s,m))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=xo(),m=Li(u);m.tag=2,a!=null&&(m.callback=a),a=$i(s,m,u),a!==null&&(no(a,s,u),Vu(a,s,u))}};function mC(s,a,u,m,w,C,D){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,C,D):a.prototype&&a.prototype.isPureReactComponent?!Au(u,m)||!Au(w,C):!0}function gC(s,a,u,m){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,m),a.state!==s&&vv.enqueueReplaceState(a,a.state,null)}function qa(s,a){var u=a;if("ref"in a){u={};for(var m in a)m!=="ref"&&(u[m]=a[m])}if(s=s.defaultProps){u===a&&(u=g({},u));for(var w in s)u[w]===void 0&&(u[w]=s[w])}return u}function yC(s){ih(s)}function vC(s){console.error(s)}function xC(s){ih(s)}function Th(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function bC(s,a,u){try{var m=s.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function xv(s,a,u){return u=Li(u),u.tag=3,u.payload={element:null},u.callback=function(){Th(s,a)},u}function wC(s){return s=Li(s),s.tag=3,s}function SC(s,a,u,m){var w=u.type.getDerivedStateFromError;if(typeof w=="function"){var C=m.value;s.payload=function(){return w(C)},s.callback=function(){bC(a,u,m)}}var D=u.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(s.callback=function(){bC(a,u,m),typeof w!="function"&&(qi===null?qi=new Set([this]):qi.add(this));var Z=m.stack;this.componentDidCatch(m.value,{componentStack:Z!==null?Z:""})})}function u4(s,a,u,m,w){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=u.alternate,a!==null&&Yl(a,u,w,!0),u=mo.current,u!==null){switch(u.tag){case 31:case 13:return Do===null?Vh():u.alternate===null&&Gn===0&&(Gn=3),u.flags&=-257,u.flags|=65536,u.lanes=w,m===gh?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([m]):a.add(m),Bv(s,m,w)),!1;case 22:return u.flags|=65536,m===gh?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([m]):u.add(m)),Bv(s,m,w)),!1}throw Error(r(435,u.tag))}return Bv(s,m,w),Vh(),!1}if(Xt)return a=mo.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=w,m!==Ly&&(s=Error(r(422),{cause:m}),Iu(Oo(s,u)))):(m!==Ly&&(a=Error(r(423),{cause:m}),Iu(Oo(a,u))),s=s.current.alternate,s.flags|=65536,w&=-w,s.lanes|=w,m=Oo(m,u),w=xv(s.stateNode,m,w),Ky(s,w),Gn!==4&&(Gn=2)),!1;var C=Error(r(520),{cause:m});if(C=Oo(C,u),td===null?td=[C]:td.push(C),Gn!==4&&(Gn=2),a===null)return!0;m=Oo(m,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=w&-w,u.lanes|=s,s=xv(u.stateNode,m,s),Ky(u,s),!1;case 1:if(a=u.type,C=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(qi===null||!qi.has(C))))return u.flags|=65536,w&=-w,u.lanes|=w,w=wC(w),SC(w,s,u,m),Ky(u,w),!1}u=u.return}while(u!==null);return!1}var bv=Error(r(461)),ar=!1;function Nr(s,a,u,m){a.child=s===null?R1(a,null,u,m):Ha(a,s.child,u,m)}function EC(s,a,u,m,w){u=u.render;var C=a.ref;if("ref"in m){var D={};for(var Z in m)Z!=="ref"&&(D[Z]=m[Z])}else D=m;return $a(a),m=tv(s,a,u,D,C,w),Z=nv(),s!==null&&!ar?(rv(s,a,w),ti(s,a,w)):(Xt&&Z&&Iy(a),a.flags|=1,Nr(s,a,m,w),a.child)}function CC(s,a,u,m,w){if(s===null){var C=u.type;return typeof C=="function"&&!Ay(C)&&C.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=C,_C(s,a,C,m,w)):(s=uh(u.type,null,m,a,a.mode,w),s.ref=a.ref,s.return=a,a.child=s)}if(C=s.child,!Nv(s,w)){var D=C.memoizedProps;if(u=u.compare,u=u!==null?u:Au,u(D,m)&&s.ref===a.ref)return ti(s,a,w)}return a.flags|=1,s=Ks(C,m),s.ref=a.ref,s.return=a,a.child=s}function _C(s,a,u,m,w){if(s!==null){var C=s.memoizedProps;if(Au(C,m)&&s.ref===a.ref)if(ar=!1,a.pendingProps=m=C,Nv(s,w))(s.flags&131072)!==0&&(ar=!0);else return a.lanes=s.lanes,ti(s,a,w)}return wv(s,a,u,m,w)}function RC(s,a,u,m){var w=m.children,C=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(C=C!==null?C.baseLanes|u:u,s!==null){for(m=a.child=s.child,w=0;m!==null;)w=w|m.lanes|m.childLanes,m=m.sibling;m=w&~C}else m=0,a.child=null;return jC(s,a,C,u,m)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&ph(a,C!==null?C.cachePool:null),C!==null?T1(a,C):Qy(),O1(a);else return m=a.lanes=536870912,jC(s,a,C!==null?C.baseLanes|u:u,u,m)}else C!==null?(ph(a,C.cachePool),T1(a,C),Vi(),a.memoizedState=null):(s!==null&&ph(a,null),Qy(),Vi());return Nr(s,a,w,u),a.child}function Gu(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function jC(s,a,u,m,w){var C=qy();return C=C===null?null:{parent:sr._currentValue,pool:C},a.memoizedState={baseLanes:u,cachePool:C},s!==null&&ph(a,null),Qy(),O1(a),s!==null&&Yl(s,a,m,!0),a.childLanes=w,null}function Oh(s,a){return a=kh({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function NC(s,a,u){return Ha(a,s.child,null,u),s=Oh(a,a.pendingProps),s.flags|=2,go(a),a.memoizedState=null,s}function d4(s,a,u){var m=a.pendingProps,w=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Xt){if(m.mode==="hidden")return s=Oh(a,m),a.lanes=536870912,Gu(null,s);if(Jy(a),(s=On)?(s=F_(s,Ao),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Ai!==null?{id:bs,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},u=d1(s),u.return=a,a.child=u,Rr=a,On=null)):s=null,s===null)throw Pi(a);return a.lanes=536870912,null}return Oh(a,m)}var C=s.memoizedState;if(C!==null){var D=C.dehydrated;if(Jy(a),w)if(a.flags&256)a.flags&=-257,a=NC(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(ar||Yl(s,a,u,!1),w=(u&s.childLanes)!==0,ar||w){if(m=En,m!==null&&(D=ee(m,u),D!==0&&D!==C.retryLane))throw C.retryLane=D,Pa(s,D),no(m,s,D),bv;Vh(),a=NC(s,a,u)}else s=C.treeContext,On=Po(D.nextSibling),Rr=a,Xt=!0,Di=null,Ao=!1,s!==null&&p1(a,s),a=Oh(a,m),a.flags|=4096;return a}return s=Ks(s.child,{mode:m.mode,children:m.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Mh(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function wv(s,a,u,m,w){return $a(a),u=tv(s,a,u,m,void 0,w),m=nv(),s!==null&&!ar?(rv(s,a,w),ti(s,a,w)):(Xt&&m&&Iy(a),a.flags|=1,Nr(s,a,u,w),a.child)}function TC(s,a,u,m,w,C){return $a(a),a.updateQueue=null,u=k1(a,m,u,w),M1(s),m=nv(),s!==null&&!ar?(rv(s,a,C),ti(s,a,C)):(Xt&&m&&Iy(a),a.flags|=1,Nr(s,a,u,C),a.child)}function OC(s,a,u,m,w){if($a(a),a.stateNode===null){var C=Ul,D=u.contextType;typeof D=="object"&&D!==null&&(C=jr(D)),C=new u(m,C),a.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=vv,a.stateNode=C,C._reactInternals=a,C=a.stateNode,C.props=m,C.state=a.memoizedState,C.refs={},Zy(a),D=u.contextType,C.context=typeof D=="object"&&D!==null?jr(D):Ul,C.state=a.memoizedState,D=u.getDerivedStateFromProps,typeof D=="function"&&(yv(a,u,D,m),C.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(D=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),D!==C.state&&vv.enqueueReplaceState(C,C.state,null),Hu(a,m,C,w),Uu(),C.state=a.memoizedState),typeof C.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(s===null){C=a.stateNode;var Z=a.memoizedProps,oe=qa(u,Z);C.props=oe;var ge=C.context,_e=u.contextType;D=Ul,typeof _e=="object"&&_e!==null&&(D=jr(_e));var Te=u.getDerivedStateFromProps;_e=typeof Te=="function"||typeof C.getSnapshotBeforeUpdate=="function",Z=a.pendingProps!==Z,_e||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(Z||ge!==D)&&gC(a,C,m,D),zi=!1;var ve=a.memoizedState;C.state=ve,Hu(a,m,C,w),Uu(),ge=a.memoizedState,Z||ve!==ge||zi?(typeof Te=="function"&&(yv(a,u,Te,m),ge=a.memoizedState),(oe=zi||mC(a,u,oe,m,ve,ge,D))?(_e||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(a.flags|=4194308)):(typeof C.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=ge),C.props=m,C.state=ge,C.context=D,m=oe):(typeof C.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{C=a.stateNode,Gy(s,a),D=a.memoizedProps,_e=qa(u,D),C.props=_e,Te=a.pendingProps,ve=C.context,ge=u.contextType,oe=Ul,typeof ge=="object"&&ge!==null&&(oe=jr(ge)),Z=u.getDerivedStateFromProps,(ge=typeof Z=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(D!==Te||ve!==oe)&&gC(a,C,m,oe),zi=!1,ve=a.memoizedState,C.state=ve,Hu(a,m,C,w),Uu();var we=a.memoizedState;D!==Te||ve!==we||zi||s!==null&&s.dependencies!==null&&fh(s.dependencies)?(typeof Z=="function"&&(yv(a,u,Z,m),we=a.memoizedState),(_e=zi||mC(a,u,_e,m,ve,we,oe)||s!==null&&s.dependencies!==null&&fh(s.dependencies))?(ge||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(m,we,oe),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(m,we,oe)),typeof C.componentDidUpdate=="function"&&(a.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof C.componentDidUpdate!="function"||D===s.memoizedProps&&ve===s.memoizedState||(a.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===s.memoizedProps&&ve===s.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=we),C.props=m,C.state=we,C.context=oe,m=_e):(typeof C.componentDidUpdate!="function"||D===s.memoizedProps&&ve===s.memoizedState||(a.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===s.memoizedProps&&ve===s.memoizedState||(a.flags|=1024),m=!1)}return C=m,Mh(s,a),m=(a.flags&128)!==0,C||m?(C=a.stateNode,u=m&&typeof u.getDerivedStateFromError!="function"?null:C.render(),a.flags|=1,s!==null&&m?(a.child=Ha(a,s.child,null,w),a.child=Ha(a,null,u,w)):Nr(s,a,u,w),a.memoizedState=C.state,s=a.child):s=ti(s,a,w),s}function MC(s,a,u,m){return za(),a.flags|=256,Nr(s,a,u,m),a.child}var Sv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ev(s){return{baseLanes:s,cachePool:b1()}}function Cv(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=vo),s}function kC(s,a,u){var m=a.pendingProps,w=!1,C=(a.flags&128)!==0,D;if((D=C)||(D=s!==null&&s.memoizedState===null?!1:(Qn.current&2)!==0),D&&(w=!0,a.flags&=-129),D=(a.flags&32)!==0,a.flags&=-33,s===null){if(Xt){if(w?Fi(a):Vi(),(s=On)?(s=F_(s,Ao),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Ai!==null?{id:bs,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},u=d1(s),u.return=a,a.child=u,Rr=a,On=null)):s=null,s===null)throw Pi(a);return ix(s)?a.lanes=32:a.lanes=536870912,null}var Z=m.children;return m=m.fallback,w?(Vi(),w=a.mode,Z=kh({mode:"hidden",children:Z},w),m=Ia(m,w,u,null),Z.return=a,m.return=a,Z.sibling=m,a.child=Z,m=a.child,m.memoizedState=Ev(u),m.childLanes=Cv(s,D,u),a.memoizedState=Sv,Gu(null,m)):(Fi(a),_v(a,Z))}var oe=s.memoizedState;if(oe!==null&&(Z=oe.dehydrated,Z!==null)){if(C)a.flags&256?(Fi(a),a.flags&=-257,a=Rv(s,a,u)):a.memoizedState!==null?(Vi(),a.child=s.child,a.flags|=128,a=null):(Vi(),Z=m.fallback,w=a.mode,m=kh({mode:"visible",children:m.children},w),Z=Ia(Z,w,u,null),Z.flags|=2,m.return=a,Z.return=a,m.sibling=Z,a.child=m,Ha(a,s.child,null,u),m=a.child,m.memoizedState=Ev(u),m.childLanes=Cv(s,D,u),a.memoizedState=Sv,a=Gu(null,m));else if(Fi(a),ix(Z)){if(D=Z.nextSibling&&Z.nextSibling.dataset,D)var ge=D.dgst;D=ge,m=Error(r(419)),m.stack="",m.digest=D,Iu({value:m,source:null,stack:null}),a=Rv(s,a,u)}else if(ar||Yl(s,a,u,!1),D=(u&s.childLanes)!==0,ar||D){if(D=En,D!==null&&(m=ee(D,u),m!==0&&m!==oe.retryLane))throw oe.retryLane=m,Pa(s,m),no(D,s,m),bv;sx(Z)||Vh(),a=Rv(s,a,u)}else sx(Z)?(a.flags|=192,a.child=s.child,a=null):(s=oe.treeContext,On=Po(Z.nextSibling),Rr=a,Xt=!0,Di=null,Ao=!1,s!==null&&p1(a,s),a=_v(a,m.children),a.flags|=4096);return a}return w?(Vi(),Z=m.fallback,w=a.mode,oe=s.child,ge=oe.sibling,m=Ks(oe,{mode:"hidden",children:m.children}),m.subtreeFlags=oe.subtreeFlags&65011712,ge!==null?Z=Ks(ge,Z):(Z=Ia(Z,w,u,null),Z.flags|=2),Z.return=a,m.return=a,m.sibling=Z,a.child=m,Gu(null,m),m=a.child,Z=s.child.memoizedState,Z===null?Z=Ev(u):(w=Z.cachePool,w!==null?(oe=sr._currentValue,w=w.parent!==oe?{parent:oe,pool:oe}:w):w=b1(),Z={baseLanes:Z.baseLanes|u,cachePool:w}),m.memoizedState=Z,m.childLanes=Cv(s,D,u),a.memoizedState=Sv,Gu(s.child,m)):(Fi(a),u=s.child,s=u.sibling,u=Ks(u,{mode:"visible",children:m.children}),u.return=a,u.sibling=null,s!==null&&(D=a.deletions,D===null?(a.deletions=[s],a.flags|=16):D.push(s)),a.child=u,a.memoizedState=null,u)}function _v(s,a){return a=kh({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function kh(s,a){return s=po(22,s,null,a),s.lanes=0,s}function Rv(s,a,u){return Ha(a,s.child,null,u),s=_v(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function AC(s,a,u){s.lanes|=a;var m=s.alternate;m!==null&&(m.lanes|=a),Vy(s.return,a,u)}function jv(s,a,u,m,w,C){var D=s.memoizedState;D===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:w,treeForkCount:C}:(D.isBackwards=a,D.rendering=null,D.renderingStartTime=0,D.last=m,D.tail=u,D.tailMode=w,D.treeForkCount=C)}function DC(s,a,u){var m=a.pendingProps,w=m.revealOrder,C=m.tail;m=m.children;var D=Qn.current,Z=(D&2)!==0;if(Z?(D=D&1|2,a.flags|=128):D&=1,Q(Qn,D),Nr(s,a,m,u),m=Xt?Pu:0,!Z&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&AC(s,u,a);else if(s.tag===19)AC(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(w){case"forwards":for(u=a.child,w=null;u!==null;)s=u.alternate,s!==null&&bh(s)===null&&(w=u),u=u.sibling;u=w,u===null?(w=a.child,a.child=null):(w=u.sibling,u.sibling=null),jv(a,!1,w,u,C,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,w=a.child,a.child=null;w!==null;){if(s=w.alternate,s!==null&&bh(s)===null){a.child=w;break}s=w.sibling,w.sibling=u,u=w,w=s}jv(a,!0,u,null,C,m);break;case"together":jv(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function ti(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Bi|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(Yl(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,u=Ks(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Ks(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function Nv(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&fh(s)))}function f4(s,a,u){switch(a.tag){case 3:K(a,a.stateNode.containerInfo),Ii(a,sr,s.memoizedState.cache),za();break;case 27:case 5:ye(a);break;case 4:K(a,a.stateNode.containerInfo);break;case 10:Ii(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Jy(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(Fi(a),a.flags|=128,null):(u&a.child.childLanes)!==0?kC(s,a,u):(Fi(a),s=ti(s,a,u),s!==null?s.sibling:null);Fi(a);break;case 19:var w=(s.flags&128)!==0;if(m=(u&a.childLanes)!==0,m||(Yl(s,a,u,!1),m=(u&a.childLanes)!==0),w){if(m)return DC(s,a,u);a.flags|=128}if(w=a.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Q(Qn,Qn.current),m)break;return null;case 22:return a.lanes=0,RC(s,a,u,a.pendingProps);case 24:Ii(a,sr,s.memoizedState.cache)}return ti(s,a,u)}function PC(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)ar=!0;else{if(!Nv(s,u)&&(a.flags&128)===0)return ar=!1,f4(s,a,u);ar=(s.flags&131072)!==0}else ar=!1,Xt&&(a.flags&1048576)!==0&&h1(a,Pu,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(s=Va(a.elementType),a.type=s,typeof s=="function")Ay(s)?(m=qa(s,m),a.tag=1,a=OC(null,a,s,m,u)):(a.tag=0,a=wv(null,a,s,m,u));else{if(s!=null){var w=s.$$typeof;if(w===N){a.tag=11,a=EC(null,a,s,m,u);break e}else if(w===M){a.tag=14,a=CC(null,a,s,m,u);break e}}throw a=I(s)||s,Error(r(306,a,""))}}return a;case 0:return wv(s,a,a.type,a.pendingProps,u);case 1:return m=a.type,w=qa(m,a.pendingProps),OC(s,a,m,w,u);case 3:e:{if(K(a,a.stateNode.containerInfo),s===null)throw Error(r(387));m=a.pendingProps;var C=a.memoizedState;w=C.element,Gy(s,a),Hu(a,m,null,u);var D=a.memoizedState;if(m=D.cache,Ii(a,sr,m),m!==C.cache&&Uy(a,[sr],u,!0),Uu(),m=D.element,C.isDehydrated)if(C={element:m,isDehydrated:!1,cache:D.cache},a.updateQueue.baseState=C,a.memoizedState=C,a.flags&256){a=MC(s,a,m,u);break e}else if(m!==w){w=Oo(Error(r(424)),a),Iu(w),a=MC(s,a,m,u);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,On=Po(s.firstChild),Rr=a,Xt=!0,Di=null,Ao=!0,u=R1(a,null,m,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(za(),m===w){a=ti(s,a,u);break e}Nr(s,a,m,u)}a=a.child}return a;case 26:return Mh(s,a),s===null?(u=Y_(a.type,null,a.pendingProps,null))?a.memoizedState=u:Xt||(u=a.type,s=a.pendingProps,m=Gh(te.current).createElement(u),m[Be]=a,m[Ge]=s,Tr(m,u,s),Kt(m),a.stateNode=m):a.memoizedState=Y_(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return ye(a),s===null&&Xt&&(m=a.stateNode=H_(a.type,a.pendingProps,te.current),Rr=a,Ao=!0,w=On,Ki(a.type)?(ax=w,On=Po(m.firstChild)):On=w),Nr(s,a,a.pendingProps.children,u),Mh(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Xt&&((w=m=On)&&(m=U4(m,a.type,a.pendingProps,Ao),m!==null?(a.stateNode=m,Rr=a,On=Po(m.firstChild),Ao=!1,w=!0):w=!1),w||Pi(a)),ye(a),w=a.type,C=a.pendingProps,D=s!==null?s.memoizedProps:null,m=C.children,nx(w,C)?m=null:D!==null&&nx(w,D)&&(a.flags|=32),a.memoizedState!==null&&(w=tv(s,a,r4,null,null,u),cd._currentValue=w),Mh(s,a),Nr(s,a,m,u),a.child;case 6:return s===null&&Xt&&((s=u=On)&&(u=H4(u,a.pendingProps,Ao),u!==null?(a.stateNode=u,Rr=a,On=null,s=!0):s=!1),s||Pi(a)),null;case 13:return kC(s,a,u);case 4:return K(a,a.stateNode.containerInfo),m=a.pendingProps,s===null?a.child=Ha(a,null,m,u):Nr(s,a,m,u),a.child;case 11:return EC(s,a,a.type,a.pendingProps,u);case 7:return Nr(s,a,a.pendingProps,u),a.child;case 8:return Nr(s,a,a.pendingProps.children,u),a.child;case 12:return Nr(s,a,a.pendingProps.children,u),a.child;case 10:return m=a.pendingProps,Ii(a,a.type,m.value),Nr(s,a,m.children,u),a.child;case 9:return w=a.type._context,m=a.pendingProps.children,$a(a),w=jr(w),m=m(w),a.flags|=1,Nr(s,a,m,u),a.child;case 14:return CC(s,a,a.type,a.pendingProps,u);case 15:return _C(s,a,a.type,a.pendingProps,u);case 19:return DC(s,a,u);case 31:return d4(s,a,u);case 22:return RC(s,a,u,a.pendingProps);case 24:return $a(a),m=jr(sr),s===null?(w=qy(),w===null&&(w=En,C=Hy(),w.pooledCache=C,C.refCount++,C!==null&&(w.pooledCacheLanes|=u),w=C),a.memoizedState={parent:m,cache:w},Zy(a),Ii(a,sr,w)):((s.lanes&u)!==0&&(Gy(s,a),Hu(a,null,null,u),Uu()),w=s.memoizedState,C=a.memoizedState,w.parent!==m?(w={parent:m,cache:m},a.memoizedState=w,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=w),Ii(a,sr,m)):(m=C.cache,Ii(a,sr,m),m!==w.cache&&Uy(a,[sr],u,!0))),Nr(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function ni(s){s.flags|=4}function Tv(s,a,u,m,w){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(w&335544128)===w)if(s.stateNode.complete)s.flags|=8192;else if(l_())s.flags|=8192;else throw Ua=gh,Yy}else s.flags&=-16777217}function IC(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Q_(a))if(l_())s.flags|=8192;else throw Ua=gh,Yy}function Ah(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?wt():536870912,s.lanes|=a,oc|=a)}function Ku(s,a){if(!Xt)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function Mn(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,m=0;if(a)for(var w=s.child;w!==null;)u|=w.lanes|w.childLanes,m|=w.subtreeFlags&65011712,m|=w.flags&65011712,w.return=s,w=w.sibling;else for(w=s.child;w!==null;)u|=w.lanes|w.childLanes,m|=w.subtreeFlags,m|=w.flags,w.return=s,w=w.sibling;return s.subtreeFlags|=m,s.childLanes=u,a}function h4(s,a,u){var m=a.pendingProps;switch(zy(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mn(a),null;case 1:return Mn(a),null;case 3:return u=a.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),Ws(sr),re(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(ql(a)?ni(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,$y())),Mn(a),null;case 26:var w=a.type,C=a.memoizedState;return s===null?(ni(a),C!==null?(Mn(a),IC(a,C)):(Mn(a),Tv(a,w,null,m,u))):C?C!==s.memoizedState?(ni(a),Mn(a),IC(a,C)):(Mn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==m&&ni(a),Mn(a),Tv(a,w,s,m,u)),null;case 27:if(fe(a),u=te.current,w=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&ni(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return Mn(a),null}s=X.current,ql(a)?m1(a):(s=H_(w,m,u),a.stateNode=s,ni(a))}return Mn(a),null;case 5:if(fe(a),w=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==m&&ni(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return Mn(a),null}if(C=X.current,ql(a))m1(a);else{var D=Gh(te.current);switch(C){case 1:C=D.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:C=D.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":C=D.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":C=D.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":C=D.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof m.is=="string"?D.createElement("select",{is:m.is}):D.createElement("select"),m.multiple?C.multiple=!0:m.size&&(C.size=m.size);break;default:C=typeof m.is=="string"?D.createElement(w,{is:m.is}):D.createElement(w)}}C[Be]=a,C[Ge]=m;e:for(D=a.child;D!==null;){if(D.tag===5||D.tag===6)C.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===a)break e;for(;D.sibling===null;){if(D.return===null||D.return===a)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}a.stateNode=C;e:switch(Tr(C,w,m),w){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ni(a)}}return Mn(a),Tv(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==m&&ni(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(r(166));if(s=te.current,ql(a)){if(s=a.stateNode,u=a.memoizedProps,m=null,w=Rr,w!==null)switch(w.tag){case 27:case 5:m=w.memoizedProps}s[Be]=a,s=!!(s.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||k_(s.nodeValue,u)),s||Pi(a,!0)}else s=Gh(s).createTextNode(m),s[Be]=a,a.stateNode=s}return Mn(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(m=ql(a),u!==null){if(s===null){if(!m)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Be]=a}else za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mn(a),s=!1}else u=$y(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(go(a),a):(go(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Mn(a),null;case 13:if(m=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(w=ql(a),m!==null&&m.dehydrated!==null){if(s===null){if(!w)throw Error(r(318));if(w=a.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(r(317));w[Be]=a}else za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mn(a),w=!1}else w=$y(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=w),w=!0;if(!w)return a.flags&256?(go(a),a):(go(a),null)}return go(a),(a.flags&128)!==0?(a.lanes=u,a):(u=m!==null,s=s!==null&&s.memoizedState!==null,u&&(m=a.child,w=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(w=m.alternate.memoizedState.cachePool.pool),C=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(C=m.memoizedState.cachePool.pool),C!==w&&(m.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),Ah(a,a.updateQueue),Mn(a),null);case 4:return re(),s===null&&Qv(a.stateNode.containerInfo),Mn(a),null;case 10:return Ws(a.type),Mn(a),null;case 19:if(F(Qn),m=a.memoizedState,m===null)return Mn(a),null;if(w=(a.flags&128)!==0,C=m.rendering,C===null)if(w)Ku(m,!1);else{if(Gn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(C=bh(s),C!==null){for(a.flags|=128,Ku(m,!1),s=C.updateQueue,a.updateQueue=s,Ah(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)u1(u,s),u=u.sibling;return Q(Qn,Qn.current&1|2),Xt&&Xs(a,m.treeForkCount),a.child}s=s.sibling}m.tail!==null&&me()>Lh&&(a.flags|=128,w=!0,Ku(m,!1),a.lanes=4194304)}else{if(!w)if(s=bh(C),s!==null){if(a.flags|=128,w=!0,s=s.updateQueue,a.updateQueue=s,Ah(a,s),Ku(m,!0),m.tail===null&&m.tailMode==="hidden"&&!C.alternate&&!Xt)return Mn(a),null}else 2*me()-m.renderingStartTime>Lh&&u!==536870912&&(a.flags|=128,w=!0,Ku(m,!1),a.lanes=4194304);m.isBackwards?(C.sibling=a.child,a.child=C):(s=m.last,s!==null?s.sibling=C:a.child=C,m.last=C)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=me(),s.sibling=null,u=Qn.current,Q(Qn,w?u&1|2:u&1),Xt&&Xs(a,m.treeForkCount),s):(Mn(a),null);case 22:case 23:return go(a),Wy(),m=a.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(u&536870912)!==0&&(a.flags&128)===0&&(Mn(a),a.subtreeFlags&6&&(a.flags|=8192)):Mn(a),u=a.updateQueue,u!==null&&Ah(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==u&&(a.flags|=2048),s!==null&&F(Fa),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Ws(sr),Mn(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function p4(s,a){switch(zy(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Ws(sr),re(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return fe(a),null;case 31:if(a.memoizedState!==null){if(go(a),a.alternate===null)throw Error(r(340));za()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(go(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));za()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return F(Qn),null;case 4:return re(),null;case 10:return Ws(a.type),null;case 22:case 23:return go(a),Wy(),s!==null&&F(Fa),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Ws(sr),null;case 25:return null;default:return null}}function zC(s,a){switch(zy(a),a.tag){case 3:Ws(sr),re();break;case 26:case 27:case 5:fe(a);break;case 4:re();break;case 31:a.memoizedState!==null&&go(a);break;case 13:go(a);break;case 19:F(Qn);break;case 10:Ws(a.type);break;case 22:case 23:go(a),Wy(),s!==null&&F(Fa);break;case 24:Ws(sr)}}function Xu(s,a){try{var u=a.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var w=m.next;u=w;do{if((u.tag&s)===s){m=void 0;var C=u.create,D=u.inst;m=C(),D.destroy=m}u=u.next}while(u!==w)}}catch(Z){hn(a,a.return,Z)}}function Ui(s,a,u){try{var m=a.updateQueue,w=m!==null?m.lastEffect:null;if(w!==null){var C=w.next;m=C;do{if((m.tag&s)===s){var D=m.inst,Z=D.destroy;if(Z!==void 0){D.destroy=void 0,w=a;var oe=u,ge=Z;try{ge()}catch(_e){hn(w,oe,_e)}}}m=m.next}while(m!==C)}}catch(_e){hn(a,a.return,_e)}}function LC(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{N1(a,u)}catch(m){hn(s,s.return,m)}}}function $C(s,a,u){u.props=qa(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(m){hn(s,a,m)}}function Qu(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof u=="function"?s.refCleanup=u(m):u.current=m}}catch(w){hn(s,a,w)}}function Ss(s,a){var u=s.ref,m=s.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(w){hn(s,a,w)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(w){hn(s,a,w)}else u.current=null}function FC(s){var a=s.type,u=s.memoizedProps,m=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&m.focus();break e;case"img":u.src?m.src=u.src:u.srcSet&&(m.srcset=u.srcSet)}}catch(w){hn(s,s.return,w)}}function Ov(s,a,u){try{var m=s.stateNode;I4(m,s.type,u,a),m[Ge]=a}catch(w){hn(s,s.return,w)}}function VC(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ki(s.type)||s.tag===4}function Mv(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||VC(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ki(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function kv(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(s),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Zs));else if(m!==4&&(m===27&&Ki(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(kv(s,a,u),s=s.sibling;s!==null;)kv(s,a,u),s=s.sibling}function Dh(s,a,u){var m=s.tag;if(m===5||m===6)s=s.stateNode,a?u.insertBefore(s,a):u.appendChild(s);else if(m!==4&&(m===27&&Ki(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Dh(s,a,u),s=s.sibling;s!==null;)Dh(s,a,u),s=s.sibling}function UC(s){var a=s.stateNode,u=s.memoizedProps;try{for(var m=s.type,w=a.attributes;w.length;)a.removeAttributeNode(w[0]);Tr(a,m,u),a[Be]=s,a[Ge]=u}catch(C){hn(s,s.return,C)}}var ri=!1,lr=!1,Av=!1,HC=typeof WeakSet=="function"?WeakSet:Set,mr=null;function m4(s,a){if(s=s.containerInfo,ex=tp,s=t1(s),Ry(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var w=m.anchorOffset,C=m.focusNode;m=m.focusOffset;try{u.nodeType,C.nodeType}catch{u=null;break e}var D=0,Z=-1,oe=-1,ge=0,_e=0,Te=s,ve=null;t:for(;;){for(var we;Te!==u||w!==0&&Te.nodeType!==3||(Z=D+w),Te!==C||m!==0&&Te.nodeType!==3||(oe=D+m),Te.nodeType===3&&(D+=Te.nodeValue.length),(we=Te.firstChild)!==null;)ve=Te,Te=we;for(;;){if(Te===s)break t;if(ve===u&&++ge===w&&(Z=D),ve===C&&++_e===m&&(oe=D),(we=Te.nextSibling)!==null)break;Te=ve,ve=Te.parentNode}Te=we}u=Z===-1||oe===-1?null:{start:Z,end:oe}}else u=null}u=u||{start:0,end:0}}else u=null;for(tx={focusedElem:s,selectionRange:u},tp=!1,mr=a;mr!==null;)if(a=mr,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,mr=s;else for(;mr!==null;){switch(a=mr,C=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)w=s[u],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&C!==null){s=void 0,u=a,w=C.memoizedProps,C=C.memoizedState,m=u.stateNode;try{var st=qa(u.type,w);s=m.getSnapshotBeforeUpdate(st,C),m.__reactInternalSnapshotBeforeUpdate=s}catch(xt){hn(u,u.return,xt)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,u=s.nodeType,u===9)ox(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":ox(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,mr=s;break}mr=a.return}}function BC(s,a,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:si(s,u),m&4&&Xu(5,u);break;case 1:if(si(s,u),m&4)if(s=u.stateNode,a===null)try{s.componentDidMount()}catch(D){hn(u,u.return,D)}else{var w=qa(u.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(w,a,s.__reactInternalSnapshotBeforeUpdate)}catch(D){hn(u,u.return,D)}}m&64&&LC(u),m&512&&Qu(u,u.return);break;case 3:if(si(s,u),m&64&&(s=u.updateQueue,s!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{N1(s,a)}catch(D){hn(u,u.return,D)}}break;case 27:a===null&&m&4&&UC(u);case 26:case 5:si(s,u),a===null&&m&4&&FC(u),m&512&&Qu(u,u.return);break;case 12:si(s,u);break;case 31:si(s,u),m&4&&ZC(s,u);break;case 13:si(s,u),m&4&&GC(s,u),m&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=C4.bind(null,u),B4(s,u))));break;case 22:if(m=u.memoizedState!==null||ri,!m){a=a!==null&&a.memoizedState!==null||lr,w=ri;var C=lr;ri=m,(lr=a)&&!C?ii(s,u,(u.subtreeFlags&8772)!==0):si(s,u),ri=w,lr=C}break;case 30:break;default:si(s,u)}}function qC(s){var a=s.alternate;a!==null&&(s.alternate=null,qC(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Wt(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var zn=null,Wr=!1;function oi(s,a,u){for(u=u.child;u!==null;)YC(s,a,u),u=u.sibling}function YC(s,a,u){if(ae&&typeof ae.onCommitFiberUnmount=="function")try{ae.onCommitFiberUnmount(ie,u)}catch{}switch(u.tag){case 26:lr||Ss(u,a),oi(s,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:lr||Ss(u,a);var m=zn,w=Wr;Ki(u.type)&&(zn=u.stateNode,Wr=!1),oi(s,a,u),id(u.stateNode),zn=m,Wr=w;break;case 5:lr||Ss(u,a);case 6:if(m=zn,w=Wr,zn=null,oi(s,a,u),zn=m,Wr=w,zn!==null)if(Wr)try{(zn.nodeType===9?zn.body:zn.nodeName==="HTML"?zn.ownerDocument.body:zn).removeChild(u.stateNode)}catch(C){hn(u,a,C)}else try{zn.removeChild(u.stateNode)}catch(C){hn(u,a,C)}break;case 18:zn!==null&&(Wr?(s=zn,L_(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),fc(s)):L_(zn,u.stateNode));break;case 4:m=zn,w=Wr,zn=u.stateNode.containerInfo,Wr=!0,oi(s,a,u),zn=m,Wr=w;break;case 0:case 11:case 14:case 15:Ui(2,u,a),lr||Ui(4,u,a),oi(s,a,u);break;case 1:lr||(Ss(u,a),m=u.stateNode,typeof m.componentWillUnmount=="function"&&$C(u,a,m)),oi(s,a,u);break;case 21:oi(s,a,u);break;case 22:lr=(m=lr)||u.memoizedState!==null,oi(s,a,u),lr=m;break;default:oi(s,a,u)}}function ZC(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{fc(s)}catch(u){hn(a,a.return,u)}}}function GC(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{fc(s)}catch(u){hn(a,a.return,u)}}function g4(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new HC),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new HC),a;default:throw Error(r(435,s.tag))}}function Ph(s,a){var u=g4(s);a.forEach(function(m){if(!u.has(m)){u.add(m);var w=_4.bind(null,s,m);m.then(w,w)}})}function Jr(s,a){var u=a.deletions;if(u!==null)for(var m=0;m<u.length;m++){var w=u[m],C=s,D=a,Z=D;e:for(;Z!==null;){switch(Z.tag){case 27:if(Ki(Z.type)){zn=Z.stateNode,Wr=!1;break e}break;case 5:zn=Z.stateNode,Wr=!1;break e;case 3:case 4:zn=Z.stateNode.containerInfo,Wr=!0;break e}Z=Z.return}if(zn===null)throw Error(r(160));YC(C,D,w),zn=null,Wr=!1,C=w.alternate,C!==null&&(C.return=null),w.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)KC(a,s),a=a.sibling}var Xo=null;function KC(s,a){var u=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Jr(a,s),eo(s),m&4&&(Ui(3,s,s.return),Xu(3,s),Ui(5,s,s.return));break;case 1:Jr(a,s),eo(s),m&512&&(lr||u===null||Ss(u,u.return)),m&64&&ri&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?m:u.concat(m))));break;case 26:var w=Xo;if(Jr(a,s),eo(s),m&512&&(lr||u===null||Ss(u,u.return)),m&4){var C=u!==null?u.memoizedState:null;if(m=s.memoizedState,u===null)if(m===null)if(s.stateNode===null){e:{m=s.type,u=s.memoizedProps,w=w.ownerDocument||w;t:switch(m){case"title":C=w.getElementsByTagName("title")[0],(!C||C[Pt]||C[Be]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=w.createElement(m),w.head.insertBefore(C,w.querySelector("head > title"))),Tr(C,m,u),C[Be]=s,Kt(C),m=C;break e;case"link":var D=K_("link","href",w).get(m+(u.href||""));if(D){for(var Z=0;Z<D.length;Z++)if(C=D[Z],C.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&C.getAttribute("rel")===(u.rel==null?null:u.rel)&&C.getAttribute("title")===(u.title==null?null:u.title)&&C.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){D.splice(Z,1);break t}}C=w.createElement(m),Tr(C,m,u),w.head.appendChild(C);break;case"meta":if(D=K_("meta","content",w).get(m+(u.content||""))){for(Z=0;Z<D.length;Z++)if(C=D[Z],C.getAttribute("content")===(u.content==null?null:""+u.content)&&C.getAttribute("name")===(u.name==null?null:u.name)&&C.getAttribute("property")===(u.property==null?null:u.property)&&C.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&C.getAttribute("charset")===(u.charSet==null?null:u.charSet)){D.splice(Z,1);break t}}C=w.createElement(m),Tr(C,m,u),w.head.appendChild(C);break;default:throw Error(r(468,m))}C[Be]=s,Kt(C),m=C}s.stateNode=m}else X_(w,s.type,s.stateNode);else s.stateNode=G_(w,m,s.memoizedProps);else C!==m?(C===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):C.count--,m===null?X_(w,s.type,s.stateNode):G_(w,m,s.memoizedProps)):m===null&&s.stateNode!==null&&Ov(s,s.memoizedProps,u.memoizedProps)}break;case 27:Jr(a,s),eo(s),m&512&&(lr||u===null||Ss(u,u.return)),u!==null&&m&4&&Ov(s,s.memoizedProps,u.memoizedProps);break;case 5:if(Jr(a,s),eo(s),m&512&&(lr||u===null||Ss(u,u.return)),s.flags&32){w=s.stateNode;try{Pl(w,"")}catch(st){hn(s,s.return,st)}}m&4&&s.stateNode!=null&&(w=s.memoizedProps,Ov(s,w,u!==null?u.memoizedProps:w)),m&1024&&(Av=!0);break;case 6:if(Jr(a,s),eo(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,u=s.stateNode;try{u.nodeValue=m}catch(st){hn(s,s.return,st)}}break;case 3:if(Qh=null,w=Xo,Xo=Kh(a.containerInfo),Jr(a,s),Xo=w,eo(s),m&4&&u!==null&&u.memoizedState.isDehydrated)try{fc(a.containerInfo)}catch(st){hn(s,s.return,st)}Av&&(Av=!1,XC(s));break;case 4:m=Xo,Xo=Kh(s.stateNode.containerInfo),Jr(a,s),eo(s),Xo=m;break;case 12:Jr(a,s),eo(s);break;case 31:Jr(a,s),eo(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Ph(s,m)));break;case 13:Jr(a,s),eo(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(zh=me()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Ph(s,m)));break;case 22:w=s.memoizedState!==null;var oe=u!==null&&u.memoizedState!==null,ge=ri,_e=lr;if(ri=ge||w,lr=_e||oe,Jr(a,s),lr=_e,ri=ge,eo(s),m&8192)e:for(a=s.stateNode,a._visibility=w?a._visibility&-2:a._visibility|1,w&&(u===null||oe||ri||lr||Ya(s)),u=null,a=s;;){if(a.tag===5||a.tag===26){if(u===null){oe=u=a;try{if(C=oe.stateNode,w)D=C.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{Z=oe.stateNode;var Te=oe.memoizedProps.style,ve=Te!=null&&Te.hasOwnProperty("display")?Te.display:null;Z.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(st){hn(oe,oe.return,st)}}}else if(a.tag===6){if(u===null){oe=a;try{oe.stateNode.nodeValue=w?"":oe.memoizedProps}catch(st){hn(oe,oe.return,st)}}}else if(a.tag===18){if(u===null){oe=a;try{var we=oe.stateNode;w?$_(we,!0):$_(oe.stateNode,!1)}catch(st){hn(oe,oe.return,st)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=s.updateQueue,m!==null&&(u=m.retryQueue,u!==null&&(m.retryQueue=null,Ph(s,u))));break;case 19:Jr(a,s),eo(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,Ph(s,m)));break;case 30:break;case 21:break;default:Jr(a,s),eo(s)}}function eo(s){var a=s.flags;if(a&2){try{for(var u,m=s.return;m!==null;){if(VC(m)){u=m;break}m=m.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var w=u.stateNode,C=Mv(s);Dh(s,C,w);break;case 5:var D=u.stateNode;u.flags&32&&(Pl(D,""),u.flags&=-33);var Z=Mv(s);Dh(s,Z,D);break;case 3:case 4:var oe=u.stateNode.containerInfo,ge=Mv(s);kv(s,ge,oe);break;default:throw Error(r(161))}}catch(_e){hn(s,s.return,_e)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function XC(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;XC(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function si(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)BC(s,a.alternate,a),a=a.sibling}function Ya(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:Ui(4,a,a.return),Ya(a);break;case 1:Ss(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&$C(a,a.return,u),Ya(a);break;case 27:id(a.stateNode);case 26:case 5:Ss(a,a.return),Ya(a);break;case 22:a.memoizedState===null&&Ya(a);break;case 30:Ya(a);break;default:Ya(a)}s=s.sibling}}function ii(s,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,w=s,C=a,D=C.flags;switch(C.tag){case 0:case 11:case 15:ii(w,C,u),Xu(4,C);break;case 1:if(ii(w,C,u),m=C,w=m.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(ge){hn(m,m.return,ge)}if(m=C,w=m.updateQueue,w!==null){var Z=m.stateNode;try{var oe=w.shared.hiddenCallbacks;if(oe!==null)for(w.shared.hiddenCallbacks=null,w=0;w<oe.length;w++)j1(oe[w],Z)}catch(ge){hn(m,m.return,ge)}}u&&D&64&&LC(C),Qu(C,C.return);break;case 27:UC(C);case 26:case 5:ii(w,C,u),u&&m===null&&D&4&&FC(C),Qu(C,C.return);break;case 12:ii(w,C,u);break;case 31:ii(w,C,u),u&&D&4&&ZC(w,C);break;case 13:ii(w,C,u),u&&D&4&&GC(w,C);break;case 22:C.memoizedState===null&&ii(w,C,u),Qu(C,C.return);break;case 30:break;default:ii(w,C,u)}a=a.sibling}}function Dv(s,a){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&zu(u))}function Pv(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&zu(s))}function Qo(s,a,u,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)QC(s,a,u,m),a=a.sibling}function QC(s,a,u,m){var w=a.flags;switch(a.tag){case 0:case 11:case 15:Qo(s,a,u,m),w&2048&&Xu(9,a);break;case 1:Qo(s,a,u,m);break;case 3:Qo(s,a,u,m),w&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&zu(s)));break;case 12:if(w&2048){Qo(s,a,u,m),s=a.stateNode;try{var C=a.memoizedProps,D=C.id,Z=C.onPostCommit;typeof Z=="function"&&Z(D,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(oe){hn(a,a.return,oe)}}else Qo(s,a,u,m);break;case 31:Qo(s,a,u,m);break;case 13:Qo(s,a,u,m);break;case 23:break;case 22:C=a.stateNode,D=a.alternate,a.memoizedState!==null?C._visibility&2?Qo(s,a,u,m):Wu(s,a):C._visibility&2?Qo(s,a,u,m):(C._visibility|=2,tc(s,a,u,m,(a.subtreeFlags&10256)!==0||!1)),w&2048&&Dv(D,a);break;case 24:Qo(s,a,u,m),w&2048&&Pv(a.alternate,a);break;default:Qo(s,a,u,m)}}function tc(s,a,u,m,w){for(w=w&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var C=s,D=a,Z=u,oe=m,ge=D.flags;switch(D.tag){case 0:case 11:case 15:tc(C,D,Z,oe,w),Xu(8,D);break;case 23:break;case 22:var _e=D.stateNode;D.memoizedState!==null?_e._visibility&2?tc(C,D,Z,oe,w):Wu(C,D):(_e._visibility|=2,tc(C,D,Z,oe,w)),w&&ge&2048&&Dv(D.alternate,D);break;case 24:tc(C,D,Z,oe,w),w&&ge&2048&&Pv(D.alternate,D);break;default:tc(C,D,Z,oe,w)}a=a.sibling}}function Wu(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=s,m=a,w=m.flags;switch(m.tag){case 22:Wu(u,m),w&2048&&Dv(m.alternate,m);break;case 24:Wu(u,m),w&2048&&Pv(m.alternate,m);break;default:Wu(u,m)}a=a.sibling}}var Ju=8192;function nc(s,a,u){if(s.subtreeFlags&Ju)for(s=s.child;s!==null;)WC(s,a,u),s=s.sibling}function WC(s,a,u){switch(s.tag){case 26:nc(s,a,u),s.flags&Ju&&s.memoizedState!==null&&n3(u,Xo,s.memoizedState,s.memoizedProps);break;case 5:nc(s,a,u);break;case 3:case 4:var m=Xo;Xo=Kh(s.stateNode.containerInfo),nc(s,a,u),Xo=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=Ju,Ju=16777216,nc(s,a,u),Ju=m):nc(s,a,u));break;default:nc(s,a,u)}}function JC(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function ed(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];mr=m,t_(m,s)}JC(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)e_(s),s=s.sibling}function e_(s){switch(s.tag){case 0:case 11:case 15:ed(s),s.flags&2048&&Ui(9,s,s.return);break;case 3:ed(s);break;case 12:ed(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Ih(s)):ed(s);break;default:ed(s)}}function Ih(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var m=a[u];mr=m,t_(m,s)}JC(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:Ui(8,a,a.return),Ih(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,Ih(a));break;default:Ih(a)}s=s.sibling}}function t_(s,a){for(;mr!==null;){var u=mr;switch(u.tag){case 0:case 11:case 15:Ui(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var m=u.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:zu(u.memoizedState.cache)}if(m=u.child,m!==null)m.return=u,mr=m;else e:for(u=s;mr!==null;){m=mr;var w=m.sibling,C=m.return;if(qC(m),m===u){mr=null;break e}if(w!==null){w.return=C,mr=w;break e}mr=C}}}var y4={getCacheForType:function(s){var a=jr(sr),u=a.data.get(s);return u===void 0&&(u=s(),a.data.set(s,u)),u},cacheSignal:function(){return jr(sr).controller.signal}},v4=typeof WeakMap=="function"?WeakMap:Map,on=0,En=null,Vt=null,qt=0,fn=0,yo=null,Hi=!1,rc=!1,Iv=!1,ai=0,Gn=0,Bi=0,Za=0,zv=0,vo=0,oc=0,td=null,to=null,Lv=!1,zh=0,n_=0,Lh=1/0,$h=null,qi=null,ur=0,Yi=null,sc=null,li=0,$v=0,Fv=null,r_=null,nd=0,Vv=null;function xo(){return(on&2)!==0&&qt!==0?qt&-qt:A.T!==null?Zv():Ce()}function o_(){if(vo===0)if((qt&536870912)===0||Xt){var s=Xe;Xe<<=1,(Xe&3932160)===0&&(Xe=262144),vo=s}else vo=536870912;return s=mo.current,s!==null&&(s.flags|=32),vo}function no(s,a,u){(s===En&&(fn===2||fn===9)||s.cancelPendingCommit!==null)&&(ic(s,0),Zi(s,qt,vo,!1)),St(s,u),((on&2)===0||s!==En)&&(s===En&&((on&2)===0&&(Za|=u),Gn===4&&Zi(s,qt,vo,!1)),Es(s))}function s_(s,a,u){if((on&6)!==0)throw Error(r(327));var m=!u&&(a&127)===0&&(a&s.expiredLanes)===0||kt(s,a),w=m?w4(s,a):Hv(s,a,!0),C=m;do{if(w===0){rc&&!m&&Zi(s,a,0,!1);break}else{if(u=s.current.alternate,C&&!x4(u)){w=Hv(s,a,!1),C=!1;continue}if(w===2){if(C=a,s.errorRecoveryDisabledLanes&C)var D=0;else D=s.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){a=D;e:{var Z=s;w=td;var oe=Z.current.memoizedState.isDehydrated;if(oe&&(ic(Z,D).flags|=256),D=Hv(Z,D,!1),D!==2){if(Iv&&!oe){Z.errorRecoveryDisabledLanes|=C,Za|=C,w=4;break e}C=to,to=w,C!==null&&(to===null?to=C:to.push.apply(to,C))}w=D}if(C=!1,w!==2)continue}}if(w===1){ic(s,0),Zi(s,a,0,!0);break}e:{switch(m=s,C=w,C){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Zi(m,a,vo,!Hi);break e;case 2:to=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(w=zh+300-me(),10<w)){if(Zi(m,a,vo,!Hi),Mt(m,0,!0)!==0)break e;li=a,m.timeoutHandle=I_(i_.bind(null,m,u,to,$h,Lv,a,vo,Za,oc,Hi,C,"Throttled",-0,0),w);break e}i_(m,u,to,$h,Lv,a,vo,Za,oc,Hi,C,null,-0,0)}}break}while(!0);Es(s)}function i_(s,a,u,m,w,C,D,Z,oe,ge,_e,Te,ve,we){if(s.timeoutHandle=-1,Te=a.subtreeFlags,Te&8192||(Te&16785408)===16785408){Te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zs},WC(a,C,Te);var st=(C&62914560)===C?zh-me():(C&4194048)===C?n_-me():0;if(st=r3(Te,st),st!==null){li=C,s.cancelPendingCommit=st(p_.bind(null,s,a,C,u,m,w,D,Z,oe,_e,Te,null,ve,we)),Zi(s,C,D,!ge);return}}p_(s,a,C,u,m,w,D,Z,oe)}function x4(s){for(var a=s;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var m=0;m<u.length;m++){var w=u[m],C=w.getSnapshot;w=w.value;try{if(!ho(C(),w))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Zi(s,a,u,m){a&=~zv,a&=~Za,s.suspendedLanes|=a,s.pingedLanes&=~a,m&&(s.warmLanes|=a),m=s.expirationTimes;for(var w=a;0<w;){var C=31-be(w),D=1<<C;m[C]=-1,w&=~D}u!==0&&Qt(s,u,a)}function Fh(){return(on&6)===0?(rd(0),!1):!0}function Uv(){if(Vt!==null){if(fn===0)var s=Vt.return;else s=Vt,Qs=La=null,ov(s),Xl=null,$u=0,s=Vt;for(;s!==null;)zC(s.alternate,s),s=s.return;Vt=null}}function ic(s,a){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,$4(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),li=0,Uv(),En=s,Vt=u=Ks(s.current,null),qt=a,fn=0,yo=null,Hi=!1,rc=kt(s,a),Iv=!1,oc=vo=zv=Za=Bi=Gn=0,to=td=null,Lv=!1,(a&8)!==0&&(a|=a&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=a;0<m;){var w=31-be(m),C=1<<w;a|=s[w],m&=~C}return ai=a,ah(),u}function a_(s,a){Tt=null,A.H=Zu,a===Kl||a===mh?(a=E1(),fn=3):a===Yy?(a=E1(),fn=4):fn=a===bv?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,yo=a,Vt===null&&(Gn=1,Th(s,Oo(a,s.current)))}function l_(){var s=mo.current;return s===null?!0:(qt&4194048)===qt?Do===null:(qt&62914560)===qt||(qt&536870912)!==0?s===Do:!1}function c_(){var s=A.H;return A.H=Zu,s===null?Zu:s}function u_(){var s=A.A;return A.A=y4,s}function Vh(){Gn=4,Hi||(qt&4194048)!==qt&&mo.current!==null||(rc=!0),(Bi&134217727)===0&&(Za&134217727)===0||En===null||Zi(En,qt,vo,!1)}function Hv(s,a,u){var m=on;on|=2;var w=c_(),C=u_();(En!==s||qt!==a)&&($h=null,ic(s,a)),a=!1;var D=Gn;e:do try{if(fn!==0&&Vt!==null){var Z=Vt,oe=yo;switch(fn){case 8:Uv(),D=6;break e;case 3:case 2:case 9:case 6:mo.current===null&&(a=!0);var ge=fn;if(fn=0,yo=null,ac(s,Z,oe,ge),u&&rc){D=0;break e}break;default:ge=fn,fn=0,yo=null,ac(s,Z,oe,ge)}}b4(),D=Gn;break}catch(_e){a_(s,_e)}while(!0);return a&&s.shellSuspendCounter++,Qs=La=null,on=m,A.H=w,A.A=C,Vt===null&&(En=null,qt=0,ah()),D}function b4(){for(;Vt!==null;)d_(Vt)}function w4(s,a){var u=on;on|=2;var m=c_(),w=u_();En!==s||qt!==a?($h=null,Lh=me()+500,ic(s,a)):rc=kt(s,a);e:do try{if(fn!==0&&Vt!==null){a=Vt;var C=yo;t:switch(fn){case 1:fn=0,yo=null,ac(s,a,C,1);break;case 2:case 9:if(w1(C)){fn=0,yo=null,f_(a);break}a=function(){fn!==2&&fn!==9||En!==s||(fn=7),Es(s)},C.then(a,a);break e;case 3:fn=7;break e;case 4:fn=5;break e;case 7:w1(C)?(fn=0,yo=null,f_(a)):(fn=0,yo=null,ac(s,a,C,7));break;case 5:var D=null;switch(Vt.tag){case 26:D=Vt.memoizedState;case 5:case 27:var Z=Vt;if(D?Q_(D):Z.stateNode.complete){fn=0,yo=null;var oe=Z.sibling;if(oe!==null)Vt=oe;else{var ge=Z.return;ge!==null?(Vt=ge,Uh(ge)):Vt=null}break t}}fn=0,yo=null,ac(s,a,C,5);break;case 6:fn=0,yo=null,ac(s,a,C,6);break;case 8:Uv(),Gn=6;break e;default:throw Error(r(462))}}S4();break}catch(_e){a_(s,_e)}while(!0);return Qs=La=null,A.H=m,A.A=w,on=u,Vt!==null?0:(En=null,qt=0,ah(),Gn)}function S4(){for(;Vt!==null&&!Ye();)d_(Vt)}function d_(s){var a=PC(s.alternate,s,ai);s.memoizedProps=s.pendingProps,a===null?Uh(s):Vt=a}function f_(s){var a=s,u=a.alternate;switch(a.tag){case 15:case 0:a=TC(u,a,a.pendingProps,a.type,void 0,qt);break;case 11:a=TC(u,a,a.pendingProps,a.type.render,a.ref,qt);break;case 5:ov(a);default:zC(u,a),a=Vt=u1(a,ai),a=PC(u,a,ai)}s.memoizedProps=s.pendingProps,a===null?Uh(s):Vt=a}function ac(s,a,u,m){Qs=La=null,ov(a),Xl=null,$u=0;var w=a.return;try{if(u4(s,w,a,u,qt)){Gn=1,Th(s,Oo(u,s.current)),Vt=null;return}}catch(C){if(w!==null)throw Vt=w,C;Gn=1,Th(s,Oo(u,s.current)),Vt=null;return}a.flags&32768?(Xt||m===1?s=!0:rc||(qt&536870912)!==0?s=!1:(Hi=s=!0,(m===2||m===9||m===3||m===6)&&(m=mo.current,m!==null&&m.tag===13&&(m.flags|=16384))),h_(a,s)):Uh(a)}function Uh(s){var a=s;do{if((a.flags&32768)!==0){h_(a,Hi);return}s=a.return;var u=h4(a.alternate,a,ai);if(u!==null){Vt=u;return}if(a=a.sibling,a!==null){Vt=a;return}Vt=a=s}while(a!==null);Gn===0&&(Gn=5)}function h_(s,a){do{var u=p4(s.alternate,s);if(u!==null){u.flags&=32767,Vt=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(s=s.sibling,s!==null)){Vt=s;return}Vt=s=u}while(s!==null);Gn=6,Vt=null}function p_(s,a,u,m,w,C,D,Z,oe){s.cancelPendingCommit=null;do Hh();while(ur!==0);if((on&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(C=a.lanes|a.childLanes,C|=My,In(s,u,C,D,Z,oe),s===En&&(Vt=En=null,qt=0),sc=a,Yi=s,li=u,$v=C,Fv=w,r_=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,R4(Ie,function(){return x_(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=A.T,A.T=null,w=P.p,P.p=2,D=on,on|=4;try{m4(s,a,u)}finally{on=D,P.p=w,A.T=m}}ur=1,m_(),g_(),y_()}}function m_(){if(ur===1){ur=0;var s=Yi,a=sc,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=A.T,A.T=null;var m=P.p;P.p=2;var w=on;on|=4;try{KC(a,s);var C=tx,D=t1(s.containerInfo),Z=C.focusedElem,oe=C.selectionRange;if(D!==Z&&Z&&Z.ownerDocument&&e1(Z.ownerDocument.documentElement,Z)){if(oe!==null&&Ry(Z)){var ge=oe.start,_e=oe.end;if(_e===void 0&&(_e=ge),"selectionStart"in Z)Z.selectionStart=ge,Z.selectionEnd=Math.min(_e,Z.value.length);else{var Te=Z.ownerDocument||document,ve=Te&&Te.defaultView||window;if(ve.getSelection){var we=ve.getSelection(),st=Z.textContent.length,xt=Math.min(oe.start,st),gn=oe.end===void 0?xt:Math.min(oe.end,st);!we.extend&&xt>gn&&(D=gn,gn=xt,xt=D);var de=JE(Z,xt),le=JE(Z,gn);if(de&&le&&(we.rangeCount!==1||we.anchorNode!==de.node||we.anchorOffset!==de.offset||we.focusNode!==le.node||we.focusOffset!==le.offset)){var pe=Te.createRange();pe.setStart(de.node,de.offset),we.removeAllRanges(),xt>gn?(we.addRange(pe),we.extend(le.node,le.offset)):(pe.setEnd(le.node,le.offset),we.addRange(pe))}}}}for(Te=[],we=Z;we=we.parentNode;)we.nodeType===1&&Te.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Z<Te.length;Z++){var je=Te[Z];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}tp=!!ex,tx=ex=null}finally{on=w,P.p=m,A.T=u}}s.current=a,ur=2}}function g_(){if(ur===2){ur=0;var s=Yi,a=sc,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=A.T,A.T=null;var m=P.p;P.p=2;var w=on;on|=4;try{BC(s,a.alternate,a)}finally{on=w,P.p=m,A.T=u}}ur=3}}function y_(){if(ur===4||ur===3){ur=0,et();var s=Yi,a=sc,u=li,m=r_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ur=5:(ur=0,sc=Yi=null,v_(s,s.pendingLanes));var w=s.pendingLanes;if(w===0&&(qi=null),ce(u),a=a.stateNode,ae&&typeof ae.onCommitFiberRoot=="function")try{ae.onCommitFiberRoot(ie,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=A.T,w=P.p,P.p=2,A.T=null;try{for(var C=s.onRecoverableError,D=0;D<m.length;D++){var Z=m[D];C(Z.value,{componentStack:Z.stack})}}finally{A.T=a,P.p=w}}(li&3)!==0&&Hh(),Es(s),w=s.pendingLanes,(u&261930)!==0&&(w&42)!==0?s===Vv?nd++:(nd=0,Vv=s):nd=0,rd(0)}}function v_(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,zu(a)))}function Hh(){return m_(),g_(),y_(),x_()}function x_(){if(ur!==5)return!1;var s=Yi,a=$v;$v=0;var u=ce(li),m=A.T,w=P.p;try{P.p=32>u?32:u,A.T=null,u=Fv,Fv=null;var C=Yi,D=li;if(ur=0,sc=Yi=null,li=0,(on&6)!==0)throw Error(r(331));var Z=on;if(on|=4,e_(C.current),QC(C,C.current,D,u),on=Z,rd(0,!1),ae&&typeof ae.onPostCommitFiberRoot=="function")try{ae.onPostCommitFiberRoot(ie,C)}catch{}return!0}finally{P.p=w,A.T=m,v_(s,a)}}function b_(s,a,u){a=Oo(u,a),a=xv(s.stateNode,a,2),s=$i(s,a,2),s!==null&&(St(s,2),Es(s))}function hn(s,a,u){if(s.tag===3)b_(s,s,u);else for(;a!==null;){if(a.tag===3){b_(a,s,u);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(qi===null||!qi.has(m))){s=Oo(u,s),u=wC(2),m=$i(a,u,2),m!==null&&(SC(u,m,a,s),St(m,2),Es(m));break}}a=a.return}}function Bv(s,a,u){var m=s.pingCache;if(m===null){m=s.pingCache=new v4;var w=new Set;m.set(a,w)}else w=m.get(a),w===void 0&&(w=new Set,m.set(a,w));w.has(u)||(Iv=!0,w.add(u),s=E4.bind(null,s,a,u),a.then(s,s))}function E4(s,a,u){var m=s.pingCache;m!==null&&m.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,En===s&&(qt&u)===u&&(Gn===4||Gn===3&&(qt&62914560)===qt&&300>me()-zh?(on&2)===0&&ic(s,0):zv|=u,oc===qt&&(oc=0)),Es(s)}function w_(s,a){a===0&&(a=wt()),s=Pa(s,a),s!==null&&(St(s,a),Es(s))}function C4(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),w_(s,u)}function _4(s,a){var u=0;switch(s.tag){case 31:case 13:var m=s.stateNode,w=s.memoizedState;w!==null&&(u=w.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(a),w_(s,u)}function R4(s,a){return Le(s,a)}var Bh=null,lc=null,qv=!1,qh=!1,Yv=!1,Gi=0;function Es(s){s!==lc&&s.next===null&&(lc===null?Bh=lc=s:lc=lc.next=s),qh=!0,qv||(qv=!0,N4())}function rd(s,a){if(!Yv&&qh){Yv=!0;do for(var u=!1,m=Bh;m!==null;){if(s!==0){var w=m.pendingLanes;if(w===0)var C=0;else{var D=m.suspendedLanes,Z=m.pingedLanes;C=(1<<31-be(42|s)+1)-1,C&=w&~(D&~Z),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(u=!0,__(m,C))}else C=qt,C=Mt(m,m===En?C:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(C&3)===0||kt(m,C)||(u=!0,__(m,C));m=m.next}while(u);Yv=!1}}function j4(){S_()}function S_(){qh=qv=!1;var s=0;Gi!==0&&L4()&&(s=Gi);for(var a=me(),u=null,m=Bh;m!==null;){var w=m.next,C=E_(m,a);C===0?(m.next=null,u===null?Bh=w:u.next=w,w===null&&(lc=u)):(u=m,(s!==0||(C&3)!==0)&&(qh=!0)),m=w}ur!==0&&ur!==5||rd(s),Gi!==0&&(Gi=0)}function E_(s,a){for(var u=s.suspendedLanes,m=s.pingedLanes,w=s.expirationTimes,C=s.pendingLanes&-62914561;0<C;){var D=31-be(C),Z=1<<D,oe=w[D];oe===-1?((Z&u)===0||(Z&m)!==0)&&(w[D]=nt(Z,a)):oe<=a&&(s.expiredLanes|=Z),C&=~Z}if(a=En,u=qt,u=Mt(s,s===a?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,u===0||s===a&&(fn===2||fn===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&Fe(m),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||kt(s,u)){if(a=u&-u,a===s.callbackPriority)return a;switch(m!==null&&Fe(m),ce(u)){case 2:case 8:u=Oe;break;case 32:u=Ie;break;case 268435456:u=it;break;default:u=Ie}return m=C_.bind(null,s),u=Le(u,m),s.callbackPriority=a,s.callbackNode=u,a}return m!==null&&m!==null&&Fe(m),s.callbackPriority=2,s.callbackNode=null,2}function C_(s,a){if(ur!==0&&ur!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Hh()&&s.callbackNode!==u)return null;var m=qt;return m=Mt(s,s===En?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(s_(s,m,a),E_(s,me()),s.callbackNode!=null&&s.callbackNode===u?C_.bind(null,s):null)}function __(s,a){if(Hh())return null;s_(s,a,!0)}function N4(){F4(function(){(on&6)!==0?Le(We,j4):S_()})}function Zv(){if(Gi===0){var s=Zl;s===0&&(s=He,He<<=1,(He&261888)===0&&(He=256)),Gi=s}return Gi}function R_(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Jf(""+s)}function j_(s,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,s.id&&u.setAttribute("form",s.id),a.parentNode.insertBefore(u,a),s=new FormData(s),u.parentNode.removeChild(u),s}function T4(s,a,u,m,w){if(a==="submit"&&u&&u.stateNode===w){var C=R_((w[Ge]||null).action),D=m.submitter;D&&(a=(a=D[Ge]||null)?R_(a.formAction):D.getAttribute("formAction"),a!==null&&(C=a,D=null));var Z=new rh("action","action",null,m,w);s.push({event:Z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Gi!==0){var oe=D?j_(w,D):new FormData(w);hv(u,{pending:!0,data:oe,method:w.method,action:C},null,oe)}}else typeof C=="function"&&(Z.preventDefault(),oe=D?j_(w,D):new FormData(w),hv(u,{pending:!0,data:oe,method:w.method,action:C},C,oe))},currentTarget:w}]})}}for(var Gv=0;Gv<Oy.length;Gv++){var Kv=Oy[Gv],O4=Kv.toLowerCase(),M4=Kv[0].toUpperCase()+Kv.slice(1);Ko(O4,"on"+M4)}Ko(o1,"onAnimationEnd"),Ko(s1,"onAnimationIteration"),Ko(i1,"onAnimationStart"),Ko("dblclick","onDoubleClick"),Ko("focusin","onFocus"),Ko("focusout","onBlur"),Ko(ZL,"onTransitionRun"),Ko(GL,"onTransitionStart"),Ko(KL,"onTransitionCancel"),Ko(a1,"onTransitionEnd"),Cr("onMouseEnter",["mouseout","mouseover"]),Cr("onMouseLeave",["mouseout","mouseover"]),Cr("onPointerEnter",["pointerout","pointerover"]),Cr("onPointerLeave",["pointerout","pointerover"]),Lr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Lr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Lr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Lr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var od="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(" "),k4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(od));function N_(s,a){a=(a&4)!==0;for(var u=0;u<s.length;u++){var m=s[u],w=m.event;m=m.listeners;e:{var C=void 0;if(a)for(var D=m.length-1;0<=D;D--){var Z=m[D],oe=Z.instance,ge=Z.currentTarget;if(Z=Z.listener,oe!==C&&w.isPropagationStopped())break e;C=Z,w.currentTarget=ge;try{C(w)}catch(_e){ih(_e)}w.currentTarget=null,C=oe}else for(D=0;D<m.length;D++){if(Z=m[D],oe=Z.instance,ge=Z.currentTarget,Z=Z.listener,oe!==C&&w.isPropagationStopped())break e;C=Z,w.currentTarget=ge;try{C(w)}catch(_e){ih(_e)}w.currentTarget=null,C=oe}}}}function Ut(s,a){var u=a[lt];u===void 0&&(u=a[lt]=new Set);var m=s+"__bubble";u.has(m)||(T_(a,s,2,!1),u.add(m))}function Xv(s,a,u){var m=0;a&&(m|=4),T_(u,s,m,a)}var Yh="_reactListening"+Math.random().toString(36).slice(2);function Qv(s){if(!s[Yh]){s[Yh]=!0,xs.forEach(function(u){u!=="selectionchange"&&(k4.has(u)||Xv(u,!1,s),Xv(u,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Yh]||(a[Yh]=!0,Xv("selectionchange",!1,a))}}function T_(s,a,u,m){switch(oR(a)){case 2:var w=i3;break;case 8:w=a3;break;default:w=fx}u=w.bind(null,a,u,s),w=void 0,!yy||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(w=!0),m?w!==void 0?s.addEventListener(a,u,{capture:!0,passive:w}):s.addEventListener(a,u,!0):w!==void 0?s.addEventListener(a,u,{passive:w}):s.addEventListener(a,u,!1)}function Wv(s,a,u,m,w){var C=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var D=m.tag;if(D===3||D===4){var Z=m.stateNode.containerInfo;if(Z===w)break;if(D===4)for(D=m.return;D!==null;){var oe=D.tag;if((oe===3||oe===4)&&D.stateNode.containerInfo===w)return;D=D.return}for(;Z!==null;){if(D=Sn(Z),D===null)return;if(oe=D.tag,oe===5||oe===6||oe===26||oe===27){m=C=D;continue e}Z=Z.parentNode}}m=m.return}DE(function(){var ge=C,_e=my(u),Te=[];e:{var ve=l1.get(s);if(ve!==void 0){var we=rh,st=s;switch(s){case"keypress":if(th(u)===0)break e;case"keydown":case"keyup":we=_L;break;case"focusin":st="focus",we=wy;break;case"focusout":st="blur",we=wy;break;case"beforeblur":case"afterblur":we=wy;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=zE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=hL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=NL;break;case o1:case s1:case i1:we=gL;break;case a1:we=OL;break;case"scroll":case"scrollend":we=dL;break;case"wheel":we=kL;break;case"copy":case"cut":case"paste":we=vL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=$E;break;case"toggle":case"beforetoggle":we=DL}var xt=(a&4)!==0,gn=!xt&&(s==="scroll"||s==="scrollend"),de=xt?ve!==null?ve+"Capture":null:ve;xt=[];for(var le=ge,pe;le!==null;){var je=le;if(pe=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||pe===null||de===null||(je=Ru(le,de),je!=null&&xt.push(sd(le,je,pe))),gn)break;le=le.return}0<xt.length&&(ve=new we(ve,st,null,u,_e),Te.push({event:ve,listeners:xt}))}}if((a&7)===0){e:{if(ve=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",ve&&u!==py&&(st=u.relatedTarget||u.fromElement)&&(Sn(st)||st[Ke]))break e;if((we||ve)&&(ve=_e.window===_e?_e:(ve=_e.ownerDocument)?ve.defaultView||ve.parentWindow:window,we?(st=u.relatedTarget||u.toElement,we=ge,st=st?Sn(st):null,st!==null&&(gn=i(st),xt=st.tag,st!==gn||xt!==5&&xt!==27&&xt!==6)&&(st=null)):(we=null,st=ge),we!==st)){if(xt=zE,je="onMouseLeave",de="onMouseEnter",le="mouse",(s==="pointerout"||s==="pointerover")&&(xt=$E,je="onPointerLeave",de="onPointerEnter",le="pointer"),gn=we==null?ve:Bt(we),pe=st==null?ve:Bt(st),ve=new xt(je,le+"leave",we,u,_e),ve.target=gn,ve.relatedTarget=pe,je=null,Sn(_e)===ge&&(xt=new xt(de,le+"enter",st,u,_e),xt.target=pe,xt.relatedTarget=gn,je=xt),gn=je,we&&st)t:{for(xt=A4,de=we,le=st,pe=0,je=de;je;je=xt(je))pe++;je=0;for(var pt=le;pt;pt=xt(pt))je++;for(;0<pe-je;)de=xt(de),pe--;for(;0<je-pe;)le=xt(le),je--;for(;pe--;){if(de===le||le!==null&&de===le.alternate){xt=de;break t}de=xt(de),le=xt(le)}xt=null}else xt=null;we!==null&&O_(Te,ve,we,xt,!1),st!==null&&gn!==null&&O_(Te,gn,st,xt,!0)}}e:{if(ve=ge?Bt(ge):window,we=ve.nodeName&&ve.nodeName.toLowerCase(),we==="select"||we==="input"&&ve.type==="file")var tn=ZE;else if(qE(ve))if(GE)tn=BL;else{tn=UL;var ct=VL}else we=ve.nodeName,!we||we.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?ge&&hy(ge.elementType)&&(tn=ZE):tn=HL;if(tn&&(tn=tn(s,ge))){YE(Te,tn,u,_e);break e}ct&&ct(s,ve,ge),s==="focusout"&&ge&&ve.type==="number"&&ge.memoizedProps.value!=null&&Cu(ve,"number",ve.value)}switch(ct=ge?Bt(ge):window,s){case"focusin":(qE(ct)||ct.contentEditable==="true")&&($l=ct,jy=ge,Du=null);break;case"focusout":Du=jy=$l=null;break;case"mousedown":Ny=!0;break;case"contextmenu":case"mouseup":case"dragend":Ny=!1,n1(Te,u,_e);break;case"selectionchange":if(YL)break;case"keydown":case"keyup":n1(Te,u,_e)}var At;if(Ey)e:{switch(s){case"compositionstart":var Yt="onCompositionStart";break e;case"compositionend":Yt="onCompositionEnd";break e;case"compositionupdate":Yt="onCompositionUpdate";break e}Yt=void 0}else Ll?HE(s,u)&&(Yt="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Yt="onCompositionStart");Yt&&(FE&&u.locale!=="ko"&&(Ll||Yt!=="onCompositionStart"?Yt==="onCompositionEnd"&&Ll&&(At=PE()):(ki=_e,vy="value"in ki?ki.value:ki.textContent,Ll=!0)),ct=Zh(ge,Yt),0<ct.length&&(Yt=new LE(Yt,s,null,u,_e),Te.push({event:Yt,listeners:ct}),At?Yt.data=At:(At=BE(u),At!==null&&(Yt.data=At)))),(At=IL?zL(s,u):LL(s,u))&&(Yt=Zh(ge,"onBeforeInput"),0<Yt.length&&(ct=new LE("onBeforeInput","beforeinput",null,u,_e),Te.push({event:ct,listeners:Yt}),ct.data=At)),T4(Te,s,ge,u,_e)}N_(Te,a)})}function sd(s,a,u){return{instance:s,listener:a,currentTarget:u}}function Zh(s,a){for(var u=a+"Capture",m=[];s!==null;){var w=s,C=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||C===null||(w=Ru(s,u),w!=null&&m.unshift(sd(s,w,C)),w=Ru(s,a),w!=null&&m.push(sd(s,w,C))),s.tag===3)return m;s=s.return}return[]}function A4(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function O_(s,a,u,m,w){for(var C=a._reactName,D=[];u!==null&&u!==m;){var Z=u,oe=Z.alternate,ge=Z.stateNode;if(Z=Z.tag,oe!==null&&oe===m)break;Z!==5&&Z!==26&&Z!==27||ge===null||(oe=ge,w?(ge=Ru(u,C),ge!=null&&D.unshift(sd(u,ge,oe))):w||(ge=Ru(u,C),ge!=null&&D.push(sd(u,ge,oe)))),u=u.return}D.length!==0&&s.push({event:a,listeners:D})}var D4=/\r\n?/g,P4=/\u0000|\uFFFD/g;function M_(s){return(typeof s=="string"?s:""+s).replace(D4,`
|
|
9
|
+
`).replace(P4,"")}function k_(s,a){return a=M_(a),M_(s)===a}function mn(s,a,u,m,w,C){switch(u){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||Pl(s,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&Pl(s,""+m);break;case"className":Go(s,"class",m);break;case"tabIndex":Go(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Go(s,u,m);break;case"style":kE(s,m,C);break;case"data":if(a!=="object"){Go(s,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||u!=="href")){s.removeAttribute(u);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Jf(""+m),s.setAttribute(u,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(u,"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 C=="function"&&(u==="formAction"?(a!=="input"&&mn(s,a,"name",w.name,w,null),mn(s,a,"formEncType",w.formEncType,w,null),mn(s,a,"formMethod",w.formMethod,w,null),mn(s,a,"formTarget",w.formTarget,w,null)):(mn(s,a,"encType",w.encType,w,null),mn(s,a,"method",w.method,w,null),mn(s,a,"target",w.target,w,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(u);break}m=Jf(""+m),s.setAttribute(u,m);break;case"onClick":m!=null&&(s.onclick=Zs);break;case"onScroll":m!=null&&Ut("scroll",s);break;case"onScrollEnd":m!=null&&Ut("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(w.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){s.removeAttribute("xlink:href");break}u=Jf(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,""+m):s.removeAttribute(u);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":m&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":m===!0?s.setAttribute(u,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(u,m):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(u,m):s.removeAttribute(u);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(u):s.setAttribute(u,m);break;case"popover":Ut("beforetoggle",s),Ut("toggle",s),Zo(s,"popover",m);break;case"xlinkActuate":Et(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Et(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Et(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Et(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Et(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Et(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Et(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Et(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Et(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Zo(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=cL.get(u)||u,Zo(s,u,m))}}function Jv(s,a,u,m,w,C){switch(u){case"style":kE(s,m,C);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(u=m.__html,u!=null){if(w.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"children":typeof m=="string"?Pl(s,m):(typeof m=="number"||typeof m=="bigint")&&Pl(s,""+m);break;case"onScroll":m!=null&&Ut("scroll",s);break;case"onScrollEnd":m!=null&&Ut("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!uo.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(w=u.endsWith("Capture"),a=u.slice(2,w?u.length-7:void 0),C=s[Ge]||null,C=C!=null?C[u]:null,typeof C=="function"&&s.removeEventListener(a,C,w),typeof m=="function")){typeof C!="function"&&C!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(a,m,w);break e}u in s?s[u]=m:m===!0?s.setAttribute(u,""):Zo(s,u,m)}}}function Tr(s,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ut("error",s),Ut("load",s);var m=!1,w=!1,C;for(C in u)if(u.hasOwnProperty(C)){var D=u[C];if(D!=null)switch(C){case"src":m=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:mn(s,a,C,D,u,null)}}w&&mn(s,a,"srcSet",u.srcSet,u,null),m&&mn(s,a,"src",u.src,u,null);return;case"input":Ut("invalid",s);var Z=C=D=w=null,oe=null,ge=null;for(m in u)if(u.hasOwnProperty(m)){var _e=u[m];if(_e!=null)switch(m){case"name":w=_e;break;case"type":D=_e;break;case"checked":oe=_e;break;case"defaultChecked":ge=_e;break;case"value":C=_e;break;case"defaultValue":Z=_e;break;case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(r(137,a));break;default:mn(s,a,m,_e,u,null)}}Dl(s,C,Z,oe,ge,D,w,!1);return;case"select":Ut("invalid",s),m=D=C=null;for(w in u)if(u.hasOwnProperty(w)&&(Z=u[w],Z!=null))switch(w){case"value":C=Z;break;case"defaultValue":D=Z;break;case"multiple":m=Z;default:mn(s,a,w,Z,u,null)}a=C,u=D,s.multiple=!!m,a!=null?Mi(s,!!m,a,!1):u!=null&&Mi(s,!!m,u,!0);return;case"textarea":Ut("invalid",s),C=w=m=null;for(D in u)if(u.hasOwnProperty(D)&&(Z=u[D],Z!=null))switch(D){case"value":m=Z;break;case"defaultValue":w=Z;break;case"children":C=Z;break;case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(91));break;default:mn(s,a,D,Z,u,null)}OE(s,m,w,C);return;case"option":for(oe in u)u.hasOwnProperty(oe)&&(m=u[oe],m!=null)&&(oe==="selected"?s.selected=m&&typeof m!="function"&&typeof m!="symbol":mn(s,a,oe,m,u,null));return;case"dialog":Ut("beforetoggle",s),Ut("toggle",s),Ut("cancel",s),Ut("close",s);break;case"iframe":case"object":Ut("load",s);break;case"video":case"audio":for(m=0;m<od.length;m++)Ut(od[m],s);break;case"image":Ut("error",s),Ut("load",s);break;case"details":Ut("toggle",s);break;case"embed":case"source":case"link":Ut("error",s),Ut("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in u)if(u.hasOwnProperty(ge)&&(m=u[ge],m!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:mn(s,a,ge,m,u,null)}return;default:if(hy(a)){for(_e in u)u.hasOwnProperty(_e)&&(m=u[_e],m!==void 0&&Jv(s,a,_e,m,u,void 0));return}}for(Z in u)u.hasOwnProperty(Z)&&(m=u[Z],m!=null&&mn(s,a,Z,m,u,null))}function I4(s,a,u,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,C=null,D=null,Z=null,oe=null,ge=null,_e=null;for(we in u){var Te=u[we];if(u.hasOwnProperty(we)&&Te!=null)switch(we){case"checked":break;case"value":break;case"defaultValue":oe=Te;default:m.hasOwnProperty(we)||mn(s,a,we,null,m,Te)}}for(var ve in m){var we=m[ve];if(Te=u[ve],m.hasOwnProperty(ve)&&(we!=null||Te!=null))switch(ve){case"type":C=we;break;case"name":w=we;break;case"checked":ge=we;break;case"defaultChecked":_e=we;break;case"value":D=we;break;case"defaultValue":Z=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,a));break;default:we!==Te&&mn(s,a,ve,we,m,Te)}}Ma(s,D,Z,oe,ge,_e,C,w);return;case"select":we=D=Z=ve=null;for(C in u)if(oe=u[C],u.hasOwnProperty(C)&&oe!=null)switch(C){case"value":break;case"multiple":we=oe;default:m.hasOwnProperty(C)||mn(s,a,C,null,m,oe)}for(w in m)if(C=m[w],oe=u[w],m.hasOwnProperty(w)&&(C!=null||oe!=null))switch(w){case"value":ve=C;break;case"defaultValue":Z=C;break;case"multiple":D=C;default:C!==oe&&mn(s,a,w,C,m,oe)}a=Z,u=D,m=we,ve!=null?Mi(s,!!u,ve,!1):!!m!=!!u&&(a!=null?Mi(s,!!u,a,!0):Mi(s,!!u,u?[]:"",!1));return;case"textarea":we=ve=null;for(Z in u)if(w=u[Z],u.hasOwnProperty(Z)&&w!=null&&!m.hasOwnProperty(Z))switch(Z){case"value":break;case"children":break;default:mn(s,a,Z,null,m,w)}for(D in m)if(w=m[D],C=u[D],m.hasOwnProperty(D)&&(w!=null||C!=null))switch(D){case"value":ve=w;break;case"defaultValue":we=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:w!==C&&mn(s,a,D,w,m,C)}_u(s,ve,we);return;case"option":for(var st in u)ve=u[st],u.hasOwnProperty(st)&&ve!=null&&!m.hasOwnProperty(st)&&(st==="selected"?s.selected=!1:mn(s,a,st,null,m,ve));for(oe in m)ve=m[oe],we=u[oe],m.hasOwnProperty(oe)&&ve!==we&&(ve!=null||we!=null)&&(oe==="selected"?s.selected=ve&&typeof ve!="function"&&typeof ve!="symbol":mn(s,a,oe,ve,m,we));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 xt in u)ve=u[xt],u.hasOwnProperty(xt)&&ve!=null&&!m.hasOwnProperty(xt)&&mn(s,a,xt,null,m,ve);for(ge in m)if(ve=m[ge],we=u[ge],m.hasOwnProperty(ge)&&ve!==we&&(ve!=null||we!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,a));break;default:mn(s,a,ge,ve,m,we)}return;default:if(hy(a)){for(var gn in u)ve=u[gn],u.hasOwnProperty(gn)&&ve!==void 0&&!m.hasOwnProperty(gn)&&Jv(s,a,gn,void 0,m,ve);for(_e in m)ve=m[_e],we=u[_e],!m.hasOwnProperty(_e)||ve===we||ve===void 0&&we===void 0||Jv(s,a,_e,ve,m,we);return}}for(var de in u)ve=u[de],u.hasOwnProperty(de)&&ve!=null&&!m.hasOwnProperty(de)&&mn(s,a,de,null,m,ve);for(Te in m)ve=m[Te],we=u[Te],!m.hasOwnProperty(Te)||ve===we||ve==null&&we==null||mn(s,a,Te,ve,m,we)}function A_(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function z4(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var w=u[m],C=w.transferSize,D=w.initiatorType,Z=w.duration;if(C&&Z&&A_(D)){for(D=0,Z=w.responseEnd,m+=1;m<u.length;m++){var oe=u[m],ge=oe.startTime;if(ge>Z)break;var _e=oe.transferSize,Te=oe.initiatorType;_e&&A_(Te)&&(oe=oe.responseEnd,D+=_e*(oe<Z?1:(Z-ge)/(oe-ge)))}if(--m,a+=8*(C+D)/(w.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var ex=null,tx=null;function Gh(s){return s.nodeType===9?s:s.ownerDocument}function D_(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function P_(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function nx(s,a){return s==="textarea"||s==="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 rx=null;function L4(){var s=window.event;return s&&s.type==="popstate"?s===rx?!1:(rx=s,!0):(rx=null,!1)}var I_=typeof setTimeout=="function"?setTimeout:void 0,$4=typeof clearTimeout=="function"?clearTimeout:void 0,z_=typeof Promise=="function"?Promise:void 0,F4=typeof queueMicrotask=="function"?queueMicrotask:typeof z_<"u"?function(s){return z_.resolve(null).then(s).catch(V4)}:I_;function V4(s){setTimeout(function(){throw s})}function Ki(s){return s==="head"}function L_(s,a){var u=a,m=0;do{var w=u.nextSibling;if(s.removeChild(u),w&&w.nodeType===8)if(u=w.data,u==="/$"||u==="/&"){if(m===0){s.removeChild(w),fc(a);return}m--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")m++;else if(u==="html")id(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,id(u);for(var C=u.firstChild;C;){var D=C.nextSibling,Z=C.nodeName;C[Pt]||Z==="SCRIPT"||Z==="STYLE"||Z==="LINK"&&C.rel.toLowerCase()==="stylesheet"||u.removeChild(C),C=D}}else u==="body"&&id(s.ownerDocument.body);u=w}while(u);fc(a)}function $_(s,a){var u=s;s=0;do{var m=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=m}while(u)}function ox(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":ox(u),Wt(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function U4(s,a,u,m){for(;s.nodeType===1;){var w=u;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[Pt])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(C=s.getAttribute("rel"),C==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(C!==w.rel||s.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||s.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||s.getAttribute("title")!==(w.title==null?null:w.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(C=s.getAttribute("src"),(C!==(w.src==null?null:w.src)||s.getAttribute("type")!==(w.type==null?null:w.type)||s.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&C&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var C=w.name==null?null:""+w.name;if(w.type==="hidden"&&s.getAttribute("name")===C)return s}else return s;if(s=Po(s.nextSibling),s===null)break}return null}function H4(s,a,u){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=Po(s.nextSibling),s===null))return null;return s}function F_(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Po(s.nextSibling),s===null))return null;return s}function sx(s){return s.data==="$?"||s.data==="$~"}function ix(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function B4(s,a){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||u.readyState!=="loading")a();else{var m=function(){a(),u.removeEventListener("DOMContentLoaded",m)};u.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function Po(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var ax=null;function V_(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(a===0)return Po(s.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}s=s.nextSibling}return null}function U_(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return s;a--}else u!=="/$"&&u!=="/&"||a++}s=s.previousSibling}return null}function H_(s,a,u){switch(a=Gh(u),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function id(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Wt(s)}var Io=new Map,B_=new Set;function Kh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var ci=P.d;P.d={f:q4,r:Y4,D:Z4,C:G4,L:K4,m:X4,X:W4,S:Q4,M:J4};function q4(){var s=ci.f(),a=Fh();return s||a}function Y4(s){var a=en(s);a!==null&&a.tag===5&&a.type==="form"?aC(a):ci.r(s)}var cc=typeof document>"u"?null:document;function q_(s,a,u){var m=cc;if(m&&typeof a=="string"&&a){var w=_r(a);w='link[rel="'+s+'"][href="'+w+'"]',typeof u=="string"&&(w+='[crossorigin="'+u+'"]'),B_.has(w)||(B_.add(w),s={rel:s,crossOrigin:u,href:a},m.querySelector(w)===null&&(a=m.createElement("link"),Tr(a,"link",s),Kt(a),m.head.appendChild(a)))}}function Z4(s){ci.D(s),q_("dns-prefetch",s,null)}function G4(s,a){ci.C(s,a),q_("preconnect",s,a)}function K4(s,a,u){ci.L(s,a,u);var m=cc;if(m&&s&&a){var w='link[rel="preload"][as="'+_r(a)+'"]';a==="image"&&u&&u.imageSrcSet?(w+='[imagesrcset="'+_r(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(w+='[imagesizes="'+_r(u.imageSizes)+'"]')):w+='[href="'+_r(s)+'"]';var C=w;switch(a){case"style":C=uc(s);break;case"script":C=dc(s)}Io.has(C)||(s=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:s,as:a},u),Io.set(C,s),m.querySelector(w)!==null||a==="style"&&m.querySelector(ad(C))||a==="script"&&m.querySelector(ld(C))||(a=m.createElement("link"),Tr(a,"link",s),Kt(a),m.head.appendChild(a)))}}function X4(s,a){ci.m(s,a);var u=cc;if(u&&s){var m=a&&typeof a.as=="string"?a.as:"script",w='link[rel="modulepreload"][as="'+_r(m)+'"][href="'+_r(s)+'"]',C=w;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=dc(s)}if(!Io.has(C)&&(s=g({rel:"modulepreload",href:s},a),Io.set(C,s),u.querySelector(w)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ld(C)))return}m=u.createElement("link"),Tr(m,"link",s),Kt(m),u.head.appendChild(m)}}}function Q4(s,a,u){ci.S(s,a,u);var m=cc;if(m&&s){var w=Fn(m).hoistableStyles,C=uc(s);a=a||"default";var D=w.get(C);if(!D){var Z={loading:0,preload:null};if(D=m.querySelector(ad(C)))Z.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},u),(u=Io.get(C))&&lx(s,u);var oe=D=m.createElement("link");Kt(oe),Tr(oe,"link",s),oe._p=new Promise(function(ge,_e){oe.onload=ge,oe.onerror=_e}),oe.addEventListener("load",function(){Z.loading|=1}),oe.addEventListener("error",function(){Z.loading|=2}),Z.loading|=4,Xh(D,a,m)}D={type:"stylesheet",instance:D,count:1,state:Z},w.set(C,D)}}}function W4(s,a){ci.X(s,a);var u=cc;if(u&&s){var m=Fn(u).hoistableScripts,w=dc(s),C=m.get(w);C||(C=u.querySelector(ld(w)),C||(s=g({src:s,async:!0},a),(a=Io.get(w))&&cx(s,a),C=u.createElement("script"),Kt(C),Tr(C,"link",s),u.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},m.set(w,C))}}function J4(s,a){ci.M(s,a);var u=cc;if(u&&s){var m=Fn(u).hoistableScripts,w=dc(s),C=m.get(w);C||(C=u.querySelector(ld(w)),C||(s=g({src:s,async:!0,type:"module"},a),(a=Io.get(w))&&cx(s,a),C=u.createElement("script"),Kt(C),Tr(C,"link",s),u.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},m.set(w,C))}}function Y_(s,a,u,m){var w=(w=te.current)?Kh(w):null;if(!w)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=uc(u.href),u=Fn(w).hoistableStyles,m=u.get(a),m||(m={type:"style",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=uc(u.href);var C=Fn(w).hoistableStyles,D=C.get(s);if(D||(w=w.ownerDocument||w,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(s,D),(C=w.querySelector(ad(s)))&&!C._p&&(D.instance=C,D.state.loading=5),Io.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Io.set(s,u),C||e3(w,s,u,D.state))),a&&m===null)throw Error(r(528,""));return D}if(a&&m!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=dc(u),u=Fn(w).hoistableScripts,m=u.get(a),m||(m={type:"script",instance:null,count:0,state:null},u.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function uc(s){return'href="'+_r(s)+'"'}function ad(s){return'link[rel="stylesheet"]['+s+"]"}function Z_(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function e3(s,a,u,m){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=s.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),Tr(a,"link",u),Kt(a),s.head.appendChild(a))}function dc(s){return'[src="'+_r(s)+'"]'}function ld(s){return"script[async]"+s}function G_(s,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var m=s.querySelector('style[data-href~="'+_r(u.href)+'"]');if(m)return a.instance=m,Kt(m),m;var w=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),Kt(m),Tr(m,"style",w),Xh(m,u.precedence,s),a.instance=m;case"stylesheet":w=uc(u.href);var C=s.querySelector(ad(w));if(C)return a.state.loading|=4,a.instance=C,Kt(C),C;m=Z_(u),(w=Io.get(w))&&lx(m,w),C=(s.ownerDocument||s).createElement("link"),Kt(C);var D=C;return D._p=new Promise(function(Z,oe){D.onload=Z,D.onerror=oe}),Tr(C,"link",m),a.state.loading|=4,Xh(C,u.precedence,s),a.instance=C;case"script":return C=dc(u.src),(w=s.querySelector(ld(C)))?(a.instance=w,Kt(w),w):(m=u,(w=Io.get(C))&&(m=g({},u),cx(m,w)),s=s.ownerDocument||s,w=s.createElement("script"),Kt(w),Tr(w,"link",m),s.head.appendChild(w),a.instance=w);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,Xh(m,u.precedence,s));return a.instance}function Xh(s,a,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=m.length?m[m.length-1]:null,C=w,D=0;D<m.length;D++){var Z=m[D];if(Z.dataset.precedence===a)C=Z;else if(C!==w)break}C?C.parentNode.insertBefore(s,C.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(s,a.firstChild))}function lx(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function cx(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Qh=null;function K_(s,a,u){if(Qh===null){var m=new Map,w=Qh=new Map;w.set(u,m)}else w=Qh,m=w.get(u),m||(m=new Map,w.set(u,m));if(m.has(s))return m;for(m.set(s,null),u=u.getElementsByTagName(s),w=0;w<u.length;w++){var C=u[w];if(!(C[Pt]||C[Be]||s==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var D=C.getAttribute(a)||"";D=s+D;var Z=m.get(D);Z?Z.push(C):m.set(D,[C])}}return m}function X_(s,a,u){s=s.ownerDocument||s,s.head.insertBefore(u,a==="title"?s.querySelector("head > title"):null)}function t3(s,a,u){if(u===1||a.itemProp!=null)return!1;switch(s){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;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!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 Q_(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function n3(s,a,u,m){if(u.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var w=uc(m.href),C=a.querySelector(ad(w));if(C){a=C._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Wh.bind(s),a.then(s,s)),u.state.loading|=4,u.instance=C,Kt(C);return}C=a.ownerDocument||a,m=Z_(m),(w=Io.get(w))&&lx(m,w),C=C.createElement("link"),Kt(C);var D=C;D._p=new Promise(function(Z,oe){D.onload=Z,D.onerror=oe}),Tr(C,"link",m),u.instance=C}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Wh.bind(s),a.addEventListener("load",u),a.addEventListener("error",u))}}var ux=0;function r3(s,a){return s.stylesheets&&s.count===0&&ep(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var m=setTimeout(function(){if(s.stylesheets&&ep(s,s.stylesheets),s.unsuspend){var C=s.unsuspend;s.unsuspend=null,C()}},6e4+a);0<s.imgBytes&&ux===0&&(ux=62500*z4());var w=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&ep(s,s.stylesheets),s.unsuspend)){var C=s.unsuspend;s.unsuspend=null,C()}},(s.imgBytes>ux?50:800)+a);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(w)}}:null}function Wh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Jh=null;function ep(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Jh=new Map,a.forEach(o3,s),Jh=null,Wh.call(s))}function o3(s,a){if(!(a.state.loading&4)){var u=Jh.get(s);if(u)var m=u.get(null);else{u=new Map,Jh.set(s,u);for(var w=s.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<w.length;C++){var D=w[C];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(u.set(D.dataset.precedence,D),m=D)}m&&u.set(null,m)}w=a.instance,D=w.getAttribute("data-precedence"),C=u.get(D)||m,C===m&&u.set(null,w),u.set(D,w),this.count++,m=Wh.bind(this),w.addEventListener("load",m),w.addEventListener("error",m),C?C.parentNode.insertBefore(w,C.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(w,s.firstChild)),a.state.loading|=4}}var cd={$$typeof:R,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function s3(s,a,u,m,w,C,D,Z,oe){this.tag=1,this.containerInfo=s,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=Dt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dt(0),this.hiddenUpdates=Dt(null),this.identifierPrefix=m,this.onUncaughtError=w,this.onCaughtError=C,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function W_(s,a,u,m,w,C,D,Z,oe,ge,_e,Te){return s=new s3(s,a,u,D,oe,ge,_e,Te,Z),a=1,C===!0&&(a|=24),C=po(3,null,null,a),s.current=C,C.stateNode=s,a=Hy(),a.refCount++,s.pooledCache=a,a.refCount++,C.memoizedState={element:m,isDehydrated:u,cache:a},Zy(C),s}function J_(s){return s?(s=Ul,s):Ul}function eR(s,a,u,m,w,C){w=J_(w),m.context===null?m.context=w:m.pendingContext=w,m=Li(a),m.payload={element:u},C=C===void 0?null:C,C!==null&&(m.callback=C),u=$i(s,m,a),u!==null&&(no(u,s,a),Vu(u,s,a))}function tR(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function dx(s,a){tR(s,a),(s=s.alternate)&&tR(s,a)}function nR(s){if(s.tag===13||s.tag===31){var a=Pa(s,67108864);a!==null&&no(a,s,67108864),dx(s,67108864)}}function rR(s){if(s.tag===13||s.tag===31){var a=xo();a=se(a);var u=Pa(s,a);u!==null&&no(u,s,a),dx(s,a)}}var tp=!0;function i3(s,a,u,m){var w=A.T;A.T=null;var C=P.p;try{P.p=2,fx(s,a,u,m)}finally{P.p=C,A.T=w}}function a3(s,a,u,m){var w=A.T;A.T=null;var C=P.p;try{P.p=8,fx(s,a,u,m)}finally{P.p=C,A.T=w}}function fx(s,a,u,m){if(tp){var w=hx(m);if(w===null)Wv(s,a,m,np,u),sR(s,m);else if(c3(w,s,a,u,m))m.stopPropagation();else if(sR(s,m),a&4&&-1<l3.indexOf(s)){for(;w!==null;){var C=en(w);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var D=bt(C.pendingLanes);if(D!==0){var Z=C;for(Z.pendingLanes|=2,Z.entangledLanes|=2;D;){var oe=1<<31-be(D);Z.entanglements[1]|=oe,D&=~oe}Es(C),(on&6)===0&&(Lh=me()+500,rd(0))}}break;case 31:case 13:Z=Pa(C,2),Z!==null&&no(Z,C,2),Fh(),dx(C,2)}if(C=hx(m),C===null&&Wv(s,a,m,np,u),C===w)break;w=C}w!==null&&m.stopPropagation()}else Wv(s,a,m,null,u)}}function hx(s){return s=my(s),px(s)}var np=null;function px(s){if(np=null,s=Sn(s),s!==null){var a=i(s);if(a===null)s=null;else{var u=a.tag;if(u===13){if(s=l(a),s!==null)return s;s=null}else if(u===31){if(s=c(a),s!==null)return s;s=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return np=s,null}function oR(s){switch(s){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(xe()){case We:return 2;case Oe:return 8;case Ie:case at:return 32;case it:return 268435456;default:return 32}default:return 32}}var mx=!1,Xi=null,Qi=null,Wi=null,ud=new Map,dd=new Map,Ji=[],l3="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 sR(s,a){switch(s){case"focusin":case"focusout":Xi=null;break;case"dragenter":case"dragleave":Qi=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":ud.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":dd.delete(a.pointerId)}}function fd(s,a,u,m,w,C){return s===null||s.nativeEvent!==C?(s={blockedOn:a,domEventName:u,eventSystemFlags:m,nativeEvent:C,targetContainers:[w]},a!==null&&(a=en(a),a!==null&&nR(a)),s):(s.eventSystemFlags|=m,a=s.targetContainers,w!==null&&a.indexOf(w)===-1&&a.push(w),s)}function c3(s,a,u,m,w){switch(a){case"focusin":return Xi=fd(Xi,s,a,u,m,w),!0;case"dragenter":return Qi=fd(Qi,s,a,u,m,w),!0;case"mouseover":return Wi=fd(Wi,s,a,u,m,w),!0;case"pointerover":var C=w.pointerId;return ud.set(C,fd(ud.get(C)||null,s,a,u,m,w)),!0;case"gotpointercapture":return C=w.pointerId,dd.set(C,fd(dd.get(C)||null,s,a,u,m,w)),!0}return!1}function iR(s){var a=Sn(s.target);if(a!==null){var u=i(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){s.blockedOn=a,Ne(s.priority,function(){rR(u)});return}}else if(a===31){if(a=c(u),a!==null){s.blockedOn=a,Ne(s.priority,function(){rR(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function rp(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var u=hx(s.nativeEvent);if(u===null){u=s.nativeEvent;var m=new u.constructor(u.type,u);py=m,u.target.dispatchEvent(m),py=null}else return a=en(u),a!==null&&nR(a),s.blockedOn=u,!1;a.shift()}return!0}function aR(s,a,u){rp(s)&&u.delete(a)}function u3(){mx=!1,Xi!==null&&rp(Xi)&&(Xi=null),Qi!==null&&rp(Qi)&&(Qi=null),Wi!==null&&rp(Wi)&&(Wi=null),ud.forEach(aR),dd.forEach(aR)}function op(s,a){s.blockedOn===a&&(s.blockedOn=null,mx||(mx=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,u3)))}var sp=null;function lR(s){sp!==s&&(sp=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){sp===s&&(sp=null);for(var a=0;a<s.length;a+=3){var u=s[a],m=s[a+1],w=s[a+2];if(typeof m!="function"){if(px(m||u)===null)continue;break}var C=en(u);C!==null&&(s.splice(a,3),a-=3,hv(C,{pending:!0,data:w,method:u.method,action:m},m,w))}}))}function fc(s){function a(oe){return op(oe,s)}Xi!==null&&op(Xi,s),Qi!==null&&op(Qi,s),Wi!==null&&op(Wi,s),ud.forEach(a),dd.forEach(a);for(var u=0;u<Ji.length;u++){var m=Ji[u];m.blockedOn===s&&(m.blockedOn=null)}for(;0<Ji.length&&(u=Ji[0],u.blockedOn===null);)iR(u),u.blockedOn===null&&Ji.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var w=u[m],C=u[m+1],D=w[Ge]||null;if(typeof C=="function")D||lR(u);else if(D){var Z=null;if(C&&C.hasAttribute("formAction")){if(w=C,D=C[Ge]||null)Z=D.formAction;else if(px(w)!==null)continue}else Z=D.action;typeof Z=="function"?u[m+1]=Z:(u.splice(m,3),m-=3),lR(u)}}}function cR(){function s(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(D){return w=D})},focusReset:"manual",scroll:"manual"})}function a(){w!==null&&(w(),w=null),m||setTimeout(u,20)}function u(){if(!m&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,w=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),w!==null&&(w(),w=null)}}}function gx(s){this._internalRoot=s}ip.prototype.render=gx.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,m=xo();eR(u,m,s,a,null,null)},ip.prototype.unmount=gx.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;eR(s.current,2,null,s,null,null),Fh(),a[Ke]=null}};function ip(s){this._internalRoot=s}ip.prototype.unstable_scheduleHydration=function(s){if(s){var a=Ce();s={blockedOn:null,target:s,priority:a};for(var u=0;u<Ji.length&&a!==0&&a<Ji[u].priority;u++);Ji.splice(u,0,s),u===0&&iR(s)}};var uR=t.version;if(uR!=="19.2.8")throw Error(r(527,uR,"19.2.8"));P.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=d(a),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var d3={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ap=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ap.isDisabled&&ap.supportsFiber)try{ie=ap.inject(d3),ae=ap}catch{}}return pd.createRoot=function(s,a){if(!o(s))throw Error(r(299));var u=!1,m="",w=yC,C=vC,D=xC;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(w=a.onUncaughtError),a.onCaughtError!==void 0&&(C=a.onCaughtError),a.onRecoverableError!==void 0&&(D=a.onRecoverableError)),a=W_(s,1,!1,null,null,u,m,null,w,C,D,cR),s[Ke]=a.current,Qv(s),new gx(a)},pd.hydrateRoot=function(s,a,u){if(!o(s))throw Error(r(299));var m=!1,w="",C=yC,D=vC,Z=xC,oe=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(w=u.identifierPrefix),u.onUncaughtError!==void 0&&(C=u.onUncaughtError),u.onCaughtError!==void 0&&(D=u.onCaughtError),u.onRecoverableError!==void 0&&(Z=u.onRecoverableError),u.formState!==void 0&&(oe=u.formState)),a=W_(s,1,!0,a,u??null,m,w,oe,C,D,Z,cR),a.context=J_(null),u=a.current,m=xo(),m=se(m),w=Li(m),w.callback=null,$i(u,w,m),u=m,a.current.lanes=u,St(a,u),Es(a),s[Ke]=a.current,Qv(s),new ip(a)},pd.version="19.2.8",pd}var bR;function w3(){if(bR)return xx.exports;bR=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(t){console.error(t)}}return e(),xx.exports=b3(),xx.exports}var S3=w3(),cu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},E3=class extends cu{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},U0=new E3,C3={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_3=class{#e=C3;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},el=new _3;function R3(e){setTimeout(e,0)}var j3=typeof window>"u"||"Deno"in globalThis;function Yr(){}function N3(e,t){return typeof e=="function"?e(t):e}function wb(e){return typeof e=="number"&&e>=0&&e!==1/0}function tM(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pa(e,t){return typeof e=="function"?e(t):e}function bo(e,t){return typeof e=="function"?e(t):e}function wR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:l,stale:c}=e;if(l){if(r){if(t.queryHash!==H0(l,t.options))return!1}else if(!Bc(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||o&&o!==t.state.fetchStatus||i&&!i(t))}function SR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(il(t.options.mutationKey)!==il(i))return!1}else if(!Bc(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function H0(e,t){return(t?.queryKeyHashFn||il)(e)}function il(e){return JSON.stringify(e,(t,n)=>Sb(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Bc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r<t.length;r++)if(!Bc(e[r],t[r]))return!1;return!0}const n=Object.keys(t);for(const r of n)if(!Bc(e[r],t[r]))return!1;return!0}return!1}var T3=Object.prototype.hasOwnProperty;function nM(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ER(e)&&ER(t);if(!r&&!(Sb(e)&&Sb(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),c=l.length,f=r?new Array(c):{};let d=0;for(let p=0;p<c;p++){const g=r?p:l[p],y=e[g],v=t[g];if(y===v){f[g]=y,(r?p<i:T3.call(e,g))&&d++;continue}if(y===null||v===null||typeof y!="object"||typeof v!="object"){f[g]=v;continue}const x=nM(y,v,n+1);f[g]=x,x===y&&d++}return i===c&&d===i?e:f}function fm(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ER(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sb(e){if(!CR(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!CR(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function CR(e){return Object.prototype.toString.call(e)==="[object Object]"}function O3(e){return new Promise(t=>{el.setTimeout(t,e)})}function Eb(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?nM(e,t):t}function B0(e){return e}function M3(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function k3(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var q0=Symbol();function rM(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===q0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Y0(e,t){return typeof e=="function"?e(...t):!!e}function A3(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var Yd=(()=>{let e=()=>j3;return{isServer(){return e()},setIsServer(t){e=t}}})();function Cb(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var D3=R3;function P3(){let e=[],t=0,n=c=>{c()},r=c=>{c()},o=D3;const i=c=>{t?e.push(c):o(()=>{n(c)})},l=()=>{const c=e;e=[],c.length&&o(()=>{r(()=>{c.forEach(f=>{n(f)})})})};return{batch:c=>{let f;t++;try{f=c()}finally{t--,t||l()}return f},batchCalls:c=>(...f)=>{i(()=>{c(...f)})},schedule:i,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{o=c}}}var fr=P3(),I3=class extends cu{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},hm=new I3;function z3(e){return Math.min(1e3*2**e,3e4)}function oM(e){return(e??"online")==="online"?hm.isOnline():!0}var _b=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function sM(e){let t=!1,n=0,r;const o=Cb(),i=()=>o.status!=="pending",l=E=>{if(!i()){const S=new _b(E);y(S),e.onCancel?.(S)}},c=()=>{t=!0},f=()=>{t=!1},d=()=>U0.isFocused()&&(e.networkMode==="always"||hm.isOnline())&&e.canRun(),p=()=>oM(e.networkMode)&&e.canRun(),g=E=>{i()||(r?.(),o.resolve(E))},y=E=>{i()||(r?.(),o.reject(E))},v=()=>new Promise(E=>{r=S=>{(i()||d())&&E(S)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),x=()=>{if(i())return;let E;const S=n===0?e.initialPromise:void 0;try{E=S??e.fn()}catch(_){E=Promise.reject(_)}Promise.resolve(E).then(g).catch(_=>{if(i())return;const j=e.retry??(Yd.isServer()?0:3),R=e.retryDelay??z3,N=typeof R=="function"?R(n,_):R,O=j===!0||typeof j=="number"&&n<j||typeof j=="function"&&j(n,_);if(t||!O){y(_);return}n++,e.onFail?.(n,_),O3(N).then(()=>d()?void 0:v()).then(()=>{t?y(_):x()})})};return{promise:o,status:()=>o.status,cancel:l,continue:()=>(r?.(),o),cancelRetry:c,continueRetry:f,canStart:p,start:()=>(p()?x():v().then(x),o)}}var iM=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wb(this.gcTime)&&(this.#e=el.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yd.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(el.clearTimeout(this.#e),this.#e=void 0)}};function L3(e){return{onFetch:(t,n)=>{const r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},f=0;const d=async()=>{let p=!1;const g=x=>{A3(x,()=>t.signal,()=>p=!0)},y=rM(t.options,t.fetchOptions),v=async(x,E,S)=>{if(p)return Promise.reject(t.signal.reason);if(E==null&&x.pages.length)return Promise.resolve(x);const j=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:E,direction:S?"backward":"forward",meta:t.options.meta};return g(k),k})(),R=await y(j),{maxPages:N}=t.options,O=S?k3:M3;return{pages:O(x.pages,R,N),pageParams:O(x.pageParams,E,N)}};if(o&&i.length){const x=o==="backward",E=x?$3:_R,S={pages:i,pageParams:l},_=E(r,S);c=await v(S,_,x)}else{const x=e??i.length;do{const E=f===0?l[0]??r.initialPageParam:_R(r,c);if(f>0&&E==null)break;c=await v(c,E),f++}while(f<x)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=d}}}function _R(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function $3(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var F3=class extends iM{#e;#t;#n;#r;#s;#o;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#r=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=jR(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#o?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=jR(this.options);t.data!==void 0&&(this.setState(RR(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=Eb(this.state.data,e,this.options);return this.#l({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:"setState",state:e})}cancel(e){const t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(Yr).catch(Yr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>bo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===q0||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>pa(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!tM(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#o&&(this.#i||this.#u()?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#o?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(d=>d.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,r=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},o=()=>{const f=rM(this.options,t),p=(()=>{const g={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(g),g})();return this.#i=!1,this.options.persister?this.options.persister(f,p,this):f(p)},l=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:o};return r(f),f})();(this.#e==="infinite"?L3(this.options.pages):this.options.behavior)?.onFetch(l,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#l({type:"fetch",meta:l.fetchOptions?.meta}),this.#o=sM({initialPromise:t?.initialPromise,fn:l.fetchFn,onCancel:f=>{f instanceof _b&&f.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(f,d)=>{this.#l({type:"failed",failureCount:f,error:d})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const f=await this.#o.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#r.config.onSuccess?.(f,this),this.#r.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof _b){if(f.silent)return this.#o.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#l({type:"error",error:f}),this.#r.config.onError?.(f,this),this.#r.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#l(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...aM(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...RR(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),fr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function aM(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:oM(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function RR(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jR(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var V3=class extends cu{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#a=Cb(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#s;#o;#a;#i;#u;#l;#p;#d;#f;#c;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),NR(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rb(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rb(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof bo(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!fm(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&TR(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||bo(this.options.enabled,this.#t)!==bo(t.enabled,this.#t)||pa(this.options.staleTime,this.#t)!==pa(t.staleTime,this.#t))&&this.#g();const o=this.#y();r&&(this.#t!==n||bo(this.options.enabled,this.#t)!==bo(t.enabled,this.#t)||o!==this.#c)&&this.#v(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return H3(this,n)&&(this.#r=n,this.#o=this.options,this.#s=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Yr)),t}#g(){this.#b();const e=pa(this.options.staleTime,this.#t);if(Yd.isServer()||this.#r.isStale||!wb(e))return;const n=tM(this.#r.dataUpdatedAt,e)+1;this.#d=el.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#c=e,!(Yd.isServer()||bo(this.options.enabled,this.#t)===!1||!wb(this.#c)||this.#c===0)&&(this.#f=el.setInterval(()=>{(this.options.refetchIntervalInBackground||U0.isFocused())&&this.#h()},this.#c))}#x(){this.#g(),this.#v(this.#y())}#b(){this.#d!==void 0&&(el.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(el.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const n=this.#t,r=this.options,o=this.#r,i=this.#s,l=this.#o,f=e!==n?e.state:this.#n,{state:d}=e;let p={...d},g=!1,y;if(t._optimisticResults){const T=this.hasListeners(),L=!T&&NR(e,t),G=T&&TR(e,n,t,r);(L||G)&&(p={...p,...aM(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:x,status:E}=p;y=p.data;let S=!1;if(t.placeholderData!==void 0&&y===void 0&&E==="pending"){let T;o?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(T=o.data,S=!0):T=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,T!==void 0&&(E="success",y=Eb(o?.data,T,t),g=!0)}if(t.select&&y!==void 0&&!S)if(o&&y===i?.data&&t.select===this.#u)y=this.#l;else try{this.#u=t.select,y=t.select(y),y=Eb(o?.data,y,t),this.#l=y,this.#i=null}catch(T){this.#i=T}this.#i&&(v=this.#i,y=this.#l,x=Date.now(),E="error");const _=p.fetchStatus==="fetching",j=E==="pending",R=E==="error",N=j&&_,O=y!==void 0,M={status:E,fetchStatus:p.fetchStatus,isPending:j,isSuccess:E==="success",isError:R,isInitialLoading:N,isLoading:N,data:y,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:x,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:_,isRefetching:_&&!j,isLoadingError:R&&!O,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:R&&O,isStale:Z0(e,t),refetch:this.refetch,promise:this.#a,isEnabled:bo(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const T=M.data!==void 0,L=M.status==="error"&&!T,G=q=>{L?q.reject(M.error):T&&q.resolve(M.data)},B=()=>{const q=this.#a=M.promise=Cb();G(q)},V=this.#a;switch(V.status){case"pending":e.queryHash===n.queryHash&&G(V);break;case"fulfilled":(L||M.data!==V.value)&&B();break;case"rejected":(!L||M.error!==V.reason)&&B();break}}return M}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#o=this.options,this.#s.data!==void 0&&(this.#p=this.#t),fm(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#m.size)return!0;const i=new Set(o??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(l=>{const c=l;return this.#r[c]!==e[c]&&i.has(c)})};this.#E({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#E(e){fr.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function U3(e,t){return bo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&bo(t.retryOnMount,e)===!1)}function NR(e,t){return U3(e,t)||e.state.data!==void 0&&Rb(e,t,t.refetchOnMount)}function Rb(e,t,n){if(bo(t.enabled,e)!==!1&&pa(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Z0(e,t)}return!1}function TR(e,t,n,r){return(e!==t||bo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Z0(e,n)}function Z0(e,t){return bo(t.enabled,e)!==!1&&e.isStaleByTime(pa(t.staleTime,e))}function H3(e,t){return!fm(e.getCurrentResult(),t)}var B3=class extends iM{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||lM(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=sM({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,l)=>{this.#s({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",o=!this.#r.canStart();try{if(r)t();else{this.#s({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const l=await this.options.onMutate?.(e,n);l!==this.state.context&&this.#s({type:"pending",context:l,variables:e,isPaused:o})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#s({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(l){Promise.reject(l)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(l){Promise.reject(l)}throw this.#s({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),fr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function lM(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var q3=class extends cu{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new B3({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=lp(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=lp(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=lp(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=lp(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){fr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>SR(t,n))}findAll(e={}){return this.getAll().filter(t=>SR(e,t))}notify(e){fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return fr.batch(()=>Promise.all(e.map(t=>t.continue().catch(Yr))))}};function lp(e){return e.options.scope?.id}var Y3=class extends cu{#e;#t=void 0;#n;#r;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),fm(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&il(n.mutationKey)!==il(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#o()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#s(){const t=this.#n?.state??lM();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){fr.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,n,r,o)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,n,r,o)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,n,r,o)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,n,r,o)}catch(i){Promise.reject(i)}}}this.listeners.forEach(n=>{n(this.#t)})})}},Z3=class extends cu{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,o=t.queryHash??H0(r,t);let i=this.get(o);return i||(i=new F3({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){fr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>wR(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>wR(e,n)):t}notify(e){fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},G3=class{#e;#t;#n;#r;#s;#o;#a;#i;constructor(e={}){this.#e=e.queryCache||new Z3,this.#t=e.mutationCache||new q3,this.#n=e.defaultOptions||{},this.#r=new Map,this.#s=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=U0.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=hm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pa(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,l=N3(t,i);if(l!==void 0)return this.#e.build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return fr.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;fr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return fr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=fr.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Yr).catch(Yr)}invalidateQueries(e,t={}){return fr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=fr.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Yr)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Yr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(pa(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yr).catch(Yr)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yr).catch(Yr)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return hm.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(il(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Bc(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(il(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{Bc(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=H0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===q0&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},cM=b.createContext(void 0),sn=e=>{const t=b.useContext(cM);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},K3=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(cM.Provider,{value:e,children:t})),uM=b.createContext(!1),X3=()=>b.useContext(uM);uM.Provider;function Q3(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var W3=b.createContext(Q3()),J3=()=>b.useContext(W3),e$=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Y0(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},t$=e=>{b.useEffect(()=>{e.clearReset()},[e])},n$=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Y0(n,[e.error,r])),r$=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},o$=(e,t)=>e.isLoading&&e.isFetching&&!t,s$=(e,t)=>e?.suspense&&t.isPending,OR=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function i$(e,t,n){const r=X3(),o=J3(),i=sn(),l=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(l);const c=i.getQueryCache().get(l.queryHash),f=e.subscribed!==!1;l._optimisticResults=r?"isRestoring":f?"optimistic":void 0,r$(l),e$(l,o,c),t$(o);const d=!i.getQueryCache().get(l.queryHash),[p]=b.useState(()=>new t(i,l)),g=p.getOptimisticResult(l),y=!r&&f;if(b.useSyncExternalStore(b.useCallback(v=>{const x=y?p.subscribe(fr.batchCalls(v)):Yr;return p.updateResult(),x},[p,y]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),b.useEffect(()=>{p.setOptions(l)},[l,p]),s$(l,g))throw OR(l,p,o);if(n$({result:g,errorResetBoundary:o,throwOnError:l.throwOnError,query:c,suspense:l.suspense}))throw g.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(l,g),l.experimental_prefetchInRender&&!Yd.isServer()&&o$(g,r)&&(d?OR(l,p,o):c?.promise)?.catch(Yr).finally(()=>{p.updateResult()}),l.notifyOnChangeProps?g:p.trackResult(g)}function co(e,t){return i$(e,V3)}function un(e,t){const n=sn(),[r]=b.useState(()=>new Y3(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const o=b.useSyncExternalStore(b.useCallback(l=>r.subscribe(fr.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=b.useCallback((l,c)=>{r.mutate(l,c).catch(Yr)},[r]);if(o.error&&Y0(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}var dM=e=>{throw TypeError(e)},fM=(e,t,n)=>t.has(e)||dM("Cannot "+n),zo=(e,t,n)=>(fM(e,t,"read from private field"),n?n.call(e):t.get(e)),Nd=(e,t,n)=>t.has(e)?dM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Cs=(e,t,n,r)=>(fM(e,t,"write to private field"),t.set(e,n),n),og=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,G0=/^[\\/]{2}/;function hM(e,t){return t+e.replace(/\\/g,"/")}var MR="popstate";function kR(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function a$(e={}){function t(r,o){let i=o.state?.masked,{pathname:l,search:c,hash:f}=i||r.location;return Zd("",{pathname:l,search:c,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:$s(o)}return c$(t,n,null,e)}function Lt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function l$(){return Math.random().toString(36).substring(2,10)}function AR(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Zd(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Fs(t):t,state:n,key:t&&t.key||r||l$(),mask:o}}function $s({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Fs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function c$(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,l=o.history,c="POP",f=null,d=p();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function p(){return(l.state||{idx:null}).idx}function g(){c="POP";let S=p(),_=S==null?null:S-d;d=S,f&&f({action:c,location:E.location,delta:_})}function y(S,_){c="PUSH";let j=kR(S)?S:Zd(E.location,S,_);d=p()+1;let R=AR(j,d),N=E.createHref(j.mask||j);try{l.pushState(R,"",N)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;o.location.assign(N)}i&&f&&f({action:c,location:E.location,delta:1})}function v(S,_){c="REPLACE";let j=kR(S)?S:Zd(E.location,S,_);d=p();let R=AR(j,d),N=E.createHref(j.mask||j);l.replaceState(R,"",N),i&&f&&f({action:c,location:E.location,delta:0})}function x(S){return pM(o,S)}let E={get action(){return c},get location(){return e(o,l)},listen(S){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(MR,g),f=S,()=>{o.removeEventListener(MR,g),f=null}},createHref(S){return t(o,S)},createURL:x,encodeLocation(S){let _=x(S);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:y,replace:v,go(S){return l.go(S)}};return E}function pM(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Lt(r,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:$s(t);return o=o.replace(/ $/,"%20"),!n&&G0.test(o)&&(o=r+o),new URL(o,r)}var Td,DR=class{constructor(e){if(Nd(this,Td,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(zo(this,Td).has(e))return zo(this,Td).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){zo(this,Td).set(e,t)}};Td=new WeakMap;var u$=new Set(["lazy","caseSensitive","path","id","index","children"]);function d$(e){return u$.has(e)}var f$=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function h$(e){return f$.has(e)}function p$(e){return e.index===!0}function Gd(e,t,n=[],r={},o=!1){return e.map((i,l)=>{let c=[...n,String(l)],f=typeof i.id=="string"?i.id:c.join("-");if(Lt(i.index!==!0||!i.children,"Cannot specify children on an index route"),Lt(o||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),p$(i)){let d={...i,id:f};return r[f]=PR(d,t(d)),d}else{let d={...i,id:f,children:void 0};return r[f]=PR(d,t(d)),i.children&&(d.children=Gd(i.children,t,c,r,o)),d}})}function PR(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function mM(e,t,n="/"){return Wo(e,t,n,!1)}function Wo(e,t,n,r,o){let i=typeof t=="string"?Fs(t):t,l=lo(i.pathname||"/",n);if(l==null)return null;let c=o??Kp(e),f=null,d=_$(l);for(let p=0;f==null&&p<c.length;++p)f=C$(c[p],d,r);return f}function gM(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Kp(e){let t=yM(e);return m$(t),t}function yM(e,t=[],n=[],r="",o=!1){let i=(l,c,f=o,d)=>{let p={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&f)return;Lt(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let g=Vo([r,p.relativePath]),y=n.concat(p);l.children&&l.children.length>0&&(Lt(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),yM(l.children,t,y,g,f)),!(l.path==null&&!l.index)&&t.push({path:g,score:S$(g,l.index),routesMeta:y.map((v,x)=>{let[E,S]=bM(v.relativePath,v.caseSensitive,x===y.length-1);return{...v,matcher:E,compiledParams:S}})})};return e.forEach((l,c)=>{if(l.path===""||!l.path?.includes("?"))i(l,c);else for(let f of vM(l.path))i(l,c,!0,f)}),t}function vM(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let l=vM(r.join("/")),c=[];return c.push(...l.map(f=>f===""?i:[i,f].join("/"))),o&&c.push(...l),c.map(f=>e.startsWith("/")&&f===""?"/":f)}function m$(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:E$(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var g$=/^:[\w-]+$/,y$=3,v$=2,x$=1,b$=10,w$=-2,IR=e=>e==="*";function S$(e,t){let n=e.split("/"),r=n.length;return n.some(IR)&&(r+=w$),t&&(r+=v$),n.filter(o=>!IR(o)).reduce((o,i)=>o+(g$.test(i)?y$:i===""?x$:b$),r)}function E$(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function C$(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",l=[];for(let c=0;c<r.length;++c){let f=r[c],d=c===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",g={path:f.relativePath,caseSensitive:f.caseSensitive,end:d},y=f.matcher&&f.compiledParams?xM(g,p,f.matcher,f.compiledParams):pm(g,p),v=f.route;if(!y&&d&&n&&!r[r.length-1].route.index&&(y=pm({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},p)),!y)return null;Object.assign(o,y.params),l.push({params:o,pathname:Vo([i,y.pathname]),pathnameBase:N$(Vo([i,y.pathnameBase])),route:v}),y.pathnameBase!=="/"&&(i=Vo([i,y.pathnameBase]))}return l}function pm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=bM(e.path,e.caseSensitive,e.end);return xM(e,t,n,r)}function xM(e,t,n,r){let o=t.match(n);if(!o)return null;let i=o[0],l=i.replace(/(.)\/+$/,"$1"),c=o.slice(1);return{params:r.reduce((d,{paramName:p,isOptional:g},y)=>{if(p==="*"){let x=c[y]||"";l=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const v=c[y];return g&&!v?d[p]=void 0:d[p]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:l,pattern:e}}function bM(e,t=!1,n=!0){nr(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 r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,f,d,p)=>{if(r.push({paramName:c,isOptional:f!=null}),f){let g=p.charAt(d+l.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function _$(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return nr(!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 (${t}).`),e}}function lo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function R$({basename:e,pathname:t}){return t==="/"?e:Vo([e,t])}var K0=e=>og.test(e);function j$(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Fs(e):e,i;return n?(n=Q0(n),n.startsWith("/")?i=zR(n.substring(1),"/"):i=zR(n,t)):i=t,{pathname:i,search:T$(r),hash:O$(o)}}function zR(e,t){let n=mm(t).split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Ex(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function wM(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function X0(e){let t=wM(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function sg(e,t,n,r=!1){let o;typeof e=="string"?o=Fs(e):(o={...e},Lt(!o.pathname||!o.pathname.includes("?"),Ex("?","pathname","search",o)),Lt(!o.pathname||!o.pathname.includes("#"),Ex("#","pathname","hash",o)),Lt(!o.search||!o.search.includes("#"),Ex("#","search","hash",o)));let i=e===""||o.pathname==="",l=i?"/":o.pathname,c;if(l==null)c=n;else{let g=t.length-1;if(!r&&l.startsWith("..")){let y=l.split("/");for(;y[0]==="..";)y.shift(),g-=1;o.pathname=y.join("/")}c=g>=0?t[g]:"/"}let f=j$(o,c),d=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(d||p)&&(f.pathname+="/"),f}var Q0=e=>e.replace(/[\\/]{2,}/g,"/"),Vo=e=>Q0(e.join("/")),mm=e=>e.replace(/\/+$/,""),N$=e=>mm(e).replace(/^\/*/,"/"),T$=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,O$=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,M$=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],vf=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kd(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function xf(e){let t=e.map(n=>n.route.path).filter(Boolean);return Vo(t)||"/"}var SM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function EM(e,t){let n=e;if(typeof n!="string"||!og.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(SM)try{let i=new URL(window.location.href),l=G0.test(n)?new URL(hM(n,i.protocol)):new URL(n),c=lo(l.pathname,t);l.origin===i.origin&&c!=null?n=c+l.search+l.hash:o=!0}catch{nr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}var ua=Symbol("Uninstrumented");function k$(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(i){let l=Object.keys(n);for(let c of l)i[c]&&n[c].push(i[c])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let o=Oc(n.lazy,t.lazy,()=>{});o&&(r.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(i=>{let l=o[i],c=n[`lazy.${i}`];if(typeof l=="function"&&c.length>0){let f=Oc(c,l,()=>{});f&&(r.lazy=Object.assign(r.lazy||{},{[i]:f}))}})}return["loader","action"].forEach(o=>{let i=t[o];if(typeof i=="function"&&n[o].length>0){let l=i[ua]??i,c=Oc(n[o],l,(...f)=>LR(f[0]));c&&(o==="loader"&&l.hydrate===!0&&(c.hydrate=!0),c[ua]=l,r[o]=c)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(o=>{let i=o[ua]??o,l=Oc(n.middleware,i,(...c)=>LR(c[0]));return l?(l[ua]=i,l):o})),r}function A$(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(o){let i=Object.keys(o);for(let l of i)o[l]&&n[l].push(o[l])}})),n.navigate.length>0){let r=e.navigate[ua]??e.navigate,o=Oc(n.navigate,r,(...i)=>{let[l,c]=i;return{to:typeof l=="number"||typeof l=="string"?l:l?$s(l):".",...$R(e,c??{})}});o&&(o[ua]=r,e.navigate=o)}if(n.fetch.length>0){let r=e.fetch[ua]??e.fetch,o=Oc(n.fetch,r,(...i)=>{let[l,,c,f]=i;return{href:c??".",fetcherKey:l,...$R(e,f??{})}});o&&(o[ua]=r,e.fetch=o)}return e}function Oc(e,t,n){return e.length===0?null:async(...r)=>{let o=await CM(e,n(...r),()=>t(...r),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function CM(e,t,n,r){let o=e[r],i;if(o){let l,c=async()=>(l?console.error("You cannot call instrumented handlers more than once"):l=CM(e,t,n,r-1),i=await l,Lt(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await o(c,t)}catch(f){console.error("An instrumentation function threw an error:",f)}l||await c(),await l}else try{i={type:"success",value:await n()}}catch(l){i={type:"error",value:l}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function LR(e){let{request:t,context:n,params:r,pattern:o}=e;return{request:D$(t),params:{...r},pattern:o,context:P$(n)}}function $R(e,t){return{currentUrl:$s(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function D$(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function P$(e){if(z$(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var I$=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function z$(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===I$}var _M=["POST","PUT","PATCH","DELETE"],L$=new Set(_M),$$=["GET",..._M],F$=new Set($$),RM=new Set([301,302,303,307,308]),V$=new Set([307,308]),Cx={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},U$={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Sc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},H$=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),jM="remix-router-transitions",NM=Symbol("ResetLoaderData"),Qa,Ec,sa,Cc,B$=class{constructor(e){Nd(this,Qa),Nd(this,Ec),Nd(this,sa),Nd(this,Cc),Cs(this,Qa,e),Cs(this,Ec,Kp(e))}get stableRoutes(){return zo(this,Qa)}get activeRoutes(){return zo(this,sa)??zo(this,Qa)}get branches(){return zo(this,Cc)??zo(this,Ec)}get hasHMRRoutes(){return zo(this,sa)!=null}setRoutes(e){Cs(this,Qa,e),Cs(this,Ec,Kp(e))}setHmrRoutes(e){Cs(this,sa,e),Cs(this,Cc,Kp(e))}commitHmrRoutes(){zo(this,sa)&&(Cs(this,Qa,zo(this,sa)),Cs(this,Ec,zo(this,Cc)),Cs(this,sa,void 0),Cs(this,Cc,void 0))}};Qa=new WeakMap;Ec=new WeakMap;sa=new WeakMap;Cc=new WeakMap;function q$(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";Lt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||H$,i=o;if(e.instrumentations){let ee=e.instrumentations;i=se=>({...o(se),...k$(ee.map(ce=>ce.route).filter(Boolean),se)})}let l={},c=new B$(Gd(e.routes,i,void 0,l)),f=e.basename||"/";f.startsWith("/")||(f=`/${f}`);let d=e.dataStrategy||X$,p={...e.future},g=null,y=new Set,v=null,x=null,E=null,S=null,_=e.hydrationData!=null,j=Wo(c.activeRoutes,e.history.location,f,!1,c.branches),R=!1,N=null,O,k;if(j==null&&!e.patchRoutesOnNavigation){let ee=Lo(404,{pathname:e.history.location.pathname}),{matches:se,route:ce}=cp(c.activeRoutes);O=!0,k=!O,j=se,N={[ce.id]:ee}}else if(j&&!e.hydrationData&&Dt(j,c.activeRoutes,e.history.location.pathname).active&&(j=null),j)if(j.some(ee=>ee.route.lazy))O=!1,k=!O;else if(!j.some(ee=>W0(ee.route)))O=!0,k=!O;else{let ee=e.hydrationData?e.hydrationData.loaderData:null,se=e.hydrationData?e.hydrationData.errors:null,ce=j;if(se){let Ce=j.findIndex(Ne=>se[Ne.route.id]!==void 0);ce=ce.slice(0,Ce+1)}k=!1,O=!0,ce.forEach(Ce=>{let Ne=TM(Ce.route,ee,se);k=k||Ne.renderFallback,O=O&&!Ne.shouldLoad})}else{O=!1,k=!O,j=[];let ee=Dt(null,c.activeRoutes,e.history.location.pathname);ee.active&&ee.matches&&(R=!0,j=ee.matches)}let M,T={historyAction:e.history.action,location:e.history.location,matches:j,initialized:O,renderFallback:k,navigation:Cx,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||N,fetchers:new Map,blockers:new Map},L="POP",G=null,B=!1,V,q=!1,I=new Map,z=null,A=!1,P=!1,U=new Set,H=new Map,Y=0,$=-1,F=new Map,Q=new Set,X=new Map,ne=new Map,te=new Set,J=new Map,K,re=null;function ye(){if(g=e.history.listen(({action:ee,location:se,delta:ce})=>{if(K){K(),K=void 0;return}nr(J.size===0||ce!=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 Ce=Je({currentLocation:T.location,nextLocation:se,historyAction:ee});if(Ce&&ce!=null){let Ne=new Promise(Ze=>{K=Ze});e.history.go(ce*-1),Xe(Ce,{state:"blocked",location:se,proceed(){Xe(Ce,{state:"proceeding",proceed:void 0,reset:void 0,location:se}),Ne.then(()=>e.history.go(ce))},reset(){let Ze=new Map(T.blockers);Ze.set(Ce,Sc),he({blockers:Ze})}}),G?.resolve(),G=null;return}return Ae(ee,se)}),n){m5(t,I);let ee=()=>g5(t,I);t.addEventListener("pagehide",ee),z=()=>t.removeEventListener("pagehide",ee)}return T.initialized||Ae("POP",T.location,{initialHydration:!0}),M}function fe(){g&&g(),z&&z(),y.clear(),V&&V.abort(),T.fetchers.forEach((ee,se)=>ie(T.fetchers,se)),T.blockers.forEach((ee,se)=>He(se))}function ue(ee){if(y.add(ee),v){let{newErrors:se}=v;v=null,ee(T,{deletedFetchers:[],newErrors:se,viewTransitionOpts:void 0,flushSync:!1})}return()=>y.delete(ee)}function he(ee,se={}){ee.matches&&(ee.matches=ee.matches.map(Ne=>{let Ze=l[Ne.route.id],Be=Ne.route;return Be.element!==Ze.element||Be.errorElement!==Ze.errorElement||Be.hydrateFallbackElement!==Ze.hydrateFallbackElement?{...Ne,route:Ze}:Ne})),T={...T,...ee};let ce=[],Ce=[];T.fetchers.forEach((Ne,Ze)=>{Ne.state==="idle"&&(te.has(Ze)?ce.push(Ze):Ce.push(Ze))}),te.forEach(Ne=>{!T.fetchers.has(Ne)&&!H.has(Ne)&&ce.push(Ne)}),y.size===0&&(v={newErrors:ee.errors??null}),[...y].forEach(Ne=>Ne(T,{deletedFetchers:ce,newErrors:ee.errors??null,viewTransitionOpts:se.viewTransitionOpts,flushSync:se.flushSync===!0})),ce.forEach(Ne=>ie(T.fetchers,Ne)),Ce.forEach(Ne=>T.fetchers.delete(Ne))}function Re(ee,se,{flushSync:ce}={}){let Ce=T.actionData!=null&&T.navigation.formMethod!=null&&Fr(T.navigation.formMethod)&&T.navigation.state==="loading"&&ee.state?._isRedirect!==!0,Ne;se.actionData?Object.keys(se.actionData).length>0?Ne=se.actionData:Ne=null:Ce?Ne=T.actionData:Ne=null;let Ze=se.loaderData?KR(T.loaderData,se.loaderData,se.matches||[],se.errors):T.loaderData,Be=T.blockers;Be.size>0&&(Be=new Map(Be),Be.forEach((ht,Rt)=>Be.set(Rt,Sc)));let Ge=A?!1:wt(ee,se.matches||T.matches),Ke=B===!0||T.navigation.formMethod!=null&&Fr(T.navigation.formMethod)&&ee.state?._isRedirect!==!0;c.commitHmrRoutes(),A||L==="POP"||(L==="PUSH"?e.history.push(ee,ee.state):L==="REPLACE"&&e.history.replace(ee,ee.state));let lt;if(L==="POP"){let ht=I.get(T.location.pathname);ht&&ht.has(ee.pathname)?lt={currentLocation:T.location,nextLocation:ee}:I.has(ee.pathname)&&(lt={currentLocation:ee,nextLocation:T.location})}else if(q){let ht=I.get(T.location.pathname);ht?ht.add(ee.pathname):(ht=new Set([ee.pathname]),I.set(T.location.pathname,ht)),lt={currentLocation:T.location,nextLocation:ee}}he({...se,actionData:Ne,loaderData:Ze,historyAction:L,location:ee,initialized:!0,renderFallback:!1,navigation:Cx,revalidation:"idle",restoreScrollPosition:Ge,preventScrollReset:Ke,blockers:Be},{viewTransitionOpts:lt,flushSync:ce===!0}),L="POP",B=!1,q=!1,A=!1,P=!1,G?.resolve(),G=null,re?.resolve(),re=null}async function ze(ee,se){if(G?.resolve(),G=null,typeof ee=="number"){G||(G=JR());let Wt=G.promise;return e.history.go(ee),Wt}let ce=jb(T.location,T.matches,f,ee,se?.fromRouteId,se?.relative),{path:Ce,submission:Ne,error:Ze}=FR(!1,ce,se),Be;se?.mask&&(Be={pathname:"",search:"",hash:"",...typeof se.mask=="string"?Fs(se.mask):{...T.location.mask,...se.mask}});let Ge=T.location,Ke=Zd(Ge,Ce,se&&se.state,void 0,Be);Ke={...Ke,...e.history.encodeLocation(Ke)};let lt=se&&se.replace!=null?se.replace:void 0,ht="PUSH";lt===!0?ht="REPLACE":lt===!1||Ne!=null&&Fr(Ne.formMethod)&&Ne.formAction===T.location.pathname+T.location.search&&(ht="REPLACE");let Rt=se&&"preventScrollReset"in se?se.preventScrollReset===!0:void 0,vt=(se&&se.flushSync)===!0,Pt=Je({currentLocation:Ge,nextLocation:Ke,historyAction:ht});if(Pt){Xe(Pt,{state:"blocked",location:Ke,proceed(){Xe(Pt,{state:"proceeding",proceed:void 0,reset:void 0,location:Ke}),ze(ee,se)},reset(){let Wt=new Map(T.blockers);Wt.set(Pt,Sc),he({blockers:Wt})}});return}await Ae(ht,Ke,{submission:Ne,pendingError:Ze,preventScrollReset:Rt,replace:se&&se.replace,enableViewTransition:se&&se.viewTransition,flushSync:vt,callSiteDefaultShouldRevalidate:se&&se.defaultShouldRevalidate})}function Ue(){re||(re=JR()),Ie(),he({revalidation:"loading"});let ee=re.promise;return T.navigation.state==="submitting"?ee:T.navigation.state==="idle"?(Ae(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),ee):(Ae(L||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:q===!0}),ee)}async function Ae(ee,se,ce){V&&V.abort(),V=null,L=ee,A=(ce&&ce.startUninterruptedRevalidation)===!0,nt(T.location,T.matches),B=(ce&&ce.preventScrollReset)===!0,q=(ce&&ce.enableViewTransition)===!0;let Ce=c.activeRoutes,Ne=ce?.initialHydration&&T.matches&&T.matches.length>0&&!R?T.matches:Wo(Ce,se,f,!1,c.branches),Ze=(ce&&ce.flushSync)===!0;if(Ne&&T.initialized&&!P&&s5(T.location,se)&&!(ce&&ce.submission&&Fr(ce.submission.formMethod))){Re(se,{matches:Ne},{flushSync:Ze});return}let Be=Dt(Ne,Ce,se.pathname);if(Be.active&&Be.matches&&(Ne=Be.matches),!Ne){let{error:en,notFoundMatches:Bt,route:Fn}=bt(se.pathname);Re(se,{matches:Bt,loaderData:{},errors:{[Fn.id]:en}},{flushSync:Ze});return}let Ge=ce&&ce.overrideNavigation?{...ce.overrideNavigation,matches:Ne,historyAction:ee}:void 0;V=new AbortController;let Ke=_c(e.history,se,V.signal,ce&&ce.submission),lt=e.getContext?await e.getContext():new DR,ht;if(ce&&ce.pendingError)ht=[la(Ne).route.id,{type:"error",error:ce.pendingError}];else if(ce&&ce.submission&&Fr(ce.submission.formMethod)){let en=await Qe(Ke,se,ce.submission,Ne,ee,lt,Be.active,ce&&ce.initialHydration===!0,{replace:ce.replace,flushSync:Ze});if(en.shortCircuited)return;if(en.pendingActionResult){let[Bt,Fn]=en.pendingActionResult;if(wo(Fn)&&Kd(Fn.error)&&Fn.error.status===404){V=null,Re(se,{matches:en.matches,loaderData:{},errors:{[Bt]:Fn.error}});return}}Ne=en.matches||Ne,ht=en.pendingActionResult,Ge=_x(se,Ne,ee,ce.submission),Ze=!1,Be.active=!1,Ke=_c(e.history,Ke.url,Ke.signal)}let{shortCircuited:Rt,matches:vt,loaderData:Pt,errors:Wt,workingFetchers:Sn}=await De(Ke,se,Ne,ee,lt,Be.active,Ge,ce&&ce.submission,ce&&ce.fetcherSubmission,ce&&ce.replace,ce&&ce.initialHydration===!0,Ze,ht,ce&&ce.callSiteDefaultShouldRevalidate);Rt||(V=null,Re(se,{matches:vt||Ne,...XR(ht),loaderData:Pt,errors:Wt,...Sn?{fetchers:Sn}:{}}))}async function Qe(ee,se,ce,Ce,Ne,Ze,Be,Ge,Ke={}){Ie();let lt=h5(se,Ce,Ne,ce);if(he({navigation:lt},{flushSync:Ke.flushSync===!0}),Be){let vt=await St(Ce,se.pathname,ee.signal);if(vt.type==="aborted")return{shortCircuited:!0};if(vt.type==="error"){if(vt.partialMatches.length===0){let{matches:Wt,route:Sn}=cp(c.activeRoutes);return{matches:Wt,pendingActionResult:[Sn.id,{type:"error",error:vt.error}]}}let Pt=la(vt.partialMatches).route.id;return{matches:vt.partialMatches,pendingActionResult:[Pt,{type:"error",error:vt.error}]}}else if(vt.matches)Ce=vt.matches;else{let{notFoundMatches:Pt,error:Wt,route:Sn}=bt(se.pathname);return{matches:Pt,pendingActionResult:[Sn.id,{type:"error",error:Wt}]}}}let ht,Rt=Xp(Ce,se);if(!Rt.route.action&&!Rt.route.lazy)ht={type:"error",error:Lo(405,{method:ee.method,pathname:se.pathname,routeId:Rt.route.id})};else{let vt=Ic(i,l,ee,se,Ce,Rt,Ge?[]:r,Ze),Pt=await We(ee,se,vt,Ze,null);if(ht=Pt[Rt.route.id],!ht){for(let Wt of Ce)if(Pt[Wt.route.id]){ht=Pt[Wt.route.id];break}}if(ee.signal.aborted)return{shortCircuited:!0}}if(tl(ht)){let vt;return Ke&&Ke.replace!=null?vt=Ke.replace:vt=YR(ht.response.headers.get("Location"),new URL(ee.url),f,e.history)===T.location.pathname+T.location.search,await xe(ee,ht,!0,{submission:ce,replace:vt}),{shortCircuited:!0}}if(wo(ht)){let vt=la(Ce,Rt.route.id);return(Ke&&Ke.replace)!==!0&&(L="PUSH"),{matches:Ce,pendingActionResult:[vt.route.id,ht,Rt.route.id]}}return{matches:Ce,pendingActionResult:[Rt.route.id,ht]}}async function De(ee,se,ce,Ce,Ne,Ze,Be,Ge,Ke,lt,ht,Rt,vt,Pt){let Wt=Be||_x(se,ce,Ce,Ge),Sn=Ge||Ke||WR(Wt),en=!A&&!ht;if(Ze){if(en){let dn=Le(vt);he({navigation:Wt,...dn!==void 0?{actionData:dn}:{}},{flushSync:Rt})}let Et=await St(ce,se.pathname,ee.signal);if(Et.type==="aborted")return{shortCircuited:!0};if(Et.type==="error"){if(Et.partialMatches.length===0){let{matches:Ur,route:fo}=cp(c.activeRoutes);return{matches:Ur,loaderData:{},errors:{[fo.id]:Et.error}}}let dn=la(Et.partialMatches).route.id;return{matches:Et.partialMatches,loaderData:{},errors:{[dn]:Et.error}}}else if(Et.matches)ce=Et.matches;else{let{error:dn,notFoundMatches:Ur,route:fo}=bt(se.pathname);return{matches:Ur,loaderData:{},errors:{[fo.id]:dn}}}}let Bt=c.activeRoutes,{dsMatches:Fn,revalidatingFetchers:Kt}=VR(ee,Ne,i,l,e.history,T,ce,Sn,se,ht?[]:r,ht===!0,P,U,te,X,Q,Bt,f,e.patchRoutesOnNavigation!=null,c.branches,vt,Pt);if($=++Y,!e.dataStrategy&&!Fn.some(Et=>Et.shouldLoad)&&!Fn.some(Et=>Et.route.middleware&&Et.route.middleware.length>0)&&Kt.length===0){let Et=new Map(T.fetchers),dn=Ve(Et);return Re(se,{matches:ce,loaderData:{},errors:vt&&wo(vt[1])?{[vt[0]]:vt[1].error}:null,...XR(vt),...dn?{fetchers:Et}:{}},{flushSync:Rt}),{shortCircuited:!0}}if(en){let Et={};if(!Ze){Et.navigation=Wt;let dn=Le(vt);dn!==void 0&&(Et.actionData=dn)}Kt.length>0&&(Et.fetchers=Fe(Kt)),he(Et,{flushSync:Rt})}Kt.forEach(Et=>{Se(Et.key),Et.controller&&H.set(Et.key,Et.controller)});let xs=()=>Kt.forEach(Et=>Se(Et.key));V&&V.signal.addEventListener("abort",xs);let{loaderResults:uo,fetcherResults:Lr}=await Oe(Fn,Kt,ee,se,Ne);if(ee.signal.aborted)return{shortCircuited:!0};V&&V.signal.removeEventListener("abort",xs),Kt.forEach(Et=>H.delete(Et.key));let Cr=up(uo);if(Cr)return await xe(ee,Cr.result,!0,{replace:lt}),{shortCircuited:!0};if(Cr=up(Lr),Cr)return Q.add(Cr.key),await xe(ee,Cr.result,!0,{replace:lt}),{shortCircuited:!0};let Kr=new Map(T.fetchers),{loaderData:Ni,errors:Xr}=GR(T,ce,uo,vt,Kt,Lr,Kr);ht&&T.errors&&(Xr={...T.errors,...Xr});let Ti=Ve(Kr),Zo=Me($,Kr),Go=Ti||Zo||Kt.length>0;return{matches:ce,loaderData:Ni,errors:Xr,...Go?{workingFetchers:Kr}:{}}}function Le(ee){if(ee&&!wo(ee[1]))return{[ee[0]]:ee[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function Fe(ee){let se=new Map(T.fetchers);return ee.forEach(ce=>{let Ce=se.get(ce.key),Ne=md(void 0,Ce?Ce.data:void 0);se.set(ce.key,Ne)}),se}async function Ye(ee,se,ce,Ce){Se(ee);let Ne=(Ce&&Ce.flushSync)===!0,Ze=c.activeRoutes,Be=jb(T.location,T.matches,f,ce,se,Ce?.relative),Ge=Wo(Ze,Be,f,!1,c.branches),Ke=Dt(Ge,Ze,Be);if(Ke.active&&Ke.matches&&(Ge=Ke.matches),!Ge){it(ee,se,Lo(404,{pathname:Be}),{flushSync:Ne});return}let{path:lt,submission:ht,error:Rt}=FR(!0,Be,Ce);if(Rt){it(ee,se,Rt,{flushSync:Ne});return}let vt=e.getContext?await e.getContext():new DR,Pt=(Ce&&Ce.preventScrollReset)===!0;if(ht&&Fr(ht.formMethod)){await et(ee,se,lt,Ge,vt,Ke.active,Ne,Pt,ht,Ce&&Ce.defaultShouldRevalidate);return}X.set(ee,{routeId:se,path:lt}),await me(ee,se,lt,Ge,vt,Ke.active,Ne,Pt,ht)}async function et(ee,se,ce,Ce,Ne,Ze,Be,Ge,Ke,lt){Ie(),X.delete(ee);let ht=T.fetchers.get(ee);at(ee,p5(Ke,ht),{flushSync:Be});let Rt=new AbortController,vt=_c(e.history,ce,Rt.signal,Ke);if(Ze){let rn=await St(Ce,new URL(vt.url).pathname,vt.signal,ee);if(rn.type==="aborted")return;if(rn.type==="error"){it(ee,se,rn.error,{flushSync:Be});return}else if(rn.matches)Ce=rn.matches;else{it(ee,se,Lo(404,{pathname:ce}),{flushSync:Be});return}}let Pt=Xp(Ce,ce);if(!Pt.route.action&&!Pt.route.lazy){let rn=Lo(405,{method:Ke.formMethod,pathname:ce,routeId:se});it(ee,se,rn,{flushSync:Be});return}H.set(ee,Rt);let Wt=Y,Sn=Ic(i,l,vt,ce,Ce,Pt,r,Ne),en=await We(vt,ce,Sn,Ne,ee),Bt=en[Pt.route.id];if(!Bt){for(let rn of Sn)if(en[rn.route.id]){Bt=en[rn.route.id];break}}if(vt.signal.aborted){H.get(ee)===Rt&&H.delete(ee);return}if(te.has(ee)){if(tl(Bt)||wo(Bt)){at(ee,js(void 0));return}}else{if(tl(Bt))if(H.delete(ee),$>Wt){at(ee,js(void 0));return}else return Q.add(ee),at(ee,md(Ke)),xe(vt,Bt,!1,{fetcherSubmission:Ke,preventScrollReset:Ge});if(wo(Bt)){it(ee,se,Bt.error);return}}let Fn=T.navigation.location||T.location,Kt=_c(e.history,Fn,Rt.signal),xs=c.activeRoutes,uo=T.navigation.state!=="idle"?Wo(xs,T.navigation.location,f,!1,c.branches):T.matches;Lt(uo,"Didn't find any matches after fetcher action");let Lr=++Y;F.set(ee,Lr);let{dsMatches:Cr,revalidatingFetchers:Kr}=VR(Kt,Ne,i,l,e.history,T,uo,Ke,Fn,r,!1,P,U,te,X,Q,xs,f,e.patchRoutesOnNavigation!=null,c.branches,[Pt.route.id,Bt],lt),Ni=md(Ke,Bt.data),Xr=new Map(T.fetchers);Xr.set(ee,Ni),Kr.filter(rn=>rn.key!==ee).forEach(rn=>{let No=rn.key,_r=Xr.get(No),Ma=md(void 0,_r?_r.data:void 0);Xr.set(No,Ma),Se(No),rn.controller&&H.set(No,rn.controller)}),he({fetchers:Xr});let Ti=()=>Kr.forEach(rn=>Se(rn.key));Rt.signal.addEventListener("abort",Ti);let{loaderResults:Zo,fetcherResults:Go}=await Oe(Cr,Kr,Kt,Fn,Ne);if(Rt.signal.aborted)return;Rt.signal.removeEventListener("abort",Ti),F.delete(ee),H.delete(ee),Kr.forEach(rn=>H.delete(rn.key));let Et=T.fetchers.has(ee),dn=rn=>{if(!Et)return rn;let No=new Map(rn.fetchers);return No.set(ee,js(Bt.data)),{...rn,fetchers:No}},Ur=up(Zo);if(Ur)return T=dn(T),xe(Kt,Ur.result,!1,{preventScrollReset:Ge});if(Ur=up(Go),Ur)return Q.add(Ur.key),T=dn(T),xe(Kt,Ur.result,!1,{preventScrollReset:Ge});let fo=new Map(T.fetchers);Et&&fo.set(ee,js(Bt.data));let{loaderData:Oi,errors:Ys}=GR(T,uo,Zo,void 0,Kr,Go,fo);Me(Lr,fo),T.navigation.state==="loading"&&Lr>$?(Lt(L,"Expected pending action"),V&&V.abort(),Re(T.navigation.location,{matches:uo,loaderData:Oi,errors:Ys,fetchers:fo})):(he({errors:Ys,loaderData:KR(T.loaderData,Oi,uo,Ys),fetchers:fo}),P=!1)}async function me(ee,se,ce,Ce,Ne,Ze,Be,Ge,Ke){let lt=T.fetchers.get(ee);at(ee,md(Ke,lt?lt.data:void 0),{flushSync:Be});let ht=new AbortController,Rt=_c(e.history,ce,ht.signal);if(Ze){let Bt=await St(Ce,new URL(Rt.url).pathname,Rt.signal,ee);if(Bt.type==="aborted")return;if(Bt.type==="error"){it(ee,se,Bt.error,{flushSync:Be});return}else if(Bt.matches)Ce=Bt.matches;else{it(ee,se,Lo(404,{pathname:ce}),{flushSync:Be});return}}let vt=Xp(Ce,ce);H.set(ee,ht);let Pt=Y,Wt=Ic(i,l,Rt,ce,Ce,vt,r,Ne),Sn=await We(Rt,ce,Wt,Ne,ee),en=Sn[vt.route.id];if(!en){for(let Bt of Ce)if(Sn[Bt.route.id]){en=Sn[Bt.route.id];break}}if(H.get(ee)===ht&&H.delete(ee),!Rt.signal.aborted){if(te.has(ee)){at(ee,js(void 0));return}if(tl(en))if($>Pt){at(ee,js(void 0));return}else{Q.add(ee),await xe(Rt,en,!1,{preventScrollReset:Ge});return}if(wo(en)){it(ee,se,en.error);return}at(ee,js(en.data))}}async function xe(ee,se,ce,{submission:Ce,fetcherSubmission:Ne,preventScrollReset:Ze,replace:Be}={}){ce||(G?.resolve(),G=null),se.response.headers.has("X-Remix-Revalidate")&&(P=!0);let Ge=se.response.headers.get("Location");Lt(Ge,"Expected a Location header on the redirect Response"),Ge=YR(Ge,new URL(ee.url),f,e.history);let Ke=Zd(T.location,Ge,{_isRedirect:!0});if(n){let Wt=!1;if(se.response.headers.has("X-Remix-Reload-Document"))Wt=!0;else if(K0(Ge)){const Sn=pM(t,Ge,!0);Wt=Sn.origin!==t.location.origin||lo(Sn.pathname,f)==null}if(Wt){Be?t.location.replace(Ge):t.location.assign(Ge);return}}V=null;let lt=Be===!0||se.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:ht,formAction:Rt,formEncType:vt}=T.navigation;!Ce&&!Ne&&ht&&Rt&&vt&&(Ce=WR(T.navigation));let Pt=Ce||Ne;if(V$.has(se.response.status)&&Pt&&Fr(Pt.formMethod))await Ae(lt,Ke,{submission:{...Pt,formAction:Ge},preventScrollReset:Ze||B,enableViewTransition:ce?q:void 0});else{let Wt=_x(Ke,[],lt,Ce);await Ae(lt,Ke,{overrideNavigation:Wt,fetcherSubmission:Ne,preventScrollReset:Ze||B,enableViewTransition:ce?q:void 0})}}async function We(ee,se,ce,Ce,Ne){let Ze,Be={};try{Ze=await W$(d,ee,se,ce,Ne,Ce,!1)}catch(Ge){return ce.filter(Ke=>Ke.shouldLoad).forEach(Ke=>{Be[Ke.route.id]={type:"error",error:Ge}}),Be}if(ee.signal.aborted)return Be;if(!Fr(ee.method))for(let Ge of ce){if(Ze[Ge.route.id]?.type==="error")break;!Ze.hasOwnProperty(Ge.route.id)&&!T.loaderData.hasOwnProperty(Ge.route.id)&&(!T.errors||!T.errors.hasOwnProperty(Ge.route.id))&&Ge.shouldCallHandler()&&(Ze[Ge.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ge.route.id}`)})}for(let[Ge,Ke]of Object.entries(Ze))if(c5(Ke)){let lt=Ke.result;Be[Ge]={type:"redirect",response:n5(lt,ee,Ge,ce,f)}}else Be[Ge]=await t5(Ke);return Be}async function Oe(ee,se,ce,Ce,Ne){let Ze=We(ce,Ce,ee,Ne,null),Be=Promise.all(se.map(async lt=>{if(lt.matches&<.match&<.request&<.controller){let Rt=(await We(lt.request,lt.path,lt.matches,Ne,lt.key))[lt.match.route.id];return{[lt.key]:Rt}}else return Promise.resolve({[lt.key]:{type:"error",error:Lo(404,{pathname:lt.path})}})})),Ge=await Ze,Ke=(await Be).reduce((lt,ht)=>Object.assign(lt,ht),{});return{loaderResults:Ge,fetcherResults:Ke}}function Ie(){P=!0,X.forEach((ee,se)=>{H.has(se)&&U.add(se),Se(se)})}function at(ee,se,ce={}){let Ce=new Map(T.fetchers);Ce.set(ee,se),he({fetchers:Ce},{flushSync:(ce&&ce.flushSync)===!0})}function it(ee,se,ce,Ce={}){let Ne=la(T.matches,se),Ze=new Map(T.fetchers);ie(Ze,ee),he({errors:{[Ne.route.id]:ce},fetchers:Ze},{flushSync:(Ce&&Ce.flushSync)===!0})}function $t(ee){return ne.set(ee,(ne.get(ee)||0)+1),te.has(ee)&&te.delete(ee),T.fetchers.get(ee)||U$}function W(ee,se){Se(ee,se?.reason),at(ee,js(null))}function ie(ee,se){let ce=T.fetchers.get(se);H.has(se)&&!(ce&&ce.state==="loading"&&F.has(se))&&Se(se),X.delete(se),F.delete(se),Q.delete(se),te.delete(se),U.delete(se),ee.delete(se)}function ae(ee){let se=(ne.get(ee)||0)-1;se<=0?(ne.delete(ee),te.add(ee)):ne.set(ee,se),he({fetchers:new Map(T.fetchers)})}function Se(ee,se){let ce=H.get(ee);ce&&(ce.abort(se),H.delete(ee))}function be(ee,se){for(let ce of ee){let Ce=se.get(ce);Lt(Ce,`Expected fetcher: ${ce}`);let Ne=js(Ce.data);se.set(ce,Ne)}}function Ve(ee){let se=[],ce=!1;for(let Ce of Q){let Ne=ee.get(Ce);Lt(Ne,`Expected fetcher: ${Ce}`),Ne.state==="loading"&&(Q.delete(Ce),se.push(Ce),ce=!0)}return be(se,ee),ce}function Me(ee,se){let ce=[];for(let[Ce,Ne]of F)if(Ne<ee){let Ze=se.get(Ce);Lt(Ze,`Expected fetcher: ${Ce}`),Ze.state==="loading"&&(Se(Ce),F.delete(Ce),ce.push(Ce))}return be(ce,se),ce.length>0}function $e(ee,se){let ce=T.blockers.get(ee)||Sc;return J.get(ee)!==se&&J.set(ee,se),ce}function He(ee){T.blockers.delete(ee),J.delete(ee)}function Xe(ee,se){let ce=T.blockers.get(ee)||Sc;Lt(ce.state==="unblocked"&&se.state==="blocked"||ce.state==="blocked"&&se.state==="blocked"||ce.state==="blocked"&&se.state==="proceeding"||ce.state==="blocked"&&se.state==="unblocked"||ce.state==="proceeding"&&se.state==="unblocked",`Invalid blocker state transition: ${ce.state} -> ${se.state}`);let Ce=new Map(T.blockers);Ce.set(ee,se),he({blockers:Ce})}function Je({currentLocation:ee,nextLocation:se,historyAction:ce}){if(J.size===0)return;J.size>1&&nr(!1,"A router only supports one blocker at a time");let Ce=Array.from(J.entries()),[Ne,Ze]=Ce[Ce.length-1],Be=T.blockers.get(Ne);if(!(Be&&Be.state==="proceeding")&&Ze({currentLocation:ee,nextLocation:se,historyAction:ce}))return Ne}function bt(ee){let se=Lo(404,{pathname:ee}),ce=c.activeRoutes,{matches:Ce,route:Ne}=cp(ce);return{notFoundMatches:Ce,route:Ne,error:se}}function Mt(ee,se,ce){if(x=ee,S=se,E=ce||null,!_&&T.navigation===Cx){_=!0;let Ce=wt(T.location,T.matches);Ce!=null&&he({restoreScrollPosition:Ce})}return()=>{x=null,S=null,E=null}}function kt(ee,se){return E&&E(ee,se.map(Ce=>gM(Ce,T.loaderData)))||ee.key}function nt(ee,se){if(x&&S){let ce=kt(ee,se);x[ce]=S()}}function wt(ee,se){if(x){let ce=kt(ee,se),Ce=x[ce];if(typeof Ce=="number")return Ce}return null}function Dt(ee,se,ce){if(e.patchRoutesOnNavigation){let Ce=c.branches;if(ee){if(Object.keys(ee[0].params).length>0)return{active:!0,matches:Wo(se,ce,f,!0,Ce)}}else return{active:!0,matches:Wo(se,ce,f,!0,Ce)||[]}}return{active:!1,matches:null}}async function St(ee,se,ce,Ce){if(!e.patchRoutesOnNavigation)return{type:"success",matches:ee};let Ne=ee;for(;;){let Ze=l;try{await e.patchRoutesOnNavigation({signal:ce,path:se,matches:Ne,fetcherKey:Ce,patch:(lt,ht)=>{ce.aborted||UR(lt,ht,c,Ze,i,!1)}})}catch(lt){return{type:"error",error:lt,partialMatches:Ne}}if(ce.aborted)return{type:"aborted"};let Be=c.branches,Ge=Wo(c.activeRoutes,se,f,!1,Be),Ke=null;if(Ge){if(Object.keys(Ge[0].params).length===0)return{type:"success",matches:Ge};if(Ke=Wo(c.activeRoutes,se,f,!0,Be),!(Ke&&Ne.length<Ke.length&&In(Ne,Ke.slice(0,Ne.length))))return{type:"success",matches:Ge}}if(Ke||(Ke=Wo(c.activeRoutes,se,f,!0,Be)),!Ke||In(Ne,Ke))return{type:"success",matches:null};Ne=Ke}}function In(ee,se){return ee.length===se.length&&ee.every((ce,Ce)=>ce.route.id===se[Ce].route.id)}function Qt(ee){l={},c.setHmrRoutes(Gd(ee,i,void 0,l))}function wn(ee,se,ce=!1){UR(ee,se,c,l,i,ce),c.hasHMRRoutes||he({})}return M={get basename(){return f},get future(){return p},get state(){return T},get routes(){return c.stableRoutes},get branches(){return c.branches},get manifest(){return l},get window(){return t},initialize:ye,subscribe:ue,enableScrollRestoration:Mt,navigate:ze,fetch:Ye,revalidate:Ue,createHref:ee=>e.history.createHref(ee),encodeLocation:ee=>e.history.encodeLocation(ee),getFetcher:$t,resetFetcher:W,deleteFetcher:ae,dispose:fe,getBlocker:$e,deleteBlocker:He,patchRoutes:wn,_internalFetchControllers:H,_internalSetRoutes:Qt,_internalSetStateDoNotUseOrYouWillBreakYourApp(ee){he(ee)}},e.instrumentations&&(M=A$(M,e.instrumentations.map(ee=>ee.router).filter(Boolean))),M}function Y$(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function jb(e,t,n,r,o,i){let l,c;if(o){l=[];for(let d of t)if(l.push(d),d.route.id===o){c=d;break}}else l=t,c=t[t.length-1];let f=sg(r||".",X0(l),lo(e.pathname,n)||e.pathname,i==="path");if(r==null&&(f.search=e.search,f.hash=e.hash),(r==null||r===""||r===".")&&c){let d=ew(f.search);if(c.route.index&&!d)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let p=new URLSearchParams(f.search),g=p.getAll("index");p.delete("index"),g.filter(v=>v).forEach(v=>p.append("index",v));let y=p.toString();f.search=y?`?${y}`:""}}return n!=="/"&&(f.pathname=R$({basename:n,pathname:f.pathname})),$s(f)}function FR(e,t,n){if(!n||!Y$(n))return{path:t};if(n.formMethod&&!f5(n.formMethod))return{path:t,error:Lo(405,{method:n.formMethod})};let r=()=>({path:t,error:Lo(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=IM(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Fr(i))return r();let g=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((y,[v,x])=>`${y}${v}=${x}
|
|
10
|
+
`,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:g}}}else if(n.formEncType==="application/json"){if(!Fr(i))return r();try{let g=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:g,text:void 0}}}catch{return r()}}}Lt(typeof FormData=="function","FormData is not available in this environment");let c,f;if(n.formData)c=Ob(n.formData),f=n.formData;else if(n.body instanceof FormData)c=Ob(n.body),f=n.body;else if(n.body instanceof URLSearchParams)c=n.body,f=ZR(c);else if(n.body==null)c=new URLSearchParams,f=new FormData;else try{c=new URLSearchParams(n.body),f=ZR(c)}catch{return r()}let d={formMethod:i,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(Fr(d.formMethod))return{path:t,submission:d};let p=Fs(t);return e&&p.search&&ew(p.search)&&c.append("index",""),p.search=`?${c}`,{path:$s(p),submission:d}}function VR(e,t,n,r,o,i,l,c,f,d,p,g,y,v,x,E,S,_,j,R,N,O){let k=N?wo(N[1])?N[1].error:N[1].data:void 0,M=o.createURL(i.location),T=o.createURL(f),L;if(p&&i.errors){let A=Object.keys(i.errors)[0];L=l.findIndex(P=>P.route.id===A)}else if(N&&wo(N[1])){let A=N[0];L=l.findIndex(P=>P.route.id===A)-1}let G=N?N[1].statusCode:void 0,B=G&&G>=400,V={currentUrl:M,currentParams:i.matches[0]?.params||{},nextUrl:T,nextParams:l[0].params,...c,actionResult:k,actionStatus:G},q=xf(l),I=l.map((A,P)=>{let{route:U}=A,H=null;if(L!=null&&P>L)H=!1;else if(U.lazy)H=!0;else if(!W0(U))H=!1;else if(p){let{shouldLoad:Q}=TM(U,i.loaderData,i.errors);H=Q}else Z$(i.loaderData,i.matches[P],A)&&(H=!0);if(H!==null)return Nb(n,r,e,f,q,A,d,t,H);let Y=!1;typeof O=="boolean"?Y=O:B?Y=!1:(g||M.pathname+M.search===T.pathname+T.search||M.search!==T.search||G$(i.matches[P],A))&&(Y=!0);let $={...V,defaultShouldRevalidate:Y},F=Ld(A,$);return Nb(n,r,e,f,q,A,d,t,F,$,O)}),z=[];return x.forEach((A,P)=>{if(p||!l.some(ne=>ne.route.id===A.routeId)||v.has(P))return;let U=i.fetchers.get(P),H=U&&U.state!=="idle"&&U.data===void 0,Y=Wo(S,A.path,_??"/",!1,R);if(!Y){if(j&&H)return;z.push({key:P,routeId:A.routeId,path:A.path,matches:null,match:null,request:null,controller:null});return}if(E.has(P))return;let $=Xp(Y,A.path),F=new AbortController,Q=_c(o,A.path,F.signal),X=null;if(y.has(P))y.delete(P),X=Ic(n,r,Q,A.path,Y,$,d,t);else if(H)g&&(X=Ic(n,r,Q,A.path,Y,$,d,t));else{let ne;typeof O=="boolean"?ne=O:B?ne=!1:ne=g;let te={...V,defaultShouldRevalidate:ne};Ld($,te)&&(X=Ic(n,r,Q,A.path,Y,$,d,t,te))}X&&z.push({key:P,routeId:A.routeId,path:A.path,matches:X,match:$,request:Q,controller:F})}),{dsMatches:I,revalidatingFetchers:z}}function W0(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function TM(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!W0(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;if(!r&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let i=!r&&!o;return{shouldLoad:i,renderFallback:i}}function Z$(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function G$(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Ld(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function UR(e,t,n,r,o,i){let l;if(e){let d=r[e];Lt(d,`No route found to patch children into: routeId = ${e}`),d.children||(d.children=[]),l=d.children}else l=n.activeRoutes;let c=[],f=[];if(t.forEach(d=>{let p=l.find(g=>OM(d,g));p?f.push({existingRoute:p,newRoute:d}):c.push(d)}),c.length>0){let d=Gd(c,o,[e||"_","patch",String(l?.length||"0")],r);l.push(...d)}if(i&&f.length>0)for(let d=0;d<f.length;d++){let{existingRoute:p,newRoute:g}=f[d],y=p,[v]=Gd([g],o,[],{},!0);Object.assign(y,{element:v.element?v.element:y.element,errorElement:v.errorElement?v.errorElement:y.errorElement,hydrateFallbackElement:v.hydrateFallbackElement?v.hydrateFallbackElement:y.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function OM(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((n,r)=>t.children?.some(o=>OM(n,o)))??!1:!1}var HR=new WeakMap,MM=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(Lt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let i=o.lazy[e];if(!i)return;let l=HR.get(o);l||(l={},HR.set(o,l));let c=l[e];if(c)return c;let f=(async()=>{let d=d$(e),g=o[e]!==void 0&&e!=="hasErrorBoundary";if(d)nr(!d,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),l[e]=Promise.resolve();else if(g)nr(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let y=await i();y!=null&&(Object.assign(o,{[e]:y}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(y=>y===void 0)&&(o.lazy=void 0))})();return l[e]=f,f},BR=new WeakMap;function K$(e,t,n,r,o){let i=n[e.id];if(Lt(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=BR.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let g=(async()=>{Lt(typeof e.lazy=="function","No lazy route function found");let y=await e.lazy(),v={};for(let x in y){let E=y[x];if(E===void 0)continue;let S=h$(x),j=i[x]!==void 0&&x!=="hasErrorBoundary";S?nr(!S,"Route property "+x+" is not a supported property to be returned from a lazy route function. This property will be ignored."):j?nr(!j,`Route "${i.id}" has a static property "${x}" defined but its lazy function is also returning a value for this property. The lazy route property "${x}" will be ignored.`):v[x]=E}Object.assign(i,v),Object.assign(i,{...r(i),lazy:void 0})})();return BR.set(i,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let l=Object.keys(e.lazy),c=[],f;for(let p of l){if(o&&o.includes(p))continue;let g=MM({key:p,route:e,manifest:n,mapRouteProperties:r});g&&(c.push(g),p===t&&(f=g))}let d=c.length>0?Promise.all(c).then(()=>{}):void 0;return d?.catch(()=>{}),f?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:f}}async function qR(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,i)=>{n[t[i].route.id]=o}),n}async function X$(e){return e.matches.some(t=>t.route.middleware)?kM(e,()=>qR(e)):qR(e)}function kM(e,t){return Q$(e,t,r=>{if(d5(r))throw r;return r},a5,n);function n(r,o,i){if(i)return Promise.resolve(Object.assign(i.value,{[o]:{type:"error",result:r}}));{let{matches:l}=e,c=Math.min(Math.max(l.findIndex(d=>d.route.id===o),0),Math.max(l.findIndex(d=>d.shouldCallHandler()),0)),f=la(l,l[c].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function Q$(e,t,n,r,o){let{matches:i,...l}=e,c=i.flatMap(d=>d.route.middleware?d.route.middleware.map(p=>[d.route.id,p]):[]);return await AM(l,c,t,n,r,o)}async function AM(e,t,n,r,o,i,l=0){let{request:c}=e;if(c.signal.aborted)throw c.signal.reason??new Error(`Request aborted: ${c.method} ${c.url}`);let f=t[l];if(!f)return await n();let[d,p]=f,g,y=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await AM(e,t,n,r,o,i,l+1)},g.value}catch(v){return g={value:await i(v,d,g)},g.value}};try{let v=await p(e,y),x=v!=null?r(v):void 0;return o(x)?x:g?x??g.value:(g={value:await y()},g.value)}catch(v){return await i(v,d,g)}}function DM(e,t,n,r,o){let i=MM({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),l=K$(r.route,Fr(n.method)?"action":"loader",t,e,o);return{middleware:i,route:l.lazyRoutePromise,handler:l.lazyHandlerPromise}}function Nb(e,t,n,r,o,i,l,c,f,d=null,p){let g=!1,y=DM(e,t,n,i,l);return{...i,_lazyPromises:y,shouldLoad:f,shouldRevalidateArgs:d,shouldCallHandler(v){return g=!0,d?typeof p=="boolean"?Ld(i,{...d,defaultShouldRevalidate:p}):typeof v=="boolean"?Ld(i,{...d,defaultShouldRevalidate:v}):Ld(i,d):f},resolve(v){let{lazy:x,loader:E,middleware:S}=i.route,_=g||f||v&&!Fr(n.method)&&(x||E),j=S&&S.length>0&&!E&&!x;return _&&(Fr(n.method)||!j)?J$({request:n,path:r,pattern:o,match:i,lazyHandlerPromise:y?.handler,lazyRoutePromise:y?.route,handlerOverride:v,scopedContext:c}):Promise.resolve({type:"data",result:void 0})}}}function Ic(e,t,n,r,o,i,l,c,f=null){return o.map(d=>d.route.id!==i.route.id?{...d,shouldLoad:!1,shouldRevalidateArgs:f,shouldCallHandler:()=>!1,_lazyPromises:DM(e,t,n,d,l),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Nb(e,t,n,r,xf(o),d,l,c,!0,f))}async function W$(e,t,n,r,o,i,l){r.some(p=>p._lazyPromises?.middleware)&&await Promise.all(r.map(p=>p._lazyPromises?.middleware));let c={request:t,url:PM(t,n),pattern:xf(r),params:r[0].params,context:i,matches:r},d=await e({...c,fetcherKey:o,runClientMiddleware:p=>{let g=c;return kM(g,()=>p({...g,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>[p._lazyPromises?.handler,p._lazyPromises?.route]))}catch{}return d}async function J$({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:o,lazyRoutePromise:i,handlerOverride:l,scopedContext:c}){let f,d,p=Fr(e.method),g=p?"action":"loader",y=v=>{let x,E=new Promise((j,R)=>x=R);d=()=>x(),e.signal.addEventListener("abort",d);let S=j=>typeof v!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${g}" [routeId: ${r.route.id}]`)):v({request:e,url:PM(e,t),pattern:n,params:r.params,context:c},...j!==void 0?[j]:[]),_=(async()=>{try{return{type:"data",result:await(l?l(R=>S(R)):S())}}catch(j){return{type:"error",result:j}}})();return Promise.race([_,E])};try{let v=p?r.route.action:r.route.loader;if(o||i)if(v){let x,[E]=await Promise.all([y(v).catch(S=>{x=S}),o,i]);if(x!==void 0)throw x;f=E}else{await o;let x=p?r.route.action:r.route.loader;if(x)[f]=await Promise.all([y(x),i]);else if(g==="action"){let E=new URL(e.url),S=E.pathname+E.search;throw Lo(405,{method:e.method,pathname:S,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(v)f=await y(v);else{let x=new URL(e.url),E=x.pathname+x.search;throw Lo(404,{pathname:E})}}catch(v){return{type:"error",result:v}}finally{d&&e.signal.removeEventListener("abort",d)}return f}async function e5(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function t5(e){let{result:t,type:n}=e;if(J0(t)){let r;try{r=await e5(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new vf(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?QR(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:i5(t),statusCode:Kd(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Kd(t)?t.status:void 0}:QR(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function n5(e,t,n,r,o){let i=e.headers.get("Location");if(Lt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!K0(i)){let l=r.slice(0,r.findIndex(c=>c.route.id===n)+1);i=jb(new URL(t.url),l,o,i),e.headers.set("Location",i)}return e}var r5=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Tb(e){try{return r5.includes(new URL(e).protocol)}catch{return!1}}function YR(e,t,n,r){if(K0(e)){let o=e,i=G0.test(o)?new URL(hM(o,t.protocol)):new URL(o);if(Tb(i.toString()))throw new Error("Invalid redirect location");let l=lo(i.pathname,n)!=null;if(i.origin===t.origin&&l)return Q0(i.pathname)+i.search+i.hash}try{let o=r.createURL(e);if(Tb(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function _c(e,t,n,r){let o=e.createURL(IM(t)).toString(),i={signal:n};if(r&&Fr(r.formMethod)){let{formMethod:l,formEncType:c}=r;i.method=l.toUpperCase(),c==="application/json"?(i.headers=new Headers({"Content-Type":c}),i.body=JSON.stringify(r.json)):c==="text/plain"?i.body=r.text:c==="application/x-www-form-urlencoded"&&r.formData?i.body=Ob(r.formData):i.body=r.formData}return new Request(o,i)}function PM(e,t){let n=new URL(e.url),r=typeof t=="string"?Fs(t):t;if(n.pathname=r.pathname||"/",r.search){let o=new URLSearchParams(r.search),i=o.getAll("index");o.delete("index");for(let l of i.filter(Boolean))o.append("index",l);n.search=o.size?`?${o.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function Ob(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function ZR(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function o5(e,t,n,r=!1,o=!1){let i={},l=null,c,f=!1,d={},p=n&&wo(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let y=g.route.id,v=t[y];if(Lt(!tl(v),"Cannot handle redirect results in processLoaderData"),wo(v)){let x=v.error;if(p!==void 0&&(x=p,p=void 0),l=l||{},o)l[y]=x;else{let E=la(e,y);l[E.route.id]==null&&(l[E.route.id]=x)}r||(i[y]=NM),f||(f=!0,c=Kd(v.error)?v.error.status:500),v.headers&&(d[y]=v.headers)}else i[y]=v.data,v.statusCode&&v.statusCode!==200&&!f&&(c=v.statusCode),v.headers&&(d[y]=v.headers)}),p!==void 0&&n&&(l={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:l,statusCode:c||200,loaderHeaders:d}}function GR(e,t,n,r,o,i,l){let{loaderData:c,errors:f}=o5(t,n,r);return o.filter(d=>!d.matches||d.matches.some(p=>p.shouldLoad)).forEach(d=>{let{key:p,match:g,controller:y}=d;if(y&&y.signal.aborted)return;let v=i[p];if(Lt(v,"Did not find corresponding fetcher result"),wo(v)){let x=la(e.matches,g?.route.id);f&&f[x.route.id]||(f={...f,[x.route.id]:v.error}),l.delete(p)}else if(tl(v))Lt(!1,"Unhandled fetcher revalidation redirect");else{let x=js(v.data);l.set(p,x)}}),{loaderData:c,errors:f}}function KR(e,t,n,r){let o=Object.entries(t).filter(([,i])=>i!==NM).reduce((i,[l,c])=>(i[l]=c,i),{});for(let i of n){let l=i.route.id;if(!t.hasOwnProperty(l)&&e.hasOwnProperty(l)&&i.route.loader&&(o[l]=e[l]),r&&r.hasOwnProperty(l))break}return o}function XR(e){return e?wo(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function la(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function cp(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Lo(e,{pathname:t,routeId:n,method:r,type:o,message:i}={}){let l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",r&&t&&n?c=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c=`Route "${n}" does not match URL "${t}"`):e===404?(l="Not Found",c=`No route matches URL "${t}"`):e===405&&(l="Method Not Allowed",r&&t&&n?c=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(c=`Invalid request method "${r.toUpperCase()}"`)),new vf(e||500,l,new Error(c),!0)}function up(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(tl(o))return{key:r,result:o}}}function IM(e){let t=typeof e=="string"?Fs(e):e;return $s({...t,hash:""})}function s5(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function i5(e){return new vf(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function a5(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&l5(n))}function l5(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function c5(e){return J0(e.result)&&RM.has(e.result.status)}function wo(e){return e.type==="error"}function tl(e){return(e&&e.type)==="redirect"}function QR(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function J0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function u5(e){return RM.has(e)}function d5(e){return J0(e)&&u5(e.status)&&e.headers.has("Location")}function f5(e){return F$.has(e.toUpperCase())}function Fr(e){return L$.has(e.toUpperCase())}function ew(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Xp(e,t){let n=typeof t=="string"?Fs(t).search:t.search;if(e[e.length-1].route.index&&ew(n||""))return e[e.length-1];let r=wM(e);return r[r.length-1]}function WR(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:l}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:l,text:void 0}}}function _x(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function h5(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function md(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function p5(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function js(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 m5(e,t){try{let n=e.sessionStorage.getItem(jM);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function g5(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(jM,JSON.stringify(n))}catch(r){nr(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function JR(){let e,t,n=new Promise((r,o)=>{e=async i=>{r(i);try{await n}catch{}},t=async i=>{o(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var _l=b.createContext(null);_l.displayName="DataRouter";var bf=b.createContext(null);bf.displayName="DataRouterState";var zM=b.createContext(!1);function LM(){return b.useContext(zM)}var tw=b.createContext({isTransitioning:!1});tw.displayName="ViewTransition";var $M=b.createContext(new Map);$M.displayName="Fetchers";var y5=b.createContext(null);y5.displayName="Await";var Bo=b.createContext(null);Bo.displayName="Navigation";var ig=b.createContext(null);ig.displayName="Location";var ls=b.createContext({outlet:null,matches:[],isDataRoute:!1});ls.displayName="Route";var nw=b.createContext(null);nw.displayName="RouteError";var FM="REACT_ROUTER_ERROR",v5="REDIRECT",x5="ROUTE_ERROR_RESPONSE";function b5(e){if(e.startsWith(`${FM}:${v5}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function w5(e){if(e.startsWith(`${FM}:${x5}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new vf(t.status,t.statusText,t.data)}catch{}}function S5(e,{relative:t}={}){Lt(wf(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=b.useContext(Bo),{hash:o,pathname:i,search:l}=Ef(e,{relative:t}),c=i;return n!=="/"&&(c=i==="/"?n:Vo([n,i])),r.createHref({pathname:c,search:l,hash:o})}function wf(){return b.useContext(ig)!=null}function Vs(){return Lt(wf(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(ig).location}var VM="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function UM(e){b.useContext(Bo).static||b.useLayoutEffect(e)}function Sa(){let{isDataRoute:e}=b.useContext(ls);return e?L5():E5()}function E5(){Lt(wf(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(_l),{basename:t,navigator:n}=b.useContext(Bo),{matches:r}=b.useContext(ls),{pathname:o}=Vs(),i=JSON.stringify(X0(r)),l=b.useRef(!1);return UM(()=>{l.current=!0}),b.useCallback((f,d={})=>{if(nr(l.current,VM),!l.current)return;if(typeof f=="number"){n.go(f);return}let p=sg(f,JSON.parse(i),o,d.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Vo([t,p.pathname])),(d.replace?n.replace:n.push)(p,d.state,d)},[t,n,i,o,e])}var C5=b.createContext(null);function _5(e){let t=b.useContext(ls).outlet;return b.useMemo(()=>t&&b.createElement(C5.Provider,{value:e},t),[t,e])}function Sf(){let{matches:e}=b.useContext(ls);return e[e.length-1]?.params??{}}function Ef(e,{relative:t}={}){let{matches:n}=b.useContext(ls),{pathname:r}=Vs(),o=JSON.stringify(X0(n));return b.useMemo(()=>sg(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function R5(e,t,n){Lt(wf(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(Bo),{matches:o}=b.useContext(ls),i=o[o.length-1],l=i?i.params:{},c=i?i.pathname:"/",f=i?i.pathnameBase:"/",d=i&&i.route;{let S=d&&d.path||"";qM(c,!d||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${S}">) 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.
|
|
11
|
+
|
|
12
|
+
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let p=Vs(),g;g=p;let y=g.pathname||"/",v=y;if(f!=="/"){let S=f.replace(/^\//,"").split("/");v="/"+y.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):mM(e,{pathname:v});return nr(d||x!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),nr(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.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.`),M5(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:Vo([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Vo([f,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,n)}function j5(){let e=P5(),t=Kd(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:i},"ErrorBoundary")," or"," ",b.createElement("code",{style:i},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:o},n):null,l)}var N5=b.createElement(j5,null),HM=class extends b.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,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):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 n=w5(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(ls.Provider,{value:this.props.routeContext},b.createElement(nw.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(T5,{error:e},t):t}};HM.contextType=zM;var Rx=new WeakMap;function T5({children:e,error:t}){let{basename:n}=b.useContext(Bo);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=b5(t.digest);if(r){let o=Rx.get(t);if(o)throw o;let i=EM(r.location,n),l=i.absoluteURL||i.to;if(Tb(l))throw new Error("Invalid redirect location");if(SM&&!Rx.get(t))if(i.isExternal||r.reloadDocument)window.location.href=l;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Rx.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function O5({routeContext:e,match:t,children:n}){let r=b.useContext(_l);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(ls.Provider,{value:e},n)}function M5(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,i=r?.errors;if(i!=null){let p=o.findIndex(g=>g.route.id&&i?.[g.route.id]!==void 0);Lt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let l=!1,c=-1;if(n&&r){l=r.renderFallback;for(let p=0;p<o.length;p++){let g=o[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=p),g.route.id){let{loaderData:y,errors:v}=r,x=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||x){n.isStatic&&(l=!0),c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}}let f=n?.onError,d=r&&f?(p,g)=>{f(p,{location:r.location,params:r.matches?.[0]?.params??{},pattern:xf(r.matches),errorInfo:g})}:void 0;return o.reduceRight((p,g,y)=>{let v,x=!1,E=null,S=null;r&&(v=i&&g.route.id?i[g.route.id]:void 0,E=g.route.errorElement||N5,l&&(c<0&&y===0?(qM("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):c===y&&(x=!0,S=g.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,y+1)),j=()=>{let R;return v?R=E:x?R=S:g.route.Component?R=b.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=p,b.createElement(O5,{match:g,routeContext:{outlet:p,matches:_,isDataRoute:r!=null},children:R})};return r&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?b.createElement(HM,{location:r.location,revalidation:r.revalidation,component:E,error:v,children:j(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:d}):j()},null)}function rw(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function BM(e){let t=b.useContext(_l);return Lt(t,rw(e)),t}function ow(e){let t=b.useContext(bf);return Lt(t,rw(e)),t}function k5(e){let t=b.useContext(ls);return Lt(t,rw(e)),t}function sw(e){let t=k5(e),n=t.matches[t.matches.length-1];return Lt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function A5(){return sw("useRouteId")}function D5(){let{matches:e,loaderData:t}=ow("useMatches");return b.useMemo(()=>e.map(n=>gM(n,t)),[e,t])}function P5(){let e=b.useContext(nw),t=ow("useRouteError"),n=sw("useRouteError");return e!==void 0?e:t.errors?.[n]}var I5=0;function z5(e){let{router:t,basename:n}=BM("useBlocker"),r=ow("useBlocker"),[o,i]=b.useState(""),l=b.useCallback(c=>{if(typeof e!="function")return!!e;if(n==="/")return e(c);let{currentLocation:f,nextLocation:d,historyAction:p}=c;return e({currentLocation:{...f,pathname:lo(f.pathname,n)||f.pathname},nextLocation:{...d,pathname:lo(d.pathname,n)||d.pathname},historyAction:p})},[n,e]);return b.useEffect(()=>{let c=String(++I5);return i(c),()=>t.deleteBlocker(c)},[t]),b.useEffect(()=>{o!==""&&t.getBlocker(o,l)},[t,o,l]),o&&r.blockers.has(o)?r.blockers.get(o):Sc}function L5(){let{router:e}=BM("useNavigate"),t=sw("useNavigate"),n=b.useRef(!1);return UM(()=>{n.current=!0}),b.useCallback(async(o,i={})=>{nr(n.current,VM),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var ej={};function qM(e,t,n){!t&&!ej[e]&&(ej[e]=!0,nr(!1,n))}var tj={};function nj(e,t){!e&&!tj[t]&&(tj[t]=!0,console.warn(t))}var $5="useOptimistic",rj=Cl[$5],F5=()=>{};function V5(e){return rj?rj(e):[e,F5]}function U5(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&nr(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:b.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&nr(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&nr(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var H5=["HydrateFallback","hydrateFallbackElement"],B5=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function q5({router:e,flushSync:t,onError:n,useTransitions:r}){r=LM()||r;let[i,l]=b.useState(e.state),[c,f]=V5(i),[d,p]=b.useState(),[g,y]=b.useState({isTransitioning:!1}),[v,x]=b.useState(),[E,S]=b.useState(),[_,j]=b.useState(),R=b.useRef(new Map),N=b.useCallback((T,{deletedFetchers:L,newErrors:G,flushSync:B,viewTransitionOpts:V})=>{G&&n&&Object.values(G).forEach(I=>n(I,{location:T.location,params:T.matches[0]?.params??{},pattern:xf(T.matches)})),T.fetchers.forEach((I,z)=>{I.data!==void 0&&R.current.set(z,I.data)}),L.forEach(I=>R.current.delete(I)),nj(B===!1||t!=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 q=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(nj(V==null||q,"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."),!V||!q){t&&B?t(()=>l(T)):r===!1?l(T):b.startTransition(()=>{r===!0&&f(I=>oj(I,T)),l(T)});return}if(t&&B){t(()=>{E&&(v?.resolve(),E.skipTransition()),y({isTransitioning:!0,flushSync:!0,currentLocation:V.currentLocation,nextLocation:V.nextLocation})});let I=e.window.document.startViewTransition(()=>{t(()=>l(T))});I.finished.finally(()=>{t(()=>{x(void 0),S(void 0),p(void 0),y({isTransitioning:!1})})}),t(()=>S(I));return}E?(v?.resolve(),E.skipTransition(),j({state:T,currentLocation:V.currentLocation,nextLocation:V.nextLocation})):(p(T),y({isTransitioning:!0,flushSync:!1,currentLocation:V.currentLocation,nextLocation:V.nextLocation}))},[e.window,t,E,v,r,f,n]);b.useLayoutEffect(()=>e.subscribe(N),[e,N]),b.useEffect(()=>{g.isTransitioning&&!g.flushSync&&x(new B5)},[g]),b.useEffect(()=>{if(v&&d&&e.window){let T=d,L=v.promise,G=e.window.document.startViewTransition(async()=>{r===!1?l(T):b.startTransition(()=>{r===!0&&f(B=>oj(B,T)),l(T)}),await L});G.finished.finally(()=>{x(void 0),S(void 0),p(void 0),y({isTransitioning:!1})}),S(G)}},[d,v,e.window,r,f]),b.useEffect(()=>{v&&d&&c.location.key===d.location.key&&v.resolve()},[v,E,c.location,d]),b.useEffect(()=>{!g.isTransitioning&&_&&(p(_.state),y({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),j(void 0))},[g.isTransitioning,_]);let O=b.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:T=>e.navigate(T),push:(T,L,G)=>e.navigate(T,{state:L,preventScrollReset:G?.preventScrollReset}),replace:(T,L,G)=>e.navigate(T,{replace:!0,state:L,preventScrollReset:G?.preventScrollReset})}),[e]),k=e.basename||"/",M=b.useMemo(()=>({router:e,navigator:O,static:!1,basename:k,onError:n}),[e,O,k,n]);return b.createElement(b.Fragment,null,b.createElement(_l.Provider,{value:M},b.createElement(bf.Provider,{value:c},b.createElement($M.Provider,{value:R.current},b.createElement(tw.Provider,{value:g},b.createElement(K5,{basename:k,location:c.location,navigationType:c.historyAction,navigator:O,useTransitions:r},b.createElement(Y5,{routes:e.routes,manifest:e.manifest,future:e.future,state:c,isStatic:!1,onError:n})))))),null)}function oj(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var Y5=b.memo(Z5);function Z5({routes:e,manifest:t,future:n,state:r,isStatic:o,onError:i}){return R5(e,void 0,{manifest:t,state:r,isStatic:o,onError:i})}function G5(e){return _5(e.context)}function K5({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,useTransitions:l}){Lt(!wf(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),f=b.useMemo(()=>({basename:c,navigator:o,static:i,useTransitions:l,future:{}}),[c,o,i,l]);typeof n=="string"&&(n=Fs(n));let{pathname:d="/",search:p="",hash:g="",state:y=null,key:v="default",mask:x}=n,E=b.useMemo(()=>{let S=lo(d,c);return S==null?null:{location:{pathname:S,search:p,hash:g,state:y,key:v,mask:x},navigationType:r}},[c,d,p,g,y,v,r,x]);return nr(E!=null,`<Router basename="${c}"> is not able to match the URL "${d}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:b.createElement(Bo.Provider,{value:f},b.createElement(ig.Provider,{children:t,value:E}))}var Qp="get",Wp="application/x-www-form-urlencoded";function ag(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function X5(e){return ag(e)&&e.tagName.toLowerCase()==="button"}function Q5(e){return ag(e)&&e.tagName.toLowerCase()==="form"}function W5(e){return ag(e)&&e.tagName.toLowerCase()==="input"}function J5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function eF(e,t){return e.button===0&&(!t||t==="_self")&&!J5(e)}function Mb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function tF(e,t){let n=Mb(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var dp=null;function nF(){if(dp===null)try{new FormData(document.createElement("form"),0),dp=!1}catch{dp=!0}return dp}var rF=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jx(e){return e!=null&&!rF.has(e)?(nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wp}"`),null):e}function oF(e,t){let n,r,o,i,l;if(Q5(e)){let c=e.getAttribute("action");r=c?lo(c,t):null,n=e.getAttribute("method")||Qp,o=jx(e.getAttribute("enctype"))||Wp,i=new FormData(e)}else if(X5(e)||W5(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(r=f?lo(f,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Qp,o=jx(e.getAttribute("formenctype"))||jx(c.getAttribute("enctype"))||Wp,i=new FormData(c,e),!nF()){let{name:d,type:p,value:g}=e;if(p==="image"){let y=d?`${d}.`:"";i.append(`${y}x`,"0"),i.append(`${y}y`,"0")}else d&&i.append(d,g)}}else{if(ag(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Qp,r=null,o=Wp,l=e}return i&&o==="text/plain"&&(l=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function iw(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function YM(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&lo(o.pathname,t)==="/"?o.pathname=`${mm(t)}/_root.${r}`:o.pathname=`${mm(o.pathname)}.${r}`,o}async function sF(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function iF(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 aF(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let l=await sF(i,n);return l.links?l.links():[]}return[]}));return dF(r.flat(1).filter(iF).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function sj(e,t,n,r,o,i){let l=(f,d)=>n[d]?f.route.id!==n[d].route.id:!0,c=(f,d)=>n[d].pathname!==f.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==f.params["*"];return i==="assets"?t.filter((f,d)=>l(f,d)||c(f,d)):i==="data"?t.filter((f,d)=>{let p=r.routes[f.route.id];if(!p||!p.hasLoader)return!1;if(l(f,d)||c(f,d))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function lF(e,t,{includeHydrateFallback:n}={}){return cF(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function cF(e){return[...new Set(e)]}function uF(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function dF(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(uF(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function aw(){let e=b.useContext(_l);return iw(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function fF(){let e=b.useContext(bf);return iw(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var lw=b.createContext(void 0);lw.displayName="FrameworkContext";function lg(){let e=b.useContext(lw);return iw(e,"You must render this element inside a <HydratedRouter> element"),e}function hF(e,t){let n=b.useContext(lw),[r,o]=b.useState(!1),[i,l]=b.useState(!1),{onFocus:c,onBlur:f,onMouseEnter:d,onMouseLeave:p,onTouchStart:g}=t,y=b.useRef(null);b.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let E=_=>{_.forEach(j=>{l(j.isIntersecting)})},S=new IntersectionObserver(E,{threshold:.5});return y.current&&S.observe(y.current),()=>{S.disconnect()}}},[e]),b.useEffect(()=>{if(r){let E=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(E)}}},[r]);let v=()=>{o(!0)},x=()=>{o(!1),l(!1)};return n?e!=="intent"?[i,y,{}]:[i,y,{onFocus:gd(c,v),onBlur:gd(f,x),onMouseEnter:gd(d,v),onMouseLeave:gd(p,x),onTouchStart:gd(g,v)}]:[!1,y,{}]}function gd(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function pF({page:e,...t}){let n=LM(),{nonce:r}=lg(),{router:o}=aw(),i=b.useMemo(()=>mM(o.routes,e,o.basename),[o.routes,e,o.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?b.createElement(gF,{page:e,matches:i,...t}):b.createElement(yF,{page:e,matches:i,...t})):null}function mF(e){let{manifest:t,routeModules:n}=lg(),[r,o]=b.useState([]);return b.useEffect(()=>{let i=!1;return aF(e,t,n).then(l=>{i||o(l)}),()=>{i=!0}},[e,t,n]),r}function gF({page:e,matches:t,...n}){let r=Vs(),{future:o}=lg(),{basename:i}=aw(),l=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let c=YM(e,i,o.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,d=[];for(let p of t)typeof p.route.shouldRevalidate=="function"?f=!0:d.push(p.route.id);return f&&d.length>0&&c.searchParams.set("_routes",d.join(",")),[c.pathname+c.search]},[i,o.v8_trailingSlashAwareDataRequests,e,r,t]);return b.createElement(b.Fragment,null,l.map(c=>b.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...n})))}function yF({page:e,matches:t,...n}){let r=Vs(),{future:o,manifest:i,routeModules:l}=lg(),{basename:c}=aw(),{loaderData:f,matches:d}=fF(),p=b.useMemo(()=>sj(e,t,d,i,r,"data"),[e,t,d,i,r]),g=b.useMemo(()=>sj(e,t,d,i,r,"assets"),[e,t,d,i,r]),y=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let E=new Set,S=!1;if(t.forEach(j=>{let R=i.routes[j.route.id];!R||!R.hasLoader||(!p.some(N=>N.route.id===j.route.id)&&j.route.id in f&&l[j.route.id]?.shouldRevalidate||R.hasClientLoader?S=!0:E.add(j.route.id))}),E.size===0)return[];let _=YM(e,c,o.v8_trailingSlashAwareDataRequests,"data");return S&&E.size>0&&_.searchParams.set("_routes",t.filter(j=>E.has(j.route.id)).map(j=>j.route.id).join(",")),[_.pathname+_.search]},[c,o.v8_trailingSlashAwareDataRequests,f,r,i,p,t,e,l]),v=b.useMemo(()=>lF(g,i),[g,i]),x=mF(g);return b.createElement(b.Fragment,null,y.map(E=>b.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...n})),v.map(E=>b.createElement("link",{key:E,rel:"modulepreload",href:E,...n})),x.map(({key:E,link:S})=>b.createElement("link",{key:E,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function vF(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var xF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{xF&&(window.__reactRouterVersion="7.18.2")}catch{}function bF(e,t){return q$({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:a$({window:t?.window}),hydrationData:wF(),routes:e,mapRouteProperties:U5,hydrationRouteProperties:H5,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function wF(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:SF(e.errors)}),e}function SF(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new vf(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&M$.includes(o.__subType)){let i=window[o.__subType];if(typeof i=="function")try{let l=new i(o.message);l.stack="",n[r]=l}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}var cn=b.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:l,mask:c,state:f,target:d,to:p,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:v,...x},E){let{basename:S,navigator:_,useTransitions:j}=b.useContext(Bo),R=typeof p=="string"&&og.test(p),N=EM(p,S);p=N.to;let O=S5(p,{relative:o}),k=Vs(),M=null;if(c){let z=sg(c,[],k.mask?k.mask.pathname:"/",!0);S!=="/"&&(z.pathname=z.pathname==="/"?S:Vo([S,z.pathname])),M=_.createHref(z)}let[T,L,G]=hF(r,x),B=_F(p,{replace:l,mask:c,state:f,target:d,preventScrollReset:g,relative:o,viewTransition:y,defaultShouldRevalidate:v,useTransitions:j});function V(z){t&&t(z),z.defaultPrevented||B(z)}let q=!(N.isExternal||i),I=b.createElement("a",{...x,...G,href:(q?M:void 0)||N.absoluteURL||O,onClick:q?V:t,ref:vF(E,L),target:d,"data-discover":!R&&n==="render"?"true":void 0});return T&&!R?b.createElement(b.Fragment,null,I,b.createElement(pF,{page:O})):I});cn.displayName="Link";var Ns=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:l,viewTransition:c,children:f,...d},p){let g=Ef(l,{relative:d.relative}),y=Vs(),v=b.useContext(bf),{navigator:x,basename:E}=b.useContext(Bo),S=v!=null&&OF(g)&&c===!0,_=x.encodeLocation?x.encodeLocation(g).pathname:g.pathname,j=y.pathname,R=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(j=j.toLowerCase(),R=R?R.toLowerCase():null,_=_.toLowerCase()),R&&E&&(R=lo(R,E)||R);const N=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let O=j===_||!o&&j.startsWith(_)&&j.charAt(N)==="/",k=R!=null&&(R===_||!o&&R.startsWith(_)&&R.charAt(_.length)==="/"),M={isActive:O,isPending:k,isTransitioning:S},T=O?t:void 0,L;typeof r=="function"?L=r(M):L=[r,O?"active":null,k?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let G=typeof i=="function"?i(M):i;return b.createElement(cn,{...d,"aria-current":T,className:L,ref:p,style:G,to:l,viewTransition:c},typeof f=="function"?f(M):f)});Ns.displayName="NavLink";var EF=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:l=Qp,action:c,onSubmit:f,relative:d,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:y,...v},x)=>{let{useTransitions:E}=b.useContext(Bo),S=NF(),_=TF(c,{relative:d}),j=l.toLowerCase()==="get"?"get":"post",R=typeof c=="string"&&og.test(c),N=O=>{if(f&&f(O),O.defaultPrevented)return;O.preventDefault();let k=O.nativeEvent.submitter,M=k?.getAttribute("formmethod")||l,T=()=>S(k||O.currentTarget,{fetcherKey:t,method:M,navigate:n,replace:o,state:i,relative:d,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:y});E&&n!==!1?b.startTransition(()=>T()):T()};return b.createElement("form",{ref:x,method:j,action:_,onSubmit:r?f:N,...v,"data-discover":!R&&e==="render"?"true":void 0})});EF.displayName="Form";function CF(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZM(e){let t=b.useContext(_l);return Lt(t,CF(e)),t}function _F(e,{target:t,replace:n,mask:r,state:o,preventScrollReset:i,relative:l,viewTransition:c,defaultShouldRevalidate:f,useTransitions:d}={}){let p=Sa(),g=Vs(),y=Ef(e,{relative:l});return b.useCallback(v=>{if(eF(v,t)){v.preventDefault();let x=n!==void 0?n:$s(g)===$s(y),E=()=>p(e,{replace:x,mask:r,state:o,preventScrollReset:i,relative:l,viewTransition:c,defaultShouldRevalidate:f});d?b.startTransition(()=>E()):E()}},[g,p,y,n,r,o,t,e,i,l,c,f,d])}function cg(e){nr(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 t=b.useRef(Mb(e)),n=b.useRef(!1),r=Vs(),o=b.useMemo(()=>tF(r.search,n.current?null:t.current),[r.search]),i=Sa(),l=b.useCallback((c,f)=>{const d=Mb(typeof c=="function"?c(new URLSearchParams(o)):c);n.current=!0,i("?"+d,f)},[i,o]);return[o,l]}var RF=0,jF=()=>`__${String(++RF)}__`;function NF(){let{router:e}=ZM("useSubmit"),{basename:t}=b.useContext(Bo),n=A5(),r=e.fetch,o=e.navigate;return b.useCallback(async(i,l={})=>{let{action:c,method:f,encType:d,formData:p,body:g}=oF(i,t);if(l.navigate===!1){let y=l.fetcherKey||jF();await r(y,n,l.action||c,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:p,body:g,formMethod:l.method||f,formEncType:l.encType||d,flushSync:l.flushSync})}else await o(l.action||c,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:p,body:g,formMethod:l.method||f,formEncType:l.encType||d,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,o,t,n])}function TF(e,{relative:t}={}){let{basename:n}=b.useContext(Bo),r=b.useContext(ls);Lt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...Ef(e||".",{relative:t})},l=Vs();if(e==null){i.search=l.search;let c=new URLSearchParams(i.search),f=c.getAll("index");if(f.some(p=>p==="")){c.delete("index"),f.filter(g=>g).forEach(g=>c.append("index",g));let p=c.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Vo([n,i.pathname])),$s(i)}function OF(e,{relative:t}={}){let n=b.useContext(tw);Lt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ZM("useViewTransitionState"),o=Ef(e,{relative:t});if(!n.isTransitioning)return!1;let i=lo(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=lo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return pm(o.pathname,l)!=null||pm(o.pathname,i)!=null}var Co=eM();const MF=V0(Co);function kF(e){return b.createElement(q5,{flushSync:Co.flushSync,...e})}function AF(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const DF=e=>{switch(e){case"success":return zF;case"info":return $F;case"warning":return LF;case"error":return FF;default:return null}},PF=Array(12).fill(0),IF=({visible:e,className:t})=>Ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ee.createElement("div",{className:"sonner-spinner"},PF.map((n,r)=>Ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),zF=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),LF=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$F=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),FF=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),VF=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),UF=()=>{const[e,t]=Ee.useState(document.hidden);return Ee.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e};let HF=1;const BF=100,ij=e=>{var t;return typeof e?.id=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:HF++};class qF{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(n=>t(n)),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-BF;t<=0||(this.toasts=this.toasts.filter(n=>t>0&&this.dismissedToasts.has(n.id)?(this.dismissedToasts.delete(n.id),t--,!1):!0))},this.create=t=>{const{message:n,...r}=t,o=ij(t),i=this.pendingDismissals.get(o);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o));const l=this.dismissedToasts.has(o),c=t.dismissible===void 0?!0:t.dismissible;return l&&(this.dismissedToasts.delete(o),this.toasts=this.toasts.filter(d=>d.id!==o)),(l?void 0:this.toasts.find(d=>d.id===o))?this.toasts=this.toasts.map(d=>d.id===o?(this.publish({...d,...t,id:o,title:n}),{...d,...t,id:o,dismissible:c,title:n}):d):this.addToast({title:n,...r,dismissible:c,id:o}),o},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);const n=this.pendingDismissals.get(t);return n!==void 0&&cancelAnimationFrame(n),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(r=>r({id:t,dismiss:!0}))})),t},this.message=(t,n)=>this.create({...n,message:t,type:void 0}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,l;const c=o.then(async d=>{if(l=["resolve",d],Ee.isValidElement(d))i=!1,this.create({id:r,type:"default",message:d});else if(ZF(d)&&!d.ok){i=!1;const g=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,y=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof g=="object"&&!Ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:y,...x})}else if(d instanceof Error){i=!1;const g=typeof n.error=="function"?await n.error(d):n.error,y=typeof n.description=="function"?await n.description(d):n.description,x=typeof g=="object"&&!Ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:y,...x})}else if(n.success!==void 0){i=!1;const g=typeof n.success=="function"?await n.success(d):n.success,y=typeof n.description=="function"?await n.description(d):n.description,x=typeof g=="object"&&!Ee.isValidElement(g)?g:{message:g};this.create({id:r,type:"success",description:y,...x})}}).catch(async d=>{if(l=["reject",d],n.error!==void 0){i=!1;const p=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,v=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:g,...v})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),f=()=>new Promise((d,p)=>c.then(()=>l[0]==="reject"?p(l[1]):d(l[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:f}:Object.assign(r,{unwrap:f})},this.custom=(t,n)=>{const r=ij(n);return this.create({...n,jsx:t(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const ro=new qF,YF=(e,t)=>ro.message(e,t),ZF=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",GF=YF,KF=()=>ro.toasts,XF=()=>ro.getActiveToasts(),ut=Object.assign(GF,{success:ro.success,info:ro.info,warning:ro.warning,error:ro.error,custom:ro.custom,message:ro.message,promise:ro.promise,dismiss:ro.dismiss,loading:ro.loading},{getHistory:KF,getToasts:XF});AF("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function fp(e){return e.label!==void 0}const QF=3,WF="24px",JF="16px",aj=4e3,eV=356,tV=14,nV=45,rV=200;function _s(...e){return e.filter(Boolean).join(" ")}function oV(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const sV=e=>{var t,n,r,o,i,l,c,f,d;const{invert:p,toast:g,unstyled:y,interacting:v,setHeights:x,visibleToasts:E,heights:S,index:_,toasts:j,expanded:R,removeToast:N,defaultRichColors:O,closeButton:k,style:M,cancelButtonStyle:T,actionButtonStyle:L,className:G="",descriptionClassName:B="",duration:V,position:q,gap:I,expandByDefault:z,classNames:A,icons:P,closeButtonAriaLabel:U="Close toast"}=e,[H,Y]=Ee.useState(null),[$,F]=Ee.useState(null),[Q,X]=Ee.useState(!1),[ne,te]=Ee.useState(!1),[J,K]=Ee.useState(!1),[re,ye]=Ee.useState(!1),[fe,ue]=Ee.useState(!1),[he,Re]=Ee.useState(0),[ze,Ue]=Ee.useState(0),Ae=Ee.useRef(g.duration||V||aj),Qe=Ee.useRef(null),De=Ee.useRef(null),Le=_===0,Fe=_+1<=E,Ye=g.type,et=Ye??"default",me=g.dismissible!==!1,xe=g.className||"",We=g.descriptionClassName||"",Oe=Ee.useMemo(()=>S.findIndex(nt=>nt.toastId===g.id)||0,[S,g.id]),Ie=Ee.useMemo(()=>{var nt;return(nt=g.closeButton)!=null?nt:k},[g.closeButton,k]),at=Ee.useMemo(()=>g.duration||V||aj,[g.duration,V]),it=Ee.useRef(0),$t=Ee.useRef(0),W=Ee.useRef(0),ie=Ee.useRef(null),[ae,Se]=q.split("-"),be=Ee.useMemo(()=>S.reduce((nt,wt,Dt)=>Dt>=Oe?nt:nt+wt.height,0),[S,Oe]),Ve=UF(),Me=Ee.useMemo(()=>{var nt;return(nt=e.swipeDirections)!=null?nt:oV(q)},[e.swipeDirections,q]),$e=g.invert||p,He=Ye==="loading";$t.current=Ee.useMemo(()=>Oe*I+be,[Oe,be]),Ee.useEffect(()=>{Ae.current=at},[at]),Ee.useEffect(()=>{X(!0)},[]),Ee.useEffect(()=>{const nt=De.current;if(nt){const wt=nt.getBoundingClientRect().height;return Ue(wt),x(Dt=>[{toastId:g.id,height:wt,position:g.position},...Dt]),()=>x(Dt=>Dt.filter(St=>St.toastId!==g.id))}},[x,g.id]),Ee.useLayoutEffect(()=>{if(!Q)return;const nt=De.current,wt=nt.style.height;nt.style.height="auto";const Dt=nt.getBoundingClientRect().height;nt.style.height=wt,Ue(Dt),x(St=>St.find(Qt=>Qt.toastId===g.id)?St.map(Qt=>Qt.toastId===g.id?{...Qt,height:Dt}:Qt):[{toastId:g.id,height:Dt,position:g.position},...St])},[Q,g.title,g.description,x,g.id,g.jsx,g.action,g.cancel]);const Xe=Ee.useCallback(()=>{te(!0),Re($t.current),x(nt=>nt.filter(wt=>wt.toastId!==g.id)),setTimeout(()=>{N(g)},rV)},[g,N,x,$t]);Ee.useEffect(()=>{if(g.promise&&Ye==="loading"||g.duration===1/0||g.type==="loading")return;let nt;return R||v||Ve?(()=>{if(W.current<it.current){const St=new Date().getTime()-it.current;Ae.current=Ae.current-St}W.current=new Date().getTime()})():Ae.current!==1/0&&(it.current=new Date().getTime(),nt=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),Xe()},Ae.current)),()=>clearTimeout(nt)},[R,v,g,Ye,Ve,Xe]),Ee.useEffect(()=>{g.delete&&(Xe(),g.onDismiss==null||g.onDismiss.call(g,g))},[Xe,g.delete]);function Je(){var nt;if(P?.loading){var wt;return Ee.createElement("div",{className:_s(A?.loader,g==null||(wt=g.classNames)==null?void 0:wt.loader,"sonner-loader"),"data-visible":Ye==="loading"},P.loading)}return Ee.createElement(IF,{className:_s(A?.loader,g==null||(nt=g.classNames)==null?void 0:nt.loader),visible:Ye==="loading"})}const bt=g.icon||P?.[Ye]||DF(Ye);var Mt,kt;return Ee.createElement("li",{tabIndex:0,ref:De,className:_s(G,xe,A?.toast,g==null||(t=g.classNames)==null?void 0:t.toast,A?.[et],g==null||(n=g.classNames)==null?void 0:n[et]),"data-sonner-toast":"","data-rich-colors":(Mt=g.richColors)!=null?Mt:O,"data-styled":!(g.jsx||g.unstyled||y),"data-mounted":Q,"data-promise":!!g.promise,"data-swiped":fe,"data-removed":ne,"data-visible":Fe,"data-y-position":ae,"data-x-position":Se,"data-index":_,"data-front":Le,"data-swiping":J,"data-dismissible":me,"data-type":Ye,"data-invert":$e,"data-swipe-out":re,"data-swipe-direction":$,"data-expanded":!!(R||z&&Q),"data-testid":g.testId,style:{"--index":_,"--toasts-before":_,"--z-index":j.length-_,"--offset":`${ne?he:$t.current}px`,"--initial-height":z?"auto":`${ze}px`,...M,...g.style},onDragEnd:()=>{K(!1),Y(null),ie.current=null},onPointerDown:nt=>{nt.button!==2&&(He||!me||(Qe.current=new Date,Re($t.current),nt.target.setPointerCapture(nt.pointerId),nt.target.tagName!=="BUTTON"&&(K(!0),ie.current={x:nt.clientX,y:nt.clientY})))},onPointerUp:()=>{var nt,wt,Dt;if(re||!me)return;ie.current=null;const St=Number(((nt=De.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),In=Number(((wt=De.current)==null?void 0:wt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Qt=new Date().getTime()-((Dt=Qe.current)==null?void 0:Dt.getTime()),wn=H==="x"?St:In,ee=Math.abs(wn)/Qt;if((H==="x"?Me.includes(St>0?"right":"left"):Me.includes(In>0?"bottom":"top"))&&(Math.abs(wn)>=nV||ee>.11)){Re($t.current),g.onDismiss==null||g.onDismiss.call(g,g),F(H==="x"?St>0?"right":"left":In>0?"down":"up"),Xe(),ye(!0);return}else{var ce,Ce;(ce=De.current)==null||ce.style.setProperty("--swipe-amount-x","0px"),(Ce=De.current)==null||Ce.style.setProperty("--swipe-amount-y","0px")}ue(!1),K(!1),Y(null)},onPointerMove:nt=>{var wt,Dt,St;if(!ie.current||!me||((wt=window.getSelection())==null?void 0:wt.toString().length)>0)return;const Qt=nt.clientY-ie.current.y,wn=nt.clientX-ie.current.x;!H&&(Math.abs(wn)>1||Math.abs(Qt)>1)&&Y(Math.abs(wn)>Math.abs(Qt)?"x":"y");let ee={x:0,y:0};const se=ce=>1/(1.5+Math.abs(ce)/20);if(H==="y"){if(Me.includes("top")||Me.includes("bottom"))if(Me.includes("top")&&Qt<0||Me.includes("bottom")&&Qt>0)ee.y=Qt;else{const ce=Qt*se(Qt);ee.y=Math.abs(ce)<Math.abs(Qt)?ce:Qt}}else if(H==="x"&&(Me.includes("left")||Me.includes("right")))if(Me.includes("left")&&wn<0||Me.includes("right")&&wn>0)ee.x=wn;else{const ce=wn*se(wn);ee.x=Math.abs(ce)<Math.abs(wn)?ce:wn}(Math.abs(ee.x)>0||Math.abs(ee.y)>0)&&ue(!0),(Dt=De.current)==null||Dt.style.setProperty("--swipe-amount-x",`${ee.x}px`),(St=De.current)==null||St.style.setProperty("--swipe-amount-y",`${ee.y}px`)}},Ie&&!g.jsx&&Ye!=="loading"?Ee.createElement("button",{"aria-label":U,"data-disabled":He,"data-close-button":!0,onClick:He||!me?()=>{}:()=>{Xe(),g.onDismiss==null||g.onDismiss.call(g,g)},className:_s(A?.closeButton,g==null||(r=g.classNames)==null?void 0:r.closeButton)},(kt=P?.close)!=null?kt:VF):null,(Ye||g.icon||g.promise)&&g.icon!==null&&(P?.[Ye]!==null||g.icon)?Ee.createElement("div",{"data-icon":"",className:_s(A?.icon,g==null||(o=g.classNames)==null?void 0:o.icon)},Ye==="loading"?g.icon||Je():g.promise?Je():null,Ye!=="loading"?bt:null):null,Ee.createElement("div",{"data-content":"",className:_s(A?.content,g==null||(i=g.classNames)==null?void 0:i.content)},Ee.createElement("div",{"data-title":"",className:_s(A?.title,g==null||(l=g.classNames)==null?void 0:l.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?Ee.createElement("div",{"data-description":"",className:_s(B,We,A?.description,g==null||(c=g.classNames)==null?void 0:c.description)},typeof g.description=="function"?g.description():g.description):null),Ee.isValidElement(g.cancel)?g.cancel:g.cancel&&fp(g.cancel)?Ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||T,onClick:nt=>{fp(g.cancel)&&me&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,nt),Xe())},className:_s(A?.cancelButton,g==null||(f=g.classNames)==null?void 0:f.cancelButton)},g.cancel.label):null,Ee.isValidElement(g.action)?g.action:g.action&&fp(g.action)?Ee.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||L,onClick:nt=>{fp(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,nt),!nt.defaultPrevented&&Xe())},className:_s(A?.actionButton,g==null||(d=g.classNames)==null?void 0:d.actionButton)},g.action.label):null)};function lj(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function iV(e,t){const n={};return[e,t].forEach((r,o)=>{const i=o===1,l=i?"--mobile-offset":"--offset",c=i?JF:WF;function f(d){["top","right","bottom","left"].forEach(p=>{n[`${l}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?f(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${l}-${d}`]=c:n[`${l}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):f(c)}),n}const aV=Ee.forwardRef(function(t,n){const{id:r,invert:o,position:i="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:f,className:d,offset:p,mobileOffset:g,theme:y="light",richColors:v,duration:x,style:E,visibleToasts:S=QF,toastOptions:_,dir:j=lj(),gap:R=tV,icons:N,customAriaLabel:O,containerAriaLabel:k="Notifications"}=t,[M,T]=Ee.useState([]),L=Ee.useMemo(()=>r?M.filter(X=>X.toasterId===r):M.filter(X=>!X.toasterId),[M,r]),G=Ee.useMemo(()=>Array.from(new Set([i].concat(L.filter(X=>X.position).map(X=>X.position)))),[L,i]),[B,V]=Ee.useState([]),[q,I]=Ee.useState(!1),[z,A]=Ee.useState(!1),[P,U]=Ee.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ee.useRef(null),Y=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=Ee.useRef(null),F=Ee.useRef(!1),Q=Ee.useCallback(X=>{T(ne=>{var te;return(te=ne.find(J=>J.id===X.id))!=null&&te.delete||ro.dismiss(X.id),ne.filter(({id:J})=>J!==X.id)})},[]);return Ee.useEffect(()=>ro.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{T(ne=>ne.map(te=>te.id===X.id?{...te,delete:!0}:te))});return}setTimeout(()=>{MF.flushSync(()=>{T(ne=>{const te=ne.findIndex(J=>J.id===X.id);return te!==-1?[...ne.slice(0,te),{...ne[te],...X},...ne.slice(te+1)]:[X,...ne]})})})}),[]),Ee.useEffect(()=>{if(y!=="system"){U(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:ne})=>{U(ne?"dark":"light")})}catch{X.addListener(({matches:te})=>{try{U(te?"dark":"light")}catch(J){console.error(J)}})}},[y]),Ee.useEffect(()=>{M.length<=1&&I(!1)},[M]),Ee.useEffect(()=>{const X=ne=>{var te;if(l.length>0&&l.every(re=>ne[re]||ne.code===re)){var K;I(!0),(K=H.current)==null||K.focus()}ne.code==="Escape"&&(document.activeElement===H.current||(te=H.current)!=null&&te.contains(document.activeElement))&&I(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[l]),Ee.useEffect(()=>{if(H.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,F.current=!1)}},[H.current]),Ee.createElement("section",{ref:n,"aria-label":O??`${k} ${Y}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},G.map((X,ne)=>{var te;const[J,K]=X.split("-");return L.length?Ee.createElement("ol",{key:X,dir:j==="auto"?lj():j,tabIndex:-1,ref:H,className:d,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":J,"data-x-position":K,style:{"--front-toast-height":`${((te=B[0])==null?void 0:te.height)||0}px`,"--width":`${eV}px`,"--gap":`${R}px`,...E,...iV(p,g)},onBlur:re=>{F.current&&!re.currentTarget.contains(re.relatedTarget)&&(F.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||F.current||(F.current=!0,$.current=re.relatedTarget)},onMouseEnter:()=>I(!0),onMouseMove:()=>I(!0),onMouseLeave:()=>{z||I(!1)},onDragEnd:()=>I(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},L.filter(re=>!re.position&&ne===0||re.position===X).map((re,ye)=>{var fe,ue;return Ee.createElement(sV,{key:re.id,icons:N,index:ye,toast:re,defaultRichColors:v,duration:(fe=_?.duration)!=null?fe:x,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:o,visibleToasts:S,closeButton:(ue=_?.closeButton)!=null?ue:f,interacting:z,position:X,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:Q,toasts:L.filter(he=>he.position==re.position),heights:B.filter(he=>he.position==re.position),setHeights:V,expandByDefault:c,gap:R,expanded:q,swipeDirections:t.swipeDirections})})):null}))});const GM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const lV=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const cV=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const cj=e=>{const t=cV(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Nx={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"};const uV=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},dV=b.createContext({}),fV=()=>b.useContext(dV),hV=b.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:i,iconNode:l,...c},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:y="currentColor",className:v=""}=fV()??{},x=r??g?Number(n??p)*24/Number(t??d):n??p;return b.createElement("svg",{ref:f,...Nx,width:t??d??Nx.width,height:t??d??Nx.height,stroke:e??y,strokeWidth:x,className:GM("lucide",v,o),...!i&&!uV(c)&&{"aria-hidden":"true"},...c},[...l.map(([E,S])=>b.createElement(E,S)),...Array.isArray(i)?i:[i]])});const or=(e,t)=>{const n=b.forwardRef(({className:r,...o},i)=>b.createElement(hV,{ref:i,iconNode:t,className:GM(`lucide-${lV(cj(e))}`,`lucide-${e}`,r),...o}));return n.displayName=cj(e),n};const pV=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],mV=or("arrow-down",pV);const gV=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Mc=or("arrow-left",gV);const yV=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vV=or("arrow-up",yV);const xV=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],uu=or("check",xV);const bV=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],KM=or("chevron-down",bV);const wV=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],SV=or("chevron-up",wV);const EV=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Cf=or("chevrons-up-down",EV);const CV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_V=or("circle-check",CV);const RV=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],jV=or("file-text",RV);const NV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],TV=or("info",NV);const OV=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],MV=or("layout-grid",OV);const kV=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],AV=or("loader-circle",kV);const DV=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 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-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PV=or("octagon-x",DV);const IV=[["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"}]],zV=or("pencil",IV);const LV=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gm=or("plus",LV);const $V=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],FV=or("save",$V);const VV=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],XM=or("search",VV);const UV=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],HV=or("settings",UV);const BV=[["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"}]],qV=or("trash-2",BV);const YV=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ZV=or("triangle-alert",YV);const GV=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ug=or("x",GV),KV=({...e})=>h.jsx(aV,{className:"toaster group",icons:{success:h.jsx(_V,{className:"size-4"}),info:h.jsx(TV,{className:"size-4"}),warning:h.jsx(ZV,{className:"size-4"}),error:h.jsx(PV,{className:"size-4"}),loading:h.jsx(AV,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e});class cw extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status;get displayMsg(){return this.message&&!this.message.startsWith("HTTP ")?`${this.message}(${this.status})`:{400:"请求参数错误(400)",404:"资源不存在(404)",409:"状态冲突(409)",422:"数据校验失败(422)"}[this.status]??`请求失败(HTTP ${this.status})`}}async function du(e){let t;try{const n=await e.json();if(typeof n.message=="string"&&n.message.length>0)t=n.message;else if(typeof n.error=="object"&&n.error!==null&&n.error.name==="ZodError"&&typeof n.error.message=="string")try{const r=JSON.parse(n.error.message),o=Array.isArray(r)?r[0]:void 0;if(o&&typeof o.message=="string"&&o.message.length>0){const i=Array.isArray(o.path)&&o.path.length>0?`(字段:${o.path.join(".")})`:"";t=`${o.message}${i}`}}catch{}}catch{}return new cw(e.status,t??`HTTP ${e.status}`)}const fu="/api";async function Ft(e,t){const n=await fetch(`${fu}${e}`,t);if(!n.ok)throw await du(n);return await n.json()}function Dn(e,t){return{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}}async function QM(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t&&n.set("q",t);const r=n.toString();return(await Ft(r?`/tasks?${r}`:"/tasks")).items}async function XV(e){return Ft(`/tasks/${encodeURIComponent(e)}`)}async function QV(e){return Ft("/tasks",Dn("POST",e))}async function WV(e,t){return Ft(`/tasks/${encodeURIComponent(e)}/advance`,Dn("POST",t?{note:t}:{}))}async function JV(e,t,n){return Ft(`/tasks/${encodeURIComponent(e)}/approve`,Dn("POST",{decision:t,...n?{comment:n}:{}}))}async function eU(e){return Ft(`/tasks/${encodeURIComponent(e)}/context?view=full`)}async function tU(e,t){return Ft(`/tasks/${encodeURIComponent(e)}/pause`,Dn("POST",t?{reason:t}:{}))}async function nU(e,t){return Ft(`/tasks/${encodeURIComponent(e)}/resume`,Dn("POST",t?{decision:t}:{}))}async function rU(e,t){return Ft(`/tasks/${encodeURIComponent(e)}/cancel`,Dn("POST",t?{reason:t}:{}))}async function oU(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true");const r=n.toString();return Ft(r?`/dag/templates?${r}`:"/dag/templates")}async function sU(e){return Ft(`/dag/templates/${encodeURIComponent(e)}`)}async function iU(e){return Ft("/dag/templates",Dn("POST",e))}async function aU(e,t){return Ft(`/dag/templates/${encodeURIComponent(e)}`,Dn("PUT",t))}async function lU(e){const t=await fetch(`${fu}/dag/templates/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await du(t)}async function cU(e,t){return Ft(`/dag/templates/${encodeURIComponent(e)}/copy`,Dn("POST",t))}async function uU(e,t){return Ft(`/dag/templates/${encodeURIComponent(e)}/enabled`,Dn("POST",{enabled:t}))}async function dU(e){return Ft(`/dag/templates/${encodeURIComponent(e)}/export`)}async function fU(e){return Ft("/dag/templates/import/plan",Dn("POST",e))}async function hU(e){return Ft("/dag/templates/import/apply",Dn("POST",e))}function Us(e){const t=[];return e?.scope&&t.push(`scope=${encodeURIComponent(e.scope)}`),e?.scope==="project"&&e.projectId&&t.push(`projectId=${encodeURIComponent(e.projectId)}`),e?.includeDisabled&&t.push("includeDisabled=true"),t.length>0?`?${t.join("&")}`:""}async function pU(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true"),t?.q&&n.set("q",t.q);const r=n.toString();return Ft(r?`/skills?${r}`:"/skills")}async function mU(e,t){const n=Us(t);return Ft(`/skills/${encodeURIComponent(e)}${n}`)}async function gU(e){return Ft("/skills",Dn("POST",e))}async function yU(e,t,n){const r=Us(n);return Ft(`/skills/${encodeURIComponent(e)}${r}`,Dn("PUT",t))}async function vU(e,t){const n=Us(t),r=await fetch(`${fu}/skills/${encodeURIComponent(e)}${n}`,{method:"DELETE"});if(!r.ok)throw await du(r)}async function xU(e,t,n){const r=Us(n);return Ft(`/skills/${encodeURIComponent(e)}/copy${r}`,Dn("POST",t))}async function bU(e,t,n){const r=Us(n);return Ft(`/skills/${encodeURIComponent(e)}/enabled${r}`,Dn("POST",{enabled:t}))}async function wU(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),n.set("includeDisabled","true"),t?.q&&n.set("q",t.q);const r=n.toString();return Ft(r?`/agents?${r}`:"/agents")}async function SU(e,t){const n=Us(t);return Ft(`/agents/${encodeURIComponent(e)}${n}`)}async function EU(e){return Ft("/agents",Dn("POST",e))}async function CU(e,t,n){const r=Us(n);return Ft(`/agents/${encodeURIComponent(e)}${r}`,Dn("PUT",t))}async function _U(e,t){const n=Us(t),r=await fetch(`${fu}/agents/${encodeURIComponent(e)}${n}`,{method:"DELETE"});if(!r.ok)throw await du(r)}async function RU(e,t,n){const r=Us(n);return Ft(`/agents/${encodeURIComponent(e)}/copy${r}`,Dn("POST",t))}async function jU(e,t,n){const r=Us(n);return Ft(`/agents/${encodeURIComponent(e)}/enabled${r}`,Dn("POST",{enabled:t}))}async function WM(){return Ft("/projects")}async function NU(e){return Ft("/projects",Dn("POST",e))}async function TU(e,t){return Ft(`/projects/${encodeURIComponent(e)}`,Dn("PUT",t))}async function OU(){return Ft("/model-aliases")}async function MU(e){return Ft("/model-aliases",Dn("POST",e))}async function kU(e,t){return Ft(`/model-aliases/${encodeURIComponent(e)}`,Dn("PUT",t))}async function AU(e){const t=await fetch(`${fu}/model-aliases/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await du(t)}async function DU(){return Ft("/settings/enums")}async function PU(e,t){return Ft(`/settings/enums/${e}`,Dn("PUT",t))}async function IU(e,t){const n=await fetch(`${fu}/settings/enums/${e}/entries/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw await du(n)}const Tx="siming.activeProjectId",JM=b.createContext(null);function zU({children:e}){const{data:t,isLoading:n,isError:r,refetch:o}=co({queryKey:["projects"],queryFn:WM}),[i,l]=b.useState("");b.useEffect(()=>{if(!t)return;const d=t.filter(x=>x.status==="active"),p=window.localStorage.getItem(Tx),g=p?d.find(x=>x.id===p):void 0,y=d.find(x=>x.key==="default")??d[0],v=g?.id??y?.id??"";v&&window.localStorage.setItem(Tx,v),l(x=>x===v?x:v)},[t]);const c=b.useCallback(d=>{window.localStorage.setItem(Tx,d),l(d)},[]),f=b.useMemo(()=>{const d=(t??[]).filter(p=>p.status==="active");return{projects:t??[],activeProjects:d,activeProject:d.find(p=>p.id===i),activeProjectId:i,setActiveProjectId:c,bootstrapReady:!n&&(t??[]).length>0&&i!=="",bootstrapError:r,retryBootstrap:()=>{o()}}},[t,n,r,o,i,c]);return h.jsx(JM.Provider,{value:f,children:e})}function cs(){const e=b.useContext(JM);if(!e)throw new Error("useProjectContext 必须在 <ProjectProvider> 内使用");return e}const ek={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},tk={...ek,position:"fixed",top:0,left:0},LU={...ek,position:"absolute"},uj={};function Dr(e,t){const n=b.useRef(uj);return n.current===uj&&(n.current=e(t)),n}function al(e,t,n,r){const o=Dr(nk).current;return FU(o,e,t,n,r)&&rk(o,[e,t,n,r]),o.callback}function $U(e){const t=Dr(nk).current;return VU(t,e)&&rk(t,e),t.callback}function nk(){return{callback:null,cleanup:null,refs:[]}}function FU(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function VU(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function rk(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const l=i(n);typeof l=="function"&&(r[o]=l);break}case"object":{i.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const l=r[o];typeof l=="function"?l():i(null);break}case"object":{i.current=null;break}}}}}}}function UU(e){const t=b.useRef(!0);t.current&&(t.current=!1,e())}function HU(e){const[t,n]=b.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function BU(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function kb({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=b.useRef(e!==void 0),[i,l]=b.useState(t),c=o?e:i,f=b.useCallback(d=>{o||l(d)},[]);return[c,f]}const qU=()=>{},tt=typeof document<"u"?b.useLayoutEffect:qU,uw={...Cl},Ox=uw.useInsertionEffect,YU=Ox&&Ox!==uw.useLayoutEffect?Ox:e=>e();function dt(e){const t=Dr(ZU).current;return t.next=e,YU(t.effect),t.trampoline}function ZU(){const e={next:void 0,callback:GU,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function GU(){}function er(e){const t=Dr(KU,e).current;return t.next=e,tt(t.effect),t}function KU(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function XU(e,t){return function(r,...o){const i=new URL(e);return i.searchParams.set("code",r.toString()),o.forEach(l=>i.searchParams.append("args[]",l)),`${t} error #${r}; visit ${i} for the full message.`}}const Er=XU("https://base-ui.com/production-error","Base UI");var Mx={exports:{}},kx={};var dj;function QU(){if(dj)return kx;dj=1;var e=yf();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function c(g,y){var v=y(),x=r({inst:{value:v,getSnapshot:y}}),E=x[0].inst,S=x[1];return i(function(){E.value=v,E.getSnapshot=y,f(E)&&S({inst:E})},[g,v,y]),o(function(){return f(E)&&S({inst:E}),g(function(){f(E)&&S({inst:E})})},[g]),l(v),v}function f(g){var y=g.getSnapshot;g=g.value;try{var v=y();return!n(g,v)}catch{return!0}}function d(g,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return kx.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,kx}var fj;function ok(){return fj||(fj=1,Mx.exports=QU()),Mx.exports}var dw=ok(),Ax={exports:{}},Dx={};var hj;function WU(){if(hj)return Dx;hj=1;var e=yf(),t=ok();function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,c=e.useMemo,f=e.useDebugValue;return Dx.useSyncExternalStoreWithSelector=function(d,p,g,y,v){var x=i(null);if(x.current===null){var E={hasValue:!1,value:null};x.current=E}else E=x.current;x=c(function(){function _(k){if(!j){if(j=!0,R=k,k=y(k),v!==void 0&&E.hasValue){var M=E.value;if(v(M,k))return N=M}return N=k}if(M=N,r(R,k))return M;var T=y(k);return v!==void 0&&v(M,T)?(R=k,M):(R=k,N=T)}var j=!1,R,N,O=g===void 0?null:g;return[function(){return _(p())},O===null?void 0:function(){return _(O())}]},[p,g,y,v]);var S=o(d,x[0],x[1]);return l(function(){E.hasValue=!0,E.value=S},[S]),f(S),S},Dx}var pj;function JU(){return pj||(pj=1,Ax.exports=WU()),Ax.exports}var fw=JU();const eH=V0(fw),tH=parseInt(b.version,10);function hw(e){return tH>=e}const Ab=[];let Db;function nH(){return Db}function rH(e){Ab.push(e)}function sk(e){const t=(n,r)=>{const o=Dr(sH).current;let i;try{Db=o;for(const l of Ab)l.before(o);i=e(n,r);for(const l of Ab)l.after(o);o.didInitialize=!0}finally{Db=void 0}return i};return t.displayName=e.displayName||e.name,t}function oH(e){return b.forwardRef(sk(e))}function sH(){return{didInitialize:!1}}const iH=hw(19),aH=iH?cH:uH;function gt(e,t,n,r,o){return aH(e,t,n,r,o)}function lH(e,t,n,r,o){const i=b.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return dw.useSyncExternalStore(e.subscribe,i,i)}rH({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),dw.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function cH(e,t,n,r,o){const i=nH();if(!i)return lH(e,t,n,r,o);const l=i.syncIndex;i.syncIndex+=1;let c;return i.didInitialize?(c=i.syncHooks[l],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(i.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.value=t(e.getSnapshot(),n,r,o))):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},i.syncHooks.push(c)),c.value}function uH(e,t,n,r,o){return fw.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,i=>t(i,n,r,o))}class dH{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return gt(this,t,n,r,o)}}function gr(){}const ll=Object.freeze([]),Kn=Object.freeze({});class _f extends dH{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){b.useDebugValue(t);const r=this;tt(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;tt(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);tt(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){b.useDebugValue(t);const r=this,o=n!==void 0;tt(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const i=this.selectors[t];return i(this.state,n,r,o)}useState(t,n,r,o){return b.useDebugValue(t),gt(this,this.selectors[t],n,r,o)}useContextCallback(t,n){b.useDebugValue(t);const r=dt(n??gr);this.context[t]=r}useStateSetter(t){const n=b.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(i=>{const l=r(i);if(!Object.is(o,l)){const c=o;o=l,n(l,c,this)}})}}function dg(){return typeof window<"u"}function Pr(e){return pw(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ci(e){var t;return(t=(pw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pw(e){return dg()?e instanceof Node||e instanceof An(e).Node:!1}function Gt(e){return dg()?e instanceof Element||e instanceof An(e).Element:!1}function Cn(e){return dg()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function qc(e){return!dg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function Rf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=_o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function fH(e){return/^(table|td|th)$/.test(Pr(e))}function fg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hH=/transform|translate|scale|rotate|perspective|filter/,pH=/paint|layout|strict|content/,Ga=e=>!!e&&e!=="none";let Px;function mw(e){const t=Gt(e)?_o(e):e;return Ga(t.transform)||Ga(t.translate)||Ga(t.scale)||Ga(t.rotate)||Ga(t.perspective)||!gw()&&(Ga(t.backdropFilter)||Ga(t.filter))||hH.test(t.willChange||"")||pH.test(t.contain||"")}function mH(e){let t=wi(e);for(;Cn(t)&&!yi(t);){if(mw(t))return t;if(fg(t))return null;t=wi(t)}return null}function gw(){return Px==null&&(Px=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Px}function yi(e){return/^(html|body|#document)$/.test(Pr(e))}function _o(e){return An(e).getComputedStyle(e)}function hg(e){return Gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wi(e){if(Pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qc(e)&&e.host||Ci(e);return qc(t)?t.host:t}function ik(e){const t=wi(e);return yi(t)?(e.ownerDocument||e).body:Cn(t)&&Rf(t)?t:ik(t)}function Xd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ik(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=An(o);if(i){const c=Pb(l);return t.concat(l,l.visualViewport||[],Rf(o)?o:[],c&&n?Xd(c):[])}else return t.concat(o,Xd(o,[],n))}function Pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ps(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Zt(e){return e?.ownerDocument||document}function zt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function yw(e){b.useEffect(e,ll)}const hp=null;class gH{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}let pp=new gH;class Ms{static create(){return new Ms}static request(t){return pp.request(t)}static cancel(t){return pp.cancel(t)}currentId=hp;request(t){this.cancel(),this.currentId=pp.request(()=>{this.currentId=hp,t()})}cancel=()=>{this.currentId!==hp&&(pp.cancel(this.currentId),this.currentId=hp)};disposeEffect=()=>this.cancel}function Yc(){const e=Dr(Ms.create).current;return yw(e.disposeEffect),e}const yd=0;class is{static create(){return new is}currentId=yd;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=yd,n()},t)}isStarted(){return this.currentId!==yd}clear=()=>{this.currentId!==yd&&(clearTimeout(this.currentId),this.currentId=yd)};disposeEffect=()=>this.clear}function Ar(){const e=Dr(is.create).current;return yw(e.disposeEffect),e}function yH(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:vH,platform:xH,maxTouchPoints:bH}=yH(),pg=vH.toLowerCase(),Qd=xH.toLowerCase(),mg=/^i(os$|p)/.test(Qd)||Qd==="macintel"&&bH>1,mj="android",Ib=Qd===mj||pg.includes(mj),vw=!mg&&Qd.startsWith("mac");Qd.startsWith("win");const wH=vw||mg,_i=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!_i&&pg.includes("firefox");!_i&&pg.includes("chrom");const SH=wH,xw=/jsdom|happydom/.test(pg);function Ts(e){e.preventDefault(),e.stopPropagation()}function EH(e){return"nativeEvent"in e}function bw(e){return e.pointerType===""&&e.isTrusted?!0:Ib&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ww(e){return xw?!1:!Ib&&e.width===0&&e.height===0||Ib&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function zc(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function CH(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const zb="data-base-ui-focusable",ak="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",gg="ArrowLeft",yg="ArrowRight",lk="ArrowUp",Sw="ArrowDown";function Zr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function mt(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&qc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ao(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ym(e,t){if(!Gt(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(mt(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function Ix(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function _H(e){return e.matches("html,body")}function vg(e){return Cn(e)&&e.matches(ak)}function RH(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ak}`)!=null}function Lb(e){return e?e.getAttribute("role")==="combobox"&&vg(e):!1}function jH(e){if(!e||xw)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vm(e){return e?e.hasAttribute(zb)?e:e.querySelector(`[${zb}]`)||e:null}function NH(e,t){return t!=null&&!zc(t)?0:typeof e=="function"?e():e}function $b(e,t,n){const r=NH(e,n);return typeof r=="number"?r:r?.[t]}function gj(e){return typeof e=="function"?e():e}function ck(e,t){return t||e==="click"||e==="mousedown"}function TH(e){return e?.includes("mouse")&&e!=="mousedown"}const Zc="none",cl="trigger-press",vr="trigger-hover",$d="trigger-focus",xg="outside-press",Fd="item-press",uk="close-press",ma="focus-out",bg="escape-key",Fb="list-navigation",dk="cancel-open",Od="sibling-open",Ew="imperative-action",OH="window-resize";function Ot(e,t,n,r){let o=!1,i=!1;const l=Kn;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){i=!0},get isCanceled(){return o},get isPropagationAllowed(){return i},trigger:n,...l}}const ga=b.forwardRef(function(t,n){const[r,o]=b.useState();tt(()=>{SH&&_i&&o("button")},[]);const i={tabIndex:0,role:r};return h.jsx("span",{...t,ref:n,style:tk,"aria-hidden":r?void 0:!0,...i,"data-base-ui-focus-guard":""})}),Gc=Math.min,vi=Math.max,xm=Math.round,mp=Math.floor,xi=e=>({x:e,y:e}),MH={left:"right",right:"left",bottom:"top",top:"bottom"};function fk(e,t,n){return vi(e,Gc(t,n))}function ya(e,t){return typeof e=="function"?e(t):e}function Uo(e){return e.split("-")[0]}function Ea(e){return e.split("-")[1]}function Cw(e){return e==="x"?"y":"x"}function _w(e){return e==="y"?"height":"width"}function Fo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Rw(e){return Cw(Fo(e))}function kH(e,t,n){n===void 0&&(n=!1);const r=Ea(e),o=Rw(e),i=_w(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=bm(l)),[l,bm(l)]}function AH(e){const t=bm(e);return[Vb(e),t,Vb(t)]}function Vb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yj=["left","right"],vj=["right","left"],DH=["top","bottom"],PH=["bottom","top"];function IH(e,t,n){switch(e){case"top":case"bottom":return n?t?vj:yj:t?yj:vj;case"left":case"right":return t?DH:PH;default:return[]}}function zH(e,t,n,r){const o=Ea(e);let i=IH(Uo(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Vb)))),i}function bm(e){const t=Uo(e);return MH[t]+e.slice(t.length)}function LH(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function hk(e){return typeof e!="number"?LH(e):{top:e,right:e,bottom:e,left:e}}function Wd(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function xj(e,t){return t<0||t>=e.length}function zx(e,t){return kc(e.current,{disabledIndices:t})}function bj(e,t){return kc(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function kc(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let i=t;do i+=n?-o:o;while(i>=0&&i<=e.length-1&&pk(e,i,r));return i}function pk(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!wg(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function $H(e){return e.visibility==="hidden"||e.visibility==="collapse"}function wg(e,t=e?_o(e):null){return!e||!e.isConnected||!t||$H(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const FH='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function VH(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return qc(n)?n.host:null}function Ub(e){for(const t of Array.from(e.children))if(Pr(t)==="summary")return t;return null}function UH(e,t){const n=Ub(t);return!!n&&(e===n||mt(n,e))}function mk(e){const t=e?Pr(e):"";return e!=null&&e.matches(FH)&&(t!=="summary"||e.parentElement!=null&&Pr(e.parentElement)==="details"&&Ub(e.parentElement)===e)&&(t!=="details"||Ub(e)==null)&&(t!=="input"||e.type!=="hidden")}function gk(e){if(!mk(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=VH(t)){const n=t!==e,r=Pr(t)==="slot";if(t.hasAttribute("inert")||n&&Pr(t)==="details"&&!t.open&&!UH(e,t)||t.hasAttribute("hidden")||!r&&!HH(t,n))return!1}return!0}function HH(e,t){const n=_o(e);return t?n.display!=="none":wg(e,n)}function yk(e){const t=e.tabIndex;if(t<0){const n=Pr(e);if(n==="details"||n==="audio"||n==="video"||Cn(e)&&e.isContentEditable)return 0}return t}function Lx(e){if(Pr(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function BH(e,t){const n=Lx(e);if(!n)return!0;const r=t.find(o=>{const i=Lx(o);return i?.name===n.name&&i.form===n.form&&i.checked});return r?r===n:t.find(o=>{const i=Lx(o);return i?.name===n.name&&i.form===n.form})===n}function vk(e){if(Cn(e)&&Pr(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Cn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function xk(e,t){vk(e).forEach(n=>{mk(n)&&t.push(n),xk(n,t)})}function bk(e,t,n){vk(e).forEach(r=>{Cn(r)&&r.matches(t)&&n.push(r),bk(r,t,n)})}function jw(e){return gk(e)&&yk(e)>=0}function wk(e){const t=[];return xk(e,t),t.filter(gk)}function jf(e){const t=wk(e);return t.filter(n=>yk(n)>=0&&BH(n,t))}function Sk(e,t){const n=jf(e),r=n.length;if(r===0)return;const o=Zr(Zt(e)),i=n.indexOf(o),l=i===-1?t===1?0:r-1:i+t;return n[l]}function Nw(e){return Sk(Zt(e).body,1)||e}function Ek(e){return Sk(Zt(e).body,-1)||e}function Ck(e,t){if(!e)return null;const n=jf(Zt(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const i=(o+t+r)%r;return n[i]}function qH(e){return Ck(e,1)}function YH(e){return Ck(e,-1)}function Lc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!mt(n,r)}function ZH(e){jf(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function wj(e){const t=[];bk(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function va(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...va(e,o.id,n)])}function Sj(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Jd(e){return`data-base-ui-${e}`}let gp=0;function Jp(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(gp);function i(){o&&!o()||e?.focus({preventScroll:n})}if(r)return i(),gr;const l=requestAnimationFrame(i);return gp=l,()=>{gp===l&&(cancelAnimationFrame(l),gp=0)}}const $x={inert:new WeakMap,"aria-hidden":new WeakMap},Ej="data-base-ui-inert",Hb={inert:new WeakSet,"aria-hidden":new WeakSet};let vd=new WeakMap,Fx=0;function GH(e){return Hb[e]}function _k(e){return e?qc(e)?e.host:_k(e.parentNode):null}const Cj=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=_k(n);return e.contains(r)?r:null}).filter(n=>n!=null),_j=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Rj=(e,t,n)=>{const r=[],o=i=>{!i||n.has(i)||Array.from(i.children).forEach(l=>{Pr(l)!=="script"&&(t.has(l)?o(l):r.push(l))})};return o(e),r};function KH(e,t,n,r,{mark:o=!0}){let i=null;r?i="inert":n&&(i="aria-hidden");let l=null,c=null;const f=Cj(t,e),d=o?Rj(t,_j(f),new Set(f)):[],p=[],g=[];if(i){const y=$x[i],v=GH(i);c=v,l=y;const x=Cj(t,Array.from(t.querySelectorAll("[aria-live]"))),E=f.concat(x);Rj(t,_j(E),new Set(E)).forEach(_=>{const j=_.getAttribute(i),R=j!==null&&j!=="false",N=(y.get(_)||0)+1;y.set(_,N),p.push(_),N===1&&R&&v.add(_),R||_.setAttribute(i,i==="inert"?"":"true")})}return o&&d.forEach(y=>{const v=(vd.get(y)||0)+1;vd.set(y,v),g.push(y),v===1&&y.setAttribute(Ej,"")}),Fx+=1,()=>{l&&p.forEach(y=>{const x=(l.get(y)||0)-1;l.set(y,x),x||(!c?.has(y)&&i&&y.removeAttribute(i),c?.delete(y))}),o&&g.forEach(y=>{const v=(vd.get(y)||0)-1;vd.set(y,v),v||y.removeAttribute(Ej)}),Fx-=1,Fx||($x.inert=new WeakMap,$x["aria-hidden"]=new WeakMap,Hb.inert=new WeakSet,Hb["aria-hidden"]=new WeakSet,vd=new WeakMap)}}function jj(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,i=Zt(e[0]).body;return KH(e,i,n,r,{mark:o})}let Nj=0;function XH(e,t="mui"){const[n,r]=b.useState(e),o=e||n;return b.useEffect(()=>{n==null&&(Nj+=1,r(`${t}-${Nj}`))},[n,t]),o}const Tj=uw.useId;function ul(e,t){if(Tj!==void 0){const n=Tj();return e??(t?`${t}-${n}`:n)}return XH(e,t)}function Oj(e){if(!b.isValidElement(e))return null;const t=e,n=t.props;return(hw(19)?n?.ref:t.ref)??null}function Bb(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function QH(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const i=t[r](o);i!=null&&Object.assign(n,i);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function WH(e,t){return typeof e=="function"?e(t):e}function JH(e,t){return typeof e=="function"?e(t):e}const Tw={};function Ho(e,t,n,r,o){if(!n&&!r&&!o&&!e)return wm(t);let i=wm(e);return t&&(i=Md(i,t)),n&&(i=Md(i,n)),r&&(i=Md(i,r)),o&&(i=Md(i,o)),i}function e6(e){if(e.length===0)return Tw;if(e.length===1)return wm(e[0]);let t=wm(e[0]);for(let n=1;n<e.length;n+=1)t=Md(t,e[n]);return t}function wm(e){return Ow(e)?{...jk(e,Tw)}:t6(e)}function Md(e,t){return Ow(t)?jk(t,e):n6(e,t)}function t6(e){const t={...e};for(const n in t){const r=t[n];Rk(n,r)&&(t[n]=Nk(r))}return t}function n6(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Bb(e.style,r);break}case"className":{e[n]=Tk(e.className,r);break}default:Rk(n,r)?e[n]=r6(e[n],r):e[n]=r}}return e}function Rk(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Ow(e){return typeof e=="function"}function jk(e,t){return Ow(e)?e(t):e??Tw}function r6(e,t){return t?e?(...n)=>{const r=n[0];if(Ok(r)){const i=r;Sm(i);const l=t(...n);return i.baseUIHandlerPrevented||e?.(...n),l}const o=t(...n);return e?.(...n),o}:Nk(t):e}function Nk(e){return e&&((...t)=>{const n=t[0];return Ok(n)&&Sm(n),e(...t)})}function Sm(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Tk(e,t){return t?e?t+" "+e:t:e}function Ok(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function bn(e,t,n={}){const r=t.render,o=o6(t,n);if(n.enabled===!1)return null;const i=n.state??Kn;return a6(e,r,o,i)}function o6(e,t={}){const{className:n,style:r,render:o}=e,{state:i=Kn,ref:l,props:c,stateAttributesMapping:f,enabled:d=!0}=t,p=d?WH(n,i):void 0,g=d?JH(r,i):void 0,y=d?QH(i,f):Kn,v=d&&c?s6(c):void 0,x=d?Bb(y,v)??{}:Kn;return typeof document<"u"&&(d?Array.isArray(l)?x.ref=$U([x.ref,Oj(o),...l]):x.ref=al(x.ref,Oj(o),l):al(null,null)),d?(p!==void 0&&(x.className=Tk(x.className,p)),g!==void 0&&(x.style=Bb(x.style,g)),x):Kn}function s6(e){return Array.isArray(e)?e6(e):Ho(void 0,e)}const i6=Symbol.for("react.lazy");function a6(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=Ho(n,t.props);o.ref=n.ref;let i=t;return i?.$$typeof===i6&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,o)}if(e&&typeof e=="string")return l6(e,n);throw new Error(Er(8))}function l6(e,t){return e==="button"?b.createElement("button",{type:"button",...t,key:t.key}):e==="img"?b.createElement("img",{alt:"",...t,key:t.key}):b.createElement(e,t)}const c6=500,Mk=500,u6={style:{transition:"none"}},kk="data-base-ui-click-trigger",Ak={fallbackAxisSide:"none"},Dk={fallbackAxisSide:"end"},d6={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Pk=b.createContext(null),Ik=()=>b.useContext(Pk),f6=Jd("portal");function h6(e={}){const{ref:t,container:n,componentProps:r=Kn,elementProps:o}=e,i=ul(),c=Ik()?.portalNode,[f,d]=b.useState(null),[p,g]=b.useState(null),y=dt(S=>{S!==null&&g(S)}),v=b.useRef(null);tt(()=>{if(n===null){v.current&&(v.current=null,g(null),d(null));return}const S=(n&&(pw(n)?n:n.current))??c??document.body;if(S==null){v.current&&(v.current=null,g(null),d(null));return}v.current!==S&&(v.current=S,g(null),d(S))},[n,c]);const x=bn("div",r,{ref:[t,y],props:[{id:i,[f6]:""},o]}),E=f&&x?Co.createPortal(x,f):null;return{node:p,nodeId:b.isValidElement(x)?x.props.id:void 0,subtree:E}}const Sg=b.forwardRef(function(t,n){const{render:r,className:o,style:i,children:l,container:c,...f}=t,{node:d,nodeId:p,subtree:g}=h6({container:c,ref:n,componentProps:t,elementProps:f}),y=b.useRef(null),v=b.useRef(null),x=b.useRef(null),E=b.useRef(null),[S,_]=b.useState(null),j=b.useRef(!1),R=S?.modal,N=S?.open,O=!!S&&!S.modal&&S.open&&!!d;b.useEffect(()=>{if(!d||R)return;function M(T){d&&T.relatedTarget&&Lc(T)&&(T.type==="focusin"?j.current&&(wj(d),j.current=!1):(ZH(d),j.current=!0))}return Ps(zt(d,"focusin",M,!0),zt(d,"focusout",M,!0))},[d,R]),tt(()=>{!d||N!==!0||!j.current||(wj(d),j.current=!1)},[N,d]);const k=b.useMemo(()=>({beforeOutsideRef:y,afterOutsideRef:v,beforeInsideRef:x,afterInsideRef:E,portalNode:d,setFocusManagerState:_}),[d]);return h.jsxs(b.Fragment,{children:[g,h.jsxs(Pk.Provider,{value:k,children:[O&&d&&h.jsx(ga,{"data-type":"outside",ref:y,onFocus:M=>{if(Lc(M,d))x.current?.focus();else{const T=S?S.domReference:null;Ek(T)?.focus()}}}),O&&d&&h.jsx("span",{"aria-owns":p,style:d6}),d&&Co.createPortal(l,d),O&&d&&h.jsx(ga,{"data-type":"outside",ref:v,onFocus:M=>{if(Lc(M,d))E.current?.focus();else{const T=S?S.domReference:null;Nw(T)?.focus(),S?.closeOnFocusOut&&S?.onOpenChange(!1,Ot(ma,M.nativeEvent))}}})]})]})});function zk(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Mw{nodesRef={current:[]};events=zk();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Lk=b.createContext(null),$k=b.createContext(null),Ca=()=>b.useContext(Lk)?.id||null,_a=e=>{const t=b.useContext($k);return e??t};function kw(e){const t=ul(),n=_a(e),r=Ca();return tt(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function Fk(e){const{children:t,id:n}=e,r=Ca();return h.jsx(Lk.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Vk(e){const{children:t,externalTree:n}=e,r=Dr(()=>n??new Mw).current;return h.jsx($k.Provider,{value:r,children:t})}function hi(e){return e==null?e:"current"in e?e.current:e}function p6(e,t){const n=An(ao(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Mj=20;let da=[];function Aw(){da=da.filter(e=>e.deref()?.isConnected)}function kj(e){Aw(),e&&Pr(e)!=="body"&&(da.push(new WeakRef(e)),da.length>Mj&&(da=da.slice(-Mj)))}function Aj(){return Aw(),da[da.length-1]?.deref()}function m6(e){return e?jw(e)?e:jf(e)[0]||e:null}function Dj(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=wk(e).filter(o=>{const i=o.getAttribute("data-tabindex")||"";return jw(o)||o.hasAttribute("data-tabindex")&&!i.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Eg(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:i=!0,restoreFocus:l=!1,modal:c=!0,closeOnFocusOut:f=!0,openInteractionType:d="",nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:y,externalTree:v,getInsideElements:x}=e,E="rootStore"in t?t.rootStore:t,S=E.useState("open"),_=E.useState("domReferenceElement"),j=E.useState("floatingElement"),{events:R,dataRef:N}=E.context,O=dt(()=>N.current.floatingContext?.nodeId),k=o===!1,M=Lb(_)&&k,T=er(o),L=er(i),G=er(d),B=er(S),V=_a(v),q=Ik(),I=b.useRef(!1),z=b.useRef(!1),A=b.useRef(!1),P=b.useRef(null),U=b.useRef(""),H=b.useRef(""),Y=b.useRef(null),$=b.useRef(null),F=al(Y,y,q?.beforeInsideRef),Q=al($,q?.afterInsideRef),X=Ar(),ne=Ar(),te=Yc(),J=q!=null,K=vm(j),re=dt((ue=K)=>ue?jf(ue):[]),ye=dt(()=>x?.().filter(ue=>ue!=null)??[]);b.useEffect(()=>{if(r||!c)return;function ue(Re){Re.key==="Tab"&&mt(K,Zr(Zt(K)))&&re().length===0&&!M&&Ts(Re)}const he=Zt(K);return zt(he,"keydown",ue)},[r,K,c,M,re]),b.useEffect(()=>{if(r||!S)return;const ue=Zt(K);function he(){A.current=!1}function Re(Ue){const Ae=ao(Ue),Qe=ye(),De=mt(j,Ae)||mt(_,Ae)||mt(q?.portalNode,Ae)||Qe.some(Le=>Le===Ae||mt(Le,Ae));A.current=!De,H.current=Ue.pointerType||"keyboard",Ae?.closest(`[${kk}]`)&&(z.current=!0,ne.start(0,()=>{z.current=!1}))}function ze(){H.current="keyboard"}return Ps(zt(ue,"pointerdown",Re,!0),zt(ue,"pointerup",he,!0),zt(ue,"pointercancel",he,!0),zt(ue,"keydown",ze,!0),he)},[r,j,_,K,S,q,ne,ye]),b.useEffect(()=>{if(r||!f)return;const ue=Zt(K);function he(){z.current=!0,ne.start(0,()=>{z.current=!1})}function Re(Qe){const De=ao(Qe);jw(De)&&(P.current=De)}function ze(Qe){const De=Qe.relatedTarget,Le=Qe.currentTarget,Fe=ao(Qe);c&&De==null&&Fe!=null&&mt(j,Fe)&&kj(Fe),queueMicrotask(()=>{const Ye=O(),et=E.context.triggerElements,me=ye(),xe=De?.hasAttribute(Jd("focus-guard"))&&[Y.current,$.current,q?.beforeInsideRef.current,q?.afterInsideRef.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,hi(g),hi(p)].includes(De),We=!(mt(_,De)||mt(j,De)||mt(De,j)||mt(q?.portalNode,De)||me.some(Oe=>Oe===De||mt(Oe,De))||et.hasMatchingElement(Oe=>mt(Oe,De))||xe||V&&(va(V.nodesRef.current,Ye).find(Oe=>mt(Oe.context?.elements.floating,De)||mt(Oe.context?.elements.domReference,De))||Sj(V.nodesRef.current,Ye).find(Oe=>[Oe.context?.elements.floating,vm(Oe.context?.elements.floating)].includes(De)||Oe.context?.elements.domReference===De)));if(Le===_&&K&&Dj(K),l&&Le!==_&&!wg(Fe)&&Zr(ue)===ue.body){if(Cn(K)&&(K.focus(),l==="popup")){te.request(()=>{K.focus()});return}const Oe=re(),Ie=P.current,at=(Ie&&Oe.includes(Ie)?Ie:null)||Oe[Oe.length-1]||K;Cn(at)&&at.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(M||!c)&&De&&We&&!z.current&&(M||De!==Aj())&&(I.current=!0,E.setOpen(!1,Ot(ma,Qe)))})}function Ue(){A.current||(N.current.insideReactTree=!0,X.start(0,()=>{N.current.insideReactTree=!1}))}const Ae=Cn(_)?_:null;if(!(!j&&!Ae))return Ps(Ae&&zt(Ae,"focusout",ze),Ae&&zt(Ae,"pointerdown",he),j&&zt(j,"focusin",Re),j&&zt(j,"focusout",ze),j&&q&&zt(j,"focusout",Ue,!0))},[r,_,j,K,c,V,q,E,f,l,re,M,O,N,X,ne,te,p,g,ye]),b.useEffect(()=>{if(r||!j||!S)return;const ue=Array.from(q?.portalNode?.querySelectorAll(`[${Jd("portal")}]`)||[]),Re=(V?Sj(V.nodesRef.current,O()):[]).find(Le=>Lb(Le.context?.elements.domReference||null))?.context?.elements.domReference,Ue=[...[j,...ue,Y.current,$.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,...ye()],Re,hi(g),hi(p),M?_:null].filter(Le=>Le!=null),Ae=jj(Ue,{ariaHidden:c||M,mark:!1}),Qe=[j,...ue].filter(Le=>Le!=null),De=jj(Qe);return()=>{De(),Ae()}},[S,r,_,j,c,q,M,V,O,p,g,ye]),tt(()=>{if(!S||r||!Cn(K))return;U.current="",H.current="";const ue=Zt(K),he=Zr(ue);queueMicrotask(()=>{const Re=T.current,ze=typeof Re=="function"?Re(G.current||""):Re;if(ze===void 0||ze===!1||mt(K,he))return;let Ae=null;const Qe=()=>(Ae==null&&(Ae=re(K)),Ae[0]||K);let De;ze===!0||ze===null?De=Qe():De=hi(ze),De=De||Qe();const Le=mt(K,Zr(ue));Jp(De,{preventScroll:De===K,shouldFocus(){if(!B.current)return!1;if(Le)return!0;const Fe=Zr(ue);return!(Fe!==De&&mt(K,Fe))}})})},[r,S,K,re,T,G,B]),tt(()=>{if(r||!K)return;const ue=Zt(K),he=Zr(ue),Re=G.current==null;kj(he);function ze(Ae){if(Ae.open||(U.current=p6(Ae.nativeEvent,H.current)),Ae.reason===vr&&Ae.nativeEvent.type==="mouseleave"&&(I.current=!0),Ae.reason===xg)if(Ae.nested)I.current=!1;else if(bw(Ae.nativeEvent)||ww(Ae.nativeEvent))I.current=!1;else{let Qe=!1;Zt(K).createElement("div").focus({get preventScroll(){return Qe=!0,!1}}),Qe?I.current=!1:I.current=!0}}R.on("openchange",ze);function Ue(Ae){const Qe=L.current;let De=typeof Qe=="function"?Qe(Ae):Qe;if(De===void 0||De===!1)return null;De===null&&(De=!0);const Le=_?.isConnected?_:null,Fe=he?.isConnected&&Pr(he)!=="body"?he:null;let Ye=Re?Fe||Le:Le||Fe;return Ye||(Ye=Aj()||null),typeof De=="boolean"?Ye:hi(De)||Ye||null}return()=>{R.off("openchange",ze);const Ae=Zr(ue),Qe=ye(),De=mt(j,Ae)||Qe.some(et=>et===Ae||mt(et,Ae))||V&&va(V.nodesRef.current,O(),!1).some(et=>mt(et.context?.elements.floating,Ae)),Le=L.current,Fe=U.current,Ye=Ue(Fe);queueMicrotask(()=>{const et=m6(Ye),me=typeof Le!="boolean";if(Le&&!I.current&&Cn(et)&&(!(!me&&et!==Ae&&Ae!==ue.body)||De)){const xe={preventScroll:!0};Fe==="keyboard"&&(xe.focusVisible=!0),et.focus(xe)}I.current=!1})}},[r,j,K,L,G,R,V,_,O,ye]),tt(()=>{if(!_i||S||!j)return;const ue=Zr(Zt(j));!Cn(ue)||!vg(ue)||mt(j,ue)&&ue.blur()},[S,j]),tt(()=>{if(!(r||!q))return q.setFocusManagerState({modal:c,closeOnFocusOut:f,open:S,onOpenChange:E.setOpen,domReference:_}),()=>{q.setFocusManagerState(null)}},[r,q,c,S,E,f,_]),tt(()=>{if(!(r||!K))return Dj(K),()=>{queueMicrotask(Aw)}},[r,K]);const fe=!r&&(c?!M:!0)&&(J||c);return h.jsxs(b.Fragment,{children:[fe&&h.jsx(ga,{"data-type":"inside",ref:F,onFocus:ue=>{if(c){const he=re();Jp(he[he.length-1])}else q?.portalNode&&(I.current=!1,Lc(ue,q.portalNode)?Nw(_)?.focus():hi(g??q.beforeOutsideRef)?.focus())}}),n,fe&&h.jsx(ga,{"data-type":"inside",ref:Q,onFocus:ue=>{c?Jp(re()[0]):q?.portalNode&&(f&&(I.current=!0),Lc(ue,q.portalNode)?Ek(_)?.focus():hi(p??q.afterOutsideRef)?.focus())}})]})}function Dw(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:f=cl}=t,d="rootStore"in e?e.rootStore:e,p=d.context.dataRef,g=b.useRef(void 0),y=Yc(),v=Ar(),x=b.useMemo(()=>{function E(_,j,R,N){const O=Ot(f,j,R);_&&N==="touch"&&c>0?v.start(c,()=>{d.setOpen(!0,O)}):d.setOpen(_,O)}function S(_,j,R){const N=p.current.openEvent,O=d.select("domReferenceElement")!==j;return _&&O||!_||!o?!0:N&&l?!R(N.type):!1}return{onPointerDown(_){g.current=zc(_.pointerType,!0)&&ww(_.nativeEvent)?"virtual":_.pointerType},onMouseDown(_){const j=g.current,R=_.nativeEvent,N=d.select("open");if(_.button!==0||r==="click"||zc(j,!0)&&i)return;const O=S(N,_.currentTarget,T=>T==="click"||T==="mousedown"),k=ao(R);if(vg(k)){E(O,R,k,j);return}const M=_.currentTarget;y.request(()=>{E(O,R,M,j)})},onClick(_){if(r==="mousedown-only")return;const j=g.current;if(r==="mousedown"&&j){g.current=void 0;return}if(zc(j,!0)&&i)return;const R=d.select("open"),N=S(R,_.currentTarget,O=>O==="click"||O==="mousedown"||O==="keydown"||O==="keyup");E(N,_.nativeEvent,_.currentTarget,j)},onKeyDown(){g.current=void 0}}},[p,r,i,f,d,l,o,y,v,c]);return b.useMemo(()=>n?{reference:x}:Kn,[n,x])}function g6(){return!1}function y6(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Cg(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:i="sloppy",referencePress:l=g6,bubbles:c,externalTree:f}=t,d="rootStore"in e?e.rootStore:e,p=d.useState("open"),g=d.useState("floatingElement"),{dataRef:y}=d.context,v=_a(f),x=dt(typeof o=="function"?o:()=>!1),E=typeof o=="function"?x:o,S=E!==!1,_=dt(()=>i),{escapeKey:j,outsidePress:R}=y6(c),N=b.useRef(!1),O=b.useRef(!1),k=b.useRef(!1),M=b.useRef(!1),T=b.useRef(""),L=b.useRef(null),G=Ar(),B=Ar(),V=dt(()=>{B.clear(),y.current.insideReactTree=!1}),q=dt(F=>{const Q=y.current.floatingContext?.nodeId;return(v?va(v.nodesRef.current,Q):[]).some(ne=>ne.context?.open&&!ne.context.dataRef.current[F])}),I=dt(F=>Ix(F,d.select("floatingElement"))||Ix(F,d.select("domReferenceElement"))),z=dt(F=>{l()&&d.setOpen(!1,Ot(cl,F.nativeEvent))}),A=dt(F=>{if(!p||!n||!r||F.key!=="Escape"||M.current||!j&&q("__escapeKeyBubbles"))return;const Q=EH(F)?F.nativeEvent:F,X=Ot(bg,Q);d.setOpen(!1,X),X.isCanceled||F.preventDefault(),!j&&!X.isPropagationAllowed&&F.stopPropagation()}),P=dt(()=>{y.current.insideReactTree=!0,B.start(0,V)}),U=dt(F=>{if(!p||!n||F.button!==0)return;const Q=ao(F.nativeEvent);mt(d.select("floatingElement"),Q)&&(N.current||(N.current=!0,O.current=!1))}),H=dt(F=>{!p||!n||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&N.current&&(O.current=!0)});b.useEffect(()=>{if(!p||!n)return V;y.current.__escapeKeyBubbles=j,y.current.__outsidePressBubbles=R;const F=new is,Q=new is;function X(){F.clear(),M.current=!0}function ne(){F.start(_i?5:0,()=>{M.current=!1})}function te(){k.current=!0,Q.start(0,()=>{k.current=!1})}function J(){N.current=!1,O.current=!1}function K(){const me=T.current,xe=me==="pen"||!me?"mouse":me,We=_(),Oe=typeof We=="function"?We():We;return typeof Oe=="string"?Oe:Oe[xe]}function re(me){const xe=K();return xe==="intentional"&&me.type!=="click"||xe==="sloppy"&&me.type==="click"}function ye(me){const xe=y.current.floatingContext?.nodeId,We=v&&va(v.nodesRef.current,xe).some(Oe=>Ix(me,Oe.context?.elements.floating));return I(me)||We}function fe(me){if(re(me)){me.type!=="click"&&!I(me)&&(Q.clear(),k.current=!1),V();return}if(y.current.insideReactTree){V();return}const xe=ao(me),We=`[${Jd("inert")}]`,Oe=Gt(xe)?xe.getRootNode():null,Ie=Array.from((qc(Oe)?Oe:Zt(d.select("floatingElement"))).querySelectorAll(We)),at=d.context.triggerElements;if(xe&&(at.hasElement(xe)||at.hasMatchingElement($t=>mt($t,xe))))return;let it=Gt(xe)?xe:null;for(;it&&!yi(it);){const $t=wi(it);if(yi($t)||!Gt($t))break;it=$t}if(!(Ie.length&&Gt(xe)&&!_H(xe)&&!mt(xe,d.select("floatingElement"))&&Ie.every($t=>!mt(it,$t)))){if(Cn(xe)&&!("touches"in me)){const $t=yi(xe),W=_o(xe),ie=/auto|scroll/,ae=$t||ie.test(W.overflowX),Se=$t||ie.test(W.overflowY),be=ae&&xe.clientWidth>0&&xe.scrollWidth>xe.clientWidth,Ve=Se&&xe.clientHeight>0&&xe.scrollHeight>xe.clientHeight,Me=W.direction==="rtl",$e=Ve&&(Me?me.offsetX<=xe.offsetWidth-xe.clientWidth:me.offsetX>xe.clientWidth),He=be&&me.offsetY>xe.clientHeight;if($e||He)return}if(!ye(me)){if(K()==="intentional"&&k.current){Q.clear(),k.current=!1;return}typeof E=="function"&&!E(me)||q("__outsidePressBubbles")||(d.setOpen(!1,Ot(xg,me)),V())}}}function ue(me){K()!=="sloppy"||me.pointerType==="touch"||!d.select("open")||!n||I(me)||fe(me)}function he(me){if(K()!=="sloppy"||!d.select("open")||!n||I(me))return;const xe=me.touches[0];xe&&(L.current={startTime:Date.now(),startX:xe.clientX,startY:xe.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},G.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Re(me,xe){const We=ao(me);if(!We)return;const Oe=zt(We,me.type,()=>{xe(me),Oe()})}function ze(me){T.current="touch",Re(me,he)}function Ue(me){G.clear(),me.type==="pointerdown"&&(T.current=me.pointerType),!(me.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Re(me,xe=>{xe.type==="pointerdown"?ue(xe):fe(xe)})}function Ae(me){if(!N.current)return;const xe=O.current;if(J(),K()==="intentional"){if(me.type==="pointercancel"){xe&&te();return}if(!ye(me)){if(xe){te();return}typeof E=="function"&&!E(me)||(Q.clear(),k.current=!0,V())}}}function Qe(me){if(K()!=="sloppy"||!L.current||I(me))return;const xe=me.touches[0];if(!xe)return;const We=Math.abs(xe.clientX-L.current.startX),Oe=Math.abs(xe.clientY-L.current.startY),Ie=Math.sqrt(We*We+Oe*Oe);Ie>5&&(L.current.dismissOnTouchEnd=!0),Ie>10&&(fe(me),G.clear(),L.current=null)}function De(me){Re(me,Qe)}function Le(me){K()!=="sloppy"||!L.current||I(me)||(L.current.dismissOnTouchEnd&&fe(me),G.clear(),L.current=null)}function Fe(me){Re(me,Le)}const Ye=Zt(g),et=Ps(r&&Ps(zt(Ye,"keydown",A),zt(Ye,"compositionstart",X),zt(Ye,"compositionend",ne)),S&&Ps(zt(Ye,"click",Ue,!0),zt(Ye,"pointerdown",Ue,!0),zt(Ye,"pointerup",Ae,!0),zt(Ye,"pointercancel",Ae,!0),zt(Ye,"mousedown",Ue,!0),zt(Ye,"mouseup",Ae,!0),zt(Ye,"touchstart",ze,!0),zt(Ye,"touchmove",De,!0),zt(Ye,"touchend",Fe,!0)));return()=>{et(),F.clear(),Q.clear(),J(),k.current=!1,V()}},[y,g,r,S,E,p,n,j,R,A,V,_,q,I,v,d,G]);const Y=b.useMemo(()=>({onKeyDown:A,onPointerDown:z,onClick:z}),[A,z]),$=b.useMemo(()=>({onKeyDown:A,onPointerDown:H,onMouseDown:H,onClickCapture:P,onMouseDownCapture(F){P(),U(F)},onPointerDownCapture(F){P(),U(F)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[A,P,U,H]);return b.useMemo(()=>n?{reference:Y,floating:$,trigger:Y}:{},[n,Y,$])}function Pj(e,t,n){let{reference:r,floating:o}=e;const i=Fo(t),l=Rw(t),c=_w(l),f=Uo(t),d=i==="y",p=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,y=r[c]/2-o[c]/2;let v;switch(f){case"top":v={x:p,y:r.y-o.height};break;case"bottom":v={x:p,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:g};break;case"left":v={x:r.x-o.width,y:g};break;default:v={x:r.x,y:r.y}}const x=Ea(t);return x&&(v[l]+=y*(x==="end"?1:-1)*(n&&d?-1:1)),v}async function v6(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:f}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:y=!1,padding:v=0}=ya(t,e),x=hk(v),S=c[y?g==="floating"?"reference":"floating":g],_=Wd(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(S)))==null||n?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:d,rootBoundary:p,strategy:f})),j=g==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),N=await(i.isElement==null?void 0:i.isElement(R))&&await(i.getScale==null?void 0:i.getScale(R))||{x:1,y:1},O=Wd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:j,offsetParent:R,strategy:f}):j);return{top:(_.top-O.top+x.top)/N.y,bottom:(O.bottom-_.bottom+x.bottom)/N.y,left:(_.left-O.left+x.left)/N.x,right:(O.right-_.right+x.right)/N.x}}const x6=50,b6=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:v6},f=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:g}=Pj(d,r,f),y=r,v=0;const x={};for(let E=0;E<i.length;E++){const S=i[E];if(!S)continue;const{name:_,fn:j}=S,{x:R,y:N,data:O,reset:k}=await j({x:p,y:g,initialPlacement:r,placement:y,strategy:o,middlewareData:x,rects:d,platform:c,elements:{reference:e,floating:t}});p=R??p,g=N??g,x[_]={...x[_],...O},k&&v<x6&&(v++,typeof k=="object"&&(k.placement&&(y=k.placement),k.rects&&(d=k.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:p,y:g}=Pj(d,y,f)),E=-1)}return{x:p,y:g,placement:y,strategy:o,middlewareData:x}},w6=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:f,elements:d}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:E=!0,...S}=ya(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=Uo(o),j=Fo(c),R=Uo(c)===c,N=await(f.isRTL==null?void 0:f.isRTL(d.floating)),O=y||(R||!E?[bm(c)]:AH(c)),k=x!=="none";!y&&k&&O.push(...zH(c,E,x,N));const M=[c,...O],T=await f.detectOverflow(t,S),L=[];let G=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&L.push(T[_]),g){const I=kH(o,l,N);L.push(T[I[0]],T[I[1]])}if(G=[...G,{placement:o,overflows:L}],!L.every(I=>I<=0)){var B,V;const I=(((B=i.flip)==null?void 0:B.index)||0)+1,z=M[I];if(z&&(!(g==="alignment"?j!==Fo(z):!1)||G.every(U=>Fo(U.placement)===j?U.overflows[0]>0:!0)))return{data:{index:I,overflows:G},reset:{placement:z}};let A=(V=G.filter(P=>P.overflows[0]<=0).sort((P,U)=>P.overflows[1]-U.overflows[1])[0])==null?void 0:V.placement;if(!A)switch(v){case"bestFit":{var q;const P=(q=G.filter(U=>{if(k){const H=Fo(U.placement);return H===j||H==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(H=>H>0).reduce((H,Y)=>H+Y,0)]).sort((U,H)=>U[1]-H[1])[0])==null?void 0:q[0];P&&(A=P);break}case"initialPlacement":A=c;break}if(o!==A)return{reset:{placement:A}}}return{}}}},Uk=new Set(["left","top"]);async function S6(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Uo(n),c=Ea(n),f=Fo(n)==="y",d=Uk.has(l)?-1:1,p=i&&f?-1:1,g=ya(t,e);let{mainAxis:y,crossAxis:v,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return c&&typeof x=="number"&&(v=c==="end"?x*-1:x),f?{x:v*p,y:y*d}:{x:y*d,y:v*p}}const E6=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,f=await S6(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+f.x,y:i+f.y,data:{...f,placement:l}}}}},C6=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:f={fn:j=>{let{x:R,y:N}=j;return{x:R,y:N}}},...d}=ya(e,t),p={x:n,y:r},g=await i.detectOverflow(t,d),y=Fo(o),v=Cw(y);let x=p[v],E=p[y];const S=(j,R)=>fk(R+g[j==="y"?"top":"left"],R,R-g[j==="y"?"bottom":"right"]);l&&(x=S(v,x)),c&&(E=S(y,E));const _=f.fn({...t,[v]:x,[y]:E});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[v]:l,[y]:c}}}}}},_6=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:i,placement:l,rects:c,middlewareData:f}=t,{offset:d=0,mainAxis:p=!0,crossAxis:g=!0}=ya(e,t),y={x:o,y:i},v=Fo(l),x=Cw(v);let E=y[x],S=y[v];const _=ya(d,t),j=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:(n=_.mainAxis)!=null?n:0,crossAxis:(r=_.crossAxis)!=null?r:0};if(p){const O=x==="y"?"height":"width",k=c.reference[x]-c.floating[O]+j.mainAxis,M=c.reference[x]+c.reference[O]-j.mainAxis;E<k?E=k:E>M&&(E=M)}if(g){var R,N;const O=x==="y"?"width":"height",k=Uk.has(Uo(l)),M=c.reference[v]-c.floating[O]+(k&&((R=f.offset)==null?void 0:R[v])||0)+(k?0:j.crossAxis),T=c.reference[v]+c.reference[O]+(k?0:((N=f.offset)==null?void 0:N[v])||0)-(k?j.crossAxis:0);S<M?S=M:S>T&&(S=T)}return{[x]:E,[v]:S}}}},R6=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:l=()=>{},...c}=ya(e,t),f=await o.detectOverflow(t,c),d=Uo(n),p=Ea(n),g=Fo(n)==="y",{width:y,height:v}=r.floating;let x,E;d==="top"||d==="bottom"?(x=d,E=p===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(E=d,x=p==="end"?"top":"bottom");const S=v-f.top-f.bottom,_=y-f.left-f.right,j=Gc(v-f[x],S),R=Gc(y-f[E],_),N=t.middlewareData.shift,O=!N;let k=j,M=R;N!=null&&N.enabled.x&&(M=_),N!=null&&N.enabled.y&&(k=S),O&&!p&&(g?M=y-2*vi(f.left,f.right):k=v-2*vi(f.top,f.bottom)),await l({...t,availableWidth:M,availableHeight:k});const T=await o.getDimensions(i.floating);return y!==T.width||v!==T.height?{reset:{rects:!0}}:{}}}};function Hk(e){const t=_o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Cn(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=xm(n)!==i||xm(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function Pw(e){return Gt(e)?e:e.contextElement}function $c(e){const t=Pw(e);if(!Cn(t))return xi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Hk(t);let l=(i?xm(n.width):n.width)/r,c=(i?xm(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const j6=xi(0);function Bk(e){const t=An(e);return!gw()||!t.visualViewport?j6:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function N6(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===An(e)}function dl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Pw(e);let l=xi(1);t&&(r?Gt(r)&&(l=$c(r)):l=$c(e));const c=N6(i,n,r)?Bk(i):xi(0);let f=(o.left+c.x)/l.x,d=(o.top+c.y)/l.y,p=o.width/l.x,g=o.height/l.y;if(i&&r){const y=An(i),v=Gt(r)?An(r):r;let x=y,E=Pb(x);for(;E&&v!==x;){const S=$c(E),_=E.getBoundingClientRect(),j=_o(E),R=_.left+(E.clientLeft+parseFloat(j.paddingLeft))*S.x,N=_.top+(E.clientTop+parseFloat(j.paddingTop))*S.y;f*=S.x,d*=S.y,p*=S.x,g*=S.y,f+=R,d+=N,x=An(E),E=Pb(x)}}return Wd({width:p,height:g,x:f,y:d})}function _g(e,t){const n=hg(e).scrollLeft;return t?t.left+n:dl(Ci(e)).left+n}function qk(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-_g(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function T6(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=Ci(r),c=t?fg(t.floating):!1;if(r===l||c&&i)return n;let f={scrollLeft:0,scrollTop:0},d=xi(1);const p=xi(0),g=Cn(r);if((g||!i)&&((Pr(r)!=="body"||Rf(l))&&(f=hg(r)),g)){const v=dl(r);d=$c(r),p.x=v.x+r.clientLeft,p.y=v.y+r.clientTop}const y=l&&!g&&!i?qk(l,f):xi(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-f.scrollLeft*d.x+p.x+y.x,y:n.y*d.y-f.scrollTop*d.y+p.y+y.y}}function O6(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function M6(e){const t=hg(e),n=e.ownerDocument.body,r=vi(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=vi(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+_g(e);const l=-t.scrollTop;return _o(n).direction==="rtl"&&(i+=vi(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:l}}const k6=25;function A6(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=An(e),i=Ci(e),l=o.visualViewport;let c=i.clientWidth,f=i.clientHeight,d=0,p=0;if(l){const y=!gw()||t==="fixed";r?y||(d=-l.offsetLeft,p=-l.offsetTop):(c=l.width,f=l.height,y&&(d=l.offsetLeft,p=l.offsetTop))}if(_g(i)<=0){const y=i.ownerDocument,v=y.body,x=getComputedStyle(v),E=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,S=Math.abs(i.clientWidth-v.clientWidth-E),_=getComputedStyle(i).scrollbarGutter==="stable both-edges"?S/2:S;_<=k6&&(c-=_)}return{width:c,height:f,x:d,y:p}}function D6(e,t){const n=dl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=$c(e),l=e.clientWidth*i.x,c=e.clientHeight*i.y,f=o*i.x,d=r*i.y;return{width:l,height:c,x:f,y:d}}function Ij(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=A6(e,n,t);else if(t==="document")r=M6(Ci(e));else if(Gt(t))r=D6(t,n);else{const o=Bk(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Wd(r)}function P6(e,t){const n=t.get(e);if(n)return n;let r=Xd(e,[],!1).filter(c=>Gt(c)&&Pr(c)!=="body"),o=null;const i=_o(e).position==="fixed";let l=i?wi(e):e;for(;Gt(l)&&!yi(l);){const c=_o(l),f=mw(l),d=o?o.position:i?"fixed":"";!f&&(d==="fixed"||d==="absolute"&&c.position==="static")?r=r.filter(g=>g!==l):o=c,l=wi(l)}return t.set(e,r),r}function I6(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?fg(t)?[]:P6(t,this._c):[].concat(n),r],c=Ij(t,l[0],o);let f=c.top,d=c.right,p=c.bottom,g=c.left;for(let y=1;y<l.length;y++){const v=Ij(t,l[y],o);f=vi(v.top,f),d=Gc(v.right,d),p=Gc(v.bottom,p),g=vi(v.left,g)}return{width:d-g,height:p-f,x:g,y:f}}function z6(e){const{width:t,height:n}=Hk(e);return{width:t,height:n}}function L6(e,t,n){const r=Cn(t),o=Ci(t),i=n==="fixed",l=dl(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const f=xi(0);if((r||!i)&&((Pr(t)!=="body"||Rf(o))&&(c=hg(t)),r)){const y=dl(t,!0,i,t);f.x=y.x+t.clientLeft,f.y=y.y+t.clientTop}!r&&o&&(f.x=_g(o));const d=o&&!r&&!i?qk(o,c):xi(0),p=l.left+c.scrollLeft-f.x-d.x,g=l.top+c.scrollTop-f.y-d.y;return{x:p,y:g,width:l.width,height:l.height}}function Vx(e){return _o(e).position==="static"}function zj(e,t){if(!Cn(e)||_o(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ci(e)===n&&(n=n.ownerDocument.body),n}function Yk(e,t){const n=An(e);if(fg(e))return n;if(!Cn(e)){let o=wi(e);for(;o&&!yi(o);){if(Gt(o)&&!Vx(o))return o;o=wi(o)}return n}let r=zj(e,t);for(;r&&fH(r)&&Vx(r);)r=zj(r,t);return r&&yi(r)&&Vx(r)&&!mw(r)?n:r||mH(e)||n}const $6=async function(e){const t=this.getOffsetParent||Yk,n=this.getDimensions,r=await n(e.floating);return{reference:L6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function F6(e){return _o(e).direction==="rtl"}const Zk={convertOffsetParentRelativeRectToViewportRelativeRect:T6,getDocumentElement:Ci,getClippingRect:I6,getOffsetParent:Yk,getElementRects:$6,getClientRects:O6,getDimensions:z6,getScale:$c,isElement:Gt,isRTL:F6};function Gk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function V6(e,t,n){let r=null,o;const i=Ci(e);function l(){var p;clearTimeout(o),(p=r)==null||p.disconnect(),r=null}function c(p,g){p===void 0&&(p=!1),g===void 0&&(g=1),l();const y=e.getBoundingClientRect(),{left:v,top:x,width:E,height:S}=y;if(p||t(),!E||!S)return;const _=mp(x),j=mp(i.clientWidth-(v+E)),R=mp(i.clientHeight-(x+S)),N=mp(v),k={rootMargin:-_+"px "+-j+"px "+-R+"px "+-N+"px",threshold:vi(0,Gc(1,g))||1};let M=!0;function T(L){const G=L[0].intersectionRatio;if(!Gk(y,e.getBoundingClientRect()))return c();if(G!==g){if(!M)return c();G?c(!1,G):o=setTimeout(()=>{c(!1,1e-7)},1e3)}M=!1}try{r=new IntersectionObserver(T,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(T,k)}r.observe(e)}const f=An(e),d=()=>c(n);return f.addEventListener("resize",d),c(!0),()=>{f.removeEventListener("resize",d),l()}}function Lj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,d=Pw(e),p=o||i?[...d?Xd(d):[],...t?Xd(t):[]]:[];p.forEach(_=>{o&&_.addEventListener("scroll",n),i&&_.addEventListener("resize",n)});const g=d&&c?V6(d,n,i):null;let y=-1,v=null;l&&(v=new ResizeObserver(_=>{let[j]=_;j&&j.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(t)})),n()}),d&&!f&&v.observe(d),t&&v.observe(t));let x,E=f?dl(e):null;f&&S();function S(){const _=dl(e);E&&!Gk(E,_)&&n(),E=_,x=requestAnimationFrame(S)}return n(),()=>{var _;p.forEach(j=>{o&&j.removeEventListener("scroll",n),i&&j.removeEventListener("resize",n)}),g?.(),(_=v)==null||_.disconnect(),v=null,f&&cancelAnimationFrame(x)}}const U6=E6,H6=C6,B6=w6,q6=R6,Y6=_6,Z6=(e,t,n)=>{const r=new Map,o=n??{},i={...Zk,...o.platform,_c:r};return b6(e,t,{...o,platform:i})};var G6=typeof document<"u",K6=function(){},em=G6?b.useLayoutEffect:K6;function Em(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Em(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Em(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Kk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $j(e,t){const n=Kk(e);return Math.round(t*n)/n}function Ux(e){const t=b.useRef(e);return em(()=>{t.current=e}),t}function X6(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:f,open:d}=e,[p,g]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,v]=b.useState(r);Em(y,r)||v(r);const[x,E]=b.useState(null),[S,_]=b.useState(null),j=b.useCallback(U=>{U!==k.current&&(k.current=U,E(U))},[]),R=b.useCallback(U=>{U!==M.current&&(M.current=U,_(U))},[]),N=i||x,O=l||S,k=b.useRef(null),M=b.useRef(null),T=b.useRef(p),L=f!=null,G=Ux(f),B=Ux(o),V=Ux(d),q=b.useCallback(()=>{if(!k.current||!M.current)return;const U={placement:t,strategy:n,middleware:y};B.current&&(U.platform=B.current),Z6(k.current,M.current,U).then(H=>{const Y={...H,isPositioned:V.current!==!1};I.current&&!Em(T.current,Y)&&(T.current=Y,Co.flushSync(()=>{g(Y)}))})},[y,t,n,B,V]);em(()=>{d===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,g(U=>({...U,isPositioned:!1})))},[d]);const I=b.useRef(!1);em(()=>(I.current=!0,()=>{I.current=!1}),[]),em(()=>{if(N&&(k.current=N),O&&(M.current=O),N&&O){if(G.current)return G.current(N,O,q);q()}},[N,O,q,G,L]);const z=b.useMemo(()=>({reference:k,floating:M,setReference:j,setFloating:R}),[j,R]),A=b.useMemo(()=>({reference:N,floating:O}),[N,O]),P=b.useMemo(()=>{const U={position:n,left:0,top:0};if(!A.floating)return U;const H=$j(A.floating,p.x),Y=$j(A.floating,p.y);return c?{...U,transform:"translate("+H+"px, "+Y+"px)",...Kk(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:Y}},[n,c,A.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:q,refs:z,elements:A,floatingStyles:P}),[p,q,z,A,P])}const Q6=(e,t)=>{const n=U6(e);return{name:n.name,fn:n.fn,options:[e,t]}},W6=(e,t)=>{const n=H6(e);return{name:n.name,fn:n.fn,options:[e,t]}},J6=(e,t)=>({fn:Y6(e).fn,options:[e,t]}),eB=(e,t)=>{const n=B6(e);return{name:n.name,fn:n.fn,options:[e,t]}},tB=(e,t)=>{const n=q6(e);return{name:n.name,fn:n.fn,options:[e,t]}},nB={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Rg extends _f{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:i,...l}=t;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:zk(),nested:r,triggerElements:i},nB),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&CH(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function Xk(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:i,onOpenChange:l}=e,c=t.useState("open"),f=t.useState("activeTriggerElement"),d=t.useState(n?"popupElement":"positionerElement"),p=t.context.triggerElements,g=l,y=b.useRef(null);r===void 0&&y.current===null&&(y.current=new Rg({open:c,transitionStatus:void 0,referenceElement:f,floatingElement:d,triggerElements:p,onOpenChange:g,floatingId:o,syncOnly:!0,nested:i}));const v=r??y.current;return t.useSyncedValue("floatingId",o),tt(()=>{const x={open:c,floatingId:o,referenceElement:f,floatingElement:d};Gt(f)&&(x.domReferenceElement=f),v.state.positionReference===v.state.referenceElement&&(x.positionReference=f),v.update(x)},[c,o,f,d,v]),v.context.onOpenChange=g,v.context.nested=i,v}function jg(e,t=!1,n=!1){const[r,o]=b.useState(e&&t?"idle":void 0),[i,l]=b.useState(e);return e&&!i&&(l(!0),o("starting")),!e&&i&&r!=="ending"&&!n&&o("ending"),!e&&!i&&r==="ending"&&o(void 0),tt(()=>{if(!e&&i&&r!=="ending"&&n){const c=Ms.request(()=>{o("ending")});return()=>{Ms.cancel(c)}}},[e,i,r,n]),tt(()=>{if(!e||t)return;const c=Ms.request(()=>{o(void 0)});return()=>{Ms.cancel(c)}},[t,e]),tt(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&o("starting");const c=Ms.request(()=>{o("idle")});return()=>{Ms.cancel(c)}},[t,e,i,r]),{mounted:i,setMounted:l,transitionStatus:r}}function Iw(e,t=!1){const n=Yc();return dt((r,o=null)=>{n.cancel();const i=hi(e);if(i==null)return;const l=i,c=()=>{Co.flushSync(r)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function f(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{o?.aborted||c()},()=>{if(o?.aborted)return;if(l.getAnimations().some(p=>p.pending||p.playState!=="finished")){f();return}c()})}if(t){const d="data-starting-style";if(!l.hasAttribute(d)){n.request(f);return}const p=new MutationObserver(()=>{l.hasAttribute(d)||(p.disconnect(),f())});p.observe(l,{attributes:!0,attributeFilter:[d]}),o?.addEventListener("abort",()=>p.disconnect(),{once:!0});return}n.request(f)})}function Ra(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,i=dt(o),l=Iw(r,n);b.useEffect(()=>{if(!t)return;const c=new AbortController;return l(i,c.signal),()=>{c.abort()}},[t,n,i,l])}const Ng={tabIndex:-1,[zb]:""};function Qk(e){return t=>t==="touch"?e.current:!0}function Wk(e,t=!1){const n=ul(),r=Ca()!=null,o=Dr(()=>e(n,r)).current;return Xk({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function zw({handle:e,store:t}){return tt(()=>e.attachStore(t),[e,t]),null}function rB(e,t){const n=b.useRef(null),r=b.useRef(null);return b.useCallback(o=>{if(e===void 0)return;let i=!1;if(n.current!==null){const l=n.current,c=r.current,f=t.context.triggerElements.getById(l);c&&f===c&&(t.context.triggerElements.delete(l),i=!0),n.current=null,r.current=null}if(o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o),i=!0),i){const l=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==l&&t.set("triggerCount",l)}},[t,e])}function Lw(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const o=n?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=n??null)}function Jk(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function eA(e,t,n,r){const o=n.useState("isMountedByTrigger",e),i=rB(e,n),l=dt(f=>{const d=n.select("open"),p=n.select("activeTriggerId");if(p===e){n.update({activeTriggerElement:f,...d?r:null});return}p==null&&d&&n.update({activeTriggerId:e,activeTriggerElement:f,...r})}),c=b.useCallback(f=>{i(f),f&&l(f)},[i,l]);return tt(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function $w(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=b.useRef(null),o=e.useState("open"),i=e.useState("triggerCount"),l=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");tt(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const f=e.context.triggerElements.size,d={};e.state.triggerCount!==f&&(d.triggerCount=f);const p=e.select("activeTriggerId");let g=null;if(p){const y=e.context.triggerElements.getById(p);if(y)r.current=p,y!==e.state.activeTriggerElement&&(d.activeTriggerElement=y);else{for(const[v,x]of e.context.triggerElements.entries())if(x===e.state.activeTriggerElement){d.activeTriggerId=v,d.activeTriggerElement=x,r.current=v;break}d.activeTriggerId===void 0&&(r.current===p?g=p:r.current=null)}}else r.current=null;if(!g&&!p&&f===1){const y=e.context.triggerElements.entries().next();if(!y.done){const[v,x]=y.value;d.activeTriggerId=v,d.activeTriggerElement=x,r.current=v}}(d.triggerCount!==void 0||d.activeTriggerId!==void 0||d.activeTriggerElement!==void 0)&&e.update(d),g&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===g&&!e.context.triggerElements.getById(g)){const y=Ot(Zc);e.setOpen(!1,y),y.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,i,l,c,n])}function Fw(e,t,n){const{mounted:r,setMounted:o,transitionStatus:i}=jg(e),l=t.useState("preventUnmountingOnClose"),c=e?!1:l;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:c});const f=dt(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Ra({enabled:r&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||f()}}),{forceUnmount:f,transitionStatus:i}}function Vw(e,t){e.useSyncedValues(t),tt(()=>()=>{e.update({activeTriggerProps:Kn,inactiveTriggerProps:Kn,popupProps:Kn})},[e])}function tA(e,t){tt(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),tt(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Nf{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function oB(){return new Rg({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Nf,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Uw(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:oB(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Kn,inactiveTriggerProps:Kn,popupProps:Kn}}function nA(e,t,n=!1){return new Rg({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const Vd=e=>e.triggerIdProp??e.activeTriggerId,Hw=e=>e.openProp??e.open,Fj=e=>(e.popupElement?.id??e.floatingId)||void 0;function rA(e,t){return t!==void 0&&Hw(e)&&Vd(e)===t}function sB(e,t){return rA(e,t)?!0:t!==void 0&&Hw(e)&&Vd(e)==null&&e.triggerCount===1}const Bw={open:Hw,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Vd,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Fj,isTriggerActive:(e,t)=>t!==void 0&&Vd(e)===t,isOpenedByTrigger:(e,t)=>rA(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Vd(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>sB(e,t)?Fj(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function oA(e){const t=b.useCallback(r=>e===void 0?gr:e.subscribeStore(r),[e]),n=b.useCallback(()=>e===void 0?void 0:e.store,[e]);return dw.useSyncExternalStore(t,n,()=>e?.serverStore)}function iB(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=ul(),i=Ca()!=null,l=Dr(()=>new Rg({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Nf,floatingId:o,syncOnly:!1,nested:i})).current;return tt(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Gt(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),l.update(c)},[t,o,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}function aB(e){return lB(e,e.rootContext)}function lB(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),i=t.useState("floatingElement"),l=t.useState("domReferenceElement"),c=t.useState("open"),f=t.useState("floatingId"),[d,p]=b.useState(null),[g,y]=b.useState(void 0),[v,x]=b.useState(void 0),E=b.useRef(null),S=_a(r),_=b.useMemo(()=>({reference:o,floating:i,domReference:l}),[o,i,l]),j=X6({...e,elements:{..._,...d&&{reference:d}}}),R=Gt(g)?g:null,N=v===void 0?t.state.floatingElement:v;t.useSyncedValue("referenceElement",g??null),t.useSyncedValue("domReferenceElement",g===void 0?l:R),t.useSyncedValue("floatingElement",N);const O=b.useCallback(B=>{const V=Gt(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;p(V),j.refs.setReference(V)},[j.refs]),k=b.useCallback(B=>{(Gt(B)||B===null)&&(E.current=B,y(B)),(Gt(j.refs.reference.current)||j.refs.reference.current===null||B!==null&&!Gt(B))&&j.refs.setReference(B)},[j.refs,y]),M=b.useCallback(B=>{x(B),j.refs.setFloating(B)},[j.refs]),T=b.useMemo(()=>({...j.refs,setReference:k,setFloating:M,setPositionReference:O,domReference:E}),[j.refs,k,M,O]),L=b.useMemo(()=>({...j.elements,domReference:l}),[j.elements,l]),G=b.useMemo(()=>({...j,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:f,refs:T,elements:L,nodeId:n,rootStore:t}),[j,T,L,n,t,c,f]);return tt(()=>{l&&(E.current=l)},[l]),tt(()=>{t.context.dataRef.current.floatingContext=G;const B=S?.nodesRef.current.find(V=>V.id===n);B&&(B.context=G)}),b.useMemo(()=>({...j,context:G,refs:T,elements:L,rootStore:t}),[j,T,L,G,t])}const Hx=vw&&_i;function cB(e,t={}){const{enabled:n=!0,delay:r}=t,o="rootStore"in e?e.rootStore:e,{events:i,dataRef:l}=o.context,c=b.useRef(!1),f=b.useRef(null),d=b.useRef(!0),p=Ar();b.useEffect(()=>{const y=o.select("domReferenceElement");if(!n)return;const v=An(y);function x(){const _=o.select("domReferenceElement");!o.select("open")&&Cn(_)&&_===Zr(Zt(_))&&(c.current=!0)}function E(){d.current=!0}function S(){d.current=!1}return Ps(zt(v,"blur",x),Hx&&zt(v,"keydown",E,!0),Hx&&zt(v,"pointerdown",S,!0))},[o,n]),b.useEffect(()=>{if(!n)return;function y(v){if(v.reason===cl||v.reason===bg){const x=o.select("domReferenceElement");Gt(x)&&(f.current=x,c.current=!0)}}return i.on("openchange",y),()=>{i.off("openchange",y)}},[i,n,o]);const g=b.useMemo(()=>{function y(){c.current=!1,f.current=null}return{onMouseLeave(){y()},onFocus(v){const x=v.currentTarget;if(c.current){if(f.current===x)return;y()}const E=ao(v.nativeEvent);if(Gt(E)){if(Hx&&!v.relatedTarget){if(!d.current&&!vg(E))return}else if(!jH(E))return}const S=ym(v.relatedTarget,o.context.triggerElements),{nativeEvent:_,currentTarget:j}=v,R=typeof r=="function"?r():r;if(o.select("open")&&S||R===0||R===void 0){o.setOpen(!0,Ot($d,_,j));return}p.start(R,()=>{c.current||o.setOpen(!0,Ot($d,_,j))})},onBlur(v){y();const x=v.relatedTarget,E=v.nativeEvent,S=Gt(x)&&x.hasAttribute(Jd("focus-guard"))&&x.getAttribute("data-type")==="outside";p.start(0,()=>{const _=o.select("domReferenceElement"),j=Zr(Zt(_));!x&&j===_||mt(l.current.floatingContext?.refs.floating.current,j)||mt(_,j)||S||ym(x??j,o.context.triggerElements)||o.setOpen(!1,Ot($d,E))})}}},[l,r,o,p]);return b.useMemo(()=>n?{reference:g,trigger:g}:{},[n,g])}class qw{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new is,this.restTimeout=new is,this.handleCloseOptions=void 0}static create(){return new qw}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Cm=new WeakMap;function _m(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Cm.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Cm.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function sA(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,i=Cm.get(n);i&&i!==e&&_m(i),_m(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Cm.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function iA(e){const t=e.context.dataRef.current,n=Dr(()=>t.hoverInteractionState??qw.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),yw(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function aA(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,i="rootStore"in e?e.rootStore:e,l=i.useState("open"),c=i.useState("floatingElement"),f=i.useState("domReferenceElement"),{dataRef:d}=i.context,p=_a(),g=Ca(),y=iA(i),v=Ar(),x=dt(()=>ck(d.current.openEvent?.type,y.interactedInside)),E=dt(()=>TH(d.current.openEvent?.type)),S=dt(()=>{_m(y)});tt(()=>{l||(y.pointerType=void 0,y.restTimeoutPending=!1,y.interactedInside=!1,S())},[l,y,S]),b.useEffect(()=>S,[S]),tt(()=>{if(n&&l&&y.handleCloseOptions?.blockPointerEvents&&E()&&Gt(f)&&c){const _=f,j=c,R=Zt(c),N=p?.nodesRef.current.find(T=>T.id===g)?.context?.elements.floating;N&&(N.style.pointerEvents="");const O=y.pointerEventsScopeElement!==j?y.pointerEventsScopeElement:null,k=N!==j?N:null,M=y.handleCloseOptions?.getScope?.()??O??k??_.closest("[data-rootownerid]")??R.body;return sA(y,{scopeElement:M,referenceElement:_,floatingElement:j}),()=>{S()}}},[n,l,f,c,y,E,p,g,S]),b.useEffect(()=>{if(!n)return;function _(){return!!(p&&g&&va(p.nodesRef.current,g).length>0)}function j(T){const L=$b(r,"close",y.pointerType),G=()=>{i.setOpen(!1,Ot(vr,T)),p?.events.emit("floating.closed",T)};L?y.openChangeTimeout.start(L,G):(y.openChangeTimeout.clear(),G())}function R(T){const L=ao(T);if(!RH(L)){y.interactedInside=!1;return}y.interactedInside=L?.closest("[aria-haspopup]")!=null}function N(){y.openChangeTimeout.clear(),v.clear(),p?.events.off("floating.closed",k),S()}function O(T){if(_()&&p){p.events.on("floating.closed",k);return}if(ym(T.relatedTarget,i.context.triggerElements))return;const L=d.current.floatingContext?.nodeId??o,G=T.relatedTarget;if(!(p&&L&&Gt(G)&&va(p.nodesRef.current,L,!1).some(V=>mt(V.context?.elements.floating,G)))){if(y.handler){y.handler(T);return}S(),E()&&!x()&&j(T)}}function k(T){!p||!g||_()||v.start(0,()=>{p.events.off("floating.closed",k),i.setOpen(!1,Ot(vr,T)),p.events.emit("floating.closed",T)})}const M=c;return Ps(M&&zt(M,"mouseenter",N),M&&zt(M,"mouseleave",O),M&&zt(M,"pointerdown",R,!0),()=>{p?.events.off("floating.closed",k)})},[n,c,i,d,r,o,E,x,S,y,p,g,v])}const uB={current:null};function lA(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:l=0,move:c=!0,triggerElementRef:f=uB,externalTree:d,isActiveTrigger:p=!0,getHandleCloseContext:g,isClosing:y,shouldOpen:v,guardStaleOpen:x=!1}=t,E="rootStore"in e?e.rootStore:e,{dataRef:S,events:_}=E.context,j=_a(d),R=iA(E),N=b.useRef(!1),O=er(o),k=er(r),M=er(l),T=er(n),L=er(v),G=er(y),B=dt(()=>ck(S.current.openEvent?.type,R.interactedInside)),V=dt(()=>L.current?.()!==!1),q=dt((A,P,U)=>{const H=E.context.triggerElements;if(H.hasElement(P))return!A||!mt(A,P);if(!Gt(U))return!1;const Y=U;return H.hasMatchingElement($=>mt($,Y))&&(!A||!mt(A,Y))}),I=dt(()=>{if(!R.handler)return;Zt(E.select("domReferenceElement")).removeEventListener("mousemove",R.handler),R.handler=void 0}),z=dt(()=>{_m(R)});return p&&(R.handleCloseOptions=O.current?.__options),b.useEffect(()=>I,[I]),b.useEffect(()=>{if(!n)return;function A(P){P.open?N.current=!1:(N.current=P.reason===vr,I(),R.openChangeTimeout.clear(),R.restTimeout.clear(),R.blockMouseMove=!0,R.restTimeoutPending=!1)}return _.on("openchange",A),()=>{_.off("openchange",A)}},[n,_,R,I]),b.useEffect(()=>{if(!n)return;function A(F,Q=!0){const X=$b(k.current,"close",R.pointerType);X?R.openChangeTimeout.start(X,()=>{E.setOpen(!1,Ot(vr,F)),j?.events.emit("floating.closed",F)}):Q&&(R.openChangeTimeout.clear(),E.setOpen(!1,Ot(vr,F)),j?.events.emit("floating.closed",F))}const P=f.current??(p?E.select("domReferenceElement"):null);if(!Gt(P))return;function U(F){if(R.openChangeTimeout.clear(),R.blockMouseMove=!1,i&&!zc(R.pointerType))return;const Q=gj(M.current),X=$b(k.current,"open",R.pointerType),ne=ao(F),te=F.currentTarget??null,J=E.select("domReferenceElement");let K=te;if(Gt(ne)&&!E.context.triggerElements.hasElement(ne)){for(const Ae of E.context.triggerElements.elements())if(mt(Ae,ne)){K=Ae;break}}Gt(te)&&Gt(J)&&!E.context.triggerElements.hasElement(te)&&mt(te,J)&&(K=J);const re=K==null?!1:q(J,K,ne),ye=E.select("open"),fe=G.current?.()??E.select("transitionStatus")==="ending",ue=!ye&&fe&&N.current,he=!re&&Gt(K)&&Gt(J)&&mt(J,K)&&ue,Re=Q>0&&!X,ze=re&&(ye||ue)||he,Ue=!ye||re;if(ze){V()&&E.setOpen(!0,Ot(vr,F,K));return}Re||(X?R.openChangeTimeout.start(X,()=>{Ue&&V()&&E.setOpen(!0,Ot(vr,F,K))}):Ue&&V()&&E.setOpen(!0,Ot(vr,F,K)))}function H(F){if(B()){z();return}I();const Q=E.select("domReferenceElement"),X=Zt(Q);R.restTimeout.clear(),R.restTimeoutPending=!1;const ne=S.current.floatingContext??g?.();if(ym(F.relatedTarget,E.context.triggerElements))return;if(O.current&&ne){E.select("open")||R.openChangeTimeout.clear();const J=f.current;R.handler=O.current({...ne,tree:j,x:F.clientX,y:F.clientY,onClose(){z(),I(),T.current&&!B()&&J===E.select("domReferenceElement")&&A(F,!0)}}),X.addEventListener("mousemove",R.handler),R.handler(F);return}(R.pointerType!=="touch"||!mt(E.select("floatingElement"),F.relatedTarget))&&A(F)}function Y(F){mt(P,F.relatedTarget)||(R.openChangeTimeout.clear(),R.restTimeout.clear(),R.restTimeoutPending=!1)}const $=x?zt(P,"mouseout",Y):void 0;return c?Ps(zt(P,"mousemove",U,{once:!0}),zt(P,"mouseenter",U),zt(P,"mouseleave",H),$):Ps(zt(P,"mouseenter",U),zt(P,"mouseleave",H),$)},[I,z,S,k,E,n,O,R,p,q,B,i,c,M,f,j,T,g,G,V,x]),b.useMemo(()=>{if(!n)return;function A(P){R.pointerType=P.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(P){const{nativeEvent:U}=P,H=P.currentTarget,Y=E.select("domReferenceElement"),$=E.select("open"),F=q(Y,H,P.target);if(i&&!zc(R.pointerType))return;if($&&F&&R.handleCloseOptions?.blockPointerEvents){const ne=E.select("floatingElement");if(ne){const te=R.handleCloseOptions?.getScope?.()??H.ownerDocument.body;sA(R,{scopeElement:te,referenceElement:H,floatingElement:ne})}}const Q=gj(M.current);if($&&!F||Q===0||!F&&R.restTimeoutPending&&P.movementX**2+P.movementY**2<2)return;R.restTimeout.clear();function X(){if(R.restTimeoutPending=!1,B())return;const ne=E.select("open");!R.blockMouseMove&&(!ne||F)&&V()&&E.setOpen(!0,Ot(vr,U,H))}R.pointerType==="touch"?Co.flushSync(()=>{X()}):F&&$?X():(R.restTimeoutPending=!0,R.restTimeout.start(Q,X))}}},[n,R,B,q,i,E,M,V])}const dB="Escape";function Vj(e){return _i&&e.movementX===0&&e.movementY===0}function Tg(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function yp(e,t){return Tg(t,e===lk||e===Sw,e===gg||e===yg)}function Bx(e,t,n){return Tg(t,e===Sw,n?e===gg:e===yg)||e==="Enter"||e===" "||e===""}function fB(e,t,n){return Tg(t,n?e===gg:e===yg,e===Sw)}function hB(e,t,n,r){const o=n?e===yg:e===gg,i=e===lk;return t==="both"||t==="horizontal"&&r?e===dB:Tg(t,o,i)}function cA(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:c=!1,loopFocus:f=!1,nested:d=!1,rtl:p=!1,virtual:g=!1,focusItemOnOpen:y="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:x=!0,disabledIndices:E=void 0,orientation:S="vertical",parentOrientation:_,id:j,resetOnPointerLeave:R=!0,externalTree:N,grid:O}=t,k=O!=null,M="rootStore"in e?e.rootStore:e,T=M.useState("open"),L=M.useState("floatingElement"),G=M.useState("domReferenceElement"),B=M.context.dataRef,V=vm(L),q=Lb(G),I=er(V),z=Ca(),A=_a(N),P=b.useRef(y),U=b.useRef(l??-1),H=b.useRef(null),Y=b.useRef(!0),$=dt(me=>{o(U.current===-1?null:U.current,me)}),F=b.useRef(!!L),Q=b.useRef(T),X=b.useRef(!1),ne=b.useRef(!1),te=b.useRef(null),J=er(E),K=er(T),re=er(l),ye=er(R),fe=Yc(),ue=Yc(),he=dt(()=>{function me(Ie){g?A?.events.emit("virtualfocus",Ie):te.current=Jp(Ie,{sync:X.current,preventScroll:!0})}const xe=n.current[U.current],We=ne.current;xe&&me(xe),(X.current?Ie=>Ie():Ie=>fe.request(Ie))(()=>{const Ie=n.current[U.current]||xe;if(!Ie)return;xe||me(Ie),De&&(We||!Y.current)&&Ie.scrollIntoView?.({block:"nearest",inline:"nearest"})})});tt(()=>{B.current.orientation=S},[B,S]),tt(()=>{i&&(T&&L?(U.current=l??-1,P.current&&l!=null&&(ne.current=!0,$())):F.current&&(U.current=-1,$()))},[i,T,L,l,$]),tt(()=>{if(i){if(!T){X.current=!1;return}if(L)if(r==null){if(X.current=!1,re.current!=null)return;if(F.current&&(U.current=-1,he()),(!Q.current||!F.current)&&P.current&&(H.current!=null||P.current===!0&&H.current==null)){let me=0;const xe=()=>{n.current[0]==null?(me<2&&(me?Oe=>ue.request(Oe):queueMicrotask)(xe),me+=1):(U.current=H.current==null||Bx(H.current,S,p)||d?zx(n):bj(n),H.current=null,$())};xe()}}else xj(n.current,r)||(U.current=r,he(),ne.current=!1)}},[i,T,L,r,re,d,n,S,p,$,he,ue]),tt(()=>{if(!i||L||!A||g||!F.current)return;const me=A.nodesRef.current,xe=me.find(Ie=>Ie.id===z)?.context?.elements.floating,We=Zr(Zt(G??xe??null)),Oe=me.some(Ie=>Ie.context&&mt(Ie.context.elements.floating,We));xe&&!Oe&&Y.current&&xe.focus({preventScroll:!0})},[i,L,G,A,z,g]),tt(()=>{Q.current=T,F.current=!!L}),tt(()=>{T||(H.current=null,P.current=y)},[T,y]);const Re=r!=null,ze=dt(me=>{if(!K.current)return;const xe=n.current.indexOf(me.currentTarget);xe!==-1&&(U.current!==xe||r!==xe)&&(U.current=xe,$(me))}),Ue=dt(()=>_??A?.nodesRef.current.find(me=>me.id===z)?.context?.dataRef?.current.orientation),Ae=dt(()=>zx(n,J.current)),Qe=dt(me=>{if(Y.current=!1,X.current=!0,me.which===229||!K.current&&me.currentTarget===I.current)return;if(d&&hB(me.key,S,p,k)){yp(me.key,Ue())||Ts(me),M.setOpen(!1,Ot(Fb,me.nativeEvent)),Cn(G)&&(g?A?.events.emit("virtualfocus",G):G.focus());return}const xe=U.current,We=zx(n,E),Oe=bj(n,E);if(q||(me.key==="Home"&&(Ts(me),U.current=We,$(me)),me.key==="End"&&(Ts(me),U.current=Oe,$(me))),O!=null){const Ie=O(me,U.current,n,S,f,p,E,We,Oe);if(Ie!=null&&(U.current=Ie,$(me)),S==="both")return}if(yp(me.key,S)){if(Ts(me),T&&!g&&Zr(me.currentTarget.ownerDocument)===me.currentTarget){U.current=Bx(me.key,S,p)?We:Oe,$(me);return}Bx(me.key,S,p)?f?xe>=Oe?c&&xe!==n.current.length?U.current=-1:(X.current=!1,U.current=We):U.current=kc(n.current,{startingIndex:xe,disabledIndices:E}):U.current=Math.min(Oe,kc(n.current,{startingIndex:xe,disabledIndices:E})):f?xe<=We?c&&xe!==-1?U.current=n.current.length:(X.current=!1,U.current=Oe):U.current=kc(n.current,{startingIndex:xe,decrement:!0,disabledIndices:E}):U.current=Math.max(We,kc(n.current,{startingIndex:xe,decrement:!0,disabledIndices:E})),xj(n.current,U.current)&&(U.current=-1),$(me)}}),De=b.useMemo(()=>({onFocus(xe){X.current=!0,ze(xe)},onClick:({currentTarget:xe})=>xe.focus({preventScroll:!0}),onMouseMove(xe){Vj(xe)||(X.current=!0,ne.current=!1,v&&ze(xe))},onPointerLeave(xe){if(!K.current||!Y.current||xe.pointerType==="touch")return;X.current=!0;const We=xe.relatedTarget;if(!(!v||n.current.includes(We))&&ye.current&&(te.current?.(),te.current=null,U.current=-1,$(xe),!g)){const Oe=I.current,Ie=Zr(Zt(Oe));Oe&&mt(Oe,Ie)&&Oe.focus({preventScroll:!0})}}}),[ze,K,I,v,n,$,ye,g]),Le=b.useMemo(()=>g&&T&&Re&&{"aria-activedescendant":`${j}-${r}`},[g,T,Re,j,r]),Fe=b.useMemo(()=>({"aria-orientation":S==="both"?void 0:S,...q?{}:Le,onKeyDown(me){if(me.key==="Tab"&&me.shiftKey&&T&&!g){const xe=ao(me.nativeEvent);if(xe&&!mt(I.current,xe))return;Ts(me),M.setOpen(!1,Ot(ma,me.nativeEvent)),Cn(G)&&G.focus();return}Qe(me)},onPointerMove(me){Vj(me)||(Y.current=!0)}}),[Le,Qe,I,S,q,M,T,g,G]),Ye=b.useMemo(()=>{function me(Oe){M.setOpen(!0,Ot(Fb,Oe.nativeEvent,Oe.currentTarget))}function xe(Oe){y==="auto"&&bw(Oe.nativeEvent)&&(P.current=!g)}function We(Oe){P.current=y,y==="auto"&&ww(Oe.nativeEvent)&&(P.current=!0)}return{onKeyDown(Oe){const Ie=M.select("open");Y.current=!1;const at=Oe.key.startsWith("Arrow"),it=fB(Oe.key,Ue(),p),$t=yp(Oe.key,S),W=(d?it:$t)||Oe.key==="Enter"||Oe.key.trim()==="";if(g&&Ie)return Qe(Oe);if(!(!Ie&&!x&&at)){if(W){const ie=yp(Oe.key,Ue());H.current=d&&ie?null:Oe.key}if(d){it&&(Ts(Oe),Ie?(U.current=Ae(),$(Oe)):me(Oe));return}$t&&(re.current!=null&&(U.current=re.current),Ts(Oe),!Ie&&x?me(Oe):Qe(Oe),Ie&&$(Oe))}},onFocus(Oe){M.select("open")&&!g&&(U.current=-1,$(Oe))},onPointerDown:We,onPointerEnter:We,onMouseDown:xe,onClick:xe}},[Qe,y,Ae,d,$,M,x,S,Ue,p,re,g]),et=b.useMemo(()=>({...Le,...Ye}),[Le,Ye]);return b.useMemo(()=>i?{reference:et,floating:Fe,item:De,trigger:Ye}:{},[i,et,Fe,Ye,De])}function uA(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:i,disabledIndices:l,onTyping:c,enabled:f=!0,resetMs:d=750,selectedIndex:p=null}=t,g="rootStore"in e?e.rootStore:e,y=g.useState("open"),v=Ar(),x=b.useRef(""),E=b.useRef(p??o??-1),S=b.useRef(null),_=dt(N=>{function O(I){return r?.current[I]}function k(I){const z=O(I);return z&&!wg(z)||z?.matches(":disabled")?!1:l==null||!pk(ll,I,l)}function M(I,z,A=0){if(I.length===0)return-1;const P=(A%I.length+I.length)%I.length,U=z.toLowerCase();for(let H=0;H<I.length;H+=1){const Y=(P+H)%I.length;if(!(!I[Y]?.toLowerCase().startsWith(U)||!k(Y)))return Y}return-1}const T=n.current;if(x.current.length>0&&N.key===" "&&(Ts(N),c?.(!0)),x.current.length>0&&x.current[0]!==" "&&M(T,x.current)===-1&&N.key!==" "&&c?.(!1),T==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;y&&N.key!==" "&&(Ts(N),c?.(!0));const L=x.current==="";L&&(E.current=p??o??-1),T.every((I,z)=>I&&k(z)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&x.current===N.key&&(x.current="",E.current=S.current),x.current+=N.key,v.start(d,()=>{x.current="",E.current=S.current,c?.(!1)});const V=((L?p??o??-1:E.current)??0)+1,q=M(T,x.current,V);q!==-1?(i?.(q),S.current=q):N.key!==" "&&(x.current="",c?.(!1))}),j=dt(N=>{const O=N.relatedTarget,k=g.select("domReferenceElement"),M=g.select("floatingElement");mt(k,O)||mt(M,O)||(v.clear(),x.current="",E.current=S.current,c?.(!1))});tt(()=>{!y&&p!==null||(v.clear(),S.current=null,x.current!==""&&(x.current=""))},[y,p,v]);const R=b.useMemo(()=>({onKeyDown:_,onBlur:j}),[_,j]);return b.useMemo(()=>f?{reference:R,floating:R}:{},[f,R])}const Uj=.1,pB=Uj*Uj,yn=.5;function vp(e,t,n,r,o,i){return r>=t!=i>=t&&e<=(o-n)*(t-r)/(i-r)+n}function xp(e,t,n,r,o,i,l,c,f,d){let p=!1;return vp(e,t,n,r,o,i)&&(p=!p),vp(e,t,o,i,l,c)&&(p=!p),vp(e,t,l,c,f,d)&&(p=!p),vp(e,t,f,d,n,r)&&(p=!p),p}function mB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function bp(e,t,n,r,o,i){const l=Math.min(n,o),c=Math.max(n,o),f=Math.min(r,i),d=Math.max(r,i);return e>=l&&e<=c&&t>=f&&t<=d}function dA(e={}){const{blockPointerEvents:t=!1}=e,n=new is,r=({x:o,y:i,placement:l,elements:c,onClose:f,nodeId:d,tree:p})=>{const g=l?.split("-")[0];let y=!1,v=null,x=null,E=typeof performance<"u"?performance.now():0;function S(j,R){const N=performance.now(),O=N-E;if(v===null||x===null||O===0)return v=j,x=R,E=N,!1;const k=j-v,M=R-x,T=k*k+M*M,L=O*O*pB;return v=j,x=R,E=N,T<L}function _(){n.clear(),f()}return function(R){n.clear();const N=c.domReference,O=c.floating;if(!N||!O||g==null||o==null||i==null)return;const{clientX:k,clientY:M}=R,T=ao(R),L=R.type==="mouseleave",G=mt(O,T),B=mt(N,T);if(G&&(y=!0,!L))return;if(B&&(y=!1,!L)){y=!0;return}if(L&&Gt(R.relatedTarget)&&mt(O,R.relatedTarget))return;function V(){return!!(p&&va(p.nodesRef.current,d).length>0)}function q(){V()||_()}if(V())return;const I=N.getBoundingClientRect(),z=O.getBoundingClientRect(),A=o>z.right-z.width/2,P=i>z.bottom-z.height/2,U=z.width>I.width,H=z.height>I.height,Y=(U?I:z).left,$=(U?I:z).right,F=(H?I:z).top,Q=(H?I:z).bottom;if(g==="top"&&i>=I.bottom-1||g==="bottom"&&i<=I.top+1||g==="left"&&o>=I.right-1||g==="right"&&o<=I.left+1){q();return}let X=!1;switch(g){case"top":X=bp(k,M,Y,I.top+1,$,z.bottom-1);break;case"bottom":X=bp(k,M,Y,z.top+1,$,I.bottom-1);break;case"left":X=bp(k,M,z.right-1,Q,I.left+1,F);break;case"right":X=bp(k,M,I.right-1,Q,z.left+1,F);break}if(X)return;if(y&&!mB(k,M,I)){q();return}if(!L&&S(k,M)){q();return}let ne=!1;switch(g){case"top":{const te=U?yn/2:yn*4,J=U||A?o+te:o-te,K=U?o-te:A?o+te:o-te,re=i+yn+1,ye=A||U?z.bottom-yn:z.top,fe=A?U?z.bottom-yn:z.top:z.bottom-yn;ne=xp(k,M,J,re,K,re,z.left,ye,z.right,fe);break}case"bottom":{const te=U?yn/2:yn*4,J=U||A?o+te:o-te,K=U?o-te:A?o+te:o-te,re=i-yn,ye=A||U?z.top+yn:z.bottom,fe=A?U?z.top+yn:z.bottom:z.top+yn;ne=xp(k,M,J,re,K,re,z.left,ye,z.right,fe);break}case"left":{const te=H?yn/2:yn*4,J=H||P?i+te:i-te,K=H?i-te:P?i+te:i-te,re=o+yn+1,ye=P||H?z.right-yn:z.left,fe=P?H?z.right-yn:z.left:z.right-yn;ne=xp(k,M,ye,z.top,fe,z.bottom,re,J,re,K);break}case"right":{const te=H?yn/2:yn*4,J=H||P?i+te:i-te,K=H?i-te:P?i+te:i-te,re=o-yn,ye=P||H?z.left+yn:z.right,fe=P?H?z.left+yn:z.right:z.left+yn;ne=xp(k,M,re,J,re,K,ye,z.top,fe,z.bottom);break}}ne?y||n.start(40,q):q()}};return r.__options={...e,blockPointerEvents:t},r}const fA=b.createContext(null);function Hs(){const e=b.useContext(fA);if(e===null)throw new Error(Er(60));return e}const gB={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},yB={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},vB={disabled:!1,...yB},hA={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},xB={invalid:void 0,name:void 0,validityData:{state:gB,errors:[],error:"",value:"",initialValue:null},setValidityData:gr,disabled:void 0,setTouched:gr,setDirty:gr,setFilled:gr,setFocused:gr,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:vB,registerFieldControl:gr,validation:{getValidationProps:(e,t=Kn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:gr,getInputControl:()=>null,commit:async()=>{},change:gr}},bB=b.createContext(xB);function Og(e=!0){const t=b.useContext(bB);if(t.setValidityData===gr&&!e)throw new Error(Er(28));return t}function pA(e,t,n,r,o=!0,i){const{registerFieldControl:l}=Og(),c=Dr(()=>Symbol());tt(()=>{const f=c.current;if(!o){l(f,void 0);return}l(f,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,o,r,t,i,l,c,n]),tt(()=>{const f=c.current;return()=>{l(f,void 0)}},[l,c])}function Rl(e){return ul(e,"base-ui")}const wB=b.createContext({controlId:void 0,registerControlId:gr,labelId:void 0,setLabelId:gr,messageIds:[],setMessageIds:gr,getDescriptionProps:e=>e});function Yw(){return b.useContext(wB)}function Zw(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:i}=Yw(),l=Rl(t),c=n?o:void 0,f=Dr(()=>Symbol()),d=b.useRef(!1),p=b.useRef(t!=null),g=dt(()=>{!d.current||i===gr||(d.current=!1,i(f.current,void 0))});return tt(()=>{if(i===gr)return;let y;if(n){const v=r?.current;Gt(v)&&v.closest("label")!=null?y=t??null:y=c??l}else if(t!=null)p.current=!0,y=t;else if(p.current)y=l;else{g();return}if(y===void 0){g();return}d.current=!0,i(f.current,y)},[t,r,c,i,n,l,f,g]),b.useEffect(()=>g,[g]),o??l}const SB=(e,t)=>Object.is(e,t);function Kc(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function tm(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Kc(r,t,n))}function EB(e,t,n){return e.filter(r=>!Kc(t,r,n))}function qb(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function mA(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function CB(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(mA(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function gA(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return qb(e)}function Rc(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?qb(e.value):qb(e)}function yA(e,t,n){function r(){return gA(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,i=mA(o)?o.flatMap(l=>l.items):o;if(e==null||typeof e!="object"){const l=i.find(c=>c.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(c=>c&&c.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function _B(e,t,n){return e.reduce((r,o,i)=>(i>0&&r.push(", "),r.push(h.jsx(b.Fragment,{children:yA(o,t,n)},i)),r),[])}const yt={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Rc(t,r)!==""},hasNullItemLabel:(e,t)=>t?CB(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>Kc(t,o,n)):Kc(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},RB=b.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:gr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function vA(){return b.useContext(RB)}function jB(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function xA(e,t){const n=b.useRef(e),r=dt(t);tt(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function NB(e){const t=b.useRef(""),n=b.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:b.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function bA(e,t){const n=dt((i,l)=>{(typeof e=="function"?e():e)||t(l||(mg?"touch":""))}),{onClick:r,onPointerDown:o}=NB(n);return b.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function wA(e){const[t,n]=b.useState(null),r=bA(e,n);return xA(e,o=>{o&&!e&&n(null)}),b.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function kd(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const es=1;function Gw(e,t){return Math.max(0,e-t)}function Rm(e,t){if(t<=0)return 0;const n=kd(e,0,t),r=n,o=t-n,i=r<=es,l=o<=es;return i&&l?r<=o?0:t:i?0:l?t:n}function TB(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:i,defaultOpen:l=!1,onOpenChange:c,name:f,form:d,autoComplete:p,disabled:g=!1,readOnly:y=!1,required:v=!1,modal:x=!0,actionsRef:E,inputRef:S,onOpenChangeComplete:_,items:j,multiple:R=!1,itemToStringLabel:N,itemToStringValue:O,isItemEqualToValue:k=SB,highlightItemOnHover:M=!0,children:T}=e,{clearErrors:L}=vA(),{setDirty:G,setTouched:B,setFocused:V,validityData:q,setFilled:I,name:z,disabled:A,validation:P,validationMode:U}=Og(),H=Zw({id:t}),Y=A||g,$=z??f,[F,Q]=kb({controlled:n,default:R?r??ll:r,name:"Select",state:"value"}),[X,ne]=kb({controlled:i,default:l,name:"Select",state:"open"}),te=b.useRef([]),J=b.useRef([]),K=b.useRef(null),re=b.useRef(null),ye=b.useRef(0),fe=b.useRef(null),ue=b.useRef([]),he=b.useRef(!1),Re=b.useRef(null),ze=b.useRef(null),Ue=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ae=b.useRef(!1),{mounted:Qe,setMounted:De,transitionStatus:Le}=jg(X),{openMethod:Fe,triggerProps:Ye}=wA(X),et=Dr(()=>new _f({id:H,labelId:void 0,modal:x,multiple:R,itemToStringLabel:N,itemToStringValue:O,isItemEqualToValue:k,value:F,open:X,mounted:Qe,transitionStatus:Le,items:j,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,me=gt(et,yt.activeIndex),xe=gt(et,yt.selectedIndex),We=gt(et,yt.triggerElement),Oe=gt(et,yt.positionerElement),Ie=HU(Fe),at=Fe??Ie,it=b.useMemo(()=>R?"":Rc(F,O),[R,F,O]),$t=b.useMemo(()=>R&&Array.isArray(F)?F.map(ee=>Rc(ee,O)):Rc(F,O),[R,F,O]),W=er(We),ie=dt(()=>$t);pA(W,H,F,ie,!Y,f);const ae=b.useRef(F),Se=R?Array.isArray(F)&&F.length>0:F!=null&&it!=="";tt(()=>{I(Se)},[Se,I]),tt(function(){let se=F,ce=!1;if(R){const Ze=Array.isArray(F)?F:[];ce=Ze.length===0,se=Ze[Ze.length-1]}const Ce=ce?-1:tm(ue.current,se,k),Ne=Ce===-1?null:Ce;Ne===null&&(ze.current=null),!X&&et.set("selectedIndex",Ne)},[R,X,F,k,et]);function be(ee){const se=q.initialValue;return Array.isArray(ee)&&Array.isArray(se)?!jB(ee,se,(ce,Ce)=>Kc(ce,Ce,k)):ee!==se}xA(F,()=>{L($),G(be(F)),P.change(F)});const Ve=dt((ee,se)=>{c?.(ee,se),!se.isCanceled&&(ne(ee),!ee&&(se.reason===ma||se.reason===xg)&&(B(!0),V(!1),U==="onBlur"&&P.commit(F)))}),Me=dt(()=>{De(!1),et.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});Ra({enabled:!E,open:X,ref:K,onComplete(){X||Me()}}),b.useImperativeHandle(E,()=>({unmount:Me}),[Me]);const $e=dt((ee,se)=>{o?.(ee,se),!se.isCanceled&&Q(ee)}),He=dt(ee=>{const se=Gw(ee.scrollHeight,ee.clientHeight),ce=Rm(ee.scrollTop,se),Ce=ce>0,Ne=ce<se;et.set("scrollUpArrowVisible",Ce),et.set("scrollDownArrowVisible",Ne)}),Xe=iB({open:X,onOpenChange:Ve,elements:{reference:We,floating:Oe}}),Je=Dw(Xe,{enabled:!y&&!Y,event:"mousedown"}),bt=Cg(Xe),Mt=cA(Xe,{enabled:!y&&!Y,listRef:te,activeIndex:me,selectedIndex:xe,disabledIndices:ll,onNavigate(ee){ee===null&&!X||et.set("activeIndex",ee)},focusItemOnHover:M}),kt=uA(Xe,{enabled:!y&&!Y&&(X||!R),listRef:J,activeIndex:me,selectedIndex:xe,disabledIndices:ee=>BU(te.current[ee]),onMatch(ee){X?et.set("activeIndex",ee):$e(ue.current[ee],Ot(Zc))},onTyping(ee){he.current=ee}}),nt=b.useMemo(()=>Ho(kt.reference,Mt.reference,bt.reference,Je.reference,Ye),[Je.reference,kt.reference,Mt.reference,bt.reference,Ye]),wt=b.useMemo(()=>Ho(Ng,kt.floating,Mt.floating,bt.floating),[kt.floating,Mt.floating,bt.floating]),Dt=Mt.item??Kn;UU(()=>{et.update({popupProps:wt,triggerProps:nt})}),et.useSyncedValues({id:H,modal:x,multiple:R,value:F,open:X,mounted:Qe,transitionStatus:Le,popupProps:wt,triggerProps:nt,items:j,itemToStringLabel:N,itemToStringValue:O,isItemEqualToValue:k,openMethod:at});const St=b.useMemo(()=>({store:et,floatingContext:Xe,required:v,disabled:Y,readOnly:y,multiple:R,highlightItemOnHover:M,setValue:$e,setOpen:Ve,listRef:te,popupRef:K,scrollHandlerRef:re,handleScrollArrowVisibility:He,scrollArrowsMountedCountRef:ye,itemProps:Dt,valueRef:fe,valuesRef:ue,labelsRef:J,typingRef:he,selectionRef:Ue,firstItemTextRef:Re,selectedItemTextRef:ze,validation:P,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:Ae,initialValueRef:ae}),[et,Xe,v,Y,y,R,M,$e,Ve,Dt,P,_,He]),In=al(S,P.inputRef),Qt=R?void 0:$,wn=b.useMemo(()=>!R||!Array.isArray(F)||!$?null:F.map(ee=>{const se=Rc(ee,O);return h.jsx("input",{type:"hidden",form:d,name:$,value:se,disabled:Y},se)}),[R,F,d,$,O,Y]);return h.jsxs(fA.Provider,{value:St,children:[T,h.jsx("input",{...P.getValidationProps(Y,{onFocus(){et.state.triggerElement?.focus({focusVisible:!0})},onChange(ee){if(ee.nativeEvent.defaultPrevented||Y||y)return;const se=ee.currentTarget.value,ce=Ot(Zc,ee.nativeEvent);function Ce(){if(R)return;const Ne=se.toLowerCase();let Ze=ue.current.findIndex(Ge=>Rc(Ge,O).toLowerCase()===Ne||gA(Ge,N).toLowerCase()===Ne);Ze===-1&&(Ze=ue.current.findIndex((Ge,Ke)=>{const lt=J.current[Ke];return lt!=null&<.toLowerCase()===Ne}));const Be=ue.current[Ze];Be!=null&&$e(Be,ce)}et.set("forceMount",!0),queueMicrotask(Ce)}}),id:H&&Qt==null?`${H}-hidden-input`:void 0,form:d,name:Qt,autoComplete:p,value:it,disabled:Y,required:v&&!(R&&Se),readOnly:y,ref:In,style:$?LU:tk,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),wn]})}function OB(e,t){return e??t}let Hj=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const MB={"data-starting-style":""},kB={"data-ending-style":""},Tf={transitionStatus(e){return e==="starting"?MB:e==="ending"?kB:null}};(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Hj.startingStyle]="startingStyle",e[e.endingStyle=Hj.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const AB={"data-popup-open":""},DB={"data-popup-open":"","data-pressed":""},PB={"data-open":""},IB={"data-closed":""},zB={"data-anchor-hidden":""},SA={open(e){return e?AB:null}},jm={open(e){return e?DB:null}},Mg={open(e){return e?PB:IB},anchorHidden(e){return e?zB:null}},Kw={...Mg,...Tf},wp=5;function EA(e,t){const n=LB(t);return e.clientX>=n.left-wp&&e.clientX<=n.right+wp&&e.clientY>=n.top-wp&&e.clientY<=n.bottom+wp}function LB(e){const t=e.getBoundingClientRect(),n=An(e);if(xw)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const l=parseFloat(r.width)||0,c=parseFloat(r.height)||0,f=parseFloat(o.width)||0,d=parseFloat(o.height)||0,p=Math.max(t.width,l,f),g=Math.max(t.height,c,d),y=p-t.width,v=g-t.height;return{left:t.left-y/2,right:t.right+y/2,top:t.top-v/2,bottom:t.bottom+v/2}}const $B=b.createContext(void 0);function Xw(e=!1){const t=b.useContext($B);if(t===void 0&&!e)throw new Error(Er(16));return t}function FB(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:i}=e,l=r&&t!==!1,c=r&&t===!1;return{props:b.useMemo(()=>{const d={onKeyDown(p){n&&t&&p.key!=="Tab"&&p.preventDefault()}};return r||(d.tabIndex=o,!i&&n&&(d.tabIndex=t?o:-1)),(i&&(t||l)||!i&&n)&&(d["aria-disabled"]=n),i&&(!t||c)&&(d.disabled=n),d},[r,n,t,l,c,i,o])}}function nm(e,t,{detail:n=0}={}){e.dispatchEvent(new(An(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function jl(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:i}=e,l=b.useRef(null),c=Xw(!0),f=i??c!==void 0,{props:d}=FB({focusableWhenDisabled:n,disabled:t,composite:f,tabIndex:r,isNativeButton:o}),p=b.useCallback(()=>{const v=l.current;qx(v)&&f&&t&&d.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,d.disabled,f]);tt(p,[p]);const g=b.useCallback((v={})=>{const{onClick:x,onMouseDown:E,onKeyUp:S,onKeyDown:_,onPointerDown:j,...R}=v;return Ho({onClick(N){if(t){N.preventDefault();return}x?.(N)},onMouseDown(N){t||E?.(N)},onKeyDown(N){if(t||(Sm(N),_?.(N),N.baseUIHandlerPrevented))return;const O=N.target===N.currentTarget,k=N.currentTarget,M=qx(k),T=!o&&VB(k),L=O&&(o?M:!T),G=N.key==="Enter",B=N.key===" ",V=k.getAttribute("role"),q=V?.startsWith("menuitem")||V==="option"||V==="gridcell";if(O&&f&&B){if(N.defaultPrevented&&q)return;N.preventDefault(),(!o||M)&&(N.preventBaseUIHandler(),nm(k,N));return}if(!L||o||!B&&!G){O&&T&&B&&N.preventDefault();return}N.defaultPrevented||(N.preventDefault(),G&&(N.preventBaseUIHandler(),nm(k,N)))},onKeyUp(N){if(!t){if(Sm(N),S?.(N),N.target===N.currentTarget&&o&&f&&qx(N.currentTarget)&&N.key===" "){N.preventDefault();return}N.baseUIHandlerPrevented||N.target===N.currentTarget&&!o&&!f&&!N.defaultPrevented&&N.key===" "&&(N.preventBaseUIHandler(),nm(N.currentTarget,N))}},onPointerDown(N){if(t){N.preventDefault();return}j?.(N)}},o?{type:"button"}:{role:"button"},d,R)},[t,d,f,o]),y=dt(v=>{l.current=v,p()});return{getButtonProps:g,buttonRef:y}}function qx(e){return Cn(e)&&e.tagName==="BUTTON"}function VB(e){return Cn(e)&&e.tagName==="A"&&!!e.href}const UB=400,HB={...jm,...hA,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},BB=b.forwardRef(function(t,n){const{render:r,className:o,id:i,disabled:l=!1,nativeButton:c=!0,style:f,...d}=t,{setTouched:p,setFocused:g,validationMode:y,state:v,disabled:x}=Og(),{labelId:E}=Yw(),{store:S,setOpen:_,selectionRef:j,validation:R,readOnly:N,required:O,alignItemWithTriggerActiveRef:k,disabled:M}=Hs(),T=x||M||l,L=gt(S,yt.open),G=gt(S,yt.mounted),B=gt(S,yt.value),V=gt(S,yt.triggerProps),q=gt(S,yt.positionerElement),I=gt(S,yt.listElement),z=gt(S,yt.popupSide),A=gt(S,yt.id),P=gt(S,yt.labelId),U=gt(S,yt.hasSelectedValue),H=G&&q?z:null,Y=i??A,$=OB(E,P);Zw({id:Y});const F=er(q),Q=b.useRef(null),{getButtonProps:X,buttonRef:ne}=jl({disabled:T,native:c}),te=S.useStateSetter("triggerElement"),J=Ar(),K=Ar(),re=Ar();b.useEffect(()=>{if(L)return re.start(UB,()=>{j.current.allowUnselectedMouseUp=!0,j.current.allowSelectedMouseUp=!0}),()=>{re.clear()};j.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[L,j,K,re]);const ye=Ho(V,{id:Y,role:"combobox","aria-expanded":L,"aria-haspopup":"listbox","aria-controls":L?I?.id??vm(q)?.id:void 0,"aria-labelledby":$,"aria-readonly":N||void 0,"aria-required":O||void 0,tabIndex:T?-1:0,onFocus(he){g(!0),L&&k.current&&_(!1,Ot(Zc,he.nativeEvent)),J.start(0,()=>{S.set("forceMount",!0)})},onBlur(he){mt(q,he.relatedTarget)||(p(!0),g(!1),y==="onBlur"&&R.commit(B))},onMouseDown(he){if(L)return;const Re=Zt(he.currentTarget);function ze(Ue){if(!Q.current)return;const Ae=Ue.target;mt(Q.current,Ae)||mt(F.current,Ae)||EA(Ue,Q.current)||_(!1,Ot(dk,Ue))}K.start(0,()=>{Re.addEventListener("mouseup",ze,{once:!0})})}},d,X),fe=R.getValidationProps(T,ye);fe.role="combobox";const ue={...v,open:L,disabled:T,value:B,readOnly:N,popupSide:H,placeholder:!U};return bn("button",t,{ref:[n,Q,ne,te],state:ue,stateAttributesMapping:HB,props:fe})}),qB={value:()=>null},YB=b.forwardRef(function(t,n){const{className:r,render:o,children:i,placeholder:l,style:c,...f}=t,{store:d,valueRef:p}=Hs(),g=gt(d,yt.value),y=gt(d,yt.items),v=gt(d,yt.itemToStringLabel),x=gt(d,yt.hasSelectedValue),E=!x&&l!=null&&i==null,S=gt(d,yt.hasNullItemLabel,E),_={value:g,placeholder:!x};let j=null;return typeof i=="function"?j=i(g):i!=null?j=i:E&&!S?j=l:Array.isArray(g)?j=_B(g,y,v):j=yA(g,y,v),bn("span",t,{state:_,ref:[n,p],props:[{children:j},f],stateAttributesMapping:qB})}),ZB=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...l}=t,{store:c}=Hs(),d={open:gt(c,yt.open)};return bn("span",t,{state:d,ref:n,props:[{"aria-hidden":!0,children:"▼"},l],stateAttributesMapping:SA})}),GB=b.forwardRef(function(t,n){const{store:r}=Hs(),o=gt(r,yt.mounted),i=gt(r,yt.forceMount);return o||i?h.jsx(Sg,{ref:n,...t}):null});function kg(e){return hw(19)?e:e?"true":void 0}const CA=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function KB(){return b.useContext(CA)}function _A(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,i=dt(o),[,l]=b.useState(!1),c=Dr(QB).current,f=Dr(XB).current,d=b.useRef(0),p=b.useRef(!0),g=b.useRef([]),y=b.useRef(null),v=dt(()=>{p.current||(p.current=!0,l(O=>!O))}),x=dt((O,k)=>{f.set(O,k),v()}),E=dt(O=>{f.delete(O),v()}),S=dt(O=>{const k=new Map;return n.current.length=0,r&&(r.current.length=0),O.forEach(M=>{k.set(M.element,{...M.registration.metadata??{},index:M.index}),n.current[M.index]=M.element,r&&(r.current[M.index]=M.registration.label!==void 0?M.registration.label:M.registration.textRef?.current?.textContent??M.element.textContent)}),d.current=n.current.length,k});function _(O){if(y.current?.disconnect(),y.current=null,typeof MutationObserver!="function"||O.length<2)return;const k=new MutationObserver(T=>{if(!e8(T))return;let L=null;for(const G of O)if(G.isConnected){if(L&&RA(L,G)>0){k.disconnect(),v();return}L=G}});y.current=k;const M=new Set;for(let T=1;T<O.length;T+=1){const L=JB(O[T-1],O[T]);L&&M.add(L)}M.forEach(T=>k.observe(T,{childList:!0}))}const j=dt(()=>{const[O,k]=WB(f),M=S(O);_(k),g.current=O,p.current=!1,c.forEach(T=>T(M)),i(M)});tt(()=>(p.current||S(g.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,S]),tt(()=>{p.current&&j()}),tt(()=>()=>{y.current?.disconnect(),p.current=!0},[]);const R=dt(O=>(c.add(O),()=>{c.delete(O)})),N=b.useMemo(()=>({register:x,unregister:E,subscribeMapChange:R,nextIndexRef:d}),[x,E,R,d]);return h.jsx(CA.Provider,{value:N,children:t})}function XB(){return new Map}function QB(){return new Set}function WB(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const c=i.index,f={index:c??-1,element:l,registration:i};c===null?r.push(f):c>=0&&(t.add(c),n.push(f))});let o=0;return r.sort((i,l)=>RA(i.element,l.element)),r.forEach(i=>{for(;t.has(o);)o+=1;i.index=o,n.push(i),o+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function JB(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function e8(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function RA(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const t8=b.createContext(void 0);function Qw(){return b.useContext(t8)?.direction??"ltr"}const n8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:f}=t,{element:d,padding:p=0,offsetParent:g="real"}=ya(e,t)||{};if(d==null)return{};const y=hk(p),v={x:n,y:r},x=Rw(o),E=_w(x),S=await l.getDimensions(d),_=x==="y",j=_?"top":"left",R=_?"bottom":"right",N=_?"clientHeight":"clientWidth",O=i.reference[E]+i.reference[x]-v[x]-i.floating[E],k=v[x]-i.reference[x],M=g==="real"?await l.getOffsetParent?.(d):c.floating;let T=c.floating[N]||i.floating[E];(!T||!await l.isElement?.(M))&&(T=c.floating[N]||i.floating[E]);const L=O/2-k/2,G=T/2-S[E]/2-1,B=Math.min(y[j],G),V=Math.min(y[R],G),q=B,I=T-S[E]-V,z=T/2-S[E]/2+L,A=fk(q,z,I),P=!f.arrow&&Ea(o)!=null&&z!==A&&i.reference[E]/2-(z<q?B:V)-S[E]/2<0,U=P?z<q?z-q:z-I:0;return{[x]:v[x]+U,data:{[x]:A,centerOffset:z-A-U,...P&&{alignmentOffset:U}},reset:P}}}),r8=(e,t)=>({...n8(e),options:[e,t]}),o8={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,i=t===0&&n===0&&r===0&&o===0,l=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:l.top-n>=0||l.right-t>=0||l.bottom-n>=0||l.left-t>=0||i}}}},s8={sideX:"left",sideY:"top"},Bj="--available-width",qj="--available-height";function jA(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Yj(e,t,n){const{rects:r,placement:o}=e;return{side:jA(t,Uo(o),n),align:Ea(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ww(e){return i8(e,aB)}function i8(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,collisionBoundary:f,collisionPadding:d=5,sticky:p=!1,arrowPadding:g=5,disableAnchorTracking:y=!1,inline:v,keepMounted:x=!1,floatingRootContext:E,mounted:S,collisionAvoidance:_,shift:j,nodeId:R,adaptiveOrigin:N,lazyFlip:O=!1,externalTree:k}=e,[M,T]=b.useState(null);!S&&M!==null&&T(null);const L=_.side||"flip",G=_.align||"flip",B=_.fallbackAxisSide||"end",V=j?.crossAxis??!1,q=j?.rootBoundary,I=typeof n=="function"?n:void 0,z=dt(I),A=I?z:n,P=er(n),U=er(S),Y=Qw()==="rtl",$=M||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":Y?"left":"right","inline-start":Y?"right":"left"}[o],F=l==="center"?$:`${$}-${l}`;let Q=d;typeof Q=="number"?Q={top:Q,right:Q,bottom:Q,left:Q}:Q&&(Q={top:Q.top||0,right:Q.right||0,bottom:Q.bottom||0,left:Q.left||0});const X=1,ne=o==="bottom"?X:0,te=o==="top"?X:0,J=o==="right"?X:0,K=o==="left"?X:0,re={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:Q},ye=b.useRef(null),fe=er(i),ue=er(c),he=typeof i!="function"?i:0,Re=typeof c!="function"?c:0,ze=[];v&&ze.push(v),ze.push(Q6(Je=>{const bt=Yj(Je,o,Y),Mt=typeof fe.current=="function"?fe.current(bt):fe.current,kt=typeof ue.current=="function"?ue.current(bt):ue.current;return{mainAxis:Mt,crossAxis:kt,alignmentAxis:kt}},[he,Re,Y,o]));const Ue=G==="none"&&L!=="shift",Ae=!Ue&&(p||V||L==="shift"),Qe=L==="none"?null:eB({...re,padding:{top:Q.top+X+ne,right:Q.right+X+K,bottom:Q.bottom+X+te,left:Q.left+X+J},mainAxis:!V&&L==="flip",crossAxis:G==="flip"?"alignment":!1,fallbackAxisSideDirection:B}),De=Ue?null:W6({...re,rootBoundary:q,mainAxis:G!=="none",crossAxis:Ae,limiter:p||V?void 0:J6(Je=>{if(!ye.current)return{};const{width:bt,height:Mt}=ye.current.getBoundingClientRect(),kt=Fo(Uo(Je.placement)),nt=kt==="y"?bt:Mt,wt=kt==="y"?Q.left+Q.right:Q.top+Q.bottom;return{offset:nt/2+wt/2}})},[re,p,V,q,Q,G]);L==="shift"||G==="shift"||l==="center"?ze.push(De,Qe):ze.push(Qe,De),ze.push(tB({...re,apply({elements:{floating:Je},availableWidth:bt,availableHeight:Mt,rects:kt}){if(!U.current)return;const nt=Je.style;nt.setProperty(Bj,`${bt}px`),nt.setProperty(qj,`${Mt}px`);const wt=An(Je).devicePixelRatio||1,{x:Dt,y:St,width:In,height:Qt}=kt.reference,wn=(Math.round((Dt+In)*wt)-Math.round(Dt*wt))/wt,ee=(Math.round((St+Qt)*wt)-Math.round(St*wt))/wt;nt.setProperty("--anchor-width",`${wn}px`),nt.setProperty("--anchor-height",`${ee}px`)}}),r8(Je=>({element:ye.current||Zt(Je.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(Je){const{elements:bt,middlewareData:Mt,placement:kt,rects:nt,y:wt}=Je,Dt=Uo(kt),St=Fo(Dt),In=ye.current,Qt=Mt.arrow?.x||0,wn=Mt.arrow?.y||0,ee=In?.clientWidth||0,se=In?.clientHeight||0,ce=Qt+ee/2,Ce=wn+se/2,Ne=Math.abs(Mt.shift?.y||0),Ze=nt.reference.height/2,Be=typeof i=="function"?i(Yj(Je,o,Y)):i,Ge=Ne>Be,Ke={top:`${ce}px calc(100% + ${Be}px)`,bottom:`${ce}px ${-Be}px`,left:`calc(100% + ${Be}px) ${Ce}px`,right:`${-Be}px ${Ce}px`}[Dt],lt=`${ce}px ${nt.reference.y+Ze-wt}px`;return bt.floating.style.setProperty("--transform-origin",Ae&&St==="y"&&Ge?lt:Ke),{}}},o8,N),tt(()=>{!S&&E&&E.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[S,E]);const Le=b.useMemo(()=>({elementResize:!y&&typeof ResizeObserver<"u",layoutShift:!y&&typeof IntersectionObserver<"u"}),[y]),{refs:Fe,elements:Ye,x:et,y:me,middlewareData:xe,update:We,placement:Oe,context:Ie,isPositioned:at,floatingStyles:it}=t({rootContext:E,open:x?S:void 0,placement:F,middleware:ze,strategy:r,whileElementsMounted:x?void 0:(...Je)=>Lj(...Je,Le),nodeId:R,externalTree:k}),{sideX:$t,sideY:W}=xe.adaptiveOrigin||s8,ie=at?r:"fixed",ae=b.useMemo(()=>{let Je;return at?N?Je={position:ie,[$t]:et,[W]:me}:Je={...it,position:ie}:Je={position:ie,top:0,left:0},Je[Bj]="100vw",Je[qj]="100vh",at||(Je.opacity=0),Je},[N,ie,$t,et,W,me,it,at]),Se=b.useRef(null);tt(()=>{if(!S)return;const Je=P.current,bt=typeof Je=="function"?Je():Je,kt=(Zj(bt)?bt.current:bt)||null||null;kt!==Se.current&&(Fe.setPositionReference(kt),Se.current=kt)},[S,Fe,A,P]),b.useEffect(()=>{if(!S)return;const Je=P.current;typeof Je!="function"&&Zj(Je)&&Je.current!==Se.current&&(Fe.setPositionReference(Je.current),Se.current=Je.current)},[S,Fe,A,P]),b.useEffect(()=>{if(x&&S&&Ye.reference&&Ye.floating)return Lj(Ye.reference,Ye.floating,We,Le)},[x,S,Ye,We,Le]);const be=Uo(Oe),Ve=jA(o,be,Y),Me=Ea(Oe)||"center",$e=!!xe.hide?.referenceHidden;tt(()=>{O&&S&&at&&be!==$&&T(be)},[O,S,at,be,$]);const He=b.useMemo(()=>({position:"absolute",top:xe.arrow?.y,left:xe.arrow?.x}),[xe.arrow]),Xe=xe.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ae,arrowStyles:He,arrowRef:ye,arrowUncentered:Xe,side:Ve,align:Me,physicalSide:be,anchorHidden:$e,refs:Fe,context:Ie,isPositioned:at,update:We}),[ae,He,ye,Xe,Ve,Me,be,$e,Fe,Ie,at,We])}function Zj(e){return e!=null&&"current"in e}const NA=b.createContext(void 0);function Jw(){const e=b.useContext(NA);if(!e)throw new Error(Er(59));return e}const Ag=b.forwardRef(function(t,n){const{cutout:r,...o}=t;let i;if(r){const l=r.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${l.left}px ${l.top}px,${l.left}px ${l.bottom}px,${l.right}px ${l.bottom}px,${l.right}px ${l.top}px,${l.left}px ${l.top}px)`}return h.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:i}})});function Nm(e,t){e&&Object.assign(e.style,t)}const TA={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function Dg(e){return e==="starting"?u6:Kn}function eS(e,t,{styles:n,transitionStatus:r,props:o,refs:i,hidden:l,inert:c=!1}){const f={...n};return c&&(f.pointerEvents="none"),bn("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:l,style:f},Dg(r),o],stateAttributesMapping:Mg})}let Gj={},Kj={},Xj="";function Pg(e,t){return Rf(e)?e:t}function Qj(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Pg(t,n)).overflowY)}function a8(e){if(typeof document>"u")return!1;const t=Zt(e);return An(t).innerWidth-t.documentElement.clientWidth>0}function l8(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Zt(e),r=n.documentElement,o=n.body,i=Pg(r,o),l=i.style.overflowY,c=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",i.style.overflowY="scroll";const f=i.offsetWidth;i.style.overflowY="hidden";const d=i.offsetWidth;return i.style.overflowY=l,r.style.scrollbarGutter=c,f===d}function c8(e){const t=Zt(e),n=t.documentElement,r=t.body,o=Pg(n,r),i={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,i)}}function u8(e){const t=Zt(e),n=t.documentElement,r=t.body,o=An(n);let i=0,l=0,c=!1;const f=Ms.create();if(_i&&(o.visualViewport?.scale??1)!==1)return()=>{};function d(){const v=o.getComputedStyle(n),x=o.getComputedStyle(r),_=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=n.scrollTop,l=n.scrollLeft,Gj={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Xj=n.style.scrollBehavior,Kj={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const j=n.scrollHeight>n.clientHeight,R=n.scrollWidth>n.clientWidth,N=v.overflowY==="scroll"||x.overflowY==="scroll",O=v.overflowX==="scroll"||x.overflowX==="scroll",k=Math.max(0,o.innerWidth-r.clientWidth),M=Math.max(0,o.innerHeight-r.clientHeight),T=parseFloat(x.marginTop)+parseFloat(x.marginBottom),L=parseFloat(x.marginLeft)+parseFloat(x.marginRight),G=Pg(n,r);if(c=l8(e),c){n.style.scrollbarGutter=_,G.style.overflowY="hidden",G.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:_,overflowY:"hidden",overflowX:"hidden"}),(j||N)&&(n.style.overflowY="scroll"),(R||O)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:T||M?`calc(100dvh - ${T+M}px)`:"100dvh",width:L||k?`calc(100vw - ${L+k}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=i,r.scrollLeft=l,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function p(){Object.assign(n.style,Gj),Object.assign(r.style,Kj),c||(n.scrollTop=i,n.scrollLeft=l,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Xj)}function g(){p(),f.request(d)}d();const y=zt(o,"resize",g);return()=>{f.cancel(),p(),typeof o.removeEventListener=="function"&&y()}}class d8{lockCount=0;restore=null;timeoutLock=is.create();timeoutUnlock=is.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=Zt(t),r=n.documentElement,o=n.body,i=An(r);if(Qj(i,r,o)){const c=new i.MutationObserver(()=>{Qj(i,r,o)||(c.disconnect(),this.restore=null,this.lock(t))}),f={attributes:!0};c.observe(r,f),c.observe(o,f),this.restore=()=>c.disconnect();return}const l=mg||!a8(t);this.restore=l?c8(t):u8(t)}}const f8=new d8;function OA(e=!0,t=null){tt(()=>{if(e)return f8.acquire(t)},[e,t])}const h8=20;function tS(e,t,n,r){const[o,i]=b.useState(!1);tt(()=>{if(!e||!t||n==null){i(!1);return}const l=Zt(n).documentElement.clientWidth,c=n.offsetWidth;i(l>0&&c>0&&c>=l-h8)},[e,t,n]),OA(e&&(!t||o),r)}const p8={position:"fixed"},m8=b.forwardRef(function(t,n){const{anchor:r,className:o,render:i,positionMethod:l,side:c,align:f,sideOffset:d,alignOffset:p,collisionBoundary:g="clipping-ancestors",collisionPadding:y,arrowPadding:v,sticky:x,disableAnchorTracking:E,alignItemWithTrigger:S=!0,collisionAvoidance:_=Ak,style:j,...R}=t,{store:N,listRef:O,labelsRef:k,alignItemWithTriggerActiveRef:M,selectedItemTextRef:T,valuesRef:L,initialValueRef:G,popupRef:B,setValue:V,floatingContext:q}=Hs(),I=gt(N,yt.open),z=gt(N,yt.mounted),A=gt(N,yt.modal),P=gt(N,yt.value),U=gt(N,yt.openMethod),H=gt(N,yt.positionerElement),Y=gt(N,yt.triggerElement),$=gt(N,yt.isItemEqualToValue),F=gt(N,yt.transitionStatus),Q=b.useRef(null),X=b.useRef(null),[ne,te]=b.useState(S),J=z&&ne&&U!=="touch";!z&&ne!==S&&te(S),b.useImperativeHandle(M,()=>J),tS((J||A)&&I,U==="touch",H,Y);const K=Ww({anchor:r,floatingRootContext:q,positionMethod:l,mounted:z,side:c,sideOffset:d,align:f,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:y,sticky:x,disableAnchorTracking:E??J,collisionAvoidance:_,keepMounted:!0}),re=J?"none":K.side,ye=J?p8:K.positionerStyles,fe={open:I,side:re,align:K.align,anchorHidden:K.anchorHidden};tt(()=>{N.set("popupSide",K.side)},[N,K.side]);const ue=N.useStateSetter("positionerElement"),he=eS(t,fe,{styles:ye,transitionStatus:F,props:R,refs:[n,ue],hidden:!z,inert:!I}),Re=b.useRef(0),ze=dt(Ae=>{if(L.current.length===0)return;const Qe=Re.current;if(Re.current=Ae.size,Ae.size===Qe)return;const De=Ot(Zc);if(Qe!==0&&!N.state.multiple&&P!==null&&tm(L.current,P,$)===-1){const Fe=G.current,et=Fe!=null&&tm(L.current,Fe,$)!==-1?Fe:null;V(et,De),et===null&&(N.set("selectedIndex",null),T.current=null)}if(Qe!==0&&N.state.multiple&&Array.isArray(P)){const Le=P.filter(Fe=>tm(L.current,Fe,$)!==-1);Le.length!==P.length&&(V(Le,De),Le.length===0&&(N.set("selectedIndex",null),T.current=null))}if(I&&J){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Le={height:""};Nm(H,Le),Nm(B.current,Le)}}),Ue=b.useMemo(()=>({...K,side:re,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:te,scrollUpArrowRef:Q,scrollDownArrowRef:X}),[K,re,J,te]);return h.jsx(_A,{elementsRef:O,labelsRef:k,onMapChange:ze,children:h.jsxs(NA.Provider,{value:Ue,children:[z&&A&&h.jsx(Ag,{inert:kg(!I),cutout:Y}),he]})})}),Sp="base-ui-disable-scrollbar",Yb={className:Sp,getElement(e){return h.jsx("style",{nonce:e,href:Sp,precedence:"base-ui:low",children:`.${Sp}{scrollbar-width:none}.${Sp}::-webkit-scrollbar{display:none}`})}},g8=b.createContext(void 0);function nS(e){return b.useContext(g8)}const y8="ArrowUp",v8="ArrowDown",x8="ArrowLeft",b8="ArrowRight",w8="Home",S8="End",Ig=new Set([y8,v8,x8,b8,w8,S8]),E8=b.createContext(void 0),C8={disableStyleElements:!1};function _8(){return b.useContext(E8)??C8}const R8={...Mg,...Tf},j8=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:l,...c}=t,{store:f,popupRef:d,onOpenChangeComplete:p,setOpen:g,valueRef:y,firstItemTextRef:v,selectedItemTextRef:x,multiple:E,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:j,highlightItemOnHover:R,floatingContext:N}=Hs(),{side:O,align:k,alignItemWithTriggerActive:M,isPositioned:T,setControlledAlignItemWithTrigger:L}=Jw(),G=nS()!=null,B=Qw(),{nonce:V,disableStyleElements:q}=_8(),I=gt(f,yt.id),z=gt(f,yt.open),A=gt(f,yt.openMethod),P=gt(f,yt.mounted),U=gt(f,yt.popupProps),H=gt(f,yt.transitionStatus),Y=gt(f,yt.triggerElement),$=gt(f,yt.positionerElement),F=gt(f,yt.listElement),Q=b.useRef(!1),X=b.useRef(!1),ne=b.useRef({}),te=Yc(),J=dt(fe=>{if(!$||!d.current||!X.current)return;const ue=$.style.top==="0px",he=$.style.bottom==="0px";if(Q.current||!M||!ue&&!he){S(fe);return}const Re=Jj($),ze=Ad($.getBoundingClientRect().height,"y",Re),Ue=Zt($),Ae=An($),Qe=Ae.getComputedStyle($),De=parseFloat(Qe.marginTop),Le=parseFloat(Qe.marginBottom),Fe=Wj(Ae.getComputedStyle(d.current)),Ye=Math.min(Ue.documentElement.clientHeight-De-Le,Fe),et=fe.scrollTop,me=Ep(fe);let xe=null;const We=it=>{$.style.height=`${it}px`},Oe=ue?me-et:et,Ie=Math.min(ze+Oe,Ye);if(Oe<=es){const it=kd(Oe,0,Ye-ze);it>0&&We(ze+it),fe.scrollTop=ue?me:0,Ye-(ze+it)<=es&&(Q.current=!0),S(fe);return}if(Ye-Ie>es)xe=ue?1/0:0;else if(he&&et<me){const it=ze+Oe-Ye;xe=et-(Oe-it)}const at=Math.ceil(Ie);if(at!==0&&We(at),xe!=null){const it=kd(xe,0,Ep(fe));Math.abs(fe.scrollTop-it)>es&&(fe.scrollTop=it)}at>=Ye-es&&(Q.current=!0),S(fe)});b.useImperativeHandle(_,()=>J,[J]),Ra({open:z,ref:d,onComplete(){z&&p?.(!0)}});const K={open:z,transitionStatus:H,side:O,align:k};tt(()=>{!$||!d.current||Object.keys(ne.current).length||(ne.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[d,$]),tt(()=>{z||M||(X.current=!1,Q.current=!1,Nm($,ne.current))},[z,M,$,d]),tt(()=>{const fe=d.current;if(!z||!Y||!$||!fe||M&&!T||f.state.transitionStatus==="ending")return;if(X.current=!0,fe.style.removeProperty("--transform-origin"),!M){te.request(()=>S(F||fe));return}const ue=N8(fe);try{let he=x.current;he?.isConnected||(he=!yt.hasSelectedValue(f.state)&&v.current?.isConnected?v.current:null);const Re=y.current,ze=An($),Ue=ze.getComputedStyle($),Ae=ze.getComputedStyle(fe),Qe=Zt(Y),De=Jj(Y),Le=Cp(Y.getBoundingClientRect(),De),Fe=Cp($.getBoundingClientRect(),De),Ye=Le.height,et=F||fe,me=et.scrollHeight,xe=parseFloat(Ae.borderBottomWidth),We=parseFloat(Ue.marginTop)||10,Oe=parseFloat(Ue.marginBottom)||10,Ie=parseFloat(Ue.minHeight)||100,at=Wj(Ae),it=5,$t=5,W=20,ie=Qe.documentElement.clientHeight-We-Oe,ae=Qe.documentElement.clientWidth,Se=ie-Le.bottom+Ye;let be,Ve=B==="rtl"?Le.right-Fe.width:Le.left,Me=0;if(he&&Re){const St=Cp(Re.getBoundingClientRect(),De);be=Cp(he.getBoundingClientRect(),De),Ve=Fe.left+(B==="rtl"?St.right-be.right:St.left-be.left);const In=St.top-Le.top+St.height/2;Me=be.top-Fe.top+be.height/2-In}const $e=Se+Me+Oe+xe;let He=Math.min(ie,$e);const Xe=ie-We-Oe,Je=$e-He,bt=ae-$t;$.style.left=`${kd(Ve,it,bt-Fe.width)}px`,$.style.height=`${He}px`,$.style.maxHeight="none",$.style.marginTop=`${We}px`,$.style.marginBottom=`${Oe}px`,fe.style.height="100%";const Mt=Ep(et),kt=Je>=Mt-es;kt&&(He=Math.min(ie,Fe.height)-(Je-Mt));const nt=Le.top<W||Le.bottom>ie-W||Math.ceil(He)+es<Math.min(me,Ie),wt=(ze.visualViewport?.scale??1)!==1&&_i;if(nt||wt){Nm($,ne.current),L(!1);return}const Dt=Math.max(Ie,He);if(kt){const St=Math.max(0,ie-$e);$.style.top=Fe.height>=Xe?"0":`${St}px`,$.style.height=`${He}px`,et.scrollTop=Ep(et)}else $.style.bottom="0",et.scrollTop=Je;if(be){const St=Fe.top,In=Fe.height,Qt=be.top+be.height/2,wn=kd(In>0?(Qt-St)/In*100:50,0,100);fe.style.setProperty("--transform-origin",`50% ${wn}%`)}(Dt===ie||He>=at)&&(Q.current=!0),S(et),R&&f.state.selectedIndex===null&&f.state.activeIndex===null&&j.current[0]!=null&&f.set("activeIndex",0)}finally{ue()}},[f,z,$,Y,y,v,x,d,S,M,L,te,F,j,R,B,T]),b.useEffect(()=>{if(!M||!$||!z)return;const fe=An($);function ue(he){g(!1,Ot(OH,he))}return zt(fe,"resize",ue)},[g,M,$,z]);const re={...F?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":E||void 0,id:`${I}-list`},onKeyDown(fe){G&&Ig.has(fe.key)&&fe.stopPropagation()},onScroll(fe){F||J(fe.currentTarget)},...M&&{style:F?{height:"100%"}:TA},className:!F&&M?Yb.className:void 0},ye=bn("div",t,{ref:[n,d],state:K,stateAttributesMapping:R8,props:[U,re,Dg(H),c]});return h.jsxs(b.Fragment,{children:[!q&&Yb.getElement(V),h.jsx(Eg,{context:N,modal:!1,disabled:!P,openInteractionType:A,returnFocus:l,restoreFocus:!0,children:ye})]})});function Wj(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Ep(e){return Gw(e.scrollHeight,e.clientHeight)}function Jj(e){return Zk.getScale(e)}function Ad(e,t,n){return e/n[t]}function Cp(e,t){return Wd({x:Ad(e.x,"x",t),y:Ad(e.y,"y",t),width:Ad(e.width,"x",t),height:Ad(e.height,"y",t)})}const eN=[["transform","none"],["scale","1"],["translate","0 0"]];function N8(e){const{style:t}=e,n={};for(const[r,o]of eN)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of eN){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const T8=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...l}=t,{store:c,scrollHandlerRef:f,multiple:d}=Hs(),{alignItemWithTriggerActive:p}=Jw(),g=gt(c,yt.hasScrollArrows),y=gt(c,yt.openMethod),x={id:`${gt(c,yt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(S){f.current?.(S.currentTarget)},...p&&{style:TA},className:g&&y!=="touch"?Yb.className:void 0},E=c.useStateSetter("listElement");return bn("div",t,{ref:[n,E],props:[x,l]})});function rS(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:i}=e,{register:l,unregister:c,subscribeMapChange:f,nextIndexRef:d}=KB(),p=b.useRef(-1),[g,y]=b.useState(i==null&&t?()=>{if(p.current===-1){const S=d.current;d.current+=1,p.current=S}return p.current}:-1),v=i??g,x=b.useRef(null),E=b.useCallback(S=>{const _=x.current;_&&c(_),x.current=S,S&&l(S,{metadata:r??null,index:i??null,label:n,textRef:o})},[i,l,c,r,n,o]);return tt(()=>{if(i==null)return f(S=>{const _=x.current?S.get(x.current)?.index:null;_!=null&&y(_)})},[i,f]),{ref:E,index:v}}const MA=b.createContext(void 0);function oS(){const e=b.useContext(MA);if(!e)throw new Error(Er(57));return e}const O8=b.memo(b.forwardRef(function(t,n){const{render:r,className:o,style:i,value:l=null,label:c,disabled:f=!1,nativeButton:d=!1,...p}=t,g=b.useRef(null),y=rS({guess:!0,label:c,textRef:g}),{store:v,itemProps:x,setOpen:E,setValue:S,selectionRef:_,typingRef:j,valuesRef:R,multiple:N,selectedItemTextRef:O,disabled:k,readOnly:M}=Hs(),T=k||f,L=gt(v,yt.isActive,y.index),G=gt(v,yt.open),B=gt(v,yt.isSelected,l),V=gt(v,yt.isSelectedByFocus,y.index),q=gt(v,yt.isItemEqualToValue),I=y.index,z=b.useRef(null);tt(()=>{const te=R.current;return te[I]=l,()=>{delete te[I]}},[I,l,R]),tt(()=>{const te=v.state.value;let J=te;N&&Array.isArray(te)&&(J=te.length>0?te[te.length-1]:void 0),J!==void 0&&Kc(l,J,q)&&(v.set("selectedIndex",I),g.current&&(O.current=g.current))},[I,N,q,v,l,O]);const A=b.useRef("mouse"),P=b.useRef(!1),{getButtonProps:U,buttonRef:H}=jl({disabled:T,focusableWhenDisabled:!0,native:d,composite:!0}),Y={disabled:T,selected:B,highlighted:L};function $(te){if(k||M)return;const J=v.state.value;if(N){const K=Array.isArray(J)?J:[],re=B?EB(K,l,q):[...K,l];S(re,Ot(Fd,te))}else S(l,Ot(Fd,te)),E(!1,Ot(Fd,te))}function F(){_.current.dragY=0}const Q={role:"option","aria-selected":B,tabIndex:G&&L?0:-1,onKeyDown(te){v.set("activeIndex",I),te.key===" "&&j.current&&te.preventDefault()},onClick(te){const J=A.current!=="touch",K=te.nativeEvent.pointerType,re=J&&bw(te.nativeEvent)&&(K!==void 0||L),ye=J&&!re&&!P.current;P.current=!1,!(T||ye)&&$(te.nativeEvent)},onPointerEnter(te){A.current=te.pointerType},onPointerMove(te){if(te.pointerType==="mouse"&&te.buttons===1){const J=_.current;J.dragY+=te.movementY,J.dragY**2>=64&&(J.allowUnselectedMouseUp=!0)}},onPointerDown(te){A.current=te.pointerType,P.current=!0,F()},onMouseUp(){if(F(),T||A.current==="touch"||P.current)return;const te=!_.current.allowSelectedMouseUp&&B,J=!_.current.allowUnselectedMouseUp&&!B;te||J||(P.current=!0,z.current?.click(),P.current=!1)}},X=bn("div",t,{ref:[H,n,y.ref,z],state:Y,props:[x,Q,p,U]}),ne=b.useMemo(()=>({selected:B,index:I,textRef:g,selectedByFocus:V}),[B,I,g,V]);return h.jsx(MA.Provider,{value:ne,children:X})})),M8=b.forwardRef(function(t,n){const{selected:r}=oS();return t.keepMounted||r?h.jsx(k8,{...t,ref:n}):null}),k8=b.memo(b.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:i,...l}=e,{selected:c}=oS(),f=b.useRef(null),{transitionStatus:d,setMounted:p}=jg(c),y=bn("span",e,{ref:[t,f],state:{selected:c,transitionStatus:d},props:[{"aria-hidden":!0,children:"✔️"},l],stateAttributesMapping:Tf});return Ra({open:c,ref:f,onComplete(){c||p(!1)}}),y})),A8=b.memo(b.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:i}=oS(),{firstItemTextRef:l,selectedItemTextRef:c}=Hs(),{render:f,className:d,style:p,...g}=t,y=b.useCallback(x=>{x&&(r===0&&(l.current=x),i&&(c.current=x))},[l,c,r,i]);return bn("div",t,{ref:[y,n,o],props:g})})),kA=b.forwardRef(function(t,n){const{render:r,className:o,style:i,direction:l,keepMounted:c,...f}=t,d=l==="up",{store:p,popupRef:g,listRef:y,handleScrollArrowVisibility:v,scrollArrowsMountedCountRef:x}=Hs(),{side:E,scrollDownArrowRef:S,scrollUpArrowRef:_}=Jw(),j=d?yt.scrollUpArrowVisible:yt.scrollDownArrowVisible,R=gt(p,j),N=gt(p,yt.openMethod),O=R&&N!=="touch",k=Ar(),M=d?_:S,{mounted:T,transitionStatus:L,setMounted:G}=jg(O);tt(()=>(x.current+=1,p.set("hasScrollArrows",!0),()=>{x.current=Math.max(0,x.current-1),x.current===0&&p.set("hasScrollArrows",!1)}),[p,x]),Ra({open:O,ref:M,onComplete(){O||G(!1)}});const q=bn("div",t,{ref:[n,M],state:{direction:l,visible:O,side:E,transitionStatus:L},props:[{"aria-hidden":!0,children:d?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||k.isStarted())return;p.set("activeIndex",null);function A(){const P=p.state.listElement??g.current;if(!P)return;p.set("activeIndex",null),v(P);const U=Gw(P.scrollHeight,P.clientHeight),H=Rm(P.scrollTop,U),Y=H===(d?0:U),$=y.current;if(H!==P.scrollTop&&(P.scrollTop=H),Y){k.clear();return}if($.length>0){const F=M.current?.offsetHeight||0;P.scrollTop=D8($,d,H,P.clientHeight,F,U)}k.start(40,A)}k.start(40,A)},onMouseLeave(){k.clear()}},f],stateAttributesMapping:Tf});return T||c?q:null});function D8(e,t,n,r,o,i){if(t){let p=0;const g=n+o-es;for(let x=0;x<e.length;x+=1){const E=e[x];if(E&&E.offsetTop>=g){p=x;break}}const y=Math.max(0,p-1),v=e[y];return y<p&&v?Rm(v.offsetTop-o,i):0}let l=e.length-1;const c=n+r-o+es;for(let p=0;p<e.length;p+=1){const g=e[p];if(g&&g.offsetTop+g.offsetHeight>c){l=Math.max(0,p-1);break}}const f=Math.min(e.length-1,l+1),d=e[f];return f>l&&d?Rm(d.offsetTop+d.offsetHeight-r+o,i):i}const P8=b.forwardRef(function(t,n){return h.jsx(kA,{...t,ref:n,direction:"down"})}),I8=b.forwardRef(function(t,n){return h.jsx(kA,{...t,ref:n,direction:"up"})});function AA(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=AA(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function DA(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=AA(e))&&(r&&(r+=" "),r+=t);return r}const z8=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},L8=(e,t)=>({classGroupId:e,validator:t}),PA=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Tm="-",tN=[],$8="arbitrary..",F8=e=>{const t=U8(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return V8(l);const c=l.split(Tm),f=c[0]===""&&c.length>1?1:0;return IA(c,f,t)},getConflictingClassGroupIds:(l,c)=>{if(c){const f=r[l],d=n[l];return f?d?z8(d,f):f:d||tN}return n[l]||tN}}},IA=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const d=IA(e,t+1,i);if(d)return d}const l=n.validators;if(l===null)return;const c=t===0?e.join(Tm):e.slice(t).join(Tm),f=l.length;for(let d=0;d<f;d++){const p=l[d];if(p.validator(c))return p.classGroupId}},V8=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?$8+r:void 0})(),U8=e=>{const{theme:t,classGroups:n}=e;return H8(n,t)},H8=(e,t)=>{const n=PA();for(const r in e){const o=e[r];sS(o,n,r,t)}return n},sS=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const l=e[i];B8(l,t,n,r)}},B8=(e,t,n,r)=>{if(typeof e=="string"){q8(e,t,n);return}if(typeof e=="function"){Y8(e,t,n,r);return}Z8(e,t,n,r)},q8=(e,t,n)=>{const r=e===""?t:zA(t,e);r.classGroupId=n},Y8=(e,t,n,r)=>{if(G8(e)){sS(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(L8(n,e))},Z8=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let l=0;l<i;l++){const[c,f]=o[l];sS(f,zA(t,c),n,r)}},zA=(e,t)=>{let n=e;const r=t.split(Tm),o=r.length;for(let i=0;i<o;i++){const l=r[i];let c=n.nextPart.get(l);c||(c=PA(),n.nextPart.set(l,c)),n=c}return n},G8=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,K8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(i,l)=>{n[i]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return o(i,l),l},set(i,l){i in n?n[i]=l:o(i,l)}}},Zb="!",nN=":",X8=[],rN=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Q8=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let l=0,c=0,f=0,d;const p=o.length;for(let E=0;E<p;E++){const S=o[E];if(l===0&&c===0){if(S===nN){i.push(o.slice(f,E)),f=E+1;continue}if(S==="/"){d=E;continue}}S==="["?l++:S==="]"?l--:S==="("?c++:S===")"&&c--}const g=i.length===0?o:o.slice(f);let y=g,v=!1;g.endsWith(Zb)?(y=g.slice(0,-1),v=!0):g.startsWith(Zb)&&(y=g.slice(1),v=!0);const x=d&&d>f?d-f:void 0;return rN(i,v,y,x)};if(t){const o=t+nN,i=r;r=l=>l.startsWith(o)?i(l.slice(o.length)):rN(X8,!1,l,void 0,!0)}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},W8=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let i=0;i<n.length;i++){const l=n[i],c=l[0]==="[",f=t.has(l);c||f?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(l)):o.push(l)}return o.length>0&&(o.sort(),r.push(...o)),r}},J8=e=>({cache:K8(e.cacheSize),parseClassName:Q8(e),sortModifiers:W8(e),postfixLookupClassGroupIds:e9(e),...F8(e)}),e9=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},t9=/\s+/,n9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i,postfixLookupClassGroupIds:l}=t,c=[],f=e.trim().split(t9);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:y,modifiers:v,hasImportantModifier:x,baseClassName:E,maybePostfixModifierPosition:S}=n(g);if(y){d=g+(d.length>0?" "+d:d);continue}let _=!!S,j;if(_){const M=E.substring(0,S);j=r(M);const T=j&&l[j]?r(E):void 0;T&&T!==j&&(j=T,_=!1)}else j=r(E);if(!j){if(!_){d=g+(d.length>0?" "+d:d);continue}if(j=r(E),!j){d=g+(d.length>0?" "+d:d);continue}_=!1}const R=v.length===0?"":v.length===1?v[0]:i(v).join(":"),N=x?R+Zb:R,O=N+j;if(c.indexOf(O)>-1)continue;c.push(O);const k=o(j,_);for(let M=0;M<k.length;++M){const T=k[M];c.push(N+T)}d=g+(d.length>0?" "+d:d)}return d},r9=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=LA(n))&&(o&&(o+=" "),o+=r);return o},LA=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=LA(e[r]))&&(n&&(n+=" "),n+=t);return n},o9=(e,...t)=>{let n,r,o,i;const l=f=>{const d=t.reduce((p,g)=>g(p),e());return n=J8(d),r=n.cache.get,o=n.cache.set,i=c,c(f)},c=f=>{const d=r(f);if(d)return d;const p=n9(f,n);return o(f,p),p};return i=l,(...f)=>i(r9(...f))},s9=[],dr=e=>{const t=n=>n[e]||s9;return t.isThemeGetter=!0,t},$A=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,FA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,i9=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,a9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,c9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,u9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,d9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ta=e=>i9.test(e),It=e=>!!e&&!Number.isNaN(Number(e)),Rs=e=>!!e&&Number.isInteger(Number(e)),Yx=e=>e.endsWith("%")&&It(e.slice(0,-1)),ui=e=>a9.test(e),VA=()=>!0,f9=e=>l9.test(e)&&!c9.test(e),iS=()=>!1,h9=e=>u9.test(e),p9=e=>d9.test(e),m9=e=>!rt(e)&&!ot(e),g9=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),y9=e=>ja(e,BA,iS),rt=e=>$A.test(e),Ka=e=>ja(e,qA,f9),oN=e=>ja(e,_9,It),v9=e=>ja(e,ZA,VA),x9=e=>ja(e,YA,iS),sN=e=>ja(e,UA,iS),b9=e=>ja(e,HA,p9),_p=e=>ja(e,GA,h9),ot=e=>FA.test(e),xd=e=>Nl(e,qA),w9=e=>Nl(e,YA),iN=e=>Nl(e,UA),S9=e=>Nl(e,BA),E9=e=>Nl(e,HA),Rp=e=>Nl(e,GA,!0),C9=e=>Nl(e,ZA,!0),ja=(e,t,n)=>{const r=$A.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Nl=(e,t,n=!1)=>{const r=FA.exec(e);return r?r[1]?t(r[1]):n:!1},UA=e=>e==="position"||e==="percentage",HA=e=>e==="image"||e==="url",BA=e=>e==="length"||e==="size"||e==="bg-size",qA=e=>e==="length",_9=e=>e==="number",YA=e=>e==="family-name",ZA=e=>e==="number"||e==="weight",GA=e=>e==="shadow",R9=()=>{const e=dr("color"),t=dr("font"),n=dr("text"),r=dr("font-weight"),o=dr("tracking"),i=dr("leading"),l=dr("breakpoint"),c=dr("container"),f=dr("spacing"),d=dr("radius"),p=dr("shadow"),g=dr("inset-shadow"),y=dr("text-shadow"),v=dr("drop-shadow"),x=dr("blur"),E=dr("perspective"),S=dr("aspect"),_=dr("ease"),j=dr("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...N(),ot,rt],k=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],T=()=>[ot,rt,f],L=()=>[ta,"full","auto",...T()],G=()=>[Rs,"none","subgrid",ot,rt],B=()=>["auto",{span:["full",Rs,ot,rt]},Rs,ot,rt],V=()=>[Rs,"auto",ot,rt],q=()=>["auto","min","max","fr",ot,rt],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...T()],P=()=>[ta,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],U=()=>[ta,"screen","full","dvw","lvw","svw","min","max","fit",...T()],H=()=>[ta,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],Y=()=>[e,ot,rt],$=()=>[...N(),iN,sN,{position:[ot,rt]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",S9,y9,{size:[ot,rt]}],X=()=>[Yx,xd,Ka],ne=()=>["","none","full",d,ot,rt],te=()=>["",It,xd,Ka],J=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[It,Yx,iN,sN],ye=()=>["","none",x,ot,rt],fe=()=>["none",It,ot,rt],ue=()=>["none",It,ot,rt],he=()=>[It,ot,rt],Re=()=>[ta,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ui],breakpoint:[ui],color:[VA],container:[ui],"drop-shadow":[ui],ease:["in","out","in-out"],font:[m9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ui],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ui],shadow:[ui],spacing:["px",It],text:[ui],"text-shadow":[ui],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ta,rt,ot,S]}],container:["container"],"container-type":[{"@container":["","normal","size",ot,rt]}],"container-named":[g9],columns:[{columns:[It,rt,ot,c]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Rs,"auto",ot,rt]}],basis:[{basis:[ta,"full","auto",c,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[It,ta,"auto","initial","none",rt]}],grow:[{grow:["",It,ot,rt]}],shrink:[{shrink:["",It,ot,rt]}],order:[{order:[Rs,"first","last","none",ot,rt]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[c,"screen",...P()]}],"min-w":[{"min-w":[c,"screen","none",...P()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",n,xd,Ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,C9,v9]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yx,rt]}],"font-family":[{font:[w9,x9,t]}],"font-features":[{"font-features":[rt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ot,rt]}],"line-clamp":[{"line-clamp":[It,"none",ot,oN]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",ot,rt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ot,rt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[It,"from-font","auto",ot,Ka]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[It,"auto",ot,rt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[Rs,ot,rt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ot,rt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ot,rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rs,ot,rt],radial:["",ot,rt],conic:[Rs,ot,rt]},E9,b9]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[It,ot,rt]}],"outline-w":[{outline:["",It,xd,Ka]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",p,Rp,_p]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",g,Rp,_p]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[It,Ka]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",y,Rp,_p]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[It,ot,rt]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[It]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[ot,rt]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[It]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ot,rt]}],filter:[{filter:["","none",ot,rt]}],blur:[{blur:ye()}],brightness:[{brightness:[It,ot,rt]}],contrast:[{contrast:[It,ot,rt]}],"drop-shadow":[{"drop-shadow":["","none",v,Rp,_p]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",It,ot,rt]}],"hue-rotate":[{"hue-rotate":[It,ot,rt]}],invert:[{invert:["",It,ot,rt]}],saturate:[{saturate:[It,ot,rt]}],sepia:[{sepia:["",It,ot,rt]}],"backdrop-filter":[{"backdrop-filter":["","none",ot,rt]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[It,ot,rt]}],"backdrop-contrast":[{"backdrop-contrast":[It,ot,rt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",It,ot,rt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[It,ot,rt]}],"backdrop-invert":[{"backdrop-invert":["",It,ot,rt]}],"backdrop-opacity":[{"backdrop-opacity":[It,ot,rt]}],"backdrop-saturate":[{"backdrop-saturate":[It,ot,rt]}],"backdrop-sepia":[{"backdrop-sepia":["",It,ot,rt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ot,rt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[It,"initial",ot,rt]}],ease:[{ease:["linear","initial",_,ot,rt]}],delay:[{delay:[It,ot,rt]}],animate:[{animate:["none",j,ot,rt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,ot,rt]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ot,rt,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],zoom:[{zoom:[Rs,ot,rt]}],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ot,rt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Y()}],"scrollbar-track-color":[{"scrollbar-track":Y()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ot,rt]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[It,xd,Ka,oN]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},j9=o9(R9);function Nt(...e){return j9(DA(e))}const br=TB;function Xc({className:e,...t}){return h.jsx(YB,{"data-slot":"select-value",className:Nt("flex flex-1 text-left",e),...t})}function wr({className:e,size:t="default",children:n,...r}){return h.jsxs(BB,{"data-slot":"select-trigger","data-size":t,className:Nt("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,h.jsx(ZB,{render:h.jsx(KM,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Sr({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:i=0,alignItemWithTrigger:l=!0,...c}){return h.jsx(GB,{children:h.jsx(m8,{side:n,sideOffset:r,align:o,alignOffset:i,alignItemWithTrigger:l,className:"isolate z-50",children:h.jsxs(j8,{"data-slot":"select-content","data-align-trigger":l,className:Nt("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:[h.jsx(N9,{}),h.jsx(T8,{children:t}),h.jsx(T9,{})]})})})}function Bn({className:e,children:t,...n}){return h.jsxs(O8,{"data-slot":"select-item",className:Nt("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx(A8,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),h.jsx(M8,{render:h.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:h.jsx(uu,{className:"pointer-events-none"})})]})}function N9({className:e,...t}){return h.jsx(I8,{"data-slot":"select-scroll-up-button",className:Nt("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(SV,{})})}function T9({className:e,...t}){return h.jsx(P8,{"data-slot":"select-scroll-down-button",className:Nt("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(KM,{})})}const O9=b.forwardRef(function(t,n){const{render:r,className:o,disabled:i=!1,focusableWhenDisabled:l=!1,nativeButton:c=!0,style:f,...d}=t,{getButtonProps:p,buttonRef:g}=jl({disabled:i,focusableWhenDisabled:l,native:c});return bn("button",t,{state:{disabled:i},ref:[n,g],props:[d,p]})}),aN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,lN=DA,zg=(e,t)=>n=>{var r;if(t?.variants==null)return lN(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,l=Object.keys(o).map(d=>{const p=n?.[d],g=i?.[d];if(p===null)return null;const y=aN(p)||aN(g);return o[d][y]}),c=n&&Object.entries(n).reduce((d,p)=>{let[g,y]=p;return y===void 0||(d[g]=y),d},{}),f=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,p)=>{let{class:g,className:y,...v}=p;return Object.entries(v).every(x=>{let[E,S]=x;return Array.isArray(S)?S.includes({...i,...c}[E]):{...i,...c}[E]===S})?[...d,g,y]:d},[]);return lN(e,l,f,n?.class,n?.className)},M9=zg("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ke({className:e,variant:t="default",size:n="default",...r}){return h.jsx(O9,{"data-slot":"button",className:Nt(M9({variant:t,size:n,className:e})),...r})}const KA=b.createContext(void 0);function XA(e){const t=b.useContext(KA);if(t===void 0&&!e)throw new Error(Er(33));return t}const QA=b.createContext(void 0);function hu(e){const t=b.useContext(QA);if(t===void 0&&!e)throw new Error(Er(36));return t}const k9=b.createContext(void 0);function aS(e=!0){const t=b.useContext(k9);if(t===void 0&&!e)throw new Error(Er(25));return t}function A9(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:i,typingRef:l,itemRef:c,itemMetadata:f}=e,{events:d}=i.useState("floatingTreeRoot"),p=i.useState("open"),g=aS(!0),y=g!==void 0;return b.useMemo(()=>({id:r,role:"menuitem",tabIndex:p&&n?0:-1,onKeyDown(v){v.key===" "&&l?.current&&v.preventDefault()},onMouseMove(v){o&&d.emit("itemhover",{nodeId:o,target:v.currentTarget})},onClick(v){t&&d.emit("close",{domEvent:v,reason:Fd})},onMouseUp(v){if(g){const x=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,y&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1||y&&!vw&&v.button===2)return}c.current&&i.context.allowMouseUpTriggerRef.current&&(!y||v.button===2)&&f.type==="regular-item"&&nm(c.current,v,{detail:1})}}),[t,n,r,d,o,p,i,l,c,g,y,f])}const D9={type:"regular-item"};function P9(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:i,typingRef:l=i.context.typingRef,nativeButton:c,itemMetadata:f,nodeId:d}=e,p=b.useRef(null),{getButtonProps:g,buttonRef:y}=jl({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),v=A9({closeOnClick:t,highlighted:r,id:o,nodeId:d,store:i,typingRef:l,itemRef:p,itemMetadata:f}),x=b.useCallback(S=>Ho(v,{onMouseEnter(){f.type==="submenu-trigger"&&f.setActive()}},S,g),[v,g,f]),E=al(p,y);return b.useMemo(()=>({getItemProps:x,itemRef:E}),[x,E])}const WA=b.createContext(void 0);function I9(){const e=b.useContext(WA);if(e===void 0)throw new Error(Er(31));return e}const z9=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...l}=t,[c,f]=b.useState(void 0),d=bn("div",t,{ref:n,props:{role:"group","aria-labelledby":c,...l}});return h.jsx(WA.Provider,{value:f,children:d})}),L9=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:l,...c}=t,f=Rl(l),d=I9();return tt(()=>(d(f),()=>{d(p=>p===f?void 0:p)}),[d,f]),bn("div",t,{ref:n,props:{id:f,role:"presentation",...c}})}),$9=b.forwardRef(function(t,n){const{render:r,className:o,id:i,label:l,nativeButton:c=!1,disabled:f=!1,closeOnClick:d=!0,style:p,...g}=t,y=rS({guess:!0,label:l}),v=XA(!0),x=Rl(i),{store:E}=hu(),S=E.useState("disabled"),_=f||S,j=E.useState("isActive",y.index),R=E.useState("itemProps"),{getItemProps:N,itemRef:O}=P9({closeOnClick:d,disabled:_,highlighted:j,id:x,store:E,nativeButton:c,nodeId:v?.context.nodeId,itemMetadata:D9});return bn("div",t,{state:{disabled:_,highlighted:j},props:[R,g,N],ref:[O,n,y.ref]})}),F9=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:l,...c}=t,{store:f}=hu(),{side:d,align:p}=XA(),g=nS()!=null,y=f.useState("open"),v=f.useState("transitionStatus"),x=f.useState("popupProps"),E=f.useState("mounted"),S=f.useState("instantType"),_=f.useState("activeTriggerElement"),j=f.useState("parent"),R=f.useState("lastOpenChangeReason"),N=f.useState("rootId"),O=f.useState("floatingRootContext"),k=f.useState("floatingTreeRoot"),M=f.useState("closeDelay"),T=f.useState("hoverEnabled"),L=f.useState("disabled"),G=f.useState("openMethod"),B=j.type==="context-menu";Ra({open:y,ref:f.context.popupRef,onComplete(){y&&f.context.onOpenChangeComplete?.(!0)}}),b.useEffect(()=>{function A(P){f.setOpen(!1,Ot(P.reason,P.domEvent))}return k.events.on("close",A),()=>{k.events.off("close",A)}},[k.events,f]),aA(O,{enabled:T&&!L&&!B&&j.type!=="menubar",closeDelay:M});const V=f.useStateSetter("popupElement"),q={transitionStatus:v,side:d,align:p,open:y,nested:j.type==="menu",instant:S},I=bn("div",t,{state:q,ref:[n,f.context.popupRef,V],stateAttributesMapping:Kw,props:[x,{onKeyDown(A){g&&Ig.has(A.key)&&A.stopPropagation()}},Dg(v),c,{"data-rootownerid":N}]});let z=j.type===void 0||B;return(_||j.type==="menubar"&&R!==xg)&&(z=!0),h.jsx(Eg,{context:O,openInteractionType:G,modal:B,disabled:!E,returnFocus:l===void 0?z:l,initialFocus:j.type!=="menu",restoreFocus:!0,externalTree:j.type!=="menubar"?k:void 0,previousFocusableElement:_,nextFocusableElement:j.type===void 0?f.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:j.type===void 0?f.context.beforeContentFocusGuardRef:void 0,children:I})}),JA=b.createContext(void 0);function V9(){const e=b.useContext(JA);if(e===void 0)throw new Error(Er(32));return e}const U9=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:i}=hu();return i.useState("mounted")||r?h.jsx(JA.Provider,{value:r,children:h.jsx(Sg,{ref:n,...o})}):null}),H9=b.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:i,render:l,side:c,align:f,sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:y=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:E=!1,collisionAvoidance:S=Ak,style:_,...j}=t,{store:R}=hu(),N=V9(),O=aS(!0),k=R.useState("parent"),M=R.useState("floatingRootContext"),T=R.useState("floatingTreeRoot"),L=R.useState("mounted"),G=R.useState("open"),B=R.useState("modal"),V=R.useState("openMethod"),q=R.useState("activeTriggerElement"),I=R.useState("transitionStatus"),z=R.useState("positionerElement"),A=R.useState("instantType"),P=R.useState("adaptiveOrigin"),U=R.useState("lastOpenChangeReason"),H=R.useState("floatingNodeId"),Y=R.useState("floatingParentNodeId"),$=M.useState("domReferenceElement"),F=b.useRef(null),Q=Iw(z);let X=r,ne=d,te=p,J=f,K=S;k.type==="context-menu"&&(X=r??k.context?.anchor,J=J??"start",!c&&J!=="center"&&(te=t.alignOffset??2,ne=t.sideOffset??-5));let re=c,ye=J;k.type==="menu"?(re=re??"inline-end",ye=ye??"start",K=t.collisionAvoidance??Dk):k.type==="menubar"&&(re=re??(k.context.orientation==="vertical"?"inline-end":"bottom"),ye=ye??"start");const fe=k.type==="context-menu",ue=Ww({anchor:X,floatingRootContext:M,positionMethod:O?"fixed":o,mounted:L,side:re,sideOffset:ne,align:ye,alignOffset:te,arrowPadding:fe?0:v,collisionBoundary:g,collisionPadding:y,sticky:x,nodeId:H,keepMounted:N,disableAnchorTracking:E,collisionAvoidance:K,shift:fe?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:T,adaptiveOrigin:P});b.useEffect(()=>{function Le(Fe){Fe.open&&(Fe.parentNodeId===H&&R.set("hoverEnabled",!1),Fe.nodeId!==H&&Fe.parentNodeId===R.select("floatingParentNodeId")&&R.setOpen(!1,Ot(Od)))}return T.events.on("menuopenchange",Le),()=>{T.events.off("menuopenchange",Le)}},[R,T.events,H]),b.useEffect(()=>{if(R.select("floatingParentNodeId")==null)return;function Le(Fe){if(Fe.open||Fe.nodeId!==R.select("floatingParentNodeId"))return;const Ye=Fe.reason??Od;R.setOpen(!1,Ot(Ye))}return T.events.on("menuopenchange",Le),()=>{T.events.off("menuopenchange",Le)}},[T.events,R]);const he=Ar();b.useEffect(()=>{G||he.clear()},[G,he]),b.useEffect(()=>{function Le(Fe){if(!(!G||Fe.nodeId!==R.select("floatingParentNodeId")))if(Fe.target&&q&&q!==Fe.target){const Ye=R.select("closeDelay");Ye>0?he.isStarted()||he.start(Ye,()=>{R.setOpen(!1,Ot(Od))}):R.setOpen(!1,Ot(Od))}else he.clear()}return T.events.on("itemhover",Le),()=>{T.events.off("itemhover",Le)}},[T.events,G,q,R,he]),b.useEffect(()=>{const Le={open:G,nodeId:H,parentNodeId:Y,reason:R.select("lastOpenChangeReason")};T.events.emit("menuopenchange",Le)},[T.events,G,R,H,Y]),tt(()=>{const Le=$,Fe=F.current;if(Le&&(F.current=Le),Fe&&Le&&Le!==Fe){R.set("instantType",void 0);const Ye=new AbortController;return Q(()=>{R.set("instantType","trigger-change")},Ye.signal),()=>{Ye.abort()}}},[$,Q,R]);const Re={open:G,side:ue.side,align:ue.align,anchorHidden:ue.anchorHidden,nested:k.type==="menu",instant:A},ze=k.type==="menubar"&&k.context.modal;tS(G&&(ze||B&&U!==vr),V==="touch",z,q);const Ae=eS(t,Re,{styles:ue.positionerStyles,transitionStatus:I,props:j,refs:[n,R.useStateSetter("positionerElement")],hidden:!L,inert:!G}),Qe=L&&k.type!=="menu"&&(k.type!=="menubar"&&B&&U!==vr||k.type==="menubar"&&k.context.modal);let De=null;return k.type==="menubar"?De=k.context.contentElement:k.type===void 0&&(De=q),h.jsxs(KA.Provider,{value:ue,children:[Qe&&h.jsx(Ag,{ref:k.type==="context-menu"||k.type==="nested-context-menu"?k.context.internalBackdropRef:null,inert:kg(!G),cutout:De}),h.jsx(Fk,{id:H,children:h.jsx(_A,{elementsRef:R.context.itemDomElements,labelsRef:R.context.itemLabels,children:Ae})})]})}),B9=b.createContext(null);function e2(e){return b.useContext(B9)}const q9={...Bw,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class Y9 extends _f{constructor(t){super({...G9(),...t},Z9(),q9),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let r=n.store.select("rootId"),o=n.store.select("floatingTreeRoot"),i=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{const l=n.store.select("rootId"),c=n.store.select("floatingTreeRoot"),f=n.store.select("keyboardEventRelay");r===l&&o===c&&i===f||(r=l,o=c,i=f,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function Z9(){return{positionerRef:b.createRef(),popupRef:b.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),onOpenChangeComplete:void 0,triggerElements:new Nf}}function G9(){return{...Uw(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Mw,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Kn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const K9=b.createContext(void 0);function X9(){return b.useContext(K9)}const Q9=sk(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:i,defaultOpen:l=!1,disabled:c=!1,modal:f,loopFocus:d=!0,orientation:p="vertical",actionsRef:g,closeParentOnEsc:y=!1,handle:v,triggerId:x,defaultTriggerId:E=null,highlightItemOnHover:S=!0}=t,_=aS(!0),j=hu(!0),R=e2(!0),N=X9(),O=b.useMemo(()=>N&&j?{type:"menu",store:j.store}:R?{type:"menubar",context:R}:_&&!j?{type:"context-menu",context:_}:{type:void 0},[_,j,R,N]),k=W9({open:l,openProp:r,activeTriggerId:E,triggerIdProp:x,parent:O});k.useControlledProp("openProp",r),k.useControlledProp("triggerIdProp",x),k.useContextCallback("onOpenChangeComplete",i);const M=ul(),T=ul(),L=k.useState("floatingTreeRoot"),G=kw(L),B=Ca(),V=k.useState("open"),q=k.useState("activeTriggerElement"),I=k.useState("positionerElement"),z=k.useState("hoverEnabled"),A=k.useState("disabled"),P=k.useState("lastOpenChangeReason"),U=k.useState("parent"),H=k.useState("activeIndex"),Y=k.useState("payload"),$=k.useState("floatingParentNodeId"),F=b.useRef(null),Q=b.useRef(U.type!=="context-menu"),X=Ar(),ne=b.useRef(!0),te=Ar(),J=$!=null,{openMethod:K,triggerProps:re}=wA(V);k.useSyncedValues({disabled:c,highlightItemOnHover:S,modal:U.type===void 0?f:void 0,openMethod:K,rootId:M}),$w(k);const{forceUnmount:ye}=Fw(V,k,()=>{k.set("allowMouseEnter",!1)});tt(()=>{_&&!j?k.update({parent:{type:"context-menu",context:_},floatingNodeId:G,floatingParentNodeId:B}):j&&k.update({floatingNodeId:G,floatingParentNodeId:B})},[_,j,G,B,k]),b.useEffect(()=>{if(V||(F.current=null),U.type==="context-menu"){if(!V){X.clear(),Q.current=!1;return}X.start(500,()=>{Q.current=!0})}},[X,V,U.type]),tt(()=>{!V&&!z&&k.set("hoverEnabled",!0)},[V,z,k]);const fe=dt((Ie,at)=>{const it=at.reason;if(!Ie&&!k.select("open")||V===Ie&&at.trigger===q&&P===it)return;const $t=Jk(at);if(!Ie&&at.trigger==null&&(at.trigger=q??void 0),o?.(Ie,at),at.isCanceled)return;k.state.floatingRootContext.dispatchOpenChange(Ie,at);const W=at.event;if(Ie===!1&&W?.type==="click"&&W.pointerType==="touch"&&!ne.current)return;Ie&&it===$d?(ne.current=!1,te.start(300,()=>{ne.current=!0})):(ne.current=!0,te.clear());const ie=(it===cl||it===Fd)&&W.detail===0,ae=!Ie&&(it===bg||it==null),Se={open:Ie,openChangeReason:it};F.current=at.event,Lw(Se,Ie,at.trigger,$t()),k.update(Se),U.type==="menubar"&&(it===$d||it===ma||it===vr||it===Fb||it===Od)?k.set("instantType","group"):ie||ae?k.set("instantType",ie?"click":"dismiss"):k.set("instantType",void 0)}),ue=Xk({popupStore:k,floatingId:T,nested:B!=null,onOpenChange:fe}),he=ue.context.events;tt(()=>{const Ie=({open:at,eventDetails:it})=>fe(at,it);return he.on("setOpen",Ie),()=>{he?.off("setOpen",Ie)}},[he,fe]);const Re=b.useCallback(()=>{k.setOpen(!1,Ot(Ew))},[k]);b.useImperativeHandle(g,()=>({unmount:ye,close:Re}),[ye,Re]);let ze;U.type==="context-menu"&&(ze=U.context),b.useImperativeHandle(ze?.positionerRef,()=>I,[I]),b.useImperativeHandle(ze?.actionsRef,()=>({setOpen:fe}),[fe]);const Ue=Cg(ue,{enabled:!A,bubbles:{escapeKey:y&&U.type==="menu"},outsidePress(){return U.type!=="context-menu"||F.current?.type==="contextmenu"?!0:Q.current},externalTree:J?L:void 0}),Ae=Qw(),Qe=b.useCallback(Ie=>{k.select("activeIndex")!==Ie&&k.set("activeIndex",Ie)},[k]),De=cA(ue,{enabled:!A,listRef:k.context.itemDomElements,activeIndex:H,nested:U.type!==void 0,loopFocus:d,orientation:p,parentOrientation:U.type==="menubar"?U.context.orientation:void 0,rtl:Ae==="rtl",disabledIndices:ll,onNavigate:Qe,openOnArrowKeyDown:U.type!=="context-menu",externalTree:J?L:void 0,focusItemOnHover:S}),Le=b.useCallback(Ie=>{k.context.typingRef.current=Ie},[k]),Fe=uA(ue,{enabled:!A,listRef:k.context.itemLabels,elementsRef:k.context.itemDomElements,activeIndex:H,resetMs:c6,onMatch:Ie=>{V&&Ie!==H&&k.set("activeIndex",Ie)},onTyping:Le}),Ye=b.useMemo(()=>{const Ie=Ho(Fe.reference,De.reference,Ue.reference,{onMouseMove(){k.set("allowMouseEnter",!0)}},re);return Ie["aria-haspopup"]="menu",Ie["aria-expanded"]=V,Ie},[k,Fe.reference,De.reference,Ue.reference,re,V]),et=b.useMemo(()=>{const Ie=Ho(De.trigger,Ue.trigger,re);return Ie["aria-haspopup"]="menu",Ie["aria-expanded"]=!1,Ie},[De.trigger,Ue.trigger,re]),me=b.useMemo(()=>Ho(Ng,{id:T,role:"menu","aria-labelledby":q?.id,onMouseMove(){k.set("allowMouseEnter",!0),U.type==="menu"&&k.set("hoverEnabled",!1)},onClick(){k.select("hoverEnabled")&&k.set("hoverEnabled",!1)},onKeyDown(Ie){const at=k.select("keyboardEventRelay");at&&!Ie.isPropagationStopped()&&at(Ie)}},Fe.floating,De.floating,Ue.floating),[q,T,U.type,k,Fe.floating,De.floating,Ue.floating]),xe=De.item??Kn;Vw(k,{floatingRootContext:ue,activeTriggerProps:Ye,inactiveTriggerProps:et,popupProps:me,itemProps:xe});const We=b.useMemo(()=>({store:k,parent:O}),[k,O]),Oe=h.jsxs(QA.Provider,{value:We,children:[v&&h.jsx(zw,{handle:v,store:k}),typeof n=="function"?n({payload:Y}):n]});return U.type===void 0||U.type==="context-menu"?h.jsx(Vk,{externalTree:L,children:Oe}):Oe});function W9(e){return Dr(()=>new Y9(e)).current}function J9(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Xw(),{ref:o,index:i}=rS(e),l=n===i,c=b.useRef(null),f=al(o,c);return{compositeProps:{tabIndex:l?0:-1,onFocus(){r(i)},onMouseMove(){const p=c.current;if(!t||!p)return;const g=p.hasAttribute("disabled")||p.ariaDisabled==="true";!l&&!g&&p.focus()}},compositeRef:f,index:i}}function eq(e){const{render:t,className:n,style:r,state:o=Kn,props:i=ll,refs:l=ll,metadata:c,stateAttributesMapping:f,tag:d="div",...p}=e,{compositeProps:g,compositeRef:y}=J9({metadata:c});return bn(d,e,{state:o,ref:[y,...l],props:[g,...i,p],stateAttributesMapping:f})}function t2(e){if(Cn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!yi(e))return t2(wi(e))}function n2(e,t){const n=b.useRef(null);function r(i){Co.flushSync(()=>{e.setOpen(!1,Ot(ma,i.nativeEvent,i.currentTarget))}),YH(n.current)?.focus()}function o(i){const l=e.select("positionerElement");if(l&&Lc(i,l))e.context.beforeContentFocusGuardRef.current?.focus();else{Co.flushSync(()=>{e.setOpen(!1,Ot(ma,i.nativeEvent,i.currentTarget))});let c=qH(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&mt(l,c);){const f=c;if(c=Nw(c),c===f)break}c?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function tq(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=b.useRef(!1);return b.useMemo(()=>t?{onMouseDown:i=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,Zt(i.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:i=>{o.current&&(o.current=!1,i.preventBaseUIHandler())}}:Kn,[t,n,r])}const nq=oH(function(t,n){const{render:r,className:o,style:i,disabled:l=!1,nativeButton:c=!0,id:f,openOnHover:d,delay:p=100,closeDelay:g=0,handle:y,payload:v,...x}=t,E=hu(!0),_=oA(y)??E?.store;if(!_)throw new Error(Er(85));const j=Rl(f),R=_.useState("isTriggerActive",j),N=_.useState("floatingRootContext"),O=_.useState("isOpenedByTrigger",j),k=_.useState("triggerPopupId",j),M=b.useRef(null),T=oq(),L=Xw(!0),G=_a(),B=b.useMemo(()=>G??new Mw,[G]),V=kw(B),q=Ca(),{registerTrigger:I,isMountedByThisTrigger:z}=eA(j,M,_,{payload:v,closeDelay:g,parent:T,floatingTreeRoot:B,floatingNodeId:V,floatingParentNodeId:q,keyboardEventRelay:L?.relayKeyboardEvent}),A=T.type==="menubar",P=_.useState("disabled"),U=l||P||A&&T.context.disabled,{getButtonProps:H,buttonRef:Y}=jl({disabled:U,native:c});b.useEffect(()=>{!O&&T.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,O,T.type]);const $=b.useRef(null),F=Ar(),Q=dt(Le=>{if(!$.current)return;F.clear(),_.context.allowMouseUpTriggerRef.current=!1;const Fe=Le.target;mt($.current,Fe)||mt(_.select("positionerElement"),Fe)||Fe===$.current||Fe!=null&&t2(Fe)===_.select("rootId")||EA(Le,$.current)||B.events.emit("close",{domEvent:Le,reason:dk})});b.useEffect(()=>{O&&_.select("lastOpenChangeReason")===vr&&Zt($.current).addEventListener("mouseup",Q,{once:!0})},[O,Q,_]);const X=A&&T.context.hasSubmenuOpen,te=lA(N,{enabled:(d??X)&&!U&&(!A||X&&!z),handleClose:dA({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:T.type===void 0?p:void 0,delay:{close:g},triggerElementRef:M,externalTree:B,isActiveTrigger:R,isClosing:()=>_.select("transitionStatus")==="ending"}),J=rq(O,_.select("lastOpenChangeReason")),K=Dw(N,{enabled:!U,event:O&&A?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?J:!1}),re=cB(N,{enabled:!U&&X}),ye=tq({open:O,enabled:A,mouseDownAction:"open"}),fe=b.useMemo(()=>Ho(re.reference,K.reference),[re.reference,K.reference]),ue=_.useState("triggerProps",z),{preFocusGuardRef:he,handlePreFocusGuardFocus:Re,handleFocusTargetFocus:ze}=n2(_,M),Ue={disabled:U,open:O},Ae=[$,n,Y,I,M],Qe=[fe,te??Kn,ue,{"aria-haspopup":"menu","aria-controls":k,id:j,onMouseDown:Le=>{if(_.select("open"))return;F.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),Zt(Le.currentTarget).addEventListener("mouseup",Q,{once:!0})}},A?{role:"menuitem"}:{},ye,x,H],De=bn("button",t,{enabled:!A,stateAttributesMapping:jm,state:Ue,ref:Ae,props:Qe});return A?h.jsx(eq,{tag:"button",render:r,className:o,style:i,state:Ue,refs:Ae,props:Qe,stateAttributesMapping:jm}):O?h.jsxs(b.Fragment,{children:[h.jsx(ga,{ref:he,onFocus:Re},`${j}-pre-focus-guard`),h.jsx(b.Fragment,{children:De},j),h.jsx(ga,{ref:_.context.triggerFocusTargetRef,onFocus:ze},`${j}-post-focus-guard`)]}):h.jsx(b.Fragment,{children:De},j)});function rq(e,t){const n=Ar(),[r,o]=b.useState(!1);return tt(()=>{e&&t===vr?(o(!0),n.start(Mk,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function oq(){const e=e2();return b.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const sq=b.forwardRef(function(t,n){const{className:r,render:o,orientation:i="horizontal",style:l,...c}=t;return bn("div",t,{state:{orientation:i},ref:n,props:[{role:"separator","aria-orientation":i},c]})});function Gb({...e}){return h.jsx(Q9,{"data-slot":"dropdown-menu",...e})}function Kb({...e}){return h.jsx(nq,{"data-slot":"dropdown-menu-trigger",...e})}function Xb({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...i}){return h.jsx(U9,{children:h.jsx(H9,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:h.jsx(F9,{"data-slot":"dropdown-menu-content",className:Nt("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...i})})})}function cN({...e}){return h.jsx(z9,{"data-slot":"dropdown-menu-group",...e})}function uN({className:e,inset:t,...n}){return h.jsx(L9,{"data-slot":"dropdown-menu-label","data-inset":t,className:Nt("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...n})}function fa({className:e,inset:t,variant:n="default",...r}){return h.jsx($9,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Nt("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function iq({className:e,...t}){return h.jsx(sq,{"data-slot":"dropdown-menu-separator",className:Nt("-mx-1 my-1 h-px bg-border",e),...t})}const hc=({isActive:e})=>`text-sm transition ${e?"border-b-2 border-foreground font-medium text-foreground":"text-muted-foreground hover:text-foreground"}`;function aq(){const{activeProjects:e,activeProject:t,activeProjectId:n,setActiveProjectId:r}=cs();return h.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-background/95 backdrop-blur",children:h.jsxs("div",{className:"mx-auto flex w-full max-w-5xl items-center gap-8 px-4 py-3",children:[h.jsx("span",{className:"text-sm font-bold tracking-wide text-foreground",children:"司命 · Siming"}),h.jsxs("div",{className:"flex items-center gap-6",children:[h.jsx(Ns,{to:"/",className:hc,children:"看板"}),h.jsx(Ns,{to:"/tasks",className:hc,children:"任务"}),h.jsx(Ns,{to:"/templates",className:hc,children:"模板"}),h.jsx(Ns,{to:"/skills",className:hc,children:"技能"}),h.jsx(Ns,{to:"/agents",className:hc,children:"代理"}),h.jsx(Ns,{to:"/projects",className:hc,children:"项目"}),h.jsxs(Gb,{children:[h.jsx(Kb,{render:h.jsx("button",{type:"button",className:"flex items-center gap-1 text-sm text-muted-foreground transition hover:text-foreground","aria-label":"设置",children:h.jsx(HV,{className:"size-4","aria-hidden":"true"})})}),h.jsx(Xb,{align:"start",children:h.jsxs(cN,{children:[h.jsx(uN,{children:"设置"}),h.jsx(fa,{render:h.jsx(Ns,{to:"/settings/models"}),children:"模型映射"}),h.jsx(fa,{render:h.jsx(Ns,{to:"/settings/enums"}),children:"枚举管理"})]})})]})]}),h.jsx("div",{className:"ml-auto hidden md:block",children:h.jsxs(br,{value:n,onValueChange:o=>{o!==null&&r(o)},children:[h.jsx(wr,{size:"sm",className:"max-w-44","aria-label":"切换项目",children:h.jsx("span",{className:"truncate text-muted-foreground",children:t?t.name:"加载中…"})}),h.jsx(Sr,{children:e.map(o=>h.jsx(Bn,{value:o.id,children:o.name},o.id))})]})}),h.jsx("div",{className:"ml-auto md:hidden",children:h.jsxs(Gb,{children:[h.jsx(Kb,{render:h.jsx(ke,{variant:"ghost",size:"sm"}),children:h.jsxs("span",{className:"flex max-w-32 items-center gap-1 truncate text-sm text-muted-foreground",children:[t?t.name:"项目",h.jsx(Cf,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})}),h.jsxs(Xb,{align:"end",children:[h.jsxs(cN,{children:[h.jsx(uN,{children:"切换项目"}),e.map(o=>h.jsx(fa,{onClick:()=>r(o.id),children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(uu,{className:`size-3.5 ${o.id===n?"opacity-100":"opacity-0"}`,"aria-hidden":"true"}),h.jsx("span",{className:"truncate",children:o.name})]})},o.id))]}),h.jsx(iq,{}),h.jsx(fa,{render:h.jsx(Ns,{to:"/projects"}),children:"项目管理"})]})]})})]})})}function lq(e){return cq(e)||typeof e=="function"||uq(e)}function cq(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function uq(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function jp(e,t){return e==null?null:lq(e)?Ee.createElement(e,t):e}function dq(e){if("cell"in e&&e.cell){const t=e.cell,n=t.column.columnDef,r=t,o=n;return r.getIsAggregated?.()?jp(o.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:jp(n.cell,t.getContext())}return"header"in e&&e.header?jp(e.header.column.columnDef.header,e.header.getContext()):"footer"in e&&e.footer?jp(e.footer.column.columnDef.footer,e.footer.getContext()):null}function fq({update:e,notify:t,unwatched:n}){return{link:r,unlink:o,propagate:i,checkDirty:l,shallowPropagate:c};function r(d,p,g){const y=p.depsTail;if(y!==void 0&&y.dep===d)return;const v=y!==void 0?y.nextDep:p.deps;if(v!==void 0&&v.dep===d){v.version=g,p.depsTail=v;return}const x=d.subsTail;if(x!==void 0&&x.version===g&&x.sub===p)return;const E=p.depsTail=d.subsTail={version:g,dep:d,sub:p,prevDep:y,nextDep:v,prevSub:x,nextSub:void 0};v!==void 0&&(v.prevDep=E),y!==void 0?y.nextDep=E:p.deps=E,x!==void 0?x.nextSub=E:d.subs=E}function o(d,p=d.sub){const g=d.dep,y=d.prevDep,v=d.nextDep,x=d.nextSub,E=d.prevSub;return v!==void 0?v.prevDep=y:p.depsTail=y,y!==void 0?y.nextDep=v:p.deps=v,x!==void 0?x.prevSub=E:g.subsTail=E,E!==void 0?E.nextSub=x:(g.subs=x)===void 0&&n(g),v}function i(d){let p=d.nextSub,g;e:do{const y=d.sub;let v=y.flags;if(v&60?v&12?v&4?!(v&48)&&f(d,y)?(y.flags=v|40,v&=1):v=0:y.flags=v&-9|32:v=0:y.flags=v|32,v&2&&t(y),v&1){const x=y.subs;if(x!==void 0){const E=(d=x).nextSub;E!==void 0&&(g={value:p,prev:g},p=E);continue}}if((d=p)!==void 0){p=d.nextSub;continue}for(;g!==void 0;)if(d=g.value,g=g.prev,d!==void 0){p=d.nextSub;continue e}break}while(!0)}function l(d,p){let g,y=0,v=!1;e:do{const x=d.dep,E=x.flags;if(p.flags&16)v=!0;else if((E&17)===17){if(e(x)){const S=x.subs;S.nextSub!==void 0&&c(S),v=!0}}else if((E&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(g={value:d,prev:g}),d=x.deps,p=x,++y;continue}if(!v){const S=d.nextDep;if(S!==void 0){d=S;continue}}for(;y--;){const S=p.subs,_=S.nextSub!==void 0;if(_?(d=g.value,g=g.prev):d=S,v){if(e(p)){_&&c(S),p=d.sub;continue}v=!1}else p.flags&=-33;p=d.sub;const j=d.nextDep;if(j!==void 0){d=j;continue e}}return v}while(!0)}function c(d){do{const p=d.sub,g=p.flags;(g&48)===32&&(p.flags=g|16,(g&6)===2&&t(p))}while((d=d.nextSub)!==void 0)}function f(d,p){let g=p.depsTail;for(;g!==void 0;){if(g===d)return!0;g=g.prevDep}return!1}}function hq(e,t,n){const r=typeof e=="object",o=r?e:void 0;return{next:(r?e.next:e)?.bind(o),error:(r?e.error:t)?.bind(o),complete:(r?e.complete:n)?.bind(o)}}const Qb=[];let rm=0;const{link:dN,unlink:pq,propagate:mq,checkDirty:r2,shallowPropagate:fN}=fq({update(e){return e._update()},notify(e){Qb[Wb++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Om(e))}});let Np=0,Wb=0,Os,Jb=0;function gq(e){try{++Jb,e()}finally{--Jb||o2()}}function Om(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=pq(n,e)}function o2(){if(!(Jb>0)){for(;Np<Wb;){const e=Qb[Np];Qb[Np++]=void 0,e.notify()}Np=0,Wb=0}}function yq(e,t){const n=typeof e=="function",r=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Os!==void 0&&dN(o,Os,rm),o._snapshot},subscribe(i){const l=hq(i),c={current:!1},f=vq(()=>{o.get(),c.current?l.next?.(o._snapshot):c.current=!0});return{unsubscribe:()=>{f.stop()}}},_update(i){const l=Os,c=t?.compare??Object.is;if(n)Os=o,++rm,o.depsTail=void 0;else if(i===void 0)return!1;n&&(o.flags=5);try{const f=o._snapshot,d=typeof i=="function"?i(f):i===void 0&&n?r(f):i;return f===void 0||!c(f,d)?(o._snapshot=d,!0):!1}finally{Os=l,n&&(o.flags&=-5),Om(o)}}};return n?(o.flags=17,o.get=function(){const i=o.flags;if(i&16||i&32&&r2(o.deps,o)){if(o._update()){const l=o.subs;l!==void 0&&fN(l)}}else i&32&&(o.flags=i&-33);return Os!==void 0&&dN(o,Os,rm),o._snapshot}):o.set=function(i){if(o._update(i)){const l=o.subs;l!==void 0&&(mq(l),fN(l),o2())}},o}function vq(e){const t=()=>{const r=Os;Os=n,++rm,n.depsTail=void 0,n.flags=6;try{return e()}finally{Os=r,n.flags&=-5,Om(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const r=this.flags;r&16||r&32&&r2(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Om(this)}};return t(),n}function Ud(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=hN(e);if(n.length!==hN(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function hN(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function xq(e,t){return e===t}function s2(e,t=r=>r,n){const r=n?.compare??xq,o=b.useCallback(l=>{const{unsubscribe:c}=e.subscribe(l);return c},[e]),i=b.useCallback(()=>e.get(),[e]);return fw.useSyncExternalStoreWithSelector(o,i,i,t,r)}function bq(e){const t=s2(e.source,e.selector,{compare:Ud});return typeof e.children=="function"?e.children(t):e.children}function wq(e){const t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),"set"in e&&(t.setState=e.set.bind(e)),t}function Sq(e){const{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw new Error("Feature not supported in current reactivity implementation")},unmount:()=>{throw new Error("Feature not supported in current reactivity implementation")},schedule:e.schedule??(o=>queueMicrotask(o)),batch:n,untrack:o=>o(),createReadonlyAtom:(o,i)=>{const l=i?.compare??Object.is;let c=!1,f;const d=()=>{const g=o();return(!c||!l(f,g))&&(f=g,c=!0),f},p=t(()=>(r.get(),d()),{compare:l});return{get:d,subscribe:p.subscribe.bind(p)}},createWritableAtom:(o,i)=>t(o,{compare:i?.compare}),commit:()=>{r.set(o=>o+1)}}}function Eq(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:o=>{r=o,n=!0},subscribe:o=>e.subscribe(i=>{(!n||!t(r,i))&&o(i)})}}function Cq(){return Sq({createAtom:yq,batch:gq})}function Of(e,t){return typeof e=="function"?e(t):e}function xa(e){if(Array.isArray(e))return e.map(xa);if(e&&typeof e=="object"){const t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;const n=t===null?ba():{},r=Object.keys(e);for(let o=0;o<r.length;o++){const i=r[o];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:xa(e[i]),writable:!0})}return n}return e}function _q(e,t){const n=Object.keys(t),r=e;for(let o=0;o<n.length;o++){const i=n[o];!i.startsWith("_memo_")&&i!=="_cellsCache"&&(r[i]=t[i])}return e}function ba(){return Object.create(null)}function Mf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i2(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(r=>Of(n,r))}}function pN(e){if(typeof e!="object"||e===null)return!1;if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function mN(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}const Rq=3;function jq(e,t){return a2(e,t,Rq)}function a2(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!pN(e)||!pN(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;const r=mN(e),o=mN(t);if(r.length!==o.length)return!1;const i=e,l=t;for(let c=0;c<r.length;c++){const f=r[c];if(!Object.prototype.propertyIsEnumerable.call(t,f)||!a2(i[f],l[f],n-1))return!1}return!0}function Lg(e,t,n,r=jq){const o=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,i=e.options[o];i&&i(l=>{const c=Of(n,l);return r(l,c)?l:c})}function Nq(e){return e instanceof Function}function Tq(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const l=t(i);l.length&&r(l)})};return r(e),n}const Oq=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:o,onBeforeUpdate:i})=>{let l=[],c;return d=>{o?.();const p=t?.(d);let g=!p||p.length!==l?.length;if(!g&&p){for(let y=0;y<p.length;y++)if(p[y]!==l[y]){g=!0;break}}return n?.(g),g&&(l=p,i?.(),c=e(...p??[]),r?.(c)),c}};function l2(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function kf({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:o,...i}){const l=()=>{if(!r)return;const{schedule:f,untrack:d}=o._reactivity;f(()=>d(()=>r()))};return Oq({...i,...{onAfterUpdate:()=>{l()}}})}function c2(e,t="_"){const[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function Tl(e,t,n){for(const[r,{fn:o,memoDeps:i}]of Object.entries(n)){const{fnKey:l,fnName:c}=c2(r);t[l]=i?kf({memoDeps:i,fn:o,fnName:c,table:t,feature:e}):o}}function Af(e,t,n,r){for(const[o,{fn:i,memoDeps:l}]of Object.entries(r)){const{fnKey:c,fnName:f}=c2(o);if(l){const d=`_memo_${c}`;t[c]=function(...p){if(!this[d]){const g=this;this[d]=kf({memoDeps:y=>l(g,y),fn:(...y)=>i(g,...y),fnName:f,objectId:g.id,table:n,feature:e})}return this[d](...p)}}else t[c]=function(...d){return i(this,...d)}}}function Is(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function Mq(e){return e.row.getValue(e.column.id)}function kq(e){return e.getValue()??e.table.options.renderFallbackValue}function Aq(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}const Dq={assignCellPrototype:(e,t)=>{Af("coreCellsFeature",e,t,{cell_getValue:{fn:n=>Mq(n)},cell_renderValue:{fn:n=>kq(n)},cell_getContext:{fn:n=>Aq(n),memoDeps:n=>[n]}})}};function Pq(e){if(!e._headerPrototype){e._headerPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function u2(e,t,n){const r=Pq(e),o=Object.create(r);o.colSpan=0,o.column=t,o.depth=n.depth,o.headerGroup=null,o.id=n.id??t.id,o.index=n.index,o.isPlaceholder=!!n.isPlaceholder,o.placeholderId=n.placeholderId,o.rowSpan=0,o.subHeaders=[];const i=e._headerInstanceInitFns;for(let l=0;l<i.length;l++)i[l](o);return o}function Iq(){return{start:[],end:[]}}function fl(e){const t=e.table.atoms.columnVisibility?.get();if(!t)return!0;const n=e.columns;return n.length?n.some(r=>Is(r,"getIsVisible",fl)):(Mf(t,e.id)?t[e.id]:void 0)??!0}function zq(e){return e.getAllLeafColumns().filter(t=>Is(t,"getIsVisible",fl))}function d2(e,t=1){let n=t;for(let r=0;r<e.length;r++){const o=e[r];Is(o,"getIsVisible",fl)&&o.columns.length&&(n=Math.max(n,d2(o.columns,t+1)))}return n}function Lq(e,t){return String(t)}function $q(e,t,n,r){let o=e??"";return t&&(o=o?`${o}_${t}`:String(t)),n&&(o=o?`${o}_${n}`:n),r&&(o=o?`${o}_${r}`:r),o}function Fq(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function f2(e,t,n,r,o,i){const l={depth:t,id:Lq(r,t),headers:[]},c=[];for(let f=0;f<e.length;f++){if(!(f in e))continue;const d=e[f],p=c[c.length-1],g=d.column.depth===l.depth;let y,v=!1;if(g&&d.column.parent?y=d.column.parent:(y=d.column,v=!0),p&&p.column===y)p.subHeaders.push(d);else{const x=u2(n,y,{id:$q(r,t,y.id,d.id),isPlaceholder:v,placeholderId:v?String(Fq(c,y)):void 0,depth:t,index:c.length});x.subHeaders.push(d),c.push(x)}l.headers.push(d),d.headerGroup=l}for(let f=0;f<i.length;f++)i[f](l);o.push(l),t>0&&f2(c,t-1,n,r,o,i)}function h2(e){for(let t=0;t<e.length;t++){const n=e[t];if(!Is(n.column,"getIsVisible",fl))continue;let r=0;if(n.subHeaders.length){h2(n.subHeaders);for(let o=0;o<n.subHeaders.length;o++){const i=n.subHeaders[o];Is(i.column,"getIsVisible",fl)&&(r+=i.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let o=1,i=n.subHeaders[0];for(;i;)i.rowSpan=0,o++,i=i.subHeaders.length===1&&i.subHeaders[0].column===n.column?i.subHeaders[0]:void 0;n.rowSpan=o}else n.rowSpan=1}}function gN(e,t,n,r){const o=d2(e),i=[],l=n._headerGroupInstanceInitFns,c=new Array(t.length);for(let f=0;f<t.length;f++)f in t&&(c[f]=u2(n,t[f],{depth:o,index:f}));return f2(c,o-1,n,r,i,l),i.reverse(),h2(i[0]?.headers??[]),i}function Vq(e){if(!e._columnPrototype){e._columnPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function Uq(e,t,n,r){const o={...e.getDefaultColumnDef(),...t},i=o.accessorKey,l=i===void 0?void 0:String(i),c=o.id??l?.replaceAll(".","_")??(typeof o.header=="string"?o.header:void 0);let f;if(o.accessorFn)f=o.accessorFn;else if(i!==void 0)if(typeof i=="string"&&i.includes(".")){const y=i.split(".");f=v=>{let x=v;for(let E=0;E<y.length;E++){const S=y[E];x=x?.[S]}return x}}else f=y=>y[o.accessorKey];if(!c)throw new Error;const d=Vq(e),p=Object.create(d);p.accessorFn=f,p.columnDef=o,p.columns=[],p.depth=n,p.id=`${String(c)}`,p.parent=r;const g=e._columnInstanceInitFns;for(let y=0;y<g.length;y++)g[y](p);return p}function p2(e){const t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{const o=new Map;for(let i=0;i<n.length;i++){const l=n[i];o.set(l.id,l)}for(let i=0;i<t.length;i++){const l=t[i],c=o.get(l);c&&(r.push(c),o.delete(l))}for(let i=0;i<n.length;i++){const l=n[i];o.has(l.id)&&r.push(l)}}return Hq(e,r)}}function Hq(e,t){const n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;const o=t.filter(c=>!n.includes(c.id));if(r==="remove")return o;const i=new Map;for(let c=0;c<t.length;c++){const f=t[c];i.set(f.id,f)}const l=[];for(let c=0;c<n.length;c++){const f=i.get(n[c]);f&&l.push(f)}return[...l,...o]}function Bq(e){return[e,...e.columns.flatMap(t=>t.getFlatColumns())]}function qq(e){if(e.columns.length){const t=e.columns.flatMap(n=>n.getLeafColumns());return Is(e.table,"getOrderColumns",p2)(t)}return[e]}function Yq(e){return{header:t=>{const n=t.header.column.columnDef;return n.accessorKey?n.accessorKey:n.accessorFn?n.id:null},cell:t=>t.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((t,n)=>Object.assign(t,n.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function m2(e,t,n,r=0){const o=new Array(t.length);for(let i=0;i<t.length;i++){if(!(i in t))continue;const l=t[i],c=Uq(e,l,r,n),f=l;c.columns=f.columns?m2(e,f.columns,c,r+1):[],o[i]=c}return o}function Zq(e){return m2(e,e.options.columns)}function Gq(e){return e.getAllColumns().flatMap(t=>t.getFlatColumns())}function Kq(e){const t=ba(),n=e.getAllFlatColumns();for(let r=0;r<n.length;r++){const o=n[r];t[o.id]=o}return t}function Xq(e){const t=e.getAllColumns().flatMap(n=>n.getLeafColumns());return Is(e,"getOrderColumns",p2)(t)}function Qq(e){const t=ba(),n=e.getAllLeafColumns();for(let r=0;r<n.length;r++){const o=n[r];t[o.id]=o}return t}function Wq(e,t){return e.getAllFlatColumnsById()[t]}const Jq={assignColumnPrototype:(e,t)=>{Af("coreColumnsFeature",e,t,{column_getFlatColumns:{fn:n=>Bq(n),memoDeps:n=>[n.table.options.columns]},column_getLeafColumns:{fn:n=>qq(n),memoDeps:n=>[n.table.atoms.columnOrder?.get(),n.table.atoms.grouping?.get(),n.table.options.columns,n.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{Tl("coreColumnsFeature",e,{table_getDefaultColumnDef:{fn:()=>Yq(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>Zq(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>Gq(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>Kq(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>Xq(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>Qq(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>Wq(e,t)}})}};function g2(e,t){for(let n=0;n<e.subHeaders.length;n++)g2(e.subHeaders[n],t);t.push(e)}function e7(e){const t=[];return g2(e,t),t}function t7(e){return{column:e.column,header:e,table:e.column.table}}function n7(e){const{start:t,end:n}=e.atoms.columnPinning?.get()??Iq(),r=e.getAllColumns(),o=Is(e,"getVisibleLeafColumns",zq);if(!t.length&&!n.length)return gN(r,o,e);const i=e.getAllLeafColumnsById(),l=[];for(let d=0;d<t.length;d++){const p=i[t[d]];p&&Is(p,"getIsVisible",fl)&&l.push(p)}const c=[];for(let d=0;d<n.length;d++){const p=i[n[d]];p&&Is(p,"getIsVisible",fl)&&c.push(p)}const f=o.filter(d=>!t.includes(d.id)&&!n.includes(d.id));return gN(r,[...l,...f,...c],e)}function r7(e){return[...e.getHeaderGroups()].reverse()}function o7(e){const t=e.getHeaderGroups(),n=[];for(let r=0;r<t.length;r++){const o=t[r].headers;for(let i=0;i<o.length;i++)n.push(o[i])}return n}function s7(e){const t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let r=0;r<t.length;r++){const o=t[r].getLeafHeaders();for(let i=0;i<o.length;i++)n.push(o[i])}return n}const i7={assignHeaderPrototype:(e,t)=>{Af("coreHeadersFeature",e,t,{header_getLeafHeaders:{fn:n=>e7(n),memoDeps:n=>[n.column.table.options.columns]},header_getContext:{fn:n=>t7(n),memoDeps:n=>[n.column.table.options.columns]}})},constructTableAPIs:e=>{Tl("coreHeadersFeature",e,{table_getHeaderGroups:{fn:()=>n7(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>r7(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>o7(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>s7(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function a7(e){if(!e._rowPrototype){e._rowPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}const l7=(e,t,n,r,o,i,l)=>{const c=a7(e),f=Object.create(c);f._displayIndexCache=-1,f._uniqueValuesCache=ba(),f._valuesCache=ba(),f.depth=o,f.id=t,f.index=r,f.original=n,f.parentId=l,f.subRows=[];const d=e._rowInstanceInitFns;for(let p=0;p<d.length;p++)d[p](f);return f},c7=/([0-9]+)/gm;function pu(e){const t=Object.assign((n,r,o)=>{let i=n.getValue(o),l=r.getValue(o);const c=t.resolveDataValue;return c&&(i=c(i),l=c(l)),t.sort(i,l,n,r,o)},e);return t}pu({resolveDataValue:e=>$g(e).toLowerCase(),sort:(e,t)=>v2(e,t)});pu({resolveDataValue:e=>$g(e),sort:(e,t)=>v2(e,t)});pu({resolveDataValue:e=>$g(e).toLowerCase(),sort:(e,t)=>lS(e,t)});pu({resolveDataValue:e=>$g(e),sort:(e,t)=>lS(e,t)});pu({resolveDataValue:e=>u7(e),sort:(e,t)=>e>t?1:e<t?-1:0});const y2=pu({sort:(e,t)=>lS(e,t)});function lS(e,t){return e===t?0:e>t?1:-1}function u7(e){return e instanceof Date?e.getTime():e}function $g(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function v2(e,t){let n=0,r=0;const o=e.length,i=t.length;for(;n<o&&r<i;){const l=Mm(e.charCodeAt(n)),c=Mm(t.charCodeAt(r)),f=e0(e,n,l),d=e0(t,r,c);if(!l&&!c){const g=d7(e,n,f,t,r,d);if(g)return g;n=f,r=d;continue}if(l!==c)return l?1:-1;const p=f7(e,n,f,t,r,d);if(p)return p;n=f,r=d}return vN(e,n)-vN(t,r)}function Mm(e){return e>=48&&e<=57}function e0(e,t,n){let r=t+1;for(;r<e.length&&Mm(e.charCodeAt(r))===n;)r++;return r}function d7(e,t,n,r,o,i){const l=n-t,c=i-o,f=l<c?l:c;for(let d=0;d<f;d++){const p=e.charCodeAt(t+d),g=r.charCodeAt(o+d);if(p>g)return 1;if(g>p)return-1}return l>c?1:c>l?-1:0}function f7(e,t,n,r,o,i){let l=t;for(;l<n&&e.charCodeAt(l)===48;)l++;let c=o;for(;c<i&&r.charCodeAt(c)===48;)c++;const f=n-l,d=i-c;if(f===0&&d===0)return 0;if(f<=15&&d<=15){const y=yN(e,l,n),v=yN(r,c,i);return y>v?1:v>y?-1:0}const p=parseInt(e.slice(t,n),10),g=parseInt(r.slice(o,i),10);return p>g?1:g>p?-1:0}function yN(e,t,n){let r=0;for(let o=t;o<n;o++)r=r*10+e.charCodeAt(o)-48;return r}function vN(e,t){let n=0,r=t;for(;r<e.length;)n++,r=e0(e,r,Mm(e.charCodeAt(r)));return n}function h7(){return[]}function p7(e,t){Lg(e,"cellSelection",xa(e.initialState.cellSelection)??h7())}function m7(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>p7(e))}function g7(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>y7(e))}function y7(e,t){const n=e.initialState.expanded;Lg(e,"expanded",n===!0?!0:Object.assign(ba(),xa(n??{})))}function v7(e){const t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||x7(t,e.id)))}function x7(e,t){return!!(e&&e!==!0&&Mf(e,t)&&e[t])}const hl=0,km=10;function Am(){return{pageIndex:hl,pageSize:km}}function cS(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??hl)===hl)return;x2(e,!0)}}function Fg(e,t){Lg(e,"pagination",t)}function b7(e,t){Fg(e,t?Am():xa(e.initialState.pagination??Am()))}function mu(e,t){Fg(e,n=>{let r=Of(t,n.pageIndex);const o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...n,pageIndex:r}})}function x2(e,t){mu(e,t?hl:e.initialState.pagination?.pageIndex??hl)}function w7(e,t){b2(e,t?km:e.initialState.pagination?.pageSize??km)}function b2(e,t){Fg(e,n=>{const r=Math.max(1,Of(t,n.pageSize)),o=n.pageSize===1/0?0:n.pageSize*n.pageIndex,i=r===1/0?0:Math.floor(o/r);return{...n,pageIndex:i,pageSize:r}})}function S7(e){const t=Df(e);let n=[];return t&&t>0&&(n=[...new Array(t)].fill(null).map((r,o)=>o)),n}function E7(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function C7(e){const t=e.atoms.pagination?.get()?.pageIndex??hl,n=Df(e);return n===-1?!0:n===0?!1:t<n-1}function _7(e){const t=e.atoms.pagination?.get()?.pageIndex??hl,n=Df(e);return Number.isFinite(n)&&n>0&&t<n-1}function R7(e){return mu(e,t=>t-1)}function j7(e){return mu(e,t=>t+1)}function N7(e){return mu(e,0)}function T7(e){const t=Df(e);if(!(!Number.isFinite(t)||t<=0))return mu(e,t-1)}function Df(e){const t=e.options.pageCount;if(t!=null)return t;const n=w2(e),r=e.atoms.pagination?.get()?.pageSize??km;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function w2(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function O7(){return[]}function Vg(e,t){Lg(e,"sorting",t)}function S2(e,t){Vg(e,t?[]:xa(e.initialState.sorting??[]))}function M7(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&S2(e)}function E2(e){const t=e.table._rowModelFns.sortFns,n=e.table.getFilteredRowModel().flatRows.slice(0,10);let r,o=!1;for(let i=0;i<n.length;i++){const l=n[i].getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]"){r="datetime";break}if(typeof l=="string"&&(o=!0,l.split(c7).length>1)){r="alphanumeric";break}}if(!r&&o&&(r="text"),r){let i=t?.[r];if(i||r==="alphanumeric"&&(i=t?.text),i)return i}return y2}function C2(e){const t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<t.length;n++){const r=t[n].getValue(e.id);if(r!=null)return typeof r=="string"?"asc":"desc"}return"desc"}function _2(e){const t=e.table._rowModelFns.sortFns;return Nq(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn==="auto"?E2(e):t?.[e.columnDef.sortFn]??y2}function R2(e,t,n){const r=N2(e,n&&Dm(e)),o=typeof t<"u";Vg(e.table,i=>{const l=i.findIndex(y=>y.id===e.id),c=l===-1?void 0:i[l];let f=[],d;const p=o?t:r==="desc",g=!!(i.length&&Dm(e)&&n);return g?c?d="toggle":d="add":c?d="toggle":d="replace",d==="toggle"&&(o||r||(d="remove")),d==="add"?(f=[...i,{id:e.id,desc:p}],f.splice(0,f.length-(e.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):d==="toggle"?f=g?i.map(y=>y.id===e.id?{...y,desc:p}:y):[{id:e.id,desc:p}]:d==="remove"?f=g?i.filter(y=>y.id!==e.id):[]:f=[{id:e.id,desc:p}],f})}function j2(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??C2(e)==="desc"?"desc":"asc"}function N2(e,t){const n=j2(e),r=T2(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r==="desc"?"asc":"desc":n}function uS(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function Dm(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function T2(e){const t=e.table.atoms.sorting?.get()?.find(n=>n.id===e.id);return t?t.desc?"desc":"asc":!1}function k7(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function A7(e){Vg(e.table,t=>t.length?t.filter(n=>n.id!==e.id):[])}function D7(e){const t=uS(e);return n=>{t&&R2(e,void 0,Dm(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function P7(){return e=>kf({feature:"coreRowModelsFeature",table:e,fnName:"table.getCoreRowModel",memoDeps:()=>[e.options.data],fn:()=>I7(e,e.options.data),onAfterUpdate:l2(()=>{g7(e),cS(e),M7(e),m7(e)})})}function O2(e,t,n,r=0,o){const i=[];for(let l=0;l<n.length;l++){const c=n[l],f=l7(e,e.getRowId(c,l,o),c,l,r,void 0,o?.id);t.flatRows.push(f),t.rowsById[f.id]=f,i.push(f),e.options.getSubRows&&(f.originalSubRows=e.options.getSubRows(c,l),f.originalSubRows?.length&&(f.subRows=O2(e,t,f.originalSubRows,r+1,f)))}return i}function I7(e,t){const n={rows:[],flatRows:[],rowsById:ba()};return n.rows=O2(e,n,t),n}function z7(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??P7()(e)),e._rowModels.coreRowModel()}function L7(e){return e.getCoreRowModel()}function $7(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function F7(e){return e.getFilteredRowModel()}function V7(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function U7(e){return e.getGroupedRowModel()}function H7(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function B7(e){return e.getSortedRowModel()}function q7(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function Y7(e){return e.getExpandedRowModel()}function Z7(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function G7(e){return e.getPaginatedRowModel()}const K7={constructTableAPIs:e=>{Tl("coreRowModelsFeature",e,{table_getCoreRowModel:{fn:()=>z7(e)},table_getPreFilteredRowModel:{fn:()=>L7(e)},table_getFilteredRowModel:{fn:()=>$7(e)},table_getPreGroupedRowModel:{fn:()=>F7(e)},table_getGroupedRowModel:{fn:()=>V7(e)},table_getPreSortedRowModel:{fn:()=>U7(e)},table_getSortedRowModel:{fn:()=>H7(e)},table_getPreExpandedRowModel:{fn:()=>B7(e)},table_getExpandedRowModel:{fn:()=>q7(e)},table_getPrePaginatedRowModel:{fn:()=>Y7(e)},table_getPaginatedRowModel:{fn:()=>Z7(e)},table_getRowModel:{fn:()=>G7(e)}})}};function X7(e){if(!e._cellPrototype){e._cellPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function Q7(e,t,n){const r=X7(n),o=Object.create(r);o.column=e,o.id=`${t.id}_${e.id}`,o.row=t;const i=n._cellInstanceInitFns;for(let l=0;l<i.length;l++)i[l](o);return o}function W7(e){const t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function J7(e){const t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){const n=[],r=o=>{o._displayIndexCache=n.length,n.push(o),o.subRows.length&&o.getIsExpanded?.()&&o.subRows.forEach(r)};return t.forEach(r),n}for(let n=0;n<t.length;n++)t[n]._displayIndexCache=n;return t}function eY(e,t){if(Mf(e._valuesCache,t))return e._valuesCache[t];const n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function tY(e,t){if(Mf(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];const n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function nY(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function rY(e){return Tq(e.subRows,t=>t.subRows)}function oY(e){const t=e.getCoreRowModel().flatRows;let n=0;for(let r=0;r<t.length;r++)n=Math.max(n,t[r].depth);return n}function sY(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function iY(e){const t=[];let n=e;for(;;){const r=n.getParentRow();if(!r)break;t.push(r),n=r}return t.reverse()}function aY(e){const t=e.table.getAllLeafColumns();let n=e._cellsCache;n||(n=e._cellsCache=new WeakMap);const r=new Array(t.length);for(let o=0;o<t.length;o++){const i=t[o];let l=n.get(i);l||(l=Q7(i,e,e.table),n.set(i,l)),r[o]=l}return r}function lY(e){const t=ba(),n=e.getAllCells();for(let r=0;r<n.length;r++){const o=n[r];t[o.column.id]=o}return t}function cY(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function uY(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw new Error;return r}const dY={assignRowPrototype:(e,t)=>{Af("coreRowsFeature",e,t,{row_getDisplayIndex:{fn:n=>W7(n)},row_getAllCellsByColumnId:{fn:n=>lY(n),memoDeps:n=>[n.getAllCells()]},row_getAllCells:{fn:n=>aY(n),memoDeps:n=>[n.table.getAllLeafColumns()]},row_getLeafRows:{fn:n=>rY(n),memoDeps:n=>[n.subRows]},row_getParentRow:{fn:n=>sY(n)},row_getParentRows:{fn:n=>iY(n)},row_getUniqueValues:{fn:(n,r)=>tY(n,r)},row_getValue:{fn:(n,r)=>eY(n,r)},row_renderValue:{fn:(n,r)=>nY(n,r)}})},constructTableAPIs:e=>{Tl("coreRowsFeature",e,{table_getRowsInDisplayOrder:{fn:()=>J7(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>cY(t,e,n,r)},table_getRow:{fn:(t,n)=>uY(e,t,n)},table_getMaxSubRowDepth:{fn:()=>oY(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function M2(e,t,n=(r,o)=>r===o){const r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(const o in r){const i=e.baseAtoms[o];if(!i)continue;const l=r[o],c=l===void 0?e.initialState[o]:l;n(e._reactivity.untrack(()=>i.get()),c)||i.set(()=>c)}})}function k2(e,t,n=(r,o)=>r===o){e._reactivity.batch(()=>{M2(e,t,n),e._reactivity.commit?.()})}function fY(e){const t=xa(e.initialState);e._reactivity.batch(()=>{const r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o];e.baseAtoms[i].set(t[i])}});const n=Object.values(e._features);for(let r=0;r<n.length;r++)n[r].resetTableInstanceData?.(e)}function hY(e,t){const{features:n,atoms:r,initialState:o}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:o};const i=e.options.mergeOptions(e.options,t),l={...Object.getOwnPropertyDescriptors(i)};return Object.defineProperties(Object.create(Object.getPrototypeOf(i)),{...l,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:o,enumerable:!0,configurable:!0,writable:!0}})}function A2(e,t,n){const r=hY(e,Of(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&k2(e,r.state??null)}const pY={constructTableAPIs:e=>{Tl("coreTablesFeature",e,{table_reset:{fn:()=>fY(e)},table_setOptions:{fn:t=>A2(e,t)}})}},mY={coreCellsFeature:Dq,coreColumnsFeature:Jq,coreHeadersFeature:i7,coreRowModelsFeature:K7,coreRowsFeature:dY,coreTablesFeature:pY};function gu(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},columns:e=>e,display:e=>e,group:e=>e}}function gY(e,t={}){return Object.values(e).forEach(n=>{t=n.getInitialState?.(t)??t}),xa(t)}function yY(e){const t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:o,expandedRowModel:i,facetedMinMaxValues:l,facetedRowModel:c,facetedUniqueValues:f,filterFns:d,filterMeta:p,filteredRowModel:g,groupedRowModel:y,paginatedRowModel:v,sortFns:x,sortedRowModel:E,tableMeta:S,..._}=e.features,j={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...mY,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:d,sortFns:x},_rowModels:{},atoms:{},baseAtoms:{}},R=Object.values(j._features),N={...R.reduce((k,M)=>Object.assign(k,M.getDefaultTableOptions?.(j)),{}),...e};if(t.wrapExternalAtoms&&N.atoms)for(const[k,M]of Object.entries(N.atoms)){const T=M,L=t.createWritableAtom(T.get(),{debugName:`externalAtom/${k}`});N.atoms[k]=L;let G=!1;const B=T.subscribe(q=>{G||L.set(q)}),V=L.subscribe(q=>{G=!0,T.set(q),G=!1});t.addSubscription(B),t.addSubscription(V)}t.createOptionsStore?(j.optionsStore=t.createWritableAtom(N,{debugName:"table/optionsStore"}),Object.defineProperty(j,"options",{configurable:!0,enumerable:!0,get(){return j.optionsStore.get()},set(k){j.optionsStore.set(()=>k)}})):j.options=N,j.initialState=gY(j._features,j.options.initialState);const O=Object.keys(j.initialState);for(let k=0;k<O.length;k++){const M=O[k];j.baseAtoms[M]=t.createWritableAtom(j.initialState[M],{debugName:`table/baseAtoms/${M}`}),j.atoms[M]=t.createReadonlyAtom(()=>{const T=j.options,L=T.atoms?.[M],G=L?L.get():j.baseAtoms[M].get();if(L)return G;const B=T.state;if(B&&Mf(B,M)){const V=B[M];return V===void 0?j.initialState[M]:V}return G},{debugName:`table/atoms/${M}`})}M2(j),j.store=wq(t.createReadonlyAtom(()=>{const k={};for(let M=0;M<O.length;M++){const T=O[M];k[T]=j.atoms[T].get()}return k},{compare:Ud,debugName:"table/store"}));for(let k=0;k<R.length;k++){const M=R[k];M.initTableInstanceData?.(j),M.initCellInstanceData&&j._cellInstanceInitFns.push(M.initCellInstanceData.bind(M)),M.initColumnInstanceData&&j._columnInstanceInitFns.push(M.initColumnInstanceData.bind(M)),M.initHeaderGroupInstanceData&&j._headerGroupInstanceInitFns.push(M.initHeaderGroupInstanceData.bind(M)),M.initHeaderInstanceData&&j._headerInstanceInitFns.push(M.initHeaderInstanceData.bind(M)),M.initRowInstanceData&&j._rowInstanceInitFns.push(M.initRowInstanceData.bind(M)),M.constructTableAPIs?.(j)}return j}const vY={getInitialState:e=>({...e,pagination:{...Am(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:i2("pagination",e)}),constructTableAPIs:e=>{Tl("rowPaginationFeature",e,{table_autoResetPageIndex:{fn:()=>cS(e)},table_setPagination:{fn:t=>Fg(e,t)},table_resetPagination:{fn:t=>b7(e,t)},table_setPageIndex:{fn:t=>mu(e,t)},table_resetPageIndex:{fn:t=>x2(e,t)},table_setPageSize:{fn:t=>b2(e,t)},table_getPageCount:{fn:()=>Df(e)},table_resetPageSize:{fn:t=>w7(e,t)},table_getPageOptions:{fn:()=>S7(e)},table_getCanPreviousPage:{fn:()=>E7(e)},table_getCanNextPage:{fn:()=>C7(e)},table_getCanLastPage:{fn:()=>_7(e)},table_previousPage:{fn:()=>R7(e)},table_nextPage:{fn:()=>j7(e)},table_firstPage:{fn:()=>N7(e)},table_lastPage:{fn:()=>T7(e)},table_getRowCount:{fn:()=>w2(e)}})}},xY={getInitialState(e){return{sorting:O7(),...e}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:i2("sorting",e),isMultiSortEvent:t=>t.shiftKey}},assignColumnPrototype(e,t){Af("rowSortingFeature",e,t,{column_getAutoSortFn:{fn:n=>E2(n)},column_getAutoSortDir:{fn:n=>C2(n)},column_getSortFn:{fn:n=>_2(n)},column_toggleSorting:{fn:(n,r,o)=>R2(n,r,o)},column_getFirstSortDir:{fn:n=>j2(n)},column_getNextSortingOrder:{fn:(n,r)=>N2(n,r)},column_getCanSort:{fn:n=>uS(n)},column_getCanMultiSort:{fn:n=>Dm(n)},column_getIsSorted:{fn:n=>T2(n)},column_getSortIndex:{fn:n=>k7(n)},column_clearSorting:{fn:n=>A7(n)},column_getToggleSortingHandler:{fn:n=>D7(n)}})},constructTableAPIs(e){Tl("rowSortingFeature",e,{table_setSorting:{fn:t=>Vg(e,t)},table_resetSorting:{fn:t=>S2(e,t)}})}};function bY(e){const t=[],n=r=>{t.push(r),r.subRows.length&&v7(r)&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function wY(){return e=>{const t=e;return kf({feature:"rowPaginationFeature",table:t,fnName:"table.getPaginatedRowModel",memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>SY(t)})}}function SY(e){const t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;const{pageSize:r,pageIndex:o}=n??Am(),{rows:i,flatRows:l,rowsById:c}=t;let f=i;if(r!==1/0||o!==0){const y=r*o,v=y+r;f=i.slice(y,v)}let d;e.options.paginateExpandedRows?d={rows:f,flatRows:l,rowsById:c}:d=bY({rows:f,flatRows:l,rowsById:c}),d.flatRows=[];const p=new Set,g=y=>{p.has(y.id)||(p.add(y.id),d.flatRows.push(y),y.subRows.length&&y.subRows.forEach(g))};return d.rows.forEach(g),d}function EY(){return e=>{const t=e;return kf({feature:"rowSortingFeature",table:t,fnName:"table.getSortedRowModel",memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>CY(t),onAfterUpdate:l2(()=>cS(t))})}}function CY(e){const t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;const r=[],o=n.filter(f=>{const d=e.getColumn(f.id);return d?uS(d):!1});if(!o.length)return t;const i=[];for(let f=0;f<o.length;f++){const d=o[f],p=e.getColumn(d.id);p&&i.push({id:d.id,desc:d.desc,sortUndefined:p.columnDef.sortUndefined,invertSorting:p.columnDef.invertSorting,sortFn:_2(p)})}const l=(f,d)=>{for(let p=0;p<i.length;p++){const g=i[p],y=g.sortUndefined,v=g.desc;let x=0;if(y){const E=f.getValue(g.id),S=d.getValue(g.id),_=E===void 0,j=S===void 0;if(_&&j)continue;if(_||j){if(y==="first")return _?-1:1;if(y==="last")return _?1:-1;x=_?y:-y}}if(x===0&&(x=g.sortFn(f,d,g.id)),x!==0)return v&&(x*=-1),g.invertSorting&&(x*=-1),x}return f.index-d.index},c=f=>{const d=f.slice();d.sort(l);let p=!1;for(let g=0;g<d.length;g++){const y=d[g];y!==f[g]&&(p=!0);const v=r.length;if(r.push(y),y.subRows.length){const x=c(y.subRows);if(x.changed){const E=Object.create(Object.getPrototypeOf(y));_q(E,y),E.subRows=x.rows,d[g]=E,r[v]=E,p=!0}}}return{rows:d,changed:p}};return{rows:c(t.rows).rows,flatRows:r,rowsById:t.rowsById}}const _Y=typeof window>"u"?b.useEffect:b.useLayoutEffect;function RY(e,t){const[{table:n,rootSource:r}]=b.useState(()=>{const f=yY({...e,features:{coreReactivityFeature:Cq(),...e.features}});return f.Subscribe=(d=>bq({...d,source:d.source??f.store})),f.FlexRender=dq,{table:f,rootSource:Eq(f.store,Ud)}}),o=n;A2(o,f=>({...f,...e}),{syncExternalState:!1});const i=o.options.state,l=r.get(),c=s2(r,t,{compare:Ud});return _Y(()=>{r.markCommitted(l),k2(o,i??null,Ud)}),b.useMemo(()=>({...n,options:e,state:c}),[n,e,c])}const D2=b.createContext(void 0);function Ol(e){const t=b.useContext(D2);if(!e&&t===void 0)throw new Error(Er(27));return t}const jY=b.forwardRef(function(t,n){const{render:r,className:o,style:i,forceRender:l=!1,...c}=t,f=Ol(),d=f.useState("open"),p=f.useState("nested"),g=f.useState("mounted"),y=f.useState("transitionStatus");return bn("div",t,{state:{open:d,transitionStatus:y},ref:[f.context.backdropRef,n],stateAttributesMapping:Kw,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:l||!p})}),dS=b.forwardRef(function(t,n){const{render:r,className:o,style:i,disabled:l=!1,nativeButton:c=!0,...f}=t,d=Ol(),p=d.useState("open"),{getButtonProps:g,buttonRef:y}=jl({disabled:l,native:c}),v={disabled:l};function x(E){p&&d.setOpen(!1,Ot(uk,E.nativeEvent))}return bn("button",t,{state:v,ref:[n,y],props:[{onClick:x},f,g]})}),NY=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:l,...c}=t,f=Ol(),d=Rl(l);return f.useSyncedValueWithCleanup("descriptionElementId",d),bn("p",t,{ref:n,props:[{id:d},c]})}),P2=b.createContext(void 0);function TY(){const e=b.useContext(P2);if(e===void 0)throw new Error(Er(26));return e}const OY={...Mg,...Tf,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},MY=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:l,initialFocus:c,...f}=t,d=Ol(),p=d.useState("descriptionElementId"),g=d.useState("disablePointerDismissal"),y=d.useState("floatingRootContext"),v=d.useState("popupProps"),x=d.useState("modal"),E=d.useState("mounted"),S=d.useState("nested"),_=d.useState("nestedOpenDialogCount"),j=d.useState("open"),R=d.useState("openMethod"),N=d.useState("titleElementId"),O=d.useState("transitionStatus"),k=d.useState("role"),M=y.useState("floatingId");TY(),Ra({open:j,ref:d.context.popupRef,onComplete(){j&&d.context.onOpenChangeComplete?.(!0)}});const T=c===void 0?Qk(d.context.popupRef):c,L=_>0,G=d.useStateSetter("popupElement"),V=bn("div",t,{state:{open:j,nested:S,transitionStatus:O,nestedDialogOpen:L},props:[v,{id:M,"aria-labelledby":N,"aria-describedby":p,role:k,...Ng,hidden:!E,onKeyDown(q){Ig.has(q.key)&&q.stopPropagation()},style:{"--nested-dialogs":_}},f],ref:[n,d.context.popupRef,G],stateAttributesMapping:OY});return h.jsx(Eg,{context:y,openInteractionType:R,disabled:!E,closeOnFocusOut:!g,initialFocus:T,returnFocus:l,modal:x!==!1,restoreFocus:"popup",children:V})}),kY=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,i=Ol(),l=i.useState("mounted"),c=i.useState("modal"),f=i.useState("open");return l||r?h.jsx(P2.Provider,{value:r,children:h.jsxs(Sg,{ref:n,...o,children:[l&&c===!0&&h.jsx(Ag,{ref:i.context.internalBackdropRef,inert:kg(!f)}),t.children]})}):null});function AY({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),o=e.useState("disablePointerDismissal"),i=e.useState("modal"),l=e.useState("popupElement"),c=e.useState("floatingRootContext"),[f,d]=b.useState(0),[p,g]=b.useState(0),y=f===0,v=Cg(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(x){if(!e.context.outsidePressEnabledRef.current||"button"in x&&x.button!==0)return!1;if("touches"in x){if(x.type==="touchend"){if(x.changedTouches.length!==1||x.touches.length!==0)return!1}else if(x.touches.length!==1)return!1}const E=ao(x);if(y&&!o){if(i){const S=e.context.internalBackdropRef.current,_=e.context.backdropRef.current;return S||_?S===E||_===E||mt(E,l)&&!E?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:y});return OA(r&&i===!0,l),e.useContextCallback("onNestedDialogOpen",(x,E)=>{d(x),g(E)}),tt(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(f+1,p+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,f,p,t]),Vw(e,{activeTriggerProps:v.reference,inactiveTriggerProps:v.trigger,popupProps:v.floating,nestedOpenDialogCount:f,nestedOpenDrawerCount:p}),null}const DY={...Bw,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class PY extends _f{constructor(t,n,r){const o=new Nf,i=IY(t,o,n,r);super(i,zY(o),DY)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t};Lw(r,t,n.trigger),this.update(r)}}function IY(e,t,n,r=!1){const o={...Uw(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return o.floatingRootContext=nA(t,n,r),o}function zY(e){return{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function LY(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:i,onOpenChangeComplete:l,disablePointerDismissal:c=!1,modal:f=!0,actionsRef:d,handle:p,triggerId:g,defaultTriggerId:y=null}=t,v=e==="drawer",x=f,E=c,S="dialog",_=Ol(!0),j=_!=null,R={modal:x,disablePointerDismissal:E,nested:j,role:S},N=Wk((G,B)=>new PY({open:o,openProp:r,activeTriggerId:y,triggerIdProp:g,...R},G,B),!0);N.useControlledProp("openProp",r),N.useControlledProp("triggerIdProp",g),N.useSyncedValues(R),N.useContextCallback("onOpenChange",i),N.useContextCallback("onOpenChangeComplete",l);const O=N.useState("open"),k=N.useState("mounted"),M=N.useState("payload");tA(N,O),$w(N);const{forceUnmount:T}=Fw(O,N);b.useImperativeHandle(d,()=>({unmount:T,close:()=>N.setOpen(!1,Ot(Ew))}),[T,N]);const L=O||k;return h.jsxs(D2.Provider,{value:N,children:[p&&h.jsx(zw,{handle:p,store:N}),L&&h.jsx(AY,{store:N,parentContext:_?.context,isDrawer:v}),typeof n=="function"?n({payload:M}):n]})}function $Y(e){return LY("dialog",e)}const FY=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:l,...c}=t,f=Ol(),d=Rl(l);return f.useSyncedValueWithCleanup("titleElementId",d),bn("h2",t,{ref:n,props:[{id:d},c]})});function us({...e}){return h.jsx($Y,{"data-slot":"dialog",...e})}function VY({...e}){return h.jsx(kY,{"data-slot":"dialog-portal",...e})}function yu({...e}){return h.jsx(dS,{"data-slot":"dialog-close",...e})}function UY({className:e,...t}){return h.jsx(jY,{"data-slot":"dialog-overlay",className:Nt("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function ds({className:e,children:t,showCloseButton:n=!0,...r}){return h.jsxs(VY,{children:[h.jsx(UY,{}),h.jsxs(MY,{"data-slot":"dialog-content",className:Nt("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&h.jsxs(dS,{"data-slot":"dialog-close",render:h.jsx(ke,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[h.jsx(ug,{}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fs({className:e,...t}){return h.jsx("div",{"data-slot":"dialog-header",className:Nt("flex flex-col gap-2",e),...t})}function Na({className:e,showCloseButton:t=!1,children:n,...r}){return h.jsxs("div",{"data-slot":"dialog-footer",className:Nt("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&h.jsx(dS,{render:h.jsx(ke,{variant:"outline"}),children:"Close"})]})}function hs({className:e,...t}){return h.jsx(FY,{"data-slot":"dialog-title",className:Nt("font-heading text-base leading-none font-medium",e),...t})}function ps({className:e,...t}){return h.jsx(NY,{"data-slot":"dialog-description",className:Nt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Ri({open:e,onOpenChange:t,title:n,description:r,confirmText:o="确认",cancelText:i="取消",destructive:l=!1,onConfirm:c,loading:f=!1}){return h.jsx(us,{open:e,onOpenChange:t,children:h.jsxs(ds,{className:"sm:max-w-sm",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:n}),r!==void 0&&h.jsx(ps,{children:r})]}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{variant:"outline"}),disabled:f,children:i}),h.jsx(ke,{type:"button",variant:l?"destructive":"default",disabled:f,onClick:c,children:f?"处理中…":o})]})]})})}function Pm({className:e,...t}){return h.jsx("div",{"data-slot":"skeleton",className:Nt("animate-pulse rounded-md bg-muted",e),...t})}function Pf({className:e,...t}){return h.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:h.jsx("table",{"data-slot":"table",className:Nt("w-full caption-bottom text-sm",e),...t})})}function If({className:e,...t}){return h.jsx("thead",{"data-slot":"table-header",className:Nt("[&_tr]:border-b",e),...t})}function zf({className:e,...t}){return h.jsx("tbody",{"data-slot":"table-body",className:Nt("[&_tr:last-child]:border-0",e),...t})}function so({className:e,...t}){return h.jsx("tr",{"data-slot":"table-row",className:Nt("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function Vn({className:e,...t}){return h.jsx("th",{"data-slot":"table-head",className:Nt("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Ht({className:e,...t}){return h.jsx("td",{"data-slot":"table-cell",className:Nt("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Ct(e){return e instanceof cw?e.displayMsg:e instanceof Error&&e.message?e.message:"未知错误"}function Ir({rows:e=4,cols:t=5}){return h.jsx("div",{className:"space-y-3","aria-label":"加载中",role:"status",children:Array.from({length:e},(n,r)=>h.jsx("div",{className:"flex gap-4 rounded-lg border border-border p-4",children:Array.from({length:t},(o,i)=>h.jsx(Pm,{className:"h-4 flex-1"},i))},r))})}function tr({message:e,actionLabel:t,onAction:n}){return h.jsxs("div",{role:"status",className:"rounded-lg border border-dashed border-border py-16 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:e}),t&&n&&h.jsx(ke,{type:"button",onClick:n,className:"mt-4",children:t})]})}function rr({message:e,onRetry:t}){return h.jsxs("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:[h.jsxs("p",{className:"text-sm text-destructive",children:["加载失败:",e]}),t&&h.jsx(ke,{type:"button",variant:"destructive",size:"sm",onClick:t,className:"mt-3",children:"重试"})]})}function I2({className:e}){return h.jsx("div",{role:"status","aria-label":"加载中",className:`h-9 w-full animate-pulse rounded-md bg-muted ${e??""}`})}function HY({message:e}){return h.jsx("p",{role:"alert",className:"text-xs text-destructive",children:e})}function Ug({message:e}){return h.jsx("p",{className:"text-sm text-muted-foreground",children:e})}function ha({title:e,children:t}){return h.jsxs("section",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[h.jsx("h2",{className:"mb-3 text-sm font-semibold text-foreground",children:e}),t]})}const BY={rowSortingFeature:xY,sortedRowModel:EY(),rowPaginationFeature:vY,paginatedRowModel:wY(),columnMeta:{}};function vu({columns:e,data:t,pageSize:n=10,manualPagination:r=!1,emptySlot:o,loading:i=!1}){const c=e.find(S=>S.meta?.initialSortDesc===!0)?.id,f={pagination:{pageIndex:0,pageSize:n},...c?{sorting:[{id:c,desc:!0}]}:{}},d=RY({features:BY,columns:e,data:t,initialState:f,...r?{pagination:{pageIndex:0,pageSize:Math.max(t.length,1)}}:{}}),p=!i&&t.length===0,g=e.length,y=d.state.pagination.pageIndex,v=d.getRowModel().rows,x=d.getPageCount(),E=!r&&!i&&x>1;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs(Pf,{children:[h.jsx(If,{children:d.getHeaderGroups().map(S=>h.jsx(so,{children:S.headers.map(_=>{const j=_.column.getIsSorted(),R=_.column.getCanSort();return h.jsx(Vn,{"aria-sort":R&&j!==!1?j==="asc"?"ascending":"descending":void 0,children:R?h.jsxs("button",{type:"button",onClick:_.column.getToggleSortingHandler(),className:"inline-flex items-center gap-1 font-medium hover:text-foreground",children:[h.jsx(d.FlexRender,{header:_}),j==="asc"?h.jsx(vV,{className:"size-3.5","aria-hidden":!0}):j==="desc"?h.jsx(mV,{className:"size-3.5","aria-hidden":!0}):h.jsx(Cf,{className:"size-3.5 text-muted-foreground","aria-hidden":!0})]}):h.jsx(d.FlexRender,{header:_})},_.id)})},S.id))}),h.jsx(zf,{children:i?Array.from({length:Math.min(n,5)},(S,_)=>h.jsx(so,{children:Array.from({length:g},(j,R)=>h.jsx(Ht,{children:h.jsx(Pm,{className:"h-4 w-full"})},R))},_)):p?h.jsx(so,{children:h.jsx(Ht,{colSpan:g,className:"p-0",children:o??h.jsx(tr,{message:"暂无数据"})})}):v.map(S=>h.jsx(so,{children:S.getAllCells().map(_=>h.jsx(Ht,{children:h.jsx(d.FlexRender,{cell:_})},_.id))},S.id))})]}),E&&h.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[h.jsxs("p",{className:"text-sm text-muted-foreground",children:["第 ",y*n+1,"-",Math.min((y+1)*n,t.length)," 条 / 共 ",t.length," 条"]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsxs(br,{value:String(d.state.pagination.pageSize),onValueChange:S=>d.setPageSize(Number(S)),children:[h.jsx(wr,{size:"sm",className:"h-8 w-20","aria-label":"每页条数",children:h.jsx(Xc,{})}),h.jsx(Sr,{children:[10,20,50].map(S=>h.jsxs(Bn,{value:String(S),children:[S," 条/页"]},S))})]}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>d.setPageIndex(0),disabled:!d.getCanPreviousPage(),children:"首页"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>d.previousPage(),disabled:!d.getCanPreviousPage(),children:"上一页"}),h.jsxs("span",{className:"text-sm tabular-nums text-muted-foreground",children:[y+1," / ",x]}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>d.nextPage(),disabled:!d.getCanNextPage(),children:"下一页"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>d.setPageIndex(x-1),disabled:!d.getCanNextPage(),children:"末页"})]})]})]})}function fS({text:e,maxWidth:t="max-w-xs",label:n="描述"}){const[r,o]=b.useState(!1);return e?h.jsxs(h.Fragment,{children:[h.jsx("span",{role:"button",tabIndex:0,"aria-haspopup":"dialog","aria-expanded":r,title:e,className:`block ${t} cursor-pointer truncate text-muted-foreground underline decoration-dotted decoration-muted-foreground/60 underline-offset-4 transition-colors hover:text-foreground focus:outline-none focus-visible:rounded focus-visible:ring-2 focus-visible:ring-foreground`,onClick:()=>o(!0),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o(!0))},children:e}),h.jsx(us,{open:r,onOpenChange:o,children:h.jsxs(ds,{className:"sm:max-w-lg",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:n}),h.jsxs(ps,{className:"sr-only",children:["完整",n,"内容"]})]}),h.jsx("div",{className:"max-h-96 overflow-y-auto whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground",children:e})]})})]}):h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}function qY(e){return bn(e.defaultTagName??"div",e,e)}const YY=zg("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Un({className:e,variant:t="default",render:n,...r}){return qY({defaultTagName:"span",props:Ho({className:Nt(YY({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}function ZY({enabled:e}){return e===!1?h.jsx(Un,{className:"bg-muted text-muted-foreground",children:"停用"}):h.jsx(Un,{variant:"secondary",children:"启用"})}function hS({enabled:e,disabled:t,onClick:n}){return h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:n,children:e===!1?"启用":"停用"})}function pS(){return{id:"enabled",header:"状态",accessorFn:e=>e.enabled??!0,cell:e=>h.jsx(ZY,{enabled:e.getValue()})}}const GY=b.forwardRef(function(t,n){const{render:r,className:o,id:i,name:l,value:c,disabled:f=!1,onValueChange:d,defaultValue:p,autoFocus:g=!1,style:y,...v}=t,{state:x,name:E,disabled:S,setTouched:_,setDirty:j,validityData:R,setFocused:N,setFilled:O,validationMode:k,validation:M}=Og(),{clearErrors:T}=vA(),L=S||f,G=E??l,B={...x,disabled:L},{labelId:V}=Yw(),q=Zw({id:i});tt(()=>{const Y=c!=null;M.inputRef.current?.value||Y&&c!==""?O(!0):Y&&c===""&&O(!1)},[M.inputRef,O,c]);const I=b.useRef(null);tt(()=>{g&&I.current===Zr(Zt(I.current))&&N(!0)},[g,N]);const[z]=kb({controlled:c,default:p,name:"FieldControl",state:"value"}),A=c!==void 0,P=A?z:void 0,U=dt(()=>M.inputRef.current?.value);return pA(M.inputRef,q,P,U,!L,l),bn("input",t,{ref:[n,I],state:B,props:[{id:q,disabled:L,name:G,ref:M.inputRef,"aria-labelledby":V,autoFocus:g,...A?{value:P}:{defaultValue:p},onChange(Y){const $=Y.currentTarget.value;d?.($,Ot(Zc,Y.nativeEvent)),j($!==(R.initialValue??"")),O($!==""),Y.nativeEvent.defaultPrevented||(T(G),M.change($))},onFocus(){N(!0)},onBlur(Y){_(!0),N(!1),k==="onBlur"&&M.commit(Y.currentTarget.value)},onKeyDown(Y){Y.currentTarget.tagName==="INPUT"&&Y.key==="Enter"&&(_(!0),M.commit(Y.currentTarget.value))}},v,Y=>M.getValidationProps(L,Y)],stateAttributesMapping:hA})}),KY=b.forwardRef(function(t,n){return h.jsx(GY,{ref:n,...t})});function ln({className:e,type:t,...n}){return h.jsx(KY,{type:t,"data-slot":"input",className:Nt("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function Im({className:e,...t}){return h.jsx("textarea",{"data-slot":"textarea",className:Nt("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function z2({className:e,...t}){return h.jsx("div",{"data-slot":"input-group",role:"group",className:Nt("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}const XY=zg("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function t0({className:e,align:t="inline-start",...n}){return h.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Nt(XY({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const QY=zg("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function WY({className:e,type:t="button",variant:n="ghost",size:r="xs",...o}){return h.jsx(ke,{type:t,"data-size":r,variant:n,className:Nt(QY({size:r}),e),...o})}function JY({className:e,...t}){return h.jsx(ln,{"data-slot":"input-group-control",className:Nt("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",e),...t})}function eZ(e,t=300){const[n,r]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function mS({onDebouncedChange:e,placeholder:t,delay:n=300,className:r}){const[o,i]=b.useState(""),l=eZ(o,n),c=b.useRef(e);return c.current=e,b.useEffect(()=>{c.current(l)},[l]),h.jsxs(z2,{className:r,children:[h.jsx(t0,{align:"inline-start",children:h.jsx(XM,{className:"size-4","aria-hidden":!0})}),h.jsx(JY,{type:"text",value:o,placeholder:t,maxLength:100,"aria-label":t??"搜索",onChange:f=>i(f.target.value)}),o.length>0&&h.jsx(t0,{align:"inline-end",children:h.jsx(WY,{size:"icon-xs","aria-label":"清空搜索",onClick:()=>i(""),children:h.jsx(ug,{className:"size-4","aria-hidden":!0})})})]})}const tZ={all:"全部状态",enabled:"启用",disabled:"停用"};function gS(e,t){return t==="all"?e:e.filter(n=>t==="disabled"?n.enabled===!1:n.enabled!==!1)}function yS({value:e,onChange:t,className:n}){return h.jsxs(br,{value:e,onValueChange:r=>{(r==="all"||r==="enabled"||r==="disabled")&&t(r)},children:[h.jsx(wr,{size:"sm",className:n??"w-28","aria-label":"状态筛选",children:tZ[e]}),h.jsxs(Sr,{children:[h.jsx(Bn,{value:"all",children:"全部状态"}),h.jsx(Bn,{value:"enabled",children:"启用"}),h.jsx(Bn,{value:"disabled",children:"停用"})]})]})}function nZ(e,t=!0,n){return co({queryKey:["agents",e,{includeDisabled:n?.includeDisabled,q:n?.q??""}],queryFn:()=>wU(e,n),enabled:t&&e.length>0,placeholderData:B0})}function rZ(e,t){return co({queryKey:["agent",e,t?.scope??"global",t?.projectId??"",t?.includeDisabled],queryFn:()=>SU(e,t),enabled:e.length>0})}function oZ(){const e=sn();return un({mutationFn:t=>EU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function sZ(){const e=sn();return un({mutationFn:({name:t,patch:n,scope:r,projectId:o})=>CU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]}),e.invalidateQueries({queryKey:["agent"]})}})}function iZ(){const e=sn();return un({mutationFn:({name:t,scope:n,projectId:r})=>_U(t,{...n!==void 0?{scope:n}:{},...r!==void 0?{projectId:r}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function aZ(){const e=sn();return un({mutationFn:({name:t,input:n,scope:r,projectId:o})=>RU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function lZ(){const e=sn();return un({mutationFn:({name:t,enabled:n,scope:r,projectId:o})=>jU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function vS({mutation:e,assetLabel:t,keyOf:n}){const{mutateAsync:r}=e,o=b.useCallback((l,c)=>{r(l).then(()=>{ut.success(`${t}「${c.name}」已${l.enabled?"启用":"停用"}`)}).catch(f=>{ut.error(Ct(f))})},[r,t,n]),i=e.isPending&&e.variables!==void 0?n(e.variables):null;return{toggle:o,togglingKey:i}}function xS(){return co({queryKey:["model-aliases"],queryFn:OU})}function cZ(){const{data:e}=xS();return b.useMemo(()=>{const t=new Map;for(const n of e??[])t.set(n.code,n);return t},[e])}function uZ(){const e=sn();return un({mutationFn:t=>MU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function dZ(){const e=sn();return un({mutationFn:({code:t,input:n})=>kU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function fZ(){const e=sn();return un({mutationFn:t=>AU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function L2(){return co({queryKey:["settings-enums"],queryFn:DU})}function Xn(e){const{data:t}=L2();return b.useMemo(()=>t?.find(r=>r.category===e)?.entries??[],[t,e])}function hZ(){const e=sn();return un({mutationFn:({category:t,input:n})=>PU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["settings-enums"]})}})}function pZ(){const e=sn();return un({mutationFn:({category:t,value:n})=>IU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["settings-enums"]})}})}function kr({className:e,...t}){return h.jsx("label",{"data-slot":"label",className:Nt("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function $2({open:e,onOpenChange:t,assetLabel:n,sourceName:r,projects:o,defaultTargetId:i,onSubmit:l}){const[c,f]=b.useState(""),[d,p]=b.useState("project"),[g,y]=b.useState(i),[v,x]=b.useState(!1),E=Xn("scope");b.useEffect(()=>{e&&(f(`${r}-copy`),p("project"),y(i),x(!1))},[e,r,i]);const S=/^[a-z0-9]+(-[a-z0-9]+)*$/.test(c),j=S&&(d==="global"||g!=="")&&!v,R=()=>{j&&(x(!0),l({newName:c,newScope:d,...d==="project"?{targetProjectId:g}:{}}).then(O=>{ut.success(`${n}已复制为「${O.name}」`),t(!1)}).catch(O=>{ut.error(Ct(O))}).finally(()=>x(!1)))},N=o.find(O=>O.id===g);return h.jsx(us,{open:e,onOpenChange:t,children:h.jsxs(ds,{className:"sm:max-w-sm",children:[h.jsxs(fs,{children:[h.jsxs(hs,{children:["复制",n]}),h.jsxs(ps,{children:["将「",r,"」复制到目标作用域;副本是全新资产,可独立编辑。"]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:`copy-${n}-scope`,children:"目标作用域"}),h.jsxs(br,{value:d,onValueChange:O=>{(O==="global"||O==="project")&&p(O)},children:[h.jsx(wr,{id:`copy-${n}-scope`,"aria-label":"目标作用域",className:"w-full",children:d==="global"?E.find(O=>O.value==="global")?.label??"全局":E.find(O=>O.value==="project")?.label??"项目"}),h.jsx(Sr,{children:E.map(O=>h.jsx(Bn,{value:O.value,children:O.label},O.value))})]})]}),d==="project"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:`copy-${n}-project`,children:"目标项目"}),h.jsxs(br,{value:g,onValueChange:O=>{O!==null&&y(O)},children:[h.jsx(wr,{id:`copy-${n}-project`,"aria-label":"目标项目",className:"w-full",children:N?N.name:"选择项目"}),h.jsx(Sr,{children:o.map(O=>h.jsx(Bn,{value:O.id,children:O.name},O.id))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:`copy-${n}-name`,children:"新名称"}),h.jsx(ln,{id:`copy-${n}-name`,value:c,placeholder:"kebab-case,如 code-review-copy",onChange:O=>f(O.target.value),onKeyDown:O=>{O.key==="Enter"&&R()}}),!S&&c.length>0&&h.jsx("p",{className:"text-xs text-destructive",children:"name 需为 kebab-case(小写字母/数字/中划线)"})]})]}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{variant:"outline"}),disabled:v,children:"取消"}),h.jsx(ke,{type:"button",disabled:!j,onClick:R,children:v?"复制中…":"复制"})]})]})})}function Hg(e){const[t,n]=cg(),r=t.get("projectId")??"",o=r?e.find(l=>l.id===r):void 0;return{overrideProjectId:r,scopedProject:o,exitScope:()=>{const l=new URLSearchParams(t);l.delete("projectId"),n(l,{replace:!0})}}}function Bg({project:e,onExit:t}){const n=e.status==="archived";return h.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-sm",role:"status",children:[h.jsx("span",{className:"text-muted-foreground",children:n?h.jsxs(h.Fragment,{children:["正在查看已停用项目「",e.name,"」的资产(只读;模板与专用资产仍可复制出到活跃项目)"]}):h.jsxs(h.Fragment,{children:["正在查看项目「",e.name,"」的资产"]})}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:t,children:"返回当前项目"})]})}function jo(e){const t=D5();b.useEffect(()=>{const r=t[t.length-1]?.handle?.meta,o=e??r?.title;o&&(document.title=o)},[t,e])}function Lf(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"—";const n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}const di=gu(),xN=e=>e.scope==="project"&&e.projectId?`/agents/${encodeURIComponent(e.name)}/edit?scope=project&projectId=${encodeURIComponent(e.projectId)}`:`/agents/${encodeURIComponent(e.name)}/edit`,mZ=e=>({name:e.name,enabled:e.enabled===!1,scope:e.scope,projectId:e.scope==="project"?e.projectId:void 0}),gZ=e=>e.name;function yZ(){jo();const e=Sa(),{activeProjectId:t,activeProjects:n,projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:l}=cs(),{overrideProjectId:c,scopedProject:f,exitScope:d}=Hg(r),p=f?.status==="archived",g=c||t,[y,v]=b.useState(""),x=nZ(g,o,{includeDisabled:!0,q:y||void 0}),E=cZ(),S=Xn("agent_function"),_=b.useMemo(()=>H=>S.find(Y=>Y.value===H)?.label.split("(")[0]??H,[S]),j=iZ(),R=aZ(),N=lZ(),[O,k]=b.useState("all"),{toggle:M,togglingKey:T}=vS({mutation:N,assetLabel:"代理",keyOf:gZ}),[L,G]=b.useState(null),[B,V]=b.useState(null),q=b.useMemo(()=>gS(x.data??[],O),[x.data,O]),I=b.useCallback(H=>r.find(Y=>Y.id===H)?.name??"未知项目",[r]),z=()=>{L&&j.mutateAsync({name:L.name,scope:L.scope,projectId:L.scope==="project"?L.projectId:void 0}).then(()=>{ut.success(`代理「${L.name}」已删除`),G(null)}).catch(H=>{ut.error(Ct(H)),G(null)})},A=b.useMemo(()=>[di.accessor("name",{id:"name",header:"名称",cell:H=>p&&H.row.original.scope==="project"?h.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:H.getValue()}):h.jsx("button",{type:"button",onClick:()=>e(xN(H.row.original)),className:"font-mono text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:H.getValue()})}),di.accessor("model",{id:"model",header:"模型",cell:H=>{const Y=E.get(H.getValue());return Y?h.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[Y.name," (",Y.realModel,")"]}):h.jsxs(Un,{variant:"secondary",children:["未匹配: ",H.getValue()]})}}),di.accessor("function",{id:"function",header:"功能类型",cell:H=>H.getValue()==="reviewer"?h.jsx(Un,{className:"bg-warning/10 text-warning",children:_(H.getValue())}):h.jsx(Un,{variant:"secondary",children:_(H.getValue())})}),di.accessor("scope",{id:"scope",header:"作用域",cell:H=>{const Y=H.row.original;return Y.scope==="global"?h.jsx(Un,{variant:"secondary",children:"全局"}):h.jsx(Un,{variant:"outline",children:I(Y.projectId)})}}),pS(),di.accessor("boundSkills",{id:"boundSkills",header:"绑定技能",cell:H=>h.jsxs(Un,{variant:"secondary",children:[H.getValue().length," 项"]})}),di.accessor("referenceCount",{id:"referenceCount",header:"引用",cell:H=>H.getValue()===void 0||H.getValue()===0?h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):h.jsx(Un,{variant:"secondary",children:H.getValue()})}),di.accessor("description",{id:"description",header:"描述",cell:H=>h.jsx(fS,{text:H.getValue()})}),di.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:H=>h.jsx("span",{className:"text-xs text-muted-foreground",children:Lf(H.getValue()??"")}),meta:{initialSortDesc:!0}}),di.display({id:"actions",header:"操作",cell:({row:H})=>{const Y=p&&H.original.scope==="project";return h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:Y,onClick:()=>e(xN(H.original)),children:"编辑"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>V(H.original),children:"复制"}),h.jsx(hS,{enabled:H.original.enabled,disabled:Y||T===H.original.name,onClick:()=>M(mZ(H.original),{name:H.original.name})}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:Y,onClick:()=>G(H.original),children:"删除"})]})}})],[I,p,E,e,_,M,T]),P=x.data??[],U=y.length>0;return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"代理库"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 配置与技能绑定管理"})]}),h.jsx(ke,{type:"button",disabled:!o||p,onClick:()=>e("/agents/new"),children:"+ 新建代理"})]}),f&&h.jsx(Bg,{project:f,onExit:d}),o&&(P.length>0||U)&&h.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[h.jsx(mS,{className:"w-full sm:max-w-xs",placeholder:"搜索代理名称…",onDebouncedChange:v}),h.jsx(yS,{value:O,onChange:k})]}),i?h.jsx(rr,{message:Ct(i),onRetry:l}):!o||x.isLoading?h.jsx(Ir,{rows:4,cols:10}):x.isError?h.jsx(rr,{message:Ct(x.error),onRetry:()=>{x.refetch()}}):P.length===0?U?h.jsx(tr,{message:`没有匹配「${y}」的代理,试试其他关键词`}):p?h.jsx(tr,{message:"该项目暂无专用代理(全局代理为空)"}):h.jsx(tr,{message:"还没有代理,点击「新建代理」创建第一个",actionLabel:"新建代理",onAction:()=>e("/agents/new")}):q.length===0?h.jsx(tr,{message:"当前筛选状态下没有代理,试试切换状态筛选"}):h.jsx("div",{className:x.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:h.jsx(vu,{columns:A,data:q})}),h.jsx(Ri,{open:L!==null,onOpenChange:H=>{H||G(null)},title:"删除代理",description:L?`确定删除代理「${L.name}」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:j.isPending,onConfirm:z}),h.jsx($2,{open:B!==null,onOpenChange:H=>{H||V(null)},assetLabel:"代理",sourceName:B?.name??"",projects:n,defaultTargetId:t,onSubmit:H=>R.mutateAsync({name:B?.name??"",input:H,scope:B?.scope,projectId:B?.projectId})})]})}var $f=e=>e.type==="checkbox",qg=e=>e.type==="file",mi=e=>e instanceof Date,yr=e=>e==null;const bS=e=>typeof e=="object";var Hn=e=>!yr(e)&&!Array.isArray(e)&&bS(e)&&!mi(e),n0=e=>Hn(e)&&e.target?$f(e.target)?e.target.checked:qg(e.target)?e.target.files:e.target.value:e,F2=(e,t)=>t.split(".").some((n,r,o)=>!isNaN(Number(n))&&e.has(o.slice(0,r).join("."))),V2=e=>{const t=e.constructor&&e.constructor.prototype;return Hn(t)&&t.hasOwnProperty("isPrototypeOf")},Yg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ln(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Yg&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Hn(e)&&V2(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=Ln(e[o]));return r}const ia={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ns={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Jo={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},U2="root",wS=["__proto__","constructor","prototype"],vZ=/^\w*$/;var Qc=e=>vZ.test(e),kn=e=>e===void 0;const xZ=/[.[\]'"]/;var ef=e=>e.split(xZ).filter(Boolean),qe=(e,t,n)=>{if(!t||!Hn(e))return n;const r=Qc(t)?[t]:ef(t);if(r.some(i=>wS.includes(i)))return n;const o=r.reduce((i,l)=>yr(i)?void 0:i[l],e);return kn(o)||o===e?kn(e[t])?n:e[t]:o},So=e=>typeof e=="boolean",Vr=e=>typeof e=="function",an=(e,t,n)=>{let r=-1;const o=Qc(t)?[t]:ef(t),i=o.length,l=i-1;for(;++r<i;){const c=o[r];let f=n;if(r!==l){const d=e[c];f=Hn(d)||Array.isArray(d)?d:isNaN(+o[r+1])?{}:[]}if(wS.includes(c))return;e[c]=f,e=e[c]}};const SS=Ee.createContext(null);SS.displayName="HookFormControlContext";const ES=()=>Ee.useContext(SS);var H2=(e,t,n,r=!0)=>{const o={};for(const i in e)Object.defineProperty(o,i,{get:()=>{const l=i;return t._proxyFormState[l]!==ns.all&&(t._proxyFormState[l]=!r||ns.all),n&&(n[l]=!0),e[l]}});return o};const CS=Yg?Ee.useLayoutEffect:Ee.useEffect;var r0=e=>yr(e)||!bS(e);const bN=(e,t)=>t.length===0&&!Array.isArray(e)&&!V2(e);function oo(e,t,n=new WeakMap){if(e===t)return!0;if(r0(e)||r0(t))return Object.is(e,t);if(mi(e)&&mi(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(bN(e,r)||bN(t,o))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=n.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const l=new WeakSet;l.add(t),n.set(e,l)}for(const l of r){const c=e[l];if(!(l in t))return!1;if(l!=="ref"){const f=t[l];if(mi(c)&&mi(f)||(Hn(c)||Array.isArray(c))&&(Hn(f)||Array.isArray(f))?!oo(c,f,n):!Object.is(c,f))return!1}}return!0}function _S(){const e=Ee.useRef(!1),t=Ee.useRef(void 0),n=Ee.useCallback((o,i,l)=>{if(o&&e.current){const c=i();oo(t.current,c)||l(c)}e.current=!0},[]),r=Ee.useCallback((o,i)=>{o&&(t.current=Ln(i()))},[]);return{resyncIfNeeded:n,snapshot:r}}function bZ(e){const t=ES(),{control:n=t,disabled:r,name:o,exact:i}=e||{},[l,c]=Ee.useState(()=>({...n._formState,defaultValues:n._defaultValues})),f=Ee.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:d,snapshot:p}=_S();return CS(()=>{const g=()=>({...n._formState,defaultValues:n._defaultValues});d(!r,g,c);const y=n._subscribe({name:o,formState:f.current,exact:i,callback:v=>{!r&&c({...n._formState,...v,defaultValues:n._defaultValues})}});return()=>{y(),p(!r,g)}},[o,r,i,d,p]),Ee.useEffect(()=>{f.current.isValid&&n._setValid(!0)},[n]),Ee.useMemo(()=>H2(l,n,f.current,!1),[l,n])}var Mr=e=>typeof e=="string",o0=(e,t,n,r,o)=>Mr(e)?(r&&t.watch.add(e),qe(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),qe(n,i))):(r&&(t.watchAll=!0),n);function wZ(e){const t=ES(),{control:n=t,name:r,defaultValue:o,disabled:i,exact:l,compute:c}=e||{},f=Ee.useRef(o),d=Ee.useRef(c),p=Ee.useRef(void 0),g=Ee.useRef(n),y=Ee.useRef(r);d.current=c;const[v,x]=Ee.useState(()=>{const T=n._getWatch(r,f.current);return d.current?d.current(T):T}),E=Ee.useCallback(T=>{const L=o0(r,n._names,T||n._formValues,!1,f.current);return d.current?d.current(L):L},[n._formValues,n._names,r]),S=Ee.useCallback(T=>{if(!i){const L=o0(r,n._names,T||n._formValues,!1,f.current);if(d.current){const G=d.current(L);oo(G,p.current)||(x(G),p.current=G)}else x(L)}},[n._formValues,n._names,i,r]),{resyncIfNeeded:_,snapshot:j}=_S(),R=Ee.useRef(S);R.current=S;const N=Ee.useRef(E);N.current=E,CS(()=>{g.current!==n||!oo(y.current,r)?(g.current=n,y.current=r,R.current()):_(!i,()=>N.current(),L=>{x(L),p.current=L});const T=n._subscribe({name:r,formState:{values:!0},exact:l,callback:L=>{R.current(L.values)}});return()=>{T(),j(!i,()=>N.current())}},[n,l,r,i,_,j]),Ee.useEffect(()=>n._removeUnmounted());const O=g.current!==n,k=y.current,M=Ee.useMemo(()=>{if(i)return null;const T=!O&&!oo(k,r);return O||T?E():null},[i,O,r,k,E]);return M!==null?M:v}function SZ(e){const t=ES(),{name:n,disabled:r,control:o=t,shouldUnregister:i,defaultValue:l,exact:c=!0}=e,f=F2(o._names.array,n),d=Ee.useMemo(()=>qe(o._formValues,n,qe(o._defaultValues,n,l)),[o,n,l]),p=wZ({control:o,name:n,defaultValue:d,exact:c}),g=bZ({control:o,name:n,exact:c}),y=Ee.useRef(e),v=Ee.useRef(null),x=Ee.useRef(o.register(n,{...e.rules,value:p,...So(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const E=Ee.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!qe(g.errors,n)},isDirty:{enumerable:!0,get:()=>!!qe(g.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!qe(g.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!qe(g.validatingFields,n)},error:{enumerable:!0,get:()=>qe(g.errors,n)}}),[g,n]),S=Ee.useCallback(N=>{const O=n0(N);return qe(o._fields,n)||(x.current=o.register(n,{...y.current.rules,value:O})),x.current.onChange({target:{value:n0(N),name:n},type:ia.CHANGE})},[n,o]),_=Ee.useCallback(()=>x.current.onBlur({target:{value:qe(o._formValues,n),name:n},type:ia.BLUR}),[n,o._formValues]),j=Ee.useCallback(N=>{N&&(v.current={focus:()=>Vr(N.focus)&&N.focus(),select:()=>Vr(N.select)&&N.select(),setCustomValidity:k=>Vr(N.setCustomValidity)&&N.setCustomValidity(k),reportValidity:()=>Vr(N.reportValidity)&&N.reportValidity()});const O=qe(o._fields,n);O&&O._f&&N&&(O._f.ref=v.current)},[o._fields,n]),R=Ee.useMemo(()=>({name:n,value:p,...So(r)||g.disabled?{disabled:g.disabled||r}:{},onChange:S,onBlur:_,ref:j}),[n,r,g.disabled,S,_,j,p]);return Ee.useEffect(()=>{const N=o._options.shouldUnregister||i;x.current=o.register(n,{...y.current.rules,...So(y.current.disabled)?{disabled:y.current.disabled}:{}});const O=(k,M)=>{const T=qe(o._fields,k);T&&T._f&&(T._f.mount=M)};if(O(n,!0),N){const k=Ln(qe(i?o._defaultValues:o._options.values||o._defaultValues,n,qe(o._options.defaultValues,n,y.current.defaultValue)));an(o._defaultValues,n,k),kn(qe(o._formValues,n))&&an(o._formValues,n,k)}if(!f&&o.register(n),v.current){const k=qe(o._fields,n);k&&k._f&&(k._f.ref=v.current)}return()=>{(f?N&&!o._state.action:N)?o.unregister(n):O(n,!1)}},[n,o,f,i]),Ee.useEffect(()=>{o._setDisabledField({disabled:r,name:n})},[r,n,o]),Ee.useMemo(()=>({field:R,formState:g,fieldState:E}),[R,g,E])}const EZ=e=>e.render(SZ(e));var Tp=e=>({isOnSubmit:!e||e===ns.onSubmit,isOnBlur:e===ns.onBlur,isOnChange:e===ns.onChange,isOnAll:e===ns.all,isOnTouch:e===ns.onTouched}),Zx=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&e.charAt(r.length)===".")return!0;return!1};const Hd=(e,t,n,r)=>{for(const o of n||Object.keys(e)){if(o==="_f")continue;const i=n?qe(e,o):e[o];if(i){const{_f:l}=i;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],o)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(Hd(i,t))break}else if((Hn(i)||Array.isArray(i))&&Hd(i,t))break}}};var wN=(e,t,n)=>{const r=qe(e,n),o=Array.isArray(r)?r:[];return an(o,U2,t[n]),an(e,n,o),e},Or=e=>Hn(e)&&!Object.keys(e).length,zm=e=>{if(!Yg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},RS=e=>e.type==="radio",Lm=e=>e instanceof RegExp,jS=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{};const SN={value:!1,isValid:!1},EN={value:!0,isValid:!0};var B2=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!kn(e[0].attributes.value)?kn(e[0].value)||e[0].value===""?EN:{value:e[0].value,isValid:!0}:EN:SN}return SN};const CN={isValid:!1,value:null};var q2=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,CN):CN;function _N(e,t,n="validate"){if(Mr(e)||Array.isArray(e)&&e.every(Mr)||So(e)&&!e)return{type:n,message:Mr(e)?e:"",ref:t}}var pc=e=>Hn(e)&&!Lm(e)?e:{value:e,message:""},RN=async(e,t,n,r,o,i)=>{const{ref:l,refs:c,required:f,maxLength:d,minLength:p,min:g,max:y,pattern:v,validate:x,name:E,valueAsNumber:S,mount:_}=e._f,j=qe(n,E);if(!_||t.has(E))return{};const R=c?c[0]:l,N=V=>{if(o&&R.reportValidity){const q=So(V)?"":V||"";c?c.forEach(I=>I.setCustomValidity(q)):R.setCustomValidity(q),R.reportValidity()}},O={},k=RS(l),M=$f(l),T=k||M,L=(S||qg(l))&&kn(l.value)&&kn(j)||zm(l)&&l.value===""||j===""||Array.isArray(j)&&!j.length,G=jS.bind(null,E,r,O),B=(V,q,I,z=Jo.maxLength,A=Jo.minLength)=>{const P=V?q:I;O[E]={type:V?z:A,message:P,ref:l,...G(V?z:A,P)}};if(i?!Array.isArray(j)||!j.length:f&&(!T&&(L||yr(j))||So(j)&&!j||M&&!B2(c).isValid||k&&!q2(c).isValid)){const{value:V,message:q}=Mr(f)?{value:!!f,message:f}:pc(f);if(V&&(O[E]={type:Jo.required,message:q,ref:R,...G(Jo.required,q)},!r))return N(q),O}if(!L&&(!yr(g)||!yr(y))){let V,q;const I=pc(y),z=pc(g);if(!yr(j)&&!mi(j)&&!isNaN(j)){const A=l.valueAsNumber||j&&+j;yr(I.value)||(V=A>I.value),yr(z.value)||(q=A<z.value)}else{const A=l.valueAsDate||new Date(j),P=Y=>new Date(new Date().toDateString()+" "+Y),U=l.type=="time",H=l.type=="week";Mr(I.value)&&j&&(V=U?P(j)>P(I.value):H?j>I.value:A>new Date(I.value)),Mr(z.value)&&j&&(q=U?P(j)<P(z.value):H?j<z.value:A<new Date(z.value))}if((V||q)&&(B(!!V,I.message,z.message,Jo.max,Jo.min),!r))return N(O[E].message),O}if((d||p)&&!L&&(Mr(j)||i&&Array.isArray(j))){const V=pc(d),q=pc(p),I=!yr(V.value)&&j.length>+V.value,z=!yr(q.value)&&j.length<+q.value;if((I||z)&&(B(I,V.message,q.message),!r))return N(O[E].message),O}if(v&&!L&&Mr(j)){const{value:V,message:q}=pc(v);if(Lm(V)&&!j.match(V)&&(O[E]={type:Jo.pattern,message:q,ref:l,...G(Jo.pattern,q)},!r))return N(q),O}if(x){if(Vr(x)){const V=await x(j,n),q=_N(V,R);if(q&&(O[E]={...q,...G(Jo.validate,q.message)},!r))return N(q.message),O}else if(Hn(x)){let V={};for(const q in x){if(!Or(V)&&!r)break;const I=_N(await x[q](j,n),R,q);I&&(V={...I,...G(q,I.message)},N(I.message),r&&(O[E]=V))}if(!Or(V)&&(O[E]={ref:R,...V},!r))return O}}return N(!0),O},om=e=>Array.isArray(e)?e:[e],Y2=e=>Array.isArray(e)?e.filter(Boolean):[];function CZ(e,t){const n=t.length-1;let r=0;for(;r<n;){if(yr(e)){e=void 0;break}e=e[t[r]],r++}return e}function _Z(e){for(const t in e)if(e.hasOwnProperty(t)&&!kn(e[t]))return!1;return!0}function Jn(e,t){if(Mr(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:Qc(t)?[t]:ef(t);if(n.some(l=>wS.includes(String(l))))return e;const r=n.length===1?e:CZ(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(Hn(r)&&Or(r)||Array.isArray(r)&&_Z(r))&&Jn(e,n.slice(0,-1)),e}const Z2=e=>{const t={};for(const n of Object.keys(e))if(bS(e[n])&&e[n]!==null&&!mi(e[n])){const r=Z2(e[n]);for(const o of Object.keys(r))t[`${n}.${o}`]=r[o]}else t[n]=e[n];return t},NS=Ee.createContext(null);NS.displayName="HookFormContext";const RZ=()=>Ee.useContext(NS),jZ=({children:e,watch:t,getValues:n,getFieldState:r,setError:o,clearErrors:i,setValue:l,setValues:c,trigger:f,formState:d,resetField:p,reset:g,resetDefaultValues:y,handleSubmit:v,unregister:x,control:E,register:S,setFocus:_,subscribe:j})=>{const R=Ee.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:o,clearErrors:i,setValue:l,setValues:c,trigger:f,formState:d,resetField:p,reset:g,resetDefaultValues:y,handleSubmit:v,unregister:x,control:E,register:S,setFocus:_,subscribe:j}),[i,E,d,r,n,v,S,g,y,p,o,_,l,c,j,f,x,t]);return Ee.createElement(NS.Provider,{value:R},Ee.createElement(SS.Provider,{value:R.control},e))};var jN=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function G2(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&Hn(o)&&i){const l=G2(o,i);Hn(l)&&(n[r]=l)}else e[r]&&(n[r]=i)}return n}var K2=e=>e.type==="select-multiple",NZ=e=>RS(e)||$f(e),Gx=e=>zm(e)&&e.isConnected;function NN(e){return Array.isArray(e)||Hn(e)}function X2(e,t,n="",r=[]){for(const o in e){const i=n?`${n}.${o}`:o,l=e[o];NN(l)&&NN(qe(t,i))?X2(l,t,i,r):r.push(i)}return r}var TZ=e=>{for(const t in e)if(Vr(e[t]))return!0;return!1};function Q2(e){return Array.isArray(e)||Hn(e)&&!TZ(e)}function W2(e){return!!(e&&"_f"in e)}function J2(e){return Array.isArray(e)?!e.some(t=>!kn(t)):!Object.keys(e).length}function s0(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function i0(e,t={},n){for(const r in e){const o=e[r],i=n&&n[r];Q2(o)&&(!Array.isArray(o)||!W2(i))?(t[r]=Array.isArray(o)?[]:{},i0(o,t[r],i),J2(t[r])&&s0(t,r)):kn(o)||(t[r]=!0)}return t}function Wa(e,t,n,r){n||(n=i0(t,{},r));for(const o in e){const i=e[o],l=r&&r[o];Q2(i)&&(!Array.isArray(i)||!W2(l))?(kn(t)||r0(n[o])?n[o]=i0(i,Array.isArray(i)?[]:{},l):Wa(i,yr(t)?{}:t[o],n[o],l),J2(n[o])&&s0(n,o)):oo(i,t[o])?s0(n,o):n[o]=!0}return n}var eD=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>kn(e)?e:t?e===""?NaN:e&&+e:n&&Mr(e)?new Date(e):r?r(e):e;function TN(e){const t=e.ref;return qg(t)?t.files:RS(t)?q2(e.refs).value:K2(t)?[...t.selectedOptions].map(({value:n})=>n):$f(t)?B2(e.refs).value:eD(t.value,e)}var OZ=(e,t,n,r)=>{const o={};for(const i of e){const l=qe(t,i);l&&an(o,i,l._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},bd=e=>kn(e)?e:Lm(e)?e.source:Hn(e)?Lm(e.value)?e.value.source:e.value:e;const ON="AsyncFunction";var MZ=e=>{if(!e||!e.validate)return!1;if(Vr(e.validate))return e.validate.constructor.name===ON;if(Hn(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===ON)return!0}return!1},kZ=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function MN(e,t,n){const r=qe(e,n);if(r||Qc(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),l=qe(t,i),c=qe(e,i);if(l&&!Array.isArray(l)&&n!==i)return{name:n};if(c&&c.type)return{name:i,error:c};if(c&&c.root&&c.root.type)return{name:`${i}.root`,error:c.root};o.pop()}return{name:n}}var AZ=(e,t,n,r)=>{n(e);const o=Object.keys(e).filter(i=>i!=="name");return!o.length||r&&o.length>=Object.keys(t).length||o.find(i=>t[i]===(!r||ns.all))},DZ=(e,t,n)=>!e||!t||e===t||om(e).some(r=>r&&(n?r===t||r.startsWith(t+"."):r.startsWith(t)||t.startsWith(r))),PZ=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,IZ=(e,t)=>{const n=qe(e,t);!Y2(n).length&&!n?.root&&Jn(e,t)};const zZ={mode:ns.onSubmit,reValidateMode:ns.onChange,shouldFocusError:!0},Kx="form",LZ=(e,t)=>{for(const n in e)n in t||delete e[n];Object.assign(e,t)},tD={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function $Z(e={}){let t={...zZ,...e},n={...Ln(tD),isLoading:Vr(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},o=Hn(t.defaultValues)||Hn(t.values)?Ln(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ln(o),l={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const f={},d={};let p=0,g=Tp(t.mode),y=Tp(t.reValidateMode);const v={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={...v};let E={...x};const S={array:jN(),state:jN()};let _=0;const j=t.criteriaMode===ns.all,R=(W,ie)=>ae=>{clearTimeout(d[W]),d[W]=setTimeout(ie,ae)},N=async W=>{if(!l.keepIsValid&&!t.disabled&&(x.isValid||E.isValid||W)){const ie=++_;let ae;t.resolver?(ae=Or((await z()).errors),ie===_&&O()):ae=await U({fields:r,onlyCheckValid:!0,eventType:ia.VALID}),ie===_&&ae!==n.isValid&&S.state.next({isValid:ae})}},O=(W,ie)=>{!t.disabled&&(x.isValidating||x.validatingFields||E.isValidating||E.validatingFields)&&((W||Array.from(c.mount)).forEach(ae=>{ae&&(ie?an(n.validatingFields,ae,ie):Jn(n.validatingFields,ae))}),S.state.next({validatingFields:n.validatingFields,isValidating:!Or(n.validatingFields)}))},k=()=>{n.dirtyFields=Wa(o,i,void 0,r)},M=(W,ie=[],ae,Se,be=!0,Ve=!0)=>{if(Se&&ae&&!t.disabled){if(l.action=!0,!l.actionArrayLengths.has(W)){const Me=qe(r,W);l.actionArrayLengths.set(W,Array.isArray(Me)?Me.length:0)}if(Ve&&Array.isArray(qe(r,W))){const Me=ae(qe(r,W),Se.argA,Se.argB);be&&an(r,W,Me)}if(Ve&&Array.isArray(qe(n.errors,W))){const Me=qe(n.errors,W),$e=Me.root,He=ae(Me,Se.argA,Se.argB)||Me;$e&&(He.root=$e),be&&an(n.errors,W,He),IZ(n.errors,W)}if((x.touchedFields||E.touchedFields)&&Ve&&Array.isArray(qe(n.touchedFields,W))){const Me=ae(qe(n.touchedFields,W),Se.argA,Se.argB);be&&an(n.touchedFields,W,Me)}(x.dirtyFields||E.dirtyFields)&&k(),S.state.next({name:W,isDirty:Y(W,ie),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else an(i,W,ie)},T=(W,ie)=>{an(n.errors,W,ie),n.errors={...n.errors},S.state.next({errors:n.errors})},L=W=>{n.errors=W,S.state.next({errors:n.errors,isValid:!1})},G=W=>{const ie=Qc(W)?[W]:ef(W);let ae=i,Se=o;for(let be=0;be<ie.length-1;be++){const Ve=ie[be];if(ae=yr(ae)?ae:ae[Ve],Se=yr(Se)?Se:Se[Ve],ae===null&&Se!==null)return!0}return!1},B=W=>{if(!l.actionArrayLengths.size)return!1;const ie=Qc(W)?[W]:ef(W);let ae=i,Se="",be=-1,Ve=0;for(let Me=0;Me<ie.length;Me++){if(yr(ae))return!1;const $e=ie[Me];if(Se=Se?`${Se}.${$e}`:$e,Array.isArray(ae)&&+$e>=ae.length)return be===-1?!1:Me===be?+$e<Ve:!0;l.actionArrayLengths.has(Se)&&(be=Me+1,Ve=l.actionArrayLengths.get(Se)),ae=ae[$e]}return!1},V=(W,ie,ae,Se)=>{const be=qe(r,W);if(be){if(G(W)||B(W))return;const Ve=kn(qe(i,W)),Me=qe(i,W,kn(ae)?qe(o,W):ae);kn(Me)||Se&&Se.defaultChecked||ie?an(i,W,ie?Me:TN(be._f)):Q(W,Me),l.mount&&!l.action&&(N(),Ve&&n.isDirty&&(x.isDirty||E.isDirty)&&(Y()||(n.isDirty=!1,S.state.next({...n}))),e.shouldUnregister&&Ve&&!kn(qe(i,W))&&Zx(W,c)&&(l.watch=!0))}},q=(W,ie,ae,Se,be)=>{let Ve=!1,Me=!1;const $e={name:W};if(!t.disabled||Se===!0){if(!ae||Se){const He=oo(qe(o,W),ie);(x.isDirty||E.isDirty)&&(Me=n.isDirty,n.isDirty=$e.isDirty=!He||Y(),Ve=Me!==$e.isDirty),Me=!!qe(n.dirtyFields,W),He!==n.isDirty?LZ(n.dirtyFields,Wa(o,i,void 0,r)):He?Jn(n.dirtyFields,W):an(n.dirtyFields,W,!0),$e.dirtyFields=n.dirtyFields,Ve=Ve||(x.dirtyFields||E.dirtyFields)&&Me!==!He}if(ae){const He=qe(n.touchedFields,W);He||(an(n.touchedFields,W,ae),$e.touchedFields=n.touchedFields,Ve=Ve||(x.touchedFields||E.touchedFields)&&He!==ae)}Ve&&be&&S.state.next($e)}return Ve?$e:{}},I=(W,ie,ae,Se)=>{const be=qe(n.errors,W),Ve=(x.isValid||E.isValid)&&So(ie)&&n.isValid!==ie;if(t.delayError&&ae?(f[W]=R(W,()=>T(W,ae)),f[W](t.delayError)):(clearTimeout(d[W]),delete f[W],ae?an(n.errors,W,ae):Jn(n.errors,W),n.errors={...n.errors}),(ae?!oo(be,ae):be)||!Or(Se)||Ve){const Me={...Se,...Ve&&So(ie)?{isValid:ie}:{},errors:n.errors,name:W};n={...n,...Me},S.state.next(Me)}},z=async W=>(O(W,!0),await t.resolver(i,t.context,OZ(W||c.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),A=async W=>{const{errors:ie}=await z(W);if(O(W),W){for(const ae of W){const Se=qe(ie,ae);Se?c.array.has(ae)&&Hn(Se)&&!Object.keys(Se).some(be=>!Number.isNaN(Number(be)))?wN(n.errors,{[ae]:Se},ae):an(n.errors,ae,Se):Jn(n.errors,ae)}n.errors={...n.errors}}else n.errors=ie;return ie},P=async({name:W,eventType:ie})=>{if(e.validate){const ae=await e.validate({formValues:i,formState:n,name:W,eventType:ie});if(Hn(ae))for(const Se in ae){const be=ae[Se];be&&Re(`${Kx}.${Se}`,{message:Mr(be.message)?be.message:"",type:be.type||Jo.validate})}else Mr(ae)||!ae?Re(Kx,{message:ae||"",type:Jo.validate}):he(Kx);return ae}return!0},U=async({fields:W,onlyCheckValid:ie,name:ae,eventType:Se,context:be={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(be.runRootValidation=!0,!await P({name:ae,eventType:Se})&&(be.valid=!1,ie)))return be.valid;for(const Ve in W){const Me=W[Ve];if(Me){const{_f:$e,...He}=Me;if($e){const Xe=c.array.has($e.name),Je=Me._f&&MZ(Me._f),bt=x.validatingFields||x.isValidating||E.validatingFields||E.isValidating;Je&&bt&&O([$e.name],!0);const Mt=await RN(Me,c.disabled,i,j,t.shouldUseNativeValidation&&!ie,Xe);if(Je&&bt&&O([$e.name]),Mt[$e.name]&&(be.valid=!1,ie)||(!ie&&(qe(Mt,$e.name)?Xe?wN(n.errors,Mt,$e.name):an(n.errors,$e.name,Mt[$e.name]):Jn(n.errors,$e.name)),e.shouldUseNativeValidation&&Mt[$e.name]))break}!Or(He)&&await U({context:be,onlyCheckValid:ie,fields:He,name:Ve,eventType:Se})}}return be.valid},H=()=>{for(const W of c.unMount){const ie=qe(r,W);ie&&(ie._f.refs?ie._f.refs.every(ae=>!Gx(ae)):!Gx(ie._f.ref))&&Qe(W)}c.unMount=new Set},Y=(W,ie)=>(W&&ie&&an(i,W,ie),!oo(l.mount?i:o,o)),$=(W,ie,ae)=>o0(W,c,{...l.mount?i:kn(ie)||Mr(W)?o:ie},ae,ie),F=W=>Y2(qe(l.mount?i:o,W,t.shouldUnregister?qe(o,W,[]):[])),Q=(W,ie,ae={},Se=!1,be=!1,Ve=!1)=>{const Me=qe(r,W);let $e=ie;if(Me){const He=Me._f;He&&(!He.disabled&&an(i,W,eD(ie,He)),$e=zm(He.ref)&&yr(ie)?"":ie,K2(He.ref)?[...He.ref.options].forEach(Xe=>Xe.selected=$e.includes(Xe.value)):He.refs?$f(He.ref)?He.refs.forEach(Xe=>{(!Xe.defaultChecked||!Xe.disabled)&&(Array.isArray($e)?Xe.checked=!!$e.find(Je=>Je===Xe.value):Xe.checked=$e===Xe.value||!!$e)}):He.refs.forEach(Xe=>Xe.checked=Xe.value===$e):qg(He.ref)?He.ref.value="":(He.ref.value=$e,!He.ref.type&&!be&&!Ve&&S.state.next({name:W,values:Se?i:Ln(i)})))}(ae.shouldDirty||ae.shouldTouch)&&q(W,$e,ae.shouldTouch,ae.shouldDirty,!be),ae.shouldValidate&&ye(W,{delayError:ae.delayError})},X=(W,ie,ae,Se=!1,be=!1,Ve=!1)=>{c.array.has(W)&&S.array.next({name:W,values:Se?i:Ln(i)});for(const Me in ie){if(!ie.hasOwnProperty(Me))return;const $e=ie[Me],He=W+"."+Me,Xe=qe(r,He);(c.array.has(W)||Hn($e)||Xe&&!Xe._f)&&!mi($e)?X(He,$e,ae,Se,be,Ve):Q(He,$e,ae,Se,be,Ve)}},ne=(W,ie,ae,Se,be=!1)=>{const Ve=qe(r,W),Me=c.array.has(W),$e=Se?ie:Ln(ie),He=qe(i,W),Xe=oo(He,$e);if(Xe||an(i,W,$e),Me)S.array.next({name:W,values:Se?i:Ln(i)}),(x.isDirty||x.dirtyFields||E.isDirty||E.dirtyFields)&&ae.shouldDirty&&(k(),be||S.state.next({name:W,dirtyFields:n.dirtyFields,isDirty:Y(W,$e)}));else{const Je=Array.isArray($e)&&!$e.length||Or($e),bt=!Xe&&!be;!Ve||Ve._f||yr($e)||Je?Q(W,$e,ae,Se,be,bt):X(W,$e,ae,Se,be,bt)}if(!Xe&&!be){const Je=Zx(W,c),bt=Se?i:Ln(i);S.state.next({...Je&&n,name:l.mount||Je?W:void 0,values:bt})}},te=(W,ie,ae={})=>ne(W,ie,ae,!1),J=(W,ie={})=>{const ae=Vr(W)?W(i):W;if(!oo(i,ae)){i={...i,...ae};const Se=Z2(ae);for(const be of c.mount)be in Se&&ne(be,Se[be],ie,!0,!0);S.state.next({...n,name:void 0,type:void 0,...p?{values:i}:{}}),ie.shouldValidate&&N()}},K=async W=>{l.mount=!0;const ie=W.target;let ae=ie.name,Se=!0;const be=qe(r,ae),Ve=Me=>{Se=Number.isNaN(Me)||mi(Me)&&isNaN(Me.getTime())||oo(Me,qe(i,ae,Me))};if(be){let Me,$e;const He=ie.type?TN(be._f):n0(W),Xe=W.type===ia.BLUR||W.type===ia.FOCUS_OUT,Je=!kZ(be._f)&&!e.validate&&!t.resolver&&!qe(n.errors,ae)&&!be._f.deps,bt=Je||PZ(Xe,qe(n.touchedFields,ae),n.isSubmitted,y,g),Mt=Zx(ae,c,Xe);if(an(i,ae,He),Xe){if(!ie||!ie.readOnly){be._f.onBlur&&be._f.onBlur(W);const wt=f[ae];wt&&wt(0)}}else be._f.onChange&&be._f.onChange(W);const kt=q(ae,He,Xe),nt=!Or(kt)||Mt;if(!Xe&&S.state.next({name:ae,type:W.type,...p?{values:Ln(i)}:{}}),bt)return(!Je||!n.isValid)&&(x.isValid||E.isValid)&&(t.mode==="onBlur"?Xe&&N():Xe||N()),nt&&S.state.next({name:ae,...Mt?{}:kt});if(!t.resolver&&e.validate&&await P({name:ae,eventType:W.type}),!Xe&&Mt&&S.state.next({...n}),t.resolver){const{errors:wt}=await z([ae]);if(O([ae]),Ve(He),!Se){!Or(kt)&&S.state.next(kt);return}const Dt=MN(n.errors,r,ae),St=MN(wt,r,Dt.name||ae);Me=St.error,ae=St.name,$e=Or(wt)}else O([ae],!0),Me=(await RN(be,c.disabled,i,j,t.shouldUseNativeValidation))[ae],O([ae]),Ve(He),Se&&(Me?$e=!1:(x.isValid||E.isValid)&&($e=await U({fields:r,onlyCheckValid:!0,name:ae,eventType:W.type})));Se&&(be._f.deps&&(!Array.isArray(be._f.deps)||be._f.deps.length>0)&&ye(be._f.deps),I(ae,$e,Me,kt))}},re=(W,ie)=>{if(qe(n.errors,ie)&&W.focus)return W.focus(),1},ye=async(W,ie={})=>{let ae,Se;const be=om(W);if(t.resolver){const Ve=await A(kn(W)?W:be);ae=Or(Ve),Se=W?!be.some(Me=>qe(Ve,Me)):ae}else W?(Se=(await Promise.all(be.map(async Ve=>{const Me=qe(r,Ve);return await U({fields:Me&&Me._f?{[Ve]:Me}:Me,eventType:ia.TRIGGER})}))).every(Boolean),!(!Se&&!n.isValid)&&N()):Se=ae=await U({fields:r,name:W,eventType:ia.TRIGGER});if(ie.delayError&&t.delayError&&Mr(W)){const Ve=qe(n.errors,W);Ve?(Jn(n.errors,W),f[W]=R(W,()=>T(W,Ve)),f[W](t.delayError)):(clearTimeout(d[W]),delete f[W])}return S.state.next({...!Mr(W)||(x.isValid||E.isValid)&&ae!==n.isValid?{}:{name:W},...t.resolver||!W?{isValid:ae}:{},errors:n.errors}),ie.shouldFocus&&!Se&&Hd(r,re,W?be:c.mount),Se},fe=(W,ie)=>{let ae={...l.mount?i:o};return ie&&(ae=G2(ie.dirtyFields?n.dirtyFields:n.touchedFields,ae)),kn(W)?ae:Mr(W)?qe(ae,W):W.map(Se=>qe(ae,Se))},ue=(W,ie)=>({invalid:!!qe((ie||n).errors,W),isDirty:!!qe((ie||n).dirtyFields,W),error:qe((ie||n).errors,W),isValidating:!!qe(n.validatingFields,W),isTouched:!!qe((ie||n).touchedFields,W)}),he=W=>{const ie=W?om(W):void 0;ie?.forEach(ae=>Jn(n.errors,ae)),ie?ie.forEach(ae=>{S.state.next({name:ae,errors:n.errors})}):(n.errors={},S.state.next({errors:n.errors}))},Re=(W,ie,ae)=>{const Se=(qe(r,W,{_f:{}})._f||{}).ref,be=qe(n.errors,W)||{},{ref:Ve,message:Me,type:$e,...He}=be;an(n.errors,W,{...He,...ie,ref:Se}),S.state.next({name:W,errors:n.errors,isValid:!1}),ae&&ae.shouldFocus&&Se&&Se.focus&&Se.focus()},ze=(W,ie)=>{if(Vr(W)){p++;const{unsubscribe:ae}=S.state.subscribe({next:be=>"values"in be&&W(be.values||$(void 0,ie),be)});let Se=!1;return{unsubscribe:()=>{Se||(Se=!0,p--,ae())}}}return $(W,ie,!0)},Ue=W=>{var ie;const ae=!!(!((ie=W.formState)===null||ie===void 0)&&ie.values);ae&&p++;const{unsubscribe:Se}=S.state.subscribe({next:Ve=>{if(DZ(W.name,Ve.name,W.exact)&&AZ(Ve,W.formState||x,Ie,W.reRenderRoot)){const Me={...i};W.callback({values:Me,...n,...Ve,defaultValues:o})}}});if(!ae)return Se;let be=!1;return()=>{be||(be=!0,p--,Se())}},Ae=W=>(l.mount=!0,E={...E,...W.formState},Ue({...W,formState:{...v,...W.formState}})),Qe=(W,ie={})=>{for(const ae of W?om(W):c.mount)c.mount.delete(ae),c.array.delete(ae),ie.keepValue||(Jn(r,ae),Jn(i,ae)),!ie.keepError&&Jn(n.errors,ae),!ie.keepDirty&&Jn(n.dirtyFields,ae),!ie.keepTouched&&Jn(n.touchedFields,ae),!ie.keepIsValidating&&Jn(n.validatingFields,ae),!t.shouldUnregister&&!ie.keepDefaultValue&&Jn(o,ae);S.state.next({values:Ln(i)}),S.state.next({...n,...ie.keepDirty?{isDirty:Y()}:{}}),!ie.keepIsValid&&N()},De=({disabled:W,name:ie})=>{if(So(W)&&l.mount||W||c.disabled.has(ie)){const be=c.disabled.has(ie)!==!!W;W?c.disabled.add(ie):c.disabled.delete(ie),be&&l.mount&&!l.action&&N()}},Le=(W,ie={})=>{let ae=qe(r,W);const Se=So(ie.disabled)||So(t.disabled),be=!c.registerName.has(W)&&ae&&ae._f&&!ae._f.mount;return an(r,W,{...ae||{},_f:{...ae&&ae._f?ae._f:{ref:{name:W}},name:W,mount:!0,...ie}}),c.mount.add(W),ae&&!be?De({disabled:So(ie.disabled)?ie.disabled:t.disabled,name:W}):V(W,!0,ie.value),{...Se?{disabled:ie.disabled||t.disabled}:{},...t.progressive?{required:!!ie.required,min:bd(ie.min),max:bd(ie.max),minLength:bd(ie.minLength),maxLength:bd(ie.maxLength),pattern:bd(ie.pattern)}:{},name:W,onChange:K,onBlur:K,ref:Ve=>{if(Ve){c.registerName.add(W),Le(W,ie),c.registerName.delete(W),ae=qe(r,W);const Me=kn(Ve.value)&&Ve.querySelectorAll&&Ve.querySelectorAll("input,select,textarea")[0]||Ve,$e=NZ(Me),He=ae._f.refs||[];if($e?He.find(Je=>Je===Me):Me===ae._f.ref)return;const Xe={...ae._f};$e?(Xe.refs=[...He.filter(Gx),Me,...Array.isArray(qe(o,W))?[{}]:[]],Xe.ref={type:Me.type,name:W}):(Xe.ref=Me,delete Xe.refs),an(r,W,{_f:Xe}),V(W,!1,void 0,Me)}else ae=qe(r,W,{}),ae._f&&(ae._f.mount=!1),(t.shouldUnregister||ie.shouldUnregister)&&!(F2(c.array,W)&&l.action)&&c.unMount.add(W)}}},Fe=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Hd(r,re,c.mount),Ye=W=>{So(W)&&(S.state.next({disabled:W}),Hd(r,(ie,ae)=>{const Se=qe(r,ae);Se&&(ie.disabled=Se._f.disabled||W,Array.isArray(Se._f.refs)&&Se._f.refs.forEach(be=>{be.disabled=Se._f.disabled||W}))},0,!1))},et=(W,ie)=>async ae=>{let Se,be;ae&&(ae.preventDefault&&ae.preventDefault(),ae.persist&&ae.persist());let Ve=Ln(i);if(S.state.next({isSubmitting:!0}),t.resolver){const{errors:Me,values:$e}=await z();O(),n.errors=Me,Ve=Ln($e)}else await U({fields:r,eventType:ia.SUBMIT});if(c.disabled.size)for(const Me of c.disabled)Jn(Ve,Me);if(Jn(n.errors,U2),Or(n.errors)){S.state.next({errors:{}});try{Se=await W(Ve,ae)}catch(Me){be=Me}}else ie&&await ie({...n.errors},ae),Fe(),setTimeout(Fe);if(S.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(n.errors)&&!be,submitCount:n.submitCount+1,errors:n.errors}),be)throw be;return Se},me=(W,ie={})=>{qe(r,W)&&(kn(ie.defaultValue)?te(W,Ln(qe(o,W))):(te(W,ie.defaultValue),an(o,W,Ln(ie.defaultValue))),ie.keepTouched||Jn(n.touchedFields,W),ie.keepDirty||(Jn(n.dirtyFields,W),n.isDirty=ie.defaultValue?Y(W,Ln(qe(o,W))):Y()),ie.keepError||(Jn(n.errors,W),x.isValid&&N()),S.state.next({...n}))},xe=(W,ie={})=>{const ae=W?Ln(W):o,Se=Ln(ae),be=Or(W),Ve=Se,Me=r;if(ie.keepDefaultValues||(o=ae),!ie.keepValues){if(ie.keepDirtyValues){const $e=new Set([...c.mount,...X2(Wa(o,i,void 0,Me),n.dirtyFields)]);for(const He of Array.from($e)){const Xe=qe(n.dirtyFields,He),Je=qe(i,He),bt=qe(Ve,He);Xe&&!kn(Je)?an(Ve,He,Je):!Xe&&!kn(bt)&&te(He,bt)}}else{if(Yg&&kn(W))for(const $e of c.mount){const He=qe(r,$e);if(He&&He._f){const Xe=Array.isArray(He._f.refs)?He._f.refs[0]:He._f.ref;if(zm(Xe)){const Je=Xe.closest("form");if(Je){Je.reset();break}}}}if(ie.keepFieldsRef)for(const $e of c.mount)te($e,qe(Ve,$e));else r={}}if(t.shouldUnregister){if(i=ie.keepDefaultValues?Ln(o):{},ie.keepFieldsRef)for(const $e of c.mount)an(i,$e,qe(Ve,$e))}else i=Ln(Ve);S.array.next({values:{...Ve}}),S.state.next({name:void 0,type:void 0,values:{...Ve}})}c={mount:ie.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!ie.keepIsValid||!!ie.keepDirtyValues||!t.shouldUnregister&&!Or(Ve),l.watch=!!t.shouldUnregister,l.keepIsValid=!!ie.keepIsValid,l.action=!1,l.actionArrayLengths.clear(),ie.keepErrors||(n.errors={}),S.state.next({submitCount:ie.keepSubmitCount?n.submitCount:0,isDirty:be?!1:ie.keepDirty?n.isDirty:ie.keepValues?Y():!!(ie.keepDefaultValues&&!oo(W,o)),isSubmitted:ie.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:be?{}:ie.keepDirtyValues?ie.keepDefaultValues&&i?Wa(o,i,void 0,Me):n.dirtyFields:ie.keepDefaultValues&&W?Wa(o,W,void 0,Me):ie.keepDirty?n.dirtyFields:{},touchedFields:ie.keepTouched?n.touchedFields:{},errors:ie.keepErrors?n.errors:{},isSubmitSuccessful:ie.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},We=(W,ie)=>xe(Vr(W)?W(i):W,{...t.resetOptions,...ie}),Oe=(W,ie={})=>{const ae=qe(r,W),Se=ae&&ae._f;if(Se){const be=Se.refs?Se.refs[0]:Se.ref;be.focus&&setTimeout(()=>{be.focus(),ie.shouldSelect&&Vr(be.select)&&be.select()})}},Ie=W=>{const{name:ie,type:ae,values:Se,...be}=W;n={...n,...be}};S.state.subscribe({next:Ie});const $t={control:{register:Le,unregister:Qe,getFieldState:ue,handleSubmit:et,setError:Re,_subscribe:Ue,_runSchema:z,_updateIsValidating:O,_focusError:Fe,_getWatch:$,_getDirty:Y,_setValid:N,_setFieldArray:M,_setDisabledField:De,_setErrors:L,_getFieldArray:F,_reset:xe,_resetDefaultValues:()=>Vr(t.defaultValues)&&t.defaultValues().then(W=>{We(W,t.resetOptions),S.state.next({isLoading:!1})}),_removeUnmounted:H,_disableForm:Ye,_subjects:S,_proxyFormState:x,get _fields(){return r},get _formValues(){return i},get _state(){return l},set _state(W){l=W},get _defaultValues(){return o},get _names(){return c},set _names(W){c=W},get _formState(){return n},get _options(){return t},set _options(W){t={...t,...W},g=Tp(t.mode),y=Tp(t.reValidateMode)}},subscribe:Ae,trigger:ye,register:Le,handleSubmit:et,watch:ze,setValue:te,setValues:J,getValues:fe,reset:We,resetField:me,resetDefaultValues:(W,ie={})=>{if(o=Ln(W),!ie.keepDirty){const ae=Wa(o,i,void 0,r);n.dirtyFields=ae,n.isDirty=!Or(ae)}ie.keepIsValid||N(),S.state.next({...n,defaultValues:o})},clearErrors:he,unregister:Qe,setError:Re,setFocus:Oe,getFieldState:ue};return{...$t,formControl:$t}}function Ff(e={}){const t=Ee.useRef(void 0),n=Ee.useRef(void 0),r=Ee.useRef(e.formControl),[o,i]=Ee.useState(()=>({...Ln(tD),isLoading:Vr(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Vr(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!Vr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...p}=$Z(e);t.current={...p,formState:o}}const l=t.current.control;l._options=e;const{resyncIfNeeded:c,snapshot:f}=_S();return CS(()=>{const d=()=>({...l._formState,defaultValues:l._defaultValues});c(!0,d,i);const p=l._subscribe({formState:l._proxyFormState,callback:()=>i({...l._formState,defaultValues:l._defaultValues}),reRenderRoot:!0});return i(g=>({...g,isReady:!0})),l._formState.isReady=!0,()=>{p(),f(!0,d)}},[l,c,f]),Ee.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),Ee.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),Ee.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),Ee.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),Ee.useEffect(()=>{if(l._proxyFormState.isDirty){const d=l._getDirty();d!==o.isDirty&&l._subjects.state.next({isDirty:d})}},[l,o.isDirty]),Ee.useEffect(()=>{var d;e.values&&!oo(e.values,n.current)?(l._reset(e.values,{keepFieldsRef:!0,...l._options.resetOptions}),!((d=l._options.resetOptions)===null||d===void 0)&&d.keepIsValid||l._setValid(),n.current=e.values,i(p=>({...p}))):l._resetDefaultValues()},[l,e.values]),Ee.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),t.current.formState=Ee.useMemo(()=>H2(o,l),[l,o]),t.current}const kN=(e,t,n)=>{if(e&&"reportValidity"in e){const r=qe(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},a0=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?kN(r.ref,n,e):r&&r.refs&&r.refs.forEach(o=>kN(o,n,e))}},AN=(e,t)=>{t.shouldUseNativeValidation&&a0(e,t);const n={};for(const r in e){const o=qe(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.refs?o.refs[0]:o&&o.ref});if(FZ(t.names||Object.keys(e),r)){const l=Object.assign({},qe(n,r));an(l,"root",i),an(n,r,l)}else an(n,r,i)}return n},FZ=(e,t)=>{const n=DN(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(r=>DN(r).match(`^${n}\\.\\d+`))};function DN(e){return e.replace(/[\[\]]/g,"")}function l0(){return l0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l0.apply(null,arguments)}function PN(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function VZ(e,t){for(var n=Object.create(null);e.length;){var r=e[0],o=r.code,i=r.message,l=r.path.join(".");if(!n[l])if("unionErrors"in r){var c,f,d=r.unionErrors.reduce(function(y,v){return v.errors.length<y.errors.length?v:y}).errors[0];n[l]={message:(c=d?.message)!=null?c:i,type:(f=d?.code)!=null?f:o}}else n[l]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(y){return y.errors.forEach(function(v){return e.push(v)})}),t){var p=n[l].types,g=p&&p[r.code];n[l]=jS(l,t,n,o,g?[].concat(g,r.message):r.message)}e.shift()}return n}function UZ(e,t){for(var n=Object.create(null),r=function(){var o=e[0],i=o.code,l=o.message,c=o.path.join(".");if(!n[c])if(o.code==="invalid_union"&&o.errors.length>0){var f,d,p=o.errors.reduce(function(v,x){return x.length<v.length?x:v})[0];n[c]={message:(f=p?.message)!=null?f:l,type:(d=p?.code)!=null?d:i}}else n[c]={message:l,type:i};if(o.code==="invalid_union"&&o.errors.forEach(function(v){return v.forEach(function(x){return e.push(l0({},x,{path:[].concat(o.path,x.path)}))})}),t){var g=n[c].types,y=g&&g[o.code];n[c]=jS(c,t,n,i,y?[].concat(y,o.message):o.message)}e.shift()};e.length;)r();return n}function Vf(e,t,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,o,i){try{return Promise.resolve(PN(function(){function l(f){return i.shouldUseNativeValidation&&a0({},i),{errors:{},values:n.raw?Object.assign({},r):f}}var c=e;return n.mode==="sync"?l(c.parse(r,t)):Promise.resolve(c.parseAsync(r,t)).then(l)},function(l){if((function(c){var f;return!(c==null||(f=c._zod)==null||(f=f.traits)==null||!f.has("$ZodError"))})(l))return{values:{},errors:AN(UZ(l.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw l}))}catch(l){return Promise.reject(l)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(e))return function(r,o,i){try{return Promise.resolve(PN(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(l){return i.shouldUseNativeValidation&&a0({},i),{errors:{},values:n.raw?Object.assign({},r):l}})},function(l){if((function(c){return Array.isArray(c?.issues)})(l))return{values:{},errors:AN(VZ(l.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw l}))}catch(l){return Promise.reject(l)}};throw new Error("Invalid input: not a Zod schema")}var IN;function Pe(e,t,n){function r(c,f){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:f,constr:l,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,f);const d=l.prototype,p=Object.keys(d);for(let g=0;g<p.length;g++){const y=p[g];y in c||(c[y]=d[y].bind(c))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function l(c){var f;const d=n?.Parent?new i:this;r(d,c),(f=d._zod).deferred??(f.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class Fc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nD extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(IN=globalThis).__zod_globalConfig??(IN.__zod_globalConfig={});const TS=globalThis.__zod_globalConfig;function pl(e){return TS}function rD(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function c0(e,t){return typeof t=="bigint"?t.toString():t}function OS(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function MS(e){return e==null}function kS(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const zN=Symbol("evaluating");function xn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==zN)return r===void 0&&(r=zN,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ml(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ta(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function LN(e){return JSON.stringify(e)}function HZ(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const oD="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const BZ=OS(()=>{if(TS.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function tf(e){if($m(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!($m(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function sD(e){return tf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const qZ=new Set(["string","number","symbol"]);function Zg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oa(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _t(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function YZ(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function ZZ(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Ta(e._zod.def,{get shape(){const l={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(l[c]=n.shape[c])}return Ml(this,"shape",l),l},checks:[]});return Oa(e,i)}function GZ(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Ta(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete l[c]}return Ml(this,"shape",l),l},checks:[]});return Oa(e,i)}function KZ(e,t){if(!tf(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const l in t)if(Object.getOwnPropertyDescriptor(i,l)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Ta(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Ml(this,"shape",i),i}});return Oa(e,o)}function XZ(e,t){if(!tf(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ta(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ml(this,"shape",r),r}});return Oa(e,n)}function QZ(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Ta(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ml(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Oa(e,n)}function WZ(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const l=Ta(t._zod.def,{get shape(){const c=t._zod.def.shape,f={...c};if(n)for(const d in n){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(f[d]=e?new e({type:"optional",innerType:c[d]}):c[d])}else for(const d in c)f[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return Ml(this,"shape",f),f},checks:[]});return Oa(t,l)}function JZ(e,t,n){const r=Ta(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const l in n){if(!(l in i))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(i[l]=new e({type:"nonoptional",innerType:o[l]}))}else for(const l in o)i[l]=new e({type:"nonoptional",innerType:o[l]});return Ml(this,"shape",i),i}});return Oa(t,r)}function Ac(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function eG(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function iD(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Op(e){return typeof e=="string"?e:e?.message}function ml(e,t,n){const r=e.message?e.message:Op(e.inst?._zod.def?.error?.(e))??Op(t?.error?.(e))??Op(n.customError?.(e))??Op(n.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:l,...c}=e;return c.path??(c.path=[]),c.message=r,t?.reportInput&&(c.input=l),c}function AS(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function nf(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const aD=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,c0,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lD=Pe("$ZodError",aD),cD=Pe("$ZodError",aD,{Parent:Error});function tG(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function nG(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>r({issues:c},[...i,...l.path]));else if(l.code==="invalid_key")r({issues:l.issues},[...i,...l.path]);else if(l.code==="invalid_element")r({issues:l.issues},[...i,...l.path]);else{const c=[...i,...l.path];if(c.length===0)n._errors.push(t(l));else{let f=n,d=0;for(;d<c.length;){const p=c[d];d===c.length-1?(f[p]=f[p]||{_errors:[]},f[p]._errors.push(t(l))):f[p]=f[p]||{_errors:[]},f=f[p],d++}}}};return r(e),n}const DS=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw new Fc;if(l.issues.length){const c=new(o?.Err??e)(l.issues.map(f=>ml(f,i,pl())));throw oD(c,o?.callee),c}return l.value},PS=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let l=t._zod.run({value:n,issues:[]},i);if(l instanceof Promise&&(l=await l),l.issues.length){const c=new(o?.Err??e)(l.issues.map(f=>ml(f,i,pl())));throw oD(c,o?.callee),c}return l.value},Gg=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Fc;return i.issues.length?{success:!1,error:new(e??lD)(i.issues.map(l=>ml(l,o,pl())))}:{success:!0,data:i.value}},rG=Gg(cD),Kg=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(l=>ml(l,o,pl())))}:{success:!0,data:i.value}},oG=Kg(cD),sG=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return DS(e)(t,n,o)},iG=e=>(t,n,r)=>DS(e)(t,n,r),aG=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return PS(e)(t,n,o)},lG=e=>async(t,n,r)=>PS(e)(t,n,r),cG=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Gg(e)(t,n,o)},uG=e=>(t,n,r)=>Gg(e)(t,n,r),dG=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Kg(e)(t,n,o)},fG=e=>async(t,n,r)=>Kg(e)(t,n,r),hG=/^[cC][0-9a-z]{6,}$/,pG=/^[0-9a-z]+$/,mG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gG=/^[0-9a-vA-V]{20}$/,yG=/^[A-Za-z0-9]{27}$/,vG=/^[a-zA-Z0-9_-]{21}$/,xG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$N=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,wG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,SG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function EG(){return new RegExp(SG,"u")}const CG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_G=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,RG=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,NG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uD=/^[A-Za-z0-9_-]*$/,TG=/^https?$/,OG=/^\+[1-9]\d{6,14}$/,dD="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",MG=new RegExp(`^${dD}$`);function fD(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kG(e){return new RegExp(`^${fD(e)}$`)}function AG(e){const t=fD({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${dD}T(?:${r})$`)}const DG=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},PG=/^[^A-Z]*$/,IG=/^[^a-z]*$/,Bs=Pe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zG=Pe("$ZodCheckMaxLength",(e,t)=>{var n;Bs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!MS(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const l=AS(o);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),LG=Pe("$ZodCheckMinLength",(e,t)=>{var n;Bs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!MS(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const l=AS(o);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$G=Pe("$ZodCheckLengthEquals",(e,t)=>{var n;Bs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!MS(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const l=AS(o),c=i>t.length;r.issues.push({origin:l,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Xg=Pe("$ZodCheckStringFormat",(e,t)=>{var n,r;Bs.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),FG=Pe("$ZodCheckRegex",(e,t)=>{Xg.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),VG=Pe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=PG),Xg.init(e,t)}),UG=Pe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=IG),Xg.init(e,t)}),HG=Pe("$ZodCheckIncludes",(e,t)=>{Bs.init(e,t);const n=Zg(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),BG=Pe("$ZodCheckStartsWith",(e,t)=>{Bs.init(e,t);const n=new RegExp(`^${Zg(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),qG=Pe("$ZodCheckEndsWith",(e,t)=>{Bs.init(e,t);const n=new RegExp(`.*${Zg(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),YG=Pe("$ZodCheckOverwrite",(e,t)=>{Bs.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ZG{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
13
|
+
`).filter(l=>l),o=Math.min(...r.map(l=>l.length-l.trimStart().length)),i=r.map(l=>l.slice(o)).map(l=>" ".repeat(this.indent*2)+l);for(const l of i)this.content.push(l)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
14
|
+
`))}}const GG={major:4,minor:4,patch:3},hr=Pe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=GG;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(l,c,f)=>{let d=Ac(l),p;for(const g of c){if(g._zod.def.when){if(eG(l)||!g._zod.def.when(l))continue}else if(d)continue;const y=l.issues.length,v=g._zod.check(l);if(v instanceof Promise&&f?.async===!1)throw new Fc;if(p||v instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await v,l.issues.length!==y&&(d||(d=Ac(l,y)))});else{if(l.issues.length===y)continue;d||(d=Ac(l,y))}}return p?p.then(()=>l):l},i=(l,c,f)=>{if(Ac(l))return l.aborted=!0,l;const d=o(c,r,f);if(d instanceof Promise){if(f.async===!1)throw new Fc;return d.then(p=>e._zod.parse(p,f))}return e._zod.parse(d,f)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const d=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(p=>i(p,l,c)):i(d,l,c)}const f=e._zod.parse(l,c);if(f instanceof Promise){if(c.async===!1)throw new Fc;return f.then(d=>o(d,r,c))}return o(f,r,c)}}xn(e,"~standard",()=>({validate:o=>{try{const i=rG(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return oG(e,o).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}))}),IS=Pe("$ZodString",(e,t)=>{hr.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??DG(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),$n=Pe("$ZodStringFormat",(e,t)=>{Xg.init(e,t),IS.init(e,t)}),KG=Pe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bG),$n.init(e,t)}),XG=Pe("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$N(r))}else t.pattern??(t.pattern=$N());$n.init(e,t)}),QG=Pe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wG),$n.init(e,t)}),WG=Pe("$ZodURL",(e,t)=>{$n.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===TG.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),JG=Pe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=EG()),$n.init(e,t)}),eK=Pe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=vG),$n.init(e,t)}),tK=Pe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hG),$n.init(e,t)}),nK=Pe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pG),$n.init(e,t)}),rK=Pe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=mG),$n.init(e,t)}),oK=Pe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gG),$n.init(e,t)}),sK=Pe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yG),$n.init(e,t)}),iK=Pe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=AG(t)),$n.init(e,t)}),aK=Pe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=MG),$n.init(e,t)}),lK=Pe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=kG(t)),$n.init(e,t)}),cK=Pe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xG),$n.init(e,t)}),uK=Pe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=CG),$n.init(e,t),e._zod.bag.format="ipv4"}),dK=Pe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_G),$n.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),fK=Pe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=RG),$n.init(e,t)}),hK=Pe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=jG),$n.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const l=Number(i);if(`${l}`!==i)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function hD(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const pK=Pe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=NG),$n.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{hD(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function mK(e){if(!uD.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return hD(n)}const gK=Pe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uD),$n.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{mK(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),yK=Pe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=OG),$n.init(e,t)});function vK(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const xK=Pe("$ZodJWT",(e,t)=>{$n.init(e,t),e._zod.check=n=>{vK(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),bK=Pe("$ZodUnknown",(e,t)=>{hr.init(e,t),e._zod.parse=n=>n}),wK=Pe("$ZodNever",(e,t)=>{hr.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function FN(e,t,n){e.issues.length&&t.issues.push(...iD(n,e.issues)),t.value[n]=e.value}const SK=Pe("$ZodArray",(e,t)=>{hr.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let l=0;l<o.length;l++){const c=o[l],f=t.element._zod.run({value:c,issues:[]},r);f instanceof Promise?i.push(f.then(d=>FN(d,n,l))):FN(f,n,l)}return i.length?Promise.all(i).then(()=>n):n}});function Fm(e,t,n,r,o,i){const l=n in r;if(e.issues.length){if(o&&i&&!l)return;t.issues.push(...iD(n,e.issues))}if(!l&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?l&&(t.value[n]=void 0):t.value[n]=e.value}function pD(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=YZ(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function mD(e,t,n,r,o,i){const l=[],c=o.keySet,f=o.catchall._zod,d=f.def.type,p=f.optin==="optional",g=f.optout==="optional";for(const y in t){if(y==="__proto__"||c.has(y))continue;if(d==="never"){l.push(y);continue}const v=f.run({value:t[y],issues:[]},r);v instanceof Promise?e.push(v.then(x=>Fm(x,n,y,t,p,g))):Fm(v,n,y,t,p,g)}return l.length&&n.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const EK=Pe("$ZodObject",(e,t)=>{if(hr.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const f={...c};return Object.defineProperty(t,"shape",{value:f}),f}})}const r=OS(()=>pD(t));xn(e._zod,"propValues",()=>{const c=t.shape,f={};for(const d in c){const p=c[d]._zod;if(p.values){f[d]??(f[d]=new Set);for(const g of p.values)f[d].add(g)}}return f});const o=$m,i=t.catchall;let l;e._zod.parse=(c,f)=>{l??(l=r.value);const d=c.value;if(!o(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};const p=[],g=l.shape;for(const y of l.keys){const v=g[y],x=v._zod.optin==="optional",E=v._zod.optout==="optional",S=v._zod.run({value:d[y],issues:[]},f);S instanceof Promise?p.push(S.then(_=>Fm(_,c,y,d,x,E))):Fm(S,c,y,d,x,E)}return i?mD(p,d,c,f,r.value,e):p.length?Promise.all(p).then(()=>c):c}}),CK=Pe("$ZodObjectJIT",(e,t)=>{EK.init(e,t);const n=e._zod.parse,r=OS(()=>pD(t)),o=y=>{const v=new ZG(["shape","payload","ctx"]),x=r.value,E=R=>{const N=LN(R);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};v.write("const input = payload.value;");const S=Object.create(null);let _=0;for(const R of x.keys)S[R]=`key_${_++}`;v.write("const newResult = {};");for(const R of x.keys){const N=S[R],O=LN(R),k=y[R],M=k?._zod?.optin==="optional",T=k?._zod?.optout==="optional";v.write(`const ${N} = ${E(R)};`),M&&T?v.write(`
|
|
15
|
+
if (${N}.issues.length) {
|
|
16
|
+
if (${O} in input) {
|
|
17
|
+
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
|
18
|
+
...iss,
|
|
19
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
20
|
+
})));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (${N}.value === undefined) {
|
|
25
|
+
if (${O} in input) {
|
|
26
|
+
newResult[${O}] = undefined;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
newResult[${O}] = ${N}.value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
`):M?v.write(`
|
|
33
|
+
if (${N}.issues.length) {
|
|
34
|
+
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
|
35
|
+
...iss,
|
|
36
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (${N}.value === undefined) {
|
|
41
|
+
if (${O} in input) {
|
|
42
|
+
newResult[${O}] = undefined;
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
newResult[${O}] = ${N}.value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
`):v.write(`
|
|
49
|
+
const ${N}_present = ${O} in input;
|
|
50
|
+
if (${N}.issues.length) {
|
|
51
|
+
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
|
52
|
+
...iss,
|
|
53
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
if (!${N}_present && !${N}.issues.length) {
|
|
57
|
+
payload.issues.push({
|
|
58
|
+
code: "invalid_type",
|
|
59
|
+
expected: "nonoptional",
|
|
60
|
+
input: undefined,
|
|
61
|
+
path: [${O}]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (${N}_present) {
|
|
66
|
+
if (${N}.value === undefined) {
|
|
67
|
+
newResult[${O}] = undefined;
|
|
68
|
+
} else {
|
|
69
|
+
newResult[${O}] = ${N}.value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
`)}v.write("payload.value = newResult;"),v.write("return payload;");const j=v.compile();return(R,N)=>j(y,R,N)};let i;const l=$m,c=!TS.jitless,d=c&&BZ.value,p=t.catchall;let g;e._zod.parse=(y,v)=>{g??(g=r.value);const x=y.value;return l(x)?c&&d&&v?.async===!1&&v.jitless!==!0?(i||(i=o(t.shape)),y=i(y,v),p?mD([],x,y,v,g,e):y):n(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),y)}});function VN(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Ac(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(l=>ml(l,r,pl())))}),t)}const _K=Pe("$ZodUnion",(e,t)=>{hr.init(e,t),xn(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),xn(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),xn(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),xn(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>kS(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const l=[];for(const c of t.options){const f=c._zod.run({value:r.value,issues:[]},o);if(f instanceof Promise)l.push(f),i=!0;else{if(f.issues.length===0)return f;l.push(f)}}return i?Promise.all(l).then(c=>VN(c,r,e,o)):VN(l,r,e,o)}}),RK=Pe("$ZodIntersection",(e,t)=>{hr.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),l=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||l instanceof Promise?Promise.all([i,l]).then(([f,d])=>UN(n,f,d)):UN(n,i,l)}});function u0(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tf(e)&&tf(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const l=u0(e[i],t[i]);if(!l.valid)return{valid:!1,mergeErrorPath:[i,...l.mergeErrorPath]};o[i]=l.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],l=u0(o,i);if(!l.valid)return{valid:!1,mergeErrorPath:[r,...l.mergeErrorPath]};n.push(l.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function UN(e,t,n){const r=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const f of c.keys)r.has(f)||r.set(f,{}),r.get(f).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const f of c.keys)r.has(f)||r.set(f,{}),r.get(f).r=!0;else e.issues.push(c);const i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&o&&e.issues.push({...o,keys:i}),Ac(e))return e;const l=u0(t.value,n.value);if(!l.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`);return e.value=l.data,e}const jK=Pe("$ZodEnum",(e,t)=>{hr.init(e,t);const n=rD(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>qZ.has(typeof o)).map(o=>typeof o=="string"?Zg(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const l=o.value;return r.has(l)||o.issues.push({code:"invalid_value",values:n,input:l,inst:e}),o}}),NK=Pe("$ZodTransform",(e,t)=>{hr.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new nD(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(l=>(n.value=l,n.fallback=!0,n));if(o instanceof Promise)throw new Fc;return n.value=o,n.fallback=!0,n}});function HN(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const gD=Pe("$ZodOptional",(e,t)=>{hr.init(e,t),e._zod.optin="optional",e._zod.optout="optional",xn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),xn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${kS(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(l=>HN(l,o)):HN(i,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),TK=Pe("$ZodExactOptional",(e,t)=>{gD.init(e,t),xn(e._zod,"values",()=>t.innerType._zod.values),xn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),OK=Pe("$ZodNullable",(e,t)=>{hr.init(e,t),xn(e._zod,"optin",()=>t.innerType._zod.optin),xn(e._zod,"optout",()=>t.innerType._zod.optout),xn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${kS(n.source)}|null)$`):void 0}),xn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),MK=Pe("$ZodDefault",(e,t)=>{hr.init(e,t),e._zod.optin="optional",xn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>BN(i,t)):BN(o,t)}});function BN(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const kK=Pe("$ZodPrefault",(e,t)=>{hr.init(e,t),e._zod.optin="optional",xn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),AK=Pe("$ZodNonOptional",(e,t)=>{hr.init(e,t),xn(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>qN(i,e)):qN(o,e)}});function qN(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const DK=Pe("$ZodCatch",(e,t)=>{hr.init(e,t),e._zod.optin="optional",xn(e._zod,"optout",()=>t.innerType._zod.optout),xn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(l=>ml(l,r,pl()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>ml(i,r,pl()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),PK=Pe("$ZodPipe",(e,t)=>{hr.init(e,t),xn(e._zod,"values",()=>t.in._zod.values),xn(e._zod,"optin",()=>t.in._zod.optin),xn(e._zod,"optout",()=>t.out._zod.optout),xn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(l=>Mp(l,t.in,r)):Mp(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Mp(i,t.out,r)):Mp(o,t.out,r)}});function Mp(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const IK=Pe("$ZodReadonly",(e,t)=>{hr.init(e,t),xn(e._zod,"propValues",()=>t.innerType._zod.propValues),xn(e._zod,"values",()=>t.innerType._zod.values),xn(e._zod,"optin",()=>t.innerType?._zod?.optin),xn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(YN):YN(o)}});function YN(e){return e.value=Object.freeze(e.value),e}const zK=Pe("$ZodCustom",(e,t)=>{Bs.init(e,t),hr.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ZN(i,n,r,e));ZN(o,n,r,e)}});function ZN(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(nf(o))}}var GN;class LK{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function $K(){return new LK}(GN=globalThis).__zod_globalRegistry??(GN.__zod_globalRegistry=$K());const Dd=globalThis.__zod_globalRegistry;function FK(e,t){return new e({type:"string",..._t(t)})}function VK(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._t(t)})}function KN(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._t(t)})}function UK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._t(t)})}function HK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._t(t)})}function BK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._t(t)})}function qK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._t(t)})}function YK(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._t(t)})}function ZK(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._t(t)})}function GK(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._t(t)})}function KK(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._t(t)})}function XK(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._t(t)})}function QK(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._t(t)})}function WK(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._t(t)})}function JK(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._t(t)})}function eX(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._t(t)})}function tX(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._t(t)})}function nX(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._t(t)})}function rX(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._t(t)})}function oX(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._t(t)})}function sX(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._t(t)})}function iX(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._t(t)})}function aX(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._t(t)})}function lX(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._t(t)})}function cX(e,t){return new e({type:"string",format:"date",check:"string_format",..._t(t)})}function uX(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._t(t)})}function dX(e,t){return new e({type:"string",format:"duration",check:"string_format",..._t(t)})}function fX(e){return new e({type:"unknown"})}function hX(e,t){return new e({type:"never",..._t(t)})}function yD(e,t){return new zG({check:"max_length",..._t(t),maximum:e})}function Vm(e,t){return new LG({check:"min_length",..._t(t),minimum:e})}function vD(e,t){return new $G({check:"length_equals",..._t(t),length:e})}function pX(e,t){return new FG({check:"string_format",format:"regex",..._t(t),pattern:e})}function mX(e){return new VG({check:"string_format",format:"lowercase",..._t(e)})}function gX(e){return new UG({check:"string_format",format:"uppercase",..._t(e)})}function yX(e,t){return new HG({check:"string_format",format:"includes",..._t(t),includes:e})}function vX(e,t){return new BG({check:"string_format",format:"starts_with",..._t(t),prefix:e})}function xX(e,t){return new qG({check:"string_format",format:"ends_with",..._t(t),suffix:e})}function xu(e){return new YG({check:"overwrite",tx:e})}function bX(e){return xu(t=>t.normalize(e))}function wX(){return xu(e=>e.trim())}function SX(){return xu(e=>e.toLowerCase())}function EX(){return xu(e=>e.toUpperCase())}function CX(){return xu(e=>HZ(e))}function _X(e,t,n){return new e({type:"array",element:t,..._t(n)})}function RX(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._t(n)})}function jX(e,t){const n=NX(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(nf(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(nf(i))}},e(r.value,r)),t);return n}function NX(e,t){const n=new Bs({check:"custom",..._t(t)});return n._zod.check=e,n}function xD(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Dd,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function zr(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const l={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,l);const c=e._zod.toJSONSchema?.();if(c)l.schema=c;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,l.schema,p);else{const y=l.schema,v=t.processors[o.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);v(e,t,y,p)}const g=e._zod.parent;g&&(l.ref||(l.ref=g),zr(g,t,p),t.seen.get(g).isParent=!0)}const f=t.metadataRegistry.get(e);return f&&Object.assign(l.schema,f),t.io==="input"&&qr(e)&&(delete l.schema.examples,delete l.schema.default),t.io==="input"&&"_prefault"in l.schema&&((r=l.schema).default??(r.default=l.schema._prefault)),delete l.schema._prefault,t.seen.get(e).schema}function bD(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const l of e.seen.entries()){const c=e.metadataRegistry.get(l[0])?.id;if(c){const f=r.get(c);if(f&&f!==l[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,l[0])}}const o=l=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(l[0])?.id,y=e.external.uri??(x=>x);if(g)return{ref:y(g)};const v=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=v,{defId:v,ref:`${y("__shared")}#/${c}/${v}`}}if(l[1]===n)return{ref:"#"};const d=`#/${c}/`,p=l[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:d+p}},i=l=>{if(l[1].schema.$ref)return;const c=l[1],{ref:f,defId:d}=o(l);c.def={...c.schema},d&&(c.defId=d);const p=c.schema;for(const g in p)delete p[g];p.$ref=f};if(e.cycles==="throw")for(const l of e.seen.entries()){const c=l[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
74
|
+
|
|
75
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const c=l[1];if(t===l[0]){i(l);continue}if(e.external){const d=e.external.registry.get(l[0])?.id;if(t!==l[0]&&d){i(l);continue}}if(e.metadataRegistry.get(l[0])?.id){i(l);continue}if(c.cycle){i(l);continue}if(c.count>1&&e.reused==="ref"){i(l);continue}}}function wD(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const f=e.seen.get(c);if(f.ref===null)return;const d=f.def??f.schema,p={...d},g=f.ref;if(f.ref=null,g){r(g);const v=e.seen.get(g),x=v.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(x)):Object.assign(d,x),Object.assign(d,p),c._zod.parent===g)for(const S in d)S==="$ref"||S==="allOf"||S in p||delete d[S];if(x.$ref&&v.def)for(const S in d)S==="$ref"||S==="allOf"||S in v.def&&JSON.stringify(d[S])===JSON.stringify(v.def[S])&&delete d[S]}const y=c._zod.parent;if(y&&y!==g){r(y);const v=e.seen.get(y);if(v?.schema.$ref&&(d.$ref=v.schema.$ref,v.def))for(const x in d)x==="$ref"||x==="allOf"||x in v.def&&JSON.stringify(d[x])===JSON.stringify(v.def[x])&&delete d[x]}e.override({zodSchema:c,jsonSchema:d,path:f.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;const l=e.external?.defs??{};for(const c of e.seen.entries()){const f=c[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Um(t,"input",e.processors),output:Um(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function qr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return qr(r.element,n);if(r.type==="set")return qr(r.valueType,n);if(r.type==="lazy")return qr(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return qr(r.innerType,n);if(r.type==="intersection")return qr(r.left,n)||qr(r.right,n);if(r.type==="record"||r.type==="map")return qr(r.keyType,n)||qr(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:qr(r.in,n)||qr(r.out,n);if(r.type==="object"){for(const o in r.shape)if(qr(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(qr(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(qr(o,n))return!0;return!!(r.rest&&qr(r.rest,n))}return!1}const TX=(e,t={})=>n=>{const r=xD({...n,processors:t});return zr(e,r),bD(r,e),wD(r,e)},Um=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},l=xD({...o??{},target:i,io:t,processors:n});return zr(e,l),bD(l,e),wD(l,e)},OX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},MX=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:l,format:c,patterns:f,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof l=="number"&&(o.maxLength=l),c&&(o.format=OX[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),d&&(o.contentEncoding=d),f&&f.size>0){const p=[...f];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},kX=(e,t,n,r)=>{n.not={}},AX=(e,t,n,r)=>{},DX=(e,t,n,r)=>{const o=e._zod.def,i=rD(o.entries);i.every(l=>typeof l=="number")&&(n.type="number"),i.every(l=>typeof l=="string")&&(n.type="string"),n.enum=i},PX=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},IX=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},zX=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:l,maximum:c}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=zr(i.element,t,{...r,path:[...r.path,"items"]})},LX=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const l=i.shape;for(const d in l)o.properties[d]=zr(l[d],t,{...r,path:[...r.path,"properties",d]});const c=new Set(Object.keys(l)),f=new Set([...c].filter(d=>{const p=i.shape[d]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));f.size>0&&(o.required=Array.from(f)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=zr(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},$X=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,l=o.options.map((c,f)=>zr(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",f]}));i?n.oneOf=l:n.anyOf=l},FX=(e,t,n,r)=>{const o=e._zod.def,i=zr(o.left,t,{...r,path:[...r.path,"allOf",0]}),l=zr(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=d=>"allOf"in d&&Object.keys(d).length===1,f=[...c(i)?i.allOf:[i],...c(l)?l.allOf:[l]];n.allOf=f},VX=(e,t,n,r)=>{const o=e._zod.def,i=zr(o.innerType,t,r),l=t.seen.get(e);t.target==="openapi-3.0"?(l.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},UX=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},HX=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},BX=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},qX=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let l;try{l=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=l},YX=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),l=t.io==="input"?i?o.out:o.in:o.out;zr(l,t,r);const c=t.seen.get(e);c.ref=l},ZX=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},SD=(e,t,n,r)=>{const o=e._zod.def;zr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},GX=Pe("ZodISODateTime",(e,t)=>{iK.init(e,t),Yn.init(e,t)});function KX(e){return lX(GX,e)}const XX=Pe("ZodISODate",(e,t)=>{aK.init(e,t),Yn.init(e,t)});function QX(e){return cX(XX,e)}const WX=Pe("ZodISOTime",(e,t)=>{lK.init(e,t),Yn.init(e,t)});function JX(e){return uX(WX,e)}const eQ=Pe("ZodISODuration",(e,t)=>{cK.init(e,t),Yn.init(e,t)});function tQ(e){return dX(eQ,e)}const nQ=(e,t)=>{lD.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>nG(e,n)},flatten:{value:n=>tG(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,c0,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,c0,2)}},isEmpty:{get(){return e.issues.length===0}}})},qo=Pe("ZodError",nQ,{Parent:Error}),rQ=DS(qo),oQ=PS(qo),sQ=Gg(qo),iQ=Kg(qo),aQ=sG(qo),lQ=iG(qo),cQ=aG(qo),uQ=lG(qo),dQ=cG(qo),fQ=uG(qo),hQ=dG(qo),pQ=fG(qo),XN=new WeakMap;function Qg(e,t,n){const r=Object.getPrototypeOf(e);let o=XN.get(r);if(o||(o=new Set,XN.set(r,o)),!o.has(t)){o.add(t);for(const i in n){const l=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const c=l.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const pr=Pe("ZodType",(e,t)=>(hr.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Um(e,"input"),output:Um(e,"output")}}),e.toJSONSchema=TX(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>rQ(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>sQ(e,n,r),e.parseAsync=async(n,r)=>oQ(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>iQ(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>aQ(e,n,r),e.decode=(n,r)=>lQ(e,n,r),e.encodeAsync=async(n,r)=>cQ(e,n,r),e.decodeAsync=async(n,r)=>uQ(e,n,r),e.safeEncode=(n,r)=>dQ(e,n,r),e.safeDecode=(n,r)=>fQ(e,n,r),e.safeEncodeAsync=async(n,r)=>hQ(e,n,r),e.safeDecodeAsync=async(n,r)=>pQ(e,n,r),Qg(e,"ZodType",{check(...n){const r=this.def;return this.clone(Ta(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Oa(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(oW(n,r))},superRefine(n,r){return this.check(sW(n,r))},overwrite(n){return this.check(xu(n))},optional(){return JN(this)},exactOptional(){return qQ(this)},nullable(){return eT(this)},nullish(){return JN(eT(this))},nonoptional(n){return QQ(this,n)},array(){return Dc(this)},or(n){return $Q([this,n])},and(n){return VQ(this,n)},transform(n){return tT(this,HQ(n))},default(n){return GQ(this,n)},prefault(n){return XQ(this,n)},catch(n){return JQ(this,n)},pipe(n){return tT(this,n)},readonly(){return nW(this)},describe(n){const r=this.clone();return Dd.add(r,{description:n}),r},meta(...n){if(n.length===0)return Dd.get(this);const r=this.clone();return Dd.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Dd.get(e)?.description},configurable:!0}),e)),ED=Pe("_ZodString",(e,t)=>{IS.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(r,o,i)=>MX(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qg(e,"_ZodString",{regex(...r){return this.check(pX(...r))},includes(...r){return this.check(yX(...r))},startsWith(...r){return this.check(vX(...r))},endsWith(...r){return this.check(xX(...r))},min(...r){return this.check(Vm(...r))},max(...r){return this.check(yD(...r))},length(...r){return this.check(vD(...r))},nonempty(...r){return this.check(Vm(1,...r))},lowercase(r){return this.check(mX(r))},uppercase(r){return this.check(gX(r))},trim(){return this.check(wX())},normalize(...r){return this.check(bX(...r))},toLowerCase(){return this.check(SX())},toUpperCase(){return this.check(EX())},slugify(){return this.check(CX())}})}),mQ=Pe("ZodString",(e,t)=>{IS.init(e,t),ED.init(e,t),e.email=n=>e.check(VK(gQ,n)),e.url=n=>e.check(YK(yQ,n)),e.jwt=n=>e.check(aX(kQ,n)),e.emoji=n=>e.check(ZK(vQ,n)),e.guid=n=>e.check(KN(QN,n)),e.uuid=n=>e.check(UK(kp,n)),e.uuidv4=n=>e.check(HK(kp,n)),e.uuidv6=n=>e.check(BK(kp,n)),e.uuidv7=n=>e.check(qK(kp,n)),e.nanoid=n=>e.check(GK(xQ,n)),e.guid=n=>e.check(KN(QN,n)),e.cuid=n=>e.check(KK(bQ,n)),e.cuid2=n=>e.check(XK(wQ,n)),e.ulid=n=>e.check(QK(SQ,n)),e.base64=n=>e.check(oX(TQ,n)),e.base64url=n=>e.check(sX(OQ,n)),e.xid=n=>e.check(WK(EQ,n)),e.ksuid=n=>e.check(JK(CQ,n)),e.ipv4=n=>e.check(eX(_Q,n)),e.ipv6=n=>e.check(tX(RQ,n)),e.cidrv4=n=>e.check(nX(jQ,n)),e.cidrv6=n=>e.check(rX(NQ,n)),e.e164=n=>e.check(iX(MQ,n)),e.datetime=n=>e.check(KX(n)),e.date=n=>e.check(QX(n)),e.time=n=>e.check(JX(n)),e.duration=n=>e.check(tQ(n))});function Tn(e){return FK(mQ,e)}const Yn=Pe("ZodStringFormat",(e,t)=>{$n.init(e,t),ED.init(e,t)}),gQ=Pe("ZodEmail",(e,t)=>{QG.init(e,t),Yn.init(e,t)}),QN=Pe("ZodGUID",(e,t)=>{KG.init(e,t),Yn.init(e,t)}),kp=Pe("ZodUUID",(e,t)=>{XG.init(e,t),Yn.init(e,t)}),yQ=Pe("ZodURL",(e,t)=>{WG.init(e,t),Yn.init(e,t)}),vQ=Pe("ZodEmoji",(e,t)=>{JG.init(e,t),Yn.init(e,t)}),xQ=Pe("ZodNanoID",(e,t)=>{eK.init(e,t),Yn.init(e,t)}),bQ=Pe("ZodCUID",(e,t)=>{tK.init(e,t),Yn.init(e,t)}),wQ=Pe("ZodCUID2",(e,t)=>{nK.init(e,t),Yn.init(e,t)}),SQ=Pe("ZodULID",(e,t)=>{rK.init(e,t),Yn.init(e,t)}),EQ=Pe("ZodXID",(e,t)=>{oK.init(e,t),Yn.init(e,t)}),CQ=Pe("ZodKSUID",(e,t)=>{sK.init(e,t),Yn.init(e,t)}),_Q=Pe("ZodIPv4",(e,t)=>{uK.init(e,t),Yn.init(e,t)}),RQ=Pe("ZodIPv6",(e,t)=>{dK.init(e,t),Yn.init(e,t)}),jQ=Pe("ZodCIDRv4",(e,t)=>{fK.init(e,t),Yn.init(e,t)}),NQ=Pe("ZodCIDRv6",(e,t)=>{hK.init(e,t),Yn.init(e,t)}),TQ=Pe("ZodBase64",(e,t)=>{pK.init(e,t),Yn.init(e,t)}),OQ=Pe("ZodBase64URL",(e,t)=>{gK.init(e,t),Yn.init(e,t)}),MQ=Pe("ZodE164",(e,t)=>{yK.init(e,t),Yn.init(e,t)}),kQ=Pe("ZodJWT",(e,t)=>{xK.init(e,t),Yn.init(e,t)}),AQ=Pe("ZodUnknown",(e,t)=>{bK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AX()});function WN(){return fX(AQ)}const DQ=Pe("ZodNever",(e,t)=>{wK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kX(e,n,r)});function PQ(e){return hX(DQ,e)}const IQ=Pe("ZodArray",(e,t)=>{SK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zX(e,n,r,o),e.element=t.element,Qg(e,"ZodArray",{min(n,r){return this.check(Vm(n,r))},nonempty(n){return this.check(Vm(1,n))},max(n,r){return this.check(yD(n,r))},length(n,r){return this.check(vD(n,r))},unwrap(){return this.element}})});function Dc(e,t){return _X(IQ,e,t)}const zQ=Pe("ZodObject",(e,t)=>{CK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>LX(e,n,r,o),xn(e,"shape",()=>t.shape),Qg(e,"ZodObject",{keyof(){return Hm(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:WN()})},loose(){return this.clone({...this._zod.def,catchall:WN()})},strict(){return this.clone({...this._zod.def,catchall:PQ()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return KZ(this,n)},safeExtend(n){return XZ(this,n)},merge(n){return QZ(this,n)},pick(n){return ZZ(this,n)},omit(n){return GZ(this,n)},partial(...n){return WZ(CD,this,n[0])},required(...n){return JZ(_D,this,n[0])}})});function gl(e,t){const n={type:"object",shape:e??{},..._t(t)};return new zQ(n)}const LQ=Pe("ZodUnion",(e,t)=>{_K.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$X(e,n,r,o),e.options=t.options});function $Q(e,t){return new LQ({type:"union",options:e,..._t(t)})}const FQ=Pe("ZodIntersection",(e,t)=>{RK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>FX(e,n,r,o)});function VQ(e,t){return new FQ({type:"intersection",left:e,right:t})}const d0=Pe("ZodEnum",(e,t)=>{jK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(r,o,i)=>DX(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const l of r)if(n.has(l))i[l]=t.entries[l];else throw new Error(`Key ${l} not found in enum`);return new d0({...t,checks:[],..._t(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const l of r)if(n.has(l))delete i[l];else throw new Error(`Key ${l} not found in enum`);return new d0({...t,checks:[],..._t(o),entries:i})}});function Hm(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new d0({type:"enum",entries:n,..._t(t)})}const UQ=Pe("ZodTransform",(e,t)=>{NK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>IX(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new nD(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(nf(i,n.value,t));else{const l=i;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=e),n.issues.push(nf(l))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function HQ(e){return new UQ({type:"transform",transform:e})}const CD=Pe("ZodOptional",(e,t)=>{gD.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>SD(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function JN(e){return new CD({type:"optional",innerType:e})}const BQ=Pe("ZodExactOptional",(e,t)=>{TK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>SD(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qQ(e){return new BQ({type:"optional",innerType:e})}const YQ=Pe("ZodNullable",(e,t)=>{OK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>VX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function eT(e){return new YQ({type:"nullable",innerType:e})}const ZQ=Pe("ZodDefault",(e,t)=>{MK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>HX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GQ(e,t){return new ZQ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sD(t)}})}const KQ=Pe("ZodPrefault",(e,t)=>{kK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>BX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function XQ(e,t){return new KQ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sD(t)}})}const _D=Pe("ZodNonOptional",(e,t)=>{AK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>UX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function QQ(e,t){return new _D({type:"nonoptional",innerType:e,..._t(t)})}const WQ=Pe("ZodCatch",(e,t)=>{DK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function JQ(e,t){return new WQ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const eW=Pe("ZodPipe",(e,t)=>{PK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>YX(e,n,r,o),e.in=t.in,e.out=t.out});function tT(e,t){return new eW({type:"pipe",in:e,out:t})}const tW=Pe("ZodReadonly",(e,t)=>{IK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ZX(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nW(e){return new tW({type:"readonly",innerType:e})}const rW=Pe("ZodCustom",(e,t)=>{zK.init(e,t),pr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>PX(e,n)});function oW(e,t={}){return RX(rW,e,t)}function sW(e,t){return jX(e,t)}const Uf=jZ;function _n({...e}){return h.jsx(RD.Provider,{value:{name:e.name},children:h.jsx(EZ,{...e})})}function Rn({className:e,...t}){const n=b.useId();return h.jsx(jD.Provider,{value:{id:n},children:h.jsx("div",{"data-slot":"form-item",className:Nt("space-y-1.5",e),...t})})}function jn({className:e,...t}){const{error:n,formItemId:r}=zS();return h.jsx(kr,{"data-error":!!n,className:Nt("data-[error=true]:text-destructive",e),htmlFor:r,...t})}function vn({children:e,...t}){const{error:n,formItemId:r,formMessageId:o}=zS();return b.cloneElement(e,{id:r,"aria-describedby":n?o:void 0,"aria-invalid":!!n,...t})}function Nn({className:e,children:t,...n}){const{error:r,formMessageId:o}=zS(),i=r?.message??t;return i?h.jsx("p",{role:"alert",id:o,className:Nt("text-xs text-destructive",e),...n,children:i}):null}const RD=b.createContext(null),jD=b.createContext(null);function zS(){const e=b.useContext(RD),t=b.useContext(jD);if(!e)throw new Error("useFormField 必须在 <FormField> 内使用");if(!t)throw new Error("useFormField 必须在 <FormItem> 内使用");const{getFieldState:n,formState:r}=RZ(),o=n(e.name,r),{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-item`,formMessageId:`${i}-message`,...o}}const ND=b.createContext(void 0);function Hf(e){const t=b.useContext(ND);if(t===void 0&&!e)throw new Error(Er(47));return t}const iW={...Bw,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class aW extends _f{constructor(t,n,r){const o=new Nf;super(lW(t,o,n,r),cW(o),iW)}setOpen=(t,n)=>{const r=n.reason===vr,o=n.reason===cl&&n.event.detail===0,i=!t&&(n.reason===bg||n.reason==null),l=Jk(n),c=this.select("activeTriggerId");if(!t&&n.reason===uk&&n.trigger==null&&c!=null&&(n.trigger=this.context.triggerElements.getById(c)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const f=()=>{const p={open:t,openChangeReason:n.reason};Lw(p,t,n.trigger,l()),this.update(p)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Mk,()=>{this.set("stickIfOpen",!1)}),Co.flushSync(f)):f();let d;o?d="click":i?d="dismiss":n.reason===ma&&(d="focus"),this.set("instantType",d)}}function lW(e,t,n,r=!1){const o={...Uw(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return o.open&&e?.mounted===void 0&&(o.mounted=!0),o.floatingRootContext=nA(t,n,r),o}function cW(e){return{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new is,triggerElements:e}}function nT({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:i,modal:l=!1,handle:c,triggerId:f,defaultTriggerId:d=null}=e,p=dW(c,{modal:l,open:r,openProp:n,activeTriggerId:d,triggerIdProp:f});p.useControlledProp("openProp",n),p.useControlledProp("triggerIdProp",f);const g=p.useState("open"),y=p.useState("mounted"),v=p.useState("payload");p.useContextCallback("onOpenChange",o),p.useContextCallback("onOpenChangeComplete",i),tA(p,g),$w(p);const{forceUnmount:x}=Fw(g,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:l}),b.useEffect(()=>{g||p.context.stickIfOpenTimeout.clear()},[p,g]),b.useImperativeHandle(e.actionsRef,()=>({unmount:x,close:()=>p.setOpen(!1,Ot(Ew))}),[x,p]);const E=g||y;return h.jsxs(ND.Provider,{value:p,children:[c&&h.jsx(zw,{handle:c,store:p}),E&&h.jsx(fW,{store:p,modal:l}),typeof t=="function"?t({payload:v}):t]})}function uW(e){return Hf(!0)?h.jsx(nT,{props:e}):h.jsx(Vk,{children:h.jsx(nT,{props:e})})}function dW(e,t){const n=Wk((r,o)=>new aW(t,r,o));return b.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function fW({store:e,modal:t}){const n=e.useState("floatingRootContext"),r=Cg(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),o=r.reference,i=r.floating;return Vw(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i}),null}const hW=300,pW=b.forwardRef(function(t,n){const{render:r,className:o,style:i,disabled:l=!1,nativeButton:c=!0,handle:f,payload:d,openOnHover:p=!1,delay:g=hW,closeDelay:y=0,id:v,...x}=t,E=Hf(!0),_=oA(f)??E;if(!_)throw new Error(Er(74));const j=Rl(v),R=_.useState("isTriggerActive",j),N=_.useState("floatingRootContext"),O=_.useState("isOpenedByTrigger",j),k=_.useState("triggerPopupId",j),M=b.useRef(null),{registerTrigger:T,isMountedByThisTrigger:L}=eA(j,M,_,{payload:d,disabled:l,openOnHover:p,closeDelay:y}),G=_.useState("openChangeReason"),B=_.useState("stickIfOpen"),V=_.useState("openMethod"),q=_.useState("focusManagerModal"),I=lA(N,{enabled:!l&&p&&(V!=="touch"||G!==cl),mouseOnly:!0,move:!1,handleClose:dA(),restMs:g,delay:{close:y},triggerElementRef:M,isActiveTrigger:R,isClosing:()=>_.select("transitionStatus")==="ending"}),z=Dw(N,{stickIfOpen:B}),A=bA(()=>_.select("open"),J=>{_.set("openMethod",J)}),P=_.useState("triggerProps",L),{getButtonProps:U,buttonRef:H}=jl({disabled:l,native:c}),Y={open(J){return J&&G===cl?jm.open(J):SA.open(J)}},{preFocusGuardRef:$,handlePreFocusGuardFocus:F,handleFocusTargetFocus:Q}=n2(_,M),ne=bn("button",t,{state:{disabled:l,open:O},ref:[H,n,T,M],props:[z.reference,I,P,A,{[kk]:"",id:j,"aria-haspopup":"dialog","aria-expanded":O,"aria-controls":k},x,U],stateAttributesMapping:Y}),te=h.jsx(b.Fragment,{children:ne},j);return L&&!q?h.jsxs(b.Fragment,{children:[h.jsx(ga,{ref:$,onFocus:F}),te,h.jsx(ga,{ref:_.context.triggerFocusTargetRef,onFocus:Q})]}):te}),TD=b.createContext(void 0);function mW(){const e=b.useContext(TD);if(e===void 0)throw new Error(Er(45));return e}const gW=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return Hf().useState("mounted")||r?h.jsx(TD.Provider,{value:r,children:h.jsx(Sg,{ref:n,...o})}):null}),OD=b.createContext(void 0);function yW(){const e=b.useContext(OD);if(!e)throw new Error(Er(46));return e}const vW=b.forwardRef(function(t,n){const{render:r,className:o,style:i,anchor:l,positionMethod:c,side:f,align:d,sideOffset:p,alignOffset:g,collisionBoundary:y="clipping-ancestors",collisionPadding:v,arrowPadding:x,sticky:E,disableAnchorTracking:S=!1,collisionAvoidance:_=Dk,...j}=t,R=Hf(),N=mW(),O=kw(),k=R.useState("floatingRootContext"),M=R.useState("mounted"),T=R.useState("open"),L=R.useState("openChangeReason"),G=R.useState("activeTriggerElement"),B=R.useState("modal"),V=R.useState("openMethod"),q=R.useState("positionerElement"),I=R.useState("instantType"),z=R.useState("transitionStatus"),A=R.useState("adaptiveOrigin"),P=b.useRef(null),U=Iw(q),H=Ww({anchor:l,floatingRootContext:k,positionMethod:c,mounted:M,side:f,sideOffset:p,align:d,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:v,sticky:E,disableAnchorTracking:S,keepMounted:N,nodeId:O,collisionAvoidance:_,adaptiveOrigin:A}),Y=k.useState("domReferenceElement");tt(()=>{const ne=Y,te=P.current;if(ne&&(P.current=ne),te&&ne&&ne!==te){R.set("instantType",void 0);const J=new AbortController;return U(()=>{R.set("instantType","trigger-change")},J.signal),()=>{J.abort()}}},[Y,U,R]);const $=B===!0&&L!==vr;tS(T&&$,V==="touch",q,G);const F=R.useStateSetter("positionerElement"),Q={open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:I},X=eS(t,Q,{styles:H.positionerStyles,transitionStatus:z,props:j,refs:[n,F],hidden:!M,inert:!T});return h.jsxs(OD.Provider,{value:H,children:[M&&$&&h.jsx(Ag,{inert:kg(!T),cutout:G}),h.jsx(Fk,{id:O,children:X})]})}),xW=b.createContext(void 0);function bW(){const[e,t]=b.useState(0),n=dt(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const wW=b.forwardRef(function(t,n){const{render:r,className:o,style:i,initialFocus:l,finalFocus:c,...f}=t,d=Hf(),p=yW(),g=nS()!=null,{context:y,hasClosePart:v}=bW(),x=d.useState("open"),E=d.useState("openMethod"),S=d.useState("instantType"),_=d.useState("transitionStatus"),j=d.useState("popupProps"),R=d.useState("titleElementId"),N=d.useState("descriptionElementId"),O=d.useState("modal"),k=d.useState("mounted"),M=d.useState("openChangeReason"),T=d.useState("activeTriggerElement"),L=d.useState("floatingRootContext"),G=L.useState("floatingId"),B=d.useState("disabled"),V=d.useState("openOnHover"),q=d.useState("closeDelay");Ra({open:x,ref:d.context.popupRef,onComplete(){x&&d.context.onOpenChangeComplete?.(!0)}}),aA(L,{enabled:V&&!B,closeDelay:q});const I=l===void 0?Qk(d.context.popupRef):l,z=O!==!1&&v;d.useSyncedValue("focusManagerModal",z);const A=d.useStateSetter("popupElement"),P={open:x,side:p.side,align:p.align,instant:S,transitionStatus:_},U=bn("div",t,{state:P,ref:[n,d.context.popupRef,A],props:[j,{id:G,role:"dialog",...Ng,"aria-labelledby":R,"aria-describedby":N,onKeyDown(H){g&&Ig.has(H.key)&&H.stopPropagation()}},Dg(_),f],stateAttributesMapping:Kw});return h.jsx(Eg,{context:L,openInteractionType:E,modal:z,disabled:!k||M===vr,initialFocus:I,returnFocus:c,restoreFocus:"popup",previousFocusableElement:Cn(T)?T:void 0,nextFocusableElement:d.context.triggerFocusTargetRef,beforeContentFocusGuardRef:d.context.beforeContentFocusGuardRef,children:h.jsx(xW.Provider,{value:y,children:U})})});function LS({...e}){return h.jsx(uW,{"data-slot":"popover",...e})}function $S({...e}){return h.jsx(pW,{"data-slot":"popover-trigger",...e})}function FS({className:e,align:t="center",alignOffset:n=0,side:r="bottom",sideOffset:o=4,...i}){return h.jsx(gW,{children:h.jsx(vW,{align:t,alignOffset:n,side:r,sideOffset:o,className:"isolate z-50",children:h.jsx(wW,{"data-slot":"popover-content",className:Nt("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i})})})}var rT=1,SW=.9,EW=.8,CW=.17,Xx=.1,Qx=.999,_W=.9999,RW=.99,jW=/[\\\/_+.#"@\[\(\{&]/,NW=/[\\\/_+.#"@\[\(\{&]/g,TW=/[\s-]/,MD=/[\s-]/g;function f0(e,t,n,r,o,i,l){if(i===t.length)return o===e.length?rT:RW;var c=`${o},${i}`;if(l[c]!==void 0)return l[c];for(var f=r.charAt(i),d=n.indexOf(f,o),p=0,g,y,v,x;d>=0;)g=f0(e,t,n,r,d+1,i+1,l),g>p&&(d===o?g*=rT:jW.test(e.charAt(d-1))?(g*=EW,v=e.slice(o,d-1).match(NW),v&&o>0&&(g*=Math.pow(Qx,v.length))):TW.test(e.charAt(d-1))?(g*=SW,x=e.slice(o,d-1).match(MD),x&&o>0&&(g*=Math.pow(Qx,x.length))):(g*=CW,o>0&&(g*=Math.pow(Qx,d-o))),e.charAt(d)!==t.charAt(i)&&(g*=_W)),(g<Xx&&n.charAt(d-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(d-1)!==r.charAt(i))&&(y=f0(e,t,n,r,d+1,i+2,l),y*Xx>g&&(g=y*Xx)),g>p&&(p=g),d=n.indexOf(f,d+1);return l[c]=p,p}function oT(e){return e.toLowerCase().replace(MD," ")}function OW(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,f0(e,t,oT(e),oT(t),0,0,{})}var MW=Object.defineProperty,bu=(e,t)=>MW(e,"name",{value:t,configurable:!0}),kD=!!(typeof window<"u"&&window.document&&window.document.createElement);function rl(e,t,{checkForDefaultPrevented:n=!0}={}){return bu(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}bu(rl,"composeEventHandlers");function kW(e){if(!kD)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}bu(kW,"getOwnerWindow");function h0(e){if(!kD)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}bu(h0,"getOwnerDocument");function AD(e,t=!1){const{activeElement:n}=h0(e);if(!n?.nodeName)return null;if(DD(n)&&n.contentDocument)return AD(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=h0(n).getElementById(r);if(o)return o}}return n}bu(AD,"getActiveElement");function DD(e){return e.tagName==="IFRAME"}bu(DD,"isFrame");var AW=Object.defineProperty,VS=(e,t)=>AW(e,"name",{value:t,configurable:!0});function p0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}VS(p0,"setRef");function yl(...e){return t=>{let n=!1;const r=e.map(o=>{const i=p0(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():p0(e[o],null)}}}}VS(yl,"composeRefs");function wu(...e){return b.useCallback(yl(...e),e)}VS(wu,"useComposedRefs");var DW=Object.defineProperty,$o=(e,t)=>DW(e,"name",{value:t,configurable:!0});function PW(e,t){const n=b.createContext(t);n.displayName=e+"Context";const r=$o(i=>{const{children:l,...c}=i,f=b.useMemo(()=>c,Object.values(c));return h.jsx(n.Provider,{value:f,children:l})},"Provider");r.displayName=e+"Provider";function o(i,l={}){const{optional:c=!1}=l,f=b.useContext(n);if(f)return f;if(t!==void 0)return t;if(!c)throw new Error(`\`${i}\` must be used within \`${e}\``)}return $o(o,"useContext"),[r,o]}$o(PW,"createContext");function PD(e,t=[]){let n=[];function r(i,l){const c=b.createContext(l);c.displayName=i+"Context";const f=n.length;n=[...n,l];const d=$o(g=>{const{scope:y,children:v,...x}=g,E=y?.[e]?.[f]||c,S=b.useMemo(()=>x,Object.values(x));return h.jsx(E.Provider,{value:S,children:v})},"Provider");d.displayName=i+"Provider";function p(g,y,v={}){const{optional:x=!1}=v,E=y?.[e]?.[f]||c,S=b.useContext(E);if(S)return S;if(l!==void 0)return l;if(!x)throw new Error(`\`${g}\` must be used within \`${i}\``)}return $o(p,"useContext"),[d,p]}$o(r,"createContext");const o=$o(()=>{const i=n.map(l=>b.createContext(l));return $o(function(c){const f=c?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])},"useScope")},"createScope");return o.scopeName=e,[r,ID(o,...t)]}$o(PD,"createContextScope");function ID(...e){const t=e[0];if(e.length===1)return t;const n=$o(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return $o(function(i){const l=r.reduce((c,{useScope:f,scopeName:d})=>{const g=f(i)[`__scope${d}`];return{...c,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}$o(ID,"composeContextScopes");var Wc=globalThis?.document?b.useLayoutEffect:()=>{},IW=Object.defineProperty,zW=(e,t)=>IW(e,"name",{value:t,configurable:!0}),LW=Cl[" useId ".trim().toString()]||(()=>{}),$W=0;function zs(e){const[t,n]=b.useState(LW());return Wc(()=>{e||n(r=>r??String($W++))},[e]),e||(t?`radix-${t}`:"")}zW(zs,"useId");var FW=Object.defineProperty,VW=(e,t)=>FW(e,"name",{value:t,configurable:!0}),sT=Cl[" useEffectEvent ".trim().toString()],iT=Cl[" useInsertionEffect ".trim().toString()];function zD(e){if(typeof sT=="function")return sT(e);const t=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof iT=="function"?iT(()=>{t.current=e}):Wc(()=>{t.current=e}),b.useMemo(()=>((...n)=>t.current?.(...n)),[])}VW(zD,"useEffectEvent");var UW=Object.defineProperty,Bf=(e,t)=>UW(e,"name",{value:t,configurable:!0}),HW=Cl[" useInsertionEffect ".trim().toString()]||Wc;function LD({prop:e,defaultProp:t,onChange:n=Bf(()=>{},"onChange"),caller:r}){const[o,i,l]=$D({defaultProp:t,onChange:n}),c=e!==void 0,f=c?e:o,d=b.useCallback(p=>{if(c){const g=FD(p)?p(e):p;g!==e&&l.current?.(g)}else i(p)},[c,e,i,l]);return[f,d]}Bf(LD,"useControllableState");function $D({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),o=b.useRef(n),i=b.useRef(t);return HW(()=>{i.current=t},[t]),b.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}Bf($D,"useUncontrolledState");function FD(e){return typeof e=="function"}Bf(FD,"isFunction");var aT=Symbol("RADIX:SYNC_STATE");function BW(e,t,n,r){const{prop:o,defaultProp:i,onChange:l,caller:c}=t,f=o!==void 0,d=zD(l),p=[{...n,state:i}];r&&p.push(r);const[g,y]=b.useReducer((S,_)=>{if(_.type===aT)return{...S,state:_.state};const j=e(S,_);return f&&!Object.is(j.state,S.state)&&d(j.state),j},...p),v=g.state,x=b.useRef(v);b.useEffect(()=>{x.current!==v&&(x.current=v,f||d(v))},[v,x,f]);const E=b.useMemo(()=>o!==void 0?{...g,state:o}:g,[g,o]);return b.useEffect(()=>{f&&!Object.is(o,g.state)&&y({type:aT,state:o})},[o,g.state,f]),[E,y]}Bf(BW,"useControllableStateReducer");var qW=Object.defineProperty,ms=(e,t)=>qW(e,"name",{value:t,configurable:!0});function US(e){const t=b.forwardRef((n,r)=>{let{children:o,...i}=n,l=null,c=!1;const f=[];m0(o)&&typeof Ap=="function"&&(o=Ap(o._payload)),b.Children.forEach(o,y=>{if(BD(y)){c=!0;const v=y;let x="child"in v.props?v.props.child:v.props.children;m0(x)&&typeof Ap=="function"&&(x=Ap(x._payload)),l=ZW(v,x),f.push(l?.props?.children)}else f.push(y)}),l?l=b.cloneElement(l,void 0,f):!c&&b.Children.count(o)===1&&b.isValidElement(o)&&(l=o);const d=l?HD(l):void 0,p=wu(r,d);if(!l){if(o||o===0)throw new Error(c?XW(e):KW(e));return o}const g=UD(i,l.props??{});return l.type!==b.Fragment&&(g.ref=r?p:d),b.cloneElement(l,g)});return t.displayName=`${e}.Slot`,t}ms(US,"createSlot");var VD=Symbol.for("radix.slottable");function YW(e){const t=ms(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=VD,t}ms(YW,"createSlottable");var ZW=ms((e,t)=>{if("child"in e.props){const n=e.props.child;return b.isValidElement(n)?b.cloneElement(n,void 0,e.props.children(n.props.children)):null}return b.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function UD(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const f=i(...c);return o(...c),f}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}ms(UD,"mergeProps");function HD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ms(HD,"getElementRef");function BD(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VD}ms(BD,"isSlottable");var GW=Symbol.for("react.lazy");function m0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===GW&&"_payload"in e&&qD(e._payload)}ms(m0,"isLazyComponent");function qD(e){return typeof e=="object"&&e!==null&&"then"in e}ms(qD,"isPromiseLike");var KW=ms(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),XW=ms(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ap=Cl[" use ".trim().toString()],QW=Object.defineProperty,WW=(e,t)=>QW(e,"name",{value:t,configurable:!0}),JW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Yo=JW.reduce((e,t)=>{const n=US(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:l,...c}=o,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(f,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function YD(e,t){e&&Co.flushSync(()=>e.dispatchEvent(t))}WW(YD,"dispatchDiscreteCustomEvent");var eJ=Object.defineProperty,tJ=(e,t)=>eJ(e,"name",{value:t,configurable:!0});function Jc(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>((...n)=>t.current?.(...n)),[])}tJ(Jc,"useCallbackRef");var nJ=Object.defineProperty,xr=(e,t)=>nJ(e,"name",{value:t,configurable:!0}),g0="dismissableLayer.update",rJ="dismissableLayer.pointerDownOutside",oJ="dismissableLayer.focusOutside",lT,ZD=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),sJ=b.forwardRef(xr(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,onDismiss:d,...p}=t,g=b.useContext(ZD),[y,v]=b.useState(null),x=y?.ownerDocument??globalThis?.document,[,E]=b.useState({}),S=wu(n,v),_=Array.from(g.layers),[j]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),R=j?_.indexOf(j):-1,N=y?_.indexOf(y):-1,O=g.layersWithOutsidePointerEventsDisabled.size>0,k=N>=R,M=b.useRef(!1),T=KD(V=>{l?.(V),f?.(V),V.defaultPrevented||d?.()},{ownerDocument:x,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:b.useCallback(V=>{if(!(V instanceof Node))return!1;const q=[...g.branches].some(I=>I.contains(V));return k&&!q},[g.branches,k])}),L=XD(V=>{if(o&&M.current)return;const q=V.target;[...g.branches].some(z=>z.contains(q))||(c?.(V),f?.(V),V.defaultPrevented||d?.())},x),G=y?N===_.length-1:!1,B=Jc(V=>{V.key==="Escape"&&(i?.(V),!V.defaultPrevented&&d&&(V.preventDefault(),d()))});return b.useEffect(()=>{if(G)return x.addEventListener("keydown",B,{capture:!0}),()=>x.removeEventListener("keydown",B,{capture:!0})},[x,G,B]),b.useEffect(()=>{if(y)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(lT=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),y0(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(y),g.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=lT))}},[y,x,r,g]),b.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),y0())},[y,g]),b.useEffect(()=>{const V=xr(()=>E({}),"handleUpdate");return document.addEventListener(g0,V),()=>document.removeEventListener(g0,V)},[]),h.jsx(Yo.div,{...p,ref:S,style:{pointerEvents:O?k?"auto":"none":void 0,...t.style},onFocusCapture:rl(t.onFocusCapture,L.onFocusCapture),onBlurCapture:rl(t.onBlurCapture,L.onBlurCapture),onPointerDownCapture:rl(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function GD(){const e=b.useContext(ZD),[t,n]=b.useState(null);return b.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}xr(GD,"useDismissableLayerSurface");var iJ=xr(()=>!0,"IS_TRUE");function KD(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:l=iJ}=t,c=Jc(e),f=b.useRef(!1),d=b.useRef(!1),p=b.useRef(new Map),g=b.useRef(()=>{});return b.useEffect(()=>{function y(){d.current=!1,o.current=!1,p.current.clear()}xr(y,"resetOutsideInteraction");function v(){return Array.from(p.current.values()).some(Boolean)}xr(v,"isOutsideInteractionIntercepted");function x(R){if(!d.current)return;const N=R.target;N instanceof Node&&[...i].some(k=>k.contains(N))||p.current.set(R.type,!0),R.type==="click"&&window.setTimeout(()=>{d.current&&g.current()},0)}xr(x,"handleInteractionCapture");function E(R){d.current&&p.current.set(R.type,!1)}xr(E,"handleInteractionBubble");const S=xr(R=>{if(R.target&&!f.current){let N=function(){n.removeEventListener("click",g.current);const k=v();y(),k||HS(rJ,c,O,{discrete:!0})};if(xr(N,"handleAndDispatchPointerDownOutsideEvent"),!l(R.target)){n.removeEventListener("click",g.current),y(),f.current=!1;return}const O={originalEvent:R};d.current=!0,o.current=r&&R.button===0,p.current.clear(),!r||R.button!==0?N():(n.removeEventListener("click",g.current),g.current=N,n.addEventListener("click",g.current,{once:!0}))}else n.removeEventListener("click",g.current),y();f.current=!1},"handlePointerDown"),_=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const R of _)n.addEventListener(R,x,!0),n.addEventListener(R,E);const j=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(j),n.removeEventListener("pointerdown",S),n.removeEventListener("click",g.current);for(const R of _)n.removeEventListener(R,x,!0),n.removeEventListener(R,E)}},[n,c,r,o,i,l]),{onPointerDownCapture:xr(()=>f.current=!0,"onPointerDownCapture")}}xr(KD,"usePointerDownOutside");function XD(e,t=globalThis?.document){const n=Jc(e),r=b.useRef(!1);return b.useEffect(()=>{const o=xr(i=>{i.target&&!r.current&&HS(oJ,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:xr(()=>r.current=!0,"onFocusCapture"),onBlurCapture:xr(()=>r.current=!1,"onBlurCapture")}}xr(XD,"useFocusOutside");function y0(){const e=new CustomEvent(g0);document.dispatchEvent(e)}xr(y0,"dispatchUpdate");function HS(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YD(o,i):o.dispatchEvent(i)}xr(HS,"handleAndDispatchCustomEvent");var aJ=Object.defineProperty,Gr=(e,t)=>aJ(e,"name",{value:t,configurable:!0}),Wx="focusScope.autoFocusOnMount",Jx="focusScope.autoFocusOnUnmount",cT={bubbles:!1,cancelable:!0},lJ=b.forwardRef(Gr(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...c}=t,[f,d]=b.useState(null),p=Jc(i),g=Jc(l),y=b.useRef(null),v=wu(n,d),x=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(o){let S=function(N){if(x.paused||!f)return;const O=N.target;f.contains(O)?y.current=O:pi(y.current,{select:!0})},_=function(N){if(x.paused||!f)return;const O=N.relatedTarget;O!==null&&(f.contains(O)||pi(y.current,{select:!0}))},j=function(N){if(document.activeElement===document.body)for(const k of N)k.removedNodes.length>0&&pi(f)};Gr(S,"handleFocusIn"),Gr(_,"handleFocusOut"),Gr(j,"handleMutations"),document.addEventListener("focusin",S),document.addEventListener("focusout",_);const R=new MutationObserver(j);return f&&R.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",_),R.disconnect()}}},[o,f,x.paused]),b.useEffect(()=>{if(f){uT.add(x);const S=document.activeElement;if(!f.contains(S)){const j=new CustomEvent(Wx,cT);f.addEventListener(Wx,p),f.dispatchEvent(j),j.defaultPrevented||(QD(nP(BS(f)),{select:!0}),document.activeElement===S&&pi(f))}return()=>{f.removeEventListener(Wx,p),setTimeout(()=>{const j=new CustomEvent(Jx,cT);f.addEventListener(Jx,g),f.dispatchEvent(j),j.defaultPrevented||pi(S??document.body,{select:!0}),f.removeEventListener(Jx,g),uT.remove(x)},0)}}},[f,p,g,x]);const E=b.useCallback(S=>{if(!r&&!o||x.paused)return;const _=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,j=document.activeElement;if(_&&j){const R=S.currentTarget,[N,O]=WD(R);N&&O?!S.shiftKey&&j===O?(S.preventDefault(),r&&pi(N,{select:!0})):S.shiftKey&&j===N&&(S.preventDefault(),r&&pi(O,{select:!0})):j===R&&S.preventDefault()}},[r,o,x.paused]);return h.jsx(Yo.div,{tabIndex:-1,...c,ref:v,onKeyDown:E})},"FocusScope"));function QD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pi(r,{select:t}),document.activeElement!==n)return}Gr(QD,"focusFirst");function WD(e){const t=BS(e),n=v0(t,e),r=v0(t.reverse(),e);return[n,r]}Gr(WD,"getTabbableEdges");function BS(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Gr(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Gr(BS,"getTabbableCandidates");function v0(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):JD(r,{upTo:t})))return r}Gr(v0,"findVisible");function JD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Gr(JD,"isHidden");function eP(e){return e instanceof HTMLInputElement&&"select"in e}Gr(eP,"isSelectableInput");function pi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&eP(e)&&t&&e.select()}}Gr(pi,"focus");var uT=tP();function tP(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=x0(e,t),e.unshift(t)},remove(t){e=x0(e,t),e[0]?.resume()}}}Gr(tP,"createFocusScopesStack");function x0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Gr(x0,"arrayRemove");function nP(e){return e.filter(t=>t.tagName!=="A")}Gr(nP,"removeLinks");var cJ=Object.defineProperty,uJ=(e,t)=>cJ(e,"name",{value:t,configurable:!0}),dJ=b.forwardRef(uJ(function(t,n){const{container:r,...o}=t,[i,l]=b.useState(!1);Wc(()=>l(!0),[]);const c=r||i&&globalThis?.document?.body;return c?Co.createPortal(h.jsx(Yo.div,{...o,ref:n}),c):null},"Portal")),fJ=Object.defineProperty,Si=(e,t)=>fJ(e,"name",{value:t,configurable:!0});function rP(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}Si(rP,"useStateMachine");var qS=Si(e=>{const{present:t,children:n}=e,r=oP(t),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=sP(r.ref,iP(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:i}):null},"Presence");function oP(e){const[t,n]=b.useState(),r=b.useRef(null),o=b.useRef(e),i=b.useRef("none"),l=b.useRef(void 0),c=e?"mounted":"unmounted",[f,d]=rP(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{f==="mounted"?(i.current=l.current??jc(r.current),l.current=void 0):i.current="none"},[f]),Wc(()=>{const p=r.current,g=o.current;if(g!==e){const v=i.current,x=jc(p);e?(l.current=x,d("MOUNT")):x==="none"||p?.display==="none"?d("UNMOUNT"):d(g&&v!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Wc(()=>{if(t){let p;const g=t.ownerDocument.defaultView??window,y=Si(x=>{const S=jc(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&S&&(d("ANIMATION_END"),!o.current)){const _=t.style.animationFillMode;t.style.animationFillMode="forwards",p=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=_)})}},"handleAnimationEnd"),v=Si(x=>{x.target===t&&(i.current=jc(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{g.clearTimeout(p),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(p=>{if(p){const g=getComputedStyle(p);r.current=g,l.current=jc(g)}else r.current=null;n(p)},[])}}Si(oP,"usePresence");function b0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Si(b0,"setRef");function sP(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const r=t.current;let o=!1;const i=r.map(l=>{const c=b0(l,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let l=0;l<i.length;l++){const c=i[l];typeof c=="function"?c():b0(r[l],null)}}},[])}Si(sP,"useStableComposedRefs");function jc(e){return e?.animationName||"none"}Si(jc,"getAnimationName");function iP(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Si(iP,"getElementRef");var hJ=Object.defineProperty,YS=(e,t)=>hJ(e,"name",{value:t,configurable:!0}),Dp=0,mc=null;function pJ(e){return ZS(),e.children}YS(pJ,"FocusGuards");function ZS(){b.useEffect(()=>{mc||(mc={start:w0(),end:w0()});const{start:e,end:t}=mc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Dp++,()=>{Dp===1&&(mc?.start.remove(),mc?.end.remove(),mc=null),Dp=Math.max(0,Dp-1)}},[])}YS(ZS,"useFocusGuards");function w0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}YS(w0,"createFocusGuard");var As=function(){return As=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},As.apply(this,arguments)};function aP(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function mJ(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var sm="right-scroll-bar-position",im="width-before-scroll-bar",gJ="with-scroll-bars-hidden",yJ="--removed-body-scroll-bar-size";function eb(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vJ(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var xJ=typeof window<"u"?b.useLayoutEffect:b.useEffect,dT=new WeakMap;function bJ(e,t){var n=vJ(null,function(r){return e.forEach(function(o){return eb(o,r)})});return xJ(function(){var r=dT.get(n);if(r){var o=new Set(r),i=new Set(e),l=n.current;o.forEach(function(c){i.has(c)||eb(c,null)}),i.forEach(function(c){o.has(c)||eb(c,l)})}dT.set(n,e)},[e]),n}function wJ(e){return e}function SJ(e,t){t===void 0&&(t=wJ);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(i),l=n}var f=function(){var p=l;l=[],p.forEach(i)},d=function(){return Promise.resolve().then(f)};d(),n={push:function(p){l.push(p),d()},filter:function(p){return l=l.filter(p),n}}}};return o}function EJ(e){e===void 0&&(e={});var t=SJ(null);return t.options=As({async:!0,ssr:!1},e),t}var lP=function(e){var t=e.sideCar,n=aP(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,As({},n))};lP.isSideCarExport=!0;function CJ(e,t){return e.useMedium(t),lP}var cP=EJ(),tb=function(){},Wg=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:tb,onWheelCapture:tb,onTouchMoveCapture:tb}),o=r[0],i=r[1],l=e.forwardProps,c=e.children,f=e.className,d=e.removeScrollBar,p=e.enabled,g=e.shards,y=e.sideCar,v=e.noRelative,x=e.noIsolation,E=e.inert,S=e.allowPinchZoom,_=e.as,j=_===void 0?"div":_,R=e.gapMode,N=aP(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=y,k=bJ([n,t]),M=As(As({},N),o);return b.createElement(b.Fragment,null,p&&b.createElement(O,{sideCar:cP,removeScrollBar:d,shards:g,noRelative:v,noIsolation:x,inert:E,setCallbacks:i,allowPinchZoom:!!S,lockRef:n,gapMode:R}),l?b.cloneElement(b.Children.only(c),As(As({},M),{ref:k})):b.createElement(j,As({},M,{className:f,ref:k}),c))});Wg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wg.classNames={fullWidth:im,zeroRight:sm};var _J=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RJ(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_J();return t&&e.setAttribute("nonce",t),e}function jJ(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function NJ(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var TJ=function(){var e=0,t=null;return{add:function(n){e==0&&(t=RJ())&&(jJ(t,n),NJ(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},OJ=function(){var e=TJ();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uP=function(){var e=OJ(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},MJ={left:0,top:0,right:0,gap:0},nb=function(e){return parseInt(e||"",10)||0},kJ=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[nb(n),nb(r),nb(o)]},AJ=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return MJ;var t=kJ(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},DJ=uP(),Vc="data-scroll-locked",PJ=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
76
|
+
.`.concat(gJ,` {
|
|
77
|
+
overflow: hidden `).concat(r,`;
|
|
78
|
+
padding-right: `).concat(c,"px ").concat(r,`;
|
|
79
|
+
}
|
|
80
|
+
body[`).concat(Vc,`] {
|
|
81
|
+
overflow: hidden `).concat(r,`;
|
|
82
|
+
overscroll-behavior: contain;
|
|
83
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
84
|
+
padding-left: `.concat(o,`px;
|
|
85
|
+
padding-top: `).concat(i,`px;
|
|
86
|
+
padding-right: `).concat(l,`px;
|
|
87
|
+
margin-left:0;
|
|
88
|
+
margin-top:0;
|
|
89
|
+
margin-right: `).concat(c,"px ").concat(r,`;
|
|
90
|
+
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.`).concat(sm,` {
|
|
94
|
+
right: `).concat(c,"px ").concat(r,`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.`).concat(im,` {
|
|
98
|
+
margin-right: `).concat(c,"px ").concat(r,`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.`).concat(sm," .").concat(sm,` {
|
|
102
|
+
right: 0 `).concat(r,`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.`).concat(im," .").concat(im,` {
|
|
106
|
+
margin-right: 0 `).concat(r,`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
body[`).concat(Vc,`] {
|
|
110
|
+
`).concat(yJ,": ").concat(c,`px;
|
|
111
|
+
}
|
|
112
|
+
`)},fT=function(){var e=parseInt(document.body.getAttribute(Vc)||"0",10);return isFinite(e)?e:0},IJ=function(){b.useEffect(function(){return document.body.setAttribute(Vc,(fT()+1).toString()),function(){var e=fT()-1;e<=0?document.body.removeAttribute(Vc):document.body.setAttribute(Vc,e.toString())}},[])},zJ=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;IJ();var i=b.useMemo(function(){return AJ(o)},[o]);return b.createElement(DJ,{styles:PJ(i,!t,o,n?"":"!important")})},S0=!1;if(typeof window<"u")try{var Pp=Object.defineProperty({},"passive",{get:function(){return S0=!0,!0}});window.addEventListener("test",Pp,Pp),window.removeEventListener("test",Pp,Pp)}catch{S0=!1}var gc=S0?{passive:!1}:!1,LJ=function(e){return e.tagName==="TEXTAREA"},dP=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!LJ(e)&&n[t]==="visible")},$J=function(e){return dP(e,"overflowY")},FJ=function(e){return dP(e,"overflowX")},hT=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=fP(e,r);if(o){var i=hP(e,r),l=i[1],c=i[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},VJ=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},UJ=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},fP=function(e,t){return e==="v"?$J(t):FJ(t)},hP=function(e,t){return e==="v"?VJ(t):UJ(t)},HJ=function(e,t){return e==="h"&&t==="rtl"?-1:1},BJ=function(e,t,n,r,o){var i=HJ(e,window.getComputedStyle(t).direction),l=i*r,c=n.target,f=t.contains(c),d=!1,p=l>0,g=0,y=0;do{if(!c)break;var v=hP(e,c),x=v[0],E=v[1],S=v[2],_=E-S-i*x;(x||_)&&fP(e,c)&&(g+=_,y+=x);var j=c.parentNode;c=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!f&&c!==document.body||f&&(t.contains(c)||t===c));return(p&&Math.abs(g)<1||!p&&Math.abs(y)<1)&&(d=!0),d},Ip=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pT=function(e){return[e.deltaX,e.deltaY]},mT=function(e){return e&&"current"in e?e.current:e},qJ=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YJ=function(e){return`
|
|
113
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
114
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
115
|
+
`)},ZJ=0,yc=[];function GJ(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(ZJ++)[0],i=b.useState(uP)[0],l=b.useRef(e);b.useEffect(function(){l.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var E=mJ([e.lockRef.current],(e.shards||[]).map(mT),!0).filter(Boolean);return E.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),E.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=b.useCallback(function(E,S){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!l.current.allowPinchZoom;var _=Ip(E),j=n.current,R="deltaX"in E?E.deltaX:j[0]-_[0],N="deltaY"in E?E.deltaY:j[1]-_[1],O,k=E.target,M=Math.abs(R)>Math.abs(N)?"h":"v";if("touches"in E&&M==="h"&&k.type==="range")return!1;var T=window.getSelection(),L=T&&T.anchorNode,G=L?L===k||L.contains(k):!1;if(G)return!1;var B=hT(M,k);if(!B)return!0;if(B?O=M:(O=M==="v"?"h":"v",B=hT(M,k)),!B)return!1;if(!r.current&&"changedTouches"in E&&(R||N)&&(r.current=O),!O)return!0;var V=r.current||O;return BJ(V,S,E,V==="h"?R:N)},[]),f=b.useCallback(function(E){var S=E;if(!(!yc.length||yc[yc.length-1]!==i)){var _="deltaY"in S?pT(S):Ip(S),j=t.current.filter(function(O){return O.name===S.type&&(O.target===S.target||S.target===O.shadowParent)&&qJ(O.delta,_)})[0];if(j&&j.should){S.cancelable&&S.preventDefault();return}if(!j){var R=(l.current.shards||[]).map(mT).filter(Boolean).filter(function(O){return O.contains(S.target)}),N=R.length>0?c(S,R[0]):!l.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),d=b.useCallback(function(E,S,_,j){var R={name:E,delta:S,target:_,should:j,shadowParent:KJ(_)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(N){return N!==R})},1)},[]),p=b.useCallback(function(E){n.current=Ip(E),r.current=void 0},[]),g=b.useCallback(function(E){d(E.type,pT(E),E.target,c(E,e.lockRef.current))},[]),y=b.useCallback(function(E){d(E.type,Ip(E),E.target,c(E,e.lockRef.current))},[]);b.useEffect(function(){return yc.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,gc),document.addEventListener("touchmove",f,gc),document.addEventListener("touchstart",p,gc),function(){yc=yc.filter(function(E){return E!==i}),document.removeEventListener("wheel",f,gc),document.removeEventListener("touchmove",f,gc),document.removeEventListener("touchstart",p,gc)}},[]);var v=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(i,{styles:YJ(o)}):null,v?b.createElement(zJ,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function KJ(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const XJ=CJ(cP,GJ);var pP=b.forwardRef(function(e,t){return b.createElement(Wg,As({},e,{ref:t,sideCar:XJ}))});pP.classNames=Wg.classNames;var QJ=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},vc=new WeakMap,zp=new WeakMap,Lp={},rb=0,mP=function(e){return e&&(e.host||mP(e.parentNode))},WJ=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=mP(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},JJ=function(e,t,n,r){var o=WJ(t,Array.isArray(e)?e:[e]);Lp[n]||(Lp[n]=new WeakMap);var i=Lp[n],l=[],c=new Set,f=new Set(o),d=function(g){!g||c.has(g)||(c.add(g),d(g.parentNode))};o.forEach(d);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(c.has(y))p(y);else try{var v=y.getAttribute(r),x=v!==null&&v!=="false",E=(vc.get(y)||0)+1,S=(i.get(y)||0)+1;vc.set(y,E),i.set(y,S),l.push(y),E===1&&x&&zp.set(y,!0),S===1&&y.setAttribute(n,"true"),x||y.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",y,_)}})};return p(t),c.clear(),rb++,function(){l.forEach(function(g){var y=vc.get(g)-1,v=i.get(g)-1;vc.set(g,y),i.set(g,v),y||(zp.has(g)||g.removeAttribute(r),zp.delete(g)),v||g.removeAttribute(n)}),rb--,rb||(vc=new WeakMap,vc=new WeakMap,zp=new WeakMap,Lp={})}},eee=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=QJ(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),JJ(r,o,n,"aria-hidden")):function(){return null}},tee=Object.defineProperty,ji=(e,t)=>tee(e,"name",{value:t,configurable:!0}),GS="Dialog",[gP,Ide]=PD(GS),[nee,kl]=gP(GS),ree=ji(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=b.useRef(null),f=b.useRef(null),[d,p]=LD({prop:r,defaultProp:o??!1,onChange:i,caller:GS}),[g,y]=b.useState(0),[v,x]=b.useState(0);return h.jsx(nee,{scope:t,triggerRef:c,contentRef:f,contentId:zs(),titleId:zs(),descriptionId:zs(),titlePresent:g>0,descriptionPresent:v>0,setTitleCount:y,setDescriptionCount:x,open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(E=>!E),[p]),modal:l,children:n})},"Dialog"),yP="DialogPortal",[oee,vP]=gP(yP,{forceMount:void 0}),see=ji(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=kl(yP,t);return h.jsx(oee,{scope:t,forceMount:n,children:b.Children.map(r,l=>h.jsx(qS,{present:n||i.open,children:h.jsx(dJ,{asChild:!0,container:o,children:l})}))})},"DialogPortal"),E0="DialogOverlay",iee=b.forwardRef(ji(function(t,n){const r=vP(E0,t.__scopeDialog),{forceMount:o=r.forceMount,...i}=t,l=kl(E0,t.__scopeDialog);return l.modal?h.jsx(qS,{present:o||l.open,children:h.jsx(lee,{...i,ref:n})}):null},"DialogOverlay")),aee=US("DialogOverlay.RemoveScroll"),lee=b.forwardRef(ji(function(t,n){const{__scopeDialog:r,...o}=t,i=kl(E0,r),l=GD(),c=wu(n,l);return h.jsx(pP,{as:aee,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(Yo.div,{"data-state":KS(i.open),...o,ref:c,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),rf="DialogContent",cee=b.forwardRef(ji(function(t,n){const r=vP(rf,t.__scopeDialog),{forceMount:o=r.forceMount,...i}=t,l=kl(rf,t.__scopeDialog);return h.jsx(qS,{present:o||l.open,children:l.modal?h.jsx(uee,{...i,ref:n}):h.jsx(dee,{...i,ref:n})})},"DialogContent")),uee=b.forwardRef(ji(function(t,n){const r=kl(rf,t.__scopeDialog),o=b.useRef(null),i=wu(n,r.contentRef,o);return b.useEffect(()=>{const l=o.current;if(l)return eee(l)},[]),h.jsx(xP,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:rl(t.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:rl(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&l.preventDefault()}),onFocusOutside:rl(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),dee=b.forwardRef(ji(function(t,n){const r=kl(rf,t.__scopeDialog),o=b.useRef(!1),i=b.useRef(!1);return h.jsx(xP,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),l.defaultPrevented||(o.current||r.triggerRef.current?.focus(),l.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),l.defaultPrevented||(o.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=l.target;r.triggerRef.current?.contains(c)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})},"DialogContentNonModal")),xP=b.forwardRef(ji(function(t,n){const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:l,...c}=t,f=kl(rf,r);return ZS(),h.jsx(h.Fragment,{children:h.jsx(lJ,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:l,children:h.jsx(sJ,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":KS(f.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl"));function KS(e){return e?"open":"closed"}ji(KS,"getState");var wd='[cmdk-group=""]',ob='[cmdk-group-items=""]',fee='[cmdk-group-heading=""]',bP='[cmdk-item=""]',gT=`${bP}:not([aria-disabled="true"])`,C0="cmdk-item-select",Nc="data-value",hee=(e,t,n)=>OW(e,t,n),wP=b.createContext(void 0),qf=()=>b.useContext(wP),SP=b.createContext(void 0),XS=()=>b.useContext(SP),EP=b.createContext(void 0),CP=b.forwardRef((e,t)=>{let n=Tc(()=>{var F,Q;return{search:"",value:(Q=(F=e.value)!=null?F:e.defaultValue)!=null?Q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Tc(()=>new Set),o=Tc(()=>new Map),i=Tc(()=>new Map),l=Tc(()=>new Set),c=_P(e),{label:f,children:d,value:p,onValueChange:g,filter:y,shouldFilter:v,loop:x,disablePointerSelection:E=!1,vimBindings:S=!0,..._}=e,j=zs(),R=zs(),N=zs(),O=b.useRef(null),k=Cee();vl(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,M.emit()}},[p]),vl(()=>{k(6,q)},[]);let M=b.useMemo(()=>({subscribe:F=>(l.current.add(F),()=>l.current.delete(F)),snapshot:()=>n.current,setState:(F,Q,X)=>{var ne,te,J,K;if(!Object.is(n.current[F],Q)){if(n.current[F]=Q,F==="search")V(),G(),k(1,B);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(N);re?re.focus():(ne=document.getElementById(j))==null||ne.focus()}if(k(7,()=>{var re;n.current.selectedItemId=(re=I())==null?void 0:re.id,M.emit()}),X||k(5,q),((te=c.current)==null?void 0:te.value)!==void 0){let re=Q??"";(K=(J=c.current).onValueChange)==null||K.call(J,re);return}}M.emit()}},emit:()=>{l.current.forEach(F=>F())}}),[]),T=b.useMemo(()=>({value:(F,Q,X)=>{var ne;Q!==((ne=i.current.get(F))==null?void 0:ne.value)&&(i.current.set(F,{value:Q,keywords:X}),n.current.filtered.items.set(F,L(Q,X)),k(2,()=>{G(),M.emit()}))},item:(F,Q)=>(r.current.add(F),Q&&(o.current.has(Q)?o.current.get(Q).add(F):o.current.set(Q,new Set([F]))),k(3,()=>{V(),G(),n.current.value||B(),M.emit()}),()=>{i.current.delete(F),r.current.delete(F),n.current.filtered.items.delete(F);let X=I();k(4,()=>{V(),X?.getAttribute("id")===F&&B(),M.emit()})}),group:F=>(o.current.has(F)||o.current.set(F,new Set),()=>{i.current.delete(F),o.current.delete(F)}),filter:()=>c.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:j,inputId:N,labelId:R,listInnerRef:O}),[]);function L(F,Q){var X,ne;let te=(ne=(X=c.current)==null?void 0:X.filter)!=null?ne:hee;return F?te(F,n.current.search,Q):0}function G(){if(!n.current.search||c.current.shouldFilter===!1)return;let F=n.current.filtered.items,Q=[];n.current.filtered.groups.forEach(ne=>{let te=o.current.get(ne),J=0;te.forEach(K=>{let re=F.get(K);J=Math.max(re,J)}),Q.push([ne,J])});let X=O.current;z().sort((ne,te)=>{var J,K;let re=ne.getAttribute("id"),ye=te.getAttribute("id");return((J=F.get(ye))!=null?J:0)-((K=F.get(re))!=null?K:0)}).forEach(ne=>{let te=ne.closest(ob);te?te.appendChild(ne.parentElement===te?ne:ne.closest(`${ob} > *`)):X.appendChild(ne.parentElement===X?ne:ne.closest(`${ob} > *`))}),Q.sort((ne,te)=>te[1]-ne[1]).forEach(ne=>{var te;let J=(te=O.current)==null?void 0:te.querySelector(`${wd}[${Nc}="${encodeURIComponent(ne[0])}"]`);J?.parentElement.appendChild(J)})}function B(){let F=z().find(X=>X.getAttribute("aria-disabled")!=="true"),Q=F?.getAttribute(Nc);M.setState("value",Q||void 0)}function V(){var F,Q,X,ne;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let te=0;for(let J of r.current){let K=(Q=(F=i.current.get(J))==null?void 0:F.value)!=null?Q:"",re=(ne=(X=i.current.get(J))==null?void 0:X.keywords)!=null?ne:[],ye=L(K,re);n.current.filtered.items.set(J,ye),ye>0&&te++}for(let[J,K]of o.current)for(let re of K)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(J);break}n.current.filtered.count=te}function q(){var F,Q,X;let ne=I();ne&&(((F=ne.parentElement)==null?void 0:F.firstChild)===ne&&((X=(Q=ne.closest(wd))==null?void 0:Q.querySelector(fee))==null||X.scrollIntoView({block:"nearest"})),ne.scrollIntoView({block:"nearest"}))}function I(){var F;return(F=O.current)==null?void 0:F.querySelector(`${bP}[aria-selected="true"]`)}function z(){var F;return Array.from(((F=O.current)==null?void 0:F.querySelectorAll(gT))||[])}function A(F){let Q=z()[F];Q&&M.setState("value",Q.getAttribute(Nc))}function P(F){var Q;let X=I(),ne=z(),te=ne.findIndex(K=>K===X),J=ne[te+F];(Q=c.current)!=null&&Q.loop&&(J=te+F<0?ne[ne.length-1]:te+F===ne.length?ne[0]:ne[te+F]),J&&M.setState("value",J.getAttribute(Nc))}function U(F){let Q=I(),X=Q?.closest(wd),ne;for(;X&&!ne;)X=F>0?See(X,wd):Eee(X,wd),ne=X?.querySelector(gT);ne?M.setState("value",ne.getAttribute(Nc)):P(F)}let H=()=>A(z().length-1),Y=F=>{F.preventDefault(),F.metaKey?H():F.altKey?U(1):P(1)},$=F=>{F.preventDefault(),F.metaKey?A(0):F.altKey?U(-1):P(-1)};return b.createElement(Yo.div,{ref:t,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:F=>{var Q;(Q=_.onKeyDown)==null||Q.call(_,F);let X=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||X))switch(F.key){case"n":case"j":{S&&F.ctrlKey&&Y(F);break}case"ArrowDown":{Y(F);break}case"p":case"k":{S&&F.ctrlKey&&$(F);break}case"ArrowUp":{$(F);break}case"Home":{F.preventDefault(),A(0);break}case"End":{F.preventDefault(),H();break}case"Enter":{F.preventDefault();let ne=I();if(ne){let te=new Event(C0);ne.dispatchEvent(te)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Ree},f),Jg(e,F=>b.createElement(SP.Provider,{value:M},b.createElement(wP.Provider,{value:T},F))))}),pee=b.forwardRef((e,t)=>{var n,r;let o=zs(),i=b.useRef(null),l=b.useContext(EP),c=qf(),f=_P(e),d=(r=(n=f.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;vl(()=>{if(!d)return c.item(o,l?.id)},[d]);let p=RP(o,i,[e.value,e.children,i],e.keywords),g=XS(),y=wa(k=>k.value&&k.value===p.current),v=wa(k=>d||c.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);b.useEffect(()=>{let k=i.current;if(!(!k||e.disabled))return k.addEventListener(C0,x),()=>k.removeEventListener(C0,x)},[v,e.onSelect,e.disabled]);function x(){var k,M;E(),(M=(k=f.current).onSelect)==null||M.call(k,p.current)}function E(){g.setState("value",p.current,!0)}if(!v)return null;let{disabled:S,value:_,onSelect:j,forceMount:R,keywords:N,...O}=e;return b.createElement(Yo.div,{ref:yl(i,t),...O,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!y,"data-disabled":!!S,"data-selected":!!y,onPointerMove:S||c.getDisablePointerSelection()?void 0:E,onClick:S?void 0:x},e.children)}),mee=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,l=zs(),c=b.useRef(null),f=b.useRef(null),d=zs(),p=qf(),g=wa(v=>o||p.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);vl(()=>p.group(l),[]),RP(l,c,[e.value,e.heading,f]);let y=b.useMemo(()=>({id:l,forceMount:o}),[o]);return b.createElement(Yo.div,{ref:yl(c,t),...i,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Jg(e,v=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},b.createElement(EP.Provider,{value:y},v))))}),gee=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=wa(l=>!l.search);return!n&&!i?null:b.createElement(Yo.div,{ref:yl(o,t),...r,"cmdk-separator":"",role:"separator"})}),yee=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=XS(),l=wa(d=>d.search),c=wa(d=>d.selectedItemId),f=qf();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Yo.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":c,id:f.inputId,type:"text",value:o?e.value:l,onChange:d=>{o||i.setState("search",d.target.value),n?.(d.target.value)}})}),vee=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),l=b.useRef(null),c=wa(d=>d.selectedItemId),f=qf();return b.useEffect(()=>{if(l.current&&i.current){let d=l.current,p=i.current,g,y=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let v=d.offsetHeight;p.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return y.observe(d),()=>{cancelAnimationFrame(g),y.unobserve(d)}}},[]),b.createElement(Yo.div,{ref:yl(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:f.listId},Jg(e,d=>b.createElement("div",{ref:yl(l,f.listInnerRef),"cmdk-list-sizer":""},d)))}),xee=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:l,...c}=e;return b.createElement(ree,{open:n,onOpenChange:r},b.createElement(see,{container:l},b.createElement(iee,{"cmdk-overlay":"",className:o}),b.createElement(cee,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(CP,{ref:t,...c}))))}),bee=b.forwardRef((e,t)=>wa(n=>n.filtered.count===0)?b.createElement(Yo.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wee=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Yo.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Jg(e,l=>b.createElement("div",{"aria-hidden":!0},l)))}),Su=Object.assign(CP,{List:vee,Item:pee,Input:yee,Group:mee,Separator:gee,Dialog:xee,Empty:bee,Loading:wee});function See(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Eee(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _P(e){let t=b.useRef(e);return vl(()=>{t.current=e}),t}var vl=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Tc(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function wa(e){let t=XS(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function RP(e,t,n,r=[]){let o=b.useRef(),i=qf();return vl(()=>{var l;let c=(()=>{var d;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():o.current}})(),f=r.map(d=>d.trim());i.value(e,c,f),(l=t.current)==null||l.setAttribute(Nc,c),o.current=c}),o}var Cee=()=>{let[e,t]=b.useState(),n=Tc(()=>new Map);return vl(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function _ee(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Jg({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(_ee(t),{ref:t.ref},n(t.props.children)):n(t)}var Ree={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function QS({className:e,...t}){return h.jsx(Su,{"data-slot":"command",className:Nt("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function WS({className:e,...t}){return h.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:h.jsxs(z2,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[h.jsx(Su.Input,{"data-slot":"command-input",className:Nt("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),h.jsx(t0,{children:h.jsx(XM,{className:"size-4 shrink-0 opacity-50"})})]})})}function JS({className:e,...t}){return h.jsx(Su.List,{"data-slot":"command-list",className:Nt("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function eE({className:e,...t}){return h.jsx(Su.Empty,{"data-slot":"command-empty",className:Nt("py-6 text-center text-sm",e),...t})}function tE({className:e,...t}){return h.jsx(Su.Group,{"data-slot":"command-group",className:Nt("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function nE({className:e,children:t,...n}){return h.jsxs(Su.Item,{"data-slot":"command-item",className:Nt("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",e),...n,children:[t,h.jsx(uu,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function jee({value:e,onChange:t,disabled:n,invalid:r,id:o,"aria-describedby":i,"aria-invalid":l}){const[c,f]=b.useState(!1),{data:d=[],isLoading:p,isError:g}=xS(),y=d.find(v=>v.code===e);return h.jsxs(LS,{open:c,onOpenChange:f,children:[h.jsx($S,{render:h.jsxs(ke,{type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:n,id:o,"aria-describedby":i,"aria-invalid":l,className:Nt("w-full justify-between font-normal",!y&&"text-muted-foreground",r&&"border-destructive"),children:[y?`${y.name} (${y.code})`:e||"选择模型映射",h.jsx(Cf,{className:"size-4 shrink-0 opacity-50"})]})}),h.jsx(FS,{className:"w-[--anchor-width] p-0",children:h.jsxs(QS,{shouldFilter:!0,children:[h.jsx(WS,{placeholder:"搜索模型(名称或 code)..."}),h.jsx(JS,{role:"listbox","aria-label":"模型映射列表",children:p?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"加载中..."}):g?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"映射列表加载失败"}):d.length===0?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground",children:[h.jsx("span",{children:"尚未创建任何模型映射"}),h.jsx(ke,{render:h.jsx(cn,{to:"/settings/models"}),nativeButton:!1,variant:"outline",size:"sm",children:"去设置 → 模型映射"})]}):h.jsxs(h.Fragment,{children:[h.jsx(eE,{children:"无匹配的模型映射"}),h.jsx(tE,{children:d.map(v=>h.jsxs(nE,{value:`${v.name} ${v.code} ${v.realModel}`,role:"option","aria-selected":v.code===e,onSelect:()=>{t(v.code),f(!1)},children:[v.name," ",h.jsxs("span",{className:"text-muted-foreground",children:["(",v.code,")"]}),h.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-mono",children:v.realModel}),v.code===e&&h.jsx(uu,{className:"ml-auto size-4 text-success","aria-hidden":"true"})]},v.code))})]})})]})})]})}function of({className:e,...t}){return h.jsx(Im,{className:Nt("font-mono min-h-64 max-h-[60vh] resize-y text-sm leading-relaxed",e),spellCheck:!1,...t})}const _0=20;function Sd(e){return e.split("/").filter(t=>t!==".").join("/").toLowerCase()}function Nee(e,t,n){const r=e.trim();if(r.length===0)return"请填写引用文档路径";if(r.startsWith("/"))return`禁止绝对路径:${r}`;if(r.includes("\\"))return`禁止反斜杠路径分隔符(须使用正斜杠 /):${r}`;const o=r.split("/");if(o.some(l=>l===""))return`禁止空路径段(连续或尾随斜杠):${r}`;if(o.includes(".."))return`禁止越界回溯(.. 路径段):${r}`;if(o.every(l=>l==="."))return`路径不能只由 "." 组成:${r}`;if(Sd(r)===n.toLowerCase())return`与主文档文件名 ${n} 冲突`;if(t.length>=_0)return`引用文档最多 ${_0} 条`;if(t.some(l=>Sd(l.path)===Sd(r)))return`引用文档路径重复(与现有条目规范化后相同):${r}`;const i=Sd(r);return t.some(l=>{const c=Sd(l.path);return c.startsWith(`${i}/`)||i.startsWith(`${c}/`)})?`引用文档路径互为目录前缀(落盘时文件与目录冲突):${r}`:null}function jP({value:e,onChange:t,getMainBody:n,mainDocName:r,disabled:o=!1,id:i,"aria-describedby":l,"aria-invalid":c}){const[f,d]=b.useState(null),[p,g]=b.useState(!1),[y,v]=b.useState(""),[x,E]=b.useState(""),[S,_]=b.useState(null),j=b.useRef(null),R=b.useMemo(()=>e.find(T=>T.path===f)??null,[e,f]),N=T=>{d(T),g(!1)},O=T=>{n().includes(T.path)&&!window.confirm(`主文档仍引用此路径「${T.path}」,删除将被服务端拒绝;先移除主文档引用?
|
|
116
|
+
确认即从本次提交中移除该引用文档。`)||(t(e.filter(L=>L.path!==T.path)),f===T.path&&d(null))},k=()=>{const T=Nee(y,e,r);if(T!==null){_(T);return}const L=y.trim();t([...e,{path:L,content:x}]),v(""),E(""),_(null),d(L),requestAnimationFrame(()=>j.current?.focus())},M=T=>{f&&t(e.map(L=>L.path===f?{...L,content:T}:L))};return h.jsxs("div",{className:"space-y-3",id:i,role:"group","aria-label":"引用文档管理","aria-describedby":l,"aria-invalid":c,children:[e.length===0?h.jsxs("div",{className:"rounded-lg border border-dashed px-4 py-6 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"尚无引用文档——主文档之外的补充材料(模板/清单/手册)可在此随资产一并存储与安装下发。"}),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"mt-3",disabled:o,onClick:()=>g(!0),children:[h.jsx(gm,{className:"size-4"}),"添加第一个引用文档"]})]}):h.jsx("ul",{className:"divide-y rounded-lg border","aria-label":"引用文档列表",children:e.map(T=>{const L=T.path===f;return h.jsxs("li",{className:"flex items-center gap-2 px-3 py-2",children:[h.jsx(jV,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),h.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",title:T.path,children:T.path}),h.jsxs(Un,{variant:"secondary",children:[T.content.length," 字符"]}),h.jsx(ke,{type:"button",variant:L?"secondary":"ghost",size:"sm",disabled:o,onClick:()=>N(T.path),children:L&&!p?"编辑中":"编辑"}),h.jsx(ke,{type:"button",variant:"destructive",size:"sm",disabled:o,onClick:()=>O(T),"aria-label":`删除引用文档 ${T.path}`,children:"删除"})]},T.path)})}),R!==null&&h.jsxs("div",{className:"space-y-2",children:[h.jsxs(kr,{htmlFor:"reference-content-editor",className:"font-mono text-xs text-muted-foreground",children:["编辑内容 · ",R.path]}),h.jsx(of,{ref:j,id:"reference-content-editor",value:R.content,disabled:o,onChange:T=>M(T.target.value),"aria-label":`引用文档 ${R.path} 内容`,placeholder:"引用文档正文(Markdown)",className:"max-h-[50vh] min-h-40"})]}),p?h.jsxs("div",{className:"space-y-2 rounded-lg border bg-muted/30 p-3",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(kr,{htmlFor:"new-ref-path",children:"新引用路径"}),h.jsx(ln,{id:"new-ref-path",value:y,disabled:o,onChange:T=>{v(T.target.value),S!==null&&_(null)},"aria-invalid":S!==null,"aria-describedby":S!==null?"new-ref-path-error":void 0,placeholder:"相对资产根的正斜杠路径,如 references/guide.md",autoComplete:"off"}),S!==null&&h.jsx("p",{id:"new-ref-path-error",role:"alert",className:"text-sm text-destructive",children:S}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["相对路径(正斜杠),不可与主文档 ",r," 同名;上限 ",_0," 条。"]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(kr,{htmlFor:"new-ref-content",children:"初始内容"}),h.jsx(of,{id:"new-ref-content",value:x,disabled:o,onChange:T=>E(T.target.value),placeholder:"可为空,稍后在列表中继续编辑",className:"min-h-24"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{g(!1),v(""),E(""),_(null)},children:"取消"}),h.jsx(ke,{type:"button",size:"sm",disabled:o,onClick:k,children:"添加"})]})]}):e.length>0&&h.jsxs(ke,{type:"button",variant:"outline",size:"sm",disabled:o,onClick:()=>{d(null),g(!0)},children:[h.jsx(gm,{className:"size-4"}),"新增引用文档"]})]})}function NP(e,t=!0,n){return co({queryKey:["skills",e,{includeDisabled:n?.includeDisabled??!1,q:n?.q??""}],queryFn:()=>pU(e,n),enabled:t&&e.length>0,placeholderData:B0})}function Tee(e,t){return co({queryKey:["skill",e,t?.scope??"global",t?.projectId??"",t?.includeDisabled],queryFn:()=>mU(e,t),enabled:e.length>0})}function Oee(){const e=sn();return un({mutationFn:t=>gU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Mee(){const e=sn();return un({mutationFn:({name:t,patch:n,scope:r,projectId:o})=>yU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function kee(){const e=sn();return un({mutationFn:({name:t,scope:n,projectId:r})=>vU(t,{...n!==void 0?{scope:n}:{},...r!==void 0?{projectId:r}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Aee(){const e=sn();return un({mutationFn:({name:t,input:n,scope:r,projectId:o})=>xU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Dee(){const e=sn();return un({mutationFn:({name:t,enabled:n,scope:r,projectId:o})=>bU(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function TP(e){const t=z5(e);b.useEffect(()=>{if(t.state!=="blocked")return;window.confirm("当前页面有未保存的修改,确定离开吗?")?t.proceed():t.reset()},[t]),b.useEffect(()=>{if(!e)return;const n=r=>{r.preventDefault()};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[e])}const Pee=gl({name:Tn().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"name 需为 kebab-case(小写字母/数字/中划线)"),description:Tn().min(1,"描述不能为空"),systemPrompt:Tn().min(1,"系统提示词不能为空"),model:Tn().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"请从模型映射中选择"),boundSkills:Dc(Tn()),tools:Dc(Tn()),permissions:Dc(Tn()),scope:Hm(["global","project"]),function:Hm(["reviewer","executor"]),references:Dc(gl({path:Tn().min(1),content:Tn()}))}),Iee={name:"",description:"",systemPrompt:"",model:"",boundSkills:[],tools:[],permissions:[],scope:"project",function:"executor",references:[]};function zee({options:e,selected:t,onToggle:n,placeholder:r,emptyText:o,disabled:i,id:l,"aria-describedby":c,"aria-invalid":f}){const[d,p]=b.useState(!1),g=b.useMemo(()=>new Set(t),[t]);return h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.length===0?h.jsx("span",{className:"text-sm text-muted-foreground",children:"未选择"}):t.map(y=>{const v=e.find(x=>x.value===y);return h.jsxs(Un,{variant:"outline",className:"gap-1 pr-1",children:[v?.label??y,h.jsx("button",{type:"button",disabled:i,onClick:()=>n(y),"aria-label":`移除 ${y}`,className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:h.jsx(ug,{className:"size-3"})})]},y)})}),h.jsxs(LS,{open:d,onOpenChange:p,children:[h.jsx($S,{render:h.jsxs(ke,{type:"button",variant:"outline",role:"combobox","aria-expanded":d,disabled:i,id:l,"aria-describedby":c,"aria-invalid":f,className:"w-full justify-between font-normal",children:[t.length>0?`已选 ${t.length} 项`:r,h.jsx(Cf,{className:"ml-2 size-4 shrink-0 opacity-50"})]})}),h.jsx(FS,{className:"w-[var(--anchor-width)] p-0",align:"start",children:h.jsxs(QS,{children:[h.jsx(WS,{placeholder:`搜索${r}…`}),h.jsxs(JS,{role:"listbox","aria-label":r,children:[h.jsx(eE,{children:o}),h.jsx(tE,{children:e.map(y=>h.jsxs(nE,{value:y.label,role:"option","aria-selected":g.has(y.value),onSelect:()=>n(y.value),children:[y.label,g.has(y.value)&&h.jsx(uu,{className:"ml-auto size-4 text-success","aria-hidden":"true"})]},y.value))})]})]})})]})]})}function yT({value:e,onChange:t,placeholder:n,disabled:r,id:o,"aria-describedby":i,"aria-invalid":l}){const[c,f]=b.useState(""),d=()=>{const p=c.trim();p.length!==0&&(e.includes(p)||t([...e,p]),f(""))};return h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?h.jsx("span",{className:"text-sm text-muted-foreground",children:"未添加"}):e.map(p=>h.jsxs(Un,{variant:"secondary",className:"gap-1 pr-1",children:[p,h.jsx("button",{type:"button",disabled:r,onClick:()=>t(e.filter(g=>g!==p)),"aria-label":`移除 ${p}`,className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:h.jsx(ug,{className:"size-3"})})]},p))}),h.jsx(ln,{value:c,disabled:r,id:o,"aria-describedby":i,"aria-invalid":l,placeholder:n,onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Backspace"&&c.length===0&&e.length>0&&t(e.slice(0,-1))}})]})}function vT(){jo();const t=Sf().name??"",n=t.length>0,r=Sa(),[o]=cg(),i=o.get("scope")==="project"?"project":"global",l=o.get("projectId")??void 0,c={scope:i,...l!==void 0?{projectId:l}:{},includeDisabled:!0},{activeProjectId:f,projects:d,bootstrapReady:p,bootstrapError:g,retryBootstrap:y}=cs(),v=rZ(n?t:"",c),x=NP(f),E=oZ(),S=sZ(),_=Xn("scope"),j=A=>_.find(P=>P.value===A)?.label??A,R=Xn("agent_function"),N=A=>R.find(P=>P.value===A)?.label??A,O=b.useMemo(()=>!n||!v.data?!1:v.data.scope==="project"&&(d.find(A=>A.id===v.data?.projectId)?.status??"active")==="archived",[n,v.data,d]),k=Ff({resolver:Vf(Pee),defaultValues:Iee}),{isSubmitting:M,isDirty:T}=k.formState,L=!!k.formState.errors.model,[G,B]=b.useState(null),V=b.useMemo(()=>(x.data??[]).map(A=>({value:A.name,label:A.name})),[x.data]),q=b.useMemo(()=>new Set(x.data?.map(A=>A.name)??[]),[x.data]),I=v.data?.name;b.useEffect(()=>{!n||!v.data||I!==t||k.getValues("name")===""&&k.reset({name:v.data.name,description:v.data.description,systemPrompt:v.data.systemPrompt,model:v.data.model,boundSkills:v.data.boundSkills,tools:v.data.tools,permissions:v.data.permissions,scope:v.data.scope,function:v.data.function??"executor",references:v.data.references??[]})},[n,v.data,I,t,k]),TP(T&&!M);const z=async A=>{B(null);try{n?(await S.mutateAsync({name:t,scope:i,projectId:l,patch:{description:A.description,systemPrompt:A.systemPrompt,model:A.model,boundSkills:A.boundSkills,tools:A.tools,permissions:A.permissions,function:A.function,references:A.references}}),ut.success("代理已更新")):(await E.mutateAsync({...A,...A.scope==="project"?{projectId:f}:{}}),ut.success("代理已创建")),r("/agents")}catch(P){const U=Ct(P);B(U),ut.error(U)}};return g?h.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:h.jsx(rr,{message:"项目上下文加载失败",onRetry:y})}):p?h.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[h.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[h.jsx(ke,{variant:"ghost",size:"icon","aria-label":"返回代理库",render:h.jsx(cn,{to:"/agents"}),nativeButton:!1,children:h.jsx(Mc,{className:"size-4"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:n?`编辑代理 · ${t}`:"新建代理"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 配置与技能绑定管理(name 为唯一键)"})]})]}),n&&v.isLoading?h.jsx(Ir,{rows:8,cols:1}):n&&v.isError?h.jsx(rr,{message:Ct(v.error),onRetry:()=>{v.refetch()}}):h.jsx(Uf,{...k,children:h.jsxs("form",{onSubmit:k.handleSubmit(z),className:"space-y-6",children:[O&&h.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:"该代理所属项目已停用,资产处于冻结状态(只读)。如需修改,请先启用该项目,或复制到其他作用域。"}),G!==null&&!O&&h.jsx("div",{role:"alert",className:"max-h-40 overflow-y-auto rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm break-all whitespace-pre-wrap text-destructive",children:G}),h.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[h.jsx(_n,{control:k.control,name:"name",render:({field:A})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["名称 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...A,placeholder:"kebab-case,如 backend-dev",disabled:M||n||O})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"scope",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"作用域"}),n?h.jsx(vn,{children:h.jsx(ln,{value:A.value==="global"?`${j("global")}(创建后不可变)`:`${d.find(P=>P.id===v.data?.projectId)?.name??"未知项目"}(创建后不可变)`,disabled:!0})}):h.jsxs(br,{value:A.value,onValueChange:P=>{(P==="global"||P==="project")&&A.onChange(P)},disabled:M,children:[h.jsx(vn,{children:h.jsx(wr,{className:"w-full",children:h.jsx(Xc,{placeholder:"选择作用域"})})}),h.jsx(Sr,{children:_.map(P=>h.jsx(Bn,{value:P.value,disabled:P.value==="project"&&f==="",children:P.value==="project"?"当前项目":P.label},P.value))})]}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"function",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"功能类型"}),h.jsxs(br,{value:A.value,onValueChange:P=>{(P==="reviewer"||P==="executor")&&A.onChange(P)},disabled:M||O,children:[h.jsx(vn,{children:h.jsx(wr,{className:"w-full",children:N(A.value)})}),h.jsx(Sr,{children:R.filter(P=>P.active).map(P=>h.jsx(Bn,{value:P.value,children:P.label},P.value))})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"审查类:安装落盘时注入受限信息边界;执行/通用:不受限(缺省)。"}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"description",render:({field:A})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["描述 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...A,placeholder:"一句话说明代理职责",disabled:M||O})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"model",render:({field:A})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["模型 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(jee,{value:A.value,onChange:A.onChange,disabled:M||O,invalid:L})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"boundSkills",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"绑定技能"}),h.jsx(vn,{children:h.jsx(zee,{options:V,selected:A.value,onToggle:P=>A.onChange(A.value.includes(P)?A.value.filter(U=>U!==P):[...A.value,P]),placeholder:"选择绑定技能…",emptyText:x.isLoading?"技能加载中…":"未找到匹配技能",disabled:M||O})}),A.value.some(P=>!q.has(P))&&h.jsxs("p",{className:"text-sm text-warning",children:["以下绑定技能不存在,保存后该绑定将无法解析:",A.value.filter(P=>!q.has(P)).join("、")]}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"tools",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"工具"}),h.jsx(vn,{children:h.jsx(yT,{value:A.value,onChange:A.onChange,placeholder:"输入工具名后回车,如 bash",disabled:M||O})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"permissions",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"权限"}),h.jsx(vn,{children:h.jsx(yT,{value:A.value,onChange:A.onChange,placeholder:"输入权限名后回车,如 read-only",disabled:M||O})}),h.jsx(Nn,{})]})})]}),h.jsx(_n,{control:k.control,name:"systemPrompt",render:({field:A})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["系统提示词 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(of,{...A,placeholder:"Agent 的系统提示词",disabled:M||O})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:k.control,name:"references",render:({field:A})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"引用文档"}),h.jsx(vn,{children:h.jsx(jP,{value:A.value,onChange:A.onChange,getMainBody:()=>k.getValues("systemPrompt"),mainDocName:"agent.md",disabled:M||O})}),h.jsx(Nn,{}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"随代理一并存储与安装下发;install 后主文档中的相对路径引用将在本地真实可达。"})]})}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",render:h.jsx(cn,{to:"/agents"}),nativeButton:!1,disabled:M,children:"取消"}),h.jsx(ke,{type:"submit",disabled:M||O,children:M?"保存中…":"保存"})]})]})})]}):h.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:h.jsx(Ir,{rows:6})})}function cr(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=cr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Lee={value:()=>{}};function ey(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new am(n)}function am(e){this._=e}function $ee(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}am.prototype=ey.prototype={constructor:am,on:function(e,t){var n=this._,r=$ee(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((o=(e=r[i]).type)&&(o=Fee(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(o=(e=r[i]).type)n[o]=xT(n[o],e.name,t);else if(t==null)for(o in n)n[o]=xT(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new am(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function Fee(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function xT(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Lee,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var R0="http://www.w3.org/1999/xhtml";const bT={svg:"http://www.w3.org/2000/svg",xhtml:R0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ty(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),bT.hasOwnProperty(t)?{space:bT[t],local:e}:e}function Vee(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===R0&&t.documentElement.namespaceURI===R0?t.createElement(e):t.createElementNS(n,e)}}function Uee(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function OP(e){var t=ty(e);return(t.local?Uee:Vee)(t)}function Hee(){}function rE(e){return e==null?Hee:function(){return this.querySelector(e)}}function Bee(e){typeof e!="function"&&(e=rE(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=new Array(l),f,d,p=0;p<l;++p)(f=i[p])&&(d=e.call(f,f.__data__,p,i))&&("__data__"in f&&(d.__data__=f.__data__),c[p]=d);return new Ro(r,this._parents)}function qee(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Yee(){return[]}function MP(e){return e==null?Yee:function(){return this.querySelectorAll(e)}}function Zee(e){return function(){return qee(e.apply(this,arguments))}}function Gee(e){typeof e=="function"?e=Zee(e):e=MP(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var l=t[i],c=l.length,f,d=0;d<c;++d)(f=l[d])&&(r.push(e.call(f,f.__data__,d,l)),o.push(f));return new Ro(r,o)}function kP(e){return function(){return this.matches(e)}}function AP(e){return function(t){return t.matches(e)}}var Kee=Array.prototype.find;function Xee(e){return function(){return Kee.call(this.children,e)}}function Qee(){return this.firstElementChild}function Wee(e){return this.select(e==null?Qee:Xee(typeof e=="function"?e:AP(e)))}var Jee=Array.prototype.filter;function ete(){return Array.from(this.children)}function tte(e){return function(){return Jee.call(this.children,e)}}function nte(e){return this.selectAll(e==null?ete:tte(typeof e=="function"?e:AP(e)))}function rte(e){typeof e!="function"&&(e=kP(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=[],f,d=0;d<l;++d)(f=i[d])&&e.call(f,f.__data__,d,i)&&c.push(f);return new Ro(r,this._parents)}function DP(e){return new Array(e.length)}function ote(){return new Ro(this._enter||this._groups.map(DP),this._parents)}function Bm(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bm.prototype={constructor:Bm,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ste(e){return function(){return e}}function ite(e,t,n,r,o,i){for(var l=0,c,f=t.length,d=i.length;l<d;++l)(c=t[l])?(c.__data__=i[l],r[l]=c):n[l]=new Bm(e,i[l]);for(;l<f;++l)(c=t[l])&&(o[l]=c)}function ate(e,t,n,r,o,i,l){var c,f,d=new Map,p=t.length,g=i.length,y=new Array(p),v;for(c=0;c<p;++c)(f=t[c])&&(y[c]=v=l.call(f,f.__data__,c,t)+"",d.has(v)?o[c]=f:d.set(v,f));for(c=0;c<g;++c)v=l.call(e,i[c],c,i)+"",(f=d.get(v))?(r[c]=f,f.__data__=i[c],d.delete(v)):n[c]=new Bm(e,i[c]);for(c=0;c<p;++c)(f=t[c])&&d.get(y[c])===f&&(o[c]=f)}function lte(e){return e.__data__}function cte(e,t){if(!arguments.length)return Array.from(this,lte);var n=t?ate:ite,r=this._parents,o=this._groups;typeof e!="function"&&(e=ste(e));for(var i=o.length,l=new Array(i),c=new Array(i),f=new Array(i),d=0;d<i;++d){var p=r[d],g=o[d],y=g.length,v=ute(e.call(p,p&&p.__data__,d,r)),x=v.length,E=c[d]=new Array(x),S=l[d]=new Array(x),_=f[d]=new Array(y);n(p,g,E,S,_,v,t);for(var j=0,R=0,N,O;j<x;++j)if(N=E[j]){for(j>=R&&(R=j+1);!(O=S[R])&&++R<x;);N._next=O||null}}return l=new Ro(l,r),l._enter=c,l._exit=f,l}function ute(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dte(){return new Ro(this._exit||this._groups.map(DP),this._parents)}function fte(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function hte(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,l=Math.min(o,i),c=new Array(o),f=0;f<l;++f)for(var d=n[f],p=r[f],g=d.length,y=c[f]=new Array(g),v,x=0;x<g;++x)(v=d[x]||p[x])&&(y[x]=v);for(;f<o;++f)c[f]=n[f];return new Ro(c,this._parents)}function pte(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],l;--o>=0;)(l=r[o])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function mte(e){e||(e=gte);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var l=n[i],c=l.length,f=o[i]=new Array(c),d,p=0;p<c;++p)(d=l[p])&&(f[p]=d);f.sort(t)}return new Ro(o,this._parents).order()}function gte(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function yte(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vte(){return Array.from(this)}function xte(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var l=r[o];if(l)return l}return null}function bte(){let e=0;for(const t of this)++e;return e}function wte(){return!this.node()}function Ste(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,l=o.length,c;i<l;++i)(c=o[i])&&e.call(c,c.__data__,i,o);return this}function Ete(e){return function(){this.removeAttribute(e)}}function Cte(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _te(e,t){return function(){this.setAttribute(e,t)}}function Rte(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function jte(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nte(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Tte(e,t){var n=ty(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Cte:Ete:typeof t=="function"?n.local?Nte:jte:n.local?Rte:_te)(n,t))}function PP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ote(e){return function(){this.style.removeProperty(e)}}function Mte(e,t,n){return function(){this.style.setProperty(e,t,n)}}function kte(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Ate(e,t,n){return arguments.length>1?this.each((t==null?Ote:typeof t=="function"?kte:Mte)(e,t,n??"")):eu(this.node(),e)}function eu(e,t){return e.style.getPropertyValue(t)||PP(e).getComputedStyle(e,null).getPropertyValue(t)}function Dte(e){return function(){delete this[e]}}function Pte(e,t){return function(){this[e]=t}}function Ite(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zte(e,t){return arguments.length>1?this.each((t==null?Dte:typeof t=="function"?Ite:Pte)(e,t)):this.node()[e]}function IP(e){return e.trim().split(/^|\s+/)}function oE(e){return e.classList||new zP(e)}function zP(e){this._node=e,this._names=IP(e.getAttribute("class")||"")}zP.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function LP(e,t){for(var n=oE(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function $P(e,t){for(var n=oE(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Lte(e){return function(){LP(this,e)}}function $te(e){return function(){$P(this,e)}}function Fte(e,t){return function(){(t.apply(this,arguments)?LP:$P)(this,e)}}function Vte(e,t){var n=IP(e+"");if(arguments.length<2){for(var r=oE(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Fte:t?Lte:$te)(n,t))}function Ute(){this.textContent=""}function Hte(e){return function(){this.textContent=e}}function Bte(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function qte(e){return arguments.length?this.each(e==null?Ute:(typeof e=="function"?Bte:Hte)(e)):this.node().textContent}function Yte(){this.innerHTML=""}function Zte(e){return function(){this.innerHTML=e}}function Gte(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Kte(e){return arguments.length?this.each(e==null?Yte:(typeof e=="function"?Gte:Zte)(e)):this.node().innerHTML}function Xte(){this.nextSibling&&this.parentNode.appendChild(this)}function Qte(){return this.each(Xte)}function Wte(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Jte(){return this.each(Wte)}function ene(e){var t=typeof e=="function"?e:OP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function tne(){return null}function nne(e,t){var n=typeof e=="function"?e:OP(e),r=t==null?tne:typeof t=="function"?t:rE(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function rne(){var e=this.parentNode;e&&e.removeChild(this)}function one(){return this.each(rne)}function sne(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ine(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ane(e){return this.select(e?ine:sne)}function lne(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cne(e){return function(t){e.call(this,t,this.__data__)}}function une(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function dne(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function fne(e,t,n){return function(){var r=this.__on,o,i=cne(t);if(r){for(var l=0,c=r.length;l<c;++l)if((o=r[l]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function hne(e,t,n){var r=une(e+""),o,i=r.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var f=0,d=c.length,p;f<d;++f)for(o=0,p=c[f];o<i;++o)if((l=r[o]).type===p.type&&l.name===p.name)return p.value}return}for(c=t?fne:dne,o=0;o<i;++o)this.each(c(r[o],t,n));return this}function FP(e,t,n){var r=PP(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function pne(e,t){return function(){return FP(this,e,t)}}function mne(e,t){return function(){return FP(this,e,t.apply(this,arguments))}}function gne(e,t){return this.each((typeof t=="function"?mne:pne)(e,t))}function*yne(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,l;o<i;++o)(l=r[o])&&(yield l)}var VP=[null];function Ro(e,t){this._groups=e,this._parents=t}function Yf(){return new Ro([[document.documentElement]],VP)}function vne(){return this}Ro.prototype=Yf.prototype={constructor:Ro,select:Bee,selectAll:Gee,selectChild:Wee,selectChildren:nte,filter:rte,data:cte,enter:ote,exit:dte,join:fte,merge:hte,selection:vne,order:pte,sort:mte,call:yte,nodes:vte,node:xte,size:bte,empty:wte,each:Ste,attr:Tte,style:Ate,property:zte,classed:Vte,text:qte,html:Kte,raise:Qte,lower:Jte,append:ene,insert:nne,remove:one,clone:ane,datum:lne,on:hne,dispatch:gne,[Symbol.iterator]:yne};function Eo(e){return typeof e=="string"?new Ro([[document.querySelector(e)]],[document.documentElement]):new Ro([[e]],VP)}function xne(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ts(e,t){if(e=xne(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const bne={passive:!1},sf={capture:!0,passive:!1};function sb(e){e.stopImmediatePropagation()}function Uc(e){e.preventDefault(),e.stopImmediatePropagation()}function UP(e){var t=e.document.documentElement,n=Eo(e).on("dragstart.drag",Uc,sf);"onselectstart"in t?n.on("selectstart.drag",Uc,sf):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function HP(e,t){var n=e.document.documentElement,r=Eo(e).on("dragstart.drag",null);t&&(r.on("click.drag",Uc,sf),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const $p=e=>()=>e;function j0(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:l,y:c,dx:f,dy:d,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}j0.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wne(e){return!e.ctrlKey&&!e.button}function Sne(){return this.parentNode}function Ene(e,t){return t??{x:e.x,y:e.y}}function Cne(){return navigator.maxTouchPoints||"ontouchstart"in this}function BP(){var e=wne,t=Sne,n=Ene,r=Cne,o={},i=ey("start","drag","end"),l=0,c,f,d,p,g=0;function y(N){N.on("mousedown.drag",v).filter(r).on("touchstart.drag",S).on("touchmove.drag",_,bne).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(N,O){if(!(p||!e.call(this,N,O))){var k=R(this,t.call(this,N,O),N,O,"mouse");k&&(Eo(N.view).on("mousemove.drag",x,sf).on("mouseup.drag",E,sf),UP(N.view),sb(N),d=!1,c=N.clientX,f=N.clientY,k("start",N))}}function x(N){if(Uc(N),!d){var O=N.clientX-c,k=N.clientY-f;d=O*O+k*k>g}o.mouse("drag",N)}function E(N){Eo(N.view).on("mousemove.drag mouseup.drag",null),HP(N.view,d),Uc(N),o.mouse("end",N)}function S(N,O){if(e.call(this,N,O)){var k=N.changedTouches,M=t.call(this,N,O),T=k.length,L,G;for(L=0;L<T;++L)(G=R(this,M,N,O,k[L].identifier,k[L]))&&(sb(N),G("start",N,k[L]))}}function _(N){var O=N.changedTouches,k=O.length,M,T;for(M=0;M<k;++M)(T=o[O[M].identifier])&&(Uc(N),T("drag",N,O[M]))}function j(N){var O=N.changedTouches,k=O.length,M,T;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),M=0;M<k;++M)(T=o[O[M].identifier])&&(sb(N),T("end",N,O[M]))}function R(N,O,k,M,T,L){var G=i.copy(),B=ts(L||k,O),V,q,I;if((I=n.call(N,new j0("beforestart",{sourceEvent:k,target:y,identifier:T,active:l,x:B[0],y:B[1],dx:0,dy:0,dispatch:G}),M))!=null)return V=I.x-B[0]||0,q=I.y-B[1]||0,function z(A,P,U){var H=B,Y;switch(A){case"start":o[T]=z,Y=l++;break;case"end":delete o[T],--l;case"drag":B=ts(U||P,O),Y=l;break}G.call(A,N,new j0(A,{sourceEvent:P,subject:I,target:y,identifier:T,active:Y,x:B[0]+V,y:B[1]+q,dx:B[0]-H[0],dy:B[1]-H[1],dispatch:G}),M)}}return y.filter=function(N){return arguments.length?(e=typeof N=="function"?N:$p(!!N),y):e},y.container=function(N){return arguments.length?(t=typeof N=="function"?N:$p(N),y):t},y.subject=function(N){return arguments.length?(n=typeof N=="function"?N:$p(N),y):n},y.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:$p(!!N),y):r},y.on=function(){var N=i.on.apply(i,arguments);return N===i?y:N},y.clickDistance=function(N){return arguments.length?(g=(N=+N)*N,y):Math.sqrt(g)},y}function sE(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qP(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Zf(){}var af=.7,qm=1/af,Hc="\\s*([+-]?\\d+)\\s*",lf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ls="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_ne=/^#([0-9a-f]{3,8})$/,Rne=new RegExp(`^rgb\\(${Hc},${Hc},${Hc}\\)$`),jne=new RegExp(`^rgb\\(${Ls},${Ls},${Ls}\\)$`),Nne=new RegExp(`^rgba\\(${Hc},${Hc},${Hc},${lf}\\)$`),Tne=new RegExp(`^rgba\\(${Ls},${Ls},${Ls},${lf}\\)$`),One=new RegExp(`^hsl\\(${lf},${Ls},${Ls}\\)$`),Mne=new RegExp(`^hsla\\(${lf},${Ls},${Ls},${lf}\\)$`),wT={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};sE(Zf,xl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ST,formatHex:ST,formatHex8:kne,formatHsl:Ane,formatRgb:ET,toString:ET});function ST(){return this.rgb().formatHex()}function kne(){return this.rgb().formatHex8()}function Ane(){return YP(this).formatHsl()}function ET(){return this.rgb().formatRgb()}function xl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_ne.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?CT(t):n===3?new io(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Rne.exec(e))?new io(t[1],t[2],t[3],1):(t=jne.exec(e))?new io(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nne.exec(e))?Fp(t[1],t[2],t[3],t[4]):(t=Tne.exec(e))?Fp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=One.exec(e))?jT(t[1],t[2]/100,t[3]/100,1):(t=Mne.exec(e))?jT(t[1],t[2]/100,t[3]/100,t[4]):wT.hasOwnProperty(e)?CT(wT[e]):e==="transparent"?new io(NaN,NaN,NaN,0):null}function CT(e){return new io(e>>16&255,e>>8&255,e&255,1)}function Fp(e,t,n,r){return r<=0&&(e=t=n=NaN),new io(e,t,n,r)}function Dne(e){return e instanceof Zf||(e=xl(e)),e?(e=e.rgb(),new io(e.r,e.g,e.b,e.opacity)):new io}function N0(e,t,n,r){return arguments.length===1?Dne(e):new io(e,t,n,r??1)}function io(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}sE(io,N0,qP(Zf,{brighter(e){return e=e==null?qm:Math.pow(qm,e),new io(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?af:Math.pow(af,e),new io(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new io(ol(this.r),ol(this.g),ol(this.b),Ym(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_T,formatHex:_T,formatHex8:Pne,formatRgb:RT,toString:RT}));function _T(){return`#${nl(this.r)}${nl(this.g)}${nl(this.b)}`}function Pne(){return`#${nl(this.r)}${nl(this.g)}${nl(this.b)}${nl((isNaN(this.opacity)?1:this.opacity)*255)}`}function RT(){const e=Ym(this.opacity);return`${e===1?"rgb(":"rgba("}${ol(this.r)}, ${ol(this.g)}, ${ol(this.b)}${e===1?")":`, ${e})`}`}function Ym(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ol(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function nl(e){return e=ol(e),(e<16?"0":"")+e.toString(16)}function jT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new rs(e,t,n,r)}function YP(e){if(e instanceof rs)return new rs(e.h,e.s,e.l,e.opacity);if(e instanceof Zf||(e=xl(e)),!e)return new rs;if(e instanceof rs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,c=i-o,f=(i+o)/2;return c?(t===i?l=(n-r)/c+(n<r)*6:n===i?l=(r-t)/c+2:l=(t-n)/c+4,c/=f<.5?i+o:2-i-o,l*=60):c=f>0&&f<1?0:l,new rs(l,c,f,e.opacity)}function Ine(e,t,n,r){return arguments.length===1?YP(e):new rs(e,t,n,r??1)}function rs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}sE(rs,Ine,qP(Zf,{brighter(e){return e=e==null?qm:Math.pow(qm,e),new rs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?af:Math.pow(af,e),new rs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new io(ib(e>=240?e-240:e+120,o,r),ib(e,o,r),ib(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new rs(NT(this.h),Vp(this.s),Vp(this.l),Ym(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ym(this.opacity);return`${e===1?"hsl(":"hsla("}${NT(this.h)}, ${Vp(this.s)*100}%, ${Vp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function NT(e){return e=(e||0)%360,e<0?e+360:e}function Vp(e){return Math.max(0,Math.min(1,e||0))}function ib(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const iE=e=>()=>e;function zne(e,t){return function(n){return e+n*t}}function Lne(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function $ne(e){return(e=+e)==1?ZP:function(t,n){return n-t?Lne(t,n,e):iE(isNaN(t)?n:t)}}function ZP(e,t){var n=t-e;return n?zne(e,n):iE(isNaN(e)?t:e)}const Zm=(function e(t){var n=$ne(t);function r(o,i){var l=n((o=N0(o)).r,(i=N0(i)).r),c=n(o.g,i.g),f=n(o.b,i.b),d=ZP(o.opacity,i.opacity);return function(p){return o.r=l(p),o.g=c(p),o.b=f(p),o.opacity=d(p),o+""}}return r.gamma=e,r})(1);function Fne(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function Vne(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Une(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),l;for(l=0;l<r;++l)o[l]=Bd(e[l],t[l]);for(;l<n;++l)i[l]=t[l];return function(c){for(l=0;l<r;++l)i[l]=o[l](c);return i}}function Hne(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ks(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Bne(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Bd(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var T0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ab=new RegExp(T0.source,"g");function qne(e){return function(){return e}}function Yne(e){return function(t){return e(t)+""}}function GP(e,t){var n=T0.lastIndex=ab.lastIndex=0,r,o,i,l=-1,c=[],f=[];for(e=e+"",t=t+"";(r=T0.exec(e))&&(o=ab.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),c[l]?c[l]+=i:c[++l]=i),(r=r[0])===(o=o[0])?c[l]?c[l]+=o:c[++l]=o:(c[++l]=null,f.push({i:l,x:ks(r,o)})),n=ab.lastIndex;return n<t.length&&(i=t.slice(n),c[l]?c[l]+=i:c[++l]=i),c.length<2?f[0]?Yne(f[0].x):qne(t):(t=f.length,function(d){for(var p=0,g;p<t;++p)c[(g=f[p]).i]=g.x(d);return c.join("")})}function Bd(e,t){var n=typeof t,r;return t==null||n==="boolean"?iE(t):(n==="number"?ks:n==="string"?(r=xl(t))?(t=r,Zm):GP:t instanceof xl?Zm:t instanceof Date?Hne:Vne(t)?Fne:Array.isArray(t)?Une:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Bne:ks)(e,t)}var TT=180/Math.PI,O0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KP(e,t,n,r,o,i){var l,c,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,f/=c),e*r<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*TT,skewX:Math.atan(f)*TT,scaleX:l,scaleY:c}}var Up;function Zne(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?O0:KP(t.a,t.b,t.c,t.d,t.e,t.f)}function Gne(e){return e==null||(Up||(Up=document.createElementNS("http://www.w3.org/2000/svg","g")),Up.setAttribute("transform",e),!(e=Up.transform.baseVal.consolidate()))?O0:(e=e.matrix,KP(e.a,e.b,e.c,e.d,e.e,e.f))}function XP(e,t,n,r){function o(d){return d.length?d.pop()+" ":""}function i(d,p,g,y,v,x){if(d!==g||p!==y){var E=v.push("translate(",null,t,null,n);x.push({i:E-4,x:ks(d,g)},{i:E-2,x:ks(p,y)})}else(g||y)&&v.push("translate("+g+t+y+n)}function l(d,p,g,y){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),y.push({i:g.push(o(g)+"rotate(",null,r)-2,x:ks(d,p)})):p&&g.push(o(g)+"rotate("+p+r)}function c(d,p,g,y){d!==p?y.push({i:g.push(o(g)+"skewX(",null,r)-2,x:ks(d,p)}):p&&g.push(o(g)+"skewX("+p+r)}function f(d,p,g,y,v,x){if(d!==g||p!==y){var E=v.push(o(v)+"scale(",null,",",null,")");x.push({i:E-4,x:ks(d,g)},{i:E-2,x:ks(p,y)})}else(g!==1||y!==1)&&v.push(o(v)+"scale("+g+","+y+")")}return function(d,p){var g=[],y=[];return d=e(d),p=e(p),i(d.translateX,d.translateY,p.translateX,p.translateY,g,y),l(d.rotate,p.rotate,g,y),c(d.skewX,p.skewX,g,y),f(d.scaleX,d.scaleY,p.scaleX,p.scaleY,g,y),d=p=null,function(v){for(var x=-1,E=y.length,S;++x<E;)g[(S=y[x]).i]=S.x(v);return g.join("")}}}var Kne=XP(Zne,"px, ","px)","deg)"),Xne=XP(Gne,", ",")",")"),Qne=1e-12;function OT(e){return((e=Math.exp(e))+1/e)/2}function Wne(e){return((e=Math.exp(e))-1/e)/2}function Jne(e){return((e=Math.exp(2*e))-1)/(e+1)}const lm=(function e(t,n,r){function o(i,l){var c=i[0],f=i[1],d=i[2],p=l[0],g=l[1],y=l[2],v=p-c,x=g-f,E=v*v+x*x,S,_;if(E<Qne)_=Math.log(y/d)/t,S=function(M){return[c+M*v,f+M*x,d*Math.exp(t*M*_)]};else{var j=Math.sqrt(E),R=(y*y-d*d+r*E)/(2*d*n*j),N=(y*y-d*d-r*E)/(2*y*n*j),O=Math.log(Math.sqrt(R*R+1)-R),k=Math.log(Math.sqrt(N*N+1)-N);_=(k-O)/t,S=function(M){var T=M*_,L=OT(O),G=d/(n*j)*(L*Jne(t*T+O)-Wne(O));return[c+G*v,f+G*x,d*L/OT(t*T+O)]}}return S.duration=_*1e3*t/Math.SQRT2,S}return o.rho=function(i){var l=Math.max(.001,+i),c=l*l,f=c*c;return e(l,c,f)},o})(Math.SQRT2,2,4);var tu=0,Pd=0,Ed=0,QP=1e3,Gm,Id,Km=0,bl=0,ny=0,cf=typeof performance=="object"&&performance.now?performance:Date,WP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function aE(){return bl||(WP(ere),bl=cf.now()+ny)}function ere(){bl=0}function Xm(){this._call=this._time=this._next=null}Xm.prototype=JP.prototype={constructor:Xm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?aE():+n)+(t==null?0:+t),!this._next&&Id!==this&&(Id?Id._next=this:Gm=this,Id=this),this._call=e,this._time=n,M0()},stop:function(){this._call&&(this._call=null,this._time=1/0,M0())}};function JP(e,t,n){var r=new Xm;return r.restart(e,t,n),r}function tre(){aE(),++tu;for(var e=Gm,t;e;)(t=bl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tu}function MT(){bl=(Km=cf.now())+ny,tu=Pd=0;try{tre()}finally{tu=0,rre(),bl=0}}function nre(){var e=cf.now(),t=e-Km;t>QP&&(ny-=t,Km=e)}function rre(){for(var e,t=Gm,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Gm=n);Id=e,M0(r)}function M0(e){if(!tu){Pd&&(Pd=clearTimeout(Pd));var t=e-bl;t>24?(e<1/0&&(Pd=setTimeout(MT,e-cf.now()-ny)),Ed&&(Ed=clearInterval(Ed))):(Ed||(Km=cf.now(),Ed=setInterval(nre,QP)),tu=1,WP(MT))}}function kT(e,t,n){var r=new Xm;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var ore=ey("start","end","cancel","interrupt"),sre=[],eI=0,AT=1,k0=2,cm=3,DT=4,A0=5,um=6;function ry(e,t,n,r,o,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;ire(e,n,{name:t,index:r,group:o,on:ore,tween:sre,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:eI})}function lE(e,t){var n=gs(e,t);if(n.state>eI)throw new Error("too late; already scheduled");return n}function qs(e,t){var n=gs(e,t);if(n.state>cm)throw new Error("too late; already running");return n}function gs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ire(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=JP(i,0,n.time);function i(d){n.state=AT,n.timer.restart(l,n.delay,n.time),n.delay<=d&&l(d-n.delay)}function l(d){var p,g,y,v;if(n.state!==AT)return f();for(p in r)if(v=r[p],v.name===n.name){if(v.state===cm)return kT(l);v.state===DT?(v.state=um,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[p]):+p<t&&(v.state=um,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete r[p])}if(kT(function(){n.state===cm&&(n.state=DT,n.timer.restart(c,n.delay,n.time),c(d))}),n.state=k0,n.on.call("start",e,e.__data__,n.index,n.group),n.state===k0){for(n.state=cm,o=new Array(y=n.tween.length),p=0,g=-1;p<y;++p)(v=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(o[++g]=v);o.length=g+1}}function c(d){for(var p=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(f),n.state=A0,1),g=-1,y=o.length;++g<y;)o[g].call(e,p);n.state===A0&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=um,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function dm(e,t){var n=e.__transition,r,o,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){i=!1;continue}o=r.state>k0&&r.state<A0,r.state=um,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}i&&delete e.__transition}}function are(e){return this.each(function(){dm(this,e)})}function lre(e,t){var n,r;return function(){var o=qs(this,e),i=o.tween;if(i!==n){r=n=i;for(var l=0,c=r.length;l<c;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}o.tween=r}}function cre(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=qs(this,e),l=i.tween;if(l!==r){o=(r=l).slice();for(var c={name:t,value:n},f=0,d=o.length;f<d;++f)if(o[f].name===t){o[f]=c;break}f===d&&o.push(c)}i.tween=o}}function ure(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=gs(this.node(),n).tween,o=0,i=r.length,l;o<i;++o)if((l=r[o]).name===e)return l.value;return null}return this.each((t==null?lre:cre)(n,e,t))}function cE(e,t,n){var r=e._id;return e.each(function(){var o=qs(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return gs(o,r).value[t]}}function tI(e,t){var n;return(typeof t=="number"?ks:t instanceof xl?Zm:(n=xl(t))?(t=n,Zm):GP)(e,t)}function dre(e){return function(){this.removeAttribute(e)}}function fre(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hre(e,t,n){var r,o=n+"",i;return function(){var l=this.getAttribute(e);return l===o?null:l===r?i:i=t(r=l,n)}}function pre(e,t,n){var r,o=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===o?null:l===r?i:i=t(r=l,n)}}function mre(e,t,n){var r,o,i;return function(){var l,c=n(this),f;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=c+"",l===f?null:l===r&&f===o?i:(o=f,i=t(r=l,c)))}}function gre(e,t,n){var r,o,i;return function(){var l,c=n(this),f;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=c+"",l===f?null:l===r&&f===o?i:(o=f,i=t(r=l,c)))}}function yre(e,t){var n=ty(e),r=n==="transform"?Xne:tI;return this.attrTween(e,typeof t=="function"?(n.local?gre:mre)(n,r,cE(this,"attr."+e,t)):t==null?(n.local?fre:dre)(n):(n.local?pre:hre)(n,r,t))}function vre(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function xre(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function bre(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&xre(e,i)),n}return o._value=t,o}function wre(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&vre(e,i)),n}return o._value=t,o}function Sre(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ty(e);return this.tween(n,(r.local?bre:wre)(r,t))}function Ere(e,t){return function(){lE(this,e).delay=+t.apply(this,arguments)}}function Cre(e,t){return t=+t,function(){lE(this,e).delay=t}}function _re(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ere:Cre)(t,e)):gs(this.node(),t).delay}function Rre(e,t){return function(){qs(this,e).duration=+t.apply(this,arguments)}}function jre(e,t){return t=+t,function(){qs(this,e).duration=t}}function Nre(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Rre:jre)(t,e)):gs(this.node(),t).duration}function Tre(e,t){if(typeof t!="function")throw new Error;return function(){qs(this,e).ease=t}}function Ore(e){var t=this._id;return arguments.length?this.each(Tre(t,e)):gs(this.node(),t).ease}function Mre(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;qs(this,e).ease=n}}function kre(e){if(typeof e!="function")throw new Error;return this.each(Mre(this._id,e))}function Are(e){typeof e!="function"&&(e=kP(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=[],f,d=0;d<l;++d)(f=i[d])&&e.call(f,f.__data__,d,i)&&c.push(f);return new Ei(r,this._parents,this._name,this._id)}function Dre(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),l=new Array(r),c=0;c<i;++c)for(var f=t[c],d=n[c],p=f.length,g=l[c]=new Array(p),y,v=0;v<p;++v)(y=f[v]||d[v])&&(g[v]=y);for(;c<r;++c)l[c]=t[c];return new Ei(l,this._parents,this._name,this._id)}function Pre(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Ire(e,t,n){var r,o,i=Pre(t)?lE:qs;return function(){var l=i(this,e),c=l.on;c!==r&&(o=(r=c).copy()).on(t,n),l.on=o}}function zre(e,t){var n=this._id;return arguments.length<2?gs(this.node(),n).on.on(e):this.each(Ire(n,e,t))}function Lre(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $re(){return this.on("end.remove",Lre(this._id))}function Fre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=rE(e));for(var r=this._groups,o=r.length,i=new Array(o),l=0;l<o;++l)for(var c=r[l],f=c.length,d=i[l]=new Array(f),p,g,y=0;y<f;++y)(p=c[y])&&(g=e.call(p,p.__data__,y,c))&&("__data__"in p&&(g.__data__=p.__data__),d[y]=g,ry(d[y],t,n,y,d,gs(p,n)));return new Ei(i,this._parents,t,n)}function Vre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=MP(e));for(var r=this._groups,o=r.length,i=[],l=[],c=0;c<o;++c)for(var f=r[c],d=f.length,p,g=0;g<d;++g)if(p=f[g]){for(var y=e.call(p,p.__data__,g,f),v,x=gs(p,n),E=0,S=y.length;E<S;++E)(v=y[E])&&ry(v,t,n,E,y,x);i.push(y),l.push(p)}return new Ei(i,l,t,n)}var Ure=Yf.prototype.constructor;function Hre(){return new Ure(this._groups,this._parents)}function Bre(e,t){var n,r,o;return function(){var i=eu(this,e),l=(this.style.removeProperty(e),eu(this,e));return i===l?null:i===n&&l===r?o:o=t(n=i,r=l)}}function nI(e){return function(){this.style.removeProperty(e)}}function qre(e,t,n){var r,o=n+"",i;return function(){var l=eu(this,e);return l===o?null:l===r?i:i=t(r=l,n)}}function Yre(e,t,n){var r,o,i;return function(){var l=eu(this,e),c=n(this),f=c+"";return c==null&&(f=c=(this.style.removeProperty(e),eu(this,e))),l===f?null:l===r&&f===o?i:(o=f,i=t(r=l,c))}}function Zre(e,t){var n,r,o,i="style."+t,l="end."+i,c;return function(){var f=qs(this,e),d=f.on,p=f.value[i]==null?c||(c=nI(t)):void 0;(d!==n||o!==p)&&(r=(n=d).copy()).on(l,o=p),f.on=r}}function Gre(e,t,n){var r=(e+="")=="transform"?Kne:tI;return t==null?this.styleTween(e,Bre(e,r)).on("end.style."+e,nI(e)):typeof t=="function"?this.styleTween(e,Yre(e,r,cE(this,"style."+e,t))).each(Zre(this._id,e)):this.styleTween(e,qre(e,r,t),n).on("end.style."+e,null)}function Kre(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Xre(e,t,n){var r,o;function i(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&Kre(e,l,n)),r}return i._value=t,i}function Qre(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Xre(e,t,n??""))}function Wre(e){return function(){this.textContent=e}}function Jre(e){return function(){var t=e(this);this.textContent=t??""}}function eoe(e){return this.tween("text",typeof e=="function"?Jre(cE(this,"text",e)):Wre(e==null?"":e+""))}function toe(e){return function(t){this.textContent=e.call(this,t)}}function noe(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&toe(o)),t}return r._value=e,r}function roe(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,noe(e))}function ooe(){for(var e=this._name,t=this._id,n=rI(),r=this._groups,o=r.length,i=0;i<o;++i)for(var l=r[i],c=l.length,f,d=0;d<c;++d)if(f=l[d]){var p=gs(f,t);ry(f,e,n,d,l,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ei(r,this._parents,e,n)}function soe(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,l){var c={value:l},f={value:function(){--o===0&&i()}};n.each(function(){var d=qs(this,r),p=d.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(f)),d.on=t}),o===0&&i()})}var ioe=0;function Ei(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function rI(){return++ioe}var fi=Yf.prototype;Ei.prototype={constructor:Ei,select:Fre,selectAll:Vre,selectChild:fi.selectChild,selectChildren:fi.selectChildren,filter:Are,merge:Dre,selection:Hre,transition:ooe,call:fi.call,nodes:fi.nodes,node:fi.node,size:fi.size,empty:fi.empty,each:fi.each,on:zre,attr:yre,attrTween:Sre,style:Gre,styleTween:Qre,text:eoe,textTween:roe,remove:$re,tween:ure,delay:_re,duration:Nre,ease:Ore,easeVarying:kre,end:soe,[Symbol.iterator]:fi[Symbol.iterator]};function aoe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var loe={time:null,delay:0,duration:250,ease:aoe};function coe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function uoe(e){var t,n;e instanceof Ei?(t=e._id,e=e._name):(t=rI(),(n=loe).time=aE(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var l=r[i],c=l.length,f,d=0;d<c;++d)(f=l[d])&&ry(f,e,t,d,l,n||coe(f,t));return new Ei(r,this._parents,e,t)}Yf.prototype.interrupt=are;Yf.prototype.transition=uoe;const Hp=e=>()=>e;function doe(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function gi(e,t,n){this.k=e,this.x=t,this.y=n}gi.prototype={constructor:gi,scale:function(e){return e===1?this:new gi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var oy=new gi(1,0,0);oI.prototype=gi.prototype;function oI(e){for(;!e.__zoom;)if(!(e=e.parentNode))return oy;return e.__zoom}function lb(e){e.stopImmediatePropagation()}function Cd(e){e.preventDefault(),e.stopImmediatePropagation()}function foe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function hoe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function PT(){return this.__zoom||oy}function poe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function moe(){return navigator.maxTouchPoints||"ontouchstart"in this}function goe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function sI(){var e=foe,t=hoe,n=goe,r=poe,o=moe,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,f=lm,d=ey("start","zoom","end"),p,g,y,v=500,x=150,E=0,S=10;function _(I){I.property("__zoom",PT).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",G).filter(o).on("touchstart.zoom",B).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(I,z,A,P){var U=I.selection?I.selection():I;U.property("__zoom",PT),I!==U?O(I,z,A,P):U.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},_.scaleBy=function(I,z,A,P){_.scaleTo(I,function(){var U=this.__zoom.k,H=typeof z=="function"?z.apply(this,arguments):z;return U*H},A,P)},_.scaleTo=function(I,z,A,P){_.transform(I,function(){var U=t.apply(this,arguments),H=this.__zoom,Y=A==null?N(U):typeof A=="function"?A.apply(this,arguments):A,$=H.invert(Y),F=typeof z=="function"?z.apply(this,arguments):z;return n(R(j(H,F),Y,$),U,l)},A,P)},_.translateBy=function(I,z,A,P){_.transform(I,function(){return n(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),l)},null,P)},_.translateTo=function(I,z,A,P,U){_.transform(I,function(){var H=t.apply(this,arguments),Y=this.__zoom,$=P==null?N(H):typeof P=="function"?P.apply(this,arguments):P;return n(oy.translate($[0],$[1]).scale(Y.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof A=="function"?-A.apply(this,arguments):-A),H,l)},P,U)};function j(I,z){return z=Math.max(i[0],Math.min(i[1],z)),z===I.k?I:new gi(z,I.x,I.y)}function R(I,z,A){var P=z[0]-A[0]*I.k,U=z[1]-A[1]*I.k;return P===I.x&&U===I.y?I:new gi(I.k,P,U)}function N(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function O(I,z,A,P){I.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var U=this,H=arguments,Y=k(U,H).event(P),$=t.apply(U,H),F=A==null?N($):typeof A=="function"?A.apply(U,H):A,Q=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),X=U.__zoom,ne=typeof z=="function"?z.apply(U,H):z,te=f(X.invert(F).concat(Q/X.k),ne.invert(F).concat(Q/ne.k));return function(J){if(J===1)J=ne;else{var K=te(J),re=Q/K[2];J=new gi(re,F[0]-K[0]*re,F[1]-K[1]*re)}Y.zoom(null,J)}})}function k(I,z,A){return!A&&I.__zooming||new M(I,z)}function M(I,z){this.that=I,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,z),this.taps=0}M.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,z){return this.mouse&&I!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var z=Eo(this.that).datum();d.call(I,this.that,new doe(I,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),z)}};function T(I,...z){if(!e.apply(this,arguments))return;var A=k(this,z).event(I),P=this.__zoom,U=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,r.apply(this,arguments)))),H=ts(I);if(A.wheel)(A.mouse[0][0]!==H[0]||A.mouse[0][1]!==H[1])&&(A.mouse[1]=P.invert(A.mouse[0]=H)),clearTimeout(A.wheel);else{if(P.k===U)return;A.mouse=[H,P.invert(H)],dm(this),A.start()}Cd(I),A.wheel=setTimeout(Y,x),A.zoom("mouse",n(R(j(P,U),A.mouse[0],A.mouse[1]),A.extent,l));function Y(){A.wheel=null,A.end()}}function L(I,...z){if(y||!e.apply(this,arguments))return;var A=I.currentTarget,P=k(this,z,!0).event(I),U=Eo(I.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",Q,!0),H=ts(I,A),Y=I.clientX,$=I.clientY;UP(I.view),lb(I),P.mouse=[H,this.__zoom.invert(H)],dm(this),P.start();function F(X){if(Cd(X),!P.moved){var ne=X.clientX-Y,te=X.clientY-$;P.moved=ne*ne+te*te>E}P.event(X).zoom("mouse",n(R(P.that.__zoom,P.mouse[0]=ts(X,A),P.mouse[1]),P.extent,l))}function Q(X){U.on("mousemove.zoom mouseup.zoom",null),HP(X.view,P.moved),Cd(X),P.event(X).end()}}function G(I,...z){if(e.apply(this,arguments)){var A=this.__zoom,P=ts(I.changedTouches?I.changedTouches[0]:I,this),U=A.invert(P),H=A.k*(I.shiftKey?.5:2),Y=n(R(j(A,H),P,U),t.apply(this,z),l);Cd(I),c>0?Eo(this).transition().duration(c).call(O,Y,P,I):Eo(this).call(_.transform,Y,P,I)}}function B(I,...z){if(e.apply(this,arguments)){var A=I.touches,P=A.length,U=k(this,z,I.changedTouches.length===P).event(I),H,Y,$,F;for(lb(I),Y=0;Y<P;++Y)$=A[Y],F=ts($,this),F=[F,this.__zoom.invert(F),$.identifier],U.touch0?!U.touch1&&U.touch0[2]!==F[2]&&(U.touch1=F,U.taps=0):(U.touch0=F,H=!0,U.taps=1+!!p);p&&(p=clearTimeout(p)),H&&(U.taps<2&&(g=F[0],p=setTimeout(function(){p=null},v)),dm(this),U.start())}}function V(I,...z){if(this.__zooming){var A=k(this,z).event(I),P=I.changedTouches,U=P.length,H,Y,$,F;for(Cd(I),H=0;H<U;++H)Y=P[H],$=ts(Y,this),A.touch0&&A.touch0[2]===Y.identifier?A.touch0[0]=$:A.touch1&&A.touch1[2]===Y.identifier&&(A.touch1[0]=$);if(Y=A.that.__zoom,A.touch1){var Q=A.touch0[0],X=A.touch0[1],ne=A.touch1[0],te=A.touch1[1],J=(J=ne[0]-Q[0])*J+(J=ne[1]-Q[1])*J,K=(K=te[0]-X[0])*K+(K=te[1]-X[1])*K;Y=j(Y,Math.sqrt(J/K)),$=[(Q[0]+ne[0])/2,(Q[1]+ne[1])/2],F=[(X[0]+te[0])/2,(X[1]+te[1])/2]}else if(A.touch0)$=A.touch0[0],F=A.touch0[1];else return;A.zoom("touch",n(R(Y,$,F),A.extent,l))}}function q(I,...z){if(this.__zooming){var A=k(this,z).event(I),P=I.changedTouches,U=P.length,H,Y;for(lb(I),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),H=0;H<U;++H)Y=P[H],A.touch0&&A.touch0[2]===Y.identifier?delete A.touch0:A.touch1&&A.touch1[2]===Y.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(Y=ts(Y,this),Math.hypot(g[0]-Y[0],g[1]-Y[1])<S)){var $=Eo(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return _.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:Hp(+I),_):r},_.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Hp(!!I),_):e},_.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:Hp(!!I),_):o},_.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Hp([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),_):t},_.scaleExtent=function(I){return arguments.length?(i[0]=+I[0],i[1]=+I[1],_):[i[0],i[1]]},_.translateExtent=function(I){return arguments.length?(l[0][0]=+I[0][0],l[1][0]=+I[1][0],l[0][1]=+I[0][1],l[1][1]=+I[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(I){return arguments.length?(n=I,_):n},_.duration=function(I){return arguments.length?(c=+I,_):c},_.interpolate=function(I){return arguments.length?(f=I,_):f},_.on=function(){var I=d.on.apply(d,arguments);return I===d?_:I},_.clickDistance=function(I){return arguments.length?(E=(I=+I)*I,_):Math.sqrt(E)},_.tapDistance=function(I){return arguments.length?(S=+I,_):S},_}const as={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},uf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],iI=["Enter"," ","Escape"],aI={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var nu;(function(e){e.Strict="strict",e.Loose="loose"})(nu||(nu={}));var sl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(sl||(sl={}));var df;(function(e){e.Partial="partial",e.Full="full"})(df||(df={}));const lI={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ca;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ca||(ca={}));var ff;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ff||(ff={}));var ft;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ft||(ft={}));const IT={[ft.Left]:ft.Right,[ft.Right]:ft.Left,[ft.Top]:ft.Bottom,[ft.Bottom]:ft.Top};function cI(e){return e===null?null:e?"valid":"invalid"}const uI=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,yoe=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),uE=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Gf=(e,t=[0,0])=>{const{width:n,height:r}=ys(e),o=e.origin??t,i=n*o[0],l=r*o[1];return{x:e.position.x-i,y:e.position.y-l}},voe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((o,i)=>{const l=typeof i=="string";let c=!t.nodeLookup&&!l?i:void 0;return t.nodeLookup&&(c=l?t.nodeLookup.get(i):uE(i)?i:t.nodeLookup.get(i.id)),c?(n=!0,sy(o,Qm(c,t.nodeOrigin))):o},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?iy(r):{x:0,y:0,width:0,height:0}},Kf=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=sy(n,Qm(o)),r=!0)}),r?iy(n):{x:0,y:0,width:0,height:0}},dE=(e,t,[n,r,o]=[0,0,1],i=!1,l=!1)=>{const c=(t.x-n)/o,f=(t.y-r)/o,d=t.width/o,p=t.height/o,g=[];for(const y of e.values()){const{measured:v,selectable:x=!0,hidden:E=!1}=y;if(l&&!x||E)continue;const S=v.width??y.width??y.initialWidth??0,_=v.height??y.height??y.initialHeight??0,{x:j,y:R}=y.internals.positionAbsolute,N=pI(c,f,d,p,j,R,S,_),O=S*_,k=i&&N>0;(!y.internals.handleBounds||k||N>=O||y.dragging)&&g.push(y)}return g},xoe=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function boe(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{let i;if(t?.includeHiddenNodes){const{width:l,height:c}=ys(o);i=l>0&&c>0}else i=!!(o.measured.width&&o.measured.height&&!o.hidden);i&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function woe({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},l){if(e.size===0)return!0;const c=boe(e,l),f=Kf(c),d=hE(f,t,n,l?.minZoom??o,l?.maxZoom??i,l?.padding??.1);return await r.setViewport(d,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),!0}function dI({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const l=n.get(e),c=l.parentId?n.get(l.parentId):void 0,{x:f,y:d}=c?c.internals.positionAbsolute:{x:0,y:0},p=l.origin??r;let g=l.extent||o;if(l.extent==="parent"&&!l.expandParent)if(!c)i?.("005",as.error005());else{const{width:v,height:x}=ys(c);v&&x&&(g=[[f,d],[f+v,d+x]])}else c&&Sl(l.extent)&&(g=[[l.extent[0][0]+f,l.extent[0][1]+d],[l.extent[1][0]+f,l.extent[1][1]+d]]);const y=Sl(g)?wl(t,g,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&i?.("015",as.error015()),{position:{x:y.x-f+(l.measured.width??0)*p[0],y:y.y-d+(l.measured.height??0)*p[1]},positionAbsolute:y}}async function Soe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(y=>y.id)),l=[];for(const y of n){if(y.deletable===!1)continue;const v=i.has(y.id),x=!v&&y.parentId&&l.find(E=>E.id===y.parentId);(v||x)&&l.push(y)}const c=new Set(t.map(y=>y.id)),f=r.filter(y=>y.deletable!==!1),p=xoe(l,f);for(const y of f)c.has(y.id)&&!p.find(x=>x.id===y.id)&&p.push(y);if(!o)return{edges:p,nodes:l};const g=await o({nodes:l,edges:p});return typeof g=="boolean"?g?{edges:p,nodes:l}:{edges:[],nodes:[]}:g}const ru=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),wl=(e={x:0,y:0},t,n)=>({x:ru(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ru(e.y,t[0][1],t[1][1]-(n?.height??0))});function fI(e,t,n){const{width:r,height:o}=ys(n),{x:i,y:l}=n.internals.positionAbsolute;return wl(e,[[i,l],[i+r,l+o]],t)}const zT=(e,t,n)=>e<t?ru(Math.abs(e-t),1,t)/t:e>n?-ru(Math.abs(e-n),1,t)/t:0,fE=(e,t,n=15,r=40)=>{const o=zT(e.x,r,t.width-r)*n,i=zT(e.y,r,t.height-r)*n;return[o,i]},sy=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),D0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),iy=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),hf=(e,t=[0,0])=>{const{x:n,y:r}=uE(e)?e.internals.positionAbsolute:Gf(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Qm=(e,t=[0,0])=>{const{x:n,y:r}=uE(e)?e.internals.positionAbsolute:Gf(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},hI=(e,t)=>iy(sy(D0(e),D0(t))),pI=(e,t,n,r,o,i,l,c)=>{const f=Math.max(0,Math.min(e+n,o+l)-Math.max(e,o)),d=Math.max(0,Math.min(t+r,i+c)-Math.max(t,i));return Math.ceil(f*d)},Wm=(e,t)=>pI(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),LT=e=>os(e.width)&&os(e.height)&&os(e.x)&&os(e.y),os=e=>!isNaN(e)&&isFinite(e),mI=(e,t)=>(n,r)=>{},Xf=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Qf=({x:e,y:t},[n,r,o],i=!1,l=[1,1])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?Xf(c,l):c},ou=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function xc(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Eoe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=xc(e,n),o=xc(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=xc(e.top??e.y??0,n),o=xc(e.bottom??e.y??0,n),i=xc(e.left??e.x??0,t),l=xc(e.right??e.x??0,t);return{top:r,right:l,bottom:o,left:i,x:i+l,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Coe(e,t,n,r,o,i){const{x:l,y:c}=ou(e,[t,n,r]),{x:f,y:d}=ou({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-f,g=i-d;return{left:Math.floor(l),top:Math.floor(c),right:Math.floor(p),bottom:Math.floor(g)}}const hE=(e,t,n,r,o,i)=>{const l=Eoe(i,t,n),c=(t-l.x)/e.width,f=(n-l.y)/e.height,d=Math.min(c,f),p=ru(d,r,o),g=e.x+e.width/2,y=e.y+e.height/2,v=t/2-g*p,x=n/2-y*p,E=Coe(e,v,x,p,t,n),S={left:Math.min(E.left-l.left,0),top:Math.min(E.top-l.top,0),right:Math.min(E.right-l.right,0),bottom:Math.min(E.bottom-l.bottom,0)};return{x:v-S.left+S.right,y:x-S.top+S.bottom,zoom:p}},pf=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Sl(e){return e!=null&&e!=="parent"}function ys(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function gI(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function yI(e,t={width:0,height:0},n,r,o){const i={...e},l=r.get(n);if(l){const c=l.origin||o;i.x+=l.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=l.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function $T(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _oe(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Roe(e){return{...aI,...e||{}}}function qd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:l}=ss(e),c=Qf({x:i-(o?.left??0),y:l-(o?.top??0)},r),{x:f,y:d}=n?Xf(c,t):c;return{xSnapped:f,ySnapped:d,...c}}const pE=e=>({width:e.offsetWidth,height:e.offsetHeight}),vI=e=>e?.getRootNode?.()||window?.document,joe=["INPUT","SELECT","TEXTAREA"];function xI(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:joe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const bI=e=>"clientX"in e,ss=(e,t)=>{const n=bI(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},FT=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:o,position:l.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...pE(l)}})};function wI({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:l,targetControlY:c}){const f=e*.125+o*.375+l*.375+n*.125,d=t*.125+i*.375+c*.375+r*.125,p=Math.abs(f-e),g=Math.abs(d-t);return[f,d,p,g]}function Bp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function VT({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case ft.Left:return[t-Bp(t-r,i),n];case ft.Right:return[t+Bp(r-t,i),n];case ft.Top:return[t,n-Bp(n-o,i)];case ft.Bottom:return[t,n+Bp(o-n,i)]}}function SI({sourceX:e,sourceY:t,sourcePosition:n=ft.Bottom,targetX:r,targetY:o,targetPosition:i=ft.Top,curvature:l=.25}){const[c,f]=VT({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[d,p]=VT({pos:i,x1:r,y1:o,x2:e,y2:t,c:l}),[g,y,v,x]=wI({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:c,sourceControlY:f,targetControlX:d,targetControlY:p});return[`M${e},${t} C${c},${f} ${d},${p} ${r},${o}`,g,y,v,x]}function EI({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,l=Math.abs(r-t)/2,c=r<t?r+l:r-l;return[i,c,o,l]}function Noe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const l=o&&n?r+1e3:r,c=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return l+c}function Toe({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=sy(Qm(e),Qm(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const l={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return Wm(l,iy(i))>0}const Ooe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Moe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),koe=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",as.error006()),t;const r=n.getEdgeId||Ooe;let o;return uI(e)?o={...e}:o={...e,id:r(e)},Moe(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function CI({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,l,c]=EI({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,l,c]}const UT={[ft.Left]:{x:-1,y:0},[ft.Right]:{x:1,y:0},[ft.Top]:{x:0,y:-1},[ft.Bottom]:{x:0,y:1}},Aoe=({source:e,sourcePosition:t=ft.Bottom,target:n})=>t===ft.Left||t===ft.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},HT=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Doe({source:e,sourcePosition:t=ft.Bottom,target:n,targetPosition:r=ft.Top,center:o,offset:i,stepPosition:l}){const c=UT[t],f=UT[r],d={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+f.x*i,y:n.y+f.y*i},g=Aoe({source:d,sourcePosition:t,target:p}),y=g.x!==0?"x":"y",v=g[y];let x=[],E,S;const _={x:0,y:0},j={x:0,y:0},[,,R,N]=EI({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[y]*f[y]===-1){y==="x"?(E=o.x??d.x+(p.x-d.x)*l,S=o.y??(d.y+p.y)/2):(E=o.x??(d.x+p.x)/2,S=o.y??d.y+(p.y-d.y)*l);const T=[{x:E,y:d.y},{x:E,y:p.y}],L=[{x:d.x,y:S},{x:p.x,y:S}];c[y]===v?x=y==="x"?T:L:x=y==="x"?L:T}else{const T=[{x:d.x,y:p.y}],L=[{x:p.x,y:d.y}];if(y==="x"?x=c.x===v?L:T:x=c.y===v?T:L,t===r){const I=Math.abs(e[y]-n[y]);if(I<=i){const z=Math.min(i-1,i-I);c[y]===v?_[y]=(d[y]>e[y]?-1:1)*z:j[y]=(p[y]>n[y]?-1:1)*z}}if(t!==r){const I=y==="x"?"y":"x",z=c[y]===f[I],A=d[I]>p[I],P=d[I]<p[I];(c[y]===1&&(!z&&A||z&&P)||c[y]!==1&&(!z&&P||z&&A))&&(x=y==="x"?T:L)}const G={x:d.x+_.x,y:d.y+_.y},B={x:p.x+j.x,y:p.y+j.y},V=Math.max(Math.abs(G.x-x[0].x),Math.abs(B.x-x[0].x)),q=Math.max(Math.abs(G.y-x[0].y),Math.abs(B.y-x[0].y));V>=q?(E=(G.x+B.x)/2,S=x[0].y):(E=x[0].x,S=(G.y+B.y)/2)}const O={x:d.x+_.x,y:d.y+_.y},k={x:p.x+j.x,y:p.y+j.y};return[[e,...O.x!==x[0].x||O.y!==x[0].y?[O]:[],...x,...k.x!==x[x.length-1].x||k.y!==x[x.length-1].y?[k]:[],n],E,S,R,N]}function Poe(e,t,n,r){const o=Math.min(HT(e,t)/2,HT(t,n)/2,r),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const d=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+o*d},${l}Q ${i},${l} ${i},${l+o*p}`}const c=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+o*f}Q ${i},${l} ${i+o*c},${l}`}function Jm({sourceX:e,sourceY:t,sourcePosition:n=ft.Bottom,targetX:r,targetY:o,targetPosition:i=ft.Top,borderRadius:l=5,centerX:c,centerY:f,offset:d=20,stepPosition:p=.5}){const[g,y,v,x,E]=Doe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:c,y:f},offset:d,stepPosition:p});let S=`M${g[0].x} ${g[0].y}`;for(let _=1;_<g.length-1;_++)S+=Poe(g[_-1],g[_],g[_+1],l);return S+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[S,y,v,x,E]}function BT(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ioe(e){const{sourceNode:t,targetNode:n}=e;if(!BT(t)||!BT(n))return null;const r=t.internals.handleBounds||qT(t.handles),o=n.internals.handleBounds||qT(n.handles),i=YT(r?.source??[],e.sourceHandle),l=YT(e.connectionMode===nu.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!l)return e.onError?.("008",as.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||ft.Bottom,f=l?.position||ft.Top,d=El(t,i,c),p=El(n,l,f);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:c,targetPosition:f}}function qT(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function El(e,t,n=ft.Left,r=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:l,height:c}=t??ys(e);if(r)return{x:o+l/2,y:i+c/2};switch(t?.position??n){case ft.Top:return{x:o+l/2,y:i};case ft.Right:return{x:o+l,y:i+c/2};case ft.Bottom:return{x:o+l/2,y:i+c};case ft.Left:return{x:o,y:i+c/2}}}function YT(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function P0(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function zoe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((l,c)=>([c.markerStart||r,c.markerEnd||o].forEach(f=>{if(f&&typeof f=="object"){const d=P0(f,t);i.has(d)||(l.push({id:d,color:f.color||n,...f}),i.add(d))}}),l),[]).sort((l,c)=>l.id.localeCompare(c.id))}const _I=1e3,Loe=10,mE={nodeOrigin:[0,0],nodeExtent:uf,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},$oe={...mE,checkEquality:!0};function gE(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Foe(e,t,n){const r=gE(mE,n);for(const o of e.values())if(o.parentId)vE(o,e,t,r);else{const i=Gf(o,r.nodeOrigin),l=Sl(o.extent)?o.extent:r.nodeExtent,c=wl(i,l,ys(o));o.internals.positionAbsolute=c}}function Voe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function yE(e){return e==="manual"}function I0(e,t,n,r={}){const o=gE($oe,r),i={i:0},l=new Map(t),c=o?.elevateNodesOnSelect&&!yE(o.zIndexMode)?_I:0;let f=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let g=l.get(p.id);if(o.checkEquality&&p===g?.internals.userNode)t.set(p.id,g);else{const y=Gf(p,o.nodeOrigin),v=Sl(p.extent)?p.extent:o.nodeExtent,x=wl(y,v,ys(p));g={...o.defaults,...p,measured:{width:p.measured?.width,height:p.measured?.height},internals:{positionAbsolute:x,handleBounds:Voe(p,g),z:RI(p,c,o.zIndexMode),userNode:p}},t.set(p.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(f=!1),p.parentId&&vE(g,t,n,r,i),d||=p.selected??!1}return{nodesInitialized:f,hasSelectedNodes:d}}function Uoe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function vE(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:l,nodeExtent:c,zIndexMode:f}=gE(mE,r),d=e.parentId,p=t.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Uoe(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&f==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*Loe),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const g=i&&!yE(f)?_I:0,{x:y,y:v,z:x}=Hoe(e,p,l,c,g,f),{positionAbsolute:E}=e.internals,S=y!==E.x||v!==E.y;(S||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:y,y:v}:E,z:x}})}function RI(e,t,n){const r=os(e.zIndex)?e.zIndex:0;return yE(n)?r:r+(e.selected?t:0)}function Hoe(e,t,n,r,o,i){const{x:l,y:c}=t.internals.positionAbsolute,f=ys(e),d=Gf(e,n),p=Sl(e.extent)?wl(d,e.extent,f):d;let g=wl({x:l+p.x,y:c+p.y},r,f);e.extent==="parent"&&(g=fI(g,f,t));const y=RI(e,o,i),v=t.internals.z??0;return{x:g.x,y:g.y,z:v>=y?v+1:y}}function xE(e,t,n,r=[0,0]){const o=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const f=i.get(l.parentId)?.expandedRect??hf(c),d=hI(f,l.rect);i.set(l.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},f)=>{const d=c.internals.positionAbsolute,p=ys(c),g=c.origin??r,y=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,v=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(p.width,Math.round(l.width)),E=Math.max(p.height,Math.round(l.height)),S=(x-p.width)*g[0],_=(E-p.height)*g[1];(y>0||v>0||S||_)&&(o.push({id:f,type:"position",position:{x:c.position.x-y+S,y:c.position.y-v+_}}),n.get(f)?.forEach(j=>{e.some(R=>R.id===j.id)||o.push({id:j.id,type:"position",position:{x:j.position.x+y,y:j.position.y+v}})})),(p.width<l.width||p.height<l.height||y||v)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:x+(y?g[0]*y-S:0),height:E+(v?g[1]*v-_:0)}})}),o}function Boe(e,t,n,r,o,i,l){const c=r?.querySelector(".xyflow__viewport");let f=!1;if(!c)return{changes:[],updatedInternals:f};const d=[],p=window.getComputedStyle(c),{m22:g}=new window.DOMMatrixReadOnly(p.transform),y=[];for(const v of e.values()){const x=t.get(v.id);if(!x)continue;if(x.hidden){t.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),f=!0;continue}const E=pE(v.nodeElement),S=x.measured.width!==E.width||x.measured.height!==E.height;if(!!(E.width&&E.height&&(S||!x.internals.handleBounds||v.force))){const j=v.nodeElement.getBoundingClientRect(),R=Sl(x.extent)?x.extent:i;let{positionAbsolute:N}=x.internals;if(x.parentId&&x.extent==="parent"){const k=t.get(x.parentId);k&&(N=fI(N,E,k))}else R&&(N=wl(N,R,E));const O={...x,measured:E,internals:{...x.internals,positionAbsolute:N,handleBounds:{source:FT("source",v.nodeElement,j,g,x.id),target:FT("target",v.nodeElement,j,g,x.id)}}};t.set(x.id,O),x.parentId&&vE(O,t,n,{nodeOrigin:o,zIndexMode:l}),f=!0,S&&(d.push({id:x.id,type:"dimensions",dimensions:E}),x.expandParent&&x.parentId&&y.push({id:x.id,parentId:x.parentId,rect:hf(O,o)}))}}if(y.length>0){const v=xE(y,t,n,o);d.push(...v)}return{changes:d,updatedInternals:f}}async function qoe({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2])}function ZT(e,t,n,r,o,i){let l=o;const c=r.get(l)||new Map;r.set(l,c.set(n,t)),l=`${o}-${e}`;const f=r.get(l)||new Map;if(r.set(l,f.set(n,t)),i){l=`${o}-${e}-${i}`;const d=r.get(l)||new Map;r.set(l,d.set(n,t))}}function jI(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:l=null,targetHandle:c=null}=r,f={edgeId:r.id,source:o,target:i,sourceHandle:l,targetHandle:c},d=`${o}-${l}--${i}-${c}`,p=`${i}-${c}--${o}-${l}`;ZT("source",f,p,e,o,l),ZT("target",f,d,e,i,c),t.set(r.id,r)}}function NI(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:NI(n,t):!1}function GT(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Yoe(e,t,n,r){const o=new Map;for(const[i,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!NI(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const c=e.get(i);c&&o.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return o}function cb({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const o=[];for(const[l,c]of t){const f=n.get(l)?.internals.userNode;f&&o.push({...f,position:c.position,dragging:r})}if(!e)return[o[0],o];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function Zoe({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},l=Xf(i,t);return{x:l.x-i.x,y:l.y-i.y}}function Goe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},l=0,c=new Map,f=!1,d={x:0,y:0},p=null,g=!1,y=null,v=!1,x=!1,E=null;function S({noDragClassName:j,handleSelector:R,domNode:N,isSelectable:O,nodeId:k,nodeClickDistance:M=0}){y=Eo(N);function T({x:V,y:q}){const{nodeLookup:I,nodeExtent:z,snapGrid:A,snapToGrid:P,nodeOrigin:U,onNodeDrag:H,onSelectionDrag:Y,onError:$,updateNodePositions:F}=t();i={x:V,y:q};let Q=!1;const X=c.size>1,ne=X&&z?D0(Kf(c)):null,te=X&&P?Zoe({dragItems:c,snapGrid:A,x:V,y:q}):null;for(const[J,K]of c){if(!I.has(J))continue;let re={x:V-K.distance.x,y:q-K.distance.y};P&&(re=te?{x:Math.round(re.x+te.x),y:Math.round(re.y+te.y)}:Xf(re,A));let ye=null;if(X&&z&&!K.extent&&ne){const{positionAbsolute:he}=K.internals,Re=he.x-ne.x+z[0][0],ze=he.x+K.measured.width-ne.x2+z[1][0],Ue=he.y-ne.y+z[0][1],Ae=he.y+K.measured.height-ne.y2+z[1][1];ye=[[Re,Ue],[ze,Ae]]}const{position:fe,positionAbsolute:ue}=dI({nodeId:J,nextPosition:re,nodeLookup:I,nodeExtent:ye||z,nodeOrigin:U,onError:$});Q=Q||K.position.x!==fe.x||K.position.y!==fe.y,K.position=fe,K.internals.positionAbsolute=ue}if(x=x||Q,!!Q&&(F(c,!0),E&&(r||H||!k&&Y))){const[J,K]=cb({nodeId:k,dragItems:c,nodeLookup:I});r?.(E,c,J,K),H?.(E,J,K),k||Y?.(E,K)}}async function L(){if(!p)return;const{transform:V,panBy:q,autoPanSpeed:I,autoPanOnNodeDrag:z}=t();if(!z){f=!1,cancelAnimationFrame(l);return}const[A,P]=fE(d,p,I);(A!==0||P!==0)&&(i.x=(i.x??0)-A/V[2],i.y=(i.y??0)-P/V[2],await q({x:A,y:P})&&T(i)),l=requestAnimationFrame(L)}function G(V){const{nodeLookup:q,multiSelectionActive:I,nodesDraggable:z,transform:A,snapGrid:P,snapToGrid:U,selectNodesOnDrag:H,onNodeDragStart:Y,onSelectionDragStart:$,unselectNodesAndEdges:F}=t();g=!0,(!H||!O)&&!I&&k&&(q.get(k)?.selected||F()),O&&H&&k&&e?.(k);const Q=qd(V.sourceEvent,{transform:A,snapGrid:P,snapToGrid:U,containerBounds:p});if(i=Q,c=Yoe(q,z,Q,k),c.size>0&&(n||Y||!k&&$)){const[X,ne]=cb({nodeId:k,dragItems:c,nodeLookup:q});n?.(V.sourceEvent,c,X,ne),Y?.(V.sourceEvent,X,ne),k||$?.(V.sourceEvent,ne)}}const B=BP().clickDistance(M).on("start",V=>{const{domNode:q,nodeDragThreshold:I,transform:z,snapGrid:A,snapToGrid:P}=t();p=q?.getBoundingClientRect()||null,v=!1,x=!1,E=V.sourceEvent,I===0&&G(V),i=qd(V.sourceEvent,{transform:z,snapGrid:A,snapToGrid:P,containerBounds:p}),d=ss(V.sourceEvent,p)}).on("drag",V=>{const{autoPanOnNodeDrag:q,transform:I,snapGrid:z,snapToGrid:A,nodeDragThreshold:P,nodeLookup:U}=t(),H=qd(V.sourceEvent,{transform:I,snapGrid:z,snapToGrid:A,containerBounds:p});if(E=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||k&&!U.has(k))&&(v=!0),!v){if(!f&&q&&g&&(f=!0,L()),!g){const Y=ss(V.sourceEvent,p),$=Y.x-d.x,F=Y.y-d.y;Math.sqrt($*$+F*F)>P&&G(V)}(i.x!==H.xSnapped||i.y!==H.ySnapped)&&c&&g&&(d=ss(V.sourceEvent,p),T(H))}}).on("end",V=>{if(!g||v){v&&c.size>0&&t().updateNodePositions(c,!1);return}if(f=!1,g=!1,cancelAnimationFrame(l),c.size>0){const{nodeLookup:q,updateNodePositions:I,onNodeDragStop:z,onSelectionDragStop:A}=t();if(x&&(I(c,!1),x=!1),o||z||!k&&A){const[P,U]=cb({nodeId:k,dragItems:c,nodeLookup:q,dragging:!1});o?.(V.sourceEvent,c,P,U),z?.(V.sourceEvent,P,U),k||A?.(V.sourceEvent,U)}}}).filter(V=>{const q=V.target;return!V.button&&(!j||!GT(q,`.${j}`,N))&&(!R||GT(q,R,N))});y.call(B)}function _(){y?.on(".drag",null)}return{update:S,destroy:_}}function Koe(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Wm(o,hf(i))>0&&r.push(i);return r}const Xoe=250;function Qoe(e,t,n,r){let o=[],i=1/0;const l=Koe(e,n,t+Xoe);for(const c of l){const f=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const d of f){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:p,y:g}=El(c,d,d.position,!0),y=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(g-e.y,2));y>t||(y<i?(o=[{...d,x:p,y:g}],i=y):y===i&&o.push({...d,x:p,y:g}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(f=>f.type===c)??o[0]}return o[0]}function TI(e,t,n,r,o,i=!1){const l=r.get(e);if(!l)return null;const c=o==="strict"?l.internals.handleBounds?.[t]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],f=(n?c?.find(d=>d.id===n):c?.[0])??null;return f&&i?{...f,...El(l,f,f.position,!0)}:f}function OI(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Woe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const MI=()=>!0;function Joe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:l,domNode:c,nodeLookup:f,lib:d,autoPanOnConnect:p,flowId:g,panBy:y,cancelConnection:v,onConnectStart:x,onConnect:E,onConnectEnd:S,isValidConnection:_=MI,onReconnectEnd:j,updateConnection:R,getTransform:N,getFromHandle:O,autoPanSpeed:k,dragThreshold:M=1,handleDomNode:T}){const L=vI(e.target);let G=0,B;const{x:V,y:q}=ss(e),I=OI(i,T),z=c?.getBoundingClientRect();let A=!1;if(!z||!I)return;const P=TI(o,I,r,f,t);if(!P)return;let U=ss(e,z),H=!1,Y=null,$=!1,F=null;function Q(){if(!p||!z)return;const[fe,ue]=fE(U,z,k);y({x:fe,y:ue}),G=requestAnimationFrame(Q)}const X={...P,nodeId:o,type:I,position:P.position},ne=f.get(o);let J={inProgress:!0,isValid:null,from:El(ne,X,ft.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ne,to:U,toHandle:null,toPosition:IT[X.position],toNode:null,pointer:U};function K(){A=!0,R(J),x?.(e,{nodeId:o,handleId:r,handleType:I})}M===0&&K();function re(fe){if(!A){const{x:Ae,y:Qe}=ss(fe),De=Ae-V,Le=Qe-q;if(!(De*De+Le*Le>M*M))return;K()}if(!O()||!X){ye(fe);return}const ue=N();U=ss(fe,z),B=Qoe(Qf(U,ue,!1,[1,1]),n,f,X),H||(Q(),H=!0);const he=kI(fe,{handle:B,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:l?"target":"source",isValidConnection:_,doc:L,lib:d,flowId:g,nodeLookup:f});F=he.handleDomNode,Y=he.connection,$=Woe(!!B,he.isValid);const Re=f.get(o),ze=Re?El(Re,X,ft.Left,!0):J.from,Ue={...J,from:ze,isValid:$,to:he.toHandle&&$?ou({x:he.toHandle.x,y:he.toHandle.y},ue):U,toHandle:he.toHandle,toPosition:$&&he.toHandle?he.toHandle.position:IT[X.position],toNode:he.toHandle?f.get(he.toHandle.nodeId):null,pointer:U};R(Ue),J=Ue}function ye(fe){if(!("touches"in fe&&fe.touches.length>0)){if(A){(B||F)&&Y&&$&&E?.(Y);const{inProgress:ue,...he}=J,Re={...he,toPosition:J.toHandle?J.toPosition:null};S?.(fe,Re),i&&j?.(fe,Re)}v(),cancelAnimationFrame(G),H=!1,$=!1,Y=null,F=null,L.removeEventListener("mousemove",re),L.removeEventListener("mouseup",ye),L.removeEventListener("touchmove",re),L.removeEventListener("touchend",ye)}}L.addEventListener("mousemove",re),L.addEventListener("mouseup",ye),L.addEventListener("touchmove",re),L.addEventListener("touchend",ye)}function kI(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:l,lib:c,flowId:f,isValidConnection:d=MI,nodeLookup:p}){const g=i==="target",y=t?l.querySelector(`.${c}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:v,y:x}=ss(e),E=l.elementFromPoint(v,x),S=E?.classList.contains(`${c}-flow__handle`)?E:y,_={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const j=OI(void 0,S),R=S.getAttribute("data-nodeid"),N=S.getAttribute("data-handleid"),O=S.classList.contains("connectable"),k=S.classList.contains("connectableend");if(!R||!j)return _;const M={source:g?R:r,sourceHandle:g?N:o,target:g?r:R,targetHandle:g?o:N};_.connection=M;const L=O&&k&&(n===nu.Strict?g&&j==="source"||!g&&j==="target":R!==r||N!==o);_.isValid=L&&d(M),_.toHandle=TI(R,j,N,p,n,!0)}return _}const z0={onPointerDown:Joe,isValid:kI};function ese({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Eo(e);function i({translateExtent:c,width:f,height:d,zoomStep:p=1,pannable:g=!0,zoomable:y=!0,inversePan:v=!1}){const x=R=>{if(R.sourceEvent.type!=="wheel"||!t)return;const N=n(),O=R.sourceEvent.ctrlKey&&pf()?10:1,k=-R.sourceEvent.deltaY*(R.sourceEvent.deltaMode===1?.05:R.sourceEvent.deltaMode?1:.002)*p,M=N[2]*Math.pow(2,k*O);t.scaleTo(M)};let E=[0,0];const S=R=>{(R.sourceEvent.type==="mousedown"||R.sourceEvent.type==="touchstart")&&(E=[R.sourceEvent.clientX??R.sourceEvent.touches[0].clientX,R.sourceEvent.clientY??R.sourceEvent.touches[0].clientY])},_=R=>{const N=n();if(R.sourceEvent.type!=="mousemove"&&R.sourceEvent.type!=="touchmove"||!t)return;const O=[R.sourceEvent.clientX??R.sourceEvent.touches[0].clientX,R.sourceEvent.clientY??R.sourceEvent.touches[0].clientY],k=[O[0]-E[0],O[1]-E[1]];E=O;const M=r()*Math.max(N[2],Math.log(N[2]))*(v?-1:1),T={x:N[0]-k[0]*M,y:N[1]-k[1]*M},L=[[0,0],[f,d]];t.setViewportConstrained({x:T.x,y:T.y,zoom:N[2]},L,c)},j=sI().on("start",S).on("zoom",g?_:null).on("zoom.wheel",y?x:null);o.call(j,{})}function l(){o.on("zoom",null)}return{update:i,destroy:l,pointer:ts}}const ay=e=>({x:e.x,y:e.y,zoom:e.k}),ub=({x:e,y:t,zoom:n})=>oy.translate(e,t).scale(n),aa=(e,t)=>e.target.closest(`.${t}`),AI=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),tse=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,db=(e,t=0,n=tse,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},DI=e=>{const t=e.ctrlKey&&pf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nse({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:l,onPanZoomStart:c,onPanZoom:f,onPanZoomEnd:d}){return p=>{if(aa(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const g=n.property("__zoom").k||1;if(p.ctrlKey&&l){const S=ts(p),_=DI(p),j=g*Math.pow(2,_);r.scaleTo(n,j,S,p);return}const y=p.deltaMode===1?20:1;let v=o===sl.Vertical?0:p.deltaX*y,x=o===sl.Horizontal?0:p.deltaY*y;!pf()&&p.shiftKey&&o!==sl.Vertical&&(v=p.deltaY*y,x=0),r.translateBy(n,-(v/g)*i,-(x/g)*i,{internal:!0});const E=ay(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?f?.(p,E):(e.isPanScrolling=!0,c?.(p,E)),e.panScrollTimeout=setTimeout(()=>{d?.(p,E),e.isPanScrolling=!1},150)}}function rse({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",l=!t&&i&&!r.ctrlKey,c=aa(r,e);if(r.ctrlKey&&i&&c&&r.preventDefault(),l||c)return null;r.preventDefault(),n.call(this,r,o)}}function ose({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const o=ay(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}function sse({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&AI(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,ay(i.transform))}}function ise({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&AI(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&i(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=ay(l.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(l.sourceEvent,c)},n?150:0)}}}function ase({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:l,userSelectionActive:c,noWheelClassName:f,noPanClassName:d,lib:p,connectionInProgress:g}){return y=>{const v=t||n,x=r&&y.ctrlKey,E=y.type==="wheel";if(y.button===1&&y.type==="mousedown"&&(aa(y,`${p}-flow__node`)||aa(y,`${p}-flow__edge`)||aa(y,`${p}-flow__selection`)||aa(y,`${p}-flow__nodesselection`)))return!0;if(!o&&!v&&!i&&!l&&!r||c||g&&!E||aa(y,f)&&E||aa(y,d)&&(!E||i&&E&&!t)||!r&&y.ctrlKey&&E)return!1;if(!r&&y.type==="touchstart"&&y.touches?.length>1)return y.preventDefault(),!1;if(!v&&!i&&!x&&E||!o&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(o)&&!o.includes(y.button)&&y.type==="mousedown")return!1;const S=Array.isArray(o)&&o.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||E||e)&&S}}function lse({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:f}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect();let g=[[0,0],[p.width,p.height]];(typeof ResizeObserver<"u"?new ResizeObserver(q=>{const I=q[0];I&&(g=[[0,0],[I.contentRect.width,I.contentRect.height]])}):null)?.observe(e);const v=sI().extent(()=>g).scaleExtent([t,n]).translateExtent(r),x=Eo(e).call(v);N({x:o.x,y:o.y,zoom:ru(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const E=x.on("wheel.zoom"),S=x.on("dblclick.zoom");v.wheelDelta(DI);async function _(q,I){return x?new Promise(z=>{v?.interpolate(I?.interpolate==="linear"?Bd:lm).transform(db(x,I?.duration,I?.ease,()=>z(!0)),q)}):!1}function j({noWheelClassName:q,noPanClassName:I,onPaneContextMenu:z,userSelectionActive:A,panOnScroll:P,panOnDrag:U,panOnScrollMode:H,panOnScrollSpeed:Y,preventScrolling:$,zoomOnPinch:F,zoomOnScroll:Q,zoomOnDoubleClick:X,panActivationKeyPressed:ne=!1,zoomActivationKeyPressed:te,lib:J,onTransformChange:K,connectionInProgress:re,paneClickDistance:ye,selectionOnDrag:fe}){A&&!d.isZoomingOrPanning&&R();const ue=P&&!te&&!A;v.clickDistance(fe?1/0:!os(ye)||ye<0?0:ye);const he=ue?nse({zoomPanValues:d,noWheelClassName:q,d3Selection:x,d3Zoom:v,panOnScrollMode:H,panOnScrollSpeed:Y,zoomOnPinch:F,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):rse({noWheelClassName:q,preventScrolling:$,d3ZoomHandler:E});x.on("wheel.zoom",he,{passive:!1});const Re=ose({zoomPanValues:d,onDraggingChange:f,onPanZoomStart:l});v.on("start",Re);const ze=sse({zoomPanValues:d,panOnDrag:U,onPaneContextMenu:!!z,onPanZoom:i,onTransformChange:K});v.on("zoom",ze);const Ue=ise({zoomPanValues:d,panOnDrag:U,panOnScroll:P,onPaneContextMenu:z,onPanZoomEnd:c,onDraggingChange:f});v.on("end",Ue);const Ae=ase({panActivationKeyPressed:ne,zoomActivationKeyPressed:te,panOnDrag:U,zoomOnScroll:Q,panOnScroll:P,zoomOnDoubleClick:X,zoomOnPinch:F,userSelectionActive:A,noPanClassName:I,noWheelClassName:q,lib:J,connectionInProgress:re});v.filter(Ae),X?x.on("dblclick.zoom",S):x.on("dblclick.zoom",null)}function R(){v.on("zoom",null)}async function N(q,I,z){const A=ub(q),P=v?.constrain()(A,I,z);return P&&await _(P),P}async function O(q,I){const z=ub(q);return await _(z,I),z}function k(q){if(x){const I=ub(q),z=x.property("__zoom");(z.k!==q.zoom||z.x!==q.x||z.y!==q.y)&&v?.transform(x,I,null,{sync:!0})}}function M(){const q=x?oI(x.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}async function T(q,I){return x?new Promise(z=>{v?.interpolate(I?.interpolate==="linear"?Bd:lm).scaleTo(db(x,I?.duration,I?.ease,()=>z(!0)),q)}):!1}async function L(q,I){return x?new Promise(z=>{v?.interpolate(I?.interpolate==="linear"?Bd:lm).scaleBy(db(x,I?.duration,I?.ease,()=>z(!0)),q)}):!1}function G(q){v?.scaleExtent(q)}function B(q){v?.translateExtent(q)}function V(q){const I=!os(q)||q<0?0:q;v?.clickDistance(I)}return{update:j,destroy:R,setViewport:O,setViewportConstrained:N,getViewport:M,scaleTo:T,scaleBy:L,setScaleExtent:G,setTranslateExtent:B,syncViewport:k,setClickDistance:V}}var su;(function(e){e.Line="line",e.Handle="handle"})(su||(su={}));function cse({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const l=e-t,c=n-r,f=[l>0?1:l<0?-1:0,c>0?1:c<0?-1:0];return l&&o&&(f[0]=f[0]*-1),c&&i&&(f[1]=f[1]*-1),f}function KT(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function na(e,t){return Math.max(0,t-e)}function ra(e,t){return Math.max(0,e-t)}function qp(e,t,n){return Math.max(0,t-e,e-n)}function XT(e,t){return e?!t:t}function use(e,t,n,r,o,i,l,c){let{affectsX:f,affectsY:d}=t;const{isHorizontal:p,isVertical:g}=t,y=p&&g,{xSnapped:v,ySnapped:x}=n,{minWidth:E,maxWidth:S,minHeight:_,maxHeight:j}=r,{x:R,y:N,width:O,height:k,aspectRatio:M}=e;let T=Math.floor(p?v-e.pointerX:0),L=Math.floor(g?x-e.pointerY:0);const G=O+(f?-T:T),B=k+(d?-L:L),V=-i[0]*O,q=-i[1]*k;let I=qp(G,E,S),z=qp(B,_,j);if(l){let U=0,H=0;f&&T<0?U=na(R+T+V,l[0][0]):!f&&T>0&&(U=ra(R+G+V,l[1][0])),d&&L<0?H=na(N+L+q,l[0][1]):!d&&L>0&&(H=ra(N+B+q,l[1][1])),I=Math.max(I,U),z=Math.max(z,H)}if(c){let U=0,H=0;f&&T>0?U=ra(R+T,c[0][0]):!f&&T<0&&(U=na(R+G,c[1][0])),d&&L>0?H=ra(N+L,c[0][1]):!d&&L<0&&(H=na(N+B,c[1][1])),I=Math.max(I,U),z=Math.max(z,H)}if(o){if(p){const U=qp(G/M,_,j)*M;if(I=Math.max(I,U),l){let H=0;!f&&!d||f&&!d&&y?H=ra(N+q+G/M,l[1][1])*M:H=na(N+q+(f?T:-T)/M,l[0][1])*M,I=Math.max(I,H)}if(c){let H=0;!f&&!d||f&&!d&&y?H=na(N+G/M,c[1][1])*M:H=ra(N+(f?T:-T)/M,c[0][1])*M,I=Math.max(I,H)}}if(g){const U=qp(B*M,E,S)/M;if(z=Math.max(z,U),l){let H=0;!f&&!d||d&&!f&&y?H=ra(R+B*M+V,l[1][0])/M:H=na(R+(d?L:-L)*M+V,l[0][0])/M,z=Math.max(z,H)}if(c){let H=0;!f&&!d||d&&!f&&y?H=na(R+B*M,c[1][0])/M:H=ra(R+(d?L:-L)*M,c[0][0])/M,z=Math.max(z,H)}}}L=L+(L<0?z:-z),T=T+(T<0?I:-I),o&&(y?G>B*M?L=(XT(f,d)?-T:T)/M:T=(XT(f,d)?-L:L)*M:p?(L=T/M,d=f):(T=L*M,f=d));const A=f?R+T:R,P=d?N+L:N;return{width:O+(f?-T:T),height:k+(d?-L:L),x:i[0]*T*(f?-1:1)+A,y:i[1]*L*(d?-1:1)+P}}const PI={width:0,height:0,x:0,y:0},dse={...PI,pointerX:0,pointerY:0,aspectRatio:1};function fse(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,l=e.measured.height??0,c=n[0]*i,f=n[1]*l;return[[r-c,o-f],[r+i-c,o+l-f]]}function hse({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Eo(e);let l={controlDirection:KT("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:d,boundaries:p,keepAspectRatio:g,resizeDirection:y,onResizeStart:v,onResize:x,onResizeEnd:E,shouldResize:S}){let _={...PI},j={...dse};l={boundaries:p,resizeDirection:y,keepAspectRatio:g,controlDirection:KT(d)};let R,N=null,O=[],k,M,T,L=!1;const G=BP().on("start",B=>{const{nodeLookup:V,transform:q,snapGrid:I,snapToGrid:z,nodeOrigin:A,paneDomNode:P}=n();if(R=V.get(t),!R)return;N=P?.getBoundingClientRect()??null;const{xSnapped:U,ySnapped:H}=qd(B.sourceEvent,{transform:q,snapGrid:I,snapToGrid:z,containerBounds:N});_={width:R.measured.width??0,height:R.measured.height??0,x:R.position.x??0,y:R.position.y??0},j={..._,pointerX:U,pointerY:H,aspectRatio:_.width/_.height},k=void 0,M=Sl(R.extent)?R.extent:void 0,R.parentId&&(R.extent==="parent"||R.expandParent)&&(k=V.get(R.parentId)),k&&R.extent==="parent"&&(M=[[0,0],[k.measured.width,k.measured.height]]),O=[],T=void 0;for(const[Y,$]of V)if($.parentId===t&&(O.push({id:Y,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const F=fse($,R,$.origin??A);T?T=[[Math.min(F[0][0],T[0][0]),Math.min(F[0][1],T[0][1])],[Math.max(F[1][0],T[1][0]),Math.max(F[1][1],T[1][1])]]:T=F}v?.(B,{..._})}).on("drag",B=>{const{transform:V,snapGrid:q,snapToGrid:I,nodeOrigin:z}=n(),A=qd(B.sourceEvent,{transform:V,snapGrid:q,snapToGrid:I,containerBounds:N}),P=[];if(!R)return;const{x:U,y:H,width:Y,height:$}=_,F={},Q=R.origin??z,{width:X,height:ne,x:te,y:J}=use(j,l.controlDirection,A,l.boundaries,l.keepAspectRatio,Q,M,T),K=X!==Y,re=ne!==$,ye=te!==U&&K,fe=J!==H&&re;if(!ye&&!fe&&!K&&!re)return;if((ye||fe||Q[0]===1||Q[1]===1)&&(F.x=ye?te:_.x,F.y=fe?J:_.y,_.x=F.x,_.y=F.y,O.length>0)){const ze=te-U,Ue=J-H;for(const Ae of O)Ae.position={x:Ae.position.x-ze+Q[0]*(X-Y),y:Ae.position.y-Ue+Q[1]*(ne-$)},P.push(Ae)}if((K||re)&&(F.width=K&&(!l.resizeDirection||l.resizeDirection==="horizontal")?X:_.width,F.height=re&&(!l.resizeDirection||l.resizeDirection==="vertical")?ne:_.height,_.width=F.width,_.height=F.height),k&&R.expandParent){const ze=Q[0]*(F.width??0);F.x&&F.x<ze&&(_.x=ze,j.x=j.x-(F.x-ze));const Ue=Q[1]*(F.height??0);F.y&&F.y<Ue&&(_.y=Ue,j.y=j.y-(F.y-Ue))}const ue=cse({width:_.width,prevWidth:Y,height:_.height,prevHeight:$,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),he={..._,direction:ue};S?.(B,he)!==!1&&(L=!0,x?.(B,he),r(F,P))}).on("end",B=>{L&&(E?.(B,{..._}),o?.({..._}),L=!1)});i.call(G)}function f(){i.on(".drag",null)}return{update:c,destroy:f}}const pse={},QT=e=>{let t;const n=new Set,r=(p,g)=>{const y=typeof p=="function"?p(t):p;if(!Object.is(y,t)){const v=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(x=>x(t,v))}},o=()=>t,f={setState:r,getState:o,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(pse?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,o,f);return f},mse=e=>e?QT(e):QT,{useDebugValue:gse}=Ee,{useSyncExternalStoreWithSelector:yse}=eH,vse=e=>e;function II(e,t=vse,n){const r=yse(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gse(r),r}const WT=(e,t)=>{const n=mse(e),r=(o,i=t)=>II(n,o,i);return Object.assign(r,n),r},xse=(e,t)=>e?WT(e,t):WT;function qn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const ly=b.createContext(null),bse=ly.Provider,zI=as.error001("react");function Jt(e,t){const n=b.useContext(ly);if(n===null)throw new Error(zI);return II(n,e,t)}function Pn(){const e=b.useContext(ly);if(e===null)throw new Error(zI);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const JT={display:"none"},wse={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},LI="react-flow__node-desc",$I="react-flow__edge-desc",Sse="react-flow__aria-live",Ese=e=>e.ariaLiveMessage,Cse=e=>e.ariaLabelConfig;function _se({rfId:e}){const t=Jt(Ese);return h.jsx("div",{id:`${Sse}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:wse,children:t})}function Rse({rfId:e,disableKeyboardA11y:t}){const n=Jt(Cse);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${LI}-${e}`,style:JT,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${$I}-${e}`,style:JT,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(_se,{rfId:e})]})}const cy=b.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const l=`${e}`.split("-");return h.jsx("div",{className:cr(["react-flow__panel",n,...l]),style:r,ref:i,...o,children:t})});cy.displayName="Panel";const eO="https://reactflow.dev?utm_source=attribution";function jse({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(cy,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${eO}`,children:h.jsx("a",{href:eO,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nse=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Yp=e=>e.id;function Tse(e,t){return qn(e.selectedNodes.map(Yp),t.selectedNodes.map(Yp))&&qn(e.selectedEdges.map(Yp),t.selectedEdges.map(Yp))}function Ose({onSelectionChange:e}){const t=Pn(),{selectedNodes:n,selectedEdges:r}=Jt(Nse,Tse);return b.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Mse=e=>!!e.onSelectionChangeHandlers;function kse({onSelectionChange:e}){const t=Jt(Mse);return e||t?h.jsx(Ose,{onSelectionChange:e}):null}const FI=[0,0],Ase={x:0,y:0,zoom:1},Dse=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],tO=[...Dse,"rfId"],Pse=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),nO={translateExtent:uf,nodeOrigin:FI,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ise(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:f}=Jt(Pse,qn),d=Pn();b.useEffect(()=>(f(e.defaultNodes,e.defaultEdges),()=>{p.current=nO,c()}),[]);const p=b.useRef(nO);return b.useEffect(()=>{for(const g of tO){const y=e[g],v=p.current[g];y!==v&&(typeof e[g]>"u"||(g==="nodes"?t(y):g==="edges"?n(y):g==="minZoom"?r(y):g==="maxZoom"?o(y):g==="translateExtent"?i(y):g==="nodeExtent"?l(y):g==="ariaLabelConfig"?d.setState({ariaLabelConfig:Roe(y)}):g==="fitView"?d.setState({fitViewQueued:y}):g==="fitViewOptions"?d.setState({fitViewOptions:y}):d.setState({[g]:y})))}p.current=e},tO.map(g=>e[g])),null}function rO(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function zse(e){const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const r=rO(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:rO()?.matches?"dark":"light"}const oO=typeof document<"u"?document:null;function mf(e=null,t={target:oO,actInsideInputWithModifier:!0}){const[n,r]=b.useState(!1),o=b.useRef(!1),i=b.useRef(new Set([])),[l,c]=b.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace(/\+/g,`
|
|
117
|
+
`).replace(`
|
|
118
|
+
|
|
119
|
+
`,`
|
|
120
|
+
+`).split(`
|
|
121
|
+
`)),p=d.reduce((g,y)=>g.concat(...y),[]);return[d,p]}return[[],[]]},[e]);return b.useEffect(()=>{const f=t?.target??oO,d=t?.actInsideInputWithModifier??!0;if(e!==null){const p=v=>{if(o.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!o.current||o.current&&!d)&&xI(v))return!1;const E=iO(v.code,c);if(i.current.add(v[E]),sO(l,i.current,!1)){const S=v.composedPath?.()?.[0]||v.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(o.current||!_)&&v.preventDefault(),r(!0)}},g=v=>{const x=iO(v.code,c);sO(l,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(v[x]),v.key==="Meta"&&i.current.clear(),o.current=!1},y=()=>{i.current.clear(),r(!1)};return f?.addEventListener("keydown",p),f?.addEventListener("keyup",g),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{f?.removeEventListener("keydown",p),f?.removeEventListener("keyup",g),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,r]),n}function sO(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function iO(e,t){return t.includes(e)?"code":"key"}const Lse=()=>{const e=Pn();return b.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:l,panZoom:c}=e.getState(),f=hE(t,r,o,i,l,n?.padding??.1);return c?(await c.setViewport(f,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:l}=e.getState();if(!l)return t;const{x:c,y:f}=l.getBoundingClientRect(),d={x:t.x-c,y:t.y-f},p=n.snapGrid??o,g=n.snapToGrid??i;return Qf(d,r,g,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),l=ou(t,n);return{x:l.x+o,y:l.y+i}}}),[])};function VI(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const l=r.get(i.id);l?l.push(i):r.set(i.id,[i])}for(const i of t){const l=r.get(i.id);if(!l){n.push(i);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const c={...i};for(const f of l)$se(f,c);n.push(c)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function $se(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function UI(e,t){return VI(e,t)}function HI(e,t){return VI(e,t)}function Ja(e,t){return{id:e,type:"select",selected:t}}function Pc(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const l=t.has(o);!(i.selected===void 0&&!l)&&i.selected!==l&&(n&&(i.selected=l),r.push(Ja(i.id,l)))}return r}function aO({items:e=[],lookup:t}){const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,i]of e.entries()){const l=t.get(i.id),c=l?.internals?.userNode??l;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function lO(e){return{id:e.id,type:"remove"}}const Fse=mI();function BI(e,t,n={}){return koe(e,t,{...n,onError:n.onError??Fse})}const cO=e=>yoe(e),Vse=e=>uI(e);function qI(e){return b.forwardRef(e)}const YI=typeof window<"u"?b.useLayoutEffect:b.useEffect;function uO(e){const[t,n]=b.useState(BigInt(0)),[r]=b.useState(()=>Use(()=>n(o=>o+BigInt(1))));return YI(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Use(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const ZI=b.createContext(null);function Hse({children:e}){const t=Pn(),n=b.useCallback(c=>{const{nodes:f=[],setNodes:d,hasDefaultNodes:p,onNodesChange:g,nodeLookup:y,fitViewQueued:v,onNodesChangeMiddlewareMap:x}=t.getState();let E=f;for(const _ of c)E=typeof _=="function"?_(E):_;let S=aO({items:E,lookup:y});for(const _ of x.values())S=_(S);p&&d(E),S.length>0?g?.(S):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:j,setNodes:R}=t.getState();_&&R(j)})},[]),r=uO(n),o=b.useCallback(c=>{const{edges:f=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:g,edgeLookup:y}=t.getState();let v=f;for(const x of c)v=typeof x=="function"?x(v):x;p?d(v):g&&g(aO({items:v,lookup:y}))},[]),i=uO(o),l=b.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return h.jsx(ZI.Provider,{value:l,children:e})}function Bse(){const e=b.useContext(ZI);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const qse=e=>!!e.panZoom;function bE(){const e=Lse(),t=Pn(),n=Bse(),r=Jt(qse),o=b.useMemo(()=>{const i=g=>t.getState().nodeLookup.get(g),l=g=>{n.nodeQueue.push(g)},c=g=>{n.edgeQueue.push(g)},f=g=>{const{nodeLookup:y,nodeOrigin:v}=t.getState(),x=cO(g)?g:y.get(g.id),E=x.parentId?yI(x.position,x.measured,x.parentId,y,v):x.position,S={...x,position:E,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return hf(S)},d=(g,y,v={replace:!1})=>{l(x=>x.map(E=>{if(E.id===g){const S=typeof y=="function"?y(E):y;return v.replace&&cO(S)?S:{...E,...S}}return E}))},p=(g,y,v={replace:!1})=>{c(x=>x.map(E=>{if(E.id===g){const S=typeof y=="function"?y(E):y;return v.replace&&Vse(S)?S:{...E,...S}}return E}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>i(g)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(y=>({...y}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:l,setEdges:c,addNodes:g=>{const y=Array.isArray(g)?g:[g];n.nodeQueue.push(v=>[...v,...y])},addEdges:g=>{const y=Array.isArray(g)?g:[g];n.edgeQueue.push(v=>[...v,...y])},toObject:()=>{const{nodes:g=[],edges:y=[],transform:v}=t.getState(),[x,E,S]=v;return{nodes:g.map(_=>({..._})),edges:y.map(_=>({..._})),viewport:{x,y:E,zoom:S}}},deleteElements:async({nodes:g=[],edges:y=[]})=>{const{nodes:v,edges:x,onNodesDelete:E,onEdgesDelete:S,triggerNodeChanges:_,triggerEdgeChanges:j,onDelete:R,onBeforeDelete:N}=t.getState(),{nodes:O,edges:k}=await Soe({nodesToRemove:g,edgesToRemove:y,nodes:v,edges:x,onBeforeDelete:N}),M=k.length>0,T=O.length>0;if(M){const L=k.map(lO);S?.(k),j(L)}if(T){const L=O.map(lO);E?.(O),_(L)}return(T||M)&&R?.({nodes:O,edges:k}),{deletedNodes:O,deletedEdges:k}},getIntersectingNodes:(g,y=!0,v)=>{const x=LT(g),E=x?g:f(g),S=v!==void 0;return E?(v||t.getState().nodes).filter(_=>{const j=t.getState().nodeLookup.get(_.id);if(j&&!x&&(_.id===g.id||!j.internals.positionAbsolute))return!1;const R=hf(S?_:j),N=Wm(R,E);return y&&N>0||N>=R.width*R.height||N>=E.width*E.height}):[]},isNodeIntersecting:(g,y,v=!0)=>{const E=LT(g)?g:f(g);if(!E)return!1;const S=Wm(E,y);return v&&S>0||S>=y.width*y.height||S>=E.width*E.height},updateNode:d,updateNodeData:(g,y,v={replace:!1})=>{d(g,x=>{const E=typeof y=="function"?y(x):y;return v.replace?{...x,data:E}:{...x,data:{...x.data,...E}}},v)},updateEdge:p,updateEdgeData:(g,y,v={replace:!1})=>{p(g,x=>{const E=typeof y=="function"?y(x):y;return v.replace?{...x,data:E}:{...x,data:{...x.data,...E}}},v)},getNodesBounds:g=>{const{nodeLookup:y,nodeOrigin:v}=t.getState();return voe(g,{nodeLookup:y,nodeOrigin:v})},getHandleConnections:({type:g,id:y,nodeId:v})=>Array.from(t.getState().connectionLookup.get(`${v}-${g}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:y,nodeId:v})=>Array.from(t.getState().connectionLookup.get(`${v}${g?y?`-${g}-${y}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const y=t.getState().fitViewResolver??_oe();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:y}),n.nodeQueue.push(v=>[...v]),y.promise}}},[]);return b.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const dO=e=>e.selected,Yse=typeof window<"u"?window:void 0;function Zse({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Pn(),{deleteElements:r}=bE(),o=mf(e,{actInsideInputWithModifier:!1}),i=mf(t,{target:Yse});b.useEffect(()=>{if(o){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(dO),edges:l.filter(dO)}),n.setState({nodesSelectionActive:!1})}},[o]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Gse(e){const t=Pn();b.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=pE(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",as.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const uy={position:"absolute",width:"100%",height:"100%",top:0,left:0},Kse=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Xse({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:o,panOnScrollSpeed:i=.5,panOnScrollMode:l=sl.Free,zoomOnDoubleClick:c=!0,panOnDrag:f=!0,defaultViewport:d,translateExtent:p,minZoom:g,maxZoom:y,zoomActivationKeyCode:v,preventScrolling:x=!0,children:E,noWheelClassName:S,noPanClassName:_,onViewportChange:j,isControlledViewport:R,paneClickDistance:N,selectionOnDrag:O}){const k=Pn(),M=b.useRef(null),{userSelectionActive:T,lib:L,connectionInProgress:G}=Jt(Kse,qn),B=mf(v),V=b.useRef();Gse(M);const q=b.useCallback(I=>{j?.({x:I[0],y:I[1],zoom:I[2]}),R||k.setState({transform:I})},[j,R]);return b.useEffect(()=>{if(M.current){V.current=lse({domNode:M.current,minZoom:g,maxZoom:y,translateExtent:p,viewport:d,onDraggingChange:P=>k.setState(U=>U.paneDragging===P?U:{paneDragging:P}),onPanZoomStart:(P,U)=>{const{onViewportChangeStart:H,onMoveStart:Y}=k.getState();Y?.(P,U),H?.(U)},onPanZoom:(P,U)=>{const{onViewportChange:H,onMove:Y}=k.getState();Y?.(P,U),H?.(U)},onPanZoomEnd:(P,U)=>{const{onViewportChangeEnd:H,onMoveEnd:Y}=k.getState();Y?.(P,U),H?.(U)}});const{x:I,y:z,zoom:A}=V.current.getViewport();return k.setState({panZoom:V.current,transform:[I,z,A],domNode:M.current.closest(".react-flow")}),()=>{V.current?.destroy()}}},[]),b.useEffect(()=>{V.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:o,panOnScrollSpeed:i,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:f,zoomActivationKeyPressed:B,preventScrolling:x,noPanClassName:_,userSelectionActive:T,noWheelClassName:S,lib:L,onTransformChange:q,connectionInProgress:G,selectionOnDrag:O,paneClickDistance:N})},[e,t,n,r,o,i,l,c,f,B,x,_,T,S,L,q,G,O,N]),h.jsx("div",{className:"react-flow__renderer",ref:M,style:uy,children:E})}const Qse=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Wse(){const{userSelectionActive:e,userSelectionRect:t}=Jt(Qse,qn);return e&&t?h.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const fb=(e,t)=>n=>{n.target===t.current&&e?.(n)},Jse=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function eie({isSelecting:e,selectionKeyPressed:t,selectionMode:n=df.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:f,onPaneClick:d,onPaneContextMenu:p,onPaneScroll:g,onPaneMouseEnter:y,onPaneMouseMove:v,onPaneMouseLeave:x,children:E}){const S=b.useRef(0),_=Pn(),{userSelectionActive:j,elementsSelectable:R,dragging:N,panBy:O,autoPanSpeed:k}=Jt(Jse,qn),M=R&&(e||j),T=b.useRef(null),L=b.useRef(),G=b.useRef(new Set),B=b.useRef(new Set),V=b.useRef(!1),q=b.useRef(!1),I=b.useRef({x:0,y:0}),z=b.useRef(!1),A=K=>{if(q.current||V.current||_.getState().connection.inProgress){q.current=!1,V.current=!1;return}d?.(K),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},P=K=>{if(Array.isArray(r)&&r?.includes(2)){K.preventDefault();return}p?.(K)},U=g?K=>g(K):void 0,H=K=>{q.current&&(K.stopPropagation(),q.current=!1)},Y=K=>{if(K.pointerType==="touch"&&r!==!1&&!t)return;const{domNode:re,transform:ye}=_.getState();if(L.current=re?.getBoundingClientRect(),!L.current)return;const fe=K.target===T.current;if(!fe&&!!K.target.closest(".nokey")||!e||!(l&&fe||t)||K.button!==0||!K.isPrimary)return;K.target?.setPointerCapture?.(K.pointerId),q.current=!1;const{x:Re,y:ze}=ss(K.nativeEvent,L.current),Ue=Qf({x:Re,y:ze},ye);_.setState({userSelectionRect:{width:0,height:0,startX:Ue.x,startY:Ue.y,x:Re,y:ze}}),fe||(K.stopPropagation(),K.preventDefault())};function $(K,re){const{userSelectionRect:ye}=_.getState();if(!ye)return;const{transform:fe,nodeLookup:ue,edgeLookup:he,connectionLookup:Re,triggerNodeChanges:ze,triggerEdgeChanges:Ue,defaultEdgeOptions:Ae}=_.getState(),Qe={x:ye.startX,y:ye.startY},{x:De,y:Le}=ou(Qe,fe),Fe={startX:Qe.x,startY:Qe.y,x:K<De?K:De,y:re<Le?re:Le,width:Math.abs(K-De),height:Math.abs(re-Le)},Ye=G.current,et=B.current;G.current=new Set(dE(ue,Fe,fe,n===df.Partial,!0).map(xe=>xe.id)),B.current=new Set;const me=Ae?.selectable??!0;for(const xe of G.current){const We=Re.get(xe);if(We)for(const{edgeId:Oe}of We.values()){const Ie=he.get(Oe);Ie&&(Ie.selectable??me)&&B.current.add(Oe)}}if(!$T(Ye,G.current)){const xe=Pc(ue,G.current,!0);ze(xe)}if(!$T(et,B.current)){const xe=Pc(he,B.current);Ue(xe)}_.setState({userSelectionRect:Fe,userSelectionActive:!0,nodesSelectionActive:!1})}function F(){if(!o||!L.current)return;const[K,re]=fE(I.current,L.current,k);O({x:K,y:re}).then(ye=>{if(!q.current||!ye){S.current=requestAnimationFrame(F);return}const{x:fe,y:ue}=I.current;$(fe,ue),S.current=requestAnimationFrame(F)})}const Q=()=>{cancelAnimationFrame(S.current),S.current=0,z.current=!1};b.useEffect(()=>()=>Q(),[]);const X=K=>{const{userSelectionRect:re,transform:ye,resetSelectedElements:fe}=_.getState();if(!L.current||!re)return;const{x:ue,y:he}=ss(K.nativeEvent,L.current);I.current={x:ue,y:he};const Re=ou({x:re.startX,y:re.startY},ye);if(!q.current){const ze=t?0:i;if(Math.hypot(ue-Re.x,he-Re.y)<=ze)return;fe(),c?.(K)}q.current=!0,z.current||(F(),z.current=!0),$(ue,he)},ne=K=>{if(!M){K.target===T.current&&_.getState().connection.inProgress&&(V.current=!0);return}K.button===0&&(K.target?.releasePointerCapture?.(K.pointerId),!j&&K.target===T.current&&_.getState().userSelectionRect&&A?.(K),_.setState({userSelectionActive:!1,userSelectionRect:null}),q.current&&(f?.(K),_.setState({nodesSelectionActive:G.current.size>0})),Q())},te=K=>{K.target?.releasePointerCapture?.(K.pointerId),Q()},J=r===!0||Array.isArray(r)&&r.includes(0);return h.jsxs("div",{className:cr(["react-flow__pane",{draggable:J,dragging:N,selection:e}]),onClick:M?void 0:fb(A,T),onContextMenu:fb(P,T),onWheel:fb(U,T),onPointerEnter:M?void 0:y,onPointerMove:M?X:v,onPointerUp:ne,onPointerCancel:M?te:void 0,onPointerDownCapture:M?Y:void 0,onClickCapture:M?H:void 0,onPointerLeave:x,ref:T,style:uy,children:[E,h.jsx(Wse,{})]})}function L0({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:l,nodeLookup:c,onError:f}=t.getState(),d=c.get(e);if(!d){f?.("012",as.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&l)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])}function GI({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:l}){const c=Pn(),[f,d]=b.useState(!1),p=b.useRef();return b.useEffect(()=>{if(!t)return p.current=Goe({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{L0({id:g,store:c,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{p.current?.destroy(),p.current=void 0}},[t,c,e]),b.useEffect(()=>{t||!e.current||!p.current||p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:l})},[n,r,t,i,e,o,l]),f}const tie=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function KI(){const e=Pn();return b.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:l,onError:c,updateNodePositions:f,nodeLookup:d,nodeOrigin:p}=e.getState(),g=new Map,y=tie(l),v=o?i[0]:5,x=o?i[1]:5,E=n.direction.x*v*n.factor,S=n.direction.y*x*n.factor;for(const[,_]of d){if(!y(_))continue;let j={x:_.internals.positionAbsolute.x+E,y:_.internals.positionAbsolute.y+S};o&&(j=Xf(j,i));const{position:R,positionAbsolute:N}=dI({nodeId:_.id,nextPosition:j,nodeLookup:d,nodeExtent:r,nodeOrigin:p,onError:c});_.position=R,_.internals.positionAbsolute=N,g.set(_.id,_)}f(g)},[])}const wE=b.createContext(null),nie=wE.Provider;wE.Consumer;const XI=()=>b.useContext(wE),rie=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),QI=b.createContext(null);function oie({children:e}){const t=Jt(rie,qn);return h.jsx(QI.Provider,{value:t,children:e})}function sie(){const e=b.useContext(QI);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const iie={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},aie=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:l}=r,{fromHandle:c,toHandle:f,isValid:d}=l;if(!c&&!o)return iie;const p=f?.nodeId===e&&f?.id===t&&f?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:p,clickConnecting:o?.nodeId===e&&o?.id===t&&o?.type===n,isPossibleEndHandle:i===nu.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:p&&d}};function lie({type:e="source",position:t=ft.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:l,onConnect:c,children:f,className:d,onMouseDown:p,onTouchStart:g,...y},v){const x=l||null,E=e==="target",S=Pn(),_=XI(),{connectOnClick:j,noPanClassName:R,rfId:N}=sie(),{connectingFrom:O,connectingTo:k,clickConnecting:M,isPossibleEndHandle:T,connectionInProcess:L,clickConnectionInProcess:G,valid:B}=Jt(aie(_,x,e),qn);_||S.getState().onError?.("010",as.error010());const V=z=>{const{defaultEdgeOptions:A,onConnect:P,hasDefaultEdges:U}=S.getState(),H={...A,...z};if(U){const{edges:Y,setEdges:$,onError:F}=S.getState();$(BI(H,Y,{onError:F}))}P?.(H),c?.(H)},q=z=>{if(!_)return;const A=bI(z.nativeEvent);if(o&&(A&&z.button===0||!A)){const P=S.getState();z0.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:E,handleId:x,nodeId:_,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:(...U)=>S.getState().onConnectEnd?.(...U),updateConnection:P.updateConnection,onConnect:V,isValidConnection:n||((...U)=>S.getState().isValidConnection?.(...U)??!0),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed,dragThreshold:P.connectionDragThreshold})}A?p?.(z):g?.(z)},I=z=>{const{onClickConnectStart:A,onClickConnectEnd:P,connectionClickStartHandle:U,connectionMode:H,isValidConnection:Y,lib:$,rfId:F,nodeLookup:Q,connection:X}=S.getState();if(!_||!U&&!o)return;if(!U){A?.(z.nativeEvent,{nodeId:_,handleId:x,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,id:x}});return}const ne=vI(z.target),te=n||Y,{connection:J,isValid:K}=z0.isValid(z.nativeEvent,{handle:{nodeId:_,id:x,type:e},connectionMode:H,fromNodeId:U.nodeId,fromHandleId:U.id||null,fromType:U.type,isValidConnection:te,flowId:F,doc:ne,lib:$,nodeLookup:Q});K&&J&&V(J);const re=structuredClone(X);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,P?.(z,re),S.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":x,"data-nodeid":_,"data-handlepos":t,"data-id":`${N}-${_}-${x}-${e}`,className:cr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",R,d,{source:!E,target:E,connectable:r,connectablestart:o,connectableend:i,clickconnecting:M,connectingfrom:O,connectingto:k,valid:B,connectionindicator:r&&(!L||T)&&(L||G?i:o)}]),onMouseDown:q,onTouchStart:q,onClick:j?I:void 0,ref:v,...y,children:f})}const iu=b.memo(qI(lie));function cie({data:e,isConnectable:t,sourcePosition:n=ft.Bottom}){return h.jsxs(h.Fragment,{children:[e?.label,h.jsx(iu,{type:"source",position:n,isConnectable:t})]})}function uie({data:e,isConnectable:t,targetPosition:n=ft.Top,sourcePosition:r=ft.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(iu,{type:"target",position:n,isConnectable:t}),e?.label,h.jsx(iu,{type:"source",position:r,isConnectable:t})]})}function die(){return null}function fie({data:e,isConnectable:t,targetPosition:n=ft.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(iu,{type:"target",position:n,isConnectable:t}),e?.label]})}const eg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},fO={input:cie,default:uie,output:fie,group:die};function hie(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const pie=e=>{const{width:t,height:n,x:r,y:o}=Kf(e.nodeLookup,{filter:i=>!!i.selected});return{width:os(t)?t:null,height:os(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function mie({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Pn(),{width:o,height:i,transformString:l,userSelectionActive:c}=Jt(pie,qn),f=KI(),d=b.useRef(null);b.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]);const p=!c&&o!==null&&i!==null;if(GI({nodeRef:d,disabled:!p}),!p)return null;const g=e?v=>{const x=r.getState().nodes.filter(E=>E.selected);e(v,x)}:void 0,y=v=>{Object.prototype.hasOwnProperty.call(eg,v.key)&&(v.preventDefault(),f({direction:eg[v.key],factor:v.shiftKey?4:1}))};return h.jsx("div",{className:cr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:h.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:o,height:i}})})}const hO=typeof window<"u"?window:void 0,gie=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function WI({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:f,selectionKeyCode:d,selectionOnDrag:p,selectionMode:g,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:E,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:j,zoomOnPinch:R,panOnScroll:N,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:T,autoPanOnSelection:L,defaultViewport:G,translateExtent:B,minZoom:V,maxZoom:q,preventScrolling:I,onSelectionContextMenu:z,noWheelClassName:A,noPanClassName:P,disableKeyboardA11y:U,onViewportChange:H,isControlledViewport:Y}){const{nodesSelectionActive:$,userSelectionActive:F}=Jt(gie,qn),Q=mf(d,{target:hO}),X=mf(E,{target:hO}),ne=X||T,te=X||N,J=p&&ne!==!0,K=Q||F||J;return Zse({deleteKeyCode:f,multiSelectionKeyCode:x}),h.jsx(Xse,{onPaneContextMenu:i,elementsSelectable:_,zoomOnScroll:j,zoomOnPinch:R,panOnScroll:te,panActivationKeyPressed:X,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:!Q&&ne,defaultViewport:G,translateExtent:B,minZoom:V,maxZoom:q,zoomActivationKeyCode:S,preventScrolling:I,noWheelClassName:A,noPanClassName:P,onViewportChange:H,isControlledViewport:Y,paneClickDistance:c,selectionOnDrag:J,children:h.jsxs(eie,{onSelectionStart:y,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:ne,autoPanOnSelection:L,isSelecting:!!K,selectionMode:g,selectionKeyPressed:Q,paneClickDistance:c,selectionOnDrag:J,children:[e,$&&h.jsx(mie,{onSelectionContextMenu:z,noPanClassName:P,disableKeyboardA11y:U})]})})}WI.displayName="FlowRenderer";const yie=b.memo(WI),vie=e=>t=>e?dE(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function xie(e){return Jt(b.useCallback(vie(e),[e]),qn)}const bie=e=>e.updateNodeInternals;function wie(){const e=Jt(bie),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return b.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Sie({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=Pn(),i=b.useRef(null),l=b.useRef(null),c=b.useRef(e.sourcePosition),f=b.useRef(e.targetPosition),d=b.useRef(t),p=n&&!!e.internals.handleBounds;return b.useEffect(()=>{i.current&&!e.hidden&&(!p||l.current!==i.current)&&(l.current&&r?.unobserve(l.current),r?.observe(i.current),l.current=i.current)},[p,e.hidden]),b.useEffect(()=>()=>{l.current&&(r?.unobserve(l.current),l.current=null)},[]),b.useEffect(()=>{if(i.current){const g=d.current!==t,y=c.current!==e.sourcePosition,v=f.current!==e.targetPosition;(g||y||v)&&(d.current=t,c.current=e.sourcePosition,f.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Eie({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:l,nodesDraggable:c,elementsSelectable:f,nodesConnectable:d,nodesFocusable:p,resizeObserver:g,noDragClassName:y,noPanClassName:v,disableKeyboardA11y:x,rfId:E,nodeTypes:S,nodeClickDistance:_,onError:j}){const{node:R,internals:N,isParent:O}=Jt(K=>{const re=K.nodeLookup.get(e),ye=K.parentLookup.has(e);return{node:re,internals:re.internals,isParent:ye}},qn);let k=R.type||"default",M=S?.[k]||fO[k];M===void 0&&(j?.("003",as.error003(k)),k="default",M=S?.default||fO.default);const T=!!(R.draggable||c&&typeof R.draggable>"u"),L=!!(R.selectable||f&&typeof R.selectable>"u"),G=!!(R.connectable||d&&typeof R.connectable>"u"),B=!!(R.focusable||p&&typeof R.focusable>"u"),V=Pn(),q=gI(R),I=Sie({node:R,nodeType:k,hasDimensions:q,resizeObserver:g}),z=GI({nodeRef:I,disabled:R.hidden||!T,noDragClassName:y,handleSelector:R.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:_}),A=KI();if(R.hidden)return null;const P=ys(R),U=hie(R),H=L||T||t||n||r||o,Y=n?K=>n(K,{...N.userNode}):void 0,$=r?K=>r(K,{...N.userNode}):void 0,F=o?K=>o(K,{...N.userNode}):void 0,Q=i?K=>i(K,{...N.userNode}):void 0,X=l?K=>l(K,{...N.userNode}):void 0,ne=K=>{const{selectNodesOnDrag:re,nodeDragThreshold:ye}=V.getState();L&&(!re||!T||ye>0)&&L0({id:e,store:V,nodeRef:I}),t&&t(K,{...N.userNode})},te=K=>{if(!(xI(K.nativeEvent)||x)){if(iI.includes(K.key)&&L){const re=K.key==="Escape";L0({id:e,store:V,unselect:re,nodeRef:I})}else if(T&&R.selected&&Object.prototype.hasOwnProperty.call(eg,K.key)){K.preventDefault();const{ariaLabelConfig:re}=V.getState();V.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),A({direction:eg[K.key],factor:K.shiftKey?4:1})}}},J=()=>{if(x||!I.current?.matches(":focus-visible"))return;const{transform:K,width:re,height:ye,autoPanOnNodeFocus:fe,setCenter:ue}=V.getState();if(!fe)return;dE(new Map([[e,R]]),{x:0,y:0,width:re,height:ye},K,!0).length>0||ue(R.position.x+P.width/2,R.position.y+P.height/2,{zoom:K[2]})};return h.jsx("div",{className:cr(["react-flow__node",`react-flow__node-${k}`,{[v]:T},R.className,{selected:R.selected,selectable:L,parent:O,draggable:T,dragging:z}]),ref:I,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:H?"all":"none",visibility:q?"visible":"hidden",...R.style,...U},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:$,onMouseLeave:F,onContextMenu:Q,onClick:ne,onDoubleClick:X,onKeyDown:B?te:void 0,tabIndex:B?0:void 0,onFocus:B?J:void 0,role:R.ariaRole??(B?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${LI}-${E}`,"aria-label":R.ariaLabel,...R.domAttributes,children:h.jsx(nie,{value:e,children:h.jsx(M,{id:e,data:R.data,type:k,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:R.selected??!1,selectable:L,draggable:T,deletable:R.deletable??!0,isConnectable:G,sourcePosition:R.sourcePosition,targetPosition:R.targetPosition,dragging:z,dragHandle:R.dragHandle,zIndex:N.z,parentId:R.parentId,...P})})})}var Cie=b.memo(Eie);const _ie=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function JI(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:o}=Jt(_ie,qn),i=xie(e.onlyRenderVisibleElements),l=wie();return h.jsx("div",{className:"react-flow__nodes",style:uy,children:i.map(c=>h.jsx(Cie,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:o},c))})}JI.displayName="NodeRenderer";const Rie=b.memo(JI);function jie(e){return Jt(b.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),l=n.nodeLookup.get(o.target);i&&l&&Toe({sourceNode:i,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),qn)}const Nie=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return h.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Tie=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return h.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},pO={[ff.Arrow]:Nie,[ff.ArrowClosed]:Tie};function Oie(e){const t=Pn();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(pO,e)?pO[e]:(t.getState().onError?.("009",as.error009(e)),null),[e])}const Mie=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const f=Oie(t);return f?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:h.jsx(f,{color:n,strokeWidth:l})}):null},ez=({defaultColor:e,rfId:t})=>{const n=Jt(i=>i.edges),r=Jt(i=>i.defaultEdgeOptions),o=b.useMemo(()=>zoe(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?h.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:h.jsx("defs",{children:o.map(i=>h.jsx(Mie,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};ez.displayName="MarkerDefinitions";var kie=b.memo(ez);function tz({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:f,className:d,...p}){const[g,y]=b.useState({x:1,y:0,width:0,height:0}),v=cr(["react-flow__edge-textwrapper",d]),x=b.useRef(null);return b.useEffect(()=>{if(x.current){const E=x.current.getBBox();y({x:E.x,y:E.y,width:E.width,height:E.height})}},[n]),n?h.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:v,visibility:g.width?"visible":"hidden",...p,children:[o&&h.jsx("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),h.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:x,style:r,children:n}),f]}):null}tz.displayName="EdgeText";const Aie=b.memo(tz);function au({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,interactionWidth:d=20,...p}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...p,d:e,fill:"none",className:cr(["react-flow__edge-path",p.className])}),d?h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&os(t)&&os(n)?h.jsx(Aie,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f}):null]})}function mO({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===ft.Left||e===ft.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function nz({sourceX:e,sourceY:t,sourcePosition:n=ft.Bottom,targetX:r,targetY:o,targetPosition:i=ft.Top}){const[l,c]=mO({pos:n,x1:e,y1:t,x2:r,y2:o}),[f,d]=mO({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,g,y,v]=wI({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:f,targetControlY:d});return[`M${e},${t} C${l},${c} ${f},${d} ${r},${o}`,p,g,y,v]}function rz(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l,targetPosition:c,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:v,style:x,markerEnd:E,markerStart:S,interactionWidth:_})=>{const[j,R,N]=nz({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c}),O=e.isInternal?void 0:t;return h.jsx(au,{id:O,path:j,labelX:R,labelY:N,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:v,style:x,markerEnd:E,markerStart:S,interactionWidth:_})})}const Die=rz({isInternal:!1}),oz=rz({isInternal:!0});Die.displayName="SimpleBezierEdge";oz.displayName="SimpleBezierEdgeInternal";function sz(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:y,sourcePosition:v=ft.Bottom,targetPosition:x=ft.Top,markerEnd:E,markerStart:S,pathOptions:_,interactionWidth:j})=>{const[R,N,O]=Jm({sourceX:n,sourceY:r,sourcePosition:v,targetX:o,targetY:i,targetPosition:x,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),k=e.isInternal?void 0:t;return h.jsx(au,{id:k,path:R,labelX:N,labelY:O,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:y,markerEnd:E,markerStart:S,interactionWidth:j})})}const iz=sz({isInternal:!1}),az=sz({isInternal:!0});iz.displayName="SmoothStepEdge";az.displayName="SmoothStepEdgeInternal";function lz(e){return b.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return h.jsx(iz,{...n,id:r,pathOptions:b.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Pie=lz({isInternal:!1}),cz=lz({isInternal:!0});Pie.displayName="StepEdge";cz.displayName="StepEdgeInternal";function uz(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:x,interactionWidth:E})=>{const[S,_,j]=CI({sourceX:n,sourceY:r,targetX:o,targetY:i}),R=e.isInternal?void 0:t;return h.jsx(au,{id:R,path:S,labelX:_,labelY:j,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:x,interactionWidth:E})})}const Iie=uz({isInternal:!1}),dz=uz({isInternal:!0});Iie.displayName="StraightEdge";dz.displayName="StraightEdgeInternal";function fz(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l=ft.Bottom,targetPosition:c=ft.Top,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:v,style:x,markerEnd:E,markerStart:S,pathOptions:_,interactionWidth:j})=>{const[R,N,O]=SI({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c,curvature:_?.curvature}),k=e.isInternal?void 0:t;return h.jsx(au,{id:k,path:R,labelX:N,labelY:O,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:v,style:x,markerEnd:E,markerStart:S,interactionWidth:j})})}const zie=fz({isInternal:!1}),hz=fz({isInternal:!0});zie.displayName="BezierEdge";hz.displayName="BezierEdgeInternal";const gO={default:hz,straight:dz,step:cz,smoothstep:az,simplebezier:oz},yO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Lie=(e,t,n)=>n===ft.Left?e-t:n===ft.Right?e+t:e,$ie=(e,t,n)=>n===ft.Top?e-t:n===ft.Bottom?e+t:e,vO="react-flow__edgeupdater";function xO({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:l,type:c}){return h.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:l,className:cr([vO,`${vO}-${c}`]),cx:Lie(t,r,e),cy:$ie(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Fie({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:l,sourcePosition:c,targetPosition:f,onReconnect:d,onReconnectStart:p,onReconnectEnd:g,setReconnecting:y,setUpdateHover:v}){const x=Pn(),E=(N,O)=>{if(N.button!==0)return;const{autoPanOnConnect:k,domNode:M,connectionMode:T,connectionRadius:L,lib:G,onConnectStart:B,cancelConnection:V,nodeLookup:q,rfId:I,panBy:z,updateConnection:A}=x.getState(),P=O.type==="target",U=($,F)=>{y(!1),g?.($,n,O.type,F)},H=$=>d?.(n,$),Y=($,F)=>{y(!0),p?.(N,n,O.type),B?.($,F)};z0.onPointerDown(N.nativeEvent,{autoPanOnConnect:k,connectionMode:T,connectionRadius:L,domNode:M,handleId:O.id,nodeId:O.nodeId,nodeLookup:q,isTarget:P,edgeUpdaterType:O.type,lib:G,flowId:I,cancelConnection:V,panBy:z,isValidConnection:(...$)=>x.getState().isValidConnection?.(...$)??!0,onConnect:H,onConnectStart:Y,onConnectEnd:(...$)=>x.getState().onConnectEnd?.(...$),onReconnectEnd:U,updateConnection:A,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},S=N=>E(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),_=N=>E(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),j=()=>v(!0),R=()=>v(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(xO,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:S,onMouseEnter:j,onMouseOut:R,type:"source"}),(e===!0||e==="target")&&h.jsx(xO,{position:f,centerX:i,centerY:l,radius:t,onMouseDown:_,onMouseEnter:j,onMouseOut:R,type:"target"})]})}function Vie({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:d,reconnectRadius:p,onReconnect:g,onReconnectStart:y,onReconnectEnd:v,rfId:x,edgeTypes:E,noPanClassName:S,onError:_,disableKeyboardA11y:j}){let R=Jt(ue=>ue.edgeLookup.get(e));const N=Jt(ue=>ue.defaultEdgeOptions);R=N?{...N,...R}:R;let O=R.type||"default",k=E?.[O]||gO[O];k===void 0&&(_?.("011",as.error011(O)),O="default",k=E?.default||gO.default);const M=!!(R.focusable||t&&typeof R.focusable>"u"),T=typeof g<"u"&&(R.reconnectable||n&&typeof R.reconnectable>"u"),L=!!(R.selectable||r&&typeof R.selectable>"u"),G=b.useRef(null),[B,V]=b.useState(!1),[q,I]=b.useState(!1),z=Pn(),{zIndex:A=R.zIndex,sourceX:P,sourceY:U,targetX:H,targetY:Y,sourcePosition:$,targetPosition:F}=Jt(b.useCallback(ue=>{const he=ue.nodeLookup.get(R.source),Re=ue.nodeLookup.get(R.target);if(!he||!Re)return yO;const ze=Ioe({id:e,sourceNode:he,targetNode:Re,sourceHandle:R.sourceHandle||null,targetHandle:R.targetHandle||null,connectionMode:ue.connectionMode,onError:_}),Ue=Noe({selected:R.selected,zIndex:R.zIndex,sourceNode:he,targetNode:Re,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode});return{...ze||yO,zIndex:Ue}},[R.source,R.target,R.sourceHandle,R.targetHandle,R.selected,R.zIndex,_]),qn),Q=b.useMemo(()=>R.markerStart?`url('#${P0(R.markerStart,x)}')`:void 0,[R.markerStart,x]),X=b.useMemo(()=>R.markerEnd?`url('#${P0(R.markerEnd,x)}')`:void 0,[R.markerEnd,x]);if(R.hidden||P===null||U===null||H===null||Y===null)return null;const ne=ue=>{const{addSelectedEdges:he,unselectNodesAndEdges:Re,multiSelectionActive:ze}=z.getState();L&&(z.setState({nodesSelectionActive:!1}),R.selected&&ze?(Re({nodes:[],edges:[R]}),G.current?.blur()):he([e])),o&&o(ue,R)},te=i?ue=>{i(ue,{...R})}:void 0,J=l?ue=>{l(ue,{...R})}:void 0,K=c?ue=>{c(ue,{...R})}:void 0,re=f?ue=>{f(ue,{...R})}:void 0,ye=d?ue=>{d(ue,{...R})}:void 0,fe=ue=>{if(!j&&iI.includes(ue.key)&&L){const{unselectNodesAndEdges:he,addSelectedEdges:Re}=z.getState();ue.key==="Escape"?(G.current?.blur(),he({edges:[R]})):Re([e])}};return h.jsx("svg",{style:{zIndex:A},children:h.jsxs("g",{className:cr(["react-flow__edge",`react-flow__edge-${O}`,R.className,S,{selected:R.selected,animated:R.animated,inactive:!L&&!o,updating:B,selectable:L}]),onClick:ne,onDoubleClick:te,onContextMenu:J,onMouseEnter:K,onMouseMove:re,onMouseLeave:ye,onKeyDown:M?fe:void 0,tabIndex:M?0:void 0,role:R.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":R.ariaLabel===null?void 0:R.ariaLabel||`Edge from ${R.source} to ${R.target}`,"aria-describedby":M?`${$I}-${x}`:void 0,ref:G,...R.domAttributes,children:[!q&&h.jsx(k,{id:e,source:R.source,target:R.target,type:R.type,selected:R.selected,animated:R.animated,selectable:L,deletable:R.deletable??!0,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,sourceX:P,sourceY:U,targetX:H,targetY:Y,sourcePosition:$,targetPosition:F,data:R.data,style:R.style,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerStart:Q,markerEnd:X,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth}),T&&h.jsx(Fie,{edge:R,isReconnectable:T,reconnectRadius:p,onReconnect:g,onReconnectStart:y,onReconnectEnd:v,sourceX:P,sourceY:U,targetX:H,targetY:Y,sourcePosition:$,targetPosition:F,setUpdateHover:V,setReconnecting:I})]})})}var Uie=b.memo(Vie);const Hie=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function pz({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:g,onEdgeDoubleClick:y,onReconnectStart:v,onReconnectEnd:x,disableKeyboardA11y:E}){const{edgesFocusable:S,edgesReconnectable:_,elementsSelectable:j,onError:R}=Jt(Hie,qn),N=jie(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(kie,{defaultColor:e,rfId:n}),N.map(O=>h.jsx(Uie,{id:O,edgesFocusable:S,edgesReconnectable:_,elementsSelectable:j,noPanClassName:o,onReconnect:i,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:d,onClick:p,reconnectRadius:g,onDoubleClick:y,onReconnectStart:v,onReconnectEnd:x,rfId:n,onError:R,edgeTypes:r,disableKeyboardA11y:E},O))]})}pz.displayName="EdgeRenderer";const Bie=b.memo(pz),bO=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function qie({children:e}){const t=Pn(),n=b.useRef(null),[r]=b.useState(()=>t.getState().transform);return YI(()=>{let o=null;const i=()=>{const l=t.getState().transform;o&&l[0]===o[0]&&l[1]===o[1]&&l[2]===o[2]||(o=l,n.current&&(n.current.style.transform=bO(l)))};return i(),t.subscribe(i)},[t]),h.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:bO(r)},children:e})}function Yie(e){const t=bE(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Zie=e=>e.panZoom?.syncViewport;function Gie(e){const t=Jt(Zie),n=Pn();return b.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Kie(e){return e.connection.inProgress?{...e.connection,to:Qf(e.connection.to,e.transform)}:{...e.connection}}function Xie(e){return Kie}function Qie(e){const t=Xie();return Jt(t,qn)}const Wie=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Jie({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:l,isValid:c,inProgress:f}=Jt(Wie,qn);return!(i&&o&&f)?null:h.jsx("svg",{style:e,width:i,height:l,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:cr(["react-flow__connection",cI(c)]),children:h.jsx(mz,{style:t,type:n,CustomComponent:r,isValid:c})})})}const mz=({style:e,type:t=ca.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:l,fromHandle:c,fromPosition:f,to:d,toNode:p,toHandle:g,toPosition:y,pointer:v}=Qie();if(!o)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:f,toPosition:y,connectionStatus:cI(r),toNode:p,toHandle:g,pointer:v});let x="";const E={sourceX:i.x,sourceY:i.y,sourcePosition:f,targetX:d.x,targetY:d.y,targetPosition:y};switch(t){case ca.Bezier:[x]=SI(E);break;case ca.SimpleBezier:[x]=nz(E);break;case ca.Step:[x]=Jm({...E,borderRadius:0});break;case ca.SmoothStep:[x]=Jm(E);break;default:[x]=CI(E)}return h.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};mz.displayName="ConnectionLine";const eae={};function wO(e=eae){b.useRef(e),Pn(),b.useEffect(()=>{},[e])}function tae(){Pn(),b.useRef(!1),b.useEffect(()=>{},[])}function gz({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:y,onSelectionEnd:v,connectionLineType:x,connectionLineStyle:E,connectionLineComponent:S,connectionLineContainerStyle:_,selectionKeyCode:j,selectionOnDrag:R,selectionMode:N,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:M,deleteKeyCode:T,onlyRenderVisibleElements:L,elementsSelectable:G,defaultViewport:B,translateExtent:V,minZoom:q,maxZoom:I,preventScrolling:z,defaultMarkerColor:A,zoomOnScroll:P,zoomOnPinch:U,panOnScroll:H,panOnScrollSpeed:Y,panOnScrollMode:$,zoomOnDoubleClick:F,panOnDrag:Q,autoPanOnSelection:X,onPaneClick:ne,onPaneMouseEnter:te,onPaneMouseMove:J,onPaneMouseLeave:K,onPaneScroll:re,onPaneContextMenu:ye,paneClickDistance:fe,nodeClickDistance:ue,onEdgeContextMenu:he,onEdgeMouseEnter:Re,onEdgeMouseMove:ze,onEdgeMouseLeave:Ue,reconnectRadius:Ae,onReconnect:Qe,onReconnectStart:De,onReconnectEnd:Le,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:et,disableKeyboardA11y:me,nodeExtent:xe,rfId:We,viewport:Oe,onViewportChange:Ie,nodesDraggable:at}){return wO(e),wO(t),tae(),Yie(n),Gie(Oe),h.jsx(yie,{onPaneClick:ne,onPaneMouseEnter:te,onPaneMouseMove:J,onPaneMouseLeave:K,onPaneContextMenu:ye,onPaneScroll:re,paneClickDistance:fe,deleteKeyCode:T,selectionKeyCode:j,selectionOnDrag:R,selectionMode:N,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:M,elementsSelectable:G,zoomOnScroll:P,zoomOnPinch:U,zoomOnDoubleClick:F,panOnScroll:H,panOnScrollSpeed:Y,panOnScrollMode:$,panOnDrag:Q,autoPanOnSelection:X,defaultViewport:B,translateExtent:V,minZoom:q,maxZoom:I,onSelectionContextMenu:g,preventScrolling:z,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:et,disableKeyboardA11y:me,onViewportChange:Ie,isControlledViewport:!!Oe,children:h.jsxs(qie,{children:[h.jsx(Bie,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:Qe,onReconnectStart:De,onReconnectEnd:Le,onlyRenderVisibleElements:L,onEdgeContextMenu:he,onEdgeMouseEnter:Re,onEdgeMouseMove:ze,onEdgeMouseLeave:Ue,reconnectRadius:Ae,defaultMarkerColor:A,noPanClassName:et,disableKeyboardA11y:me,rfId:We}),h.jsx(Jie,{style:E,type:x,component:S,containerStyle:_}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(Rie,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:ue,onlyRenderVisibleElements:L,noPanClassName:et,noDragClassName:Fe,disableKeyboardA11y:me,nodeExtent:xe,rfId:We,nodesDraggable:at}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}gz.displayName="GraphView";const nae=b.memo(gz),rae=mI(),SO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:f=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:g,zIndexMode:y="basic"}={})=>{const v=new Map,x=new Map,E=new Map,S=new Map,_=r??t??[],j=n??e??[],R=p??[0,0],N=g??uf;jI(E,S,_);const{nodesInitialized:O}=I0(j,v,x,{nodeOrigin:R,nodeExtent:N,zIndexMode:y});let k=[0,0,1];if(l&&o&&i){const M=Kf(v,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:T,y:L,zoom:G}=hE(M,o,i,f,d,c?.padding??.1);k=[T,L,G]}return{rfId:"1",width:o??0,height:i??0,transform:k,nodes:j,nodesInitialized:O,nodeLookup:v,parentLookup:x,edges:_,edgeLookup:S,connectionLookup:E,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:f,maxZoom:d,translateExtent:uf,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:nu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:R,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...lI},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:rae,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:aI,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},oae=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:d,nodeOrigin:p,nodeExtent:g,zIndexMode:y})=>xse((v,x)=>{async function E(){const{nodeLookup:S,panZoom:_,fitViewOptions:j,fitViewResolver:R,width:N,height:O,minZoom:k,maxZoom:M}=x();_&&(await woe({nodes:S,width:N,height:O,panZoom:_,minZoom:k,maxZoom:M},j),R?.resolve(!0),v({fitViewResolver:null}))}return{...SO({nodes:e,edges:t,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:d,nodeOrigin:p,nodeExtent:g,defaultNodes:n,defaultEdges:r,zIndexMode:y}),setNodes:S=>{const{nodeLookup:_,parentLookup:j,nodeOrigin:R,nodeExtent:N,elevateNodesOnSelect:O,fitViewQueued:k,zIndexMode:M,nodesSelectionActive:T}=x(),{nodesInitialized:L,hasSelectedNodes:G}=I0(S,_,j,{nodeOrigin:R,nodeExtent:N,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:M}),B=T&&G;k&&L?(E(),v({nodes:S,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):v({nodes:S,nodesInitialized:L,nodesSelectionActive:B})},setEdges:S=>{const{connectionLookup:_,edgeLookup:j}=x();jI(_,j,S),v({edges:S})},setDefaultNodesAndEdges:(S,_)=>{if(S){const{setNodes:j}=x();j(S),v({hasDefaultNodes:!0})}if(_){const{setEdges:j}=x();j(_),v({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:_,nodeLookup:j,parentLookup:R,domNode:N,nodeOrigin:O,nodeExtent:k,debug:M,fitViewQueued:T,zIndexMode:L}=x(),{changes:G,updatedInternals:B}=Boe(S,j,R,N,O,k,L);B&&(Foe(j,R,{nodeOrigin:O,nodeExtent:k,zIndexMode:L}),T?(E(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),G?.length>0&&(M&&console.log("React Flow: trigger node changes",G),_?.(G)))},updateNodePositions:(S,_=!1)=>{const j=[];let R=[];const{nodeLookup:N,triggerNodeChanges:O,connection:k,updateConnection:M,onNodesChangeMiddlewareMap:T}=x();for(const[L,G]of S){const B=N.get(L),V=!!(B?.expandParent&&B?.parentId&&G?.position),q={id:L,type:"position",position:V?{x:Math.max(0,G.position.x),y:Math.max(0,G.position.y)}:G.position,dragging:_};if(B&&k.inProgress&&k.fromNode.id===B.id){const I=El(B,k.fromHandle,ft.Left,!0);M({...k,from:I})}V&&B.parentId&&j.push({id:L,parentId:B.parentId,rect:{...G.internals.positionAbsolute,width:G.measured.width??0,height:G.measured.height??0}}),R.push(q)}if(j.length>0){const{parentLookup:L,nodeOrigin:G}=x(),B=xE(j,N,L,G);R.push(...B)}for(const L of T.values())R=L(R);O(R)},triggerNodeChanges:S=>{const{onNodesChange:_,setNodes:j,nodes:R,hasDefaultNodes:N,debug:O}=x();if(S?.length){if(N){const k=UI(S,R);j(k)}O&&console.log("React Flow: trigger node changes",S),_?.(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:_,setEdges:j,edges:R,hasDefaultEdges:N,debug:O}=x();if(S?.length){if(N){const k=HI(S,R);j(k)}O&&console.log("React Flow: trigger edge changes",S),_?.(S)}},addSelectedNodes:S=>{const{multiSelectionActive:_,edgeLookup:j,nodeLookup:R,triggerNodeChanges:N,triggerEdgeChanges:O}=x();if(_){const k=S.map(M=>Ja(M,!0));N(k);return}N(Pc(R,new Set([...S]),!0)),O(Pc(j))},addSelectedEdges:S=>{const{multiSelectionActive:_,edgeLookup:j,nodeLookup:R,triggerNodeChanges:N,triggerEdgeChanges:O}=x();if(_){const k=S.map(M=>Ja(M,!0));O(k);return}O(Pc(j,new Set([...S]))),N(Pc(R,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:_}={})=>{const{edges:j,nodes:R,nodeLookup:N,triggerNodeChanges:O,triggerEdgeChanges:k}=x(),M=S||R,T=_||j,L=[];for(const B of M){if(!B.selected)continue;const V=N.get(B.id);V&&(V.selected=!1),L.push(Ja(B.id,!1))}const G=[];for(const B of T)B.selected&&G.push(Ja(B.id,!1));O(L),k(G)},setMinZoom:S=>{const{panZoom:_,maxZoom:j}=x();_?.setScaleExtent([S,j]),v({minZoom:S})},setMaxZoom:S=>{const{panZoom:_,minZoom:j}=x();_?.setScaleExtent([j,S]),v({maxZoom:S})},setTranslateExtent:S=>{x().panZoom?.setTranslateExtent(S),v({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:_,triggerNodeChanges:j,triggerEdgeChanges:R,elementsSelectable:N}=x();if(!N)return;const O=_.reduce((M,T)=>T.selected?[...M,Ja(T.id,!1)]:M,[]),k=S.reduce((M,T)=>T.selected?[...M,Ja(T.id,!1)]:M,[]);j(O),R(k)},setNodeExtent:S=>{const{nodes:_,nodeLookup:j,parentLookup:R,nodeOrigin:N,elevateNodesOnSelect:O,nodeExtent:k,zIndexMode:M}=x();S[0][0]===k[0][0]&&S[0][1]===k[0][1]&&S[1][0]===k[1][0]&&S[1][1]===k[1][1]||(I0(_,j,R,{nodeOrigin:N,nodeExtent:S,elevateNodesOnSelect:O,checkEquality:!1,zIndexMode:M}),v({nodeExtent:S}))},panBy:S=>{const{transform:_,width:j,height:R,panZoom:N,translateExtent:O}=x();return qoe({delta:S,panZoom:N,transform:_,translateExtent:O,width:j,height:R})},setCenter:async(S,_,j)=>{const{width:R,height:N,maxZoom:O,panZoom:k}=x();if(!k)return!1;const M=typeof j?.zoom<"u"?j.zoom:O;return await k.setViewport({x:R/2-S*M,y:N/2-_*M,zoom:M},{duration:j?.duration,ease:j?.ease,interpolate:j?.interpolate}),!0},cancelConnection:()=>{v({connection:{...lI}})},updateConnection:S=>{v({connection:S})},reset:()=>v({...SO()})}},Object.is);function sae({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:f,fitView:d,nodeOrigin:p,nodeExtent:g,zIndexMode:y,children:v}){const[x]=b.useState(()=>oae({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:f,nodeOrigin:p,nodeExtent:g,zIndexMode:y}));return h.jsx(bse,{value:x,children:h.jsx(Hse,{children:h.jsx(oie,{children:v})})})}function iae({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:l,fitView:c,fitViewOptions:f,minZoom:d,maxZoom:p,nodeOrigin:g,nodeExtent:y,zIndexMode:v}){return b.useContext(ly)?h.jsx(h.Fragment,{children:e}):h.jsx(sae,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:l,fitView:c,initialFitViewOptions:f,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:g,nodeExtent:y,zIndexMode:v,children:e})}const aae={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function lae({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:l,onNodeClick:c,onEdgeClick:f,onInit:d,onMove:p,onMoveStart:g,onMoveEnd:y,onConnect:v,onConnectStart:x,onConnectEnd:E,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:j,onNodeMouseMove:R,onNodeMouseLeave:N,onNodeContextMenu:O,onNodeDoubleClick:k,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:L,onNodesDelete:G,onEdgesDelete:B,onDelete:V,onSelectionChange:q,onSelectionDragStart:I,onSelectionDrag:z,onSelectionDragStop:A,onSelectionContextMenu:P,onSelectionStart:U,onSelectionEnd:H,onBeforeDelete:Y,connectionMode:$,connectionLineType:F=ca.Bezier,connectionLineStyle:Q,connectionLineComponent:X,connectionLineContainerStyle:ne,deleteKeyCode:te="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:K=!1,selectionMode:re=df.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:fe=pf()?"Meta":"Control",zoomActivationKeyCode:ue=pf()?"Meta":"Control",snapToGrid:he,snapGrid:Re,onlyRenderVisibleElements:ze=!1,selectNodesOnDrag:Ue,nodesDraggable:Ae,autoPanOnNodeFocus:Qe,nodesConnectable:De,nodesFocusable:Le,nodeOrigin:Fe=FI,edgesFocusable:Ye,edgesReconnectable:et,elementsSelectable:me=!0,defaultViewport:xe=Ase,minZoom:We=.5,maxZoom:Oe=2,translateExtent:Ie=uf,preventScrolling:at=!0,nodeExtent:it,defaultMarkerColor:$t="#b1b1b7",zoomOnScroll:W=!0,zoomOnPinch:ie=!0,panOnScroll:ae=!1,panOnScrollSpeed:Se=.5,panOnScrollMode:be=sl.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:Me=!0,onPaneClick:$e,onPaneMouseEnter:He,onPaneMouseMove:Xe,onPaneMouseLeave:Je,onPaneScroll:bt,onPaneContextMenu:Mt,paneClickDistance:kt=1,nodeClickDistance:nt=0,children:wt,onReconnect:Dt,onReconnectStart:St,onReconnectEnd:In,onEdgeContextMenu:Qt,onEdgeDoubleClick:wn,onEdgeMouseEnter:ee,onEdgeMouseMove:se,onEdgeMouseLeave:ce,reconnectRadius:Ce=10,onNodesChange:Ne,onEdgesChange:Ze,noDragClassName:Be="nodrag",noWheelClassName:Ge="nowheel",noPanClassName:Ke="nopan",fitView:lt,fitViewOptions:ht,connectOnClick:Rt,attributionPosition:vt,proOptions:Pt,defaultEdgeOptions:Wt,elevateNodesOnSelect:Sn=!0,elevateEdgesOnSelect:en=!1,disableKeyboardA11y:Bt=!1,autoPanOnConnect:Fn,autoPanOnNodeDrag:Kt,autoPanOnSelection:xs=!0,autoPanSpeed:uo,connectionRadius:Lr,isValidConnection:Cr,onError:Kr,style:Ni,id:Xr,nodeDragThreshold:Ti,connectionDragThreshold:Zo,viewport:Go,onViewportChange:Et,width:dn,height:Ur,colorMode:fo="light",debug:Oi,onScroll:Ys,ariaLabelConfig:rn,zIndexMode:No="basic",..._r},Ma){const Dl=Xr||"1",Cu=zse(fo),Mi=b.useCallback(_u=>{_u.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ys?.(_u)},[Ys]);return h.jsx("div",{"data-testid":"rf__wrapper",..._r,onScroll:Mi,style:{...Ni,...aae},ref:Ma,className:cr(["react-flow",o,Cu]),id:Xr,role:"application",children:h.jsxs(iae,{nodes:e,edges:t,width:dn,height:Ur,fitView:lt,fitViewOptions:ht,minZoom:We,maxZoom:Oe,nodeOrigin:Fe,nodeExtent:it,zIndexMode:No,children:[h.jsx(Ise,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:x,onConnectEnd:E,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:Ae,autoPanOnNodeFocus:Qe,nodesConnectable:De,nodesFocusable:Le,edgesFocusable:Ye,edgesReconnectable:et,elementsSelectable:me,elevateNodesOnSelect:Sn,elevateEdgesOnSelect:en,minZoom:We,maxZoom:Oe,nodeExtent:it,onNodesChange:Ne,onEdgesChange:Ze,snapToGrid:he,snapGrid:Re,connectionMode:$,translateExtent:Ie,connectOnClick:Rt,defaultEdgeOptions:Wt,fitView:lt,fitViewOptions:ht,onNodesDelete:G,onEdgesDelete:B,onDelete:V,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:L,onSelectionDrag:z,onSelectionDragStart:I,onSelectionDragStop:A,onMove:p,onMoveStart:g,onMoveEnd:y,noPanClassName:Ke,nodeOrigin:Fe,rfId:Dl,autoPanOnConnect:Fn,autoPanOnNodeDrag:Kt,autoPanSpeed:uo,onError:Kr,connectionRadius:Lr,isValidConnection:Cr,selectNodesOnDrag:Ue,nodeDragThreshold:Ti,connectionDragThreshold:Zo,onBeforeDelete:Y,debug:Oi,ariaLabelConfig:rn,zIndexMode:No}),h.jsx(nae,{onInit:d,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:R,onNodeMouseLeave:N,onNodeContextMenu:O,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:l,connectionLineType:F,connectionLineStyle:Q,connectionLineComponent:X,connectionLineContainerStyle:ne,selectionKeyCode:J,selectionOnDrag:K,selectionMode:re,deleteKeyCode:te,multiSelectionKeyCode:fe,panActivationKeyCode:ye,zoomActivationKeyCode:ue,onlyRenderVisibleElements:ze,defaultViewport:xe,translateExtent:Ie,minZoom:We,maxZoom:Oe,preventScrolling:at,zoomOnScroll:W,zoomOnPinch:ie,zoomOnDoubleClick:Ve,panOnScroll:ae,panOnScrollSpeed:Se,panOnScrollMode:be,panOnDrag:Me,autoPanOnSelection:xs,onPaneClick:$e,onPaneMouseEnter:He,onPaneMouseMove:Xe,onPaneMouseLeave:Je,onPaneScroll:bt,onPaneContextMenu:Mt,paneClickDistance:kt,nodeClickDistance:nt,onSelectionContextMenu:P,onSelectionStart:U,onSelectionEnd:H,onReconnect:Dt,onReconnectStart:St,onReconnectEnd:In,onEdgeContextMenu:Qt,onEdgeDoubleClick:wn,onEdgeMouseEnter:ee,onEdgeMouseMove:se,onEdgeMouseLeave:ce,reconnectRadius:Ce,defaultMarkerColor:$t,noDragClassName:Be,noWheelClassName:Ge,noPanClassName:Ke,rfId:Dl,disableKeyboardA11y:Bt,nodeExtent:it,viewport:Go,onViewportChange:Et,nodesDraggable:Ae}),h.jsx(kse,{onSelectionChange:q}),wt,h.jsx(jse,{proOptions:Pt,position:vt}),h.jsx(Rse,{rfId:Dl,disableKeyboardA11y:Bt})]})})}var cae=qI(lae);const uae=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function dae({children:e}){const t=Jt(uae);return t?Co.createPortal(e,t):null}function fae(e){const[t,n]=b.useState(e),r=b.useCallback(o=>n(i=>UI(o,i)),[]);return[t,n,r]}function hae(e){const[t,n]=b.useState(e),r=b.useCallback(o=>n(i=>HI(o,i)),[]);return[t,n,r]}function pae({dimensions:e,lineWidth:t,variant:n,className:r}){return h.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:cr(["react-flow__background-pattern",n,r])})}function mae({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:cr(["react-flow__background-pattern","dots",t])})}var bi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(bi||(bi={}));const gae={[bi.Dots]:1,[bi.Lines]:1,[bi.Cross]:6},yae=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function yz({id:e,variant:t=bi.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:l,bgColor:c,style:f,className:d,patternClassName:p}){const g=b.useRef(null),{transform:y,patternId:v}=Jt(yae,qn),x=r||gae[t],E=t===bi.Dots,S=t===bi.Cross,_=Array.isArray(n)?n:[n,n],j=[_[0]*y[2]||1,_[1]*y[2]||1],R=x*y[2],N=Array.isArray(i)?i:[i,i],O=S?[R,R]:j,k=[N[0]*y[2]+O[0]/2,N[1]*y[2]+O[1]/2],M=`${v}${e||""}`;return h.jsxs("svg",{className:cr(["react-flow__background",d]),style:{...f,...uy,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[h.jsx("pattern",{id:M,x:y[0]%j[0],y:y[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:E?h.jsx(mae,{radius:R/2,className:p}):h.jsx(pae,{dimensions:O,lineWidth:o,variant:t,className:p})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}yz.displayName="Background";const vae=b.memo(yz);function xae(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:h.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function bae(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:h.jsx("path",{d:"M0 0h32v4.2H0z"})})}function wae(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:h.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Sae(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Eae(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Zp({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:cr(["react-flow__controls-button",t]),...n,children:e})}const Cae=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function vz({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:l,onFitView:c,onInteractiveChange:f,className:d,children:p,position:g="bottom-left",orientation:y="vertical","aria-label":v}){const x=Pn(),{isInteractive:E,minZoomReached:S,maxZoomReached:_,ariaLabelConfig:j}=Jt(Cae,qn),{zoomIn:R,zoomOut:N,fitView:O}=bE(),k=()=>{R(),i?.()},M=()=>{N(),l?.()},T=()=>{O(o),c?.()},L=()=>{x.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),f?.(!E)},G=y==="horizontal"?"horizontal":"vertical";return h.jsxs(cy,{className:cr(["react-flow__controls",G,d]),position:g,style:e,"data-testid":"rf__controls","aria-label":v??j["controls.ariaLabel"],children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(Zp,{onClick:k,className:"react-flow__controls-zoomin",title:j["controls.zoomIn.ariaLabel"],"aria-label":j["controls.zoomIn.ariaLabel"],disabled:_,children:h.jsx(xae,{})}),h.jsx(Zp,{onClick:M,className:"react-flow__controls-zoomout",title:j["controls.zoomOut.ariaLabel"],"aria-label":j["controls.zoomOut.ariaLabel"],disabled:S,children:h.jsx(bae,{})})]}),n&&h.jsx(Zp,{className:"react-flow__controls-fitview",onClick:T,title:j["controls.fitView.ariaLabel"],"aria-label":j["controls.fitView.ariaLabel"],children:h.jsx(wae,{})}),r&&h.jsx(Zp,{className:"react-flow__controls-interactive",onClick:L,title:j["controls.interactive.ariaLabel"],"aria-label":j["controls.interactive.ariaLabel"],children:E?h.jsx(Eae,{}):h.jsx(Sae,{})}),p]})}vz.displayName="Controls";const _ae=b.memo(vz);function Rae({id:e,x:t,y:n,width:r,height:o,style:i,color:l,strokeColor:c,strokeWidth:f,className:d,borderRadius:p,shapeRendering:g,selected:y,onClick:v}){const{background:x,backgroundColor:E}=i||{},S=l||x||E;return h.jsx("rect",{className:cr(["react-flow__minimap-node",{selected:y},d]),x:t,y:n,rx:p,ry:p,width:r,height:o,style:{fill:S,stroke:c,strokeWidth:f},shapeRendering:g,onClick:v?_=>v(_,e):void 0})}const jae=b.memo(Rae),Nae=e=>e.nodes.map(t=>t.id),hb=e=>e instanceof Function?e:()=>e;function Tae({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=jae,onClick:l}){const c=Jt(Nae,qn),f=hb(t),d=hb(e),p=hb(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:c.map(y=>h.jsx(Mae,{id:y,nodeColorFunc:f,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:l,shapeRendering:g},y))})}function Oae({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:l,NodeComponent:c,onClick:f}){const{node:d,x:p,y:g,width:y,height:v}=Jt(x=>{const E=x.nodeLookup.get(e);if(!E)return{node:void 0,x:0,y:0,width:0,height:0};const S=E.internals.userNode,{x:_,y:j}=E.internals.positionAbsolute,{width:R,height:N}=ys(S);return{node:S,x:_,y:j,width:R,height:N}},qn);return!d||d.hidden||!gI(d)?null:h.jsx(c,{x:p,y:g,width:y,height:v,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:o,strokeColor:n(d),strokeWidth:i,shapeRendering:l,onClick:f,id:d.id})}const Mae=b.memo(Oae);var kae=b.memo(Tae);const Aae=200,Dae=150,Pae=e=>!e.hidden,Iae=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?hI(Kf(e.nodeLookup,{filter:Pae}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},EO=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,zae=(e,t)=>EO(e.viewBB,t.viewBB)&&EO(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,Lae="react-flow__minimap-desc";function xz({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:f,maskColor:d,maskStrokeColor:p,maskStrokeWidth:g,position:y="bottom-right",onClick:v,onNodeClick:x,pannable:E=!1,zoomable:S=!1,ariaLabel:_,inversePan:j,zoomStep:R=1,offsetScale:N=5}){const O=Pn(),k=b.useRef(null),{boundingRect:M,viewBB:T,rfId:L,panZoom:G,translateExtent:B,flowWidth:V,flowHeight:q,ariaLabelConfig:I}=Jt(Iae,zae),z=e?.width??Aae,A=e?.height??Dae,P=M.width/z,U=M.height/A,H=Math.max(P,U),Y=H*z,$=H*A,F=N*H,Q=M.x-(Y-M.width)/2-F,X=M.y-($-M.height)/2-F,ne=Y+F*2,te=$+F*2,J=`${Lae}-${L}`,K=b.useRef(0),re=b.useRef();K.current=H,b.useEffect(()=>{if(k.current&&G)return re.current=ese({domNode:k.current,panZoom:G,getTransform:()=>O.getState().transform,getViewScale:()=>K.current}),()=>{re.current?.destroy()}},[G]),b.useEffect(()=>{re.current?.update({translateExtent:B,width:V,height:q,inversePan:j,pannable:E,zoomStep:R,zoomable:S})},[E,S,j,R,B,V,q]);const ye=v?he=>{const[Re,ze]=re.current?.pointer(he)||[0,0];v(he,{x:Re,y:ze})}:void 0,fe=x?b.useCallback((he,Re)=>{const ze=O.getState().nodeLookup.get(Re).internals.userNode;x(he,ze)},[]):void 0,ue=_??I["minimap.ariaLabel"];return h.jsx(cy,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*H:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:cr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:z,height:A,viewBox:`${Q} ${X} ${ne} ${te}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:k,onClick:ye,children:[ue&&h.jsx("title",{id:J,children:ue}),h.jsx(kae,{onClick:fe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${Q-F},${X-F}h${ne+F*2}v${te+F*2}h${-ne-F*2}z
|
|
122
|
+
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}xz.displayName="MiniMap";const $ae=b.memo(xz),Fae=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Vae={[su.Line]:"right",[su.Handle]:"bottom-right"};function Uae({nodeId:e,position:t,variant:n=su.Handle,className:r,style:o=void 0,children:i,color:l,minWidth:c=10,minHeight:f=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:y,autoScale:v=!0,shouldResize:x,onResizeStart:E,onResize:S,onResizeEnd:_}){const j=XI(),R=typeof e=="string"?e:j,N=Pn(),O=b.useRef(null),k=n===su.Handle,M=Jt(b.useCallback(Fae(k&&v),[k,v]),qn),T=b.useRef(null),L=t??Vae[n];b.useEffect(()=>{if(!(!O.current||!R))return T.current||(T.current=hse({domNode:O.current,nodeId:R,getStoreItems:()=>{const{nodeLookup:B,transform:V,snapGrid:q,snapToGrid:I,nodeOrigin:z,domNode:A}=N.getState();return{nodeLookup:B,transform:V,snapGrid:q,snapToGrid:I,nodeOrigin:z,paneDomNode:A}},onChange:(B,V)=>{const{triggerNodeChanges:q,nodeLookup:I,parentLookup:z,nodeOrigin:A}=N.getState(),P=[],U={x:B.x,y:B.y},H=I.get(R);if(H&&H.expandParent&&H.parentId){const Y=H.origin??A,$=B.width??H.measured.width??0,F=B.height??H.measured.height??0,Q={id:H.id,parentId:H.parentId,rect:{width:$,height:F,...yI({x:B.x??H.position.x,y:B.y??H.position.y},{width:$,height:F},H.parentId,I,Y)}},X=xE([Q],I,z,A);P.push(...X),U.x=B.x?Math.max(Y[0]*$,B.x):void 0,U.y=B.y?Math.max(Y[1]*F,B.y):void 0}if(U.x!==void 0&&U.y!==void 0){const Y={id:R,type:"position",position:{...U}};P.push(Y)}if(B.width!==void 0&&B.height!==void 0){const $={id:R,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};P.push($)}for(const Y of V){const $={...Y,type:"position"};P.push($)}q(P)},onEnd:({width:B,height:V})=>{const q={id:R,type:"dimensions",resizing:!1,dimensions:{width:B,height:V}};N.getState().triggerNodeChanges([q])}})),T.current.update({controlPosition:L,boundaries:{minWidth:c,minHeight:f,maxWidth:d,maxHeight:p},keepAspectRatio:g,resizeDirection:y,onResizeStart:E,onResize:S,onResizeEnd:_,shouldResize:x}),()=>{T.current?.destroy()}},[L,c,f,d,p,g,E,S,_,x]);const G=L.split("-");return h.jsx("div",{className:cr(["react-flow__resize-control","nodrag",...G,n,r]),ref:O,style:{...o,scale:M,...l&&{[k?"backgroundColor":"borderColor"]:l}},children:i})}b.memo(Uae);function Hae(e,t=""){return co({queryKey:["tasks",e,t],queryFn:()=>QM(e,t||void 0),enabled:e.length>0,placeholderData:B0})}function bz(e){return co({queryKey:["task",e],queryFn:()=>XV(e),enabled:e.length>0})}function wz(e,t=!0,n){return co({queryKey:["templates",e,{includeDisabled:n?.includeDisabled??!1}],queryFn:()=>oU(e,n),enabled:t&&e.length>0})}function Sz(e){return co({queryKey:["template",e],queryFn:()=>sU(e),enabled:e.length>0})}function Ez(){const e=sn();return un({mutationFn:t=>QV(t),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Bae(e){const t=sn();return un({mutationFn:n=>WV(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function qae(e){const t=sn();return un({mutationFn:n=>JV(e,n.decision,n.comment),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]}),t.invalidateQueries({queryKey:["taskContext",e]})}})}function Yae(e,t=!0){return co({queryKey:["taskContext",e],queryFn:()=>eU(e),enabled:t&&e.length>0})}function Zae(e){const t=sn();return un({mutationFn:n=>tU(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Gae(e){const t=sn();return un({mutationFn:n=>nU(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Kae(e){const t=sn();return un({mutationFn:n=>rU(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Xae(){const e=sn();return un({mutationFn:({id:t,enabled:n})=>uU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}function Qae(){return un({mutationFn:fU})}function Wae(){const e=sn();return un({mutationFn:hU,onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]}),e.invalidateQueries({queryKey:["template"]}),e.invalidateQueries({queryKey:["skills"]}),e.invalidateQueries({queryKey:["skill"]}),e.invalidateQueries({queryKey:["agents"]}),e.invalidateQueries({queryKey:["agent"]}),e.invalidateQueries({queryKey:["model-aliases"]})}})}function Cz(){const e=sn();return un({mutationFn:t=>lU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}function _z(){const e=sn();return un({mutationFn:({id:t,patch:n})=>aU(t,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["template",n.id]}),e.invalidateQueries({queryKey:["templates"]})}})}function Jae(e){const t=sn();return un({mutationFn:n=>iU({name:n,description:"",projectId:e,nodes:[{id:"ENTRY",label:"入口节点",phase:"entry",track:"all",prompt:"",skills:[]}],edges:[]}),onSuccess:()=>{t.invalidateQueries({queryKey:["templates"]})}})}function ele(){const e=sn();return un({mutationFn:({id:t,input:n})=>cU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}const tle={entry:"bg-info",track:"bg-primary",test:"bg-warning",exit:"bg-success"};function nle(e){switch(e){case"completed":return"ring-2 ring-success";case"active":return"ring-2 ring-primary animate-pulse";case"skipped":return"opacity-60 ring-2 ring-dashed ring-muted";default:return"ring-2 ring-muted-foreground/30"}}const rle=b.memo(function({data:t}){const{node:n,instanceStatus:r}=t,o=Xn("dag_phase"),i=Xn("dag_track"),l=f=>o.find(d=>d.value===f)?.label??f,c=f=>i.find(d=>d.value===f)?.label??f;return h.jsxs("div",{className:`w-50 rounded-md border border-border bg-card shadow-sm ${nle(r)}`,children:[h.jsx(iu,{type:"target",position:ft.Top,isConnectableStart:!1}),h.jsx("div",{className:`h-1.5 rounded-t-md ${tle[n.phase]??"bg-muted"}`}),h.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:`truncate text-sm font-medium ${r==="skipped"?"text-muted-foreground line-through":"text-foreground"}`,children:n.label}),r==="completed"&&h.jsx("span",{role:"img","aria-label":"已完成",className:"shrink-0 rounded bg-success/10 px-1 text-xs text-success",title:"已完成",children:"✓"})]}),h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[h.jsx("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:n.id}),h.jsx("span",{className:"rounded bg-muted px-1 py-0.5",children:l(n.phase)}),h.jsx("span",{className:"rounded bg-muted px-1 py-0.5",children:c(n.track)})]})]}),h.jsx(iu,{type:"source",position:ft.Bottom})]})}),ole=b.memo(function({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l=ft.Bottom,targetPosition:c=ft.Top,data:f,markerEnd:d}){const[p,g,y]=Jm({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l,targetPosition:c}),v=f,x=v?.pausePoint,E=v?.pauseState??"pending";if(!x)return h.jsx(au,{id:t,path:p,...d?{markerEnd:d}:{}});const S=E==="awaiting",_=E==="passed",j=x.type==="checkpoint";return h.jsxs(h.Fragment,{children:[h.jsx(au,{id:t,path:p,...d?{markerEnd:d}:{},className:[_?"stroke-success":j?"stroke-info":"stroke-warning",S?"stroke-3 animate-pulse motion-reduce:animate-none":"stroke-2"].join(" ")}),h.jsx(dae,{children:h.jsxs("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${g}px, ${y}px)`},className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs pointer-events-none ${_?"border-success bg-success/10 text-success":S?"border-warning bg-warning/10 text-warning animate-pulse font-bold motion-reduce:animate-none":j?"border-info/50 bg-info/5 text-info/70":"border-warning/50 bg-warning/5 text-warning/70"}`,children:[_?"✓":"🖐",h.jsx("span",{children:x.type==="human_approval"?"审批":"检查点"})]})})]})});var Rz=Object.defineProperty,sle=(e,t,n)=>t in e?Rz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ile=(e,t)=>{for(var n in t)Rz(e,n,{get:t[n],enumerable:!0})},ale=(e,t,n)=>sle(e,t+"",n),jz={};ile(jz,{Graph:()=>vs,alg:()=>EE});var lle=Object.defineProperty,Nz=(e,t)=>{for(var n in t)lle(e,n,{get:t[n],enumerable:!0})},SE=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let o of r)n.add(o);return Array.from(n.values())}}isLeaf(e){var t;let n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),((t=n?.length)!=null?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,l,c,f=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,l=e.name,arguments.length===2&&(c=t,f=!0)):(o=e,i=t,l=r,arguments.length>2&&(c=n,f=!0)),o=""+o,i=""+i,l!==void 0&&(l=""+l);let d=zd(this._isDirected,o,i,l);if(d in this._edgeLabels)return f&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[d]=f?c:this._defaultEdgeLabelFn(o,i,l);let p=cle(this._isDirected,o,i,l);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[d]=p,CO(this._preds[i],o),CO(this._sucs[o],i),this._in[i][d]=p,this._out[o][d]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?pb(this._isDirected,e):zd(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"||r===null?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?pb(this._isDirected,e):zd(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?pb(this._isDirected,e):zd(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,l=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],_O(this._preds[l],i),_O(this._sucs[i],l),delete this._in[l][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function CO(e,t){e[t]?e[t]++:e[t]=1}function _O(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function zd(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let l=o;o=i,i=l}return o+""+i+""+(r===void 0?"\0":r)}function cle(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let c=o;o=i,i=c}let l={v:o,w:i};return r&&(l.name=r),l}function pb(e,t){return zd(e,t.v,t.w,t.name)}var ule={};Nz(ule,{read:()=>ple,write:()=>dle});function dle(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:fle(e),edges:hle(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function fle(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function hle(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function ple(e){let t=new SE(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var EE={};Nz(EE,{CycleException:()=>ng,bellmanFord:()=>Tz,components:()=>yle,dijkstra:()=>tg,dijkstraAll:()=>ble,findCycles:()=>wle,floydWarshall:()=>Ele,isAcyclic:()=>_le,postorder:()=>jle,preorder:()=>Nle,prim:()=>Tle,shortestPaths:()=>Ole,tarjan:()=>Mz,topsort:()=>kz});var mle=()=>1;function Tz(e,t,n,r){return gle(e,String(t),n||mle,r||function(o){var i;return(i=e.outEdges(o))!=null?i:[]})}function gle(e,t,n,r){let o={},i,l=0,c=e.nodes(),f=function(g){let y=o[g.v],v=o[g.w];if(!y||!v)return;let x=n(g);y.distance+x<v.distance&&(o[g.w]={distance:y.distance+x,predecessor:g.v},i=!0)},d=function(){c.forEach(function(g){r(g).forEach(function(y){let v=y.v===g?y.v:y.w,x=v===y.v?y.w:y.v;f({v,w:x})})})};c.forEach(function(g){let y=g===t?0:Number.POSITIVE_INFINITY;o[g]={distance:y,predecessor:""}});let p=c.length;for(let g=1;g<p&&(i=!1,l++,d(),!!i);g++);if(l===p-1&&(i=!1,d(),i))throw new Error("The graph contains a negative weight cycle");return o}function yle(e){let t={},n=[],r;function o(i){var l,c;i in t||(t[i]=!0,r.push(i),(l=e.successors(i))==null||l.forEach(o),(c=e.predecessors(i))==null||c.forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var Oz=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw new Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},vle=()=>1;function tg(e,t,n,r){let o=function(i){var l;return(l=e.outEdges(i))!=null?l:[]};return xle(e,String(t),n||vle,r||o)}function xle(e,t,n,r){let o={},i=new Oz,l,c,f=function(d){let p=d.v!==l?d.v:d.w,g=o[p];if(!g)return;let y=n(d),v=c.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+y);v<g.distance&&(g.distance=v,g.predecessor=l,i.decrease(p,v))};for(e.nodes().forEach(function(d){let p=d===t?0:Number.POSITIVE_INFINITY;o[d]={distance:p,predecessor:""},i.add(d,p)});i.size()>0;){l=i.removeMin();let d=o[l];if(!d||d.distance===Number.POSITIVE_INFINITY)break;c=d,r(l).forEach(f)}return o}function ble(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=tg(e,o,t,n),r},{})}function Mz(e){let t=0,n=[],r={},o=[];function i(l){var c;let f=r[l]={onStack:!0,lowlink:t,index:t++};if(n.push(l),(c=e.successors(l))==null||c.forEach(function(d){if(d in r){let p=r[d];p!=null&&p.onStack&&(f.lowlink=Math.min(f.lowlink,p.index))}else{i(d);let p=r[d];p&&(f.lowlink=Math.min(f.lowlink,p.lowlink))}}),f.lowlink===f.index){let d=[],p;do{p=n.pop();let g=r[p];g&&(g.onStack=!1),d.push(p)}while(l!==p);o.push(d)}}return e.nodes().forEach(function(l){l in r||i(l)}),o}function wle(e){return Mz(e).filter(function(t){var n;let r=t[0];return r?t.length>1||t.length===1&&((n=e.outEdges(r,r))!=null?n:[]).length>0:!1})}var Sle=()=>1;function Ele(e,t,n){return Cle(e,t||Sle,n||function(r){var o;return(o=e.outEdges(r))!=null?o:[]})}function Cle(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){let l={};r[i]=l,l[i]={distance:0,predecessor:""},o.forEach(function(c){i!==c&&(l[c]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(c){let f=c.v===i?c.w:c.v,d=t(c);l[f]={distance:d,predecessor:i}})}),o.forEach(function(i){let l=r[i];l&&o.forEach(function(c){let f=r[c];f&&o.forEach(function(d){let p=f[i],g=l[d],y=f[d];if(p&&g&&y){let v=p.distance+g.distance;v<y.distance&&(y.distance=v,y.predecessor=g.predecessor)}})})}),r}var ng=class extends Error{constructor(e){super(e),this.name="CycleException"}};function kz(e){let t={},n={},r=[];function o(i){var l;if(i in n)throw new ng;i in t||(n[i]=!0,t[i]=!0,(l=e.predecessors(i))==null||l.forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new ng;return r}function _le(e){try{kz(e)}catch(t){if(t instanceof ng)return!1;throw t}return!0}function Rle(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(c=>{var f;return(f=e.isDirected()?e.successors(c):e.neighbors(c))!=null?f:[]}),l={};return t.forEach(function(c){if(!e.hasNode(c))throw new Error("Graph does not have node: "+c);o=Az(e,c,n==="post",l,i,r,o)}),o}function Az(e,t,n,r,o,i,l){return t in r||(r[t]=!0,n||(l=i(l,t)),o(t).forEach(function(c){l=Az(e,c,n,r,o,i,l)}),n&&(l=i(l,t))),l}function Dz(e,t,n){return Rle(e,t,n,function(r,o){return r.push(o),r},[])}function jle(e,t){return Dz(e,t,"post")}function Nle(e,t){return Dz(e,t,"pre")}function Tle(e,t){var n;let r=new SE,o={},i=new Oz,l;function c(p){let g=p.v===l?p.w:p.v,y=i.priority(g);if(y!==void 0){let v=t(p);v<y&&(o[g]=l,i.decrease(g,v))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(p){i.add(p,Number.POSITIVE_INFINITY),r.setNode(p)});let f=e.nodes()[0];f!==void 0&&i.decrease(f,0);let d=!1;for(;i.size()>0;){if(l=i.removeMin(),l in o)r.setEdge(l,o[l]);else{if(d)throw new Error("Input graph is not connected: "+e);d=!0}(n=e.nodeEdges(l))==null||n.forEach(c)}return r}function Ole(e,t,n,r){return Mle(e,t,n,r??(o=>{var i;return(i=e.outEdges(o))!=null?i:[]}))}function Mle(e,t,n,r){if(n===void 0)return tg(e,t,n,r);let o=!1,i=e.nodes();for(let l=0;l<i.length;l++){let c=i[l];if(c===void 0)continue;let f=r(c);for(let d=0;d<f.length;d++){let p=f[d];if(!p)continue;let g=p.v===c?p.v:p.w,y=g===p.v?p.w:p.v;n({v:g,w:y})<0&&(o=!0)}if(o)return Tz(e,t,n,r)}return tg(e,t,n,r)}var vs=SE;function Eu(e,t,n,r){let o=r;for(;e.hasNode(o);)o=CE(r);return n.dummy=t,e.setNode(o,n),o}function kle(e){let t=new vs().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function Pz(e){let t=new vs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function RO(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,l=e.width/2,c=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let f,d;return Math.abs(i)*l>Math.abs(o)*c?(i<0&&(c=-c),f=c*o/i,d=c):(o<0&&(l=-l),f=l,d=l*i/o),{x:n+f,y:r+d}}function Wf(e){let t=gf(zz(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function Ale(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Ds(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Dle(e){let t=e.nodes().map(l=>e.node(l).rank).filter(l=>l!==void 0),n=Ds(Math.min,t),r=[];e.nodes().forEach(l=>{let c=e.node(l).rank-n;r[c]||(r[c]=[]),r[c].push(l)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((l,c)=>{l===void 0&&c%i!==0?--o:l!==void 0&&o&&l.forEach(f=>e.node(f).rank+=o)})}function jO(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Eu(e,"border",o,t)}function Ple(e,t=Iz){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var Iz=65535;function Ds(e,t){if(t.length>Iz){let n=Ple(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function zz(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Ds(Math.max,t)}function Ile(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function zle(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Lz(e,t){return t()}var Lle=0;function CE(e){let t=++Lle;return e+(""+t)}function gf(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function rg(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function dy(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function $le(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var fy="\0";function $z(e,t,n){var r,o,i,l,c,f;if(!(e&&t&&n&&t.dummy==="edge"&&n.dummy==="edge"&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let d=!0;t.edgeObj.w===n.edgeObj.w&&(d=!1);let p=d?(o=(r=e[t.edgeObj.v])==null?void 0:r.rank)!=null?o:NaN+1:(l=(i=e[t.edgeObj.w])==null?void 0:i.rank)!=null?l:NaN-1,g=Object.entries(e).find(E=>{var S,_;return((S=E[1].edgeObj)==null?void 0:S.v)===t.edgeObj.v&&((_=E[1].edgeObj)==null?void 0:_.w)===t.edgeObj.w&&E[1].rank===p}),y=Object.entries(e).find(E=>{var S,_;return((S=E[1].edgeObj)==null?void 0:S.v)===n.edgeObj.v&&((_=E[1].edgeObj)==null?void 0:_.w)===n.edgeObj.w&&E[1].rank===p});if(!g||!y)return 0;let v=(c=g[1].order)!=null?c:NaN,x=(f=y[1].order)!=null?f:NaN;return isNaN(v-x)?0:v-x}var Fle="3.1.1",Vle=class{constructor(){ale(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return NO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&NO(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Ule)),n=n._prev;return"["+e.join(", ")+"]"}};function NO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ule(e,t){if(e!=="_next"&&e!=="_prev")return t}var Hle=Vle,Ble=()=>1;function qle(e,t){if(e.nodeCount()<=1)return[];let n=Zle(e,t||Ble);return Yle(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function Yle(e,t,n){var r;let o=[],i=t[t.length-1],l=t[0],c;for(;e.nodeCount();){for(;c=l.dequeue();)mb(e,t,n,c);for(;c=i.dequeue();)mb(e,t,n,c);if(e.nodeCount()){for(let f=t.length-2;f>0;--f)if(c=(r=t[f])==null?void 0:r.dequeue(),c){o=o.concat(mb(e,t,n,c,!0)||[]);break}}}return o}function mb(e,t,n,r,o){let i=[],l=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(c=>{let f=e.edge(c),d=e.node(c.v);o&&i.push({v:c.v,w:c.w}),d.out-=f,$0(t,n,d)}),(e.outEdges(r.v)||[]).forEach(c=>{let f=e.edge(c),d=c.w,p=e.node(d);p.in-=f,$0(t,n,p)}),e.removeNode(r.v),l}function Zle(e,t){let n=new vs,r=0,o=0;e.nodes().forEach(c=>{n.setNode(c,{v:c,in:0,out:0})}),e.edges().forEach(c=>{let f=n.edge(c.v,c.w)||0,d=t(c),p=f+d;n.setEdge(c.v,c.w,p);let g=n.node(c.v),y=n.node(c.w);o=Math.max(o,g.out+=d),r=Math.max(r,y.in+=d)});let i=Gle(o+r+3).map(()=>new Hle),l=r+1;return n.nodes().forEach(c=>{$0(i,l,n.node(c))}),{graph:n,buckets:i,zeroIdx:l}}function $0(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Gle(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Kle(e,t){(e.graph().acyclicer==="greedy"?qle(e,n(e)):Xle(e,t??null)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,CE("rev"))});function n(r){return o=>r.edge(o).weight}}function Xle(e,t){let n=[],r={},o={};function i(f){Object.hasOwn(o,f)||(o[f]=!0,r[f]=!0,e.outEdges(f).forEach(d=>{Object.hasOwn(r,d.w)?n.push(d):i(d.w)}),delete r[f])}function l(f){var d;Object.hasOwn(o,f)||(o[f]=!0,r[f]=!0,(d=e.outEdges(f))==null||d.forEach(p=>{var g,y;Object.hasOwn(r,p.w)||((g=t.node(f))==null?void 0:g.rank)>((y=t.node(p.w))==null?void 0:y.rank)&&Wle(e,p.w,p)?n.push(p):l(p.w)}),delete r[f])}let c=i;return t&&typeof t.node=="function"&&(c=l),e.sources().forEach(c),e.nodes().forEach(c),n}function Qle(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Wle(e,t,n){let r=new Set;function o(i){var l;if(e.sources().includes(i))return!0;r.add(i);for(let c of(l=e.inEdges(i))!=null?l:[])if(!(c.v===n.v&&c.w===n.w)&&!r.has(c.v)&&o(c.v))return!0;return!1}return o(t)}function Jle(e){e.graph().dummyChains=[],e.edges().forEach(t=>ece(e,t))}function ece(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,l=t.name,c=e.edge(t),f=c.labelRank;if(i===r+1)return;e.removeEdge(t);let d,p,g;for(g=0,++r;r<i;++g,++r)c.points=[],p={width:0,height:0,edgeLabel:c,edgeObj:t,rank:r},d=Eu(e,"edge",p,"_d"),r===f&&(p.width=c.width,p.height=c.height,p.dummy="edge-label",p.labelpos=c.labelpos),e.setEdge(n,d,{weight:c.weight},l),g===0&&e.graph().dummyChains.push(d),n=d;e.setEdge(n,o,{weight:c.weight},l)}function tce(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}function _E(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),l=i?i.map(f=>f==null?Number.POSITIVE_INFINITY:n(f.w)-e.edge(f).minlen):[],c=Ds(Math.min,l);return c===Number.POSITIVE_INFINITY&&(c=0),o.rank=c}e.sources().forEach(n)}function lu(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Fz=nce;function nce(e){let t=new vs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,l;for(;rce(t,e)<o&&(i=oce(t,e),!!i);)l=t.hasNode(i.v)?lu(e,i):-lu(e,i),sce(t,e,l);return t}function rce(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let l=i.v,c=r===l?i.w:l;!e.hasNode(c)&&!lu(t,i)&&(e.setNode(c,{}),e.setEdge(r,c,{}),n(c))})}return e.nodes().forEach(n),e.nodeCount()}function oce(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=lu(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function sce(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:ice,postorder:ace}=EE,lce=Al;Al.initLowLimValues=jE;Al.initCutValues=RE;Al.calcCutValue=Vz;Al.leaveEdge=Hz;Al.enterEdge=Bz;Al.exchangeEdges=qz;function Al(e){e=kle(e),_E(e);let t=Fz(e);jE(t),RE(t,e);let n,r;for(;n=Hz(t);)r=Bz(t,e,n),qz(t,e,n,r)}function RE(e,t){let n=ace(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>cce(e,t,r))}function cce(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=Vz(e,t,n)}function Vz(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),l=0;i||(o=!1,i=t.edge(r,n)),l=i.weight;let c=t.nodeEdges(n);return c&&c.forEach(f=>{let d=f.v===n,p=d?f.w:f.v;if(p!==r){let g=d===o,y=t.edge(f).weight;if(l+=g?y:-y,dce(e,n,p)){let v=e.edge(n,p).cutvalue;l+=g?-v:v}}}),l}function jE(e,t){arguments.length<2&&(t=e.nodes()[0]),Uz(e,{},1,t)}function Uz(e,t,n,r,o){let i=n,l=e.node(r);t[r]=!0;let c=e.neighbors(r);return c&&c.forEach(f=>{Object.hasOwn(t,f)||(n=Uz(e,t,n,f,r))}),l.low=i,l.lim=n++,o?l.parent=o:delete l.parent,n}function Hz(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Bz(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),l=e.node(o),c=i,f=!1;return i.lim>l.lim&&(c=l,f=!0),t.edges().filter(d=>f===TO(e,e.node(d.v),c)&&f!==TO(e,e.node(d.w),c)).reduce((d,p)=>lu(t,p)<lu(t,d)?p:d)}function qz(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),jE(e),RE(e,t),uce(e,t)}function uce(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=ice(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,l=t.edge(o,i),c=!1;l||(l=t.edge(i,o),c=!0),t.node(o).rank=t.node(i).rank+(c?l.minlen:-l.minlen)})}function dce(e,t,n){return e.hasEdge(t,n)}function TO(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var fce=hce;function hce(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":OO(e);break;case"tight-tree":mce(e);break;case"longest-path":pce(e);break;case"none":break;default:OO(e)}}var pce=_E;function mce(e){_E(e),Fz(e)}function OO(e){lce(e)}var gce=yce;function yce(e){let t=xce(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(r=>{let o=e.node(r),i=o.edgeObj,l=vce(e,t,i.v,i.w),c=l.path,f=l.lca,d=0,p=c[d],g=!0;for(;r!==i.w;){if(o=e.node(r),g){for(;(p=c[d])!==f&&e.node(p).maxRank<o.rank;)d++;p===f&&(g=!1)}if(!g){for(;d<c.length-1&&e.node(c[d+1]).minRank<=o.rank;)d++;p=c[d]}p!==void 0&&e.setParent(r,p),r=e.successors(r)[0]}})}function vce(e,t,n,r){let o=[],i=[],l=Math.min(t[n].low,t[r].low),c=Math.max(t[n].lim,t[r].lim),f;f=n;do f=e.parent(f),o.push(f);while(f&&(t[f].low>l||c>t[f].lim));let d=f,p=r;for(;(p=e.parent(p))!==d;)i.push(p);return{path:o.concat(i.reverse()),lca:d}}function xce(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(fy).forEach(r),t}function bce(e){let t=Eu(e,"root",{},"_root"),n=wce(e),r=Object.values(n),o=Ds(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(c=>e.edge(c).minlen*=i);let l=Sce(e)+1;e.children(fy).forEach(c=>{Yz(e,t,i,l,o,n,c)}),e.graph().nodeRankFactor=i}function Yz(e,t,n,r,o,i,l){var c;let f=e.children(l);if(!f.length){l!==t&&e.setEdge(t,l,{weight:0,minlen:n});return}let d=jO(e,"_bt"),p=jO(e,"_bb"),g=e.node(l);e.setParent(d,l),g.borderTop=d,e.setParent(p,l),g.borderBottom=p,f.forEach(y=>{var v;Yz(e,t,n,r,o,i,y);let x=e.node(y),E=x.borderTop?x.borderTop:y,S=x.borderBottom?x.borderBottom:y,_=x.borderTop?r:2*r,j=E!==S?1:o-((v=i[l])!=null?v:0)+1;e.setEdge(d,E,{weight:_,minlen:j,nestingEdge:!0}),e.setEdge(S,p,{weight:_,minlen:j,nestingEdge:!0})}),e.parent(l)||e.setEdge(t,d,{weight:0,minlen:o+((c=i[l])!=null?c:0)})}function wce(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(l=>n(l,o+1)),t[r]=o}return e.children(fy).forEach(r=>n(r,1)),t}function Sce(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Ece(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Cce=_ce;function _ce(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),o&&Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,l=o.maxRank+1;i<l;++i)MO(e,"borderLeft","_bl",n,o,i),MO(e,"borderRight","_br",n,o,i)}}e.children(fy).forEach(t)}function MO(e,t,n,r,o,i){let l={width:0,height:0,rank:i,borderType:t},c=o[t][i-1],f=Eu(e,"border",l,n);o[t][i]=f,e.setParent(f,r),c&&e.setEdge(c,f,{weight:1})}function Rce(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&Zz(e)}function jce(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Nce(e),(n==="lr"||n==="rl")&&(Tce(e),Zz(e))}function Zz(e){e.nodes().forEach(t=>kO(e.node(t))),e.edges().forEach(t=>kO(e.edge(t)))}function kO(e){let t=e.width;e.width=e.height,e.height=t}function Nce(e){e.nodes().forEach(t=>gb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(gb),Object.hasOwn(r,"y")&&gb(r)})}function gb(e){e.y=-e.y}function Tce(e){e.nodes().forEach(t=>yb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(yb),Object.hasOwn(r,"x")&&yb(r)})}function yb(e){let t=e.x;e.x=e.y,e.y=t}function Oce(e,t=null){let n={},r=e.nodes().filter(d=>!e.children(d).length),o=r.map(d=>e.node(d).rank),i=Ds(Math.max,o),l=gf(i+1).map(()=>[]);function c(d){if(n[d])return;n[d]=!0;let p=e.node(d);l[p.rank].push(d);let g=e.successors(d);g&&[...g].sort((y,v)=>f(y,v)).forEach(c)}r.sort((d,p)=>e.node(d).rank-e.node(p).rank).forEach(c);function f(d,p){let g=e.node(d),y=e.node(p);return $z(t,g,y)}return l}function Mce(e,t){let n=0;for(let r=1;r<t.length;++r)n+=kce(e,t[r-1],t[r]);return n}function kce(e,t,n){let r=$le(n,n.map((d,p)=>p)),o=t.flatMap(d=>{let p=e.outEdges(d);return p?p.map(g=>({pos:r[g.w],weight:e.edge(g).weight})).sort((g,y)=>g.pos-y.pos):[]}),i=1;for(;i<n.length;)i<<=1;let l=2*i-1;i-=1;let c=new Array(l).fill(0),f=0;return o.forEach(d=>{let p=d.pos+i;c[p]+=d.weight;let g=0;for(;p>0;)p%2&&(g+=c[p+1]),p=p-1>>1,c[p]+=d.weight;f+=d.weight*g}),f}function Ace(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,l)=>{let c=e.edge(l),f=e.node(l.v);return{sum:i.sum+c.weight*f.order,weight:i.weight+c.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Dce(e,t){let n={};e.forEach((o,i)=>{let l={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(l.barycenter=o.barycenter,l.weight=o.weight),n[o.v]=l}),t.edges().forEach(o=>{let i=n[o.v],l=n[o.w];i!==void 0&&l!==void 0&&(l.indegree++,i.out.push(l))});let r=Object.values(n).filter(o=>!o.indegree);return Pce(r)}function Pce(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Ice(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>rg(o,["vs","i","barycenter","weight"]))}function Ice(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function zce(e,t,n,r,o){let i={},l=null,c=null,f=o;typeof t=="boolean"?(f=t,i={}):t&&(i=t,l=n??null,c=r??null);let d=Ile(e,_=>Object.hasOwn(_,"barycenter")),p=d.lhs,g=d.rhs.sort((_,j)=>j.i-_.i),y=[],v=0,x=0,E=0;p.sort(Lce(c,l,!!f));for(let[_,j]of Object.entries(i)){let R=p.findIndex(N=>N.vs[0]===_);p.splice(R+1,0,j)}E=AO(y,g,E),p.forEach(_=>{E+=_.vs.length,y.push(_.vs),v+=_.barycenter*_.weight,x+=_.weight,E=AO(y,g,E)});let S={vs:y.flat(1)};return x&&(S.barycenter=v/x,S.weight=x),S}function AO(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Lce(e,t,n){return(r,o)=>{if(r.barycenter<o.barycenter)return-1;if(r.barycenter>o.barycenter)return 1;if(e&&(typeof r.vs[0]=="string"||typeof o.vs[0]=="string")){let i=e.node(r.vs[0]),l=e.node(o.vs[0]),c=$z(t,i,l);if(c!==0)return c}return n?o.i-r.i:r.i-o.i}}function Gz(e,t,n,r,o){var i,l,c,f,d,p,g,y,v,x,E;let S=null,_=o;typeof r=="boolean"?(_=r,S=null):r!==void 0&&(S=r);let j=e.children(t),R=e.node(t),N=R?R.borderLeft:void 0,O=R?R.borderRight:void 0,k={};N&&(j=j.filter(V=>V!==N&&V!==O));let M=Ace(e,j);M.forEach(V=>{if(e.children(V.v).length){let{result:q}=Gz(e,V.v,n,S,_);k[V.v]=q,Object.hasOwn(q,"barycenter")&&Fce(V,q)}});let T=Dce(M,n);$ce(T,k);let L={},G=!1;for(let V=0;V<T.length;V++)for(let q=V+1;q<T.length;q++)if(!(!T[V]||!T[q]||!((i=T[V])!=null&&i.barycenter)||!((l=T[q])!=null&&l.barycenter))&&((c=T[V])==null?void 0:c.barycenter)===T[q].barycenter){let I=(d=(f=T[V])==null?void 0:f.vs[0])!=null?d:"",z=(g=(p=T[q])==null?void 0:p.vs[0])!=null?g:"",A=e.node(I),P=e.node(z);if(A.dummy==="edge"&&P.dummy==="edge"&&((y=A.edgeObj)==null?void 0:y.v)===((v=P.edgeObj)==null?void 0:v.v)&&((x=A.edgeObj)==null?void 0:x.w)===((E=P.edgeObj)==null?void 0:E.w))if(A.edgeLabel.reversed){L[z]=T[V],T.splice(V,1),V--;break}else L[I]=T[q],T.splice(q,1),q--;else G=!0}let B=zce(T,L,S,e,_);if(N&&O){B.vs=[N,B.vs,O].flat(1);let V=e.predecessors(N);if(V&&V.length){let q=e.node(V[0]),I=e.predecessors(O),z=e.node(I[0]);Object.hasOwn(B,"barycenter")||(B.barycenter=0,B.weight=0),B.barycenter=(B.barycenter*B.weight+q.order+z.order)/(B.weight+2),B.weight+=2}}return Object.defineProperty(B,"result",{value:B,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(B,"usedBias",{value:G,enumerable:!1,configurable:!0,writable:!0}),B}function $ce(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function Fce(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Vce(e,t,n,r){r||(r=e.nodes());let o=Uce(e),i=new vs({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(l=>e.node(l));return r.forEach(l=>{let c=e.node(l),f=e.parent(l);if(c.rank===t||c.minRank<=t&&t<=c.maxRank){i.setNode(l),i.setParent(l,f||o);let d=e[n](l);d&&d.forEach(p=>{let g=p.v===l?p.w:p.v,y=i.edge(g,l),v=y!==void 0?y.weight:0;i.setEdge(g,l,{weight:e.edge(p).weight+v})}),Object.hasOwn(c,"minRank")&&i.setNode(l,{borderLeft:c.borderLeft[t],borderRight:c.borderRight[t]})}}),i}function Uce(e){let t;for(;e.hasNode(t=CE("_root")););return t}function Hce(e,t,n){let r={},o;n.forEach(i=>{let l=e.parent(i),c,f;for(;l;){if(c=e.parent(l),c?(f=r[c],r[c]=l):(f=o,o=l),f&&f!==l){t.setEdge(f,l);return}l=c}})}function Kz(e,t={},n=null){if(typeof t.customOrder=="function"){t.customOrder(e,Kz);return}let r=zz(e),o=DO(e,gf(1,r+1),"inEdges"),i=DO(e,gf(r-1,-1,-1),"outEdges"),l=Oce(e,n);if(PO(e,l),t.disableOptimalOrderHeuristic)return;let c=Number.POSITIVE_INFINITY,f,d=t.constraints||[];for(let p=0,g=0;g<4;++p,++g){Bce(p%2?o:i,p%4>=2,d,n),l=Wf(e);let y=Mce(e,l);y<c?(g=0,f=Object.assign({},l),c=y):y===c&&(f=structuredClone(l))}PO(e,f)}function DO(e,t,n){let r=new Map,o=(i,l)=>{r.has(i)||r.set(i,[]),r.get(i).push(l)};for(let i of e.nodes()){let l=e.node(i);if(typeof l.rank=="number"&&o(l.rank,i),typeof l.minRank=="number"&&typeof l.maxRank=="number")for(let c=l.minRank;c<=l.maxRank;c++)c!==l.rank&&o(c,i)}return t.map(function(i){return Vce(e,i,n,r.get(i)||[])})}function Bce(e,t,n,r){let o=!0,i=new vs;e.forEach(function(l){n.forEach(p=>i.setEdge(p.left,p.right));let c=l.graph().root,{result:f,usedBias:d}=Gz(l,c,i,r,o);t&&d&&(o=!o),f.vs.forEach((p,g)=>l.node(p).order=g),Hce(l,i,f.vs)})}function PO(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function qce(e,t){let n={};function r(o,i){let l=0,c=0,f=o.length,d=i[i.length-1];return i.forEach((p,g)=>{let y=Zce(e,p),v=y?e.node(y).order:f;(y||p===d)&&(i.slice(c,g+1).forEach(x=>{let E=e.predecessors(x);E&&E.forEach(S=>{let _=e.node(S),j=_.order;(j<l||v<j)&&!(_.dummy&&e.node(x).dummy)&&Xz(n,S,x)})}),c=g+1,l=v)}),i}return t.length&&t.reduce(r),n}function Yce(e,t){let n={};function r(i,l,c,f,d){gf(l,c).forEach(p=>{let g=i[p];if(g!==void 0&&e.node(g).dummy){let y=e.predecessors(g);y&&y.forEach(v=>{if(v===void 0)return;let x=e.node(v);x.dummy&&(x.order<f||x.order>d)&&Xz(n,v,g)})}})}function o(i,l){let c=-1,f=-1,d=0;return l.forEach((p,g)=>{if(e.node(p).dummy==="border"){let y=e.predecessors(p);if(y&&y.length){let v=y[0];if(v===void 0)return;f=e.node(v).order,r(l,d,g,c,f),d=g,c=f}}r(l,d,l.length,f,i.length)}),l}return t.length&&t.reduce(o),n}function Zce(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function Xz(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Gce(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Kce(e,t,n,r,o){let i={},l={},c={};return t.forEach(f=>{f.forEach((d,p)=>{i[d]=d,l[d]=d,c[d]=p})}),t.forEach(f=>{let d=-1,p=-1,g=!1,y=f,v=f.findIndex(x=>o?.includes(x)||IO(x,e,o));v>0&&(y=[f[v],...f.slice(0,v),...f.slice(v+1)],g=!0),y.forEach(x=>{var E;let S=r(x);if(S&&S.length){o!=null&&o.includes(x)&&(S=S.filter(R=>IO(R,e,o)));let _=S.sort((R,N)=>{let O=c[R],k=c[N];return(O!==void 0?O:0)-(k!==void 0?k:0)}),j=(_.length-1)/2;for(let R=Math.floor(j),N=Math.ceil(j);R<=N;++R){let O=_[R];if(O===void 0)continue;let k=c[O];if(k!==void 0&&l[x]===x&&d<k&&c[O]!==p&&!Gce(n,x,O)){let M=i[O];M!==void 0&&(l[O]=x,l[x]=i[x]=M,d=k,g&&(d=-1,p=(E=c[O])!=null?E:-1,g=!1))}}}})}),{root:i,align:l}}function Xce(e,t,n,r,o=!1){let i={},l=Qce(e,t,n,o),c=o?"borderLeft":"borderRight";function f(v,x){let E=l.nodes().slice(),S={},_=E.pop();for(;_;){if(S[_])v(_);else{S[_]=!0,E.push(_);for(let j of x(_))E.push(j)}_=E.pop()}}function d(v){let x=l.inEdges(v);x?i[v]=x.reduce((E,S)=>{var _;let j=(_=i[S.v])!=null?_:0,R=l.edge(S);return Math.max(E,j+(R!==void 0?R:0))},0):i[v]=0}function p(v){let x=l.outEdges(v),E=Number.POSITIVE_INFINITY;x&&(E=x.reduce((_,j)=>{let R=i[j.w],N=l.edge(j);return Math.min(_,(R!==void 0?R:0)-(N!==void 0?N:0))},Number.POSITIVE_INFINITY));let S=e.node(v);E!==Number.POSITIVE_INFINITY&&S.borderType!==c&&(i[v]=Math.max(i[v]!==void 0?i[v]:0,E))}function g(v){return l.predecessors(v)||[]}function y(v){return l.successors(v)||[]}return f(d,g),f(p,y),Object.keys(r).forEach(v=>{var x;let E=n[v];E!==void 0&&(i[v]=(x=i[E])!=null?x:0)}),i}function Qce(e,t,n,r){let o=new vs,i=e.graph(),l=nue(i.nodesep,i.edgesep,r);return t.forEach(c=>{let f;c.forEach(d=>{let p=n[d];if(p!==void 0){if(o.setNode(p),f!==void 0){let g=n[f];if(g!==void 0){let y=o.edge(g,p);o.setEdge(g,p,Math.max(l(e,d,f),y||0))}}f=d}})}),o}function Wce(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([c,f])=>{let d=rue(e,c)/2;o=Math.max(f+d,o),i=Math.min(f-d,i)});let l=o-i;return l<n[0]&&(n=[l,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function Jce(e,t){let n=Object.values(t),r=Ds(Math.min,n),o=Ds(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(l=>{let c=i+l,f=e[c];if(!f||f===t)return;let d=Object.values(f),p=r-Ds(Math.min,d);l!=="l"&&(p=o-Ds(Math.max,d)),p&&(e[c]=dy(f,g=>g+p))})})}function eue(e,t=void 0){let n=e.ul;return n?dy(n,(r,o)=>{var i,l;if(t){let f=t.toLowerCase(),d=e[f];if(d&&d[o]!==void 0)return d[o]}let c=Object.values(e).map(f=>{let d=f[o];return d!==void 0?d:0}).sort((f,d)=>f-d);return(((i=c[1])!=null?i:0)+((l=c[2])!=null?l:0))/2}):{}}function tue(e,t){let n=Wf(e),r=Object.assign(qce(e,n),Yce(e,n)),o={},i;["u","d"].forEach(c=>{i=c==="u"?n:Object.values(n).reverse(),["l","r"].forEach(f=>{f==="r"&&(i=i.map(g=>Object.values(g).reverse()));let d=Kce(e,i,r,g=>(c==="u"?e.predecessors(g):e.successors(g))||[],t),p=Xce(e,i,d.root,d.align,f==="r");f==="r"&&(p=dy(p,g=>-g)),o[c+f]=p})});let l=Wce(e,o);return Jce(o,l),eue(o,e.graph().align)}function nue(e,t,n){return(r,o,i)=>{let l=r.node(o),c=r.node(i),f=0,d;if(f+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=-l.width/2;break;case"r":d=l.width/2;break}if(d&&(f+=n?d:-d),d=void 0,f+=(l.dummy?t:e)/2,f+=(c.dummy?t:e)/2,f+=c.width/2,Object.hasOwn(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":d=c.width/2;break;case"r":d=-c.width/2;break}return d&&(f+=n?d:-d),f}}function rue(e,t){return e.node(t).width}function IO(e,t,n){var r;if(!n)return!1;let o=(r=t.node(e))==null?void 0:r.edgeObj;if(!o||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(o?.v),l=n.indexOf(o?.w);return i!==-1&&l!==-1&&i===(l+1)%n.length||i===(l-1)%n.length}function oue(e,t){e=Pz(e),sue(e),Object.entries(tue(e,t)).forEach(([n,r])=>e.node(n).x=r)}function sue(e){let t=Wf(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(l=>{let c=l.reduce((f,d)=>{var p;let g=(p=e.node(d).height)!=null?p:0;return f>g?f:g},0);l.forEach(f=>{let d=e.node(f);o==="top"?d.y=i+d.height/2:o==="bottom"?d.y=i+c-d.height/2:d.y=i+c/2}),i+=c+r})}var zO=new WeakMap;function iue(e,t={}){return Qz(e,Lz,t),e}function LO(e,t,n){let r=t;for(;r!==void 0;){let o=e.parent(r);if(o===n)return r;r=o}}function Qz(e,t,n){var r;let o=e.nodes().filter(j=>e.children(j).length),i={};o.forEach(j=>{let R=e.node(j);if(R&&R.rankdir){let N=new vs({multigraph:!0,compound:!0});N.setGraph({rankdir:R.rankdir});let O=e.children(j);O.forEach(I=>{let z={...e.node(I)};N.setNode(I,z);let A=e.parent(I);A&&A!==j&&O.includes(A)&&N.setParent(I,A)});let k=new Set;e.edges().forEach(I=>{let z=LO(e,I.v,j),A=LO(e,I.w,j);if(z&&A&&z!==A){let P=`${z}\0${A}`;k.has(P)||(k.add(P),N.setEdge(z,A,{...e.edge(I)}))}}),Qz(N,t,n);let M=UO(N);$O(M,t,n,null),FO(N,M);let T=1/0,L=1/0,G=-1/0,B=-1/0;N.nodes().forEach(I=>{if(I===j)return;let z=N.node(I);z&&typeof z.x=="number"&&typeof z.y=="number"&&typeof z.width=="number"&&typeof z.height=="number"&&(T=Math.min(T,z.x-z.width/2),G=Math.max(G,z.x+z.width/2),L=Math.min(L,z.y-z.height/2),B=Math.max(B,z.y+z.height/2))}),(!isFinite(T)||!isFinite(L)||!isFinite(G)||!isFinite(B))&&(T=L=0,G=B=0);let V=G-T,q=B-L;i[j]={minX:T,minY:L,maxX:G,maxY:B,width:V,height:q,offsetX:T,offsetY:L},R._dagreClusterSubgraph=N}});let l=[],c=j=>{let R=[],N=(e.children(j)||[]).filter(O=>O!==j);for(;N.length>0;){let O=N.shift();R.push(O),(e.children(O)||[]).filter(k=>k!==O).forEach(k=>N.push(k))}return R},f=new Map;o.forEach(j=>{let R=e.node(j);R&&R.rankdir&&i[j]&&f.set(j,(e.children(j)||[]).filter(N=>N!==j))});let d=new Set([...f.values()].flat()),p=new Map;f.forEach((j,R)=>{d.has(R)||p.set(R,c(R))});let g=new Set([...p.values()].flat()),y=j=>{for(let[R,N]of p)if(N.includes(j))return R;return j},v=[];e.edges().forEach(j=>{(g.has(j.v)||g.has(j.w))&&v.push({edge:j,label:e.edge(j)})});let x=new Map;g.forEach(j=>{let R=e.parent(j);x.set(j,typeof R=="string"?R:void 0)}),p.forEach((j,R)=>{let N=e.node(R),O=[];j.forEach(T=>{let L=e.node(T);L&&(O.push({id:T,node:L,parent:x.get(T)}),e.removeNode(T))});let k=v.filter(({edge:T})=>j.includes(T.v)||j.includes(T.w)),M=i[R];N&&(l.push({clusterId:R,subgraph:N._dagreClusterSubgraph,bounds:M,children:j,removedNodes:O,removedEdges:k}),N.width=M.width,N.height=M.height)});let E=new Set;v.forEach(({edge:j,label:R})=>{let N=y(j.v),O=y(j.w);if(N!==O&&e.hasNode(N)&&e.hasNode(O)){let k=`${N}\0${O}`;E.has(k)||(E.add(k),e.setEdge(N,O,{...R,width:0,height:0}))}});let S=UO(e),_=$O(S,t,n,(r=zO.get(e))!=null?r:null);zO.set(e,_),FO(e,S),E.forEach(j=>{let R=j.indexOf("\0"),N=j.slice(0,R),O=j.slice(R+1);e.hasEdge(N,O)&&e.removeEdge(N,O)}),l.forEach(({clusterId:j,subgraph:R,bounds:N,removedNodes:O,removedEdges:k})=>{var M,T;let L=e.node(j),G=(M=L?.x)!=null?M:0,B=(T=L?.y)!=null?T:0,V=(N.minX+N.maxX)/2,q=(N.minY+N.maxY)/2;O.forEach(({id:I,node:z,parent:A})=>{e.setNode(I,z),A!==void 0&&e.setParent(I,A)}),k.forEach(({edge:I,label:z})=>{e.setEdge(I,z)}),R.nodes().forEach(I=>{if(I===j)return;let z=R.node(I),A=e.node(I);A&&z&&typeof z.x=="number"&&typeof z.y=="number"&&(A.x=G+(z.x-V),A.y=B+(z.y-q))}),delete L._dagreClusterSubgraph}),o.forEach(j=>{var R,N;let O=e.node(j),k=i[j];if(O&&O.rankdir&&O._dagreClusterSubgraph&&k){let M=O._dagreClusterSubgraph,T=(R=O.x)!=null?R:0,L=(N=O.y)!=null?N:0,G=(k.minX+k.maxX)/2,B=(k.minY+k.maxY)/2;M.nodes().forEach(V=>{if(V===j)return;let q=M.node(V),I=e.node(V);if(I&&q&&typeof q.x=="number"&&typeof q.y=="number"){let z=q.x-G,A=q.y-B;I.x=T+z,I.y=L+A}}),delete O._dagreClusterSubgraph}})}function $O(e,t,n,r=null){var o,i;let l=n?.useDynamic!==!1,c=l&&(o=r?.graph)!=null?o:null,f=l&&(i=r?.rawNodes)!=null?i:null;t(" makeSpaceForEdgeLabels",()=>pue(e)),t(" removeSelfEdges",()=>Eue(e)),t(" acyclic",()=>Kle(e,c)),t(" nestingGraph.run",()=>bce(e)),t(" rank",()=>fce(Pz(e))),t(" injectEdgeLabelProxies",()=>mue(e)),t(" removeEmptyRanks",()=>Dle(e)),t(" nestingGraph.cleanup",()=>Ece(e)),t(" normalizeRanks",()=>Ale(e)),t(" assignRankMinMax",()=>gue(e)),t(" removeEdgeLabelProxies",()=>yue(e)),t(" normalize.run",()=>Jle(e)),t(" parentDummyChains",()=>gce(e)),t(" addBorderSegments",()=>Cce(e)),t(" order",()=>Kz(e,n,f)),t(" insertSelfEdges",()=>Cue(e)),t(" adjustCoordinateSystem",()=>Rce(e)),t(" position",()=>oue(e,n.corePath)),t(" positionSelfEdges",()=>_ue(e));let d=JSON.parse(JSON.stringify(e._nodes));return t(" removeBorderNodes",()=>Sue(e)),t(" normalize.undo",()=>tce(e)),t(" fixupEdgeLabelCoords",()=>bue(e)),t(" undoCoordinateSystem",()=>jce(e)),t(" translateGraph",()=>vue(e)),t(" assignNodeIntersects",()=>xue(e)),t(" reversePoints",()=>wue(e)),t(" acyclic.undo",()=>Qle(e)),{graph:e,rawNodes:d}}function FO(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var aue=["nodesep","edgesep","ranksep","marginx","marginy"],lue={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},cue=["acyclicer","ranker","rankdir","align","rankalign"],uue=["width","height","rank"],VO={width:0,height:0},due=["minlen","weight","width","height","labeloffset"],fue={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},hue=["labelpos"];function UO(e){let t=new vs({multigraph:!0,compound:!0}),n=xb(e.graph());return t.setGraph(Object.assign({},lue,vb(n,aue),rg(n,cue))),e.nodes().forEach(r=>{let o=xb(e.node(r)),i=vb(o,uue);Object.keys(VO).forEach(c=>{i[c]===void 0&&(i[c]=VO[c])}),t.setNode(r,i);let l=e.parent(r);l!==void 0&&t.setParent(r,l)}),e.edges().forEach(r=>{let o=xb(e.edge(r));t.setEdge(r,Object.assign({},fue,vb(o,due),rg(o,hue)))}),t}function pue(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{var r;let o=e.edge(n);o.minlen*=2,((r=o.labelpos)!=null?r:"r").toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?o.width+=o.labeloffset:o.height+=o.labeloffset)})}function mue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};Eu(e,"edge-proxy",o,"_ep")}})}function gue(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function yue(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function vue(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),l=i.marginx||0,c=i.marginy||0;function f(d){let p=d.x,g=d.y,y=d.width,v=d.height;t=Math.min(t,p-y/2),n=Math.max(n,p+y/2),r=Math.min(r,g-v/2),o=Math.max(o,g+v/2)}e.nodes().forEach(d=>f(e.node(d))),e.edges().forEach(d=>{let p=e.edge(d);Object.hasOwn(p,"x")&&f(p)}),t-=l,r-=c,e.nodes().forEach(d=>{let p=e.node(d);p.x-=t,p.y-=r}),e.edges().forEach(d=>{let p=e.edge(d);p.points.forEach(g=>{g.x-=t,g.y-=r}),Object.hasOwn(p,"x")&&(p.x-=t),Object.hasOwn(p,"y")&&(p.y-=r)}),i.width=n-t+l,i.height=o-r+c}function xue(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,l;n.points?(i=n.points[0],l=n.points[n.points.length-1]):(n.points=[],i=o,l=r),n.points.unshift(RO(r,i)),n.points.push(RO(o,l))})}function bue(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function wue(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Sue(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),l=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(l.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Eue(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Cue(e){Wf(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);typeof i.rank!="number"&&(i.rank=0),i.order=o+n,(i.selfEdges||[]).forEach(l=>{Eu(e,"selfedge",{width:l.label.width,height:l.label.height,rank:i.rank,order:o+ ++n,e:l.e,edgeLabel:l.label},"_se"),(!Array.isArray(l.label.points)||l.label.points.length!==7)&&(l.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function _ue(e){e.nodes().forEach(t=>{let n=e.node(t),r=o=>typeof o=="number"&&isFinite(o);if(n.dummy==="selfedge"){let o=n,i=e.node(o.e.v),l=r(i?.x)?i.x:0,c=r(i?.y)?i.y:0,f=r(i?.width)?i.width:0,d=r(i?.height)?i.height:0,p=r(n.x)?n.x:l,g=r(n.y)?n.y:c,y=f/2,v=d/2;o.edgeLabel.points=[{x:p+y,y:g-v},{x:p+y,y:g-v},{x:p,y:g},{x:p-y,y:g+v},{x:p-y,y:g+v},{x:p,y:g},{x:p,y:g}],o.edgeLabel.x=p,o.edgeLabel.y=g,e.setEdge(o.e,o.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(o=>{if(!Array.isArray(o.label.points)||o.label.points.length!==7){let i=r(n.x)?n.x:0,l=r(n.y)?n.y:0,c=r(n.width)?n.width:0,f=r(n.height)?n.height:0,d=c/2,p=f/2;o.label.points=[{x:i+d,y:l-p},{x:i+d,y:l-p},{x:i,y:l},{x:i-d,y:l+p},{x:i-d,y:l+p},{x:i,y:l},{x:i,y:l}]}})})}function vb(e,t){return dy(rg(e,t),Number)}function xb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Rue(e){let t=Wf(e),n=new vs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((l,c)=>(n.setEdge(l,c,{style:"invis"}),c))}),n}var jue={graphlib:jz,version:Fle,layout:iue,debug:Rue,util:{time:zle,notime:Lz}},HO=jue;const Nue=200,Tue=64;function Wz(e,t){const n=new HO.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,marginx:40,marginy:40}),n.setDefaultEdgeLabel(()=>({}));for(const o of e)n.setNode(o.id,{width:Nue,height:Tue});for(const o of t)n.setEdge(o.from,o.to);HO.layout(n);const r={};for(const o of e){const i=n.node(o.id);i&&(r[o.id]={x:i.x-i.width/2,y:i.y-i.height/2})}return r}function BO(e,t,n){const r=n&&e.every(o=>n[o.id])?n:Wz(e,t);return e.map(o=>({id:o.id,type:"dagNode",position:r[o.id]??{x:0,y:0},data:{node:o}}))}const Jz={type:"smoothstep",markerEnd:{type:ff.ArrowClosed,width:18,height:18}};function Gp(e){return e.map(t=>{const n={id:`${t.from}->${t.to}`,source:t.from,target:t.to,label:t.condition??void 0,...Jz};return t.pausePoint?{...n,type:"pause",data:{pausePoint:t.pausePoint}}:n})}function Oue(e,t,n,r){const o={};for(const l of e)o[l.id]={x:l.position.x,y:l.position.y};const i=t.map(l=>r.find(f=>f.from===l.source&&f.to===l.target)??{from:l.source,to:l.target});return{nodes:n,edges:i,layout:o}}function Mue(e){return!e.source||!e.target?!1:e.source!==e.target}const kue={dagNode:rle},Aue={pause:ole};function qO({nodes:e,edges:t,readOnly:n,onNodesChange:r,onEdgesChange:o,onConnect:i,onNodeClick:l,onEdgeClick:c,onPaneClick:f}){const d=b.useCallback(p=>Mue({source:p.source,target:p.target}),[]);return h.jsx("div",{className:"h-full w-full",children:h.jsxs(cae,{nodes:e,edges:t,nodeTypes:kue,edgeTypes:Aue,nodesDraggable:!n,nodesConnectable:!n,nodesFocusable:!n,edgesFocusable:!n,edgesReconnectable:!n,deleteKeyCode:n?null:"Backspace",onNodesChange:r,onEdgesChange:o,onConnect:i,isValidConnection:d,onNodeClick:l,onEdgeClick:c,...f!==void 0?{onPaneClick:f}:{},fitView:!0,fitViewOptions:{padding:.2},children:[h.jsx(vae,{variant:bi.Dots,gap:20}),h.jsx(_ae,{}),h.jsx($ae,{pannable:!0,zoomable:!0})]})})}function Due({edge:e,onConditionChange:t,onPausePointChange:n,onDelete:r,onClose:o}){const i=Xn("pause_type").filter(f=>f.active),l=f=>i.find(d=>d.value===f)?.label??f;if(!e)return null;const c=e.pausePoint;return h.jsxs("div",{role:"region","aria-label":"边编辑",className:"absolute top-3 right-3 z-10 w-64 rounded-lg border border-border bg-card p-3 shadow-md",children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:["边 ",h.jsx("span",{className:"font-mono",children:e.from})," → ",h.jsx("span",{className:"font-mono",children:e.to})]}),h.jsx("button",{type:"button","aria-label":"关闭边编辑",className:"text-muted-foreground hover:text-foreground",onClick:o,children:"✕"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(kr,{htmlFor:"edge-condition",children:"条件(可选)"}),h.jsx(ln,{id:"edge-condition",placeholder:"如 backend / ui / always",value:e.condition??"",onChange:f=>t(f.target.value)}),c?h.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-warning/30 bg-warning/5 p-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-medium text-warning",children:"暂停点"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>n(void 0),children:"摘除"})]}),h.jsxs(br,{value:c.type,onValueChange:f=>{f!==null&&n({...c,type:f})},children:[h.jsx(wr,{className:"text-xs",children:l(c.type)}),h.jsx(Sr,{children:i.map(f=>h.jsx(Bn,{value:f.value,children:f.label},f.value))})]}),h.jsx(ln,{className:"text-xs",value:c.description,placeholder:"暂停点描述",onChange:f=>n({...c,description:f.target.value})}),h.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[h.jsx("input",{type:"checkbox",checked:c.autoResume,onChange:f=>n({...c,autoResume:f.target.checked})}),"自动恢复(checkpoint)"]})]}):h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>n({type:"human_approval",description:`请审批 ${e.from} 的产出`,autoResume:!1}),children:"⏸ 在此边挂暂停点"}),h.jsx("div",{className:"mt-1 border-t border-border pt-2",children:h.jsx(ke,{type:"button",variant:"ghost",size:"sm","aria-label":"删除边",className:"h-6 px-2 text-xs text-destructive hover:text-destructive",onClick:r,children:"删除边"})})]})]})}const _d=[{key:"info",label:"信息"},{key:"prompt",label:"Prompt"}];function YO(e){const n=Xn(e).filter(o=>o.active),r=new Map(n.map(o=>[o.value,o.label]));return{values:n.map(o=>o.value),getLabel:o=>r.get(o)??o}}function eL({node:e,open:t,onOpenChange:n,onChange:r,onDelete:o,onRename:i}){const[l,c]=b.useState("info"),[f,d]=b.useState(""),[p,g]=b.useState(!1),y=YO("dag_phase"),v=YO("dag_track");return b.useEffect(()=>{c("info"),d(e?.id??"")},[e?.id,t]),e?h.jsx(us,{open:t,onOpenChange:n,children:h.jsxs(ds,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-5xl flex-col gap-4 sm:max-w-none",children:[h.jsxs(fs,{children:[h.jsx(hs,{className:"font-mono text-base",children:e.id}),h.jsx(ps,{children:"编辑节点属性(保存模板时生效)"})]}),h.jsx("div",{className:"flex shrink-0 gap-1 rounded-md bg-muted p-1",role:"tablist","aria-label":"节点属性分区",onKeyDown:x=>{if(x.key!=="ArrowRight"&&x.key!=="ArrowLeft")return;x.preventDefault();const E=_d.findIndex(j=>j.key===l),S=x.key==="ArrowRight"?1:-1,_=_d[(E+S+_d.length)%_d.length];_&&(c(_.key),document.getElementById(`node-tab-${_.key}`)?.focus())},children:_d.map(x=>h.jsx("button",{type:"button",role:"tab",id:`node-tab-${x.key}`,"aria-selected":l===x.key,"aria-controls":`node-tabpanel-${x.key}`,tabIndex:l===x.key?0:-1,className:`flex-1 rounded px-2 py-1.5 text-sm transition ${l===x.key?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>c(x.key),children:x.label},x.key))}),h.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",role:"tabpanel",id:`node-tabpanel-${l}`,"aria-labelledby":`node-tab-${l}`,children:[l==="info"&&h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(kr,{htmlFor:"node-label",children:"名称"}),h.jsx(ln,{id:"node-label",value:e.label,onChange:x=>r({label:x.target.value})})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(kr,{htmlFor:"node-id",children:"ID(重命名会级联更新连线与暂停点)"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ln,{id:"node-id",className:"font-mono",value:f,onChange:x=>d(x.target.value)}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:!f||f===e.id,onClick:()=>i(f.trim()),children:"重命名"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(kr,{htmlFor:"node-phase",children:"阶段"}),h.jsxs(br,{value:e.phase,onValueChange:x=>{x!==null&&r({phase:x})},children:[h.jsx(wr,{id:"node-phase",children:y.getLabel(e.phase)}),h.jsx(Sr,{children:y.values.map(x=>h.jsx(Bn,{value:x,children:y.getLabel(x)},x))})]})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(kr,{htmlFor:"node-track",children:"轨道"}),h.jsxs(br,{value:e.track,onValueChange:x=>{x!==null&&r({track:x})},children:[h.jsx(wr,{id:"node-track",children:v.getLabel(e.track)}),h.jsx(Sr,{children:v.values.map(x=>h.jsx(Bn,{value:x,children:v.getLabel(x)},x))})]})]})]})]}),l==="prompt"&&h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(kr,{htmlFor:"node-prompt",children:"节点 Prompt"}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["支持 ","{{task.title}}"," 等模板变量"]})]}),h.jsx(of,{id:"node-prompt",value:e.prompt,onChange:x=>r({prompt:x.target.value})})]})]}),h.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border pt-3",children:[h.jsx(ke,{type:"button",variant:"destructive",size:"sm",onClick:()=>g(!0),children:"删除节点"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>n(!1),children:"关闭"})]}),h.jsx(Ri,{open:p,onOpenChange:g,title:`删除节点 ${e.id}?`,description:"将级联删除其所有连线与关联暂停点,保存模板后生效。",confirmText:"删除",destructive:!0,onConfirm:()=>{g(!1),o(),n(!1)}})]})}):null}function tL(e,t){const[n,r]=b.useState(null),o=b.useCallback(p=>r(p),[]),i=b.useCallback(()=>r(null),[]),l=b.useCallback(p=>{n!==null&&t({nodes:e.nodes.map(g=>g.id===n?{...g,...p}:g),edges:e.edges})},[n,e,t]),c=b.useCallback(p=>{if(n===null||e.nodes.some(y=>y.id===p))return!1;const g=n;return t({nodes:e.nodes.map(y=>y.id===g?{...y,id:p}:y),edges:e.edges.map(y=>({...y,from:y.from===g?p:y.from,to:y.to===g?p:y.to}))},{rename:{oldId:g,newId:p}}),r(p),!0},[n,e,t]),f=b.useCallback(()=>{if(n===null)return;const p=n;t({nodes:e.nodes.filter(g=>g.id!==p),edges:e.edges.filter(g=>g.from!==p&&g.to!==p)},{deleted:p}),r(null)},[n,e,t]),d=e.nodes.find(p=>p.id===n)??null;return{nodes:e.nodes,edges:e.edges,selectedNodeId:n,selectedNode:d,selectNode:o,clearSelection:i,patchNode:l,renameNode:c,deleteNode:f}}function nL(e,t){const{nodes:n,edges:r}=e,{tracks:o,entryPhase:i}=t,l=[],c=new Set(n.map(v=>v.id));if(c.size!==n.length){const v=new Set;for(const x of n)v.has(x.id)&&l.push(`节点 id 重复:${x.id}`),v.add(x.id)}for(const v of r)(!c.has(v.from)||!c.has(v.to))&&l.push(`边 ${v.from} → ${v.to} 指向不存在的节点`);for(const v of r)v.from===v.to&&l.push(`节点 ${v.from} 存在自环`);for(const v of n)o.includes(v.track)||l.push(`节点 ${v.id} 的 track「${v.track}」不是有效的轨道`);const f=v=>v==="mixed"?new Set(["backend","ui","all"]):new Set([v,"all"]);for(const v of o){const x=f(v);for(const E of n){const S=[];for(const j of r){if(j.from!==E.id)continue;const R=n.find(N=>N.id===j.to);R&&x.has(R.track)&&S.push({targetTrack:R.track})}const _=new Map;for(const j of S)_.set(j.targetTrack,(_.get(j.targetTrack)??0)+1);for(const[j,R]of _)R>1&&l.push(`节点 ${E.id} 在 ${v} 轨有 ${R} 条指向 ${j} 的出边(同轨分叉)`)}}const d=new Map;for(const v of r)if(c.has(v.from)&&c.has(v.to)){const x=d.get(v.from)??[];x.push(v.to),d.set(v.from,x)}const p=new Map,g=new Set,y=(v,x)=>{p.set(v,1),x.push(v);for(const E of d.get(v)??[]){const S=p.get(E)??0;if(S===1){const _=x.indexOf(E);for(const j of x.slice(_===-1?0:_))g.add(j);l.push(`检测到环:${[...x.slice(_===-1?0:_),E].join(" → ")}`)}else S===0&&y(E,x)}x.pop(),p.set(v,2)};for(const v of n)(p.get(v.id)??0)===0&&y(v.id,[]);for(const v of o)n.some(E=>(E.track===v||E.track==="all")&&!r.some(S=>S.from===E.id))||l.push(`${v} 轨缺少终端节点`);return n.some(v=>v.phase===i)||l.push(`模板需要至少一个 ${i} 节点`),l}function F0(e){const t=/^(\d+)\.(\d+)\.(\d+)$/.exec(e);return t?`${t[1]}.${t[2]}.${Number(t[3])+1}`:`${e}.1`}function Pue(){const{id:e=""}=Sf(),[t]=cg(),n=t.get("instance"),r=n!==null;jo(r?"流程图 · 司命":"DAG 编辑器 · 司命");const o=Sz(e),i=bz(n??""),l=Xn("dag_track"),c=Xn("node_status"),f=b.useMemo(()=>l.filter(J=>J.active).map(J=>J.value),[l]),d=b.useMemo(()=>c.filter(J=>J.active).map(J=>J.value),[c]),[p,g,y]=fae([]),[v,x,E]=hae([]),[S,_]=b.useState([]),[j,R]=b.useState(!1);b.useEffect(()=>{if(!j&&o.data){const J=o.data;g(BO(J.nodes,J.edges,J.layout)),x(Gp(J.edges)),_(J.edges),R(!0)}},[j,o.data,g,x]);const[N,O]=b.useState(null),[k,M]=b.useState([]),[T,L]=b.useState(!1),G=_z(),B=p.map(J=>J.data.node),V=tL({nodes:B,edges:S},b.useCallback((J,K)=>{g(re=>{const ye=new Map(J.nodes.map(fe=>[fe.id,fe]));if(K?.rename){const{oldId:fe,newId:ue}=K.rename,he=ye.get(ue);if(he)return re.map(Re=>Re.id!==fe?Re:{...Re,id:ue,data:{...Re.data,node:he}})}if(K?.deleted){const fe=K.deleted;return re.filter(ue=>ue.id!==fe)}return re.map(fe=>{const ue=ye.get(fe.id);return ue?{...fe,data:{...fe.data,node:ue}}:fe})}),x(Gp(J.edges)),_(J.edges)},[g,x])),{selectedNodeId:q,selectedNode:I}=V,z=I,A=b.useMemo(()=>{if(N===null)return null;const J=v.find(K=>K.id===N);return J?S.find(K=>K.from===J.source&&K.to===J.target)??{from:J.source,to:J.target}:null},[N,v,S]),P=b.useCallback(J=>{A&&_(K=>{const re=K.findIndex(he=>he.from===A.from&&he.to===A.to);if(re<0)return K;const ye=K[re];if(!ye)return K;const fe=J?{from:ye.from,to:ye.to,pausePoint:J,...ye.condition?{condition:ye.condition}:{}}:{from:ye.from,to:ye.to,...ye.condition?{condition:ye.condition}:{}},ue=K.map((he,Re)=>Re===re?fe:he);return x(Gp(ue)),ue})},[A,x]),U=b.useMemo(()=>{if(!r||!i.data)return null;const J=i.data.dagInstance,K=o.data?.layout,re=BO(J.nodes,J.edges,K).map(fe=>{const ue=J.nodeStates[fe.id]?.status,he=d.find(Re=>Re===ue);return{...fe,data:{...fe.data,...he!==void 0?{instanceStatus:he}:{}}}}),ye=Gp(J.edges).map(fe=>{if(fe.type!=="pause")return fe;const ue=fe.data;if(!ue)return fe;const he=J.nodeStates[fe.source]?.status,Re=J.nodeStates[fe.target]?.status;let ze="pending";return(Re==="active"||Re==="completed")&&he==="completed"?ze="passed":i.data.status==="paused"&&i.data.pausedAt===fe.source&&(ze="awaiting"),{...fe,data:{...ue,pauseState:ze}}});return{nodes:re,edges:ye}},[r,i.data,o.data?.layout,d]),H=b.useCallback(J=>{const{source:K,target:re}=J;K===null||re===null||x(ye=>BI({id:`${K}->${re}`,source:K,target:re,...Jz},ye))},[x]),Y=b.useCallback(J=>{const K=J.filter(re=>re.type==="remove");if(K.length>0){const re=new Set(K.map(ye=>ye.id));_(ye=>ye.filter(fe=>!re.has(`${fe.from}->${fe.to}`)))}E(J)},[E]),$=b.useCallback(J=>{A&&_(K=>{const re=K.findIndex(ue=>ue.from===A.from&&ue.to===A.to),ye=J.trim(),fe={from:A.from,to:A.to};return ye&&(fe.condition=ye),re>=0?K.map((ue,he)=>he===re?fe:ue):[...K,fe]})},[A]),F=b.useCallback(()=>{N!==null&&(Y([{id:N,type:"remove"}]),O(null))},[N,Y]),Q=b.useCallback(()=>{let J=1;for(;p.some(ue=>ue.id===`NODE_${J}`);)J++;const K=`NODE_${J}`,re=p[p.length-1],ye=re?{x:re.position.x+240,y:re.position.y}:{x:0,y:0},fe={id:K,label:`节点 ${J}`,phase:"track",track:"all",prompt:"",skills:[]};g(ue=>[...ue,{id:K,type:"dagNode",position:ye,data:{node:fe}}]),ut.success(`已添加节点 ${K}(点击节点可编辑属性)`)},[p,g]),X=b.useCallback(()=>{const J=p.map(re=>re.data.node),K=Wz(J,S);g(re=>re.map(ye=>({...ye,position:K[ye.id]??ye.position}))),L(!1)},[p,S,g]),ne=b.useCallback(()=>{const J=o.data;if(!J)return;const K=p.map(fe=>fe.data.node),re=Oue(p,v,K,S),ye=nL(re,{tracks:f,entryPhase:"entry"});if(M(ye),ye.length>0){ut.error(`校验未通过(${ye.length} 项),请修复后保存`);return}G.mutate({id:J.id,patch:{nodes:re.nodes,edges:re.edges,layout:re.layout,version:F0(J.version)}},{onSuccess:()=>ut.success(`模板已保存(version ${F0(J.version)})`),onError:fe=>ut.error(Ct(fe))})},[o.data,p,v,S,G,f]),te=r?`流程图 · ${i.data?.title??"…"}`:`DAG 编辑器 · ${o.data?.name??"…"}`;return r?i.isLoading?h.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:h.jsx(Ir,{rows:3,cols:3})}):i.isError?h.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:h.jsx(rr,{message:Ct(i.error),onRetry:()=>{i.refetch()}})}):U?h.jsxs("main",{className:"mx-auto flex h-[calc(100vh-4rem)] w-full max-w-6xl flex-col px-4 py-4",children:[h.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:te}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["只读实例视图(task 快照渲染,模板布局",o.isError?"不可用,已自动排列":"应用中",")"]})]}),h.jsxs(ke,{render:h.jsx(cn,{to:`/tasks/${n??""}`}),nativeButton:!1,variant:"outline",size:"sm",children:[h.jsx(Mc,{"aria-hidden":"true"}),"返回任务"]})]}),o.isError&&h.jsx("p",{className:"mb-3 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",children:"关联模板已被删除或不可访问,画布使用自动布局展示任务快照。"}),i.data?.status==="paused"&&h.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-sm text-warning",children:[h.jsx("span",{"aria-hidden":"true",children:"⏸"}),h.jsxs("span",{children:["任务在此暂停,等待决策:",h.jsx("span",{className:"font-mono",children:i.data.pausedAt??"手动暂停"})]}),h.jsx(cn,{to:`/tasks/${i.data.taskId}`,className:"underline underline-offset-2 hover:text-foreground",children:"前往处理 →"})]}),h.jsxs("div",{className:"mb-3 flex items-center gap-3 text-xs text-muted-foreground","aria-label":"节点状态图例",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"inline-block size-2 rounded-full bg-success","aria-hidden":"true"}),"已完成"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"inline-block size-2 rounded-full bg-primary","aria-hidden":"true"}),"当前节点"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"inline-block size-2 rounded-full bg-muted-foreground/40","aria-hidden":"true"}),"未到达"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"inline-block size-2 rounded-full bg-warning","aria-hidden":"true"}),"暂停点后"]})]}),h.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:h.jsx(qO,{nodes:U.nodes,edges:U.edges,readOnly:!0,onNodesChange:()=>{},onEdgesChange:()=>{},onConnect:()=>{},onNodeClick:()=>{},onEdgeClick:()=>{}})})]}):h.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:h.jsx(tr,{message:"任务数据不完整,无法渲染流程图"})}):o.isLoading?h.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:h.jsx(Ir,{rows:3,cols:3})}):o.isError?h.jsxs("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(rr,{message:Ct(o.error),onRetry:()=>{o.refetch()}}),h.jsx("div",{className:"mt-4 flex justify-center",children:h.jsxs(ke,{render:h.jsx(cn,{to:"/templates"}),nativeButton:!1,variant:"ghost",size:"sm",children:[h.jsx(Mc,{"aria-hidden":"true"}),"返回模板列表"]})})]}):o.data?h.jsxs("main",{className:"mx-auto flex h-[calc(100vh-4rem)] w-full max-w-6xl flex-col px-4 py-4",children:[h.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:te}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:["version ",o.data.version," · ",p.length," 节点 / ",v.length," 边"]})]}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsxs(ke,{render:h.jsx(cn,{to:`/templates/${e}`}),nativeButton:!1,variant:"outline",size:"sm",children:[h.jsx(Mc,{"aria-hidden":"true"}),"返回模板详情"]}),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:Q,children:[h.jsx(gm,{"aria-hidden":"true"}),"添加节点"]}),h.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>L(!0),children:[h.jsx(MV,{"aria-hidden":"true"}),"自动布局"]}),h.jsxs(ke,{type:"button",size:"sm",disabled:G.isPending,onClick:ne,children:[h.jsx(FV,{"aria-hidden":"true"}),G.isPending?"保存中…":"保存"]})]})]}),k.length>0&&h.jsxs("div",{className:"mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[h.jsxs("p",{className:"mb-1 font-medium",children:["校验未通过(",k.length," 项):"]}),h.jsx("ul",{className:"list-disc space-y-0.5 pl-4",children:k.map((J,K)=>h.jsx("li",{children:J},`${K}-${J}`))})]}),h.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:p.length===0?h.jsx(tr,{message:"画布为空,点击「添加节点」开始编排"}):h.jsxs(h.Fragment,{children:[h.jsx(qO,{nodes:p,edges:v,readOnly:!1,onNodesChange:y,onEdgesChange:Y,onConnect:H,onNodeClick:(J,K)=>V.selectNode(K.id),onEdgeClick:(J,K)=>O(K.id),onPaneClick:()=>{V.clearSelection(),O(null)}}),h.jsx(Due,{edge:A,onConditionChange:$,onPausePointChange:P,onDelete:F,onClose:()=>O(null)})]})}),h.jsx(eL,{node:z,open:z!==null,onOpenChange:J=>{J||V.clearSelection()},onChange:J=>V.patchNode(J),onDelete:()=>V.deleteNode(),onRename:J=>{V.renameNode(J)?ut.success(`已重命名为 ${J}(连线与暂停点已级联更新,保存后生效)`):ut.error(`节点 id「${J}」已存在`)}}),h.jsx(Ri,{open:T,onOpenChange:L,title:"应用自动布局",description:"将按拓扑重新排列全部节点,覆盖当前手动布局(保存模板后生效)。",confirmText:"应用",onConfirm:X})]}):h.jsxs("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(tr,{message:"模板不存在"}),h.jsx("div",{className:"mt-4 flex justify-center",children:h.jsxs(ke,{render:h.jsx(cn,{to:"/templates"}),nativeButton:!1,variant:"ghost",size:"sm",children:[h.jsx(Mc,{"aria-hidden":"true"}),"返回模板列表"]})})]})}const Iue=gl({title:Tn().min(1,"标题不能为空").max(80,"标题最长 80 个字符"),projectId:Tn().min(1,"请选择项目"),track:Tn().min(1,"请选择轨道"),templateId:Tn().min(1,"请选择 DAG 模板")});function rL({open:e,projects:t,defaultProjectId:n,onClose:r,onCreate:o}){const i=Ff({resolver:Vf(Iue),defaultValues:{title:"",projectId:"",track:"backend",templateId:""}}),{isSubmitting:l}=i.formState,[c,f]=b.useState(!1),d=Xn("dag_track").filter(E=>E.active&&E.value!=="all"),p=E=>d.find(S=>S.value===E)?.label??E,g=i.watch("projectId"),{data:y=[],isLoading:v}=wz(g,e);b.useEffect(()=>{e&&i.reset({title:"",projectId:n,track:"backend",templateId:""})},[e,n]),b.useEffect(()=>{i.setValue("templateId","",{shouldValidate:!1})},[g]),b.useEffect(()=>{if(e&&i.getValues("templateId").length===0){const E=y[0];E&&i.setValue("templateId",E.id,{shouldValidate:!1})}},[e,y]);const x=async E=>{try{await o({title:E.title.trim(),projectId:E.projectId,track:E.track,dagTemplateId:E.templateId}),r()}catch(S){ut.error(Ct(S))}};return h.jsx(us,{open:e,onOpenChange:E=>{!E&&!l&&r()},children:h.jsxs(ds,{className:"sm:max-w-md",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:"新建任务"}),h.jsx(ps,{className:"sr-only",children:"填写任务信息以启动新的 DAG 执行"})]}),h.jsx(Uf,{...i,children:h.jsxs("form",{onSubmit:i.handleSubmit(x),className:"space-y-4",children:[h.jsx(_n,{control:i.control,name:"title",render:({field:E})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["标题 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...E,placeholder:"例如:实现任务列表页",disabled:l})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:i.control,name:"projectId",render:({field:E})=>{const S=t.find(_=>_.id===E.value);return h.jsxs(Rn,{children:[h.jsxs(jn,{children:["项目 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsxs(br,{value:E.value,onValueChange:_=>{t.some(j=>j.id===_)&&E.onChange(_)},children:[h.jsx(vn,{children:h.jsx(wr,{disabled:l,className:"w-full",children:S?S.name:"选择项目"})}),h.jsx(Sr,{children:t.map(_=>h.jsx(Bn,{value:_.id,children:_.name},_.id))})]}),h.jsx(Nn,{})]})}}),h.jsx(_n,{control:i.control,name:"track",render:({field:E})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"轨道"}),h.jsxs(br,{value:E.value,onValueChange:S=>{S!==null&&d.some(_=>_.value===S)&&E.onChange(S)},children:[h.jsx(vn,{children:h.jsx(wr,{disabled:l,className:"w-full",children:p(E.value)})}),h.jsx(Sr,{children:d.map(S=>h.jsx(Bn,{value:S.value,children:S.label},S.value))})]}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:i.control,name:"templateId",render:({field:E})=>{const S=y.find(_=>_.id===E.value);return h.jsxs(Rn,{children:[h.jsxs(jn,{children:["DAG 模板 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),v?h.jsx(I2,{}):y.length===0?h.jsx(Ug,{message:"该项目暂无模板,请先创建或复制模板到该项目"}):h.jsxs(LS,{open:c,onOpenChange:f,children:[h.jsx($S,{render:h.jsx(vn,{children:h.jsxs(ke,{type:"button",variant:"outline",disabled:l,className:"w-full justify-between font-normal",children:[S?S.name:"选择 DAG 模板…",h.jsx(Cf,{className:"ml-2 size-4 shrink-0 opacity-50"})]})})}),h.jsx(FS,{className:"w-[var(--anchor-width)] p-0",align:"start",children:h.jsxs(QS,{children:[h.jsx(WS,{placeholder:"搜索模板…"}),h.jsxs(JS,{children:[h.jsx(eE,{children:"未找到模板"}),h.jsx(tE,{children:y.map(_=>h.jsxs(nE,{value:_.name,onSelect:j=>{const R=y.find(N=>N.name===j);R&&E.onChange(R.id),f(!1)},children:[_.name,h.jsx(uu,{className:`ml-auto size-4 text-success ${_.id===E.value?"opacity-100":"opacity-0"}`})]},_.id))})]})]})})]}),h.jsx(Nn,{})]})}}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{type:"button",variant:"outline",disabled:l}),children:"取消"}),h.jsx(ke,{type:"submit",disabled:l,children:l?"创建中…":"创建"})]})]})})]})})}const zue={active:{badge:"bg-info/10 text-info",dot:"bg-info"},paused:{badge:"bg-warning/10 text-warning",dot:"bg-warning"},completed:{badge:"bg-success/10 text-success",dot:"bg-success"},cancelled:{badge:"bg-destructive/10 text-destructive",dot:"bg-destructive"}};function NE({status:e}){const n=Xn("task_status").find(o=>o.value===e)?.label??e,r=zue[e]??{badge:"bg-muted text-muted-foreground",dot:"bg-muted"};return h.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${r.badge}`,children:[h.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${r.dot}`}),n]})}const Lue=[{key:"total",dot:"bg-foreground",registryValue:null},{key:"active",dot:"bg-info",registryValue:"active"},{key:"paused",dot:"bg-warning",registryValue:"paused"},{key:"completed",dot:"bg-success",registryValue:"completed"},{key:"cancelled",dot:"bg-destructive",registryValue:"cancelled"}],bc=gu();function $ue(){jo();const{activeProjectId:e,activeProjects:t,bootstrapReady:n,bootstrapError:r,retryBootstrap:o}=cs(),i=co({queryKey:["tasks",e],queryFn:()=>QM(e),enabled:e.length>0,refetchInterval:5e3}),l=Ez(),[c,f]=b.useState(!1),d=Xn("task_status"),p=x=>d.find(E=>E.value===x)?.label??x,g=b.useMemo(()=>{const x=i.data??[],E=S=>x.filter(_=>_.status===S).length;return{total:x.length,active:E("active"),paused:E("paused"),completed:E("completed"),cancelled:E("cancelled")}},[i.data]),y=b.useMemo(()=>(i.data??[]).filter(x=>x.status==="active"||x.status==="paused"),[i.data]),v=b.useMemo(()=>[bc.accessor("taskId",{id:"taskId",header:"ID",cell:x=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:x.getValue()})}),bc.accessor("title",{id:"title",header:"标题",cell:x=>h.jsx(cn,{to:`/tasks/${x.row.original.taskId}`,className:"font-medium text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:x.getValue()})}),bc.accessor("currentNode",{id:"currentNode",header:"当前节点",cell:x=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:x.getValue()})}),bc.accessor("status",{id:"status",header:"状态",cell:x=>h.jsx(NE,{status:x.getValue()})}),bc.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:x=>h.jsx("span",{className:"text-xs text-muted-foreground",children:Lf(x.getValue())}),meta:{initialSortDesc:!0}}),bc.display({id:"actions",header:"操作",cell:({row:x})=>h.jsx(ke,{render:h.jsx(cn,{to:`/tasks/${x.original.taskId}`}),nativeButton:!1,variant:"outline",size:"sm",children:"详情"})})],[]);return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"看板"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"任务统计与活跃任务总览(每 5 秒自动刷新)"})]}),h.jsx(ke,{type:"button",disabled:!n,onClick:()=>f(!0),children:"+ 新建任务"})]}),r?h.jsx(rr,{message:Ct(r),onRetry:o}):!n||i.isLoading?h.jsx(Ir,{rows:4,cols:5}):i.isError?h.jsx(rr,{message:Ct(i.error),onRetry:()=>{i.refetch()}}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5",children:Lue.map(x=>h.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx("span",{className:`size-2 rounded-full ${x.dot}`}),x.registryValue===null?"总任务":p(x.registryValue)]}),h.jsx("p",{className:"mt-2 text-2xl font-bold tabular-nums text-foreground",children:g[x.key]})]},x.key))}),h.jsx("div",{className:"mt-6",children:h.jsx(ha,{title:"活跃任务",children:(i.data?.length??0)===0?h.jsx(tr,{message:"还没有任务,点击「新建任务」创建第一个",actionLabel:"新建任务",onAction:()=>f(!0)}):h.jsx(vu,{columns:v,data:y,pageSize:5,emptySlot:h.jsx(tr,{message:"没有进行中的任务,去「全部任务」查看历史"})})})}),h.jsx("div",{className:"mt-6",children:h.jsx(ha,{title:"快捷入口",children:h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx(ke,{type:"button",onClick:()=>f(!0),children:"+ 新建任务"}),h.jsx(ke,{render:h.jsx(cn,{to:"/templates"}),nativeButton:!1,variant:"outline",children:"新建模板(模板库)"}),h.jsx(ke,{render:h.jsx(cn,{to:"/tasks"}),nativeButton:!1,variant:"outline",children:"查看全部任务"})]})})})]}),h.jsx(rL,{open:c,projects:t,defaultProjectId:e,onClose:()=>f(!1),onCreate:async x=>{await l.mutateAsync(x),ut.success("任务已创建")}})]})}const Fue=gl({code:Tn().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"code 需为 kebab-case(小写字母/数字/中划线)"),name:Tn().min(1,"名称不能为空"),realModel:Tn().min(1,"真实模型不能为空")}),ZO={code:"",name:"",realModel:""};function Vue(){jo();const e=xS(),t=uZ(),n=dZ(),r=fZ(),[o,i]=b.useState(null),[l,c]=b.useState(null),f=Ff({resolver:Vf(Fue),defaultValues:ZO}),{isSubmitting:d}=f.formState;b.useEffect(()=>{o&&f.reset(o.mode==="edit"?{code:o.alias.code,name:o.alias.name,realModel:o.alias.realModel}:ZO)},[o]);const p=async y=>{try{o?.mode==="edit"?(await n.mutateAsync({code:o.alias.code,input:{name:y.name,realModel:y.realModel}}),ut.success("模型映射已更新")):(await t.mutateAsync(y),ut.success("模型映射已创建")),i(null)}catch(v){ut.error(Ct(v))}},g=()=>{l&&r.mutateAsync(l.code).then(()=>{ut.success(`模型映射「${l.name}」已删除`),c(null)}).catch(y=>{ut.error(Ct(y)),c(null)})};return h.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"模型映射"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 模型引用表:code 全局唯一(创建后不可变),Agent.model 存 code,改 realModel 全局生效"})]}),h.jsx(ke,{type:"button",disabled:e.isLoading,onClick:()=>i({mode:"create"}),children:"+ 新建映射"})]}),e.isLoading?h.jsx(Ir,{rows:4,cols:5}):e.isError?h.jsx(rr,{message:Ct(e.error),onRetry:()=>{e.refetch()}}):(e.data?.length??0)===0?h.jsxs("div",{className:"rounded-lg border border-dashed p-10 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"尚未创建任何模型映射。Agent 表单的模型字段依赖映射列表,请先创建至少一条。"}),h.jsx(ke,{type:"button",variant:"outline",className:"mt-4",onClick:()=>i({mode:"create"}),children:"创建第一条映射"})]}):h.jsx("div",{className:"overflow-hidden rounded-lg border",children:h.jsxs(Pf,{children:[h.jsx(If,{children:h.jsxs(so,{children:[h.jsx(Vn,{className:"px-4 py-3",children:"code"}),h.jsx(Vn,{className:"px-4 py-3",children:"名称"}),h.jsx(Vn,{className:"px-4 py-3",children:"真实模型"}),h.jsx(Vn,{className:"px-4 py-3",children:"引用"}),h.jsx(Vn,{className:"px-4 py-3 text-right",children:"操作"})]})}),h.jsx(zf,{children:(e.data??[]).map(y=>h.jsxs(so,{className:"hover:bg-muted/30",children:[h.jsx(Ht,{className:"px-4 py-3 font-mono text-xs",children:y.code}),h.jsx(Ht,{className:"px-4 py-3",children:y.name}),h.jsx(Ht,{className:"px-4 py-3 font-mono text-xs text-muted-foreground",children:y.realModel}),h.jsx(Ht,{className:"px-4 py-3",children:h.jsx(Un,{variant:y.refCount>0?"secondary":"outline",children:y.refCount>0?`${y.refCount} 个 Agent`:"无引用"})}),h.jsx(Ht,{className:"px-4 py-3 text-right",children:h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>i({mode:"edit",alias:y}),children:"编辑"}),h.jsx("span",{className:"inline-flex",title:y.refCount>0?`被 ${y.refCount} 个 Agent 引用,禁止删除`:void 0,children:h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:y.refCount>0,onClick:()=>c(y),children:"删除"})})]})})]},y.code))})]})}),h.jsx(us,{open:o!==null,onOpenChange:y=>{!y&&!d&&i(null)},children:h.jsxs(ds,{className:"sm:max-w-md",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:o?.mode==="edit"?`编辑映射 · ${o.alias.code}`:"新建映射"}),h.jsx(ps,{className:"sr-only",children:o?.mode==="edit"?"修改映射名称与真实模型":"创建新的模型映射"})]}),h.jsx(Uf,{...f,children:h.jsxs("form",{onSubmit:f.handleSubmit(p),className:"space-y-4",children:[h.jsx(_n,{control:f.control,name:"code",render:({field:y})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["code ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...y,placeholder:"kebab-case,如 primary",disabled:d||o?.mode==="edit"})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:f.control,name:"name",render:({field:y})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["名称 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...y,placeholder:"如 主力模型",disabled:d})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:f.control,name:"realModel",render:({field:y})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["真实模型 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...y,placeholder:"如 zhipuai/glm-5.3",disabled:d})}),h.jsx(Nn,{})]})}),h.jsx(Na,{children:h.jsx(ke,{type:"submit",disabled:d,children:d?"保存中…":"保存"})})]})})]})}),h.jsx(Ri,{open:l!==null,onOpenChange:y=>{y||c(null)},title:"删除模型映射",description:l?`确定删除映射「${l.name}(${l.code})」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:r.isPending,onConfirm:g})]})}const GO={dag_phase:{label:"DAG 阶段",desc:"节点阶段(phase):entry/track/test/exit,自定义可流经引擎"},dag_track:{label:"DAG 轨道",desc:"节点轨道(track):backend/ui 为内置双轨,all 为引擎哨兵,其余为自定义轨道"},pause_type:{label:"暂停点类型",desc:"边级暂停点(edge.pausePoint)类型"},task_status:{label:"任务状态",desc:"任务状态机(status):引擎硬依赖内置值"},node_status:{label:"节点状态",desc:"节点状态(nodeStatus):引擎硬依赖内置值"},skill_category:{label:"Skill 分类",desc:"Skill category:可自定义,全放开"},scope:{label:"资产作用域",desc:"资源作用域:value 永锁(承重字段),仅展示"}},bb=new Set(["scope"]);function Uue(e){return{value:e.value,label:e.label,color:e.color??"",order:String(e.order??0),active:e.active}}function KO(e){const t=e.color.trim();return{value:e.value.trim(),label:e.label.trim(),...t!==""?{color:t}:{},order:Number(e.order)||0,builtin:!1,active:e.active}}function Hue(){jo();const e=L2(),t=hZ(),n=pZ(),[r,o]=b.useState(null),[i,l]=b.useState(null),c=e.data??[],f=async(y,v,x)=>{if(x.value.trim()===""||x.label.trim()===""){ut.error("value 与 label 不能为空");return}const E=c.find(_=>_.category===y);if(!E)return;const S=[...E.entries];if(v===-1)S.push(KO(x));else{const _=S[v];if(!_)return;S[v]={...KO(x),builtin:_.builtin,value:_.builtin?_.value:x.value.trim()}}try{await t.mutateAsync({category:y,input:{entries:S}}),ut.success(`「${GO[y]?.label??y}」已保存`),o(null)}catch(_){ut.error(Ct(_))}},d=async(y,v)=>{try{await n.mutateAsync({category:y,value:v.value}),ut.success(`枚举值「${v.label}(${v.value})」已删除`),l(null)}catch(x){ut.error(Ct(x)),l(null)}},p=(y,v,x)=>{const E=bb.has(y.category),S=v.builtin;if(r?.category===y.category&&r.index===x){const j=r.draft;return h.jsxs(so,{children:[h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:j.value,disabled:S||E,className:"h-8 font-mono text-xs",onChange:R=>o({...r,draft:{...j,value:R.target.value}})})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:j.label,className:"h-8",onChange:R=>o({...r,draft:{...j,label:R.target.value}})})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(ln,{value:j.color,className:"h-8 w-16 font-mono text-xs",onChange:R=>o({...r,draft:{...j,color:R.target.value}})}),j.color?h.jsx("span",{className:"inline-block size-5 rounded border",style:{backgroundColor:j.color}}):null]})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:j.order,type:"number",className:"h-8 w-20",onChange:R=>o({...r,draft:{...j,order:R.target.value}})})}),E?null:h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs(br,{value:j.active?"active":"inactive",onValueChange:R=>o({...r,draft:{...j,active:R==="active"}}),children:[h.jsx(wr,{className:"h-8 w-24",children:h.jsx(Xc,{})}),h.jsxs(Sr,{children:[h.jsx(Bn,{value:"active",children:"启用"}),h.jsx(Bn,{value:"inactive",children:"停用"})]})]})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>{f(y.category,x,j)},children:"保存"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(null),children:"取消"})]})})]},v.value)}return h.jsxs(so,{className:v.active?"":"opacity-50",children:[h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs("span",{className:"inline-flex items-center gap-2",children:[h.jsx("span",{className:"font-mono text-xs",children:v.value}),S?h.jsx(Un,{variant:"secondary",className:"text-[10px]",children:"内置"}):null,v.active?null:h.jsx(Un,{variant:"outline",className:"text-[10px]",children:"停用"})]})}),h.jsx(Ht,{className:"px-4 py-2",children:v.label}),h.jsx(Ht,{className:"px-4 py-2",children:v.color?h.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx("span",{className:"inline-block size-3.5 rounded border",style:{backgroundColor:v.color}}),v.color]}):h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),h.jsx(Ht,{className:"px-4 py-2 font-mono text-xs",children:v.order??0}),E?null:h.jsx(Ht,{className:"px-4 py-2 text-xs",children:v.active?h.jsx("span",{className:"text-foreground",children:"启用"}):h.jsx("span",{className:"text-muted-foreground",children:"停用"})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs("div",{className:"flex justify-end gap-1",children:[h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>o({category:y.category,index:x,draft:Uue(v)}),children:h.jsx(zV,{className:"size-3.5","aria-hidden":"true"})}),E?null:h.jsx("span",{className:"inline-flex",title:S?"内置值不可删除":void 0,children:h.jsx(ke,{type:"button",variant:"ghost",size:"sm",disabled:S,onClick:()=>l({category:y.category,entry:v}),children:h.jsx(qV,{className:"size-3.5","aria-hidden":"true"})})})]})})]},v.value)},g=y=>{const v=bb.has(y.category);if(r?.category!==y.category||r.index!==-1)return null;const x=r.draft;return h.jsxs(so,{children:[h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:x.value,autoFocus:!0,className:"h-8 font-mono text-xs",placeholder:"value",onChange:E=>o({...r,draft:{...x,value:E.target.value}})})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:x.label,className:"h-8",placeholder:"label",onChange:E=>o({...r,draft:{...x,label:E.target.value}})})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:x.color,className:"h-8 w-16 font-mono text-xs",placeholder:"#fff",onChange:E=>o({...r,draft:{...x,color:E.target.value}})})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsx(ln,{value:x.order,type:"number",className:"h-8 w-20",placeholder:"0",onChange:E=>o({...r,draft:{...x,order:E.target.value}})})}),v?null:h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs(br,{value:x.active?"active":"inactive",onValueChange:E=>o({...r,draft:{...x,active:E==="active"}}),children:[h.jsx(wr,{className:"h-8 w-24",children:h.jsx(Xc,{})}),h.jsxs(Sr,{children:[h.jsx(Bn,{value:"active",children:"启用"}),h.jsx(Bn,{value:"inactive",children:"停用"})]})]})}),h.jsx(Ht,{className:"px-4 py-2",children:h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>{f(y.category,-1,x)},children:"保存"}),h.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(null),children:"取消"})]})})]})};return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"枚举管理"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"全站下拉选项的统一数据源:各页面下拉读此注册表,不写死。内置值(D8)服务端强制不可删除/改名。"})]}),e.isLoading?h.jsx(Ir,{rows:4,cols:4}):e.isError?h.jsx(rr,{message:Ct(e.error),onRetry:()=>{e.refetch()}}):h.jsx("div",{className:"space-y-6",children:c.map(y=>{const v=GO[y.category]??{label:y.category,desc:""},x=bb.has(y.category);return h.jsxs("section",{className:"overflow-hidden rounded-lg border",children:[h.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[h.jsxs("div",{children:[h.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[v.label,h.jsx("span",{className:"font-mono text-xs font-normal text-muted-foreground",children:y.category})]}),h.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:v.desc})]}),x?null:h.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>o({category:y.category,index:-1,draft:{value:"",label:"",color:"",order:String(y.entries.length),active:!0}}),children:[h.jsx(gm,{className:"size-3.5","aria-hidden":"true"}),"新增"]})]}),h.jsxs(Pf,{children:[h.jsx(If,{children:h.jsxs(so,{children:[h.jsx(Vn,{className:"px-4 py-2",children:"value"}),h.jsx(Vn,{className:"px-4 py-2",children:"label"}),h.jsx(Vn,{className:"px-4 py-2",children:"color"}),h.jsx(Vn,{className:"px-4 py-2",children:"order"}),x?null:h.jsx(Vn,{className:"px-4 py-2",children:"状态"}),h.jsx(Vn,{className:"px-4 py-2 text-right",children:"操作"})]})}),h.jsxs(zf,{children:[y.entries.map((E,S)=>p(y,E,S)),g(y)]})]})]},y.category)})}),h.jsx(Ri,{open:i!==null,onOpenChange:y=>{y||l(null)},title:"删除枚举值",description:i?`确定删除枚举值「${i.entry.label}(${i.entry.value})」?引用中的值将被服务端拒绝删除。`:"",confirmText:"删除",destructive:!0,loading:n.isPending,onConfirm:()=>{i&&d(i.category,i.entry)}})]})}function Bue(){return co({queryKey:["projects"],queryFn:WM})}function que(){const e=sn();return un({mutationFn:t=>NU(t),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}function Yue(){const e=sn();return un({mutationFn:({id:t,patch:n})=>TU(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}const Zue=gl({name:Tn().min(1,"名称不能为空").max(50,"名称最多 50 字符"),description:Tn().max(500,"描述最多 500 字符").optional()}),XO={name:"",description:""},Rd=gu();function Gue(){jo();const e=Bue(),t=que(),n=Yue(),{activeProjectId:r}=cs(),[o,i]=b.useState(null),[l,c]=b.useState(null),f=Ff({resolver:Vf(Zue),defaultValues:XO}),{isSubmitting:d}=f.formState;b.useEffect(()=>{o&&f.reset(o.mode==="edit"?{name:o.project.name,...o.project.description?{description:o.project.description}:{}}:XO)},[o]);const p=async v=>{const x={name:v.name,...v.description?{description:v.description}:{}};try{if(o?.mode==="edit")await n.mutateAsync({id:o.project.id,patch:x}),ut.success("项目已更新");else{const E=await t.mutateAsync(x);ut.success(`项目「${E.name}」已创建(key: ${E.key})`)}i(null)}catch(E){ut.error(Ct(E))}},g=v=>{const x=v.status==="active";n.mutateAsync({id:v.id,patch:{status:x?"archived":"active"}}).then(()=>{ut.success(x?`项目「${v.name}」已停用`:`项目「${v.name}」已启用`),c(null)}).catch(E=>{ut.error(Ct(E)),c(null)})},y=[Rd.accessor("name",{id:"name",header:"名称",cell:v=>h.jsx("button",{type:"button",onClick:()=>i({mode:"edit",project:v.row.original}),className:"text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:v.getValue()})}),Rd.accessor("key",{id:"key",header:"标识",cell:v=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",title:v.getValue(),children:v.getValue()})}),Rd.accessor("status",{id:"status",header:"状态",cell:v=>v.getValue()==="active"?h.jsx(Un,{variant:"secondary",children:"使用中"}):h.jsx(Un,{variant:"outline",children:"已停用"})}),Rd.accessor("description",{id:"description",header:"描述",cell:v=>v.getValue()?h.jsx("span",{className:"block max-w-xs truncate text-muted-foreground",title:v.getValue(),children:v.getValue()}):h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),Rd.display({id:"actions",header:"操作",cell:({row:v})=>{const x=v.original,E=x.key==="default";return h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(Gb,{children:[h.jsx(Kb,{render:h.jsx(ke,{variant:"outline",size:"sm"}),children:"查看资产"}),h.jsxs(Xb,{align:"start",children:[h.jsx(fa,{render:h.jsx(cn,{to:`/tasks?projectId=${x.id}`}),children:"任务"}),h.jsx(fa,{render:h.jsx(cn,{to:`/templates?projectId=${x.id}`}),children:"模板"}),h.jsx(fa,{render:h.jsx(cn,{to:`/skills?projectId=${x.id}`}),children:"技能"}),h.jsx(fa,{render:h.jsx(cn,{to:`/agents?projectId=${x.id}`}),children:"代理"})]})]}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>i({mode:"edit",project:x}),children:"编辑"}),x.status==="active"?h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:E,title:E?"默认项目不可停用":void 0,onClick:()=>c(x),children:"停用"}):h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>g(x),children:"启用"})]})}})];return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"项目管理"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"项目是任务与模板的归属维度;停用项目冻结新变更但保留数据"})]}),h.jsx(ke,{type:"button",onClick:()=>i({mode:"create"}),children:"+ 新建项目"})]}),e.isLoading?h.jsx(Ir,{rows:4,cols:5}):e.isError?h.jsx(rr,{message:Ct(e.error),onRetry:()=>{e.refetch()}}):(e.data?.length??0)===0?h.jsx(tr,{message:"还没有项目,点击「新建项目」创建第一个",actionLabel:"新建项目",onAction:()=>i({mode:"create"})}):h.jsx(vu,{columns:y,data:e.data??[]}),h.jsx(us,{open:o!==null,onOpenChange:v=>{!v&&!d&&i(null)},children:h.jsxs(ds,{className:"sm:max-w-sm",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:o?.mode==="edit"?`编辑项目 · ${o.project.name}`:"新建项目"}),h.jsx(ps,{children:o?.mode==="edit"?"修改项目名称与描述":"项目标识(key)由系统自动生成,创建后不可变"})]}),h.jsx(Uf,{...f,children:h.jsxs("form",{onSubmit:f.handleSubmit(p),className:"space-y-4",children:[h.jsx(_n,{control:f.control,name:"name",render:({field:v})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["名称 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...v,placeholder:"如 司命平台",maxLength:50,disabled:d})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:f.control,name:"description",render:({field:v})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"描述"}),h.jsx(vn,{children:h.jsx(Im,{...v,value:v.value??"",rows:3,maxLength:500,placeholder:"一句话说明项目用途(可选)",disabled:d})}),h.jsx(Nn,{})]})}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{variant:"outline"}),disabled:d,children:"取消"}),h.jsx(ke,{type:"submit",disabled:d,children:d?"保存中…":"保存"})]})]})})]})}),h.jsx(Ri,{open:l!==null,onOpenChange:v=>{v||c(null)},title:"停用项目",description:l?`确定停用项目「${l.name}」?停用后该项目下不能新建任务/编辑资产(数据保留,可重新启用)${l.id===r?";当前正在使用该项目,停用后将自动切回默认项目":""}`:"",confirmText:"停用",destructive:!0,loading:n.isPending,onConfirm:()=>l&&g(l)})]})}const oL=gl({name:Tn().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"name 需为 kebab-case(小写字母/数字/中划线)"),description:Tn().min(1,"描述不能为空"),content:Tn().min(1,"内容不能为空"),category:Tn().min(1,"请选择类别"),version:Tn().min(1,"版本不能为空"),scope:Hm(["global","project"]),references:Dc(gl({path:Tn().min(1),content:Tn()}))}),Kue=oL.extend({name:Tn().min(1)}),Xue={name:"",description:"",content:"",category:"process",version:"1.0.0",scope:"project",references:[]};function QO(){jo();const t=Sf().name??"",n=t.length>0,r=Sa(),[o]=cg(),i=o.get("scope")==="project"?"project":"global",l=o.get("projectId")??void 0,c={scope:i,...l!==void 0?{projectId:l}:{},includeDisabled:!0},{activeProjectId:f,projects:d,bootstrapReady:p,bootstrapError:g,retryBootstrap:y}=cs(),v=Xn("skill_category"),x=Xn("scope"),E=B=>x.find(V=>V.value===B)?.label??B,S=Tee(n?t:"",c),_=Oee(),j=Mee(),R=b.useMemo(()=>!n||!S.data?!1:S.data.scope==="project"&&(d.find(B=>B.id===S.data?.projectId)?.status??"active")==="archived",[n,S.data,d]),N=Ff({resolver:Vf(n?Kue:oL),defaultValues:Xue}),{isSubmitting:O,isDirty:k}=N.formState,[M,T]=b.useState(null),L=S.data?.name;b.useEffect(()=>{!n||!S.data||L!==t||N.getValues("name")===""&&N.reset({name:S.data.name,description:S.data.description,content:S.data.content,category:S.data.category,version:S.data.version,scope:S.data.scope,references:S.data.references??[]})},[n,S.data,L,t,N]),TP(k&&!O);const G=async B=>{T(null);try{n?(await j.mutateAsync({name:t,scope:i,projectId:l,patch:{description:B.description,content:B.content,category:B.category,version:B.version,references:B.references}}),ut.success("技能已更新")):(await _.mutateAsync({...B,...B.scope==="project"?{projectId:f}:{}}),ut.success("技能已创建")),r("/skills")}catch(V){const q=Ct(V);T(q),ut.error(q)}};return g?h.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:h.jsx(rr,{message:"项目上下文加载失败",onRetry:y})}):p?h.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[h.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[h.jsx(ke,{variant:"ghost",size:"icon","aria-label":"返回技能库",render:h.jsx(cn,{to:"/skills"}),nativeButton:!1,children:h.jsx(Mc,{className:"size-4"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:n?`编辑技能 · ${t}`:"新建技能"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Skill 元数据管理(name 为唯一键)"})]})]}),n&&S.isLoading?h.jsx(Ir,{rows:6,cols:1}):n&&S.isError?h.jsx(rr,{message:Ct(S.error),onRetry:()=>{S.refetch()}}):h.jsx(Uf,{...N,children:h.jsxs("form",{onSubmit:N.handleSubmit(G),className:"space-y-6",children:[R&&h.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:"该技能所属项目已停用,资产处于冻结状态(只读)。如需修改,请先在项目中启用该项目,或复制到其他作用域。"}),M!==null&&!R&&h.jsx("div",{role:"alert",className:"max-h-40 overflow-y-auto rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm break-all whitespace-pre-wrap text-destructive",children:M}),h.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[h.jsx(_n,{control:N.control,name:"name",render:({field:B})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["名称 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...B,placeholder:"kebab-case,如 code-review",disabled:O||n||R})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:N.control,name:"description",render:({field:B})=>h.jsxs(Rn,{children:[h.jsxs(jn,{children:["描述 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vn,{children:h.jsx(ln,{...B,placeholder:"一句话说明技能用途",disabled:O||R})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:N.control,name:"category",render:({field:B})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"类别"}),h.jsxs(br,{value:B.value,onValueChange:V=>{V!==null&&v.some(q=>q.value===V)&&B.onChange(V)},disabled:O||R,children:[h.jsx(vn,{children:h.jsx(wr,{className:"w-full",children:h.jsx(Xc,{placeholder:"选择类别"})})}),h.jsx(Sr,{children:v.filter(V=>V.active).map(V=>h.jsx(Bn,{value:V.value,children:V.label},V.value))})]}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:N.control,name:"scope",render:({field:B})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"作用域"}),n?h.jsx(vn,{children:h.jsx(ln,{value:B.value==="global"?`${E("global")}(创建后不可变)`:`${d.find(V=>V.id===S.data?.projectId)?.name??"未知项目"}(创建后不可变)`,disabled:!0})}):h.jsxs(br,{value:B.value,onValueChange:V=>{(V==="global"||V==="project")&&B.onChange(V)},disabled:O,children:[h.jsx(vn,{children:h.jsx(wr,{className:"w-full",children:h.jsx(Xc,{placeholder:"选择作用域"})})}),h.jsx(Sr,{children:x.map(V=>h.jsx(Bn,{value:V.value,disabled:V.value==="project"&&f==="",children:V.value==="project"?"当前项目":V.label},V.value))})]}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:N.control,name:"version",render:({field:B})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"版本"}),h.jsx(vn,{children:h.jsx(ln,{...B,placeholder:"1.0.0",disabled:O||R})}),h.jsx(Nn,{})]})})]}),h.jsx(_n,{control:N.control,name:"content",render:({field:B})=>h.jsxs(Rn,{children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs(jn,{children:["内容 ",h.jsx("span",{className:"text-destructive",children:"*"})]}),R&&h.jsx(Un,{variant:"outline",children:"冻结"})]}),h.jsx(vn,{children:h.jsx(of,{...B,placeholder:"Markdown 技能指令",disabled:O||R})}),h.jsx(Nn,{})]})}),h.jsx(_n,{control:N.control,name:"references",render:({field:B})=>h.jsxs(Rn,{children:[h.jsx(jn,{children:"引用文档"}),h.jsx(vn,{children:h.jsx(jP,{value:B.value,onChange:B.onChange,getMainBody:()=>N.getValues("content"),mainDocName:"SKILL.md",disabled:O||R})}),h.jsx(Nn,{}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"随技能一并存储与安装下发;install 后主文档中的相对路径引用将在本地真实可达。"})]})}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",render:h.jsx(cn,{to:"/skills"}),nativeButton:!1,disabled:O,children:"取消"}),h.jsx(ke,{type:"submit",disabled:O||R,children:O?"保存中…":"保存"})]})]})})]}):h.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:h.jsx(Ir,{rows:6})})}const Que={process:"secondary",domain:"default",tooling:"outline"},Wue={global:"全局"},oa=gu(),WO=e=>e.scope==="project"&&e.projectId?`/skills/${encodeURIComponent(e.name)}/edit?scope=project&projectId=${encodeURIComponent(e.projectId)}`:`/skills/${encodeURIComponent(e.name)}/edit`,Jue=e=>({name:e.name,enabled:e.enabled===!1,scope:e.scope,projectId:e.scope==="project"?e.projectId:void 0}),ede=e=>e.name;function tde(){jo();const e=Sa(),{activeProjectId:t,activeProjects:n,projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:l}=cs(),{overrideProjectId:c,scopedProject:f,exitScope:d}=Hg(r),p=f?.status==="archived",g=c||t,[y,v]=b.useState(""),x=NP(g,o,{includeDisabled:!0,q:y||void 0}),E=kee(),S=Aee(),_=Dee(),[j,R]=b.useState("all"),{toggle:N,togglingKey:O}=vS({mutation:_,assetLabel:"技能",keyOf:ede}),k=Xn("skill_category"),[M,T]=b.useState(null),[L,G]=b.useState(null),B=b.useMemo(()=>gS(x.data??[],j),[x.data,j]),V=b.useCallback(P=>r.find(U=>U.id===P)?.name??"未知项目",[r]),q=()=>{M&&E.mutateAsync({name:M.name,scope:M.scope,projectId:M.scope==="project"?M.projectId:void 0}).then(()=>{ut.success(`技能「${M.name}」已删除`),T(null)}).catch(P=>{ut.error(Ct(P)),T(null)})},I=b.useMemo(()=>[oa.accessor("name",{id:"name",header:"名称",cell:P=>p&&P.row.original.scope==="project"?h.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:P.getValue()}):h.jsx("button",{type:"button",onClick:()=>e(WO(P.row.original)),className:"font-mono text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:P.getValue()})}),oa.accessor("category",{id:"category",header:"类别",cell:P=>{const U=P.getValue(),H=k.find($=>$.value===U)?.label??U,Y=Que[U]??"secondary";return h.jsx(Un,{variant:Y,children:H})}}),oa.accessor("scope",{id:"scope",header:"作用域",cell:P=>{const U=P.row.original;return U.scope==="global"?h.jsx(Un,{variant:"secondary",children:Wue.global}):h.jsx(Un,{variant:"outline",children:V(U.projectId)})}}),pS(),oa.accessor("version",{id:"version",header:"版本",cell:P=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:P.getValue()})}),oa.accessor("referenceCount",{id:"referenceCount",header:"引用",cell:P=>P.getValue()===void 0||P.getValue()===0?h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):h.jsx(Un,{variant:"secondary",children:P.getValue()})}),oa.accessor("description",{id:"description",header:"描述",cell:P=>h.jsx(fS,{text:P.getValue()})}),oa.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:P=>h.jsx("span",{className:"text-xs text-muted-foreground",children:Lf(P.getValue()??"")}),meta:{initialSortDesc:!0}}),oa.display({id:"actions",header:"操作",cell:({row:P})=>{const U=p&&P.original.scope==="project";return h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:U,onClick:()=>e(WO(P.original)),children:"编辑"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>G(P.original),children:"复制"}),h.jsx(hS,{enabled:P.original.enabled,disabled:U||O===P.original.name,onClick:()=>N(Jue(P.original),{name:P.original.name})}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:U,onClick:()=>T(P.original),children:"删除"})]})}})],[V,p,k,e,N,O]),z=x.data??[],A=y.length>0;return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"技能库"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Skill 元数据管理(name 为唯一键)"})]}),h.jsx(ke,{type:"button",disabled:!o||p,onClick:()=>e("/skills/new"),children:"+ 新建技能"})]}),f&&h.jsx(Bg,{project:f,onExit:d}),o&&(z.length>0||A)&&h.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[h.jsx(mS,{className:"w-full sm:max-w-xs",placeholder:"搜索技能名称…",onDebouncedChange:v}),h.jsx(yS,{value:j,onChange:R})]}),i?h.jsx(rr,{message:Ct(i),onRetry:l}):!o||x.isLoading?h.jsx(Ir,{rows:4,cols:9}):x.isError?h.jsx(rr,{message:Ct(x.error),onRetry:()=>{x.refetch()}}):z.length===0?A?h.jsx(tr,{message:`没有匹配「${y}」的技能,试试其他关键词`}):p?h.jsx(tr,{message:"该项目暂无专用技能(全局技能为空)"}):h.jsx(tr,{message:"还没有技能,点击「新建技能」创建第一个",actionLabel:"新建技能",onAction:()=>e("/skills/new")}):B.length===0?h.jsx(tr,{message:"当前筛选状态下没有技能,试试切换状态筛选"}):h.jsx("div",{className:x.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:h.jsx(vu,{columns:I,data:B})}),h.jsx(Ri,{open:M!==null,onOpenChange:P=>{P||T(null)},title:"删除技能",description:M?`确定删除技能「${M.name}」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:E.isPending,onConfirm:q}),h.jsx($2,{open:L!==null,onOpenChange:P=>{P||G(null)},assetLabel:"技能",sourceName:L?.name??"",projects:n,defaultTargetId:t,onSubmit:P=>S.mutateAsync({name:L?.name??"",input:P,scope:L?.scope,projectId:L?.projectId})})]})}function TE({open:e,onOpenChange:t,title:n,label:r,placeholder:o,optional:i=!1,initialValue:l="",onSubmit:c,loading:f=!1}){const[d,p]=b.useState(l);b.useEffect(()=>{e&&p(l)},[e,l]);const g=b.useRef(null),y=()=>{f||!i&&d.trim()===""||c(d)};return h.jsx(us,{open:e,onOpenChange:t,children:h.jsxs(ds,{className:"sm:max-w-sm",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:n}),h.jsx(ps,{className:"sr-only",children:r})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:"prompt-input",children:r}),h.jsx(ln,{id:"prompt-input",ref:g,value:d,placeholder:o,autoFocus:!0,onChange:v=>p(v.target.value),onKeyDown:v=>{v.key==="Enter"&&y()}})]}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{variant:"outline"}),disabled:f,children:"取消"}),h.jsx(ke,{type:"button",disabled:f||!i&&d.trim()==="",onClick:y,children:f?"处理中…":"确定"})]})]})})}function nde({task:e,onAdvance:t,onApprove:n,onPause:r,onResume:o,onError:i}){const l=e.currentNode;let c;e.status==="active"?c="active":e.status==="paused"?c=e.pausedAt?"pause-point":"manual":e.status==="completed"?c="completed":c="cancelled";const[f,d]=b.useState(""),[p,g]=b.useState(""),[y,v]=b.useState(!1),[x,E]=b.useState(null),[S,_]=b.useState(!1);b.useEffect(()=>{d(""),g(""),E(null)},[e.id,e.status,l]);const j=e.pausedAt!==null?e.dagInstance.edges.find(G=>G.from===e.pausedAt&&G.pausePoint)??null:null,R=[...e.history].reverse().find(G=>G.action==="paused"),N=typeof R?.details.reason=="string"&&R.details.reason.length>0?R.details.reason:null,O=async(G,B=!1)=>{v(!0),E(null);try{await G()}catch(V){B?i?.(V):E(Ct(V))}finally{v(!1)}},k=()=>{O(()=>t(f.trim()||void 0))},M=G=>{O(()=>n(G,p.trim()||void 0),!0)},T=G=>{O(async()=>{await r(G.length>0?G:void 0),_(!1)},!0)},L=()=>{O(()=>o(),!0)};return h.jsxs("div",{className:"space-y-4",children:[c==="active"&&h.jsxs("div",{children:[h.jsx("p",{className:"mb-2 text-xs text-muted-foreground",children:"填写推进说明(可选),然后推进到下一节点:"}),h.jsx(Im,{value:f,onChange:G=>d(G.target.value),placeholder:"推进说明…",rows:2,disabled:y})]}),c==="pause-point"&&h.jsxs("div",{children:[h.jsxs("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3",children:[h.jsxs("p",{className:"text-sm font-medium text-warning",children:["任务在暂停点 ",h.jsx("span",{className:"font-mono",children:e.pausedAt})]}),h.jsx("p",{className:"mt-1 text-sm text-warning/90",children:j?.pausePoint?.description??"等待人工审批"})]}),h.jsx(Im,{value:p,onChange:G=>g(G.target.value),placeholder:"审批意见(可选)…",rows:2,disabled:y,className:"mt-3"}),h.jsxs("div",{className:"mt-2 flex gap-2",children:[h.jsx(ke,{type:"button",disabled:y,onClick:()=>M("approved"),variant:"outline",className:"border-success bg-success text-success-foreground hover:bg-success/90",children:"✓ 批准"}),h.jsx(ke,{type:"button",disabled:y,onClick:()=>M("rejected"),variant:"outline",className:"border-destructive bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"✗ 拒绝"})]})]}),c==="manual"&&h.jsxs("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3",children:[h.jsx("p",{className:"text-sm font-medium text-warning",children:"任务已手动暂停"}),h.jsx("p",{className:"mt-1 text-sm text-warning/90",children:N??"手动暂停"})]}),c==="completed"&&h.jsx("div",{className:"rounded-md border border-success/30 bg-success/10 p-3",children:h.jsx("p",{className:"text-sm font-medium text-success",children:"任务已完成,无需操作 ✓"})}),c==="cancelled"&&h.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 p-3",children:h.jsx("p",{className:"text-sm font-medium text-destructive",children:"任务已取消,无需操作"})}),c==="active"&&h.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-muted pt-3",children:[h.jsx(ke,{type:"button",disabled:y,onClick:k,children:y?"提交中…":"🟢 推进"}),h.jsx(ke,{type:"button",disabled:y,onClick:()=>_(!0),variant:"outline",className:"border-warning/60 bg-warning/10 text-warning hover:bg-warning/20",children:"🟡 暂停"})]}),c==="manual"&&h.jsx("div",{className:"flex flex-wrap gap-2 border-t border-muted pt-3",children:h.jsx(ke,{type:"button",disabled:y,onClick:L,variant:"outline",className:"border-info/40 bg-info/10 text-info hover:bg-info/20",children:"🔵 恢复"})}),x&&h.jsx(HY,{message:x}),h.jsx(TE,{open:S,onOpenChange:_,title:"暂停任务",label:"暂停原因(可选)",placeholder:"输入暂停原因…",optional:!0,loading:y,onSubmit:T})]})}const rde={entered:"进入节点",advanced:"推进",paused:"暂停",resumed:"恢复",approved:"审批通过",rejected:"审批拒绝",completed:"完成",cancelled:"取消"};function ode(e){for(const t of["reason","decision","evidence","message"]){const n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function sde({history:e}){return e.length===0?h.jsx(Ug,{message:"暂无操作记录"}):h.jsx("ol",{className:"space-y-0",children:e.map((t,n)=>{const r=ode(t.details);return h.jsxs("li",{className:"relative flex gap-3 pb-4 last:pb-0",children:[n<e.length-1&&h.jsx("span",{className:"absolute left-1 top-4 h-full w-px bg-border","aria-hidden":"true"}),h.jsx("span",{className:`relative mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full ${t.action==="rejected"?"bg-destructive":t.action==="approved"?"bg-success":"bg-muted-foreground"}`,"aria-hidden":"true"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[h.jsx("span",{className:"text-sm font-medium text-foreground",children:rde[t.action]??t.action}),h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.nodeId}),h.jsx("span",{className:"text-xs text-muted-foreground/60",children:Lf(t.timestamp)})]}),r&&h.jsx("p",{className:"mt-0.5 break-all text-xs text-muted-foreground",children:r})]})]},n)})})}function ide({task:e,onNodeClick:t}){const{nodes:n,nodeStates:r,prunedNodes:o}=e.dagInstance,i=e.status==="paused"&&e.pausedAt!==null,l=new Map;for(const c of n){const f=r[c.id],d=i&&e.pausedAt===c.id?"paused":f?.status==="completed"?"completed":f?.status==="active"?"active":f?.status==="skipped"?"skipped":"pending";l.set(c.id,{label:c.label,state:d})}for(const c of o)l.has(c)||l.set(c,{label:c,state:"skipped"});return h.jsxs("div",{className:"overflow-x-auto",children:[h.jsx("div",{className:"flex min-w-max items-start gap-2 py-2",children:n.map((c,f)=>{const p=l.get(c.id)?.state??"pending",g=p==="active",y=p==="paused";return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{type:"button",disabled:!t,onClick:()=>t?.(c.id),className:`flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm transition ${g?"border-success bg-success/10 text-success":y?"border-warning bg-warning/10 text-warning":p==="completed"?"border-border bg-muted text-muted-foreground":p==="skipped"?"border-dashed border-muted text-muted-foreground/60":"border-muted text-muted-foreground"} ${t?"cursor-pointer hover:border-primary/50 hover:bg-primary/5":"cursor-default"}`,title:`${c.id}(${p})${t?"· 点击查看节点信息":""}`,children:[h.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${g?"bg-success":y?"bg-warning":p==="completed"?"bg-muted-foreground":p==="skipped"?"bg-muted-foreground/40":"border border-muted-foreground/40 bg-background"}`}),h.jsx("span",{className:"font-mono text-xs",children:c.id})]}),f<n.length-1&&h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:`h-px w-6 ${g||y?"bg-success":"bg-muted-foreground/40"}`}),h.jsx("span",{className:"text-xs text-muted-foreground/60",children:"→"})]})]},c.id)})}),h.jsxs("div",{className:"mt-1 flex gap-4 text-xs text-muted-foreground",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-success"})," 当前"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-warning"})," 暂停点"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground"})," 已完成"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full border border-muted-foreground/40 bg-background"})," 待处理"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/40"})," 已跳过"]})]})]})}const ade=[{key:"task",label:"任务信息"},{key:"template",label:"模板信息"}];function lde({nodeId:e,task:t,open:n,onOpenChange:r}){const[o,i]=b.useState("task");if(!t||!e)return null;const l=t.dagInstance.nodes.find(g=>g.id===e),c=t.dagInstance.nodeStates[e];if(!l)return null;const f=t.dagInstance.edges.filter(g=>g.to===e).map(g=>g.from),d=t.dagInstance.edges.filter(g=>g.from===e).map(g=>g.to),p=t.dagInstance.edges.filter(g=>g.from===e&&g.pausePoint);return h.jsx(us,{open:n,onOpenChange:r,children:h.jsxs(ds,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-3xl flex-col gap-4 sm:max-w-none",children:[h.jsxs(fs,{children:[h.jsx(hs,{className:"font-mono text-base",children:e}),h.jsx(ps,{children:"节点信息(只读)"})]}),h.jsx("div",{className:"flex shrink-0 gap-1 rounded-md bg-muted p-1",role:"tablist","aria-label":"节点信息分区",children:ade.map(g=>h.jsx("button",{type:"button",role:"tab","aria-selected":o===g.key,className:`flex-1 rounded px-2 py-1.5 text-sm transition ${o===g.key?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>i(g.key),children:g.label},g.key))}),h.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o==="task"&&h.jsx("div",{className:"space-y-4",children:h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"状态"}),h.jsx("p",{className:"font-medium text-foreground",children:c?.status??"未到达"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"进入时间"}),h.jsx("p",{className:"font-mono text-xs text-foreground",children:c?.enteredAt??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"完成时间"}),h.jsx("p",{className:"font-mono text-xs text-foreground",children:c?.completedAt??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"出边暂停点"}),h.jsx("p",{className:"text-xs text-foreground",children:p.length>0?p.map(g=>`${g.pausePoint?.type}(${g.to})`).join(", "):"无"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"前驱节点"}),h.jsx("p",{className:"font-mono text-xs text-foreground",children:f.length>0?f.join(", "):"无"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"后继节点"}),h.jsx("p",{className:"font-mono text-xs text-foreground",children:d.length>0?d.join(", "):"无"})]})]})}),o==="template"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"标签"}),h.jsx("p",{className:"font-medium text-foreground",children:l.label})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"阶段"}),h.jsx("p",{className:"text-foreground",children:l.phase})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"轨道"}),h.jsx("p",{className:"text-foreground",children:l.track})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"Skills"}),h.jsx("p",{className:"text-xs text-foreground",children:l.skills.length>0?l.skills.join(", "):"无"})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"mb-1 text-xs text-muted-foreground",children:"节点 Prompt"}),h.jsx("pre",{className:"whitespace-pre-wrap rounded-md bg-muted/50 p-3 font-mono text-xs leading-relaxed text-muted-foreground",children:l.prompt||"(无 prompt)"})]})]})]}),h.jsx("div",{className:"flex shrink-0 justify-end border-t border-border pt-3",children:h.jsx("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm text-muted-foreground transition hover:text-foreground",onClick:()=>r(!1),children:"关闭"})})]})})}function cde({notice:e,onClose:t}){const n=e.status==="paused"?"border-warning/30 bg-warning/10 text-warning":"border-success/30 bg-success/10 text-success";return h.jsx("div",{className:`rounded-lg border p-4 text-sm ${n}`,children:h.jsxs("div",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"min-w-0 space-y-1",children:[e.status==="advanced"&&h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"font-medium",children:["已推进到「",e.nextNode.label,"」(",e.nextNode.nodeId,")"]}),e.nextNode.upcomingPause&&h.jsxs("p",{className:"text-xs",children:["前方暂停点:",e.nextNode.upcomingPause]})]}),e.status==="paused"&&h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"font-medium",children:["到达暂停点:",e.pausePoint.description]}),h.jsx("p",{className:"text-xs",children:e.guidance})]}),e.status==="completed"&&h.jsx("p",{className:"font-medium",children:"任务已完成 ✓"})]}),h.jsx(ke,{type:"button",variant:"ghost",size:"icon-sm",onClick:t,"aria-label":"关闭提示",className:"shrink-0 text-inherit hover:bg-transparent",children:"×"})]})})}function sL({project:e}){return e?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["项目:",e.name,e.status==="archived"&&h.jsx(Un,{variant:"outline",children:"已停用"})]}):null}function ude({taskDoc:e}){const t=e.acceptance??[],n=e.nonGoals??[];return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[h.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"目标(What)"}),h.jsx("p",{className:"mt-1 text-sm leading-relaxed text-foreground",children:e.what??"(未写)"})]}),h.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"动机(Why)"}),h.jsx("p",{className:"mt-1 text-sm leading-relaxed text-foreground",children:e.why??"(未写)"})]})]}),e.trackNote&&h.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"轨道备注:"}),e.trackNote]}),h.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[h.jsxs("div",{children:[h.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["验收标准(",t.length,")"]}),h.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map((r,o)=>h.jsxs("li",{className:"flex gap-1.5 text-sm text-foreground",children:[h.jsx("span",{className:"text-muted-foreground",children:"✓"}),h.jsx("span",{className:"leading-relaxed",children:r})]},o))})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["非目标(",n.length,")"]}),h.jsx("ul",{className:"mt-1.5 space-y-1",children:n.map((r,o)=>h.jsxs("li",{className:"flex gap-1.5 text-sm text-muted-foreground",children:[h.jsx("span",{children:"✗"}),h.jsx("span",{className:"leading-relaxed",children:r})]},o))})]})]})]})}function dde({type:e,path:t,content:n}){const[r,o]=b.useState(!1),i=Math.round(n.length/1024*10)/10;return h.jsxs("div",{className:"rounded-md border border-muted",children:[h.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs hover:bg-muted/30",children:[h.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e}),h.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:t}),h.jsxs("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground",children:["全文 ",i," KB ",r?"▼":"▶"]})]}),r&&h.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap border-t border-muted bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground",children:n})]})}function fde({nodeId:e,label:t,record:n}){if(!n)return null;const r=n.checks??[],o=n.decisions??[],i=n.artifacts??[],l=n.confirmations??[];return h.jsxs("div",{className:"rounded-md border border-border",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-muted/30 px-3 py-1.5",children:[h.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e}),h.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),n.review&&h.jsxs("span",{className:`ml-auto rounded px-1.5 py-0.5 text-[10px] font-medium ${n.review.verdict==="pass"?"bg-success/10 text-success":"bg-destructive/10 text-destructive"}`,children:["审查 ",n.review.verdict," · ",n.review.rounds," 轮 · critical ",n.review.critical]})]}),h.jsxs("div",{className:"space-y-2.5 px-3 py-2.5",children:[n.summary&&h.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:n.summary}),r.length>0&&h.jsx("ul",{className:"space-y-1",children:r.map(c=>h.jsxs("li",{className:"flex gap-1.5 text-sm",children:[h.jsx("span",{className:c.passed?"text-success":"text-destructive",children:c.passed?"✓":"✗"}),h.jsx("span",{className:"leading-relaxed text-foreground",children:c.item})]},c.id))}),o.length>0&&h.jsx("div",{className:"space-y-1",children:o.map(c=>h.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.jsxs("span",{className:"font-medium text-foreground",children:["决策 · ",c.topic,":"]}),c.decision]},c.id))}),i.length>0&&h.jsx("div",{className:"space-y-1.5",children:i.map(c=>c.content?h.jsx(dde,{type:c.type,path:c.path,content:c.content},c.id):h.jsxs("span",{className:"block rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:[c.type,": ",c.path]},c.id))}),l.length>0&&h.jsx("div",{className:"space-y-1.5",children:l.map(c=>h.jsxs("blockquote",{className:"border-l-2 border-border pl-2.5 text-xs italic leading-relaxed text-muted-foreground",children:[c.quote,h.jsxs("span",{className:"ml-2 not-italic",children:["— ",new Date(c.at).toLocaleString()]})]},c.id))})]})]})}function hde({contextQuery:e}){if(e.isLoading)return h.jsx(I2,{className:"h-16"});if(e.isError)return h.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center",children:[h.jsxs("p",{className:"text-sm text-destructive",children:["任务信息加载失败:",Ct(e.error)]}),h.jsx(ke,{variant:"outline",size:"sm",onClick:()=>{e.refetch()},children:"重试"})]});const t=e.data;if(!t)return null;const n=Object.keys(t.nodeRecords);if(!(t.taskDoc!==null||n.length>0||t.archNotes.length>0))return h.jsx(Ug,{message:"尚无任务信息。执行期间经 siming task doc / record / archnote 命令小步写入后在此呈现。"});const o=[...t.nodes.filter(i=>i.nodeId in t.nodeRecords),...n.filter(i=>!t.nodes.some(l=>l.nodeId===i)).map(i=>({nodeId:i,label:i}))];return h.jsxs("div",{className:"space-y-4",children:[t.taskDoc&&h.jsx(ude,{taskDoc:t.taskDoc}),o.length>0&&h.jsx("div",{className:"space-y-2.5",children:o.map(({nodeId:i,label:l})=>h.jsx(fde,{nodeId:i,label:l,record:t.nodeRecords[i]},i))}),t.archNotes.length>0&&h.jsx(pde,{notes:t.archNotes})]})}function pde({notes:e}){return h.jsxs("div",{className:"rounded-md border border-dashed border-border p-3",children:[h.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["架构信息素材(",e.length,")"]}),h.jsx("ul",{className:"mt-1.5 space-y-1.5",children:e.map(t=>h.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed text-muted-foreground",children:[h.jsx("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-muted-foreground/60"}),h.jsxs("span",{children:[t.text,h.jsxs("span",{className:"ml-1.5 opacity-70",children:["(",new Date(t.at).toLocaleDateString(),")"]})]})]},t.id))})]})}function mde(){const{taskId:e=""}=Sf(),t=bz(e),{projects:n}=cs();jo(t.data?`任务 ${t.data.taskId} · 司命`:void 0);const r=Bae(e),o=qae(e),i=Zae(e),l=Gae(e),c=Kae(e),f=Xn("dag_track"),d=Xn("dag_phase"),p=V=>f.find(q=>q.value===V)?.label??V,g=V=>d.find(q=>q.value===V)?.label??V,[y,v]=b.useState(null),[x,E]=b.useState(null),[S,_]=b.useState(!1),[j,R]=b.useState(!1),N=t.data,O=Yae(e),k=async V=>{const q=await r.mutateAsync(V);return v(q),q},M=async(V,q)=>{try{await o.mutateAsync({decision:V,...q?{comment:q}:{}}),ut.success(V==="approved"?"已批准,任务继续推进":"已拒绝,任务保持暂停"),v(null)}catch(I){ut.error(Ct(I))}},T=async V=>{await i.mutateAsync(V),ut.success("任务已暂停"),v(null)},L=async()=>{await l.mutateAsync(void 0),ut.success("任务已恢复"),v(null)},G=V=>{c.mutateAsync(V.trim()||void 0).then(()=>{ut.success("任务已取消"),R(!1),v(null)}).catch(q=>ut.error(Ct(q)))},B=V=>{E(V),_(!0)};return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(cn,{to:"/tasks",className:"mb-1 inline-block text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回任务列表"}),t.isLoading?h.jsx("div",{className:"mt-4",children:h.jsx(Ir,{rows:4,cols:4})}):t.isError?h.jsx("div",{className:"mt-4",children:h.jsx(rr,{message:Ct(t.error),onRetry:()=>{t.refetch()}})}):N?h.jsxs("div",{className:"mt-4 space-y-5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:N.title}),h.jsx(NE,{status:N.status}),h.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:N.taskId}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["轨道:",p(N.track)]}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["阶段:",g(N.currentPhase)]}),h.jsx(sL,{project:n.find(V=>V.id===N.projectId)}),h.jsx(cn,{to:`/dag/templates/${N.dagTemplateId}?instance=${N.taskId}`,className:"ml-auto text-sm text-primary underline-offset-4 transition hover:underline",children:"查看流程图 →"})]}),y&&h.jsx(cde,{notice:y,onClose:()=>v(null)}),h.jsx(ha,{title:"流程进度",children:h.jsx(ide,{task:N,onNodeClick:B})}),h.jsx(ha,{title:"任务信息",children:h.jsx(hde,{contextQuery:O})}),h.jsxs(ha,{title:"操作",children:[h.jsx(nde,{task:N,onAdvance:k,onApprove:M,onPause:T,onResume:L,onError:V=>ut.error(Ct(V))}),(N.status==="active"||N.status==="paused")&&h.jsxs("div",{className:"mt-4 flex items-center gap-3 border-t border-muted pt-3",children:[h.jsx(ke,{type:"button",variant:"destructive",disabled:c.isPending,onClick:()=>R(!0),children:c.isPending?"取消中…":"取消任务"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"取消后任务进入终态,不可恢复"})]})]}),h.jsx(ha,{title:"操作历史",children:h.jsx(sde,{history:N.history})})]}):null,h.jsx(lde,{nodeId:x,task:N??null,open:S,onOpenChange:_}),h.jsx(TE,{open:j,onOpenChange:R,title:"取消任务(不可恢复)",label:"取消理由(可选,写入操作历史)",placeholder:"输入取消理由…",optional:!0,loading:c.isPending,onSubmit:G})]})}const jd=gu(),gde=[jd.accessor("taskId",{id:"taskId",header:"ID",cell:e=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.getValue()})}),jd.accessor("title",{id:"title",header:"标题",cell:e=>h.jsx(cn,{to:`/tasks/${e.row.original.taskId}`,className:"font-medium text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:e.getValue()})}),jd.accessor("status",{id:"status",header:"状态",cell:e=>h.jsx(NE,{status:e.getValue()})}),jd.accessor("currentNode",{id:"currentNode",header:"当前节点",cell:e=>h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.getValue()})}),jd.accessor("createdAt",{id:"createdAt",header:"创建时间",meta:{initialSortDesc:!0},cell:e=>h.jsx("span",{className:"text-xs text-muted-foreground",children:Lf(e.getValue())})})];function yde({tasks:e}){return h.jsx(vu,{columns:gde,data:e})}function vde(){jo();const{activeProjectId:e,activeProjects:t,projects:n,bootstrapReady:r,bootstrapError:o,retryBootstrap:i}=cs(),{overrideProjectId:l,scopedProject:c,exitScope:f}=Hg(n),d=c?.status==="archived",p=l||e,[g,y]=b.useState(""),v=Hae(p,g),x=Ez(),[E,S]=b.useState(!1);return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"任务"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"DAG 驱动的研发任务看板"})]}),h.jsx(ke,{type:"button",disabled:!r||d,onClick:()=>S(!0),children:"+ 新建任务"})]}),c&&h.jsx(Bg,{project:c,onExit:f}),r&&((v.data?.length??0)>0||g.length>0)&&h.jsx("div",{className:"mb-3",children:h.jsx(mS,{className:"w-full sm:max-w-xs",placeholder:"搜索任务标题…",onDebouncedChange:y})}),o?h.jsx(rr,{message:Ct(o),onRetry:i}):r?v.isLoading?h.jsx(Ir,{rows:4,cols:5}):v.isError?h.jsx(rr,{message:Ct(v.error),onRetry:()=>{v.refetch()}}):(v.data?.length??0)===0?g.length>0?h.jsx(tr,{message:`没有匹配「${g}」的任务,试试其他关键词`}):d?h.jsx(tr,{message:"该项目暂无任务"}):h.jsx(tr,{message:"还没有任务,点击「新建任务」创建第一个",actionLabel:"新建任务",onAction:()=>S(!0)}):h.jsx("div",{className:v.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:h.jsx(yde,{tasks:v.data??[]})}):h.jsx(Ir,{rows:4,cols:5}),h.jsx(rL,{open:E,projects:t,defaultProjectId:e,onClose:()=>S(!1),onCreate:async _=>{await x.mutateAsync(_),ut.success("任务已创建")}})]})}function xde(){jo();const{id:e=""}=Sf(),t=Sa(),n=Sz(e),{projects:r}=cs(),o=Cz(),i=_z(),[l,c]=b.useState(!1),[f,d]=b.useState(!1),[p,g]=b.useState(null),[y,v]=b.useState(void 0),x=p??{nodes:n.data?.nodes??[],edges:n.data?.edges??[]},E=b.useCallback((z,A)=>{g(z);const P=n.data?.layout;if(A?.rename){const{oldId:U,newId:H}=A.rename;v(Y=>{const $=Y??P;if(!$)return Y;const F=$[U];if(!F)return $;const{[U]:Q,...X}=$;return{...X,[H]:F}})}if(A?.deleted){const U=A.deleted;v(H=>{const Y=H??P;if(!Y)return H;if(!(U in Y))return Y;const{[U]:$,...F}=Y;return F})}},[n.data?.layout]),S=tL(x,E),_=Xn("dag_phase"),j=Xn("dag_track"),R=z=>_.find(A=>A.value===z)?.label??z,N=z=>j.find(A=>A.value===z)?.label??z,O=Xn("pause_type"),k=z=>O.find(A=>A.value===z)?.label??z;if(n.isLoading)return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(cn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),h.jsx("div",{className:"mt-4",children:h.jsx(Ir,{rows:4,cols:4})})]});if(n.isError)return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(cn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),h.jsx("div",{className:"mt-4",children:h.jsx(rr,{message:Ct(n.error),onRetry:()=>{n.refetch()}})})]});if(!n.data)return null;const M=n.data,T=p!==null,L=r.find(z=>z.id===M.projectId)?.status==="archived",G=j.filter(z=>z.active).map(z=>z.value),B=()=>{if(!p)return;const z=nL(p,{tracks:G,entryPhase:"entry"});if(z.length>0){ut.error(`校验未通过(${z.length} 项),请修复后保存`);return}const A=y??M.layout;i.mutateAsync({id:e,patch:{nodes:p.nodes,edges:p.edges,...A?{layout:A}:{},version:F0(M.version)}}).then(()=>{ut.success(`模板「${M.name}」已保存`),g(null),v(void 0)}).catch(P=>ut.error(Ct(P)))},V=()=>{g(null),v(void 0),S.clearSelection()},q=()=>{d(!0),dU(e).then(z=>{const A=new Blob([JSON.stringify(z,null,2)],{type:"application/json"}),P=URL.createObjectURL(A),U=document.createElement("a");U.href=P,U.download=`${z.template.name.replace(/[\\/:*?"<>|]/g,"_")}-v${z.template.version}.json`,U.click(),URL.revokeObjectURL(P),ut.success(`模板「${M.name}」已导出(含 ${z.dependencies.skills.length+z.dependencies.agents.length+z.dependencies.modelAliases.length} 项依赖)`)}).catch(z=>ut.error(Ct(z))).finally(()=>d(!1))},I=()=>{o.mutateAsync(e).then(()=>{ut.success(`模板「${M.name}」已删除`),c(!1),t("/templates")}).catch(z=>{ut.error(Ct(z)),c(!1)})};return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsx(cn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),h.jsxs("div",{className:"mt-4 space-y-5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:M.name}),M.isDefault&&h.jsx("span",{className:"rounded bg-foreground px-2 py-0.5 text-xs text-background",children:"默认模板"}),h.jsxs("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:["v",M.version]}),h.jsx(sL,{project:r.find(z=>z.id===M.projectId)}),h.jsx(ke,{type:"button",variant:"outline",className:"ml-auto",disabled:f,onClick:q,children:f?"导出中…":"导出"}),L?h.jsx(ke,{type:"button",variant:"outline",disabled:!0,children:"打开编辑器"}):h.jsx(ke,{render:h.jsx(cn,{to:`/dag/templates/${M.id}`}),nativeButton:!1,variant:"outline",children:"打开编辑器"}),T&&h.jsxs(h.Fragment,{children:[h.jsx(ke,{type:"button",variant:"outline",disabled:i.isPending,onClick:V,children:"取消编辑"}),h.jsx(ke,{type:"button",disabled:i.isPending,onClick:B,children:"保存节点"})]}),h.jsx(ke,{type:"button",variant:"destructive",disabled:o.isPending||L,onClick:()=>c(!0),children:"删除模板"})]}),h.jsx("p",{className:"text-sm text-muted-foreground",children:M.description}),h.jsx(ha,{title:`节点(${M.nodes.length})`,children:h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-left text-sm",children:[h.jsx("thead",{className:"border-b border-border",children:h.jsxs("tr",{children:[h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"ID"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"标签"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"阶段"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"轨道"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Skills"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"操作"})]})}),h.jsx("tbody",{children:M.nodes.map(z=>h.jsxs("tr",{className:"border-b border-muted last:border-0",children:[h.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:z.id}),h.jsx("td",{className:"px-3 py-2 text-foreground",children:z.label}),h.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:R(z.phase)}),h.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:N(z.track)}),h.jsx("td",{className:"px-3 py-2",children:z.skills.length===0?h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):h.jsx("span",{className:"text-xs text-muted-foreground",children:z.skills.join(", ")})}),h.jsx("td",{className:"px-3 py-2",children:h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:L||i.isPending,onClick:()=>S.selectNode(z.id),children:"编辑"})})]},z.id))})]})})}),h.jsx(ha,{title:`边(${M.edges.length})`,children:M.edges.length===0?h.jsx(Ug,{message:"无连线"}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-left text-sm",children:[h.jsx("thead",{className:"border-b border-border",children:h.jsxs("tr",{children:[h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"From"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"To"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"条件"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"暂停点"}),h.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"操作"})]})}),h.jsx("tbody",{children:M.edges.map(z=>h.jsxs("tr",{className:"border-b border-muted last:border-0",children:[h.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:z.from}),h.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:z.to}),h.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:z.condition??"—"}),h.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:z.pausePoint?`${k(z.pausePoint.type)}:${z.pausePoint.description}`:"—"}),h.jsx("td",{className:"px-3 py-2 text-xs",children:h.jsx(cn,{to:`/dag/templates/${M.id}`,className:"text-primary hover:underline",children:"编辑"})})]},`${z.from}->${z.to}`))})]})})})]}),h.jsx(eL,{node:S.selectedNode,open:S.selectedNode!==null,onOpenChange:z=>{z||S.clearSelection()},onChange:z=>S.patchNode(z),onDelete:()=>S.deleteNode(),onRename:z=>{S.renameNode(z)?ut.success(`已重命名为 ${z}(连线与暂停点已级联更新,保存后生效)`):ut.error(`节点 id「${z}」已存在`)}}),h.jsx(Ri,{open:l,onOpenChange:c,title:"删除模板",description:`确定删除模板「${M.name}」?该操作不可恢复。`,confirmText:"删除",destructive:!0,loading:o.isPending,onConfirm:I})]})}function bde({open:e,onOpenChange:t,template:n,projects:r,defaultTargetId:o,onCopied:i}){const[l,c]=b.useState(""),[f,d]=b.useState(o),p=ele();b.useEffect(()=>{e&&n&&(c(`${n.name} 副本`),d(o))},[e,n,o]);const g=r.find(E=>E.id===f),y=l.trim().length>=1&&l.trim().length<=50,v=y&&f!==""&&!p.isPending,x=()=>{!n||!v||p.mutateAsync({id:n.id,input:{newName:l.trim(),targetProjectId:f}}).then(E=>{i({id:E.id,name:E.name}),t(!1)}).catch(E=>{ut.error(Ct(E))})};return h.jsx(us,{open:e,onOpenChange:t,children:h.jsxs(ds,{className:"sm:max-w-sm",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:"复制模板"}),h.jsx(ps,{children:n?`将「${n.name}」复制到目标项目,副本为全新独立模板。`:""})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:"copy-target-project",children:"目标项目"}),h.jsxs(br,{value:f,onValueChange:E=>{E!==null&&d(E)},children:[h.jsx(wr,{id:"copy-target-project","aria-label":"目标项目",className:"w-full",children:g?g.name:"选择项目"}),h.jsx(Sr,{children:r.map(E=>h.jsx(Bn,{value:E.id,children:E.name},E.id))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kr,{htmlFor:"copy-template-name",children:"新模板名称"}),h.jsx(ln,{id:"copy-template-name",value:l,placeholder:"如:发布流程模板 副本",maxLength:50,"aria-invalid":e&&!y,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&x()}}),e&&l.trim().length===0&&h.jsx("p",{className:"text-xs text-destructive",children:"请输入新模板名称"}),e&&l.trim().length>50&&h.jsx("p",{className:"text-xs text-destructive",children:"名称不能超过 50 个字符"})]})]}),h.jsxs(Na,{children:[h.jsx(yu,{render:h.jsx(ke,{variant:"outline"}),disabled:p.isPending,children:"取消"}),h.jsx(ke,{type:"button",disabled:!v,onClick:x,children:p.isPending?"复制中…":"复制"})]})]})})}function Xa(e){return`${e.kind}::${e.scope??""}::${e.name}`}const iL={skill:"技能",agent:"代理",modelAlias:"模型映射"},wde={create:"新建",identical:"相同",conflict:"有冲突"},Sde={global:"全局",project:"项目"},JO={created:"已新建",updated:"已覆盖",skipped:"已跳过",identical:"相同(无变更)",failed:"失败"},Ede={create:"bg-info/10 text-info",identical:"bg-success/10 text-success",conflict:"bg-warning/10 text-warning"},Cde={created:"bg-info/10 text-info",updated:"bg-warning/10 text-warning",skipped:"bg-muted text-muted-foreground",identical:"bg-success/10 text-success",failed:"bg-destructive/10 text-destructive"};function _de(e,t){return e.kind==="modelAlias"?{kind:"modelAlias",name:e.name,action:t}:{kind:e.kind,name:e.name,scope:e.scope??"global",action:t}}function Rde({open:e,onOpenChange:t,projectId:n,onImported:r}){const[o,i]=b.useState("file"),[l,c]=b.useState(null),[f,d]=b.useState(null),[p,g]=b.useState({}),y=Qae(),v=Wae(),x=Xn("scope"),E=M=>x.find(T=>T.value===M)?.label??Sde[M]??M;b.useEffect(()=>{e||(i("file"),c(null),d(null),g({}),y.reset(),v.reset())},[e]);const S=y.data,_=b.useMemo(()=>(S?.dependencies??[]).filter(M=>M.status==="conflict"),[S]),j=M=>{d(null),M.text().then(T=>{let L;try{L=JSON.parse(T)}catch{throw new Error("文件不是合法的 JSON——请确认选择的是模板导出文件")}if(typeof L!="object"||L===null||!("template"in L)||!("dependencies"in L)||!("exportFormatVersion"in L))throw new Error("文件缺少 exportFormatVersion/template/dependencies 字段——可能不是模板导出文件");const G=L;c(G),i("plan"),y.mutate({targetProjectId:n,bundle:G})}).catch(T=>{d(T instanceof Error?T.message:String(T))})},R=()=>{i("file"),c(null),y.reset(),v.reset()},N=M=>{const T={};for(const L of _)T[Xa(L)]=M;g(T)},O=b.useMemo(()=>_.filter(M=>p[Xa(M)]!==void 0).map(M=>_de(M,p[Xa(M)]??"skip")),[_,p]),k=()=>{l&&v.mutate({targetProjectId:n,bundle:l,decisions:O},{onSuccess:M=>{i("result"),M.dependencies.filter(L=>L.action==="failed").length===0&&(ut.success(`模板「${M.template.name}」导入成功`),r?.(M))}})};return h.jsx(us,{open:e,onOpenChange:t,children:h.jsxs(ds,{className:"sm:max-w-2xl",children:[h.jsxs(fs,{children:[h.jsx(hs,{children:"导入模板"}),h.jsxs(ps,{children:[o==="file"&&"选择其他环境导出的模板 JSON 文件,导入到当前项目",o==="plan"&&"预检目标项目环境,确认依赖冲突决策后执行导入",o==="result"&&"导入执行结果(失败项可查看错误信息)"]})]}),o==="file"&&h.jsxs("div",{className:"space-y-3",children:[h.jsx(kr,{htmlFor:"import-template-file",children:"模板导出文件(.json)"}),h.jsx("input",{id:"import-template-file",type:"file",accept:"application/json,.json",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground file:mr-3 file:rounded file:border-0 file:bg-muted file:px-2 file:py-1 file:text-xs file:text-muted-foreground","aria-invalid":f!==null,onChange:M=>{const T=M.target.files?.[0];T&&j(T),M.target.value=""}}),f&&h.jsx("p",{className:"text-xs text-destructive",children:f}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"导入目标为当前项目——跨项目迁移请先在导航中切换目标项目"})]}),o==="plan"&&h.jsxs("div",{className:"space-y-4",children:[y.isPending&&h.jsxs("div",{className:"space-y-2","aria-busy":"true",children:[h.jsx(Pm,{className:"h-16 w-full"}),h.jsx(Pm,{className:"h-40 w-full"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"正在预检目标项目环境…"})]}),y.isError&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:[h.jsx("p",{className:"font-medium",children:"预检失败"}),h.jsx("p",{className:"mt-1 break-all",children:Ct(y.error)})]}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:R,children:"重新选择文件"})]}),v.isError&&h.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:[h.jsx("p",{className:"font-medium",children:"导入失败(目标环境未被修改的部分保持原状,可修正后重试)"}),h.jsx("p",{className:"mt-1 break-all",children:Ct(v.error)})]}),S&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-sm",children:[h.jsxs("p",{children:[h.jsx("span",{className:"font-medium",children:S.template.name}),S.template.willOverwrite?h.jsxs("span",{className:"text-warning",children:[" ","— 将覆盖同名模板(v",S.template.currentVersion," → v",S.template.importVersion,")"]}):h.jsxs("span",{className:"text-info",children:[" — 将新建模板(v",S.template.importVersion,")"]})]}),S.template.isDefaultRequested&&!S.template.isDefaultEffect&&h.jsx("p",{className:"mt-1 text-xs text-warning",children:"目标项目已有默认模板——导入后该模板 isDefault 降级为 false,不抢占默认位"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"覆盖时目标资产启停状态保持现值不变,新建资产默认为启用"})]}),h.jsxs("div",{children:[h.jsxs("h3",{className:"mb-2 text-sm font-medium text-foreground",children:["依赖资产(",S.dependencies.length,")"]}),S.dependencies.length===0?h.jsxs("div",{className:"rounded-md border border-dashed border-border p-3 text-center",children:[h.jsx("p",{className:"text-xs text-muted-foreground",children:"该模板无依赖资产(纯模板结构导入)"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"无冲突决策,可直接点击「确认导入」完成"})]}):h.jsxs("div",{children:[h.jsx("div",{className:"max-h-64 overflow-auto rounded-md border border-border",children:h.jsxs(Pf,{children:[h.jsx(If,{children:h.jsxs(so,{children:[h.jsx(Vn,{children:"类型"}),h.jsx(Vn,{children:"名称"}),h.jsx(Vn,{children:"作用域"}),h.jsx(Vn,{children:"版本"}),h.jsx(Vn,{children:"状态"}),h.jsx(Vn,{children:"影响"}),h.jsx(Vn,{children:"冲突决策"})]})}),h.jsx(zf,{children:S.dependencies.map(M=>h.jsxs(so,{children:[h.jsx(Ht,{className:"text-xs text-muted-foreground",children:iL[M.kind]??M.kind}),h.jsx(Ht,{className:"max-w-40 truncate font-mono text-xs",title:M.name,children:M.name}),h.jsx(Ht,{className:"text-xs text-muted-foreground",children:M.scope?E(M.scope):"—"}),h.jsx(Ht,{className:"text-xs text-muted-foreground",children:M.status==="identical"?"—":M.currentVersion?`v${M.currentVersion} → v${M.importVersion??"?"}`:M.kind==="modelAlias"?"新建":`v${M.importVersion??"?"}(新建)`}),h.jsx(Ht,{children:h.jsx("span",{className:`rounded px-1.5 py-0.5 text-xs ${Ede[M.status]}`,children:wde[M.status]})}),h.jsx(Ht,{children:h.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:E(M.impact)})}),h.jsx(Ht,{children:M.status==="conflict"?h.jsxs("div",{className:"space-y-1",children:[h.jsxs(br,{value:p[Xa(M)]??"skip",onValueChange:T=>{(T==="overwrite"||T==="skip")&&g(L=>({...L,[Xa(M)]:T}))},children:[h.jsx(wr,{size:"sm",className:"w-24","aria-label":`${M.name} 冲突决策`,children:p[Xa(M)]==="overwrite"?"覆盖":"跳过"}),h.jsxs(Sr,{children:[h.jsx(Bn,{value:"skip",children:"跳过"}),h.jsx(Bn,{value:"overwrite",children:"覆盖"})]})]}),M.changeSummary&&h.jsxs("p",{className:"max-w-40 truncate text-xs text-muted-foreground",title:M.changeSummary,children:["差异:",M.changeSummary]})]}):h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},Xa(M)))})]})}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground sm:hidden",children:"← 左右滑动查看全部列(含冲突决策)"})]})]}),S.warnings.length>0&&h.jsx("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3 text-xs text-warning",children:S.warnings.map((M,T)=>h.jsx("p",{className:"break-all",children:M},T))}),_.length>0&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.length," 项冲突,默认全部跳过"]}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>N("skip"),children:"全部跳过"}),h.jsx(ke,{type:"button",variant:"destructive",size:"sm",onClick:()=>N("overwrite"),children:"全部覆盖"})]})]})]}),o==="result"&&v.data&&h.jsx(jde,{result:v.data}),h.jsxs(Na,{children:[o==="plan"&&S&&!y.isPending&&h.jsxs(h.Fragment,{children:[h.jsx(ke,{type:"button",variant:"outline",onClick:R,disabled:v.isPending,children:"重新选择文件"}),h.jsx(ke,{type:"button",onClick:k,disabled:v.isPending||n.length===0,children:v.isPending?"导入中…":"确认导入"})]}),o==="result"&&h.jsx(ke,{type:"button",variant:"outline",onClick:()=>t(!1),children:"关闭"})]})]})})}function jde({result:e}){const t=b.useMemo(()=>{const r={};for(const o of e.dependencies)r[o.action]=(r[o.action]??0)+1;return r},[e.dependencies]),n=["created","updated","skipped","identical","failed"].filter(r=>t[r]).map(r=>`${JO[r]} ${t[r]}`).join(",");return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:`rounded-md border p-3 text-sm ${t.failed?"border-destructive/30 bg-destructive/10 text-destructive":"border-success/30 bg-success/10 text-success"}`,role:"status",children:[h.jsxs("p",{className:"font-medium",children:["模板「",e.template.name,"」",e.template.action==="created"?"已新建":"已覆盖",!e.template.isDefaultEffect&&"(默认位未抢占)"]}),e.dependencies.length>0&&h.jsxs("p",{className:"mt-1 text-xs",children:["依赖资产:",n]})]}),e.dependencies.length>0&&h.jsx("div",{className:"max-h-56 overflow-auto rounded-md border border-border",children:h.jsxs(Pf,{children:[h.jsx(If,{children:h.jsxs(so,{children:[h.jsx(Vn,{children:"类型"}),h.jsx(Vn,{children:"名称"}),h.jsx(Vn,{children:"结果"}),h.jsx(Vn,{children:"错误信息"})]})}),h.jsx(zf,{children:e.dependencies.map(r=>h.jsxs(so,{children:[h.jsx(Ht,{className:"text-xs text-muted-foreground",children:iL[r.kind]??r.kind}),h.jsx(Ht,{className:"max-w-40 truncate font-mono text-xs",title:r.name,children:r.name}),h.jsx(Ht,{children:h.jsx("span",{className:`rounded px-1.5 py-0.5 text-xs ${Cde[r.action]}`,children:JO[r.action]})}),h.jsx(Ht,{className:"max-w-52",children:r.message?h.jsx("span",{className:"block truncate text-xs text-destructive",title:r.message,children:r.message}):h.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},`${r.kind}:${r.scope??""}:${r.name}`))})]})})]})}const wc=gu();function Nde({templates:e,deletingId:t,togglingKey:n,onDelete:r,onCopy:o,onToggleEnabled:i,frozen:l=!1}){const c=b.useMemo(()=>[wc.accessor("name",{id:"name",header:"名称",cell:f=>h.jsxs("span",{className:"flex items-center gap-2 whitespace-nowrap",children:[h.jsx(cn,{to:`/templates/${f.row.original.id}`,className:"font-medium text-foreground hover:text-muted-foreground",children:f.getValue()}),f.row.original.isDefault&&h.jsx("span",{className:"rounded bg-foreground px-1.5 py-0.5 text-xs text-background",children:"默认"})]})}),pS(),wc.accessor("description",{id:"description",header:"描述",cell:f=>h.jsx(fS,{text:f.getValue()})}),wc.accessor("nodes",{id:"nodeCount",header:"节点数",cell:f=>h.jsx("span",{className:"whitespace-nowrap text-foreground",children:f.getValue().length})}),wc.accessor(f=>f.edges.filter(d=>d.pausePoint).length,{id:"pausePointCount",header:"暂停点",cell:f=>h.jsx("span",{className:"whitespace-nowrap text-foreground",children:f.getValue()})}),wc.accessor("version",{id:"version",header:"版本",cell:f=>h.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:f.getValue()})}),wc.display({id:"actions",header:"操作",cell:({row:f})=>h.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[h.jsx(ke,{render:h.jsx(cn,{to:`/templates/${f.original.id}`}),nativeButton:!1,variant:"outline",size:"sm",children:"查看"}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>o(f.original.id,f.original.name),children:"复制"}),h.jsx(hS,{enabled:f.original.enabled,disabled:l||n===f.original.id,onClick:()=>i(f.original.id,f.original.name,f.original.enabled===!1)}),h.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:t===f.original.id||l,onClick:()=>r(f.original.id,f.original.name),children:"删除"})]})})],[t,n,r,o,i,l]);return h.jsx(vu,{columns:c,data:e})}const Tde=e=>e.id;function Ode(){jo();const{activeProjectId:e,activeProjects:t,projects:n,bootstrapReady:r,bootstrapError:o,retryBootstrap:i}=cs(),{overrideProjectId:l,scopedProject:c,exitScope:f}=Hg(n),d=c?.status==="archived",p=l||e,g=wz(p,r,{includeDisabled:!0}),y=Sa(),v=Jae(e),[x,E]=b.useState(!1),S=Cz(),_=Xae(),[j,R]=b.useState("all"),{toggle:N,togglingKey:O}=vS({mutation:_,assetLabel:"模板",keyOf:Tde}),[k,M]=b.useState(null),[T,L]=b.useState(null),[G,B]=b.useState(!1),V=b.useMemo(()=>gS(g.data??[],j),[g.data,j]),q=()=>{if(!k)return;const{id:U,name:H}=k;S.mutateAsync(U).then(()=>{ut.success(`模板「${H}」已删除`),M(null)}).catch(Y=>{ut.error(Ct(Y)),M(null)})},I=b.useCallback((U,H)=>M({id:U,name:H}),[]),z=b.useCallback((U,H)=>L({id:U,name:H}),[]),A=b.useCallback((U,H,Y)=>N({id:U,enabled:Y},{name:H}),[N]),P=g.data??[];return h.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[h.jsxs("div",{className:"mb-5 flex flex-wrap items-end justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-foreground",children:"DAG 模板"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"任务编排模板(可视化编辑请打开编辑器)"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ke,{type:"button",variant:"outline",disabled:!r||d,onClick:()=>B(!0),children:"导入模板"}),h.jsx(ke,{type:"button",disabled:!r||d,onClick:()=>E(!0),children:"+ 新建空白模板"})]})]}),c&&h.jsx(Bg,{project:c,onExit:f}),r&&P.length>0&&h.jsx("div",{className:"mb-3",children:h.jsx(yS,{value:j,onChange:R})}),o?h.jsx(rr,{message:Ct(o),onRetry:i}):!r||g.isLoading?h.jsx(Ir,{rows:3,cols:7}):g.isError?h.jsx(rr,{message:Ct(g.error),onRetry:()=>{g.refetch()}}):P.length===0?d?h.jsx(tr,{message:"该项目暂无模板"}):h.jsx(tr,{message:"当前项目暂无模板,可新建空白模板、复制其他项目的模板或运行 seed 脚本初始化",actionLabel:"新建空白模板",onAction:()=>E(!0)}):V.length===0?h.jsx(tr,{message:"当前筛选状态下没有模板,试试切换状态筛选"}):h.jsx(Nde,{templates:V,deletingId:S.isPending?S.variables:null,togglingKey:O,frozen:d,onDelete:I,onCopy:z,onToggleEnabled:A}),h.jsx(TE,{open:x,onOpenChange:E,title:"新建空白模板",label:"模板名称",placeholder:"如:发布流程模板",loading:v.isPending,onSubmit:U=>{v.mutateAsync(U.trim()).then(H=>{ut.success(`模板「${H.name}」已创建`),E(!1),y(`/dag/templates/${H.id}`)}).catch(H=>ut.error(Ct(H)))}}),h.jsx(Ri,{open:k!==null,onOpenChange:U=>{U||M(null)},title:"删除模板",description:k?`确定删除模板「${k.name}」?该操作不可恢复。`:void 0,confirmText:"删除",destructive:!0,loading:S.isPending,onConfirm:q}),h.jsx(bde,{open:T!==null,onOpenChange:U=>{U||L(null)},template:T,projects:t,defaultTargetId:e,onCopied:U=>{ut.success(`模板「${U.name}」已复制`),y(`/dag/templates/${U.id}`)}}),h.jsx(Rde,{open:G,onOpenChange:B,projectId:p,onImported:U=>{U.dependencies.every(H=>H.action!=="failed")&&y(`/templates/${U.template.id}`)}})]})}const Mde=new G3({defaultOptions:{queries:{retry:(e,t)=>t instanceof cw&&t.status>=400&&t.status<500?!1:e<3}}}),Br={dashboard:{title:"看板 · 司命",description:"任务统计与活跃任务总览"},dagEditor:{title:"DAG 编辑器 · 司命",description:"DAG 模板可视化编辑与实例查看"},skills:{title:"技能库 · 司命",description:"Skill 元数据管理"},agents:{title:"代理库 · 司命",description:"Agent 配置与绑定管理"},tasks:{title:"任务列表 · 司命",description:"全部任务与状态总览"},taskDetail:{title:"任务详情 · 司命",description:"任务详情与流转操作"},templates:{title:"模板列表 · 司命",description:"DAG 流程模板管理"},templateDetail:{title:"模板详情 · 司命",description:"DAG 模板拓扑只读查看"},projects:{title:"项目管理 · 司命",description:"项目维度与资产归属管理"},skillEdit:{title:"编辑技能 · 司命",description:"技能元数据与提示词内容编辑"},agentEdit:{title:"编辑代理 · 司命",description:"代理配置与技能绑定管理"},modelAliases:{title:"模型映射 · 司命",description:"Agent 模型映射与引用管理"},settingsEnums:{title:"枚举管理 · 司命",description:"全站下拉选项统一数据源(枚举注册表)"}};function kde(){return h.jsxs(h.Fragment,{children:[h.jsx(aq,{}),h.jsx(G5,{}),h.jsx(KV,{richColors:!0,position:"top-center"})]})}const Ade=bF([{element:h.jsx(kde,{}),children:[{path:"/",element:h.jsx($ue,{}),handle:{meta:Br.dashboard}},{path:"/tasks",element:h.jsx(vde,{}),handle:{meta:Br.tasks}},{path:"/tasks/:taskId",element:h.jsx(mde,{}),handle:{meta:Br.taskDetail}},{path:"/templates",element:h.jsx(Ode,{}),handle:{meta:Br.templates}},{path:"/templates/:id",element:h.jsx(xde,{}),handle:{meta:Br.templateDetail}},{path:"/dag/templates/:id",element:h.jsx(Pue,{}),handle:{meta:Br.dagEditor}},{path:"/skills",element:h.jsx(tde,{}),handle:{meta:Br.skills}},{path:"/skills/new",element:h.jsx(QO,{}),handle:{meta:Br.skillEdit}},{path:"/skills/:name/edit",element:h.jsx(QO,{}),handle:{meta:Br.skillEdit}},{path:"/agents",element:h.jsx(yZ,{}),handle:{meta:Br.agents}},{path:"/agents/new",element:h.jsx(vT,{}),handle:{meta:Br.agentEdit}},{path:"/agents/:name/edit",element:h.jsx(vT,{}),handle:{meta:Br.agentEdit}},{path:"/projects",element:h.jsx(Gue,{}),handle:{meta:Br.projects}},{path:"/settings/models",element:h.jsx(Vue,{}),handle:{meta:Br.modelAliases}},{path:"/settings/enums",element:h.jsx(Hue,{}),handle:{meta:Br.settingsEnums}}]}]);function Dde(){return h.jsx(K3,{client:Mde,children:h.jsx(zU,{children:h.jsx(kF,{router:Ade})})})}const aL=document.getElementById("root");if(!aL)throw new Error("#root not found");S3.createRoot(aL).render(h.jsx(b.StrictMode,{children:h.jsx(Dde,{})}));
|