@openscout/scout 0.2.52 → 0.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- function QR(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=s(i);fetch(i.href,l)}})();function zS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lp={exports:{}},ll={};var ox;function e2(){if(ox)return ll;ox=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var f in i)f!=="key"&&(l[f]=i[f])}else l=i;return i=l.ref,{$$typeof:e,type:r,key:u,ref:i!==void 0?i:null,props:l}}return ll.Fragment=t,ll.jsx=s,ll.jsxs=s,ll}var lx;function t2(){return lx||(lx=1,lp.exports=e2()),lp.exports}var d=t2(),cp={exports:{}},Ve={};var cx;function n2(){if(cx)return Ve;cx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,R={};function C(D,$,J){this.props=D,this.context=$,this.refs=R,this.updater=J||N}C.prototype.isReactComponent={},C.prototype.setState=function(D,$){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,$,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function j(){}j.prototype=C.prototype;function E(D,$,J){this.props=D,this.context=$,this.refs=R,this.updater=J||N}var _=E.prototype=new j;_.constructor=E,T(_,C.prototype),_.isPureReactComponent=!0;var A=Array.isArray;function M(){}var O={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function Y(D,$,J){var re=J.ref;return{$$typeof:e,type:D,key:$,ref:re!==void 0?re:null,props:J}}function F(D,$){return Y(D.type,$,D.props)}function B(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function P(D){var $={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return $[J]})}var X=/\/+/g;function ie(D,$){return typeof D=="object"&&D!==null&&D.key!=null?P(""+D.key):$.toString(36)}function ee(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(M,M):(D.status="pending",D.then(function($){D.status==="pending"&&(D.status="fulfilled",D.value=$)},function($){D.status==="pending"&&(D.status="rejected",D.reason=$)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function z(D,$,J,re,se){var ge=typeof D;(ge==="undefined"||ge==="boolean")&&(D=null);var he=!1;if(D===null)he=!0;else switch(ge){case"bigint":case"string":case"number":he=!0;break;case"object":switch(D.$$typeof){case e:case t:he=!0;break;case y:return he=D._init,z(he(D._payload),$,J,re,se)}}if(he)return se=se(D),he=re===""?"."+ie(D,0):re,A(se)?(J="",he!=null&&(J=he.replace(X,"$&/")+"/"),z(se,$,J,"",function(Ce){return Ce})):se!=null&&(B(se)&&(se=F(se,J+(se.key==null||D&&D.key===se.key?"":(""+se.key).replace(X,"$&/")+"/")+he)),$.push(se)),1;he=0;var pe=re===""?".":re+":";if(A(D))for(var be=0;be<D.length;be++)re=D[be],ge=pe+ie(re,be),he+=z(re,$,J,ge,se);else if(be=w(D),typeof be=="function")for(D=be.call(D),be=0;!(re=D.next()).done;)re=re.value,ge=pe+ie(re,be++),he+=z(re,$,J,ge,se);else if(ge==="object"){if(typeof D.then=="function")return z(ee(D),$,J,re,se);throw $=String(D),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return he}function H(D,$,J){if(D==null)return D;var re=[],se=0;return z(D,re,"","",function(ge){return $.call(J,ge,se++)}),re}function U(D){if(D._status===-1){var $=D._result;$=$(),$.then(function(J){(D._status===0||D._status===-1)&&(D._status=1,D._result=J)},function(J){(D._status===0||D._status===-1)&&(D._status=2,D._result=J)}),D._status===-1&&(D._status=0,D._result=$)}if(D._status===1)return D._result.default;throw D._result}var ne=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},G={map:H,forEach:function(D,$,J){H(D,function(){$.apply(this,arguments)},J)},count:function(D){var $=0;return H(D,function(){$++}),$},toArray:function(D){return H(D,function($){return $})||[]},only:function(D){if(!B(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ve.Activity=v,Ve.Children=G,Ve.Component=C,Ve.Fragment=s,Ve.Profiler=i,Ve.PureComponent=E,Ve.StrictMode=r,Ve.Suspense=m,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(D){return O.H.useMemoCache(D)}},Ve.cache=function(D){return function(){return D.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(D,$,J){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var re=T({},D.props),se=D.key;if($!=null)for(ge in $.key!==void 0&&(se=""+$.key),$)!I.call($,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&$.ref===void 0||(re[ge]=$[ge]);var ge=arguments.length-2;if(ge===1)re.children=J;else if(1<ge){for(var he=Array(ge),pe=0;pe<ge;pe++)he[pe]=arguments[pe+2];re.children=he}return Y(D.type,se,re)},Ve.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Ve.createElement=function(D,$,J){var re,se={},ge=null;if($!=null)for(re in $.key!==void 0&&(ge=""+$.key),$)I.call($,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(se[re]=$[re]);var he=arguments.length-2;if(he===1)se.children=J;else if(1<he){for(var pe=Array(he),be=0;be<he;be++)pe[be]=arguments[be+2];se.children=pe}if(D&&D.defaultProps)for(re in he=D.defaultProps,he)se[re]===void 0&&(se[re]=he[re]);return Y(D,ge,se)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(D){return{$$typeof:f,render:D}},Ve.isValidElement=B,Ve.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:U}},Ve.memo=function(D,$){return{$$typeof:h,type:D,compare:$===void 0?null:$}},Ve.startTransition=function(D){var $=O.T,J={};O.T=J;try{var re=D(),se=O.S;se!==null&&se(J,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(M,ne)}catch(ge){ne(ge)}finally{$!==null&&J.types!==null&&($.types=J.types),O.T=$}},Ve.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Ve.use=function(D){return O.H.use(D)},Ve.useActionState=function(D,$,J){return O.H.useActionState(D,$,J)},Ve.useCallback=function(D,$){return O.H.useCallback(D,$)},Ve.useContext=function(D){return O.H.useContext(D)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(D,$){return O.H.useDeferredValue(D,$)},Ve.useEffect=function(D,$){return O.H.useEffect(D,$)},Ve.useEffectEvent=function(D){return O.H.useEffectEvent(D)},Ve.useId=function(){return O.H.useId()},Ve.useImperativeHandle=function(D,$,J){return O.H.useImperativeHandle(D,$,J)},Ve.useInsertionEffect=function(D,$){return O.H.useInsertionEffect(D,$)},Ve.useLayoutEffect=function(D,$){return O.H.useLayoutEffect(D,$)},Ve.useMemo=function(D,$){return O.H.useMemo(D,$)},Ve.useOptimistic=function(D,$){return O.H.useOptimistic(D,$)},Ve.useReducer=function(D,$,J){return O.H.useReducer(D,$,J)},Ve.useRef=function(D){return O.H.useRef(D)},Ve.useState=function(D){return O.H.useState(D)},Ve.useSyncExternalStore=function(D,$,J){return O.H.useSyncExternalStore(D,$,J)},Ve.useTransition=function(){return O.H.useTransition()},Ve.version="19.2.3",Ve}var ux;function Vl(){return ux||(ux=1,cp.exports=n2()),cp.exports}var b=Vl();const IS=zS(b),LS=QR({__proto__:null,default:IS},[b]);var up={exports:{}},cl={},dp={exports:{}},fp={};var dx;function s2(){return dx||(dx=1,(function(e){function t(z,H){var U=z.length;z.push(H);e:for(;0<U;){var ne=U-1>>>1,G=z[ne];if(0<i(G,H))z[ne]=H,z[U]=G,U=ne;else break e}}function s(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var H=z[0],U=z.pop();if(U!==H){z[0]=U;e:for(var ne=0,G=z.length,D=G>>>1;ne<D;){var $=2*(ne+1)-1,J=z[$],re=$+1,se=z[re];if(0>i(J,U))re<G&&0>i(se,J)?(z[ne]=se,z[re]=U,ne=re):(z[ne]=J,z[$]=U,ne=$);else if(re<G&&0>i(se,U))z[ne]=se,z[re]=U,ne=re;else break e}}return H}function i(z,H){var U=z.sortIndex-H.sortIndex;return U!==0?U:z.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],h=[],y=1,v=null,x=3,w=!1,N=!1,T=!1,R=!1,C=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function _(z){for(var H=s(h);H!==null;){if(H.callback===null)r(h);else if(H.startTime<=z)r(h),H.sortIndex=H.expirationTime,t(m,H);else break;H=s(h)}}function A(z){if(T=!1,_(z),!N)if(s(m)!==null)N=!0,M||(M=!0,P());else{var H=s(h);H!==null&&ee(A,H.startTime-z)}}var M=!1,O=-1,I=5,Y=-1;function F(){return R?!0:!(e.unstable_now()-Y<I)}function B(){if(R=!1,M){var z=e.unstable_now();Y=z;var H=!0;try{e:{N=!1,T&&(T=!1,j(O),O=-1),w=!0;var U=x;try{t:{for(_(z),v=s(m);v!==null&&!(v.expirationTime>z&&F());){var ne=v.callback;if(typeof ne=="function"){v.callback=null,x=v.priorityLevel;var G=ne(v.expirationTime<=z);if(z=e.unstable_now(),typeof G=="function"){v.callback=G,_(z),H=!0;break t}v===s(m)&&r(m),_(z)}else r(m);v=s(m)}if(v!==null)H=!0;else{var D=s(h);D!==null&&ee(A,D.startTime-z),H=!1}}break e}finally{v=null,x=U,w=!1}H=void 0}}finally{H?P():M=!1}}}var P;if(typeof E=="function")P=function(){E(B)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,ie=X.port2;X.port1.onmessage=B,P=function(){ie.postMessage(null)}}else P=function(){C(B,0)};function ee(z,H){O=C(function(){z(e.unstable_now())},H)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(z){switch(x){case 1:case 2:case 3:var H=3;break;default:H=x}var U=x;x=H;try{return z()}finally{x=U}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(z,H){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var U=x;x=z;try{return H()}finally{x=U}},e.unstable_scheduleCallback=function(z,H,U){var ne=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?ne+U:ne):U=ne,z){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=U+G,z={id:y++,callback:H,priorityLevel:z,startTime:U,expirationTime:G,sortIndex:-1},U>ne?(z.sortIndex=U,t(h,z),s(m)===null&&z===s(h)&&(T?(j(O),O=-1):T=!0,ee(A,U-ne))):(z.sortIndex=G,t(m,z),N||w||(N=!0,M||(M=!0,P()))),z},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(z){var H=x;return function(){var U=x;x=H;try{return z.apply(this,arguments)}finally{x=U}}}})(fp)),fp}var fx;function a2(){return fx||(fx=1,dp.exports=s2()),dp.exports}var hp={exports:{}},dn={};var hx;function r2(){if(hx)return dn;hx=1;var e=Vl();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)h+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(m,h,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:""+v,children:m,containerInfo:h,implementation:y}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,dn.createPortal=function(m,h){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(m,h,null,y)},dn.flushSync=function(m){var h=u.T,y=r.p;try{if(u.T=null,r.p=2,m)return m()}finally{u.T=h,r.p=y,r.d.f()}},dn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(m,h))},dn.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},dn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var y=h.as,v=f(y,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;y==="style"?r.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:w}):y==="script"&&r.d.X(m,{crossOrigin:v,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},dn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var y=f(h.as,h.crossOrigin);r.d.M(m,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(m)},dn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var y=h.as,v=f(y,h.crossOrigin);r.d.L(m,y,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},dn.preloadModule=function(m,h){if(typeof m=="string")if(h){var y=f(h.as,h.crossOrigin);r.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(m)},dn.requestFormReset=function(m){r.d.r(m)},dn.unstable_batchedUpdates=function(m,h){return m(h)},dn.useFormState=function(m,h,y){return u.H.useFormState(m,h,y)},dn.useFormStatus=function(){return u.H.useHostTransitionStatus()},dn.version="19.2.3",dn}var px;function PS(){if(px)return hp.exports;px=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(),hp.exports=r2(),hp.exports}var mx;function i2(){if(mx)return cl;mx=1;var e=a2(),t=Vl(),s=PS();function r(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,o=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(o=a.return),n=a.return;while(n)}return a.tag===3?o:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function f(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(l(n)!==n)throw Error(r(188))}function h(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(r(188));return a!==n?null:n}for(var o=n,c=a;;){var p=o.return;if(p===null)break;var g=p.alternate;if(g===null){if(c=p.return,c!==null){o=c;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===o)return m(p),n;if(g===c)return m(p),a;g=g.sibling}throw Error(r(188))}if(o.return!==c.return)o=p,c=g;else{for(var S=!1,k=p.child;k;){if(k===o){S=!0,o=p,c=g;break}if(k===c){S=!0,c=p,o=g;break}k=k.sibling}if(!S){for(k=g.child;k;){if(k===o){S=!0,o=g,c=p;break}if(k===c){S=!0,c=g,o=p;break}k=k.sibling}if(!S)throw Error(r(189))}}if(o.alternate!==c)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?n:a}function y(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=y(n),a!==null)return a;n=n.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),E=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function P(n){return n===null||typeof n!="object"?null:(n=B&&n[B]||n["@@iterator"],typeof n=="function"?n:null)}var X=Symbol.for("react.client.reference");function ie(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===X?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case T:return"Fragment";case C:return"Profiler";case R:return"StrictMode";case A:return"Suspense";case M:return"SuspenseList";case Y:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case E:return n.displayName||"Context";case j:return(n._context.displayName||"Context")+".Consumer";case _:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case O:return a=n.displayName||null,a!==null?a:ie(n.type)||"Memo";case I:a=n._payload,n=n._init;try{return ie(n(a))}catch{}}return null}var ee=Array.isArray,z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},ne=[],G=-1;function D(n){return{current:n}}function $(n){0>G||(n.current=ne[G],ne[G]=null,G--)}function J(n,a){G++,ne[G]=n.current,n.current=a}var re=D(null),se=D(null),ge=D(null),he=D(null);function pe(n,a){switch(J(ge,a),J(se,n),J(re,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?_b(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=_b(a),n=kb(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}$(re),J(re,n)}function be(){$(re),$(se),$(ge)}function Ce(n){n.memoizedState!==null&&J(he,n);var a=re.current,o=kb(a,n.type);a!==o&&(J(se,n),J(re,o))}function fe(n){se.current===n&&($(re),$(se)),he.current===n&&($(he),al._currentValue=U)}var Re,we;function Pe(n){if(Re===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",we=-1<o.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Re+n+we}var _e=!1;function xe(n,a){if(!n||_e)return"";_e=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ae){var Q=ae}Reflect.construct(n,[],ue)}else{try{ue.call()}catch(ae){Q=ae}n.call(ue.prototype)}}else{try{throw Error()}catch(ae){Q=ae}(ue=n())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ae){if(ae&&Q&&typeof ae.stack=="string")return[ae.stack,Q.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),S=g[0],k=g[1];if(S&&k){var L=S.split(`
4
- `),W=k.split(`
5
- `);for(p=c=0;c<L.length&&!L[c].includes("DetermineComponentFrameRoot");)c++;for(;p<W.length&&!W[p].includes("DetermineComponentFrameRoot");)p++;if(c===L.length||p===W.length)for(c=L.length-1,p=W.length-1;1<=c&&0<=p&&L[c]!==W[p];)p--;for(;1<=c&&0<=p;c--,p--)if(L[c]!==W[p]){if(c!==1||p!==1)do if(c--,p--,0>p||L[c]!==W[p]){var oe=`
6
- `+L[c].replace(" at new "," at ");return n.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",n.displayName)),oe}while(1<=c&&0<=p);break}}}finally{_e=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Pe(o):""}function Se(n,a){switch(n.tag){case 26:case 27:case 5:return Pe(n.type);case 16:return Pe("Lazy");case 13:return n.child!==a&&a!==null?Pe("Suspense Fallback"):Pe("Suspense");case 19:return Pe("SuspenseList");case 0:case 15:return xe(n.type,!1);case 11:return xe(n.type.render,!1);case 1:return xe(n.type,!0);case 31:return Pe("Activity");default:return""}}function Ue(n){try{var a="",o=null;do a+=Se(n,o),o=n,n=n.return;while(n);return a}catch(c){return`
7
- Error generating stack: `+c.message+`
8
- `+c.stack}}var Le=Object.prototype.hasOwnProperty,Ze=e.unstable_scheduleCallback,Z=e.unstable_cancelCallback,te=e.unstable_shouldYield,de=e.unstable_requestPaint,me=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,Ae=e.unstable_ImmediatePriority,Ie=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,tt=e.unstable_LowPriority,Ot=e.unstable_IdlePriority,Nn=e.log,pn=e.unstable_setDisableYieldValue,Qt=null,Oe=null;function nt(n){if(typeof Nn=="function"&&pn(n),Oe&&typeof Oe.setStrictMode=="function")try{Oe.setStrictMode(Qt,n)}catch{}}var at=Math.clz32?Math.clz32:mn,yt=Math.log,Lt=Math.LN2;function mn(n){return n>>>=0,n===0?32:31-(yt(n)/Lt|0)|0}var Gt=256,Tn=262144,en=4194304;function gn(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function pa(n,a,o){var c=n.pendingLanes;if(c===0)return 0;var p=0,g=n.suspendedLanes,S=n.pingedLanes;n=n.warmLanes;var k=c&134217727;return k!==0?(c=k&~g,c!==0?p=gn(c):(S&=k,S!==0?p=gn(S):o||(o=k&~n,o!==0&&(p=gn(o))))):(k=c&~g,k!==0?p=gn(k):S!==0?p=gn(S):o||(o=c&~n,o!==0&&(p=gn(o)))),p===0?0:a!==0&&a!==p&&(a&g)===0&&(g=p&-p,o=a&-a,g>=o||g===32&&(o&4194048)!==0)?a:p}function ma(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Wd(n,a){switch(n){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 Wl(){var n=en;return en<<=1,(en&62914560)===0&&(en=4194304),n}function mo(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function cr(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function go(n,a,o,c,p,g){var S=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var k=n.entanglements,L=n.expirationTimes,W=n.hiddenUpdates;for(o=S&~o;0<o;){var oe=31-at(o),ue=1<<oe;k[oe]=0,L[oe]=-1;var Q=W[oe];if(Q!==null)for(W[oe]=null,oe=0;oe<Q.length;oe++){var ae=Q[oe];ae!==null&&(ae.lane&=-536870913)}o&=~ue}c!==0&&yo(n,c,0),g!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=g&~(S&~a))}function yo(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-at(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|o&261930}function Jl(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var c=31-at(o),p=1<<c;p&a|n[c]&a&&(n[c]|=a),o&=~p}}function Ql(n,a){var o=a&-a;return o=(o&42)!==0?1:Hs(o),(o&(n.suspendedLanes|a))!==0?0:o}function Hs(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function vo(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function ec(){var n=H.p;return n!==0?n:(n=window.event,n===void 0?32:ex(n.type))}function tc(n,a){var o=H.p;try{return H.p=n,a()}finally{H.p=o}}var ga=Math.random().toString(36).slice(2),tn="__reactFiber$"+ga,jn="__reactProps$"+ga,Gr="__reactContainer$"+ga,Jd="__reactEvents$"+ga,BC="__reactListeners$"+ga,ZC="__reactHandles$"+ga,yy="__reactResources$"+ga,bo="__reactMarker$"+ga;function Qd(n){delete n[tn],delete n[jn],delete n[Jd],delete n[BC],delete n[ZC]}function Xr(n){var a=n[tn];if(a)return a;for(var o=n.parentNode;o;){if(a=o[Gr]||o[tn]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=Pb(n);n!==null;){if(o=n[tn])return o;n=Pb(n)}return a}n=o,o=n.parentNode}return null}function Kr(n){if(n=n[tn]||n[Gr]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function xo(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(r(33))}function Wr(n){var a=n[yy];return a||(a=n[yy]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wt(n){n[bo]=!0}var vy=new Set,by={};function ur(n,a){Jr(n,a),Jr(n+"Capture",a)}function Jr(n,a){for(by[n]=a,n=0;n<a.length;n++)vy.add(a[n])}var HC=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]*$"),xy={},wy={};function FC(n){return Le.call(wy,n)?!0:Le.call(xy,n)?!1:HC.test(n)?wy[n]=!0:(xy[n]=!0,!1)}function nc(n,a,o){if(FC(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+o)}}function sc(n,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+o)}}function Fs(n,a,o,c){if(c===null)n.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+c)}}function Wn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Sy(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function qC(n,a,o){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,g=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return p.call(this)},set:function(S){o=""+S,g.call(this,S)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function ef(n){if(!n._valueTracker){var a=Sy(n)?"checked":"value";n._valueTracker=qC(n,a,""+n[a])}}function Ey(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),c="";return n&&(c=Sy(n)?n.checked?"true":"false":n.value),n=c,n!==o?(a.setValue(n),!0):!1}function ac(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var YC=/[\n"\\]/g;function Jn(n){return n.replace(YC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function tf(n,a,o,c,p,g,S,k){n.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.type=S:n.removeAttribute("type"),a!=null?S==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Wn(a)):n.value!==""+Wn(a)&&(n.value=""+Wn(a)):S!=="submit"&&S!=="reset"||n.removeAttribute("value"),a!=null?nf(n,S,Wn(a)):o!=null?nf(n,S,Wn(o)):c!=null&&n.removeAttribute("value"),p==null&&g!=null&&(n.defaultChecked=!!g),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Wn(k):n.removeAttribute("name")}function Ny(n,a,o,c,p,g,S,k){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(n.type=g),a!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){ef(n);return}o=o!=null?""+Wn(o):"",a=a!=null?""+Wn(a):o,k||a===n.value||(n.value=a),n.defaultValue=a}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=k?n.checked:!!c,n.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.name=S),ef(n)}function nf(n,a,o){a==="number"&&ac(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function Qr(n,a,o,c){if(n=n.options,a){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=a.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&c&&(n[o].defaultSelected=!0)}else{for(o=""+Wn(o),a=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,c&&(n[p].defaultSelected=!0);return}a!==null||n[p].disabled||(a=n[p])}a!==null&&(a.selected=!0)}}function Ty(n,a,o){if(a!=null&&(a=""+Wn(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Wn(o):""}function jy(n,a,o,c){if(a==null){if(c!=null){if(o!=null)throw Error(r(92));if(ee(c)){if(1<c.length)throw Error(r(93));c=c[0]}o=c}o==null&&(o=""),a=o}o=Wn(a),n.defaultValue=o,c=n.textContent,c===o&&c!==""&&c!==null&&(n.value=c),ef(n)}function ei(n,a){if(a){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=a;return}}n.textContent=a}var GC=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 Cy(n,a,o){var c=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,o):typeof o!="number"||o===0||GC.has(a)?a==="float"?n.cssFloat=o:n[a]=(""+o).trim():n[a]=o+"px"}function Ay(n,a,o){if(a!=null&&typeof a!="object")throw Error(r(62));if(n=n.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var p in a)c=a[p],a.hasOwnProperty(p)&&o[p]!==c&&Cy(n,p,c)}else for(var g in a)a.hasOwnProperty(g)&&Cy(n,g,a[g])}function sf(n){if(n.indexOf("-")===-1)return!1;switch(n){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 XC=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"]]),KC=/^[\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 rc(n){return KC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function qs(){}var af=null;function rf(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ti=null,ni=null;function Ry(n){var a=Kr(n);if(a&&(n=a.stateNode)){var o=n[jn]||null;e:switch(n=a.stateNode,a.type){case"input":if(tf(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Jn(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var c=o[a];if(c!==n&&c.form===n.form){var p=c[jn]||null;if(!p)throw Error(r(90));tf(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)c=o[a],c.form===n.form&&Ey(c)}break e;case"textarea":Ty(n,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&Qr(n,!!o.multiple,a,!1)}}}var of=!1;function _y(n,a,o){if(of)return n(a,o);of=!0;try{var c=n(a);return c}finally{if(of=!1,(ti!==null||ni!==null)&&(qc(),ti&&(a=ti,n=ni,ni=ti=null,Ry(a),n)))for(a=0;a<n.length;a++)Ry(n[a])}}function wo(n,a){var o=n.stateNode;if(o===null)return null;var c=o[jn]||null;if(c===null)return null;o=c[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":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(r(231,a,typeof o));return o}var Ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lf=!1;if(Ys)try{var So={};Object.defineProperty(So,"passive",{get:function(){lf=!0}}),window.addEventListener("test",So,So),window.removeEventListener("test",So,So)}catch{lf=!1}var ya=null,cf=null,ic=null;function ky(){if(ic)return ic;var n,a=cf,o=a.length,c,p="value"in ya?ya.value:ya.textContent,g=p.length;for(n=0;n<o&&a[n]===p[n];n++);var S=o-n;for(c=1;c<=S&&a[o-c]===p[g-c];c++);return ic=p.slice(n,1<c?1-c:void 0)}function oc(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function lc(){return!0}function My(){return!1}function Cn(n){function a(o,c,p,g,S){this._reactName=o,this._targetInst=p,this.type=c,this.nativeEvent=g,this.target=S,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(o=n[k],this[k]=o?o(g):g[k]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?lc:My,this.isPropagationStopped=My,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=lc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=lc)},persist:function(){},isPersistent:lc}),a}var dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cc=Cn(dr),Eo=v({},dr,{view:0,detail:0}),WC=Cn(Eo),uf,df,No,uc=v({},Eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hf,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==No&&(No&&n.type==="mousemove"?(uf=n.screenX-No.screenX,df=n.screenY-No.screenY):df=uf=0,No=n),uf)},movementY:function(n){return"movementY"in n?n.movementY:df}}),Oy=Cn(uc),JC=v({},uc,{dataTransfer:0}),QC=Cn(JC),eA=v({},Eo,{relatedTarget:0}),ff=Cn(eA),tA=v({},dr,{animationName:0,elapsedTime:0,pseudoElement:0}),nA=Cn(tA),sA=v({},dr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),aA=Cn(sA),rA=v({},dr,{data:0}),Dy=Cn(rA),iA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oA={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"},lA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cA(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=lA[n])?!!a[n]:!1}function hf(){return cA}var uA=v({},Eo,{key:function(n){if(n.key){var a=iA[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=oc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?oA[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hf,charCode:function(n){return n.type==="keypress"?oc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?oc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),dA=Cn(uA),fA=v({},uc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zy=Cn(fA),hA=v({},Eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hf}),pA=Cn(hA),mA=v({},dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),gA=Cn(mA),yA=v({},uc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),vA=Cn(yA),bA=v({},dr,{newState:0,oldState:0}),xA=Cn(bA),wA=[9,13,27,32],pf=Ys&&"CompositionEvent"in window,To=null;Ys&&"documentMode"in document&&(To=document.documentMode);var SA=Ys&&"TextEvent"in window&&!To,Iy=Ys&&(!pf||To&&8<To&&11>=To),Ly=" ",Py=!1;function $y(n,a){switch(n){case"keyup":return wA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var si=!1;function EA(n,a){switch(n){case"compositionend":return Uy(a);case"keypress":return a.which!==32?null:(Py=!0,Ly);case"textInput":return n=a.data,n===Ly&&Py?null:n;default:return null}}function NA(n,a){if(si)return n==="compositionend"||!pf&&$y(n,a)?(n=ky(),ic=cf=ya=null,si=!1,n):null;switch(n){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 Iy&&a.locale!=="ko"?null:a.data;default:return null}}var TA={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 Vy(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!TA[n.type]:a==="textarea"}function By(n,a,o,c){ti?ni?ni.push(c):ni=[c]:ti=c,a=Qc(a,"onChange"),0<a.length&&(o=new cc("onChange","change",null,o,c),n.push({event:o,listeners:a}))}var jo=null,Co=null;function jA(n){Nb(n,0)}function dc(n){var a=xo(n);if(Ey(a))return n}function Zy(n,a){if(n==="change")return a}var Hy=!1;if(Ys){var mf;if(Ys){var gf="oninput"in document;if(!gf){var Fy=document.createElement("div");Fy.setAttribute("oninput","return;"),gf=typeof Fy.oninput=="function"}mf=gf}else mf=!1;Hy=mf&&(!document.documentMode||9<document.documentMode)}function qy(){jo&&(jo.detachEvent("onpropertychange",Yy),Co=jo=null)}function Yy(n){if(n.propertyName==="value"&&dc(Co)){var a=[];By(a,Co,n,rf(n)),_y(jA,a)}}function CA(n,a,o){n==="focusin"?(qy(),jo=a,Co=o,jo.attachEvent("onpropertychange",Yy)):n==="focusout"&&qy()}function AA(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return dc(Co)}function RA(n,a){if(n==="click")return dc(a)}function _A(n,a){if(n==="input"||n==="change")return dc(a)}function kA(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Pn=typeof Object.is=="function"?Object.is:kA;function Ao(n,a){if(Pn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),c=Object.keys(a);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var p=o[c];if(!Le.call(a,p)||!Pn(n[p],a[p]))return!1}return!0}function Gy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Xy(n,a){var o=Gy(n);n=0;for(var c;o;){if(o.nodeType===3){if(c=n+o.textContent.length,n<=a&&c>=a)return{node:o,offset:a-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Gy(o)}}function Ky(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Ky(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Wy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=ac(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=ac(n.document)}return a}function yf(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var MA=Ys&&"documentMode"in document&&11>=document.documentMode,ai=null,vf=null,Ro=null,bf=!1;function Jy(n,a,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;bf||ai==null||ai!==ac(c)||(c=ai,"selectionStart"in c&&yf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ro&&Ao(Ro,c)||(Ro=c,c=Qc(vf,"onSelect"),0<c.length&&(a=new cc("onSelect","select",null,a,o),n.push({event:a,listeners:c}),a.target=ai)))}function fr(n,a){var o={};return o[n.toLowerCase()]=a.toLowerCase(),o["Webkit"+n]="webkit"+a,o["Moz"+n]="moz"+a,o}var ri={animationend:fr("Animation","AnimationEnd"),animationiteration:fr("Animation","AnimationIteration"),animationstart:fr("Animation","AnimationStart"),transitionrun:fr("Transition","TransitionRun"),transitionstart:fr("Transition","TransitionStart"),transitioncancel:fr("Transition","TransitionCancel"),transitionend:fr("Transition","TransitionEnd")},xf={},Qy={};Ys&&(Qy=document.createElement("div").style,"AnimationEvent"in window||(delete ri.animationend.animation,delete ri.animationiteration.animation,delete ri.animationstart.animation),"TransitionEvent"in window||delete ri.transitionend.transition);function hr(n){if(xf[n])return xf[n];if(!ri[n])return n;var a=ri[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in Qy)return xf[n]=a[o];return n}var ev=hr("animationend"),tv=hr("animationiteration"),nv=hr("animationstart"),OA=hr("transitionrun"),DA=hr("transitionstart"),zA=hr("transitioncancel"),sv=hr("transitionend"),av=new Map,wf="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(" ");wf.push("scrollEnd");function hs(n,a){av.set(n,a),ur(a,[n])}var fc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Qn=[],ii=0,Sf=0;function hc(){for(var n=ii,a=Sf=ii=0;a<n;){var o=Qn[a];Qn[a++]=null;var c=Qn[a];Qn[a++]=null;var p=Qn[a];Qn[a++]=null;var g=Qn[a];if(Qn[a++]=null,c!==null&&p!==null){var S=c.pending;S===null?p.next=p:(p.next=S.next,S.next=p),c.pending=p}g!==0&&rv(o,p,g)}}function pc(n,a,o,c){Qn[ii++]=n,Qn[ii++]=a,Qn[ii++]=o,Qn[ii++]=c,Sf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function Ef(n,a,o,c){return pc(n,a,o,c),mc(n)}function pr(n,a){return pc(n,null,null,a),mc(n)}function rv(n,a,o){n.lanes|=o;var c=n.alternate;c!==null&&(c.lanes|=o);for(var p=!1,g=n.return;g!==null;)g.childLanes|=o,c=g.alternate,c!==null&&(c.childLanes|=o),g.tag===22&&(n=g.stateNode,n===null||n._visibility&1||(p=!0)),n=g,g=g.return;return n.tag===3?(g=n.stateNode,p&&a!==null&&(p=31-at(o),n=g.hiddenUpdates,c=n[p],c===null?n[p]=[a]:c.push(a),a.lane=o|536870912),g):null}function mc(n){if(50<Wo)throw Wo=0,Mh=null,Error(r(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var oi={};function IA(n,a,o,c){this.tag=n,this.key=o,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=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(n,a,o,c){return new IA(n,a,o,c)}function Nf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Gs(n,a){var o=n.alternate;return o===null?(o=$n(n.tag,a,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=a,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,a=n.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function iv(n,a){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,a=o.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function gc(n,a,o,c,p,g){var S=0;if(c=n,typeof n=="function")Nf(n)&&(S=1);else if(typeof n=="string")S=VR(n,o,re.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case Y:return n=$n(31,o,a,p),n.elementType=Y,n.lanes=g,n;case T:return mr(o.children,p,g,a);case R:S=8,p|=24;break;case C:return n=$n(12,o,a,p|2),n.elementType=C,n.lanes=g,n;case A:return n=$n(13,o,a,p),n.elementType=A,n.lanes=g,n;case M:return n=$n(19,o,a,p),n.elementType=M,n.lanes=g,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:S=10;break e;case j:S=9;break e;case _:S=11;break e;case O:S=14;break e;case I:S=16,c=null;break e}S=29,o=Error(r(130,n===null?"null":typeof n,"")),c=null}return a=$n(S,o,a,p),a.elementType=n,a.type=c,a.lanes=g,a}function mr(n,a,o,c){return n=$n(7,n,c,a),n.lanes=o,n}function Tf(n,a,o){return n=$n(6,n,null,a),n.lanes=o,n}function ov(n){var a=$n(18,null,null,0);return a.stateNode=n,a}function jf(n,a,o){return a=$n(4,n.children!==null?n.children:[],n.key,a),a.lanes=o,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var lv=new WeakMap;function es(n,a){if(typeof n=="object"&&n!==null){var o=lv.get(n);return o!==void 0?o:(a={value:n,source:a,stack:Ue(a)},lv.set(n,a),a)}return{value:n,source:a,stack:Ue(a)}}var li=[],ci=0,yc=null,_o=0,ts=[],ns=0,va=null,js=1,Cs="";function Xs(n,a){li[ci++]=_o,li[ci++]=yc,yc=n,_o=a}function cv(n,a,o){ts[ns++]=js,ts[ns++]=Cs,ts[ns++]=va,va=n;var c=js;n=Cs;var p=32-at(c)-1;c&=~(1<<p),o+=1;var g=32-at(a)+p;if(30<g){var S=p-p%5;g=(c&(1<<S)-1).toString(32),c>>=S,p-=S,js=1<<32-at(a)+p|o<<p|c,Cs=g+n}else js=1<<g|o<<p|c,Cs=n}function Cf(n){n.return!==null&&(Xs(n,1),cv(n,1,0))}function Af(n){for(;n===yc;)yc=li[--ci],li[ci]=null,_o=li[--ci],li[ci]=null;for(;n===va;)va=ts[--ns],ts[ns]=null,Cs=ts[--ns],ts[ns]=null,js=ts[--ns],ts[ns]=null}function uv(n,a){ts[ns++]=js,ts[ns++]=Cs,ts[ns++]=va,js=a.id,Cs=a.overflow,va=n}var nn=null,xt=null,Qe=!1,ba=null,ss=!1,Rf=Error(r(519));function xa(n){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ko(es(a,n)),Rf}function dv(n){var a=n.stateNode,o=n.type,c=n.memoizedProps;switch(a[tn]=n,a[jn]=c,o){case"dialog":Xe("cancel",a),Xe("close",a);break;case"iframe":case"object":case"embed":Xe("load",a);break;case"video":case"audio":for(o=0;o<Qo.length;o++)Xe(Qo[o],a);break;case"source":Xe("error",a);break;case"img":case"image":case"link":Xe("error",a),Xe("load",a);break;case"details":Xe("toggle",a);break;case"input":Xe("invalid",a),Ny(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Xe("invalid",a);break;case"textarea":Xe("invalid",a),jy(a,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||c.suppressHydrationWarning===!0||Ab(a.textContent,o)?(c.popover!=null&&(Xe("beforetoggle",a),Xe("toggle",a)),c.onScroll!=null&&Xe("scroll",a),c.onScrollEnd!=null&&Xe("scrollend",a),c.onClick!=null&&(a.onclick=qs),a=!0):a=!1,a||xa(n,!0)}function fv(n){for(nn=n.return;nn;)switch(nn.tag){case 5:case 31:case 13:ss=!1;return;case 27:case 3:ss=!0;return;default:nn=nn.return}}function ui(n){if(n!==nn)return!1;if(!Qe)return fv(n),Qe=!0,!1;var a=n.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||Yh(n.type,n.memoizedProps)),o=!o),o&&xt&&xa(n),fv(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));xt=Lb(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));xt=Lb(n)}else a===27?(a=xt,Da(n.type)?(n=Jh,Jh=null,xt=n):xt=a):xt=nn?rs(n.stateNode.nextSibling):null;return!0}function gr(){xt=nn=null,Qe=!1}function _f(){var n=ba;return n!==null&&(kn===null?kn=n:kn.push.apply(kn,n),ba=null),n}function ko(n){ba===null?ba=[n]:ba.push(n)}var kf=D(null),yr=null,Ks=null;function wa(n,a,o){J(kf,a._currentValue),a._currentValue=o}function Ws(n){n._currentValue=kf.current,$(kf)}function Mf(n,a,o){for(;n!==null;){var c=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),n===o)break;n=n.return}}function Of(n,a,o,c){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var g=p.dependencies;if(g!==null){var S=p.child;g=g.firstContext;e:for(;g!==null;){var k=g;g=p;for(var L=0;L<a.length;L++)if(k.context===a[L]){g.lanes|=o,k=g.alternate,k!==null&&(k.lanes|=o),Mf(g.return,o,n),c||(S=null);break e}g=k.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(r(341));S.lanes|=o,g=S.alternate,g!==null&&(g.lanes|=o),Mf(S,o,n),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===n){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function di(n,a,o,c){n=null;for(var p=a,g=!1;p!==null;){if(!g){if((p.flags&524288)!==0)g=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var k=p.type;Pn(p.pendingProps.value,S.value)||(n!==null?n.push(k):n=[k])}}else if(p===he.current){if(S=p.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(al):n=[al])}p=p.return}n!==null&&Of(a,n,o,c),a.flags|=262144}function vc(n){for(n=n.firstContext;n!==null;){if(!Pn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function vr(n){yr=n,Ks=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function sn(n){return hv(yr,n)}function bc(n,a){return yr===null&&vr(n),hv(n,a)}function hv(n,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},Ks===null){if(n===null)throw Error(r(308));Ks=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Ks=Ks.next=a;return o}var LA=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},PA=e.unstable_scheduleCallback,$A=e.unstable_NormalPriority,Vt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Df(){return{controller:new LA,data:new Map,refCount:0}}function Mo(n){n.refCount--,n.refCount===0&&PA($A,function(){n.controller.abort()})}var Oo=null,zf=0,fi=0,hi=null;function UA(n,a){if(Oo===null){var o=Oo=[];zf=0,fi=Ph(),hi={status:"pending",value:void 0,then:function(c){o.push(c)}}}return zf++,a.then(pv,pv),a}function pv(){if(--zf===0&&Oo!==null){hi!==null&&(hi.status="fulfilled");var n=Oo;Oo=null,fi=0,hi=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function VA(n,a){var o=[],c={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(c.status="rejected",c.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),c}var mv=z.S;z.S=function(n,a){J0=me(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&UA(n,a),mv!==null&&mv(n,a)};var br=D(null);function If(){var n=br.current;return n!==null?n:mt.pooledCache}function xc(n,a){a===null?J(br,br.current):J(br,a.pool)}function gv(){var n=If();return n===null?null:{parent:Vt._currentValue,pool:n}}var pi=Error(r(460)),Lf=Error(r(474)),wc=Error(r(542)),Sc={then:function(){}};function yv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function vv(n,a,o){switch(o=n[o],o===void 0?n.push(a):o!==a&&(a.then(qs,qs),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,xv(n),n;default:if(typeof a.status=="string")a.then(qs,qs);else{if(n=mt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=c}},function(c){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,xv(n),n}throw wr=a,pi}}function xr(n){try{var a=n._init;return a(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(wr=o,pi):o}}var wr=null;function bv(){if(wr===null)throw Error(r(459));var n=wr;return wr=null,n}function xv(n){if(n===pi||n===wc)throw Error(r(483))}var mi=null,Do=0;function Ec(n){var a=Do;return Do+=1,mi===null&&(mi=[]),vv(mi,n,a)}function zo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Nc(n,a){throw a.$$typeof===x?Error(r(525)):(n=Object.prototype.toString.call(a),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function wv(n){function a(q,V){if(n){var K=q.deletions;K===null?(q.deletions=[V],q.flags|=16):K.push(V)}}function o(q,V){if(!n)return null;for(;V!==null;)a(q,V),V=V.sibling;return null}function c(q){for(var V=new Map;q!==null;)q.key!==null?V.set(q.key,q):V.set(q.index,q),q=q.sibling;return V}function p(q,V){return q=Gs(q,V),q.index=0,q.sibling=null,q}function g(q,V,K){return q.index=K,n?(K=q.alternate,K!==null?(K=K.index,K<V?(q.flags|=67108866,V):K):(q.flags|=67108866,V)):(q.flags|=1048576,V)}function S(q){return n&&q.alternate===null&&(q.flags|=67108866),q}function k(q,V,K,ce){return V===null||V.tag!==6?(V=Tf(K,q.mode,ce),V.return=q,V):(V=p(V,K),V.return=q,V)}function L(q,V,K,ce){var ke=K.type;return ke===T?oe(q,V,K.props.children,ce,K.key):V!==null&&(V.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===I&&xr(ke)===V.type)?(V=p(V,K.props),zo(V,K),V.return=q,V):(V=gc(K.type,K.key,K.props,null,q.mode,ce),zo(V,K),V.return=q,V)}function W(q,V,K,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==K.containerInfo||V.stateNode.implementation!==K.implementation?(V=jf(K,q.mode,ce),V.return=q,V):(V=p(V,K.children||[]),V.return=q,V)}function oe(q,V,K,ce,ke){return V===null||V.tag!==7?(V=mr(K,q.mode,ce,ke),V.return=q,V):(V=p(V,K),V.return=q,V)}function ue(q,V,K){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Tf(""+V,q.mode,K),V.return=q,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return K=gc(V.type,V.key,V.props,null,q.mode,K),zo(K,V),K.return=q,K;case N:return V=jf(V,q.mode,K),V.return=q,V;case I:return V=xr(V),ue(q,V,K)}if(ee(V)||P(V))return V=mr(V,q.mode,K,null),V.return=q,V;if(typeof V.then=="function")return ue(q,Ec(V),K);if(V.$$typeof===E)return ue(q,bc(q,V),K);Nc(q,V)}return null}function Q(q,V,K,ce){var ke=V!==null?V.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return ke!==null?null:k(q,V,""+K,ce);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return K.key===ke?L(q,V,K,ce):null;case N:return K.key===ke?W(q,V,K,ce):null;case I:return K=xr(K),Q(q,V,K,ce)}if(ee(K)||P(K))return ke!==null?null:oe(q,V,K,ce,null);if(typeof K.then=="function")return Q(q,V,Ec(K),ce);if(K.$$typeof===E)return Q(q,V,bc(q,K),ce);Nc(q,K)}return null}function ae(q,V,K,ce,ke){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return q=q.get(K)||null,k(V,q,""+ce,ke);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:return q=q.get(ce.key===null?K:ce.key)||null,L(V,q,ce,ke);case N:return q=q.get(ce.key===null?K:ce.key)||null,W(V,q,ce,ke);case I:return ce=xr(ce),ae(q,V,K,ce,ke)}if(ee(ce)||P(ce))return q=q.get(K)||null,oe(V,q,ce,ke,null);if(typeof ce.then=="function")return ae(q,V,K,Ec(ce),ke);if(ce.$$typeof===E)return ae(q,V,K,bc(V,ce),ke);Nc(V,ce)}return null}function Ee(q,V,K,ce){for(var ke=null,rt=null,Te=V,qe=V=0,Je=null;Te!==null&&qe<K.length;qe++){Te.index>qe?(Je=Te,Te=null):Je=Te.sibling;var it=Q(q,Te,K[qe],ce);if(it===null){Te===null&&(Te=Je);break}n&&Te&&it.alternate===null&&a(q,Te),V=g(it,V,qe),rt===null?ke=it:rt.sibling=it,rt=it,Te=Je}if(qe===K.length)return o(q,Te),Qe&&Xs(q,qe),ke;if(Te===null){for(;qe<K.length;qe++)Te=ue(q,K[qe],ce),Te!==null&&(V=g(Te,V,qe),rt===null?ke=Te:rt.sibling=Te,rt=Te);return Qe&&Xs(q,qe),ke}for(Te=c(Te);qe<K.length;qe++)Je=ae(Te,q,qe,K[qe],ce),Je!==null&&(n&&Je.alternate!==null&&Te.delete(Je.key===null?qe:Je.key),V=g(Je,V,qe),rt===null?ke=Je:rt.sibling=Je,rt=Je);return n&&Te.forEach(function($a){return a(q,$a)}),Qe&&Xs(q,qe),ke}function De(q,V,K,ce){if(K==null)throw Error(r(151));for(var ke=null,rt=null,Te=V,qe=V=0,Je=null,it=K.next();Te!==null&&!it.done;qe++,it=K.next()){Te.index>qe?(Je=Te,Te=null):Je=Te.sibling;var $a=Q(q,Te,it.value,ce);if($a===null){Te===null&&(Te=Je);break}n&&Te&&$a.alternate===null&&a(q,Te),V=g($a,V,qe),rt===null?ke=$a:rt.sibling=$a,rt=$a,Te=Je}if(it.done)return o(q,Te),Qe&&Xs(q,qe),ke;if(Te===null){for(;!it.done;qe++,it=K.next())it=ue(q,it.value,ce),it!==null&&(V=g(it,V,qe),rt===null?ke=it:rt.sibling=it,rt=it);return Qe&&Xs(q,qe),ke}for(Te=c(Te);!it.done;qe++,it=K.next())it=ae(Te,q,qe,it.value,ce),it!==null&&(n&&it.alternate!==null&&Te.delete(it.key===null?qe:it.key),V=g(it,V,qe),rt===null?ke=it:rt.sibling=it,rt=it);return n&&Te.forEach(function(JR){return a(q,JR)}),Qe&&Xs(q,qe),ke}function pt(q,V,K,ce){if(typeof K=="object"&&K!==null&&K.type===T&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case w:e:{for(var ke=K.key;V!==null;){if(V.key===ke){if(ke=K.type,ke===T){if(V.tag===7){o(q,V.sibling),ce=p(V,K.props.children),ce.return=q,q=ce;break e}}else if(V.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===I&&xr(ke)===V.type){o(q,V.sibling),ce=p(V,K.props),zo(ce,K),ce.return=q,q=ce;break e}o(q,V);break}else a(q,V);V=V.sibling}K.type===T?(ce=mr(K.props.children,q.mode,ce,K.key),ce.return=q,q=ce):(ce=gc(K.type,K.key,K.props,null,q.mode,ce),zo(ce,K),ce.return=q,q=ce)}return S(q);case N:e:{for(ke=K.key;V!==null;){if(V.key===ke)if(V.tag===4&&V.stateNode.containerInfo===K.containerInfo&&V.stateNode.implementation===K.implementation){o(q,V.sibling),ce=p(V,K.children||[]),ce.return=q,q=ce;break e}else{o(q,V);break}else a(q,V);V=V.sibling}ce=jf(K,q.mode,ce),ce.return=q,q=ce}return S(q);case I:return K=xr(K),pt(q,V,K,ce)}if(ee(K))return Ee(q,V,K,ce);if(P(K)){if(ke=P(K),typeof ke!="function")throw Error(r(150));return K=ke.call(K),De(q,V,K,ce)}if(typeof K.then=="function")return pt(q,V,Ec(K),ce);if(K.$$typeof===E)return pt(q,V,bc(q,K),ce);Nc(q,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,V!==null&&V.tag===6?(o(q,V.sibling),ce=p(V,K),ce.return=q,q=ce):(o(q,V),ce=Tf(K,q.mode,ce),ce.return=q,q=ce),S(q)):o(q,V)}return function(q,V,K,ce){try{Do=0;var ke=pt(q,V,K,ce);return mi=null,ke}catch(Te){if(Te===pi||Te===wc)throw Te;var rt=$n(29,Te,null,q.mode);return rt.lanes=ce,rt.return=q,rt}}}var Sr=wv(!0),Sv=wv(!1),Sa=!1;function Pf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $f(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ea(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Na(n,a,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(ot&2)!==0){var p=c.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a,a=mc(n),rv(n,null,o),a}return pc(n,c,a,o),mc(n)}function Io(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Jl(n,o)}}function Uf(n,a){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var p=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var S={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?p=g=S:g=g.next=S,o=o.next}while(o!==null);g===null?p=g=a:g=g.next=a}else p=g=a;o={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var Vf=!1;function Lo(){if(Vf){var n=hi;if(n!==null)throw n}}function Po(n,a,o,c){Vf=!1;var p=n.updateQueue;Sa=!1;var g=p.firstBaseUpdate,S=p.lastBaseUpdate,k=p.shared.pending;if(k!==null){p.shared.pending=null;var L=k,W=L.next;L.next=null,S===null?g=W:S.next=W,S=L;var oe=n.alternate;oe!==null&&(oe=oe.updateQueue,k=oe.lastBaseUpdate,k!==S&&(k===null?oe.firstBaseUpdate=W:k.next=W,oe.lastBaseUpdate=L))}if(g!==null){var ue=p.baseState;S=0,oe=W=L=null,k=g;do{var Q=k.lane&-536870913,ae=Q!==k.lane;if(ae?(We&Q)===Q:(c&Q)===Q){Q!==0&&Q===fi&&(Vf=!0),oe!==null&&(oe=oe.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ee=n,De=k;Q=a;var pt=o;switch(De.tag){case 1:if(Ee=De.payload,typeof Ee=="function"){ue=Ee.call(pt,ue,Q);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=De.payload,Q=typeof Ee=="function"?Ee.call(pt,ue,Q):Ee,Q==null)break e;ue=v({},ue,Q);break e;case 2:Sa=!0}}Q=k.callback,Q!==null&&(n.flags|=64,ae&&(n.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[Q]:ae.push(Q))}else ae={lane:Q,tag:k.tag,payload:k.payload,callback:k.callback,next:null},oe===null?(W=oe=ae,L=ue):oe=oe.next=ae,S|=Q;if(k=k.next,k===null){if(k=p.shared.pending,k===null)break;ae=k,k=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);oe===null&&(L=ue),p.baseState=L,p.firstBaseUpdate=W,p.lastBaseUpdate=oe,g===null&&(p.shared.lanes=0),Ra|=S,n.lanes=S,n.memoizedState=ue}}function Ev(n,a){if(typeof n!="function")throw Error(r(191,n));n.call(a)}function Nv(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)Ev(o[n],a)}var gi=D(null),Tc=D(0);function Tv(n,a){n=ia,J(Tc,n),J(gi,a),ia=n|a.baseLanes}function Bf(){J(Tc,ia),J(gi,gi.current)}function Zf(){ia=Tc.current,$(gi),$(Tc)}var Un=D(null),as=null;function Ta(n){var a=n.alternate;J(Pt,Pt.current&1),J(Un,n),as===null&&(a===null||gi.current!==null||a.memoizedState!==null)&&(as=n)}function Hf(n){J(Pt,Pt.current),J(Un,n),as===null&&(as=n)}function jv(n){n.tag===22?(J(Pt,Pt.current),J(Un,n),as===null&&(as=n)):ja()}function ja(){J(Pt,Pt.current),J(Un,Un.current)}function Vn(n){$(Un),as===n&&(as=null),$(Pt)}var Pt=D(0);function jc(n){for(var a=n;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Kh(o)||Wh(o)))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===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Js=0,Fe=null,ft=null,Bt=null,Cc=!1,yi=!1,Er=!1,Ac=0,$o=0,vi=null,BA=0;function Dt(){throw Error(r(321))}function Ff(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!Pn(n[o],a[o]))return!1;return!0}function qf(n,a,o,c,p,g){return Js=g,Fe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,z.H=n===null||n.memoizedState===null?c0:oh,Er=!1,g=o(c,p),Er=!1,yi&&(g=Av(a,o,c,p)),Cv(n),g}function Cv(n){z.H=Bo;var a=ft!==null&&ft.next!==null;if(Js=0,Bt=ft=Fe=null,Cc=!1,$o=0,vi=null,a)throw Error(r(300));n===null||Zt||(n=n.dependencies,n!==null&&vc(n)&&(Zt=!0))}function Av(n,a,o,c){Fe=n;var p=0;do{if(yi&&(vi=null),$o=0,yi=!1,25<=p)throw Error(r(301));if(p+=1,Bt=ft=null,n.updateQueue!=null){var g=n.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}z.H=u0,g=a(o,c)}while(yi);return g}function ZA(){var n=z.H,a=n.useState()[0];return a=typeof a.then=="function"?Uo(a):a,n=n.useState()[0],(ft!==null?ft.memoizedState:null)!==n&&(Fe.flags|=1024),a}function Yf(){var n=Ac!==0;return Ac=0,n}function Gf(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function Xf(n){if(Cc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Cc=!1}Js=0,Bt=ft=Fe=null,yi=!1,$o=Ac=0,vi=null}function yn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Fe.memoizedState=Bt=n:Bt=Bt.next=n,Bt}function $t(){if(ft===null){var n=Fe.alternate;n=n!==null?n.memoizedState:null}else n=ft.next;var a=Bt===null?Fe.memoizedState:Bt.next;if(a!==null)Bt=a,ft=n;else{if(n===null)throw Fe.alternate===null?Error(r(467)):Error(r(310));ft=n,n={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},Bt===null?Fe.memoizedState=Bt=n:Bt=Bt.next=n}return Bt}function Rc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Uo(n){var a=$o;return $o+=1,vi===null&&(vi=[]),n=vv(vi,n,a),a=Fe,(Bt===null?a.memoizedState:Bt.next)===null&&(a=a.alternate,z.H=a===null||a.memoizedState===null?c0:oh),n}function _c(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Uo(n);if(n.$$typeof===E)return sn(n)}throw Error(r(438,String(n)))}function Kf(n){var a=null,o=Fe.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var c=Fe.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=Rc(),Fe.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),c=0;c<n;c++)o[c]=F;return a.index++,o}function Qs(n,a){return typeof a=="function"?a(n):a}function kc(n){var a=$t();return Wf(a,ft,n)}function Wf(n,a,o){var c=n.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=o;var p=n.baseQueue,g=c.pending;if(g!==null){if(p!==null){var S=p.next;p.next=g.next,g.next=S}a.baseQueue=p=g,c.pending=null}if(g=n.baseState,p===null)n.memoizedState=g;else{a=p.next;var k=S=null,L=null,W=a,oe=!1;do{var ue=W.lane&-536870913;if(ue!==W.lane?(We&ue)===ue:(Js&ue)===ue){var Q=W.revertLane;if(Q===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ue===fi&&(oe=!0);else if((Js&Q)===Q){W=W.next,Q===fi&&(oe=!0);continue}else ue={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},L===null?(k=L=ue,S=g):L=L.next=ue,Fe.lanes|=Q,Ra|=Q;ue=W.action,Er&&o(g,ue),g=W.hasEagerState?W.eagerState:o(g,ue)}else Q={lane:ue,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},L===null?(k=L=Q,S=g):L=L.next=Q,Fe.lanes|=ue,Ra|=ue;W=W.next}while(W!==null&&W!==a);if(L===null?S=g:L.next=k,!Pn(g,n.memoizedState)&&(Zt=!0,oe&&(o=hi,o!==null)))throw o;n.memoizedState=g,n.baseState=S,n.baseQueue=L,c.lastRenderedState=g}return p===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Jf(n){var a=$t(),o=a.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var c=o.dispatch,p=o.pending,g=a.memoizedState;if(p!==null){o.pending=null;var S=p=p.next;do g=n(g,S.action),S=S.next;while(S!==p);Pn(g,a.memoizedState)||(Zt=!0),a.memoizedState=g,a.baseQueue===null&&(a.baseState=g),o.lastRenderedState=g}return[g,c]}function Rv(n,a,o){var c=Fe,p=$t(),g=Qe;if(g){if(o===void 0)throw Error(r(407));o=o()}else o=a();var S=!Pn((ft||p).memoizedState,o);if(S&&(p.memoizedState=o,Zt=!0),p=p.queue,th(Mv.bind(null,c,p,n),[n]),p.getSnapshot!==a||S||Bt!==null&&Bt.memoizedState.tag&1){if(c.flags|=2048,bi(9,{destroy:void 0},kv.bind(null,c,p,o,a),null),mt===null)throw Error(r(349));g||(Js&127)!==0||_v(c,a,o)}return o}function _v(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=Fe.updateQueue,a===null?(a=Rc(),Fe.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function kv(n,a,o,c){a.value=o,a.getSnapshot=c,Ov(a)&&Dv(n)}function Mv(n,a,o){return o(function(){Ov(a)&&Dv(n)})}function Ov(n){var a=n.getSnapshot;n=n.value;try{var o=a();return!Pn(n,o)}catch{return!0}}function Dv(n){var a=pr(n,2);a!==null&&Mn(a,n,2)}function Qf(n){var a=yn();if(typeof n=="function"){var o=n;if(n=o(),Er){nt(!0);try{o()}finally{nt(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:n},a}function zv(n,a,o,c){return n.baseState=o,Wf(n,ft,typeof c=="function"?c:Qs)}function HA(n,a,o,c,p){if(Dc(n))throw Error(r(485));if(n=a.action,n!==null){var g={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){g.listeners.push(S)}};z.T!==null?o(!0):g.isTransition=!1,c(g),o=a.pending,o===null?(g.next=a.pending=g,Iv(a,g)):(g.next=o.next,a.pending=o.next=g)}}function Iv(n,a){var o=a.action,c=a.payload,p=n.state;if(a.isTransition){var g=z.T,S={};z.T=S;try{var k=o(p,c),L=z.S;L!==null&&L(S,k),Lv(n,a,k)}catch(W){eh(n,a,W)}finally{g!==null&&S.types!==null&&(g.types=S.types),z.T=g}}else try{g=o(p,c),Lv(n,a,g)}catch(W){eh(n,a,W)}}function Lv(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Pv(n,a,c)},function(c){return eh(n,a,c)}):Pv(n,a,o)}function Pv(n,a,o){a.status="fulfilled",a.value=o,$v(a),n.state=o,a=n.pending,a!==null&&(o=a.next,o===a?n.pending=null:(o=o.next,a.next=o,Iv(n,o)))}function eh(n,a,o){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=o,$v(a),a=a.next;while(a!==c)}n.action=null}function $v(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Uv(n,a){return a}function Vv(n,a){if(Qe){var o=mt.formState;if(o!==null){e:{var c=Fe;if(Qe){if(xt){t:{for(var p=xt,g=ss;p.nodeType!==8;){if(!g){p=null;break t}if(p=rs(p.nextSibling),p===null){p=null;break t}}g=p.data,p=g==="F!"||g==="F"?p:null}if(p){xt=rs(p.nextSibling),c=p.data==="F!";break e}}xa(c)}c=!1}c&&(a=o[0])}}return o=yn(),o.memoizedState=o.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Uv,lastRenderedState:a},o.queue=c,o=i0.bind(null,Fe,c),c.dispatch=o,c=Qf(!1),g=ih.bind(null,Fe,!1,c.queue),c=yn(),p={state:a,dispatch:null,action:n,pending:null},c.queue=p,o=HA.bind(null,Fe,p,g,o),p.dispatch=o,c.memoizedState=n,[a,o,!1]}function Bv(n){var a=$t();return Zv(a,ft,n)}function Zv(n,a,o){if(a=Wf(n,a,Uv)[0],n=kc(Qs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Uo(a)}catch(S){throw S===pi?wc:S}else c=a;a=$t();var p=a.queue,g=p.dispatch;return o!==a.memoizedState&&(Fe.flags|=2048,bi(9,{destroy:void 0},FA.bind(null,p,o),null)),[c,g,n]}function FA(n,a){n.action=a}function Hv(n){var a=$t(),o=ft;if(o!==null)return Zv(a,o,n);$t(),a=a.memoizedState,o=$t();var c=o.queue.dispatch;return o.memoizedState=n,[a,c,!1]}function bi(n,a,o,c){return n={tag:n,create:o,deps:c,inst:a,next:null},a=Fe.updateQueue,a===null&&(a=Rc(),Fe.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(c=o.next,o.next=n,n.next=c,a.lastEffect=n),n}function Fv(){return $t().memoizedState}function Mc(n,a,o,c){var p=yn();Fe.flags|=n,p.memoizedState=bi(1|a,{destroy:void 0},o,c===void 0?null:c)}function Oc(n,a,o,c){var p=$t();c=c===void 0?null:c;var g=p.memoizedState.inst;ft!==null&&c!==null&&Ff(c,ft.memoizedState.deps)?p.memoizedState=bi(a,g,o,c):(Fe.flags|=n,p.memoizedState=bi(1|a,g,o,c))}function qv(n,a){Mc(8390656,8,n,a)}function th(n,a){Oc(2048,8,n,a)}function qA(n){Fe.flags|=4;var a=Fe.updateQueue;if(a===null)a=Rc(),Fe.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function Yv(n){var a=$t().memoizedState;return qA({ref:a,nextImpl:n}),function(){if((ot&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Gv(n,a){return Oc(4,2,n,a)}function Xv(n,a){return Oc(4,4,n,a)}function Kv(n,a){if(typeof a=="function"){n=n();var o=a(n);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Wv(n,a,o){o=o!=null?o.concat([n]):null,Oc(4,4,Kv.bind(null,a,n),o)}function nh(){}function Jv(n,a){var o=$t();a=a===void 0?null:a;var c=o.memoizedState;return a!==null&&Ff(a,c[1])?c[0]:(o.memoizedState=[n,a],n)}function Qv(n,a){var o=$t();a=a===void 0?null:a;var c=o.memoizedState;if(a!==null&&Ff(a,c[1]))return c[0];if(c=n(),Er){nt(!0);try{n()}finally{nt(!1)}}return o.memoizedState=[c,a],c}function sh(n,a,o){return o===void 0||(Js&1073741824)!==0&&(We&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=eb(),Fe.lanes|=n,Ra|=n,o)}function e0(n,a,o,c){return Pn(o,a)?o:gi.current!==null?(n=sh(n,o,c),Pn(n,a)||(Zt=!0),n):(Js&42)===0||(Js&1073741824)!==0&&(We&261930)===0?(Zt=!0,n.memoizedState=o):(n=eb(),Fe.lanes|=n,Ra|=n,a)}function t0(n,a,o,c,p){var g=H.p;H.p=g!==0&&8>g?g:8;var S=z.T,k={};z.T=k,ih(n,!1,a,o);try{var L=p(),W=z.S;if(W!==null&&W(k,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var oe=VA(L,c);Vo(n,a,oe,Hn(n))}else Vo(n,a,c,Hn(n))}catch(ue){Vo(n,a,{then:function(){},status:"rejected",reason:ue},Hn())}finally{H.p=g,S!==null&&k.types!==null&&(S.types=k.types),z.T=S}}function YA(){}function ah(n,a,o,c){if(n.tag!==5)throw Error(r(476));var p=n0(n).queue;t0(n,p,a,U,o===null?YA:function(){return s0(n),o(c)})}function n0(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:U},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function s0(n){var a=n0(n);a.next===null&&(a=n.alternate.memoizedState),Vo(n,a.next.queue,{},Hn())}function rh(){return sn(al)}function a0(){return $t().memoizedState}function r0(){return $t().memoizedState}function GA(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=Hn();n=Ea(o);var c=Na(a,n,o);c!==null&&(Mn(c,a,o),Io(c,a,o)),a={cache:Df()},n.payload=a;return}a=a.return}}function XA(n,a,o){var c=Hn();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Dc(n)?o0(a,o):(o=Ef(n,a,o,c),o!==null&&(Mn(o,n,c),l0(o,a,c)))}function i0(n,a,o){var c=Hn();Vo(n,a,o,c)}function Vo(n,a,o,c){var p={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Dc(n))o0(a,p);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var S=a.lastRenderedState,k=g(S,o);if(p.hasEagerState=!0,p.eagerState=k,Pn(k,S))return pc(n,a,p,0),mt===null&&hc(),!1}catch{}if(o=Ef(n,a,p,c),o!==null)return Mn(o,n,c),l0(o,a,c),!0}return!1}function ih(n,a,o,c){if(c={lane:2,revertLane:Ph(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Dc(n)){if(a)throw Error(r(479))}else a=Ef(n,o,c,2),a!==null&&Mn(a,n,2)}function Dc(n){var a=n.alternate;return n===Fe||a!==null&&a===Fe}function o0(n,a){yi=Cc=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function l0(n,a,o){if((o&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Jl(n,o)}}var Bo={readContext:sn,use:_c,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Bo.useEffectEvent=Dt;var c0={readContext:sn,use:_c,useCallback:function(n,a){return yn().memoizedState=[n,a===void 0?null:a],n},useContext:sn,useEffect:qv,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,Mc(4194308,4,Kv.bind(null,a,n),o)},useLayoutEffect:function(n,a){return Mc(4194308,4,n,a)},useInsertionEffect:function(n,a){Mc(4,2,n,a)},useMemo:function(n,a){var o=yn();a=a===void 0?null:a;var c=n();if(Er){nt(!0);try{n()}finally{nt(!1)}}return o.memoizedState=[c,a],c},useReducer:function(n,a,o){var c=yn();if(o!==void 0){var p=o(a);if(Er){nt(!0);try{o(a)}finally{nt(!1)}}}else p=a;return c.memoizedState=c.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},c.queue=n,n=n.dispatch=XA.bind(null,Fe,n),[c.memoizedState,n]},useRef:function(n){var a=yn();return n={current:n},a.memoizedState=n},useState:function(n){n=Qf(n);var a=n.queue,o=i0.bind(null,Fe,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:nh,useDeferredValue:function(n,a){var o=yn();return sh(o,n,a)},useTransition:function(){var n=Qf(!1);return n=t0.bind(null,Fe,n.queue,!0,!1),yn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var c=Fe,p=yn();if(Qe){if(o===void 0)throw Error(r(407));o=o()}else{if(o=a(),mt===null)throw Error(r(349));(We&127)!==0||_v(c,a,o)}p.memoizedState=o;var g={value:o,getSnapshot:a};return p.queue=g,qv(Mv.bind(null,c,g,n),[n]),c.flags|=2048,bi(9,{destroy:void 0},kv.bind(null,c,g,o,a),null),o},useId:function(){var n=yn(),a=mt.identifierPrefix;if(Qe){var o=Cs,c=js;o=(c&~(1<<32-at(c)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Ac++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=BA++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:rh,useFormState:Vv,useActionState:Vv,useOptimistic:function(n){var a=yn();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=ih.bind(null,Fe,!0,o),o.dispatch=a,[n,a]},useMemoCache:Kf,useCacheRefresh:function(){return yn().memoizedState=GA.bind(null,Fe)},useEffectEvent:function(n){var a=yn(),o={impl:n};return a.memoizedState=o,function(){if((ot&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},oh={readContext:sn,use:_c,useCallback:Jv,useContext:sn,useEffect:th,useImperativeHandle:Wv,useInsertionEffect:Gv,useLayoutEffect:Xv,useMemo:Qv,useReducer:kc,useRef:Fv,useState:function(){return kc(Qs)},useDebugValue:nh,useDeferredValue:function(n,a){var o=$t();return e0(o,ft.memoizedState,n,a)},useTransition:function(){var n=kc(Qs)[0],a=$t().memoizedState;return[typeof n=="boolean"?n:Uo(n),a]},useSyncExternalStore:Rv,useId:a0,useHostTransitionStatus:rh,useFormState:Bv,useActionState:Bv,useOptimistic:function(n,a){var o=$t();return zv(o,ft,n,a)},useMemoCache:Kf,useCacheRefresh:r0};oh.useEffectEvent=Yv;var u0={readContext:sn,use:_c,useCallback:Jv,useContext:sn,useEffect:th,useImperativeHandle:Wv,useInsertionEffect:Gv,useLayoutEffect:Xv,useMemo:Qv,useReducer:Jf,useRef:Fv,useState:function(){return Jf(Qs)},useDebugValue:nh,useDeferredValue:function(n,a){var o=$t();return ft===null?sh(o,n,a):e0(o,ft.memoizedState,n,a)},useTransition:function(){var n=Jf(Qs)[0],a=$t().memoizedState;return[typeof n=="boolean"?n:Uo(n),a]},useSyncExternalStore:Rv,useId:a0,useHostTransitionStatus:rh,useFormState:Hv,useActionState:Hv,useOptimistic:function(n,a){var o=$t();return ft!==null?zv(o,ft,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Kf,useCacheRefresh:r0};u0.useEffectEvent=Yv;function lh(n,a,o,c){a=n.memoizedState,o=o(c,a),o=o==null?a:v({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var ch={enqueueSetState:function(n,a,o){n=n._reactInternals;var c=Hn(),p=Ea(c);p.payload=a,o!=null&&(p.callback=o),a=Na(n,p,c),a!==null&&(Mn(a,n,c),Io(a,n,c))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var c=Hn(),p=Ea(c);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=Na(n,p,c),a!==null&&(Mn(a,n,c),Io(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=Hn(),c=Ea(o);c.tag=2,a!=null&&(c.callback=a),a=Na(n,c,o),a!==null&&(Mn(a,n,o),Io(a,n,o))}};function d0(n,a,o,c,p,g,S){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,g,S):a.prototype&&a.prototype.isPureReactComponent?!Ao(o,c)||!Ao(p,g):!0}function f0(n,a,o,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,c),a.state!==n&&ch.enqueueReplaceState(a,a.state,null)}function Nr(n,a){var o=a;if("ref"in a){o={};for(var c in a)c!=="ref"&&(o[c]=a[c])}if(n=n.defaultProps){o===a&&(o=v({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function h0(n){fc(n)}function p0(n){console.error(n)}function m0(n){fc(n)}function zc(n,a){try{var o=n.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function g0(n,a,o){try{var c=n.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function uh(n,a,o){return o=Ea(o),o.tag=3,o.payload={element:null},o.callback=function(){zc(n,a)},o}function y0(n){return n=Ea(n),n.tag=3,n}function v0(n,a,o,c){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var g=c.value;n.payload=function(){return p(g)},n.callback=function(){g0(a,o,c)}}var S=o.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(n.callback=function(){g0(a,o,c),typeof p!="function"&&(_a===null?_a=new Set([this]):_a.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function KA(n,a,o,c,p){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=o.alternate,a!==null&&di(a,o,p,!0),o=Un.current,o!==null){switch(o.tag){case 31:case 13:return as===null?Yc():o.alternate===null&&zt===0&&(zt=3),o.flags&=-257,o.flags|=65536,o.lanes=p,c===Sc?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([c]):a.add(c),zh(n,c,p)),!1;case 22:return o.flags|=65536,c===Sc?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([c]):o.add(c)),zh(n,c,p)),!1}throw Error(r(435,o.tag))}return zh(n,c,p),Yc(),!1}if(Qe)return a=Un.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,c!==Rf&&(n=Error(r(422),{cause:c}),ko(es(n,o)))):(c!==Rf&&(a=Error(r(423),{cause:c}),ko(es(a,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,c=es(c,o),p=uh(n.stateNode,c,p),Uf(n,p),zt!==4&&(zt=2)),!1;var g=Error(r(520),{cause:c});if(g=es(g,o),Ko===null?Ko=[g]:Ko.push(g),zt!==4&&(zt=2),a===null)return!0;c=es(c,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=uh(o.stateNode,c,n),Uf(o,n),!1;case 1:if(a=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(_a===null||!_a.has(g))))return o.flags|=65536,p&=-p,o.lanes|=p,p=y0(p),v0(p,n,o,c),Uf(o,p),!1}o=o.return}while(o!==null);return!1}var dh=Error(r(461)),Zt=!1;function an(n,a,o,c){a.child=n===null?Sv(a,null,o,c):Sr(a,n.child,o,c)}function b0(n,a,o,c,p){o=o.render;var g=a.ref;if("ref"in c){var S={};for(var k in c)k!=="ref"&&(S[k]=c[k])}else S=c;return vr(a),c=qf(n,a,o,S,g,p),k=Yf(),n!==null&&!Zt?(Gf(n,a,p),ea(n,a,p)):(Qe&&k&&Cf(a),a.flags|=1,an(n,a,c,p),a.child)}function x0(n,a,o,c,p){if(n===null){var g=o.type;return typeof g=="function"&&!Nf(g)&&g.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=g,w0(n,a,g,c,p)):(n=gc(o.type,null,c,a,a.mode,p),n.ref=a.ref,n.return=a,a.child=n)}if(g=n.child,!bh(n,p)){var S=g.memoizedProps;if(o=o.compare,o=o!==null?o:Ao,o(S,c)&&n.ref===a.ref)return ea(n,a,p)}return a.flags|=1,n=Gs(g,c),n.ref=a.ref,n.return=a,a.child=n}function w0(n,a,o,c,p){if(n!==null){var g=n.memoizedProps;if(Ao(g,c)&&n.ref===a.ref)if(Zt=!1,a.pendingProps=c=g,bh(n,p))(n.flags&131072)!==0&&(Zt=!0);else return a.lanes=n.lanes,ea(n,a,p)}return fh(n,a,o,c,p)}function S0(n,a,o,c){var p=c.children,g=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(g=g!==null?g.baseLanes|o:o,n!==null){for(c=a.child=n.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~g}else c=0,a.child=null;return E0(n,a,g,o,c)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&xc(a,g!==null?g.cachePool:null),g!==null?Tv(a,g):Bf(),jv(a);else return c=a.lanes=536870912,E0(n,a,g!==null?g.baseLanes|o:o,o,c)}else g!==null?(xc(a,g.cachePool),Tv(a,g),ja(),a.memoizedState=null):(n!==null&&xc(a,null),Bf(),ja());return an(n,a,p,o),a.child}function Zo(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function E0(n,a,o,c,p){var g=If();return g=g===null?null:{parent:Vt._currentValue,pool:g},a.memoizedState={baseLanes:o,cachePool:g},n!==null&&xc(a,null),Bf(),jv(a),n!==null&&di(n,a,c,!0),a.childLanes=p,null}function Ic(n,a){return a=Pc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function N0(n,a,o){return Sr(a,n.child,null,o),n=Ic(a,a.pendingProps),n.flags|=2,Vn(a),a.memoizedState=null,n}function WA(n,a,o){var c=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(Qe){if(c.mode==="hidden")return n=Ic(a,c),a.lanes=536870912,Zo(null,n);if(Hf(a),(n=xt)?(n=Ib(n,ss),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:va!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=ov(n),o.return=a,a.child=o,nn=a,xt=null)):n=null,n===null)throw xa(a);return a.lanes=536870912,null}return Ic(a,c)}var g=n.memoizedState;if(g!==null){var S=g.dehydrated;if(Hf(a),p)if(a.flags&256)a.flags&=-257,a=N0(n,a,o);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(r(558));else if(Zt||di(n,a,o,!1),p=(o&n.childLanes)!==0,Zt||p){if(c=mt,c!==null&&(S=Ql(c,o),S!==0&&S!==g.retryLane))throw g.retryLane=S,pr(n,S),Mn(c,n,S),dh;Yc(),a=N0(n,a,o)}else n=g.treeContext,xt=rs(S.nextSibling),nn=a,Qe=!0,ba=null,ss=!1,n!==null&&uv(a,n),a=Ic(a,c),a.flags|=4096;return a}return n=Gs(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Lc(n,a){var o=a.ref;if(o===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(n===null||n.ref!==o)&&(a.flags|=4194816)}}function fh(n,a,o,c,p){return vr(a),o=qf(n,a,o,c,void 0,p),c=Yf(),n!==null&&!Zt?(Gf(n,a,p),ea(n,a,p)):(Qe&&c&&Cf(a),a.flags|=1,an(n,a,o,p),a.child)}function T0(n,a,o,c,p,g){return vr(a),a.updateQueue=null,o=Av(a,c,o,p),Cv(n),c=Yf(),n!==null&&!Zt?(Gf(n,a,g),ea(n,a,g)):(Qe&&c&&Cf(a),a.flags|=1,an(n,a,o,g),a.child)}function j0(n,a,o,c,p){if(vr(a),a.stateNode===null){var g=oi,S=o.contextType;typeof S=="object"&&S!==null&&(g=sn(S)),g=new o(c,g),a.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=ch,a.stateNode=g,g._reactInternals=a,g=a.stateNode,g.props=c,g.state=a.memoizedState,g.refs={},Pf(a),S=o.contextType,g.context=typeof S=="object"&&S!==null?sn(S):oi,g.state=a.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(lh(a,o,S,c),g.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(S=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),S!==g.state&&ch.enqueueReplaceState(g,g.state,null),Po(a,c,g,p),Lo(),g.state=a.memoizedState),typeof g.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){g=a.stateNode;var k=a.memoizedProps,L=Nr(o,k);g.props=L;var W=g.context,oe=o.contextType;S=oi,typeof oe=="object"&&oe!==null&&(S=sn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof g.getSnapshotBeforeUpdate=="function",k=a.pendingProps!==k,oe||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(k||W!==S)&&f0(a,g,c,S),Sa=!1;var Q=a.memoizedState;g.state=Q,Po(a,c,g,p),Lo(),W=a.memoizedState,k||Q!==W||Sa?(typeof ue=="function"&&(lh(a,o,ue,c),W=a.memoizedState),(L=Sa||d0(a,o,L,c,Q,W,S))?(oe||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(a.flags|=4194308)):(typeof g.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=W),g.props=c,g.state=W,g.context=S,c=L):(typeof g.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{g=a.stateNode,$f(n,a),S=a.memoizedProps,oe=Nr(o,S),g.props=oe,ue=a.pendingProps,Q=g.context,W=o.contextType,L=oi,typeof W=="object"&&W!==null&&(L=sn(W)),k=o.getDerivedStateFromProps,(W=typeof k=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(S!==ue||Q!==L)&&f0(a,g,c,L),Sa=!1,Q=a.memoizedState,g.state=Q,Po(a,c,g,p),Lo();var ae=a.memoizedState;S!==ue||Q!==ae||Sa||n!==null&&n.dependencies!==null&&vc(n.dependencies)?(typeof k=="function"&&(lh(a,o,k,c),ae=a.memoizedState),(oe=Sa||d0(a,o,oe,c,Q,ae,L)||n!==null&&n.dependencies!==null&&vc(n.dependencies))?(W||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,ae,L),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,ae,L)),typeof g.componentDidUpdate=="function"&&(a.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof g.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=ae),g.props=c,g.state=ae,g.context=L,c=oe):(typeof g.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),c=!1)}return g=c,Lc(n,a),c=(a.flags&128)!==0,g||c?(g=a.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:g.render(),a.flags|=1,n!==null&&c?(a.child=Sr(a,n.child,null,p),a.child=Sr(a,null,o,p)):an(n,a,o,p),a.memoizedState=g.state,n=a.child):n=ea(n,a,p),n}function C0(n,a,o,c){return gr(),a.flags|=256,an(n,a,o,c),a.child}var hh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ph(n){return{baseLanes:n,cachePool:gv()}}function mh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=Zn),n}function A0(n,a,o){var c=a.pendingProps,p=!1,g=(a.flags&128)!==0,S;if((S=g)||(S=n!==null&&n.memoizedState===null?!1:(Pt.current&2)!==0),S&&(p=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,n===null){if(Qe){if(p?Ta(a):ja(),(n=xt)?(n=Ib(n,ss),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:va!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=ov(n),o.return=a,a.child=o,nn=a,xt=null)):n=null,n===null)throw xa(a);return Wh(n)?a.lanes=32:a.lanes=536870912,null}var k=c.children;return c=c.fallback,p?(ja(),p=a.mode,k=Pc({mode:"hidden",children:k},p),c=mr(c,p,o,null),k.return=a,c.return=a,k.sibling=c,a.child=k,c=a.child,c.memoizedState=ph(o),c.childLanes=mh(n,S,o),a.memoizedState=hh,Zo(null,c)):(Ta(a),gh(a,k))}var L=n.memoizedState;if(L!==null&&(k=L.dehydrated,k!==null)){if(g)a.flags&256?(Ta(a),a.flags&=-257,a=yh(n,a,o)):a.memoizedState!==null?(ja(),a.child=n.child,a.flags|=128,a=null):(ja(),k=c.fallback,p=a.mode,c=Pc({mode:"visible",children:c.children},p),k=mr(k,p,o,null),k.flags|=2,c.return=a,k.return=a,c.sibling=k,a.child=c,Sr(a,n.child,null,o),c=a.child,c.memoizedState=ph(o),c.childLanes=mh(n,S,o),a.memoizedState=hh,a=Zo(null,c));else if(Ta(a),Wh(k)){if(S=k.nextSibling&&k.nextSibling.dataset,S)var W=S.dgst;S=W,c=Error(r(419)),c.stack="",c.digest=S,ko({value:c,source:null,stack:null}),a=yh(n,a,o)}else if(Zt||di(n,a,o,!1),S=(o&n.childLanes)!==0,Zt||S){if(S=mt,S!==null&&(c=Ql(S,o),c!==0&&c!==L.retryLane))throw L.retryLane=c,pr(n,c),Mn(S,n,c),dh;Kh(k)||Yc(),a=yh(n,a,o)}else Kh(k)?(a.flags|=192,a.child=n.child,a=null):(n=L.treeContext,xt=rs(k.nextSibling),nn=a,Qe=!0,ba=null,ss=!1,n!==null&&uv(a,n),a=gh(a,c.children),a.flags|=4096);return a}return p?(ja(),k=c.fallback,p=a.mode,L=n.child,W=L.sibling,c=Gs(L,{mode:"hidden",children:c.children}),c.subtreeFlags=L.subtreeFlags&65011712,W!==null?k=Gs(W,k):(k=mr(k,p,o,null),k.flags|=2),k.return=a,c.return=a,c.sibling=k,a.child=c,Zo(null,c),c=a.child,k=n.child.memoizedState,k===null?k=ph(o):(p=k.cachePool,p!==null?(L=Vt._currentValue,p=p.parent!==L?{parent:L,pool:L}:p):p=gv(),k={baseLanes:k.baseLanes|o,cachePool:p}),c.memoizedState=k,c.childLanes=mh(n,S,o),a.memoizedState=hh,Zo(n.child,c)):(Ta(a),o=n.child,n=o.sibling,o=Gs(o,{mode:"visible",children:c.children}),o.return=a,o.sibling=null,n!==null&&(S=a.deletions,S===null?(a.deletions=[n],a.flags|=16):S.push(n)),a.child=o,a.memoizedState=null,o)}function gh(n,a){return a=Pc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Pc(n,a){return n=$n(22,n,null,a),n.lanes=0,n}function yh(n,a,o){return Sr(a,n.child,null,o),n=gh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function R0(n,a,o){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),Mf(n.return,a,o)}function vh(n,a,o,c,p,g){var S=n.memoizedState;S===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:p,treeForkCount:g}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=o,S.tailMode=p,S.treeForkCount=g)}function _0(n,a,o){var c=a.pendingProps,p=c.revealOrder,g=c.tail;c=c.children;var S=Pt.current,k=(S&2)!==0;if(k?(S=S&1|2,a.flags|=128):S&=1,J(Pt,S),an(n,a,c,o),c=Qe?_o:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&R0(n,o,a);else if(n.tag===19)R0(n,o,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(p){case"forwards":for(o=a.child,p=null;o!==null;)n=o.alternate,n!==null&&jc(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=a.child,a.child=null):(p=o.sibling,o.sibling=null),vh(a,!1,p,o,g,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=a.child,a.child=null;p!==null;){if(n=p.alternate,n!==null&&jc(n)===null){a.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}vh(a,!0,o,null,g,c);break;case"together":vh(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function ea(n,a,o){if(n!==null&&(a.dependencies=n.dependencies),Ra|=a.lanes,(o&a.childLanes)===0)if(n!==null){if(di(n,a,o,!1),(o&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(r(153));if(a.child!==null){for(n=a.child,o=Gs(n,n.pendingProps),a.child=o,o.return=a;n.sibling!==null;)n=n.sibling,o=o.sibling=Gs(n,n.pendingProps),o.return=a;o.sibling=null}return a.child}function bh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&vc(n)))}function JA(n,a,o){switch(a.tag){case 3:pe(a,a.stateNode.containerInfo),wa(a,Vt,n.memoizedState.cache),gr();break;case 27:case 5:Ce(a);break;case 4:pe(a,a.stateNode.containerInfo);break;case 10:wa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Hf(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(Ta(a),a.flags|=128,null):(o&a.child.childLanes)!==0?A0(n,a,o):(Ta(a),n=ea(n,a,o),n!==null?n.sibling:null);Ta(a);break;case 19:var p=(n.flags&128)!==0;if(c=(o&a.childLanes)!==0,c||(di(n,a,o,!1),c=(o&a.childLanes)!==0),p){if(c)return _0(n,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),J(Pt,Pt.current),c)break;return null;case 22:return a.lanes=0,S0(n,a,o,a.pendingProps);case 24:wa(a,Vt,n.memoizedState.cache)}return ea(n,a,o)}function k0(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)Zt=!0;else{if(!bh(n,o)&&(a.flags&128)===0)return Zt=!1,JA(n,a,o);Zt=(n.flags&131072)!==0}else Zt=!1,Qe&&(a.flags&1048576)!==0&&cv(a,_o,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=xr(a.elementType),a.type=n,typeof n=="function")Nf(n)?(c=Nr(n,c),a.tag=1,a=j0(null,a,n,c,o)):(a.tag=0,a=fh(null,a,n,c,o));else{if(n!=null){var p=n.$$typeof;if(p===_){a.tag=11,a=b0(null,a,n,c,o);break e}else if(p===O){a.tag=14,a=x0(null,a,n,c,o);break e}}throw a=ie(n)||n,Error(r(306,a,""))}}return a;case 0:return fh(n,a,a.type,a.pendingProps,o);case 1:return c=a.type,p=Nr(c,a.pendingProps),j0(n,a,c,p,o);case 3:e:{if(pe(a,a.stateNode.containerInfo),n===null)throw Error(r(387));c=a.pendingProps;var g=a.memoizedState;p=g.element,$f(n,a),Po(a,c,null,o);var S=a.memoizedState;if(c=S.cache,wa(a,Vt,c),c!==g.cache&&Of(a,[Vt],o,!0),Lo(),c=S.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=g,a.memoizedState=g,a.flags&256){a=C0(n,a,c,o);break e}else if(c!==p){p=es(Error(r(424)),a),ko(p),a=C0(n,a,c,o);break e}else for(n=a.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,xt=rs(n.firstChild),nn=a,Qe=!0,ba=null,ss=!0,o=Sv(a,null,c,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(gr(),c===p){a=ea(n,a,o);break e}an(n,a,c,o)}a=a.child}return a;case 26:return Lc(n,a),n===null?(o=Bb(a.type,null,a.pendingProps,null))?a.memoizedState=o:Qe||(o=a.type,n=a.pendingProps,c=eu(ge.current).createElement(o),c[tn]=a,c[jn]=n,rn(c,o,n),Wt(c),a.stateNode=c):a.memoizedState=Bb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Ce(a),n===null&&Qe&&(c=a.stateNode=$b(a.type,a.pendingProps,ge.current),nn=a,ss=!0,p=xt,Da(a.type)?(Jh=p,xt=rs(c.firstChild)):xt=p),an(n,a,a.pendingProps.children,o),Lc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&Qe&&((p=c=xt)&&(c=AR(c,a.type,a.pendingProps,ss),c!==null?(a.stateNode=c,nn=a,xt=rs(c.firstChild),ss=!1,p=!0):p=!1),p||xa(a)),Ce(a),p=a.type,g=a.pendingProps,S=n!==null?n.memoizedProps:null,c=g.children,Yh(p,g)?c=null:S!==null&&Yh(p,S)&&(a.flags|=32),a.memoizedState!==null&&(p=qf(n,a,ZA,null,null,o),al._currentValue=p),Lc(n,a),an(n,a,c,o),a.child;case 6:return n===null&&Qe&&((n=o=xt)&&(o=RR(o,a.pendingProps,ss),o!==null?(a.stateNode=o,nn=a,xt=null,n=!0):n=!1),n||xa(a)),null;case 13:return A0(n,a,o);case 4:return pe(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=Sr(a,null,c,o):an(n,a,c,o),a.child;case 11:return b0(n,a,a.type,a.pendingProps,o);case 7:return an(n,a,a.pendingProps,o),a.child;case 8:return an(n,a,a.pendingProps.children,o),a.child;case 12:return an(n,a,a.pendingProps.children,o),a.child;case 10:return c=a.pendingProps,wa(a,a.type,c.value),an(n,a,c.children,o),a.child;case 9:return p=a.type._context,c=a.pendingProps.children,vr(a),p=sn(p),c=c(p),a.flags|=1,an(n,a,c,o),a.child;case 14:return x0(n,a,a.type,a.pendingProps,o);case 15:return w0(n,a,a.type,a.pendingProps,o);case 19:return _0(n,a,o);case 31:return WA(n,a,o);case 22:return S0(n,a,o,a.pendingProps);case 24:return vr(a),c=sn(Vt),n===null?(p=If(),p===null&&(p=mt,g=Df(),p.pooledCache=g,g.refCount++,g!==null&&(p.pooledCacheLanes|=o),p=g),a.memoizedState={parent:c,cache:p},Pf(a),wa(a,Vt,p)):((n.lanes&o)!==0&&($f(n,a),Po(a,null,null,o),Lo()),p=n.memoizedState,g=a.memoizedState,p.parent!==c?(p={parent:c,cache:c},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),wa(a,Vt,c)):(c=g.cache,wa(a,Vt,c),c!==p.cache&&Of(a,[Vt],o,!0))),an(n,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function ta(n){n.flags|=4}function xh(n,a,o,c,p){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(ab())n.flags|=8192;else throw wr=Sc,Lf}else n.flags&=-16777217}function M0(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Yb(a))if(ab())n.flags|=8192;else throw wr=Sc,Lf}function $c(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Wl():536870912,n.lanes|=a,Ei|=a)}function Ho(n,a){if(!Qe)switch(n.tailMode){case"hidden":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function wt(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,c=0;if(a)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=c,n.childLanes=o,a}function QA(n,a,o){var c=a.pendingProps;switch(Af(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(a),null;case 1:return wt(a),null;case 3:return o=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Ws(Vt),be(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(ui(a)?ta(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,_f())),wt(a),null;case 26:var p=a.type,g=a.memoizedState;return n===null?(ta(a),g!==null?(wt(a),M0(a,g)):(wt(a),xh(a,p,null,c,o))):g?g!==n.memoizedState?(ta(a),wt(a),M0(a,g)):(wt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&ta(a),wt(a),xh(a,p,n,c,o)),null;case 27:if(fe(a),o=ge.current,p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&ta(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return wt(a),null}n=re.current,ui(a)?dv(a):(n=$b(p,c,o),a.stateNode=n,ta(a))}return wt(a),null;case 5:if(fe(a),p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&ta(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return wt(a),null}if(g=re.current,ui(a))dv(a);else{var S=eu(ge.current);switch(g){case 1:g=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:g=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":g=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":g=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":g=S.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?S.createElement(p,{is:c.is}):S.createElement(p)}}g[tn]=a,g[jn]=c;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)g.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&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}a.stateNode=g;e:switch(rn(g,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&ta(a)}}return wt(a),xh(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&ta(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(r(166));if(n=ge.current,ui(a)){if(n=a.stateNode,o=a.memoizedProps,c=null,p=nn,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}n[tn]=a,n=!!(n.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Ab(n.nodeValue,o)),n||xa(a,!0)}else n=eu(n).createTextNode(c),n[tn]=a,a.stateNode=n}return wt(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(c=ui(a),o!==null){if(n===null){if(!c)throw Error(r(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[tn]=a}else gr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wt(a),n=!1}else o=_f(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(Vn(a),a):(Vn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return wt(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=ui(a),c!==null&&c.dehydrated!==null){if(n===null){if(!p)throw Error(r(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[tn]=a}else gr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;wt(a),p=!1}else p=_f(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(Vn(a),a):(Vn(a),null)}return Vn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=c!==null,n=n!==null&&n.memoizedState!==null,o&&(c=a.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==p&&(c.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),$c(a,a.updateQueue),wt(a),null);case 4:return be(),n===null&&Bh(a.stateNode.containerInfo),wt(a),null;case 10:return Ws(a.type),wt(a),null;case 19:if($(Pt),c=a.memoizedState,c===null)return wt(a),null;if(p=(a.flags&128)!==0,g=c.rendering,g===null)if(p)Ho(c,!1);else{if(zt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(g=jc(n),g!==null){for(a.flags|=128,Ho(c,!1),n=g.updateQueue,a.updateQueue=n,$c(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)iv(o,n),o=o.sibling;return J(Pt,Pt.current&1|2),Qe&&Xs(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&me()>Hc&&(a.flags|=128,p=!0,Ho(c,!1),a.lanes=4194304)}else{if(!p)if(n=jc(g),n!==null){if(a.flags|=128,p=!0,n=n.updateQueue,a.updateQueue=n,$c(a,n),Ho(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Qe)return wt(a),null}else 2*me()-c.renderingStartTime>Hc&&o!==536870912&&(a.flags|=128,p=!0,Ho(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(n=c.last,n!==null?n.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=me(),n.sibling=null,o=Pt.current,J(Pt,p?o&1|2:o&1),Qe&&Xs(a,c.treeForkCount),n):(wt(a),null);case 22:case 23:return Vn(a),Zf(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(o&536870912)!==0&&(a.flags&128)===0&&(wt(a),a.subtreeFlags&6&&(a.flags|=8192)):wt(a),o=a.updateQueue,o!==null&&$c(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==o&&(a.flags|=2048),n!==null&&$(br),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Ws(Vt),wt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function eR(n,a){switch(Af(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Ws(Vt),be(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return fe(a),null;case 31:if(a.memoizedState!==null){if(Vn(a),a.alternate===null)throw Error(r(340));gr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Vn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(r(340));gr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return $(Pt),null;case 4:return be(),null;case 10:return Ws(a.type),null;case 22:case 23:return Vn(a),Zf(),n!==null&&$(br),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Ws(Vt),null;case 25:return null;default:return null}}function O0(n,a){switch(Af(a),a.tag){case 3:Ws(Vt),be();break;case 26:case 27:case 5:fe(a);break;case 4:be();break;case 31:a.memoizedState!==null&&Vn(a);break;case 13:Vn(a);break;case 19:$(Pt);break;case 10:Ws(a.type);break;case 22:case 23:Vn(a),Zf(),n!==null&&$(br);break;case 24:Ws(Vt)}}function Fo(n,a){try{var o=a.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var p=c.next;o=p;do{if((o.tag&n)===n){c=void 0;var g=o.create,S=o.inst;c=g(),S.destroy=c}o=o.next}while(o!==p)}}catch(k){ut(a,a.return,k)}}function Ca(n,a,o){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var g=p.next;c=g;do{if((c.tag&n)===n){var S=c.inst,k=S.destroy;if(k!==void 0){S.destroy=void 0,p=a;var L=o,W=k;try{W()}catch(oe){ut(p,L,oe)}}}c=c.next}while(c!==g)}}catch(oe){ut(a,a.return,oe)}}function D0(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{Nv(a,o)}catch(c){ut(n,n.return,c)}}}function z0(n,a,o){o.props=Nr(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(c){ut(n,a,c)}}function qo(n,a){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof o=="function"?n.refCleanup=o(c):o.current=c}}catch(p){ut(n,a,p)}}function As(n,a){var o=n.ref,c=n.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(p){ut(n,a,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){ut(n,a,p)}else o.current=null}function I0(n){var a=n.type,o=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(p){ut(n,n.return,p)}}function wh(n,a,o){try{var c=n.stateNode;SR(c,n.type,o,a),c[jn]=a}catch(p){ut(n,n.return,p)}}function L0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Da(n.type)||n.tag===4}function Sh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||L0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Da(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Eh(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=qs));else if(c!==4&&(c===27&&Da(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(Eh(n,a,o),n=n.sibling;n!==null;)Eh(n,a,o),n=n.sibling}function Uc(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(c!==4&&(c===27&&Da(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Uc(n,a,o),n=n.sibling;n!==null;)Uc(n,a,o),n=n.sibling}function P0(n){var a=n.stateNode,o=n.memoizedProps;try{for(var c=n.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);rn(a,c,o),a[tn]=n,a[jn]=o}catch(g){ut(n,n.return,g)}}var na=!1,Ht=!1,Nh=!1,$0=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function tR(n,a){if(n=n.containerInfo,Fh=ou,n=Wy(n),yf(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var p=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var S=0,k=-1,L=-1,W=0,oe=0,ue=n,Q=null;t:for(;;){for(var ae;ue!==o||p!==0&&ue.nodeType!==3||(k=S+p),ue!==g||c!==0&&ue.nodeType!==3||(L=S+c),ue.nodeType===3&&(S+=ue.nodeValue.length),(ae=ue.firstChild)!==null;)Q=ue,ue=ae;for(;;){if(ue===n)break t;if(Q===o&&++W===p&&(k=S),Q===g&&++oe===c&&(L=S),(ae=ue.nextSibling)!==null)break;ue=Q,Q=ue.parentNode}ue=ae}o=k===-1||L===-1?null:{start:k,end:L}}else o=null}o=o||{start:0,end:0}}else o=null;for(qh={focusedElem:n,selectionRange:o},ou=!1,Jt=a;Jt!==null;)if(a=Jt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Jt=n;else for(;Jt!==null;){switch(a=Jt,g=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&g!==null){n=void 0,o=a,p=g.memoizedProps,g=g.memoizedState,c=o.stateNode;try{var Ee=Nr(o.type,p);n=c.getSnapshotBeforeUpdate(Ee,g),c.__reactInternalSnapshotBeforeUpdate=n}catch(De){ut(o,o.return,De)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)Xh(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Xh(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=a.sibling,n!==null){n.return=a.return,Jt=n;break}Jt=a.return}}function U0(n,a,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:aa(n,o),c&4&&Fo(5,o);break;case 1:if(aa(n,o),c&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(S){ut(o,o.return,S)}else{var p=Nr(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(p,a,n.__reactInternalSnapshotBeforeUpdate)}catch(S){ut(o,o.return,S)}}c&64&&D0(o),c&512&&qo(o,o.return);break;case 3:if(aa(n,o),c&64&&(n=o.updateQueue,n!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{Nv(n,a)}catch(S){ut(o,o.return,S)}}break;case 27:a===null&&c&4&&P0(o);case 26:case 5:aa(n,o),a===null&&c&4&&I0(o),c&512&&qo(o,o.return);break;case 12:aa(n,o);break;case 31:aa(n,o),c&4&&Z0(n,o);break;case 13:aa(n,o),c&4&&H0(n,o),c&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=uR.bind(null,o),_R(n,o))));break;case 22:if(c=o.memoizedState!==null||na,!c){a=a!==null&&a.memoizedState!==null||Ht,p=na;var g=Ht;na=c,(Ht=a)&&!g?ra(n,o,(o.subtreeFlags&8772)!==0):aa(n,o),na=p,Ht=g}break;case 30:break;default:aa(n,o)}}function V0(n){var a=n.alternate;a!==null&&(n.alternate=null,V0(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Qd(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Rt=null,An=!1;function sa(n,a,o){for(o=o.child;o!==null;)B0(n,a,o),o=o.sibling}function B0(n,a,o){if(Oe&&typeof Oe.onCommitFiberUnmount=="function")try{Oe.onCommitFiberUnmount(Qt,o)}catch{}switch(o.tag){case 26:Ht||As(o,a),sa(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Ht||As(o,a);var c=Rt,p=An;Da(o.type)&&(Rt=o.stateNode,An=!1),sa(n,a,o),tl(o.stateNode),Rt=c,An=p;break;case 5:Ht||As(o,a);case 6:if(c=Rt,p=An,Rt=null,sa(n,a,o),Rt=c,An=p,Rt!==null)if(An)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(o.stateNode)}catch(g){ut(o,a,g)}else try{Rt.removeChild(o.stateNode)}catch(g){ut(o,a,g)}break;case 18:Rt!==null&&(An?(n=Rt,Db(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),ki(n)):Db(Rt,o.stateNode));break;case 4:c=Rt,p=An,Rt=o.stateNode.containerInfo,An=!0,sa(n,a,o),Rt=c,An=p;break;case 0:case 11:case 14:case 15:Ca(2,o,a),Ht||Ca(4,o,a),sa(n,a,o);break;case 1:Ht||(As(o,a),c=o.stateNode,typeof c.componentWillUnmount=="function"&&z0(o,a,c)),sa(n,a,o);break;case 21:sa(n,a,o);break;case 22:Ht=(c=Ht)||o.memoizedState!==null,sa(n,a,o),Ht=c;break;default:sa(n,a,o)}}function Z0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ki(n)}catch(o){ut(a,a.return,o)}}}function H0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{ki(n)}catch(o){ut(a,a.return,o)}}function nR(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new $0),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new $0),a;default:throw Error(r(435,n.tag))}}function Vc(n,a){var o=nR(n);a.forEach(function(c){if(!o.has(c)){o.add(c);var p=dR.bind(null,n,c);c.then(p,p)}})}function Rn(n,a){var o=a.deletions;if(o!==null)for(var c=0;c<o.length;c++){var p=o[c],g=n,S=a,k=S;e:for(;k!==null;){switch(k.tag){case 27:if(Da(k.type)){Rt=k.stateNode,An=!1;break e}break;case 5:Rt=k.stateNode,An=!1;break e;case 3:case 4:Rt=k.stateNode.containerInfo,An=!0;break e}k=k.return}if(Rt===null)throw Error(r(160));B0(g,S,p),Rt=null,An=!1,g=p.alternate,g!==null&&(g.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)F0(a,n),a=a.sibling}var ps=null;function F0(n,a){var o=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Rn(a,n),_n(n),c&4&&(Ca(3,n,n.return),Fo(3,n),Ca(5,n,n.return));break;case 1:Rn(a,n),_n(n),c&512&&(Ht||o===null||As(o,o.return)),c&64&&na&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?c:o.concat(c))));break;case 26:var p=ps;if(Rn(a,n),_n(n),c&512&&(Ht||o===null||As(o,o.return)),c&4){var g=o!==null?o.memoizedState:null;if(c=n.memoizedState,o===null)if(c===null)if(n.stateNode===null){e:{c=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":g=p.getElementsByTagName("title")[0],(!g||g[bo]||g[tn]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=p.createElement(c),p.head.insertBefore(g,p.querySelector("head > title"))),rn(g,c,o),g[tn]=n,Wt(g),c=g;break e;case"link":var S=Fb("link","href",p).get(c+(o.href||""));if(S){for(var k=0;k<S.length;k++)if(g=S[k],g.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&g.getAttribute("rel")===(o.rel==null?null:o.rel)&&g.getAttribute("title")===(o.title==null?null:o.title)&&g.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){S.splice(k,1);break t}}g=p.createElement(c),rn(g,c,o),p.head.appendChild(g);break;case"meta":if(S=Fb("meta","content",p).get(c+(o.content||""))){for(k=0;k<S.length;k++)if(g=S[k],g.getAttribute("content")===(o.content==null?null:""+o.content)&&g.getAttribute("name")===(o.name==null?null:o.name)&&g.getAttribute("property")===(o.property==null?null:o.property)&&g.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&g.getAttribute("charset")===(o.charSet==null?null:o.charSet)){S.splice(k,1);break t}}g=p.createElement(c),rn(g,c,o),p.head.appendChild(g);break;default:throw Error(r(468,c))}g[tn]=n,Wt(g),c=g}n.stateNode=c}else qb(p,n.type,n.stateNode);else n.stateNode=Hb(p,c,n.memoizedProps);else g!==c?(g===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):g.count--,c===null?qb(p,n.type,n.stateNode):Hb(p,c,n.memoizedProps)):c===null&&n.stateNode!==null&&wh(n,n.memoizedProps,o.memoizedProps)}break;case 27:Rn(a,n),_n(n),c&512&&(Ht||o===null||As(o,o.return)),o!==null&&c&4&&wh(n,n.memoizedProps,o.memoizedProps);break;case 5:if(Rn(a,n),_n(n),c&512&&(Ht||o===null||As(o,o.return)),n.flags&32){p=n.stateNode;try{ei(p,"")}catch(Ee){ut(n,n.return,Ee)}}c&4&&n.stateNode!=null&&(p=n.memoizedProps,wh(n,p,o!==null?o.memoizedProps:p)),c&1024&&(Nh=!0);break;case 6:if(Rn(a,n),_n(n),c&4){if(n.stateNode===null)throw Error(r(162));c=n.memoizedProps,o=n.stateNode;try{o.nodeValue=c}catch(Ee){ut(n,n.return,Ee)}}break;case 3:if(su=null,p=ps,ps=tu(a.containerInfo),Rn(a,n),ps=p,_n(n),c&4&&o!==null&&o.memoizedState.isDehydrated)try{ki(a.containerInfo)}catch(Ee){ut(n,n.return,Ee)}Nh&&(Nh=!1,q0(n));break;case 4:c=ps,ps=tu(n.stateNode.containerInfo),Rn(a,n),_n(n),ps=c;break;case 12:Rn(a,n),_n(n);break;case 31:Rn(a,n),_n(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Vc(n,c)));break;case 13:Rn(a,n),_n(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Zc=me()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Vc(n,c)));break;case 22:p=n.memoizedState!==null;var L=o!==null&&o.memoizedState!==null,W=na,oe=Ht;if(na=W||p,Ht=oe||L,Rn(a,n),Ht=oe,na=W,_n(n),c&8192)e:for(a=n.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||L||na||Ht||Tr(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){L=o=a;try{if(g=L.stateNode,p)S=g.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{k=L.stateNode;var ue=L.memoizedProps.style,Q=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;k.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Ee){ut(L,L.return,Ee)}}}else if(a.tag===6){if(o===null){L=a;try{L.stateNode.nodeValue=p?"":L.memoizedProps}catch(Ee){ut(L,L.return,Ee)}}}else if(a.tag===18){if(o===null){L=a;try{var ae=L.stateNode;p?zb(ae,!0):zb(L.stateNode,!1)}catch(Ee){ut(L,L.return,Ee)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,Vc(n,o))));break;case 19:Rn(a,n),_n(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Vc(n,c)));break;case 30:break;case 21:break;default:Rn(a,n),_n(n)}}function _n(n){var a=n.flags;if(a&2){try{for(var o,c=n.return;c!==null;){if(L0(c)){o=c;break}c=c.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,g=Sh(n);Uc(n,g,p);break;case 5:var S=o.stateNode;o.flags&32&&(ei(S,""),o.flags&=-33);var k=Sh(n);Uc(n,k,S);break;case 3:case 4:var L=o.stateNode.containerInfo,W=Sh(n);Eh(n,W,L);break;default:throw Error(r(161))}}catch(oe){ut(n,n.return,oe)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function q0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;q0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function aa(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)U0(n,a.alternate,a),a=a.sibling}function Tr(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Ca(4,a,a.return),Tr(a);break;case 1:As(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&z0(a,a.return,o),Tr(a);break;case 27:tl(a.stateNode);case 26:case 5:As(a,a.return),Tr(a);break;case 22:a.memoizedState===null&&Tr(a);break;case 30:Tr(a);break;default:Tr(a)}n=n.sibling}}function ra(n,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,p=n,g=a,S=g.flags;switch(g.tag){case 0:case 11:case 15:ra(p,g,o),Fo(4,g);break;case 1:if(ra(p,g,o),c=g,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(W){ut(c,c.return,W)}if(c=g,p=c.updateQueue,p!==null){var k=c.stateNode;try{var L=p.shared.hiddenCallbacks;if(L!==null)for(p.shared.hiddenCallbacks=null,p=0;p<L.length;p++)Ev(L[p],k)}catch(W){ut(c,c.return,W)}}o&&S&64&&D0(g),qo(g,g.return);break;case 27:P0(g);case 26:case 5:ra(p,g,o),o&&c===null&&S&4&&I0(g),qo(g,g.return);break;case 12:ra(p,g,o);break;case 31:ra(p,g,o),o&&S&4&&Z0(p,g);break;case 13:ra(p,g,o),o&&S&4&&H0(p,g);break;case 22:g.memoizedState===null&&ra(p,g,o),qo(g,g.return);break;case 30:break;default:ra(p,g,o)}a=a.sibling}}function Th(n,a){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Mo(o))}function jh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Mo(n))}function ms(n,a,o,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Y0(n,a,o,c),a=a.sibling}function Y0(n,a,o,c){var p=a.flags;switch(a.tag){case 0:case 11:case 15:ms(n,a,o,c),p&2048&&Fo(9,a);break;case 1:ms(n,a,o,c);break;case 3:ms(n,a,o,c),p&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Mo(n)));break;case 12:if(p&2048){ms(n,a,o,c),n=a.stateNode;try{var g=a.memoizedProps,S=g.id,k=g.onPostCommit;typeof k=="function"&&k(S,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(L){ut(a,a.return,L)}}else ms(n,a,o,c);break;case 31:ms(n,a,o,c);break;case 13:ms(n,a,o,c);break;case 23:break;case 22:g=a.stateNode,S=a.alternate,a.memoizedState!==null?g._visibility&2?ms(n,a,o,c):Yo(n,a):g._visibility&2?ms(n,a,o,c):(g._visibility|=2,xi(n,a,o,c,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Th(S,a);break;case 24:ms(n,a,o,c),p&2048&&jh(a.alternate,a);break;default:ms(n,a,o,c)}}function xi(n,a,o,c,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var g=n,S=a,k=o,L=c,W=S.flags;switch(S.tag){case 0:case 11:case 15:xi(g,S,k,L,p),Fo(8,S);break;case 23:break;case 22:var oe=S.stateNode;S.memoizedState!==null?oe._visibility&2?xi(g,S,k,L,p):Yo(g,S):(oe._visibility|=2,xi(g,S,k,L,p)),p&&W&2048&&Th(S.alternate,S);break;case 24:xi(g,S,k,L,p),p&&W&2048&&jh(S.alternate,S);break;default:xi(g,S,k,L,p)}a=a.sibling}}function Yo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,c=a,p=c.flags;switch(c.tag){case 22:Yo(o,c),p&2048&&Th(c.alternate,c);break;case 24:Yo(o,c),p&2048&&jh(c.alternate,c);break;default:Yo(o,c)}a=a.sibling}}var Go=8192;function wi(n,a,o){if(n.subtreeFlags&Go)for(n=n.child;n!==null;)G0(n,a,o),n=n.sibling}function G0(n,a,o){switch(n.tag){case 26:wi(n,a,o),n.flags&Go&&n.memoizedState!==null&&BR(o,ps,n.memoizedState,n.memoizedProps);break;case 5:wi(n,a,o);break;case 3:case 4:var c=ps;ps=tu(n.stateNode.containerInfo),wi(n,a,o),ps=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Go,Go=16777216,wi(n,a,o),Go=c):wi(n,a,o));break;default:wi(n,a,o)}}function X0(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Xo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];Jt=c,W0(c,n)}X0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)K0(n),n=n.sibling}function K0(n){switch(n.tag){case 0:case 11:case 15:Xo(n),n.flags&2048&&Ca(9,n,n.return);break;case 3:Xo(n);break;case 12:Xo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Bc(n)):Xo(n);break;default:Xo(n)}}function Bc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];Jt=c,W0(c,n)}X0(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Ca(8,a,a.return),Bc(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,Bc(a));break;default:Bc(a)}n=n.sibling}}function W0(n,a){for(;Jt!==null;){var o=Jt;switch(o.tag){case 0:case 11:case 15:Ca(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Mo(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Jt=c;else e:for(o=n;Jt!==null;){c=Jt;var p=c.sibling,g=c.return;if(V0(c),c===o){Jt=null;break e}if(p!==null){p.return=g,Jt=p;break e}Jt=g}}}var sR={getCacheForType:function(n){var a=sn(Vt),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return sn(Vt).controller.signal}},aR=typeof WeakMap=="function"?WeakMap:Map,ot=0,mt=null,Ge=null,We=0,ct=0,Bn=null,Aa=!1,Si=!1,Ch=!1,ia=0,zt=0,Ra=0,jr=0,Ah=0,Zn=0,Ei=0,Ko=null,kn=null,Rh=!1,Zc=0,J0=0,Hc=1/0,Fc=null,_a=null,Xt=0,ka=null,Ni=null,oa=0,_h=0,kh=null,Q0=null,Wo=0,Mh=null;function Hn(){return(ot&2)!==0&&We!==0?We&-We:z.T!==null?Ph():ec()}function eb(){if(Zn===0)if((We&536870912)===0||Qe){var n=Tn;Tn<<=1,(Tn&3932160)===0&&(Tn=262144),Zn=n}else Zn=536870912;return n=Un.current,n!==null&&(n.flags|=32),Zn}function Mn(n,a,o){(n===mt&&(ct===2||ct===9)||n.cancelPendingCommit!==null)&&(Ti(n,0),Ma(n,We,Zn,!1)),cr(n,o),((ot&2)===0||n!==mt)&&(n===mt&&((ot&2)===0&&(jr|=o),zt===4&&Ma(n,We,Zn,!1)),Rs(n))}function tb(n,a,o){if((ot&6)!==0)throw Error(r(327));var c=!o&&(a&127)===0&&(a&n.expiredLanes)===0||ma(n,a),p=c?oR(n,a):Dh(n,a,!0),g=c;do{if(p===0){Si&&!c&&Ma(n,a,0,!1);break}else{if(o=n.current.alternate,g&&!rR(o)){p=Dh(n,a,!1),g=!1;continue}if(p===2){if(g=a,n.errorRecoveryDisabledLanes&g)var S=0;else S=n.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var k=n;p=Ko;var L=k.current.memoizedState.isDehydrated;if(L&&(Ti(k,S).flags|=256),S=Dh(k,S,!1),S!==2){if(Ch&&!L){k.errorRecoveryDisabledLanes|=g,jr|=g,p=4;break e}g=kn,kn=p,g!==null&&(kn===null?kn=g:kn.push.apply(kn,g))}p=S}if(g=!1,p!==2)continue}}if(p===1){Ti(n,0),Ma(n,a,0,!0);break}e:{switch(c=n,g=p,g){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ma(c,a,Zn,!Aa);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(p=Zc+300-me(),10<p)){if(Ma(c,a,Zn,!Aa),pa(c,0,!0)!==0)break e;oa=a,c.timeoutHandle=Mb(nb.bind(null,c,o,kn,Fc,Rh,a,Zn,jr,Ei,Aa,g,"Throttled",-0,0),p);break e}nb(c,o,kn,Fc,Rh,a,Zn,jr,Ei,Aa,g,null,-0,0)}}break}while(!0);Rs(n)}function nb(n,a,o,c,p,g,S,k,L,W,oe,ue,Q,ae){if(n.timeoutHandle=-1,ue=a.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qs},G0(a,g,ue);var Ee=(g&62914560)===g?Zc-me():(g&4194048)===g?J0-me():0;if(Ee=ZR(ue,Ee),Ee!==null){oa=g,n.cancelPendingCommit=Ee(ub.bind(null,n,a,g,o,c,p,S,k,L,oe,ue,null,Q,ae)),Ma(n,g,S,!W);return}}ub(n,a,g,o,c,p,S,k,L)}function rR(n){for(var a=n;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var p=o[c],g=p.getSnapshot;p=p.value;try{if(!Pn(g(),p))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ma(n,a,o,c){a&=~Ah,a&=~jr,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var p=a;0<p;){var g=31-at(p),S=1<<g;c[g]=-1,p&=~S}o!==0&&yo(n,o,a)}function qc(){return(ot&6)===0?(Jo(0),!1):!0}function Oh(){if(Ge!==null){if(ct===0)var n=Ge.return;else n=Ge,Ks=yr=null,Xf(n),mi=null,Do=0,n=Ge;for(;n!==null;)O0(n.alternate,n),n=n.return;Ge=null}}function Ti(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,TR(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),oa=0,Oh(),mt=n,Ge=o=Gs(n.current,null),We=a,ct=0,Bn=null,Aa=!1,Si=ma(n,a),Ch=!1,Ei=Zn=Ah=jr=Ra=zt=0,kn=Ko=null,Rh=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var p=31-at(c),g=1<<p;a|=n[p],c&=~g}return ia=a,hc(),o}function sb(n,a){Fe=null,z.H=Bo,a===pi||a===wc?(a=bv(),ct=3):a===Lf?(a=bv(),ct=4):ct=a===dh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Bn=a,Ge===null&&(zt=1,zc(n,es(a,n.current)))}function ab(){var n=Un.current;return n===null?!0:(We&4194048)===We?as===null:(We&62914560)===We||(We&536870912)!==0?n===as:!1}function rb(){var n=z.H;return z.H=Bo,n===null?Bo:n}function ib(){var n=z.A;return z.A=sR,n}function Yc(){zt=4,Aa||(We&4194048)!==We&&Un.current!==null||(Si=!0),(Ra&134217727)===0&&(jr&134217727)===0||mt===null||Ma(mt,We,Zn,!1)}function Dh(n,a,o){var c=ot;ot|=2;var p=rb(),g=ib();(mt!==n||We!==a)&&(Fc=null,Ti(n,a)),a=!1;var S=zt;e:do try{if(ct!==0&&Ge!==null){var k=Ge,L=Bn;switch(ct){case 8:Oh(),S=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(a=!0);var W=ct;if(ct=0,Bn=null,ji(n,k,L,W),o&&Si){S=0;break e}break;default:W=ct,ct=0,Bn=null,ji(n,k,L,W)}}iR(),S=zt;break}catch(oe){sb(n,oe)}while(!0);return a&&n.shellSuspendCounter++,Ks=yr=null,ot=c,z.H=p,z.A=g,Ge===null&&(mt=null,We=0,hc()),S}function iR(){for(;Ge!==null;)ob(Ge)}function oR(n,a){var o=ot;ot|=2;var c=rb(),p=ib();mt!==n||We!==a?(Fc=null,Hc=me()+500,Ti(n,a)):Si=ma(n,a);e:do try{if(ct!==0&&Ge!==null){a=Ge;var g=Bn;t:switch(ct){case 1:ct=0,Bn=null,ji(n,a,g,1);break;case 2:case 9:if(yv(g)){ct=0,Bn=null,lb(a);break}a=function(){ct!==2&&ct!==9||mt!==n||(ct=7),Rs(n)},g.then(a,a);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:yv(g)?(ct=0,Bn=null,lb(a)):(ct=0,Bn=null,ji(n,a,g,7));break;case 5:var S=null;switch(Ge.tag){case 26:S=Ge.memoizedState;case 5:case 27:var k=Ge;if(S?Yb(S):k.stateNode.complete){ct=0,Bn=null;var L=k.sibling;if(L!==null)Ge=L;else{var W=k.return;W!==null?(Ge=W,Gc(W)):Ge=null}break t}}ct=0,Bn=null,ji(n,a,g,5);break;case 6:ct=0,Bn=null,ji(n,a,g,6);break;case 8:Oh(),zt=6;break e;default:throw Error(r(462))}}lR();break}catch(oe){sb(n,oe)}while(!0);return Ks=yr=null,z.H=c,z.A=p,ot=o,Ge!==null?0:(mt=null,We=0,hc(),zt)}function lR(){for(;Ge!==null&&!te();)ob(Ge)}function ob(n){var a=k0(n.alternate,n,ia);n.memoizedProps=n.pendingProps,a===null?Gc(n):Ge=a}function lb(n){var a=n,o=a.alternate;switch(a.tag){case 15:case 0:a=T0(o,a,a.pendingProps,a.type,void 0,We);break;case 11:a=T0(o,a,a.pendingProps,a.type.render,a.ref,We);break;case 5:Xf(a);default:O0(o,a),a=Ge=iv(a,ia),a=k0(o,a,ia)}n.memoizedProps=n.pendingProps,a===null?Gc(n):Ge=a}function ji(n,a,o,c){Ks=yr=null,Xf(a),mi=null,Do=0;var p=a.return;try{if(KA(n,p,a,o,We)){zt=1,zc(n,es(o,n.current)),Ge=null;return}}catch(g){if(p!==null)throw Ge=p,g;zt=1,zc(n,es(o,n.current)),Ge=null;return}a.flags&32768?(Qe||c===1?n=!0:Si||(We&536870912)!==0?n=!1:(Aa=n=!0,(c===2||c===9||c===3||c===6)&&(c=Un.current,c!==null&&c.tag===13&&(c.flags|=16384))),cb(a,n)):Gc(a)}function Gc(n){var a=n;do{if((a.flags&32768)!==0){cb(a,Aa);return}n=a.return;var o=QA(a.alternate,a,ia);if(o!==null){Ge=o;return}if(a=a.sibling,a!==null){Ge=a;return}Ge=a=n}while(a!==null);zt===0&&(zt=5)}function cb(n,a){do{var o=eR(n.alternate,n);if(o!==null){o.flags&=32767,Ge=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){Ge=n;return}Ge=n=o}while(n!==null);zt=6,Ge=null}function ub(n,a,o,c,p,g,S,k,L){n.cancelPendingCommit=null;do Xc();while(Xt!==0);if((ot&6)!==0)throw Error(r(327));if(a!==null){if(a===n.current)throw Error(r(177));if(g=a.lanes|a.childLanes,g|=Sf,go(n,o,g,S,k,L),n===mt&&(Ge=mt=null,We=0),Ni=a,ka=n,oa=o,_h=g,kh=p,Q0=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,fR(Me,function(){return mb(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=z.T,z.T=null,p=H.p,H.p=2,S=ot,ot|=4;try{tR(n,a,o)}finally{ot=S,H.p=p,z.T=c}}Xt=1,db(),fb(),hb()}}function db(){if(Xt===1){Xt=0;var n=ka,a=Ni,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=z.T,z.T=null;var c=H.p;H.p=2;var p=ot;ot|=4;try{F0(a,n);var g=qh,S=Wy(n.containerInfo),k=g.focusedElem,L=g.selectionRange;if(S!==k&&k&&k.ownerDocument&&Ky(k.ownerDocument.documentElement,k)){if(L!==null&&yf(k)){var W=L.start,oe=L.end;if(oe===void 0&&(oe=W),"selectionStart"in k)k.selectionStart=W,k.selectionEnd=Math.min(oe,k.value.length);else{var ue=k.ownerDocument||document,Q=ue&&ue.defaultView||window;if(Q.getSelection){var ae=Q.getSelection(),Ee=k.textContent.length,De=Math.min(L.start,Ee),pt=L.end===void 0?De:Math.min(L.end,Ee);!ae.extend&&De>pt&&(S=pt,pt=De,De=S);var q=Xy(k,De),V=Xy(k,pt);if(q&&V&&(ae.rangeCount!==1||ae.anchorNode!==q.node||ae.anchorOffset!==q.offset||ae.focusNode!==V.node||ae.focusOffset!==V.offset)){var K=ue.createRange();K.setStart(q.node,q.offset),ae.removeAllRanges(),De>pt?(ae.addRange(K),ae.extend(V.node,V.offset)):(K.setEnd(V.node,V.offset),ae.addRange(K))}}}}for(ue=[],ae=k;ae=ae.parentNode;)ae.nodeType===1&&ue.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ue.length;k++){var ce=ue[k];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}ou=!!Fh,qh=Fh=null}finally{ot=p,H.p=c,z.T=o}}n.current=a,Xt=2}}function fb(){if(Xt===2){Xt=0;var n=ka,a=Ni,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=z.T,z.T=null;var c=H.p;H.p=2;var p=ot;ot|=4;try{U0(n,a.alternate,a)}finally{ot=p,H.p=c,z.T=o}}Xt=3}}function hb(){if(Xt===4||Xt===3){Xt=0,de();var n=ka,a=Ni,o=oa,c=Q0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Xt=5:(Xt=0,Ni=ka=null,pb(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(_a=null),vo(o),a=a.stateNode,Oe&&typeof Oe.onCommitFiberRoot=="function")try{Oe.onCommitFiberRoot(Qt,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=z.T,p=H.p,H.p=2,z.T=null;try{for(var g=n.onRecoverableError,S=0;S<c.length;S++){var k=c[S];g(k.value,{componentStack:k.stack})}}finally{z.T=a,H.p=p}}(oa&3)!==0&&Xc(),Rs(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===Mh?Wo++:(Wo=0,Mh=n):Wo=0,Jo(0)}}function pb(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Mo(a)))}function Xc(){return db(),fb(),hb(),mb()}function mb(){if(Xt!==5)return!1;var n=ka,a=_h;_h=0;var o=vo(oa),c=z.T,p=H.p;try{H.p=32>o?32:o,z.T=null,o=kh,kh=null;var g=ka,S=oa;if(Xt=0,Ni=ka=null,oa=0,(ot&6)!==0)throw Error(r(331));var k=ot;if(ot|=4,K0(g.current),Y0(g,g.current,S,o),ot=k,Jo(0,!1),Oe&&typeof Oe.onPostCommitFiberRoot=="function")try{Oe.onPostCommitFiberRoot(Qt,g)}catch{}return!0}finally{H.p=p,z.T=c,pb(n,a)}}function gb(n,a,o){a=es(o,a),a=uh(n.stateNode,a,2),n=Na(n,a,2),n!==null&&(cr(n,2),Rs(n))}function ut(n,a,o){if(n.tag===3)gb(n,n,o);else for(;a!==null;){if(a.tag===3){gb(a,n,o);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(_a===null||!_a.has(c))){n=es(o,n),o=y0(2),c=Na(a,o,2),c!==null&&(v0(o,c,a,n),cr(c,2),Rs(c));break}}a=a.return}}function zh(n,a,o){var c=n.pingCache;if(c===null){c=n.pingCache=new aR;var p=new Set;c.set(a,p)}else p=c.get(a),p===void 0&&(p=new Set,c.set(a,p));p.has(o)||(Ch=!0,p.add(o),n=cR.bind(null,n,a,o),a.then(n,n))}function cR(n,a,o){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,mt===n&&(We&o)===o&&(zt===4||zt===3&&(We&62914560)===We&&300>me()-Zc?(ot&2)===0&&Ti(n,0):Ah|=o,Ei===We&&(Ei=0)),Rs(n)}function yb(n,a){a===0&&(a=Wl()),n=pr(n,a),n!==null&&(cr(n,a),Rs(n))}function uR(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),yb(n,o)}function dR(n,a){var o=0;switch(n.tag){case 31:case 13:var c=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(a),yb(n,o)}function fR(n,a){return Ze(n,a)}var Kc=null,Ci=null,Ih=!1,Wc=!1,Lh=!1,Oa=0;function Rs(n){n!==Ci&&n.next===null&&(Ci===null?Kc=Ci=n:Ci=Ci.next=n),Wc=!0,Ih||(Ih=!0,pR())}function Jo(n,a){if(!Lh&&Wc){Lh=!0;do for(var o=!1,c=Kc;c!==null;){if(n!==0){var p=c.pendingLanes;if(p===0)var g=0;else{var S=c.suspendedLanes,k=c.pingedLanes;g=(1<<31-at(42|n)+1)-1,g&=p&~(S&~k),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,wb(c,g))}else g=We,g=pa(c,c===mt?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ma(c,g)||(o=!0,wb(c,g));c=c.next}while(o);Lh=!1}}function hR(){vb()}function vb(){Wc=Ih=!1;var n=0;Oa!==0&&NR()&&(n=Oa);for(var a=me(),o=null,c=Kc;c!==null;){var p=c.next,g=bb(c,a);g===0?(c.next=null,o===null?Kc=p:o.next=p,p===null&&(Ci=o)):(o=c,(n!==0||(g&3)!==0)&&(Wc=!0)),c=p}Xt!==0&&Xt!==5||Jo(n),Oa!==0&&(Oa=0)}function bb(n,a){for(var o=n.suspendedLanes,c=n.pingedLanes,p=n.expirationTimes,g=n.pendingLanes&-62914561;0<g;){var S=31-at(g),k=1<<S,L=p[S];L===-1?((k&o)===0||(k&c)!==0)&&(p[S]=Wd(k,a)):L<=a&&(n.expiredLanes|=k),g&=~k}if(a=mt,o=We,o=pa(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,o===0||n===a&&(ct===2||ct===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&Z(c),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||ma(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(c!==null&&Z(c),vo(o)){case 2:case 8:o=Ie;break;case 32:o=Me;break;case 268435456:o=Ot;break;default:o=Me}return c=xb.bind(null,n),o=Ze(o,c),n.callbackPriority=a,n.callbackNode=o,a}return c!==null&&c!==null&&Z(c),n.callbackPriority=2,n.callbackNode=null,2}function xb(n,a){if(Xt!==0&&Xt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Xc()&&n.callbackNode!==o)return null;var c=We;return c=pa(n,n===mt?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(tb(n,c,a),bb(n,me()),n.callbackNode!=null&&n.callbackNode===o?xb.bind(null,n):null)}function wb(n,a){if(Xc())return null;tb(n,a,!0)}function pR(){jR(function(){(ot&6)!==0?Ze(Ae,hR):vb()})}function Ph(){if(Oa===0){var n=fi;n===0&&(n=Gt,Gt<<=1,(Gt&261888)===0&&(Gt=256)),Oa=n}return Oa}function Sb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:rc(""+n)}function Eb(n,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,n.id&&o.setAttribute("form",n.id),a.parentNode.insertBefore(o,a),n=new FormData(n),o.parentNode.removeChild(o),n}function mR(n,a,o,c,p){if(a==="submit"&&o&&o.stateNode===p){var g=Sb((p[jn]||null).action),S=c.submitter;S&&(a=(a=S[jn]||null)?Sb(a.formAction):S.getAttribute("formAction"),a!==null&&(g=a,S=null));var k=new cc("action","action",null,c,p);n.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Oa!==0){var L=S?Eb(p,S):new FormData(p);ah(o,{pending:!0,data:L,method:p.method,action:g},null,L)}}else typeof g=="function"&&(k.preventDefault(),L=S?Eb(p,S):new FormData(p),ah(o,{pending:!0,data:L,method:p.method,action:g},g,L))},currentTarget:p}]})}}for(var $h=0;$h<wf.length;$h++){var Uh=wf[$h],gR=Uh.toLowerCase(),yR=Uh[0].toUpperCase()+Uh.slice(1);hs(gR,"on"+yR)}hs(ev,"onAnimationEnd"),hs(tv,"onAnimationIteration"),hs(nv,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(OA,"onTransitionRun"),hs(DA,"onTransitionStart"),hs(zA,"onTransitionCancel"),hs(sv,"onTransitionEnd"),Jr("onMouseEnter",["mouseout","mouseover"]),Jr("onMouseLeave",["mouseout","mouseover"]),Jr("onPointerEnter",["pointerout","pointerover"]),Jr("onPointerLeave",["pointerout","pointerover"]),ur("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ur("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ur("onBeforeInput",["compositionend","keypress","textInput","paste"]),ur("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ur("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ur("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qo="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(" "),vR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qo));function Nb(n,a){a=(a&4)!==0;for(var o=0;o<n.length;o++){var c=n[o],p=c.event;c=c.listeners;e:{var g=void 0;if(a)for(var S=c.length-1;0<=S;S--){var k=c[S],L=k.instance,W=k.currentTarget;if(k=k.listener,L!==g&&p.isPropagationStopped())break e;g=k,p.currentTarget=W;try{g(p)}catch(oe){fc(oe)}p.currentTarget=null,g=L}else for(S=0;S<c.length;S++){if(k=c[S],L=k.instance,W=k.currentTarget,k=k.listener,L!==g&&p.isPropagationStopped())break e;g=k,p.currentTarget=W;try{g(p)}catch(oe){fc(oe)}p.currentTarget=null,g=L}}}}function Xe(n,a){var o=a[Jd];o===void 0&&(o=a[Jd]=new Set);var c=n+"__bubble";o.has(c)||(Tb(a,n,2,!1),o.add(c))}function Vh(n,a,o){var c=0;a&&(c|=4),Tb(o,n,c,a)}var Jc="_reactListening"+Math.random().toString(36).slice(2);function Bh(n){if(!n[Jc]){n[Jc]=!0,vy.forEach(function(o){o!=="selectionchange"&&(vR.has(o)||Vh(o,!1,n),Vh(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Jc]||(a[Jc]=!0,Vh("selectionchange",!1,a))}}function Tb(n,a,o,c){switch(ex(a)){case 2:var p=qR;break;case 8:p=YR;break;default:p=sp}o=p.bind(null,a,o,n),p=void 0,!lf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),c?p!==void 0?n.addEventListener(a,o,{capture:!0,passive:p}):n.addEventListener(a,o,!0):p!==void 0?n.addEventListener(a,o,{passive:p}):n.addEventListener(a,o,!1)}function Zh(n,a,o,c,p){var g=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var k=c.stateNode.containerInfo;if(k===p)break;if(S===4)for(S=c.return;S!==null;){var L=S.tag;if((L===3||L===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;k!==null;){if(S=Xr(k),S===null)return;if(L=S.tag,L===5||L===6||L===26||L===27){c=g=S;continue e}k=k.parentNode}}c=c.return}_y(function(){var W=g,oe=rf(o),ue=[];e:{var Q=av.get(n);if(Q!==void 0){var ae=cc,Ee=n;switch(n){case"keypress":if(oc(o)===0)break e;case"keydown":case"keyup":ae=dA;break;case"focusin":Ee="focus",ae=ff;break;case"focusout":Ee="blur",ae=ff;break;case"beforeblur":case"afterblur":ae=ff;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=QC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=pA;break;case ev:case tv:case nv:ae=nA;break;case sv:ae=gA;break;case"scroll":case"scrollend":ae=WC;break;case"wheel":ae=vA;break;case"copy":case"cut":case"paste":ae=aA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=zy;break;case"toggle":case"beforetoggle":ae=xA}var De=(a&4)!==0,pt=!De&&(n==="scroll"||n==="scrollend"),q=De?Q!==null?Q+"Capture":null:Q;De=[];for(var V=W,K;V!==null;){var ce=V;if(K=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||K===null||q===null||(ce=wo(V,q),ce!=null&&De.push(el(V,ce,K))),pt)break;V=V.return}0<De.length&&(Q=new ae(Q,Ee,null,o,oe),ue.push({event:Q,listeners:De}))}}if((a&7)===0){e:{if(Q=n==="mouseover"||n==="pointerover",ae=n==="mouseout"||n==="pointerout",Q&&o!==af&&(Ee=o.relatedTarget||o.fromElement)&&(Xr(Ee)||Ee[Gr]))break e;if((ae||Q)&&(Q=oe.window===oe?oe:(Q=oe.ownerDocument)?Q.defaultView||Q.parentWindow:window,ae?(Ee=o.relatedTarget||o.toElement,ae=W,Ee=Ee?Xr(Ee):null,Ee!==null&&(pt=l(Ee),De=Ee.tag,Ee!==pt||De!==5&&De!==27&&De!==6)&&(Ee=null)):(ae=null,Ee=W),ae!==Ee)){if(De=Oy,ce="onMouseLeave",q="onMouseEnter",V="mouse",(n==="pointerout"||n==="pointerover")&&(De=zy,ce="onPointerLeave",q="onPointerEnter",V="pointer"),pt=ae==null?Q:xo(ae),K=Ee==null?Q:xo(Ee),Q=new De(ce,V+"leave",ae,o,oe),Q.target=pt,Q.relatedTarget=K,ce=null,Xr(oe)===W&&(De=new De(q,V+"enter",Ee,o,oe),De.target=K,De.relatedTarget=pt,ce=De),pt=ce,ae&&Ee)t:{for(De=bR,q=ae,V=Ee,K=0,ce=q;ce;ce=De(ce))K++;ce=0;for(var ke=V;ke;ke=De(ke))ce++;for(;0<K-ce;)q=De(q),K--;for(;0<ce-K;)V=De(V),ce--;for(;K--;){if(q===V||V!==null&&q===V.alternate){De=q;break t}q=De(q),V=De(V)}De=null}else De=null;ae!==null&&jb(ue,Q,ae,De,!1),Ee!==null&&pt!==null&&jb(ue,pt,Ee,De,!0)}}e:{if(Q=W?xo(W):window,ae=Q.nodeName&&Q.nodeName.toLowerCase(),ae==="select"||ae==="input"&&Q.type==="file")var rt=Zy;else if(Vy(Q))if(Hy)rt=_A;else{rt=AA;var Te=CA}else ae=Q.nodeName,!ae||ae.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?W&&sf(W.elementType)&&(rt=Zy):rt=RA;if(rt&&(rt=rt(n,W))){By(ue,rt,o,oe);break e}Te&&Te(n,Q,W),n==="focusout"&&W&&Q.type==="number"&&W.memoizedProps.value!=null&&nf(Q,"number",Q.value)}switch(Te=W?xo(W):window,n){case"focusin":(Vy(Te)||Te.contentEditable==="true")&&(ai=Te,vf=W,Ro=null);break;case"focusout":Ro=vf=ai=null;break;case"mousedown":bf=!0;break;case"contextmenu":case"mouseup":case"dragend":bf=!1,Jy(ue,o,oe);break;case"selectionchange":if(MA)break;case"keydown":case"keyup":Jy(ue,o,oe)}var qe;if(pf)e:{switch(n){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else si?$y(n,o)&&(Je="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(Je="onCompositionStart");Je&&(Iy&&o.locale!=="ko"&&(si||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&si&&(qe=ky()):(ya=oe,cf="value"in ya?ya.value:ya.textContent,si=!0)),Te=Qc(W,Je),0<Te.length&&(Je=new Dy(Je,n,null,o,oe),ue.push({event:Je,listeners:Te}),qe?Je.data=qe:(qe=Uy(o),qe!==null&&(Je.data=qe)))),(qe=SA?EA(n,o):NA(n,o))&&(Je=Qc(W,"onBeforeInput"),0<Je.length&&(Te=new Dy("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Te,listeners:Je}),Te.data=qe)),mR(ue,n,W,o,oe)}Nb(ue,a)})}function el(n,a,o){return{instance:n,listener:a,currentTarget:o}}function Qc(n,a){for(var o=a+"Capture",c=[];n!==null;){var p=n,g=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||g===null||(p=wo(n,o),p!=null&&c.unshift(el(n,p,g)),p=wo(n,a),p!=null&&c.push(el(n,p,g))),n.tag===3)return c;n=n.return}return[]}function bR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function jb(n,a,o,c,p){for(var g=a._reactName,S=[];o!==null&&o!==c;){var k=o,L=k.alternate,W=k.stateNode;if(k=k.tag,L!==null&&L===c)break;k!==5&&k!==26&&k!==27||W===null||(L=W,p?(W=wo(o,g),W!=null&&S.unshift(el(o,W,L))):p||(W=wo(o,g),W!=null&&S.push(el(o,W,L)))),o=o.return}S.length!==0&&n.push({event:a,listeners:S})}var xR=/\r\n?/g,wR=/\u0000|\uFFFD/g;function Cb(n){return(typeof n=="string"?n:""+n).replace(xR,`
9
- `).replace(wR,"")}function Ab(n,a){return a=Cb(a),Cb(n)===a}function ht(n,a,o,c,p,g){switch(o){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||ei(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&ei(n,""+c);break;case"className":sc(n,"class",c);break;case"tabIndex":sc(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":sc(n,o,c);break;case"style":Ay(n,c,g);break;case"data":if(a!=="object"){sc(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=rc(""+c),n.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(o,"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 g=="function"&&(o==="formAction"?(a!=="input"&&ht(n,a,"name",p.name,p,null),ht(n,a,"formEncType",p.formEncType,p,null),ht(n,a,"formMethod",p.formMethod,p,null),ht(n,a,"formTarget",p.formTarget,p,null)):(ht(n,a,"encType",p.encType,p,null),ht(n,a,"method",p.method,p,null),ht(n,a,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=rc(""+c),n.setAttribute(o,c);break;case"onClick":c!=null&&(n.onclick=qs);break;case"onScroll":c!=null&&Xe("scroll",n);break;case"onScrollEnd":c!=null&&Xe("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}o=rc(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,""+c):n.removeAttribute(o);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":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":c===!0?n.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,c):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(o,c):n.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(o):n.setAttribute(o,c);break;case"popover":Xe("beforetoggle",n),Xe("toggle",n),nc(n,"popover",c);break;case"xlinkActuate":Fs(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Fs(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Fs(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Fs(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Fs(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Fs(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":nc(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=XC.get(o)||o,nc(n,o,c))}}function Hh(n,a,o,c,p,g){switch(o){case"style":Ay(n,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof c=="string"?ei(n,c):(typeof c=="number"||typeof c=="bigint")&&ei(n,""+c);break;case"onScroll":c!=null&&Xe("scroll",n);break;case"onScrollEnd":c!=null&&Xe("scrollend",n);break;case"onClick":c!=null&&(n.onclick=qs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!by.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),a=o.slice(2,p?o.length-7:void 0),g=n[jn]||null,g=g!=null?g[o]:null,typeof g=="function"&&n.removeEventListener(a,g,p),typeof c=="function")){typeof g!="function"&&g!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,c,p);break e}o in n?n[o]=c:c===!0?n.setAttribute(o,""):nc(n,o,c)}}}function rn(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",n),Xe("load",n);var c=!1,p=!1,g;for(g in o)if(o.hasOwnProperty(g)){var S=o[g];if(S!=null)switch(g){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ht(n,a,g,S,o,null)}}p&&ht(n,a,"srcSet",o.srcSet,o,null),c&&ht(n,a,"src",o.src,o,null);return;case"input":Xe("invalid",n);var k=g=S=p=null,L=null,W=null;for(c in o)if(o.hasOwnProperty(c)){var oe=o[c];if(oe!=null)switch(c){case"name":p=oe;break;case"type":S=oe;break;case"checked":L=oe;break;case"defaultChecked":W=oe;break;case"value":g=oe;break;case"defaultValue":k=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,a));break;default:ht(n,a,c,oe,o,null)}}Ny(n,g,k,L,W,S,p,!1);return;case"select":Xe("invalid",n),c=S=g=null;for(p in o)if(o.hasOwnProperty(p)&&(k=o[p],k!=null))switch(p){case"value":g=k;break;case"defaultValue":S=k;break;case"multiple":c=k;default:ht(n,a,p,k,o,null)}a=g,o=S,n.multiple=!!c,a!=null?Qr(n,!!c,a,!1):o!=null&&Qr(n,!!c,o,!0);return;case"textarea":Xe("invalid",n),g=p=c=null;for(S in o)if(o.hasOwnProperty(S)&&(k=o[S],k!=null))switch(S){case"value":c=k;break;case"defaultValue":p=k;break;case"children":g=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:ht(n,a,S,k,o,null)}jy(n,c,p,g);return;case"option":for(L in o)o.hasOwnProperty(L)&&(c=o[L],c!=null)&&(L==="selected"?n.selected=c&&typeof c!="function"&&typeof c!="symbol":ht(n,a,L,c,o,null));return;case"dialog":Xe("beforetoggle",n),Xe("toggle",n),Xe("cancel",n),Xe("close",n);break;case"iframe":case"object":Xe("load",n);break;case"video":case"audio":for(c=0;c<Qo.length;c++)Xe(Qo[c],n);break;case"image":Xe("error",n),Xe("load",n);break;case"details":Xe("toggle",n);break;case"embed":case"source":case"link":Xe("error",n),Xe("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in o)if(o.hasOwnProperty(W)&&(c=o[W],c!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ht(n,a,W,c,o,null)}return;default:if(sf(a)){for(oe in o)o.hasOwnProperty(oe)&&(c=o[oe],c!==void 0&&Hh(n,a,oe,c,o,void 0));return}}for(k in o)o.hasOwnProperty(k)&&(c=o[k],c!=null&&ht(n,a,k,c,o,null))}function SR(n,a,o,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,g=null,S=null,k=null,L=null,W=null,oe=null;for(ae in o){var ue=o[ae];if(o.hasOwnProperty(ae)&&ue!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":L=ue;default:c.hasOwnProperty(ae)||ht(n,a,ae,null,c,ue)}}for(var Q in c){var ae=c[Q];if(ue=o[Q],c.hasOwnProperty(Q)&&(ae!=null||ue!=null))switch(Q){case"type":g=ae;break;case"name":p=ae;break;case"checked":W=ae;break;case"defaultChecked":oe=ae;break;case"value":S=ae;break;case"defaultValue":k=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,a));break;default:ae!==ue&&ht(n,a,Q,ae,c,ue)}}tf(n,S,k,L,W,oe,g,p);return;case"select":ae=S=k=Q=null;for(g in o)if(L=o[g],o.hasOwnProperty(g)&&L!=null)switch(g){case"value":break;case"multiple":ae=L;default:c.hasOwnProperty(g)||ht(n,a,g,null,c,L)}for(p in c)if(g=c[p],L=o[p],c.hasOwnProperty(p)&&(g!=null||L!=null))switch(p){case"value":Q=g;break;case"defaultValue":k=g;break;case"multiple":S=g;default:g!==L&&ht(n,a,p,g,c,L)}a=k,o=S,c=ae,Q!=null?Qr(n,!!o,Q,!1):!!c!=!!o&&(a!=null?Qr(n,!!o,a,!0):Qr(n,!!o,o?[]:"",!1));return;case"textarea":ae=Q=null;for(k in o)if(p=o[k],o.hasOwnProperty(k)&&p!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:ht(n,a,k,null,c,p)}for(S in c)if(p=c[S],g=o[S],c.hasOwnProperty(S)&&(p!=null||g!=null))switch(S){case"value":Q=p;break;case"defaultValue":ae=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==g&&ht(n,a,S,p,c,g)}Ty(n,Q,ae);return;case"option":for(var Ee in o)Q=o[Ee],o.hasOwnProperty(Ee)&&Q!=null&&!c.hasOwnProperty(Ee)&&(Ee==="selected"?n.selected=!1:ht(n,a,Ee,null,c,Q));for(L in c)Q=c[L],ae=o[L],c.hasOwnProperty(L)&&Q!==ae&&(Q!=null||ae!=null)&&(L==="selected"?n.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":ht(n,a,L,Q,c,ae));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 De in o)Q=o[De],o.hasOwnProperty(De)&&Q!=null&&!c.hasOwnProperty(De)&&ht(n,a,De,null,c,Q);for(W in c)if(Q=c[W],ae=o[W],c.hasOwnProperty(W)&&Q!==ae&&(Q!=null||ae!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,a));break;default:ht(n,a,W,Q,c,ae)}return;default:if(sf(a)){for(var pt in o)Q=o[pt],o.hasOwnProperty(pt)&&Q!==void 0&&!c.hasOwnProperty(pt)&&Hh(n,a,pt,void 0,c,Q);for(oe in c)Q=c[oe],ae=o[oe],!c.hasOwnProperty(oe)||Q===ae||Q===void 0&&ae===void 0||Hh(n,a,oe,Q,c,ae);return}}for(var q in o)Q=o[q],o.hasOwnProperty(q)&&Q!=null&&!c.hasOwnProperty(q)&&ht(n,a,q,null,c,Q);for(ue in c)Q=c[ue],ae=o[ue],!c.hasOwnProperty(ue)||Q===ae||Q==null&&ae==null||ht(n,a,ue,Q,c,ae)}function Rb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ER(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var p=o[c],g=p.transferSize,S=p.initiatorType,k=p.duration;if(g&&k&&Rb(S)){for(S=0,k=p.responseEnd,c+=1;c<o.length;c++){var L=o[c],W=L.startTime;if(W>k)break;var oe=L.transferSize,ue=L.initiatorType;oe&&Rb(ue)&&(L=L.responseEnd,S+=oe*(L<k?1:(k-W)/(L-W)))}if(--c,a+=8*(g+S)/(p.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Fh=null,qh=null;function eu(n){return n.nodeType===9?n:n.ownerDocument}function _b(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kb(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Yh(n,a){return n==="textarea"||n==="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 Gh=null;function NR(){var n=window.event;return n&&n.type==="popstate"?n===Gh?!1:(Gh=n,!0):(Gh=null,!1)}var Mb=typeof setTimeout=="function"?setTimeout:void 0,TR=typeof clearTimeout=="function"?clearTimeout:void 0,Ob=typeof Promise=="function"?Promise:void 0,jR=typeof queueMicrotask=="function"?queueMicrotask:typeof Ob<"u"?function(n){return Ob.resolve(null).then(n).catch(CR)}:Mb;function CR(n){setTimeout(function(){throw n})}function Da(n){return n==="head"}function Db(n,a){var o=a,c=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(c===0){n.removeChild(p),ki(a);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")tl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,tl(o);for(var g=o.firstChild;g;){var S=g.nextSibling,k=g.nodeName;g[bo]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=S}}else o==="body"&&tl(n.ownerDocument.body);o=p}while(o);ki(a)}function zb(n,a){var o=n;n=0;do{var c=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=c}while(o)}function Xh(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Xh(o),Qd(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function AR(n,a,o,c){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[bo])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(g=n.getAttribute("rel"),g==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(g!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(g=n.getAttribute("src"),(g!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&g&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var g=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===g)return n}else return n;if(n=rs(n.nextSibling),n===null)break}return null}function RR(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=rs(n.nextSibling),n===null))return null;return n}function Ib(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=rs(n.nextSibling),n===null))return null;return n}function Kh(n){return n.data==="$?"||n.data==="$~"}function Wh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function _R(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var c=function(){a(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function rs(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Jh=null;function Lb(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(a===0)return rs(n.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}n=n.nextSibling}return null}function Pb(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return n;a--}else o!=="/$"&&o!=="/&"||a++}n=n.previousSibling}return null}function $b(n,a,o){switch(a=eu(o),n){case"html":if(n=a.documentElement,!n)throw Error(r(452));return n;case"head":if(n=a.head,!n)throw Error(r(453));return n;case"body":if(n=a.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function tl(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Qd(n)}var is=new Map,Ub=new Set;function tu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var la=H.d;H.d={f:kR,r:MR,D:OR,C:DR,L:zR,m:IR,X:PR,S:LR,M:$R};function kR(){var n=la.f(),a=qc();return n||a}function MR(n){var a=Kr(n);a!==null&&a.tag===5&&a.type==="form"?s0(a):la.r(n)}var Ai=typeof document>"u"?null:document;function Vb(n,a,o){var c=Ai;if(c&&typeof a=="string"&&a){var p=Jn(a);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Ub.has(p)||(Ub.add(p),n={rel:n,crossOrigin:o,href:a},c.querySelector(p)===null&&(a=c.createElement("link"),rn(a,"link",n),Wt(a),c.head.appendChild(a)))}}function OR(n){la.D(n),Vb("dns-prefetch",n,null)}function DR(n,a){la.C(n,a),Vb("preconnect",n,a)}function zR(n,a,o){la.L(n,a,o);var c=Ai;if(c&&n&&a){var p='link[rel="preload"][as="'+Jn(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+Jn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+Jn(o.imageSizes)+'"]')):p+='[href="'+Jn(n)+'"]';var g=p;switch(a){case"style":g=Ri(n);break;case"script":g=_i(n)}is.has(g)||(n=v({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),is.set(g,n),c.querySelector(p)!==null||a==="style"&&c.querySelector(nl(g))||a==="script"&&c.querySelector(sl(g))||(a=c.createElement("link"),rn(a,"link",n),Wt(a),c.head.appendChild(a)))}}function IR(n,a){la.m(n,a);var o=Ai;if(o&&n){var c=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Jn(c)+'"][href="'+Jn(n)+'"]',g=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=_i(n)}if(!is.has(g)&&(n=v({rel:"modulepreload",href:n},a),is.set(g,n),o.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(sl(g)))return}c=o.createElement("link"),rn(c,"link",n),Wt(c),o.head.appendChild(c)}}}function LR(n,a,o){la.S(n,a,o);var c=Ai;if(c&&n){var p=Wr(c).hoistableStyles,g=Ri(n);a=a||"default";var S=p.get(g);if(!S){var k={loading:0,preload:null};if(S=c.querySelector(nl(g)))k.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},o),(o=is.get(g))&&Qh(n,o);var L=S=c.createElement("link");Wt(L),rn(L,"link",n),L._p=new Promise(function(W,oe){L.onload=W,L.onerror=oe}),L.addEventListener("load",function(){k.loading|=1}),L.addEventListener("error",function(){k.loading|=2}),k.loading|=4,nu(S,a,c)}S={type:"stylesheet",instance:S,count:1,state:k},p.set(g,S)}}}function PR(n,a){la.X(n,a);var o=Ai;if(o&&n){var c=Wr(o).hoistableScripts,p=_i(n),g=c.get(p);g||(g=o.querySelector(sl(p)),g||(n=v({src:n,async:!0},a),(a=is.get(p))&&ep(n,a),g=o.createElement("script"),Wt(g),rn(g,"link",n),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(p,g))}}function $R(n,a){la.M(n,a);var o=Ai;if(o&&n){var c=Wr(o).hoistableScripts,p=_i(n),g=c.get(p);g||(g=o.querySelector(sl(p)),g||(n=v({src:n,async:!0,type:"module"},a),(a=is.get(p))&&ep(n,a),g=o.createElement("script"),Wt(g),rn(g,"link",n),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(p,g))}}function Bb(n,a,o,c){var p=(p=ge.current)?tu(p):null;if(!p)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=Ri(o.href),o=Wr(p).hoistableStyles,c=o.get(a),c||(c={type:"style",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=Ri(o.href);var g=Wr(p).hoistableStyles,S=g.get(n);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,S),(g=p.querySelector(nl(n)))&&!g._p&&(S.instance=g,S.state.loading=5),is.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},is.set(n,o),g||UR(p,n,o,S.state))),a&&c===null)throw Error(r(528,""));return S}if(a&&c!==null)throw Error(r(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=_i(o),o=Wr(p).hoistableScripts,c=o.get(a),c||(c={type:"script",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function Ri(n){return'href="'+Jn(n)+'"'}function nl(n){return'link[rel="stylesheet"]['+n+"]"}function Zb(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function UR(n,a,o,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),rn(a,"link",o),Wt(a),n.head.appendChild(a))}function _i(n){return'[src="'+Jn(n)+'"]'}function sl(n){return"script[async]"+n}function Hb(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Jn(o.href)+'"]');if(c)return a.instance=c,Wt(c),c;var p=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Wt(c),rn(c,"style",p),nu(c,o.precedence,n),a.instance=c;case"stylesheet":p=Ri(o.href);var g=n.querySelector(nl(p));if(g)return a.state.loading|=4,a.instance=g,Wt(g),g;c=Zb(o),(p=is.get(p))&&Qh(c,p),g=(n.ownerDocument||n).createElement("link"),Wt(g);var S=g;return S._p=new Promise(function(k,L){S.onload=k,S.onerror=L}),rn(g,"link",c),a.state.loading|=4,nu(g,o.precedence,n),a.instance=g;case"script":return g=_i(o.src),(p=n.querySelector(sl(g)))?(a.instance=p,Wt(p),p):(c=o,(p=is.get(g))&&(c=v({},o),ep(c,p)),n=n.ownerDocument||n,p=n.createElement("script"),Wt(p),rn(p,"link",c),n.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,nu(c,o.precedence,n));return a.instance}function nu(n,a,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,g=p,S=0;S<c.length;S++){var k=c[S];if(k.dataset.precedence===a)g=k;else if(g!==p)break}g?g.parentNode.insertBefore(n,g.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(n,a.firstChild))}function Qh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function ep(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var su=null;function Fb(n,a,o){if(su===null){var c=new Map,p=su=new Map;p.set(o,c)}else p=su,c=p.get(o),c||(c=new Map,p.set(o,c));if(c.has(n))return c;for(c.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var g=o[p];if(!(g[bo]||g[tn]||n==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var S=g.getAttribute(a)||"";S=n+S;var k=c.get(S);k?k.push(g):c.set(S,[g])}}return c}function qb(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function VR(n,a,o){if(o===1||a.itemProp!=null)return!1;switch(n){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"?(n=a.disabled,typeof a.precedence=="string"&&n==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 Yb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function BR(n,a,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=Ri(c.href),g=a.querySelector(nl(p));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=au.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=g,Wt(g);return}g=a.ownerDocument||a,c=Zb(c),(p=is.get(p))&&Qh(c,p),g=g.createElement("link"),Wt(g);var S=g;S._p=new Promise(function(k,L){S.onload=k,S.onerror=L}),rn(g,"link",c),o.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=au.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var tp=0;function ZR(n,a){return n.stylesheets&&n.count===0&&iu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var c=setTimeout(function(){if(n.stylesheets&&iu(n,n.stylesheets),n.unsuspend){var g=n.unsuspend;n.unsuspend=null,g()}},6e4+a);0<n.imgBytes&&tp===0&&(tp=62500*ER());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&iu(n,n.stylesheets),n.unsuspend)){var g=n.unsuspend;n.unsuspend=null,g()}},(n.imgBytes>tp?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function au(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)iu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var ru=null;function iu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,ru=new Map,a.forEach(HR,n),ru=null,au.call(n))}function HR(n,a){if(!(a.state.loading&4)){var o=ru.get(n);if(o)var c=o.get(null);else{o=new Map,ru.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<p.length;g++){var S=p[g];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(o.set(S.dataset.precedence,S),c=S)}c&&o.set(null,c)}p=a.instance,S=p.getAttribute("data-precedence"),g=o.get(S)||c,g===c&&o.set(null,p),o.set(S,p),this.count++,c=au.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),g?g.parentNode.insertBefore(p,g.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),a.state.loading|=4}}var al={$$typeof:E,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function FR(n,a,o,c,p,g,S,k,L){this.tag=1,this.containerInfo=n,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=mo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mo(0),this.hiddenUpdates=mo(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=g,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Gb(n,a,o,c,p,g,S,k,L,W,oe,ue){return n=new FR(n,a,o,S,L,W,oe,ue,k),a=1,g===!0&&(a|=24),g=$n(3,null,null,a),n.current=g,g.stateNode=n,a=Df(),a.refCount++,n.pooledCache=a,a.refCount++,g.memoizedState={element:c,isDehydrated:o,cache:a},Pf(g),n}function Xb(n){return n?(n=oi,n):oi}function Kb(n,a,o,c,p,g){p=Xb(p),c.context===null?c.context=p:c.pendingContext=p,c=Ea(a),c.payload={element:o},g=g===void 0?null:g,g!==null&&(c.callback=g),o=Na(n,c,a),o!==null&&(Mn(o,n,a),Io(o,n,a))}function Wb(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<a?o:a}}function np(n,a){Wb(n,a),(n=n.alternate)&&Wb(n,a)}function Jb(n){if(n.tag===13||n.tag===31){var a=pr(n,67108864);a!==null&&Mn(a,n,67108864),np(n,67108864)}}function Qb(n){if(n.tag===13||n.tag===31){var a=Hn();a=Hs(a);var o=pr(n,a);o!==null&&Mn(o,n,a),np(n,a)}}var ou=!0;function qR(n,a,o,c){var p=z.T;z.T=null;var g=H.p;try{H.p=2,sp(n,a,o,c)}finally{H.p=g,z.T=p}}function YR(n,a,o,c){var p=z.T;z.T=null;var g=H.p;try{H.p=8,sp(n,a,o,c)}finally{H.p=g,z.T=p}}function sp(n,a,o,c){if(ou){var p=ap(c);if(p===null)Zh(n,a,c,lu,o),tx(n,c);else if(XR(p,n,a,o,c))c.stopPropagation();else if(tx(n,c),a&4&&-1<GR.indexOf(n)){for(;p!==null;){var g=Kr(p);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var S=gn(g.pendingLanes);if(S!==0){var k=g;for(k.pendingLanes|=2,k.entangledLanes|=2;S;){var L=1<<31-at(S);k.entanglements[1]|=L,S&=~L}Rs(g),(ot&6)===0&&(Hc=me()+500,Jo(0))}}break;case 31:case 13:k=pr(g,2),k!==null&&Mn(k,g,2),qc(),np(g,2)}if(g=ap(c),g===null&&Zh(n,a,c,lu,o),g===p)break;p=g}p!==null&&c.stopPropagation()}else Zh(n,a,c,null,o)}}function ap(n){return n=rf(n),rp(n)}var lu=null;function rp(n){if(lu=null,n=Xr(n),n!==null){var a=l(n);if(a===null)n=null;else{var o=a.tag;if(o===13){if(n=u(a),n!==null)return n;n=null}else if(o===31){if(n=f(a),n!==null)return n;n=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return lu=n,null}function ex(n){switch(n){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(ye()){case Ae:return 2;case Ie:return 8;case Me:case tt:return 32;case Ot:return 268435456;default:return 32}default:return 32}}var ip=!1,za=null,Ia=null,La=null,rl=new Map,il=new Map,Pa=[],GR="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 tx(n,a){switch(n){case"focusin":case"focusout":za=null;break;case"dragenter":case"dragleave":Ia=null;break;case"mouseover":case"mouseout":La=null;break;case"pointerover":case"pointerout":rl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":il.delete(a.pointerId)}}function ol(n,a,o,c,p,g){return n===null||n.nativeEvent!==g?(n={blockedOn:a,domEventName:o,eventSystemFlags:c,nativeEvent:g,targetContainers:[p]},a!==null&&(a=Kr(a),a!==null&&Jb(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),n)}function XR(n,a,o,c,p){switch(a){case"focusin":return za=ol(za,n,a,o,c,p),!0;case"dragenter":return Ia=ol(Ia,n,a,o,c,p),!0;case"mouseover":return La=ol(La,n,a,o,c,p),!0;case"pointerover":var g=p.pointerId;return rl.set(g,ol(rl.get(g)||null,n,a,o,c,p)),!0;case"gotpointercapture":return g=p.pointerId,il.set(g,ol(il.get(g)||null,n,a,o,c,p)),!0}return!1}function nx(n){var a=Xr(n.target);if(a!==null){var o=l(a);if(o!==null){if(a=o.tag,a===13){if(a=u(o),a!==null){n.blockedOn=a,tc(n.priority,function(){Qb(o)});return}}else if(a===31){if(a=f(o),a!==null){n.blockedOn=a,tc(n.priority,function(){Qb(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function cu(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var o=ap(n.nativeEvent);if(o===null){o=n.nativeEvent;var c=new o.constructor(o.type,o);af=c,o.target.dispatchEvent(c),af=null}else return a=Kr(o),a!==null&&Jb(a),n.blockedOn=o,!1;a.shift()}return!0}function sx(n,a,o){cu(n)&&o.delete(a)}function KR(){ip=!1,za!==null&&cu(za)&&(za=null),Ia!==null&&cu(Ia)&&(Ia=null),La!==null&&cu(La)&&(La=null),rl.forEach(sx),il.forEach(sx)}function uu(n,a){n.blockedOn===a&&(n.blockedOn=null,ip||(ip=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,KR)))}var du=null;function ax(n){du!==n&&(du=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){du===n&&(du=null);for(var a=0;a<n.length;a+=3){var o=n[a],c=n[a+1],p=n[a+2];if(typeof c!="function"){if(rp(c||o)===null)continue;break}var g=Kr(o);g!==null&&(n.splice(a,3),a-=3,ah(g,{pending:!0,data:p,method:o.method,action:c},c,p))}}))}function ki(n){function a(L){return uu(L,n)}za!==null&&uu(za,n),Ia!==null&&uu(Ia,n),La!==null&&uu(La,n),rl.forEach(a),il.forEach(a);for(var o=0;o<Pa.length;o++){var c=Pa[o];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Pa.length&&(o=Pa[0],o.blockedOn===null);)nx(o),o.blockedOn===null&&Pa.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var p=o[c],g=o[c+1],S=p[jn]||null;if(typeof g=="function")S||ax(o);else if(S){var k=null;if(g&&g.hasAttribute("formAction")){if(p=g,S=g[jn]||null)k=S.formAction;else if(rp(p)!==null)continue}else k=S.action;typeof k=="function"?o[c+1]=k:(o.splice(c,3),c-=3),ax(o)}}}function rx(){function n(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function op(n){this._internalRoot=n}fu.prototype.render=op.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(r(409));var o=a.current,c=Hn();Kb(o,c,n,a,null,null)},fu.prototype.unmount=op.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Kb(n.current,2,null,n,null,null),qc(),a[Gr]=null}};function fu(n){this._internalRoot=n}fu.prototype.unstable_scheduleHydration=function(n){if(n){var a=ec();n={blockedOn:null,target:n,priority:a};for(var o=0;o<Pa.length&&a!==0&&a<Pa[o].priority;o++);Pa.splice(o,0,n),o===0&&nx(n)}};var ix=t.version;if(ix!=="19.2.3")throw Error(r(527,ix,"19.2.3"));H.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=h(a),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var WR={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hu.isDisabled&&hu.supportsFiber)try{Qt=hu.inject(WR),Oe=hu}catch{}}return cl.createRoot=function(n,a){if(!i(n))throw Error(r(299));var o=!1,c="",p=h0,g=p0,S=m0;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(g=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=Gb(n,1,!1,null,null,o,c,null,p,g,S,rx),n[Gr]=a.current,Bh(n),new op(a)},cl.hydrateRoot=function(n,a,o){if(!i(n))throw Error(r(299));var c=!1,p="",g=h0,S=p0,k=m0,L=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(g=o.onUncaughtError),o.onCaughtError!==void 0&&(S=o.onCaughtError),o.onRecoverableError!==void 0&&(k=o.onRecoverableError),o.formState!==void 0&&(L=o.formState)),a=Gb(n,1,!0,a,o??null,c,p,L,g,S,k,rx),a.context=Xb(null),o=a.current,c=Hn(),c=Hs(c),p=Ea(c),p.callback=null,Na(o,p,c),o=c,a.current.lanes=o,cr(a,o),Rs(a),n[Gr]=a.current,Bh(n),new fu(a)},cl.version="19.2.3",cl}var gx;function o2(){if(gx)return up.exports;gx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),up.exports=i2(),up.exports}var l2=o2();const c2=({panOffset:e,scale:t,onPan:s,onPanStart:r,onPanEnd:i,isPanLocked:l=!1,onClick:u,showGuides:f=!1,onGuidesChange:m,gridOpacity:h=1})=>{const[y,v]=b.useState(f),[x,w]=b.useState(!1),N=b.useRef(!1),T=b.useRef({x:0,y:0}),R=b.useRef({active:!1,startX:0,startY:0}),C=b.useRef(null),j=b.useRef(null),E=b.useRef(null),_=4,A=b.useRef({x:0,y:0}),M=b.useRef(0),O=b.useRef(!1);b.useEffect(()=>{v(f)},[f]);const I=b.useCallback(G=>{const D=G;return D?D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable:!1},[]),Y=b.useCallback(G=>{const D=G;return D?!!D.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),F=b.useCallback(G=>{N.current=G,w(G)},[]);b.useEffect(()=>{const G=re=>{if(M.current=re.buttons,R.current.active&&(re.buttons&1)!==1&&(R.current.active=!1),N.current&&(re.buttons&1)!==1){F(!1),R.current.active=!1,i?.(),document.body.style.cursor="";return}if(l&&N.current){F(!1),R.current.active=!1,i?.(),document.body.style.cursor="";return}const se=C.current?.getBoundingClientRect(),ge=se?re.clientX-se.left:re.clientX,he=se?re.clientY-se.top:re.clientY;if(A.current={x:ge,y:he},j.current&&(j.current.style.left=`${ge}px`),E.current&&(E.current.style.top=`${he}px`),R.current.active&&!N.current){const pe=re.clientX-R.current.startX,be=re.clientY-R.current.startY;Math.hypot(pe,be)>=_&&(R.current.active=!1,F(!0),O.current=!0,r?.(),T.current={x:re.clientX,y:re.clientY},document.body.style.cursor="grabbing")}N.current&&(s({x:(re.clientX-T.current.x)/t,y:(re.clientY-T.current.y)/t}),T.current={x:re.clientX,y:re.clientY})},D=re=>{M.current=re.buttons,R.current.active=!1,N.current&&(F(!1),i?.(),document.body.style.cursor="")},$=re=>{(re.metaKey||re.ctrlKey)&&re.key==="\\"&&(re.preventDefault(),v(se=>{const ge=!se;return m?.(ge),ge}))},J=()=>{R.current.active=!1,D(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",G),window.addEventListener("mouseup",D),window.addEventListener("keydown",$),window.addEventListener("blur",J),document.addEventListener("visibilitychange",J),()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",D),window.removeEventListener("keydown",$),window.removeEventListener("blur",J),document.removeEventListener("visibilitychange",J)}},[s,i,r,t,I,Y,l,F,m]),b.useEffect(()=>{!l||!N.current||(F(!1),i?.(),document.body.style.cursor="")},[l,i,F]);const B=G=>{O.current=!1,!(l||G.button!==0)&&(I(G.target)||Y(G.target)||(M.current=G.buttons,R.current={active:!0,startX:G.clientX,startY:G.clientY},G.preventDefault()))},P=G=>{!O.current&&u&&u(G),O.current=!1},[X,ie]=b.useState({w:0,h:0});b.useEffect(()=>{const G=()=>ie({w:window.innerWidth,h:window.innerHeight});return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]);const ee=Math.max(.4,Math.min(2,t)),z=100*ee,H=20*ee,U=(X.w/2+e.x*t)%z,ne=(X.h/2+e.y*t)%z;return d.jsxs("div",{ref:C,className:`absolute inset-0 z-0 overflow-hidden bg-black ${x?"cursor-grabbing":"cursor-grab"}`,onMouseDown:B,onClick:P,children:[d.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.5*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #444 1px, transparent 1px)",backgroundSize:`${H}px ${H}px`,backgroundPosition:`${U+100}px ${ne+100}px`}}),d.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.25*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #555 1.5px, transparent 1.5px)",backgroundSize:`${z}px ${z}px`,backgroundPosition:`${U+100}px ${ne+100}px`}}),y&&d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:j,className:"absolute top-0 bottom-0 w-px pointer-events-none bg-emerald-500/10",style:{left:0}}),d.jsx("div",{ref:E,className:"absolute left-0 right-0 h-px pointer-events-none bg-emerald-500/10",style:{top:0}})]})]})};const $S=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();const u2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const d2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());const yx=e=>{const t=d2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var f2={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 h2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const p2=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:u,...f},m)=>b.createElement("svg",{ref:m,...f2,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:$S("lucide",i),...!l&&!h2(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,y])=>b.createElement(h,y)),...Array.isArray(l)?l:[l]]));const jt=(e,t)=>{const s=b.forwardRef(({className:r,...i},l)=>b.createElement(p2,{ref:l,iconNode:t,className:$S(`lucide-${u2(yx(e))}`,`lucide-${e}`,r),...i}));return s.displayName=yx(e),s};const m2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],g2=jt("chevron-down",m2);const y2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],v2=jt("chevron-right",y2);const b2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],x2=jt("circle-alert",b2);const w2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],S2=jt("clock",w2);const E2=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],N2=jt("corner-down-left",E2);const T2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vx=jt("loader-circle",T2);const j2=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],C2=jt("map",j2);const A2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],US=jt("maximize-2",A2);const R2=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],_2=jt("mic",R2);const k2=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],M2=jt("minimize-2",k2);const O2=[["path",{d:"M5 12h14",key:"1ays0h"}]],D2=jt("minus",O2);const z2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],I2=jt("panel-left-close",z2);const L2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],P2=jt("panel-left-open",L2);const $2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],U2=jt("panel-right-close",$2);const V2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],B2=jt("panel-right-open",V2);const Z2=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],H2=jt("paperclip",Z2);const F2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],q2=jt("plus",F2);const Y2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ig=jt("search",Y2);const G2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],VS=jt("sparkles",G2);const X2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],BS=jt("square",X2);const K2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ZS=jt("terminal",K2);const W2=[["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"}]],J2=jt("trash-2",W2);const Q2=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],e_=jt("volume-2",Q2);const t_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],n_=jt("volume-x",t_);const s_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],HS=jt("x",s_),a_=({scale:e,onZoom:t,min:s=.2,max:r=3,step:i=.1})=>{const[l,u]=b.useState(!1),[f,m]=b.useState(""),h=b.useRef(null),y=b.useCallback(R=>Math.min(r,Math.max(s,R)),[s,r]),v=b.useCallback(()=>{t(y(e+i))},[e,i,t,y]),x=b.useCallback(()=>{t(y(e-i))},[e,i,t,y]),w=b.useCallback(()=>{m(Math.round(e*100).toString()),u(!0)},[e]),N=b.useCallback(()=>{u(!1);const R=parseInt(f,10);!isNaN(R)&&R>0&&t(y(R/100))},[f,t,y]),T=b.useCallback(R=>{R.key==="Enter"?N():R.key==="Escape"&&u(!1)},[N]);return b.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select())},[l]),d.jsxs("div",{className:"pointer-events-auto flex flex-col items-center bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 rounded-md shadow-[0_0_20px_rgba(0,0,0,0.6)] overflow-hidden",children:[d.jsx("button",{onClick:v,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom in",children:d.jsx(q2,{size:14})}),d.jsx("div",{className:"w-full border-t border-b border-neutral-700/50",children:l?d.jsx("input",{ref:h,type:"text",value:f,onChange:R=>m(R.target.value.replace(/[^0-9]/g,"")),onBlur:N,onKeyDown:T,className:"w-9 py-1.5 text-center text-[11px] font-mono text-white bg-black/60 outline-none tabular-nums"}):d.jsxs("button",{onClick:w,className:"w-9 py-1.5 text-center text-[11px] font-mono text-neutral-200 hover:text-white hover:bg-white/10 transition-colors cursor-text tabular-nums",title:"Click to set zoom",children:[Math.round(e*100),"%"]})}),d.jsx("button",{onClick:x,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom out",children:d.jsx(D2,{size:14})})]})},r_={...LS};let bx=0;function i_(e,t="mui"){const[s,r]=b.useState(e),i=e||s;return b.useEffect(()=>{s==null&&(bx+=1,r(`${t}-${bx}`))},[s,t]),i}const xx=r_.useId;function er(e,t){if(xx!==void 0){const s=xx();return e??(t?`${t}-${s}`:s)}return i_(e,t)}function Fr(e,...t){const s=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>s.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${s} for the full message.`}const FS=b.createContext(void 0);function _d(e=!0){const t=b.useContext(FS);if(t===void 0&&!e)throw new Error(Fr(25));return t}const qS=b.createContext(void 0);function YS(e){const t=b.useContext(qS);if(t===void 0&&!e)throw new Error(Fr(33));return t}const og=b.createContext(void 0);function ro(e){const t=b.useContext(og);if(t===void 0&&!e)throw new Error(Fr(36));return t}const wx={};function ds(e,t){const s=b.useRef(wx);return s.current===wx&&(s.current=e(t)),s}function Al(e,t,s,r){const i=ds(GS).current;return l_(i,e,t,s,r)&&XS(i,[e,t,s,r]),i.callback}function o_(e){const t=ds(GS).current;return c_(t,e)&&XS(t,e),t.callback}function GS(){return{callback:null,cleanup:null,refs:[]}}function l_(e,t,s,r,i){return e.refs[0]!==t||e.refs[1]!==s||e.refs[2]!==r||e.refs[3]!==i}function c_(e,t){return e.refs.length!==t.length||e.refs.some((s,r)=>s!==t[r])}function XS(e,t){if(e.refs=t,t.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const r=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const u=l(s);typeof u=="function"&&(r[i]=u);break}case"object":{l.current=s;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const u=r[i];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}const u_=parseInt(b.version,10);function lg(e){return u_>=e}function Sx(e){if(!b.isValidElement(e))return null;const t=e,s=t.props;return(lg(19)?s?.ref:t.ref)??null}function rm(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function d_(e,t){const s={};for(const r in e){const i=e[r];if(t?.hasOwnProperty(r)){const l=t[r](i);l!=null&&Object.assign(s,l);continue}i===!0?s[`data-${r.toLowerCase()}`]="":i&&(s[`data-${r.toLowerCase()}`]=i.toString())}return s}function f_(e,t){return typeof e=="function"?e(t):e}function h_(e,t){return typeof e=="function"?e(t):e}const bl={};function kd(e,t,s,r,i){let l={...im(e,bl)};return t&&(l=Pu(l,t)),s&&(l=Pu(l,s)),r&&(l=Pu(l,r)),l}function p_(e){if(e.length===0)return bl;if(e.length===1)return im(e[0],bl);let t={...im(e[0],bl)};for(let s=1;s<e.length;s+=1)t=Pu(t,e[s]);return t}function Pu(e,t){return KS(t)?t(e):m_(e,t)}function m_(e,t){if(!t)return e;for(const s in t){const r=t[s];switch(s){case"style":{e[s]=rm(e.style,r);break}case"className":{e[s]=WS(e.className,r);break}default:g_(s,r)?e[s]=y_(e[s],r):e[s]=r}}return e}function g_(e,t){const s=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&r===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function KS(e){return typeof e=="function"}function im(e,t){return KS(e)?e(t):e??bl}function y_(e,t){return t?e?s=>{if(v_(s)){const i=s;om(i);const l=t(i);return i.baseUIHandlerPrevented||e?.(i),l}const r=t(s);return e?.(s),r}:t:e}function om(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function WS(e,t){return t?e?t+" "+e:t:e}function v_(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function JS(){}const QS=Object.freeze([]),zn=Object.freeze({}),b_=500,x_={style:{transition:"none"}},w_="data-base-ui-click-trigger",S_={fallbackAxisSide:"none"},E_={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function tr(e,t,s={}){const r=t.render,i=N_(t,s);if(s.enabled===!1)return null;const l=s.state??zn;return T_(e,r,i,l)}function N_(e,t={}){const{className:s,style:r,render:i}=e,{state:l=zn,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,y=h?f_(s,l):void 0,v=h?h_(r,l):void 0,x=h?d_(l,m):zn,w=h?rm(x,Array.isArray(f)?p_(f):f)??zn:zn;return typeof document<"u"&&(h?Array.isArray(u)?w.ref=o_([w.ref,Sx(i),...u]):w.ref=Al(w.ref,Sx(i),u):Al(null,null)),h?(y!==void 0&&(w.className=WS(w.className,y)),v!==void 0&&(w.style=rm(w.style,v)),w):zn}function T_(e,t,s,r){if(t){if(typeof t=="function")return t(s,r);const i=kd(s,t.props);return i.ref=s.ref,b.cloneElement(t,i)}return j_(e,s)}function j_(e,t){return b.createElement(e,t)}let td=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const C_={[td.startingStyle]:""},A_={[td.endingStyle]:""},R_={transitionStatus(e){return e==="starting"?C_:e==="ending"?A_:null}};let cg=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=td.startingStyle]="startingStyle",e[e.endingStyle=td.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Ex=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const __={[Ex.popupOpen]:"",[Ex.pressed]:""},k_={[cg.open]:""},M_={[cg.closed]:""},O_={[cg.anchorHidden]:""},D_={open(e){return e?__:null}},eE={open(e){return e?k_:M_},anchorHidden(e){return e?O_:null}},z_="none",nd="trigger-press",Ir="trigger-hover",Nx="trigger-focus",ug="outside-press",tE="item-press",Md="focus-out",nE="escape-key",$u="list-navigation",I_="cancel-open",hl="sibling-open",L_="imperative-action",pp=LS[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],P_=pp&&pp!==b.useLayoutEffect?pp:e=>e();function Be(e){const t=ds($_).current;return t.next=e,P_(t.effect),t.trampoline}function $_(){const e={next:void 0,callback:U_,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function U_(){}function Od(){return typeof window<"u"}function nr(e){return dg(e)?(e.nodeName||"").toLowerCase():"#document"}function un(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zs(e){var t;return(t=(dg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dg(e){return Od()?e instanceof Node||e instanceof un(e).Node:!1}function Tt(e){return Od()?e instanceof Element||e instanceof un(e).Element:!1}function Ut(e){return Od()?e instanceof HTMLElement||e instanceof un(e).HTMLElement:!1}function lm(e){return!Od()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof un(e).ShadowRoot}const V_=new Set(["inline","contents"]);function qr(e){const{overflow:t,overflowX:s,overflowY:r,display:i}=Gn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+s)&&!V_.has(i)}const B_=new Set(["table","td","th"]);function Z_(e){return B_.has(nr(e))}const H_=[":popover-open",":modal"];function Dd(e){return H_.some(t=>{try{return e.matches(t)}catch{return!1}})}const F_=["transform","translate","scale","rotate","perspective"],q_=["transform","translate","scale","rotate","perspective","filter"],Y_=["paint","layout","strict","content"];function fg(e){const t=zd(),s=Tt(e)?Gn(e):e;return F_.some(r=>s[r]?s[r]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!t&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!t&&(s.filter?s.filter!=="none":!1)||q_.some(r=>(s.willChange||"").includes(r))||Y_.some(r=>(s.contain||"").includes(r))}function G_(e){let t=Us(e);for(;Ut(t)&&!Ls(t);){if(fg(t))return t;if(Dd(t))return null;t=Us(t)}return null}function zd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const X_=new Set(["html","body","#document"]);function Ls(e){return X_.has(nr(e))}function Gn(e){return un(e).getComputedStyle(e)}function Id(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Us(e){if(nr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lm(e)&&e.host||Zs(e);return lm(t)?t.host:t}function sE(e){const t=Us(e);return Ls(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(t)&&qr(t)?t:sE(t)}function Ya(e,t,s){var r;t===void 0&&(t=[]),s===void 0&&(s=!0);const i=sE(e),l=i===((r=e.ownerDocument)==null?void 0:r.body),u=un(i);if(l){const f=cm(u);return t.concat(u,u.visualViewport||[],qr(i)?i:[],f&&s?Ya(f):[])}return t.concat(i,Ya(i,[],s))}function cm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const K_=()=>{},$e=typeof document<"u"?b.useLayoutEffect:K_,W_=b.createContext(void 0);function J_(e=!1){const t=b.useContext(W_);if(t===void 0&&!e)throw new Error(Fr(16));return t}function Q_(e){const{focusableWhenDisabled:t,disabled:s,composite:r=!1,tabIndex:i=0,isNativeButton:l}=e,u=r&&t!==!1,f=r&&t===!1;return{props:b.useMemo(()=>{const h={onKeyDown(y){s&&t&&y.key!=="Tab"&&y.preventDefault()}};return r||(h.tabIndex=i,!l&&s&&(h.tabIndex=t?i:-1)),(l&&(t||u)||!l&&s)&&(h["aria-disabled"]=s),l&&(!t||f)&&(h.disabled=s),h},[r,s,t,u,f,l,i])}}function ek(e={}){const{disabled:t=!1,focusableWhenDisabled:s,tabIndex:r=0,native:i=!0}=e,l=b.useRef(null),u=J_(!0)!==void 0,f=Be(()=>{const x=l.current;return!!(x?.tagName==="A"&&x?.href)}),{props:m}=Q_({focusableWhenDisabled:s,disabled:t,composite:u,tabIndex:r,isNativeButton:i}),h=b.useCallback(()=>{const x=l.current;tk(x)&&u&&t&&m.disabled===void 0&&x.disabled&&(x.disabled=!1)},[t,m.disabled,u]);$e(h,[h]);const y=b.useCallback((x={})=>{const{onClick:w,onMouseDown:N,onKeyUp:T,onKeyDown:R,onPointerDown:C,...j}=x;return kd({type:i?"button":void 0,onClick(_){if(t){_.preventDefault();return}w?.(_)},onMouseDown(_){t||N?.(_)},onKeyDown(_){if(t||(om(_),R?.(_)),_.baseUIHandlerPrevented)return;const A=_.target===_.currentTarget&&!i&&!f()&&!t,M=_.key==="Enter",O=_.key===" ";A&&((O||M)&&_.preventDefault(),M&&w?.(_))},onKeyUp(_){t||(om(_),T?.(_)),!_.baseUIHandlerPrevented&&_.target===_.currentTarget&&!i&&!t&&_.key===" "&&w?.(_)},onPointerDown(_){if(t){_.preventDefault();return}C?.(_)}},i?void 0:{role:"button"},m,j)},[t,m,i,f]),v=Be(x=>{l.current=x,h()});return{getButtonProps:y,buttonRef:v}}function tk(e){return Ut(e)&&e.tagName==="BUTTON"}const nk={type:"regular-item"};function sk(e){const{closeOnClick:t,disabled:s=!1,highlighted:r,id:i,store:l,nativeButton:u,itemMetadata:f,nodeId:m}=e,h=b.useRef(null),y=_d(!0),v=y!==void 0,{events:x}=l.useState("floatingTreeRoot"),{getButtonProps:w,buttonRef:N}=ek({disabled:s,focusableWhenDisabled:!0,native:u}),T=b.useCallback(C=>kd({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(j){m&&x.emit("itemhover",{nodeId:m,target:j.currentTarget})},onMouseEnter(){f.type==="submenu-trigger"&&f.setActive()},onKeyUp(j){j.key===" "&&l.context.typingRef.current&&j.preventBaseUIHandler()},onClick(j){t&&x.emit("close",{domEvent:j,reason:tE})},onMouseUp(j){if(y){const E=y.initialCursorPointRef.current;if(y.initialCursorPointRef.current=null,v&&E&&Math.abs(j.clientX-E.x)<=1&&Math.abs(j.clientY-E.y)<=1)return}h.current&&l.context.allowMouseUpTriggerRef.current&&(!v||j.button===2)&&f.type==="regular-item"&&h.current.click()}},C,w),[i,r,w,t,x,l,v,y,f,m]),R=Al(h,N);return b.useMemo(()=>({getItemProps:T,itemRef:R}),[T,R])}const aE=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ak(){return b.useContext(aE)}let rk=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ik(e={}){const{label:t,metadata:s,textRef:r,indexGuessBehavior:i,index:l}=e,{register:u,unregister:f,subscribeMapChange:m,elementsRef:h,labelsRef:y,nextIndexRef:v}=ak(),x=b.useRef(-1),[w,N]=b.useState(l??(i===rk.GuessFromOrder?()=>{if(x.current===-1){const C=v.current;v.current+=1,x.current=C}return x.current}:-1)),T=b.useRef(null),R=b.useCallback(C=>{if(T.current=C,w!==-1&&C!==null&&(h.current[w]=C,y)){const j=t!==void 0;y.current[w]=j?t:r?.current?.textContent??C.textContent}},[w,h,y,t,r]);return $e(()=>{if(l!=null)return;const C=T.current;if(C)return u(C,s),()=>{f(C)}},[l,u,f,s]),$e(()=>{if(l==null)return m(C=>{const j=T.current?C.get(T.current)?.index:null;j!=null&&N(j)})},[l,m,N]),b.useMemo(()=>({ref:R,index:w}),[w,R])}function rE(e){return er(e,"base-ui")}function qt(e,t,s,r){let i=!1,l=!1;const u=zn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:s,...u}}var $r=PS();const ok=[];function iE(e){b.useEffect(e,ok)}const pu=null;class lk{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const s=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<s.length;i+=1)s[i]?.(t)};request(t){const s=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(t){const s=t-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const mu=new lk;class zs{static create(){return new zs}static request(t){return mu.request(t)}static cancel(t){return mu.cancel(t)}currentId=pu;request(t){this.cancel(),this.currentId=mu.request(()=>{this.currentId=pu,t()})}cancel=()=>{this.currentId!==pu&&(mu.cancel(this.currentId),this.currentId=pu)};disposeEffect=()=>this.cancel}function hg(){const e=ds(zs.create).current;return iE(e.disposeEffect),e}function ck(e,t=!1,s=!1){const[r,i]=b.useState(e&&t?"idle":void 0),[l,u]=b.useState(e);return e&&!l&&(u(!0),i("starting")),!e&&l&&r!=="ending"&&!s&&i("ending"),!e&&!l&&r==="ending"&&i(void 0),$e(()=>{if(!e&&l&&r!=="ending"&&s){const f=zs.request(()=>{i("ending")});return()=>{zs.cancel(f)}}},[e,l,r,s]),$e(()=>{if(!e||t)return;const f=zs.request(()=>{$r.flushSync(()=>{i(void 0)})});return()=>{zs.cancel(f)}},[t,e]),$e(()=>{if(!e||!t)return;e&&l&&r!=="idle"&&i("starting");const f=zs.request(()=>{i("idle")});return()=>{zs.cancel(f)}},[t,e,l,i,r]),b.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:r}),[l,r])}function On(e){const t=ds(uk,e).current;return t.next=e,$e(t.effect),t}function uk(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function _r(e){return e==null?e:"current"in e?e.current:e}function dk(e,t=!1,s=!0){const r=hg();return Be((i,l=null)=>{r.cancel();const u=_r(e);u!=null&&(typeof u.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function f(){u&&Promise.all(u.getAnimations().map(m=>m.finished)).then(()=>{l!=null&&l.aborted||$r.flushSync(i)}).catch(()=>{if(s){if(l!=null&&l.aborted)return;$r.flushSync(i)}else u.getAnimations().length>0&&u.getAnimations().some(m=>m.pending||m.playState!=="finished")&&f()})}t?r.request(f):f()}))})}function oE(e){const{enabled:t=!0,open:s,ref:r,onComplete:i}=e,l=On(s),u=Be(i),f=dk(r,s);b.useEffect(()=>{t&&f(()=>{s===l.current&&u()})},[t,s,u,f,l])}const lE=b.createContext(void 0);function fk(){const e=b.useContext(lE);if(e===void 0)throw new Error(Fr(31));return e}const hk=b.forwardRef(function(t,s){const{render:r,className:i,...l}=t,[u,f]=b.useState(void 0),m=b.useMemo(()=>({setLabelId:f}),[f]),h=tr("div",t,{ref:s,props:{role:"group","aria-labelledby":u,...l}});return d.jsx(lE.Provider,{value:m,children:h})}),pk=b.forwardRef(function(t,s){const{className:r,render:i,id:l,...u}=t,f=rE(l),{setLabelId:m}=fk();return $e(()=>(m(f),()=>{m(void 0)}),[m,f]),tr("div",t,{ref:s,props:{id:f,role:"presentation",...u}})}),mk=b.forwardRef(function(t,s){const{render:r,className:i,id:l,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!0,...y}=t,v=ik({label:u}),x=YS(!0),w=rE(l),{store:N}=ro(),T=N.useState("isActive",v.index),R=N.useState("itemProps"),{getItemProps:C,itemRef:j}=sk({closeOnClick:h,disabled:m,highlighted:T,id:w,store:N,nativeButton:f,nodeId:x?.nodeId,itemMetadata:nk}),E=b.useMemo(()=>({disabled:m,highlighted:T}),[m,T]);return tr("div",t,{state:E,props:[R,y,C],ref:[j,s,v.ref]})}),ul=0;class Wi{static create(){return new Wi}currentId=ul;start(t,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ul,s()},t)}isStarted(){return this.currentId!==ul}clear=()=>{this.currentId!==ul&&(clearTimeout(this.currentId),this.currentId=ul)};disposeEffect=()=>this.clear}function Ns(){const e=ds(Wi.create).current;return iE(e.disposeEffect),e}const io=typeof navigator<"u",mp=xk(),cE=Sk(),uE=wk(),gk=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),yk=mp.platform==="MacIntel"&&mp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(mp.platform),vk=io&&/apple/i.test(navigator.vendor),um=io&&/android/i.test(cE)||/android/i.test(uE);io&&cE.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const bk=uE.includes("jsdom/");function xk(){if(!io)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function wk(){if(!io)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:s})=>`${t}/${s}`).join(" "):navigator.userAgent}function Sk(){if(!io)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const dm="data-base-ui-focusable",dE="active",fE="selected",hE="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Ga="ArrowLeft",Xa="ArrowRight",pg="ArrowUp",Bl="ArrowDown";function Ha(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Nt(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&lm(s)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Dn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function gs(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const s=e;return s.target!=null&&t.contains(s.target)}function Ek(e){return e.matches("html,body")}function ln(e){return e?.ownerDocument||document}function Nk(e){return Ut(e)&&e.matches(hE)}function fm(e){return e?e.getAttribute("role")==="combobox"&&Nk(e):!1}function sd(e){return e?e.hasAttribute(dm)?e:e.querySelector(`[${dm}]`)||e:null}function qi(e,t,s=!0){return e.filter(i=>i.parentId===t&&(!s||i.context?.open)).flatMap(i=>[i,...qi(e,i.id,s)])}function Tx(e,t){let s=[],r=e.find(i=>i.id===t)?.parentId;for(;r;){const i=e.find(l=>l.id===r);r=i?.parentId,i&&(s=s.concat(i))}return s}function cn(e){e.preventDefault(),e.stopPropagation()}function Tk(e){return"nativeEvent"in e}function pE(e){return e.mozInputSource===0&&e.isTrusted?!0:um&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function mE(e){return bk?!1:!um&&e.width===0&&e.height===0||um&&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 jk(e,t){const s=["mouse","pen"];return s.push("",void 0),s.includes(e)}function Ck(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Ak=["top","right","bottom","left"],Ji=Math.min,Fn=Math.max,ad=Math.round,Pi=Math.floor,Ps=e=>({x:e,y:e}),Rk={left:"right",right:"left",bottom:"top",top:"bottom"},_k={start:"end",end:"start"};function hm(e,t,s){return Fn(e,Ji(t,s))}function fa(e,t){return typeof e=="function"?e(t):e}function qn(e){return e.split("-")[0]}function sr(e){return e.split("-")[1]}function mg(e){return e==="x"?"y":"x"}function gg(e){return e==="y"?"height":"width"}const kk=new Set(["top","bottom"]);function ls(e){return kk.has(qn(e))?"y":"x"}function yg(e){return mg(ls(e))}function Mk(e,t,s){s===void 0&&(s=!1);const r=sr(e),i=yg(e),l=gg(i);let u=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=rd(u)),[u,rd(u)]}function Ok(e){const t=rd(e);return[pm(e),t,pm(t)]}function pm(e){return e.replace(/start|end/g,t=>_k[t])}const jx=["left","right"],Cx=["right","left"],Dk=["top","bottom"],zk=["bottom","top"];function Ik(e,t,s){switch(e){case"top":case"bottom":return s?t?Cx:jx:t?jx:Cx;case"left":case"right":return t?Dk:zk;default:return[]}}function Lk(e,t,s,r){const i=sr(e);let l=Ik(qn(e),s==="start",r);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(pm)))),l}function rd(e){return e.replace(/left|right|bottom|top/g,t=>Rk[t])}function Pk(e){return{top:0,right:0,bottom:0,left:0,...e}}function gE(e){return typeof e!="number"?Pk(e):{top:e,right:e,bottom:e,left:e}}function id(e){const{x:t,y:s,width:r,height:i}=e;return{width:r,height:i,top:s,left:t,right:t+r,bottom:s+i,x:t,y:s}}function gu(e,t,s){return Math.floor(e/t)!==s}function xl(e,t){return t<0||t>=e.current.length}function gp(e,t){return fn(e,{disabledIndices:t})}function Ax(e,t){return fn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function fn(e,{startingIndex:t=-1,decrement:s=!1,disabledIndices:r,amount:i=1}={}){let l=t;do l+=s?-i:i;while(l>=0&&l<=e.current.length-1&&wl(e,l,r));return l}function $k(e,{event:t,orientation:s,loopFocus:r,rtl:i,cols:l,disabledIndices:u,minIndex:f,maxIndex:m,prevIndex:h,stopEvent:y=!1}){let v=h;const x=[],w={};let N=!1;{let C=null,j=-1;e.current.forEach((E,_)=>{if(E==null)return;const A=E.closest('[role="row"]');A&&(N=!0),(A!==C||j===-1)&&(C=A,j+=1,x[j]=[]),x[j].push(_),w[_]=j})}const T=N&&x.length>0&&x.some(C=>C.length!==l);function R(C){if(!T||h===-1)return;const j=w[h];if(j==null)return;const E=x[j].indexOf(h);let _=C==="up"?j-1:j+1;r&&(_<0?_=x.length-1:_>=x.length&&(_=0));const A=new Set;for(;_>=0&&_<x.length&&!A.has(_);){A.add(_);const M=x[_];if(M.length===0){_=C==="up"?_-1:_+1;continue}const O=Math.min(E,M.length-1);for(let I=O;I>=0;I-=1){const Y=M[I];if(!wl(e,Y,u))return Y}_=C==="up"?_-1:_+1,r&&(_<0?_=x.length-1:_>=x.length&&(_=0))}}if(t.key===pg){const C=R("up");if(C!==void 0)y&&cn(t),v=C;else{if(y&&cn(t),h===-1)v=m;else if(v=fn(e,{startingIndex:v,amount:l,decrement:!0,disabledIndices:u}),r&&(h-l<f||v<0)){const j=h%l,E=m%l,_=m-(E-j);E===j?v=m:v=E>j?_:_-l}xl(e,v)&&(v=h)}}if(t.key===Bl){const C=R("down");C!==void 0?(y&&cn(t),v=C):(y&&cn(t),h===-1?v=f:(v=fn(e,{startingIndex:h,amount:l,disabledIndices:u}),r&&h+l>m&&(v=fn(e,{startingIndex:h%l-l,amount:l,disabledIndices:u}))),xl(e,v)&&(v=h))}if(s==="both"){const C=Pi(h/l);t.key===(i?Ga:Xa)&&(y&&cn(t),h%l!==l-1?(v=fn(e,{startingIndex:h,disabledIndices:u}),r&&gu(v,l,C)&&(v=fn(e,{startingIndex:h-h%l-1,disabledIndices:u}))):r&&(v=fn(e,{startingIndex:h-h%l-1,disabledIndices:u})),gu(v,l,C)&&(v=h)),t.key===(i?Xa:Ga)&&(y&&cn(t),h%l!==0?(v=fn(e,{startingIndex:h,decrement:!0,disabledIndices:u}),r&&gu(v,l,C)&&(v=fn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u}))):r&&(v=fn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u})),gu(v,l,C)&&(v=h));const j=Pi(m/l)===C;xl(e,v)&&(r&&j?v=t.key===(i?Xa:Ga)?m:fn(e,{startingIndex:h-h%l-1,disabledIndices:u}):v=h)}return v}function Uk(e,t,s){const r=[];let i=0;return e.forEach(({width:l,height:u},f)=>{let m=!1;for(s&&(i=0);!m;){const h=[];for(let y=0;y<l;y+=1)for(let v=0;v<u;v+=1)h.push(i+y+v*t);i%t+l<=t&&h.every(y=>r[y]==null)?(h.forEach(y=>{r[y]=f}),m=!0):i+=1}}),[...r]}function Vk(e,t,s,r,i){if(e===-1)return-1;const l=s.indexOf(e),u=t[e];switch(i){case"tl":return l;case"tr":return u?l+u.width-1:l;case"bl":return u?l+(u.height-1)*r:l;case"br":return s.lastIndexOf(e);default:return-1}}function Bk(e,t){return t.flatMap((s,r)=>e.includes(s)?[r]:[])}function wl(e,t,s){if(typeof s=="function")return s(t);if(s)return s.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var Zk=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],od=Zk.join(","),yE=typeof Element>"u",Qi=yE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ld=!yE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},cd=function(t,s){var r;s===void 0&&(s=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),l=i===""||i==="true",u=l||s&&t&&(typeof t.closest=="function"?t.closest("[inert]"):cd(t.parentNode));return u},Hk=function(t){var s,r=t==null||(s=t.getAttribute)===null||s===void 0?void 0:s.call(t,"contenteditable");return r===""||r==="true"},vE=function(t,s,r){if(cd(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(od));return s&&Qi.call(t,od)&&i.unshift(t),i=i.filter(r),i},ud=function(t,s,r){for(var i=[],l=Array.from(t);l.length;){var u=l.shift();if(!cd(u,!1))if(u.tagName==="SLOT"){var f=u.assignedElements(),m=f.length?f:u.children,h=ud(m,!0,r);r.flatten?i.push.apply(i,h):i.push({scopeParent:u,candidates:h})}else{var y=Qi.call(u,od);y&&r.filter(u)&&(s||!t.includes(u))&&i.push(u);var v=u.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(u),x=!cd(v,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(u));if(v&&x){var w=ud(v===!0?u.children:v.children,!0,r);r.flatten?i.push.apply(i,w):i.push({scopeParent:u,candidates:w})}else l.unshift.apply(l,u.children)}}return i},bE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},xE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Hk(t))&&!bE(t)?0:t.tabIndex},Fk=function(t,s){var r=xE(t);return r<0&&s&&!bE(t)?0:r},qk=function(t,s){return t.tabIndex===s.tabIndex?t.documentOrder-s.documentOrder:t.tabIndex-s.tabIndex},wE=function(t){return t.tagName==="INPUT"},Yk=function(t){return wE(t)&&t.type==="hidden"},Gk=function(t){var s=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return s},Xk=function(t,s){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===s)return t[r]},Kk=function(t){if(!t.name)return!0;var s=t.form||ld(t),r=function(f){return s.querySelectorAll('input[type="radio"][name="'+f+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(u){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",u.message),!1}var l=Xk(i,t.form);return!l||l===t},Wk=function(t){return wE(t)&&t.type==="radio"},Jk=function(t){return Wk(t)&&!Kk(t)},Qk=function(t){var s,r=t&&ld(t),i=(s=r)===null||s===void 0?void 0:s.host,l=!1;if(r&&r!==t){var u,f,m;for(l=!!((u=i)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(i)||t!=null&&(m=t.ownerDocument)!==null&&m!==void 0&&m.contains(t));!l&&i;){var h,y,v;r=ld(i),i=(h=r)===null||h===void 0?void 0:h.host,l=!!((y=i)!==null&&y!==void 0&&(v=y.ownerDocument)!==null&&v!==void 0&&v.contains(i))}}return l},Rx=function(t){var s=t.getBoundingClientRect(),r=s.width,i=s.height;return r===0&&i===0},eM=function(t,s){var r=s.displayCheck,i=s.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var l=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!l}if(getComputedStyle(t).visibility==="hidden")return!0;var u=Qi.call(t,"details>summary:first-of-type"),f=u?t.parentElement:t;if(Qi.call(f,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var m=t;t;){var h=t.parentElement,y=ld(t);if(h&&!h.shadowRoot&&i(h)===!0)return Rx(t);t.assignedSlot?t=t.assignedSlot:!h&&y!==t.ownerDocument?t=y.host:t=h}t=m}if(Qk(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Rx(t);return!1},tM=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var s=t.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var r=0;r<s.children.length;r++){var i=s.children.item(r);if(i.tagName==="LEGEND")return Qi.call(s,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}s=s.parentElement}return!1},mm=function(t,s){return!(s.disabled||Yk(s)||eM(s,t)||Gk(s)||tM(s))},gm=function(t,s){return!(Jk(s)||xE(s)<0||!mm(t,s))},nM=function(t){var s=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},SE=function(t){var s=[],r=[];return t.forEach(function(i,l){var u=!!i.scopeParent,f=u?i.scopeParent:i,m=Fk(f,u),h=u?SE(i.candidates):f;m===0?u?s.push.apply(s,h):s.push(f):r.push({documentOrder:l,tabIndex:m,item:i,isScope:u,content:h})}),r.sort(qk).reduce(function(i,l){return l.isScope?i.push.apply(i,l.content):i.push(l.content),i},[]).concat(s)},Ld=function(t,s){s=s||{};var r;return s.getShadowRoot?r=ud([t],s.includeContainer,{filter:gm.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:nM}):r=vE(t,s.includeContainer,gm.bind(null,s)),SE(r)},sM=function(t,s){s=s||{};var r;return s.getShadowRoot?r=ud([t],s.includeContainer,{filter:mm.bind(null,s),flatten:!0,getShadowRoot:s.getShadowRoot}):r=vE(t,s.includeContainer,mm.bind(null,s)),r},EE=function(t,s){if(s=s||{},!t)throw new Error("No node provided");return Qi.call(t,od)===!1?!1:gm(s,t)};const Zl=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function NE(e,t){const s=Ld(e,Zl()),r=s.length;if(r===0)return;const i=Ha(ln(e)),l=s.indexOf(i),u=l===-1?t===1?0:r-1:l+t;return s[u]}function TE(e){return NE(ln(e).body,1)||e}function jE(e){return NE(ln(e).body,-1)||e}function Sl(e,t){const s=t||e.currentTarget,r=e.relatedTarget;return!r||!Nt(s,r)}function aM(e){Ld(e,Zl()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function _x(e){e.querySelectorAll("[data-tabindex]").forEach(s=>{const r=s.dataset.tabindex;delete s.dataset.tabindex,r?s.setAttribute("tabindex",r):s.removeAttribute("tabindex")})}function CE(){const e=new Map;return{emit(t,s){e.get(t)?.forEach(r=>r(s))},on(t,s){e.has(t)||e.set(t,new Set),e.get(t).add(s)},off(t,s){e.get(t)?.delete(s)}}}class AE{nodesRef={current:[]};events=CE();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const s=this.nodesRef.current.findIndex(r=>r===t);s!==-1&&this.nodesRef.current.splice(s,1)}}const RE=b.createContext(null),_E=b.createContext(null),ar=()=>b.useContext(RE)?.id||null,oo=e=>{const t=b.useContext(_E);return e??t};function rM(e){const t=er(),s=oo(e),r=ar();return $e(()=>{if(!t)return;const i={id:t,parentId:r};return s?.addNode(i),()=>{s?.removeNode(i)}},[s,t,r]),t}function iM(e){const{children:t,id:s}=e,r=ar();return d.jsx(RE.Provider,{value:b.useMemo(()=>({id:s,parentId:r}),[s,r]),children:t})}function oM(e){const{children:t,externalTree:s}=e,r=ds(()=>s??new AE).current;return d.jsx(_E.Provider,{value:r,children:t})}function Rl(e){return`data-base-ui-${e}`}const kE={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function Ur(e){return e?.ownerDocument||document}const dd=b.forwardRef(function(t,s){const[r,i]=b.useState();$e(()=>{vk&&i("button")},[]);const l={tabIndex:0,role:r};return d.jsx("span",{...t,ref:s,style:kE,"aria-hidden":r?void 0:!0,...l,"data-base-ui-focus-guard":""})});let kx=0;function Uu(e,t={}){const{preventScroll:s=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(kx);const l=()=>e?.focus({preventScroll:s});i?l():kx=requestAnimationFrame(l)}const Yi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Mx(e){return e==="inert"?Yi.inert:e==="aria-hidden"?Yi["aria-hidden"]:Yi.none}let yu=new WeakSet,vu={},yp=0;const ME=e=>e&&(e.host||ME(e.parentNode)),lM=(e,t)=>t.map(s=>{if(e.contains(s))return s;const r=ME(s);return e.contains(r)?r:null}).filter(s=>s!=null);function cM(e,t,s,r){const i="data-base-ui-inert",l=r?"inert":s?"aria-hidden":null,u=lM(t,e),f=new Set,m=new Set(u),h=[];vu[i]||(vu[i]=new WeakMap);const y=vu[i];u.forEach(v),x(t),f.clear();function v(w){!w||f.has(w)||(f.add(w),w.parentNode&&v(w.parentNode))}function x(w){!w||m.has(w)||[].forEach.call(w.children,N=>{if(nr(N)!=="script")if(f.has(N))x(N);else{const T=l?N.getAttribute(l):null,R=T!==null&&T!=="false",C=Mx(l),j=(C.get(N)||0)+1,E=(y.get(N)||0)+1;C.set(N,j),y.set(N,E),h.push(N),j===1&&R&&yu.add(N),E===1&&N.setAttribute(i,""),!R&&l&&N.setAttribute(l,l==="inert"?"":"true")}})}return yp+=1,()=>{h.forEach(w=>{const N=Mx(l),R=(N.get(w)||0)-1,C=(y.get(w)||0)-1;N.set(w,R),y.set(w,C),R||(!yu.has(w)&&l&&w.removeAttribute(l),yu.delete(w)),C||w.removeAttribute(i)}),yp-=1,yp||(Yi.inert=new WeakMap,Yi["aria-hidden"]=new WeakMap,Yi.none=new WeakMap,yu=new WeakSet,vu={})}}function uM(e,t=!1,s=!1){const r=ln(e[0]).body;return cM(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,s)}const OE=b.createContext(null),DE=()=>b.useContext(OE),dM=Rl("portal");function fM(e={}){const{ref:t,container:s,componentProps:r=zn,elementProps:i,elementState:l}=e,u=er(),m=DE()?.portalNode,[h,y]=b.useState(null),[v,x]=b.useState(null),w=b.useRef(null);$e(()=>{if(s===null){w.current&&(w.current=null,x(null),y(null));return}if(u==null)return;const R=(s&&(dg(s)?s:s.current))??m??document.body;if(R==null){w.current&&(w.current=null,x(null),y(null));return}w.current!==R&&(w.current=R,x(null),y(R))},[s,m,u]);const N=tr("div",r,{ref:[t,x],state:l,props:[{id:u,[dM]:""},i]});return{portalNode:v,portalSubtree:h&&N?$r.createPortal(N,h):null}}const hM=b.forwardRef(function(t,s){const{children:r,container:i,className:l,render:u,renderGuards:f,...m}=t,{portalNode:h,portalSubtree:y}=fM({container:i,ref:s,componentProps:t,elementProps:m}),v=b.useRef(null),x=b.useRef(null),w=b.useRef(null),N=b.useRef(null),[T,R]=b.useState(null),C=T?.modal,j=T?.open,E=typeof f=="boolean"?f:!!T&&!T.modal&&T.open&&!!h;b.useEffect(()=>{if(!h||C)return;function A(M){h&&Sl(M)&&(M.type==="focusin"?_x:aM)(h)}return h.addEventListener("focusin",A,!0),h.addEventListener("focusout",A,!0),()=>{h.removeEventListener("focusin",A,!0),h.removeEventListener("focusout",A,!0)}},[h,C]),b.useEffect(()=>{!h||j||_x(h)},[j,h]);const _=b.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:x,beforeInsideRef:w,afterInsideRef:N,portalNode:h,setFocusManagerState:R}),[h]);return d.jsxs(b.Fragment,{children:[y,d.jsxs(OE.Provider,{value:_,children:[E&&h&&d.jsx(dd,{"data-type":"outside",ref:v,onFocus:A=>{if(Sl(A,h))w.current?.focus();else{const M=T?T.domReference:null;jE(M)?.focus()}}}),E&&h&&d.jsx("span",{"aria-owns":h.id,style:E_}),h&&$r.createPortal(r,h),E&&h&&d.jsx(dd,{"data-type":"outside",ref:x,onFocus:A=>{if(Sl(A,h))N.current?.focus();else{const M=T?T.domReference:null;TE(M)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,qt(Md,A.nativeEvent))}}})]})]})});function pM(e,t){const s=un(e.target);return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Ox=20;let Fa=[];function vg(){Fa=Fa.filter(e=>e.isConnected)}function mM(e){vg(),e&&nr(e)!=="body"&&(Fa.push(e),Fa.length>Ox&&(Fa=Fa.slice(-Ox)))}function vp(){return vg(),Fa[Fa.length-1]}function gM(e){if(!e)return null;const t=Zl();return EE(e,t)?e:Ld(e,t)[0]||e}function yM(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Gn(e).display!=="none"}function Dx(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const s=Zl(),i=sM(e,s).filter(u=>{const f=u.getAttribute("data-tabindex")||"";return EE(u,s)||u.hasAttribute("data-tabindex")&&!f.startsWith("-")}),l=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function vM(e){const{context:t,children:s,disabled:r=!1,order:i=["content"],initialFocus:l=!0,returnFocus:u=!0,restoreFocus:f=!1,modal:m=!0,closeOnFocusOut:h=!0,openInteractionType:y="",getInsideElements:v=()=>[],nextFocusableElement:x,previousFocusableElement:w,beforeContentFocusGuardRef:N,externalTree:T}=e,R="rootStore"in t?t.rootStore:t,C=R.useState("open"),j=R.useState("domReferenceElement"),E=R.useState("floatingElement"),{events:_,dataRef:A}=R.context,M=Be(()=>A.current.floatingContext?.nodeId),O=Be(v),I=l===!1,Y=fm(j)&&I,F=On(i),B=On(l),P=On(u),X=On(y),ie=oo(T),ee=DE(),z=b.useRef(null),H=b.useRef(null),U=b.useRef(!1),ne=b.useRef(!1),G=b.useRef(!1),D=b.useRef(-1),$=b.useRef(""),J=b.useRef(""),re=Ns(),se=Ns(),ge=hg(),he=ee!=null,pe=sd(E),be=Be((xe=pe)=>xe?Ld(xe,Zl()):[]),Ce=Be(xe=>{const Se=be(xe);return F.current.map(()=>Se).filter(Boolean).flat()});b.useEffect(()=>{if(r||!m)return;function xe(Ue){Ue.key==="Tab"&&Nt(pe,Ha(ln(pe)))&&be().length===0&&!Y&&cn(Ue)}const Se=ln(pe);return Se.addEventListener("keydown",xe),()=>{Se.removeEventListener("keydown",xe)}},[r,j,pe,m,F,Y,be,Ce]),b.useEffect(()=>{if(r||!E)return;function xe(Se){const Ue=Dn(Se),Ze=be().indexOf(Ue);Ze!==-1&&(D.current=Ze)}return E.addEventListener("focusin",xe),()=>{E.removeEventListener("focusin",xe)}},[r,E,be]),b.useEffect(()=>{if(r||!C)return;const xe=ln(pe);function Se(){G.current=!1}function Ue(Ze){const Z=Dn(Ze),te=Nt(E,Z)||Nt(j,Z)||Nt(ee?.portalNode,Z);G.current=!te,J.current=Ze.pointerType||"keyboard"}function Le(){J.current="keyboard"}return xe.addEventListener("pointerdown",Ue,!0),xe.addEventListener("pointerup",Se,!0),xe.addEventListener("pointercancel",Se,!0),xe.addEventListener("keydown",Le,!0),()=>{xe.removeEventListener("pointerdown",Ue,!0),xe.removeEventListener("pointerup",Se,!0),xe.removeEventListener("pointercancel",Se,!0),xe.removeEventListener("keydown",Le,!0)}},[r,E,j,pe,C,ee]),b.useEffect(()=>{if(r||!h)return;function xe(){ne.current=!0,se.start(0,()=>{ne.current=!1})}function Se(Z){const te=Z.relatedTarget,de=Z.currentTarget,me=Dn(Z);queueMicrotask(()=>{const ye=M(),Ae=R.context.triggerElements,Ie=!(Nt(j,te)||Nt(E,te)||Nt(te,E)||Nt(ee?.portalNode,te)||te!=null&&Ae.hasElement(te)||Ae.hasMatchingElement(Me=>Nt(Me,te))||te?.hasAttribute(Rl("focus-guard"))||ie&&(qi(ie.nodesRef.current,ye).find(Me=>Nt(Me.context?.elements.floating,te)||Nt(Me.context?.elements.domReference,te))||Tx(ie.nodesRef.current,ye).find(Me=>[Me.context?.elements.floating,sd(Me.context?.elements.floating)].includes(te)||Me.context?.elements.domReference===te)));if(de===j&&pe&&Dx(pe,F),f&&de!==j&&!yM(me)&&Ha(ln(pe))===ln(pe).body){if(Ut(pe)&&(pe.focus(),f==="popup")){ge.request(()=>{pe.focus()});return}const Me=D.current,tt=be(),Ot=tt[Me]||tt[tt.length-1]||pe;Ut(Ot)&&Ot.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(Y||!m)&&te&&Ie&&!ne.current&&(Y||te!==vp())&&(U.current=!0,R.setOpen(!1,qt(Md,Z)))})}function Ue(){G.current||(A.current.insideReactTree=!0,re.start(0,()=>{A.current.insideReactTree=!1}))}const Le=Ut(j)?j:null,Ze=[];if(!(!E&&!Le))return Le&&(Le.addEventListener("focusout",Se),Le.addEventListener("pointerdown",xe),Ze.push(()=>{Le.removeEventListener("focusout",Se),Le.removeEventListener("pointerdown",xe)})),E&&(E.addEventListener("focusout",Se),ee&&(E.addEventListener("focusout",Ue,!0),Ze.push(()=>{E.removeEventListener("focusout",Ue,!0)})),Ze.push(()=>{E.removeEventListener("focusout",Se)})),()=>{Ze.forEach(Z=>{Z()})}},[r,j,E,pe,m,ie,ee,R,h,f,be,Y,M,F,A,re,se,ge]);const fe=b.useRef(null),Re=b.useRef(null),we=Al(fe,N,ee?.beforeInsideRef),Pe=Al(Re,ee?.afterInsideRef);b.useEffect(()=>{if(r||!E||!C)return;const xe=Array.from(ee?.portalNode?.querySelectorAll(`[${Rl("portal")}]`)||[]),Ue=(ie?Tx(ie.nodesRef.current,M()):[]).find(Z=>fm(Z.context?.elements.domReference||null))?.context?.elements.domReference,Le=[E,Ue,...xe,...O(),z.current,H.current,fe.current,Re.current,ee?.beforeOutsideRef.current,ee?.afterOutsideRef.current,_r(w),_r(x),Y?j:null].filter(Z=>Z!=null),Ze=uM(Le,m||Y);return()=>{Ze()}},[C,r,j,E,m,F,ee,Y,ie,M,O,x,w]),$e(()=>{if(!C||r||!Ut(pe))return;const xe=ln(pe),Se=Ha(xe);queueMicrotask(()=>{const Ue=Ce(pe),Le=B.current,Ze=typeof Le=="function"?Le(X.current||""):Le;if(Ze===void 0||Ze===!1)return;let Z;Ze===!0||Ze===null?Z=Ue[0]||pe:Z=_r(Ze),Z=Z||Ue[0]||pe,!Nt(pe,Se)&&Uu(Z,{preventScroll:Z===pe})})},[r,C,pe,I,Ce,B,X]),$e(()=>{if(r||!pe)return;const xe=ln(pe),Se=Ha(xe);mM(Se);function Ue(Z){if(Z.open||($.current=pM(Z.nativeEvent,J.current)),Z.reason===Ir&&Z.nativeEvent.type==="mouseleave"&&(U.current=!0),Z.reason===ug)if(Z.nested)U.current=!1;else if(pE(Z.nativeEvent)||mE(Z.nativeEvent))U.current=!1;else{let te=!1;document.createElement("div").focus({get preventScroll(){return te=!0,!1}}),te?U.current=!1:U.current=!0}}_.on("openchange",Ue);const Le=xe.createElement("span");Le.setAttribute("tabindex","-1"),Le.setAttribute("aria-hidden","true"),Object.assign(Le.style,kE),he&&j&&j.insertAdjacentElement("afterend",Le);function Ze(){const Z=P.current;let te=typeof Z=="function"?Z($.current):Z;if(te===void 0||te===!1)return null;if(te===null&&(te=!0),typeof te=="boolean"){const me=j||vp();return me&&me.isConnected?me:Le}const de=j||vp()||Le;return _r(te)||de}return()=>{_.off("openchange",Ue);const Z=Ha(xe),te=Nt(E,Z)||ie&&qi(ie.nodesRef.current,M(),!1).some(me=>Nt(me.context?.elements.floating,Z)),de=Ze();queueMicrotask(()=>{const me=gM(de),ye=typeof P.current!="boolean";P.current&&!U.current&&Ut(me)&&(!(!ye&&me!==Z&&Z!==xe.body)||te)&&me.focus({preventScroll:!0}),Le.remove()})}},[r,E,pe,P,A,_,ie,he,j,M]),b.useEffect(()=>{queueMicrotask(()=>{U.current=!1})},[r]),b.useEffect(()=>{if(r||!C)return;function xe(Ue){Dn(Ue)?.closest(`[${w_}]`)&&(ne.current=!0)}const Se=ln(pe);return Se.addEventListener("pointerdown",xe,!0),()=>{Se.removeEventListener("pointerdown",xe,!0)}},[r,C,pe]),$e(()=>{if(!r&&ee)return ee.setFocusManagerState({modal:m,closeOnFocusOut:h,open:C,onOpenChange:R.setOpen,domReference:j}),()=>{ee.setFocusManagerState(null)}},[r,ee,m,C,R,h,j]),$e(()=>{if(!(r||!pe))return Dx(pe,F),()=>{queueMicrotask(vg)}},[r,pe,F]);const _e=!r&&(m?!Y:!0)&&(he||m);return d.jsxs(b.Fragment,{children:[_e&&d.jsx(dd,{"data-type":"inside",ref:we,onFocus:xe=>{if(m){const Se=Ce();Uu(Se[Se.length-1])}else ee?.portalNode&&(U.current=!1,Sl(xe,ee.portalNode)?TE(j)?.focus():_r(w??ee.beforeOutsideRef)?.focus())}}),s,_e&&d.jsx(dd,{"data-type":"inside",ref:Pe,onFocus:xe=>{m?Uu(Ce()[0]):ee?.portalNode&&(h&&(U.current=!0),Sl(xe,ee.portalNode)?jE(j)?.focus():_r(x??ee.afterOutsideRef)?.focus())}})]})}function zx(e,t,s){let{reference:r,floating:i}=e;const l=ls(t),u=yg(t),f=gg(u),m=qn(t),h=l==="y",y=r.x+r.width/2-i.width/2,v=r.y+r.height/2-i.height/2,x=r[f]/2-i[f]/2;let w;switch(m){case"top":w={x:y,y:r.y-i.height};break;case"bottom":w={x:y,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:v};break;case"left":w={x:r.x-i.width,y:v};break;default:w={x:r.x,y:r.y}}switch(sr(t)){case"start":w[u]-=x*(s&&h?-1:1);break;case"end":w[u]+=x*(s&&h?-1:1);break}return w}async function bM(e,t){var s;t===void 0&&(t={});const{x:r,y:i,platform:l,rects:u,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:x=!1,padding:w=0}=fa(t,e),N=gE(w),R=f[x?v==="floating"?"reference":"floating":v],C=id(await l.getClippingRect({element:(s=await(l.isElement==null?void 0:l.isElement(R)))==null||s?R:R.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:h,rootBoundary:y,strategy:m})),j=v==="floating"?{x:r,y:i,width:u.floating.width,height:u.floating.height}:u.reference,E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),_=await(l.isElement==null?void 0:l.isElement(E))?await(l.getScale==null?void 0:l.getScale(E))||{x:1,y:1}:{x:1,y:1},A=id(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:j,offsetParent:E,strategy:m}):j);return{top:(C.top-A.top+N.top)/_.y,bottom:(A.bottom-C.bottom+N.bottom)/_.y,left:(C.left-A.left+N.left)/_.x,right:(A.right-C.right+N.right)/_.x}}const xM=async(e,t,s)=>{const{placement:r="bottom",strategy:i="absolute",middleware:l=[],platform:u}=s,f=l.filter(Boolean),m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:y,y:v}=zx(h,r,m),x=r,w={},N=0;for(let R=0;R<f.length;R++){var T;const{name:C,fn:j}=f[R],{x:E,y:_,data:A,reset:M}=await j({x:y,y:v,initialPlacement:r,placement:x,strategy:i,middlewareData:w,rects:h,platform:{...u,detectOverflow:(T=u.detectOverflow)!=null?T:bM},elements:{reference:e,floating:t}});y=E??y,v=_??v,w={...w,[C]:{...w[C],...A}},M&&N<=50&&(N++,typeof M=="object"&&(M.placement&&(x=M.placement),M.rects&&(h=M.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):M.rects),{x:y,y:v}=zx(h,x,m)),R=-1)}return{x:y,y:v,placement:x,strategy:i,middlewareData:w}},wM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,r;const{placement:i,middlewareData:l,rects:u,initialPlacement:f,platform:m,elements:h}=t,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:T=!0,...R}=fa(e,t);if((s=l.arrow)!=null&&s.alignmentOffset)return{};const C=qn(i),j=ls(f),E=qn(f)===f,_=await(m.isRTL==null?void 0:m.isRTL(h.floating)),A=x||(E||!T?[rd(f)]:Ok(f)),M=N!=="none";!x&&M&&A.push(...Lk(f,T,N,_));const O=[f,...A],I=await m.detectOverflow(t,R),Y=[];let F=((r=l.flip)==null?void 0:r.overflows)||[];if(y&&Y.push(I[C]),v){const ie=Mk(i,u,_);Y.push(I[ie[0]],I[ie[1]])}if(F=[...F,{placement:i,overflows:Y}],!Y.every(ie=>ie<=0)){var B,P;const ie=(((B=l.flip)==null?void 0:B.index)||0)+1,ee=O[ie];if(ee&&(!(v==="alignment"?j!==ls(ee):!1)||F.every(U=>ls(U.placement)===j?U.overflows[0]>0:!0)))return{data:{index:ie,overflows:F},reset:{placement:ee}};let z=(P=F.filter(H=>H.overflows[0]<=0).sort((H,U)=>H.overflows[1]-U.overflows[1])[0])==null?void 0:P.placement;if(!z)switch(w){case"bestFit":{var X;const H=(X=F.filter(U=>{if(M){const ne=ls(U.placement);return ne===j||ne==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(ne=>ne>0).reduce((ne,G)=>ne+G,0)]).sort((U,ne)=>U[1]-ne[1])[0])==null?void 0:X[0];H&&(z=H);break}case"initialPlacement":z=f;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Ix(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lx(e){return Ak.some(t=>e[t]>=0)}const SM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:r}=t,{strategy:i="referenceHidden",...l}=fa(e,t);switch(i){case"referenceHidden":{const u=await r.detectOverflow(t,{...l,elementContext:"reference"}),f=Ix(u,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:Lx(f)}}}case"escaped":{const u=await r.detectOverflow(t,{...l,altBoundary:!0}),f=Ix(u,s.floating);return{data:{escapedOffsets:f,escaped:Lx(f)}}}default:return{}}}}},zE=new Set(["left","top"]);async function EM(e,t){const{placement:s,platform:r,elements:i}=e,l=await(r.isRTL==null?void 0:r.isRTL(i.floating)),u=qn(s),f=sr(s),m=ls(s)==="y",h=zE.has(u)?-1:1,y=l&&m?-1:1,v=fa(t,e);let{mainAxis:x,crossAxis:w,alignmentAxis:N}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof N=="number"&&(w=f==="end"?N*-1:N),m?{x:w*y,y:x*h}:{x:x*h,y:w*y}}const NM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,r;const{x:i,y:l,placement:u,middlewareData:f}=t,m=await EM(t,e);return u===((s=f.offset)==null?void 0:s.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:i+m.x,y:l+m.y,data:{...m,placement:u}}}}},TM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:r,placement:i,platform:l}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:m={fn:C=>{let{x:j,y:E}=C;return{x:j,y:E}}},...h}=fa(e,t),y={x:s,y:r},v=await l.detectOverflow(t,h),x=ls(qn(i)),w=mg(x);let N=y[w],T=y[x];if(u){const C=w==="y"?"top":"left",j=w==="y"?"bottom":"right",E=N+v[C],_=N-v[j];N=hm(E,N,_)}if(f){const C=x==="y"?"top":"left",j=x==="y"?"bottom":"right",E=T+v[C],_=T-v[j];T=hm(E,T,_)}const R=m.fn({...t,[w]:N,[x]:T});return{...R,data:{x:R.x-s,y:R.y-r,enabled:{[w]:u,[x]:f}}}}}},jM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:r,placement:i,rects:l,middlewareData:u}=t,{offset:f=0,mainAxis:m=!0,crossAxis:h=!0}=fa(e,t),y={x:s,y:r},v=ls(i),x=mg(v);let w=y[x],N=y[v];const T=fa(f,t),R=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:0,crossAxis:0,...T};if(m){const E=x==="y"?"height":"width",_=l.reference[x]-l.floating[E]+R.mainAxis,A=l.reference[x]+l.reference[E]-R.mainAxis;w<_?w=_:w>A&&(w=A)}if(h){var C,j;const E=x==="y"?"width":"height",_=zE.has(qn(i)),A=l.reference[v]-l.floating[E]+(_&&((C=u.offset)==null?void 0:C[v])||0)+(_?0:R.crossAxis),M=l.reference[v]+l.reference[E]+(_?0:((j=u.offset)==null?void 0:j[v])||0)-(_?R.crossAxis:0);N<A?N=A:N>M&&(N=M)}return{[x]:w,[v]:N}}}},CM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,r;const{placement:i,rects:l,platform:u,elements:f}=t,{apply:m=()=>{},...h}=fa(e,t),y=await u.detectOverflow(t,h),v=qn(i),x=sr(i),w=ls(i)==="y",{width:N,height:T}=l.floating;let R,C;v==="top"||v==="bottom"?(R=v,C=x===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(C=v,R=x==="end"?"top":"bottom");const j=T-y.top-y.bottom,E=N-y.left-y.right,_=Ji(T-y[R],j),A=Ji(N-y[C],E),M=!t.middlewareData.shift;let O=_,I=A;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(I=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=j),M&&!x){const F=Fn(y.left,0),B=Fn(y.right,0),P=Fn(y.top,0),X=Fn(y.bottom,0);w?I=N-2*(F!==0||B!==0?F+B:Fn(y.left,y.right)):O=T-2*(P!==0||X!==0?P+X:Fn(y.top,y.bottom))}await m({...t,availableWidth:I,availableHeight:O});const Y=await u.getDimensions(f.floating);return N!==Y.width||T!==Y.height?{reset:{rects:!0}}:{}}}};function IE(e){const t=Gn(e);let s=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ut(e),l=i?e.offsetWidth:s,u=i?e.offsetHeight:r,f=ad(s)!==l||ad(r)!==u;return f&&(s=l,r=u),{width:s,height:r,$:f}}function bg(e){return Tt(e)?e:e.contextElement}function Gi(e){const t=bg(e);if(!Ut(t))return Ps(1);const s=t.getBoundingClientRect(),{width:r,height:i,$:l}=IE(t);let u=(l?ad(s.width):s.width)/r,f=(l?ad(s.height):s.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const AM=Ps(0);function LE(e){const t=un(e);return!zd()||!t.visualViewport?AM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function RM(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==un(e)?!1:t}function Vr(e,t,s,r){t===void 0&&(t=!1),s===void 0&&(s=!1);const i=e.getBoundingClientRect(),l=bg(e);let u=Ps(1);t&&(r?Tt(r)&&(u=Gi(r)):u=Gi(e));const f=RM(l,s,r)?LE(l):Ps(0);let m=(i.left+f.x)/u.x,h=(i.top+f.y)/u.y,y=i.width/u.x,v=i.height/u.y;if(l){const x=un(l),w=r&&Tt(r)?un(r):r;let N=x,T=cm(N);for(;T&&r&&w!==N;){const R=Gi(T),C=T.getBoundingClientRect(),j=Gn(T),E=C.left+(T.clientLeft+parseFloat(j.paddingLeft))*R.x,_=C.top+(T.clientTop+parseFloat(j.paddingTop))*R.y;m*=R.x,h*=R.y,y*=R.x,v*=R.y,m+=E,h+=_,N=un(T),T=cm(N)}}return id({width:y,height:v,x:m,y:h})}function Pd(e,t){const s=Id(e).scrollLeft;return t?t.left+s:Vr(Zs(e)).left+s}function PE(e,t){const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-Pd(e,s),i=s.top+t.scrollTop;return{x:r,y:i}}function _M(e){let{elements:t,rect:s,offsetParent:r,strategy:i}=e;const l=i==="fixed",u=Zs(r),f=t?Dd(t.floating):!1;if(r===u||f&&l)return s;let m={scrollLeft:0,scrollTop:0},h=Ps(1);const y=Ps(0),v=Ut(r);if((v||!v&&!l)&&((nr(r)!=="body"||qr(u))&&(m=Id(r)),Ut(r))){const w=Vr(r);h=Gi(r),y.x=w.x+r.clientLeft,y.y=w.y+r.clientTop}const x=u&&!v&&!l?PE(u,m):Ps(0);return{width:s.width*h.x,height:s.height*h.y,x:s.x*h.x-m.scrollLeft*h.x+y.x+x.x,y:s.y*h.y-m.scrollTop*h.y+y.y+x.y}}function kM(e){return Array.from(e.getClientRects())}function MM(e){const t=Zs(e),s=Id(e),r=e.ownerDocument.body,i=Fn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=Fn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let u=-s.scrollLeft+Pd(e);const f=-s.scrollTop;return Gn(r).direction==="rtl"&&(u+=Fn(t.clientWidth,r.clientWidth)-i),{width:i,height:l,x:u,y:f}}const Px=25;function OM(e,t){const s=un(e),r=Zs(e),i=s.visualViewport;let l=r.clientWidth,u=r.clientHeight,f=0,m=0;if(i){l=i.width,u=i.height;const y=zd();(!y||y&&t==="fixed")&&(f=i.offsetLeft,m=i.offsetTop)}const h=Pd(r);if(h<=0){const y=r.ownerDocument,v=y.body,x=getComputedStyle(v),w=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,N=Math.abs(r.clientWidth-v.clientWidth-w);N<=Px&&(l-=N)}else h<=Px&&(l+=h);return{width:l,height:u,x:f,y:m}}const DM=new Set(["absolute","fixed"]);function zM(e,t){const s=Vr(e,!0,t==="fixed"),r=s.top+e.clientTop,i=s.left+e.clientLeft,l=Ut(e)?Gi(e):Ps(1),u=e.clientWidth*l.x,f=e.clientHeight*l.y,m=i*l.x,h=r*l.y;return{width:u,height:f,x:m,y:h}}function $x(e,t,s){let r;if(t==="viewport")r=OM(e,s);else if(t==="document")r=MM(Zs(e));else if(Tt(t))r=zM(t,s);else{const i=LE(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return id(r)}function $E(e,t){const s=Us(e);return s===t||!Tt(s)||Ls(s)?!1:Gn(s).position==="fixed"||$E(s,t)}function IM(e,t){const s=t.get(e);if(s)return s;let r=Ya(e,[],!1).filter(f=>Tt(f)&&nr(f)!=="body"),i=null;const l=Gn(e).position==="fixed";let u=l?Us(e):e;for(;Tt(u)&&!Ls(u);){const f=Gn(u),m=fg(u);!m&&f.position==="fixed"&&(i=null),(l?!m&&!i:!m&&f.position==="static"&&!!i&&DM.has(i.position)||qr(u)&&!m&&$E(e,u))?r=r.filter(y=>y!==u):i=f,u=Us(u)}return t.set(e,r),r}function LM(e){let{element:t,boundary:s,rootBoundary:r,strategy:i}=e;const u=[...s==="clippingAncestors"?Dd(t)?[]:IM(t,this._c):[].concat(s),r],f=u[0],m=u.reduce((h,y)=>{const v=$x(t,y,i);return h.top=Fn(v.top,h.top),h.right=Ji(v.right,h.right),h.bottom=Ji(v.bottom,h.bottom),h.left=Fn(v.left,h.left),h},$x(t,f,i));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function PM(e){const{width:t,height:s}=IE(e);return{width:t,height:s}}function $M(e,t,s){const r=Ut(t),i=Zs(t),l=s==="fixed",u=Vr(e,!0,l,t);let f={scrollLeft:0,scrollTop:0};const m=Ps(0);function h(){m.x=Pd(i)}if(r||!r&&!l)if((nr(t)!=="body"||qr(i))&&(f=Id(t)),r){const w=Vr(t,!0,l,t);m.x=w.x+t.clientLeft,m.y=w.y+t.clientTop}else i&&h();l&&!r&&i&&h();const y=i&&!r&&!l?PE(i,f):Ps(0),v=u.left+f.scrollLeft-m.x-y.x,x=u.top+f.scrollTop-m.y-y.y;return{x:v,y:x,width:u.width,height:u.height}}function bp(e){return Gn(e).position==="static"}function Ux(e,t){if(!Ut(e)||Gn(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return Zs(e)===s&&(s=s.ownerDocument.body),s}function UE(e,t){const s=un(e);if(Dd(e))return s;if(!Ut(e)){let i=Us(e);for(;i&&!Ls(i);){if(Tt(i)&&!bp(i))return i;i=Us(i)}return s}let r=Ux(e,t);for(;r&&Z_(r)&&bp(r);)r=Ux(r,t);return r&&Ls(r)&&bp(r)&&!fg(r)?s:r||G_(e)||s}const UM=async function(e){const t=this.getOffsetParent||UE,s=this.getDimensions,r=await s(e.floating);return{reference:$M(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VM(e){return Gn(e).direction==="rtl"}const BM={convertOffsetParentRelativeRectToViewportRelativeRect:_M,getDocumentElement:Zs,getClippingRect:LM,getOffsetParent:UE,getElementRects:UM,getClientRects:kM,getDimensions:PM,getScale:Gi,isElement:Tt,isRTL:VM};function VE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ZM(e,t){let s=null,r;const i=Zs(e);function l(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function u(f,m){f===void 0&&(f=!1),m===void 0&&(m=1),l();const h=e.getBoundingClientRect(),{left:y,top:v,width:x,height:w}=h;if(f||t(),!x||!w)return;const N=Pi(v),T=Pi(i.clientWidth-(y+x)),R=Pi(i.clientHeight-(v+w)),C=Pi(y),E={rootMargin:-N+"px "+-T+"px "+-R+"px "+-C+"px",threshold:Fn(0,Ji(1,m))||1};let _=!0;function A(M){const O=M[0].intersectionRatio;if(O!==m){if(!_)return u();O?u(!1,O):r=setTimeout(()=>{u(!1,1e-7)},1e3)}O===1&&!VE(h,e.getBoundingClientRect())&&u(),_=!1}try{s=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{s=new IntersectionObserver(A,E)}s.observe(e)}return u(!0),l}function Vx(e,t,s,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,h=bg(e),y=i||l?[...h?Ya(h):[],...Ya(t)]:[];y.forEach(C=>{i&&C.addEventListener("scroll",s,{passive:!0}),l&&C.addEventListener("resize",s)});const v=h&&f?ZM(h,s):null;let x=-1,w=null;u&&(w=new ResizeObserver(C=>{let[j]=C;j&&j.target===h&&w&&(w.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var E;(E=w)==null||E.observe(t)})),s()}),h&&!m&&w.observe(h),w.observe(t));let N,T=m?Vr(e):null;m&&R();function R(){const C=Vr(e);T&&!VE(T,C)&&s(),T=C,N=requestAnimationFrame(R)}return s(),()=>{var C;y.forEach(j=>{i&&j.removeEventListener("scroll",s),l&&j.removeEventListener("resize",s)}),v?.(),(C=w)==null||C.disconnect(),w=null,m&&cancelAnimationFrame(N)}}const HM=NM,FM=TM,qM=wM,YM=CM,GM=SM,XM=jM,KM=(e,t,s)=>{const r=new Map,i={platform:BM,...s},l={...i.platform,_c:r};return xM(e,t,{...i,platform:l})};var WM=typeof document<"u",JM=function(){},Vu=WM?b.useLayoutEffect:JM;function fd(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 s,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(r=s;r--!==0;)if(!fd(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),s=i.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=s;r--!==0;){const l=i[r];if(!(l==="_owner"&&e.$$typeof)&&!fd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function BE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bx(e,t){const s=BE(e);return Math.round(t*s)/s}function xp(e){const t=b.useRef(e);return Vu(()=>{t.current=e}),t}function QM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:u}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[y,v]=b.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=b.useState(r);fd(x,r)||w(r);const[N,T]=b.useState(null),[R,C]=b.useState(null),j=b.useCallback(U=>{U!==M.current&&(M.current=U,T(U))},[]),E=b.useCallback(U=>{U!==O.current&&(O.current=U,C(U))},[]),_=l||N,A=u||R,M=b.useRef(null),O=b.useRef(null),I=b.useRef(y),Y=m!=null,F=xp(m),B=xp(i),P=xp(h),X=b.useCallback(()=>{if(!M.current||!O.current)return;const U={placement:t,strategy:s,middleware:x};B.current&&(U.platform=B.current),KM(M.current,O.current,U).then(ne=>{const G={...ne,isPositioned:P.current!==!1};ie.current&&!fd(I.current,G)&&(I.current=G,$r.flushSync(()=>{v(G)}))})},[x,t,s,B,P]);Vu(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,v(U=>({...U,isPositioned:!1})))},[h]);const ie=b.useRef(!1);Vu(()=>(ie.current=!0,()=>{ie.current=!1}),[]),Vu(()=>{if(_&&(M.current=_),A&&(O.current=A),_&&A){if(F.current)return F.current(_,A,X);X()}},[_,A,X,F,Y]);const ee=b.useMemo(()=>({reference:M,floating:O,setReference:j,setFloating:E}),[j,E]),z=b.useMemo(()=>({reference:_,floating:A}),[_,A]),H=b.useMemo(()=>{const U={position:s,left:0,top:0};if(!z.floating)return U;const ne=Bx(z.floating,y.x),G=Bx(z.floating,y.y);return f?{...U,transform:"translate("+ne+"px, "+G+"px)",...BE(z.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:ne,top:G}},[s,f,z.floating,y.x,y.y]);return b.useMemo(()=>({...y,update:X,refs:ee,elements:z,floatingStyles:H}),[y,X,ee,z,H])}const eO=(e,t)=>({...HM(e),options:[e,t]}),tO=(e,t)=>({...FM(e),options:[e,t]}),nO=(e,t)=>({...XM(e),options:[e,t]}),sO=(e,t)=>({...qM(e),options:[e,t]}),aO=(e,t)=>({...YM(e),options:[e,t]}),rO=(e,t)=>({...GM(e),options:[e,t]}),iO={intentional:"onClick",sloppy:"onPointerDown"};function oO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function lO(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("referenceElement"),u=s.useState("domReferenceElement"),{onOpenChange:f,dataRef:m}=s.context,{enabled:h=!0,escapeKey:y=!0,outsidePress:v=!0,outsidePressEvent:x="sloppy",referencePress:w=!1,referencePressEvent:N="sloppy",ancestorScroll:T=!1,bubbles:R,externalTree:C}=t,j=oo(C),E=Be(typeof v=="function"?v:()=>!1),_=typeof v=="function"?E:v,A=b.useRef(!1),{escapeKey:M,outsidePress:O}=oO(R),I=b.useRef(null),Y=Ns(),F=Ns(),B=Be(()=>{F.clear(),m.current.insideReactTree=!1}),P=b.useRef(!1),X=b.useRef(""),ie=Be(fe=>{X.current=fe.pointerType}),ee=Be(()=>{const fe=X.current,Re=fe==="pen"||!fe?"mouse":fe,we=typeof x=="function"?x():x;return typeof we=="string"?we:we[Re]}),z=Be(fe=>{if(!r||!h||!y||fe.key!=="Escape"||P.current)return;const Re=m.current.floatingContext?.nodeId,we=j?qi(j.nodesRef.current,Re):[];if(!M&&we.length>0){let xe=!0;if(we.forEach(Se=>{Se.context?.open&&!Se.context.dataRef.current.__escapeKeyBubbles&&(xe=!1)}),!xe)return}const Pe=Tk(fe)?fe.nativeEvent:fe,_e=qt(nE,Pe);s.setOpen(!1,_e),!M&&!_e.isPropagationAllowed&&fe.stopPropagation()}),H=Be(fe=>{const Re=ee();return Re==="intentional"&&fe.type!=="click"||Re==="sloppy"&&fe.type==="click"}),U=Be(()=>{m.current.insideReactTree=!0,F.start(0,B)}),ne=Be((fe,Re=!1)=>{if(H(fe)){B();return}if(m.current.insideReactTree){B();return}if(ee()==="intentional"&&Re||typeof _=="function"&&!_(fe))return;const we=Dn(fe),Pe=`[${Rl("inert")}]`,_e=ln(s.select("floatingElement")).querySelectorAll(Pe),xe=s.context.triggerElements;if(we&&(xe.hasElement(we)||xe.hasMatchingElement(Z=>Nt(Z,we))))return;let Se=Tt(we)?we:null;for(;Se&&!Ls(Se);){const Z=Us(Se);if(Ls(Z)||!Tt(Z))break;Se=Z}if(_e.length&&Tt(we)&&!Ek(we)&&!Nt(we,s.select("floatingElement"))&&Array.from(_e).every(Z=>!Nt(Se,Z)))return;if(Ut(we)&&!("touches"in fe)){const Z=Ls(we),te=Gn(we),de=/auto|scroll/,me=Z||de.test(te.overflowX),ye=Z||de.test(te.overflowY),Ae=me&&we.clientWidth>0&&we.scrollWidth>we.clientWidth,Ie=ye&&we.clientHeight>0&&we.scrollHeight>we.clientHeight,Me=te.direction==="rtl",tt=Ie&&(Me?fe.offsetX<=we.offsetWidth-we.clientWidth:fe.offsetX>we.clientWidth),Ot=Ae&&fe.offsetY>we.clientHeight;if(tt||Ot)return}const Ue=m.current.floatingContext?.nodeId,Le=j&&qi(j.nodesRef.current,Ue).some(Z=>gs(fe,Z.context?.elements.floating));if(gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||Le)return;const Ze=j?qi(j.nodesRef.current,Ue):[];if(Ze.length>0){let Z=!0;if(Ze.forEach(te=>{te.context?.open&&!te.context.dataRef.current.__outsidePressBubbles&&(Z=!1)}),!Z)return}s.setOpen(!1,qt(ug,fe)),B()}),G=Be(fe=>{ee()!=="sloppy"||fe.pointerType==="touch"||!s.select("open")||!h||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||ne(fe)}),D=Be(fe=>{if(ee()!=="sloppy"||!s.select("open")||!h||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement")))return;const Re=fe.touches[0];Re&&(I.current={startTime:Date.now(),startX:Re.clientX,startY:Re.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},Y.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),$=Be(fe=>{const Re=Dn(fe);function we(){D(fe),Re?.removeEventListener(fe.type,we)}Re?.addEventListener(fe.type,we)}),J=Be(fe=>{const Re=A.current;if(A.current=!1,Y.clear(),fe.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const we=Dn(fe);function Pe(){fe.type==="pointerdown"?G(fe):ne(fe,Re),we?.removeEventListener(fe.type,Pe)}we?.addEventListener(fe.type,Pe)}),re=Be(fe=>{if(ee()!=="sloppy"||!I.current||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement")))return;const Re=fe.touches[0];if(!Re)return;const we=Math.abs(Re.clientX-I.current.startX),Pe=Math.abs(Re.clientY-I.current.startY),_e=Math.sqrt(we*we+Pe*Pe);_e>5&&(I.current.dismissOnTouchEnd=!0),_e>10&&(ne(fe),Y.clear(),I.current=null)}),se=Be(fe=>{const Re=Dn(fe);function we(){re(fe),Re?.removeEventListener(fe.type,we)}Re?.addEventListener(fe.type,we)}),ge=Be(fe=>{ee()!=="sloppy"||!I.current||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&ne(fe),Y.clear(),I.current=null)}),he=Be(fe=>{const Re=Dn(fe);function we(){ge(fe),Re?.removeEventListener(fe.type,we)}Re?.addEventListener(fe.type,we)});b.useEffect(()=>{if(!r||!h)return;m.current.__escapeKeyBubbles=M,m.current.__outsidePressBubbles=O;const fe=new Wi;function Re(Se){s.setOpen(!1,qt(z_,Se))}function we(){fe.clear(),P.current=!0}function Pe(){fe.start(zd()?5:0,()=>{P.current=!1})}const _e=ln(i);_e.addEventListener("pointerdown",ie,!0),y&&(_e.addEventListener("keydown",z),_e.addEventListener("compositionstart",we),_e.addEventListener("compositionend",Pe)),_&&(_e.addEventListener("click",J,!0),_e.addEventListener("pointerdown",J,!0),_e.addEventListener("touchstart",$,!0),_e.addEventListener("touchmove",se,!0),_e.addEventListener("touchend",he,!0),_e.addEventListener("mousedown",J,!0));let xe=[];return T&&(Tt(u)&&(xe=Ya(u)),Tt(i)&&(xe=xe.concat(Ya(i))),!Tt(l)&&l&&l.contextElement&&(xe=xe.concat(Ya(l.contextElement)))),xe=xe.filter(Se=>Se!==_e.defaultView?.visualViewport),xe.forEach(Se=>{Se.addEventListener("scroll",Re,{passive:!0})}),()=>{_e.removeEventListener("pointerdown",ie,!0),y&&(_e.removeEventListener("keydown",z),_e.removeEventListener("compositionstart",we),_e.removeEventListener("compositionend",Pe)),_&&(_e.removeEventListener("click",J,!0),_e.removeEventListener("pointerdown",J,!0),_e.removeEventListener("touchstart",$,!0),_e.removeEventListener("touchmove",se,!0),_e.removeEventListener("touchend",he,!0),_e.removeEventListener("mousedown",J,!0)),xe.forEach(Se=>{Se.removeEventListener("scroll",Re)}),fe.clear()}},[m,i,l,u,y,_,r,f,T,h,M,O,z,ne,J,G,$,se,he,ie,s]),b.useEffect(B,[_,B]);const pe=b.useMemo(()=>({onKeyDown:z,...w&&{[iO[N]]:fe=>{s.setOpen(!1,qt(nd,fe.nativeEvent))},...N!=="intentional"&&{onClick(fe){s.setOpen(!1,qt(nd,fe.nativeEvent))}}}}),[z,s,w,N]),be=Be(fe=>{const Re=Dn(fe.nativeEvent);!Nt(s.select("floatingElement"),Re)||fe.button!==0||(A.current=!0)}),Ce=b.useMemo(()=>({onKeyDown:z,onPointerDown:be,onMouseDown:be,onMouseUp:be,onClickCapture:U,onMouseDownCapture:U,onPointerDownCapture:U,onMouseUpCapture:U,onTouchEndCapture:U,onTouchMoveCapture:U}),[z,be,U]);return b.useMemo(()=>h?{reference:pe,floating:Ce,trigger:pe}:{},[h,pe,Ce])}var hd=Symbol("NOT_FOUND");function cO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function uO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function dO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(s=>typeof s=="function")){const s=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${s}]`)}}var Zx=e=>Array.isArray(e)?e:[e];function fO(e){const t=Array.isArray(e[0])?e[0]:e;return dO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function hO(e,t){const s=[],{length:r}=e;for(let i=0;i<r;i++)s.push(e[i].apply(null,t));return s}function pO(e){let t;return{get(s){return t&&e(t.key,s)?t.value:hd},put(s,r){t={key:s,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function mO(e,t){let s=[];function r(f){const m=s.findIndex(h=>t(f,h.key));if(m>-1){const h=s[m];return m>0&&(s.splice(m,1),s.unshift(h)),h.value}return hd}function i(f,m){r(f)===hd&&(s.unshift({key:f,value:m}),s.length>e&&s.pop())}function l(){return s}function u(){s=[]}return{get:r,put:i,getEntries:l,clear:u}}var gO=(e,t)=>e===t;function yO(e){return function(s,r){if(s===null||r===null||s.length!==r.length)return!1;const{length:i}=s;for(let l=0;l<i;l++)if(!e(s[l],r[l]))return!1;return!0}}function vO(e,t){const s=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=gO,maxSize:i=1,resultEqualityCheck:l}=s,u=yO(r);let f=0;const m=i<=1?pO(u):mO(i,u);function h(){let y=m.get(arguments);if(y===hd){if(y=e.apply(null,arguments),f++,l){const x=m.getEntries().find(w=>l(w.value,y));x&&(y=x.value,f!==0&&f--)}m.put(arguments,y)}return y}return h.clearCache=()=>{m.clear(),h.resetResultsCount()},h.resultsCount=()=>f,h.resetResultsCount=()=>{f=0},h}var bO=class{constructor(e){this.value=e}deref(){return this.value}},xO=typeof WeakRef<"u"?WeakRef:bO,wO=0,Hx=1;function bu(){return{s:wO,v:void 0,o:null,p:null}}function ZE(e,t={}){let s=bu();const{resultEqualityCheck:r}=t;let i,l=0;function u(){let f=s;const{length:m}=arguments;for(let v=0,x=m;v<x;v++){const w=arguments[v];if(typeof w=="function"||typeof w=="object"&&w!==null){let N=f.o;N===null&&(f.o=N=new WeakMap);const T=N.get(w);T===void 0?(f=bu(),N.set(w,f)):f=T}else{let N=f.p;N===null&&(f.p=N=new Map);const T=N.get(w);T===void 0?(f=bu(),N.set(w,f)):f=T}}const h=f;let y;if(f.s===Hx)y=f.v;else if(y=e.apply(null,arguments),l++,r){const v=i?.deref?.()??i;v!=null&&r(v,y)&&(y=v,l!==0&&l--),i=typeof y=="object"&&y!==null||typeof y=="function"?new xO(y):y}return h.s=Hx,h.v=y,y}return u.clearCache=()=>{s=bu(),u.resetResultsCount()},u.resultsCount=()=>l,u.resetResultsCount=()=>{l=0},u}function HE(e,...t){const s=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let l=0,u=0,f,m={},h=i.pop();typeof h=="object"&&(m=h,h=i.pop()),cO(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const y={...s,...m},{memoize:v,memoizeOptions:x=[],argsMemoize:w=ZE,argsMemoizeOptions:N=[]}=y,T=Zx(x),R=Zx(N),C=fO(i),j=v(function(){return l++,h.apply(null,arguments)},...T),E=w(function(){u++;const A=hO(C,arguments);return f=j.apply(null,A),f},...R);return Object.assign(E,{resultFunc:h,memoizedResultFunc:j,dependencies:C,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>f,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:v,argsMemoize:w})};return Object.assign(r,{withTypes:()=>r}),r}var SO=HE(ZE),EO=Object.assign((e,t=SO)=>{uO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const s=Object.keys(e),r=s.map(l=>e[l]);return t(r,(...l)=>l.reduce((u,f,m)=>(u[s[m]]=f,u),{}))},{withTypes:()=>EO});HE({memoize:vO,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Ye=(e,t,s,r,i,l,...u)=>{if(u.length>0)throw new Error(Fr(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var wp={exports:{}},Sp={};var Fx;function NO(){if(Fx)return Sp;Fx=1;var e=Vl();function t(v,x){return v===x&&(v!==0||1/v===1/x)||v!==v&&x!==x}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function f(v,x){var w=x(),N=r({inst:{value:w,getSnapshot:x}}),T=N[0].inst,R=N[1];return l(function(){T.value=w,T.getSnapshot=x,m(T)&&R({inst:T})},[v,w,x]),i(function(){return m(T)&&R({inst:T}),v(function(){m(T)&&R({inst:T})})},[v]),u(w),w}function m(v){var x=v.getSnapshot;v=v.value;try{var w=x();return!s(v,w)}catch{return!0}}function h(v,x){return x()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Sp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sp}var qx;function FE(){return qx||(qx=1,wp.exports=NO()),wp.exports}var TO=FE(),Ep={exports:{}},Np={};var Yx;function jO(){if(Yx)return Np;Yx=1;var e=Vl(),t=FE();function s(h,y){return h===y&&(h!==0||1/h===1/y)||h!==h&&y!==y}var r=typeof Object.is=="function"?Object.is:s,i=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Np.useSyncExternalStoreWithSelector=function(h,y,v,x,w){var N=l(null);if(N.current===null){var T={hasValue:!1,value:null};N.current=T}else T=N.current;N=f(function(){function C(M){if(!j){if(j=!0,E=M,M=x(M),w!==void 0&&T.hasValue){var O=T.value;if(w(O,M))return _=O}return _=M}if(O=_,r(E,M))return O;var I=x(M);return w!==void 0&&w(O,I)?(E=M,O):(E=M,_=I)}var j=!1,E,_,A=v===void 0?null:v;return[function(){return C(y())},A===null?void 0:function(){return C(A())}]},[y,v,x,w]);var R=i(h,N[0],N[1]);return u(function(){T.hasValue=!0,T.value=R},[R]),m(R),R},Np}var Gx;function CO(){return Gx||(Gx=1,Ep.exports=jO()),Ep.exports}var AO=CO();const RO=lg(19),_O=RO?MO:OO;function kO(e,t,s,r,i){return _O(e,t,s,r,i)}function MO(e,t,s,r,i){const l=b.useCallback(()=>t(e.getSnapshot(),s,r,i),[e,t,s,r,i]);return TO.useSyncExternalStore(e.subscribe,l,l)}function OO(e,t,s,r,i){return AO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,s,r,i))}class El{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 s=this.updateTick;for(const r of this.listeners){if(s!==this.updateTick)return;r(t)}}update(t){for(const s in t)if(!Object.is(this.state[s],t[s])){El.prototype.setState.call(this,{...this.state,...t});return}}set(t,s){Object.is(this.state[t],s)||El.prototype.setState.call(this,{...this.state,[t]:s})}notifyAll(){const t={...this.state};El.prototype.setState.call(this,t)}}class qE extends El{constructor(t,s={},r){super(t),this.context=s,this.selectors=r}controlledValues=new Map;useSyncedValue(t,s){b.useDebugValue(t),$e(()=>{this.state[t]!==s&&this.set(t,s)},[t,s])}useSyncedValueWithCleanup(t,s){$e(()=>(this.state[t]!==s&&this.set(t,s),()=>{this.set(t,void 0)}),[t,s])}useSyncedValues(t){const s=Object.values(t);$e(()=>{this.update(t)},s)}useControlledProp(t,s,r){b.useDebugValue(t);const i=s!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,i),!i&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),$e(()=>{i&&!Object.is(this.state[t],s)&&super.setState({...this.state,[t]:s})},[t,s,r,i])}set(t,s){this.controlledValues.get(t)!==!0&&super.set(t,s)}update(t){const s={...t};for(const r in s)if(Object.hasOwn(s,r)&&this.controlledValues.get(r)===!0){delete s[r];continue}super.update(s)}setState(t){const s={...t};for(const r in s)if(Object.hasOwn(s,r)&&this.controlledValues.get(r)===!0){delete s[r];continue}super.setState({...this.state,...s})}select=(t,s,r,i)=>{const l=this.selectors[t];return l(this.state,s,r,i)};useState=(t,s,r,i)=>{b.useDebugValue(t);const l=this.selectors[t];return kO(this,l,s,r,i)};useContextCallback(t,s){b.useDebugValue(t);const r=Be(s??JS);this.context[t]=r}useStateSetter(t){const s=b.useRef(void 0);return s.current===void 0&&(s.current=r=>{this.set(t,r)}),s.current}observe(t,s){let r;typeof t=="function"?r=t:r=this.selectors[t];let i=r(this.state);return s(i,i,this),this.subscribe(l=>{const u=r(l);if(!Object.is(i,u)){const f=i;i=u,s(u,f,this)}})}}const DO={open:Ye(e=>e.open),domReferenceElement:Ye(e=>e.domReferenceElement),referenceElement:Ye(e=>e.positionReference??e.referenceElement),floatingElement:Ye(e=>e.floatingElement),floatingId:Ye(e=>e.floatingId)};class xg extends qE{constructor(t){const{nested:s,noEmit:r,onOpenChange:i,triggerElements:l,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:CE(),nested:s,noEmit:r,triggerElements:l},DO)}setOpen=(t,s)=>{if((!t||!this.state.open||Ck(s.event))&&(this.context.dataRef.current.openEvent=t?s.event:void 0),!this.context.noEmit){const r={open:t,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,s)}}function zO(e){const t=e.useState("open");$e(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const s=e.context.triggerElements.entries().next();if(!s.done){const[r,i]=s.value;e.update({activeTriggerId:r,activeTriggerElement:i})}}},[t,e])}function IO(e,t,s){const{mounted:r,setMounted:i,transitionStatus:l}=ck(e);t.useSyncedValues({mounted:r,transitionStatus:l});const u=Be(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),s?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return oE({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}}class wg{constructor(){this.elements=new Set,this.idMap=new Map}add(t,s){const r=this.idMap.get(t);r!==s&&(r!==void 0&&this.elements.delete(r),this.elements.add(s),this.idMap.set(t,s))}delete(t){const s=this.idMap.get(t);s&&(this.elements.delete(s),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const s of this.elements)if(t(s))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function LO(){return new xg({open:!1,floatingElement:null,referenceElement:null,triggerElements:new wg,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function PO(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:LO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:zn,inactiveTriggerProps:zn,popupProps:zn}}const $O={open:Ye(e=>e.open),mounted:Ye(e=>e.mounted),transitionStatus:Ye(e=>e.transitionStatus),floatingRootContext:Ye(e=>e.floatingRootContext),preventUnmountingOnClose:Ye(e=>e.preventUnmountingOnClose),payload:Ye(e=>e.payload),activeTriggerId:Ye(e=>e.activeTriggerId),activeTriggerElement:Ye(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Ye((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Ye((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Ye((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Ye((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Ye(e=>e.popupProps),popupElement:Ye(e=>e.popupElement),positionerElement:Ye(e=>e.positionerElement)};function UO(e){const{open:t=!1,onOpenChange:s,elements:r={}}=e,i=er(),l=ar()!=null,u=ds(()=>new xg({open:t,onOpenChange:s,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new wg,floatingId:i,nested:l,noEmit:e.noEmit||!1})).current;return $e(()=>{const f={open:t,floatingId:i};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=Tt(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),u.update(f)},[t,i,r.reference,r.floating,u]),u.context.onOpenChange=s,u.context.nested=l,u.context.noEmit=e.noEmit||!1,u}function VO(e={}){const{nodeId:t,externalTree:s}=e,r=UO(e),i=e.rootContext||r,l={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[u,f]=b.useState(null),m=b.useRef(null),h=oo(s);$e(()=>{l.domReference&&(m.current=l.domReference)},[l.domReference]);const y=QM({...e,elements:{...l,...u&&{reference:u}}}),v=b.useCallback(O=>{const I=Tt(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;f(I),y.refs.setReference(I)},[y.refs]),[x,w]=b.useState(null),[N,T]=b.useState(null);i.useSyncedValue("referenceElement",x),i.useSyncedValue("domReferenceElement",Tt(x)?x:null),i.useSyncedValue("floatingElement",N);const R=b.useCallback(O=>{(Tt(O)||O===null)&&(m.current=O,w(O)),(Tt(y.refs.reference.current)||y.refs.reference.current===null||O!==null&&!Tt(O))&&y.refs.setReference(O)},[y.refs,w]),C=b.useCallback(O=>{T(O),y.refs.setFloating(O)},[y.refs]),j=b.useMemo(()=>({...y.refs,setReference:R,setFloating:C,setPositionReference:v,domReference:m}),[y.refs,R,C,v]),E=b.useMemo(()=>({...y.elements,domReference:l.domReference}),[y.elements,l.domReference]),_=i.useState("open"),A=i.useState("floatingId"),M=b.useMemo(()=>({...y,dataRef:i.context.dataRef,open:_,onOpenChange:i.setOpen,events:i.context.events,floatingId:A,refs:j,elements:E,nodeId:t,rootStore:i}),[y,j,E,t,i,_,A]);return $e(()=>{i.context.dataRef.current.floatingContext=M;const O=h?.nodesRef.current.find(I=>I.id===t);O&&(O.context=M)}),b.useMemo(()=>({...y,context:M,refs:j,elements:E,rootStore:i}),[y,j,E,M,i])}function BO(e){const{popupStore:t,noEmit:s=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,l=er(),u=ar()!=null,f=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(r?"popupElement":"positionerElement"),y=t.context.triggerElements,v=ds(()=>new xg({open:f,referenceElement:m,floatingElement:h,triggerElements:y,onOpenChange:i,floatingId:l,nested:u,noEmit:s})).current;return $e(()=>{const x={open:f,floatingId:l,referenceElement:m,floatingElement:h};Tt(m)&&(x.domReferenceElement=m),v.update(x)},[f,l,m,h,v]),v.context.onOpenChange=i,v.context.nested=u,v.context.noEmit=s,v}const Xx=Rl("safe-polygon"),ZO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${hE}`;function HO(e){return e?!!e.closest(ZO):!1}function FO(e){const t=b.useRef(void 0),s=b.useRef(!1),r=b.useRef(void 0),i=b.useRef(!0),l=b.useRef(!1),u=b.useRef(()=>{}),f=b.useRef(!1),m=Ns(),h=Ns(),y=b.useRef(void 0);return b.useMemo(()=>{const v=e.context.dataRef.current;return v.hoverInteractionState||(v.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:s,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:l,unbindMouseMoveRef:u,restTimeoutPendingRef:f,openChangeTimeout:m,restTimeout:h,handleCloseOptionsRef:y}),v.hoverInteractionState},[e,t,s,r,i,l,u,f,m,h,y])}const qO=new Set(["click","mousedown"]);function YO(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),{dataRef:u}=s.context,{enabled:f=!0,closeDelay:m=0,externalTree:h}=t,{pointerTypeRef:y,interactedInsideRef:v,handlerRef:x,performedPointerEventsMutationRef:w,unbindMouseMoveRef:N,restTimeoutPendingRef:T,openChangeTimeout:R,handleCloseOptionsRef:C}=FO(s),j=oo(h),E=ar(),_=Be(()=>v.current?!0:u.current.openEvent?qO.has(u.current.openEvent.type):!1),A=Be(()=>{const F=u.current.openEvent?.type;return F?.includes("mouse")&&F!=="mousedown"}),M=b.useCallback((F,B=!0)=>{const P=GO(m,y.current);P&&!x.current?R.start(P,()=>s.setOpen(!1,qt(Ir,F))):B&&(R.clear(),s.setOpen(!1,qt(Ir,F)))},[m,x,s,y,R]),O=Be(()=>{N.current(),x.current=void 0}),I=Be(()=>{if(w.current){const F=ln(i).body;F.style.pointerEvents="",F.removeAttribute(Xx),w.current=!1}}),Y=Be(F=>{const B=Dn(F);if(!HO(B)){v.current=!1;return}v.current=!0});$e(()=>{r||(y.current=void 0,T.current=!1,v.current=!1,O(),I())},[r,y,T,v,O,I]),b.useEffect(()=>()=>{O()},[O]),b.useEffect(()=>I,[I]),$e(()=>{if(f&&r&&C.current?.blockPointerEvents&&A()&&Tt(l)&&i){w.current=!0;const F=ln(i).body;F.setAttribute(Xx,"");const B=l,P=i,X=j?.nodesRef.current.find(ie=>ie.id===E)?.context?.elements.floating;return X&&(X.style.pointerEvents=""),F.style.pointerEvents="none",B.style.pointerEvents="auto",P.style.pointerEvents="auto",()=>{F.style.pointerEvents="",B.style.pointerEvents="",P.style.pointerEvents=""}}},[f,r,l,i,C,A,j,E,w]),b.useEffect(()=>{if(!f)return;function F(ie){if(_()||!u.current.floatingContext)return;const ee=s.context.triggerElements;ie.relatedTarget&&ee.hasElement(ie.relatedTarget)||(I(),O(),_()||M(ie))}function B(ie){R.clear(),I(),x.current?.(ie),O()}function P(ie){_()||M(ie,!1)}const X=i;return X&&(X.addEventListener("mouseleave",F),X.addEventListener("mouseenter",B),X.addEventListener("mouseleave",P),X.addEventListener("pointerdown",Y,!0)),()=>{X&&(X.removeEventListener("mouseleave",F),X.removeEventListener("mouseenter",B),X.removeEventListener("mouseleave",P),X.removeEventListener("pointerdown",Y,!0))}})}function GO(e,t){return t&&!jk(t)?0:typeof e=="function"?e():e}function XO(e=[]){const t=e.map(h=>h?.reference),s=e.map(h=>h?.floating),r=e.map(h=>h?.item),i=e.map(h=>h?.trigger),l=b.useCallback(h=>xu(h,e,"reference"),t),u=b.useCallback(h=>xu(h,e,"floating"),s),f=b.useCallback(h=>xu(h,e,"item"),r),m=b.useCallback(h=>xu(h,e,"trigger"),i);return b.useMemo(()=>({getReferenceProps:l,getFloatingProps:u,getItemProps:f,getTriggerProps:m}),[l,u,f,m])}function xu(e,t,s){const r=new Map,i=s==="item",l={};s==="floating"&&(l.tabIndex=-1,l[dm]="");for(const u in e)i&&e&&(u===dE||u===fE)||(l[u]=e[u]);for(let u=0;u<t.length;u+=1){let f;const m=t[u]?.[s];typeof m=="function"?f=e?m(e):null:f=m,f&&Kx(l,f,i,r)}return Kx(l,e,i,r),l}function Kx(e,t,s,r){for(const i in t){const l=t[i];s&&(i===dE||i===fE)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof l=="function"&&(r.get(i)?.push(l),e[i]=(...u)=>r.get(i)?.map(f=>f(...u)).find(f=>f!==void 0))):e[i]=l)}}const KO="Escape";function $d(e,t,s){switch(e){case"vertical":return t;case"horizontal":return s;default:return t||s}}function wu(e,t){return $d(t,e===pg||e===Bl,e===Ga||e===Xa)}function Tp(e,t,s){return $d(t,e===Bl,s?e===Ga:e===Xa)||e==="Enter"||e===" "||e===""}function WO(e,t,s){return $d(t,s?e===Ga:e===Xa,e===Bl)}function JO(e,t,s,r){const i=s?e===Xa:e===Ga,l=e===pg;return t==="both"||t==="horizontal"&&r&&r>1?e===KO:$d(t,i,l)}function QO(e,t){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),u=s.context.dataRef,{listRef:f,activeIndex:m,onNavigate:h=()=>{},enabled:y=!0,selectedIndex:v=null,allowEscape:x=!1,loopFocus:w=!1,nested:N=!1,rtl:T=!1,virtual:R=!1,focusItemOnOpen:C="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:E=!0,disabledIndices:_=void 0,orientation:A="vertical",parentOrientation:M,cols:O=1,scrollItemIntoView:I=!0,itemSizes:Y,dense:F=!1,id:B,resetOnPointerLeave:P=!0,externalTree:X}=t,ie=sd(i),ee=On(ie),z=ar(),H=oo(X);$e(()=>{u.current.orientation=A},[u,A]);const U=fm(l),ne=b.useRef(C),G=b.useRef(v??-1),D=b.useRef(null),$=b.useRef(!0),J=Be(de=>{h(G.current===-1?null:G.current,de)}),re=b.useRef(J),se=b.useRef(!!i),ge=b.useRef(r),he=b.useRef(!1),pe=b.useRef(!1),be=On(_),Ce=On(r),fe=On(I),Re=On(v),we=On(P),Pe=Be(()=>{function de(Ie){R?H?.events.emit("virtualfocus",Ie):Uu(Ie,{sync:he.current,preventScroll:!0})}const me=f.current[G.current],ye=pe.current;me&&de(me),(he.current?Ie=>Ie():requestAnimationFrame)(()=>{const Ie=f.current[G.current]||me;if(!Ie)return;me||de(Ie);const Me=fe.current;Me&&xe&&(ye||!$.current)&&Ie.scrollIntoView?.(typeof Me=="boolean"?{block:"nearest",inline:"nearest"}:Me)})});$e(()=>{y&&(r&&i?(G.current=v??-1,ne.current&&v!=null&&(pe.current=!0,J())):se.current&&(G.current=-1,re.current()))},[y,r,i,v,J]),$e(()=>{if(y){if(!r){he.current=!1;return}if(i)if(m==null){if(he.current=!1,Re.current!=null)return;if(se.current&&(G.current=-1,Pe()),(!ge.current||!se.current)&&ne.current&&(D.current!=null||ne.current===!0&&D.current==null)){let de=0;const me=()=>{f.current[0]==null?(de<2&&(de?requestAnimationFrame:queueMicrotask)(me),de+=1):(G.current=D.current==null||Tp(D.current,A,T)||N?gp(f):Ax(f),D.current=null,J())};me()}}else xl(f,m)||(G.current=m,Pe(),pe.current=!1)}},[y,r,i,m,Re,N,f,A,T,J,Pe,be]),$e(()=>{if(!y||i||!H||R||!se.current)return;const de=H.nodesRef.current,me=de.find(Ie=>Ie.id===z)?.context?.elements.floating,ye=Ha(ln(i)),Ae=de.some(Ie=>Ie.context&&Nt(Ie.context.elements.floating,ye));me&&!Ae&&$.current&&me.focus({preventScroll:!0})},[y,i,H,z,R]),$e(()=>{re.current=J,ge.current=r,se.current=!!i}),$e(()=>{r||(D.current=null,ne.current=C)},[r,C]);const _e=m!=null,xe=b.useMemo(()=>{function de(ye){if(!Ce.current)return;const Ae=f.current.indexOf(ye.currentTarget);Ae!==-1&&G.current!==Ae&&(G.current=Ae,J(ye))}return{onFocus(ye){he.current=!0,de(ye)},onClick:({currentTarget:ye})=>ye.focus({preventScroll:!0}),onMouseMove(ye){he.current=!0,pe.current=!1,j&&de(ye)},onPointerLeave(ye){if(!Ce.current||!$.current||ye.pointerType==="touch")return;he.current=!0;const Ae=ye.relatedTarget;!j||f.current.includes(Ae)||we.current&&(G.current=-1,J(ye),R||ee.current?.focus({preventScroll:!0}))}}},[Ce,ee,j,f,J,we,R]),Se=b.useCallback(()=>M??H?.nodesRef.current.find(de=>de.id===z)?.context?.dataRef?.current.orientation,[z,H,M]),Ue=Be(de=>{if($.current=!1,he.current=!0,de.which===229||!Ce.current&&de.currentTarget===ee.current)return;if(N&&JO(de.key,A,T,O)){wu(de.key,Se())||cn(de),s.setOpen(!1,qt($u,de.nativeEvent)),Ut(l)&&(R?H?.events.emit("virtualfocus",l):l.focus());return}const me=G.current,ye=gp(f,_),Ae=Ax(f,_);if(U||(de.key==="Home"&&(cn(de),G.current=ye,J(de)),de.key==="End"&&(cn(de),G.current=Ae,J(de))),O>1){const Ie=Y||Array.from({length:f.current.length},()=>({width:1,height:1})),Me=Uk(Ie,O,F),tt=Me.findIndex(pn=>pn!=null&&!wl(f,pn,_)),Ot=Me.reduce((pn,Qt,Oe)=>Qt!=null&&!wl(f,Qt,_)?Oe:pn,-1),Nn=Me[$k({current:Me.map(pn=>pn!=null?f.current[pn]:null)},{event:de,orientation:A,loopFocus:w,rtl:T,cols:O,disabledIndices:Bk([...(typeof _!="function"?_:null)||f.current.map((pn,Qt)=>wl(f,Qt,_)?Qt:void 0),void 0],Me),minIndex:tt,maxIndex:Ot,prevIndex:Vk(G.current>Ae?ye:G.current,Ie,Me,O,de.key===Bl?"bl":de.key===(T?Ga:Xa)?"tr":"tl"),stopEvent:!0})];if(Nn!=null&&(G.current=Nn,J(de)),A==="both")return}if(wu(de.key,A)){if(cn(de),r&&!R&&Ha(de.currentTarget.ownerDocument)===de.currentTarget){G.current=Tp(de.key,A,T)?ye:Ae,J(de);return}Tp(de.key,A,T)?w?me>=Ae?x&&me!==f.current.length?G.current=-1:(he.current=!1,G.current=ye):G.current=fn(f,{startingIndex:me,disabledIndices:_}):G.current=Math.min(Ae,fn(f,{startingIndex:me,disabledIndices:_})):w?me<=ye?x&&me!==-1?G.current=f.current.length:(he.current=!1,G.current=Ae):G.current=fn(f,{startingIndex:me,decrement:!0,disabledIndices:_}):G.current=Math.max(ye,fn(f,{startingIndex:me,decrement:!0,disabledIndices:_})),xl(f,G.current)&&(G.current=-1),J(de)}}),Le=b.useMemo(()=>R&&r&&_e&&{"aria-activedescendant":`${B}-${m}`},[R,r,_e,B,m]),Ze=b.useMemo(()=>({"aria-orientation":A==="both"?void 0:A,...U?{}:Le,onKeyDown(de){if(de.key==="Tab"&&de.shiftKey&&r&&!R){const me=Dn(de.nativeEvent);if(me&&!Nt(ee.current,me))return;cn(de),s.setOpen(!1,qt(Md,de.nativeEvent)),Ut(l)&&l.focus();return}Ue(de)},onPointerMove(){$.current=!0}}),[Le,Ue,ee,A,U,s,r,R,l]),Z=b.useMemo(()=>{function de(ye){C==="auto"&&pE(ye.nativeEvent)&&(ne.current=!R)}function me(ye){ne.current=C,C==="auto"&&mE(ye.nativeEvent)&&(ne.current=!0)}return{onKeyDown(ye){const Ae=s.select("open");$.current=!1;const Ie=ye.key.startsWith("Arrow"),Me=WO(ye.key,Se(),T),tt=wu(ye.key,A),Ot=(N?Me:tt)||ye.key==="Enter"||ye.key.trim()==="";if(R&&Ae)return Ue(ye);if(!(!Ae&&!E&&Ie)){if(Ot){const Nn=wu(ye.key,Se());D.current=N&&Nn?null:ye.key}if(N){Me&&(cn(ye),Ae?(G.current=gp(f,be.current),J(ye)):s.setOpen(!0,qt($u,ye.nativeEvent,ye.currentTarget)));return}tt&&(Re.current!=null&&(G.current=Re.current),cn(ye),!Ae&&E?s.setOpen(!0,qt($u,ye.nativeEvent,ye.currentTarget)):Ue(ye),Ae&&J(ye))}},onFocus(ye){s.select("open")&&!R&&(G.current=-1,J(ye))},onPointerDown:me,onPointerEnter:me,onMouseDown:de,onClick:de}},[Ue,be,C,f,N,J,s,E,A,Se,T,Re,R]),te=b.useMemo(()=>({...Le,...Z}),[Le,Z]);return b.useMemo(()=>y?{reference:te,floating:Ze,item:xe,trigger:Z}:{},[y,te,Ze,Z,xe])}const eD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function tD(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingId"),l=s.useState("domReferenceElement"),u=s.useState("floatingElement"),{enabled:f=!0,role:m="dialog"}=t,h=er(),y=l?.id||h,v=b.useMemo(()=>sd(u)?.id||i,[u,i]),x=eD.get(m)??m,N=ar()!=null,T=b.useMemo(()=>x==="tooltip"||m==="label"?zn:{"aria-haspopup":x==="alertdialog"?"dialog":x,"aria-expanded":"false",...x==="listbox"&&{role:"combobox"},...x==="menu"&&N&&{role:"menuitem"},...m==="select"&&{"aria-autocomplete":"none"},...m==="combobox"&&{"aria-autocomplete":"list"}},[x,N,m]),R=b.useMemo(()=>x==="tooltip"||m==="label"?{[`aria-${m==="label"?"labelledby":"describedby"}`]:r?v:void 0}:{...T,"aria-expanded":r?"true":"false","aria-controls":r?v:void 0,...x==="menu"&&{id:y}},[x,v,r,y,m,T]),C=b.useMemo(()=>{const E={id:v,...x&&{role:x}};return x==="tooltip"||m==="label"?E:{...E,...x==="menu"&&{"aria-labelledby":y}}},[x,v,y,m]),j=b.useCallback(({active:E,selected:_})=>{const A={role:"option",...E&&{id:`${v}-fui-option`}};switch(m){case"select":case"combobox":return{...A,"aria-selected":_}}return{}},[v,m]);return b.useMemo(()=>f?{reference:R,floating:C,item:j,trigger:T}:{},[f,R,C,T,j])}function nD(e,t){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.context.dataRef,{listRef:l,activeIndex:u,onMatch:f,onTypingChange:m,enabled:h=!0,findMatch:y=null,resetMs:v=750,ignoreKeys:x=QS,selectedIndex:w=null}=t,N=Ns(),T=b.useRef(""),R=b.useRef(w??u??-1),C=b.useRef(null);$e(()=>{r&&(N.clear(),C.current=null,T.current="")},[r,N]),$e(()=>{r&&T.current===""&&(R.current=w??u??-1)},[r,w,u]);const j=Be(M=>{M?i.current.typing||(i.current.typing=M,m?.(M)):i.current.typing&&(i.current.typing=M,m?.(M))}),E=Be(M=>{function O(P,X,ie){const ee=y?y(X,ie):X.find(z=>z?.toLocaleLowerCase().indexOf(ie.toLocaleLowerCase())===0);return ee?P.indexOf(ee):-1}const I=l.current;if(T.current.length>0&&T.current[0]!==" "&&(O(I,I,T.current)===-1?j(!1):M.key===" "&&cn(M)),I==null||x.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;r&&M.key!==" "&&(cn(M),j(!0)),I.every(P=>P?P[0]?.toLocaleLowerCase()!==P[1]?.toLocaleLowerCase():!0)&&T.current===M.key&&(T.current="",R.current=C.current),T.current+=M.key,N.start(v,()=>{T.current="",R.current=C.current,j(!1)});const F=R.current,B=O(I,[...I.slice((F||0)+1),...I.slice(0,(F||0)+1)],T.current);B!==-1?(f?.(B),C.current=B):M.key!==" "&&(T.current="",j(!1))}),_=b.useMemo(()=>({onKeyDown:E}),[E]),A=b.useMemo(()=>({onKeyDown:E,onKeyUp(M){M.key===" "&&j(!1)}}),[E,j]);return b.useMemo(()=>h?{reference:_,floating:A}:{},[h,_,A])}const sD=b.createContext(void 0);function aD(e){return b.useContext(sD)}const YE="ArrowUp",GE="ArrowDown",XE="ArrowLeft",KE="ArrowRight",WE="Home",JE="End",rD=new Set([XE,KE]),iD=new Set([YE,GE]),oD=new Set([...rD,...iD]);[...oD];const lD=new Set([YE,GE,XE,KE,WE,JE]);function cD(e){return e==="starting"?x_:zn}const uD={...eE,...R_},dD=b.forwardRef(function(t,s){const{render:r,className:i,finalFocus:l,...u}=t,{store:f}=ro(),{side:m,align:h}=YS(),y=aD()!=null,v=f.useState("open"),x=f.useState("transitionStatus"),w=f.useState("popupProps"),N=f.useState("mounted"),T=f.useState("instantType"),R=f.useState("activeTriggerElement"),C=f.useState("parent"),j=f.useState("lastOpenChangeReason"),E=f.useState("rootId"),_=f.useState("floatingRootContext"),A=f.useState("floatingTreeRoot"),M=f.useState("closeDelay"),O=f.useState("activeTriggerElement");oE({open:v,ref:f.context.popupRef,onComplete(){v&&f.context.onOpenChangeComplete?.(!0)}}),b.useEffect(()=>{function X(ie){f.setOpen(!1,qt(ie.reason,ie.domEvent))}return A.events.on("close",X),()=>{A.events.off("close",X)}},[A.events,f]);const I=f.useState("hoverEnabled"),Y=f.useState("disabled");YO(_,{enabled:I&&!Y&&C.type!=="context-menu"&&C.type!=="menubar",closeDelay:M});const F=b.useMemo(()=>({transitionStatus:x,side:m,align:h,open:v,nested:C.type==="menu",instant:T}),[x,m,h,v,C.type,T]),B=tr("div",t,{state:F,ref:[s,f.context.popupRef],stateAttributesMapping:uD,props:[w,{onKeyDown(X){y&&lD.has(X.key)&&X.stopPropagation()}},cD(x),u,{"data-rootownerid":E}]});let P=C.type===void 0||C.type==="context-menu";return(R||C.type==="menubar"&&j!==ug)&&(P=!0),d.jsx(vM,{context:_,modal:!1,disabled:!N,returnFocus:l===void 0?P:l,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?A:void 0,previousFocusableElement:O,nextFocusableElement:C.type===void 0?f.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?f.context.beforeContentFocusGuardRef:void 0,children:B})}),QE=b.createContext(void 0);function fD(){const e=b.useContext(QE);if(e===void 0)throw new Error(Fr(32));return e}const hD=b.forwardRef(function(t,s){const{keepMounted:r=!1,...i}=t,{store:l}=ro();return l.useState("mounted")||r?d.jsx(QE.Provider,{value:r,children:d.jsx(hM,{ref:s,...i})}):null});function pD(e){return lg(19)?e:e?"true":void 0}const mD=b.createContext(void 0);function eN(){return b.useContext(mD)?.direction??"ltr"}const gD=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:r,placement:i,rects:l,platform:u,elements:f,middlewareData:m}=t,{element:h,padding:y=0,offsetParent:v="real"}=fa(e,t)||{};if(h==null)return{};const x=gE(y),w={x:s,y:r},N=yg(i),T=gg(N),R=await u.getDimensions(h),C=N==="y",j=C?"top":"left",E=C?"bottom":"right",_=C?"clientHeight":"clientWidth",A=l.reference[T]+l.reference[N]-w[N]-l.floating[T],M=w[N]-l.reference[N],O=v==="real"?await u.getOffsetParent?.(h):f.floating;let I=f.floating[_]||l.floating[T];(!I||!await u.isElement?.(O))&&(I=f.floating[_]||l.floating[T]);const Y=A/2-M/2,F=I/2-R[T]/2-1,B=Math.min(x[j],F),P=Math.min(x[E],F),X=B,ie=I-R[T]-P,ee=I/2-R[T]/2+Y,z=hm(X,ee,ie),H=!m.arrow&&sr(i)!=null&&ee!==z&&l.reference[T]/2-(ee<X?B:P)-R[T]/2<0,U=H?ee<X?ee-X:ee-ie:0;return{[N]:w[N]+U,data:{[N]:z,centerOffset:ee-z-U,...H&&{alignmentOffset:U}},reset:H}}}),yD=(e,t)=>({...gD(e),options:[e,t]}),vD={name:"hide",async fn(e){const{width:t,height:s,x:r,y:i}=e.rects.reference,l=t===0&&s===0&&r===0&&i===0;return{data:{referenceHidden:(await rO().fn(e)).data?.referenceHidden||l}}}},bD={sideX:"left",sideY:"top"};function tN(e,t,s){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?s?"inline-start":"inline-end":"right",bottom:"bottom",left:r?s?"inline-end":"inline-start":"left"}[t]}function Wx(e,t,s){const{rects:r,placement:i}=e;return{side:tN(t,qn(i),s),align:sr(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function xD(e){const{anchor:t,positionMethod:s="absolute",side:r="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,collisionBoundary:f,collisionPadding:m=5,sticky:h=!1,arrowPadding:y=5,disableAnchorTracking:v=!1,keepMounted:x=!1,floatingRootContext:w,mounted:N,collisionAvoidance:T,shiftCrossAxis:R=!1,nodeId:C,adaptiveOrigin:j,lazyFlip:E=!1,externalTree:_}=e,[A,M]=b.useState(null);!N&&A!==null&&M(null);const O=T.side||"flip",I=T.align||"flip",Y=T.fallbackAxisSide||"end",F=typeof t=="function"?t:void 0,B=Be(F),P=F?B:t,X=On(t),ee=eN()==="rtl",z=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ee?"left":"right","inline-start":ee?"right":"left"}[r],H=l==="center"?z:`${z}-${l}`;let U=m;const ne=1,G=r==="bottom"?ne:0,D=r==="top"?ne:0,$=r==="right"?ne:0,J=r==="left"?ne:0;typeof U=="number"?U={top:U+G,right:U+J,bottom:U+D,left:U+$}:U&&(U={top:(U.top||0)+G,right:(U.right||0)+J,bottom:(U.bottom||0)+D,left:(U.left||0)+$});const re={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:U},se=b.useRef(null),ge=On(i),he=On(u),Ce=[eO(yt=>{const Lt=Wx(yt,r,ee),mn=typeof ge.current=="function"?ge.current(Lt):ge.current,Gt=typeof he.current=="function"?he.current(Lt):he.current;return{mainAxis:mn,crossAxis:Gt,alignmentAxis:Gt}},[typeof i!="function"?i:0,typeof u!="function"?u:0,ee,r])],fe=I==="none"&&O!=="shift",Re=!fe&&(h||R||O==="shift"),we=O==="none"?null:sO({...re,padding:{top:U.top+ne,right:U.right+ne,bottom:U.bottom+ne,left:U.left+ne},mainAxis:!R&&O==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:Y}),Pe=fe?null:tO(yt=>{const Lt=Ur(yt.elements.floating).documentElement;return{...re,rootBoundary:R?{x:0,y:0,width:Lt.clientWidth,height:Lt.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:Re,limiter:h||R?void 0:nO(mn=>{if(!se.current)return{};const{width:Gt,height:Tn}=se.current.getBoundingClientRect(),en=ls(qn(mn.placement)),gn=en==="y"?Gt:Tn,pa=en==="y"?U.left+U.right:U.top+U.bottom;return{offset:gn/2+pa/2}})}},[re,h,R,U,I]);O==="shift"||I==="shift"||l==="center"?Ce.push(Pe,we):Ce.push(we,Pe),Ce.push(aO({...re,apply({elements:{floating:yt},rects:{reference:Lt},availableWidth:mn,availableHeight:Gt}){Object.entries({"--available-width":`${mn}px`,"--available-height":`${Gt}px`,"--anchor-width":`${Lt.width}px`,"--anchor-height":`${Lt.height}px`}).forEach(([Tn,en])=>{yt.style.setProperty(Tn,en)})}}),yD(()=>({element:se.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(yt){const{elements:Lt,middlewareData:mn,placement:Gt,rects:Tn,y:en}=yt,gn=qn(Gt),pa=ls(gn),ma=se.current,Wd=mn.arrow?.x||0,Wl=mn.arrow?.y||0,mo=ma?.clientWidth||0,cr=ma?.clientHeight||0,go=Wd+mo/2,yo=Wl+cr/2,Jl=Math.abs(mn.shift?.y||0),Ql=Tn.reference.height/2,Hs=typeof i=="function"?i(Wx(yt,r,ee)):i,vo=Jl>Hs,ec={top:`${go}px calc(100% + ${Hs}px)`,bottom:`${go}px ${-Hs}px`,left:`calc(100% + ${Hs}px) ${yo}px`,right:`${-Hs}px ${yo}px`}[gn],tc=`${go}px ${Tn.reference.y+Ql-en}px`;return Lt.floating.style.setProperty("--transform-origin",Re&&pa==="y"&&vo?tc:ec),{}}},vD,j),$e(()=>{!N&&w&&w.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[N,w]);const _e=b.useMemo(()=>({elementResize:!v&&typeof ResizeObserver<"u",layoutShift:!v&&typeof IntersectionObserver<"u"}),[v]),{refs:xe,elements:Se,x:Ue,y:Le,middlewareData:Ze,update:Z,placement:te,context:de,isPositioned:me,floatingStyles:ye}=VO({rootContext:w,placement:H,middleware:Ce,strategy:s,whileElementsMounted:x?void 0:(...yt)=>Vx(...yt,_e),nodeId:C,externalTree:_}),{sideX:Ae,sideY:Ie}=Ze.adaptiveOrigin||bD,Me=me?s:"fixed",tt=b.useMemo(()=>j?{position:Me,[Ae]:Ue,[Ie]:Le}:{position:Me,...ye},[j,Me,Ae,Ue,Ie,Le,ye]),Ot=b.useRef(null);$e(()=>{if(!N)return;const yt=X.current,Lt=typeof yt=="function"?yt():yt,Gt=(Jx(Lt)?Lt.current:Lt)||null||null;Gt!==Ot.current&&(xe.setPositionReference(Gt),Ot.current=Gt)},[N,xe,P,X]),b.useEffect(()=>{if(!N)return;const yt=X.current;typeof yt!="function"&&Jx(yt)&&yt.current!==Ot.current&&(xe.setPositionReference(yt.current),Ot.current=yt.current)},[N,xe,P,X]),b.useEffect(()=>{if(x&&N&&Se.domReference&&Se.floating)return Vx(Se.domReference,Se.floating,Z,_e)},[x,N,Se,Z,_e]);const Nn=qn(te),pn=tN(r,Nn,ee),Qt=sr(te)||"center",Oe=!!Ze.hide?.referenceHidden;$e(()=>{E&&N&&me&&M(Nn)},[E,N,me,Nn]);const nt=b.useMemo(()=>({position:"absolute",top:Ze.arrow?.y,left:Ze.arrow?.x}),[Ze.arrow]),at=Ze.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:tt,arrowStyles:nt,arrowRef:se,arrowUncentered:at,side:pn,align:Qt,physicalSide:Nn,anchorHidden:Oe,refs:xe,context:de,isPositioned:me,update:Z}),[tt,nt,se,at,pn,Qt,Nn,Oe,xe,de,me,Z])}function Jx(e){return e!=null&&"current"in e}function wD(e){const{children:t,elementsRef:s,labelsRef:r,onMapChange:i}=e,l=Be(i),u=b.useRef(0),f=ds(ED).current,m=ds(SD).current,[h,y]=b.useState(0),v=b.useRef(h),x=Be((C,j)=>{m.set(C,j??null),v.current+=1,y(v.current)}),w=Be(C=>{m.delete(C),v.current+=1,y(v.current)}),N=b.useMemo(()=>{const C=new Map;return Array.from(m.keys()).filter(E=>E.isConnected).sort(ND).forEach((E,_)=>{const A=m.get(E)??{};C.set(E,{...A,index:_})}),C},[m,h]);$e(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const C=new MutationObserver(j=>{const E=new Set,_=A=>E.has(A)?E.delete(A):E.add(A);j.forEach(A=>{A.removedNodes.forEach(_),A.addedNodes.forEach(_)}),E.size===0&&(v.current+=1,y(v.current))});return N.forEach((j,E)=>{E.parentElement&&C.observe(E.parentElement,{childList:!0})}),()=>{C.disconnect()}},[N]),$e(()=>{v.current===h&&(s.current.length!==N.size&&(s.current.length=N.size),r&&r.current.length!==N.size&&(r.current.length=N.size),u.current=N.size),l(N)},[l,N,s,r,h]),$e(()=>()=>{s.current=[]},[s]),$e(()=>()=>{r&&(r.current=[])},[r]);const T=Be(C=>(f.add(C),()=>{f.delete(C)}));$e(()=>{f.forEach(C=>C(N))},[f,N]);const R=b.useMemo(()=>({register:x,unregister:w,subscribeMapChange:T,elementsRef:s,labelsRef:r,nextIndexRef:u}),[x,w,T,s,r,u]);return d.jsx(aE.Provider,{value:R,children:t})}function SD(){return new Map}function ED(){return new Set}function ND(e,t){const s=e.compareDocumentPosition(t);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const TD=b.forwardRef(function(t,s){const{cutout:r,...i}=t;let l;if(r){const u=r?.getBoundingClientRect();l=`polygon(
10
- 0% 0%,
11
- 100% 0%,
12
- 100% 100%,
13
- 0% 100%,
14
- 0% 0%,
15
- ${u.left}px ${u.top}px,
16
- ${u.left}px ${u.bottom}px,
17
- ${u.right}px ${u.bottom}px,
18
- ${u.right}px ${u.top}px,
19
- ${u.left}px ${u.top}px
20
- )`}return d.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),jD=b.forwardRef(function(t,s){const{anchor:r,positionMethod:i="absolute",className:l,render:u,side:f,align:m,sideOffset:h=0,alignOffset:y=0,collisionBoundary:v="clipping-ancestors",collisionPadding:x=5,arrowPadding:w=5,sticky:N=!1,disableAnchorTracking:T=!1,collisionAvoidance:R=S_,...C}=t,{store:j}=ro(),E=fD(),_=_d(!0),A=j.useState("parent"),M=j.useState("floatingRootContext"),O=j.useState("floatingTreeRoot"),I=j.useState("mounted"),Y=j.useState("open"),F=j.useState("modal"),B=j.useState("activeTriggerElement"),P=j.useState("lastOpenChangeReason"),X=j.useState("floatingNodeId"),ie=j.useState("floatingParentNodeId");let ee=r,z=h,H=y,U=m;A.type==="context-menu"&&(ee=r??A.context?.anchor,U=U??"start",!f&&U!=="center"&&(H=t.alignOffset??2,z=t.sideOffset??-5));let ne=f,G=U;A.type==="menu"?(ne=ne??"inline-end",G=G??"start"):A.type==="menubar"&&(ne=ne??"bottom",G=G??"start");const D=A.type==="context-menu",$=xD({anchor:ee,floatingRootContext:M,positionMethod:_?"fixed":i,mounted:I,side:ne,sideOffset:z,align:G,alignOffset:H,arrowPadding:D?0:w,collisionBoundary:v,collisionPadding:x,sticky:N,nodeId:X,keepMounted:E,disableAnchorTracking:T,collisionAvoidance:R,shiftCrossAxis:D,externalTree:O}),J=b.useMemo(()=>{const be={};return Y||(be.pointerEvents="none"),{role:"presentation",hidden:!I,style:{...$.positionerStyles,...be}}},[Y,I,$.positionerStyles]);b.useEffect(()=>{function be(Ce){Ce.open?(Ce.parentNodeId===X&&j.set("hoverEnabled",!1),Ce.nodeId!==X&&Ce.parentNodeId===j.select("floatingParentNodeId")&&j.setOpen(!1,qt(hl))):Ce.parentNodeId===X&&Ce.reason!==hl&&j.set("hoverEnabled",!0)}return O.events.on("menuopenchange",be),()=>{O.events.off("menuopenchange",be)}},[j,O.events,X]),b.useEffect(()=>{if(j.select("floatingParentNodeId")==null)return;function be(Ce){if(Ce.open||Ce.nodeId!==j.select("floatingParentNodeId"))return;const fe=Ce.reason??hl;j.setOpen(!1,qt(fe))}return O.events.on("menuopenchange",be),()=>{O.events.off("menuopenchange",be)}},[O.events,j]),b.useEffect(()=>{function be(Ce){!Y||Ce.nodeId!==j.select("floatingParentNodeId")||Ce.target&&B&&B!==Ce.target&&j.setOpen(!1,qt(hl))}return O.events.on("itemhover",be),()=>{O.events.off("itemhover",be)}},[O.events,Y,B,j]),b.useEffect(()=>{const be={open:Y,nodeId:X,parentNodeId:ie,reason:j.select("lastOpenChangeReason")};O.events.emit("menuopenchange",be)},[O.events,Y,j,X,ie]);const re=b.useMemo(()=>({open:Y,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:A.type==="menu"}),[Y,$.side,$.align,$.anchorHidden,A.type]),se=b.useMemo(()=>({side:$.side,align:$.align,arrowRef:$.arrowRef,arrowUncentered:$.arrowUncentered,arrowStyles:$.arrowStyles,nodeId:$.context.nodeId}),[$.side,$.align,$.arrowRef,$.arrowUncentered,$.arrowStyles,$.context.nodeId]),ge=tr("div",t,{state:re,stateAttributesMapping:eE,ref:[s,j.useStateSetter("positionerElement")],props:[J,C]}),he=I&&A.type!=="menu"&&(A.type!=="menubar"&&F&&P!==Ir||A.type==="menubar"&&A.context.modal);let pe=null;return A.type==="menubar"?pe=A.context.contentElement:A.type===void 0&&(pe=B),d.jsxs(qS.Provider,{value:se,children:[he&&d.jsx(TD,{ref:A.type==="context-menu"||A.type==="nested-context-menu"?A.context.internalBackdropRef:null,inert:pD(!Y),cutout:pe}),d.jsx(iM,{id:X,children:d.jsx(wD,{elementsRef:j.context.itemDomElements,labelsRef:j.context.itemLabels,children:ge})})]})});let Qx={},e1={},t1="";function CD(e){if(typeof document>"u")return!1;const t=Ur(e);return un(t).innerWidth-t.documentElement.clientWidth>0}function AD(e){const t=Ur(e),s=t.documentElement,r=t.body,i=qr(s)?s:r,l=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=l}}function RD(e){const t=Ur(e),s=t.documentElement,r=t.body,i=un(s);let l=0,u=0;const f=zs.create(),m=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(gk&&(i.visualViewport?.scale??1)!==1)return()=>{};function h(){const x=i.getComputedStyle(s),w=i.getComputedStyle(r),R=(x.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=s.scrollTop,u=s.scrollLeft,Qx={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},t1=s.style.scrollBehavior,e1={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 C=s.scrollHeight>s.clientHeight,j=s.scrollWidth>s.clientWidth,E=x.overflowY==="scroll"||w.overflowY==="scroll",_=x.overflowX==="scroll"||w.overflowX==="scroll",A=Math.max(0,i.innerWidth-s.clientWidth),M=Math.max(0,i.innerHeight-s.clientHeight),O=parseFloat(w.marginTop)+parseFloat(w.marginBottom),I=parseFloat(w.marginLeft)+parseFloat(w.marginRight),Y=qr(s)?s:r;if(m){s.style.scrollbarGutter=R,Y.style.overflowY="hidden",Y.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(C||E)&&(s.style.overflowY="scroll"),(j||_)&&(s.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:O||M?`calc(100dvh - ${O+M}px)`:"100dvh",width:I||A?`calc(100vw - ${I+A}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=l,r.scrollLeft=u,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function y(){Object.assign(s.style,Qx),Object.assign(r.style,e1),m||(s.scrollTop=l,s.scrollLeft=u,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=t1)}function v(){y(),f.request(h)}return h(),i.addEventListener("resize",v),()=>{f.cancel(),y(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",v)}}class _D{lockCount=0;restore=null;timeoutLock=Wi.create();timeoutUnlock=Wi.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 r=Ur(t).documentElement,i=un(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=JS;return}const l=yk||!CD(t);this.restore=l?AD(t):RD(t)}}const kD=new _D;function MD(e=!0,t=null){$e(()=>{if(e)return kD.acquire(t)},[e,t])}const OD=b.createContext(null);function DD(e){return b.useContext(OD)}function zD(e){const t=b.useRef(""),s=b.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:b.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i&&e(i,i.pointerType),e(i,t.current),t.current=""},[e]),onPointerDown:s}}function ID(e){const[t,s]=b.useState(null),r=Be((f,m)=>{e||s(m)}),i=b.useCallback(()=>{s(null)},[]),{onClick:l,onPointerDown:u}=zD(r);return b.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:l,onPointerDown:u}}),[t,i,l,u])}const LD={...$O,disabled:Ye(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ye(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ye(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ye(e=>e.stickIfOpen),parent:Ye(e=>e.parent),rootId:Ye(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ye(e=>e.activeIndex),isActive:Ye((e,t)=>e.activeIndex===t),hoverEnabled:Ye(e=>e.hoverEnabled),instantType:Ye(e=>e.instantType),lastOpenChangeReason:Ye(e=>e.openChangeReason),floatingTreeRoot:Ye(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ye(e=>e.floatingNodeId),floatingParentNodeId:Ye(e=>e.floatingParentNodeId),itemProps:Ye(e=>e.itemProps),closeDelay:Ye(e=>e.closeDelay),keyboardEventRelay:Ye(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Sg extends qE{constructor(t){super({...PD(),...t},{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 wg},LD),this.observe(Ye(s=>s.allowMouseEnter),(s,r)=>{this.state.parent.type==="menu"&&s!==r&&this.state.parent.store.set("allowMouseEnter",s)}),this.unsubscribeParentListener=this.observe("parent",s=>{if(this.unsubscribeParentListener?.(),s.type==="menu"){this.unsubscribeParentListener=s.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=s.store.context.allowMouseUpTriggerRef;return}s.type!==void 0&&(this.context.allowMouseUpTriggerRef=s.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,s){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:s})}static useStore(t,s){return ds(()=>t??new Sg(s)).current}unsubscribeParentListener=null}function PD(){return{...PO(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new AE,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:zn,keyboardEventRelay:void 0,closeDelay:0}}const $D=b.createContext(void 0);function UD(){return b.useContext($D)}function VD(e){const{children:t,open:s,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:l=!1,disabled:u=!1,modal:f,loopFocus:m=!0,orientation:h="vertical",actionsRef:y,closeParentOnEsc:v=!0,handle:x,triggerId:w,defaultTriggerId:N=null,highlightItemOnHover:T=!0}=e,R=_d(!0),C=ro(!0),j=DD(),E=UD(),_=b.useMemo(()=>E&&C?{type:"menu",store:C.store}:j?{type:"menubar",context:j}:R&&!C?{type:"context-menu",context:R}:{type:void 0},[R,C,j,E]),A=Sg.useStore(x?.store,{parent:_}),M=A.useState("floatingTreeRoot"),O=rM(M),I=ar();$e(()=>{R&&!C?A.update({parent:{type:"context-menu",context:R},floatingNodeId:O,floatingParentNodeId:I}):C&&A.update({floatingNodeId:O,floatingParentNodeId:I})},[R,C,O,I,A]),A.useControlledProp("open",s,l),A.useControlledProp("activeTriggerId",w,N),A.useContextCallback("onOpenChangeComplete",i);const Y=A.useState("open"),F=A.useState("activeTriggerElement"),B=A.useState("positionerElement"),P=A.useState("hoverEnabled"),X=A.useState("modal"),ie=A.useState("disabled"),ee=A.useState("lastOpenChangeReason"),z=A.useState("parent"),H=A.useState("activeIndex"),U=A.useState("payload"),ne=A.useState("floatingParentNodeId"),G=b.useRef(null),D=ne!=null;let $;A.useSyncedValues({disabled:u,modal:z.type===void 0?f:void 0,rootId:er()});const{openMethod:J,triggerProps:re,reset:se}=ID(Y);zO(A);const{forceUnmount:ge}=IO(Y,A,()=>{A.update({allowMouseEnter:!1,stickIfOpen:!0}),se()}),he=b.useRef(z.type!=="context-menu"),pe=Ns();b.useEffect(()=>{if(Y||(G.current=null),z.type==="context-menu"){if(!Y){pe.clear(),he.current=!1;return}pe.start(500,()=>{he.current=!0})}},[pe,Y,z.type]),MD(Y&&X&&ee!==Ir&&J!=="touch",B),$e(()=>{!Y&&!P&&A.set("hoverEnabled",!0)},[Y,P,A]);const be=b.useRef(!0),Ce=Ns(),fe=Be((Oe,nt)=>{const at=nt.reason;if(Y===Oe&&nt.trigger===F||(nt.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},!Oe&&nt.trigger==null&&(nt.trigger=F??void 0),r?.(Oe,nt),nt.isCanceled))return;const yt={open:Oe,nativeEvent:nt.event,reason:nt.reason,nested:D};$?.emit("openchange",yt);const Lt=nt.event;if(Oe===!1&&Lt?.type==="click"&&Lt.pointerType==="touch"&&!be.current)return;if(!Oe&&H!==null){const en=A.context.itemDomElements.current[H];queueMicrotask(()=>{en?.setAttribute("tabindex","-1")})}Oe&&at===Nx?(be.current=!1,Ce.start(300,()=>{be.current=!0})):(be.current=!0,Ce.clear());const mn=(at===nd||at===tE)&&Lt.detail===0&&Lt?.isTrusted,Gt=!Oe&&(at===nE||at==null);function Tn(){const en={open:Oe,openChangeReason:at};G.current=nt.event??null;const gn=nt.trigger?.id??null;(gn||Oe)&&(en.activeTriggerId=gn,en.activeTriggerElement=nt.trigger??null),A.update(en)}at===Ir?$r.flushSync(Tn):Tn(),z.type==="menubar"&&(at===Nx||at===Md||at===Ir||at===$u||at===hl)?A.set("instantType","group"):mn||Gt?A.set("instantType",mn?"click":"dismiss"):A.set("instantType",void 0)}),Re=b.useCallback(Oe=>{const nt=qt(Oe);return nt.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},nt},[A]),we=b.useCallback(()=>{A.setOpen(!1,Re(L_))},[A,Re]);b.useImperativeHandle(y,()=>({unmount:ge,close:we}),[ge,we]);let Pe;z.type==="context-menu"&&(Pe=z.context),b.useImperativeHandle(Pe?.positionerRef,()=>B,[B]),b.useImperativeHandle(Pe?.actionsRef,()=>({setOpen:fe}),[fe]);const _e=BO({popupStore:A,onOpenChange:fe});$=_e.context.events,b.useEffect(()=>{const Oe=({open:nt,eventDetails:at})=>fe(nt,at);return $.on("setOpen",Oe),()=>{$?.off("setOpen",Oe)}},[$,fe]);const xe=lO(_e,{enabled:!ie,bubbles:v&&z.type==="menu",outsidePress(){return z.type!=="context-menu"||G.current?.type==="contextmenu"?!0:he.current},externalTree:D?M:void 0}),Se=tD(_e,{role:"menu"}),Ue=eN(),Le=b.useCallback(Oe=>{A.select("activeIndex")!==Oe&&A.set("activeIndex",Oe)},[A]),Ze=QO(_e,{enabled:!ie,listRef:A.context.itemDomElements,activeIndex:H,nested:z.type!==void 0,loopFocus:m,orientation:h,parentOrientation:z.type==="menubar"?z.context.orientation:void 0,rtl:Ue==="rtl",disabledIndices:QS,onNavigate:Le,openOnArrowKeyDown:z.type!=="context-menu",externalTree:D?M:void 0,focusItemOnHover:T}),Z=b.useCallback(Oe=>{A.context.typingRef.current=Oe},[A]),te=nD(_e,{listRef:A.context.itemLabels,activeIndex:H,resetMs:b_,onMatch:Oe=>{Y&&Oe!==H&&A.set("activeIndex",Oe)},onTypingChange:Z}),{getReferenceProps:de,getFloatingProps:me,getItemProps:ye,getTriggerProps:Ae}=XO([xe,Se,Ze,te]),Ie=b.useMemo(()=>{const Oe=kd(de(),{onMouseEnter(){A.set("hoverEnabled",!0)},onMouseMove(){A.set("allowMouseEnter",!0)}},re);return delete Oe.role,Oe},[de,A,re]),Me=b.useMemo(()=>{const Oe=Ae();if(!Oe)return Oe;const{role:nt,["aria-controls"]:at,...yt}=Oe;return yt},[Ae]),tt=hg(),Ot=b.useMemo(()=>me({onMouseEnter(){z.type==="menu"&&tt.request(()=>A.set("hoverEnabled",!1))},onMouseMove(){A.set("allowMouseEnter",!0)},onClick(){A.select("hoverEnabled")&&A.set("hoverEnabled",!1)},onKeyDown(Oe){const nt=A.select("keyboardEventRelay");nt&&!Oe.isPropagationStopped()&&nt(Oe)}}),[me,z.type,tt,A]),Nn=b.useMemo(()=>ye(),[ye]);A.useSyncedValues({floatingRootContext:_e,activeTriggerProps:Ie,inactiveTriggerProps:Me,popupProps:Ot,itemProps:Nn});const pn=b.useMemo(()=>({store:A,parent:_}),[A,_]),Qt=d.jsx(og.Provider,{value:pn,children:typeof t=="function"?t({payload:U}):t});return z.type===void 0||z.type==="context-menu"?d.jsx(oM,{externalTree:M,children:Qt}):Qt}function nN(e){if(Ut(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Ls(e))return nN(Us(e))}const BD=b.forwardRef(function(t,s){const{className:r,render:i,orientation:l="horizontal",...u}=t,f=b.useMemo(()=>({orientation:l}),[l]);return tr("div",t,{state:f,ref:s,props:[{role:"separator","aria-orientation":l},u]})});function ZD(e){const[t,s]=b.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=b.useRef(null),i=b.useRef(null),l=b.useRef(null),u=b.useRef(null),f=b.useRef(!0),m=b.useRef(null),h=er(),y=b.useMemo(()=>({anchor:t,setAnchor:s,actionsRef:l,backdropRef:r,internalBackdropRef:i,positionerRef:u,allowMouseUpTriggerRef:f,initialCursorPointRef:m,rootId:h}),[t,h]);return d.jsx(FS.Provider,{value:y,children:d.jsx(og.Provider,{value:void 0,children:d.jsx(VD,{...e})})})}const n1=500,HD=b.forwardRef(function(t,s){const{render:r,className:i,...l}=t,{setAnchor:u,actionsRef:f,internalBackdropRef:m,backdropRef:h,positionerRef:y,allowMouseUpTriggerRef:v,initialCursorPointRef:x,rootId:w}=_d(!1),{store:N}=ro(!1),T=N.useState("open"),R=b.useRef(null),C=b.useRef(null),j=Ns(),E=Ns(),_=b.useRef(!1);function A(P,X,ie){const ee=ie.type.startsWith("touch");x.current={x:P,y:X},u({getBoundingClientRect(){return DOMRect.fromRect({width:ee?10:0,height:ee?10:0,x:P,y:X})}}),_.current=!1,f.current?.setOpen(!0,qt(nd,ie)),E.start(n1,()=>{_.current=!0})}function M(P){v.current=!0,cn(P),A(P.clientX,P.clientY,P.nativeEvent),Ur(R.current).addEventListener("mouseup",ie=>{if(v.current=!1,!_.current)return;E.clear(),_.current=!1;const ee=Dn(ie);Nt(y.current,ee)||w&&ee&&nN(ee)===w||f.current?.setOpen(!1,qt(I_,ie))},{once:!0})}function O(P){if(v.current=!1,P.touches.length===1){P.stopPropagation();const X=P.touches[0];C.current={x:X.clientX,y:X.clientY},j.start(n1,()=>{C.current&&A(C.current.x,C.current.y,P.nativeEvent)})}}function I(P){if(j.isStarted()&&C.current&&P.touches.length===1){const X=P.touches[0],ie=10,ee=Math.abs(X.clientX-C.current.x),z=Math.abs(X.clientY-C.current.y);(ee>ie||z>ie)&&j.clear()}}function Y(){j.clear(),C.current=null}b.useEffect(()=>{function P(ie){const z=Dn(ie);(Nt(R.current,z)||Nt(m.current,z)||Nt(h.current,z))&&ie.preventDefault()}const X=Ur(R.current);return X.addEventListener("contextmenu",P),()=>{X.removeEventListener("contextmenu",P)}},[h,m]);const F=b.useMemo(()=>({open:T}),[T]);return tr("div",t,{state:F,ref:[R,s],props:[{onContextMenu:M,onTouchStart:O,onTouchMove:I,onTouchEnd:Y,onTouchCancel:Y,style:{WebkitTouchCallout:"none"}},l],stateAttributesMapping:D_})}),Eg=b.createContext({});function Ng(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const sN=typeof window<"u",aN=sN?b.useLayoutEffect:b.useEffect,Ud=b.createContext(null);function Tg(e,t){e.indexOf(t)===-1&&e.push(t)}function pd(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Vs=(e,t,s)=>s>t?t:s<e?e:s;let jg=()=>{};const ha={},rN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function iN(e){return typeof e=="object"&&e!==null}const oN=e=>/^0[^.\s]+$/u.test(e);function lN(e){let t;return()=>(t===void 0&&(t=e()),t)}const us=e=>e,FD=(e,t)=>s=>t(e(s)),Hl=(...e)=>e.reduce(FD),_l=(e,t,s)=>{const r=t-e;return r===0?1:(s-e)/r};class Cg{constructor(){this.subscriptions=[]}add(t){return Tg(this.subscriptions,t),()=>pd(this.subscriptions,t)}notify(t,s,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,s,r);else for(let l=0;l<i;l++){const u=this.subscriptions[l];u&&u(t,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ss=e=>e*1e3,cs=e=>e/1e3;function cN(e,t){return t?e*(1e3/t):0}const uN=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,qD=1e-7,YD=12;function GD(e,t,s,r,i){let l,u,f=0;do u=t+(s-t)/2,l=uN(u,r,i)-e,l>0?s=u:t=u;while(Math.abs(l)>qD&&++f<YD);return u}function Fl(e,t,s,r){if(e===t&&s===r)return us;const i=l=>GD(l,0,1,e,s);return l=>l===0||l===1?l:uN(i(l),t,r)}const dN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fN=e=>t=>1-e(1-t),hN=Fl(.33,1.53,.69,.99),Ag=fN(hN),pN=dN(Ag),mN=e=>(e*=2)<1?.5*Ag(e):.5*(2-Math.pow(2,-10*(e-1))),Rg=e=>1-Math.sin(Math.acos(e)),gN=fN(Rg),yN=dN(Rg),XD=Fl(.42,0,1,1),KD=Fl(0,0,.58,1),vN=Fl(.42,0,.58,1),WD=e=>Array.isArray(e)&&typeof e[0]!="number",bN=e=>Array.isArray(e)&&typeof e[0]=="number",JD={linear:us,easeIn:XD,easeInOut:vN,easeOut:KD,circIn:Rg,circInOut:yN,circOut:gN,backIn:Ag,backInOut:pN,backOut:hN,anticipate:mN},QD=e=>typeof e=="string",s1=e=>{if(bN(e)){jg(e.length===4);const[t,s,r,i]=e;return Fl(t,s,r,i)}else if(QD(e))return JD[e];return e},Su=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function ez(e,t){let s=new Set,r=new Set,i=!1,l=!1;const u=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function m(y){u.has(y)&&(h.schedule(y),e()),y(f)}const h={schedule:(y,v=!1,x=!1)=>{const N=x&&i?s:r;return v&&u.add(y),N.has(y)||N.add(y),y},cancel:y=>{r.delete(y),u.delete(y)},process:y=>{if(f=y,i){l=!0;return}i=!0,[s,r]=[r,s],s.forEach(m),s.clear(),i=!1,l&&(l=!1,h.process(y))}};return h}const tz=40;function xN(e,t){let s=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=Su.reduce((E,_)=>(E[_]=ez(l),E),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:y,update:v,preRender:x,render:w,postRender:N}=u,T=()=>{const E=ha.useManualTiming?i.timestamp:performance.now();s=!1,ha.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(E-i.timestamp,tz),1)),i.timestamp=E,i.isProcessing=!0,f.process(i),m.process(i),h.process(i),y.process(i),v.process(i),x.process(i),w.process(i),N.process(i),i.isProcessing=!1,s&&t&&(r=!1,e(T))},R=()=>{s=!0,r=!0,i.isProcessing||e(T)};return{schedule:Su.reduce((E,_)=>{const A=u[_];return E[_]=(M,O=!1,I=!1)=>(s||R(),A.schedule(M,O,I)),E},{}),cancel:E=>{for(let _=0;_<Su.length;_++)u[Su[_]].cancel(E)},state:i,steps:u}}const{schedule:vt,cancel:Wa,state:on,steps:jp}=xN(typeof requestAnimationFrame<"u"?requestAnimationFrame:us,!0);let Bu;function nz(){Bu=void 0}const wn={now:()=>(Bu===void 0&&wn.set(on.isProcessing||ha.useManualTiming?on.timestamp:performance.now()),Bu),set:e=>{Bu=e,queueMicrotask(nz)}},wN=e=>t=>typeof t=="string"&&t.startsWith(e),SN=wN("--"),sz=wN("var(--"),_g=e=>sz(e)?az.test(e.split("/*")[0].trim()):!1,az=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function a1(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const lo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},kl={...lo,transform:e=>Vs(0,1,e)},Eu={...lo,default:1},Nl=e=>Math.round(e*1e5)/1e5,kg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function rz(e){return e==null}const iz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Mg=(e,t)=>s=>!!(typeof s=="string"&&iz.test(s)&&s.startsWith(e)||t&&!rz(s)&&Object.prototype.hasOwnProperty.call(s,t)),EN=(e,t,s)=>r=>{if(typeof r!="string")return r;const[i,l,u,f]=r.match(kg);return{[e]:parseFloat(i),[t]:parseFloat(l),[s]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},oz=e=>Vs(0,255,e),Cp={...lo,transform:e=>Math.round(oz(e))},Or={test:Mg("rgb","red"),parse:EN("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:r=1})=>"rgba("+Cp.transform(e)+", "+Cp.transform(t)+", "+Cp.transform(s)+", "+Nl(kl.transform(r))+")"};function lz(e){let t="",s="",r="",i="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,s+=s,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const ym={test:Mg("#"),parse:lz,transform:Or.transform},ql=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ua=ql("deg"),$s=ql("%"),Ne=ql("px"),cz=ql("vh"),uz=ql("vw"),r1={...$s,parse:e=>$s.parse(e)/100,transform:e=>$s.transform(e*100)},$i={test:Mg("hsl","hue"),parse:EN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+$s.transform(Nl(t))+", "+$s.transform(Nl(s))+", "+Nl(kl.transform(r))+")"},Ft={test:e=>Or.test(e)||ym.test(e)||$i.test(e),parse:e=>Or.test(e)?Or.parse(e):$i.test(e)?$i.parse(e):ym.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Or.transform(e):$i.transform(e),getAnimatableNone:e=>{const t=Ft.parse(e);return t.alpha=0,Ft.transform(t)}},dz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fz(e){return isNaN(e)&&typeof e=="string"&&(e.match(kg)?.length||0)+(e.match(dz)?.length||0)>0}const NN="number",TN="color",hz="var",pz="var(",i1="${}",mz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ml(e){const t=e.toString(),s=[],r={color:[],number:[],var:[]},i=[];let l=0;const f=t.replace(mz,m=>(Ft.test(m)?(r.color.push(l),i.push(TN),s.push(Ft.parse(m))):m.startsWith(pz)?(r.var.push(l),i.push(hz),s.push(m)):(r.number.push(l),i.push(NN),s.push(parseFloat(m))),++l,i1)).split(i1);return{values:s,split:f,indexes:r,types:i}}function jN(e){return Ml(e).values}function CN(e){const{split:t,types:s}=Ml(e),r=t.length;return i=>{let l="";for(let u=0;u<r;u++)if(l+=t[u],i[u]!==void 0){const f=s[u];f===NN?l+=Nl(i[u]):f===TN?l+=Ft.transform(i[u]):l+=i[u]}return l}}const gz=e=>typeof e=="number"?0:Ft.test(e)?Ft.getAnimatableNone(e):e;function yz(e){const t=jN(e);return CN(e)(t.map(gz))}const Es={test:fz,parse:jN,createTransformer:CN,getAnimatableNone:yz};function Ap(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function vz({hue:e,saturation:t,lightness:s,alpha:r}){e/=360,t/=100,s/=100;let i=0,l=0,u=0;if(!t)i=l=u=s;else{const f=s<.5?s*(1+t):s+t-s*t,m=2*s-f;i=Ap(m,f,e+1/3),l=Ap(m,f,e),u=Ap(m,f,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:r}}function md(e,t){return s=>s>0?t:e}const kt=(e,t,s)=>e+(t-e)*s,Rp=(e,t,s)=>{const r=e*e,i=s*(t*t-r)+r;return i<0?0:Math.sqrt(i)},bz=[ym,Or,$i],xz=e=>bz.find(t=>t.test(e));function o1(e){const t=xz(e);if(!t)return!1;let s=t.parse(e);return t===$i&&(s=vz(s)),s}const l1=(e,t)=>{const s=o1(e),r=o1(t);if(!s||!r)return md(e,t);const i={...s};return l=>(i.red=Rp(s.red,r.red,l),i.green=Rp(s.green,r.green,l),i.blue=Rp(s.blue,r.blue,l),i.alpha=kt(s.alpha,r.alpha,l),Or.transform(i))},vm=new Set(["none","hidden"]);function wz(e,t){return vm.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Sz(e,t){return s=>kt(e,t,s)}function Og(e){return typeof e=="number"?Sz:typeof e=="string"?_g(e)?md:Ft.test(e)?l1:Tz:Array.isArray(e)?AN:typeof e=="object"?Ft.test(e)?l1:Ez:md}function AN(e,t){const s=[...e],r=s.length,i=e.map((l,u)=>Og(l)(l,t[u]));return l=>{for(let u=0;u<r;u++)s[u]=i[u](l);return s}}function Ez(e,t){const s={...e,...t},r={};for(const i in s)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Og(e[i])(e[i],t[i]));return i=>{for(const l in r)s[l]=r[l](i);return s}}function Nz(e,t){const s=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],u=e.indexes[l][r[l]],f=e.values[u]??0;s[i]=f,r[l]++}return s}const Tz=(e,t)=>{const s=Es.createTransformer(t),r=Ml(e),i=Ml(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?vm.has(e)&&!i.values.length||vm.has(t)&&!r.values.length?wz(e,t):Hl(AN(Nz(r,i),i.values),s):md(e,t)};function RN(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?kt(e,t,s):Og(e)(e,t)}const jz=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>vt.update(t,s),stop:()=>Wa(t),now:()=>on.isProcessing?on.timestamp:wn.now()}},_N=(e,t,s=10)=>{let r="";const i=Math.max(Math.round(t/s),2);for(let l=0;l<i;l++)r+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},gd=2e4;function Dg(e){let t=0;const s=50;let r=e.next(t);for(;!r.done&&t<gd;)t+=s,r=e.next(t);return t>=gd?1/0:t}function Cz(e,t=100,s){const r=s({...e,keyframes:[0,t]}),i=Math.min(Dg(r),gd);return{type:"keyframes",ease:l=>r.next(i*l).value/t,duration:cs(i)}}const Az=5;function kN(e,t,s){const r=Math.max(t-Az,0);return cN(s-e(r),t-r)}const It={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},_p=.001;function Rz({duration:e=It.duration,bounce:t=It.bounce,velocity:s=It.velocity,mass:r=It.mass}){let i,l,u=1-t;u=Vs(It.minDamping,It.maxDamping,u),e=Vs(It.minDuration,It.maxDuration,cs(e)),u<1?(i=h=>{const y=h*u,v=y*e,x=y-s,w=bm(h,u),N=Math.exp(-v);return _p-x/w*N},l=h=>{const v=h*u*e,x=v*s+s,w=Math.pow(u,2)*Math.pow(h,2)*e,N=Math.exp(-v),T=bm(Math.pow(h,2),u);return(-i(h)+_p>0?-1:1)*((x-w)*N)/T}):(i=h=>{const y=Math.exp(-h*e),v=(h-s)*e+1;return-_p+y*v},l=h=>{const y=Math.exp(-h*e),v=(s-h)*(e*e);return y*v});const f=5/e,m=kz(i,l,f);if(e=Ss(e),isNaN(m))return{stiffness:It.stiffness,damping:It.damping,duration:e};{const h=Math.pow(m,2)*r;return{stiffness:h,damping:u*2*Math.sqrt(r*h),duration:e}}}const _z=12;function kz(e,t,s){let r=s;for(let i=1;i<_z;i++)r=r-e(r)/t(r);return r}function bm(e,t){return e*Math.sqrt(1-t*t)}const Mz=["duration","bounce"],Oz=["stiffness","damping","mass"];function c1(e,t){return t.some(s=>e[s]!==void 0)}function Dz(e){let t={velocity:It.velocity,stiffness:It.stiffness,damping:It.damping,mass:It.mass,isResolvedFromDuration:!1,...e};if(!c1(e,Oz)&&c1(e,Mz))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,r=2*Math.PI/(s*1.2),i=r*r,l=2*Vs(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:It.mass,stiffness:i,damping:l}}else{const s=Rz({...e,velocity:0});t={...t,...s,mass:It.mass},t.isResolvedFromDuration=!0}return t}function yd(e=It.visualDuration,t=It.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=s;const l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],f={done:!1,value:l},{stiffness:m,damping:h,mass:y,duration:v,velocity:x,isResolvedFromDuration:w}=Dz({...s,velocity:-cs(s.velocity||0)}),N=x||0,T=h/(2*Math.sqrt(m*y)),R=u-l,C=cs(Math.sqrt(m/y)),j=Math.abs(R)<5;r||(r=j?It.restSpeed.granular:It.restSpeed.default),i||(i=j?It.restDelta.granular:It.restDelta.default);let E;if(T<1){const A=bm(C,T);E=M=>{const O=Math.exp(-T*C*M);return u-O*((N+T*C*R)/A*Math.sin(A*M)+R*Math.cos(A*M))}}else if(T===1)E=A=>u-Math.exp(-C*A)*(R+(N+C*R)*A);else{const A=C*Math.sqrt(T*T-1);E=M=>{const O=Math.exp(-T*C*M),I=Math.min(A*M,300);return u-O*((N+T*C*R)*Math.sinh(I)+A*R*Math.cosh(I))/A}}const _={calculatedDuration:w&&v||null,next:A=>{const M=E(A);if(w)f.done=A>=v;else{let O=A===0?N:0;T<1&&(O=A===0?Ss(N):kN(E,A,M));const I=Math.abs(O)<=r,Y=Math.abs(u-M)<=i;f.done=I&&Y}return f.value=f.done?u:M,f},toString:()=>{const A=Math.min(Dg(_),gd),M=_N(O=>_.next(A*O).value,A,30);return A+"ms "+M},toTransition:()=>{}};return _}yd.applyToOptions=e=>{const t=Cz(e,100,yd);return e.ease=t.ease,e.duration=Ss(t.duration),e.type="keyframes",e};function xm({keyframes:e,velocity:t=0,power:s=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:u,min:f,max:m,restDelta:h=.5,restSpeed:y}){const v=e[0],x={done:!1,value:v},w=I=>f!==void 0&&I<f||m!==void 0&&I>m,N=I=>f===void 0?m:m===void 0||Math.abs(f-I)<Math.abs(m-I)?f:m;let T=s*t;const R=v+T,C=u===void 0?R:u(R);C!==R&&(T=C-v);const j=I=>-T*Math.exp(-I/r),E=I=>C+j(I),_=I=>{const Y=j(I),F=E(I);x.done=Math.abs(Y)<=h,x.value=x.done?C:F};let A,M;const O=I=>{w(x.value)&&(A=I,M=yd({keyframes:[x.value,N(x.value)],velocity:kN(E,I,x.value),damping:i,stiffness:l,restDelta:h,restSpeed:y}))};return O(0),{calculatedDuration:null,next:I=>{let Y=!1;return!M&&A===void 0&&(Y=!0,_(I),O(I)),A!==void 0&&I>=A?M.next(I-A):(!Y&&_(I),x)}}}function zz(e,t,s){const r=[],i=s||ha.mix||RN,l=e.length-1;for(let u=0;u<l;u++){let f=i(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||us:t;f=Hl(m,f)}r.push(f)}return r}function Iz(e,t,{clamp:s=!0,ease:r,mixer:i}={}){const l=e.length;if(jg(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=zz(t,r,i),m=f.length,h=y=>{if(u&&y<e[0])return t[0];let v=0;if(m>1)for(;v<e.length-2&&!(y<e[v+1]);v++);const x=_l(e[v],e[v+1],y);return f[v](x)};return s?y=>h(Vs(e[0],e[l-1],y)):h}function Lz(e,t){const s=e[e.length-1];for(let r=1;r<=t;r++){const i=_l(0,t,r);e.push(kt(s,1,i))}}function Pz(e){const t=[0];return Lz(t,e.length-1),t}function $z(e,t){return e.map(s=>s*t)}function Uz(e,t){return e.map(()=>t||vN).splice(0,e.length-1)}function Tl({duration:e=300,keyframes:t,times:s,ease:r="easeInOut"}){const i=WD(r)?r.map(s1):s1(r),l={done:!1,value:t[0]},u=$z(s&&s.length===t.length?s:Pz(t),e),f=Iz(u,t,{ease:Array.isArray(i)?i:Uz(t,i)});return{calculatedDuration:e,next:m=>(l.value=f(m),l.done=m>=e,l)}}const Vz=e=>e!==null;function zg(e,{repeat:t,repeatType:s="loop"},r,i=1){const l=e.filter(Vz),f=i<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!f||r===void 0?l[f]:r}const Bz={decay:xm,inertia:xm,tween:Tl,keyframes:Tl,spring:yd};function MN(e){typeof e.type=="string"&&(e.type=Bz[e.type])}class Ig{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const Zz=e=>e/100;class Lg extends Ig{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==wn.now()&&this.tick(wn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;MN(t);const{type:s=Tl,repeat:r=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:f}=t;const m=s||Tl;m!==Tl&&typeof f[0]!="number"&&(this.mixKeyframes=Hl(Zz,RN(f[0],f[1])),f=[0,100]);const h=m({...t,keyframes:f});l==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...f].reverse(),velocity:-u})),h.calculatedDuration===null&&(h.calculatedDuration=Dg(h));const{calculatedDuration:y}=h;this.calculatedDuration=y,this.resolvedDuration=y+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=h}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:r,totalDuration:i,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return r.next(0);const{delay:h=0,keyframes:y,repeat:v,repeatType:x,repeatDelay:w,type:N,onUpdate:T,finalKeyframe:R}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const C=this.currentTime-h*(this.playbackSpeed>=0?1:-1),j=this.playbackSpeed>=0?C<0:C>i;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let E=this.currentTime,_=r;if(v){const I=Math.min(this.currentTime,i)/f;let Y=Math.floor(I),F=I%1;!F&&I>=1&&(F=1),F===1&&Y--,Y=Math.min(Y,v+1),Y%2&&(x==="reverse"?(F=1-F,w&&(F-=w/f)):x==="mirror"&&(_=u)),E=Vs(0,1,F)*f}const A=j?{done:!1,value:y[0]}:_.next(E);l&&(A.value=l(A.value));let{done:M}=A;!j&&m!==null&&(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return O&&N!==xm&&(A.value=zg(y,this.options,R,this.speed)),T&&T(A.value),O&&this.finish(),A}then(t,s){return this.finished.then(t,s)}get duration(){return cs(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+cs(t)}get time(){return cs(this.currentTime)}set time(t){t=Ss(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(wn.now());const s=this.playbackSpeed!==t;this.playbackSpeed=t,s&&(this.time=cs(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=jz,startTime:s}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(wn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Hz(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Dr=e=>e*180/Math.PI,wm=e=>{const t=Dr(Math.atan2(e[1],e[0]));return Sm(t)},Fz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:wm,rotateZ:wm,skewX:e=>Dr(Math.atan(e[1])),skewY:e=>Dr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Sm=e=>(e=e%360,e<0&&(e+=360),e),u1=wm,d1=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),f1=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),qz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:d1,scaleY:f1,scale:e=>(d1(e)+f1(e))/2,rotateX:e=>Sm(Dr(Math.atan2(e[6],e[5]))),rotateY:e=>Sm(Dr(Math.atan2(-e[2],e[0]))),rotateZ:u1,rotate:u1,skewX:e=>Dr(Math.atan(e[4])),skewY:e=>Dr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Em(e){return e.includes("scale")?1:0}function Nm(e,t){if(!e||e==="none")return Em(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(s)r=qz,i=s;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Fz,i=f}if(!i)return Em(t);const l=r[t],u=i[1].split(",").map(Gz);return typeof l=="function"?l(u):u[l]}const Yz=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Nm(s,t)};function Gz(e){return parseFloat(e.trim())}const co=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],uo=new Set(co),h1=e=>e===lo||e===Ne,Xz=new Set(["x","y","z"]),Kz=co.filter(e=>!Xz.has(e));function Wz(e){const t=[];return Kz.forEach(s=>{const r=e.getValue(s);r!==void 0&&(t.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),t}const qa={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Nm(t,"x"),y:(e,{transform:t})=>Nm(t,"y")};qa.translateX=qa.x;qa.translateY=qa.y;const Lr=new Set;let Tm=!1,jm=!1,Cm=!1;function ON(){if(jm){const e=Array.from(Lr).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),s=new Map;t.forEach(r=>{const i=Wz(r);i.length&&(s.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=s.get(r);i&&i.forEach(([l,u])=>{r.getValue(l)?.set(u)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}jm=!1,Tm=!1,Lr.forEach(e=>e.complete(Cm)),Lr.clear()}function DN(){Lr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(jm=!0)})}function Jz(){Cm=!0,DN(),ON(),Cm=!1}class Pg{constructor(t,s,r,i,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=r,this.motionValue=i,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Lr.add(this),Tm||(Tm=!0,vt.read(DN),vt.resolveKeyframes(ON))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:r,motionValue:i}=this;if(t[0]===null){const l=i?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(r&&s){const f=r.readValue(s,u);f!=null&&(t[0]=f)}t[0]===void 0&&(t[0]=u),i&&l===void 0&&i.set(t[0])}Hz(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Lr.delete(this)}cancel(){this.state==="scheduled"&&(Lr.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Qz=e=>e.startsWith("--");function e5(e,t,s){Qz(t)?e.style.setProperty(t,s):e.style[t]=s}const t5={};function zN(e,t){const s=lN(e);return()=>t5[t]??s()}const n5=zN(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),IN=zN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),pl=([e,t,s,r])=>`cubic-bezier(${e}, ${t}, ${s}, ${r})`,p1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pl([0,.65,.55,1]),circOut:pl([.55,0,1,.45]),backIn:pl([.31,.01,.66,-.59]),backOut:pl([.33,1.53,.69,.99])};function LN(e,t){if(e)return typeof e=="function"?IN()?_N(e,t):"ease-out":bN(e)?pl(e):Array.isArray(e)?e.map(s=>LN(s,t)||p1.easeOut):p1[e]}function s5(e,t,s,{delay:r=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:f="easeOut",times:m}={},h=void 0){const y={[t]:s};m&&(y.offset=m);const v=LN(f,i);Array.isArray(v)&&(y.easing=v);const x={delay:r,duration:i,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return h&&(x.pseudoElement=h),e.animate(y,x)}function PN(e){return typeof e=="function"&&"applyToOptions"in e}function a5({type:e,...t}){return PN(e)&&IN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class $N extends Ig{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:r,keyframes:i,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:f,onComplete:m}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,jg(typeof t.type!="string");const h=a5(t);this.animation=s5(s,r,i,h,l),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const y=zg(i,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):e5(s,r,y),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return cs(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+cs(t)}get time(){return cs(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ss(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&n5()?(this.animation.timeline=t,us):s(this)}}const UN={anticipate:mN,backInOut:pN,circInOut:yN};function r5(e){return e in UN}function i5(e){typeof e.ease=="string"&&r5(e.ease)&&(e.ease=UN[e.ease])}const kp=10;class o5 extends $N{constructor(t){i5(t),MN(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:r,onComplete:i,element:l,...u}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const f=new Lg({...u,autoplay:!1}),m=Math.max(kp,wn.now()-this.startTime),h=Vs(0,kp,m-kp);s.setWithVelocity(f.sample(Math.max(0,m-h)).value,f.sample(m).value,h),f.stop()}}const m1=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Es.test(e)||e==="0")&&!e.startsWith("url("));function l5(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function c5(e,t,s,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=m1(i,t),f=m1(l,t);return!u||!f?!1:l5(e)||(s==="spring"||PN(s))&&r}function Am(e){e.duration=0,e.type="keyframes"}const u5=new Set(["opacity","clipPath","filter","transform"]),d5=lN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function f5(e){const{motionValue:t,name:s,repeatDelay:r,repeatType:i,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:h}=t.owner.getProps();return d5()&&s&&u5.has(s)&&(s!=="transform"||!h)&&!m&&!r&&i!=="mirror"&&l!==0&&u!=="inertia"}const h5=40;class p5 extends Ig{constructor({autoplay:t=!0,delay:s=0,type:r="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:u="loop",keyframes:f,name:m,motionValue:h,element:y,...v}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wn.now();const x={autoplay:t,delay:s,type:r,repeat:i,repeatDelay:l,repeatType:u,name:m,motionValue:h,element:y,...v},w=y?.KeyframeResolver||Pg;this.keyframeResolver=new w(f,(N,T,R)=>this.onKeyframesResolved(N,T,x,!R),m,h,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,r,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:f,delay:m,isHandoff:h,onUpdate:y}=r;this.resolvedAt=wn.now(),c5(t,l,u,f)||((ha.instantAnimations||!m)&&y?.(zg(t,r,s)),t[0]=t[t.length-1],Am(r),r.repeat=0);const x={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>h5?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:t},w=!h&&f5(x),N=x.motionValue?.owner?.current,T=w?new o5({...x,element:N}):new Lg(x);T.finished.then(()=>{this.notifyFinished()}).catch(us),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Jz()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function VN(e,t,s,r=0,i=1){const l=Array.from(e).sort((h,y)=>h.sortNodePosition(y)).indexOf(t),u=e.size,f=(u-1)*r;return typeof s=="function"?s(l,u):i===1?l*r:f-l*r}const m5=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function g5(e){const t=m5.exec(e);if(!t)return[,];const[,s,r,i]=t;return[`--${s??r}`,i]}function BN(e,t,s=1){const[r,i]=g5(e);if(!r)return;const l=window.getComputedStyle(t).getPropertyValue(r);if(l){const u=l.trim();return rN(u)?parseFloat(u):u}return _g(i)?BN(i,t,s+1):i}const y5={type:"spring",stiffness:500,damping:25,restSpeed:10},v5=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),b5={type:"keyframes",duration:.8},x5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},w5=(e,{keyframes:t})=>t.length>2?b5:uo.has(e)?e.startsWith("scale")?v5(t[1]):y5:x5,S5=e=>e!==null;function E5(e,{repeat:t,repeatType:s="loop"},r){const i=e.filter(S5),l=t&&s!=="loop"&&t%2===1?0:i.length-1;return i[l]}function ZN(e,t){if(e?.inherit&&t){const{inherit:s,...r}=e;return{...t,...r}}return e}function $g(e,t){const s=e?.[t]??e?.default??e;return s!==e?ZN(s,e):s}function N5({when:e,delay:t,delayChildren:s,staggerChildren:r,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:f,from:m,elapsed:h,...y}){return!!Object.keys(y).length}const Ug=(e,t,s,r={},i,l)=>u=>{const f=$g(r,e)||{},m=f.delay||r.delay||0;let{elapsed:h=0}=r;h=h-Ss(m);const y={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:x=>{t.set(x),f.onUpdate&&f.onUpdate(x)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:l?void 0:i};N5(f)||Object.assign(y,w5(e,y)),y.duration&&(y.duration=Ss(y.duration)),y.repeatDelay&&(y.repeatDelay=Ss(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Am(y),y.delay===0&&(v=!0)),(ha.instantAnimations||ha.skipAnimations||i?.shouldSkipAnimations)&&(v=!0,Am(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,v&&!l&&t.get()!==void 0){const x=E5(y.keyframes,f);if(x!==void 0){vt.update(()=>{y.onUpdate(x),y.onComplete()});return}}return f.isSync?new Lg(y):new p5(y)};function g1(e){const t=[{},{}];return e?.values.forEach((s,r)=>{t[0][r]=s.get(),t[1][r]=s.getVelocity()}),t}function Vg(e,t,s,r){if(typeof t=="function"){const[i,l]=g1(r);t=t(s!==void 0?s:e.custom,i,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,l]=g1(r);t=t(s!==void 0?s:e.custom,i,l)}return t}function Xi(e,t,s){const r=e.getProps();return Vg(r,t,s!==void 0?s:r.custom,e)}const HN=new Set(["width","height","top","left","right","bottom",...co]),y1=30,T5=e=>!isNaN(parseFloat(e));class j5{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=wn.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=wn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=T5(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new Cg);const r=this.events[t].add(s);return t==="change"?()=>{r(),vt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=wn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>y1)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,y1);return cN(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function eo(e,t){return new j5(e,t)}const Rm=e=>Array.isArray(e);function C5(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,eo(s))}function A5(e){return Rm(e)?e[e.length-1]||0:e}function R5(e,t){const s=Xi(e,t);let{transitionEnd:r={},transition:i={},...l}=s||{};l={...l,...r};for(const u in l){const f=A5(l[u]);C5(e,u,f)}}const hn=e=>!!(e&&e.getVelocity);function _5(e){return!!(hn(e)&&e.add)}function _m(e,t){const s=e.getValue("willChange");if(_5(s))return s.add(t);if(!s&&ha.WillChange){const r=new ha.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Bg(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const k5="framerAppearId",FN="data-"+Bg(k5);function qN(e){return e.props[FN]}function M5({protectedKeys:e,needsAnimating:t},s){const r=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,r}function YN(e,t,{delay:s=0,transitionOverride:r,type:i}={}){let{transition:l,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();l=l?ZN(l,m):m;const h=l?.reduceMotion;r&&(l=r);const y=[],v=i&&e.animationState&&e.animationState.getState()[i];for(const x in f){const w=e.getValue(x,e.latestValues[x]??null),N=f[x];if(N===void 0||v&&M5(v,x))continue;const T={delay:s,...$g(l||{},x)},R=w.get();if(R!==void 0&&!w.isAnimating&&!Array.isArray(N)&&N===R&&!T.velocity)continue;let C=!1;if(window.MotionHandoffAnimation){const _=qN(e);if(_){const A=window.MotionHandoffAnimation(_,x,vt);A!==null&&(T.startTime=A,C=!0)}}_m(e,x);const j=h??e.shouldReduceMotion;w.start(Ug(x,w,N,j&&HN.has(x)?{type:!1}:T,e,C));const E=w.animation;E&&y.push(E)}if(u){const x=()=>vt.update(()=>{u&&R5(e,u)});y.length?Promise.all(y).then(x):x()}return y}function km(e,t,s={}){const r=Xi(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(i=s.transitionOverride);const l=r?()=>Promise.all(YN(e,r,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:h=0,staggerChildren:y,staggerDirection:v}=i;return O5(e,t,m,h,y,v,s)}:()=>Promise.resolve(),{when:f}=i;if(f){const[m,h]=f==="beforeChildren"?[l,u]:[u,l];return m().then(()=>h())}else return Promise.all([l(),u(s.delay)])}function O5(e,t,s=0,r=0,i=0,l=1,u){const f=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),f.push(km(m,t,{...u,delay:s+(typeof r=="function"?0:r)+VN(e.variantChildren,m,r,i,l)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function D5(e,t,s={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(l=>km(e,l,s));r=Promise.all(i)}else if(typeof t=="string")r=km(e,t,s);else{const i=typeof t=="function"?Xi(e,t,s.custom):t;r=Promise.all(YN(e,i,s))}return r.then(()=>{e.notify("AnimationComplete",t)})}const z5={test:e=>e==="auto",parse:e=>e},GN=e=>t=>t.test(e),XN=[lo,Ne,$s,Ua,uz,cz,z5],v1=e=>XN.find(GN(e));function I5(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||oN(e):!0}const L5=new Set(["brightness","contrast","saturate","opacity"]);function P5(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=s.match(kg)||[];if(!r)return e;const i=s.replace(r,"");let l=L5.has(t)?1:0;return r!==s&&(l*=100),t+"("+l+i+")"}const $5=/\b([a-z-]*)\(.*?\)/gu,Mm={...Es,getAnimatableNone:e=>{const t=e.match($5);return t?t.map(P5).join(" "):e}},Om={...Es,getAnimatableNone:e=>{const t=Es.parse(e);return Es.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},b1={...lo,transform:Math.round},U5={rotate:Ua,rotateX:Ua,rotateY:Ua,rotateZ:Ua,scale:Eu,scaleX:Eu,scaleY:Eu,scaleZ:Eu,skew:Ua,skewX:Ua,skewY:Ua,distance:Ne,translateX:Ne,translateY:Ne,translateZ:Ne,x:Ne,y:Ne,z:Ne,perspective:Ne,transformPerspective:Ne,opacity:kl,originX:r1,originY:r1,originZ:Ne},Zg={borderWidth:Ne,borderTopWidth:Ne,borderRightWidth:Ne,borderBottomWidth:Ne,borderLeftWidth:Ne,borderRadius:Ne,borderTopLeftRadius:Ne,borderTopRightRadius:Ne,borderBottomRightRadius:Ne,borderBottomLeftRadius:Ne,width:Ne,maxWidth:Ne,height:Ne,maxHeight:Ne,top:Ne,right:Ne,bottom:Ne,left:Ne,inset:Ne,insetBlock:Ne,insetBlockStart:Ne,insetBlockEnd:Ne,insetInline:Ne,insetInlineStart:Ne,insetInlineEnd:Ne,padding:Ne,paddingTop:Ne,paddingRight:Ne,paddingBottom:Ne,paddingLeft:Ne,paddingBlock:Ne,paddingBlockStart:Ne,paddingBlockEnd:Ne,paddingInline:Ne,paddingInlineStart:Ne,paddingInlineEnd:Ne,margin:Ne,marginTop:Ne,marginRight:Ne,marginBottom:Ne,marginLeft:Ne,marginBlock:Ne,marginBlockStart:Ne,marginBlockEnd:Ne,marginInline:Ne,marginInlineStart:Ne,marginInlineEnd:Ne,fontSize:Ne,backgroundPositionX:Ne,backgroundPositionY:Ne,...U5,zIndex:b1,fillOpacity:kl,strokeOpacity:kl,numOctaves:b1},V5={...Zg,color:Ft,backgroundColor:Ft,outlineColor:Ft,fill:Ft,stroke:Ft,borderColor:Ft,borderTopColor:Ft,borderRightColor:Ft,borderBottomColor:Ft,borderLeftColor:Ft,filter:Mm,WebkitFilter:Mm,mask:Om,WebkitMask:Om},KN=e=>V5[e],B5=new Set([Mm,Om]);function WN(e,t){let s=KN(e);return B5.has(s)||(s=Es),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const Z5=new Set(["auto","none","0"]);function H5(e,t,s){let r=0,i;for(;r<e.length&&!i;){const l=e[r];typeof l=="string"&&!Z5.has(l)&&Ml(l).values.length&&(i=e[r]),r++}if(i&&s)for(const l of t)e[l]=WN(s,i)}class F5 extends Pg{constructor(t,s,r,i,l){super(t,s,r,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let y=0;y<t.length;y++){let v=t[y];if(typeof v=="string"&&(v=v.trim(),_g(v))){const x=BN(v,s.current);x!==void 0&&(t[y]=x),y===t.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!HN.has(r)||t.length!==2)return;const[i,l]=t,u=v1(i),f=v1(l),m=a1(i),h=a1(l);if(m!==h&&qa[r]){this.needsMeasurement=!0;return}if(u!==f)if(h1(u)&&h1(f))for(let y=0;y<t.length;y++){const v=t[y];typeof v=="string"&&(t[y]=parseFloat(v))}else qa[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||I5(t[i]))&&r.push(i);r.length&&H5(t,r,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=qa[r](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(s);i&&i.jump(this.measuredOrigin,!1);const l=r.length-1,u=r[l];r[l]=qa[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,m])=>{t.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const q5=new Set(["opacity","clipPath","filter","transform"]);function JN(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=s?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const QN=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Dm(e){return iN(e)&&"offsetHeight"in e}const{schedule:Hg}=xN(queueMicrotask,!1),xs={x:!1,y:!1};function eT(){return xs.x||xs.y}function Y5(e){return e==="x"||e==="y"?xs[e]?null:(xs[e]=!0,()=>{xs[e]=!1}):xs.x||xs.y?null:(xs.x=xs.y=!0,()=>{xs.x=xs.y=!1})}function tT(e,t){const s=JN(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[s,i,()=>r.abort()]}function G5(e){return!(e.pointerType==="touch"||eT())}function X5(e,t,s={}){const[r,i,l]=tT(e,s);return r.forEach(u=>{let f=!1,m=!1,h;const y=()=>{u.removeEventListener("pointerleave",N)},v=R=>{h&&(h(R),h=void 0),y()},x=R=>{f=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),m&&(m=!1,v(R))},w=()=>{f=!0,window.addEventListener("pointerup",x,i),window.addEventListener("pointercancel",x,i)},N=R=>{if(R.pointerType!=="touch"){if(f){m=!0;return}v(R)}},T=R=>{if(!G5(R))return;m=!1;const C=t(u,R);typeof C=="function"&&(h=C,u.addEventListener("pointerleave",N,i))};u.addEventListener("pointerenter",T,i),u.addEventListener("pointerdown",w,i)}),l}const nT=(e,t)=>t?e===t?!0:nT(e,t.parentElement):!1,Fg=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,K5=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function W5(e){return K5.has(e.tagName)||e.isContentEditable===!0}const J5=new Set(["INPUT","SELECT","TEXTAREA"]);function Q5(e){return J5.has(e.tagName)||e.isContentEditable===!0}const Zu=new WeakSet;function x1(e){return t=>{t.key==="Enter"&&e(t)}}function Mp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const e3=(e,t)=>{const s=e.currentTarget;if(!s)return;const r=x1(()=>{if(Zu.has(s))return;Mp(s,"down");const i=x1(()=>{Mp(s,"up")}),l=()=>Mp(s,"cancel");s.addEventListener("keyup",i,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",r,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),t)};function w1(e){return Fg(e)&&!eT()}const S1=new WeakSet;function t3(e,t,s={}){const[r,i,l]=tT(e,s),u=f=>{const m=f.currentTarget;if(!w1(f)||S1.has(f))return;Zu.add(m),s.stopPropagation&&S1.add(f);const h=t(m,f),y=(w,N)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",x),Zu.has(m)&&Zu.delete(m),w1(w)&&typeof h=="function"&&h(w,{success:N})},v=w=>{y(w,m===window||m===document||s.useGlobalTarget||nT(m,w.target))},x=w=>{y(w,!1)};window.addEventListener("pointerup",v,i),window.addEventListener("pointercancel",x,i)};return r.forEach(f=>{(s.useGlobalTarget?window:f).addEventListener("pointerdown",u,i),Dm(f)&&(f.addEventListener("focus",h=>e3(h,i)),!W5(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),l}function qg(e){return iN(e)&&"ownerSVGElement"in e}const Hu=new WeakMap;let Fu;const sT=(e,t,s)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:qg(r)&&"getBBox"in r?r.getBBox()[t]:r[s],n3=sT("inline","width","offsetWidth"),s3=sT("block","height","offsetHeight");function a3({target:e,borderBoxSize:t}){Hu.get(e)?.forEach(s=>{s(e,{get width(){return n3(e,t)},get height(){return s3(e,t)}})})}function r3(e){e.forEach(a3)}function i3(){typeof ResizeObserver>"u"||(Fu=new ResizeObserver(r3))}function o3(e,t){Fu||i3();const s=JN(e);return s.forEach(r=>{let i=Hu.get(r);i||(i=new Set,Hu.set(r,i)),i.add(t),Fu?.observe(r)}),()=>{s.forEach(r=>{const i=Hu.get(r);i?.delete(t),i?.size||Fu?.unobserve(r)})}}const qu=new Set;let Ui;function l3(){Ui=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};qu.forEach(t=>t(e))},window.addEventListener("resize",Ui)}function c3(e){return qu.add(e),Ui||l3(),()=>{qu.delete(e),!qu.size&&typeof Ui=="function"&&(window.removeEventListener("resize",Ui),Ui=void 0)}}function E1(e,t){return typeof e=="function"?c3(e):o3(e,t)}function u3(e){return qg(e)&&e.tagName==="svg"}const d3=[...XN,Ft,Es],f3=e=>d3.find(GN(e)),N1=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vi=()=>({x:N1(),y:N1()}),T1=()=>({min:0,max:0}),Kt=()=>({x:T1(),y:T1()}),h3=new WeakMap;function Vd(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Ol(e){return typeof e=="string"||Array.isArray(e)}const Yg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Gg=["initial",...Yg];function Bd(e){return Vd(e.animate)||Gg.some(t=>Ol(e[t]))}function aT(e){return!!(Bd(e)||e.variants)}function p3(e,t,s){for(const r in t){const i=t[r],l=s[r];if(hn(i))e.addValue(r,i);else if(hn(l))e.addValue(r,eo(i,{owner:e}));else if(l!==i)if(e.hasValue(r)){const u=e.getValue(r);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(r);e.addValue(r,eo(u!==void 0?u:i,{owner:e}))}}for(const r in s)t[r]===void 0&&e.removeValue(r);return t}const zm={current:null},rT={current:!1},m3=typeof window<"u";function g3(){if(rT.current=!0,!!m3)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>zm.current=e.matches;e.addEventListener("change",t),t()}else zm.current=!1}const j1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let vd={};function iT(e){vd=e}function y3(){return vd}class v3{scrapeMotionValuesFromProps(t,s,r){return{}}constructor({parent:t,props:s,presenceContext:r,reducedMotionConfig:i,skipAnimations:l,blockInitialAnimation:u,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Pg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=wn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,vt.render(this.render,!1,!0))};const{latestValues:h,renderState:y}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=s.initial?{...h}:{},this.renderState=y,this.parent=t,this.props=s,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=l,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=Bd(s),this.isVariantNode=aT(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:v,...x}=this.scrapeMotionValuesFromProps(s,{},this);for(const w in x){const N=x[w];h[w]!==void 0&&hn(N)&&N.set(h[w])}}mount(t){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,h3.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(rT.current||g3(),this.shouldReduceMotion=zm.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Wa(this.notifyUpdate),Wa(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),s.accelerate&&q5.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:m,ease:h,duration:y}=s.accelerate,v=new $N({element:this.current,name:t,keyframes:f,times:m,ease:h,duration:Ss(y)}),x=u(v);this.valueSubscriptions.set(t,()=>{x(),v.cancel()});return}const r=uo.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&vt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{i(),l&&l(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in vd){const s=vd[t];if(!s)continue;const{isEnabled:r,Feature:i}=s;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<j1.length;r++){const i=j1[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const l="on"+i,u=t[l];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=p3(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const r=this.values.get(t);s!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&s!==void 0&&(r=eo(s===null?void 0:s,{owner:this}),this.addValue(t,r)),r}readValue(t,s){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(rN(r)||oN(r))?r=parseFloat(r):!f3(r)&&Es.test(s)&&(r=WN(t,s)),this.setBaseTarget(t,hn(r)?r.get():r)),hn(r)?r.get():r}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const l=Vg(this.props,s,this.presenceContext?.custom);l&&(r=l[t])}if(s&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!hn(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new Cg),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){Hg.render(this.render)}}class oT extends v3{constructor(){super(...arguments),this.KeyframeResolver=F5}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const r=t.style;return r?r[s]:void 0}removeValueFromRenderState(t,{vars:s,style:r}){delete s[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;hn(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class rr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function lT({top:e,left:t,right:s,bottom:r}){return{x:{min:t,max:s},y:{min:e,max:r}}}function b3({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function x3(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function Op(e){return e===void 0||e===1}function Im({scale:e,scaleX:t,scaleY:s}){return!Op(e)||!Op(t)||!Op(s)}function kr(e){return Im(e)||cT(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cT(e){return C1(e.x)||C1(e.y)}function C1(e){return e&&e!=="0%"}function bd(e,t,s){const r=e-s,i=t*r;return s+i}function A1(e,t,s,r,i){return i!==void 0&&(e=bd(e,i,r)),bd(e,s,r)+t}function Lm(e,t=0,s=1,r,i){e.min=A1(e.min,t,s,r,i),e.max=A1(e.max,t,s,r,i)}function uT(e,{x:t,y:s}){Lm(e.x,t.translate,t.scale,t.originPoint),Lm(e.y,s.translate,s.scale,s.originPoint)}const R1=.999999999999,_1=1.0000000000001;function w3(e,t,s,r=!1){const i=s.length;if(!i)return;t.x=t.y=1;let l,u;for(let f=0;f<i;f++){l=s[f],u=l.projectionDelta;const{visualElement:m}=l.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Zi(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,uT(e,u)),r&&kr(l.latestValues)&&Zi(e,l.latestValues))}t.x<_1&&t.x>R1&&(t.x=1),t.y<_1&&t.y>R1&&(t.y=1)}function Bi(e,t){e.min=e.min+t,e.max=e.max+t}function k1(e,t,s,r,i=.5){const l=kt(e.min,e.max,i);Lm(e,t,s,l,r)}function Zi(e,t){k1(e.x,t.x,t.scaleX,t.scale,t.originX),k1(e.y,t.y,t.scaleY,t.scale,t.originY)}function dT(e,t){return lT(x3(e.getBoundingClientRect(),t))}function S3(e,t,s){const r=dT(e,s),{scroll:i}=t;return i&&(Bi(r.x,i.offset.x),Bi(r.y,i.offset.y)),r}const E3={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},N3=co.length;function T3(e,t,s){let r="",i=!0;for(let l=0;l<N3;l++){const u=co[l],f=e[u];if(f===void 0)continue;let m=!0;if(typeof f=="number")m=f===(u.startsWith("scale")?1:0);else{const h=parseFloat(f);m=u.startsWith("scale")?h===1:h===0}if(!m||s){const h=QN(f,Zg[u]);if(!m){i=!1;const y=E3[u]||u;r+=`${y}(${h}) `}s&&(t[u]=h)}}return r=r.trim(),s?r=s(t,i?"":r):i&&(r="none"),r}function Xg(e,t,s){const{style:r,vars:i,transformOrigin:l}=e;let u=!1,f=!1;for(const m in t){const h=t[m];if(uo.has(m)){u=!0;continue}else if(SN(m)){i[m]=h;continue}else{const y=QN(h,Zg[m]);m.startsWith("origin")?(f=!0,l[m]=y):r[m]=y}}if(t.transform||(u||s?r.transform=T3(t,e.transform,s):r.transform&&(r.transform="none")),f){const{originX:m="50%",originY:h="50%",originZ:y=0}=l;r.transformOrigin=`${m} ${h} ${y}`}}function fT(e,{style:t,vars:s},r,i){const l=e.style;let u;for(u in t)l[u]=t[u];i?.applyProjectionStyles(l,r);for(u in s)l.setProperty(u,s[u])}function M1(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const dl={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ne.test(e))e=parseFloat(e);else return e;const s=M1(e,t.target.x),r=M1(e,t.target.y);return`${s}% ${r}%`}},j3={correct:(e,{treeScale:t,projectionDelta:s})=>{const r=e,i=Es.parse(e);if(i.length>5)return r;const l=Es.createTransformer(e),u=typeof i[0]!="number"?1:0,f=s.x.scale*t.x,m=s.y.scale*t.y;i[0+u]/=f,i[1+u]/=m;const h=kt(f,m,.5);return typeof i[2+u]=="number"&&(i[2+u]/=h),typeof i[3+u]=="number"&&(i[3+u]/=h),l(i)}},Pm={borderRadius:{...dl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:dl,borderTopRightRadius:dl,borderBottomLeftRadius:dl,borderBottomRightRadius:dl,boxShadow:j3};function hT(e,{layout:t,layoutId:s}){return uo.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Pm[e]||e==="opacity")}function Kg(e,t,s){const r=e.style,i=t?.style,l={};if(!r)return l;for(const u in r)(hn(r[u])||i&&hn(i[u])||hT(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=r[u]);return l}function C3(e){return window.getComputedStyle(e)}class A3 extends oT{constructor(){super(...arguments),this.type="html",this.renderInstance=fT}readValueFromInstance(t,s){if(uo.has(s))return this.projection?.isProjecting?Em(s):Yz(t,s);{const r=C3(t),i=(SN(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:s}){return dT(t,s)}build(t,s,r){Xg(t,s,r.transformTemplate)}scrapeMotionValuesFromProps(t,s,r){return Kg(t,s,r)}}const R3={offset:"stroke-dashoffset",array:"stroke-dasharray"},_3={offset:"strokeDashoffset",array:"strokeDasharray"};function k3(e,t,s=1,r=0,i=!0){e.pathLength=1;const l=i?R3:_3;e[l.offset]=`${-r}`,e[l.array]=`${t} ${s}`}const M3=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function pT(e,{attrX:t,attrY:s,attrScale:r,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...f},m,h,y){if(Xg(e,f,h),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:v,style:x}=e;v.transform&&(x.transform=v.transform,delete v.transform),(x.transform||v.transformOrigin)&&(x.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),x.transform&&(x.transformBox=y?.transformBox??"fill-box",delete v.transformBox);for(const w of M3)v[w]!==void 0&&(x[w]=v[w],delete v[w]);t!==void 0&&(v.x=t),s!==void 0&&(v.y=s),r!==void 0&&(v.scale=r),i!==void 0&&k3(v,i,l,u,!1)}const mT=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),gT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function O3(e,t,s,r){fT(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(mT.has(i)?i:Bg(i),t.attrs[i])}function yT(e,t,s){const r=Kg(e,t,s);for(const i in e)if(hn(e[i])||hn(t[i])){const l=co.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[l]=e[i]}return r}class D3 extends oT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kt}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(uo.has(s)){const r=KN(s);return r&&r.default||0}return s=mT.has(s)?s:Bg(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,r){return yT(t,s,r)}build(t,s,r){pT(t,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,s,r,i){O3(t,s,r,i)}mount(t){this.isSVGTag=gT(t.tagName),super.mount(t)}}const z3=Gg.length;function vT(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?vT(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<z3;s++){const r=Gg[s],i=e.props[r];(Ol(i)||i===!1)&&(t[r]=i)}return t}function bT(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;return!0}const I3=[...Yg].reverse(),L3=Yg.length;function P3(e){return t=>Promise.all(t.map(({animation:s,options:r})=>D5(e,s,r)))}function $3(e){let t=P3(e),s=O1(),r=!0;const i=m=>(h,y)=>{const v=Xi(e,y,m==="exit"?e.presenceContext?.custom:void 0);if(v){const{transition:x,transitionEnd:w,...N}=v;h={...h,...N,...w}}return h};function l(m){t=m(e)}function u(m){const{props:h}=e,y=vT(e.parent)||{},v=[],x=new Set;let w={},N=1/0;for(let R=0;R<L3;R++){const C=I3[R],j=s[C],E=h[C]!==void 0?h[C]:y[C],_=Ol(E),A=C===m?j.isActive:null;A===!1&&(N=R);let M=E===y[C]&&E!==h[C]&&_;if(M&&r&&e.manuallyAnimateOnMount&&(M=!1),j.protectedKeys={...w},!j.isActive&&A===null||!E&&!j.prevProp||Vd(E)||typeof E=="boolean")continue;if(C==="exit"&&j.isActive&&A!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const O=U3(j.prevProp,E);let I=O||C===m&&j.isActive&&!M&&_||R>N&&_,Y=!1;const F=Array.isArray(E)?E:[E];let B=F.reduce(i(C),{});A===!1&&(B={});const{prevResolvedValues:P={}}=j,X={...P,...B},ie=H=>{I=!0,x.has(H)&&(Y=!0,x.delete(H)),j.needsAnimating[H]=!0;const U=e.getValue(H);U&&(U.liveStyle=!1)};for(const H in X){const U=B[H],ne=P[H];if(w.hasOwnProperty(H))continue;let G=!1;Rm(U)&&Rm(ne)?G=!bT(U,ne):G=U!==ne,G?U!=null?ie(H):x.add(H):U!==void 0&&x.has(H)?ie(H):j.protectedKeys[H]=!0}j.prevProp=E,j.prevResolvedValues=B,j.isActive&&(w={...w,...B}),r&&e.blockInitialAnimation&&(I=!1);const ee=M&&O;I&&(!ee||Y)&&v.push(...F.map(H=>{const U={type:C};if(typeof H=="string"&&r&&!ee&&e.manuallyAnimateOnMount&&e.parent){const{parent:ne}=e,G=Xi(ne,H);if(ne.enteringChildren&&G){const{delayChildren:D}=G.transition||{};U.delay=VN(ne.enteringChildren,e,D)}}return{animation:H,options:U}}))}if(x.size){const R={};if(typeof h.initial!="boolean"){const C=Xi(e,Array.isArray(h.initial)?h.initial[0]:h.initial);C&&C.transition&&(R.transition=C.transition)}x.forEach(C=>{const j=e.getBaseTarget(C),E=e.getValue(C);E&&(E.liveStyle=!0),R[C]=j??null}),v.push({animation:R})}let T=!!v.length;return r&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(T=!1),r=!1,T?t(v):Promise.resolve()}function f(m,h){if(s[m].isActive===h)return Promise.resolve();e.variantChildren?.forEach(v=>v.animationState?.setActive(m,h)),s[m].isActive=h;const y=u(m);for(const v in s)s[v].protectedKeys={};return y}return{animateChanges:u,setActive:f,setAnimateFunction:l,getState:()=>s,reset:()=>{s=O1()}}}function U3(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!bT(t,e):!1}function Cr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function O1(){return{animate:Cr(!0),whileInView:Cr(),whileHover:Cr(),whileTap:Cr(),whileDrag:Cr(),whileFocus:Cr(),exit:Cr()}}function D1(e,t){e.min=t.min,e.max=t.max}function ys(e,t){D1(e.x,t.x),D1(e.y,t.y)}function z1(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const xT=1e-4,V3=1-xT,B3=1+xT,wT=.01,Z3=0-wT,H3=0+wT;function Sn(e){return e.max-e.min}function F3(e,t,s){return Math.abs(e-t)<=s}function I1(e,t,s,r=.5){e.origin=r,e.originPoint=kt(t.min,t.max,e.origin),e.scale=Sn(s)/Sn(t),e.translate=kt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=V3&&e.scale<=B3||isNaN(e.scale))&&(e.scale=1),(e.translate>=Z3&&e.translate<=H3||isNaN(e.translate))&&(e.translate=0)}function jl(e,t,s,r){I1(e.x,t.x,s.x,r?r.originX:void 0),I1(e.y,t.y,s.y,r?r.originY:void 0)}function L1(e,t,s){e.min=s.min+t.min,e.max=e.min+Sn(t)}function q3(e,t,s){L1(e.x,t.x,s.x),L1(e.y,t.y,s.y)}function P1(e,t,s){e.min=t.min-s.min,e.max=e.min+Sn(t)}function xd(e,t,s){P1(e.x,t.x,s.x),P1(e.y,t.y,s.y)}function $1(e,t,s,r,i){return e-=t,e=bd(e,1/s,r),i!==void 0&&(e=bd(e,1/i,r)),e}function Y3(e,t=0,s=1,r=.5,i,l=e,u=e){if($s.test(t)&&(t=parseFloat(t),t=kt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=kt(l.min,l.max,r);e===l&&(f-=t),e.min=$1(e.min,t,s,f,i),e.max=$1(e.max,t,s,f,i)}function U1(e,t,[s,r,i],l,u){Y3(e,t[s],t[r],t[i],t.scale,l,u)}const G3=["x","scaleX","originX"],X3=["y","scaleY","originY"];function V1(e,t,s,r){U1(e.x,t,G3,s?s.x:void 0,r?r.x:void 0),U1(e.y,t,X3,s?s.y:void 0,r?r.y:void 0)}function B1(e){return e.translate===0&&e.scale===1}function ST(e){return B1(e.x)&&B1(e.y)}function Z1(e,t){return e.min===t.min&&e.max===t.max}function K3(e,t){return Z1(e.x,t.x)&&Z1(e.y,t.y)}function H1(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ET(e,t){return H1(e.x,t.x)&&H1(e.y,t.y)}function F1(e){return Sn(e.x)/Sn(e.y)}function q1(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Os(e){return[e("x"),e("y")]}function W3(e,t,s){let r="";const i=e.x.translate/t.x,l=e.y.translate/t.y,u=s?.z||0;if((i||l||u)&&(r=`translate3d(${i}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:h,rotate:y,rotateX:v,rotateY:x,skewX:w,skewY:N}=s;h&&(r=`perspective(${h}px) ${r}`),y&&(r+=`rotate(${y}deg) `),v&&(r+=`rotateX(${v}deg) `),x&&(r+=`rotateY(${x}deg) `),w&&(r+=`skewX(${w}deg) `),N&&(r+=`skewY(${N}deg) `)}const f=e.x.scale*t.x,m=e.y.scale*t.y;return(f!==1||m!==1)&&(r+=`scale(${f}, ${m})`),r||"none"}const NT=["TopLeft","TopRight","BottomLeft","BottomRight"],J3=NT.length,Y1=e=>typeof e=="string"?parseFloat(e):e,G1=e=>typeof e=="number"||Ne.test(e);function Q3(e,t,s,r,i,l){i?(e.opacity=kt(0,s.opacity??1,e4(r)),e.opacityExit=kt(t.opacity??1,0,t4(r))):l&&(e.opacity=kt(t.opacity??1,s.opacity??1,r));for(let u=0;u<J3;u++){const f=`border${NT[u]}Radius`;let m=X1(t,f),h=X1(s,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||G1(m)===G1(h)?(e[f]=Math.max(kt(Y1(m),Y1(h),r),0),($s.test(h)||$s.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||s.rotate)&&(e.rotate=kt(t.rotate||0,s.rotate||0,r))}function X1(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const e4=TT(0,.5,gN),t4=TT(.5,.95,us);function TT(e,t,s){return r=>r<e?0:r>t?1:s(_l(e,t,r))}function n4(e,t,s){const r=hn(e)?e:eo(e);return r.start(Ug("",r,t,s)),r.animation}function Dl(e,t,s,r={passive:!0}){return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s)}const s4=(e,t)=>e.depth-t.depth;class a4{constructor(){this.children=[],this.isDirty=!1}add(t){Tg(this.children,t),this.isDirty=!0}remove(t){pd(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(s4),this.isDirty=!1,this.children.forEach(t)}}function r4(e,t){const s=wn.now(),r=({timestamp:i})=>{const l=i-s;l>=t&&(Wa(r),e(l-t))};return vt.setup(r,!0),()=>Wa(r)}function Yu(e){return hn(e)?e.get():e}class i4{constructor(){this.members=[]}add(t){Tg(this.members,t);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;i&&i.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&pd(this.members,r)}t.scheduleRender()}remove(t){if(pd(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){const s=this.members.findIndex(i=>t===i);if(s===0)return!1;let r;for(let i=s;i>=0;i--){const l=this.members[i],u=l.instance;if(l.isPresent!==!1&&(!u||u.isConnected!==!1)){r=l;break}}return r?(this.promote(r),!0):!1}promote(t,s){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender();const i=r.options.layoutDependency,l=t.options.layoutDependency;if(!(i!==void 0&&l!==void 0&&i===l)){const m=r.instance;m&&m.isConnected===!1&&!r.snapshot||(t.resumeFrom=r,s&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:f}=t.options;f===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:s,resumingFrom:r}=t;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Gu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Dp=["","X","Y","Z"],o4=1e3;let l4=0;function zp(e,t,s,r){const{latestValues:i}=t;i[e]&&(s[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function jT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=qN(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",vt,!(i||l))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&jT(r)}function CT({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(u={},f=t?.()){this.id=l4++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(d4),this.nodes.forEach(m4),this.nodes.forEach(g4),this.nodes.forEach(f4)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new a4)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Cg),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const m=this.eventHandlers.get(u);m&&m.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=qg(u)&&!u3(u),this.instance=u;const{layoutId:f,layout:m,visualElement:h}=this.options;if(h&&!h.current&&h.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),e){let y,v=0;const x=()=>this.root.updateBlockedByResize=!1;vt.read(()=>{v=window.innerWidth}),e(u,()=>{const w=window.innerWidth;w!==v&&(v=w,this.root.updateBlockedByResize=!0,y&&y(),y=r4(x,250),Gu.hasAnimatedSinceResize&&(Gu.hasAnimatedSinceResize=!1,this.nodes.forEach(J1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:v,hasRelativeLayoutChanged:x,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||h.getDefaultTransition()||w4,{onLayoutAnimationStart:T,onLayoutAnimationComplete:R}=h.getProps(),C=!this.targetLayout||!ET(this.targetLayout,w),j=!v&&x;if(this.options.layoutRoot||this.resumeFrom||j||v&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...$g(N,"layout"),onPlay:T,onComplete:R};(h.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(y,j)}else v||J1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Wa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(y4),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&jT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(K1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(W1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(p4),this.nodes.forEach(c4),this.nodes.forEach(u4)):this.nodes.forEach(W1),this.clearAllSnapshots();const f=wn.now();on.delta=Vs(0,1e3/60,f-on.timestamp),on.timestamp=f,on.isProcessing=!0,jp.update.process(on),jp.preRender.process(on),jp.render.process(on),on.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Hg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(h4),this.sharedNodes.forEach(v4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Sn(this.snapshot.measuredBox.x)&&!Sn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Kt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f&&this.instance){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!ST(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,y=h!==this.prevTransformTemplateValue;u&&this.instance&&(f||kr(this.latestValues)||y)&&(i(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return u&&(m=this.removeTransform(m)),S4(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Kt();const f=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(E4))){const{scroll:h}=this.root;h&&(Bi(f.x,h.offset.x),Bi(f.y,h.offset.y))}return f}removeElementScroll(u){const f=Kt();if(ys(f,u),this.scroll?.wasRoot)return f;for(let m=0;m<this.path.length;m++){const h=this.path[m],{scroll:y,options:v}=h;h!==this.root&&y&&v.layoutScroll&&(y.wasRoot&&ys(f,u),Bi(f.x,y.offset.x),Bi(f.y,y.offset.y))}return f}applyTransform(u,f=!1){const m=Kt();ys(m,u);for(let h=0;h<this.path.length;h++){const y=this.path[h];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&Zi(m,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),kr(y.latestValues)&&Zi(m,y.latestValues)}return kr(this.latestValues)&&Zi(m,this.latestValues),m}removeTransform(u){const f=Kt();ys(f,u);for(let m=0;m<this.path.length;m++){const h=this.path[m];if(!h.instance||!kr(h.latestValues))continue;Im(h.latestValues)&&h.updateSnapshot();const y=Kt(),v=h.measurePageBox();ys(y,v),V1(f,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,y)}return kr(this.latestValues)&&V1(f,this.latestValues),f}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==on.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==f;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:v}=this.options;if(!this.layout||!(y||v))return;this.resolvedRelativeTargetAt=on.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Kt(),this.targetWithTransforms=Kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),q3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ys(this.target,this.layout.layoutBox),uT(this.target,this.targetDelta)):ys(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Im(this.parent.latestValues)||cT(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,f,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),xd(this.relativeTargetOrigin,f,m),ys(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),f=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===on.timestamp&&(m=!1),m)return;const{layout:h,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||y))return;ys(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,x=this.treeScale.y;w3(this.layoutCorrected,this.treeScale,this.path,f),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Kt());const{target:w}=u;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(z1(this.prevProjectionDelta.x,this.projectionDelta.x),z1(this.prevProjectionDelta.y,this.projectionDelta.y)),jl(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==x||!q1(this.projectionDelta.x,this.prevProjectionDelta.x)||!q1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Vi(),this.projectionDelta=Vi(),this.projectionDeltaWithTransform=Vi()}setAnimationOrigin(u,f=!1){const m=this.snapshot,h=m?m.latestValues:{},y={...this.latestValues},v=Vi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const x=Kt(),w=m?m.source:void 0,N=this.layout?this.layout.source:void 0,T=w!==N,R=this.getStack(),C=!R||R.members.length<=1,j=!!(T&&!C&&this.options.crossfade===!0&&!this.path.some(x4));this.animationProgress=0;let E;this.mixTargetDelta=_=>{const A=_/1e3;Q1(v.x,u.x,A),Q1(v.y,u.y,A),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(xd(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),b4(this.relativeTarget,this.relativeTargetOrigin,x,A),E&&K3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Kt()),ys(E,this.relativeTarget)),T&&(this.animationValues=y,Q3(y,h,this.latestValues,A,j,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Wa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vt.update(()=>{Gu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=eo(0)),this.motionValue.jump(0,!1),this.currentAnimation=n4(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),u.onUpdate&&u.onUpdate(f)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(o4),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:f,target:m,layout:h,latestValues:y}=u;if(!(!f||!m||!h)){if(this!==u&&this.layout&&h&&AT(this.options.animationType,this.layout.layoutBox,h.layoutBox)){m=this.target||Kt();const v=Sn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+v;const x=Sn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+x}ys(f,m),Zi(f,y),jl(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new i4),this.sharedNodes.get(u).add(f);const h=f.options.initialPromotionConfig;f.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:m}={}){const h=this.getStack();h&&h.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const h={};m.z&&zp("z",u,h,this.animationValues);for(let y=0;y<Dp.length;y++)zp(`rotate${Dp[y]}`,u,h,this.animationValues),zp(`skew${Dp[y]}`,u,h,this.animationValues);u.render();for(const y in h)u.setStaticValue(y,h[y]),this.animationValues&&(this.animationValues[y]=h[y]);u.scheduleRender()}applyProjectionStyles(u,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Yu(f?.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Yu(f?.pointerEvents)||""),this.hasProjected&&!kr(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=h.animationValues||h.latestValues;this.applyTransformsToTarget();let v=W3(this.projectionDeltaWithTransform,this.treeScale,y);m&&(v=m(y,v)),u.transform=v;const{x,y:w}=this.projectionDelta;u.transformOrigin=`${x.origin*100}% ${w.origin*100}% 0`,h.animationValues?u.opacity=h===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:u.opacity=h===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const N in Pm){if(y[N]===void 0)continue;const{correct:T,applyTo:R,isCSSVariable:C}=Pm[N],j=v==="none"?y[N]:T(y[N],h);if(R){const E=R.length;for(let _=0;_<E;_++)u[R[_]]=j}else C?this.options.visualElement.renderState.vars[N]=j:u[N]=j}this.options.layoutId&&(u.pointerEvents=h===this?Yu(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(K1),this.root.sharedNodes.clear()}}}function c4(e){e.updateLayout()}function u4(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:i}=e.options,l=t.source!==e.layout.source;i==="size"?Os(y=>{const v=l?t.measuredBox[y]:t.layoutBox[y],x=Sn(v);v.min=s[y].min,v.max=v.min+x}):AT(i,t.layoutBox,s)&&Os(y=>{const v=l?t.measuredBox[y]:t.layoutBox[y],x=Sn(s[y]);v.max=v.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[y].max=e.relativeTarget[y].min+x)});const u=Vi();jl(u,s,t.layoutBox);const f=Vi();l?jl(f,e.applyTransform(r,!0),t.measuredBox):jl(f,s,t.layoutBox);const m=!ST(u);let h=!1;if(!e.resumeFrom){const y=e.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:v,layout:x}=y;if(v&&x){const w=Kt();xd(w,t.layoutBox,v.layoutBox);const N=Kt();xd(N,s,x.layoutBox),ET(w,N)||(h=!0),y.options.layoutRoot&&(e.relativeTarget=N,e.relativeTargetOrigin=w,e.relativeParent=y)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:f,layoutDelta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function d4(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function f4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function h4(e){e.clearSnapshot()}function K1(e){e.clearMeasurements()}function W1(e){e.isLayoutDirty=!1}function p4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function J1(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function m4(e){e.resolveTargetDelta()}function g4(e){e.calcProjection()}function y4(e){e.resetSkewAndRotation()}function v4(e){e.removeLeadSnapshot()}function Q1(e,t,s){e.translate=kt(t.translate,0,s),e.scale=kt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function ew(e,t,s,r){e.min=kt(t.min,s.min,r),e.max=kt(t.max,s.max,r)}function b4(e,t,s,r){ew(e.x,t.x,s.x,r),ew(e.y,t.y,s.y,r)}function x4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const w4={duration:.45,ease:[.4,0,.1,1]},tw=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),nw=tw("applewebkit/")&&!tw("chrome/")?Math.round:us;function sw(e){e.min=nw(e.min),e.max=nw(e.max)}function S4(e){sw(e.x),sw(e.y)}function AT(e,t,s){return e==="position"||e==="preserve-aspect"&&!F3(F1(t),F1(s),.2)}function E4(e){return e!==e.root&&e.scroll?.wasRoot}const N4=CT({attachResizeListener:(e,t)=>Dl(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Ip={current:void 0},RT=CT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ip.current){const e=new N4({});e.mount(window),e.setOptions({layoutScroll:!0}),Ip.current=e}return Ip.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Wg=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function aw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function T4(...e){return t=>{let s=!1;const r=e.map(i=>{const l=aw(i,t);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let i=0;i<r.length;i++){const l=r[i];typeof l=="function"?l():aw(e[i],null)}}}}function j4(...e){return b.useCallback(T4(...e),e)}class C4 extends b.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=s.offsetParent,i=Dm(r)&&r.offsetWidth||0,l=Dm(r)&&r.offsetHeight||0,u=this.props.sizeRef.current;u.height=s.offsetHeight||0,u.width=s.offsetWidth||0,u.top=s.offsetTop,u.left=s.offsetLeft,u.right=i-u.width-u.left,u.bottom=l-u.height-u.top}return null}componentDidUpdate(){}render(){return this.props.children}}function A4({children:e,isPresent:t,anchorX:s,anchorY:r,root:i,pop:l}){const u=b.useId(),f=b.useRef(null),m=b.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=b.useContext(Wg),y=e.props?.ref??e?.ref,v=j4(f,y);return b.useInsertionEffect(()=>{const{width:x,height:w,top:N,left:T,right:R,bottom:C}=m.current;if(t||l===!1||!f.current||!x||!w)return;const j=s==="left"?`left: ${T}`:`right: ${R}`,E=r==="bottom"?`bottom: ${C}`:`top: ${N}`;f.current.dataset.motionPopId=u;const _=document.createElement("style");h&&(_.nonce=h);const A=i??document.head;return A.appendChild(_),_.sheet&&_.sheet.insertRule(`
21
- [data-motion-pop-id="${u}"] {
22
- position: absolute !important;
23
- width: ${x}px !important;
24
- height: ${w}px !important;
25
- ${j}px !important;
26
- ${E}px !important;
27
- }
28
- `),()=>{A.contains(_)&&A.removeChild(_)}},[t]),d.jsx(C4,{isPresent:t,childRef:f,sizeRef:m,pop:l,children:l===!1?e:b.cloneElement(e,{ref:v})})}const R4=({children:e,initial:t,isPresent:s,onExitComplete:r,custom:i,presenceAffectsLayout:l,mode:u,anchorX:f,anchorY:m,root:h})=>{const y=Ng(_4),v=b.useId();let x=!0,w=b.useMemo(()=>(x=!1,{id:v,initial:t,isPresent:s,custom:i,onExitComplete:N=>{y.set(N,!0);for(const T of y.values())if(!T)return;r&&r()},register:N=>(y.set(N,!1),()=>y.delete(N))}),[s,y,r]);return l&&x&&(w={...w}),b.useMemo(()=>{y.forEach((N,T)=>y.set(T,!1))},[s]),b.useEffect(()=>{!s&&!y.size&&r&&r()},[s]),e=d.jsx(A4,{pop:u==="popLayout",isPresent:s,anchorX:f,anchorY:m,root:h,children:e}),d.jsx(Ud.Provider,{value:w,children:e})};function _4(){return new Map}function _T(e=!0){const t=b.useContext(Ud);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:i}=t,l=b.useId();b.useEffect(()=>{if(e)return i(l)},[e]);const u=b.useCallback(()=>e&&r&&r(l),[l,r,e]);return!s&&r?[!1,u]:[!0]}const Nu=e=>e.key||"";function rw(e){const t=[];return b.Children.forEach(e,s=>{b.isValidElement(s)&&t.push(s)}),t}const k4=({children:e,custom:t,initial:s=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:l="sync",propagate:u=!1,anchorX:f="left",anchorY:m="top",root:h})=>{const[y,v]=_T(u),x=b.useMemo(()=>rw(e),[e]),w=u&&!y?[]:x.map(Nu),N=b.useRef(!0),T=b.useRef(x),R=Ng(()=>new Map),C=b.useRef(new Set),[j,E]=b.useState(x),[_,A]=b.useState(x);aN(()=>{N.current=!1,T.current=x;for(let I=0;I<_.length;I++){const Y=Nu(_[I]);w.includes(Y)?(R.delete(Y),C.current.delete(Y)):R.get(Y)!==!0&&R.set(Y,!1)}},[_,w.length,w.join("-")]);const M=[];if(x!==j){let I=[...x];for(let Y=0;Y<_.length;Y++){const F=_[Y],B=Nu(F);w.includes(B)||(I.splice(Y,0,F),M.push(F))}return l==="wait"&&M.length&&(I=M),A(rw(I)),E(x),null}const{forceRender:O}=b.useContext(Eg);return d.jsx(d.Fragment,{children:_.map(I=>{const Y=Nu(I),F=u&&!y?!1:x===_||w.includes(Y),B=()=>{if(C.current.has(Y))return;if(C.current.add(Y),R.has(Y))R.set(Y,!0);else return;let P=!0;R.forEach(X=>{X||(P=!1)}),P&&(O?.(),A(T.current),u&&v?.(),r&&r())};return d.jsx(R4,{isPresent:F,initial:!N.current||s?void 0:!1,custom:t,presenceAffectsLayout:i,mode:l,root:h,onExitComplete:F?void 0:B,anchorX:f,anchorY:m,children:I},Y)})})},kT=b.createContext({strict:!1}),iw={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let ow=!1;function M4(){if(ow)return;const e={};for(const t in iw)e[t]={isEnabled:s=>iw[t].some(r=>!!s[r])};iT(e),ow=!0}function MT(){return M4(),y3()}function O4(e){const t=MT();for(const s in e)t[s]={...t[s],...e[s]};iT(t)}const D4=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function wd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||D4.has(e)}let OT=e=>!wd(e);function z4(e){typeof e=="function"&&(OT=t=>t.startsWith("on")?!wd(t):e(t))}try{z4(require("@emotion/is-prop-valid").default)}catch{}function I4(e,t,s){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(OT(i)||s===!0&&wd(i)||!t&&!wd(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Zd=b.createContext({});function L4(e,t){if(Bd(e)){const{initial:s,animate:r}=e;return{initial:s===!1||Ol(s)?s:void 0,animate:Ol(r)?r:void 0}}return e.inherit!==!1?t:{}}function P4(e){const{initial:t,animate:s}=L4(e,b.useContext(Zd));return b.useMemo(()=>({initial:t,animate:s}),[lw(t),lw(s)])}function lw(e){return Array.isArray(e)?e.join(" "):e}const Jg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function DT(e,t,s){for(const r in t)!hn(t[r])&&!hT(r,s)&&(e[r]=t[r])}function $4({transformTemplate:e},t){return b.useMemo(()=>{const s=Jg();return Xg(s,t,e),Object.assign({},s.vars,s.style)},[t])}function U4(e,t){const s=e.style||{},r={};return DT(r,s,e),Object.assign(r,$4(e,t)),r}function V4(e,t){const s={},r=U4(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=r,s}const zT=()=>({...Jg(),attrs:{}});function B4(e,t,s,r){const i=b.useMemo(()=>{const l=zT();return pT(l,t,gT(r),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};DT(l,e.style,e),i.style={...l,...i.style}}return i}const Z4=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Qg(e){return typeof e!="string"||e.includes("-")?!1:!!(Z4.indexOf(e)>-1||/[A-Z]/u.test(e))}function H4(e,t,s,{latestValues:r},i,l=!1,u){const m=(u??Qg(e)?B4:V4)(t,r,i,e),h=I4(t,typeof e=="string",l),y=e!==b.Fragment?{...h,...m,ref:s}:{},{children:v}=t,x=b.useMemo(()=>hn(v)?v.get():v,[v]);return b.createElement(e,{...y,children:x})}function F4({scrapeMotionValuesFromProps:e,createRenderState:t},s,r,i){return{latestValues:q4(s,r,i,e),renderState:t()}}function q4(e,t,s,r){const i={},l=r(e,{});for(const x in l)i[x]=Yu(l[x]);let{initial:u,animate:f}=e;const m=Bd(e),h=aT(e);t&&h&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),f===void 0&&(f=t.animate));let y=s?s.initial===!1:!1;y=y||u===!1;const v=y?f:u;if(v&&typeof v!="boolean"&&!Vd(v)){const x=Array.isArray(v)?v:[v];for(let w=0;w<x.length;w++){const N=Vg(e,x[w]);if(N){const{transitionEnd:T,transition:R,...C}=N;for(const j in C){let E=C[j];if(Array.isArray(E)){const _=y?E.length-1:0;E=E[_]}E!==null&&(i[j]=E)}for(const j in T)i[j]=T[j]}}}return i}const IT=e=>(t,s)=>{const r=b.useContext(Zd),i=b.useContext(Ud),l=()=>F4(e,t,r,i);return s?l():Ng(l)},Y4=IT({scrapeMotionValuesFromProps:Kg,createRenderState:Jg}),G4=IT({scrapeMotionValuesFromProps:yT,createRenderState:zT}),X4=Symbol.for("motionComponentSymbol");function K4(e,t,s){const r=b.useRef(s);b.useInsertionEffect(()=>{r.current=s});const i=b.useRef(null);return b.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=r.current;if(typeof u=="function")if(l){const f=u(l);typeof f=="function"&&(i.current=f)}else i.current?(i.current(),i.current=null):u(l);else u&&(u.current=l)},[t])}const LT=b.createContext({});function zi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function W4(e,t,s,r,i,l){const{visualElement:u}=b.useContext(Zd),f=b.useContext(kT),m=b.useContext(Ud),h=b.useContext(Wg),y=h.reducedMotion,v=h.skipAnimations,x=b.useRef(null),w=b.useRef(!1);r=r||f.renderer,!x.current&&r&&(x.current=r(e,{visualState:t,parent:u,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y,skipAnimations:v,isSVG:l}),w.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const N=x.current,T=b.useContext(LT);N&&!N.projection&&i&&(N.type==="html"||N.type==="svg")&&J4(x.current,s,i,T);const R=b.useRef(!1);b.useInsertionEffect(()=>{N&&R.current&&N.update(s,m)});const C=s[FN],j=b.useRef(!!C&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return aN(()=>{w.current=!0,N&&(R.current=!0,window.MotionIsMounted=!0,N.updateFeatures(),N.scheduleRenderMicrotask(),j.current&&N.animationState&&N.animationState.animateChanges())}),b.useEffect(()=>{N&&(!j.current&&N.animationState&&N.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),j.current=!1),N.enteringChildren=void 0)}),N}function J4(e,t,s,r){const{layoutId:i,layout:l,drag:u,dragConstraints:f,layoutScroll:m,layoutRoot:h,layoutCrossfade:y}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:PT(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!u||f&&zi(f),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:m,layoutRoot:h})}function PT(e){if(e)return e.options.allowProjection!==!1?e.projection:PT(e.parent)}function Lp(e,{forwardMotionProps:t=!1,type:s}={},r,i){r&&O4(r);const l=s?s==="svg":Qg(e),u=l?G4:Y4;function f(h,y){let v;const x={...b.useContext(Wg),...h,layoutId:Q4(h)},{isStatic:w}=x,N=P4(h),T=u(h,w);if(!w&&sN){eI();const R=tI(x);v=R.MeasureLayout,N.visualElement=W4(e,T,x,i,R.ProjectionNode,l)}return d.jsxs(Zd.Provider,{value:N,children:[v&&N.visualElement?d.jsx(v,{visualElement:N.visualElement,...x}):null,H4(e,h,K4(T,N.visualElement,y),T,w,t,l)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=b.forwardRef(f);return m[X4]=e,m}function Q4({layoutId:e}){const t=b.useContext(Eg).id;return t&&e!==void 0?t+"-"+e:e}function eI(e,t){b.useContext(kT).strict}function tI(e){const t=MT(),{drag:s,layout:r}=t;if(!s&&!r)return{};const i={...s,...r};return{MeasureLayout:s?.isEnabled(e)||r?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function nI(e,t){if(typeof Proxy>"u")return Lp;const s=new Map,r=(l,u)=>Lp(l,u,e,t),i=(l,u)=>r(l,u);return new Proxy(i,{get:(l,u)=>u==="create"?r:(s.has(u)||s.set(u,Lp(u,void 0,e,t)),s.get(u))})}const sI=(e,t)=>t.isSVG??Qg(e)?new D3(t):new A3(t,{allowProjection:e!==b.Fragment});class aI extends rr{constructor(t){super(t),t.animationState||(t.animationState=$3(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Vd(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let rI=0;class iI extends rr{constructor(){super(...arguments),this.id=rI++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);s&&!t&&i.then(()=>{s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const oI={animation:{Feature:aI},exit:{Feature:iI}};function Yl(e){return{point:{x:e.pageX,y:e.pageY}}}const lI=e=>t=>Fg(t)&&e(t,Yl(t));function Cl(e,t,s,r){return Dl(e,t,lI(s),r)}const $T=({current:e})=>e?e.ownerDocument.defaultView:null,cw=(e,t)=>Math.abs(e-t);function cI(e,t){const s=cw(e.x,t.x),r=cw(e.y,t.y);return Math.sqrt(s**2+r**2)}const uw=new Set(["auto","scroll"]);class UT{constructor(t,s,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=$p(this.lastMoveEventInfo,this.history),N=this.startEvent!==null,T=cI(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!N&&!T)return;const{point:R}=w,{timestamp:C}=on;this.history.push({...R,timestamp:C});const{onStart:j,onMove:E}=this.handlers;N||(j&&j(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,w)},this.handlePointerMove=(w,N)=>{this.lastMoveEvent=w,this.lastMoveEventInfo=Pp(N,this.transformPagePoint),vt.update(this.updatePoint,!0)},this.handlePointerUp=(w,N)=>{this.end();const{onEnd:T,onSessionEnd:R,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=$p(w.type==="pointercancel"?this.lastMoveEventInfo:Pp(N,this.transformPagePoint),this.history);this.startEvent&&T&&T(w,j),R&&R(w,j)},!Fg(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=u,this.contextWindow=i||window;const m=Yl(t),h=Pp(m,this.transformPagePoint),{point:y}=h,{timestamp:v}=on;this.history=[{...y,timestamp:v}];const{onSessionStart:x}=s;x&&x(t,$p(h,this.history)),this.removeListeners=Hl(Cl(this.contextWindow,"pointermove",this.handlePointerMove),Cl(this.contextWindow,"pointerup",this.handlePointerUp),Cl(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(t){let s=t.parentElement;for(;s;){const r=getComputedStyle(s);(uw.has(r.overflowX)||uw.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:i.x-s.x,y:i.y-s.y};l.x===0&&l.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,i),vt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Wa(this.updatePoint)}}function Pp(e,t){return t?{point:t(e.point)}:e}function dw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function $p({point:e},t){return{point:e,delta:dw(e,VT(t)),offset:dw(e,uI(t)),velocity:dI(t,.1)}}function uI(e){return e[0]}function VT(e){return e[e.length-1]}function dI(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,r=null;const i=VT(e);for(;s>=0&&(r=e[s],!(i.timestamp-r.timestamp>Ss(t)));)s--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Ss(t)*2&&(r=e[1]);const l=cs(i.timestamp-r.timestamp);if(l===0)return{x:0,y:0};const u={x:(i.x-r.x)/l,y:(i.y-r.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function fI(e,{min:t,max:s},r){return t!==void 0&&e<t?e=r?kt(t,e,r.min):Math.max(e,t):s!==void 0&&e>s&&(e=r?kt(s,e,r.max):Math.min(e,s)),e}function fw(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function hI(e,{top:t,left:s,bottom:r,right:i}){return{x:fw(e.x,s,i),y:fw(e.y,t,r)}}function hw(e,t){let s=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,r]=[r,s]),{min:s,max:r}}function pI(e,t){return{x:hw(e.x,t.x),y:hw(e.y,t.y)}}function mI(e,t){let s=.5;const r=Sn(e),i=Sn(t);return i>r?s=_l(t.min,t.max-r,e.min):r>i&&(s=_l(e.min,e.max-i,t.min)),Vs(0,1,s)}function gI(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}const $m=.35;function yI(e=$m){return e===!1?e=0:e===!0&&(e=$m),{x:pw(e,"left","right"),y:pw(e,"top","bottom")}}function pw(e,t,s){return{min:mw(e,t),max:mw(e,s)}}function mw(e,t){return typeof e=="number"?e:e[t]||0}const vI=new WeakMap;class bI{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=v=>{s&&this.snapToCursor(Yl(v).point),this.stopAnimation()},u=(v,x)=>{const{drag:w,dragPropagation:N,onDragStart:T}=this.getProps();if(w&&!N&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Y5(w),!this.openDragLock))return;this.latestPointerEvent=v,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Os(C=>{let j=this.getAxisMotionValue(C).get()||0;if($s.test(j)){const{projection:E}=this.visualElement;if(E&&E.layout){const _=E.layout.layoutBox[C];_&&(j=Sn(_)*(parseFloat(j)/100))}}this.originPoint[C]=j}),T&&vt.update(()=>T(v,x),!1,!0),_m(this.visualElement,"transform");const{animationState:R}=this.visualElement;R&&R.setActive("whileDrag",!0)},f=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x;const{dragPropagation:w,dragDirectionLock:N,onDirectionLock:T,onDrag:R}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:C}=x;if(N&&this.currentDirection===null){this.currentDirection=wI(C),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),R&&vt.update(()=>R(v,x),!1,!0)},m=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x,this.stop(v,x),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:v}=this.getProps();(v||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:y}=this.getProps();this.panSession=new UT(t,{onSessionStart:l,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:$T(this.visualElement),element:this.visualElement.current})}stop(t,s){const r=t||this.latestPointerEvent,i=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!r)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&vt.postRender(()=>f(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,r){const{drag:i}=this.getProps();if(!r||!Tu(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(u=fI(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&zi(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=hI(r.layoutBox,t):this.constraints=!1,this.elastic=yI(s),i!==this.constraints&&!zi(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Os(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=gI(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!zi(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=S3(r,i.root,this.visualElement.getTransformPagePoint());let u=pI(i.layout.layoutBox,l);if(s){const f=s(b3(u));this.hasMutatedConstraints=!!f,f&&(u=lT(f))}return u}startAnimation(t){const{drag:s,dragMomentum:r,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=Os(y=>{if(!Tu(y,s,this.currentDirection))return;let v=m&&m[y]||{};u&&(v={min:0,max:0});const x=i?200:1e6,w=i?40:1e7,N={type:"inertia",velocity:r?t[y]:0,bounceStiffness:x,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(y,N)});return Promise.all(h).then(f)}startAxisValueAnimation(t,s){const r=this.getAxisMotionValue(t);return _m(this.visualElement,t),r.start(Ug(t,r,0,s,this.visualElement,!1))}stopAnimation(){Os(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[s];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Os(s=>{const{drag:r}=this.getProps();if(!Tu(s,r,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(s);if(i&&i.layout){const{min:u,max:f}=i.layout.layoutBox[s],m=l.get()||0;l.set(t[s]-kt(u,f,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!zi(s)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Os(u=>{const f=this.getAxisMotionValue(u);if(f&&this.constraints!==!1){const m=f.get();i[u]=mI({min:m,max:m},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Os(u=>{if(!Tu(u,t,null))return;const f=this.getAxisMotionValue(u),{min:m,max:h}=this.constraints[u];f.set(kt(m,h,i[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;vI.set(this.visualElement,this);const t=this.visualElement.current,s=Cl(t,"pointerdown",h=>{const{drag:y,dragListener:v=!0}=this.getProps(),x=h.target,w=x!==t&&Q5(x);y&&v&&!w&&this.start(h)});let r;const i=()=>{const{dragConstraints:h}=this.getProps();zi(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),r||(r=xI(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",i);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),vt.read(i);const f=Dl(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:y})=>{this.isDragging&&y&&(Os(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=h[v].translate,x.set(x.get()+h[v].translate))}),this.visualElement.render())}));return()=>{f(),s(),u(),m&&m(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:u=$m,dragMomentum:f=!0}=t;return{...t,drag:s,dragDirectionLock:r,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:f}}}function gw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function xI(e,t,s){const r=E1(e,gw(s)),i=E1(t,gw(s));return()=>{r(),i()}}function Tu(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function wI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class SI extends rr{constructor(t){super(t),this.removeGroupControls=us,this.removeListeners=us,this.controls=new bI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||us}update(){const{dragControls:t}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};t!==s&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Up=e=>(t,s)=>{e&&vt.update(()=>e(t,s),!1,!0)};class EI extends rr{constructor(){super(...arguments),this.removePointerDownListener=us}onPointerDown(t){this.session=new UT(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:$T(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Up(t),onStart:Up(s),onMove:Up(r),onEnd:(l,u)=>{delete this.session,i&&vt.postRender(()=>i(l,u))}}}mount(){this.removePointerDownListener=Cl(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Vp=!1;class NI extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r,layoutId:i}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),r&&r.register&&i&&r.register(l),Vp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gu.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:r,drag:i,isPresent:l}=this.props,{projection:u}=r;return u&&(u.isPresent=l,t.layoutDependency!==s&&u.setOptions({...u.options,layoutDependency:s}),Vp=!0,i||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||vt.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Hg.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:i}=t;Vp=!0,i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function BT(e){const[t,s]=_T(),r=b.useContext(Eg);return d.jsx(NI,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(LT),isPresent:t,safeToRemove:s})}const TI={pan:{Feature:EI},drag:{Feature:SI,ProjectionNode:RT,MeasureLayout:BT}};function yw(e,t,s){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",s==="Start");const i="onHover"+s,l=r[i];l&&vt.postRender(()=>l(t,Yl(t)))}class jI extends rr{mount(){const{current:t}=this.node;t&&(this.unmount=X5(t,(s,r)=>(yw(this.node,r,"Start"),i=>yw(this.node,i,"End"))))}unmount(){}}class CI extends rr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Hl(Dl(this.node.current,"focus",()=>this.onFocus()),Dl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vw(e,t,s){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",s==="Start");const i="onTap"+(s==="End"?"":s),l=r[i];l&&vt.postRender(()=>l(t,Yl(t)))}class AI extends rr{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:r}=this.node.props;this.unmount=t3(t,(i,l)=>(vw(this.node,l,"Start"),(u,{success:f})=>vw(this.node,u,f?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:r?.tap===!1})}unmount(){}}const Um=new WeakMap,Bp=new WeakMap,RI=e=>{const t=Um.get(e.target);t&&t(e)},_I=e=>{e.forEach(RI)};function kI({root:e,...t}){const s=e||document;Bp.has(s)||Bp.set(s,{});const r=Bp.get(s),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(_I,{root:e,...t})),r[i]}function MI(e,t,s){const r=kI(t);return Um.set(e,s),r.observe(e),()=>{Um.delete(e),r.unobserve(e)}}const OI={some:0,all:1};class DI extends rr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:s,margin:r,amount:i="some",once:l}=t,u={root:s?s.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:OI[i]},f=m=>{const{isIntersecting:h}=m;if(this.isInView===h||(this.isInView=h,l&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),x=h?y:v;x&&x(m)};return MI(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(zI(t,s))&&this.startObserver()}unmount(){}}function zI({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const II={inView:{Feature:DI},tap:{Feature:AI},focus:{Feature:CI},hover:{Feature:jI}},LI={layout:{ProjectionNode:RT,MeasureLayout:BT}},PI={...oI,...II,...TI,...LI},$I=nI(PI,sI);function UI(e){return"type"in e&&e.type==="separator"}function VI(e){return"type"in e&&e.type==="group"}function bw({item:e}){return d.jsxs(mk,{disabled:e.disabled,onClick:e.action,className:"flex items-center gap-3 px-3 py-1.5 text-[12px] font-mono text-neutral-300 outline-none select-none data-[highlighted]:bg-neutral-700/50 data-[highlighted]:text-white data-[disabled]:opacity-40 data-[disabled]:pointer-events-none cursor-default",children:[e.icon&&d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-neutral-400",children:e.icon}),d.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&d.jsx("span",{className:"text-neutral-400 text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}const ZT=IS.forwardRef(({items:e},t)=>d.jsx($I.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:d.jsx(dD,{className:"bg-neutral-900/95 backdrop-blur-xl border border-neutral-700/60 rounded-lg shadow-2xl py-1 min-w-[180px] z-[200] outline-none",children:e.map((s,r)=>UI(s)?d.jsx(BD,{className:"h-px bg-neutral-700/50 my-1"},`sep-${r}`):VI(s)?d.jsxs(hk,{children:[d.jsx(pk,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-neutral-400",children:s.label}),s.items.map(i=>d.jsx(bw,{item:i},i.id))]},`grp-${r}`):d.jsx(bw,{item:s},s.id))})}));ZT.displayName="PopupContent";function BI({items:e,children:t}){return e.length===0?d.jsx(d.Fragment,{children:t}):d.jsxs(ZD,{children:[d.jsx(HD,{render:d.jsx("div",{style:{display:"contents"}}),children:t}),d.jsx(hD,{children:d.jsx(jD,{className:"z-[200]",sideOffset:4,children:d.jsx(k4,{children:d.jsx(ZT,{items:e})})})})]})}const xw=()=>{},ZI={x:0,y:0},HI=({children:e,hud:t,mode:s="canvas",panOffset:r=ZI,scale:i=1,onPan:l=xw,onZoom:u=xw,onPanStart:f,onPanEnd:m,isTransitioning:h=!1,onViewportChange:y,onCanvasClick:v,canvasProps:x,zoomSensitivity:w,zoomControlsRightOffset:N,canvasContextMenuItems:T})=>{const R=b.useRef(null),C=b.useRef(i);C.current=i;const j=b.useRef(u);j.current=u;const E=b.useRef(l);E.current=l;const _=b.useRef(f);_.current=f;const A=b.useRef(m);A.current=m;const M=b.useRef(w);M.current=w;const[O,I]=b.useState(!1),Y=b.useRef(!1),[F,B]=b.useState(!1),P=b.useRef(!1),X=b.useRef({x:0,y:0}),ie=b.useRef(z=>{const H=z.target||document.activeElement;if(!H)return!1;const U=H.tagName;return!!(U==="INPUT"||U==="TEXTAREA"||H.isContentEditable||H.closest?.(".xterm"))});b.useEffect(()=>{if(s!=="canvas")return;const z=ne=>{ne.key!==" "||ne.repeat||ie.current(ne)||h||(ne.preventDefault(),Y.current=!0,I(!0))},H=ne=>{ne.key===" "&&Y.current&&(Y.current=!1,I(!1),P.current&&(P.current=!1,B(!1),A.current?.()))},U=()=>{Y.current&&(Y.current=!1,I(!1),P.current&&(P.current=!1,B(!1),A.current?.()))};return window.addEventListener("keydown",z),window.addEventListener("keyup",H),window.addEventListener("blur",U),()=>{window.removeEventListener("keydown",z),window.removeEventListener("keyup",H),window.removeEventListener("blur",U)}},[s,h]);const ee=b.useCallback(z=>{z.button===0&&(z.preventDefault(),P.current=!0,B(!0),X.current={x:z.clientX,y:z.clientY},_.current?.())},[]);return b.useEffect(()=>{if(!O)return;const z=U=>{if(!P.current)return;const ne=(U.clientX-X.current.x)/C.current,G=(U.clientY-X.current.y)/C.current;X.current={x:U.clientX,y:U.clientY},E.current({x:ne,y:G})},H=()=>{P.current&&(P.current=!1,B(!1),A.current?.())};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",H),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",H)}},[O]),b.useEffect(()=>{if(s!=="canvas")return;const z=H=>{if(H.ctrlKey||H.metaKey){H.preventDefault();const U=C.current,ne=-H.deltaY*.001*(M.current??1),G=Math.min(Math.max(.2,U+ne),3);C.current=G,j.current(G)}};return window.addEventListener("wheel",z,{passive:!1}),()=>window.removeEventListener("wheel",z)},[s]),b.useEffect(()=>{if(!y)return;let z=null;const H=()=>{z&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{y({width:window.innerWidth,height:window.innerHeight})})};return H(),window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H),z&&cancelAnimationFrame(z)}},[y]),s==="panel"?d.jsxs("div",{ref:R,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[d.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar",children:e}),d.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]}):d.jsxs("div",{ref:R,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[d.jsx(BI,{items:T??[],children:d.jsx(c2,{panOffset:r,scale:i,onPan:l,onPanStart:f,onPanEnd:m,isPanLocked:h,onClick:v,showGuides:x?.showGuides,onGuidesChange:x?.onGuidesChange,gridOpacity:x?.gridOpacity})}),d.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:i},children:d.jsx("div",{style:{position:"absolute",left:r.x,top:r.y},children:e})}),O&&d.jsx("div",{className:`fixed inset-0 z-20 ${F?"cursor-grabbing":"cursor-grab"}`,onMouseDown:ee}),d.jsx("div",{className:"fixed bottom-[36px] z-30",style:{right:(N??280)+16},children:d.jsx(a_,{scale:i,onZoom:z=>u(z)})}),d.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]})},FI={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},qI=b.createContext(FI);function Hd(){return b.useContext(qI)}const Fd={panels:{statusBar:"bg-neutral-950/95 backdrop-blur-xl border-t border-neutral-700 shadow-[0_-5px_30px_rgba(0,0,0,0.6),inset_0_1px_0_rgba(255,255,255,0.06)] fixed bottom-0 left-0 right-0 z-[60]"},zIndex:{drawer:70},layout:{navHeight:48,statusBarHeight:28}},YI=Fd.panels;function ey(){const{titleBarInset:e}=Hd();return b.useMemo(()=>{const t=Fd.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}const GI=({title:e,subtitle:t,center:s,actions:r,onTitleClick:i,search:l})=>{const{dragRegionProps:u,onInteractiveMouseDown:f}=Hd(),{navTotalHeight:m}=ey(),h=l&&l.value&&l.value.length>0;return d.jsx("div",{"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...u,children:d.jsxs("div",{className:"bg-neutral-950/95 backdrop-blur-xl border-b border-neutral-700/80 shadow-[0_4px_30px_rgba(0,0,0,0.5)] flex items-end px-4",style:{height:m},children:[d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/8 to-transparent"}),d.jsxs("div",{className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-3 select-none",onMouseDown:f,children:[d.jsx("button",{onClick:i,className:"text-[22px] font-bold text-white tracking-[0.25em] font-mono leading-none bg-transparent border-none cursor-pointer",children:e}),t&&d.jsx("span",{className:"text-xs font-mono text-neutral-400",children:t})]}),s&&d.jsx("div",{className:"flex-1 flex justify-center h-12 items-center",onMouseDown:f,children:s}),d.jsxs("div",{className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:f,children:[r,l&&d.jsxs("div",{className:"relative w-[220px] bg-white/[0.06] border border-neutral-600/50 rounded px-2.5 hover:border-neutral-500/60 focus-within:border-neutral-400/50 focus-within:bg-white/[0.08] transition-all duration-200",children:[d.jsx(ig,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-400"}),d.jsx("input",{type:"text",value:l.value,onChange:y=>l.onChange(y.target.value),placeholder:l.placeholder??"Search...",className:`
29
- w-full h-7 pl-5 pr-6 bg-transparent text-[12px] font-mono tracking-wider
30
- placeholder:text-neutral-400 text-neutral-200
31
- focus:outline-none transition-all duration-200
32
- ${h?"text-emerald-400":""}
33
- `}),h&&d.jsx("button",{onClick:()=>l.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-white transition-colors",children:d.jsx(HS,{size:12})})]})]})]})})},ww=({side:e,title:t,icon:s,isCollapsed:r=!1,onToggleCollapse:i,headerActions:l,footer:u,style:f,width:m,onResizeStart:h,children:y})=>{if(r){const C=e==="left"?P2:B2;return d.jsx("button",{onClick:i,className:`fixed top-1/2 -translate-y-1/2 z-40 ${e==="left"?"left-3":"right-3"} p-2.5 rounded bg-neutral-950/95 border border-neutral-700/80 hover:border-emerald-500/60 backdrop-blur-xl shadow-[0_0_20px_rgba(0,0,0,0.5),inset_0_1px_0_rgba(255,255,255,0.08)] hover:shadow-[0_0_30px_rgba(16,185,129,0.2),inset_0_1px_0_rgba(255,255,255,0.1)] transition-all duration-200 group pointer-events-auto`,title:`Expand ${t||"panel"}`,children:d.jsx(C,{size:14,className:"text-neutral-400 group-hover:text-emerald-400 transition-colors",strokeWidth:1.5})})}const v=e==="left"?I2:U2,{panelTopOffset:x}=ey(),T=`bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 shadow-[0_0_30px_rgba(0,0,0,0.8),inset_0_1px_0_rgba(255,255,255,0.08)] fixed bottom-[28px] z-40 rounded-none border-t-0 overflow-hidden ${e==="left"?"border-l-0 border-r-0":"border-r-0 border-l-0"}`,R={...f,position:"fixed",top:x,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${m||280}px`};return d.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector",className:`${T} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:R,children:[h&&d.jsxs("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-[7px] cursor-ew-resize z-50 pointer-events-auto group flex items-center justify-center`,onMouseDown:h,children:[d.jsx("div",{className:`absolute top-0 bottom-0 ${e==="left"?"right-0":"left-0"} w-px bg-neutral-700/80 group-hover:bg-emerald-500/50 transition-colors`}),d.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"})]})]}),!h&&d.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px bg-neutral-700/80`}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent z-10"}),d.jsxs("div",{className:"pointer-events-auto flex-1 flex flex-col overflow-hidden",children:[t&&d.jsx("div",{className:"shrink-0 p-4 border-b border-neutral-700/50",children:d.jsxs("div",{className:"flex items-center justify-between text-neutral-200 text-[12px]",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&d.jsx("span",{className:"text-neutral-400",children:s}),d.jsx("span",{className:"tracking-widest font-bold uppercase",children:t})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[l,i&&d.jsx("button",{onClick:i,className:"p-1 hover:bg-white/10 rounded transition-colors text-neutral-400 hover:text-white",title:"Collapse panel",children:d.jsx(v,{size:12})})]})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:y}),u&&d.jsx("div",{className:"shrink-0",children:u})]})]})},XI={emerald:{dot:"bg-emerald-500",ping:"bg-emerald-400",text:"text-emerald-500"},amber:{dot:"bg-amber-500",ping:"bg-amber-400",text:"text-amber-500"},red:{dot:"bg-red-500",ping:"bg-red-400",text:"text-red-500"},neutral:{dot:"bg-neutral-500",ping:"bg-neutral-400",text:"text-neutral-400"}},KI=({left:e,viewport:t,right:s,isMinimapCollapsed:r=!1,onExpandMinimap:i,status:l={label:"READY",color:"emerald"},onToggleTerminal:u,isTerminalOpen:f=!1})=>{const[m,h]=b.useState(new Date),[y,v]=b.useState(!1),[x,w]=b.useState(!1);b.useEffect(()=>{w(!0);const R=setInterval(()=>h(new Date),1e3);return()=>clearInterval(R)},[]);const N=XI[l.color],T=async()=>{if(!t)return;const R=`PAN: ${t.pan.x.toFixed(0)},${t.pan.y.toFixed(0)} | SIZE: ${t.canvasSize?.w??1024}x${t.canvasSize?.h??1024} | ZOOM: ${(t.zoom*100).toFixed(0)}%`;try{await navigator.clipboard.writeText(R),v(!0),setTimeout(()=>v(!1),1500)}catch{}};return d.jsxs("div",{"data-frame-panel":"status-bar",className:`${YI.statusBar} h-7 flex items-center justify-between px-3 select-none font-mono text-[12px] text-neutral-200 pointer-events-auto`,children:[d.jsxs("div",{className:"flex items-center gap-4",children:[r&&i&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-white/5 border border-neutral-800 hover:bg-white/10 transition-colors text-neutral-400 hover:text-white",title:"Expand minimap",children:[d.jsx(C2,{size:10}),d.jsx("span",{className:"text-[11px] font-bold",children:"MAP"}),d.jsx(US,{size:8,className:"opacity-60"})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),d.jsxs("div",{className:`flex items-center gap-2 ${N.text}`,children:[d.jsxs("div",{className:"relative flex h-2 w-2",children:[d.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${N.ping} opacity-75`}),d.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${N.dot}`})]}),d.jsx("span",{className:"font-bold tracking-wider",children:l.label})]}),e&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),e]})]}),t&&d.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-3 opacity-70 hover:opacity-100 transition-opacity",children:d.jsxs("button",{onClick:T,className:"flex items-center gap-3 hover:text-neutral-200 transition-colors cursor-pointer",title:"Copy viewport data",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"PAN:"}),d.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"SIZE:"}),d.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"ZOOM:"}),d.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),d.jsxs("div",{className:"flex items-center gap-4",children:[s,s&&d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),u&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:u,className:`flex items-center gap-1.5 px-2 py-1 rounded transition-all ${f?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"text-neutral-400 hover:text-neutral-100 hover:bg-white/5 border border-transparent"}`,title:"Toggle Terminal (Ctrl+`)",children:[d.jsxs("span",{className:"text-[12px]",children:[">","_"]}),d.jsx("span",{className:"uppercase text-[11px] font-semibold tracking-wider",children:"Console"})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),d.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-200 min-w-[60px] justify-end",children:[d.jsx(S2,{size:11,className:"text-neutral-400"}),d.jsx("span",{children:x?m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},WI=({onOpenCommandPalette:e,extraControls:t})=>d.jsx("div",{className:"select-none font-mono text-[12px] border-t border-neutral-700/50",children:d.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[d.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-neutral-400 hover:text-white transition-colors",children:[d.jsx(ig,{size:10}),d.jsx("span",{className:"tracking-widest font-bold uppercase",children:"Command Palette"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[t,d.jsx("kbd",{className:"text-[11px] text-neutral-400 font-mono",children:"⌘K"})]})]})}),JI=({isOpen:e,onClose:t,commands:s})=>{const[r,i]=b.useState(""),[l,u]=b.useState(0),f=b.useRef(null),m=b.useRef(null),h=s.filter(v=>v.label.toLowerCase().includes(r.toLowerCase()));b.useEffect(()=>{e&&(setTimeout(()=>f.current?.focus(),10),i(""),u(0))},[e]),b.useEffect(()=>{u(0)},[r]),b.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[l]);const y=v=>{v.key==="ArrowDown"?(v.preventDefault(),u(x=>(x+1)%h.length)):v.key==="ArrowUp"?(v.preventDefault(),u(x=>(x-1+h.length)%h.length)):v.key==="Enter"?(v.preventDefault(),h[l]&&(h[l].action(),t())):v.key==="Escape"&&t()};return e?d.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/60 backdrop-blur-[2px] pointer-events-auto",onClick:t,children:d.jsxs("div",{className:"w-[640px] max-w-[90vw] bg-[#161616] border border-neutral-700 shadow-2xl rounded-lg overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-100",onClick:v=>v.stopPropagation(),children:[d.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-neutral-700 gap-3",children:[d.jsx(ig,{className:"text-neutral-400",size:18}),d.jsx("input",{ref:f,className:"flex-1 bg-transparent border-none outline-none text-neutral-100 placeholder-neutral-500 font-mono text-sm",placeholder:"Type a command or search...",value:r,onChange:v=>i(v.target.value),onKeyDown:y,autoFocus:!0}),d.jsx("div",{className:"px-1.5 py-0.5 rounded bg-neutral-700 border border-neutral-700 text-[12px] text-neutral-200 font-mono",children:"ESC"})]}),d.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[d.jsx("div",{className:"pb-2",children:h.length===0?d.jsx("div",{className:"px-4 py-8 text-center text-neutral-400 text-xs font-mono",children:"No matching commands"}):h.map((v,x)=>d.jsxs("div",{ref:x===l?m:null,className:`px-4 py-2.5 flex items-center gap-3 cursor-pointer transition-colors ${x===l?"bg-emerald-900/20 border-l-2 border-emerald-500":"border-l-2 border-transparent hover:bg-white/5"}`,onClick:()=>{v.action(),t()},onMouseEnter:()=>u(x),children:[v.icon&&d.jsx("div",{className:`text-neutral-300 ${x===l?"text-emerald-400":""}`,children:v.icon}),d.jsx("div",{className:"flex-1",children:d.jsx("div",{className:`text-sm ${x===l?"text-emerald-100":"text-neutral-200"}`,children:v.label})}),v.shortcut&&d.jsx("div",{className:"text-[12px] font-mono text-neutral-300 bg-neutral-800 px-1.5 py-0.5 rounded border border-neutral-700",children:v.shortcut}),x===l&&d.jsx(N2,{size:14,className:"text-emerald-500 ml-2"})]},v.id))}),h.length>6&&d.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-[#111] to-transparent pointer-events-none"})]}),d.jsxs("div",{className:"px-4 py-1.5 bg-neutral-800/90 backdrop-blur-sm border-t border-neutral-700 flex justify-between items-center text-[12px] text-neutral-300 font-mono relative z-10",children:[d.jsx("span",{children:"Command Palette"}),d.jsxs("span",{children:[h.length," matches"]})]})]})}):null},{statusBarHeight:ju}=Fd.layout,Sw=120,QI=({isOpen:e,onClose:t,onToggleMaximize:s,isMaximized:r=!1,height:i=320,onHeightChange:l,title:u,headerActions:f,children:m})=>{const h=b.useRef(!1),y=b.useRef(null),v=b.useCallback(w=>{if(!l)return;w.preventDefault(),h.current=!0;const N=w.clientY,T=i;y.current&&(y.current.style.transition="none");const R=j=>{const E=N-j.clientY,_=window.innerHeight-ju,A=Math.max(Sw,Math.min(_,T+E));y.current&&(y.current.style.height=`${A}px`)},C=j=>{h.current=!1,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",C),y.current&&(y.current.style.transition="");const E=N-j.clientY,_=window.innerHeight-ju;l(Math.max(Sw,Math.min(_,T+E)))};document.addEventListener("mousemove",R),document.addEventListener("mouseup",C)},[i,l]),x=r?`calc(100vh - ${ju}px)`:`${i}px`;return d.jsxs("div",{ref:y,className:`
34
- fixed left-0 right-0 shadow-[0_-10px_40px_rgba(0,0,0,0.8)] flex flex-col border-t border-neutral-700
35
- bg-neutral-950/95 backdrop-blur-xl
36
- ${e?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-full opacity-0 pointer-events-none"}
37
- transition-all duration-300 ease-in-out
38
- `,style:{bottom:ju,height:x,zIndex:Fd.zIndex.drawer},children:[d.jsxs("div",{className:"h-9 bg-neutral-900/70 border-b border-neutral-700 flex items-center justify-between px-3 shrink-0 select-none backdrop-blur-sm",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[u||d.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[d.jsx(ZS,{size:14}),d.jsx("span",{className:"text-xs font-bold tracking-widest font-mono",children:"TERMINAL"})]}),f]}),d.jsx("div",{className:"flex-1 flex items-center justify-center h-full cursor-ns-resize text-neutral-500 hover:text-neutral-300 transition-colors group",title:"Drag to Resize",onMouseDown:v,children:d.jsx("div",{className:"w-16 h-1 rounded-full bg-neutral-700 group-hover:bg-neutral-500 transition-colors"})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-neutral-700 text-neutral-400 hover:text-white transition-colors",title:r?"Restore":"Maximize",children:r?d.jsx(M2,{size:14}):d.jsx(US,{size:14})}),d.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-red-900/20 text-neutral-400 hover:text-red-400 transition-colors",title:"Close",children:d.jsx(HS,{size:14})})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:m})]})};var HT="vercel.ai.error",eL=Symbol.for(HT),Ew,Nw,Bs=class FT extends(Nw=Error,Ew=eL,Nw){constructor({name:t,message:s,cause:r}){super(s),this[Ew]=!0,this.name=t,this.cause=r}static isInstance(t){return FT.hasMarker(t,HT)}static hasMarker(t,s){const r=Symbol.for(s);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};function qT(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var YT="AI_InvalidArgumentError",GT=`vercel.ai.error.${YT}`,tL=Symbol.for(GT),Tw,jw,nL=class extends(jw=Bs,Tw=tL,jw){constructor({message:e,cause:t,argument:s}){super({name:YT,message:e,cause:t}),this[Tw]=!0,this.argument=s}static isInstance(e){return Bs.hasMarker(e,GT)}},XT="AI_JSONParseError",KT=`vercel.ai.error.${XT}`,sL=Symbol.for(KT),Cw,Aw,Rw=class extends(Aw=Bs,Cw=sL,Aw){constructor({text:e,cause:t}){super({name:XT,message:`JSON parsing failed: Text: ${e}.
39
- Error message: ${qT(t)}`,cause:t}),this[Cw]=!0,this.text=e}static isInstance(e){return Bs.hasMarker(e,KT)}},WT="AI_TypeValidationError",JT=`vercel.ai.error.${WT}`,aL=Symbol.for(JT),_w,kw,to=class Vm extends(kw=Bs,_w=aL,kw){constructor({value:t,cause:s,context:r}){let i="Type validation failed";if(r?.field&&(i+=` for ${r.field}`),r?.entityName||r?.entityId){i+=" (";const l=[];r.entityName&&l.push(r.entityName),r.entityId&&l.push(`id: "${r.entityId}"`),i+=l.join(", "),i+=")"}super({name:WT,message:`${i}: Value: ${JSON.stringify(t)}.
40
- Error message: ${qT(s)}`,cause:s}),this[_w]=!0,this.value=t,this.context=r}static isInstance(t){return Bs.hasMarker(t,JT)}static wrap({value:t,cause:s,context:r}){var i,l,u;return Vm.isInstance(s)&&s.value===t&&((i=s.context)==null?void 0:i.field)===r?.field&&((l=s.context)==null?void 0:l.entityName)===r?.entityName&&((u=s.context)==null?void 0:u.entityId)===r?.entityId?s:new Vm({value:t,cause:s,context:r})}};function le(e,t,s){function r(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=u.prototype,y=Object.keys(h);for(let v=0;v<y.length;v++){const x=y[v];x in f||(f[x]=h[x].bind(f))}}const i=s?.Parent??Object;class l extends i{}Object.defineProperty(l,"name",{value:e});function u(f){var m;const h=s?.Parent?new l:this;r(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const y of h._zod.deferred)y();return h}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>s?.Parent&&f instanceof s.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Ki extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class QT extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ej={};function Ja(e){return ej}function tj(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function Bm(e,t){return typeof t=="bigint"?t.toString():t}function qd(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ty(e){return e==null}function ny(e){const t=e.startsWith("^")?1:0,s=e.endsWith("$")?e.length-1:e.length;return e.slice(t,s)}function rL(e,t){const s=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const m=r.match(/\d?e-(\d?)/);m?.[1]&&(i=Number.parseInt(m[1]))}const l=s>i?s:i,u=Number.parseInt(e.toFixed(l).replace(".","")),f=Number.parseInt(t.toFixed(l).replace(".",""));return u%f/10**l}const Mw=Symbol("evaluating");function et(e,t,s){let r;Object.defineProperty(e,t,{get(){if(r!==Mw)return r===void 0&&(r=Mw,r=s()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Yr(e,t,s){Object.defineProperty(e,t,{value:s,writable:!0,enumerable:!0,configurable:!0})}function ir(...e){const t={};for(const s of e){const r=Object.getOwnPropertyDescriptors(s);Object.assign(t,r)}return Object.defineProperties({},t)}function Ow(e){return JSON.stringify(e)}function iL(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const nj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const oL=qd(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function no(e){if(zl(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const s=t.prototype;return!(zl(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function sj(e){return no(e)?{...e}:Array.isArray(e)?[...e]:e}const lL=new Set(["string","number","symbol"]);function so(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function or(e,t,s){const r=new e._zod.constr(t??e._zod.def);return(!t||s?.parent)&&(r._zod.parent=e),r}function je(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 cL(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const uL={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function dL(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=ir(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=s.shape[f])}return Yr(this,"shape",u),u},checks:[]});return or(e,l)}function fL(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=ir(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Yr(this,"shape",u),u},checks:[]});return or(e,l)}function hL(e,t){if(!no(t))throw new Error("Invalid input to extend: expected a plain object");const s=e._zod.def.checks;if(s&&s.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=ir(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Yr(this,"shape",l),l}});return or(e,i)}function pL(e,t){if(!no(t))throw new Error("Invalid input to safeExtend: expected a plain object");const s=ir(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Yr(this,"shape",r),r}});return or(e,s)}function mL(e,t){const s=ir(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Yr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return or(e,s)}function gL(e,t,s){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=ir(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(s)for(const h in s){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);s[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return Yr(this,"shape",m),m},checks:[]});return or(t,u)}function yL(e,t,s){const r=ir(t._zod.def,{get shape(){const i=t._zod.def.shape,l={...i};if(s)for(const u in s){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);s[u]&&(l[u]=new e({type:"nonoptional",innerType:i[u]}))}else for(const u in i)l[u]=new e({type:"nonoptional",innerType:i[u]});return Yr(this,"shape",l),l}});return or(t,r)}function Hi(e,t=0){if(e.aborted===!0)return!0;for(let s=t;s<e.issues.length;s++)if(e.issues[s]?.continue!==!0)return!0;return!1}function Fi(e,t){return t.map(s=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(e),s})}function Cu(e){return typeof e=="string"?e:e?.message}function Qa(e,t,s){const r={...e,path:e.path??[]};if(!e.message){const i=Cu(e.inst?._zod.def?.error?.(e))??Cu(t?.error?.(e))??Cu(s.customError?.(e))??Cu(s.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function sy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Il(...e){const[t,s,r]=e;return typeof t=="string"?{message:t,code:"custom",input:s,inst:r}:{...t}}const aj=(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,Bm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rj=le("$ZodError",aj),ij=le("$ZodError",aj,{Parent:Error});function vL(e,t=s=>s.message){const s={},r=[];for(const i of e.issues)i.path.length>0?(s[i.path[0]]=s[i.path[0]]||[],s[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:s}}function bL(e,t=s=>s.message){const s={_errors:[]},r=i=>{for(const l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u}));else if(l.code==="invalid_key")r({issues:l.issues});else if(l.code==="invalid_element")r({issues:l.issues});else if(l.path.length===0)s._errors.push(t(l));else{let u=s,f=0;for(;f<l.path.length;){const m=l.path[f];f===l.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(l))):u[m]=u[m]||{_errors:[]},u=u[m],f++}}};return r(e),s}const ay=e=>(t,s,r,i)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise)throw new Ki;if(u.issues.length){const f=new(i?.Err??e)(u.issues.map(m=>Qa(m,l,Ja())));throw nj(f,i?.callee),f}return u.value},ry=e=>async(t,s,r,i)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(i?.Err??e)(u.issues.map(m=>Qa(m,l,Ja())));throw nj(f,i?.callee),f}return u.value},Yd=e=>(t,s,r)=>{const i=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:s,issues:[]},i);if(l instanceof Promise)throw new Ki;return l.issues.length?{success:!1,error:new(e??rj)(l.issues.map(u=>Qa(u,i,Ja())))}:{success:!0,data:l.value}},xL=Yd(ij),Gd=e=>async(t,s,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:s,issues:[]},i);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>Qa(u,i,Ja())))}:{success:!0,data:l.value}},wL=Gd(ij),SL=e=>(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ay(e)(t,s,i)},EL=e=>(t,s,r)=>ay(e)(t,s,r),NL=e=>async(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ry(e)(t,s,i)},TL=e=>async(t,s,r)=>ry(e)(t,s,r),jL=e=>(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yd(e)(t,s,i)},CL=e=>(t,s,r)=>Yd(e)(t,s,r),AL=e=>async(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Gd(e)(t,s,i)},RL=e=>async(t,s,r)=>Gd(e)(t,s,r),_L=/^[cC][^\s-]{8,}$/,kL=/^[0-9a-z]+$/,ML=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OL=/^[0-9a-vA-V]{20}$/,DL=/^[A-Za-z0-9]{27}$/,zL=/^[a-zA-Z0-9_-]{21}$/,IL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,LL=/^([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})$/,Dw=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)$/,PL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$L="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function UL(){return new RegExp($L,"u")}const VL=/^(?:(?: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])$/,BL=/^(([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}|:))$/,ZL=/^((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])$/,HL=/^(([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])$/,FL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,oj=/^[A-Za-z0-9_-]*$/,qL=/^\+[1-9]\d{6,14}$/,lj="(?:(?:\\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])))",YL=new RegExp(`^${lj}$`);function cj(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 GL(e){return new RegExp(`^${cj(e)}$`)}function XL(e){const t=cj({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${s.join("|")})`;return new RegExp(`^${lj}T(?:${r})$`)}const KL=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},WL=/^-?\d+$/,uj=/^-?\d+(?:\.\d+)?$/,JL=/^(?:true|false)$/i,QL=/^null$/i,e6=/^[^A-Z]*$/,t6=/^[^a-z]*$/,Ln=le("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),dj={number:"number",bigint:"bigint",object:"date"},fj=le("$ZodCheckLessThan",(e,t)=>{Ln.init(e,t);const s=dj[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,l=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:s,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hj=le("$ZodCheckGreaterThan",(e,t)=>{Ln.init(e,t);const s=dj[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,l=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:s,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n6=le("$ZodCheckMultipleOf",(e,t)=>{Ln.init(e,t),e._zod.onattach.push(s=>{var r;(r=s._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=s=>{if(typeof s.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof s.value=="bigint"?s.value%t.value===BigInt(0):rL(s.value,t.value)===0)||s.issues.push({origin:typeof s.value,code:"not_multiple_of",divisor:t.value,input:s.value,inst:e,continue:!t.abort})}}),s6=le("$ZodCheckNumberFormat",(e,t)=>{Ln.init(e,t),t.format=t.format||"float64";const s=t.format?.includes("int"),r=s?"int":"number",[i,l]=uL[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=i,f.maximum=l,s&&(f.pattern=WL)}),e._zod.check=u=>{const f=u.value;if(s){if(!Number.isInteger(f)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}f<i&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),f>l&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),a6=le("$ZodCheckMaxLength",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const u=sy(i);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),r6=le("$ZodCheckMinLength",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const u=sy(i);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),i6=le("$ZodCheckLengthEquals",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,l=i.length;if(l===t.length)return;const u=sy(i),f=l>t.length;r.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Xd=le("$ZodCheckStringFormat",(e,t)=>{var s,r;Ln.init(e,t),e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(s=e._zod).check??(s.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),o6=le("$ZodCheckRegex",(e,t)=>{Xd.init(e,t),e._zod.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),l6=le("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e6),Xd.init(e,t)}),c6=le("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t6),Xd.init(e,t)}),u6=le("$ZodCheckIncludes",(e,t)=>{Ln.init(e,t);const s=so(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${s}`:s);t.pattern=r,e._zod.onattach.push(i=>{const l=i._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),d6=le("$ZodCheckStartsWith",(e,t)=>{Ln.init(e,t);const s=new RegExp(`^${so(t.prefix)}.*`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),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})}}),f6=le("$ZodCheckEndsWith",(e,t)=>{Ln.init(e,t);const s=new RegExp(`.*${so(t.suffix)}$`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),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})}}),h6=le("$ZodCheckOverwrite",(e,t)=>{Ln.init(e,t),e._zod.check=s=>{s.value=t.tx(s.value)}});class p6{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(`
41
- `).filter(u=>u),i=Math.min(...r.map(u=>u.length-u.trimStart().length)),l=r.map(u=>u.slice(i)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,s=this?.args,i=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...s,i.join(`
42
- `))}}const m6={major:4,minor:3,patch:6},Ct=le("$ZodType",(e,t)=>{var s;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=m6;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const l of i._zod.onattach)l(e);if(r.length===0)(s=e._zod).deferred??(s.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(u,f,m)=>{let h=Hi(u),y;for(const v of f){if(v._zod.def.when){if(!v._zod.def.when(u))continue}else if(h)continue;const x=u.issues.length,w=v._zod.check(u);if(w instanceof Promise&&m?.async===!1)throw new Ki;if(y||w instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await w,u.issues.length!==x&&(h||(h=Hi(u,x)))});else{if(u.issues.length===x)continue;h||(h=Hi(u,x))}}return y?y.then(()=>u):u},l=(u,f,m)=>{if(Hi(u))return u.aborted=!0,u;const h=i(f,r,m);if(h instanceof Promise){if(m.async===!1)throw new Ki;return h.then(y=>e._zod.parse(y,m))}return e._zod.parse(h,m)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return h instanceof Promise?h.then(y=>l(y,u,f)):l(h,u,f)}const m=e._zod.parse(u,f);if(m instanceof Promise){if(f.async===!1)throw new Ki;return m.then(h=>i(h,r,f))}return i(m,r,f)}}et(e,"~standard",()=>({validate:i=>{try{const l=xL(e,i);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return wL(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),iy=le("$ZodString",(e,t)=>{Ct.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??KL(e._zod.bag),e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:e}),s}}),_t=le("$ZodStringFormat",(e,t)=>{Xd.init(e,t),iy.init(e,t)}),g6=le("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=LL),_t.init(e,t)}),y6=le("$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=Dw(r))}else t.pattern??(t.pattern=Dw());_t.init(e,t)}),v6=le("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=PL),_t.init(e,t)}),b6=le("$ZodURL",(e,t)=>{_t.init(e,t),e._zod.check=s=>{try{const r=s.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:s.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:s.value,inst:e,continue:!t.abort})),t.normalize?s.value=i.href:s.value=r;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:e,continue:!t.abort})}}}),x6=le("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=UL()),_t.init(e,t)}),w6=le("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=zL),_t.init(e,t)}),S6=le("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_L),_t.init(e,t)}),E6=le("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=kL),_t.init(e,t)}),N6=le("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ML),_t.init(e,t)}),T6=le("$ZodXID",(e,t)=>{t.pattern??(t.pattern=OL),_t.init(e,t)}),j6=le("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=DL),_t.init(e,t)}),C6=le("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=XL(t)),_t.init(e,t)}),A6=le("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=YL),_t.init(e,t)}),R6=le("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=GL(t)),_t.init(e,t)}),_6=le("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=IL),_t.init(e,t)}),k6=le("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=VL),_t.init(e,t),e._zod.bag.format="ipv4"}),M6=le("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=BL),_t.init(e,t),e._zod.bag.format="ipv6",e._zod.check=s=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:e,continue:!t.abort})}}}),O6=le("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ZL),_t.init(e,t)}),D6=le("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=HL),_t.init(e,t),e._zod.check=s=>{const r=s.value.split("/");try{if(r.length!==2)throw new Error;const[i,l]=r;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${i}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:e,continue:!t.abort})}}});function pj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const z6=le("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=FL),_t.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=s=>{pj(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:e,continue:!t.abort})}});function I6(e){if(!oj.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),s=t.padEnd(Math.ceil(t.length/4)*4,"=");return pj(s)}const L6=le("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=oj),_t.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=s=>{I6(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:e,continue:!t.abort})}}),P6=le("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qL),_t.init(e,t)});function $6(e,t=null){try{const s=e.split(".");if(s.length!==3)return!1;const[r]=s;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const U6=le("$ZodJWT",(e,t)=>{_t.init(e,t),e._zod.check=s=>{$6(s.value,t.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:e,continue:!t.abort})}}),mj=le("$ZodNumber",(e,t)=>{Ct.init(e,t),e._zod.pattern=e._zod.bag.pattern??uj,e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=Number(s.value)}catch{}const i=s.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return s;const l=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return s.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...l?{received:l}:{}}),s}}),V6=le("$ZodNumberFormat",(e,t)=>{s6.init(e,t),mj.init(e,t)}),B6=le("$ZodBoolean",(e,t)=>{Ct.init(e,t),e._zod.pattern=JL,e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=!!s.value}catch{}const i=s.value;return typeof i=="boolean"||s.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),s}}),Z6=le("$ZodNull",(e,t)=>{Ct.init(e,t),e._zod.pattern=QL,e._zod.values=new Set([null]),e._zod.parse=(s,r)=>{const i=s.value;return i===null||s.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),s}}),H6=le("$ZodUnknown",(e,t)=>{Ct.init(e,t),e._zod.parse=s=>s}),F6=le("$ZodNever",(e,t)=>{Ct.init(e,t),e._zod.parse=(s,r)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:e}),s)});function zw(e,t,s){e.issues.length&&t.issues.push(...Fi(s,e.issues)),t.value[s]=e.value}const q6=le("$ZodArray",(e,t)=>{Ct.init(e,t),e._zod.parse=(s,r)=>{const i=s.value;if(!Array.isArray(i))return s.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),s;s.value=Array(i.length);const l=[];for(let u=0;u<i.length;u++){const f=i[u],m=t.element._zod.run({value:f,issues:[]},r);m instanceof Promise?l.push(m.then(h=>zw(h,s,u))):zw(m,s,u)}return l.length?Promise.all(l).then(()=>s):s}});function Sd(e,t,s,r,i){if(e.issues.length){if(i&&!(s in r))return;t.issues.push(...Fi(s,e.issues))}e.value===void 0?s in r&&(t.value[s]=void 0):t.value[s]=e.value}function gj(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 s=cL(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function yj(e,t,s,r,i,l){const u=[],f=i.keySet,m=i.catchall._zod,h=m.def.type,y=m.optout==="optional";for(const v in t){if(f.has(v))continue;if(h==="never"){u.push(v);continue}const x=m.run({value:t[v],issues:[]},r);x instanceof Promise?e.push(x.then(w=>Sd(w,s,v,t,y))):Sd(x,s,v,t,y)}return u.length&&s.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>s):s}const Y6=le("$ZodObject",(e,t)=>{if(Ct.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const r=qd(()=>gj(t));et(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const y=f[h]._zod;if(y.values){m[h]??(m[h]=new Set);for(const v of y.values)m[h].add(v)}}return m});const i=zl,l=t.catchall;let u;e._zod.parse=(f,m)=>{u??(u=r.value);const h=f.value;if(!i(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const y=[],v=u.shape;for(const x of u.keys){const w=v[x],N=w._zod.optout==="optional",T=w._zod.run({value:h[x],issues:[]},m);T instanceof Promise?y.push(T.then(R=>Sd(R,f,x,h,N))):Sd(T,f,x,h,N)}return l?yj(y,h,f,m,r.value,e):y.length?Promise.all(y).then(()=>f):f}}),G6=le("$ZodObjectJIT",(e,t)=>{Y6.init(e,t);const s=e._zod.parse,r=qd(()=>gj(t)),i=x=>{const w=new p6(["shape","payload","ctx"]),N=r.value,T=E=>{const _=Ow(E);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};w.write("const input = payload.value;");const R=Object.create(null);let C=0;for(const E of N.keys)R[E]=`key_${C++}`;w.write("const newResult = {};");for(const E of N.keys){const _=R[E],A=Ow(E),O=x[E]?._zod?.optout==="optional";w.write(`const ${_} = ${T(E)};`),O?w.write(`
43
- if (${_}.issues.length) {
44
- if (${A} in input) {
45
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
46
- ...iss,
47
- path: iss.path ? [${A}, ...iss.path] : [${A}]
48
- })));
49
- }
50
- }
51
-
52
- if (${_}.value === undefined) {
53
- if (${A} in input) {
54
- newResult[${A}] = undefined;
55
- }
56
- } else {
57
- newResult[${A}] = ${_}.value;
58
- }
59
-
60
- `):w.write(`
61
- if (${_}.issues.length) {
62
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
63
- ...iss,
64
- path: iss.path ? [${A}, ...iss.path] : [${A}]
65
- })));
66
- }
67
-
68
- if (${_}.value === undefined) {
69
- if (${A} in input) {
70
- newResult[${A}] = undefined;
71
- }
72
- } else {
73
- newResult[${A}] = ${_}.value;
74
- }
75
-
76
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const j=w.compile();return(E,_)=>j(x,E,_)};let l;const u=zl,f=!ej.jitless,h=f&&oL.value,y=t.catchall;let v;e._zod.parse=(x,w)=>{v??(v=r.value);const N=x.value;return u(N)?f&&h&&w?.async===!1&&w.jitless!==!0?(l||(l=i(t.shape)),x=l(x,w),y?yj([],N,x,w,v,e):x):s(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:N,inst:e}),x)}});function Iw(e,t,s,r){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const i=e.filter(l=>!Hi(l));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:s,errors:e.map(l=>l.issues.map(u=>Qa(u,r,Ja())))}),t)}const vj=le("$ZodUnion",(e,t)=>{Ct.init(e,t),et(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),et(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),et(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),et(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${i.map(l=>ny(l.source)).join("|")})$`)}});const s=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,l)=>{if(s)return r(i,l);let u=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:i.value,issues:[]},l);if(h instanceof Promise)f.push(h),u=!0;else{if(h.issues.length===0)return h;f.push(h)}}return u?Promise.all(f).then(m=>Iw(m,i,e,l)):Iw(f,i,e,l)}}),X6=le("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,vj.init(e,t);const s=e._zod.parse;et(e._zod,"propValues",()=>{const i={};for(const l of t.options){const u=l._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const[f,m]of Object.entries(u)){i[f]||(i[f]=new Set);for(const h of m)i[f].add(h)}}return i});const r=qd(()=>{const i=t.options,l=new Map;for(const u of i){const f=u._zod.propValues?.[t.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const m of f){if(l.has(m))throw new Error(`Duplicate discriminator value "${String(m)}"`);l.set(m,u)}}return l});e._zod.parse=(i,l)=>{const u=i.value;if(!zl(u))return i.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),i;const f=r.value.get(u?.[t.discriminator]);return f?f._zod.run(i,l):t.unionFallback?s(i,l):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),i)}}),K6=le("$ZodIntersection",(e,t)=>{Ct.init(e,t),e._zod.parse=(s,r)=>{const i=s.value,l=t.left._zod.run({value:i,issues:[]},r),u=t.right._zod.run({value:i,issues:[]},r);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([m,h])=>Lw(s,m,h)):Lw(s,l,u)}});function Zm(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(no(e)&&no(t)){const s=Object.keys(t),r=Object.keys(e).filter(l=>s.indexOf(l)!==-1),i={...e,...t};for(const l of r){const u=Zm(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};i[l]=u.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<e.length;r++){const i=e[r],l=t[r],u=Zm(i,l);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};s.push(u.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function Lw(e,t,s){const r=new Map;let i;for(const f of t.issues)if(f.code==="unrecognized_keys"){i??(i=f);for(const m of f.keys)r.has(m)||r.set(m,{}),r.get(m).l=!0}else e.issues.push(f);for(const f of s.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)r.has(m)||r.set(m,{}),r.get(m).r=!0;else e.issues.push(f);const l=[...r].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&i&&e.issues.push({...i,keys:l}),Hi(e))return e;const u=Zm(t.value,s.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const W6=le("$ZodRecord",(e,t)=>{Ct.init(e,t),e._zod.parse=(s,r)=>{const i=s.value;if(!no(i))return s.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),s;const l=[],u=t.keyType._zod.values;if(u){s.value={};const f=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const y=t.valueType._zod.run({value:i[h],issues:[]},r);y instanceof Promise?l.push(y.then(v=>{v.issues.length&&s.issues.push(...Fi(h,v.issues)),s.value[h]=v.value})):(y.issues.length&&s.issues.push(...Fi(h,y.issues)),s.value[h]=y.value)}let m;for(const h in i)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&s.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:m})}else{s.value={};for(const f of Reflect.ownKeys(i)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&uj.test(f)&&m.issues.length){const v=t.keyType._zod.run({value:Number(f),issues:[]},r);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(m=v)}if(m.issues.length){t.mode==="loose"?s.value[f]=i[f]:s.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(v=>Qa(v,r,Ja())),input:f,path:[f],inst:e});continue}const y=t.valueType._zod.run({value:i[f],issues:[]},r);y instanceof Promise?l.push(y.then(v=>{v.issues.length&&s.issues.push(...Fi(f,v.issues)),s.value[m.value]=v.value})):(y.issues.length&&s.issues.push(...Fi(f,y.issues)),s.value[m.value]=y.value)}}return l.length?Promise.all(l).then(()=>s):s}}),J6=le("$ZodEnum",(e,t)=>{Ct.init(e,t);const s=tj(t.entries),r=new Set(s);e._zod.values=r,e._zod.pattern=new RegExp(`^(${s.filter(i=>lL.has(typeof i)).map(i=>typeof i=="string"?so(i):i.toString()).join("|")})$`),e._zod.parse=(i,l)=>{const u=i.value;return r.has(u)||i.issues.push({code:"invalid_value",values:s,input:u,inst:e}),i}}),Q6=le("$ZodLiteral",(e,t)=>{if(Ct.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(t.values);e._zod.values=s,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?so(r):r?so(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const l=r.value;return s.has(l)||r.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),r}}),eP=le("$ZodTransform",(e,t)=>{Ct.init(e,t),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new QT(e.constructor.name);const i=t.transform(s.value,s);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(s.value=u,s));if(i instanceof Promise)throw new Ki;return s.value=i,s}});function Pw(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const bj=le("$ZodOptional",(e,t)=>{Ct.init(e,t),e._zod.optin="optional",e._zod.optout="optional",et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),et(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ny(s.source)})?$`):void 0}),e._zod.parse=(s,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>Pw(l,s.value)):Pw(i,s.value)}return s.value===void 0?s:t.innerType._zod.run(s,r)}}),tP=le("$ZodExactOptional",(e,t)=>{bj.init(e,t),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(s,r)=>t.innerType._zod.run(s,r)}),nP=le("$ZodNullable",(e,t)=>{Ct.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ny(s.source)}|null)$`):void 0}),et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(s,r)=>s.value===null?s:t.innerType._zod.run(s,r)}),sP=le("$ZodDefault",(e,t)=>{Ct.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);if(s.value===void 0)return s.value=t.defaultValue,s;const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>$w(l,t)):$w(i,t)}});function $w(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const aP=le("$ZodPrefault",(e,t)=>{Ct.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=t.defaultValue),t.innerType._zod.run(s,r))}),rP=le("$ZodNonOptional",(e,t)=>{Ct.init(e,t),et(e._zod,"values",()=>{const s=t.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),e._zod.parse=(s,r)=>{const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>Uw(l,e)):Uw(i,e)}});function Uw(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 iP=le("$ZodCatch",(e,t)=>{Ct.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>(s.value=l.value,l.issues.length&&(s.value=t.catchValue({...s,error:{issues:l.issues.map(u=>Qa(u,r,Ja()))},input:s.value}),s.issues=[]),s)):(s.value=i.value,i.issues.length&&(s.value=t.catchValue({...s,error:{issues:i.issues.map(l=>Qa(l,r,Ja()))},input:s.value}),s.issues=[]),s)}}),oP=le("$ZodPipe",(e,t)=>{Ct.init(e,t),et(e._zod,"values",()=>t.in._zod.values),et(e._zod,"optin",()=>t.in._zod.optin),et(e._zod,"optout",()=>t.out._zod.optout),et(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(s,r)=>{if(r.direction==="backward"){const l=t.out._zod.run(s,r);return l instanceof Promise?l.then(u=>Au(u,t.in,r)):Au(l,t.in,r)}const i=t.in._zod.run(s,r);return i instanceof Promise?i.then(l=>Au(l,t.out,r)):Au(i,t.out,r)}});function Au(e,t,s){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},s)}const lP=le("$ZodReadonly",(e,t)=>{Ct.init(e,t),et(e._zod,"propValues",()=>t.innerType._zod.propValues),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"optin",()=>t.innerType?._zod?.optin),et(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(Vw):Vw(i)}});function Vw(e){return e.value=Object.freeze(e.value),e}const cP=le("$ZodLazy",(e,t)=>{Ct.init(e,t),et(e._zod,"innerType",()=>t.getter()),et(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),et(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),et(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),et(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(s,r)=>e._zod.innerType._zod.run(s,r)}),uP=le("$ZodCustom",(e,t)=>{Ln.init(e,t),Ct.init(e,t),e._zod.parse=(s,r)=>s,e._zod.check=s=>{const r=s.value,i=t.fn(r);if(i instanceof Promise)return i.then(l=>Bw(l,s,r,e));Bw(i,s,r,e)}});function Bw(e,t,s,r){if(!e){const i={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Il(i))}}var Zw;class dP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...s){const r=s[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 s=this._map.get(t);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(t),this}get(t){const s=t._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function fP(){return new dP}(Zw=globalThis).__zod_globalRegistry??(Zw.__zod_globalRegistry=fP());const ml=globalThis.__zod_globalRegistry;function hP(e,t){return new e({type:"string",...je(t)})}function pP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(t)})}function Hw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(t)})}function mP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(t)})}function gP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(t)})}function yP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(t)})}function vP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(t)})}function bP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(t)})}function xP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(t)})}function wP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(t)})}function SP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(t)})}function EP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(t)})}function NP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(t)})}function TP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(t)})}function jP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(t)})}function CP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(t)})}function AP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(t)})}function RP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(t)})}function _P(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(t)})}function kP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(t)})}function MP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(t)})}function OP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(t)})}function DP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(t)})}function zP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(t)})}function IP(e,t){return new e({type:"string",format:"date",check:"string_format",...je(t)})}function LP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(t)})}function PP(e,t){return new e({type:"string",format:"duration",check:"string_format",...je(t)})}function $P(e,t){return new e({type:"number",checks:[],...je(t)})}function UP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(t)})}function VP(e,t){return new e({type:"boolean",...je(t)})}function BP(e,t){return new e({type:"null",...je(t)})}function ZP(e){return new e({type:"unknown"})}function HP(e,t){return new e({type:"never",...je(t)})}function Fw(e,t){return new fj({check:"less_than",...je(t),value:e,inclusive:!1})}function Zp(e,t){return new fj({check:"less_than",...je(t),value:e,inclusive:!0})}function qw(e,t){return new hj({check:"greater_than",...je(t),value:e,inclusive:!1})}function Hp(e,t){return new hj({check:"greater_than",...je(t),value:e,inclusive:!0})}function Yw(e,t){return new n6({check:"multiple_of",...je(t),value:e})}function xj(e,t){return new a6({check:"max_length",...je(t),maximum:e})}function Ed(e,t){return new r6({check:"min_length",...je(t),minimum:e})}function wj(e,t){return new i6({check:"length_equals",...je(t),length:e})}function FP(e,t){return new o6({check:"string_format",format:"regex",...je(t),pattern:e})}function qP(e){return new l6({check:"string_format",format:"lowercase",...je(e)})}function YP(e){return new c6({check:"string_format",format:"uppercase",...je(e)})}function GP(e,t){return new u6({check:"string_format",format:"includes",...je(t),includes:e})}function XP(e,t){return new d6({check:"string_format",format:"starts_with",...je(t),prefix:e})}function KP(e,t){return new f6({check:"string_format",format:"ends_with",...je(t),suffix:e})}function fo(e){return new h6({check:"overwrite",tx:e})}function WP(e){return fo(t=>t.normalize(e))}function JP(){return fo(e=>e.trim())}function QP(){return fo(e=>e.toLowerCase())}function e8(){return fo(e=>e.toUpperCase())}function t8(){return fo(e=>iL(e))}function n8(e,t,s){return new e({type:"array",element:t,...je(s)})}function s8(e,t,s){const r=je(s);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function a8(e,t,s){return new e({type:"custom",check:"custom",fn:t,...je(s)})}function r8(e){const t=i8(s=>(s.addIssue=r=>{if(typeof r=="string")s.issues.push(Il(r,s.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=s.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),s.issues.push(Il(i))}},e(s.value,s)));return t}function i8(e,t){const s=new Ln({check:"custom",...je(t)});return s._zod.check=e,s}function Nd(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??ml,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 bt(e,t,s={path:[],schemaPath:[]}){var r;const i=e._zod.def,l=t.seen.get(e);if(l)return l.count++,s.schemaPath.includes(e)&&(l.cycle=s.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:s.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const y={...s,schemaPath:[...s.schemaPath,e],path:s.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,y);else{const x=u.schema,w=t.processors[i.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);w(e,t,x,y)}const v=e._zod.parent;v&&(u.ref||(u.ref=v),bt(v,t,y),t.seen.get(v).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&bn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((r=u.schema).default??(r.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function Td(e,t){const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const m=r.get(f);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,u[0])}}const i=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(u[0])?.id,x=e.external.uri??(N=>N);if(v)return{ref:x(v)};const w=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=w,{defId:w,ref:`${x("__shared")}#/${f}/${w}`}}if(u[1]===s)return{ref:"#"};const h=`#/${f}/`,y=u[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:h+y}},l=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:m,defId:h}=i(u);f.def={...f.schema},h&&(f.defId=h);const y=f.schema;for(const v in y)delete y[v];y.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
77
-
78
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(t===u[0]){l(u);continue}if(e.external){const h=e.external.registry.get(u[0])?.id;if(t!==u[0]&&h){l(u);continue}}if(e.metadataRegistry.get(u[0])?.id){l(u);continue}if(f.cycle){l(u);continue}if(f.count>1&&e.reused==="ref"){l(u);continue}}}function jd(e,t){const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,h={...m},y=f.ref;if(f.ref=null,y){r(y);const x=e.seen.get(y),w=x.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(w)):Object.assign(m,w),Object.assign(m,h),u._zod.parent===y)for(const T in m)T==="$ref"||T==="allOf"||T in h||delete m[T];if(w.$ref&&x.def)for(const T in m)T==="$ref"||T==="allOf"||T in x.def&&JSON.stringify(m[T])===JSON.stringify(x.def[T])&&delete m[T]}const v=u._zod.parent;if(v&&v!==y){r(v);const x=e.seen.get(v);if(x?.schema.$ref&&(m.$ref=x.schema.$ref,x.def))for(const w in m)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(m[w])===JSON.stringify(x.def[w])&&delete m[w]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())r(u[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(u)}Object.assign(i,s.def??s.schema);const l=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?i.$defs=l:i.definitions=l);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Cd(t,"input",e.processors),output:Cd(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function bn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return bn(r.element,s);if(r.type==="set")return bn(r.valueType,s);if(r.type==="lazy")return bn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return bn(r.innerType,s);if(r.type==="intersection")return bn(r.left,s)||bn(r.right,s);if(r.type==="record"||r.type==="map")return bn(r.keyType,s)||bn(r.valueType,s);if(r.type==="pipe")return bn(r.in,s)||bn(r.out,s);if(r.type==="object"){for(const i in r.shape)if(bn(r.shape[i],s))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(bn(i,s))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(bn(i,s))return!0;return!!(r.rest&&bn(r.rest,s))}return!1}const o8=(e,t={})=>s=>{const r=Nd({...s,processors:t});return bt(e,r),Td(r,e),jd(r,e)},Cd=(e,t,s={})=>r=>{const{libraryOptions:i,target:l}=r??{},u=Nd({...i??{},target:l,io:t,processors:s});return bt(e,u),Td(u,e),jd(u,e)},l8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Sj=(e,t,s,r)=>{const i=s;i.type="string";const{minimum:l,maximum:u,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(i.minLength=l),typeof u=="number"&&(i.maxLength=u),f&&(i.format=l8[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),h&&(i.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?i.pattern=y[0].source:y.length>1&&(i.allOf=[...y.map(v=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},Ej=(e,t,s,r)=>{const i=s,{minimum:l,maximum:u,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=y,i.exclusiveMinimum=!0):i.exclusiveMinimum=y),typeof l=="number"&&(i.minimum=l,typeof y=="number"&&t.target!=="draft-04"&&(y>=l?delete i.minimum:delete i.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=h,i.exclusiveMaximum=!0):i.exclusiveMaximum=h),typeof u=="number"&&(i.maximum=u,typeof h=="number"&&t.target!=="draft-04"&&(h<=u?delete i.maximum:delete i.exclusiveMaximum)),typeof m=="number"&&(i.multipleOf=m)},Nj=(e,t,s,r)=>{s.type="boolean"},c8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},u8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Tj=(e,t,s,r)=>{t.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},d8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},f8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},jj=(e,t,s,r)=>{s.not={}},h8=(e,t,s,r)=>{},Cj=(e,t,s,r)=>{},p8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Aj=(e,t,s,r)=>{const i=e._zod.def,l=tj(i.entries);l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),s.enum=l},Rj=(e,t,s,r)=>{const i=e._zod.def,l=[];for(const u of i.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");l.push(Number(u))}else l.push(u);if(l.length!==0)if(l.length===1){const u=l[0];s.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?s.enum=[u]:s.const=u}else l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),l.every(u=>typeof u=="boolean")&&(s.type="boolean"),l.every(u=>u===null)&&(s.type="null"),s.enum=l},m8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},g8=(e,t,s,r)=>{const i=s,l=e._zod.pattern;if(!l)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=l.source},y8=(e,t,s,r)=>{const i=s,l={type:"string",format:"binary",contentEncoding:"binary"},{minimum:u,maximum:f,mime:m}=e._zod.bag;u!==void 0&&(l.minLength=u),f!==void 0&&(l.maxLength=f),m?m.length===1?(l.contentMediaType=m[0],Object.assign(i,l)):(Object.assign(i,l),i.anyOf=m.map(h=>({contentMediaType:h}))):Object.assign(i,l)},v8=(e,t,s,r)=>{s.type="boolean"},_j=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},b8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},kj=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},x8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},w8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Mj=(e,t,s,r)=>{const i=s,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(i.minItems=u),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=bt(l.element,t,{...r,path:[...r.path,"items"]})},Oj=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="object",i.properties={};const u=l.shape;for(const h in u)i.properties[h]=bt(u[h],t,{...r,path:[...r.path,"properties",h]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(h=>{const y=l.shape[h]._zod;return t.io==="input"?y.optin===void 0:y.optout===void 0}));m.size>0&&(i.required=Array.from(m)),l.catchall?._zod.def.type==="never"?i.additionalProperties=!1:l.catchall?l.catchall&&(i.additionalProperties=bt(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Dj=(e,t,s,r)=>{const i=e._zod.def,l=i.inclusive===!1,u=i.options.map((f,m)=>bt(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",m]}));l?s.oneOf=u:s.anyOf=u},zj=(e,t,s,r)=>{const i=e._zod.def,l=bt(i.left,t,{...r,path:[...r.path,"allOf",0]}),u=bt(i.right,t,{...r,path:[...r.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];s.allOf=m},S8=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="array";const u=t.target==="draft-2020-12"?"prefixItems":"items",f=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",m=l.items.map((x,w)=>bt(x,t,{...r,path:[...r.path,u,w]})),h=l.rest?bt(l.rest,t,{...r,path:[...r.path,f,...t.target==="openapi-3.0"?[l.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=m,h&&(i.items=h)):t.target==="openapi-3.0"?(i.items={anyOf:m},h&&i.items.anyOf.push(h),i.minItems=m.length,h||(i.maxItems=m.length)):(i.items=m,h&&(i.additionalItems=h));const{minimum:y,maximum:v}=e._zod.bag;typeof y=="number"&&(i.minItems=y),typeof v=="number"&&(i.maxItems=v)},Ij=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="object";const u=l.keyType,m=u._zod.bag?.patterns;if(l.mode==="loose"&&m&&m.size>0){const y=bt(l.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const v of m)i.patternProperties[v.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=bt(l.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=bt(l.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=u._zod.values;if(h){const y=[...h].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(i.required=y)}},Lj=(e,t,s,r)=>{const i=e._zod.def,l=bt(i.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=i.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},Pj=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},$j=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,s.default=JSON.parse(JSON.stringify(i.defaultValue))},Uj=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Vj=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType;let u;try{u=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=u},Bj=(e,t,s,r)=>{const i=e._zod.def,l=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;bt(l,t,r);const u=t.seen.get(e);u.ref=l},Zj=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,s.readOnly=!0},E8=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},oy=(e,t,s,r)=>{const i=e._zod.def;bt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},Hj=(e,t,s,r)=>{const i=e._zod.innerType;bt(i,t,r);const l=t.seen.get(e);l.ref=i},Gw={string:Sj,number:Ej,boolean:Nj,bigint:c8,symbol:u8,null:Tj,undefined:d8,void:f8,never:jj,any:h8,unknown:Cj,date:p8,enum:Aj,literal:Rj,nan:m8,template_literal:g8,file:y8,success:v8,custom:_j,function:b8,transform:kj,map:x8,set:w8,array:Mj,object:Oj,union:Dj,intersection:zj,tuple:S8,record:Ij,nullable:Lj,nonoptional:Pj,default:$j,prefault:Uj,catch:Vj,pipe:Bj,readonly:Zj,promise:E8,optional:oy,lazy:Hj};function N8(e,t){if("_idmap"in e){const r=e,i=Nd({...t,processors:Gw}),l={};for(const m of r._idmap.entries()){const[h,y]=m;bt(y,i)}const u={},f={registry:r,uri:t?.uri,defs:l};i.external=f;for(const m of r._idmap.entries()){const[h,y]=m;Td(i,y),u[h]=jd(i,y)}if(Object.keys(l).length>0){const m=i.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[m]:l}}return{schemas:u}}const s=Nd({...t,processors:Gw});return bt(e,s),Td(s,e),jd(s,e)}const T8=le("ZodISODateTime",(e,t)=>{C6.init(e,t),Mt.init(e,t)});function j8(e){return zP(T8,e)}const C8=le("ZodISODate",(e,t)=>{A6.init(e,t),Mt.init(e,t)});function A8(e){return IP(C8,e)}const R8=le("ZodISOTime",(e,t)=>{R6.init(e,t),Mt.init(e,t)});function _8(e){return LP(R8,e)}const k8=le("ZodISODuration",(e,t)=>{_6.init(e,t),Mt.init(e,t)});function M8(e){return PP(k8,e)}const O8=(e,t)=>{rj.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>bL(e,s)},flatten:{value:s=>vL(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Bm,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Bm,2)}},isEmpty:{get(){return e.issues.length===0}}})},fs=le("ZodError",O8,{Parent:Error}),D8=ay(fs),z8=ry(fs),I8=Yd(fs),Fj=Gd(fs),L8=SL(fs),P8=EL(fs),$8=NL(fs),U8=TL(fs),V8=jL(fs),B8=CL(fs),Z8=AL(fs),H8=RL(fs),At=le("ZodType",(e,t)=>(Ct.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Cd(e,"input"),output:Cd(e,"output")}}),e.toJSONSchema=o8(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(ir(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>or(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>D8(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>I8(e,s,r),e.parseAsync=async(s,r)=>z8(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>Fj(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>L8(e,s,r),e.decode=(s,r)=>P8(e,s,r),e.encodeAsync=async(s,r)=>$8(e,s,r),e.decodeAsync=async(s,r)=>U8(e,s,r),e.safeEncode=(s,r)=>V8(e,s,r),e.safeDecode=(s,r)=>B8(e,s,r),e.safeEncodeAsync=async(s,r)=>Z8(e,s,r),e.safeDecodeAsync=async(s,r)=>H8(e,s,r),e.refine=(s,r)=>e.check(U9(s,r)),e.superRefine=s=>e.check(V9(s)),e.overwrite=s=>e.check(fo(s)),e.optional=()=>Ww(e),e.exactOptional=()=>j9(e),e.nullable=()=>Jw(e),e.nullish=()=>Ww(Jw(e)),e.nonoptional=s=>M9(e,s),e.array=()=>ho(e),e.or=s=>En([e,s]),e.and=s=>x9(e,s),e.transform=s=>Qw(e,N9(s)),e.default=s=>R9(e,s),e.prefault=s=>k9(e,s),e.catch=s=>D9(e,s),e.pipe=s=>Qw(e,s),e.readonly=()=>L9(e),e.describe=s=>{const r=e.clone();return ml.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){return ml.get(e)?.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return ml.get(e);const r=e.clone();return ml.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),qj=le("_ZodString",(e,t)=>{iy.init(e,t),At.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Sj(e,r,i);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(FP(...r)),e.includes=(...r)=>e.check(GP(...r)),e.startsWith=(...r)=>e.check(XP(...r)),e.endsWith=(...r)=>e.check(KP(...r)),e.min=(...r)=>e.check(Ed(...r)),e.max=(...r)=>e.check(xj(...r)),e.length=(...r)=>e.check(wj(...r)),e.nonempty=(...r)=>e.check(Ed(1,...r)),e.lowercase=r=>e.check(qP(r)),e.uppercase=r=>e.check(YP(r)),e.trim=()=>e.check(JP()),e.normalize=(...r)=>e.check(WP(...r)),e.toLowerCase=()=>e.check(QP()),e.toUpperCase=()=>e.check(e8()),e.slugify=()=>e.check(t8())}),F8=le("ZodString",(e,t)=>{iy.init(e,t),qj.init(e,t),e.email=s=>e.check(pP(q8,s)),e.url=s=>e.check(bP(Y8,s)),e.jwt=s=>e.check(DP(l9,s)),e.emoji=s=>e.check(xP(G8,s)),e.guid=s=>e.check(Hw(Xw,s)),e.uuid=s=>e.check(mP(Ru,s)),e.uuidv4=s=>e.check(gP(Ru,s)),e.uuidv6=s=>e.check(yP(Ru,s)),e.uuidv7=s=>e.check(vP(Ru,s)),e.nanoid=s=>e.check(wP(X8,s)),e.guid=s=>e.check(Hw(Xw,s)),e.cuid=s=>e.check(SP(K8,s)),e.cuid2=s=>e.check(EP(W8,s)),e.ulid=s=>e.check(NP(J8,s)),e.base64=s=>e.check(kP(r9,s)),e.base64url=s=>e.check(MP(i9,s)),e.xid=s=>e.check(TP(Q8,s)),e.ksuid=s=>e.check(jP(e9,s)),e.ipv4=s=>e.check(CP(t9,s)),e.ipv6=s=>e.check(AP(n9,s)),e.cidrv4=s=>e.check(RP(s9,s)),e.cidrv6=s=>e.check(_P(a9,s)),e.e164=s=>e.check(OP(o9,s)),e.datetime=s=>e.check(j8(s)),e.date=s=>e.check(A8(s)),e.time=s=>e.check(_8(s)),e.duration=s=>e.check(M8(s))});function ve(e){return hP(F8,e)}const Mt=le("ZodStringFormat",(e,t)=>{_t.init(e,t),qj.init(e,t)}),q8=le("ZodEmail",(e,t)=>{v6.init(e,t),Mt.init(e,t)}),Xw=le("ZodGUID",(e,t)=>{g6.init(e,t),Mt.init(e,t)}),Ru=le("ZodUUID",(e,t)=>{y6.init(e,t),Mt.init(e,t)}),Y8=le("ZodURL",(e,t)=>{b6.init(e,t),Mt.init(e,t)}),G8=le("ZodEmoji",(e,t)=>{x6.init(e,t),Mt.init(e,t)}),X8=le("ZodNanoID",(e,t)=>{w6.init(e,t),Mt.init(e,t)}),K8=le("ZodCUID",(e,t)=>{S6.init(e,t),Mt.init(e,t)}),W8=le("ZodCUID2",(e,t)=>{E6.init(e,t),Mt.init(e,t)}),J8=le("ZodULID",(e,t)=>{N6.init(e,t),Mt.init(e,t)}),Q8=le("ZodXID",(e,t)=>{T6.init(e,t),Mt.init(e,t)}),e9=le("ZodKSUID",(e,t)=>{j6.init(e,t),Mt.init(e,t)}),t9=le("ZodIPv4",(e,t)=>{k6.init(e,t),Mt.init(e,t)}),n9=le("ZodIPv6",(e,t)=>{M6.init(e,t),Mt.init(e,t)}),s9=le("ZodCIDRv4",(e,t)=>{O6.init(e,t),Mt.init(e,t)}),a9=le("ZodCIDRv6",(e,t)=>{D6.init(e,t),Mt.init(e,t)}),r9=le("ZodBase64",(e,t)=>{z6.init(e,t),Mt.init(e,t)}),i9=le("ZodBase64URL",(e,t)=>{L6.init(e,t),Mt.init(e,t)}),o9=le("ZodE164",(e,t)=>{P6.init(e,t),Mt.init(e,t)}),l9=le("ZodJWT",(e,t)=>{U6.init(e,t),Mt.init(e,t)}),Yj=le("ZodNumber",(e,t)=>{mj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Ej(e,r,i),e.gt=(r,i)=>e.check(qw(r,i)),e.gte=(r,i)=>e.check(Hp(r,i)),e.min=(r,i)=>e.check(Hp(r,i)),e.lt=(r,i)=>e.check(Fw(r,i)),e.lte=(r,i)=>e.check(Zp(r,i)),e.max=(r,i)=>e.check(Zp(r,i)),e.int=r=>e.check(Kw(r)),e.safe=r=>e.check(Kw(r)),e.positive=r=>e.check(qw(0,r)),e.nonnegative=r=>e.check(Hp(0,r)),e.negative=r=>e.check(Fw(0,r)),e.nonpositive=r=>e.check(Zp(0,r)),e.multipleOf=(r,i)=>e.check(Yw(r,i)),e.step=(r,i)=>e.check(Yw(r,i)),e.finite=()=>e;const s=e._zod.bag;e.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),e.isFinite=!0,e.format=s.format??null});function c9(e){return $P(Yj,e)}const u9=le("ZodNumberFormat",(e,t)=>{V6.init(e,t),Yj.init(e,t)});function Kw(e){return UP(u9,e)}const d9=le("ZodBoolean",(e,t)=>{B6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Nj(e,s,r)});function xn(e){return VP(d9,e)}const f9=le("ZodNull",(e,t)=>{Z6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Tj(e,s,r)});function h9(e){return BP(f9,e)}const p9=le("ZodUnknown",(e,t)=>{H6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Cj()});function Ds(){return ZP(p9)}const m9=le("ZodNever",(e,t)=>{F6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>jj(e,s,r)});function Gj(e){return HP(m9,e)}const g9=le("ZodArray",(e,t)=>{q6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Mj(e,s,r,i),e.element=t.element,e.min=(s,r)=>e.check(Ed(s,r)),e.nonempty=s=>e.check(Ed(1,s)),e.max=(s,r)=>e.check(xj(s,r)),e.length=(s,r)=>e.check(wj(s,r)),e.unwrap=()=>e.element});function ho(e,t){return n8(g9,e,t)}const Xj=le("ZodObject",(e,t)=>{G6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Oj(e,s,r,i),et(e,"shape",()=>t.shape),e.keyof=()=>Wj(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ds()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ds()}),e.strict=()=>e.clone({...e._zod.def,catchall:Gj()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>hL(e,s),e.safeExtend=s=>pL(e,s),e.merge=s=>mL(e,s),e.pick=s=>dL(e,s),e.omit=s=>fL(e,s),e.partial=(...s)=>gL(Jj,e,s[0]),e.required=(...s)=>yL(Qj,e,s[0])});function gt(e,t){const s={type:"object",shape:e??{},...je(t)};return new Xj(s)}function St(e,t){return new Xj({type:"object",shape:e,catchall:Gj(),...je(t)})}const Kj=le("ZodUnion",(e,t)=>{vj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Dj(e,s,r,i),e.options=t.options});function En(e,t){return new Kj({type:"union",options:e,...je(t)})}const y9=le("ZodDiscriminatedUnion",(e,t)=>{Kj.init(e,t),X6.init(e,t)});function v9(e,t,s){return new y9({type:"union",options:t,discriminator:e,...je(s)})}const b9=le("ZodIntersection",(e,t)=>{K6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>zj(e,s,r,i)});function x9(e,t){return new b9({type:"intersection",left:e,right:t})}const w9=le("ZodRecord",(e,t)=>{W6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Ij(e,s,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function Ll(e,t,s){return new w9({type:"record",keyType:e,valueType:t,...je(s)})}const Hm=le("ZodEnum",(e,t)=>{J6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Aj(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const l={};for(const u of r)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Hm({...t,checks:[],...je(i),entries:l})},e.exclude=(r,i)=>{const l={...t.entries};for(const u of r)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Hm({...t,checks:[],...je(i),entries:l})}});function Wj(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Hm({type:"enum",entries:s,...je(t)})}const S9=le("ZodLiteral",(e,t)=>{Q6.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Rj(e,s,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ze(e,t){return new S9({type:"literal",values:Array.isArray(e)?e:[e],...je(t)})}const E9=le("ZodTransform",(e,t)=>{eP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>kj(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new QT(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(Il(l,s.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=s.value),u.inst??(u.inst=e),s.issues.push(Il(u))}};const i=t.transform(s.value,s);return i instanceof Promise?i.then(l=>(s.value=l,s)):(s.value=i,s)}});function N9(e){return new E9({type:"transform",transform:e})}const Jj=le("ZodOptional",(e,t)=>{bj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>oy(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function Ww(e){return new Jj({type:"optional",innerType:e})}const T9=le("ZodExactOptional",(e,t)=>{tP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>oy(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function j9(e){return new T9({type:"optional",innerType:e})}const C9=le("ZodNullable",(e,t)=>{nP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Lj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function Jw(e){return new C9({type:"nullable",innerType:e})}const A9=le("ZodDefault",(e,t)=>{sP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>$j(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function R9(e,t){return new A9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sj(t)}})}const _9=le("ZodPrefault",(e,t)=>{aP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Uj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function k9(e,t){return new _9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sj(t)}})}const Qj=le("ZodNonOptional",(e,t)=>{rP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Pj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function M9(e,t){return new Qj({type:"nonoptional",innerType:e,...je(t)})}const O9=le("ZodCatch",(e,t)=>{iP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Vj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function D9(e,t){return new O9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const z9=le("ZodPipe",(e,t)=>{oP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Bj(e,s,r,i),e.in=t.in,e.out=t.out});function Qw(e,t){return new z9({type:"pipe",in:e,out:t})}const I9=le("ZodReadonly",(e,t)=>{lP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Zj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function L9(e){return new I9({type:"readonly",innerType:e})}const P9=le("ZodLazy",(e,t)=>{cP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Hj(e,s,r,i),e.unwrap=()=>e._zod.def.getter()});function $9(e){return new P9({type:"lazy",getter:e})}const ly=le("ZodCustom",(e,t)=>{uP.init(e,t),At.init(e,t),e._zod.processJSONSchema=(s,r,i)=>_j(e,s)});function eC(e,t){return s8(ly,e??(()=>!0),t)}function U9(e,t={}){return a8(ly,e,t)}function V9(e){return r8(e)}function Ad(e,t={}){const s=new ly({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...je(t)});return s._zod.bag.Class=e,s._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:s,path:[...s._zod.def.path??[]]})},s}var Pl;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function s(i){throw new Error}e.assertNever=s,e.arrayToEnum=i=>{const l={};for(const u of i)l[u]=u;return l},e.getValidEnumValues=i=>{const l=e.objectKeys(i).filter(f=>typeof i[i[f]]!="number"),u={};for(const f of l)u[f]=i[f];return e.objectValues(u)},e.objectValues=i=>e.objectKeys(i).map(function(l){return i[l]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const u in i)Object.prototype.hasOwnProperty.call(i,u)&&l.push(u);return l},e.find=(i,l)=>{for(const u of i)if(l(u))return u},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,l=" | "){return i.map(u=>typeof u=="string"?`'${u}'`:u).join(l)}e.joinValues=r,e.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Pl||(Pl={}));var eS;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(eS||(eS={}));Pl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Rd extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(l){return l.message},r={_errors:[]},i=l=>{for(const u of l.issues)if(u.code==="invalid_union")u.unionErrors.map(i);else if(u.code==="invalid_return_type")i(u.returnTypeError);else if(u.code==="invalid_arguments")i(u.argumentsError);else if(u.path.length===0)r._errors.push(s(u));else{let f=r,m=0;for(;m<u.path.length;){const h=u.path[m];m===u.path.length-1?(f[h]=f[h]||{_errors:[]},f[h]._errors.push(s(u))):f[h]=f[h]||{_errors:[]},f=f[h],m++}}};return i(this),r}static assert(t){if(!(t instanceof Rd))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const l=i.path[0];s[l]=s[l]||[],s[l].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}Rd.create=e=>new Rd(e);var tS;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(tS||(tS={}));var He;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(He||(He={}));class nS extends Error{constructor(t,s){super(t),this.name="ParseError",this.type=s.type,this.field=s.field,this.value=s.value,this.line=s.line}}const sS=10,B9=13,Ar=32;function Fp(e){}function Z9(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Fp,onError:s=Fp,onRetry:r=Fp,onComment:i}=e;let l="",u=!0,f,m="",h=0,y;function v(j){if(u){u=!1,x(j);return}const E=l===""?j:l+j;l=w(E)}function x(j){j.charCodeAt(0)===239&&j.charCodeAt(1)===187&&j.charCodeAt(2)===191&&(j=j.slice(3));const E=l===""?j:l+j;l=w(E)}function w(j){let E=0;if(j.indexOf("\r")===-1){let _=j.indexOf(`
79
- `,E);for(;_!==-1;){if(E===_){h>0&&t({id:f,event:y,data:m}),f=void 0,m="",h=0,y=void 0,E=_+1,_=j.indexOf(`
80
- `,E);continue}const A=j.charCodeAt(E);if(aS(j,E,A)){const M=j.charCodeAt(E+5)===Ar?E+6:E+5,O=j.slice(M,_);if(h===0&&j.charCodeAt(_+1)===sS){t({id:f,event:y,data:O}),f=void 0,m="",y=void 0,E=_+2,_=j.indexOf(`
81
- `,E);continue}m=h===0?O:`${m}
82
- ${O}`,h++}else rS(j,E,A)?y=j.slice(j.charCodeAt(E+6)===Ar?E+7:E+6,_)||void 0:N(j,E,_);E=_+1,_=j.indexOf(`
83
- `,E)}return j.slice(E)}for(;E<j.length;){const _=j.indexOf("\r",E),A=j.indexOf(`
84
- `,E);let M=-1;if(_!==-1&&A!==-1?M=_<A?_:A:_!==-1?_===j.length-1?M=-1:M=_:A!==-1&&(M=A),M===-1)break;N(j,E,M),E=M+1,j.charCodeAt(E-1)===B9&&j.charCodeAt(E)===sS&&E++}return j.slice(E)}function N(j,E,_){if(E===_){R();return}const A=j.charCodeAt(E);if(aS(j,E,A)){const B=j.charCodeAt(E+5)===Ar?E+6:E+5,P=j.slice(B,_);m=h===0?P:`${m}
85
- ${P}`,h++;return}if(rS(j,E,A)){y=j.slice(j.charCodeAt(E+6)===Ar?E+7:E+6,_)||void 0;return}if(A===105&&j.charCodeAt(E+1)===100&&j.charCodeAt(E+2)===58){const B=j.slice(j.charCodeAt(E+3)===Ar?E+4:E+3,_);f=B.includes("\0")?void 0:B;return}if(A===58){if(i){const B=j.slice(E,_);i(B.slice(j.charCodeAt(E+1)===Ar?2:1))}return}const M=j.slice(E,_),O=M.indexOf(":");if(O===-1){T(M,"",M);return}const I=M.slice(0,O),Y=M.charCodeAt(O+1)===Ar?2:1,F=M.slice(O+Y);T(I,F,M)}function T(j,E,_){switch(j){case"event":y=E||void 0;break;case"data":m=h===0?E:`${m}
86
- ${E}`,h++;break;case"id":f=E.includes("\0")?void 0:E;break;case"retry":/^\d+$/.test(E)?r(parseInt(E,10)):s(new nS(`Invalid \`retry\` value: "${E}"`,{type:"invalid-retry",value:E,line:_}));break;default:s(new nS(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:E,line:_}));break}}function R(){h>0&&t({id:f,event:y,data:m}),f=void 0,m="",h=0,y=void 0}function C(j={}){l&&j.consume&&N(l,0,l.length),u=!0,f=void 0,m="",h=0,y=void 0,l=""}return{feed:v,reset:C}}function aS(e,t,s){return s===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function rS(e,t,s){return s===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class H9 extends TransformStream{constructor({onError:t,onRetry:s,onComment:r}={}){let i;super({start(l){i=Z9({onEvent:u=>{l.enqueue(u)},onError(u){t==="terminate"?l.error(u):typeof t=="function"&&t(u)},onRetry:s,onComment:r})},transform(l){i.feed(l)}})}}var Gl=({prefix:e,size:t=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const l=s.length,u=new Array(t);for(let f=0;f<t;f++)u[f]=s[Math.random()*l|0];return u.join("")};if(e==null)return i;if(s.includes(r))throw new nL({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${s}".`});return()=>`${e}${r}${i()}`},F9=Gl();function Mi(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((s,r)=>{t[r.toLowerCase()]=s});else{Array.isArray(e)||(e=Object.entries(e));for(const[s,r]of e)r!=null&&(t[s.toLowerCase()]=r)}return t}var q9=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Y9=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function iS(e){const t=JSON.parse(e);return t===null||typeof t!="object"||q9.test(e)===!1&&Y9.test(e)===!1?t:G9(t)}function G9(e){let t=[e];for(;t.length;){const s=t;t=[];for(const r of s){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const l=r[i];l&&typeof l=="object"&&t.push(l)}}}return e}function X9(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return iS(e)}try{return iS(e)}finally{Error.stackTraceLimit=t}}function cy(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:s}=e;if(s!=null)for(const r of Object.keys(s))s[r]=Rr(s[r])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Rr):Rr(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Rr)),e.allOf!=null&&(e.allOf=e.allOf.map(Rr)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Rr));const{definitions:t}=e;if(t!=null)for(const s of Object.keys(t))t[s]=Rr(t[s]);return e}function Rr(e){return typeof e=="boolean"?e:cy(e)}var K9=Symbol("Let zodToJsonSchema decide on which parser to use"),oS={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},W9=e=>typeof e=="string"?{...oS,name:e}:{...oS,...e};function Xn(){return{}}function J9(e,t){var s,r,i;const l={type:"array"};return(s=e.type)!=null&&s._def&&((i=(r=e.type)==null?void 0:r._def)==null?void 0:i.typeName)!==He.ZodAny&&(l.items=dt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(l.minItems=e.minLength.value),e.maxLength&&(l.maxItems=e.maxLength.value),e.exactLength&&(l.minItems=e.exactLength.value,l.maxItems=e.exactLength.value),l}function Q9(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function e$(){return{type:"boolean"}}function tC(e,t){return dt(e.type._def,t)}var t$=(e,t)=>dt(e.innerType._def,t);function nC(e,t,s){const r=s??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,l)=>nC(e,t,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return n$(e)}}var n$=e=>{const t={type:"integer",format:"unix-time"};for(const s of e.checks)switch(s.kind){case"min":t.minimum=s.value;break;case"max":t.maximum=s.value;break}return t};function s$(e,t){return{...dt(e.innerType._def,t),default:e.defaultValue()}}function a$(e,t){return t.effectStrategy==="input"?dt(e.schema._def,t):Xn()}function r$(e){return{type:"string",enum:Array.from(e.values)}}var i$=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function o$(e,t){const s=[dt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),dt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return s.forEach(i=>{if(i$(i))r.push(...i.allOf);else{let l=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:u,...f}=i;l=f}r.push(l)}}),r.length?{allOf:r}:void 0}function l$(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var qp=void 0,vs={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(qp===void 0&&(qp=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qp),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function sC(e,t){const s={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,r.value):r.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":bs(s,"email",r.message,t);break;case"format:idn-email":bs(s,"idn-email",r.message,t);break;case"pattern:zod":vn(s,vs.email,r.message,t);break}break;case"url":bs(s,"uri",r.message,t);break;case"uuid":bs(s,"uuid",r.message,t);break;case"regex":vn(s,r.regex,r.message,t);break;case"cuid":vn(s,vs.cuid,r.message,t);break;case"cuid2":vn(s,vs.cuid2,r.message,t);break;case"startsWith":vn(s,RegExp(`^${Yp(r.value,t)}`),r.message,t);break;case"endsWith":vn(s,RegExp(`${Yp(r.value,t)}$`),r.message,t);break;case"datetime":bs(s,"date-time",r.message,t);break;case"date":bs(s,"date",r.message,t);break;case"time":bs(s,"time",r.message,t);break;case"duration":bs(s,"duration",r.message,t);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,r.value):r.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,r.value):r.value;break;case"includes":{vn(s,RegExp(Yp(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&bs(s,"ipv4",r.message,t),r.version!=="v4"&&bs(s,"ipv6",r.message,t);break}case"base64url":vn(s,vs.base64url,r.message,t);break;case"jwt":vn(s,vs.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&vn(s,vs.ipv4Cidr,r.message,t),r.version!=="v4"&&vn(s,vs.ipv6Cidr,r.message,t);break}case"emoji":vn(s,vs.emoji(),r.message,t);break;case"ulid":{vn(s,vs.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{bs(s,"binary",r.message,t);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{vn(s,vs.base64,r.message,t);break}}break}case"nanoid":vn(s,vs.nanoid,r.message,t)}return s}function Yp(e,t){return t.patternStrategy==="escape"?u$(e):e}var c$=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function u$(e){let t="";for(let s=0;s<e.length;s++)c$.has(e[s])||(t+="\\"),t+=e[s];return t}function bs(e,t,s,r){var i;e.format||(i=e.anyOf)!=null&&i.some(l=>l.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...s&&r.errorMessages&&{errorMessage:{format:s}}})):e.format=t}function vn(e,t,s,r){var i;e.pattern||(i=e.allOf)!=null&&i.some(l=>l.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:lS(t,r),...s&&r.errorMessages&&{errorMessage:{pattern:s}}})):e.pattern=lS(t,r)}function lS(e,t){var s;if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source;let l="",u=!1,f=!1,m=!1;for(let h=0;h<i.length;h++){if(u){l+=i[h],u=!1;continue}if(r.i){if(f){if(i[h].match(/[a-z]/)){m?(l+=i[h],l+=`${i[h-2]}-${i[h]}`.toUpperCase(),m=!1):i[h+1]==="-"&&((s=i[h+2])!=null&&s.match(/[a-z]/))?(l+=i[h],m=!0):l+=`${i[h]}${i[h].toUpperCase()}`;continue}}else if(i[h].match(/[a-z]/)){l+=`[${i[h]}${i[h].toUpperCase()}]`;continue}}if(r.m){if(i[h]==="^"){l+=`(^|(?<=[\r
87
- ]))`;continue}else if(i[h]==="$"){l+=`($|(?=[\r
88
- ]))`;continue}}if(r.s&&i[h]==="."){l+=f?`${i[h]}\r
89
- `:`[${i[h]}\r
90
- ]`;continue}l+=i[h],i[h]==="\\"?u=!0:f&&i[h]==="]"?f=!1:!f&&i[h]==="["&&(f=!0)}try{new RegExp(l)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return l}function aC(e,t){var s,r,i,l,u,f;const m={type:"object",additionalProperties:(s=dt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?s:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===He.ZodString&&((i=e.keyType._def.checks)!=null&&i.length)){const{type:h,...y}=sC(e.keyType._def,t);return{...m,propertyNames:y}}else{if(((l=e.keyType)==null?void 0:l._def.typeName)===He.ZodEnum)return{...m,propertyNames:{enum:e.keyType._def.values}};if(((u=e.keyType)==null?void 0:u._def.typeName)===He.ZodBranded&&e.keyType._def.type._def.typeName===He.ZodString&&((f=e.keyType._def.type._def.checks)!=null&&f.length)){const{type:h,...y}=tC(e.keyType._def,t);return{...m,propertyNames:y}}}return m}function d$(e,t){if(t.mapStrategy==="record")return aC(e,t);const s=dt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Xn(),r=dt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Xn();return{type:"array",maxItems:125,items:{type:"array",items:[s,r],minItems:2,maxItems:2}}}function f$(e){const t=e.values,r=Object.keys(e.values).filter(l=>typeof t[t[l]]!="number").map(l=>t[l]),i=Array.from(new Set(r.map(l=>typeof l)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function h$(){return{not:Xn()}}function p$(){return{type:"null"}}var Fm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function m$(e,t){const s=e.options instanceof Map?Array.from(e.options.values()):e.options;if(s.every(r=>r._def.typeName in Fm&&(!r._def.checks||!r._def.checks.length))){const r=s.reduce((i,l)=>{const u=Fm[l._def.typeName];return u&&!i.includes(u)?[...i,u]:i},[]);return{type:r.length>1?r:r[0]}}else if(s.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=s.reduce((i,l)=>{const u=typeof l._def.value;switch(u){case"string":case"number":case"boolean":return[...i,u];case"bigint":return[...i,"integer"];case"object":if(l._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===s.length){const i=r.filter((l,u,f)=>f.indexOf(l)===u);return{type:i.length>1?i:i[0],enum:s.reduce((l,u)=>l.includes(u._def.value)?l:[...l,u._def.value],[])}}}else if(s.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((r,i)=>[...r,...i._def.values.filter(l=>!r.includes(l))],[])};return g$(e,t)}var g$=(e,t)=>{const s=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,i)=>dt(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return s.length?{anyOf:s}:void 0};function y$(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Fm[e.innerType._def.typeName],"null"]};const s=dt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function v$(e){const t={type:"number"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"int":t.type="integer";break;case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function b$(e,t){const s={type:"object",properties:{}},r=[],i=e.shape();for(const u in i){let f=i[u];if(f===void 0||f._def===void 0)continue;const m=w$(f),h=dt(f._def,{...t,currentPath:[...t.currentPath,"properties",u],propertyPath:[...t.currentPath,"properties",u]});h!==void 0&&(s.properties[u]=h,m||r.push(u))}r.length&&(s.required=r);const l=x$(e,t);return l!==void 0&&(s.additionalProperties=l),s}function x$(e,t){if(e.catchall._def.typeName!=="ZodNever")return dt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function w$(e){try{return e.isOptional()}catch{return!0}}var S$=(e,t)=>{var s;if(t.currentPath.toString()===((s=t.propertyPath)==null?void 0:s.toString()))return dt(e.innerType._def,t);const r=dt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xn()},r]}:Xn()},E$=(e,t)=>{if(t.pipeStrategy==="input")return dt(e.in._def,t);if(t.pipeStrategy==="output")return dt(e.out._def,t);const s=dt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=dt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,r].filter(i=>i!==void 0)}};function N$(e,t){return dt(e.type._def,t)}function T$(e,t){const r={type:"array",uniqueItems:!0,items:dt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function j$(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((s,r)=>dt(s._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((s,r)=>r===void 0?s:[...s,r],[]),additionalItems:dt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((s,r)=>dt(s._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((s,r)=>r===void 0?s:[...s,r],[])}}function C$(){return{not:Xn()}}function A$(){return Xn()}var R$=(e,t)=>dt(e.innerType._def,t),_$=(e,t,s)=>{switch(t){case He.ZodString:return sC(e,s);case He.ZodNumber:return v$(e);case He.ZodObject:return b$(e,s);case He.ZodBigInt:return Q9(e);case He.ZodBoolean:return e$();case He.ZodDate:return nC(e,s);case He.ZodUndefined:return C$();case He.ZodNull:return p$();case He.ZodArray:return J9(e,s);case He.ZodUnion:case He.ZodDiscriminatedUnion:return m$(e,s);case He.ZodIntersection:return o$(e,s);case He.ZodTuple:return j$(e,s);case He.ZodRecord:return aC(e,s);case He.ZodLiteral:return l$(e);case He.ZodEnum:return r$(e);case He.ZodNativeEnum:return f$(e);case He.ZodNullable:return y$(e,s);case He.ZodOptional:return S$(e,s);case He.ZodMap:return d$(e,s);case He.ZodSet:return T$(e,s);case He.ZodLazy:return()=>e.getter()._def;case He.ZodPromise:return N$(e,s);case He.ZodNaN:case He.ZodNever:return h$();case He.ZodEffects:return a$(e,s);case He.ZodAny:return Xn();case He.ZodUnknown:return A$();case He.ZodDefault:return s$(e,s);case He.ZodBranded:return tC(e,s);case He.ZodReadonly:return R$(e,s);case He.ZodCatch:return t$(e,s);case He.ZodPipeline:return E$(e,s);case He.ZodFunction:case He.ZodVoid:case He.ZodSymbol:return;default:return(r=>{})()}},k$=(e,t)=>{let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];s++);return[(e.length-s).toString(),...t.slice(s)].join("/")};function dt(e,t,s=!1){var r;const i=t.seen.get(e);if(t.override){const m=(r=t.override)==null?void 0:r.call(t,e,t,i,s);if(m!==K9)return m}if(i&&!s){const m=M$(i,t);if(m!==void 0)return m}const l={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,l);const u=_$(e,e.typeName,t),f=typeof u=="function"?dt(u(),t):u;if(f&&O$(e,t,f),t.postProcess){const m=t.postProcess(f,e,t);return l.jsonSchema=f,m}return l.jsonSchema=f,f}var M$=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:k$(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((s,r)=>t.currentPath[r]===s)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Xn()):t.$refStrategy==="seen"?Xn():void 0}},O$=(e,t,s)=>(e.description&&(s.description=e.description),s),D$=e=>{const t=W9(e),s=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},z$=(e,t)=>{var s;const r=D$(t);let i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((h,[y,v])=>{var x;return{...h,[y]:(x=dt(v._def,{...r,currentPath:[...r.basePath,r.definitionPath,y]},!0))!=null?x:Xn()}},{}):void 0;const l=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,u=(s=dt(e._def,l===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,l]},!1))!=null?s:Xn(),f=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;f!==void 0&&(u.title=f);const m=l===void 0?i?{...u,[r.definitionPath]:i}:u:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,l].join("/"),[r.definitionPath]:{...i,[l]:u}};return m.$schema="http://json-schema.org/draft-07/schema#",m},qm=Symbol.for("vercel.ai.schema");function I$(e){let t;return()=>(t==null&&(t=e()),t)}function Kd(e,{validate:t}={}){return{[qm]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function L$(e){return typeof e=="object"&&e!==null&&qm in e&&e[qm]===!0&&"jsonSchema"in e&&"validate"in e}function uy(e){return e==null?Kd({properties:{},additionalProperties:!1}):L$(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?rC(e):P$(e):e()}function P$(e){return Kd(()=>cy(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const s=await e["~standard"].validate(t);return"value"in s?{success:!0,value:s.value}:{success:!1,error:new to({value:t,cause:s.issues})}}})}function $$(e,t){var s;const r=(s=void 0)!=null?s:!1;return Kd(()=>z$(e,{$refStrategy:r?"root":"none"}),{validate:async i=>{const l=await e.safeParseAsync(i);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function U$(e,t){var s;const r=(s=void 0)!=null?s:!1;return Kd(()=>cy(N8(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const l=await Fj(e,i);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function V$(e){return"_zod"in e}function rC(e,t){return V$(e)?U$(e):$$(e)}async function cS({value:e,schema:t,context:s}){const r=await $l({value:e,schema:t,context:s});if(!r.success)throw to.wrap({value:e,cause:r.error,context:s});return r.value}async function $l({value:e,schema:t,context:s}){const r=uy(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const i=await r.validate(e);return i.success?{success:!0,value:i.value,rawValue:e}:{success:!1,error:to.wrap({value:e,cause:i.error,context:s}),rawValue:e}}catch(i){return{success:!1,error:to.wrap({value:e,cause:i,context:s}),rawValue:e}}}async function Br({text:e,schema:t}){try{const s=X9(e);return t==null?{success:!0,value:s,rawValue:s}:await $l({value:s,schema:t})}catch(s){return{success:!1,error:Rw.isInstance(s)?s:new Rw({text:e,cause:s}),rawValue:void 0}}}function B$({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new H9).pipeThrough(new TransformStream({async transform({data:s},r){s!=="[DONE]"&&r.enqueue(await Br({text:s,schema:t}))}}))}async function Ba(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var Z$=Object.defineProperty,H$=(e,t)=>{for(var s in t)Z$(e,s,{get:t[s],enumerable:!0})},iC="AI_NoObjectGeneratedError",oC=`vercel.ai.error.${iC}`,F$=Symbol.for(oC),lC,Ka=class extends Bs{constructor({message:e="No object generated.",cause:t,text:s,response:r,usage:i,finishReason:l}){super({name:iC,message:e,cause:t}),this[lC]=!0,this.text=s,this.response=r,this.usage=i,this.finishReason=l}static isInstance(e){return Bs.hasMarker(e,oC)}};lC=F$;var cC="AI_UIMessageStreamError",uC=`vercel.ai.error.${cC}`,q$=Symbol.for(uC),dC,Oi=class extends Bs{constructor({chunkType:e,chunkId:t,message:s}){super({name:cC,message:s}),this[dC]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Bs.hasMarker(e,uC)}};dC=q$;var fC=En([ve(),Ad(Uint8Array),Ad(ArrayBuffer),eC(e=>{var t,s;return(s=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?s:!1},{message:"Must be a Buffer"})]),Ul=$9(()=>En([h9(),ve(),c9(),xn(),Ll(ve(),Ul.optional()),ho(Ul)])),Ke=Ll(ve(),Ll(ve(),Ul.optional())),hC=gt({type:ze("text"),text:ve(),providerOptions:Ke.optional()}),Y$=gt({type:ze("image"),image:En([fC,Ad(URL)]),mediaType:ve().optional(),providerOptions:Ke.optional()}),pC=gt({type:ze("file"),data:En([fC,Ad(URL)]),filename:ve().optional(),mediaType:ve(),providerOptions:Ke.optional()}),G$=gt({type:ze("reasoning"),text:ve(),providerOptions:Ke.optional()}),X$=gt({type:ze("tool-call"),toolCallId:ve(),toolName:ve(),input:Ds(),providerOptions:Ke.optional(),providerExecuted:xn().optional()}),K$=v9("type",[gt({type:ze("text"),value:ve(),providerOptions:Ke.optional()}),gt({type:ze("json"),value:Ul,providerOptions:Ke.optional()}),gt({type:ze("execution-denied"),reason:ve().optional(),providerOptions:Ke.optional()}),gt({type:ze("error-text"),value:ve(),providerOptions:Ke.optional()}),gt({type:ze("error-json"),value:Ul,providerOptions:Ke.optional()}),gt({type:ze("content"),value:ho(En([gt({type:ze("text"),text:ve(),providerOptions:Ke.optional()}),gt({type:ze("media"),data:ve(),mediaType:ve()}),gt({type:ze("file-data"),data:ve(),mediaType:ve(),filename:ve().optional(),providerOptions:Ke.optional()}),gt({type:ze("file-url"),url:ve(),providerOptions:Ke.optional()}),gt({type:ze("file-id"),fileId:En([ve(),Ll(ve(),ve())]),providerOptions:Ke.optional()}),gt({type:ze("image-data"),data:ve(),mediaType:ve(),providerOptions:Ke.optional()}),gt({type:ze("image-url"),url:ve(),providerOptions:Ke.optional()}),gt({type:ze("image-file-id"),fileId:En([ve(),Ll(ve(),ve())]),providerOptions:Ke.optional()}),gt({type:ze("custom"),providerOptions:Ke.optional()})]))})]),mC=gt({type:ze("tool-result"),toolCallId:ve(),toolName:ve(),output:K$,providerOptions:Ke.optional()}),W$=gt({type:ze("tool-approval-request"),approvalId:ve(),toolCallId:ve()}),J$=gt({type:ze("tool-approval-response"),approvalId:ve(),approved:xn(),reason:ve().optional()}),Q$=gt({role:ze("system"),content:ve(),providerOptions:Ke.optional()}),eU=gt({role:ze("user"),content:En([ve(),ho(En([hC,Y$,pC]))]),providerOptions:Ke.optional()}),tU=gt({role:ze("assistant"),content:En([ve(),ho(En([hC,pC,G$,X$,mC,W$]))]),providerOptions:Ke.optional()}),nU=gt({role:ze("tool"),content:ho(En([mC,J$])),providerOptions:Ke.optional()});En([Q$,eU,tU,nU]);function gC(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const s={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const i=t[r];if(i===void 0)continue;const l=r in e?e[r]:void 0,u=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),f=l!=null&&typeof l=="object"&&!Array.isArray(l)&&!(l instanceof Date)&&!(l instanceof RegExp);u&&f?s[r]=gC(l,i):s[r]=i}return s}var sU={};H$(sU,{array:()=>oU,choice:()=>lU,json:()=>cU,object:()=>iU,text:()=>rU});function aU(e){const t=["ROOT"];let s=-1,r=null;function i(m,h,y){switch(m){case'"':{s=h,t.pop(),t.push(y),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=h,r=h,t.pop(),t.push(y),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(y),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=h,t.pop(),t.push(y),t.push("INSIDE_NUMBER");break}case"{":{s=h,t.pop(),t.push(y),t.push("INSIDE_OBJECT_START");break}case"[":{s=h,t.pop(),t.push(y),t.push("INSIDE_ARRAY_START");break}}}function l(m,h){switch(m){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=h,t.pop();break}}}function u(m,h){switch(m){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=h,t.pop();break}}}for(let m=0;m<e.length;m++){const h=e[m];switch(t[t.length-1]){case"ROOT":i(h,m,"FINISH");break;case"INSIDE_OBJECT_START":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{s=m,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{h===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(h,m,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{l(h,m);break}case"INSIDE_STRING":{switch(h){case'"':{t.pop(),s=m;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:s=m}break}case"INSIDE_ARRAY_START":{h==="]"?(s=m,t.pop()):(s=m,i(h,m,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(h){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=m,t.pop();break}default:{s=m;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(h,m,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),s=m;break}case"INSIDE_NUMBER":{switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=m;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,m);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,m);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const v=e.substring(r,m+1);!"false".startsWith(v)&&!"true".startsWith(v)&&!"null".startsWith(v)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,m):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m)):s=m;break}}}let f=e.slice(0,s+1);for(let m=t.length-1;m>=0;m--)switch(t[m]){case"INSIDE_STRING":{f+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{f+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{f+="]";break}case"INSIDE_LITERAL":{const y=e.substring(r,e.length);"true".startsWith(y)?f+="true".slice(y.length):"false".startsWith(y)?f+="false".slice(y.length):"null".startsWith(y)&&(f+="null".slice(y.length))}}return f}async function Xl(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Br({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Br({text:aU(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var rU=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),iU=({schema:e,name:t,description:s})=>{const r=uy(e);return{name:"object",responseFormat:Ba(r.jsonSchema).then(i=>({type:"json",schema:i,...t!=null&&{name:t},...s!=null&&{description:s}})),async parseCompleteOutput({text:i},l){const u=await Br({text:i});if(!u.success)throw new Ka({message:"No object generated: could not parse the response.",cause:u.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=await $l({value:u.value,schema:r});if(!f.success)throw new Ka({message:"No object generated: response did not match schema.",cause:f.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});return f.value},async parsePartialOutput({text:i}){const l=await Xl(i);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:l.value}}},createElementStreamTransform(){}}},oU=({element:e,name:t,description:s})=>{const r=uy(e);return{name:"array",responseFormat:Ba(r.jsonSchema).then(i=>{const{$schema:l,...u}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:u}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}}),async parseCompleteOutput({text:i},l){const u=await Br({text:i});if(!u.success)throw new Ka({message:"No object generated: could not parse the response.",cause:u.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=u.value;if(f==null||typeof f!="object"||!("elements"in f)||!Array.isArray(f.elements))throw new Ka({message:"No object generated: response did not match schema.",cause:new to({value:f,cause:"response must be an object with an elements array"}),text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});for(const m of f.elements){const h=await $l({value:m,schema:r});if(!h.success)throw new Ka({message:"No object generated: response did not match schema.",cause:h.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason})}return f.elements},async parsePartialOutput({text:i}){const l=await Xl(i);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const u=l.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))return;const f=l.state==="repaired-parse"&&u.elements.length>0?u.elements.slice(0,-1):u.elements,m=[];for(const h of f){const y=await $l({value:h,schema:r});y.success&&m.push(y.value)}return{partial:m}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:l},u){if(l!=null)for(;i<l.length;i++)u.enqueue(l[i])}})}}},lU=({options:e,name:t,description:s})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}),async parseCompleteOutput({text:r},i){const l=await Br({text:r});if(!l.success)throw new Ka({message:"No object generated: could not parse the response.",cause:l.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const u=l.value;if(u==null||typeof u!="object"||!("result"in u)||typeof u.result!="string"||!e.includes(u.result))throw new Ka({message:"No object generated: response did not match schema.",cause:new to({value:u,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return u.result},async parsePartialOutput({text:r}){const i=await Xl(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const l=i.value;if(l==null||typeof l!="object"||!("result"in l)||typeof l.result!="string")return;const u=e.filter(f=>f.startsWith(l.result));return i.state==="successful-parse"?u.includes(l.result)?{partial:l.result}:void 0:u.length===1?{partial:u[0]}:void 0}}},createElementStreamTransform(){}}),cU=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:s},r){const i=await Br({text:s});if(!i.success)throw new Ka({message:"No object generated: could not parse the response.",cause:i.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:s}){const r=await Xl(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});Gl({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
91
-
92
- `)},flush(e){e.enqueue(`data: [DONE]
93
-
94
- `)}})}});var uU=I$(()=>rC(En([St({type:ze("text-start"),id:ve(),providerMetadata:Ke.optional()}),St({type:ze("text-delta"),id:ve(),delta:ve(),providerMetadata:Ke.optional()}),St({type:ze("text-end"),id:ve(),providerMetadata:Ke.optional()}),St({type:ze("error"),errorText:ve()}),St({type:ze("tool-input-start"),toolCallId:ve(),toolName:ve(),providerExecuted:xn().optional(),providerMetadata:Ke.optional(),dynamic:xn().optional(),title:ve().optional()}),St({type:ze("tool-input-delta"),toolCallId:ve(),inputTextDelta:ve()}),St({type:ze("tool-input-available"),toolCallId:ve(),toolName:ve(),input:Ds(),providerExecuted:xn().optional(),providerMetadata:Ke.optional(),dynamic:xn().optional(),title:ve().optional()}),St({type:ze("tool-input-error"),toolCallId:ve(),toolName:ve(),input:Ds(),providerExecuted:xn().optional(),providerMetadata:Ke.optional(),dynamic:xn().optional(),errorText:ve(),title:ve().optional()}),St({type:ze("tool-approval-request"),approvalId:ve(),toolCallId:ve()}),St({type:ze("tool-output-available"),toolCallId:ve(),output:Ds(),providerExecuted:xn().optional(),providerMetadata:Ke.optional(),dynamic:xn().optional(),preliminary:xn().optional()}),St({type:ze("tool-output-error"),toolCallId:ve(),errorText:ve(),providerExecuted:xn().optional(),providerMetadata:Ke.optional(),dynamic:xn().optional()}),St({type:ze("tool-output-denied"),toolCallId:ve()}),St({type:ze("reasoning-start"),id:ve(),providerMetadata:Ke.optional()}),St({type:ze("reasoning-delta"),id:ve(),delta:ve(),providerMetadata:Ke.optional()}),St({type:ze("reasoning-end"),id:ve(),providerMetadata:Ke.optional()}),St({type:ze("source-url"),sourceId:ve(),url:ve(),title:ve().optional(),providerMetadata:Ke.optional()}),St({type:ze("source-document"),sourceId:ve(),mediaType:ve(),title:ve(),filename:ve().optional(),providerMetadata:Ke.optional()}),St({type:ze("file"),url:ve(),mediaType:ve(),providerMetadata:Ke.optional()}),St({type:eC(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:ve().optional(),data:Ds(),transient:xn().optional()}),St({type:ze("start-step")}),St({type:ze("finish-step")}),St({type:ze("start"),messageId:ve().optional(),messageMetadata:Ds().optional()}),St({type:ze("finish"),finishReason:Wj(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Ds().optional()}),St({type:ze("abort"),reason:ve().optional()}),St({type:ze("message-metadata"),messageMetadata:Ds()})])));function dU(e){return e.type.startsWith("data-")}function Ym(e){return e.type.startsWith("tool-")}function yC(e){return e.type==="dynamic-tool"}function Zr(e){return Ym(e)||yC(e)}function Gm(e){return e.type.split("-").slice(1).join("-")}function vC(e){return yC(e)?e.toolName:Gm(e)}function fU({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function hU({stream:e,messageMetadataSchema:t,dataPartSchemas:s,runUpdateMessageJob:r,onError:i,onToolCall:l,onData:u}){return e.pipeThrough(new TransformStream({async transform(f,m){await r(async({state:h,write:y})=>{var v,x,w,N;function T(E){const A=h.message.parts.filter(Zr).find(M=>M.toolCallId===E);if(A==null)throw new Oi({chunkType:"tool-invocation",chunkId:E,message:`No tool invocation found for tool call ID "${E}".`});return A}function R(E){var _;const A=h.message.parts.find(I=>Ym(I)&&I.toolCallId===E.toolCallId),M=E,O=A;if(A!=null){A.state=E.state,O.input=M.input,O.output=M.output,O.errorText=M.errorText,O.rawInput=M.rawInput,O.preliminary=M.preliminary,E.title!==void 0&&(O.title=E.title),O.providerExecuted=(_=M.providerExecuted)!=null?_:A.providerExecuted;const I=M.providerMetadata;if(I!=null)if(E.state==="output-available"||E.state==="output-error"){const Y=A;Y.resultProviderMetadata=I}else A.callProviderMetadata=I}else h.message.parts.push({type:`tool-${E.toolName}`,toolCallId:E.toolCallId,state:E.state,title:E.title,input:M.input,output:M.output,rawInput:M.rawInput,errorText:M.errorText,providerExecuted:M.providerExecuted,preliminary:M.preliminary,...M.providerMetadata!=null&&(E.state==="output-available"||E.state==="output-error")?{resultProviderMetadata:M.providerMetadata}:{},...M.providerMetadata!=null&&!(E.state==="output-available"||E.state==="output-error")?{callProviderMetadata:M.providerMetadata}:{}})}function C(E){var _,A;const M=h.message.parts.find(Y=>Y.type==="dynamic-tool"&&Y.toolCallId===E.toolCallId),O=E,I=M;if(M!=null){M.state=E.state,I.toolName=E.toolName,I.input=O.input,I.output=O.output,I.errorText=O.errorText,I.rawInput=(_=O.rawInput)!=null?_:I.rawInput,I.preliminary=O.preliminary,E.title!==void 0&&(I.title=E.title),I.providerExecuted=(A=O.providerExecuted)!=null?A:M.providerExecuted;const Y=O.providerMetadata;if(Y!=null)if(E.state==="output-available"||E.state==="output-error"){const F=M;F.resultProviderMetadata=Y}else M.callProviderMetadata=Y}else h.message.parts.push({type:"dynamic-tool",toolName:E.toolName,toolCallId:E.toolCallId,state:E.state,input:O.input,output:O.output,errorText:O.errorText,preliminary:O.preliminary,providerExecuted:O.providerExecuted,title:E.title,...O.providerMetadata!=null&&(E.state==="output-available"||E.state==="output-error")?{resultProviderMetadata:O.providerMetadata}:{},...O.providerMetadata!=null&&!(E.state==="output-available"||E.state==="output-error")?{callProviderMetadata:O.providerMetadata}:{}})}async function j(E){if(E!=null){const _=h.message.metadata!=null?gC(h.message.metadata,E):E;t!=null&&await cS({value:_,schema:t,context:{field:"message.metadata",entityId:h.message.id}}),h.message.metadata=_}}switch(f.type){case"text-start":{const E={type:"text",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeTextParts[f.id]=E,h.message.parts.push(E),y();break}case"text-delta":{const E=h.activeTextParts[f.id];if(E==null)throw new Oi({chunkType:"text-delta",chunkId:f.id,message:`Received text-delta for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});E.text+=f.delta,E.providerMetadata=(v=f.providerMetadata)!=null?v:E.providerMetadata,y();break}case"text-end":{const E=h.activeTextParts[f.id];if(E==null)throw new Oi({chunkType:"text-end",chunkId:f.id,message:`Received text-end for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});E.state="done",E.providerMetadata=(x=f.providerMetadata)!=null?x:E.providerMetadata,delete h.activeTextParts[f.id],y();break}case"reasoning-start":{const E={type:"reasoning",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeReasoningParts[f.id]=E,h.message.parts.push(E),y();break}case"reasoning-delta":{const E=h.activeReasoningParts[f.id];if(E==null)throw new Oi({chunkType:"reasoning-delta",chunkId:f.id,message:`Received reasoning-delta for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});E.text+=f.delta,E.providerMetadata=(w=f.providerMetadata)!=null?w:E.providerMetadata,y();break}case"reasoning-end":{const E=h.activeReasoningParts[f.id];if(E==null)throw new Oi({chunkType:"reasoning-end",chunkId:f.id,message:`Received reasoning-end for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});E.providerMetadata=(N=f.providerMetadata)!=null?N:E.providerMetadata,E.state="done",delete h.activeReasoningParts[f.id],y();break}case"file":{h.message.parts.push({type:"file",mediaType:f.mediaType,url:f.url,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}}),y();break}case"source-url":{h.message.parts.push({type:"source-url",sourceId:f.sourceId,url:f.url,title:f.title,providerMetadata:f.providerMetadata}),y();break}case"source-document":{h.message.parts.push({type:"source-document",sourceId:f.sourceId,mediaType:f.mediaType,title:f.title,filename:f.filename,providerMetadata:f.providerMetadata}),y();break}case"tool-input-start":{const E=h.message.parts.filter(Ym);h.partialToolCalls[f.toolCallId]={text:"",toolName:f.toolName,index:E.length,dynamic:f.dynamic,title:f.title},f.dynamic?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}):R({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}),y();break}case"tool-input-delta":{const E=h.partialToolCalls[f.toolCallId];if(E==null)throw new Oi({chunkType:"tool-input-delta",chunkId:f.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${f.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});E.text+=f.inputTextDelta;const{value:_}=await Xl(E.text);E.dynamic?C({toolCallId:f.toolCallId,toolName:E.toolName,state:"input-streaming",input:_,title:E.title}):R({toolCallId:f.toolCallId,toolName:E.toolName,state:"input-streaming",input:_,title:E.title}),y();break}case"tool-input-available":{f.dynamic?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}):R({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}),y(),l&&!f.providerExecuted&&await l({toolCall:f});break}case"tool-input-error":{const E=h.message.parts.filter(Zr).find(A=>A.toolCallId===f.toolCallId);(E!=null?E.type==="dynamic-tool":!!f.dynamic)?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}):R({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:void 0,rawInput:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}),y();break}case"tool-approval-request":{const E=T(f.toolCallId);E.state="approval-requested",E.approval={id:f.approvalId},y();break}case"tool-output-denied":{const E=T(f.toolCallId);E.state="output-denied",y();break}case"tool-output-available":{const E=T(f.toolCallId);E.type==="dynamic-tool"?C({toolCallId:f.toolCallId,toolName:E.toolName,state:"output-available",input:E.input,output:f.output,preliminary:f.preliminary,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:E.title}):R({toolCallId:f.toolCallId,toolName:Gm(E),state:"output-available",input:E.input,output:f.output,providerExecuted:f.providerExecuted,preliminary:f.preliminary,providerMetadata:f.providerMetadata,title:E.title}),y();break}case"tool-output-error":{const E=T(f.toolCallId);E.type==="dynamic-tool"?C({toolCallId:f.toolCallId,toolName:E.toolName,state:"output-error",input:E.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:E.title}):R({toolCallId:f.toolCallId,toolName:Gm(E),state:"output-error",input:E.input,rawInput:E.rawInput,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:E.title}),y();break}case"start-step":{h.message.parts.push({type:"step-start"});break}case"finish-step":{h.activeTextParts={},h.activeReasoningParts={};break}case"start":{f.messageId!=null&&(h.message.id=f.messageId),await j(f.messageMetadata),(f.messageId!=null||f.messageMetadata!=null)&&y();break}case"finish":{f.finishReason!=null&&(h.finishReason=f.finishReason),await j(f.messageMetadata),f.messageMetadata!=null&&y();break}case"message-metadata":{await j(f.messageMetadata),f.messageMetadata!=null&&y();break}case"error":{i?.(new Error(f.errorText));break}default:if(dU(f)){if(s?.[f.type]!=null){const A=h.message.parts.findIndex(O=>"id"in O&&"data"in O&&O.id===f.id&&O.type===f.type),M=A>=0?A:h.message.parts.length;await cS({value:f.data,schema:s[f.type],context:{field:`message.parts[${M}].data`,entityName:f.type,entityId:f.id}})}const E=f;if(E.transient){u?.(E);break}const _=E.id!=null?h.message.parts.find(A=>E.type===A.type&&E.id===A.id):void 0;_!=null?_.data=E.data:h.message.parts.push(E),u?.(E),y()}}m.enqueue(f)})}}))}async function pU({stream:e,onError:t}){const s=e.getReader();try{for(;;){const{done:r}=await s.read();if(r)break}}catch(r){t?.(r)}finally{s.releaseLock()}}Gl({prefix:"aitxt",size:24});Gl({prefix:"aiobj",size:24});var mU=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,s)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){s(r)}}),this.processQueue()})}};Gl({prefix:"aiobj",size:24});async function gU(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:s,type:r}=t,i=await new Promise((l,u)=>{const f=new FileReader;f.onload=m=>{var h;l((h=m.target)==null?void 0:h.result)},f.onerror=m=>u(m),f.readAsDataURL(t)});return{type:"file",mediaType:r,filename:s,url:i}}))}var yU=class{constructor({api:e="/api/chat",credentials:t,headers:s,body:r,fetch:i,prepareSendMessagesRequest:l,prepareReconnectToStreamRequest:u}){this.api=e,this.credentials=t,this.headers=s,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=l,this.prepareReconnectToStreamRequest=u}async sendMessages({abortSignal:e,...t}){var s,r,i,l,u;const f=await Ba(this.body),m=await Ba(this.headers),h=await Ba(this.credentials),y={...Mi(m),...Mi(t.headers)},v=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...f,...t.body},headers:y,credentials:h,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),x=(r=v?.api)!=null?r:this.api,w=v?.headers!==void 0?Mi(v.headers):y,N=v?.body!==void 0?v.body:{...f,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},T=(i=v?.credentials)!=null?i:h,C=await((l=this.fetch)!=null?l:globalThis.fetch)(x,{method:"POST",headers:{"Content-Type":"application/json",...w},body:JSON.stringify(N),credentials:T,signal:e});if(!C.ok)throw new Error((u=await C.text())!=null?u:"Failed to fetch the chat response.");if(!C.body)throw new Error("The response body is empty.");return this.processResponseStream(C.body)}async reconnectToStream(e){var t,s,r,i,l;const u=await Ba(this.body),f=await Ba(this.headers),m=await Ba(this.credentials),h={...Mi(f),...Mi(e.headers)},y=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...u,...e.body},headers:h,credentials:m,requestMetadata:e.metadata})),v=(s=y?.api)!=null?s:`${this.api}/${e.chatId}/stream`,x=y?.headers!==void 0?Mi(y.headers):h,w=(r=y?.credentials)!=null?r:m,T=await((i=this.fetch)!=null?i:globalThis.fetch)(v,{method:"GET",headers:x,credentials:w});if(T.status===204)return null;if(!T.ok)throw new Error((l=await T.text())!=null?l:"Failed to fetch the chat response.");if(!T.body)throw new Error("The response body is empty.");return this.processResponseStream(T.body)}},bC=class extends yU{constructor(e={}){super(e)}processResponseStream(e){return B$({stream:e,schema:uU}).pipeThrough(new TransformStream({async transform(t,s){if(!t.success)throw t.error;s.enqueue(t.value)}}))}},vU=class{constructor({generateId:e=F9,id:t=e(),transport:s=new bC,messageMetadataSchema:r,dataPartSchemas:i,state:l,onError:u,onToolCall:f,onFinish:m,onData:h,sendAutomaticallyWhen:y}){this.activeResponse=void 0,this.jobExecutor=new mU,this.sendMessage=async(v,x)=>{var w,N,T,R;if(v==null){await this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...x});return}let C;if("text"in v||"files"in v?C={parts:[...Array.isArray(v.files)?v.files:await gU(v.files),..."text"in v&&v.text!=null?[{type:"text",text:v.text}]:[]]}:C=v,v.messageId!=null){const j=this.state.messages.findIndex(E=>E.id===v.messageId);if(j===-1)throw new Error(`message with id ${v.messageId} not found`);if(this.state.messages[j].role!=="user")throw new Error(`message with id ${v.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,j+1),this.state.replaceMessage(j,{...C,id:v.messageId,role:(N=C.role)!=null?N:"user",metadata:v.metadata})}else this.state.pushMessage({...C,id:(T=C.id)!=null?T:this.generateId(),role:(R=C.role)!=null?R:"user",metadata:v.metadata});await this.makeRequest({trigger:"submit-message",messageId:v.messageId,...x})},this.regenerate=async({messageId:v,...x}={})=>{const w=v==null?this.state.messages.length-1:this.state.messages.findIndex(N=>N.id===v);if(w===-1)throw new Error(`message ${v} not found`);this.state.messages=this.state.messages.slice(0,this.messages[w].role==="assistant"?w:w+1),await this.makeRequest({trigger:"regenerate-message",messageId:v,...x})},this.resumeStream=async(v={})=>{await this.makeRequest({trigger:"resume-stream",...v})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:v,approved:x,reason:w,options:N})=>this.jobExecutor.run(async()=>{const T=this.state.messages,R=T[T.length-1],C=j=>Zr(j)&&j.state==="approval-requested"&&j.approval.id===v?{...j,state:"approval-responded",approval:{id:v,approved:x,reason:w}}:j;this.state.replaceMessage(T.length-1,{...R,parts:R.parts.map(C)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(C)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(j=>{var E;j&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id,...N})})}),this.addToolOutput=async({state:v="output-available",toolCallId:x,output:w,errorText:N,options:T})=>this.jobExecutor.run(async()=>{const R=this.state.messages,C=R[R.length-1],j=E=>Zr(E)&&E.toolCallId===x?{...E,state:v,output:w,errorText:N}:E;this.state.replaceMessage(R.length-1,{...C,parts:C.parts.map(j)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(j)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(E=>{var _;E&&this.makeRequest({trigger:"submit-message",messageId:(_=this.lastMessage)==null?void 0:_.id,...T})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var v;this.status!=="streaming"&&this.status!=="submitted"||(v=this.activeResponse)!=null&&v.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=s,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=l,this.onError=u,this.onToolCall=f,this.onFinish=m,this.onData=h,this.sendAutomaticallyWhen=y}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:s,body:r,messageId:i}){var l,u,f;let m;if(e==="resume-stream")try{const w=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:s,body:r});if(w==null)return;m=w}catch(w){this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w});return}this.setStatus({status:"submitted",error:void 0});const h=this.lastMessage;let y=!1,v=!1,x=!1;try{const w={state:fU({lastMessage:this.state.snapshot(h),messageId:this.generateId()}),abortController:new AbortController};w.abortController.signal.addEventListener("abort",()=>{y=!0}),this.activeResponse=w;let N;e==="resume-stream"?N=m:N=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:w.abortController.signal,metadata:t,headers:s,body:r,trigger:e,messageId:i});const T=R=>this.jobExecutor.run(()=>R({state:w.state,write:()=>{var C;this.setStatus({status:"streaming"}),w.state.message.id===((C=this.lastMessage)==null?void 0:C.id)?this.state.replaceMessage(this.state.messages.length-1,w.state.message):this.state.pushMessage(w.state.message)}}));await pU({stream:hU({stream:N,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:T,onError:R=>{throw R}}),onError:R=>{throw R}}),this.setStatus({status:"ready"})}catch(w){if(y||w.name==="AbortError")return y=!0,this.setStatus({status:"ready"}),null;x=!0,w instanceof TypeError&&(w.message.toLowerCase().includes("fetch")||w.message.toLowerCase().includes("network"))&&(v=!0),this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w})}finally{try{(u=this.onFinish)==null||u.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:y,isDisconnect:v,isError:x,finishReason:(l=this.activeResponse)==null?void 0:l.state.finishReason})}catch(w){console.error(w)}this.activeResponse=void 0}!x&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,metadata:t,headers:s,body:r})}};function bU({chat:e,placeholder:t="Ask AI...",inputExtras:s,inputStatus:r,inputValue:i,onInputChange:l}){const{messages:u,sendMessage:f,stop:m,status:h,clearChat:y,error:v,attachments:x,activeAttachments:w,toggleAttachment:N}=e,[T,R]=b.useState(""),C=i!==void 0,j=C?i:T,E=F=>{C?l?.(F):R(F)},_=b.useRef(null),A=b.useRef(null),M=h==="streaming"||h==="submitted",O=x.length>0;b.useEffect(()=>{const F=_.current;F&&(F.scrollTop=F.scrollHeight)},[u]),b.useEffect(()=>{A.current?.focus()},[]);const I=F=>{F.preventDefault();const B=j.trim();!B||M||(E(""),f({text:B}))},Y=F=>{F.stopPropagation(),F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),I(F))};return d.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[d.jsxs("div",{ref:_,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[u.length===0&&d.jsx("div",{className:"text-neutral-500 text-center py-8 select-none",children:t}),u.map(F=>d.jsx("div",{className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:d.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${F.role==="user"?"bg-emerald-500/10 text-emerald-100 border border-emerald-500/20":"bg-neutral-800/50 text-neutral-200 border border-neutral-700/50"}`,children:(F.parts??[]).map((B,P)=>{if(!B)return null;if(B.type==="text")return d.jsx("span",{children:B.text},P);if(Zr(B)){const X=vC(B),ie=Object.entries(B.input??{}).map(([ee,z])=>`${ee}: ${JSON.stringify(z)}`).join(", ");return d.jsxs("div",{className:"text-[11px] text-cyan-400/70 mt-1 font-mono",children:[d.jsx("span",{className:"text-neutral-500",children:"↳ "}),X,"(",ie,")"]},P)}return null})})},F.id)),M&&u[u.length-1]?.role!=="assistant"&&d.jsx("div",{className:"flex justify-start",children:d.jsx("div",{className:"bg-neutral-800/50 border border-neutral-700/50 rounded-lg px-3 py-2 text-neutral-400",children:d.jsx("span",{className:"animate-pulse",children:"..."})})})]}),v&&d.jsxs("div",{className:"px-3 py-2 bg-red-900/20 border-t border-red-500/30 text-red-400 text-[11px] flex items-center gap-2",children:[d.jsx(x2,{size:12}),d.jsx("span",{className:"truncate",children:v.message||"An error occurred"})]}),d.jsxs("div",{className:"px-3 py-2.5 border-t border-neutral-700/50 bg-neutral-900/50",children:[O&&d.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[d.jsx(H2,{size:11,className:"text-neutral-500 shrink-0"}),x.map(F=>{const B=w.has(F.label);return d.jsx("button",{type:"button",onClick:()=>N(F.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${B?"bg-cyan-500/15 text-cyan-300 border-cyan-500/40":"text-neutral-500 border-neutral-700 hover:text-neutral-300 hover:border-neutral-600"}`,children:F.label},F.label)}),w.size>0&&d.jsx("span",{className:"text-[10px] text-neutral-600 ml-1",children:"attached"})]}),d.jsxs("form",{onSubmit:I,className:"flex items-center gap-2 rounded-lg border border-neutral-700 bg-neutral-800/60 px-3 py-2 focus-within:border-emerald-500/40 transition-colors",children:[u.length>0&&d.jsx("button",{type:"button",onClick:()=>y(),className:"p-1 rounded text-neutral-500 hover:text-neutral-300 hover:bg-neutral-700 transition-colors",title:"Clear",children:d.jsx(J2,{size:12})}),d.jsx("input",{ref:A,type:"text",value:j,onChange:F=>E(F.target.value),onKeyDown:Y,placeholder:t,className:"flex-1 bg-transparent outline-none text-neutral-100 placeholder:text-neutral-500 caret-emerald-400",disabled:M}),M?d.jsx("button",{type:"button",onClick:()=>m(),className:"p-1.5 rounded text-amber-400 hover:bg-amber-900/20 transition-colors",title:"Stop",children:d.jsx(BS,{size:12})}):d.jsx("button",{type:"submit",disabled:!j.trim(),className:"text-[11px] px-2 py-1 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/20 disabled:opacity-30 disabled:cursor-default transition-colors",children:"Send"})]})]})]})}const xU="modulepreload",wU=function(e){return"/"+e},uS={},Xu=function(t,s,r){let i=Promise.resolve();if(s&&s.length>0){let m=function(h){return Promise.all(h.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");i=m(s.map(h=>{if(h=wU(h),h in uS)return;uS[h]=!0;const y=h.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":xU,y||(x.as="script"),x.crossOrigin="",x.href=h,f&&x.setAttribute("nonce",f),document.head.appendChild(x),y)return new Promise((w,N)=>{x.addEventListener("load",w),x.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return i.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},SU={background:"#1a1a1a",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#1a1a1a",selectionBackground:"#3e4451",selectionForeground:"#abb2bf",black:"#1a1a1a",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"},EU=`
95
- .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
96
- .xterm.focus, .xterm:focus { outline: none; }
97
- .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
98
- .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
99
- .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
100
- .xterm .composition-view.active { display: block; }
101
- .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
102
- .xterm .xterm-screen { position: relative; }
103
- .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
104
- .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
105
- .xterm.enable-mouse-events { cursor: default; }
106
- .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
107
- .xterm.column-select.focus { cursor: crosshair; }
108
- .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
109
- .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
110
- .xterm .xterm-accessibility-tree { font-family: monospace; user-select: text; white-space: pre; }
111
- .xterm .xterm-accessibility-tree > div { transform-origin: left; width: fit-content; }
112
- .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
113
- .xterm-dim { opacity: 1 !important; }
114
- .xterm-underline-1 { text-decoration: underline; }
115
- .xterm-underline-2 { text-decoration: double underline; }
116
- .xterm-underline-3 { text-decoration: wavy underline; }
117
- .xterm-underline-4 { text-decoration: dotted underline; }
118
- .xterm-underline-5 { text-decoration: dashed underline; }
119
- .xterm-overline { text-decoration: overline; }
120
- .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
121
- .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
122
- .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
123
- .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
124
- .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
125
- .xterm-strikethrough { text-decoration: line-through; }
126
- .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
127
- .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
128
- .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
129
- .xterm-decoration-top { z-index: 2; position: relative; }
130
- .xterm .xterm-scrollable-element > .scrollbar { cursor: default; }
131
- .xterm .xterm-scrollable-element > .scrollbar > .scra { cursor: pointer; font-size: 11px !important; }
132
- .xterm .xterm-scrollable-element > .visible { opacity: 1; background: rgba(0,0,0,0); transition: opacity 100ms linear; z-index: 11; }
133
- .xterm .xterm-scrollable-element > .invisible { opacity: 0; pointer-events: none; }
134
- .xterm .xterm-scrollable-element > .invisible.fade { transition: opacity 800ms linear; }
135
- .xterm .xterm-scrollable-element > .shadow { position: absolute; display: none; }
136
- .xterm .xterm-scrollable-element > .shadow.top { display: block; top: 0; left: 3px; height: 3px; width: 100%; }
137
- .xterm .xterm-scrollable-element > .shadow.left { display: block; top: 3px; left: 0; height: 100%; width: 3px; }
138
- `;function NU(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const e=document.createElement("style");e.setAttribute("data-xterm-css",""),e.textContent=EU,document.head.appendChild(e)}function TU(e){return new Promise((t,s)=>{const r=new FileReader;r.onload=()=>{const i=r.result;t(i.split(",")[1])},r.onerror=s,r.readAsDataURL(e)})}function jU({relay:e,fontSize:t=12,fontFamily:s="'JetBrains Mono', 'Hack Nerd Font', monospace",configItems:r,onOpenSettings:i,onStartService:l}){const{status:u,error:f,exitCode:m,cwd:h,setCwd:y,sendInput:v,resize:x,onData:w,connect:N,disconnect:T}=e,[R,C]=b.useState(!1),{apiBaseUrl:j}=Hd(),E=b.useRef(null),_=b.useRef(null),A=b.useRef(null),M=b.useRef(null),[O,I]=b.useState(!1),[Y,F]=b.useState(!1),B=b.useRef(0);b.useEffect(()=>{const $=E.current;if(!$)return;const J=re=>{re.key===" "&&!re.metaKey&&!re.ctrlKey&&!re.altKey&&re.stopPropagation()};return $.addEventListener("keydown",J),()=>$.removeEventListener("keydown",J)},[]);const P=`${j}/api/relay/upload`,X=b.useCallback(async $=>{try{const J=await TU($),re=await fetch(P,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$.name,data:J})}),{path:se}=await re.json();return se||null}catch(J){return console.error("File upload failed:",J),null}},[P]);b.useEffect(()=>{const $=E.current;if(!$)return;const J=async re=>{if(!re.clipboardData)return;const se=Array.from(re.clipboardData.items).filter(ge=>ge.type.startsWith("image/"));if(se.length!==0){re.preventDefault(),re.stopPropagation();for(const ge of se){const he=ge.getAsFile();if(!he)continue;const pe=await X(he);pe&&v(pe)}}};return $.addEventListener("paste",J),()=>$.removeEventListener("paste",J)},[v,X]);const ie=b.useCallback($=>{$.preventDefault(),$.dataTransfer.dropEffect="copy"},[]),ee=b.useCallback($=>{$.preventDefault(),B.current++,$.dataTransfer.types.includes("Files")&&F(!0)},[]),z=b.useCallback($=>{$.preventDefault(),B.current--,B.current===0&&F(!1)},[]),H=b.useCallback(async $=>{$.preventDefault(),B.current=0,F(!1);const J=Array.from($.dataTransfer.files).filter(re=>re.type.startsWith("image/"));if(J.length!==0)for(const re of J){const se=await X(re);se&&v(se)}},[v,X]);b.useEffect(()=>{let $=!1,J=null;async function re(){const[{Terminal:se},{FitAddon:ge},he]=await Promise.all([Xu(()=>import("./xterm-B-qIQCd3.js"),[]),Xu(()=>import("./addon-fit-DX4qG4td.js"),[]),Xu(()=>import("./addon-webgl-DCtw1yLn.js"),[]).catch(()=>null)]);if(NU(),$||!_.current)return;J=new se({fontSize:t,fontFamily:s,theme:SU,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:5e3,convertEol:!1,allowProposedApi:!0});const pe=new ge;if(J.loadAddon(pe),J.open(_.current),he)try{const be=new he.WebglAddon;be.onContextLoss(()=>{be.dispose()}),J.loadAddon(be)}catch{}try{pe.fit()}catch{}A.current=J,M.current=pe,x(J.cols,J.rows),J.onData(be=>{v(be)}),I(!0)}return re(),()=>{$=!0,J&&(J.dispose(),A.current=null,M.current=null)}},[]),b.useEffect(()=>{const $=A.current;if($){$.options.fontSize=t,$.options.fontFamily=s;try{M.current?.fit()}catch{}}},[t,s]),b.useEffect(()=>{if(O)return w($=>{A.current?.write($)}),()=>{w(()=>{})}},[O,w]),b.useEffect(()=>{const $=_.current;if(!$||!O)return;const J=new ResizeObserver(()=>{const re=M.current,se=A.current;if(!(!re||!se))try{re.fit(),x(se.cols,se.rows)}catch{}});return J.observe($),()=>J.disconnect()},[O,x]),b.useEffect(()=>{u==="connected"&&A.current&&A.current.focus()},[u]);const U=b.useCallback(()=>{u==="connected"&&A.current&&A.current.focus()},[u]),ne=u==="error"&&f==="Relay service is not running",G=b.useCallback(async()=>{if(l){C(!0);try{await l()&&setTimeout(()=>N(),500)}finally{C(!1)}}},[l,N]);let D=null;return ne?D=d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:d.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Relay service not running"}),d.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:l?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[l&&d.jsx("button",{type:"button",onClick:G,disabled:R,className:"text-[11px] px-4 py-1.5 rounded-full border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 transition-colors font-medium disabled:opacity-50",children:R?"Starting...":"Start Service"}),d.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Retry"}),i&&d.jsx("button",{type:"button",onClick:i,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):u==="error"&&f?D=d.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:d.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),d.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),d.jsx("code",{className:"text-[11px] text-neutral-400 bg-neutral-800/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:f}),m!==null&&m!==0&&d.jsxs("span",{className:"text-[10px] text-neutral-600",children:["Exit code ",m]}),d.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):u==="disconnected"?D=d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-neutral-800 border border-neutral-700 flex items-center justify-center",children:d.jsx("span",{className:"text-neutral-500 text-[14px]",children:"▷"})}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Terminal relay disconnected"}),d.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:"Set working directory and connect."})]}),d.jsxs("form",{className:"w-full",onSubmit:$=>{$.preventDefault(),N()},children:[d.jsx("label",{className:"text-[10px] font-mono text-neutral-500 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),d.jsx("input",{type:"text",value:h,onChange:$=>y($.target.value),placeholder:"~/dev/my-project",className:"w-full bg-neutral-800/80 border border-neutral-700/50 rounded px-3 py-1.5 text-[11px] font-mono text-neutral-200 placeholder:text-neutral-600 outline-none focus:border-cyan-500/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),r&&r.length>0&&d.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-neutral-800/60 border border-neutral-700/40 rounded-md px-3 py-2",children:r.map($=>d.jsxs("div",{className:"contents",children:[d.jsx("span",{className:"text-neutral-500",children:$.label}),d.jsx("span",{className:"text-neutral-400 truncate text-left",children:$.value})]},$.label))}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),i&&d.jsx("button",{type:"button",onClick:i,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):u==="connecting"&&(D=d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[d.jsx("div",{className:"w-6 h-6 border-2 border-neutral-600 border-t-cyan-400 rounded-full animate-spin"}),d.jsx("span",{className:"text-[12px] text-neutral-400",children:"Connecting to relay..."}),d.jsx("button",{type:"button",onClick:()=>{T()},className:"text-[10px] px-3 py-1 rounded-full border border-neutral-700 text-neutral-500 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Cancel"})]})),d.jsxs("div",{ref:E,className:"relative flex flex-col h-full overflow-hidden",onClick:U,onDragOver:ie,onDragEnter:ee,onDragLeave:z,onDrop:H,children:[D&&d.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-neutral-900/90",children:D}),Y&&d.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:d.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),d.jsx("div",{ref:_,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:D?"hidden":"visible",padding:"4px 8px"}})]})}function CU(e={}){const{url:t="ws://localhost:3600",systemPrompt:s,cwd:r,workspaceFiles:i,autoConnect:l=!1,sessionKey:u,orphanTTL:f,backend:m,tmuxSession:h,agent:y,provider:v,model:x}=e,w=u?`hudson.relay.${u}`:null,N=()=>{if(!w)return null;try{return localStorage.getItem(w)}catch{return null}},T=he=>{if(w)try{he?localStorage.setItem(w,he):localStorage.removeItem(w)}catch{}},[R,C]=b.useState("disconnected"),[j,E]=b.useState(null),[_,A]=b.useState(null),[M,O]=b.useState(null),[I,Y]=b.useState(r||"~"),F=b.useRef(null),B=b.useRef(null),P=b.useRef({cols:80,rows:24}),X=b.useRef(!1),ie=b.useRef(I);ie.current=I;const ee=b.useRef(N()),z=b.useRef(null),H=b.useCallback(he=>{const pe=F.current;pe&&pe.readyState===WebSocket.OPEN&&pe.send(JSON.stringify(he))},[]),U=b.useCallback(()=>{B.current&&(clearTimeout(B.current),B.current=null);const he=F.current;he&&(he.close(),F.current=null),X.current=!1,C("disconnected")},[]),ne=b.useCallback(()=>{const he=ie.current;return{type:"session:init",cols:P.current.cols,rows:P.current.rows,...s?{systemPrompt:s}:{},...he?{cwd:he}:{},...i?{workspaceFiles:i}:{},...f?{orphanTTL:f}:{},...m?{backend:m}:{},...h?{tmuxSession:h}:{},...y?{agent:y}:{},...v?{provider:v}:{},...x?{model:x}:{}}},[s,i,f,m,h,y,v,x]),G=b.useCallback(()=>{X.current||(X.current=!0,ee.current?H({type:"session:reconnect",sessionId:ee.current,cols:P.current.cols,rows:P.current.rows}):H(ne()))},[H,ne]),D=b.useCallback(async()=>{F.current&&(F.current.close(),F.current=null),X.current=!1,C("connecting"),A(null),O(null);const he=t.replace(/^ws(s?):\/\//,"http$1://");try{await fetch(`${he}/health`,{signal:AbortSignal.timeout(2e3)})}catch{C("error"),A("Relay service is not running");return}const pe=new WebSocket(t);F.current=pe,pe.onopen=()=>{G()},pe.onmessage=be=>{try{const Ce=JSON.parse(be.data);switch(Ce.type){case"session:ready":ee.current=Ce.sessionId,T(Ce.sessionId),E(Ce.sessionId),C("connected"),A(null),O(null);break;case"session:expired":{ee.current=null,T(null),X.current=!1,z.current&&z.current("\x1B[2J\x1B[H"),H(ne()),X.current=!0;break}case"session:error":C("error"),A(Ce.error||"Session failed to start");break;case"terminal:data":z.current&&Ce.data&&z.current(Ce.data);break;case"session:exit":ee.current=null,T(null),E(null),O(Ce.exitCode??null),Ce.exitCode!==0?(C("error"),A(Ce.reason||`Process exited with code ${Ce.exitCode}`)):C("disconnected");break;case"session:detached":ee.current=null,T(null),E(null);break}}catch{}},pe.onclose=()=>{F.current=null,X.current=!1,C(be=>be==="error"?be:"disconnected")},pe.onerror=()=>{C("error"),A("Could not connect to relay")}},[t,G,H,s,i]),$=b.useCallback(he=>{H({type:"terminal:input",data:he})},[H]),J=b.useCallback(he=>{H({type:"terminal:input",data:he+"\r"})},[H]),re=b.useCallback((he,pe)=>{P.current={cols:he,rows:pe},X.current&&H({type:"terminal:resize",cols:he,rows:pe})},[H]),se=b.useCallback(he=>{z.current=he},[]);b.useEffect(()=>(l&&D(),()=>{U()}),[]);const ge=b.useCallback(()=>{if(U(),ee.current=null,E(null),u)try{sessionStorage.removeItem(`hudson.relay.${u}`)}catch{}A(null),O(null),setTimeout(()=>D(),200)},[U,D,u]);return{status:R,sessionId:j,error:_,exitCode:M,cwd:I,setCwd:Y,onData:se,sendInput:$,sendLine:J,resize:re,connect:D,disconnect:U,restart:ge}}var Gp,dS;function AU(){if(dS)return Gp;dS=1;function e(t,s){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,i=0;return function(...u){clearTimeout(r);const f=Date.now(),m=f-i,h=s-m;h<=0?(i=f,t.apply(this,u)):r=setTimeout(()=>{i=Date.now(),t.apply(this,u)},h)}}return Gp=e,Gp}var RU=AU();const _U=zS(RU);var xC=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},Et=(e,t,s)=>(xC(e,t,"read from private field"),s?s.call(e):t.get(e)),Ms=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},Va=(e,t,s,r)=>(xC(e,t,"write to private field"),t.set(e,s),s);function kU(e,t){return t!=null?_U(e,t):e}var os,Ku,Wu,gl,yl,vl,Ii,Xm,Km,MU=class{constructor(e=[]){Ms(this,os,void 0),Ms(this,Ku,"ready"),Ms(this,Wu,void 0),Ms(this,gl,new Set),Ms(this,yl,new Set),Ms(this,vl,new Set),this.pushMessage=t=>{Va(this,os,Et(this,os).concat(t)),Et(this,Ii).call(this)},this.popMessage=()=>{Va(this,os,Et(this,os).slice(0,-1)),Et(this,Ii).call(this)},this.replaceMessage=(t,s)=>{Va(this,os,[...Et(this,os).slice(0,t),this.snapshot(s),...Et(this,os).slice(t+1)]),Et(this,Ii).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,s)=>{const r=s?kU(t,s):t;return Et(this,gl).add(r),()=>{Et(this,gl).delete(r)}},this["~registerStatusCallback"]=t=>(Et(this,yl).add(t),()=>{Et(this,yl).delete(t)}),this["~registerErrorCallback"]=t=>(Et(this,vl).add(t),()=>{Et(this,vl).delete(t)}),Ms(this,Ii,()=>{Et(this,gl).forEach(t=>t())}),Ms(this,Xm,()=>{Et(this,yl).forEach(t=>t())}),Ms(this,Km,()=>{Et(this,vl).forEach(t=>t())}),Va(this,os,e)}get status(){return Et(this,Ku)}set status(e){Va(this,Ku,e),Et(this,Xm).call(this)}get error(){return Et(this,Wu)}set error(e){Va(this,Wu,e),Et(this,Km).call(this)}get messages(){return Et(this,os)}set messages(e){Va(this,os,[...e]),Et(this,Ii).call(this)}};os=new WeakMap;Ku=new WeakMap;Wu=new WeakMap;gl=new WeakMap;yl=new WeakMap;vl=new WeakMap;Ii=new WeakMap;Xm=new WeakMap;Km=new WeakMap;var Li,fS=class extends vU{constructor({messages:e,...t}){const s=new MU(e);super({...t,state:s}),Ms(this,Li,void 0),this["~registerMessagesCallback"]=(r,i)=>Et(this,Li)["~registerMessagesCallback"](r,i),this["~registerStatusCallback"]=r=>Et(this,Li)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>Et(this,Li)["~registerErrorCallback"](r),Va(this,Li,s)}};Li=new WeakMap;function OU({experimental_throttle:e,resume:t=!1,...s}={}){const r=b.useRef("chat"in s?{}:{onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});"chat"in s||(r.current={onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});const i={...s,onToolCall:x=>{var w,N;return(N=(w=r.current).onToolCall)==null?void 0:N.call(w,x)},onData:x=>{var w,N;return(N=(w=r.current).onData)==null?void 0:N.call(w,x)},onFinish:x=>{var w,N;return(N=(w=r.current).onFinish)==null?void 0:N.call(w,x)},onError:x=>{var w,N;return(N=(w=r.current).onError)==null?void 0:N.call(w,x)},sendAutomaticallyWhen:x=>{var w,N,T;return(T=(N=(w=r.current).sendAutomaticallyWhen)==null?void 0:N.call(w,x))!=null?T:!1}},l=b.useRef("chat"in s?s.chat:new fS(i));("chat"in s&&s.chat!==l.current||"id"in s&&l.current.id!==s.id)&&(l.current="chat"in s?s.chat:new fS(i));const f=b.useCallback(x=>l.current["~registerMessagesCallback"](x,e),[e,l.current.id]),m=b.useSyncExternalStore(f,()=>l.current.messages,()=>l.current.messages),h=b.useSyncExternalStore(l.current["~registerStatusCallback"],()=>l.current.status,()=>l.current.status),y=b.useSyncExternalStore(l.current["~registerErrorCallback"],()=>l.current.error,()=>l.current.error),v=b.useCallback(x=>{typeof x=="function"&&(x=x(l.current.messages)),l.current.messages=x},[l]);return b.useEffect(()=>{t&&l.current.resumeStream()},[t,l]),{id:l.current.id,messages:m,setMessages:v,sendMessage:l.current.sendMessage,regenerate:l.current.regenerate,clearError:l.current.clearError,stop:l.current.stop,error:y,resumeStream:l.current.resumeStream,status:h,addToolResult:l.current.addToolOutput,addToolOutput:l.current.addToolOutput,addToolApprovalResponse:l.current.addToolApprovalResponse}}function DU(e){try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}}function zU(e,t){try{localStorage.setItem(e,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("hudson:saved",{detail:{key:e}}))}catch{}}const IU=()=>()=>{},LU=()=>!0,PU=()=>!1;function $U(){return b.useSyncExternalStore(IU,LU,PU)}function ua(e,t){const s=$U(),[r,i]=b.useState(t),l=b.useRef(!1);if(s&&!l.current){l.current=!0;const u=DU(e);u!==void 0&&i(u)}return b.useEffect(()=>{s&&zU(e,r)},[e,r,s]),[r,i]}function UU(e){const t={};for(const s of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(s.label)){const r=s.content();r!==null&&(t[s.label.toLowerCase()]=r)}return{toolset:e.toolsetRef.current,context:{...e.contextRef.current,...t},mode:e.modeRef.current,sessionId:e.sessionIdRef.current,provider:e.providerRef.current,model:e.modelRef.current}}function VU(e,t){e.current?.(t)}function BU(e,t){e.current?.(t)}function ZU(e){const t=new Set;for(const s of e??[])if(s.role==="assistant")for(const r of s.parts??[])r&&Zr(r)&&t.add(r.toolCallId);return t}function HU({toolset:e,chatId:t,initialMessages:s,context:r,onToolCall:i,mode:l,attachments:u,provider:f,model:m,sessionId:h,onSessionIdChange:y,onFinish:v,onError:x}){const w=b.useRef(i),N=b.useRef(v),T=b.useRef(x),R=b.useRef(h??crypto.randomUUID()),[C,j]=b.useState(new Set),E=b.useCallback(U=>{j(ne=>{const G=new Set(ne);return G.has(U)?G.delete(U):G.add(U),G})},[]),[_]=ua("hudson.settings",{}),A=l??_.aiMode??"api",M=b.useRef(C),O=b.useRef(u),I=b.useRef(r),Y=b.useRef(e),F=b.useRef(A),B=b.useRef(f),P=b.useRef(m);b.useEffect(()=>{w.current=i},[i]),b.useEffect(()=>{N.current=v},[v]),b.useEffect(()=>{T.current=x},[x]),b.useEffect(()=>{h&&h!==R.current&&(R.current=h)},[h]),b.useEffect(()=>{y?.(R.current)},[y]),b.useEffect(()=>{M.current=C},[C]),b.useEffect(()=>{O.current=u},[u]),b.useEffect(()=>{I.current=r},[r]),b.useEffect(()=>{Y.current=e},[e]),b.useEffect(()=>{F.current=A},[A]),b.useEffect(()=>{B.current=f},[f]),b.useEffect(()=>{P.current=m},[m]);const X=b.useMemo(()=>new bC({api:"/api/ai/chat",body:()=>UU({activeAttachmentsRef:M,attachmentsRef:O,contextRef:I,toolsetRef:Y,modeRef:F,sessionIdRef:R,providerRef:B,modelRef:P})}),[]),ie=OU({id:t,messages:s,transport:X,onFinish:U=>VU(N,U),onError:U=>BU(T,U)}),ee=b.useRef(ZU(s)),z=b.useCallback(()=>{const U=crypto.randomUUID();R.current=U,y?.(U),ee.current.clear(),ie.setMessages([])},[ie,y]),{messages:H}=ie;return b.useEffect(()=>{if(w.current){for(const U of H)if(U.role==="assistant"){for(const ne of U.parts??[])if(ne&&Zr(ne)){if("state"in ne&&ne.state==="input-streaming")continue;const G=ne.toolCallId;if(!ee.current.has(G)){ee.current.add(G);const D=vC(ne);w.current?.(D,ne.input??{})}}}}},[H]),{messages:H,sendMessage:ie.sendMessage,stop:ie.stop,status:ie.status,setMessages:ie.setMessages,clearChat:z,error:ie.error,mode:A,attachments:u??[],activeAttachments:C,toggleAttachment:E}}function FU({app:e,commands:t,state:s,provider:r,model:i,onFinish:l}){const u=b.useMemo(()=>(e.intents??[]).map(h=>({commandId:h.commandId,title:h.title,description:h.description,category:h.category,keywords:h.keywords,shortcut:h.shortcut,dangerous:h.dangerous,params:h.params?.map(y=>({name:y.name,description:y.description,type:y.type,optional:y.optional,enum:y.enum}))})),[e.intents]),f=b.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:u,state:s}),[e.id,e.name,e.description,u,s]),m=b.useCallback(h=>{const y=t.find(v=>v.id===h);if(!y){console.warn(`[useAssistant] no command for id "${h}"`);return}y.action()},[t]);return HU({toolset:"intents",context:f,provider:r,model:i,onFinish:l,onToolCall:(h,y)=>{if(h!=="dispatch")return;const v=y.commandId;typeof v=="string"&&m(v)}})}function qU({app:e,commands:t,state:s,relayUrl:r="ws://localhost:3600",cwd:i,agent:l="pi",provider:u,model:f,backend:m="pty",tmuxSession:h,workspaceFiles:y,onOpenSettings:v,onStartService:x,voiceKit:w}){const[N,T]=ua(`assistant.${e.id}.mode`,"relay"),[R,C]=b.useState(""),[j,E]=ua(`assistant.${e.id}.voice.speakReplies`,w?.settings.speakReplies??!1),{serviceApiUrl:_}=Hd(),A=b.useMemo(()=>GU(e),[e]),M=CU({url:r,systemPrompt:A,cwd:i,workspaceFiles:y,sessionKey:`assistant-${e.id}`,backend:m,tmuxSession:h,agent:l,provider:l==="pi"?u:void 0,model:l==="pi"?f:void 0}),O=b.useCallback(async()=>{if(x)return x();try{return(await(await fetch(`${_}/api/services/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:"relay",action:"start",triggeredBy:"assistant"})})).json()).success===!0}catch{return!1}},[x,_]),I=b.useMemo(()=>{const U=[{label:"Relay",value:r},{label:"Agent",value:l}];return i&&U.push({label:"CWD",value:i}),l==="pi"&&f&&U.push({label:"Model",value:f}),U},[r,l,i,f]),[Y,F]=b.useState("text"),B=FU({app:e,commands:t,state:s,provider:u,model:f,onFinish:({message:U,isAbort:ne,isDisconnect:G,isError:D})=>{!w||!j||ne||G||D||U.role==="assistant"&&w.speakReply(U,{surface:"hudson-assistant",appId:e.id,source:Y})}}),P=b.useCallback(U=>{if(!w)return;const ne=[R.trim(),U].filter(Boolean).join(" ");w.settings.autoSend&&B.status!=="streaming"&&B.status!=="submitted"?(C(""),F("voice"),B.sendMessage({text:ne})):C(ne)},[w,R,B]),X=b.useCallback(()=>{w&&(w.input.status==="recording"?w.input.stop():w.input.start(P))},[w,P]),ie=e.intents?.length??0,ee=!!w,z=w?.input.status==="transcribing",H=w?.input.status==="recording";return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-neutral-700/50 bg-neutral-900/50",children:[d.jsx(VS,{size:11,className:"text-cyan-400/60"}),d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-neutral-500",children:"Assistant"}),d.jsxs("span",{className:"text-[10px] font-mono text-neutral-600",children:["· ",e.name]}),d.jsx("div",{className:"flex-1"}),ee&&N==="chat"&&d.jsx("button",{type:"button",onClick:()=>{j&&w?.output.stop(),E(!j)},className:`p-1 rounded transition-colors ${j?"text-cyan-300 hover:text-cyan-200":"text-neutral-500 hover:text-neutral-300"}`,title:j?"Speaker on (click to mute)":"Speaker off (click to enable)",children:w?.output.isPlaying?d.jsx(vx,{size:12,className:"animate-spin"}):j?d.jsx(e_,{size:12}):d.jsx(n_,{size:12})}),d.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-neutral-700 p-0.5",children:[d.jsx(pS,{active:N==="relay",onClick:()=>T("relay"),children:"Relay"}),d.jsx(pS,{active:N==="chat",onClick:()=>T("chat"),children:"Chat"})]}),N==="relay"&&M.status==="connected"&&d.jsx("button",{type:"button",onClick:()=>M.restart(),className:"text-[10px] px-2 py-0.5 rounded-full border text-cyan-400 border-cyan-500/30 hover:bg-cyan-500/10 transition-colors",title:"Kill session and start fresh",children:"Restart"}),N==="relay"&&M.status==="connected"&&d.jsx("button",{type:"button",onClick:()=>M.disconnect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-red-400 border-red-500/30 hover:bg-red-500/10 transition-colors",children:"Disconnect"}),N==="relay"&&M.status!=="connected"&&M.status!=="connecting"&&d.jsx("button",{type:"button",onClick:()=>M.connect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10 transition-colors",children:"Connect"})]}),d.jsx("div",{className:"flex-1 min-h-0",children:N==="relay"?d.jsx(jU,{relay:M,configItems:I,onOpenSettings:v,onStartService:O}):d.jsx(bU,{chat:B,placeholder:ie===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${ie} intent${ie===1?"":"s"})`,inputValue:R,onInputChange:U=>{Y==="voice"&&U.length===0&&F("text"),C(U)},inputExtras:ee&&w?.input.isSupported?d.jsx("button",{type:"button",onClick:X,disabled:z,className:`p-1 rounded transition-colors disabled:opacity-30 ${H?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-neutral-500 hover:text-cyan-400"}`,title:H?"Stop recording":"Record voice prompt",children:z?d.jsx(vx,{size:12,className:"animate-spin"}):H?d.jsx(BS,{size:11}):d.jsx(_2,{size:12})}):void 0,inputStatus:ee&&w?d.jsx(YU,{inputStatus:w.input.status,inputError:w.input.error,outputStatus:w.output.status,outputError:w.output.error}):void 0})})]})}function YU({inputStatus:e,inputError:t,outputStatus:s,outputError:r}){const i=hS(e)??hS(s),l=t??r;return!i&&!l?null:d.jsxs("div",{className:"flex items-center gap-2",children:[i&&d.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${i.className}`,children:i.label}),l&&d.jsx("span",{className:"text-[10px] text-neutral-500 truncate flex-1",title:l,children:l})]})}function hS(e){switch(e){case"recording":return{label:"listening",className:"border-red-500/20 bg-red-500/10 text-red-300"};case"transcribing":return{label:"transcribing",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"ready":return{label:"draft ready",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"synthesizing":return{label:"voicing",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"speaking":return{label:"speaking",className:"border-emerald-500/20 bg-emerald-500/10 text-emerald-300"};case"unavailable":return{label:"voice offline",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"error":return{label:"voice error",className:"border-red-500/20 bg-red-500/10 text-red-300"};default:return null}}function pS({active:e,onClick:t,children:s}){return d.jsx("button",{type:"button",onClick:t,className:`text-[10px] px-2 py-0.5 rounded-full transition-colors ${e?"bg-cyan-500/15 text-cyan-300":"text-neutral-500 hover:text-neutral-300"}`,children:s})}function GU(e){const t=[`You are working alongside the user inside the **${e.name}** Hudson app.`];e.description&&t.push(e.description);const s=e.intents??[];if(s.length>0){t.push("","## What this app can do (for context)");for(const r of s)t.push(`- ${r.title} — ${r.description}`);t.push("","These actions live inside the running app. You can describe them to the user, but you do not invoke them yourself — the user can trigger any of them via the command palette (Cmd+K).")}return t.push("","## How to behave","- Be terse. The user is in a terminal; respect their attention.","- Use your own tools (file ops, shell, etc.) freely if it helps.","- When asked to change something inside the app itself, prefer guiding the user to the matching command rather than hacking around it."),t.join(`
139
- `)}function XU({app:e,assistant:t=!0}){return d.jsx(e.Provider,{children:d.jsx(KU,{app:e,assistantEnabled:t})})}function KU({app:e,assistantEnabled:t}){const{navTotalHeight:s}=ey(),r=e.hooks.useCommands(),i=e.hooks.useStatus(),l=e.hooks.useSearch?.()??null,u=e.hooks.useNavCenter?.()??null,f=e.hooks.useNavActions?.()??null,m=e.hooks.useLayoutMode?.()??e.mode,h=e.hooks.useActiveToolHint?.()??null,y=e.hooks.useTakeover?.()??null,v=y?.active===!0,x=v&&y?.dismissible===!0,w=y?.onDismiss,N=e.slots.Takeover,[T,R]=ua(`appshell.${e.id}.left`,!1),[C,j]=ua(`appshell.${e.id}.right`,!1),[E,_]=ua(`appshell.${e.id}.leftW`,260),[A,M]=ua(`appshell.${e.id}.rightW`,280),[O,I]=b.useState({x:0,y:0}),[Y,F]=b.useState(1),B=b.useCallback(Z=>{I(te=>({x:te.x+Z.x,y:te.y+Z.y}))},[]),P=b.useCallback(Z=>{F(Z)},[]),[X,ie]=b.useState(!1),[ee,z]=b.useState(!1),[H,U]=ua(`appshell.${e.id}.termH`,320),ne=!!e.slots.Terminal,G=b.useMemo(()=>{const Z=[];return ne&&Z.push("terminal"),t&&Z.push("assistant"),Z},[ne,t]),D=G[0]??"terminal",[$,J]=ua(`appshell.${e.id}.drawerTab`,D),re=G.includes($)?$:D,[se,ge]=b.useState(!1),[he,pe]=b.useState(new Set),be=b.useCallback(Z=>{pe(te=>{const de=new Set(te);return de.has(Z)?de.delete(Z):de.add(Z),de})},[]),Ce=b.useCallback(Z=>te=>{te.preventDefault();const de=te.clientX,me=Z==="left"?E:A,ye=Z==="left"?_:M,Ae=Z==="left"?1:-1,Ie=tt=>{const Ot=(tt.clientX-de)*Ae;ye(Math.max(200,Math.min(500,me+Ot)))},Me=()=>{document.removeEventListener("mousemove",Ie),document.removeEventListener("mouseup",Me)};document.addEventListener("mousemove",Ie),document.addEventListener("mouseup",Me)},[E,A,_,M]),fe=b.useMemo(()=>{const Z=[{id:"shell:toggle-left",label:"Toggle Left Panel",shortcut:"Cmd+[",action:()=>R(te=>!te)},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>j(te=>!te)},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>ie(te=>!te)}];return t&&Z.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{J("assistant"),ie(te=>!te||$!=="assistant")}}),Z},[R,j,t,$,J]),Re=b.useMemo(()=>[...r,...fe],[r,fe]);b.useEffect(()=>{const Z=te=>{v||((te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),ge(!0)),(te.metaKey||te.ctrlKey)&&te.key==="["&&(te.preventDefault(),R(de=>!de)),(te.metaKey||te.ctrlKey)&&te.key==="]"&&(te.preventDefault(),j(de=>!de)),te.ctrlKey&&te.key==="`"&&(te.preventDefault(),ie(de=>!de)),t&&(te.metaKey||te.ctrlKey)&&te.key==="j"&&(te.preventDefault(),J("assistant"),ie(de=>!(de&&re==="assistant"))))};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[R,j,t,re,J,v]);const we=e.slots.Inspector,Pe=e.slots.RightPanel,_e=e.tools&&e.tools.length>0,xe=d.jsxs(d.Fragment,{children:[we&&d.jsx(we,{}),!we&&Pe&&d.jsx(Pe,{}),_e&&d.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(Z=>{const te=he.has(Z.id);return d.jsxs("div",{children:[d.jsxs("button",{onClick:()=>be(Z.id),className:`w-full flex items-center gap-2 px-4 py-2.5 text-[11px] font-mono tracking-wider uppercase transition-colors hover:bg-white/5 ${h===Z.id?"text-emerald-400":"text-neutral-300"}`,children:[te?d.jsx(g2,{size:10}):d.jsx(v2,{size:10}),d.jsx("span",{className:"text-neutral-400",children:Z.icon}),d.jsx("span",{className:"font-bold",children:Z.name})]}),te&&d.jsx("div",{className:"px-4 pb-3",children:d.jsx(Z.Component,{})})]},Z.id)})})]}),Se=d.jsxs(d.Fragment,{children:[e.slots.LeftFooter&&d.jsx(e.slots.LeftFooter,{}),d.jsx(WI,{onOpenCommandPalette:()=>ge(!0)})]}),Ue=b.useRef(null),Le=b.useRef(null);b.useEffect(()=>{const Z=Ue.current;Z&&(v?Z.setAttribute("inert",""):Z.removeAttribute("inert"))},[v]),b.useEffect(()=>{if(!v)return;const Z=Le.current;if(Z&&(Z.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??Z).focus(),!x)return;const te=de=>{de.key==="Escape"&&(de.preventDefault(),w?.())};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[v,x,w]);const Ze=m==="panel"?{position:"absolute",top:s,bottom:28,left:T?0:E,right:C?0:A,overflow:"auto",transition:"left 200ms ease, right 200ms ease"}:{};return d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:Ue,"aria-hidden":v?!0:void 0,style:{display:"contents"},children:d.jsx(HI,{mode:m,panOffset:O,scale:Y,onPan:B,onZoom:P,hud:d.jsxs(d.Fragment,{children:[d.jsx(GI,{title:e.name.toUpperCase(),search:l??void 0,center:u,actions:f}),d.jsx(ww,{side:"left",title:e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:T,onToggleCollapse:()=>R(!T),width:E,onResizeStart:Ce("left"),footer:Se,headerActions:e.leftPanel?.headerActions&&d.jsx(e.leftPanel.headerActions,{}),children:e.slots.LeftPanel&&d.jsx(e.slots.LeftPanel,{})}),d.jsx(ww,{side:"right",title:e.rightPanel?.title??"Inspector",icon:e.rightPanel?.icon,isCollapsed:C,onToggleCollapse:()=>j(!C),width:A,onResizeStart:Ce("right"),headerActions:e.rightPanel?.headerActions&&d.jsx(e.rightPanel.headerActions,{}),children:xe}),d.jsx(KI,{status:i,onToggleTerminal:()=>ie(Z=>!Z),isTerminalOpen:X}),d.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:T?0:E,right:C?0:A,bottom:0,top:0,zIndex:45,transition:"left 200ms ease, right 200ms ease",transform:"translateZ(0)"},children:d.jsxs(QI,{isOpen:X,onClose:()=>ie(!1),onToggleMaximize:()=>z(Z=>!Z),isMaximized:ee,height:H,onHeightChange:U,title:d.jsx(WU,{tabs:G,active:re,onSelect:J}),children:[re==="terminal"&&(e.slots.Terminal?d.jsx(e.slots.Terminal,{}):d.jsx("div",{className:"p-4 font-mono text-[12px] text-neutral-400",children:"No terminal content"})),re==="assistant"&&d.jsx(qU,{app:e,commands:r})]})}),d.jsx(JI,{isOpen:se,onClose:()=>ge(!1),commands:Re})]}),children:d.jsx("div",{style:Ze,className:"frame-scrollbar select-text",children:d.jsx(e.slots.Content,{})})})}),v&&N?d.jsx("div",{ref:Le,tabIndex:-1,role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:80,outline:"none"},children:d.jsx(N,{})}):null]})}function WU({tabs:e,active:t,onSelect:s}){return e.length===0?null:d.jsx("div",{className:"flex items-center gap-0.5",children:e.map(r=>{const i=r===t,l=r==="terminal"?ZS:VS,u=r==="terminal"?"TERMINAL":"ASSISTANT",f=r==="terminal"?"text-emerald-400":"text-cyan-400";return d.jsxs("button",{type:"button",onClick:()=>s(r),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${i?`${f} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[d.jsx(l,{size:13}),d.jsx("span",{children:u})]},r)})})}const wC=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();const JU=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const QU=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());const mS=e=>{const t=QU(e);return t.charAt(0).toUpperCase()+t.slice(1)};var eV={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 tV=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const nV=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:u,...f},m)=>b.createElement("svg",{ref:m,...eV,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:wC("lucide",i),...!l&&!tV(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,y])=>b.createElement(h,y)),...Array.isArray(l)?l:[l]]));const lr=(e,t)=>{const s=b.forwardRef(({className:r,...i},l)=>b.createElement(nV,{ref:l,iconNode:t,className:wC(`lucide-${JU(mS(e))}`,`lucide-${e}`,r),...i}));return s.displayName=mS(e),s};const sV=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],aV=lr("activity",sV);const rV=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],iV=lr("house",rV);const oV=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],lV=lr("layers",oV);const cV=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],uV=lr("messages-square",cV);const dV=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],fV=lr("network",dV);const hV=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],pV=lr("radio",hV);const mV=[["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"}]],gV=lr("settings",mV);const yV=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],vV=lr("users",yV);function Xp(){const e=new URL(window.location.href),t=e.pathname.replace(/^\/+/,"").split("/").filter(Boolean),s=e.searchParams.get("compose")==="ask"?"ask":void 0;return t[0]==="agent"&&t[1]?{view:"agent-info",conversationId:decodeURIComponent(t[1])}:t[0]==="agents"&&t[1]&&t[2]==="c"&&t[3]?{view:"agents",agentId:decodeURIComponent(t[1]),conversationId:decodeURIComponent(t[3])}:t[0]==="agents"&&t[1]?{view:"agents",agentId:decodeURIComponent(t[1])}:t[0]==="agents"?{view:"agents"}:t[0]==="fleet"?{view:"fleet"}:t[0]==="c"&&t[1]?{view:"conversation",conversationId:decodeURIComponent(t[1]),...s?{composeMode:s}:{}}:t[0]==="sessions"&&t[1]?{view:"sessions",sessionId:decodeURIComponent(t[1])}:t[0]==="sessions"?{view:"sessions"}:t[0]==="mesh"?{view:"mesh"}:t[0]==="activity"?{view:"activity"}:t[0]==="work"&&t[1]?{view:"work",workId:decodeURIComponent(t[1])}:t[0]==="settings"?{view:"settings"}:{view:"inbox"}}function bV(e){switch(e.view){case"inbox":return"/";case"conversation":{const t=new URLSearchParams;e.composeMode==="ask"&&t.set("compose","ask");const s=t.toString();return`/c/${encodeURIComponent(e.conversationId)}${s?`?${s}`:""}`}case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents":return e.agentId?e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:`/agents/${encodeURIComponent(e.agentId)}`:"/agents";case"fleet":return"/fleet";case"sessions":return e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions";case"mesh":return"/mesh";case"activity":return"/activity";case"work":return`/work/${encodeURIComponent(e.workId)}`;case"settings":return"/settings"}}function Kp(e){switch(e.view){case"conversation":return`conv:${e.conversationId}`;case"agent-info":return`agent-info:${e.conversationId}`;case"agents":return e.conversationId?`agent-conv:${e.conversationId}`:e.agentId?`agent:${e.agentId}`:"agents";case"sessions":return e.sessionId?`session:${e.sessionId}`:"sessions";case"work":return`work:${e.workId}`;default:return e.view}}function xV(){const[e,t]=b.useState(Xp),s=b.useRef({});b.useEffect(()=>{const i=()=>{const l=Xp();t(l),requestAnimationFrame(()=>{window.scrollTo(0,s.current[Kp(l)]??0)})};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=b.useCallback(i=>{s.current[Kp(Xp())]=window.scrollY,window.history.pushState(null,"",bV(i)),t(i),requestAnimationFrame(()=>{window.scrollTo(0,s.current[Kp(i)]??0)})},[]);return{route:e,navigate:r}}function SC(e){const t=e.match(/^dm\.operator\.(.+)$/);return t?t[1]:null}function Ju(e){return`dm.operator.${e}`}async function lt(e,t){const s=await fetch(e,{...t,headers:{...t?.headers??{},...t?.body?{"content-type":"application/json"}:{}}});if(!s.ok){const i=await s.text();let l=i||`HTTP ${s.status}`;try{const u=JSON.parse(i);u?.error&&(l=u.error)}catch{}throw new Error(l)}const r=await s.text();if(r)return JSON.parse(r)}const wV=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","conversation.upserted","binding.upserted","message.posted","invocation.requested","flight.updated","delivery.planned","delivery.attempted","delivery.state.changed","collaboration.upserted","collaboration.event.appended","scout.dispatched"];function SV(e){try{return JSON.parse(e)}catch{return{kind:"unknown"}}}function Kn(e){const t=b.useRef(e);t.current=e,b.useEffect(()=>{let s=null,r=null,i=0;function l(){s=new EventSource("/api/events");const u=f=>{t.current(SV(f.data))};s.onopen=()=>{i=0},s.onmessage=u;for(const f of wV)s.addEventListener(f,u);s.onerror=()=>{s?.close(),i++;const f=Math.min(3e3*2**(i-1),6e4);r=setTimeout(l,f)}}return l(),()=>{s?.close(),r&&clearTimeout(r)}},[])}function ws(e){return e==="working"?"working":!e||e==="offline"?"offline":"available"}function Hr(e){return ws(e)!=="offline"}function ao(e){switch(ws(e)){case"working":return"Working";case"available":return"Available";default:return"Offline"}}const EC={current:null,setMenu:null};function po(){return b.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),EC.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function EV({children:e}){const[t,s]=b.useState(null),r=b.useRef(null);EC.setMenu=s;const i=b.useCallback(()=>s(null),[]);return b.useEffect(()=>{if(!t)return;const l=()=>i(),u=m=>{m.key==="Escape"&&i()},f=()=>i();return window.addEventListener("mousedown",l,!0),window.addEventListener("keydown",u),window.addEventListener("scroll",f,!0),window.addEventListener("contextmenu",i,!0),()=>{window.removeEventListener("mousedown",l,!0),window.removeEventListener("keydown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("contextmenu",i,!0)}},[t,i]),b.useEffect(()=>{if(!t||!r.current)return;const l=r.current,u=l.getBoundingClientRect(),f=window.innerWidth,m=window.innerHeight;let h=t.position.x,y=t.position.y;h+u.width>f-8&&(h=f-u.width-8),y+u.height>m-8&&(y=m-u.height-8),h<8&&(h=8),y<8&&(y=8),l.style.left=`${h}px`,l.style.top=`${y}px`},[t]),t?d.jsxs(d.Fragment,{children:[e,d.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y},role:"menu",onMouseDown:l=>l.stopPropagation(),children:t.items.map((l,u)=>l.kind==="separator"?d.jsx("div",{className:"s-context-menu-sep",role:"separator"},u):d.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{l.onSelect(),i()},children:[d.jsx("span",{className:"s-context-menu-label",children:l.label}),l.shortcut&&d.jsx("span",{className:"s-context-menu-shortcut",children:l.shortcut})]},u))})]}):d.jsx(d.Fragment,{children:e})}const NC=b.createContext(null);function Yt(){const e=b.useContext(NC);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function NV({children:e}){const{route:t,navigate:s}=xV(),[r,i]=b.useState([]),[l,u]=b.useState([]),[f,m]=b.useState(null),[h,y]=b.useState(!1),v=b.useCallback(()=>y(!0),[]),x=b.useCallback(async()=>{const[R,C]=await Promise.allSettled([lt("/api/agents"),lt("/api/messages")]);R.status==="fulfilled"&&i(R.value),C.status==="fulfilled"&&u(C.value)},[]),w=b.useCallback(async()=>{try{const R=await lt("/api/onboarding/state");m(R)}catch{m({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null})}},[]);b.useEffect(()=>{x(),w()},[x,w]),Kn(x);const N=b.useMemo(()=>r.filter(R=>Hr(R.state)).length,[r]),T=b.useMemo(()=>({route:t,navigate:s,agents:r,messages:l,onlineCount:N,reload:x,onboarding:f,refreshOnboarding:w,onboardingSkipped:h,skipOnboarding:v}),[t,s,r,l,N,x,f,w,h,v]);return d.jsx(NC.Provider,{value:T,children:d.jsx("div",{"data-scout-theme":!0,style:{"--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', Georgia, serif"},children:d.jsx(EV,{children:e})})})}const TV={ask_sent:"asked",ask_replied:"replied",ask_failed:"failed",ask_working:"working",flight_created:"task started",flight_updated:"task updated",message_sent:"sent",message_received:"received",agent_online:"online",agent_offline:"offline"};function jV(e){return TV[e]??e.replace(/_/g," ")}const gS=["#6366f1","#8b5cf6","#0ea5e9","#14b8a6","#f59e0b","#ef4444","#ec4899","#10b981"];function Ts(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return gS[Math.abs(t)%gS.length]}function Kl(e){switch(ws(e)){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}const CV={workspace:"workspace",worktree:"workspace",branch:"workspace",profile:"profile",persona:"profile",harness:"harness",runtime:"harness",node:"node",host:"node"};function AV(e){return e.trim().replace(/^@+/,"").replace(/[.,!?;)\]]+$/,"")}function Is(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const RV="scout";function _V(e){return CV[Is(e)]??null}function TC(e){const t=Is(e.definitionId),s=e.workspaceQualifier?Is(e.workspaceQualifier):void 0,r=e.profile?Is(e.profile):void 0,i=e.harness?Is(e.harness):void 0,l=e.nodeQualifier?Is(e.nodeQualifier):void 0;return t?{definitionId:t,...s?{workspaceQualifier:s}:{},...r?{profile:r}:{},...i?{harness:i}:{},...l?{nodeQualifier:l}:{}}:null}function kV(e){const t=e.split(".").filter(Boolean),s=t.shift();if(!s)return null;const r={definitionId:s},i=[];for(const l of t){if(l.includes(":")){const[u,f=""]=l.split(":",2),m=_V(u),h=Is(f);if(!m||!h)return null;m==="workspace"?r.workspaceQualifier=h:m==="profile"?r.profile=h:m==="harness"?r.harness=h:m==="node"&&(r.nodeQualifier=h);continue}i.push(l)}if(i.length===1){const l=Is(i[0]);if(!l)return null;r.workspaceQualifier=l}else if(i.length===2){const l=Is(i[0]),u=Is(i[1]);if(!l||!u)return null;r.workspaceQualifier||(r.workspaceQualifier=l),r.nodeQualifier||(r.nodeQualifier=u)}else if(i.length>2)return null;return OV(r,{raw:e})}function MV(e){const t=AV(e);return!t||t.includes("@")||t.includes("#")?null:kV(t)}function yS(e,t={}){const s=TC(e);if(!s)return t.includeSigil===!1?"":"@";const i=[`${t.includeSigil===!1?"":"@"}${s.definitionId}`];return s.workspaceQualifier&&i.push(s.workspaceQualifier),s.profile&&i.push(`profile:${s.profile}`),s.harness&&i.push(`harness:${s.harness}`),s.nodeQualifier&&i.push(`node:${s.nodeQualifier}`),i.join(".")}function OV(e,t={}){const s=TC(e);return s?{raw:t.raw??yS(s,{includeSigil:!1}),label:yS(s),definitionId:s.definitionId,...s.nodeQualifier?{nodeQualifier:s.nodeQualifier}:{},...s.workspaceQualifier?{workspaceQualifier:s.workspaceQualifier}:{},...s.profile?{profile:s.profile}:{},...s.harness?{harness:s.harness}:{}}:null}function DV(e){return zV(e).parsed}function zV(e){const t=Array.from(e.matchAll(/(^|\s)@([a-z0-9][a-z0-9._/:-]*)/gi)),s=new Map,r=[];for(const i of t){const l=i[2]??"",u=MV(l);if(!u){l&&r.push(`@${l}`);continue}s.set(u.label,u)}return{parsed:Array.from(s.values()),unparsed:Array.from(new Set(r))}}function IV(e,t){if(t.length===0)return[{kind:"text",value:e}];const s=new Map;for(const u of t)s.set(u.label.toLowerCase(),u);const r=[];let i=e;const l=/@([a-z0-9][a-z0-9._/:-]*)/i;for(;i.length>0;){const u=l.exec(i);if(!u||u.index===void 0){r.push({kind:"text",value:i});break}u.index>0&&r.push({kind:"text",value:i.slice(0,u.index)});const f=u[0],m=f.toLowerCase(),h=s.get(m);h?r.push({kind:"mention",identity:h}):r.push({kind:"text",value:f}),i=i.slice(u.index+f.length)}return r}function LV(e,t){const s=[],r=/\*\*(.+?)\*\*/g;let i=0,l,u=0;for(;(l=r.exec(e))!==null;)l.index>i&&s.push(d.jsx("span",{children:e.slice(i,l.index)},`${t}-${u++}`)),s.push(d.jsx("strong",{children:l[1]},`${t}-${u++}`)),i=l.index+l[0].length;return i<e.length&&s.push(d.jsx("span",{children:e.slice(i)},`${t}-${u++}`)),s.length>0?s:[d.jsx("span",{children:e},t)]}function Yn(e){if(!e)return e??"";const t=DV(e);return IV(e,t).flatMap((r,i)=>{if(r.kind==="text")return LV(r.value,i*100);const{identity:l}=r,f=l.definitionId===RV?"var(--accent)":Ts(l.definitionId);return d.jsx("span",{className:"s-mention",style:{"--mention-color":f},children:l.label},i)})}function st(e){const t=e<1e12?e*1e3:e,s=Math.floor((Date.now()-t)/1e3);return s<5?"now":s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function zr(e){return new Date(e<1e12?e*1e3:e).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})}const PV={"agent.registered":"registered","agent.online":"came online","agent.offline":"went offline","flight.started":"started task","flight.completed":"completed task","flight.updated":"updated task","message.sent":"sent message","message.received":"received message","collaboration.ask":"asked a question","collaboration.answer":"answered",ask_sent:"asked",ask_replied:"replied",ask_working:"working",flight_created:"started task",flight_updated:"updated task",message_sent:"sent",message_received:"received"},$V={presence:{label:"Presence",tone:"notice"},work:{label:"Execution",tone:"working"},message:{label:"Delivery",tone:"completed"},collaboration:{label:"Coordination",tone:"working"},system:{label:"System",tone:"notice"}};function jC(e){return PV[e]??e.replace(/[._]/g," ")}function UV(e){return e.startsWith("agent.")||e.includes("registered")||e.includes("online")||e.includes("offline")?"presence":e.startsWith("flight")||e.startsWith("ask_")?"work":e.startsWith("message")?"message":e.startsWith("collaboration")?"collaboration":"system"}function VV(e){return(e??"system").charAt(0).toUpperCase()}function CC(e){return e.length<=14?e:`${e.slice(0,8)}...${e.slice(-4)}`}function BV(e){if(!e)return null;const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function ZV(e){return`${e.actorName??"system"} ${jC(e.kind)}`}function HV(e){return e.workspaceRoot?`Recorded from ${e.workspaceRoot}.`:e.conversationId?`Linked to thread ${CC(e.conversationId)}.`:"No additional detail was captured for this event."}function FV({navigate:e}){const[t,s]=b.useState([]),[r,i]=b.useState(null),[l,u]=b.useState(!0),[f,m]=b.useState(!1),[h,y]=b.useState(null),[v,x]=b.useState(null),w=b.useRef([]),N=b.useRef(0),T=b.useRef(null),R=po();b.useEffect(()=>{w.current=t},[t]);const C=b.useCallback(async(M="initial")=>{const O=++N.current;!(w.current.length>0)&&M!=="background"?(u(!0),y(null)):m(!0);try{const Y=await lt("/api/activity");if(O!==N.current)return;s(Y),y(null),x(Date.now()),i(F=>Y.some(B=>B.id===F)?F:null)}catch(Y){if(O!==N.current)return;y(Y instanceof Error?Y.message:String(Y))}finally{O===N.current&&(u(!1),m(!1))}},[]),j=b.useCallback(()=>{T.current||(T.current=setTimeout(()=>{T.current=null,C("background")},250))},[C]);b.useEffect(()=>(C("initial"),()=>{T.current&&clearTimeout(T.current)}),[C]),Kn(j);const E=b.useMemo(()=>{const M=new Set(t.map(I=>I.actorName??"system")),O=new Set(t.map(I=>I.conversationId).filter(I=>!!I));return[{label:"Events",value:`${t.length}`,detail:t.length>0?`Latest ${st(t[0].ts)}`:"Waiting for records"},{label:"Actors",value:`${M.size}`,detail:M.size>0?"Distinct event owners":"No actors yet"},{label:"Threads",value:`${O.size}`,detail:O.size>0?"Conversation-linked records":"No linked threads"}]},[t]),_=!l&&t.length===0&&!!h,A=!l&&t.length===0&&!h;return d.jsxs("div",{className:"sys-surface-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Activity"}),d.jsx("p",{className:"sys-page-subtitle",children:"Broker events, task execution, and collaboration handoffs."})]}),d.jsxs("div",{className:"sys-page-actions",children:[d.jsx("div",{className:"sys-sync-note",children:l?"Loading audit ledger...":h&&t.length>0?`Showing last confirmed snapshot from ${v?st(v):"earlier"}`:v?`Updated ${st(v)}`:"Waiting for first snapshot"}),d.jsx("button",{type:"button",className:"s-btn",disabled:l||f,onClick:()=>{C("manual")},children:f?"Refreshing...":"Refresh"})]})]}),d.jsx("div",{className:"sys-stat-grid",children:E.map(M=>d.jsxs("div",{className:"sys-stat-card",children:[d.jsx("span",{className:"sys-stat-label",children:M.label}),d.jsx("strong",{className:"sys-stat-value",children:M.value}),d.jsx("span",{className:"sys-stat-detail",children:M.detail})]},M.label))}),h&&t.length>0&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Refresh failed."}),d.jsx("span",{children:h})]}),l&&t.length===0&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading activity"}),d.jsx("p",{className:"sys-state-body",children:"Pulling the latest records from the broker database."})]}),_&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Activity is unavailable"}),d.jsx("p",{className:"sys-state-body",children:h}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{C("manual")},children:"Try again"})})]}),A&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"No activity yet"}),d.jsx("p",{className:"sys-state-body",children:"Events appear here after agents register, send messages, or advance work."})]}),t.length>0&&d.jsx("div",{className:"sys-audit-list",children:t.map(M=>{const O=r===M.id,I=UV(M.kind),Y=$V[I],F=BV(M.workspaceRoot),B=M.summary&&M.summary!==M.title?M.summary:HV(M);return d.jsxs("article",{className:`sys-audit-entry${O?" sys-audit-entry-expanded":""}`,onContextMenu:P=>{const X=window.getSelection()?.toString().trim(),ie=[];X&&(ie.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(X)}),ie.push({kind:"separator"}));const ee=M.title??M.summary??"";ee&&ie.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(ee)}),M.actorName&&ie.push({kind:"action",label:"Copy Actor",onSelect:()=>navigator.clipboard.writeText(M.actorName)}),ie.push({kind:"action",label:"Copy Event ID",onSelect:()=>navigator.clipboard.writeText(M.id)}),M.conversationId&&(ie.push({kind:"separator"}),ie.push({kind:"action",label:"Open Thread",onSelect:()=>e({view:"conversation",conversationId:M.conversationId})})),R(P,ie)},children:[d.jsxs("button",{type:"button",className:"sys-audit-toggle","aria-expanded":O,onClick:()=>i(O?null:M.id),children:[d.jsxs("div",{className:"sys-audit-stamp",children:[d.jsx("span",{className:"sys-audit-time",children:st(M.ts)}),d.jsx("span",{className:"sys-audit-date",children:zr(M.ts)})]}),d.jsx("div",{className:`sys-audit-marker sys-audit-marker-${Y.tone}`,children:d.jsx("span",{})}),d.jsxs("div",{className:"sys-audit-body",children:[d.jsxs("div",{className:"sys-audit-topline",children:[d.jsx("span",{className:"sys-audit-category",children:Y.label}),d.jsx("span",{className:"sys-audit-kind",children:jC(M.kind)})]}),d.jsx("h3",{className:"sys-audit-title",children:Yn(M.title??ZV(M))}),d.jsx("p",{className:"sys-audit-summary",children:Yn(B)}),d.jsxs("div",{className:"sys-audit-meta",children:[d.jsxs("span",{className:"sys-audit-meta-item",children:[d.jsx("span",{className:"sys-audit-avatar",style:{background:Ts(M.actorName??"system")},children:VV(M.actorName)}),M.actorName??"system"]}),F&&d.jsxs("span",{className:"sys-audit-meta-item",children:["Workspace ",F]}),M.conversationId&&d.jsxs("span",{className:"sys-audit-meta-item",children:["Thread ",CC(M.conversationId)]})]})]}),d.jsx("div",{className:"sys-audit-expand",children:O?"Close":"Details"})]}),O&&d.jsxs("div",{className:"sys-audit-details",children:[d.jsxs("div",{className:"sys-detail-grid",children:[d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Event"}),d.jsx("code",{className:"sys-detail-value",children:M.kind})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Recorded"}),d.jsx("span",{className:"sys-detail-value",children:zr(M.ts)})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Actor"}),d.jsx("span",{className:"sys-detail-value",children:M.actorName??"system"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Workspace"}),d.jsx("span",{className:"sys-detail-value",children:M.workspaceRoot??"Not attached"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Thread"}),d.jsx("span",{className:"sys-detail-value",children:M.conversationId??"Not attached"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Record id"}),d.jsx("code",{className:"sys-detail-value",children:M.id})]})]}),M.conversationId&&d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:()=>e({view:"conversation",conversationId:M.conversationId}),children:"Open thread"})})]})]},M.id)})})]})}function qV(e){const t=e.split(".");return t[t.length-1]||e}function fl(e){return e?e.replace(/_/g," "):null}function YV({values:e}){return d.jsx("span",{className:"s-agent-token-list",children:e.map(t=>d.jsx("span",{className:"s-agent-token",children:t},t))})}function _u({title:e,items:t}){return t.length===0?null:d.jsxs("section",{className:"s-agent-profile-card",children:[d.jsx("div",{className:"s-agent-profile-card-header",children:d.jsx("div",{className:"s-agent-profile-card-title",children:e})}),d.jsx("div",{className:"s-agent-meta-card-body",children:t.map(s=>d.jsxs("div",{className:"s-agent-meta-row",children:[d.jsx("span",{className:"s-agent-meta-label",children:s.label}),d.jsx("span",{className:"s-agent-meta-value",children:s.value})]},s.label))})]})}function GV({conversationId:e,navigate:t}){const{agents:s}=Yt(),[r,i]=b.useState(null),[l,u]=b.useState(null),f=SC(e),m=b.useCallback(async()=>{u(null);try{const T=await lt(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);i(T)}catch(T){u(T instanceof Error?T.message:String(T)),i(null)}},[e]);b.useEffect(()=>{m()},[m]),Kn(m);const h=r?.agentId??f,y=b.useMemo(()=>h?s.find(T=>T.id===h)??null:null,[s,h]);if(!y)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Back"}),l&&d.jsx("p",{className:"s-error",children:l}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Agent not found"})})]});const v=[{label:"Agent ID",value:y.id},...y.handle?[{label:"Handle",value:`@${y.handle}`}]:[],{label:"Class",value:fl(y.agentClass)??"—"},...y.role?[{label:"Role",value:y.role}]:[],...y.selector?[{label:"Selector",value:y.selector}]:[]],x=[...y.project?[{label:"Project",value:y.project}]:[],...y.branch?[{label:"Branch",value:y.branch}]:[],...y.projectRoot?[{label:"Path",value:y.projectRoot}]:[],...y.cwd?[{label:"Working dir",value:y.cwd}]:[]],w=[{label:"State",value:ao(y.state)},...y.harness?[{label:"Harness",value:y.harness}]:[],...y.transport?[{label:"Transport",value:fl(y.transport)??y.transport}]:[],...y.wakePolicy?[{label:"Wake policy",value:fl(y.wakePolicy)??y.wakePolicy}]:[],...y.capabilities.length>0?[{label:"Capabilities",value:d.jsx(YV,{values:y.capabilities})}]:[]],N=[{label:"Conversation ID",value:e},...r?.title?[{label:"Title",value:r.title}]:[],...r?.workspaceRoot?[{label:"Workspace",value:r.workspaceRoot}]:[],...r?.currentBranch?[{label:"Session branch",value:r.currentBranch}]:[],...r?.messageCount!=null?[{label:"Messages",value:String(r.messageCount)}]:[],...r?.lastMessageAt?[{label:"Last message",value:zr(r.lastMessageAt)}]:[],...y.harnessSessionId?[{label:"Harness session",value:y.harnessSessionId}]:[],...y.harnessLogPath?[{label:"Harness log",value:y.harnessLogPath}]:[]];return d.jsxs("div",{className:"s-agent-profile-page",children:[d.jsxs("div",{className:"s-agent-profile-page-topbar",children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Conversation"}),d.jsx("button",{type:"button",className:"s-btn",onClick:()=>t({view:"agents",agentId:y.id}),children:"Open in Agents"})]}),l&&d.jsx("p",{className:"s-error",children:l}),d.jsxs("section",{className:"s-agent-profile-hero",children:[d.jsx("div",{className:"s-agent-profile-hero-main",children:d.jsxs("div",{className:"s-agent-profile-hero-title-row",children:[d.jsx("div",{className:"s-avatar s-agent-profile-hero-avatar",style:{background:Ts(y.name)},children:y.name[0].toUpperCase()}),d.jsxs("div",{className:"s-agent-profile-hero-copy",children:[d.jsxs("div",{className:"s-agent-casefile-title-meta",children:[d.jsx("span",{className:"s-agent-casefile-record",children:qV(y.id)}),d.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${ws(y.state)}`,children:[d.jsx("span",{className:"s-dot",style:{background:Kl(y.state)}}),ao(y.state)]})]}),d.jsx("h1",{className:"s-agent-profile-hero-title",children:y.name}),d.jsx("p",{className:"s-agent-profile-hero-copyline",children:[y.handle?`@${y.handle}`:null,y.project,y.branch,fl(y.role)??fl(y.agentClass)].filter(Boolean).join(" • ")}),d.jsxs("p",{className:"s-agent-profile-hero-context",children:[r?.title?`Conversation: ${r.title}.`:"Attached to the current conversation.",y.updatedAt?` Updated ${st(y.updatedAt)}.`:""]})]})]})}),d.jsx("div",{className:"s-agent-profile-hero-actions",children:d.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>t({view:"conversation",conversationId:e}),children:"Open conversation"})})]}),d.jsxs("div",{className:"s-agent-profile-grid",children:[d.jsx(_u,{title:"Identity",items:v}),d.jsx(_u,{title:"Workspace",items:x}),d.jsx(_u,{title:"Runtime",items:w}),d.jsx(_u,{title:"Conversation context",items:N})]})]})}function XV(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function KV(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function WV(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function JV({items:e,navigate:t,emptyTitle:s,emptyDetail:r}){if(e.length===0){const i=[{titleWidth:"56%",metaWidths:["18%","14%","16%"],summaryWidth:"74%"},{titleWidth:"48%",metaWidths:["16%","20%","12%"],summaryWidth:"62%"}];return d.jsxs("div",{className:"s-work-empty-state",children:[d.jsxs("div",{className:"s-work-empty-copy",children:[d.jsx("p",{className:"s-work-empty-kicker",children:"Quiet for now"}),d.jsx("p",{className:"s-work-empty-title",children:s}),r&&d.jsx("p",{className:"s-work-empty-detail",children:r})]}),d.jsx("div",{className:"s-work-empty-skeleton","aria-hidden":"true",children:i.map((l,u)=>d.jsxs("div",{className:"s-work-empty-row",children:[d.jsxs("div",{className:"s-work-empty-row-header",children:[d.jsx("span",{className:"s-work-empty-line s-work-empty-line-title",style:{width:l.titleWidth}}),d.jsx("span",{className:"s-work-empty-pill"})]}),d.jsx("div",{className:"s-work-empty-row-meta",children:l.metaWidths.map(f=>d.jsx("span",{className:"s-work-empty-line s-work-empty-line-meta",style:{width:f}},f))}),d.jsx("span",{className:"s-work-empty-line s-work-empty-line-summary",style:{width:l.summaryWidth}})]},u))})]})}return d.jsx("div",{className:"s-work-list",children:e.map(i=>{const l=!!i.id||!!i.conversationId,u=WV(i.attention),f=i.ownerName??i.ownerId??"Unassigned",m=i.id?()=>t({view:"work",workId:i.id}):i.conversationId?()=>t({view:"conversation",conversationId:i.conversationId}):void 0;return d.jsxs("div",{className:`s-work-row${l?" s-work-row-clickable":""}`,onClick:m,children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsxs("div",{className:"s-work-row-title-wrap",children:[d.jsx("span",{className:"s-work-row-title",children:i.title}),i.priority&&d.jsx("span",{className:"s-badge",children:i.priority})]}),d.jsx("span",{className:`s-pill s-pill-${XV(i)}`,children:i.currentPhase})]}),d.jsxs("div",{className:"s-work-row-meta",children:[d.jsx("span",{children:f}),d.jsx("span",{children:KV(i.state)}),i.activeChildWorkCount>0&&d.jsxs("span",{children:[i.activeChildWorkCount," child",i.activeChildWorkCount===1?"":"ren"]}),i.activeFlightCount>0&&d.jsxs("span",{children:[i.activeFlightCount," flight",i.activeFlightCount===1?"":"s"]}),u&&d.jsx("span",{children:u}),d.jsx("span",{children:st(i.lastMeaningfulAt)})]}),i.lastMeaningfulSummary&&d.jsx("p",{className:"s-work-row-summary",children:Yn(i.lastMeaningfulSummary)})]},i.id)})})}const Wm=new Set(["completed","failed","cancelled"]),QV={direct:"Direct message",channel:"Channel",group_direct:"Group",thread:"Thread"};function In(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1e12?e*1e3:e}function eB(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function tB(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function Wp(e){const t=In(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function nB(e,t){const s=In(e),r=In(t);if(s===null||r===null)return!1;const i=new Date(s),l=new Date(r);return i.getFullYear()===l.getFullYear()&&i.getMonth()===l.getMonth()&&i.getDate()===l.getDate()}function vS(e){const t=In(e);if(t===null)return"";const s=new Date(t),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),l=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),u=1440*60*1e3;return l===i?"Today":l===i-u?"Yesterday":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(t)}function sB(e){switch(e){case"status":return"Status";case"system":return"System";case"scout.dispatch":return"Dispatch";default:return null}}function ku(e){return[...e].sort((t,s)=>(In(t.createdAt)??0)-(In(s.createdAt)??0))}function aB(e){return e.filter(t=>!Wm.has(t.state)).sort((t,s)=>(In(s.startedAt)??0)-(In(t.startedAt)??0))[0]??null}function bS(e,t,s){return{id:e.id,invocationId:e.invocationId,agentId:e.targetAgentId||s,agentName:null,conversationId:t,collaborationRecordId:null,state:e.state,summary:e.summary??null,startedAt:e.startedAt??null,completedAt:e.completedAt??null}}function rB(e){const t=e.metadata?.scoutDispatch;if(!t||typeof t!="object")return null;const s=t;return!s.id||!s.kind||!Array.isArray(s.candidates)?null:s}function Jm(e,t){if(e.class==="operator")return!0;const s=e.actorName?.toLowerCase()??"";return s===t.toLowerCase()||s==="operator"||s==="you"}function iB(e,t){return e.reduce((s,r)=>{if(Jm(r,t))return s;const i=In(r.createdAt);return i===null?s:s===null||i>s?i:s},null)}function oB(e,t){switch(t){case"queued":return`${e} has your message and is waiting to start.`;case"waking":return`${e} is waking up now.`;case"waiting":return`${e} is thinking through the request.`;case"running":return`${e} is working on your request.`;default:return`${e} is working on it.`}}function lB(e){const{agentName:t,agentState:s,sending:r,currentFlight:i,showWorkingTurn:l}=e;if(r&&!i)return{label:"Sending",detail:`Handing your message to ${t}.`,tone:"pending",showStrip:!0,showTyping:!1};if(i&&l){const u=i.summary?.trim()||oB(t,i.state);switch(i.state){case"queued":return{label:"Queued",detail:u,tone:"pending",showStrip:!0,showTyping:!0};case"waking":return{label:"Coming online",detail:u,tone:"working",showStrip:!0,showTyping:!0};case"waiting":return{label:"Thinking",detail:u,tone:"working",showStrip:!0,showTyping:!0};default:return{label:"Working",detail:u,tone:"working",showStrip:!0,showTyping:!0}}}return Hr(s)?{label:"Available",detail:`${t} is connected.`,tone:"idle",showStrip:!1,showTyping:!1}:{label:"Offline",detail:`${t} is offline right now. Sending a message will wake it up.`,tone:"offline",showStrip:!0,showTyping:!1}}function cB(e,t){switch(e.tone){case"pending":return"var(--accent)";case"working":return"var(--green)";case"offline":return"var(--dim)";default:return Kl(t)}}function uB(){return d.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"m3 11 18-8-8 18-2.8-7.2L3 11Z"}),d.jsx("path",{d:"M10.2 13.8 21 3"})]})}function dB(){return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:d.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function xS({label:e,value:t}){return d.jsxs("div",{className:"s-conv-meta-row",children:[d.jsx("span",{className:"s-conv-meta-label",children:e}),d.jsx("span",{className:"s-conv-meta-value",children:t})]})}function fB(e){if(!e)return null;const t=e.participantIds.filter(s=>s!=="operator");return t.length===0?null:t.join(", ")}function Qm({conversationId:e,initialComposeMode:t,navigate:s}){const{agents:r}=Yt(),[i,l]=b.useState(null),[u,f]=b.useState([]),[m,h]=b.useState(null),[y,v]=b.useState(null),x=b.useRef(null),w=b.useRef(null),N=b.useRef(new Set),T=b.useRef(null),R=b.useRef(0),C=SC(e),j=i?.agentId??C,E=i?.kind==="direct"||C!==null,_=b.useMemo(()=>j?r.find(Z=>Z.id===j)??null:null,[r,j]),A=b.useCallback(async()=>{v(null);try{const Z=await lt(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);l(Z);const te=Z?.agentId??C,de=Z?.kind==="direct"&&te&&te.startsWith("local-session-agent-")?Ju(te):e;if(de!==e){s({view:"conversation",conversationId:de,...t?{composeMode:t}:{}});return}const[me,ye]=await Promise.all([lt(`/api/messages?conversationId=${encodeURIComponent(de)}&limit=300`),lt(`/api/flights?conversationId=${encodeURIComponent(de)}`)]);f(ku(me)),N.current=new Set(ye.map(Ae=>Ae.invocationId)),h(aB(ye))}catch(Z){v(Z instanceof Error?Z.message:String(Z))}},[e,t,C,s]);b.useEffect(()=>{A()},[A]),b.useEffect(()=>{T.current=m},[m]);const[M,O]=b.useState(""),[I,Y]=b.useState(!1),[F,B]=b.useState("operator"),[P,X]=b.useState(null),[ie,ee]=b.useState(t==="ask"?"ask":"tell");b.useEffect(()=>{ee(E&&t==="ask"?"ask":"tell")},[e,t,E]),b.useEffect(()=>{const Z=w.current;if(!Z)return;Z.style.height="0px";const te=Math.min(Math.max(Z.scrollHeight,40),160);Z.style.height=`${te}px`,Z.style.overflowY=Z.scrollHeight>te?"auto":"hidden"},[M]),b.useEffect(()=>{lt("/api/user").then(Z=>B(Z.name)).catch(()=>{})},[]);const z=b.useMemo(()=>iB(u,F),[u,F]);b.useEffect(()=>{P===null||z===null||z>=P&&X(null)},[P,z]);const H=b.useMemo(()=>!m||Wm.has(m.state)?!1:(In(m.startedAt)??P??Date.now())>=(z??0),[P,m,z]),U=I||P!==null||H,ne=_?.name??i?.agentName??i?.title??j??"Conversation",G=b.useMemo(()=>lB({agentName:ne,agentState:_?.state??null,sending:I,currentFlight:m,showWorkingTurn:H}),[_?.state,ne,m,I,H]),D=i?tB(i):ne,$=i?.kind?QV[i.kind]??i.kind:"Conversation",J=fB(i)??e,re=eB(i?.workspaceRoot),se=i?.lastMessageAt??u[u.length-1]?.createdAt??null,ge=[re?{label:re,title:i?.workspaceRoot??void 0}:null,i?.currentBranch?{label:i.currentBranch,title:i.currentBranch}:null,_?.harness??i?.harness?{label:_?.harness??i?.harness??"",title:void 0}:null].filter(Z=>!!Z);Kn(b.useCallback(Z=>{if(Z.kind==="message.posted"){const te=Z.payload?.message;if(!te||te.conversationId!==e)return;const de=te.actorId===j,me={id:te.id,conversationId:te.conversationId,actorName:de?ne:F,body:te.body,createdAt:te.createdAt,class:de?te.class:"operator"};if(f(ye=>{if(ye.some(Ae=>Ae.id===te.id))return ye;if(!de){const Ae=ye.findIndex(Ie=>Ie.id.startsWith("optimistic-")&&Ie.body===te.body&&Math.abs((In(Ie.createdAt)??0)-(In(te.createdAt)??0))<=6e4);if(Ae!==-1){const Ie=[...ye];return Ie[Ae]=me,ku(Ie)}}return ku([...ye,me])}),de){const ye=In(te.createdAt)??Date.now();X(Ae=>Ae===null||ye<Ae?Ae:null),h(Ae=>{if(!Ae)return Ae;const Ie=In(Ae.startedAt)??0;return ye>=Ie?null:Ae})}return}if(Z.kind==="invocation.requested"){const te=Z.payload?.invocation;if(!te||te.targetAgentId!==j||te.conversationId!==e)return;N.current.add(te.id),X(de=>de??Date.now());return}if(Z.kind==="flight.updated"){const te=Z.payload?.flight;if(!te||te.targetAgentId!==j||!(N.current.has(te.invocationId)||T.current?.id===te.id))return;if(Wm.has(te.state)){h(me=>me?.id===te.id?null:me),A();return}N.current.add(te.invocationId),h(bS(te,e,j??""));return}Z.kind!=="agent.endpoint.upserted"&&Z.kind==="unknown"&&A()},[j,ne,e,A,F])),b.useEffect(()=>{if(!U)return;const Z=setInterval(()=>{A()},5e3);return()=>clearInterval(Z)},[U,A]),b.useEffect(()=>{const Z=()=>{if(document.visibilityState!=="visible")return;const te=Date.now();te-R.current<1e3||(R.current=te,A())};return window.addEventListener("focus",Z),document.addEventListener("visibilitychange",Z),()=>{window.removeEventListener("focus",Z),document.removeEventListener("visibilitychange",Z)}},[A]);const he=u.length+(G.showTyping?1:0),pe=b.useRef(0);b.useEffect(()=>{he>pe.current&&x.current?.scrollIntoView({behavior:"smooth"}),pe.current=he},[he]);const[,be]=b.useState(0);b.useEffect(()=>{const Z=setInterval(()=>be(te=>te+1),15e3);return()=>clearInterval(Z)},[]);const Ce=async(Z,te)=>{const de=Z.trim();if(!de||I)return;const me=te?.forceMode??ie,ye=E?U?"steer":me:"tell",Ae=Date.now(),Ie={id:`optimistic-${Ae}`,conversationId:e,actorName:F,body:de,createdAt:Ae,class:"operator"};Y(!0),X(Ae),v(null),f(Me=>ku([...Me,Ie]));try{const Me=await lt(ye==="ask"?"/api/ask":"/api/send",{method:"POST",body:JSON.stringify({body:de,conversationId:e})});Me.flight&&(N.current.add(Me.flight.invocationId),h(bS(Me.flight,e,j??"")))}catch(Me){f(tt=>tt.filter(Ot=>Ot.id!==Ie.id)),X(null),v(Me instanceof Error?Me.message:String(Me))}finally{Y(!1)}},fe=async()=>{const Z=M.trim();Z&&(O(""),await Ce(Z))},Re=async()=>{if(j)try{await lt("/api/agents/"+encodeURIComponent(j)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},we=G.tone==="working"||G.tone==="pending",Pe=E?U?"steer":ie:"tell",_e=Pe==="ask"?`Ask ${ne} to own this and report back...`:Pe==="steer"?`Steer ${ne} while the current turn is active...`:E?`Tell ${ne} what changed...`:`Message ${ne}...`,xe=Pe==="ask"?"Ask creates owned work in this DM and expects a reply here.":Pe==="steer"?"Follow-up stays in this DM while the current turn is active.":E?"Tell is for heads-up, replies, and status in this DM.":"Channels are for group coordination and shared updates.",Se=!M.trim()&&we,Ue=po(),Le=b.useCallback((Z,te)=>{const de=window.getSelection()?.toString().trim(),me=[];de&&(me.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(de)}),me.push({kind:"separator"})),me.push({kind:"action",label:"Copy Message",onSelect:()=>navigator.clipboard.writeText(te.body)}),te.actorName&&!Jm(te,F)&&me.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(te.actorName??"")}),me.push({kind:"separator"}),me.push({kind:"action",label:"Copy Message ID",onSelect:()=>navigator.clipboard.writeText(te.id)}),Ue(Z,me)},[F,Ue]),Ze=async(Z,te)=>{const de=`@${te.agentId} `,me=M.trim();if(me){O(""),await Ce(`${de}${me}`,{forceMode:"tell"});return}O(de),w.current?.focus()};return d.jsxs("div",{className:"s-conversation s-inbox-thread-redesign",children:[d.jsxs("div",{className:"s-conv-header",onClick:()=>E?s({view:"agent-info",conversationId:e}):void 0,style:E?void 0:{cursor:"default"},onContextMenu:Z=>{const te=[{kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(D)}];j&&te.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(j)}),te.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(e)}),Ue(Z,te)},children:[d.jsx("button",{type:"button",className:"s-back",onClick:Z=>{Z.stopPropagation(),s(E?{view:"inbox"}:{view:"sessions"})},children:"←"}),d.jsxs("div",{className:"s-thread-header-copy",children:[d.jsxs("div",{className:"s-thread-header-main",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(ne)},children:ne[0]?.toUpperCase()??"?"}),d.jsxs("div",{className:"s-conv-header-info",children:[d.jsx("span",{className:"s-conv-header-name",children:D}),d.jsxs("span",{className:"s-conv-header-state",title:E?G.detail:J,children:[d.jsx("span",{className:"s-dot s-dot-sm",style:{background:cB(G,_?.state??null)}}),E?G.label:J]})]})]}),d.jsxs("div",{className:"s-thread-header-meta",children:[d.jsx("span",{className:"s-thread-kicker",children:$}),se&&d.jsx("span",{className:"s-thread-header-updated s-tabular",title:Wp(se),children:st(se)})]})]}),ge.length>0&&d.jsx("div",{className:"s-thread-header-chips","aria-label":"Thread details",children:ge.map((Z,te)=>d.jsx("span",{className:"s-thread-chip",title:Z.title,children:Z.label},`${Z.label}-${te}`))}),E&&j&&d.jsx("span",{className:"s-chevron"})]}),G.showStrip&&d.jsxs("div",{className:`s-conv-status s-conv-status-${G.tone}`,"aria-live":"polite",children:[d.jsx("span",{className:"s-conv-status-dot"}),d.jsxs("div",{className:"s-conv-status-copy",children:[d.jsx("span",{className:"s-conv-status-label",children:G.label}),d.jsx("span",{className:"s-conv-status-detail",children:G.detail})]})]}),E&&_&&(_.harnessSessionId||_.harnessLogPath)&&d.jsxs("details",{className:"s-conv-meta-disclosure",children:[d.jsx("summary",{className:"s-conv-meta-toggle",children:"Session details"}),d.jsxs("div",{className:"s-conv-meta","aria-label":"Agent session metadata",children:[_.harnessSessionId&&d.jsx(xS,{label:"Harness Session",value:_.harnessSessionId}),_.harnessLogPath&&d.jsx(xS,{label:"Harness Log",value:_.harnessLogPath})]})]}),y&&d.jsx("p",{className:"s-error",children:y}),d.jsxs("div",{className:"s-messages",children:[u.length===0?d.jsxs("div",{className:"s-empty s-thread-empty",children:[d.jsx("p",{children:"No messages yet"}),d.jsx("p",{children:E?"Use Tell for quick coordination or Ask for owned work with a reply.":"Start the thread below."})]}):u.map((Z,te)=>{const de=Jm(Z,F),me=rB(Z),ye=me?"scout.dispatch":Z.class,Ae=sB(ye),Ie=te===0||!nB(u[te-1]?.createdAt,Z.createdAt),Me=Wp(Z.createdAt);return d.jsxs("div",{className:"s-thread-message-block",children:[Ie&&d.jsxs("div",{className:"s-thread-day-divider","aria-label":vS(Z.createdAt),children:[d.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),d.jsx("span",{className:"s-thread-day-label",children:vS(Z.createdAt)}),d.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]}),d.jsx("article",{className:`s-msg s-row-message${de?" s-msg-you":""}`,"data-class":ye,onContextMenu:tt=>Le(tt,Z),children:d.jsxs("div",{className:"s-msg-card",children:[d.jsxs("div",{className:"s-msg-header",children:[d.jsxs("div",{className:"s-msg-meta",children:[d.jsx("span",{className:"s-msg-actor",children:de?"You":Z.actorName}),Ae&&d.jsx("span",{className:"s-msg-kind",children:Ae})]}),d.jsx("span",{className:"s-msg-time",title:Me,children:st(Z.createdAt)})]}),d.jsx("div",{className:"s-msg-body",title:Me,children:Yn(Z.body)}),me&&me.candidates.length>0&&d.jsx("div",{className:"s-scout-dispatch",children:me.candidates.map(tt=>d.jsxs("button",{type:"button",className:"s-scout-tile",onClick:()=>{Ze(me,tt)},children:[d.jsxs("span",{className:"s-scout-tile-id",children:["@",tt.agentId]}),d.jsx("span",{className:"s-scout-tile-state",children:tt.endpointState}),d.jsx("span",{className:"s-scout-tile-meta",children:[tt.workspace,tt.node,tt.projectRoot].filter(Boolean).join(" · ")||tt.displayName})]},tt.agentId))})]})})]},Z.id)}),G.showTyping&&d.jsx("div",{className:"s-thread-message-block",children:d.jsx("div",{className:"s-msg s-msg-working","aria-live":"polite",children:d.jsxs("div",{className:"s-msg-card s-msg-working-card",children:[d.jsxs("div",{className:"s-msg-header",children:[d.jsxs("div",{className:"s-msg-meta",children:[d.jsx("span",{className:"s-msg-actor",children:ne}),d.jsx("span",{className:"s-msg-kind",children:"Live"})]}),d.jsx("span",{className:"s-msg-time",title:m?.startedAt?Wp(m.startedAt):"now",children:m?.startedAt?st(m.startedAt):"now"})]}),d.jsxs("div",{className:"s-msg-working-body",children:[d.jsxs("span",{className:"s-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{className:"s-typing-dot"}),d.jsx("span",{className:"s-typing-dot"}),d.jsx("span",{className:"s-typing-dot"})]}),d.jsx("span",{className:"s-msg-working-copy",children:G.detail})]})]})})}),d.jsx("div",{ref:x})]}),d.jsx("form",{className:"s-compose",onSubmit:Z=>{Z.preventDefault(),fe()},children:d.jsxs("div",{className:"s-thread-compose-shell",children:[E&&d.jsxs("div",{className:"s-compose-mode-row",children:[d.jsxs("div",{className:"s-seg s-compose-mode",role:"tablist","aria-label":"Direct message mode",children:[d.jsx("button",{type:"button",className:"s-seg-btn","aria-pressed":ie==="tell",onClick:()=>ee("tell"),children:"Tell"}),d.jsx("button",{type:"button",className:"s-seg-btn","aria-pressed":ie==="ask",onClick:()=>ee("ask"),children:"Ask"})]}),d.jsx("span",{className:"s-compose-mode-detail",children:xe})]}),d.jsx("textarea",{ref:w,className:"s-compose-input",placeholder:_e,value:M,onChange:Z=>O(Z.target.value),onKeyDown:Z=>{Z.key!=="Enter"||Z.shiftKey||Z.nativeEvent.isComposing||(Z.preventDefault(),!I&&M.trim()&&fe())},rows:1}),d.jsxs("div",{className:"s-thread-compose-footer",children:[d.jsx("span",{className:"s-thread-compose-hint",children:I?"Sending…":Se?"Stop":Pe==="steer"?d.jsxs(d.Fragment,{children:[d.jsx("kbd",{className:"s-kbd",children:"↵"})," steer"]}):Pe==="ask"?d.jsxs(d.Fragment,{children:[d.jsx("kbd",{className:"s-kbd",children:"↵"})," ask",d.jsx("kbd",{className:"s-kbd",children:"⇧↵"})," newline"]}):d.jsxs(d.Fragment,{children:[d.jsx("kbd",{className:"s-kbd",children:"↵"})," ",E?"tell":"send",d.jsx("kbd",{className:"s-kbd",children:"⇧↵"})," newline"]})}),Se?d.jsx("button",{type:"button",className:"s-compose-send s-compose-stop",onClick:()=>{Re()},"aria-label":"Stop agent",children:d.jsx(dB,{})}):d.jsx("button",{type:"submit",className:"s-compose-send",disabled:I||!M.trim(),"aria-label":Pe==="ask"?"Ask agent":Pe==="steer"?"Steer agent":E?"Tell agent":"Send message",children:d.jsx(uB,{})})]})]})})]})}function AC(e,t){if(t.filter(i=>i.name===e.name).length<=1)return{name:e.name,qualifier:null};const r=e.project??e.branch??e.id.replace(/^.*\./,"");return{name:e.name,qualifier:r}}function Jp(e){return e?e.replace(/_/g," "):null}function hB(e){return e?st(e):"—"}function pB(e){const t=[...e].filter(i=>i.kind==="direct"&&!!i.agentId).sort((i,l)=>(l.lastMessageAt??0)-(i.lastMessageAt??0)),s=new Map,r=new Map;for(const i of t){const l=i.agentId;s.has(l)||(s.set(l,i.id),r.set(l,i))}return{conversationByAgentId:s,sessionByAgentId:r}}function mB({label:e,value:t}){return d.jsxs("div",{className:"s-agent-meta-row",children:[d.jsx("span",{className:"s-agent-meta-label",children:e}),d.jsx("span",{className:"s-agent-meta-value",children:t})]})}function gB({values:e}){return d.jsx("span",{className:"s-agent-token-list",children:e.map(t=>d.jsx("span",{className:"s-agent-token",children:t},t))})}function yB({title:e,count:t,children:s}){return d.jsxs("section",{className:"s-agent-roster-section",children:[d.jsxs("div",{className:"s-agent-roster-section-header",children:[d.jsx("div",{className:"s-agent-roster-section-title",children:e}),d.jsx("span",{className:"s-agent-roster-section-count",children:t})]}),d.jsx("div",{className:"s-agent-roster-stack",children:s})]})}function vB({agents:e}){return e.length===0?null:d.jsxs("div",{className:"s-agent-overview-empty",children:[d.jsx("h2",{className:"s-agent-overview-empty-title",children:"Select an agent"}),d.jsx("p",{className:"s-agent-overview-empty-copy",children:"Pick an agent from the roster to view its profile, current work, and session context."})]})}function bB({agent:e,allAgents:t,session:s,conversationId:r,navigate:i}){const{name:l,qualifier:u}=AC(e,t),[f,m]=b.useState([]),h=ws(e.state),y=po(),v=b.useCallback(async()=>{try{m(await lt(`/api/work?agentId=${encodeURIComponent(e.id)}`))}catch{m([])}},[e.id]);b.useEffect(()=>{v()},[v]),Kn(v);const x=[...e.project?[{label:"Project",value:e.project}]:[],...e.branch?[{label:"Branch",value:e.branch}]:[],...e.harness?[{label:"Harness",value:e.harness}]:[],...e.transport?[{label:"Transport",value:Jp(e.transport)??e.transport}]:[],...e.projectRoot?[{label:"Path",value:e.projectRoot}]:[],...s?.workspaceRoot?[{label:"Workspace",value:s.workspaceRoot}]:[],...s?.currentBranch?[{label:"Session branch",value:s.currentBranch}]:[]];return d.jsxs("div",{className:"s-agent-casefile",children:[d.jsx("button",{type:"button",className:"s-back s-agent-mobile-back",onClick:()=>i({view:"agents"}),children:"← All agents"}),d.jsxs("section",{className:"s-agent-detail-identity",onContextMenu:w=>{const N=window.getSelection()?.toString().trim(),T=[];N&&(T.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(N)}),T.push({kind:"separator"})),T.push({kind:"action",label:"Copy Agent Name",onSelect:()=>navigator.clipboard.writeText(l)}),T.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(e.id)}),e.handle&&T.push({kind:"action",label:`Copy @${e.handle}`,onSelect:()=>navigator.clipboard.writeText(`@${e.handle}`)}),y(w,T)},children:[d.jsx("div",{className:"s-avatar s-agent-casefile-avatar",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),d.jsxs("div",{className:"s-agent-detail-identity-copy",children:[d.jsxs("h2",{className:"s-agent-detail-identity-name",children:[l,u&&d.jsx("span",{className:"s-agent-casefile-title-qualifier",children:u})]}),d.jsxs("div",{className:"s-agent-detail-identity-meta",children:[e.handle&&d.jsxs("span",{className:"s-agent-detail-handle",children:["@",e.handle]}),d.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${h}`,children:[d.jsx("span",{className:"s-dot",style:{background:Kl(e.state)}}),ao(e.state)]}),e.updatedAt&&d.jsx("span",{className:"s-agent-detail-updated",children:st(e.updatedAt)})]}),d.jsx("p",{className:"s-agent-detail-identity-desc",children:[Jp(e.role)??Jp(e.agentClass),e.project].filter(Boolean).join(" · ")}),d.jsxs("div",{className:"s-agent-detail-actions",children:[d.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>r&&i({view:"agents",agentId:e.id,conversationId:r}),disabled:!r,children:r?"Open conversation":"No conversation"}),e.capabilities.length>0&&d.jsx("div",{className:"s-agent-detail-capabilities",children:d.jsx(gB,{values:e.capabilities})})]})]})]}),x.length>0&&d.jsxs("section",{className:"s-agent-detail-context",children:[d.jsx("h3",{className:"s-agent-detail-section-title",children:"Context"}),d.jsx("div",{className:"s-agent-meta-card-body",children:x.map(w=>d.jsx(mB,{label:w.label,value:w.value},w.label))})]}),d.jsxs("section",{className:"s-agent-detail-work",children:[d.jsx("h3",{className:"s-agent-detail-section-title",children:"Active work"}),d.jsx(JV,{items:f,navigate:i,emptyTitle:"Nothing in flight",emptyDetail:"New asks, handoffs, and follow-ups will stack here once this agent picks up work."})]})]})}function xB({navigate:e,selectedAgentId:t,conversationId:s}){const{agents:r}=Yt(),[i,l]=b.useState([]),u=b.useCallback(async()=>{const A=await lt("/api/sessions").catch(()=>null);A&&l(A)},[]);b.useEffect(()=>{u()},[u]),Kn(u);const f=[...r].sort((A,M)=>{const O={working:0,available:1,offline:2},I=O[ws(A.state)]-O[ws(M.state)];if(I!==0)return I;const Y=(M.updatedAt??0)-(A.updatedAt??0);return Y!==0?Y:A.name.localeCompare(M.name)}),m=[{key:"working",title:"Working",agents:f.filter(A=>ws(A.state)==="working")},{key:"available",title:"Available",agents:f.filter(A=>ws(A.state)==="available")},{key:"offline",title:"Offline",agents:f.filter(A=>ws(A.state)==="offline")}],h=t?r.find(A=>A.id===t)??null:null,{conversationByAgentId:y,sessionByAgentId:v}=pB(i),x=r.length>0,w=200,N=440,T="scout-agents-roster-w",[R,C]=b.useState(()=>{try{const A=localStorage.getItem(T);if(A){const M=Number(A);if(M>=w&&M<=N)return M}}catch{}return 280}),j=b.useRef(!1),E=b.useRef(null);b.useEffect(()=>{try{localStorage.setItem(T,String(R))}catch{}},[R]);const _=b.useCallback(A=>{A.preventDefault(),j.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const M=E.current?.getBoundingClientRect().left??0,O=Y=>{j.current&&C(Math.min(N,Math.max(w,Y.clientX-M)))},I=()=>{j.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",I)},[]);return d.jsxs("div",{className:["s-agents-layout","s-agents-browser",x?"s-agents-layout-split":"",h?"s-agents-browser-selected":""].filter(Boolean).join(" "),style:{"--agents-roster-w":`${R}px`},children:[d.jsx("div",{ref:E,className:"s-agents-list-panel s-agents-browser-list",children:d.jsxs("div",{className:"s-agent-roster",children:[d.jsx("div",{className:"s-agent-roster-header",children:d.jsxs("div",{children:[d.jsx("h2",{className:"s-section-title s-agent-roster-title",children:"Agents"}),d.jsxs("p",{className:"s-agent-roster-copy",children:[r.length," total · ",m[0].agents.length," working · ",m[1].agents.length," available"]})]})}),r.length===0?d.jsxs("div",{className:"s-empty s-agent-roster-empty",children:[d.jsx("p",{children:"No agents"}),d.jsx("p",{children:"Agents appear here when they connect to the broker."})]}):m.filter(A=>A.agents.length>0).map(A=>d.jsx(yB,{title:A.title,count:A.agents.length,children:A.agents.map(M=>d.jsx(wB,{agent:M,allAgents:r,selected:M.id===t,onClick:()=>e({view:"agents",agentId:M.id})},M.id))},A.key))]})}),x&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"s-agents-roster-resize",onMouseDown:_,role:"separator","aria-orientation":"vertical"}),d.jsx("div",{className:"s-agents-detail-panel s-agents-browser-detail",children:s&&h?d.jsx(Qm,{conversationId:s,navigate:e}):h?d.jsx(bB,{agent:h,allAgents:r,session:v.get(h.id)??null,conversationId:y.get(h.id)??h.conversationId??null,navigate:e}):d.jsx(vB,{agents:r})})]})]})}function wB({agent:e,allAgents:t,selected:s,onClick:r}){const{name:i,qualifier:l}=AC(e,t),u=ws(e.state),f=po();return d.jsxs("div",{className:`s-agent-list-row s-agent-roster-row${s?" s-agent-list-row-active":""}`,onClick:r,onContextMenu:m=>{const h=[{kind:"action",label:"Copy Agent Name",onSelect:()=>navigator.clipboard.writeText(i)},{kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(e.id)}];e.handle&&h.push({kind:"action",label:`Copy @${e.handle}`,onSelect:()=>navigator.clipboard.writeText(`@${e.handle}`)}),f(m,h)},children:[d.jsxs("div",{className:"s-agent-roster-avatar-wrap",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),d.jsx("span",{className:`s-agent-roster-avatar-status s-agent-roster-avatar-status-${u}`,style:{background:Kl(e.state)}})]}),d.jsx("div",{className:"s-agent-list-body s-agent-roster-row-body",children:d.jsxs("div",{className:"s-agent-roster-row-top",children:[d.jsxs("div",{className:"s-agent-list-header",children:[d.jsx("span",{className:"s-agent-list-name",children:i}),l&&d.jsx("span",{className:"s-agent-list-qualifier",children:l})]}),d.jsx("span",{className:"s-agent-roster-row-time",children:hB(e.updatedAt)})]})})]})}function SB(e){switch(e){case"queued":case"working":return"working";case"needs_attention":return"updated";case"failed":return"failed";default:return"completed"}}function EB(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId}}function NB(e){return e.kind==="work_item"&&e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function TB(e){return e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function Mu({title:e,detail:t,count:s}){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"s-dashboard-panel-header",children:[d.jsx("div",{children:d.jsx("h3",{children:e})}),d.jsx("span",{className:"s-dashboard-count",style:s===0?{opacity:.4}:void 0,children:s})]}),d.jsx("p",{className:"s-dashboard-panel-copy",children:t})]})}function wS({ask:e,navigate:t,section:s}){const r=EB(e),i=e.completedAt?`finished ${st(e.completedAt)}`:e.startedAt?`started ${st(e.startedAt)}`:`updated ${st(e.updatedAt)}`;return d.jsxs("div",{className:`s-work-row s-work-row-clickable s-dashboard-fleet-row s-dashboard-fleet-row-${s}`,"data-status":e.status,onClick:()=>t(r),children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsxs("div",{className:"s-fleet-row-title-wrap",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.agentName??e.agentId)},children:(e.agentName??e.agentId)[0]?.toUpperCase()??"?"}),d.jsxs("div",{className:"s-fleet-row-title-copy",children:[d.jsxs("div",{className:"s-work-row-title-wrap",children:[d.jsx("span",{className:"s-work-row-title",children:e.agentName??e.agentId}),e.harness&&d.jsx("span",{className:"s-badge",children:e.harness})]}),d.jsxs("div",{className:"s-work-row-meta",style:{marginTop:2},children:[d.jsx("span",{className:"s-dot",style:{background:Kl(e.agentState)}}),d.jsx("span",{children:ao(e.agentState)}),d.jsx("span",{children:i})]})]})]}),d.jsx("span",{className:`s-pill s-pill-${SB(e.status)}`,children:e.statusLabel})]}),d.jsx("p",{className:"s-work-row-summary",children:Yn(e.task)}),e.summary&&d.jsx("p",{className:"s-work-row-summary",style:{marginTop:8},children:Yn(e.summary)})]})}function jB({item:e,navigate:t}){const s=NB(e),r=e.kind==="question"?"question":e.state.replace(/_/g," "),i=e.acceptanceState!=="none"?e.acceptanceState.replace(/_/g," "):e.kind==="question"?"awaiting answer":"your move";return d.jsxs("div",{className:`s-work-row s-dashboard-fleet-row s-dashboard-fleet-attention-row${s?" s-work-row-clickable":""}`,onClick:s?()=>t(s):void 0,children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsx("div",{className:"s-work-row-title-wrap",children:d.jsx("span",{className:"s-work-row-title",children:e.title})}),d.jsx("span",{className:"s-pill s-pill-updated",children:"Needs your input"})]}),d.jsxs("div",{className:"s-work-row-meta",children:[d.jsx("span",{children:e.kind==="question"?"question":"work item"}),e.agentName&&d.jsx("span",{children:e.agentName}),d.jsx("span",{children:r}),d.jsx("span",{children:i}),d.jsx("span",{children:st(e.updatedAt)})]}),e.summary&&d.jsx("p",{className:"s-work-row-summary",children:Yn(e.summary)})]})}function CB({item:e,navigate:t}){const s=TB(e);return d.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>t(s):void 0,children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.actorName??e.agentId??"system")},children:(e.actorName??e.agentId??"S")[0]?.toUpperCase()??"S"}),d.jsxs("div",{className:"s-dashboard-activity-body",children:[d.jsxs("div",{className:"s-dashboard-activity-header",children:[d.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),d.jsx("span",{className:"s-dashboard-activity-kind",children:jV(e.kind)}),d.jsx("span",{className:"s-time",children:st(e.ts)})]}),(e.title||e.summary)&&d.jsx("p",{className:"s-dashboard-activity-summary",children:Yn(e.title??e.summary??"")}),e.title&&e.summary&&d.jsx("p",{className:"s-dashboard-activity-note",children:Yn(e.summary)})]})]})}function AB({navigate:e}){const[t,s]=b.useState(null),r=b.useCallback(async()=>{try{s(await lt("/api/fleet"))}catch{s(null)}},[]);b.useEffect(()=>{r()},[r]),Kn(r);const i=t?.activeAsks??[],l=t?.recentCompleted??[],u=t?.needsAttention??[],f=t?.activity??[],m=u.length>0?`${u.length} item${u.length===1?" is":"s are"} waiting on you. Clear ${u.length===1?"it":"those"} first, then monitor the rest of the queue.`:i.length>0?`${i.length} ask${i.length===1?" is":"s are"} currently in flight. The queue is clear of interruptions.`:l.length>0?"Nothing is actively running right now. Recent finishes are ready for review.":"No asks have moved through the fleet yet. Start work and this becomes the operations board.";return d.jsxs("div",{className:"s-home s-dashboard-screen s-dashboard-fleet",children:[d.jsx("div",{className:"s-dashboard-hero s-dashboard-hero-fleet",children:d.jsxs("div",{className:"s-dashboard-hero-copy",children:[d.jsxs("div",{className:"s-dashboard-hero-head",children:[d.jsx("h2",{children:"Fleet"}),t&&d.jsxs("span",{className:"s-time",children:["Updated ",st(t.generatedAt)]})]}),d.jsx("p",{children:m}),d.jsxs("div",{className:"s-dashboard-summary-grid",children:[d.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.needsAttention??0)>0?" s-dashboard-summary-card-attention":""}`,children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Needs input"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.needsAttention??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Questions, reviews, or decisions waiting on you"})]}),d.jsxs("div",{className:"s-dashboard-summary-card",children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Active asks"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.active??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Currently in flight across the fleet"})]}),d.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.recentCompleted??0)>0?" s-dashboard-summary-card-finished":""}`,children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Finished"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.recentCompleted??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent completions and failures to review"})]}),d.jsxs("div",{className:"s-dashboard-summary-card",children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Activity"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.activity??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent events across the fleet"})]})]})]})}),d.jsxs("div",{className:"s-dashboard-fleet-stack",children:[d.jsxs("section",{className:`s-dashboard-panel${u.length>0?" s-dashboard-panel-attention":""}`,children:[d.jsx(Mu,{title:"Needs your input",detail:"Handle interruptions, pending answers, and review requests first.",count:u.length}),u.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"Nothing is waiting on you"}),d.jsx("p",{children:"When agents ask a question or a work item needs review, it will land here first."})]}):d.jsx("div",{className:"s-work-list",children:u.map(h=>d.jsx(jB,{item:h,navigate:e},h.recordId))})]}),d.jsxs("div",{className:"s-dashboard-fleet-columns",children:[d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-active",children:[d.jsx(Mu,{title:"Active asks",detail:"The asks still in flight across the fleet.",count:i.length}),i.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No active asks"}),d.jsx("p",{children:"New agent work will appear here while it is still in progress."})]}):d.jsx("div",{className:"s-work-list",children:i.map(h=>d.jsx(wS,{ask:h,navigate:e,section:"active"},h.invocationId))})]}),d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-finished",children:[d.jsx(Mu,{title:"Recent finishes",detail:"Review completions and failures once the active queue is stable.",count:l.length}),l.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No recent finishes"}),d.jsx("p",{children:"Completed asks and failures will show up here once they settle."})]}):d.jsx("div",{className:"s-work-list",children:l.map(h=>d.jsx(wS,{ask:h,navigate:e,section:"finished"},h.invocationId))})]})]}),d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-activity",children:[d.jsx(Mu,{title:"Recent activity",detail:"The broader event stream behind the queue.",count:f.length}),f.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No recent fleet activity"}),d.jsx("p",{children:"Messages, asks, and other agent activity will stream here."})]}):d.jsx("div",{className:"s-dashboard-activity-feed",children:f.slice(0,20).map(h=>d.jsx(CB,{item:h,navigate:e},h.id))})]})]})]})}function RB(){const e=window.getSelection();return e!==null&&e.toString().trim().length>0}function RC(e){RB()||e()}const _B={"agent.registered":"registered","agent.online":"came online","agent.offline":"went offline","flight.started":"started task","flight.completed":"completed task","message.sent":"sent message","message.received":"received message","collaboration.ask":"asked a question","collaboration.answer":"answered"};function kB(e){return _B[e]??e.replace(/[._]/g," ")}function MB({item:e,navigate:t}){const s=e.conversationId?{view:"conversation",conversationId:e.conversationId}:null,r=po(),i=b.useCallback(l=>{const u=e.title??e.summary??"",f=window.getSelection()?.toString().trim(),m=[];f&&(m.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(f)}),m.push({kind:"separator"})),u&&m.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(u)}),e.actorName&&m.push({kind:"action",label:"Copy Actor Name",onSelect:()=>navigator.clipboard.writeText(e.actorName)}),s&&(m.push({kind:"separator"}),m.push({kind:"action",label:"Open Conversation",onSelect:()=>t(s)})),m.length>0&&r(l,m)},[e,s,t,r]);return d.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>RC(()=>t(s)):void 0,onContextMenu:i,children:[d.jsx("div",{className:"s-dashboard-activity-time",children:st(e.ts)}),d.jsxs("div",{className:"s-dashboard-activity-body",children:[d.jsxs("div",{className:"s-dashboard-activity-header",children:[d.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),d.jsx("span",{className:"s-dashboard-activity-kind",children:kB(e.kind)})]}),(e.title||e.summary)&&d.jsx("p",{className:"s-dashboard-activity-summary",children:Yn(e.title??e.summary??"")})]})]})}function OB({navigate:e}){const[t,s]=b.useState([]),r=b.useCallback(async()=>{try{const l=await lt("/api/activity");s(l)}catch{}},[]);b.useEffect(()=>{r()},[r]),Kn(r);const i=t.slice(0,20);return d.jsx("div",{className:"s-home s-dashboard-screen",children:d.jsx("div",{className:"s-dashboard-body s-dashboard-body-solo",children:d.jsxs("main",{className:"s-dashboard-main",children:[d.jsxs("div",{className:"s-dashboard-section-head",children:[d.jsx("h3",{children:"Activity"}),t.length>0&&d.jsx("span",{className:"s-dashboard-count",children:t.length})]}),i.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No activity yet"}),d.jsx("p",{children:"Events appear here as agents connect and work."})]}):d.jsx("div",{className:"s-dashboard-activity-feed",children:i.map(l=>d.jsx(MB,{item:l,navigate:e},l.id))}),t.length>20&&d.jsx("button",{type:"button",className:"s-dashboard-see-all",onClick:()=>e({view:"activity"}),children:"See all activity"})]})})})}const DB=b.lazy(()=>Xu(()=>import("./arc.es-iPbdMi1H.js"),[]).then(e=>({default:e.ArcDiagram})));function Pr(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[s]=t.split(":");return s.split(".")[0]}function zB(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return Pr(t)||t;const s=e.dnsName?.trim().replace(/\.$/,"");return s?Pr(s)||s:Pr(e.name)||e.name}function eg(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[s]=t.split(":");return s.replace(/\.$/,"").toLowerCase()}function Za(e){const t=eg(e);return t?t.split(".")[0]??t:""}function IB(e){return e.brokerUrl?Pr(e.brokerUrl):e.hostName?Pr(e.hostName):e.id.slice(0,10)}function LB(e,t){return Math.abs(e)>=Math.abs(t)?e>=0?["right","left"]:["left","right"]:t>=0?["bottom","top"]:["top","bottom"]}function PB(e,t){const s=Za(t.hostName||t.name),r=Za(e.localNode?.hostName||e.localNode?.name);return!!r&&s===r}function $B(e,t){const s=new Set([Za(e.hostName),Za(e.name),...e.addresses.map(i=>eg(i)),...e.addresses.map(i=>Za(i))].filter(Boolean)),r=new Set([Za(t.hostName),Za(t.name),eg(t.brokerUrl),Za(t.brokerUrl)].filter(Boolean));for(const i of s)if(r.has(i))return!0;return!1}function UB(e){if(!e.localNode)return null;const t=e.localNode.id,s=Object.values(e.nodes).filter(x=>x.id!==t),r=e.tailscale.peers.filter(x=>!PB(e,x)).filter(x=>!s.some(w=>$B(x,w))),i=[...s.map(x=>({kind:"mesh",peer:x})),...r.map(x=>({kind:"tailnet",peer:x}))],l=800,u=300,f=l/2,m=u/2,h={[t]:{x:f,y:m,size:"m"}},y={[t]:{icon:"Database",name:Pr(e.localNode.hostName)||e.localNode.name||"broker",subtitle:"this node",color:"violet"}},v=[];if(i.length===0)h.__placeholder={x:f+220,y:m,size:"m"},y.__placeholder={icon:"CircleDashed",name:"No peers yet",subtitle:"awaiting discovery",color:"zinc"},v.push({from:t,to:"__placeholder",fromAnchor:"right",toAnchor:"left",style:"pending"});else{const x=i.length,w=Math.min(170,100+x*10);i.forEach(({kind:N,peer:T},R)=>{const C=R/x*Math.PI*2-Math.PI/2,j=Math.round(f+w*Math.cos(C)),E=Math.round(m+w*Math.sin(C)),_=N==="mesh"?T.id:`tailnet:${T.id}`,A=N==="mesh"?Pr(T.hostName)||T.name||"peer":zB(T)||"tailnet",M=N==="mesh"?IB(T):T.online?T.addresses[0]??"tailnet only":"tailnet offline";h[_]={x:j,y:E,size:N==="mesh"?"m":"s"},y[_]={icon:N==="mesh"?"Database":"CircleDashed",name:A,subtitle:M,color:N==="mesh"?T.advertiseScope==="mesh"?"emerald":"zinc":T.online?"sky":"zinc"};const[O,I]=LB(j-f,E-m);v.push({from:t,to:_,fromAnchor:O,toAnchor:I,style:N==="mesh"?T.advertiseScope==="mesh"?"mesh":"local":T.online?"tailnet":"tailnet-offline"})})}return{layout:{width:l,height:u},nodes:h,nodeData:y,connectors:v,connectorStyles:{mesh:{color:"emerald",strokeWidth:2,label:"mesh"},local:{color:"zinc",strokeWidth:1.5},tailnet:{color:"sky",strokeWidth:1.5,dashed:!0,label:"tailnet"},"tailnet-offline":{color:"zinc",strokeWidth:1.25,dashed:!0,label:"tailnet"},pending:{color:"zinc",strokeWidth:1.5,dashed:!0}}}}function VB({mesh:e}){const t=b.useMemo(()=>UB(e),[e]);return t?d.jsx("div",{className:"s-mesh-topology",children:d.jsx(b.Suspense,{fallback:d.jsx("div",{className:"s-mesh-topology-fallback"}),children:d.jsx(DB,{data:t,className:"s-mesh-topology-canvas",mode:"light",theme:"cool",interactive:!0,showArcToggle:!1,defaultZoom:"fit",maxFitZoom:.95,hoverEffects:{dim:!0,lift:!0,glow:!0,highlightEdges:!0}})})}):null}function BB(e){return e.code==="local_only"?"notice":e.severity==="error"?"error":"warning"}function ZB(e){switch(e.code){case"local_only":return"Not discoverable";case"mesh_loopback":return"Wrong address";case"discovery_unconfigured":return"No path";default:return"Offline"}}function HB(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function FB(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return t;const s=e.dnsName?.trim().replace(/\.$/,"");return s?s.split(".")[0]??s:e.name}function qB(e){return e==="mesh"?"Announced to mesh":e==="local"?"Local only":e||"Not advertised"}function YB(e){return e.identity.discoverable?"success":e.health.reachable?"warning":"danger"}function GB(e){return e.identity.discoverable?"Discoverable":e.health.reachable?"Not discoverable":"Broker offline"}function XB(e){return!e.health.reachable||e.issues.some(t=>t.severity==="error")?"danger":e.issues.length>0?"warning":"success"}function KB(e){return e.health.reachable?e.issues.some(t=>t.severity==="error")?"Degraded":e.issues.length>0?"Needs attention":"Healthy":"Broker unreachable"}function WB({issue:e}){const t=BB(e);return d.jsxs("article",{className:`sys-issue-card sys-issue-card-${t}`,children:[d.jsxs("div",{className:"sys-issue-head",children:[d.jsx("h3",{className:"sys-issue-title",children:e.title}),d.jsx("span",{className:`sys-chip sys-chip-${t==="error"?"failed":t}`,children:ZB(e)})]}),d.jsx("p",{className:"sys-issue-body",children:e.summary}),(e.action||e.actionCommand)&&d.jsxs("div",{className:"sys-issue-action",children:[e.actionCommand&&d.jsx("code",{className:"sys-code-inline",children:e.actionCommand}),e.action&&d.jsx("span",{children:e.action})]})]})}function JB({navigate:e}){const[t,s]=b.useState(null),[r,i]=b.useState(!0),[l,u]=b.useState(!1),[f,m]=b.useState(!1),[h,y]=b.useState(null),[v,x]=b.useState(null),[w,N]=b.useState(null),T=b.useRef(null),R=b.useRef(0);b.useEffect(()=>{T.current=t},[t]);const C=b.useCallback(async(P="initial")=>{const X=++R.current;!(T.current!==null)&&P!=="background"?(i(!0),x(null)):u(!0);try{const ee=await lt("/api/mesh");if(X!==R.current)return;s(ee),x(null),N(Date.now())}catch(ee){if(X!==R.current)return;x(ee instanceof Error?ee.message:String(ee))}finally{X===R.current&&(i(!1),u(!1))}},[]);b.useEffect(()=>{C("initial")},[C]),b.useEffect(()=>{const P=setInterval(()=>{C("background")},1e4);return()=>clearInterval(P)},[C]);const j=b.useCallback(async()=>{m(!0),y(null);try{const P=await lt("/api/mesh/announce",{method:"POST",body:"{}"});s(P),T.current=P,x(null),N(Date.now()),y({tone:P.identity.discoverable?"success":"warning",title:P.identity.discoverable?"Mesh updated.":"Mesh updated, but still needs attention.",message:P.identity.discoverable?"This broker is now announced to the mesh.":"Mesh visibility was updated, but this broker still is not peer-reachable."})}catch(P){y({tone:"warning",title:"Could not announce broker.",message:P instanceof Error?P.message:String(P)})}finally{m(!1)}},[]),E=t?XB(t):"warning",_=t?KB(t):"Loading",A=t?Object.values(t.nodes):[],M=t?.localNode?.id,O=t?.localNode?.hostName?.toLowerCase(),I=A.filter(P=>P.id!==M),Y=(t?.tailscale.peers??[]).filter(P=>{const X=P.hostName?.toLowerCase();return!X||X==="localhost"?!0:!(O&&(X===O||X.startsWith(`${O.split(".")[0]}.`)))}),F=t?t.issues.length>0?t.issues:t.warnings.map((P,X)=>({code:`fallback-${X}`,severity:"warning",title:"Mesh notice",summary:P,action:null,actionCommand:null})):[],B=b.useMemo(()=>t?[{label:"Broker",value:t.health.reachable?"Reachable":"Unavailable",detail:t.health.error??HB(t.brokerUrl)},{label:"Discoverable",value:t.identity.discoverable?"Yes":"No",detail:t.identity.modeLabel},{label:"Mesh peers",value:`${I.length}`,detail:I.length>0?"Remote brokers in this mesh":"No remote brokers discovered"},{label:"Tailnet",value:t.tailscale.available?`${Y.filter(P=>P.online).length}/${Y.length}`:"Unavailable",detail:t.tailscale.available?"Online peers / visible peers":"Tailscale peers not detected"}]:[],[Y,t,I.length]);return d.jsxs("div",{className:"sys-surface-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Mesh"}),d.jsx("p",{className:"sys-page-subtitle",children:"Who this broker is, whether peers can discover it, and what the current mesh can see."})]}),d.jsxs("div",{className:"sys-page-actions",children:[d.jsx("span",{className:`sys-chip sys-chip-${E}`,children:_}),d.jsx("div",{className:"sys-sync-note",children:r?"Loading system snapshot...":v&&t?`Showing last confirmed snapshot from ${w?st(w):"earlier"}`:w?`Confirmed ${st(w)}`:"Waiting for first snapshot"}),d.jsx("button",{type:"button",className:"s-btn",disabled:r||l,onClick:()=>{C("manual")},children:l?"Refreshing...":"Refresh"})]})]}),v&&t&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Mesh refresh failed."}),d.jsx("span",{children:v})]}),r&&!t&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading mesh status"}),d.jsx("p",{className:"sys-state-body",children:"Inspecting broker reachability and peer discovery inputs."})]}),!r&&!t&&v&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Mesh status is unavailable"}),d.jsx("p",{className:"sys-state-body",children:v}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{C("manual")},children:"Try again"})})]}),t&&d.jsxs(d.Fragment,{children:[d.jsxs("section",{className:"sys-panel sys-mesh-identity",children:[d.jsxs("div",{className:"sys-section-head",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"This broker"}),d.jsx("p",{className:"sys-section-subtitle",children:"The identity peers will learn if they discover this machine."})]}),d.jsx("span",{className:`sys-chip sys-chip-${YB(t)}`,children:GB(t)})]}),d.jsxs("div",{className:"sys-detail-grid",children:[d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Who Am I"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.name??t.localNode?.name??"Unavailable"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Node ID"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.nodeId??"Unavailable"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Mesh"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.meshId??"Unassigned"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Mode"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.modeLabel})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Discoverable"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.discoverable?"Yes":"No"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Announced As"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.announceUrl??"Not announced"})]})]}),d.jsxs("div",{className:`sys-banner ${t.identity.discoverable?"sys-banner-success":"sys-banner-muted"}`,children:[d.jsx("strong",{children:"How peers find you."}),d.jsx("span",{children:t.identity.discoveryDetail})]}),!t.identity.discoverable&&t.health.reachable&&d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",disabled:f,onClick:()=>{j()},children:f?"Announcing...":"Announce on mesh"})}),h&&d.jsxs("div",{className:`sys-banner ${h.tone==="success"?"sys-banner-success":"sys-banner-warning"}`,children:[d.jsx("strong",{children:h.title}),d.jsx("span",{children:h.message})]})]}),d.jsx("div",{className:"sys-stat-grid",children:B.map(P=>d.jsxs("div",{className:"sys-stat-card",children:[d.jsx("span",{className:"sys-stat-label",children:P.label}),d.jsx("strong",{className:"sys-stat-value",children:P.value}),d.jsx("span",{className:"sys-stat-detail",children:P.detail})]},P.label))}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Health notices"}),d.jsx("p",{className:"sys-section-subtitle",children:"Warnings and errors from the current broker and discovery snapshot."})]})}),F.length>0?d.jsx("div",{className:"sys-issue-grid",children:F.map((P,X)=>d.jsx(WB,{issue:P},`${P.code}-${X}`))}):d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No active mesh warnings"}),d.jsx("p",{children:"The broker is reachable and discovery inputs look healthy from this page."})]})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Topology"}),d.jsx("p",{className:"sys-section-subtitle",children:"Current broker relationships plus visible tailnet peers from this machine."})]})}),t.localNode?d.jsx(VB,{mesh:t}):d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"Topology unavailable"}),d.jsx("p",{children:"A local node record is required before the topology view can render."})]})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Discovered peers"}),d.jsxs("p",{className:"sys-section-subtitle",children:["Remote brokers registered in ",t.meshId??"this mesh","."]})]})}),I.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No remote brokers discovered"}),d.jsx("p",{children:"This can be normal on a single-node setup. If you expect peers, check the health notices above."})]}):d.jsx("div",{className:"sys-list-grid",children:I.map(P=>d.jsxs("article",{className:"sys-list-card",children:[d.jsxs("div",{className:"sys-list-card-head",children:[d.jsx("h3",{className:"sys-list-card-title",children:P.name}),d.jsx("span",{className:`sys-chip sys-chip-${P.advertiseScope==="mesh"?"success":"neutral"}`,children:qB(P.advertiseScope)})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Node id"}),d.jsx("code",{className:"sys-detail-value",children:P.id})]}),P.brokerUrl&&d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Broker"}),d.jsx("code",{className:"sys-detail-value",children:P.brokerUrl})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Last seen"}),d.jsx("span",{className:"sys-detail-value",children:P.lastSeenAt?st(P.lastSeenAt):"Recently registered"})]})]},P.id))})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Tailnet"}),d.jsx("p",{className:"sys-section-subtitle",children:"External Tailscale peers visible from this machine."})]})}),Y.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No external tailnet peers"}),d.jsx("p",{children:t.tailscale.available?"Only this host is visible in the current tailnet snapshot.":"Tailscale peers were not detected on this machine."})]}):d.jsx("div",{className:"sys-list-grid",children:Y.map(P=>d.jsxs("article",{className:"sys-list-card",children:[d.jsxs("div",{className:"sys-list-card-head",children:[d.jsx("h3",{className:"sys-list-card-title",children:FB(P)}),d.jsx("span",{className:`sys-chip sys-chip-${P.online?"success":"failed"}`,children:P.online?"Online":"Offline"})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Address"}),d.jsx("code",{className:"sys-detail-value",children:P.addresses?.[0]??"Unavailable"})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Platform"}),d.jsx("span",{className:"sys-detail-value",children:P.os??"Unknown"})]})]},P.id))})]})]})]})}const QB=[[/```[\s\S]*?```/g," "],[/`([^`]+)`/g,"$1"],[/!\[([^\]]*)\]\([^)]+\)/g,"$1"],[/\[([^\]]+)\]\([^)]+\)/g,"$1"],[/\*\*(.+?)\*\*/g,"$1"],[/__(.+?)__/g,"$1"],[new RegExp("(?<!\\*)\\*(?!\\*)([^*\\n]+)\\*(?!\\*)","g"),"$1"],[new RegExp("(?<!_)_(?!_)([^_\\n]+)_(?!_)","g"),"$1"],[/~~(.+?)~~/g,"$1"],[/^#{1,6}\s+/gm,""],[/^>\s?/gm,""],[/^[-*+]\s+/gm,""],[/^\d+\.\s+/gm,""],[/^---+\s*$/gm,""],[/^\s*\|.*\|\s*$/gm,""]];function e7(e,t=140){if(!e)return"";let s=e;for(const[r,i]of QB)s=s.replace(r,i);return s=s.replace(/\s+/g," ").trim(),s.length>t&&(s=`${s.slice(0,t-1)}…`),s}const _C="scout:sessions:lastViewed";function kC(){if(typeof localStorage>"u")return{};try{const e=localStorage.getItem(_C);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function t7(e,t=Date.now()){const s=kC();s[e]=t;try{localStorage.setItem(_C,JSON.stringify(s))}catch{}return s}function Qp(e,t,s){return e?e>(s[t]??0):!1}const SS={direct:"DM",channel:"Channel",group_direct:"Group",thread:"Thread"},n7=new Set(["all","direct","channel","group_direct","thread"]);function tg(e){return typeof window>"u"?"":new URLSearchParams(window.location.search).get(e)??""}function s7(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);for(const[r,i]of Object.entries(e))i===null||i===""?t.delete(r):t.set(r,i);const s=t.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:""))}function a7(){const e=tg("view");return n7.has(e)?e:"all"}function r7(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function i7(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function o7(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"";const t=e<1e12?e*1e3:e;return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function l7({navigate:e}){const[t,s]=b.useState([]),[r,i]=b.useState(()=>a7()),[l,u]=b.useState(()=>tg("q")),[f,m]=b.useState(()=>tg("unread")==="1"),[h,y]=b.useState(()=>kC()),[v,x]=b.useState(0),[w,N]=b.useState(null),T=b.useRef(null),R=b.useRef(null),C=po(),j=b.useCallback(async()=>{N(null);try{const B=await lt("/api/sessions");s(B.sort((P,X)=>(X.lastMessageAt??0)-(P.lastMessageAt??0)))}catch(B){N(B instanceof Error?B.message:String(B))}},[]);b.useEffect(()=>{j()},[j]),Kn(j);const[,E]=b.useState(0);b.useEffect(()=>{const B=setInterval(()=>E(P=>P+1),15e3);return()=>clearInterval(B)},[]),b.useEffect(()=>{s7({view:r==="all"?null:r,q:l.trim()||null,unread:f?"1":null})},[r,l,f]);const _=b.useMemo(()=>Array.from(new Set(t.map(B=>B.kind))),[t]),A=b.useMemo(()=>{const B={all:t.length};for(const P of t)B[P.kind]=(B[P.kind]??0)+1;return B},[t]),M=b.useMemo(()=>t.filter(B=>Qp(B.lastMessageAt,B.id,h)).length,[t,h]),O=b.useMemo(()=>{const B=l.trim().toLowerCase();return t.filter(P=>!(r!=="all"&&P.kind!==r||f&&!Qp(P.lastMessageAt,P.id,h)||B&&![P.title,P.preview,P.agentName??"",P.harness??"",...P.participantIds].join(" ").toLowerCase().includes(B)))},[t,r,f,h,l]);b.useEffect(()=>{v>=O.length&&x(Math.max(0,O.length-1))},[O.length,v]);const I=b.useCallback(B=>{y(t7(B.id)),e({view:"conversation",conversationId:B.id})},[e]);b.useEffect(()=>{function B(P){const X=P.target,ie=X instanceof HTMLInputElement||X instanceof HTMLTextAreaElement||X instanceof HTMLElement&&X.isContentEditable;if((P.metaKey||P.ctrlKey)&&P.key.toLowerCase()==="k"){P.preventDefault(),T.current?.focus(),T.current?.select();return}if(ie){P.key==="Escape"&&X===T.current&&T.current?.blur();return}if(P.key==="/"){P.preventDefault(),T.current?.focus();return}if(P.key==="j"||P.key==="ArrowDown"){P.preventDefault(),x(ee=>Math.min(O.length-1,ee+1));return}if(P.key==="k"||P.key==="ArrowUp"){P.preventDefault(),x(ee=>Math.max(0,ee-1));return}if(P.key==="Enter"||P.key==="o"){const ee=O[v];ee&&(P.preventDefault(),I(ee))}}return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[O,v,I]),b.useEffect(()=>{R.current?.querySelector(`[data-idx="${v}"]`)?.scrollIntoView({block:"nearest"})},[v]);const Y=_.length>1,F=f?M>0?`${M} unread threads need attention.`:"No unread threads right now.":O.length===t.length?"Recent activity across every conversation.":`${O.length} conversations match the current filters.`;return d.jsxs("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:[d.jsx("section",{className:"s-thread-overview",children:d.jsxs("div",{className:"s-thread-overview-copy",children:[d.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[d.jsx("h2",{className:"s-page-title",children:"Sessions"}),d.jsxs("span",{className:"s-meta s-tabular",children:[O.length," of ",t.length]})]}),d.jsx("p",{className:"s-thread-overview-summary",children:F})]})}),d.jsxs("section",{className:"s-thread-panel s-thread-panel-list",children:[d.jsxs("div",{className:"s-sessions-toolbar",children:[Y&&d.jsxs("div",{className:"s-seg",role:"tablist","aria-label":"Session kind",children:[d.jsx(ES,{label:"All",count:A.all,pressed:r==="all",onClick:()=>i("all")}),_.map(B=>d.jsx(ES,{label:SS[B]??B,count:A[B]??0,pressed:r===B,onClick:()=>i(B)},B))]}),d.jsxs("button",{type:"button",className:`s-seg-standalone${f?" is-on":""}`,onClick:()=>m(B=>!B),"aria-pressed":f,title:"Show unread only",children:[d.jsx("span",{className:"s-dot s-dot-sm","aria-hidden":"true"}),d.jsx("span",{children:"Unread"}),M>0&&d.jsx("span",{className:"s-seg-count",children:M})]}),d.jsxs("div",{className:"s-search",children:[d.jsx("input",{ref:T,type:"text",className:"s-search-input",placeholder:"Search conversations…",value:l,onChange:B=>u(B.target.value),onKeyDown:B=>{B.key==="Escape"&&(l?u(""):B.target.blur())}}),d.jsx("kbd",{className:"s-search-kbd",children:"⌘K"})]})]}),w&&d.jsx("p",{className:"s-error",children:w}),O.length===0?d.jsxs("div",{className:"s-empty s-thread-empty-state",children:[d.jsx("p",{children:l||f?"No matches":"No conversations"}),d.jsx("p",{children:l?"Try a different search term.":f?"You're all caught up.":"Conversations appear here when agents communicate."})]}):d.jsx("div",{className:"s-inbox",ref:R,role:"listbox","aria-label":"Sessions",children:O.map((B,P)=>{const X=r7(B),ie=(B.agentName??X)[0]?.toUpperCase()??"?",ee=Qp(B.lastMessageAt,B.id,h),z=P===v,H=e7(B.preview,160),U=SS[B.kind]??B.kind,ne=i7(B.workspaceRoot);return d.jsxs("div",{"data-idx":P,"data-unread":ee?"true":"false","data-selected":z?"true":"false",className:"s-inbox-row",role:"option","aria-selected":z,tabIndex:z?0:-1,onClick:()=>{RC(()=>{x(P),I(B)})},onMouseEnter:()=>x(P),onContextMenu:G=>{const D=window.getSelection()?.toString().trim(),$=[];D&&($.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(D)}),$.push({kind:"separator"})),$.push({kind:"action",label:"Open Conversation",onSelect:()=>I(B)}),$.push({kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(X)}),B.id&&$.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(B.id)}),C(G,$)},children:[d.jsxs("div",{className:"s-session-avatar-wrap",children:[d.jsx("div",{className:"s-avatar",style:{background:Ts(B.agentName??X)},"aria-hidden":"true",children:ie}),ee&&d.jsx("span",{className:"s-session-unread-dot","aria-hidden":"true"})]}),d.jsxs("div",{className:"s-inbox-body",children:[d.jsxs("div",{className:"s-inbox-header",children:[d.jsx("div",{className:"s-session-heading",children:d.jsx("span",{className:"s-inbox-name",title:X,children:X})}),d.jsx("div",{className:"s-session-trailing",children:B.lastMessageAt&&d.jsx("span",{className:"s-inbox-time s-tabular",title:o7(B.lastMessageAt),children:st(B.lastMessageAt)})})]}),H?d.jsx("p",{className:"s-inbox-preview",children:H}):d.jsx("p",{className:"s-inbox-preview s-inbox-preview-empty",children:"No messages yet"}),d.jsxs("div",{className:"s-session-meta-row","aria-label":"Conversation details",children:[d.jsx("span",{className:"s-session-pill",children:U}),ne&&d.jsx("span",{className:"s-session-pill",title:B.workspaceRoot??void 0,children:ne}),B.currentBranch&&d.jsx("span",{className:"s-session-pill",title:B.currentBranch,children:B.currentBranch})]})]})]},B.id)})})]})]})}function ES({label:e,count:t,pressed:s,onClick:r}){return d.jsxs("button",{type:"button",className:"s-seg-btn","aria-pressed":s,onClick:r,children:[d.jsx("span",{children:e}),d.jsx("span",{className:"s-seg-count",children:t})]})}var Mr=(e=>(e[e.Border=-1]="Border",e[e.Data=0]="Data",e[e.Function=1]="Function",e[e.Position=2]="Position",e[e.Timing=3]="Timing",e[e.Alignment=4]="Alignment",e))(Mr||{});const c7=[0,1],MC=[1,0],OC=[2,3],DC=[3,2],u7={L:c7,M:MC,Q:OC,H:DC},d7=/^\d*$/,f7=/^[A-Z0-9 $%*+./:-]*$/,em="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",dy=1,fy=40,NS=3,h7=3,Ou=40,p7=10,zC=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],IC=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class m7{constructor(t,s,r,i){if(this.version=t,this.ecc=s,t<dy||t>fy)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const l=Array.from({length:this.size}).fill(!1);for(let f=0;f<this.size;f++)this.modules.push(l.slice()),this.types.push(l.map(()=>0));this.drawFunctionPatterns();const u=this.addEccAndInterleave(r);if(this.drawCodewords(u),i===-1){let f=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const h=this.getPenaltyScore();h<f&&(i=m,f=h),this.applyMask(m)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}size;mask;modules=[];types=[];getModule(t,s){return t>=0&&t<this.size&&s>=0&&s<this.size&&this.modules[s][t]}drawFunctionPatterns(){for(let r=0;r<this.size;r++)this.setFunctionModule(6,r,r%2===0,Mr.Timing),this.setFunctionModule(r,6,r%2===0,Mr.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),s=t.length;for(let r=0;r<s;r++)for(let i=0;i<s;i++)r===0&&i===0||r===0&&i===s-1||r===s-1&&i===0||this.drawAlignmentPattern(t[r],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const s=this.ecc[1]<<3|t;let r=s;for(let l=0;l<10;l++)r=r<<1^(r>>>9)*1335;const i=(s<<10|r)^21522;for(let l=0;l<=5;l++)this.setFunctionModule(8,l,ca(i,l));this.setFunctionModule(8,7,ca(i,6)),this.setFunctionModule(8,8,ca(i,7)),this.setFunctionModule(7,8,ca(i,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,ca(i,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,ca(i,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,ca(i,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let r=0;r<12;r++)t=t<<1^(t>>>11)*7973;const s=this.version<<12|t;for(let r=0;r<18;r++){const i=ca(s,r),l=this.size-11+r%3,u=Math.floor(r/3);this.setFunctionModule(l,u,i),this.setFunctionModule(u,l,i)}}drawFinderPattern(t,s){for(let r=-4;r<=4;r++)for(let i=-4;i<=4;i++){const l=Math.max(Math.abs(i),Math.abs(r)),u=t+i,f=s+r;u>=0&&u<this.size&&f>=0&&f<this.size&&this.setFunctionModule(u,f,l!==2&&l!==4,Mr.Position)}}drawAlignmentPattern(t,s){for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,s+r,Math.max(Math.abs(i),Math.abs(r))!==1,Mr.Alignment)}setFunctionModule(t,s,r,i=Mr.Function){this.modules[s][t]=r,this.types[s][t]=i}addEccAndInterleave(t){const s=this.version,r=this.ecc;if(t.length!==Qu(s,r))throw new RangeError("Invalid argument");const i=IC[r[0]][s],l=zC[r[0]][s],u=Math.floor(ng(s)/8),f=i-u%i,m=Math.floor(u/i),h=[],y=N7(l);for(let x=0,w=0;x<i;x++){const N=t.slice(w,w+m-l+(x<f?0:1));w+=N.length;const T=T7(N,y);x<f&&N.push(0),h.push(N.concat(T))}const v=[];for(let x=0;x<h[0].length;x++)h.forEach((w,N)=>{(x!==m-l||N>=f)&&v.push(w[x])});return v}drawCodewords(t){if(t.length!==Math.floor(ng(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let r=this.size-1;r>=1;r-=2){r===6&&(r=5);for(let i=0;i<this.size;i++)for(let l=0;l<2;l++){const u=r-l,m=(r+1&2)===0?this.size-1-i:i;!this.types[m][u]&&s<t.length*8&&(this.modules[m][u]=ca(t[s>>>3],7-(s&7)),s++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let r=0;r<this.size;r++){let i;switch(t){case 0:i=(r+s)%2===0;break;case 1:i=s%2===0;break;case 2:i=r%3===0;break;case 3:i=(r+s)%3===0;break;case 4:i=(Math.floor(r/3)+Math.floor(s/2))%2===0;break;case 5:i=r*s%2+r*s%3===0;break;case 6:i=(r*s%2+r*s%3)%2===0;break;case 7:i=((r+s)%2+r*s%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[s][r]&&i&&(this.modules[s][r]=!this.modules[s][r])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let u=!1,f=0;const m=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[l][h]===u?(f++,f===5?t+=NS:f>5&&t++):(this.finderPenaltyAddHistory(f,m),u||(t+=this.finderPenaltyCountPatterns(m)*Ou),u=this.modules[l][h],f=1);t+=this.finderPenaltyTerminateAndCount(u,f,m)*Ou}for(let l=0;l<this.size;l++){let u=!1,f=0;const m=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][l]===u?(f++,f===5?t+=NS:f>5&&t++):(this.finderPenaltyAddHistory(f,m),u||(t+=this.finderPenaltyCountPatterns(m)*Ou),u=this.modules[h][l],f=1);t+=this.finderPenaltyTerminateAndCount(u,f,m)*Ou}for(let l=0;l<this.size-1;l++)for(let u=0;u<this.size-1;u++){const f=this.modules[l][u];f===this.modules[l][u+1]&&f===this.modules[l+1][u]&&f===this.modules[l+1][u+1]&&(t+=h7)}let s=0;for(const l of this.modules)s=l.reduce((u,f)=>u+(f?1:0),s);const r=this.size*this.size,i=Math.ceil(Math.abs(s*20-r*10)/r)-1;return t+=i*p7,t}getAlignmentPatternPositions(){if(this.version===1)return[];{const t=Math.floor(this.version/7)+2,s=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,r=[6];for(let i=this.size-7;r.length<t;i-=s)r.splice(1,0,i);return r}}finderPenaltyCountPatterns(t){const s=t[1],r=s>0&&t[2]===s&&t[3]===s*3&&t[4]===s&&t[5]===s;return(r&&t[0]>=s*4&&t[6]>=s?1:0)+(r&&t[6]>=s*4&&t[0]>=s?1:0)}finderPenaltyTerminateAndCount(t,s,r){return t&&(this.finderPenaltyAddHistory(s,r),s=0),s+=this.size,this.finderPenaltyAddHistory(s,r),this.finderPenaltyCountPatterns(r)}finderPenaltyAddHistory(t,s){s[0]===0&&(t+=this.size),s.pop(),s.unshift(t)}}function da(e,t,s){if(t<0||t>31||e>>>t)throw new RangeError("Value out of range");for(let r=t-1;r>=0;r--)s.push(e>>>r&1)}function ca(e,t){return(e>>>t&1)!==0}class hy{constructor(t,s,r){if(this.mode=t,this.numChars=s,this.bitData=r,s<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}getData(){return this.bitData.slice()}}const g7=[1,10,12,14],y7=[2,9,11,13],v7=[4,8,16,16];function LC(e,t){return e[Math.floor((t+7)/17)+1]}function PC(e){const t=[];for(const s of e)da(s,8,t);return new hy(v7,e.length,t)}function b7(e){if(!$C(e))throw new RangeError("String contains non-numeric characters");const t=[];for(let s=0;s<e.length;){const r=Math.min(e.length-s,3);da(Number.parseInt(e.substring(s,s+r),10),r*3+1,t),s+=r}return new hy(g7,e.length,t)}function x7(e){if(!UC(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let s;for(s=0;s+2<=e.length;s+=2){let r=em.indexOf(e.charAt(s))*45;r+=em.indexOf(e.charAt(s+1)),da(r,11,t)}return s<e.length&&da(em.indexOf(e.charAt(s)),6,t),new hy(y7,e.length,t)}function w7(e){return e===""?[]:$C(e)?[b7(e)]:UC(e)?[x7(e)]:[PC(E7(e))]}function $C(e){return d7.test(e)}function UC(e){return f7.test(e)}function S7(e,t){let s=0;for(const r of e){const i=LC(r.mode,t);if(r.numChars>=1<<i)return Number.POSITIVE_INFINITY;s+=4+i+r.bitData.length}return s}function E7(e){e=encodeURI(e);const t=[];for(let s=0;s<e.length;s++)e.charAt(s)!=="%"?t.push(e.charCodeAt(s)):(t.push(Number.parseInt(e.substring(s+1,s+3),16)),s+=2);return t}function ng(e){if(e<dy||e>fy)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const s=Math.floor(e/7)+2;t-=(25*s-10)*s-55,e>=7&&(t-=36)}return t}function Qu(e,t){return Math.floor(ng(e)/8)-zC[t[0]][e]*IC[t[0]][e]}function N7(e){if(e<1||e>255)throw new RangeError("Degree out of range");const t=[];for(let r=0;r<e-1;r++)t.push(0);t.push(1);let s=1;for(let r=0;r<e;r++){for(let i=0;i<t.length;i++)t[i]=sg(t[i],s),i+1<t.length&&(t[i]^=t[i+1]);s=sg(s,2)}return t}function T7(e,t){const s=t.map(r=>0);for(const r of e){const i=r^s.shift();s.push(0),t.forEach((l,u)=>s[u]^=sg(l,i))}return s}function sg(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let s=0;for(let r=7;r>=0;r--)s=s<<1^(s>>>7)*285,s^=(t>>>r&1)*e;return s}function j7(e,t,s=1,r=40,i=-1,l=!0){if(!(dy<=s&&s<=r&&r<=fy)||i<-1||i>7)throw new RangeError("Invalid value");let u,f;for(u=s;;u++){const v=Qu(u,t)*8,x=S7(e,u);if(x<=v){f=x;break}if(u>=r)throw new RangeError("Data too long")}for(const v of[MC,OC,DC])l&&f<=Qu(u,v)*8&&(t=v);const m=[];for(const v of e){da(v.mode[0],4,m),da(v.numChars,LC(v.mode,u),m);for(const x of v.getData())m.push(x)}const h=Qu(u,t)*8;da(0,Math.min(4,h-m.length),m),da(0,(8-m.length%8)%8,m);for(let v=236;m.length<h;v^=253)da(v,8,m);const y=Array.from({length:Math.ceil(m.length/8)},()=>0);return m.forEach((v,x)=>y[x>>>3]|=v<<7-(x&7)),new m7(u,t,y,i)}function C7(e,t){const{ecc:s="L",boostEcc:r=!1,minVersion:i=1,maxVersion:l=40,maskPattern:u=-1,border:f=1}=t||{},m=typeof e=="string"?w7(e):Array.isArray(e)?[PC(e)]:void 0;if(!m)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);const h=j7(m,u7[s],i,l,u,r),y=A7({version:h.version,maskPattern:h.mask,size:h.size,data:h.modules,types:h.types},f);return t?.invert&&(y.data=y.data.map(v=>v.map(x=>!x))),t?.onEncoded?.(y),y}function A7(e,t=1){if(!t)return e;const{size:s}=e,r=s+t*2;e.size=r,e.data.forEach(l=>{for(let u=0;u<t;u++)l.unshift(!1),l.push(!1)});for(let l=0;l<t;l++)e.data.unshift(Array.from({length:r},u=>!1)),e.data.push(Array.from({length:r},u=>!1));const i=Mr.Border;e.types.forEach(l=>{for(let u=0;u<t;u++)l.unshift(i),l.push(i)});for(let l=0;l<t;l++)e.types.unshift(Array.from({length:r},u=>i)),e.types.push(Array.from({length:r},u=>i));return e}function TS(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R7(e,t={}){const s=C7(e,t),{pixelSize:r=10,whiteColor:i="white",blackColor:l="black"}=t,u=s.size*r,f=s.size*r;let m=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${f} ${u}">`;const h=[];for(let y=0;y<s.size;y++)for(let v=0;v<s.size;v++){const x=v*r,w=y*r;s.data[y][v]&&h.push(`M${x},${w}h${r}v${r}h-${r}z`)}return m+=`<rect fill="${TS(i)}" width="${f}" height="${u}"/>`,m+=`<path fill="${TS(l)}" d="${h.join("")}"/>`,m+="</svg>",m}function _7(e){return e?e.replace(/^wss?:\/\//,"").replace(/:\d+$/,""):null}function jS(e){return e?e.length<=18?e:`${e.slice(0,10)}...${e.slice(-6)}`:null}function k7(e){return e?e.status==="paired"||e.status==="connected"?"success":e.status==="error"||e.status==="closed"?"danger":"warning":"warning"}function M7(e,t){if(!e)return null;const s=Math.max(0,Math.floor((e-t)/1e3));if(s===0)return null;if(s<60)return`${s}s`;const r=Math.floor(s/60),i=s%60;return i>0?`${r}m ${i}s`:`${r}m`}function CS({value:e}){const[t,s]=b.useState(!1),r=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[e]);return d.jsx("button",{type:"button",className:"sys-copy-btn",onClick:r,title:"Copy",children:t?d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("polyline",{points:"20 6 9 17 4 12"})}):d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}function O7({navigate:e}){const[t,s]=b.useState(null),[r,i]=b.useState(""),[l,u]=b.useState(""),[f,m]=b.useState(!0),[h,y]=b.useState(!1),[v,x]=b.useState(!1),[w,N]=b.useState(null),[T,R]=b.useState(null),[C,j]=b.useState(null),[E,_]=b.useState(null),[A,M]=b.useState(()=>Date.now()),[O,I]=b.useState(null),Y=b.useRef(null),F=b.useRef(0),B=b.useRef(null);b.useEffect(()=>{Y.current=t},[t]),b.useEffect(()=>{B.current=w},[w]);const P=b.useCallback(async(se="initial")=>{if(se==="background"&&B.current)return;const ge=++F.current;!(Y.current!==null)&&se!=="background"?(m(!0),R(null)):y(!0);try{const pe=await lt(se==="manual"?"/api/pairing-state/refresh":"/api/pairing-state");if(ge!==F.current)return;s(pe),R(null),_(Date.now())}catch(pe){if(ge!==F.current)return;R(pe instanceof Error?pe.message:String(pe))}finally{ge===F.current&&(m(!1),y(!1))}},[]),X=b.useCallback(async()=>{try{const se=await lt("/api/user");u(se.name),i(se.name),j(null)}catch(se){j(se instanceof Error?se.message:String(se))}},[]);b.useEffect(()=>{P("initial"),X()},[P,X]),b.useEffect(()=>{const se=setInterval(()=>{P("background")},1e4);return()=>clearInterval(se)},[P]),b.useEffect(()=>{if(!t?.pairing?.expiresAt)return;M(Date.now());const se=setInterval(()=>{M(Date.now())},1e3);return()=>clearInterval(se)},[t?.pairing?.expiresAt]);const ie=b.useCallback(async()=>{x(!0),j(null);try{const se=await lt("/api/user",{method:"POST",body:JSON.stringify({name:r})});u(se.name),i(se.name)}catch(se){j(se instanceof Error?se.message:String(se))}finally{x(!1)}},[r]),ee=b.useCallback(async se=>{const ge=++F.current;N(se),R(null);try{const he=await lt("/api/pairing/control",{method:"POST",body:JSON.stringify({action:se})});if(ge!==F.current)return;s(he),_(Date.now())}catch(he){if(ge!==F.current)return;R(he instanceof Error?he.message:String(he))}finally{ge===F.current&&N(null)}},[]),z=b.useCallback(async se=>{I(se);try{await lt(`/api/pairing/peers/${encodeURIComponent(se)}`,{method:"DELETE"}),P("manual")}catch{}finally{I(null)}},[P]),H=b.useMemo(()=>{const se=t?.pairing?.qrValue?.trim();return se?R7(se,{border:2,ecc:"M",pixelSize:8}):null},[t?.pairing?.qrValue]),U=_7(t?.pairing?.relay??t?.relay??null),ne=M7(t?.pairing?.expiresAt,A),D=(t?.trustedPeers.find(se=>se.fingerprint===t.connectedPeerFingerprint)??null)?.name??jS(t?.connectedPeerFingerprint??null),$=k7(t),J=r.trim()!==l,re=!f&&!t&&!!T;return d.jsxs("div",{className:"sys-surface-page sys-settings-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Settings"}),d.jsx("p",{className:"sys-page-subtitle",children:"Identity, pairing, and trusted devices."})]}),d.jsxs("div",{className:"sys-page-actions",children:[t&&d.jsx("span",{className:`sys-chip sys-chip-${$}`,children:t.statusLabel}),d.jsx("div",{className:"sys-sync-note",children:f?"Loading...":T&&t?`Snapshot from ${E?st(E):"earlier"}`:E?`Updated ${st(E)}`:""}),d.jsx("button",{type:"button",className:"s-btn",disabled:f||h||!!w,onClick:()=>{P("manual")},children:h?"Refreshing...":"Refresh"})]})]}),T&&t&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Refresh failed."}),d.jsx("span",{children:T})]}),C&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Identity error."}),d.jsx("span",{children:C})]}),f&&!t&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading settings"}),d.jsx("p",{className:"sys-state-body",children:"Checking relay status and trusted peers."})]}),re&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Pairing unavailable"}),d.jsx("p",{className:"sys-state-body",children:T}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{P("manual")},children:"Try again"})})]}),d.jsxs("div",{className:"sys-settings-hero",children:[d.jsx("div",{className:"sys-settings-qr-col",children:H?d.jsxs("div",{className:"sys-settings-qr-frame",children:[d.jsx("div",{className:"s-qr",dangerouslySetInnerHTML:{__html:H}}),ne&&d.jsxs("span",{className:"sys-settings-qr-expires",children:["Expires in ",ne]})]}):d.jsx("div",{className:"sys-settings-qr-empty",children:d.jsx("span",{className:"sys-settings-qr-empty-label",children:t?.isRunning?"Waiting for QR...":"Start pairing to generate QR"})})}),d.jsxs("div",{className:"sys-settings-info-col",children:[d.jsxs("div",{className:"sys-input-row",children:[d.jsx("input",{className:"sys-input",type:"text",placeholder:"Your name",value:r,onChange:se=>i(se.target.value),onKeyDown:se=>{se.key==="Enter"&&J&&!v&&ie()}}),d.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!J||v,onClick:()=>{ie()},children:v?"Saving...":"Save"})]}),d.jsxs("div",{className:"sys-settings-kv-list",children:[t?.identityFingerprint&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Fingerprint"}),d.jsxs("span",{className:"sys-settings-kv-value",children:[d.jsx("code",{children:t.identityFingerprint}),d.jsx(CS,{value:t.identityFingerprint})]})]}),U&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Relay"}),d.jsxs("span",{className:"sys-settings-kv-value",children:[d.jsx("code",{children:U}),d.jsx(CS,{value:U})]})]}),t?.statusDetail&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Status"}),d.jsx("span",{className:"sys-settings-kv-value sys-settings-kv-nowrap",children:t.statusDetail})]}),D&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Connected"}),d.jsx("span",{className:"sys-settings-kv-value",children:D})]}),t?.secure&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Security"}),d.jsx("span",{className:"sys-settings-kv-value",children:d.jsx("span",{className:"sys-chip sys-chip-success",style:{margin:0},children:"Noise XX"})})]})]}),t&&d.jsx("div",{className:"sys-inline-actions sys-settings-controls",children:t.isRunning?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("restart")},children:w==="restart"?"Restarting...":"Restart"}),d.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("stop")},children:w==="stop"?"Stopping...":"Stop"})]}):d.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!!w,onClick:()=>{ee("start")},children:w==="start"?"Starting...":"Start pairing"})})]})]}),t&&d.jsxs("section",{className:"sys-settings-peers",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Trusted peers"}),d.jsxs("p",{className:"sys-section-subtitle",children:[t.trustedPeers.length," device",t.trustedPeers.length!==1?"s":""," paired with this broker."]})]})}),t.trustedPeers.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No trusted peers"}),d.jsx("p",{children:"Devices appear here after completing pairing."})]}):d.jsxs("table",{className:"sys-peers-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Device"}),d.jsx("th",{children:"Fingerprint"}),d.jsx("th",{children:"Paired"}),d.jsx("th",{children:"Last seen"}),d.jsx("th",{})]})}),d.jsx("tbody",{children:t.trustedPeers.map(se=>{const ge=se.fingerprint===t.connectedPeerFingerprint;return d.jsxs("tr",{className:ge?"sys-peers-row-connected":"",children:[d.jsx("td",{children:d.jsxs("span",{className:"sys-peers-name",children:[se.name??jS(se.fingerprint)??"Peer",ge&&d.jsx("span",{className:"sys-chip sys-chip-success sys-peers-badge",children:"Connected"})]})}),d.jsx("td",{children:d.jsx("code",{className:"sys-peers-fp",children:se.fingerprint})}),d.jsx("td",{children:se.pairedAtLabel??"—"}),d.jsx("td",{children:se.lastSeenLabel??"—"}),d.jsx("td",{children:d.jsx("button",{type:"button",className:"sys-peers-remove",disabled:O===se.fingerprint,onClick:()=>{z(se.fingerprint)},title:"Remove peer",children:O===se.fingerprint?"...":"Remove"})})]},se.fingerprint)})})]})]})]})}function D7(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function tm(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function z7(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function I7(e){switch(e.kind){case"flight_started":return"flight started";case"flight_completed":return e.detailKind?`flight ${e.detailKind}`:"flight ended";case"message":return"message";default:return e.title??e.detailKind??"event"}}function AS(e){return e.kind==="message"?"message":e.kind==="flight_started"?"flight":e.kind==="flight_completed"?e.detailKind?.includes("fail")?"alert":"done":e.detailKind?.includes("interrupt")||e.detailKind?.includes("block")?"alert":"system"}function nm({title:e,items:t}){return t.length===0?null:d.jsxs("section",{className:"s-work-fact-card",children:[d.jsx("div",{className:"s-work-fact-card-header",children:d.jsx("div",{className:"s-work-fact-card-title",children:e})}),d.jsx("div",{className:"s-work-fact-card-body",children:t.map(s=>d.jsxs("div",{className:"s-work-fact-row",children:[d.jsx("span",{className:"s-work-fact-label",children:s.label}),d.jsx("span",{className:"s-work-fact-value",children:s.value})]},s.label))})]})}function RS({label:e,value:t,onClick:s}){return d.jsxs("button",{type:"button",className:"s-work-action-row",onClick:s,children:[d.jsx("span",{className:"s-work-action-row-label",children:e}),d.jsx("span",{className:"s-work-action-row-value",children:t})]})}function L7(e){const t=e.split(".");return t[t.length-1]||e}function P7({workId:e,navigate:t}){const[s,r]=b.useState(null),[i,l]=b.useState(null),[u,f]=b.useState(!1),m=b.useCallback(async()=>{l(null);try{const T=await lt(`/api/work/${encodeURIComponent(e)}`);r(T)}catch(T){l(T instanceof Error?T.message:String(T)),r(null)}finally{f(!0)}},[e]);if(b.useEffect(()=>{f(!1),m()},[m]),Kn(m),!u)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Loading…"})})]});if(!s)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),i&&d.jsx("p",{className:"s-error",children:i}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Work item not found"})})]});const h=z7(s.attention),y=s.ownerName??s.ownerId??"Unassigned",v=s.nextMoveOwnerName??s.nextMoveOwnerId??"—",x=[{label:"State",value:tm(s.state)},{label:"Acceptance",value:s.acceptanceState.replace(/_/g," ")},{label:"Phase",value:s.currentPhase},...h?[{label:"Attention",value:h}]:[]],w=[{label:"Owner",value:y},{label:"Next move",value:v},...s.priority?[{label:"Priority",value:s.priority}]:[],{label:"Conversation",value:s.conversationId?"Attached":"None"}],N=[{label:"Case ID",value:s.id},{label:"Created",value:zr(s.createdAt)},{label:"Updated",value:zr(s.updatedAt)},{label:"Last activity",value:zr(s.lastMeaningfulAt)}];return d.jsxs("div",{className:"s-work-detail s-work-casefile",children:[d.jsxs("div",{className:"s-work-casefile-topbar",children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),d.jsxs("span",{className:"s-work-casefile-record",children:["Case ",L7(s.id)]})]}),i&&d.jsx("p",{className:"s-error",children:i}),d.jsx("section",{className:"s-work-casefile-hero",children:d.jsxs("div",{className:"s-work-casefile-hero-main",children:[d.jsxs("div",{className:"s-work-casefile-title-row",children:[d.jsx("h1",{className:"s-work-casefile-title",children:s.title}),d.jsx("span",{className:`s-pill s-pill-${D7(s)}`,children:s.currentPhase})]}),s.lastMeaningfulSummary&&d.jsx("div",{className:"s-work-casefile-summary",children:Yn(s.lastMeaningfulSummary)}),d.jsxs("div",{className:"s-work-casefile-meta",children:[d.jsxs("span",{children:["Updated ",st(s.updatedAt)]}),d.jsx("span",{children:y}),d.jsx("span",{children:tm(s.state)}),h&&d.jsx("span",{children:h}),s.priority&&d.jsxs("span",{children:["Priority ",s.priority]})]})]})}),d.jsxs("div",{className:"s-work-casefile-layout",children:[d.jsxs("div",{className:"s-work-casefile-main",children:[d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Case facts"})}),d.jsxs("div",{className:"s-work-fact-grid",children:[d.jsx(nm,{title:"Status",items:x}),d.jsx(nm,{title:"Assignment",items:w})]})]}),s.activeFlights.length>0&&d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),d.jsx("div",{className:"s-work-flight-list",children:s.activeFlights.map(T=>d.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:T.conversationId?()=>t({view:"conversation",conversationId:T.conversationId}):void 0,disabled:!T.conversationId,children:[d.jsxs("div",{className:"s-work-flight-card-header",children:[d.jsx("span",{className:"s-work-flight-card-title",children:T.agentName??T.agentId}),d.jsx("span",{className:"s-pill s-pill-working",children:T.state})]}),d.jsxs("div",{className:"s-work-flight-card-meta",children:[d.jsx("span",{children:T.startedAt?`Started ${st(T.startedAt)}`:"Start time unavailable"}),T.completedAt&&d.jsxs("span",{children:["Completed ",st(T.completedAt)]})]}),T.summary&&d.jsx("div",{className:"s-work-flight-card-copy",children:T.summary})]},T.id))})]}),s.childWork.length>0&&d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),d.jsx("div",{className:"s-work-related-list",children:s.childWork.map(T=>d.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>t({view:"work",workId:T.id}),children:[d.jsxs("div",{className:"s-work-related-card-header",children:[d.jsx("span",{className:"s-work-related-card-title",children:T.title}),d.jsx("span",{className:`s-pill s-pill-${T.attention==="interrupt"?"failed":"updated"}`,children:T.currentPhase})]}),d.jsxs("div",{className:"s-work-related-card-meta",children:[d.jsx("span",{children:T.ownerName??T.ownerId??"Unassigned"}),d.jsx("span",{children:tm(T.state)}),d.jsx("span",{children:st(T.lastMeaningfulAt)})]}),T.lastMeaningfulSummary&&d.jsx("div",{className:"s-work-related-card-copy",children:Yn(T.lastMeaningfulSummary)})]},T.id))})]}),d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Timeline"})}),s.timeline.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No activity yet."}),d.jsx("p",{children:"Timeline events will appear once the case receives messages or coordination updates."})]}):d.jsx("div",{className:"s-work-timeline",children:s.timeline.map(T=>d.jsxs("button",{type:"button",className:`s-work-timeline-entry${T.conversationId?" s-work-timeline-entry-clickable":""}`,onClick:T.conversationId?()=>t({view:"conversation",conversationId:T.conversationId}):void 0,disabled:!T.conversationId,children:[d.jsx("span",{className:`s-work-timeline-marker s-work-timeline-marker-${AS(T)}`}),d.jsxs("div",{className:"s-work-timeline-content",children:[d.jsxs("div",{className:"s-work-timeline-header",children:[d.jsx("span",{className:"s-work-timeline-time",children:st(T.at)}),d.jsx("span",{className:`s-work-timeline-kind s-work-timeline-kind-${AS(T)}`,children:I7(T)})]}),d.jsx("div",{className:"s-work-timeline-actor",children:T.actorName??"system"}),T.title&&d.jsx("div",{className:"s-work-timeline-title",children:T.title}),T.summary&&d.jsx("div",{className:"s-work-timeline-summary",children:Yn(T.summary)}),d.jsx("div",{className:"s-work-timeline-stamp",children:zr(T.at)})]})]},T.id))})]})]}),d.jsxs("aside",{className:"s-work-casefile-side",children:[d.jsx(nm,{title:"Record",items:N}),d.jsxs("section",{className:"s-work-fact-card",children:[d.jsx("div",{className:"s-work-fact-card-header",children:d.jsx("div",{className:"s-work-fact-card-title",children:"Links"})}),d.jsxs("div",{className:"s-work-action-list",children:[s.conversationId?d.jsx(RS,{label:"Conversation",value:"Open thread",onClick:()=>t({view:"conversation",conversationId:s.conversationId})}):d.jsx("div",{className:"s-work-action-list-empty",children:"No conversation attached."}),s.parentId&&s.parentTitle?d.jsx(RS,{label:"Parent",value:s.parentTitle,onClick:()=>t({view:"work",workId:s.parentId})}):d.jsx("div",{className:"s-work-action-list-empty",children:"No parent work item."})]})]})]})]})]})}function $7(){const{route:e,navigate:t}=Yt();return d.jsx(U7,{children:V7(e,t)})}function U7({children:e}){return d.jsx("div",{style:{background:"var(--bg)",color:"var(--ink)",minHeight:"100%",height:"100%",display:"flex",flexDirection:"column"},children:e})}function V7(e,t){switch(e.view){case"conversation":return d.jsx(Qm,{conversationId:e.conversationId,initialComposeMode:e.composeMode,navigate:t});case"agent-info":return d.jsx(GV,{conversationId:e.conversationId,navigate:t});case"settings":return d.jsx(O7,{navigate:t});case"agents":return d.jsx(xB,{navigate:t,selectedAgentId:e.agentId,conversationId:e.conversationId});case"fleet":return d.jsx(AB,{navigate:t});case"sessions":return e.sessionId?d.jsx(Qm,{conversationId:e.sessionId,navigate:t}):d.jsx(l7,{navigate:t});case"mesh":return d.jsx(JB,{navigate:t});case"activity":return d.jsx(FV,{navigate:t});case"work":return d.jsx(P7,{workId:e.workId,navigate:t});default:return d.jsx(OB,{navigate:t})}}function B7(){const{route:e,agents:t}=Yt();if(e.view!=="agents")return null;const s=e.agentId?t.find(i=>i.id===e.agentId)??null:null;if(!s){const i=t.filter(l=>Hr(l.state)).length;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsx(_s,{label:"Total",value:`${t.length}`}),d.jsx(_s,{label:"Working",value:`${i}`}),d.jsx(_s,{label:"Available",value:`${t.length-i}`}),d.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] text-white/25 leading-relaxed",children:"Select an agent from the roster to see its identity + session context here."})]})}const r=Hr(s.state);return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"flex items-center gap-3 pb-3 border-b border-white/[0.04]",children:[d.jsxs("div",{className:"relative w-10 h-10 rounded-full flex items-center justify-center text-[13px] font-mono text-black/80 shrink-0",style:{background:Ts(s.name)},children:[s.name[0]?.toUpperCase()??"?",r&&d.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 w-2.5 h-2.5 rounded-full bg-emerald-400 ring-2 ring-neutral-950"})]}),d.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[d.jsx("span",{className:"text-[13px] text-white/90 truncate",children:s.name}),s.handle&&d.jsxs("span",{className:"text-[10px] font-mono text-cyan-400/70",children:["@",s.handle]})]})]}),d.jsxs(Du,{label:"State",children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r?"bg-emerald-400":"bg-white/20"}`}),d.jsx("span",{className:"text-[12px] text-white/80 capitalize",children:ao(s.state)})]}),s.updatedAt&&d.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Updated ",st(s.updatedAt)]})]}),d.jsxs(Du,{label:"Identity",children:[d.jsx(_s,{label:"Class",value:s.agentClass}),s.role&&d.jsx(_s,{label:"Role",value:s.role}),s.harness&&d.jsx(_s,{label:"Harness",value:s.harness}),s.transport&&d.jsx(_s,{label:"Transport",value:s.transport})]}),(s.project||s.branch||s.cwd)&&d.jsxs(Du,{label:"Project",children:[s.project&&d.jsx(_s,{label:"Name",value:s.project}),s.branch&&d.jsx(_s,{label:"Branch",value:s.branch}),s.cwd&&d.jsx(_s,{label:"Cwd",value:s.cwd})]}),s.capabilities.length>0&&d.jsx(Du,{label:`Capabilities · ${s.capabilities.length}`,children:d.jsx("div",{className:"flex flex-wrap gap-1",children:s.capabilities.map(i=>d.jsx("span",{className:"text-[10px] font-mono text-white/50 px-1.5 py-0.5 rounded-sm bg-white/[0.04]",children:i},i))})})]})}function Du({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function _s({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function Z7(){const[e,t]=b.useState(null),s=b.useCallback(async()=>{try{t(await lt("/api/fleet"))}catch{}},[]);if(b.useEffect(()=>{s()},[s]),Kn(s),!e)return d.jsx("div",{className:"flex items-center justify-center h-full text-[11px] font-mono uppercase tracking-[0.15em] text-white/25",children:"Loading fleet…"});const r=e.totals;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:["Updated ",st(e.generatedAt)]}),d.jsx(zu,{label:"Needs Input",value:r.needsAttention,emphasis:r.needsAttention>0?"warn":"muted"}),d.jsx(zu,{label:"Active Asks",value:r.active}),d.jsx(zu,{label:"Recent Finished",value:r.recentCompleted,emphasis:r.recentCompleted>0?"good":"muted"}),d.jsx(zu,{label:"Activity",value:r.activity})]})}function zu({label:e,value:t,emphasis:s}){const r=s==="good"?"text-emerald-300/90":s==="warn"?"text-amber-300/90":s==="muted"?"text-white/40":"text-white/80";return d.jsxs("div",{className:"flex flex-col pb-3 border-b border-white/[0.04] last:border-b-0",children:[d.jsx("span",{className:`text-[24px] font-mono tabular-nums leading-none ${r}`,children:t}),d.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mt-1",children:e})]})}function H7(){const{agents:e,navigate:t}=Yt();if(e.length===0)return d.jsxs("div",{className:"flex flex-col h-full items-center justify-center px-4 text-center text-[11px] text-white/30 font-mono leading-relaxed",children:[d.jsx("div",{className:"mb-1 uppercase tracking-[0.15em]",children:"No agents"}),d.jsx("div",{children:"Connect an agent to see your roster here."})]});const s=e.filter(i=>Hr(i.state)),r=e.filter(i=>!Hr(i.state));return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[s.length>0&&d.jsx(_S,{label:"Online",count:s.length,children:s.map(i=>d.jsx(kS,{agent:i,navigate:t},i.id))}),r.length>0&&d.jsx(_S,{label:"Standby",count:r.length,children:r.map(i=>d.jsx(kS,{agent:i,navigate:t,dim:!0},i.id))})]})}function _S({label:e,count:t,children:s}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[d.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:e}),d.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25",children:t})]}),d.jsx("div",{className:"flex flex-col gap-0.5",children:s})]})}function kS({agent:e,navigate:t,dim:s}){const r=Hr(e.state);return d.jsxs("button",{onClick:()=>t({view:"agents",agentId:e.id}),className:`group flex items-center gap-2.5 px-2 py-1.5 rounded-sm text-left transition-colors ${s?"opacity-60 hover:opacity-100 hover:bg-white/[0.03]":"hover:bg-white/[0.03]"}`,children:[d.jsxs("div",{className:"relative w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-mono text-black/80 shrink-0",style:{background:Ts(e.name)},children:[e.name[0]?.toUpperCase()??"?",r&&d.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-emerald-400 ring-2 ring-neutral-950"})]}),d.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[d.jsx("span",{className:"text-[12px] text-white/80 truncate group-hover:text-white transition-colors",children:e.name}),d.jsx("span",{className:"text-[10px] font-mono text-white/30 truncate",children:ao(e.state)})]}),e.updatedAt&&d.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25 shrink-0",children:st(e.updatedAt)})]})}function F7(){const{route:e}=Yt(),[t,s]=b.useState([]),r=b.useCallback(async()=>{try{s(await lt("/api/sessions"))}catch{}},[]);if(b.useEffect(()=>{r()},[r]),Kn(r),e.view!=="sessions")return null;const i=e.sessionId?t.find(l=>l.id===e.sessionId)??null:null;if(!i){const l=new Set(t.map(f=>f.kind)),u=t.filter(f=>f.currentBranch).length;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsx(ks,{label:"Total",value:`${t.length}`}),d.jsx(ks,{label:"Kinds",value:`${l.size}`}),d.jsx(ks,{label:"Branched",value:`${u}`}),d.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] text-white/25 leading-relaxed",children:"Select a session from the list to see its context here."})]})}return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[d.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:i.title}),d.jsx("div",{className:"text-[10px] font-mono uppercase tracking-wider text-cyan-400/70 mt-1",children:i.kind})]}),i.agentName&&d.jsxs(Iu,{label:"Agent",children:[d.jsx(ks,{label:"Name",value:i.agentName}),i.harness&&d.jsx(ks,{label:"Harness",value:i.harness})]}),(i.currentBranch||i.workspaceRoot)&&d.jsxs(Iu,{label:"Workspace",children:[i.currentBranch&&d.jsx(ks,{label:"Branch",value:i.currentBranch}),i.workspaceRoot&&d.jsx(ks,{label:"Root",value:i.workspaceRoot})]}),d.jsxs(Iu,{label:"Activity",children:[d.jsx(ks,{label:"Messages",value:`${i.messageCount}`}),i.lastMessageAt&&d.jsx(ks,{label:"Last",value:st(i.lastMessageAt)}),i.participantIds.length>0&&d.jsx(ks,{label:"Participants",value:`${i.participantIds.length}`})]}),i.preview&&d.jsx(Iu,{label:"Preview",children:d.jsxs("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:['"',i.preview,'"']})})]})}function Iu({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function ks({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function q7(){const{route:e}=Yt(),t=e.view==="work"?e.workId:null,[s,r]=b.useState(null),i=b.useCallback(async()=>{if(!t){r(null);return}try{r(await lt(`/api/work/${encodeURIComponent(t)}`))}catch{r(null)}},[t]);if(b.useEffect(()=>{i()},[i]),Kn(i),e.view!=="work")return null;if(!s)return d.jsx("div",{className:"flex items-center justify-center h-full text-[11px] font-mono uppercase tracking-[0.15em] text-white/25 text-center px-4",children:"Loading work item…"});const l=G7(s.state);return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[d.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-cyan-400/70 mb-1",children:["Case ",Y7(s.id)]}),d.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:s.title})]}),d.jsxs(Lu,{label:"State",children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),d.jsx("span",{className:`text-[12px] capitalize ${l.text}`,children:s.state.replace(/_/g," ")})]}),d.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Phase · ",s.currentPhase]})]}),d.jsxs(Lu,{label:"Ownership",children:[s.ownerName&&d.jsx(Di,{label:"Owner",value:s.ownerName}),s.nextMoveOwnerName&&d.jsx(Di,{label:"Next move",value:s.nextMoveOwnerName}),s.priority&&d.jsx(Di,{label:"Priority",value:s.priority})]}),d.jsxs(Lu,{label:"Activity",children:[d.jsx(Di,{label:"Children",value:`${s.activeChildWorkCount}`}),d.jsx(Di,{label:"Flights",value:`${s.activeFlightCount}`}),s.lastMeaningfulAt&&d.jsx(Di,{label:"Last update",value:st(s.lastMeaningfulAt)})]}),s.attention!=="silent"&&d.jsx("div",{className:`text-[10px] font-mono uppercase tracking-wider px-2 py-1 rounded-sm ${s.attention==="interrupt"?"text-red-300/90 bg-red-500/10 border border-red-500/20":"text-amber-300/90 bg-amber-500/10 border border-amber-500/20"}`,children:s.attention==="interrupt"?"Interrupt":"Needs attention"}),s.lastMeaningfulSummary&&d.jsx(Lu,{label:"Latest",children:d.jsx("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:s.lastMeaningfulSummary})})]})}function Y7(e){return e.length>10?`${e.slice(0,8)}…`:e}function G7(e){return/complete|done|finished/i.test(e)?{dot:"bg-emerald-400",text:"text-emerald-300/90"}:/fail|error/i.test(e)?{dot:"bg-red-400",text:"text-red-300/90"}:/block|wait|pause/i.test(e)?{dot:"bg-amber-400",text:"text-amber-300/90"}:/active|working|in[_-]?progress/i.test(e)?{dot:"bg-cyan-400",text:"text-cyan-300/90"}:{dot:"bg-white/30",text:"text-white/70"}}function Lu({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function Di({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function X7(){const{route:e}=Yt();switch(e.view){case"inbox":return d.jsx(H7,{});case"agents":case"agent-info":return d.jsx(B7,{});case"fleet":return d.jsx(Z7,{});case"sessions":case"conversation":return d.jsx(F7,{});case"work":return d.jsx(q7,{});default:return null}}const K7=[{view:"inbox",label:"Home",icon:iV,target:{view:"inbox"}},{view:"agents",label:"Agents",icon:vV,target:{view:"agents"}},{view:"fleet",label:"Fleet",icon:lV,target:{view:"fleet"}},{view:"sessions",label:"Sessions",icon:uV,target:{view:"sessions"}},{view:"activity",label:"Activity",icon:aV,target:{view:"activity"}},{view:"mesh",label:"Mesh",icon:fV,target:{view:"mesh"}}],W7=[{view:"settings",label:"Settings",icon:gV,target:{view:"settings"}}];function J7(){const{route:e,navigate:t}=Yt();return d.jsxs("div",{className:"flex flex-col h-full py-2",children:[d.jsx("nav",{className:"flex flex-col",children:K7.map(s=>d.jsx(MS,{item:s,activeView:e.view,navigate:t},s.view))}),d.jsx("div",{className:"flex-1"}),d.jsx("nav",{className:"flex flex-col",children:W7.map(s=>d.jsx(MS,{item:s,activeView:e.view,navigate:t},s.view))})]})}function MS({item:e,activeView:t,navigate:s}){const r=t===e.view,i=e.icon;return d.jsxs("button",{onClick:()=>s(e.target),className:`group w-full flex items-center gap-2.5 px-3 py-1.5 text-left transition-colors border-l-2 ${r?"bg-cyan-500/5 border-l-cyan-400/40 text-white/80":"border-l-transparent text-white/40 hover:bg-white/[0.02] hover:text-white/60"}`,children:[d.jsx(i,{size:13,strokeWidth:1.5,className:r?"text-cyan-400/70":"text-white/30 group-hover:text-white/50"}),d.jsx("span",{className:"text-[12px]",children:e.label})]})}function Q7(){const{onboarding:e}=Yt();return e?e.hasLocalConfig?e.hasOperatorName?e.hasProjectConfig?null:d.jsx(sm,{children:d.jsx(nZ,{})}):d.jsx(sm,{children:d.jsx(tZ,{})}):d.jsx(sm,{children:d.jsx(eZ,{})}):null}function sm({children:e}){return d.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",background:"var(--bg)",color:"var(--ink)"},children:d.jsx("div",{style:{width:"100%",maxWidth:720,padding:"80px 72px",display:"flex",flexDirection:"column",gap:40},children:e})})}function py({eyebrow:e,title:t,description:s}){return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[d.jsx("div",{style:sZ,children:e}),d.jsx("div",{style:aZ,children:t}),d.jsx("div",{style:rZ,children:s})]})}function my({primary:e,onPrimary:t,primaryDisabled:s,busy:r}){const{skipOnboarding:i}=Yt();return d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,paddingTop:8},children:[d.jsx("button",{type:"button",onClick:t,disabled:s||r,style:{...oZ,opacity:s||r?.5:1,cursor:s||r?"default":"pointer"},children:r?"Working…":e}),d.jsx("button",{type:"button",onClick:i,style:lZ,onMouseEnter:l=>{l.currentTarget.style.color="rgba(255,255,255,0.8)"},onMouseLeave:l=>{l.currentTarget.style.color="rgba(255,255,255,0.45)"},children:"Skip for now"})]})}function gy({message:e}){return e?d.jsx("div",{style:{borderRadius:8,border:"1px solid rgba(239,68,68,0.35)",backgroundColor:"rgba(239,68,68,0.08)",color:"rgba(252,165,165,0.95)",padding:"12px 16px",fontSize:12,lineHeight:1.5},children:e}):null}function eZ(){const{onboarding:e,refreshOnboarding:t}=Yt(),[s,r]=b.useState(!1),[i,l]=b.useState(null),u=async()=>{r(!0),l(null);try{await lt("/api/onboarding/init",{method:"POST",body:"{}"}),await t()}catch(f){l(f instanceof Error?f.message:String(f))}finally{r(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(py,{eyebrow:"First-run setup",title:"Welcome to Scout",description:d.jsxs(d.Fragment,{children:["Scout needs a local config before it can talk to the broker, the web app, and paired devices. This writes"," ",d.jsx("code",{style:rg,children:"~/.openscout/config.json"})," with sensible defaults — you can edit it any time."]})}),d.jsxs("ul",{style:cZ,children:[d.jsx(OS,{label:"Local config (~/.openscout/config.json)",done:!1,hint:"missing"}),d.jsx(OS,{label:".openscout/project.json in a repo",done:!!e?.hasProjectConfig,hint:e?.hasProjectConfig?e.projectRoot??void 0:"checked after setup"})]}),d.jsx(gy,{message:i}),d.jsx(my,{primary:"Initialize Scout",onPrimary:()=>{u()},busy:s})]})}function tZ(){const{onboarding:e,refreshOnboarding:t}=Yt(),s=e?.operatorNameSuggestion??"",[r,i]=b.useState(s),[l,u]=b.useState(!1),[f,m]=b.useState(null);b.useEffect(()=>{!r&&s&&i(s)},[s,r]);const h=async()=>{const y=r.trim();if(!y){m("Name is required.");return}u(!0),m(null);try{await lt("/api/user",{method:"POST",body:JSON.stringify({name:y})}),await t()}catch(v){m(v instanceof Error?v.message:String(v))}finally{u(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(py,{eyebrow:"Step 1 of 2",title:"What should we call you?",description:"Your name shows up on messages you send and in any agent that speaks for you. You can change it later in Settings."}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[d.jsx("label",{style:ed,children:"Your name"}),d.jsx("input",{autoFocus:!0,value:r,onChange:y=>{i(y.target.value),m(null)},onKeyDown:y=>{y.key==="Enter"&&h()},placeholder:s||"Operator",style:ag}),s?d.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)",fontFamily:"var(--hud-font-mono)"},children:"Prefilled from your machine."}):null]}),d.jsx(gy,{message:f}),d.jsx(my,{primary:"Continue",onPrimary:()=>{h()},busy:l,primaryDisabled:!r.trim()})]})}function nZ(){const{onboarding:e,refreshOnboarding:t}=Yt(),s=e?.currentDirectory??"",[r,i]=b.useState([s||"~/dev"]),[l,u]=b.useState(s),[f,m]=b.useState("claude"),[h,y]=b.useState(!1),[v,x]=b.useState(null),w=(C,j)=>{i(E=>E.map((_,A)=>A===C?j:_))},N=()=>i(C=>[...C,""]),T=C=>i(j=>j.filter((E,_)=>_!==C)),R=async()=>{const C=r.map(E=>E.trim()).filter(Boolean),j=l.trim();if(!j){x("Pick where Scout should anchor this context.");return}y(!0),x(null);try{await lt("/api/onboarding/project",{method:"POST",body:JSON.stringify({contextRoot:j,sourceRoots:C,defaultHarness:f})}),await t()}catch(E){x(E instanceof Error?E.message:String(E))}finally{y(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(py,{eyebrow:"Step 2 of 2",title:"Where do your repos live?",description:d.jsxs(d.Fragment,{children:["Scout scans these folders for projects and anchors this context at"," ",d.jsx("code",{style:rg,children:"<context>/.openscout/project.json"}),"."]})}),d.jsxs("div",{style:am,children:[d.jsx("label",{style:ed,children:"Scan folders"}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[r.map((C,j)=>d.jsxs("div",{style:{display:"flex",gap:8},children:[d.jsx("input",{value:C,onChange:E=>w(j,E.target.value),placeholder:j===0?"~/dev":"Add another folder",style:{...ag,flex:1}}),d.jsx("button",{type:"button",onClick:()=>T(j),disabled:r.length<=1,style:{...DS,opacity:r.length<=1?.4:1,cursor:r.length<=1?"default":"pointer"},"aria-label":`Remove folder ${j+1}`,children:"−"})]},j)),d.jsx("button",{type:"button",onClick:N,style:{...DS,alignSelf:"flex-start"},children:"+ Add folder"})]})]}),d.jsxs("div",{style:am,children:[d.jsx("label",{style:ed,children:"Context root"}),d.jsx("input",{value:l,onChange:C=>u(C.target.value),placeholder:"~/dev",style:ag}),d.jsxs("div",{style:iZ,children:["Scout writes ",d.jsx("code",{style:rg,children:".openscout/project.json"})," ","inside this folder."]})]}),d.jsxs("div",{style:am,children:[d.jsx("label",{style:ed,children:"Default harness"}),d.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:["claude","codex"].map(C=>{const j=f===C;return d.jsxs("button",{type:"button",onClick:()=>m(C),style:{...uZ,borderColor:j?"var(--accent, #2dd4bf)":"rgba(255,255,255,0.12)",backgroundColor:j?"rgba(45,212,191,0.08)":"rgba(255,255,255,0.02)"},children:[d.jsx("div",{style:{fontSize:15,fontWeight:600,textTransform:"capitalize"},children:C}),d.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",marginTop:6,lineHeight:1.5},children:C==="claude"?"Anthropic Claude Code — local CLI agent.":"OpenAI Codex — cloud agentic sandbox."})]},C)})})]}),d.jsx(gy,{message:v}),d.jsx(my,{primary:"Create project",onPrimary:()=>{R()},busy:h,primaryDisabled:!l.trim()})]})}function OS({label:e,done:t,hint:s}){return d.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:16},children:[d.jsx("span",{style:{marginTop:2,width:20,height:20,borderRadius:999,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,flexShrink:0,backgroundColor:t?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.12)",color:t?"#4ade80":"#f87171"},children:t?"✓":"•"}),d.jsxs("div",{style:{minWidth:0},children:[d.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:t?"rgba(255,255,255,0.75)":"rgba(255,255,255,0.9)"},children:e}),s?d.jsx("div",{style:{fontSize:11,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.35)",marginTop:4,wordBreak:"break-all"},children:s}):null]})]})}const sZ={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.18em",color:"rgba(255,255,255,0.4)"},aZ={fontSize:36,fontWeight:600,letterSpacing:"-0.01em",lineHeight:1.15},rZ={fontSize:15,lineHeight:1.75,color:"rgba(255,255,255,0.6)",maxWidth:580},am={display:"flex",flexDirection:"column",gap:10},ed={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.15em",color:"rgba(255,255,255,0.5)"},ag={width:"100%",padding:"10px 14px",fontSize:14,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.92)",backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,outline:"none",boxSizing:"border-box"},iZ={fontSize:12,color:"rgba(255,255,255,0.45)",lineHeight:1.6},rg={fontFamily:"var(--hud-font-mono)",fontSize:12,padding:"2px 6px",borderRadius:4,backgroundColor:"rgba(255,255,255,0.06)"},oZ={fontSize:13,fontWeight:600,padding:"12px 24px",borderRadius:10,backgroundColor:"var(--accent, #2dd4bf)",color:"#0b0d12",border:"none",transition:"opacity 0.15s ease"},DS={fontSize:13,fontWeight:500,padding:"10px 14px",borderRadius:8,backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.85)",transition:"all 0.15s ease"},lZ={fontSize:12,color:"rgba(255,255,255,0.45)",textDecoration:"underline dotted rgba(255,255,255,0.25)",textUnderlineOffset:4,background:"none",border:"none",cursor:"pointer",padding:"4px 2px",transition:"color 0.15s ease"},cZ={display:"flex",flexDirection:"column",gap:20,margin:0,padding:0,listStyle:"none"},uZ={textAlign:"left",padding:"16px 18px",borderRadius:12,border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.9)",cursor:"pointer",transition:"all 0.15s ease"};function dZ(){const{navigate:e,agents:t,reload:s}=Yt(),r=b.useCallback(async i=>{await lt(`/api/agents/${encodeURIComponent(i)}/interrupt`,{method:"POST",body:JSON.stringify({})})},[]);return b.useMemo(()=>{const i=[{id:"nav:home",label:"Go to Home",action:()=>e({view:"inbox"}),shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Agents",action:()=>e({view:"agents"}),shortcut:"Cmd+2"},{id:"nav:fleet",label:"Go to Fleet",action:()=>e({view:"fleet"}),shortcut:"Cmd+3"},{id:"nav:sessions",label:"Go to Sessions",action:()=>e({view:"sessions"}),shortcut:"Cmd+4"},{id:"nav:activity",label:"Go to Activity",action:()=>e({view:"activity"}),shortcut:"Cmd+5"},{id:"nav:mesh",label:"Go to Mesh",action:()=>e({view:"mesh"}),shortcut:"Cmd+6"},{id:"nav:settings",label:"Open Settings",action:()=>e({view:"settings"}),shortcut:"Cmd+,"},{id:"nav:pair",label:"Pair Device",action:()=>e({view:"settings"})},{id:"scout:reload",label:"Reload Agents",action:()=>{s()}}];for(const l of t)i.push({id:`scout:open:${l.id}`,label:`Open ${l.name}`,action:()=>e({view:"conversation",conversationId:Ju(l.id)})}),i.push({id:`scout:send:${l.id}`,label:`Tell ${l.name}`,action:()=>e({view:"conversation",conversationId:Ju(l.id)})}),i.push({id:`scout:ask:${l.id}`,label:`Ask ${l.name}`,action:()=>e({view:"conversation",conversationId:Ju(l.id),composeMode:"ask"})}),i.push({id:`scout:interrupt:${l.id}`,label:`Interrupt ${l.name}`,action:()=>{r(l.id)}});return i},[t,r,e,s])}function fZ(){const{agents:e,onlineCount:t}=Yt();return e.length===0?{label:"offline",color:"neutral"}:t===0?{label:`0/${e.length} agents`,color:"amber"}:{label:`${t}/${e.length} agents`,color:"emerald"}}const hZ={inbox:"Home",conversation:"Conversation","agent-info":"Agent",agents:"Agents",fleet:"Fleet",sessions:"Sessions",activity:"Activity",mesh:"Mesh",settings:"Settings",work:"Work"};function pZ(){const{route:e}=Yt(),t=hZ[e.view]??e.view;return b.createElement("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/40"},t)}function mZ(){const{navigate:e}=Yt();return b.createElement("button",{onClick:()=>e({view:"settings"}),className:"px-2 py-1 rounded-sm text-[11px] font-mono uppercase tracking-wider text-white/60 hover:text-white/90 hover:bg-white/[0.04] border border-white/[0.06] transition-colors"},"Pair device")}function gZ(){return"panel"}function yZ(){const{onboarding:e,onboardingSkipped:t,skipOnboarding:s}=Yt();if(!e)return null;if(t)return{active:!1,dismissible:!0};const r=!e.hasLocalConfig,i=!e.hasProjectConfig,l=!e.hasOperatorName;return{active:r||l||i,dismissible:!0,onDismiss:s}}const vZ=[{commandId:"nav:home",title:"Go to Home",description:"Navigate to the home screen showing the agent inbox",category:"navigation",keywords:["home","inbox","dashboard"],shortcut:"Cmd+1"},{commandId:"nav:agents",title:"Go to Agents",description:"Navigate to the agents roster showing all registered agents",category:"navigation",keywords:["agents","roster","list"],shortcut:"Cmd+2"},{commandId:"nav:fleet",title:"Go to Fleet",description:"Navigate to the fleet overview with agent status summary",category:"navigation",keywords:["fleet","overview","status"],shortcut:"Cmd+3"},{commandId:"nav:sessions",title:"Go to Sessions",description:"Navigate to the sessions list showing all active conversations",category:"navigation",keywords:["sessions","conversations","threads"],shortcut:"Cmd+4"},{commandId:"nav:activity",title:"Go to Activity",description:"Navigate to the activity feed showing recent events",category:"navigation",keywords:["activity","feed","events","log"],shortcut:"Cmd+5"},{commandId:"nav:mesh",title:"Go to Mesh",description:"Navigate to the mesh network view showing nodes and topology",category:"navigation",keywords:["mesh","network","nodes","peers","topology"],shortcut:"Cmd+6"},{commandId:"nav:settings",title:"Open Settings",description:"Open the settings screen for pairing, identity, and relay config",category:"settings",keywords:["settings","preferences","config","pair"],shortcut:"Cmd+,"},{commandId:"nav:pair",title:"Pair Device",description:"Open the device pairing flow to connect a mobile device",category:"settings",keywords:["pair","qr","device","phone","mobile"]},{commandId:"scout:reload",title:"Reload Agents",description:"Refresh the agent list and message state from the broker",category:"workspace",keywords:["reload","refresh","sync"]},{commandId:"scout:open:*",title:"Open Agent Conversation",description:"Open the DM lane for one specific agent. One agent maps to a DM; group work belongs in an explicit channel and broadcasts belong in the shared channel.",category:"navigation",keywords:["open","chat","conversation","dm","message"],params:[{name:"agentId",description:"The agent identifier to open",type:"string"}]},{commandId:"scout:send:*",title:"Tell Agent",description:"Open or compose the DM tell/update path for one specific agent. Use Tell for heads-up, replies, status, and steering an active turn inside the same DM.",category:"workspace",keywords:["tell","message","update","dm","reply","steer"],params:[{name:"agentId",description:"The agent identifier to tell",type:"string"},{name:"message",description:"The message body to send",type:"string"}]},{commandId:"scout:ask:*",title:"Ask Agent",description:"Open the DM ask path for one specific agent. Use Ask when the meaning is 'own this work and get back to me' and keep follow-up in the same DM.",category:"workspace",keywords:["ask","assign","task","dm","work","reply"],params:[{name:"agentId",description:"The agent identifier to ask",type:"string"},{name:"message",description:"The message body to send",type:"string"}]},{commandId:"scout:interrupt:*",title:"Interrupt Agent",description:"Send Ctrl-C to interrupt a working agent. The commandId is scout:interrupt:{agentId}.",category:"workspace",keywords:["stop","interrupt","cancel","halt","kill"],dangerous:!0,params:[{name:"agentId",description:"The agent identifier to interrupt",type:"string"}]}],bZ={id:"openscout",name:"Scout",description:"All your agents, one message away. Scout is a control plane for managing coding agents: one agent means a DM, group work means an explicit channel, Tell stays conversational, Ask is owned work with a reply path, and shared updates mean broadcast.",mode:"panel",Provider:NV,leftPanel:{title:"Scout",icon:b.createElement(pV,{size:12})},slots:{Content:$7,LeftPanel:J7,Inspector:X7,Takeover:Q7},intents:vZ,hooks:{useCommands:dZ,useStatus:fZ,useNavCenter:pZ,useNavActions:mZ,useLayoutMode:gZ,useTakeover:yZ}},VC=document.getElementById("root");if(!VC)throw new Error("missing #root");l2.createRoot(VC).render(d.jsx(b.StrictMode,{children:d.jsx(XU,{app:bZ})}));export{LS as F,IS as f,d as j,b as r};