@openscout/scout 0.2.47 → 0.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -1
- package/dist/client/assets/index-CA2ASaSK.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/control-plane-client/assets/addon-fit-DX4qG4td.js +1 -0
- package/dist/control-plane-client/assets/addon-webgl-DCtw1yLn.js +64 -0
- package/dist/control-plane-client/assets/{arc.es-BkYc1VKe.js → arc.es-DndjiskC.js} +1 -1
- package/dist/control-plane-client/assets/index-CCQvN8TG.css +1 -0
- package/dist/control-plane-client/assets/index-DlKOe-t6.js +140 -0
- package/dist/control-plane-client/assets/index-TVkH_WDG.js +1 -0
- package/dist/control-plane-client/assets/xterm-B-qIQCd3.js +16 -0
- package/dist/control-plane-client/index.html +2 -2
- package/dist/main.mjs +574 -2053
- package/dist/pair-supervisor.mjs +12519 -12609
- package/dist/scout-control-plane-web.mjs +9748 -9853
- package/dist/scout-web-server.mjs +8833 -8943
- package/package.json +2 -2
- package/dist/client/assets/index-BIhZnptE.css +0 -1
- package/dist/control-plane-client/assets/index-C3R8grI3.css +0 -1
- package/dist/control-plane-client/assets/index-DLYQAPHm.js +0 -9
- /package/dist/client/assets/{index-Dz8OkaKF.js → index-DAPDqcsj.js} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
function e_(e,t){for(var s=0;s<t.length;s++){const a=t[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>a[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"]'))a(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"&&a(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 a(i){if(i.ep)return;i.ep=!0;const l=s(i);fetch(i.href,l)}})();function DS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lp={exports:{}},ol={};var ax;function t_(){if(ax)return ol;ax=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(a,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:l}}return ol.Fragment=t,ol.jsx=s,ol.jsxs=s,ol}var ix;function n_(){return ix||(ix=1,lp.exports=t_()),lp.exports}var f=n_(),cp={exports:{}},Pe={};var ox;function s_(){if(ox)return Pe;ox=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=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,_={};function C(D,P,K){this.props=D,this.context=P,this.refs=_,this.updater=K||N}C.prototype.isReactComponent={},C.prototype.setState=function(D,P){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,P,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function j(){}j.prototype=C.prototype;function E(D,P,K){this.props=D,this.context=P,this.refs=_,this.updater=K||N}var A=E.prototype=new j;A.constructor=E,T(A,C.prototype),A.isPureReactComponent=!0;var R=Array.isArray;function O(){}var M={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function F(D,P,K){var se=K.ref;return{$$typeof:e,type:D,key:P,ref:se!==void 0?se:null,props:K}}function Z(D,P){return F(D.type,P,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function H(D){var P={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(K){return P[K]})}var W=/\/+/g;function oe(D,P){return typeof D=="object"&&D!==null&&D.key!=null?H(""+D.key):P.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(O,O):(D.status="pending",D.then(function(P){D.status==="pending"&&(D.status="fulfilled",D.value=P)},function(P){D.status==="pending"&&(D.status="rejected",D.reason=P)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function I(D,P,K,se,te){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,I(he(D._payload),P,K,se,te)}}if(he)return te=te(D),he=se===""?"."+oe(D,0):se,R(te)?(K="",he!=null&&(K=he.replace(W,"$&/")+"/"),I(te,P,K,"",function(Re){return Re})):te!=null&&(U(te)&&(te=Z(te,K+(te.key==null||D&&D.key===te.key?"":(""+te.key).replace(W,"$&/")+"/")+he)),P.push(te)),1;he=0;var pe=se===""?".":se+":";if(R(D))for(var xe=0;xe<D.length;xe++)se=D[xe],ge=pe+oe(se,xe),he+=I(se,P,K,ge,te);else if(xe=w(D),typeof xe=="function")for(D=xe.call(D),xe=0;!(se=D.next()).done;)se=se.value,ge=pe+oe(se,xe++),he+=I(se,P,K,ge,te);else if(ge==="object"){if(typeof D.then=="function")return I(ee(D),P,K,se,te);throw P=String(D),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return he}function B(D,P,K){if(D==null)return D;var se=[],te=0;return I(D,se,"","",function(ge){return P.call(K,ge,te++)}),se}function $(D){if(D._status===-1){var P=D._result;P=P(),P.then(function(K){(D._status===0||D._status===-1)&&(D._status=1,D._result=K)},function(K){(D._status===0||D._status===-1)&&(D._status=2,D._result=K)}),D._status===-1&&(D._status=0,D._result=P)}if(D._status===1)return D._result.default;throw D._result}var re=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=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(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},J={map:B,forEach:function(D,P,K){B(D,function(){P.apply(this,arguments)},K)},count:function(D){var P=0;return B(D,function(){P++}),P},toArray:function(D){return B(D,function(P){return P})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Pe.Activity=v,Pe.Children=J,Pe.Component=C,Pe.Fragment=s,Pe.Profiler=i,Pe.PureComponent=E,Pe.StrictMode=a,Pe.Suspense=p,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(D){return M.H.useMemoCache(D)}},Pe.cache=function(D){return function(){return D.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(D,P,K){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var se=T({},D.props),te=D.key;if(P!=null)for(ge in P.key!==void 0&&(te=""+P.key),P)!z.call(P,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&P.ref===void 0||(se[ge]=P[ge]);var ge=arguments.length-2;if(ge===1)se.children=K;else if(1<ge){for(var he=Array(ge),pe=0;pe<ge;pe++)he[pe]=arguments[pe+2];se.children=he}return F(D.type,te,se)},Pe.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},Pe.createElement=function(D,P,K){var se,te={},ge=null;if(P!=null)for(se in P.key!==void 0&&(ge=""+P.key),P)z.call(P,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(te[se]=P[se]);var he=arguments.length-2;if(he===1)te.children=K;else if(1<he){for(var pe=Array(he),xe=0;xe<he;xe++)pe[xe]=arguments[xe+2];te.children=pe}if(D&&D.defaultProps)for(se in he=D.defaultProps,he)te[se]===void 0&&(te[se]=he[se]);return F(D,ge,te)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(D){return{$$typeof:d,render:D}},Pe.isValidElement=U,Pe.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:$}},Pe.memo=function(D,P){return{$$typeof:h,type:D,compare:P===void 0?null:P}},Pe.startTransition=function(D){var P=M.T,K={};M.T=K;try{var se=D(),te=M.S;te!==null&&te(K,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(O,re)}catch(ge){re(ge)}finally{P!==null&&K.types!==null&&(P.types=K.types),M.T=P}},Pe.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},Pe.use=function(D){return M.H.use(D)},Pe.useActionState=function(D,P,K){return M.H.useActionState(D,P,K)},Pe.useCallback=function(D,P){return M.H.useCallback(D,P)},Pe.useContext=function(D){return M.H.useContext(D)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(D,P){return M.H.useDeferredValue(D,P)},Pe.useEffect=function(D,P){return M.H.useEffect(D,P)},Pe.useEffectEvent=function(D){return M.H.useEffectEvent(D)},Pe.useId=function(){return M.H.useId()},Pe.useImperativeHandle=function(D,P,K){return M.H.useImperativeHandle(D,P,K)},Pe.useInsertionEffect=function(D,P){return M.H.useInsertionEffect(D,P)},Pe.useLayoutEffect=function(D,P){return M.H.useLayoutEffect(D,P)},Pe.useMemo=function(D,P){return M.H.useMemo(D,P)},Pe.useOptimistic=function(D,P){return M.H.useOptimistic(D,P)},Pe.useReducer=function(D,P,K){return M.H.useReducer(D,P,K)},Pe.useRef=function(D){return M.H.useRef(D)},Pe.useState=function(D){return M.H.useState(D)},Pe.useSyncExternalStore=function(D,P,K){return M.H.useSyncExternalStore(D,P,K)},Pe.useTransition=function(){return M.H.useTransition()},Pe.version="19.2.3",Pe}var lx;function Bl(){return lx||(lx=1,cp.exports=s_()),cp.exports}var b=Bl();const zS=DS(b),IS=e_({__proto__:null,default:zS},[b]);var up={exports:{}},ll={},dp={exports:{}},fp={};var cx;function r_(){return cx||(cx=1,(function(e){function t(I,B){var $=I.length;I.push(B);e:for(;0<$;){var re=$-1>>>1,J=I[re];if(0<i(J,B))I[re]=B,I[$]=J,$=re;else break e}}function s(I){return I.length===0?null:I[0]}function a(I){if(I.length===0)return null;var B=I[0],$=I.pop();if($!==B){I[0]=$;e:for(var re=0,J=I.length,D=J>>>1;re<D;){var P=2*(re+1)-1,K=I[P],se=P+1,te=I[se];if(0>i(K,$))se<J&&0>i(te,K)?(I[re]=te,I[se]=$,re=se):(I[re]=K,I[P]=$,re=P);else if(se<J&&0>i(te,$))I[re]=te,I[se]=$,re=se;else break e}}return B}function i(I,B){var $=I.sortIndex-B.sortIndex;return $!==0?$:I.id-B.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,d=u.now();e.unstable_now=function(){return u.now()-d}}var p=[],h=[],y=1,v=null,x=3,w=!1,N=!1,T=!1,_=!1,C=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(I){for(var B=s(h);B!==null;){if(B.callback===null)a(h);else if(B.startTime<=I)a(h),B.sortIndex=B.expirationTime,t(p,B);else break;B=s(h)}}function R(I){if(T=!1,A(I),!N)if(s(p)!==null)N=!0,O||(O=!0,H());else{var B=s(h);B!==null&&ee(R,B.startTime-I)}}var O=!1,M=-1,z=5,F=-1;function Z(){return _?!0:!(e.unstable_now()-F<z)}function U(){if(_=!1,O){var I=e.unstable_now();F=I;var B=!0;try{e:{N=!1,T&&(T=!1,j(M),M=-1),w=!0;var $=x;try{t:{for(A(I),v=s(p);v!==null&&!(v.expirationTime>I&&Z());){var re=v.callback;if(typeof re=="function"){v.callback=null,x=v.priorityLevel;var J=re(v.expirationTime<=I);if(I=e.unstable_now(),typeof J=="function"){v.callback=J,A(I),B=!0;break t}v===s(p)&&a(p),A(I)}else a(p);v=s(p)}if(v!==null)B=!0;else{var D=s(h);D!==null&&ee(R,D.startTime-I),B=!1}}break e}finally{v=null,x=$,w=!1}B=void 0}}finally{B?H():O=!1}}}var H;if(typeof E=="function")H=function(){E(U)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,oe=W.port2;W.port1.onmessage=U,H=function(){oe.postMessage(null)}}else H=function(){C(U,0)};function ee(I,B){M=C(function(){I(e.unstable_now())},B)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(I){switch(x){case 1:case 2:case 3:var B=3;break;default:B=x}var $=x;x=B;try{return I()}finally{x=$}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(I,B){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var $=x;x=I;try{return B()}finally{x=$}},e.unstable_scheduleCallback=function(I,B,$){var re=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?re+$:re):$=re,I){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=$+J,I={id:y++,callback:B,priorityLevel:I,startTime:$,expirationTime:J,sortIndex:-1},$>re?(I.sortIndex=$,t(h,I),s(p)===null&&I===s(h)&&(T?(j(M),M=-1):T=!0,ee(R,$-re))):(I.sortIndex=J,t(p,I),N||w||(N=!0,O||(O=!0,H()))),I},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(I){var B=x;return function(){var $=x;x=B;try{return I.apply(this,arguments)}finally{x=$}}}})(fp)),fp}var ux;function a_(){return ux||(ux=1,dp.exports=r_()),dp.exports}var hp={exports:{}},un={};var dx;function i_(){if(dx)return un;dx=1;var e=Bl();function t(p){var h="https://react.dev/errors/"+p;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 #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var a={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(p,h,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:""+v,children:p,containerInfo:h,implementation:y}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return un.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,un.createPortal=function(p,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(p,h,null,y)},un.flushSync=function(p){var h=u.T,y=a.p;try{if(u.T=null,a.p=2,p)return p()}finally{u.T=h,a.p=y,a.d.f()}},un.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(p,h))},un.prefetchDNS=function(p){typeof p=="string"&&a.d.D(p)},un.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var y=h.as,v=d(y,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;y==="style"?a.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:w}):y==="script"&&a.d.X(p,{crossOrigin:v,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},un.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var y=d(h.as,h.crossOrigin);a.d.M(p,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(p)},un.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var y=h.as,v=d(y,h.crossOrigin);a.d.L(p,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})}},un.preloadModule=function(p,h){if(typeof p=="string")if(h){var y=d(h.as,h.crossOrigin);a.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(p)},un.requestFormReset=function(p){a.d.r(p)},un.unstable_batchedUpdates=function(p,h){return p(h)},un.useFormState=function(p,h,y){return u.H.useFormState(p,h,y)},un.useFormStatus=function(){return u.H.useHostTransitionStatus()},un.version="19.2.3",un}var fx;function LS(){if(fx)return hp.exports;fx=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=i_(),hp.exports}var hx;function o_(){if(hx)return ll;hx=1;var e=a_(),t=Bl(),s=LS();function a(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+r+" 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 r=n,o=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(o=r.return),n=r.return;while(n)}return r.tag===3?o:null}function u(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function d(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function p(n){if(l(n)!==n)throw Error(a(188))}function h(n){var r=n.alternate;if(!r){if(r=l(n),r===null)throw Error(a(188));return r!==n?null:n}for(var o=n,c=r;;){var m=o.return;if(m===null)break;var g=m.alternate;if(g===null){if(c=m.return,c!==null){o=c;continue}break}if(m.child===g.child){for(g=m.child;g;){if(g===o)return p(m),n;if(g===c)return p(m),r;g=g.sibling}throw Error(a(188))}if(o.return!==c.return)o=m,c=g;else{for(var S=!1,k=m.child;k;){if(k===o){S=!0,o=m,c=g;break}if(k===c){S=!0,c=m,o=g;break}k=k.sibling}if(!S){for(k=g.child;k;){if(k===o){S=!0,o=g,c=m;break}if(k===c){S=!0,c=g,o=m;break}k=k.sibling}if(!S)throw Error(a(189))}}if(o.alternate!==c)throw Error(a(190))}if(o.tag!==3)throw Error(a(188));return o.stateNode.current===o?n:r}function y(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=y(n),r!==null)return r;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"),_=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),E=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function H(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var W=Symbol.for("react.client.reference");function oe(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===W?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case T:return"Fragment";case C:return"Profiler";case _:return"StrictMode";case R:return"Suspense";case O:return"SuspenseList";case F: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 A:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case M:return r=n.displayName||null,r!==null?r:oe(n.type)||"Memo";case z:r=n._payload,n=n._init;try{return oe(n(r))}catch{}}return null}var ee=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},re=[],J=-1;function D(n){return{current:n}}function P(n){0>J||(n.current=re[J],re[J]=null,J--)}function K(n,r){J++,re[J]=n.current,n.current=r}var se=D(null),te=D(null),ge=D(null),he=D(null);function pe(n,r){switch(K(ge,r),K(te,n),K(se,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?Rb(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=Rb(r),n=Ab(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}P(se),K(se,n)}function xe(){P(se),P(te),P(ge)}function Re(n){n.memoizedState!==null&&K(he,n);var r=se.current,o=Ab(r,n.type);r!==o&&(K(te,n),K(se,o))}function fe(n){te.current===n&&(P(se),P(te)),he.current===n&&(P(he),sl._currentValue=$)}var ke,Te;function He(n){if(ke===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);ke=r&&r[1]||"",Te=-1<o.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ke+n+Te}var ie=!1;function Y(n,r){if(!n||ie)return"";ie=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ne){var Q=ne}Reflect.construct(n,[],de)}else{try{de.call()}catch(ne){Q=ne}n.call(de.prototype)}}else{try{throw Error()}catch(ne){Q=ne}(de=n())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ne){if(ne&&Q&&typeof ne.stack=="string")return[ne.stack,Q.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.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
|
+
`),X=k.split(`
|
|
5
|
+
`);for(m=c=0;c<L.length&&!L[c].includes("DetermineComponentFrameRoot");)c++;for(;m<X.length&&!X[m].includes("DetermineComponentFrameRoot");)m++;if(c===L.length||m===X.length)for(c=L.length-1,m=X.length-1;1<=c&&0<=m&&L[c]!==X[m];)m--;for(;1<=c&&0<=m;c--,m--)if(L[c]!==X[m]){if(c!==1||m!==1)do if(c--,m--,0>m||L[c]!==X[m]){var le=`
|
|
6
|
+
`+L[c].replace(" at new "," at ");return n.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",n.displayName)),le}while(1<=c&&0<=m);break}}}finally{ie=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?He(o):""}function ae(n,r){switch(n.tag){case 26:case 27:case 5:return He(n.type);case 16:return He("Lazy");case 13:return n.child!==r&&r!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return Y(n.type,!1);case 11:return Y(n.type.render,!1);case 1:return Y(n.type,!0);case 31:return He("Activity");default:return""}}function ye(n){try{var r="",o=null;do r+=ae(n,o),o=n,n=n.return;while(n);return r}catch(c){return`
|
|
7
|
+
Error generating stack: `+c.message+`
|
|
8
|
+
`+c.stack}}var we=Object.prototype.hasOwnProperty,Ce=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,ve=e.unstable_requestPaint,Se=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,We=e.unstable_ImmediatePriority,it=e.unstable_UserBlockingPriority,Fe=e.unstable_NormalPriority,Ft=e.unstable_LowPriority,Xt=e.unstable_IdlePriority,En=e.log,hn=e.unstable_setDisableYieldValue,Jt=null,De=null;function et(n){if(typeof En=="function"&&hn(n),De&&typeof De.setStrictMode=="function")try{De.setStrictMode(Jt,n)}catch{}}var nt=Math.clz32?Math.clz32:pn,gt=Math.log,zt=Math.LN2;function pn(n){return n>>>=0,n===0?32:31-(gt(n)/zt|0)|0}var qt=256,Nn=262144,Qt=4194304;function mn(n){var r=n&42;if(r!==0)return r;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 pr(n,r,o){var c=n.pendingLanes;if(c===0)return 0;var m=0,g=n.suspendedLanes,S=n.pingedLanes;n=n.warmLanes;var k=c&134217727;return k!==0?(c=k&~g,c!==0?m=mn(c):(S&=k,S!==0?m=mn(S):o||(o=k&~n,o!==0&&(m=mn(o))))):(k=c&~g,k!==0?m=mn(k):S!==0?m=mn(S):o||(o=c&~n,o!==0&&(m=mn(o)))),m===0?0:r!==0&&r!==m&&(r&g)===0&&(g=m&-m,o=r&-r,g>=o||g===32&&(o&4194048)!==0)?r:m}function mr(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function Wd(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Ql(){var n=Qt;return Qt<<=1,(Qt&62914560)===0&&(Qt=4194304),n}function po(n){for(var r=[],o=0;31>o;o++)r.push(n);return r}function ca(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function mo(n,r,o,c,m,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,X=n.hiddenUpdates;for(o=S&~o;0<o;){var le=31-nt(o),de=1<<le;k[le]=0,L[le]=-1;var Q=X[le];if(Q!==null)for(X[le]=null,le=0;le<Q.length;le++){var ne=Q[le];ne!==null&&(ne.lane&=-536870913)}o&=~de}c!==0&&go(n,c,0),g!==0&&m===0&&n.tag!==0&&(n.suspendedLanes|=g&~(S&~r))}function go(n,r,o){n.pendingLanes|=r,n.suspendedLanes&=~r;var c=31-nt(r);n.entangledLanes|=r,n.entanglements[c]=n.entanglements[c]|1073741824|o&261930}function ec(n,r){var o=n.entangledLanes|=r;for(n=n.entanglements;o;){var c=31-nt(o),m=1<<c;m&r|n[c]&r&&(n[c]|=r),o&=~m}}function tc(n,r){var o=r&-r;return o=(o&42)!==0?1:Hs(o),(o&(n.suspendedLanes|r))!==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 yo(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function nc(){var n=B.p;return n!==0?n:(n=window.event,n===void 0?32:Jb(n.type))}function sc(n,r){var o=B.p;try{return B.p=n,r()}finally{B.p=o}}var gr=Math.random().toString(36).slice(2),en="__reactFiber$"+gr,Tn="__reactProps$"+gr,Ya="__reactContainer$"+gr,Jd="__reactEvents$"+gr,ZC="__reactListeners$"+gr,HC="__reactHandles$"+gr,my="__reactResources$"+gr,vo="__reactMarker$"+gr;function Qd(n){delete n[en],delete n[Tn],delete n[Jd],delete n[ZC],delete n[HC]}function Ga(n){var r=n[en];if(r)return r;for(var o=n.parentNode;o;){if(r=o[Ya]||o[en]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(n=Ib(n);n!==null;){if(o=n[en])return o;n=Ib(n)}return r}n=o,o=n.parentNode}return null}function Xa(n){if(n=n[en]||n[Ya]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function bo(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(a(33))}function Ka(n){var r=n[my];return r||(r=n[my]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Kt(n){n[vo]=!0}var gy=new Set,yy={};function ua(n,r){Wa(n,r),Wa(n+"Capture",r)}function Wa(n,r){for(yy[n]=r,n=0;n<r.length;n++)gy.add(r[n])}var FC=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]*$"),vy={},by={};function qC(n){return we.call(by,n)?!0:we.call(vy,n)?!1:FC.test(n)?by[n]=!0:(vy[n]=!0,!1)}function rc(n,r,o){if(qC(r))if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+o)}}function ac(n,r,o){if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+o)}}function Fs(n,r,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(r,o,""+c)}}function Kn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xy(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function YC(n,r,o){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,g=c.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return m.call(this)},set:function(S){o=""+S,g.call(this,S)}}),Object.defineProperty(n,r,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function ef(n){if(!n._valueTracker){var r=xy(n)?"checked":"value";n._valueTracker=YC(n,r,""+n[r])}}function wy(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var o=r.getValue(),c="";return n&&(c=xy(n)?n.checked?"true":"false":n.value),n=c,n!==o?(r.setValue(n),!0):!1}function ic(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 GC=/[\n"\\]/g;function Wn(n){return n.replace(GC,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function tf(n,r,o,c,m,g,S,k){n.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.type=S:n.removeAttribute("type"),r!=null?S==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Kn(r)):n.value!==""+Kn(r)&&(n.value=""+Kn(r)):S!=="submit"&&S!=="reset"||n.removeAttribute("value"),r!=null?nf(n,S,Kn(r)):o!=null?nf(n,S,Kn(o)):c!=null&&n.removeAttribute("value"),m==null&&g!=null&&(n.defaultChecked=!!g),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Kn(k):n.removeAttribute("name")}function Sy(n,r,o,c,m,g,S,k){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(n.type=g),r!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){ef(n);return}o=o!=null?""+Kn(o):"",r=r!=null?""+Kn(r):o,k||r===n.value||(n.value=r),n.defaultValue=r}c=c??m,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,r,o){r==="number"&&ic(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function Ja(n,r,o,c){if(n=n.options,r){r={};for(var m=0;m<o.length;m++)r["$"+o[m]]=!0;for(o=0;o<n.length;o++)m=r.hasOwnProperty("$"+n[o].value),n[o].selected!==m&&(n[o].selected=m),m&&c&&(n[o].defaultSelected=!0)}else{for(o=""+Kn(o),r=null,m=0;m<n.length;m++){if(n[m].value===o){n[m].selected=!0,c&&(n[m].defaultSelected=!0);return}r!==null||n[m].disabled||(r=n[m])}r!==null&&(r.selected=!0)}}function Ey(n,r,o){if(r!=null&&(r=""+Kn(r),r!==n.value&&(n.value=r),o==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=o!=null?""+Kn(o):""}function Ny(n,r,o,c){if(r==null){if(c!=null){if(o!=null)throw Error(a(92));if(ee(c)){if(1<c.length)throw Error(a(93));c=c[0]}o=c}o==null&&(o=""),r=o}o=Kn(r),n.defaultValue=o,c=n.textContent,c===o&&c!==""&&c!==null&&(n.value=c),ef(n)}function Qa(n,r){if(r){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=r;return}}n.textContent=r}var XC=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 Ty(n,r,o){var c=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":c?n.setProperty(r,o):typeof o!="number"||o===0||XC.has(r)?r==="float"?n.cssFloat=o:n[r]=(""+o).trim():n[r]=o+"px"}function jy(n,r,o){if(r!=null&&typeof r!="object")throw Error(a(62));if(n=n.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var m in r)c=r[m],r.hasOwnProperty(m)&&o[m]!==c&&Ty(n,m,c)}else for(var g in r)r.hasOwnProperty(g)&&Ty(n,g,r[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 KC=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"]]),WC=/^[\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 oc(n){return WC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function qs(){}var rf=null;function af(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ei=null,ti=null;function Cy(n){var r=Xa(n);if(r&&(n=r.stateNode)){var o=n[Tn]||null;e:switch(n=r.stateNode,r.type){case"input":if(tf(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Wn(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var c=o[r];if(c!==n&&c.form===n.form){var m=c[Tn]||null;if(!m)throw Error(a(90));tf(c,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<o.length;r++)c=o[r],c.form===n.form&&wy(c)}break e;case"textarea":Ey(n,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&Ja(n,!!o.multiple,r,!1)}}}var of=!1;function Ry(n,r,o){if(of)return n(r,o);of=!0;try{var c=n(r);return c}finally{if(of=!1,(ei!==null||ti!==null)&&(Gc(),ei&&(r=ei,n=ti,ti=ei=null,Cy(r),n)))for(r=0;r<n.length;r++)Cy(n[r])}}function xo(n,r){var o=n.stateNode;if(o===null)return null;var c=o[Tn]||null;if(c===null)return null;o=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(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(a(231,r,typeof o));return o}var Ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lf=!1;if(Ys)try{var wo={};Object.defineProperty(wo,"passive",{get:function(){lf=!0}}),window.addEventListener("test",wo,wo),window.removeEventListener("test",wo,wo)}catch{lf=!1}var yr=null,cf=null,lc=null;function Ay(){if(lc)return lc;var n,r=cf,o=r.length,c,m="value"in yr?yr.value:yr.textContent,g=m.length;for(n=0;n<o&&r[n]===m[n];n++);var S=o-n;for(c=1;c<=S&&r[o-c]===m[g-c];c++);return lc=m.slice(n,1<c?1-c:void 0)}function cc(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function uc(){return!0}function _y(){return!1}function jn(n){function r(o,c,m,g,S){this._reactName=o,this._targetInst=m,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)?uc:_y,this.isPropagationStopped=_y,this}return v(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=uc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=uc)},persist:function(){},isPersistent:uc}),r}var da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dc=jn(da),So=v({},da,{view:0,detail:0}),JC=jn(So),uf,df,Eo,fc=v({},So,{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!==Eo&&(Eo&&n.type==="mousemove"?(uf=n.screenX-Eo.screenX,df=n.screenY-Eo.screenY):df=uf=0,Eo=n),uf)},movementY:function(n){return"movementY"in n?n.movementY:df}}),ky=jn(fc),QC=v({},fc,{dataTransfer:0}),eR=jn(QC),tR=v({},So,{relatedTarget:0}),ff=jn(tR),nR=v({},da,{animationName:0,elapsedTime:0,pseudoElement:0}),sR=jn(nR),rR=v({},da,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),aR=jn(rR),iR=v({},da,{data:0}),My=jn(iR),oR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lR={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"},cR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uR(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=cR[n])?!!r[n]:!1}function hf(){return uR}var dR=v({},So,{key:function(n){if(n.key){var r=oR[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=cc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?lR[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"?cc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?cc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),fR=jn(dR),hR=v({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oy=jn(hR),pR=v({},So,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hf}),mR=jn(pR),gR=v({},da,{propertyName:0,elapsedTime:0,pseudoElement:0}),yR=jn(gR),vR=v({},fc,{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}),bR=jn(vR),xR=v({},da,{newState:0,oldState:0}),wR=jn(xR),SR=[9,13,27,32],pf=Ys&&"CompositionEvent"in window,No=null;Ys&&"documentMode"in document&&(No=document.documentMode);var ER=Ys&&"TextEvent"in window&&!No,Dy=Ys&&(!pf||No&&8<No&&11>=No),zy=" ",Iy=!1;function Ly(n,r){switch(n){case"keyup":return SR.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Py(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ni=!1;function NR(n,r){switch(n){case"compositionend":return Py(r);case"keypress":return r.which!==32?null:(Iy=!0,zy);case"textInput":return n=r.data,n===zy&&Iy?null:n;default:return null}}function TR(n,r){if(ni)return n==="compositionend"||!pf&&Ly(n,r)?(n=Ay(),lc=cf=yr=null,ni=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Dy&&r.locale!=="ko"?null:r.data;default:return null}}var jR={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 Uy(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!jR[n.type]:r==="textarea"}function Vy(n,r,o,c){ei?ti?ti.push(c):ti=[c]:ei=c,r=tu(r,"onChange"),0<r.length&&(o=new dc("onChange","change",null,o,c),n.push({event:o,listeners:r}))}var To=null,jo=null;function CR(n){Sb(n,0)}function hc(n){var r=bo(n);if(wy(r))return n}function $y(n,r){if(n==="change")return r}var By=!1;if(Ys){var mf;if(Ys){var gf="oninput"in document;if(!gf){var Zy=document.createElement("div");Zy.setAttribute("oninput","return;"),gf=typeof Zy.oninput=="function"}mf=gf}else mf=!1;By=mf&&(!document.documentMode||9<document.documentMode)}function Hy(){To&&(To.detachEvent("onpropertychange",Fy),jo=To=null)}function Fy(n){if(n.propertyName==="value"&&hc(jo)){var r=[];Vy(r,jo,n,af(n)),Ry(CR,r)}}function RR(n,r,o){n==="focusin"?(Hy(),To=r,jo=o,To.attachEvent("onpropertychange",Fy)):n==="focusout"&&Hy()}function AR(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return hc(jo)}function _R(n,r){if(n==="click")return hc(r)}function kR(n,r){if(n==="input"||n==="change")return hc(r)}function MR(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var Ln=typeof Object.is=="function"?Object.is:MR;function Co(n,r){if(Ln(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var o=Object.keys(n),c=Object.keys(r);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var m=o[c];if(!we.call(r,m)||!Ln(n[m],r[m]))return!1}return!0}function qy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Yy(n,r){var o=qy(n);n=0;for(var c;o;){if(o.nodeType===3){if(c=n+o.textContent.length,n<=r&&c>=r)return{node:o,offset:r-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=qy(o)}}function Gy(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Gy(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Xy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=ic(n.document);r instanceof n.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)n=r.contentWindow;else break;r=ic(n.document)}return r}function yf(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var OR=Ys&&"documentMode"in document&&11>=document.documentMode,si=null,vf=null,Ro=null,bf=!1;function Ky(n,r,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;bf||si==null||si!==ic(c)||(c=si,"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&&Co(Ro,c)||(Ro=c,c=tu(vf,"onSelect"),0<c.length&&(r=new dc("onSelect","select",null,r,o),n.push({event:r,listeners:c}),r.target=si)))}function fa(n,r){var o={};return o[n.toLowerCase()]=r.toLowerCase(),o["Webkit"+n]="webkit"+r,o["Moz"+n]="moz"+r,o}var ri={animationend:fa("Animation","AnimationEnd"),animationiteration:fa("Animation","AnimationIteration"),animationstart:fa("Animation","AnimationStart"),transitionrun:fa("Transition","TransitionRun"),transitionstart:fa("Transition","TransitionStart"),transitioncancel:fa("Transition","TransitionCancel"),transitionend:fa("Transition","TransitionEnd")},xf={},Wy={};Ys&&(Wy=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 ha(n){if(xf[n])return xf[n];if(!ri[n])return n;var r=ri[n],o;for(o in r)if(r.hasOwnProperty(o)&&o in Wy)return xf[n]=r[o];return n}var Jy=ha("animationend"),Qy=ha("animationiteration"),ev=ha("animationstart"),DR=ha("transitionrun"),zR=ha("transitionstart"),IR=ha("transitioncancel"),tv=ha("transitionend"),nv=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 fs(n,r){nv.set(n,r),ua(r,[n])}var pc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Jn=[],ai=0,Sf=0;function mc(){for(var n=ai,r=Sf=ai=0;r<n;){var o=Jn[r];Jn[r++]=null;var c=Jn[r];Jn[r++]=null;var m=Jn[r];Jn[r++]=null;var g=Jn[r];if(Jn[r++]=null,c!==null&&m!==null){var S=c.pending;S===null?m.next=m:(m.next=S.next,S.next=m),c.pending=m}g!==0&&sv(o,m,g)}}function gc(n,r,o,c){Jn[ai++]=n,Jn[ai++]=r,Jn[ai++]=o,Jn[ai++]=c,Sf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function Ef(n,r,o,c){return gc(n,r,o,c),yc(n)}function pa(n,r){return gc(n,null,null,r),yc(n)}function sv(n,r,o){n.lanes|=o;var c=n.alternate;c!==null&&(c.lanes|=o);for(var m=!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||(m=!0)),n=g,g=g.return;return n.tag===3?(g=n.stateNode,m&&r!==null&&(m=31-nt(o),n=g.hiddenUpdates,c=n[m],c===null?n[m]=[r]:c.push(r),r.lane=o|536870912),g):null}function yc(n){if(50<Ko)throw Ko=0,Mh=null,Error(a(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var ii={};function LR(n,r,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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(n,r,o,c){return new LR(n,r,o,c)}function Nf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Gs(n,r){var o=n.alternate;return o===null?(o=Pn(n.tag,r,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=r,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,r=n.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function rv(n,r){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=r,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,r=o.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function vc(n,r,o,c,m,g){var S=0;if(c=n,typeof n=="function")Nf(n)&&(S=1);else if(typeof n=="string")S=BA(n,o,se.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case F:return n=Pn(31,o,r,m),n.elementType=F,n.lanes=g,n;case T:return ma(o.children,m,g,r);case _:S=8,m|=24;break;case C:return n=Pn(12,o,r,m|2),n.elementType=C,n.lanes=g,n;case R:return n=Pn(13,o,r,m),n.elementType=R,n.lanes=g,n;case O:return n=Pn(19,o,r,m),n.elementType=O,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 A:S=11;break e;case M:S=14;break e;case z:S=16,c=null;break e}S=29,o=Error(a(130,n===null?"null":typeof n,"")),c=null}return r=Pn(S,o,r,m),r.elementType=n,r.type=c,r.lanes=g,r}function ma(n,r,o,c){return n=Pn(7,n,c,r),n.lanes=o,n}function Tf(n,r,o){return n=Pn(6,n,null,r),n.lanes=o,n}function av(n){var r=Pn(18,null,null,0);return r.stateNode=n,r}function jf(n,r,o){return r=Pn(4,n.children!==null?n.children:[],n.key,r),r.lanes=o,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var iv=new WeakMap;function Qn(n,r){if(typeof n=="object"&&n!==null){var o=iv.get(n);return o!==void 0?o:(r={value:n,source:r,stack:ye(r)},iv.set(n,r),r)}return{value:n,source:r,stack:ye(r)}}var oi=[],li=0,bc=null,Ao=0,es=[],ts=0,vr=null,js=1,Cs="";function Xs(n,r){oi[li++]=Ao,oi[li++]=bc,bc=n,Ao=r}function ov(n,r,o){es[ts++]=js,es[ts++]=Cs,es[ts++]=vr,vr=n;var c=js;n=Cs;var m=32-nt(c)-1;c&=~(1<<m),o+=1;var g=32-nt(r)+m;if(30<g){var S=m-m%5;g=(c&(1<<S)-1).toString(32),c>>=S,m-=S,js=1<<32-nt(r)+m|o<<m|c,Cs=g+n}else js=1<<g|o<<m|c,Cs=n}function Cf(n){n.return!==null&&(Xs(n,1),ov(n,1,0))}function Rf(n){for(;n===bc;)bc=oi[--li],oi[li]=null,Ao=oi[--li],oi[li]=null;for(;n===vr;)vr=es[--ts],es[ts]=null,Cs=es[--ts],es[ts]=null,js=es[--ts],es[ts]=null}function lv(n,r){es[ts++]=js,es[ts++]=Cs,es[ts++]=vr,js=r.id,Cs=r.overflow,vr=n}var tn=null,bt=null,Je=!1,br=null,ns=!1,Af=Error(a(519));function xr(n){var r=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _o(Qn(r,n)),Af}function cv(n){var r=n.stateNode,o=n.type,c=n.memoizedProps;switch(r[en]=n,r[Tn]=c,o){case"dialog":Ye("cancel",r),Ye("close",r);break;case"iframe":case"object":case"embed":Ye("load",r);break;case"video":case"audio":for(o=0;o<Jo.length;o++)Ye(Jo[o],r);break;case"source":Ye("error",r);break;case"img":case"image":case"link":Ye("error",r),Ye("load",r);break;case"details":Ye("toggle",r);break;case"input":Ye("invalid",r),Sy(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ye("invalid",r);break;case"textarea":Ye("invalid",r),Ny(r,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||c.suppressHydrationWarning===!0||jb(r.textContent,o)?(c.popover!=null&&(Ye("beforetoggle",r),Ye("toggle",r)),c.onScroll!=null&&Ye("scroll",r),c.onScrollEnd!=null&&Ye("scrollend",r),c.onClick!=null&&(r.onclick=qs),r=!0):r=!1,r||xr(n,!0)}function uv(n){for(tn=n.return;tn;)switch(tn.tag){case 5:case 31:case 13:ns=!1;return;case 27:case 3:ns=!0;return;default:tn=tn.return}}function ci(n){if(n!==tn)return!1;if(!Je)return uv(n),Je=!0,!1;var r=n.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||Yh(n.type,n.memoizedProps)),o=!o),o&&bt&&xr(n),uv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));bt=zb(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));bt=zb(n)}else r===27?(r=bt,Dr(n.type)?(n=Jh,Jh=null,bt=n):bt=r):bt=tn?rs(n.stateNode.nextSibling):null;return!0}function ga(){bt=tn=null,Je=!1}function _f(){var n=br;return n!==null&&(_n===null?_n=n:_n.push.apply(_n,n),br=null),n}function _o(n){br===null?br=[n]:br.push(n)}var kf=D(null),ya=null,Ks=null;function wr(n,r,o){K(kf,r._currentValue),r._currentValue=o}function Ws(n){n._currentValue=kf.current,P(kf)}function Mf(n,r,o){for(;n!==null;){var c=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),n===o)break;n=n.return}}function Of(n,r,o,c){var m=n.child;for(m!==null&&(m.return=n);m!==null;){var g=m.dependencies;if(g!==null){var S=m.child;g=g.firstContext;e:for(;g!==null;){var k=g;g=m;for(var L=0;L<r.length;L++)if(k.context===r[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(m.tag===18){if(S=m.return,S===null)throw Error(a(341));S.lanes|=o,g=S.alternate,g!==null&&(g.lanes|=o),Mf(S,o,n),S=null}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===n){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}}function ui(n,r,o,c){n=null;for(var m=r,g=!1;m!==null;){if(!g){if((m.flags&524288)!==0)g=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var k=m.type;Ln(m.pendingProps.value,S.value)||(n!==null?n.push(k):n=[k])}}else if(m===he.current){if(S=m.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(n!==null?n.push(sl):n=[sl])}m=m.return}n!==null&&Of(r,n,o,c),r.flags|=262144}function xc(n){for(n=n.firstContext;n!==null;){if(!Ln(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function va(n){ya=n,Ks=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function nn(n){return dv(ya,n)}function wc(n,r){return ya===null&&va(n),dv(n,r)}function dv(n,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Ks===null){if(n===null)throw Error(a(308));Ks=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Ks=Ks.next=r;return o}var PR=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(o,c){n.push(c)}};this.abort=function(){r.aborted=!0,n.forEach(function(o){return o()})}},UR=e.unstable_scheduleCallback,VR=e.unstable_NormalPriority,Ut={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Df(){return{controller:new PR,data:new Map,refCount:0}}function ko(n){n.refCount--,n.refCount===0&&UR(VR,function(){n.controller.abort()})}var Mo=null,zf=0,di=0,fi=null;function $R(n,r){if(Mo===null){var o=Mo=[];zf=0,di=Ph(),fi={status:"pending",value:void 0,then:function(c){o.push(c)}}}return zf++,r.then(fv,fv),r}function fv(){if(--zf===0&&Mo!==null){fi!==null&&(fi.status="fulfilled");var n=Mo;Mo=null,di=0,fi=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function BR(n,r){var o=[],c={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return n.then(function(){c.status="fulfilled",c.value=r;for(var m=0;m<o.length;m++)(0,o[m])(r)},function(m){for(c.status="rejected",c.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),c}var hv=I.S;I.S=function(n,r){K0=Se(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&$R(n,r),hv!==null&&hv(n,r)};var ba=D(null);function If(){var n=ba.current;return n!==null?n:pt.pooledCache}function Sc(n,r){r===null?K(ba,ba.current):K(ba,r.pool)}function pv(){var n=If();return n===null?null:{parent:Ut._currentValue,pool:n}}var hi=Error(a(460)),Lf=Error(a(474)),Ec=Error(a(542)),Nc={then:function(){}};function mv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function gv(n,r,o){switch(o=n[o],o===void 0?n.push(r):o!==r&&(r.then(qs,qs),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,vv(n),n;default:if(typeof r.status=="string")r.then(qs,qs);else{if(n=pt,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=r,n.status="pending",n.then(function(c){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=c}},function(c){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,vv(n),n}throw wa=r,hi}}function xa(n){try{var r=n._init;return r(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(wa=o,hi):o}}var wa=null;function yv(){if(wa===null)throw Error(a(459));var n=wa;return wa=null,n}function vv(n){if(n===hi||n===Ec)throw Error(a(483))}var pi=null,Oo=0;function Tc(n){var r=Oo;return Oo+=1,pi===null&&(pi=[]),gv(pi,n,r)}function Do(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function jc(n,r){throw r.$$typeof===x?Error(a(525)):(n=Object.prototype.toString.call(r),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function bv(n){function r(q,V){if(n){var G=q.deletions;G===null?(q.deletions=[V],q.flags|=16):G.push(V)}}function o(q,V){if(!n)return null;for(;V!==null;)r(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 m(q,V){return q=Gs(q,V),q.index=0,q.sibling=null,q}function g(q,V,G){return q.index=G,n?(G=q.alternate,G!==null?(G=G.index,G<V?(q.flags|=67108866,V):G):(q.flags|=67108866,V)):(q.flags|=1048576,V)}function S(q){return n&&q.alternate===null&&(q.flags|=67108866),q}function k(q,V,G,ue){return V===null||V.tag!==6?(V=Tf(G,q.mode,ue),V.return=q,V):(V=m(V,G),V.return=q,V)}function L(q,V,G,ue){var Me=G.type;return Me===T?le(q,V,G.props.children,ue,G.key):V!==null&&(V.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===z&&xa(Me)===V.type)?(V=m(V,G.props),Do(V,G),V.return=q,V):(V=vc(G.type,G.key,G.props,null,q.mode,ue),Do(V,G),V.return=q,V)}function X(q,V,G,ue){return V===null||V.tag!==4||V.stateNode.containerInfo!==G.containerInfo||V.stateNode.implementation!==G.implementation?(V=jf(G,q.mode,ue),V.return=q,V):(V=m(V,G.children||[]),V.return=q,V)}function le(q,V,G,ue,Me){return V===null||V.tag!==7?(V=ma(G,q.mode,ue,Me),V.return=q,V):(V=m(V,G),V.return=q,V)}function de(q,V,G){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Tf(""+V,q.mode,G),V.return=q,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return G=vc(V.type,V.key,V.props,null,q.mode,G),Do(G,V),G.return=q,G;case N:return V=jf(V,q.mode,G),V.return=q,V;case z:return V=xa(V),de(q,V,G)}if(ee(V)||H(V))return V=ma(V,q.mode,G,null),V.return=q,V;if(typeof V.then=="function")return de(q,Tc(V),G);if(V.$$typeof===E)return de(q,wc(q,V),G);jc(q,V)}return null}function Q(q,V,G,ue){var Me=V!==null?V.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Me!==null?null:k(q,V,""+G,ue);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return G.key===Me?L(q,V,G,ue):null;case N:return G.key===Me?X(q,V,G,ue):null;case z:return G=xa(G),Q(q,V,G,ue)}if(ee(G)||H(G))return Me!==null?null:le(q,V,G,ue,null);if(typeof G.then=="function")return Q(q,V,Tc(G),ue);if(G.$$typeof===E)return Q(q,V,wc(q,G),ue);jc(q,G)}return null}function ne(q,V,G,ue,Me){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return q=q.get(G)||null,k(V,q,""+ue,Me);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:return q=q.get(ue.key===null?G:ue.key)||null,L(V,q,ue,Me);case N:return q=q.get(ue.key===null?G:ue.key)||null,X(V,q,ue,Me);case z:return ue=xa(ue),ne(q,V,G,ue,Me)}if(ee(ue)||H(ue))return q=q.get(G)||null,le(V,q,ue,Me,null);if(typeof ue.then=="function")return ne(q,V,G,Tc(ue),Me);if(ue.$$typeof===E)return ne(q,V,G,wc(V,ue),Me);jc(V,ue)}return null}function Ne(q,V,G,ue){for(var Me=null,st=null,Ae=V,Be=V=0,Ke=null;Ae!==null&&Be<G.length;Be++){Ae.index>Be?(Ke=Ae,Ae=null):Ke=Ae.sibling;var rt=Q(q,Ae,G[Be],ue);if(rt===null){Ae===null&&(Ae=Ke);break}n&&Ae&&rt.alternate===null&&r(q,Ae),V=g(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt,Ae=Ke}if(Be===G.length)return o(q,Ae),Je&&Xs(q,Be),Me;if(Ae===null){for(;Be<G.length;Be++)Ae=de(q,G[Be],ue),Ae!==null&&(V=g(Ae,V,Be),st===null?Me=Ae:st.sibling=Ae,st=Ae);return Je&&Xs(q,Be),Me}for(Ae=c(Ae);Be<G.length;Be++)Ke=ne(Ae,q,Be,G[Be],ue),Ke!==null&&(n&&Ke.alternate!==null&&Ae.delete(Ke.key===null?Be:Ke.key),V=g(Ke,V,Be),st===null?Me=Ke:st.sibling=Ke,st=Ke);return n&&Ae.forEach(function(Ur){return r(q,Ur)}),Je&&Xs(q,Be),Me}function ze(q,V,G,ue){if(G==null)throw Error(a(151));for(var Me=null,st=null,Ae=V,Be=V=0,Ke=null,rt=G.next();Ae!==null&&!rt.done;Be++,rt=G.next()){Ae.index>Be?(Ke=Ae,Ae=null):Ke=Ae.sibling;var Ur=Q(q,Ae,rt.value,ue);if(Ur===null){Ae===null&&(Ae=Ke);break}n&&Ae&&Ur.alternate===null&&r(q,Ae),V=g(Ur,V,Be),st===null?Me=Ur:st.sibling=Ur,st=Ur,Ae=Ke}if(rt.done)return o(q,Ae),Je&&Xs(q,Be),Me;if(Ae===null){for(;!rt.done;Be++,rt=G.next())rt=de(q,rt.value,ue),rt!==null&&(V=g(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt);return Je&&Xs(q,Be),Me}for(Ae=c(Ae);!rt.done;Be++,rt=G.next())rt=ne(Ae,q,Be,rt.value,ue),rt!==null&&(n&&rt.alternate!==null&&Ae.delete(rt.key===null?Be:rt.key),V=g(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt);return n&&Ae.forEach(function(QA){return r(q,QA)}),Je&&Xs(q,Be),Me}function ht(q,V,G,ue){if(typeof G=="object"&&G!==null&&G.type===T&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case w:e:{for(var Me=G.key;V!==null;){if(V.key===Me){if(Me=G.type,Me===T){if(V.tag===7){o(q,V.sibling),ue=m(V,G.props.children),ue.return=q,q=ue;break e}}else if(V.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===z&&xa(Me)===V.type){o(q,V.sibling),ue=m(V,G.props),Do(ue,G),ue.return=q,q=ue;break e}o(q,V);break}else r(q,V);V=V.sibling}G.type===T?(ue=ma(G.props.children,q.mode,ue,G.key),ue.return=q,q=ue):(ue=vc(G.type,G.key,G.props,null,q.mode,ue),Do(ue,G),ue.return=q,q=ue)}return S(q);case N:e:{for(Me=G.key;V!==null;){if(V.key===Me)if(V.tag===4&&V.stateNode.containerInfo===G.containerInfo&&V.stateNode.implementation===G.implementation){o(q,V.sibling),ue=m(V,G.children||[]),ue.return=q,q=ue;break e}else{o(q,V);break}else r(q,V);V=V.sibling}ue=jf(G,q.mode,ue),ue.return=q,q=ue}return S(q);case z:return G=xa(G),ht(q,V,G,ue)}if(ee(G))return Ne(q,V,G,ue);if(H(G)){if(Me=H(G),typeof Me!="function")throw Error(a(150));return G=Me.call(G),ze(q,V,G,ue)}if(typeof G.then=="function")return ht(q,V,Tc(G),ue);if(G.$$typeof===E)return ht(q,V,wc(q,G),ue);jc(q,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,V!==null&&V.tag===6?(o(q,V.sibling),ue=m(V,G),ue.return=q,q=ue):(o(q,V),ue=Tf(G,q.mode,ue),ue.return=q,q=ue),S(q)):o(q,V)}return function(q,V,G,ue){try{Oo=0;var Me=ht(q,V,G,ue);return pi=null,Me}catch(Ae){if(Ae===hi||Ae===Ec)throw Ae;var st=Pn(29,Ae,null,q.mode);return st.lanes=ue,st.return=q,st}}}var Sa=bv(!0),xv=bv(!1),Sr=!1;function Pf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uf(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Er(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Nr(n,r,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(at&2)!==0){var m=c.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),c.pending=r,r=yc(n),sv(n,null,o),r}return gc(n,c,r,o),yc(n)}function zo(n,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var c=r.lanes;c&=n.pendingLanes,o|=c,r.lanes=o,ec(n,o)}}function Vf(n,r){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var m=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?m=g=S:g=g.next=S,o=o.next}while(o!==null);g===null?m=g=r:g=g.next=r}else m=g=r;o={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=r:n.next=r,o.lastBaseUpdate=r}var $f=!1;function Io(){if($f){var n=fi;if(n!==null)throw n}}function Lo(n,r,o,c){$f=!1;var m=n.updateQueue;Sr=!1;var g=m.firstBaseUpdate,S=m.lastBaseUpdate,k=m.shared.pending;if(k!==null){m.shared.pending=null;var L=k,X=L.next;L.next=null,S===null?g=X:S.next=X,S=L;var le=n.alternate;le!==null&&(le=le.updateQueue,k=le.lastBaseUpdate,k!==S&&(k===null?le.firstBaseUpdate=X:k.next=X,le.lastBaseUpdate=L))}if(g!==null){var de=m.baseState;S=0,le=X=L=null,k=g;do{var Q=k.lane&-536870913,ne=Q!==k.lane;if(ne?(Xe&Q)===Q:(c&Q)===Q){Q!==0&&Q===di&&($f=!0),le!==null&&(le=le.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ne=n,ze=k;Q=r;var ht=o;switch(ze.tag){case 1:if(Ne=ze.payload,typeof Ne=="function"){de=Ne.call(ht,de,Q);break e}de=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=ze.payload,Q=typeof Ne=="function"?Ne.call(ht,de,Q):Ne,Q==null)break e;de=v({},de,Q);break e;case 2:Sr=!0}}Q=k.callback,Q!==null&&(n.flags|=64,ne&&(n.flags|=8192),ne=m.callbacks,ne===null?m.callbacks=[Q]:ne.push(Q))}else ne={lane:Q,tag:k.tag,payload:k.payload,callback:k.callback,next:null},le===null?(X=le=ne,L=de):le=le.next=ne,S|=Q;if(k=k.next,k===null){if(k=m.shared.pending,k===null)break;ne=k,k=ne.next,ne.next=null,m.lastBaseUpdate=ne,m.shared.pending=null}}while(!0);le===null&&(L=de),m.baseState=L,m.firstBaseUpdate=X,m.lastBaseUpdate=le,g===null&&(m.shared.lanes=0),Ar|=S,n.lanes=S,n.memoizedState=de}}function wv(n,r){if(typeof n!="function")throw Error(a(191,n));n.call(r)}function Sv(n,r){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)wv(o[n],r)}var mi=D(null),Cc=D(0);function Ev(n,r){n=ir,K(Cc,n),K(mi,r),ir=n|r.baseLanes}function Bf(){K(Cc,ir),K(mi,mi.current)}function Zf(){ir=Cc.current,P(mi),P(Cc)}var Un=D(null),ss=null;function Tr(n){var r=n.alternate;K(It,It.current&1),K(Un,n),ss===null&&(r===null||mi.current!==null||r.memoizedState!==null)&&(ss=n)}function Hf(n){K(It,It.current),K(Un,n),ss===null&&(ss=n)}function Nv(n){n.tag===22?(K(It,It.current),K(Un,n),ss===null&&(ss=n)):jr()}function jr(){K(It,It.current),K(Un,Un.current)}function Vn(n){P(Un),ss===n&&(ss=null),P(It)}var It=D(0);function Rc(n){for(var r=n;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Kh(o)||Wh(o)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Js=0,$e=null,dt=null,Vt=null,Ac=!1,gi=!1,Ea=!1,_c=0,Po=0,yi=null,ZR=0;function Mt(){throw Error(a(321))}function Ff(n,r){if(r===null)return!1;for(var o=0;o<r.length&&o<n.length;o++)if(!Ln(n[o],r[o]))return!1;return!0}function qf(n,r,o,c,m,g){return Js=g,$e=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,I.H=n===null||n.memoizedState===null?o0:oh,Ea=!1,g=o(c,m),Ea=!1,gi&&(g=jv(r,o,c,m)),Tv(n),g}function Tv(n){I.H=$o;var r=dt!==null&&dt.next!==null;if(Js=0,Vt=dt=$e=null,Ac=!1,Po=0,yi=null,r)throw Error(a(300));n===null||$t||(n=n.dependencies,n!==null&&xc(n)&&($t=!0))}function jv(n,r,o,c){$e=n;var m=0;do{if(gi&&(yi=null),Po=0,gi=!1,25<=m)throw Error(a(301));if(m+=1,Vt=dt=null,n.updateQueue!=null){var g=n.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}I.H=l0,g=r(o,c)}while(gi);return g}function HR(){var n=I.H,r=n.useState()[0];return r=typeof r.then=="function"?Uo(r):r,n=n.useState()[0],(dt!==null?dt.memoizedState:null)!==n&&($e.flags|=1024),r}function Yf(){var n=_c!==0;return _c=0,n}function Gf(n,r,o){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~o}function Xf(n){if(Ac){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Ac=!1}Js=0,Vt=dt=$e=null,gi=!1,Po=_c=0,yi=null}function gn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?$e.memoizedState=Vt=n:Vt=Vt.next=n,Vt}function Lt(){if(dt===null){var n=$e.alternate;n=n!==null?n.memoizedState:null}else n=dt.next;var r=Vt===null?$e.memoizedState:Vt.next;if(r!==null)Vt=r,dt=n;else{if(n===null)throw $e.alternate===null?Error(a(467)):Error(a(310));dt=n,n={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},Vt===null?$e.memoizedState=Vt=n:Vt=Vt.next=n}return Vt}function kc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Uo(n){var r=Po;return Po+=1,yi===null&&(yi=[]),n=gv(yi,n,r),r=$e,(Vt===null?r.memoizedState:Vt.next)===null&&(r=r.alternate,I.H=r===null||r.memoizedState===null?o0:oh),n}function Mc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Uo(n);if(n.$$typeof===E)return nn(n)}throw Error(a(438,String(n)))}function Kf(n){var r=null,o=$e.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var c=$e.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=kc(),$e.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(n),c=0;c<n;c++)o[c]=Z;return r.index++,o}function Qs(n,r){return typeof r=="function"?r(n):r}function Oc(n){var r=Lt();return Wf(r,dt,n)}function Wf(n,r,o){var c=n.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=o;var m=n.baseQueue,g=c.pending;if(g!==null){if(m!==null){var S=m.next;m.next=g.next,g.next=S}r.baseQueue=m=g,c.pending=null}if(g=n.baseState,m===null)n.memoizedState=g;else{r=m.next;var k=S=null,L=null,X=r,le=!1;do{var de=X.lane&-536870913;if(de!==X.lane?(Xe&de)===de:(Js&de)===de){var Q=X.revertLane;if(Q===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),de===di&&(le=!0);else if((Js&Q)===Q){X=X.next,Q===di&&(le=!0);continue}else de={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},L===null?(k=L=de,S=g):L=L.next=de,$e.lanes|=Q,Ar|=Q;de=X.action,Ea&&o(g,de),g=X.hasEagerState?X.eagerState:o(g,de)}else Q={lane:de,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},L===null?(k=L=Q,S=g):L=L.next=Q,$e.lanes|=de,Ar|=de;X=X.next}while(X!==null&&X!==r);if(L===null?S=g:L.next=k,!Ln(g,n.memoizedState)&&($t=!0,le&&(o=fi,o!==null)))throw o;n.memoizedState=g,n.baseState=S,n.baseQueue=L,c.lastRenderedState=g}return m===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Jf(n){var r=Lt(),o=r.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=n;var c=o.dispatch,m=o.pending,g=r.memoizedState;if(m!==null){o.pending=null;var S=m=m.next;do g=n(g,S.action),S=S.next;while(S!==m);Ln(g,r.memoizedState)||($t=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),o.lastRenderedState=g}return[g,c]}function Cv(n,r,o){var c=$e,m=Lt(),g=Je;if(g){if(o===void 0)throw Error(a(407));o=o()}else o=r();var S=!Ln((dt||m).memoizedState,o);if(S&&(m.memoizedState=o,$t=!0),m=m.queue,th(_v.bind(null,c,m,n),[n]),m.getSnapshot!==r||S||Vt!==null&&Vt.memoizedState.tag&1){if(c.flags|=2048,vi(9,{destroy:void 0},Av.bind(null,c,m,o,r),null),pt===null)throw Error(a(349));g||(Js&127)!==0||Rv(c,r,o)}return o}function Rv(n,r,o){n.flags|=16384,n={getSnapshot:r,value:o},r=$e.updateQueue,r===null?(r=kc(),$e.updateQueue=r,r.stores=[n]):(o=r.stores,o===null?r.stores=[n]:o.push(n))}function Av(n,r,o,c){r.value=o,r.getSnapshot=c,kv(r)&&Mv(n)}function _v(n,r,o){return o(function(){kv(r)&&Mv(n)})}function kv(n){var r=n.getSnapshot;n=n.value;try{var o=r();return!Ln(n,o)}catch{return!0}}function Mv(n){var r=pa(n,2);r!==null&&kn(r,n,2)}function Qf(n){var r=gn();if(typeof n=="function"){var o=n;if(n=o(),Ea){et(!0);try{o()}finally{et(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:n},r}function Ov(n,r,o,c){return n.baseState=o,Wf(n,dt,typeof c=="function"?c:Qs)}function FR(n,r,o,c,m){if(Ic(n))throw Error(a(485));if(n=r.action,n!==null){var g={payload:m,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){g.listeners.push(S)}};I.T!==null?o(!0):g.isTransition=!1,c(g),o=r.pending,o===null?(g.next=r.pending=g,Dv(r,g)):(g.next=o.next,r.pending=o.next=g)}}function Dv(n,r){var o=r.action,c=r.payload,m=n.state;if(r.isTransition){var g=I.T,S={};I.T=S;try{var k=o(m,c),L=I.S;L!==null&&L(S,k),zv(n,r,k)}catch(X){eh(n,r,X)}finally{g!==null&&S.types!==null&&(g.types=S.types),I.T=g}}else try{g=o(m,c),zv(n,r,g)}catch(X){eh(n,r,X)}}function zv(n,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Iv(n,r,c)},function(c){return eh(n,r,c)}):Iv(n,r,o)}function Iv(n,r,o){r.status="fulfilled",r.value=o,Lv(r),n.state=o,r=n.pending,r!==null&&(o=r.next,o===r?n.pending=null:(o=o.next,r.next=o,Dv(n,o)))}function eh(n,r,o){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=o,Lv(r),r=r.next;while(r!==c)}n.action=null}function Lv(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function Pv(n,r){return r}function Uv(n,r){if(Je){var o=pt.formState;if(o!==null){e:{var c=$e;if(Je){if(bt){t:{for(var m=bt,g=ns;m.nodeType!==8;){if(!g){m=null;break t}if(m=rs(m.nextSibling),m===null){m=null;break t}}g=m.data,m=g==="F!"||g==="F"?m:null}if(m){bt=rs(m.nextSibling),c=m.data==="F!";break e}}xr(c)}c=!1}c&&(r=o[0])}}return o=gn(),o.memoizedState=o.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pv,lastRenderedState:r},o.queue=c,o=r0.bind(null,$e,c),c.dispatch=o,c=Qf(!1),g=ih.bind(null,$e,!1,c.queue),c=gn(),m={state:r,dispatch:null,action:n,pending:null},c.queue=m,o=FR.bind(null,$e,m,g,o),m.dispatch=o,c.memoizedState=n,[r,o,!1]}function Vv(n){var r=Lt();return $v(r,dt,n)}function $v(n,r,o){if(r=Wf(n,r,Pv)[0],n=Oc(Qs)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=Uo(r)}catch(S){throw S===hi?Ec:S}else c=r;r=Lt();var m=r.queue,g=m.dispatch;return o!==r.memoizedState&&($e.flags|=2048,vi(9,{destroy:void 0},qR.bind(null,m,o),null)),[c,g,n]}function qR(n,r){n.action=r}function Bv(n){var r=Lt(),o=dt;if(o!==null)return $v(r,o,n);Lt(),r=r.memoizedState,o=Lt();var c=o.queue.dispatch;return o.memoizedState=n,[r,c,!1]}function vi(n,r,o,c){return n={tag:n,create:o,deps:c,inst:r,next:null},r=$e.updateQueue,r===null&&(r=kc(),$e.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=n.next=n:(c=o.next,o.next=n,n.next=c,r.lastEffect=n),n}function Zv(){return Lt().memoizedState}function Dc(n,r,o,c){var m=gn();$e.flags|=n,m.memoizedState=vi(1|r,{destroy:void 0},o,c===void 0?null:c)}function zc(n,r,o,c){var m=Lt();c=c===void 0?null:c;var g=m.memoizedState.inst;dt!==null&&c!==null&&Ff(c,dt.memoizedState.deps)?m.memoizedState=vi(r,g,o,c):($e.flags|=n,m.memoizedState=vi(1|r,g,o,c))}function Hv(n,r){Dc(8390656,8,n,r)}function th(n,r){zc(2048,8,n,r)}function YR(n){$e.flags|=4;var r=$e.updateQueue;if(r===null)r=kc(),$e.updateQueue=r,r.events=[n];else{var o=r.events;o===null?r.events=[n]:o.push(n)}}function Fv(n){var r=Lt().memoizedState;return YR({ref:r,nextImpl:n}),function(){if((at&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}function qv(n,r){return zc(4,2,n,r)}function Yv(n,r){return zc(4,4,n,r)}function Gv(n,r){if(typeof r=="function"){n=n();var o=r(n);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function Xv(n,r,o){o=o!=null?o.concat([n]):null,zc(4,4,Gv.bind(null,r,n),o)}function nh(){}function Kv(n,r){var o=Lt();r=r===void 0?null:r;var c=o.memoizedState;return r!==null&&Ff(r,c[1])?c[0]:(o.memoizedState=[n,r],n)}function Wv(n,r){var o=Lt();r=r===void 0?null:r;var c=o.memoizedState;if(r!==null&&Ff(r,c[1]))return c[0];if(c=n(),Ea){et(!0);try{n()}finally{et(!1)}}return o.memoizedState=[c,r],c}function sh(n,r,o){return o===void 0||(Js&1073741824)!==0&&(Xe&261930)===0?n.memoizedState=r:(n.memoizedState=o,n=J0(),$e.lanes|=n,Ar|=n,o)}function Jv(n,r,o,c){return Ln(o,r)?o:mi.current!==null?(n=sh(n,o,c),Ln(n,r)||($t=!0),n):(Js&42)===0||(Js&1073741824)!==0&&(Xe&261930)===0?($t=!0,n.memoizedState=o):(n=J0(),$e.lanes|=n,Ar|=n,r)}function Qv(n,r,o,c,m){var g=B.p;B.p=g!==0&&8>g?g:8;var S=I.T,k={};I.T=k,ih(n,!1,r,o);try{var L=m(),X=I.S;if(X!==null&&X(k,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var le=BR(L,c);Vo(n,r,le,Zn(n))}else Vo(n,r,c,Zn(n))}catch(de){Vo(n,r,{then:function(){},status:"rejected",reason:de},Zn())}finally{B.p=g,S!==null&&k.types!==null&&(S.types=k.types),I.T=S}}function GR(){}function rh(n,r,o,c){if(n.tag!==5)throw Error(a(476));var m=e0(n).queue;Qv(n,m,r,$,o===null?GR:function(){return t0(n),o(c)})}function e0(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:$},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:o},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function t0(n){var r=e0(n);r.next===null&&(r=n.alternate.memoizedState),Vo(n,r.next.queue,{},Zn())}function ah(){return nn(sl)}function n0(){return Lt().memoizedState}function s0(){return Lt().memoizedState}function XR(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var o=Zn();n=Er(o);var c=Nr(r,n,o);c!==null&&(kn(c,r,o),zo(c,r,o)),r={cache:Df()},n.payload=r;return}r=r.return}}function KR(n,r,o){var c=Zn();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ic(n)?a0(r,o):(o=Ef(n,r,o,c),o!==null&&(kn(o,n,c),i0(o,r,c)))}function r0(n,r,o){var c=Zn();Vo(n,r,o,c)}function Vo(n,r,o,c){var m={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Ic(n))a0(r,m);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var S=r.lastRenderedState,k=g(S,o);if(m.hasEagerState=!0,m.eagerState=k,Ln(k,S))return gc(n,r,m,0),pt===null&&mc(),!1}catch{}if(o=Ef(n,r,m,c),o!==null)return kn(o,n,c),i0(o,r,c),!0}return!1}function ih(n,r,o,c){if(c={lane:2,revertLane:Ph(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ic(n)){if(r)throw Error(a(479))}else r=Ef(n,o,c,2),r!==null&&kn(r,n,2)}function Ic(n){var r=n.alternate;return n===$e||r!==null&&r===$e}function a0(n,r){gi=Ac=!0;var o=n.pending;o===null?r.next=r:(r.next=o.next,o.next=r),n.pending=r}function i0(n,r,o){if((o&4194048)!==0){var c=r.lanes;c&=n.pendingLanes,o|=c,r.lanes=o,ec(n,o)}}var $o={readContext:nn,use:Mc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};$o.useEffectEvent=Mt;var o0={readContext:nn,use:Mc,useCallback:function(n,r){return gn().memoizedState=[n,r===void 0?null:r],n},useContext:nn,useEffect:Hv,useImperativeHandle:function(n,r,o){o=o!=null?o.concat([n]):null,Dc(4194308,4,Gv.bind(null,r,n),o)},useLayoutEffect:function(n,r){return Dc(4194308,4,n,r)},useInsertionEffect:function(n,r){Dc(4,2,n,r)},useMemo:function(n,r){var o=gn();r=r===void 0?null:r;var c=n();if(Ea){et(!0);try{n()}finally{et(!1)}}return o.memoizedState=[c,r],c},useReducer:function(n,r,o){var c=gn();if(o!==void 0){var m=o(r);if(Ea){et(!0);try{o(r)}finally{et(!1)}}}else m=r;return c.memoizedState=c.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},c.queue=n,n=n.dispatch=KR.bind(null,$e,n),[c.memoizedState,n]},useRef:function(n){var r=gn();return n={current:n},r.memoizedState=n},useState:function(n){n=Qf(n);var r=n.queue,o=r0.bind(null,$e,r);return r.dispatch=o,[n.memoizedState,o]},useDebugValue:nh,useDeferredValue:function(n,r){var o=gn();return sh(o,n,r)},useTransition:function(){var n=Qf(!1);return n=Qv.bind(null,$e,n.queue,!0,!1),gn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,o){var c=$e,m=gn();if(Je){if(o===void 0)throw Error(a(407));o=o()}else{if(o=r(),pt===null)throw Error(a(349));(Xe&127)!==0||Rv(c,r,o)}m.memoizedState=o;var g={value:o,getSnapshot:r};return m.queue=g,Hv(_v.bind(null,c,g,n),[n]),c.flags|=2048,vi(9,{destroy:void 0},Av.bind(null,c,g,o,r),null),o},useId:function(){var n=gn(),r=pt.identifierPrefix;if(Je){var o=Cs,c=js;o=(c&~(1<<32-nt(c)-1)).toString(32)+o,r="_"+r+"R_"+o,o=_c++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=ZR++,r="_"+r+"r_"+o.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:ah,useFormState:Uv,useActionState:Uv,useOptimistic:function(n){var r=gn();r.memoizedState=r.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=ih.bind(null,$e,!0,o),o.dispatch=r,[n,r]},useMemoCache:Kf,useCacheRefresh:function(){return gn().memoizedState=XR.bind(null,$e)},useEffectEvent:function(n){var r=gn(),o={impl:n};return r.memoizedState=o,function(){if((at&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}},oh={readContext:nn,use:Mc,useCallback:Kv,useContext:nn,useEffect:th,useImperativeHandle:Xv,useInsertionEffect:qv,useLayoutEffect:Yv,useMemo:Wv,useReducer:Oc,useRef:Zv,useState:function(){return Oc(Qs)},useDebugValue:nh,useDeferredValue:function(n,r){var o=Lt();return Jv(o,dt.memoizedState,n,r)},useTransition:function(){var n=Oc(Qs)[0],r=Lt().memoizedState;return[typeof n=="boolean"?n:Uo(n),r]},useSyncExternalStore:Cv,useId:n0,useHostTransitionStatus:ah,useFormState:Vv,useActionState:Vv,useOptimistic:function(n,r){var o=Lt();return Ov(o,dt,n,r)},useMemoCache:Kf,useCacheRefresh:s0};oh.useEffectEvent=Fv;var l0={readContext:nn,use:Mc,useCallback:Kv,useContext:nn,useEffect:th,useImperativeHandle:Xv,useInsertionEffect:qv,useLayoutEffect:Yv,useMemo:Wv,useReducer:Jf,useRef:Zv,useState:function(){return Jf(Qs)},useDebugValue:nh,useDeferredValue:function(n,r){var o=Lt();return dt===null?sh(o,n,r):Jv(o,dt.memoizedState,n,r)},useTransition:function(){var n=Jf(Qs)[0],r=Lt().memoizedState;return[typeof n=="boolean"?n:Uo(n),r]},useSyncExternalStore:Cv,useId:n0,useHostTransitionStatus:ah,useFormState:Bv,useActionState:Bv,useOptimistic:function(n,r){var o=Lt();return dt!==null?Ov(o,dt,n,r):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Kf,useCacheRefresh:s0};l0.useEffectEvent=Fv;function lh(n,r,o,c){r=n.memoizedState,o=o(c,r),o=o==null?r:v({},r,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var ch={enqueueSetState:function(n,r,o){n=n._reactInternals;var c=Zn(),m=Er(c);m.payload=r,o!=null&&(m.callback=o),r=Nr(n,m,c),r!==null&&(kn(r,n,c),zo(r,n,c))},enqueueReplaceState:function(n,r,o){n=n._reactInternals;var c=Zn(),m=Er(c);m.tag=1,m.payload=r,o!=null&&(m.callback=o),r=Nr(n,m,c),r!==null&&(kn(r,n,c),zo(r,n,c))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var o=Zn(),c=Er(o);c.tag=2,r!=null&&(c.callback=r),r=Nr(n,c,o),r!==null&&(kn(r,n,o),zo(r,n,o))}};function c0(n,r,o,c,m,g,S){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,g,S):r.prototype&&r.prototype.isPureReactComponent?!Co(o,c)||!Co(m,g):!0}function u0(n,r,o,c){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,c),r.state!==n&&ch.enqueueReplaceState(r,r.state,null)}function Na(n,r){var o=r;if("ref"in r){o={};for(var c in r)c!=="ref"&&(o[c]=r[c])}if(n=n.defaultProps){o===r&&(o=v({},o));for(var m in n)o[m]===void 0&&(o[m]=n[m])}return o}function d0(n){pc(n)}function f0(n){console.error(n)}function h0(n){pc(n)}function Lc(n,r){try{var o=n.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function p0(n,r,o){try{var c=n.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function uh(n,r,o){return o=Er(o),o.tag=3,o.payload={element:null},o.callback=function(){Lc(n,r)},o}function m0(n){return n=Er(n),n.tag=3,n}function g0(n,r,o,c){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var g=c.value;n.payload=function(){return m(g)},n.callback=function(){p0(r,o,c)}}var S=o.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(n.callback=function(){p0(r,o,c),typeof m!="function"&&(_r===null?_r=new Set([this]):_r.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function WR(n,r,o,c,m){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=o.alternate,r!==null&&ui(r,o,m,!0),o=Un.current,o!==null){switch(o.tag){case 31:case 13:return ss===null?Xc():o.alternate===null&&Ot===0&&(Ot=3),o.flags&=-257,o.flags|=65536,o.lanes=m,c===Nc?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([c]):r.add(c),zh(n,c,m)),!1;case 22:return o.flags|=65536,c===Nc?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([c]):o.add(c)),zh(n,c,m)),!1}throw Error(a(435,o.tag))}return zh(n,c,m),Xc(),!1}if(Je)return r=Un.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,c!==Af&&(n=Error(a(422),{cause:c}),_o(Qn(n,o)))):(c!==Af&&(r=Error(a(423),{cause:c}),_o(Qn(r,o))),n=n.current.alternate,n.flags|=65536,m&=-m,n.lanes|=m,c=Qn(c,o),m=uh(n.stateNode,c,m),Vf(n,m),Ot!==4&&(Ot=2)),!1;var g=Error(a(520),{cause:c});if(g=Qn(g,o),Xo===null?Xo=[g]:Xo.push(g),Ot!==4&&(Ot=2),r===null)return!0;c=Qn(c,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,n=m&-m,o.lanes|=n,n=uh(o.stateNode,c,n),Vf(o,n),!1;case 1:if(r=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(_r===null||!_r.has(g))))return o.flags|=65536,m&=-m,o.lanes|=m,m=m0(m),g0(m,n,o,c),Vf(o,m),!1}o=o.return}while(o!==null);return!1}var dh=Error(a(461)),$t=!1;function sn(n,r,o,c){r.child=n===null?xv(r,null,o,c):Sa(r,n.child,o,c)}function y0(n,r,o,c,m){o=o.render;var g=r.ref;if("ref"in c){var S={};for(var k in c)k!=="ref"&&(S[k]=c[k])}else S=c;return va(r),c=qf(n,r,o,S,g,m),k=Yf(),n!==null&&!$t?(Gf(n,r,m),er(n,r,m)):(Je&&k&&Cf(r),r.flags|=1,sn(n,r,c,m),r.child)}function v0(n,r,o,c,m){if(n===null){var g=o.type;return typeof g=="function"&&!Nf(g)&&g.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=g,b0(n,r,g,c,m)):(n=vc(o.type,null,c,r,r.mode,m),n.ref=r.ref,n.return=r,r.child=n)}if(g=n.child,!bh(n,m)){var S=g.memoizedProps;if(o=o.compare,o=o!==null?o:Co,o(S,c)&&n.ref===r.ref)return er(n,r,m)}return r.flags|=1,n=Gs(g,c),n.ref=r.ref,n.return=r,r.child=n}function b0(n,r,o,c,m){if(n!==null){var g=n.memoizedProps;if(Co(g,c)&&n.ref===r.ref)if($t=!1,r.pendingProps=c=g,bh(n,m))(n.flags&131072)!==0&&($t=!0);else return r.lanes=n.lanes,er(n,r,m)}return fh(n,r,o,c,m)}function x0(n,r,o,c){var m=c.children,g=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((r.flags&128)!==0){if(g=g!==null?g.baseLanes|o:o,n!==null){for(c=r.child=n.child,m=0;c!==null;)m=m|c.lanes|c.childLanes,c=c.sibling;c=m&~g}else c=0,r.child=null;return w0(n,r,g,o,c)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Sc(r,g!==null?g.cachePool:null),g!==null?Ev(r,g):Bf(),Nv(r);else return c=r.lanes=536870912,w0(n,r,g!==null?g.baseLanes|o:o,o,c)}else g!==null?(Sc(r,g.cachePool),Ev(r,g),jr(),r.memoizedState=null):(n!==null&&Sc(r,null),Bf(),jr());return sn(n,r,m,o),r.child}function Bo(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function w0(n,r,o,c,m){var g=If();return g=g===null?null:{parent:Ut._currentValue,pool:g},r.memoizedState={baseLanes:o,cachePool:g},n!==null&&Sc(r,null),Bf(),Nv(r),n!==null&&ui(n,r,c,!0),r.childLanes=m,null}function Pc(n,r){return r=Vc({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function S0(n,r,o){return Sa(r,n.child,null,o),n=Pc(r,r.pendingProps),n.flags|=2,Vn(r),r.memoizedState=null,n}function JR(n,r,o){var c=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(Je){if(c.mode==="hidden")return n=Pc(r,c),r.lanes=536870912,Bo(null,n);if(Hf(r),(n=bt)?(n=Db(n,ns),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:vr!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=av(n),o.return=r,r.child=o,tn=r,bt=null)):n=null,n===null)throw xr(r);return r.lanes=536870912,null}return Pc(r,c)}var g=n.memoizedState;if(g!==null){var S=g.dehydrated;if(Hf(r),m)if(r.flags&256)r.flags&=-257,r=S0(n,r,o);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(a(558));else if($t||ui(n,r,o,!1),m=(o&n.childLanes)!==0,$t||m){if(c=pt,c!==null&&(S=tc(c,o),S!==0&&S!==g.retryLane))throw g.retryLane=S,pa(n,S),kn(c,n,S),dh;Xc(),r=S0(n,r,o)}else n=g.treeContext,bt=rs(S.nextSibling),tn=r,Je=!0,br=null,ns=!1,n!==null&&lv(r,n),r=Pc(r,c),r.flags|=4096;return r}return n=Gs(n.child,{mode:c.mode,children:c.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Uc(n,r){var o=r.ref;if(o===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(a(284));(n===null||n.ref!==o)&&(r.flags|=4194816)}}function fh(n,r,o,c,m){return va(r),o=qf(n,r,o,c,void 0,m),c=Yf(),n!==null&&!$t?(Gf(n,r,m),er(n,r,m)):(Je&&c&&Cf(r),r.flags|=1,sn(n,r,o,m),r.child)}function E0(n,r,o,c,m,g){return va(r),r.updateQueue=null,o=jv(r,c,o,m),Tv(n),c=Yf(),n!==null&&!$t?(Gf(n,r,g),er(n,r,g)):(Je&&c&&Cf(r),r.flags|=1,sn(n,r,o,g),r.child)}function N0(n,r,o,c,m){if(va(r),r.stateNode===null){var g=ii,S=o.contextType;typeof S=="object"&&S!==null&&(g=nn(S)),g=new o(c,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=ch,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=c,g.state=r.memoizedState,g.refs={},Pf(r),S=o.contextType,g.context=typeof S=="object"&&S!==null?nn(S):ii,g.state=r.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(lh(r,o,S,c),g.state=r.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),Lo(r,c,g,m),Io(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(n===null){g=r.stateNode;var k=r.memoizedProps,L=Na(o,k);g.props=L;var X=g.context,le=o.contextType;S=ii,typeof le=="object"&&le!==null&&(S=nn(le));var de=o.getDerivedStateFromProps;le=typeof de=="function"||typeof g.getSnapshotBeforeUpdate=="function",k=r.pendingProps!==k,le||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(k||X!==S)&&u0(r,g,c,S),Sr=!1;var Q=r.memoizedState;g.state=Q,Lo(r,c,g,m),Io(),X=r.memoizedState,k||Q!==X||Sr?(typeof de=="function"&&(lh(r,o,de,c),X=r.memoizedState),(L=Sr||c0(r,o,L,c,Q,X,S))?(le||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"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=X),g.props=c,g.state=X,g.context=S,c=L):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{g=r.stateNode,Uf(n,r),S=r.memoizedProps,le=Na(o,S),g.props=le,de=r.pendingProps,Q=g.context,X=o.contextType,L=ii,typeof X=="object"&&X!==null&&(L=nn(X)),k=o.getDerivedStateFromProps,(X=typeof k=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(S!==de||Q!==L)&&u0(r,g,c,L),Sr=!1,Q=r.memoizedState,g.state=Q,Lo(r,c,g,m),Io();var ne=r.memoizedState;S!==de||Q!==ne||Sr||n!==null&&n.dependencies!==null&&xc(n.dependencies)?(typeof k=="function"&&(lh(r,o,k,c),ne=r.memoizedState),(le=Sr||c0(r,o,le,c,Q,ne,L)||n!==null&&n.dependencies!==null&&xc(n.dependencies))?(X||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,ne,L),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,ne,L)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=ne),g.props=c,g.state=ne,g.context=L,c=le):(typeof g.componentDidUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&Q===n.memoizedState||(r.flags|=1024),c=!1)}return g=c,Uc(n,r),c=(r.flags&128)!==0,g||c?(g=r.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,n!==null&&c?(r.child=Sa(r,n.child,null,m),r.child=Sa(r,null,o,m)):sn(n,r,o,m),r.memoizedState=g.state,n=r.child):n=er(n,r,m),n}function T0(n,r,o,c){return ga(),r.flags|=256,sn(n,r,o,c),r.child}var hh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ph(n){return{baseLanes:n,cachePool:pv()}}function mh(n,r,o){return n=n!==null?n.childLanes&~o:0,r&&(n|=Bn),n}function j0(n,r,o){var c=r.pendingProps,m=!1,g=(r.flags&128)!==0,S;if((S=g)||(S=n!==null&&n.memoizedState===null?!1:(It.current&2)!==0),S&&(m=!0,r.flags&=-129),S=(r.flags&32)!==0,r.flags&=-33,n===null){if(Je){if(m?Tr(r):jr(),(n=bt)?(n=Db(n,ns),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:vr!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=av(n),o.return=r,r.child=o,tn=r,bt=null)):n=null,n===null)throw xr(r);return Wh(n)?r.lanes=32:r.lanes=536870912,null}var k=c.children;return c=c.fallback,m?(jr(),m=r.mode,k=Vc({mode:"hidden",children:k},m),c=ma(c,m,o,null),k.return=r,c.return=r,k.sibling=c,r.child=k,c=r.child,c.memoizedState=ph(o),c.childLanes=mh(n,S,o),r.memoizedState=hh,Bo(null,c)):(Tr(r),gh(r,k))}var L=n.memoizedState;if(L!==null&&(k=L.dehydrated,k!==null)){if(g)r.flags&256?(Tr(r),r.flags&=-257,r=yh(n,r,o)):r.memoizedState!==null?(jr(),r.child=n.child,r.flags|=128,r=null):(jr(),k=c.fallback,m=r.mode,c=Vc({mode:"visible",children:c.children},m),k=ma(k,m,o,null),k.flags|=2,c.return=r,k.return=r,c.sibling=k,r.child=c,Sa(r,n.child,null,o),c=r.child,c.memoizedState=ph(o),c.childLanes=mh(n,S,o),r.memoizedState=hh,r=Bo(null,c));else if(Tr(r),Wh(k)){if(S=k.nextSibling&&k.nextSibling.dataset,S)var X=S.dgst;S=X,c=Error(a(419)),c.stack="",c.digest=S,_o({value:c,source:null,stack:null}),r=yh(n,r,o)}else if($t||ui(n,r,o,!1),S=(o&n.childLanes)!==0,$t||S){if(S=pt,S!==null&&(c=tc(S,o),c!==0&&c!==L.retryLane))throw L.retryLane=c,pa(n,c),kn(S,n,c),dh;Kh(k)||Xc(),r=yh(n,r,o)}else Kh(k)?(r.flags|=192,r.child=n.child,r=null):(n=L.treeContext,bt=rs(k.nextSibling),tn=r,Je=!0,br=null,ns=!1,n!==null&&lv(r,n),r=gh(r,c.children),r.flags|=4096);return r}return m?(jr(),k=c.fallback,m=r.mode,L=n.child,X=L.sibling,c=Gs(L,{mode:"hidden",children:c.children}),c.subtreeFlags=L.subtreeFlags&65011712,X!==null?k=Gs(X,k):(k=ma(k,m,o,null),k.flags|=2),k.return=r,c.return=r,c.sibling=k,r.child=c,Bo(null,c),c=r.child,k=n.child.memoizedState,k===null?k=ph(o):(m=k.cachePool,m!==null?(L=Ut._currentValue,m=m.parent!==L?{parent:L,pool:L}:m):m=pv(),k={baseLanes:k.baseLanes|o,cachePool:m}),c.memoizedState=k,c.childLanes=mh(n,S,o),r.memoizedState=hh,Bo(n.child,c)):(Tr(r),o=n.child,n=o.sibling,o=Gs(o,{mode:"visible",children:c.children}),o.return=r,o.sibling=null,n!==null&&(S=r.deletions,S===null?(r.deletions=[n],r.flags|=16):S.push(n)),r.child=o,r.memoizedState=null,o)}function gh(n,r){return r=Vc({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Vc(n,r){return n=Pn(22,n,null,r),n.lanes=0,n}function yh(n,r,o){return Sa(r,n.child,null,o),n=gh(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function C0(n,r,o){n.lanes|=r;var c=n.alternate;c!==null&&(c.lanes|=r),Mf(n.return,r,o)}function vh(n,r,o,c,m,g){var S=n.memoizedState;S===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:m,treeForkCount:g}:(S.isBackwards=r,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=o,S.tailMode=m,S.treeForkCount=g)}function R0(n,r,o){var c=r.pendingProps,m=c.revealOrder,g=c.tail;c=c.children;var S=It.current,k=(S&2)!==0;if(k?(S=S&1|2,r.flags|=128):S&=1,K(It,S),sn(n,r,c,o),c=Je?Ao:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&C0(n,o,r);else if(n.tag===19)C0(n,o,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(m){case"forwards":for(o=r.child,m=null;o!==null;)n=o.alternate,n!==null&&Rc(n)===null&&(m=o),o=o.sibling;o=m,o===null?(m=r.child,r.child=null):(m=o.sibling,o.sibling=null),vh(r,!1,m,o,g,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=r.child,r.child=null;m!==null;){if(n=m.alternate,n!==null&&Rc(n)===null){r.child=m;break}n=m.sibling,m.sibling=o,o=m,m=n}vh(r,!0,o,null,g,c);break;case"together":vh(r,!1,null,null,void 0,c);break;default:r.memoizedState=null}return r.child}function er(n,r,o){if(n!==null&&(r.dependencies=n.dependencies),Ar|=r.lanes,(o&r.childLanes)===0)if(n!==null){if(ui(n,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(a(153));if(r.child!==null){for(n=r.child,o=Gs(n,n.pendingProps),r.child=o,o.return=r;n.sibling!==null;)n=n.sibling,o=o.sibling=Gs(n,n.pendingProps),o.return=r;o.sibling=null}return r.child}function bh(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&xc(n)))}function QR(n,r,o){switch(r.tag){case 3:pe(r,r.stateNode.containerInfo),wr(r,Ut,n.memoizedState.cache),ga();break;case 27:case 5:Re(r);break;case 4:pe(r,r.stateNode.containerInfo);break;case 10:wr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Hf(r),null;break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(Tr(r),r.flags|=128,null):(o&r.child.childLanes)!==0?j0(n,r,o):(Tr(r),n=er(n,r,o),n!==null?n.sibling:null);Tr(r);break;case 19:var m=(n.flags&128)!==0;if(c=(o&r.childLanes)!==0,c||(ui(n,r,o,!1),c=(o&r.childLanes)!==0),m){if(c)return R0(n,r,o);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),K(It,It.current),c)break;return null;case 22:return r.lanes=0,x0(n,r,o,r.pendingProps);case 24:wr(r,Ut,n.memoizedState.cache)}return er(n,r,o)}function A0(n,r,o){if(n!==null)if(n.memoizedProps!==r.pendingProps)$t=!0;else{if(!bh(n,o)&&(r.flags&128)===0)return $t=!1,QR(n,r,o);$t=(n.flags&131072)!==0}else $t=!1,Je&&(r.flags&1048576)!==0&&ov(r,Ao,r.index);switch(r.lanes=0,r.tag){case 16:e:{var c=r.pendingProps;if(n=xa(r.elementType),r.type=n,typeof n=="function")Nf(n)?(c=Na(n,c),r.tag=1,r=N0(null,r,n,c,o)):(r.tag=0,r=fh(null,r,n,c,o));else{if(n!=null){var m=n.$$typeof;if(m===A){r.tag=11,r=y0(null,r,n,c,o);break e}else if(m===M){r.tag=14,r=v0(null,r,n,c,o);break e}}throw r=oe(n)||n,Error(a(306,r,""))}}return r;case 0:return fh(n,r,r.type,r.pendingProps,o);case 1:return c=r.type,m=Na(c,r.pendingProps),N0(n,r,c,m,o);case 3:e:{if(pe(r,r.stateNode.containerInfo),n===null)throw Error(a(387));c=r.pendingProps;var g=r.memoizedState;m=g.element,Uf(n,r),Lo(r,c,null,o);var S=r.memoizedState;if(c=S.cache,wr(r,Ut,c),c!==g.cache&&Of(r,[Ut],o,!0),Io(),c=S.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:S.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=T0(n,r,c,o);break e}else if(c!==m){m=Qn(Error(a(424)),r),_o(m),r=T0(n,r,c,o);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,bt=rs(n.firstChild),tn=r,Je=!0,br=null,ns=!0,o=xv(r,null,c,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ga(),c===m){r=er(n,r,o);break e}sn(n,r,c,o)}r=r.child}return r;case 26:return Uc(n,r),n===null?(o=Vb(r.type,null,r.pendingProps,null))?r.memoizedState=o:Je||(o=r.type,n=r.pendingProps,c=nu(ge.current).createElement(o),c[en]=r,c[Tn]=n,rn(c,o,n),Kt(c),r.stateNode=c):r.memoizedState=Vb(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return Re(r),n===null&&Je&&(c=r.stateNode=Lb(r.type,r.pendingProps,ge.current),tn=r,ns=!0,m=bt,Dr(r.type)?(Jh=m,bt=rs(c.firstChild)):bt=m),sn(n,r,r.pendingProps.children,o),Uc(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&Je&&((m=c=bt)&&(c=AA(c,r.type,r.pendingProps,ns),c!==null?(r.stateNode=c,tn=r,bt=rs(c.firstChild),ns=!1,m=!0):m=!1),m||xr(r)),Re(r),m=r.type,g=r.pendingProps,S=n!==null?n.memoizedProps:null,c=g.children,Yh(m,g)?c=null:S!==null&&Yh(m,S)&&(r.flags|=32),r.memoizedState!==null&&(m=qf(n,r,HR,null,null,o),sl._currentValue=m),Uc(n,r),sn(n,r,c,o),r.child;case 6:return n===null&&Je&&((n=o=bt)&&(o=_A(o,r.pendingProps,ns),o!==null?(r.stateNode=o,tn=r,bt=null,n=!0):n=!1),n||xr(r)),null;case 13:return j0(n,r,o);case 4:return pe(r,r.stateNode.containerInfo),c=r.pendingProps,n===null?r.child=Sa(r,null,c,o):sn(n,r,c,o),r.child;case 11:return y0(n,r,r.type,r.pendingProps,o);case 7:return sn(n,r,r.pendingProps,o),r.child;case 8:return sn(n,r,r.pendingProps.children,o),r.child;case 12:return sn(n,r,r.pendingProps.children,o),r.child;case 10:return c=r.pendingProps,wr(r,r.type,c.value),sn(n,r,c.children,o),r.child;case 9:return m=r.type._context,c=r.pendingProps.children,va(r),m=nn(m),c=c(m),r.flags|=1,sn(n,r,c,o),r.child;case 14:return v0(n,r,r.type,r.pendingProps,o);case 15:return b0(n,r,r.type,r.pendingProps,o);case 19:return R0(n,r,o);case 31:return JR(n,r,o);case 22:return x0(n,r,o,r.pendingProps);case 24:return va(r),c=nn(Ut),n===null?(m=If(),m===null&&(m=pt,g=Df(),m.pooledCache=g,g.refCount++,g!==null&&(m.pooledCacheLanes|=o),m=g),r.memoizedState={parent:c,cache:m},Pf(r),wr(r,Ut,m)):((n.lanes&o)!==0&&(Uf(n,r),Lo(r,null,null,o),Io()),m=n.memoizedState,g=r.memoizedState,m.parent!==c?(m={parent:c,cache:c},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),wr(r,Ut,c)):(c=g.cache,wr(r,Ut,c),c!==m.cache&&Of(r,[Ut],o,!0))),sn(n,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(a(156,r.tag))}function tr(n){n.flags|=4}function xh(n,r,o,c,m){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(m&335544128)===m)if(n.stateNode.complete)n.flags|=8192;else if(nb())n.flags|=8192;else throw wa=Nc,Lf}else n.flags&=-16777217}function _0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Fb(r))if(nb())n.flags|=8192;else throw wa=Nc,Lf}function $c(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?Ql():536870912,n.lanes|=r,Si|=r)}function Zo(n,r){if(!Je)switch(n.tailMode){case"hidden":r=n.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.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?r||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function xt(n){var r=n.alternate!==null&&n.alternate.child===n.child,o=0,c=0;if(r)for(var m=n.child;m!==null;)o|=m.lanes|m.childLanes,c|=m.subtreeFlags&65011712,c|=m.flags&65011712,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)o|=m.lanes|m.childLanes,c|=m.subtreeFlags,c|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=c,n.childLanes=o,r}function eA(n,r,o){var c=r.pendingProps;switch(Rf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(r),null;case 1:return xt(r),null;case 3:return o=r.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ws(Ut),xe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(ci(r)?tr(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,_f())),xt(r),null;case 26:var m=r.type,g=r.memoizedState;return n===null?(tr(r),g!==null?(xt(r),_0(r,g)):(xt(r),xh(r,m,null,c,o))):g?g!==n.memoizedState?(tr(r),xt(r),_0(r,g)):(xt(r),r.flags&=-16777217):(n=n.memoizedProps,n!==c&&tr(r),xt(r),xh(r,m,n,c,o)),null;case 27:if(fe(r),o=ge.current,m=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==c&&tr(r);else{if(!c){if(r.stateNode===null)throw Error(a(166));return xt(r),null}n=se.current,ci(r)?cv(r):(n=Lb(m,c,o),r.stateNode=n,tr(r))}return xt(r),null;case 5:if(fe(r),m=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==c&&tr(r);else{if(!c){if(r.stateNode===null)throw Error(a(166));return xt(r),null}if(g=se.current,ci(r))cv(r);else{var S=nu(ge.current);switch(g){case 1:g=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:g=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":g=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":g=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);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(m,{is:c.is}):S.createElement(m)}}g[en]=r,g[Tn]=c;e:for(S=r.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===r)break e;for(;S.sibling===null;){if(S.return===null||S.return===r)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}r.stateNode=g;e:switch(rn(g,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&tr(r)}}return xt(r),xh(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,o),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==c&&tr(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(a(166));if(n=ge.current,ci(r)){if(n=r.stateNode,o=r.memoizedProps,c=null,m=tn,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}n[en]=r,n=!!(n.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||jb(n.nodeValue,o)),n||xr(r,!0)}else n=nu(n).createTextNode(c),n[en]=r,r.stateNode=n}return xt(r),null;case 31:if(o=r.memoizedState,n===null||n.memoizedState!==null){if(c=ci(r),o!==null){if(n===null){if(!c)throw Error(a(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[en]=r}else ga(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;xt(r),n=!1}else o=_f(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return r.flags&256?(Vn(r),r):(Vn(r),null);if((r.flags&128)!==0)throw Error(a(558))}return xt(r),null;case 13:if(c=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=ci(r),c!==null&&c.dehydrated!==null){if(n===null){if(!m)throw Error(a(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));m[en]=r}else ga(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;xt(r),m=!1}else m=_f(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(Vn(r),r):(Vn(r),null)}return Vn(r),(r.flags&128)!==0?(r.lanes=o,r):(o=c!==null,n=n!==null&&n.memoizedState!==null,o&&(c=r.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==m&&(c.flags|=2048)),o!==n&&o&&(r.child.flags|=8192),$c(r,r.updateQueue),xt(r),null);case 4:return xe(),n===null&&Bh(r.stateNode.containerInfo),xt(r),null;case 10:return Ws(r.type),xt(r),null;case 19:if(P(It),c=r.memoizedState,c===null)return xt(r),null;if(m=(r.flags&128)!==0,g=c.rendering,g===null)if(m)Zo(c,!1);else{if(Ot!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(g=Rc(n),g!==null){for(r.flags|=128,Zo(c,!1),n=g.updateQueue,r.updateQueue=n,$c(r,n),r.subtreeFlags=0,n=o,o=r.child;o!==null;)rv(o,n),o=o.sibling;return K(It,It.current&1|2),Je&&Xs(r,c.treeForkCount),r.child}n=n.sibling}c.tail!==null&&Se()>qc&&(r.flags|=128,m=!0,Zo(c,!1),r.lanes=4194304)}else{if(!m)if(n=Rc(g),n!==null){if(r.flags|=128,m=!0,n=n.updateQueue,r.updateQueue=n,$c(r,n),Zo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Je)return xt(r),null}else 2*Se()-c.renderingStartTime>qc&&o!==536870912&&(r.flags|=128,m=!0,Zo(c,!1),r.lanes=4194304);c.isBackwards?(g.sibling=r.child,r.child=g):(n=c.last,n!==null?n.sibling=g:r.child=g,c.last=g)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=Se(),n.sibling=null,o=It.current,K(It,m?o&1|2:o&1),Je&&Xs(r,c.treeForkCount),n):(xt(r),null);case 22:case 23:return Vn(r),Zf(),c=r.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(o&536870912)!==0&&(r.flags&128)===0&&(xt(r),r.subtreeFlags&6&&(r.flags|=8192)):xt(r),o=r.updateQueue,o!==null&&$c(r,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==o&&(r.flags|=2048),n!==null&&P(ba),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Ws(Ut),xt(r),null;case 25:return null;case 30:return null}throw Error(a(156,r.tag))}function tA(n,r){switch(Rf(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ws(Ut),xe(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return fe(r),null;case 31:if(r.memoizedState!==null){if(Vn(r),r.alternate===null)throw Error(a(340));ga()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(Vn(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(a(340));ga()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return P(It),null;case 4:return xe(),null;case 10:return Ws(r.type),null;case 22:case 23:return Vn(r),Zf(),n!==null&&P(ba),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Ws(Ut),null;case 25:return null;default:return null}}function k0(n,r){switch(Rf(r),r.tag){case 3:Ws(Ut),xe();break;case 26:case 27:case 5:fe(r);break;case 4:xe();break;case 31:r.memoizedState!==null&&Vn(r);break;case 13:Vn(r);break;case 19:P(It);break;case 10:Ws(r.type);break;case 22:case 23:Vn(r),Zf(),n!==null&&P(ba);break;case 24:Ws(Ut)}}function Ho(n,r){try{var o=r.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var m=c.next;o=m;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!==m)}}catch(k){lt(r,r.return,k)}}function Cr(n,r,o){try{var c=r.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var g=m.next;c=g;do{if((c.tag&n)===n){var S=c.inst,k=S.destroy;if(k!==void 0){S.destroy=void 0,m=r;var L=o,X=k;try{X()}catch(le){lt(m,L,le)}}}c=c.next}while(c!==g)}}catch(le){lt(r,r.return,le)}}function M0(n){var r=n.updateQueue;if(r!==null){var o=n.stateNode;try{Sv(r,o)}catch(c){lt(n,n.return,c)}}}function O0(n,r,o){o.props=Na(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(c){lt(n,r,c)}}function Fo(n,r){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(m){lt(n,r,m)}}function Rs(n,r){var o=n.ref,c=n.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(m){lt(n,r,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){lt(n,r,m)}else o.current=null}function D0(n){var r=n.type,o=n.memoizedProps,c=n.stateNode;try{e:switch(r){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(m){lt(n,n.return,m)}}function wh(n,r,o){try{var c=n.stateNode;EA(c,n.type,o,r),c[Tn]=r}catch(m){lt(n,n.return,m)}}function z0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Dr(n.type)||n.tag===4}function Sh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||z0(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&&Dr(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,r,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(n),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=qs));else if(c!==4&&(c===27&&Dr(n.type)&&(o=n.stateNode,r=null),n=n.child,n!==null))for(Eh(n,r,o),n=n.sibling;n!==null;)Eh(n,r,o),n=n.sibling}function Bc(n,r,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?o.insertBefore(n,r):o.appendChild(n);else if(c!==4&&(c===27&&Dr(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Bc(n,r,o),n=n.sibling;n!==null;)Bc(n,r,o),n=n.sibling}function I0(n){var r=n.stateNode,o=n.memoizedProps;try{for(var c=n.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);rn(r,c,o),r[en]=n,r[Tn]=o}catch(g){lt(n,n.return,g)}}var nr=!1,Bt=!1,Nh=!1,L0=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function nA(n,r){if(n=n.containerInfo,Fh=cu,n=Xy(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 m=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,X=0,le=0,de=n,Q=null;t:for(;;){for(var ne;de!==o||m!==0&&de.nodeType!==3||(k=S+m),de!==g||c!==0&&de.nodeType!==3||(L=S+c),de.nodeType===3&&(S+=de.nodeValue.length),(ne=de.firstChild)!==null;)Q=de,de=ne;for(;;){if(de===n)break t;if(Q===o&&++X===m&&(k=S),Q===g&&++le===c&&(L=S),(ne=de.nextSibling)!==null)break;de=Q,Q=de.parentNode}de=ne}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},cu=!1,Wt=r;Wt!==null;)if(r=Wt,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Wt=n;else for(;Wt!==null;){switch(r=Wt,g=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)m=n[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&g!==null){n=void 0,o=r,m=g.memoizedProps,g=g.memoizedState,c=o.stateNode;try{var Ne=Na(o.type,m);n=c.getSnapshotBeforeUpdate(Ne,g),c.__reactInternalSnapshotBeforeUpdate=n}catch(ze){lt(o,o.return,ze)}}break;case 3:if((n&1024)!==0){if(n=r.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(a(163))}if(n=r.sibling,n!==null){n.return=r.return,Wt=n;break}Wt=r.return}}function P0(n,r,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:rr(n,o),c&4&&Ho(5,o);break;case 1:if(rr(n,o),c&4)if(n=o.stateNode,r===null)try{n.componentDidMount()}catch(S){lt(o,o.return,S)}else{var m=Na(o.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(m,r,n.__reactInternalSnapshotBeforeUpdate)}catch(S){lt(o,o.return,S)}}c&64&&M0(o),c&512&&Fo(o,o.return);break;case 3:if(rr(n,o),c&64&&(n=o.updateQueue,n!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Sv(n,r)}catch(S){lt(o,o.return,S)}}break;case 27:r===null&&c&4&&I0(o);case 26:case 5:rr(n,o),r===null&&c&4&&D0(o),c&512&&Fo(o,o.return);break;case 12:rr(n,o);break;case 31:rr(n,o),c&4&&$0(n,o);break;case 13:rr(n,o),c&4&&B0(n,o),c&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=dA.bind(null,o),kA(n,o))));break;case 22:if(c=o.memoizedState!==null||nr,!c){r=r!==null&&r.memoizedState!==null||Bt,m=nr;var g=Bt;nr=c,(Bt=r)&&!g?ar(n,o,(o.subtreeFlags&8772)!==0):rr(n,o),nr=m,Bt=g}break;case 30:break;default:rr(n,o)}}function U0(n){var r=n.alternate;r!==null&&(n.alternate=null,U0(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&Qd(r)),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,Cn=!1;function sr(n,r,o){for(o=o.child;o!==null;)V0(n,r,o),o=o.sibling}function V0(n,r,o){if(De&&typeof De.onCommitFiberUnmount=="function")try{De.onCommitFiberUnmount(Jt,o)}catch{}switch(o.tag){case 26:Bt||Rs(o,r),sr(n,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Bt||Rs(o,r);var c=Rt,m=Cn;Dr(o.type)&&(Rt=o.stateNode,Cn=!1),sr(n,r,o),el(o.stateNode),Rt=c,Cn=m;break;case 5:Bt||Rs(o,r);case 6:if(c=Rt,m=Cn,Rt=null,sr(n,r,o),Rt=c,Cn=m,Rt!==null)if(Cn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(o.stateNode)}catch(g){lt(o,r,g)}else try{Rt.removeChild(o.stateNode)}catch(g){lt(o,r,g)}break;case 18:Rt!==null&&(Cn?(n=Rt,Mb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),_i(n)):Mb(Rt,o.stateNode));break;case 4:c=Rt,m=Cn,Rt=o.stateNode.containerInfo,Cn=!0,sr(n,r,o),Rt=c,Cn=m;break;case 0:case 11:case 14:case 15:Cr(2,o,r),Bt||Cr(4,o,r),sr(n,r,o);break;case 1:Bt||(Rs(o,r),c=o.stateNode,typeof c.componentWillUnmount=="function"&&O0(o,r,c)),sr(n,r,o);break;case 21:sr(n,r,o);break;case 22:Bt=(c=Bt)||o.memoizedState!==null,sr(n,r,o),Bt=c;break;default:sr(n,r,o)}}function $0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{_i(n)}catch(o){lt(r,r.return,o)}}}function B0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{_i(n)}catch(o){lt(r,r.return,o)}}function sA(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new L0),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new L0),r;default:throw Error(a(435,n.tag))}}function Zc(n,r){var o=sA(n);r.forEach(function(c){if(!o.has(c)){o.add(c);var m=fA.bind(null,n,c);c.then(m,m)}})}function Rn(n,r){var o=r.deletions;if(o!==null)for(var c=0;c<o.length;c++){var m=o[c],g=n,S=r,k=S;e:for(;k!==null;){switch(k.tag){case 27:if(Dr(k.type)){Rt=k.stateNode,Cn=!1;break e}break;case 5:Rt=k.stateNode,Cn=!1;break e;case 3:case 4:Rt=k.stateNode.containerInfo,Cn=!0;break e}k=k.return}if(Rt===null)throw Error(a(160));V0(g,S,m),Rt=null,Cn=!1,g=m.alternate,g!==null&&(g.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Z0(r,n),r=r.sibling}var hs=null;function Z0(n,r){var o=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Rn(r,n),An(n),c&4&&(Cr(3,n,n.return),Ho(3,n),Cr(5,n,n.return));break;case 1:Rn(r,n),An(n),c&512&&(Bt||o===null||Rs(o,o.return)),c&64&&nr&&(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 m=hs;if(Rn(r,n),An(n),c&512&&(Bt||o===null||Rs(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,m=m.ownerDocument||m;t:switch(c){case"title":g=m.getElementsByTagName("title")[0],(!g||g[vo]||g[en]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=m.createElement(c),m.head.insertBefore(g,m.querySelector("head > title"))),rn(g,c,o),g[en]=n,Kt(g),c=g;break e;case"link":var S=Zb("link","href",m).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=m.createElement(c),rn(g,c,o),m.head.appendChild(g);break;case"meta":if(S=Zb("meta","content",m).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=m.createElement(c),rn(g,c,o),m.head.appendChild(g);break;default:throw Error(a(468,c))}g[en]=n,Kt(g),c=g}n.stateNode=c}else Hb(m,n.type,n.stateNode);else n.stateNode=Bb(m,c,n.memoizedProps);else g!==c?(g===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):g.count--,c===null?Hb(m,n.type,n.stateNode):Bb(m,c,n.memoizedProps)):c===null&&n.stateNode!==null&&wh(n,n.memoizedProps,o.memoizedProps)}break;case 27:Rn(r,n),An(n),c&512&&(Bt||o===null||Rs(o,o.return)),o!==null&&c&4&&wh(n,n.memoizedProps,o.memoizedProps);break;case 5:if(Rn(r,n),An(n),c&512&&(Bt||o===null||Rs(o,o.return)),n.flags&32){m=n.stateNode;try{Qa(m,"")}catch(Ne){lt(n,n.return,Ne)}}c&4&&n.stateNode!=null&&(m=n.memoizedProps,wh(n,m,o!==null?o.memoizedProps:m)),c&1024&&(Nh=!0);break;case 6:if(Rn(r,n),An(n),c&4){if(n.stateNode===null)throw Error(a(162));c=n.memoizedProps,o=n.stateNode;try{o.nodeValue=c}catch(Ne){lt(n,n.return,Ne)}}break;case 3:if(au=null,m=hs,hs=su(r.containerInfo),Rn(r,n),hs=m,An(n),c&4&&o!==null&&o.memoizedState.isDehydrated)try{_i(r.containerInfo)}catch(Ne){lt(n,n.return,Ne)}Nh&&(Nh=!1,H0(n));break;case 4:c=hs,hs=su(n.stateNode.containerInfo),Rn(r,n),An(n),hs=c;break;case 12:Rn(r,n),An(n);break;case 31:Rn(r,n),An(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Zc(n,c)));break;case 13:Rn(r,n),An(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Fc=Se()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Zc(n,c)));break;case 22:m=n.memoizedState!==null;var L=o!==null&&o.memoizedState!==null,X=nr,le=Bt;if(nr=X||m,Bt=le||L,Rn(r,n),Bt=le,nr=X,An(n),c&8192)e:for(r=n.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(o===null||L||nr||Bt||Ta(n)),o=null,r=n;;){if(r.tag===5||r.tag===26){if(o===null){L=o=r;try{if(g=L.stateNode,m)S=g.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{k=L.stateNode;var de=L.memoizedProps.style,Q=de!=null&&de.hasOwnProperty("display")?de.display:null;k.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Ne){lt(L,L.return,Ne)}}}else if(r.tag===6){if(o===null){L=r;try{L.stateNode.nodeValue=m?"":L.memoizedProps}catch(Ne){lt(L,L.return,Ne)}}}else if(r.tag===18){if(o===null){L=r;try{var ne=L.stateNode;m?Ob(ne,!0):Ob(L.stateNode,!1)}catch(Ne){lt(L,L.return,Ne)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=n.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,Zc(n,o))));break;case 19:Rn(r,n),An(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Zc(n,c)));break;case 30:break;case 21:break;default:Rn(r,n),An(n)}}function An(n){var r=n.flags;if(r&2){try{for(var o,c=n.return;c!==null;){if(z0(c)){o=c;break}c=c.return}if(o==null)throw Error(a(160));switch(o.tag){case 27:var m=o.stateNode,g=Sh(n);Bc(n,g,m);break;case 5:var S=o.stateNode;o.flags&32&&(Qa(S,""),o.flags&=-33);var k=Sh(n);Bc(n,k,S);break;case 3:case 4:var L=o.stateNode.containerInfo,X=Sh(n);Eh(n,X,L);break;default:throw Error(a(161))}}catch(le){lt(n,n.return,le)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function H0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;H0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function rr(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)P0(n,r.alternate,r),r=r.sibling}function Ta(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:Cr(4,r,r.return),Ta(r);break;case 1:Rs(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&O0(r,r.return,o),Ta(r);break;case 27:el(r.stateNode);case 26:case 5:Rs(r,r.return),Ta(r);break;case 22:r.memoizedState===null&&Ta(r);break;case 30:Ta(r);break;default:Ta(r)}n=n.sibling}}function ar(n,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,m=n,g=r,S=g.flags;switch(g.tag){case 0:case 11:case 15:ar(m,g,o),Ho(4,g);break;case 1:if(ar(m,g,o),c=g,m=c.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(X){lt(c,c.return,X)}if(c=g,m=c.updateQueue,m!==null){var k=c.stateNode;try{var L=m.shared.hiddenCallbacks;if(L!==null)for(m.shared.hiddenCallbacks=null,m=0;m<L.length;m++)wv(L[m],k)}catch(X){lt(c,c.return,X)}}o&&S&64&&M0(g),Fo(g,g.return);break;case 27:I0(g);case 26:case 5:ar(m,g,o),o&&c===null&&S&4&&D0(g),Fo(g,g.return);break;case 12:ar(m,g,o);break;case 31:ar(m,g,o),o&&S&4&&$0(m,g);break;case 13:ar(m,g,o),o&&S&4&&B0(m,g);break;case 22:g.memoizedState===null&&ar(m,g,o),Fo(g,g.return);break;case 30:break;default:ar(m,g,o)}r=r.sibling}}function Th(n,r){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&ko(o))}function jh(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&ko(n))}function ps(n,r,o,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)F0(n,r,o,c),r=r.sibling}function F0(n,r,o,c){var m=r.flags;switch(r.tag){case 0:case 11:case 15:ps(n,r,o,c),m&2048&&Ho(9,r);break;case 1:ps(n,r,o,c);break;case 3:ps(n,r,o,c),m&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&ko(n)));break;case 12:if(m&2048){ps(n,r,o,c),n=r.stateNode;try{var g=r.memoizedProps,S=g.id,k=g.onPostCommit;typeof k=="function"&&k(S,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(L){lt(r,r.return,L)}}else ps(n,r,o,c);break;case 31:ps(n,r,o,c);break;case 13:ps(n,r,o,c);break;case 23:break;case 22:g=r.stateNode,S=r.alternate,r.memoizedState!==null?g._visibility&2?ps(n,r,o,c):qo(n,r):g._visibility&2?ps(n,r,o,c):(g._visibility|=2,bi(n,r,o,c,(r.subtreeFlags&10256)!==0||!1)),m&2048&&Th(S,r);break;case 24:ps(n,r,o,c),m&2048&&jh(r.alternate,r);break;default:ps(n,r,o,c)}}function bi(n,r,o,c,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=n,S=r,k=o,L=c,X=S.flags;switch(S.tag){case 0:case 11:case 15:bi(g,S,k,L,m),Ho(8,S);break;case 23:break;case 22:var le=S.stateNode;S.memoizedState!==null?le._visibility&2?bi(g,S,k,L,m):qo(g,S):(le._visibility|=2,bi(g,S,k,L,m)),m&&X&2048&&Th(S.alternate,S);break;case 24:bi(g,S,k,L,m),m&&X&2048&&jh(S.alternate,S);break;default:bi(g,S,k,L,m)}r=r.sibling}}function qo(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=n,c=r,m=c.flags;switch(c.tag){case 22:qo(o,c),m&2048&&Th(c.alternate,c);break;case 24:qo(o,c),m&2048&&jh(c.alternate,c);break;default:qo(o,c)}r=r.sibling}}var Yo=8192;function xi(n,r,o){if(n.subtreeFlags&Yo)for(n=n.child;n!==null;)q0(n,r,o),n=n.sibling}function q0(n,r,o){switch(n.tag){case 26:xi(n,r,o),n.flags&Yo&&n.memoizedState!==null&&ZA(o,hs,n.memoizedState,n.memoizedProps);break;case 5:xi(n,r,o);break;case 3:case 4:var c=hs;hs=su(n.stateNode.containerInfo),xi(n,r,o),hs=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Yo,Yo=16777216,xi(n,r,o),Yo=c):xi(n,r,o));break;default:xi(n,r,o)}}function Y0(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function Go(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var c=r[o];Wt=c,X0(c,n)}Y0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)G0(n),n=n.sibling}function G0(n){switch(n.tag){case 0:case 11:case 15:Go(n),n.flags&2048&&Cr(9,n,n.return);break;case 3:Go(n);break;case 12:Go(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,Hc(n)):Go(n);break;default:Go(n)}}function Hc(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var c=r[o];Wt=c,X0(c,n)}Y0(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:Cr(8,r,r.return),Hc(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,Hc(r));break;default:Hc(r)}n=n.sibling}}function X0(n,r){for(;Wt!==null;){var o=Wt;switch(o.tag){case 0:case 11:case 15:Cr(8,o,r);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:ko(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Wt=c;else e:for(o=n;Wt!==null;){c=Wt;var m=c.sibling,g=c.return;if(U0(c),c===o){Wt=null;break e}if(m!==null){m.return=g,Wt=m;break e}Wt=g}}}var rA={getCacheForType:function(n){var r=nn(Ut),o=r.data.get(n);return o===void 0&&(o=n(),r.data.set(n,o)),o},cacheSignal:function(){return nn(Ut).controller.signal}},aA=typeof WeakMap=="function"?WeakMap:Map,at=0,pt=null,qe=null,Xe=0,ot=0,$n=null,Rr=!1,wi=!1,Ch=!1,ir=0,Ot=0,Ar=0,ja=0,Rh=0,Bn=0,Si=0,Xo=null,_n=null,Ah=!1,Fc=0,K0=0,qc=1/0,Yc=null,_r=null,Yt=0,kr=null,Ei=null,or=0,_h=0,kh=null,W0=null,Ko=0,Mh=null;function Zn(){return(at&2)!==0&&Xe!==0?Xe&-Xe:I.T!==null?Ph():nc()}function J0(){if(Bn===0)if((Xe&536870912)===0||Je){var n=Nn;Nn<<=1,(Nn&3932160)===0&&(Nn=262144),Bn=n}else Bn=536870912;return n=Un.current,n!==null&&(n.flags|=32),Bn}function kn(n,r,o){(n===pt&&(ot===2||ot===9)||n.cancelPendingCommit!==null)&&(Ni(n,0),Mr(n,Xe,Bn,!1)),ca(n,o),((at&2)===0||n!==pt)&&(n===pt&&((at&2)===0&&(ja|=o),Ot===4&&Mr(n,Xe,Bn,!1)),As(n))}function Q0(n,r,o){if((at&6)!==0)throw Error(a(327));var c=!o&&(r&127)===0&&(r&n.expiredLanes)===0||mr(n,r),m=c?lA(n,r):Dh(n,r,!0),g=c;do{if(m===0){wi&&!c&&Mr(n,r,0,!1);break}else{if(o=n.current.alternate,g&&!iA(o)){m=Dh(n,r,!1),g=!1;continue}if(m===2){if(g=r,n.errorRecoveryDisabledLanes&g)var S=0;else S=n.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){r=S;e:{var k=n;m=Xo;var L=k.current.memoizedState.isDehydrated;if(L&&(Ni(k,S).flags|=256),S=Dh(k,S,!1),S!==2){if(Ch&&!L){k.errorRecoveryDisabledLanes|=g,ja|=g,m=4;break e}g=_n,_n=m,g!==null&&(_n===null?_n=g:_n.push.apply(_n,g))}m=S}if(g=!1,m!==2)continue}}if(m===1){Ni(n,0),Mr(n,r,0,!0);break}e:{switch(c=n,g=m,g){case 0:case 1:throw Error(a(345));case 4:if((r&4194048)!==r)break;case 6:Mr(c,r,Bn,!Rr);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(a(329))}if((r&62914560)===r&&(m=Fc+300-Se(),10<m)){if(Mr(c,r,Bn,!Rr),pr(c,0,!0)!==0)break e;or=r,c.timeoutHandle=_b(eb.bind(null,c,o,_n,Yc,Ah,r,Bn,ja,Si,Rr,g,"Throttled",-0,0),m);break e}eb(c,o,_n,Yc,Ah,r,Bn,ja,Si,Rr,g,null,-0,0)}}break}while(!0);As(n)}function eb(n,r,o,c,m,g,S,k,L,X,le,de,Q,ne){if(n.timeoutHandle=-1,de=r.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qs},q0(r,g,de);var Ne=(g&62914560)===g?Fc-Se():(g&4194048)===g?K0-Se():0;if(Ne=HA(de,Ne),Ne!==null){or=g,n.cancelPendingCommit=Ne(lb.bind(null,n,r,g,o,c,m,S,k,L,le,de,null,Q,ne)),Mr(n,g,S,!X);return}}lb(n,r,g,o,c,m,S,k,L)}function iA(n){for(var r=n;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var m=o[c],g=m.getSnapshot;m=m.value;try{if(!Ln(g(),m))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Mr(n,r,o,c){r&=~Rh,r&=~ja,n.suspendedLanes|=r,n.pingedLanes&=~r,c&&(n.warmLanes|=r),c=n.expirationTimes;for(var m=r;0<m;){var g=31-nt(m),S=1<<g;c[g]=-1,m&=~S}o!==0&&go(n,o,r)}function Gc(){return(at&6)===0?(Wo(0),!1):!0}function Oh(){if(qe!==null){if(ot===0)var n=qe.return;else n=qe,Ks=ya=null,Xf(n),pi=null,Oo=0,n=qe;for(;n!==null;)k0(n.alternate,n),n=n.return;qe=null}}function Ni(n,r){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,jA(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),or=0,Oh(),pt=n,qe=o=Gs(n.current,null),Xe=r,ot=0,$n=null,Rr=!1,wi=mr(n,r),Ch=!1,Si=Bn=Rh=ja=Ar=Ot=0,_n=Xo=null,Ah=!1,(r&8)!==0&&(r|=r&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=r;0<c;){var m=31-nt(c),g=1<<m;r|=n[m],c&=~g}return ir=r,mc(),o}function tb(n,r){$e=null,I.H=$o,r===hi||r===Ec?(r=yv(),ot=3):r===Lf?(r=yv(),ot=4):ot=r===dh?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,$n=r,qe===null&&(Ot=1,Lc(n,Qn(r,n.current)))}function nb(){var n=Un.current;return n===null?!0:(Xe&4194048)===Xe?ss===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?n===ss:!1}function sb(){var n=I.H;return I.H=$o,n===null?$o:n}function rb(){var n=I.A;return I.A=rA,n}function Xc(){Ot=4,Rr||(Xe&4194048)!==Xe&&Un.current!==null||(wi=!0),(Ar&134217727)===0&&(ja&134217727)===0||pt===null||Mr(pt,Xe,Bn,!1)}function Dh(n,r,o){var c=at;at|=2;var m=sb(),g=rb();(pt!==n||Xe!==r)&&(Yc=null,Ni(n,r)),r=!1;var S=Ot;e:do try{if(ot!==0&&qe!==null){var k=qe,L=$n;switch(ot){case 8:Oh(),S=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(r=!0);var X=ot;if(ot=0,$n=null,Ti(n,k,L,X),o&&wi){S=0;break e}break;default:X=ot,ot=0,$n=null,Ti(n,k,L,X)}}oA(),S=Ot;break}catch(le){tb(n,le)}while(!0);return r&&n.shellSuspendCounter++,Ks=ya=null,at=c,I.H=m,I.A=g,qe===null&&(pt=null,Xe=0,mc()),S}function oA(){for(;qe!==null;)ab(qe)}function lA(n,r){var o=at;at|=2;var c=sb(),m=rb();pt!==n||Xe!==r?(Yc=null,qc=Se()+500,Ni(n,r)):wi=mr(n,r);e:do try{if(ot!==0&&qe!==null){r=qe;var g=$n;t:switch(ot){case 1:ot=0,$n=null,Ti(n,r,g,1);break;case 2:case 9:if(mv(g)){ot=0,$n=null,ib(r);break}r=function(){ot!==2&&ot!==9||pt!==n||(ot=7),As(n)},g.then(r,r);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:mv(g)?(ot=0,$n=null,ib(r)):(ot=0,$n=null,Ti(n,r,g,7));break;case 5:var S=null;switch(qe.tag){case 26:S=qe.memoizedState;case 5:case 27:var k=qe;if(S?Fb(S):k.stateNode.complete){ot=0,$n=null;var L=k.sibling;if(L!==null)qe=L;else{var X=k.return;X!==null?(qe=X,Kc(X)):qe=null}break t}}ot=0,$n=null,Ti(n,r,g,5);break;case 6:ot=0,$n=null,Ti(n,r,g,6);break;case 8:Oh(),Ot=6;break e;default:throw Error(a(462))}}cA();break}catch(le){tb(n,le)}while(!0);return Ks=ya=null,I.H=c,I.A=m,at=o,qe!==null?0:(pt=null,Xe=0,mc(),Ot)}function cA(){for(;qe!==null&&!Oe();)ab(qe)}function ab(n){var r=A0(n.alternate,n,ir);n.memoizedProps=n.pendingProps,r===null?Kc(n):qe=r}function ib(n){var r=n,o=r.alternate;switch(r.tag){case 15:case 0:r=E0(o,r,r.pendingProps,r.type,void 0,Xe);break;case 11:r=E0(o,r,r.pendingProps,r.type.render,r.ref,Xe);break;case 5:Xf(r);default:k0(o,r),r=qe=rv(r,ir),r=A0(o,r,ir)}n.memoizedProps=n.pendingProps,r===null?Kc(n):qe=r}function Ti(n,r,o,c){Ks=ya=null,Xf(r),pi=null,Oo=0;var m=r.return;try{if(WR(n,m,r,o,Xe)){Ot=1,Lc(n,Qn(o,n.current)),qe=null;return}}catch(g){if(m!==null)throw qe=m,g;Ot=1,Lc(n,Qn(o,n.current)),qe=null;return}r.flags&32768?(Je||c===1?n=!0:wi||(Xe&536870912)!==0?n=!1:(Rr=n=!0,(c===2||c===9||c===3||c===6)&&(c=Un.current,c!==null&&c.tag===13&&(c.flags|=16384))),ob(r,n)):Kc(r)}function Kc(n){var r=n;do{if((r.flags&32768)!==0){ob(r,Rr);return}n=r.return;var o=eA(r.alternate,r,ir);if(o!==null){qe=o;return}if(r=r.sibling,r!==null){qe=r;return}qe=r=n}while(r!==null);Ot===0&&(Ot=5)}function ob(n,r){do{var o=tA(n.alternate,n);if(o!==null){o.flags&=32767,qe=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(n=n.sibling,n!==null)){qe=n;return}qe=n=o}while(n!==null);Ot=6,qe=null}function lb(n,r,o,c,m,g,S,k,L){n.cancelPendingCommit=null;do Wc();while(Yt!==0);if((at&6)!==0)throw Error(a(327));if(r!==null){if(r===n.current)throw Error(a(177));if(g=r.lanes|r.childLanes,g|=Sf,mo(n,o,g,S,k,L),n===pt&&(qe=pt=null,Xe=0),Ei=r,kr=n,or=o,_h=g,kh=m,W0=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,hA(Fe,function(){return hb(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=I.T,I.T=null,m=B.p,B.p=2,S=at,at|=4;try{nA(n,r,o)}finally{at=S,B.p=m,I.T=c}}Yt=1,cb(),ub(),db()}}function cb(){if(Yt===1){Yt=0;var n=kr,r=Ei,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=I.T,I.T=null;var c=B.p;B.p=2;var m=at;at|=4;try{Z0(r,n);var g=qh,S=Xy(n.containerInfo),k=g.focusedElem,L=g.selectionRange;if(S!==k&&k&&k.ownerDocument&&Gy(k.ownerDocument.documentElement,k)){if(L!==null&&yf(k)){var X=L.start,le=L.end;if(le===void 0&&(le=X),"selectionStart"in k)k.selectionStart=X,k.selectionEnd=Math.min(le,k.value.length);else{var de=k.ownerDocument||document,Q=de&&de.defaultView||window;if(Q.getSelection){var ne=Q.getSelection(),Ne=k.textContent.length,ze=Math.min(L.start,Ne),ht=L.end===void 0?ze:Math.min(L.end,Ne);!ne.extend&&ze>ht&&(S=ht,ht=ze,ze=S);var q=Yy(k,ze),V=Yy(k,ht);if(q&&V&&(ne.rangeCount!==1||ne.anchorNode!==q.node||ne.anchorOffset!==q.offset||ne.focusNode!==V.node||ne.focusOffset!==V.offset)){var G=de.createRange();G.setStart(q.node,q.offset),ne.removeAllRanges(),ze>ht?(ne.addRange(G),ne.extend(V.node,V.offset)):(G.setEnd(V.node,V.offset),ne.addRange(G))}}}}for(de=[],ne=k;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<de.length;k++){var ue=de[k];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}cu=!!Fh,qh=Fh=null}finally{at=m,B.p=c,I.T=o}}n.current=r,Yt=2}}function ub(){if(Yt===2){Yt=0;var n=kr,r=Ei,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=I.T,I.T=null;var c=B.p;B.p=2;var m=at;at|=4;try{P0(n,r.alternate,r)}finally{at=m,B.p=c,I.T=o}}Yt=3}}function db(){if(Yt===4||Yt===3){Yt=0,ve();var n=kr,r=Ei,o=or,c=W0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Yt=5:(Yt=0,Ei=kr=null,fb(n,n.pendingLanes));var m=n.pendingLanes;if(m===0&&(_r=null),yo(o),r=r.stateNode,De&&typeof De.onCommitFiberRoot=="function")try{De.onCommitFiberRoot(Jt,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=I.T,m=B.p,B.p=2,I.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{I.T=r,B.p=m}}(or&3)!==0&&Wc(),As(n),m=n.pendingLanes,(o&261930)!==0&&(m&42)!==0?n===Mh?Ko++:(Ko=0,Mh=n):Ko=0,Wo(0)}}function fb(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,ko(r)))}function Wc(){return cb(),ub(),db(),hb()}function hb(){if(Yt!==5)return!1;var n=kr,r=_h;_h=0;var o=yo(or),c=I.T,m=B.p;try{B.p=32>o?32:o,I.T=null,o=kh,kh=null;var g=kr,S=or;if(Yt=0,Ei=kr=null,or=0,(at&6)!==0)throw Error(a(331));var k=at;if(at|=4,G0(g.current),F0(g,g.current,S,o),at=k,Wo(0,!1),De&&typeof De.onPostCommitFiberRoot=="function")try{De.onPostCommitFiberRoot(Jt,g)}catch{}return!0}finally{B.p=m,I.T=c,fb(n,r)}}function pb(n,r,o){r=Qn(o,r),r=uh(n.stateNode,r,2),n=Nr(n,r,2),n!==null&&(ca(n,2),As(n))}function lt(n,r,o){if(n.tag===3)pb(n,n,o);else for(;r!==null;){if(r.tag===3){pb(r,n,o);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(_r===null||!_r.has(c))){n=Qn(o,n),o=m0(2),c=Nr(r,o,2),c!==null&&(g0(o,c,r,n),ca(c,2),As(c));break}}r=r.return}}function zh(n,r,o){var c=n.pingCache;if(c===null){c=n.pingCache=new aA;var m=new Set;c.set(r,m)}else m=c.get(r),m===void 0&&(m=new Set,c.set(r,m));m.has(o)||(Ch=!0,m.add(o),n=uA.bind(null,n,r,o),r.then(n,n))}function uA(n,r,o){var c=n.pingCache;c!==null&&c.delete(r),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,pt===n&&(Xe&o)===o&&(Ot===4||Ot===3&&(Xe&62914560)===Xe&&300>Se()-Fc?(at&2)===0&&Ni(n,0):Rh|=o,Si===Xe&&(Si=0)),As(n)}function mb(n,r){r===0&&(r=Ql()),n=pa(n,r),n!==null&&(ca(n,r),As(n))}function dA(n){var r=n.memoizedState,o=0;r!==null&&(o=r.retryLane),mb(n,o)}function fA(n,r){var o=0;switch(n.tag){case 31:case 13:var c=n.stateNode,m=n.memoizedState;m!==null&&(o=m.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(a(314))}c!==null&&c.delete(r),mb(n,o)}function hA(n,r){return Ce(n,r)}var Jc=null,ji=null,Ih=!1,Qc=!1,Lh=!1,Or=0;function As(n){n!==ji&&n.next===null&&(ji===null?Jc=ji=n:ji=ji.next=n),Qc=!0,Ih||(Ih=!0,mA())}function Wo(n,r){if(!Lh&&Qc){Lh=!0;do for(var o=!1,c=Jc;c!==null;){if(n!==0){var m=c.pendingLanes;if(m===0)var g=0;else{var S=c.suspendedLanes,k=c.pingedLanes;g=(1<<31-nt(42|n)+1)-1,g&=m&~(S&~k),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,bb(c,g))}else g=Xe,g=pr(c,c===pt?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||mr(c,g)||(o=!0,bb(c,g));c=c.next}while(o);Lh=!1}}function pA(){gb()}function gb(){Qc=Ih=!1;var n=0;Or!==0&&TA()&&(n=Or);for(var r=Se(),o=null,c=Jc;c!==null;){var m=c.next,g=yb(c,r);g===0?(c.next=null,o===null?Jc=m:o.next=m,m===null&&(ji=o)):(o=c,(n!==0||(g&3)!==0)&&(Qc=!0)),c=m}Yt!==0&&Yt!==5||Wo(n),Or!==0&&(Or=0)}function yb(n,r){for(var o=n.suspendedLanes,c=n.pingedLanes,m=n.expirationTimes,g=n.pendingLanes&-62914561;0<g;){var S=31-nt(g),k=1<<S,L=m[S];L===-1?((k&o)===0||(k&c)!==0)&&(m[S]=Wd(k,r)):L<=r&&(n.expiredLanes|=k),g&=~k}if(r=pt,o=Xe,o=pr(n,n===r?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,o===0||n===r&&(ot===2||ot===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&me(c),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||mr(n,o)){if(r=o&-o,r===n.callbackPriority)return r;switch(c!==null&&me(c),yo(o)){case 2:case 8:o=it;break;case 32:o=Fe;break;case 268435456:o=Xt;break;default:o=Fe}return c=vb.bind(null,n),o=Ce(o,c),n.callbackPriority=r,n.callbackNode=o,r}return c!==null&&c!==null&&me(c),n.callbackPriority=2,n.callbackNode=null,2}function vb(n,r){if(Yt!==0&&Yt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Wc()&&n.callbackNode!==o)return null;var c=Xe;return c=pr(n,n===pt?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(Q0(n,c,r),yb(n,Se()),n.callbackNode!=null&&n.callbackNode===o?vb.bind(null,n):null)}function bb(n,r){if(Wc())return null;Q0(n,r,!0)}function mA(){CA(function(){(at&6)!==0?Ce(We,pA):gb()})}function Ph(){if(Or===0){var n=di;n===0&&(n=qt,qt<<=1,(qt&261888)===0&&(qt=256)),Or=n}return Or}function xb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:oc(""+n)}function wb(n,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,n.id&&o.setAttribute("form",n.id),r.parentNode.insertBefore(o,r),n=new FormData(n),o.parentNode.removeChild(o),n}function gA(n,r,o,c,m){if(r==="submit"&&o&&o.stateNode===m){var g=xb((m[Tn]||null).action),S=c.submitter;S&&(r=(r=S[Tn]||null)?xb(r.formAction):S.getAttribute("formAction"),r!==null&&(g=r,S=null));var k=new dc("action","action",null,c,m);n.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Or!==0){var L=S?wb(m,S):new FormData(m);rh(o,{pending:!0,data:L,method:m.method,action:g},null,L)}}else typeof g=="function"&&(k.preventDefault(),L=S?wb(m,S):new FormData(m),rh(o,{pending:!0,data:L,method:m.method,action:g},g,L))},currentTarget:m}]})}}for(var Uh=0;Uh<wf.length;Uh++){var Vh=wf[Uh],yA=Vh.toLowerCase(),vA=Vh[0].toUpperCase()+Vh.slice(1);fs(yA,"on"+vA)}fs(Jy,"onAnimationEnd"),fs(Qy,"onAnimationIteration"),fs(ev,"onAnimationStart"),fs("dblclick","onDoubleClick"),fs("focusin","onFocus"),fs("focusout","onBlur"),fs(DR,"onTransitionRun"),fs(zR,"onTransitionStart"),fs(IR,"onTransitionCancel"),fs(tv,"onTransitionEnd"),Wa("onMouseEnter",["mouseout","mouseover"]),Wa("onMouseLeave",["mouseout","mouseover"]),Wa("onPointerEnter",["pointerout","pointerover"]),Wa("onPointerLeave",["pointerout","pointerover"]),ua("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ua("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ua("onBeforeInput",["compositionend","keypress","textInput","paste"]),ua("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ua("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ua("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jo="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(" "),bA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Jo));function Sb(n,r){r=(r&4)!==0;for(var o=0;o<n.length;o++){var c=n[o],m=c.event;c=c.listeners;e:{var g=void 0;if(r)for(var S=c.length-1;0<=S;S--){var k=c[S],L=k.instance,X=k.currentTarget;if(k=k.listener,L!==g&&m.isPropagationStopped())break e;g=k,m.currentTarget=X;try{g(m)}catch(le){pc(le)}m.currentTarget=null,g=L}else for(S=0;S<c.length;S++){if(k=c[S],L=k.instance,X=k.currentTarget,k=k.listener,L!==g&&m.isPropagationStopped())break e;g=k,m.currentTarget=X;try{g(m)}catch(le){pc(le)}m.currentTarget=null,g=L}}}}function Ye(n,r){var o=r[Jd];o===void 0&&(o=r[Jd]=new Set);var c=n+"__bubble";o.has(c)||(Eb(r,n,2,!1),o.add(c))}function $h(n,r,o){var c=0;r&&(c|=4),Eb(o,n,c,r)}var eu="_reactListening"+Math.random().toString(36).slice(2);function Bh(n){if(!n[eu]){n[eu]=!0,gy.forEach(function(o){o!=="selectionchange"&&(bA.has(o)||$h(o,!1,n),$h(o,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[eu]||(r[eu]=!0,$h("selectionchange",!1,r))}}function Eb(n,r,o,c){switch(Jb(r)){case 2:var m=YA;break;case 8:m=GA;break;default:m=sp}o=m.bind(null,r,o,n),m=void 0,!lf||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),c?m!==void 0?n.addEventListener(r,o,{capture:!0,passive:m}):n.addEventListener(r,o,!0):m!==void 0?n.addEventListener(r,o,{passive:m}):n.addEventListener(r,o,!1)}function Zh(n,r,o,c,m){var g=c;if((r&1)===0&&(r&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===m)break;if(S===4)for(S=c.return;S!==null;){var L=S.tag;if((L===3||L===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;k!==null;){if(S=Ga(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}Ry(function(){var X=g,le=af(o),de=[];e:{var Q=nv.get(n);if(Q!==void 0){var ne=dc,Ne=n;switch(n){case"keypress":if(cc(o)===0)break e;case"keydown":case"keyup":ne=fR;break;case"focusin":Ne="focus",ne=ff;break;case"focusout":Ne="blur",ne=ff;break;case"beforeblur":case"afterblur":ne=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":ne=ky;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=eR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=mR;break;case Jy:case Qy:case ev:ne=sR;break;case tv:ne=yR;break;case"scroll":case"scrollend":ne=JC;break;case"wheel":ne=bR;break;case"copy":case"cut":case"paste":ne=aR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Oy;break;case"toggle":case"beforetoggle":ne=wR}var ze=(r&4)!==0,ht=!ze&&(n==="scroll"||n==="scrollend"),q=ze?Q!==null?Q+"Capture":null:Q;ze=[];for(var V=X,G;V!==null;){var ue=V;if(G=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||G===null||q===null||(ue=xo(V,q),ue!=null&&ze.push(Qo(V,ue,G))),ht)break;V=V.return}0<ze.length&&(Q=new ne(Q,Ne,null,o,le),de.push({event:Q,listeners:ze}))}}if((r&7)===0){e:{if(Q=n==="mouseover"||n==="pointerover",ne=n==="mouseout"||n==="pointerout",Q&&o!==rf&&(Ne=o.relatedTarget||o.fromElement)&&(Ga(Ne)||Ne[Ya]))break e;if((ne||Q)&&(Q=le.window===le?le:(Q=le.ownerDocument)?Q.defaultView||Q.parentWindow:window,ne?(Ne=o.relatedTarget||o.toElement,ne=X,Ne=Ne?Ga(Ne):null,Ne!==null&&(ht=l(Ne),ze=Ne.tag,Ne!==ht||ze!==5&&ze!==27&&ze!==6)&&(Ne=null)):(ne=null,Ne=X),ne!==Ne)){if(ze=ky,ue="onMouseLeave",q="onMouseEnter",V="mouse",(n==="pointerout"||n==="pointerover")&&(ze=Oy,ue="onPointerLeave",q="onPointerEnter",V="pointer"),ht=ne==null?Q:bo(ne),G=Ne==null?Q:bo(Ne),Q=new ze(ue,V+"leave",ne,o,le),Q.target=ht,Q.relatedTarget=G,ue=null,Ga(le)===X&&(ze=new ze(q,V+"enter",Ne,o,le),ze.target=G,ze.relatedTarget=ht,ue=ze),ht=ue,ne&&Ne)t:{for(ze=xA,q=ne,V=Ne,G=0,ue=q;ue;ue=ze(ue))G++;ue=0;for(var Me=V;Me;Me=ze(Me))ue++;for(;0<G-ue;)q=ze(q),G--;for(;0<ue-G;)V=ze(V),ue--;for(;G--;){if(q===V||V!==null&&q===V.alternate){ze=q;break t}q=ze(q),V=ze(V)}ze=null}else ze=null;ne!==null&&Nb(de,Q,ne,ze,!1),Ne!==null&&ht!==null&&Nb(de,ht,Ne,ze,!0)}}e:{if(Q=X?bo(X):window,ne=Q.nodeName&&Q.nodeName.toLowerCase(),ne==="select"||ne==="input"&&Q.type==="file")var st=$y;else if(Uy(Q))if(By)st=kR;else{st=AR;var Ae=RR}else ne=Q.nodeName,!ne||ne.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?X&&sf(X.elementType)&&(st=$y):st=_R;if(st&&(st=st(n,X))){Vy(de,st,o,le);break e}Ae&&Ae(n,Q,X),n==="focusout"&&X&&Q.type==="number"&&X.memoizedProps.value!=null&&nf(Q,"number",Q.value)}switch(Ae=X?bo(X):window,n){case"focusin":(Uy(Ae)||Ae.contentEditable==="true")&&(si=Ae,vf=X,Ro=null);break;case"focusout":Ro=vf=si=null;break;case"mousedown":bf=!0;break;case"contextmenu":case"mouseup":case"dragend":bf=!1,Ky(de,o,le);break;case"selectionchange":if(OR)break;case"keydown":case"keyup":Ky(de,o,le)}var Be;if(pf)e:{switch(n){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else ni?Ly(n,o)&&(Ke="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(Ke="onCompositionStart");Ke&&(Dy&&o.locale!=="ko"&&(ni||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&ni&&(Be=Ay()):(yr=le,cf="value"in yr?yr.value:yr.textContent,ni=!0)),Ae=tu(X,Ke),0<Ae.length&&(Ke=new My(Ke,n,null,o,le),de.push({event:Ke,listeners:Ae}),Be?Ke.data=Be:(Be=Py(o),Be!==null&&(Ke.data=Be)))),(Be=ER?NR(n,o):TR(n,o))&&(Ke=tu(X,"onBeforeInput"),0<Ke.length&&(Ae=new My("onBeforeInput","beforeinput",null,o,le),de.push({event:Ae,listeners:Ke}),Ae.data=Be)),gA(de,n,X,o,le)}Sb(de,r)})}function Qo(n,r,o){return{instance:n,listener:r,currentTarget:o}}function tu(n,r){for(var o=r+"Capture",c=[];n!==null;){var m=n,g=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||g===null||(m=xo(n,o),m!=null&&c.unshift(Qo(n,m,g)),m=xo(n,r),m!=null&&c.push(Qo(n,m,g))),n.tag===3)return c;n=n.return}return[]}function xA(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Nb(n,r,o,c,m){for(var g=r._reactName,S=[];o!==null&&o!==c;){var k=o,L=k.alternate,X=k.stateNode;if(k=k.tag,L!==null&&L===c)break;k!==5&&k!==26&&k!==27||X===null||(L=X,m?(X=xo(o,g),X!=null&&S.unshift(Qo(o,X,L))):m||(X=xo(o,g),X!=null&&S.push(Qo(o,X,L)))),o=o.return}S.length!==0&&n.push({event:r,listeners:S})}var wA=/\r\n?/g,SA=/\u0000|\uFFFD/g;function Tb(n){return(typeof n=="string"?n:""+n).replace(wA,`
|
|
9
|
+
`).replace(SA,"")}function jb(n,r){return r=Tb(r),Tb(n)===r}function ft(n,r,o,c,m,g){switch(o){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||Qa(n,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&Qa(n,""+c);break;case"className":ac(n,"class",c);break;case"tabIndex":ac(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":ac(n,o,c);break;case"style":jy(n,c,g);break;case"data":if(r!=="object"){ac(n,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||o!=="href")){n.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=oc(""+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"?(r!=="input"&&ft(n,r,"name",m.name,m,null),ft(n,r,"formEncType",m.formEncType,m,null),ft(n,r,"formMethod",m.formMethod,m,null),ft(n,r,"formTarget",m.formTarget,m,null)):(ft(n,r,"encType",m.encType,m,null),ft(n,r,"method",m.method,m,null),ft(n,r,"target",m.target,m,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=oc(""+c),n.setAttribute(o,c);break;case"onClick":c!=null&&(n.onclick=qs);break;case"onScroll":c!=null&&Ye("scroll",n);break;case"onScrollEnd":c!=null&&Ye("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(a(61));if(o=c.__html,o!=null){if(m.children!=null)throw Error(a(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=oc(""+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":Ye("beforetoggle",n),Ye("toggle",n),rc(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":rc(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=KC.get(o)||o,rc(n,o,c))}}function Hh(n,r,o,c,m,g){switch(o){case"style":jy(n,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(a(61));if(o=c.__html,o!=null){if(m.children!=null)throw Error(a(60));n.innerHTML=o}}break;case"children":typeof c=="string"?Qa(n,c):(typeof c=="number"||typeof c=="bigint")&&Qa(n,""+c);break;case"onScroll":c!=null&&Ye("scroll",n);break;case"onScrollEnd":c!=null&&Ye("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(!yy.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),r=o.slice(2,m?o.length-7:void 0),g=n[Tn]||null,g=g!=null?g[o]:null,typeof g=="function"&&n.removeEventListener(r,g,m),typeof c=="function")){typeof g!="function"&&g!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(r,c,m);break e}o in n?n[o]=c:c===!0?n.setAttribute(o,""):rc(n,o,c)}}}function rn(n,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",n),Ye("load",n);var c=!1,m=!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":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:ft(n,r,g,S,o,null)}}m&&ft(n,r,"srcSet",o.srcSet,o,null),c&&ft(n,r,"src",o.src,o,null);return;case"input":Ye("invalid",n);var k=g=S=m=null,L=null,X=null;for(c in o)if(o.hasOwnProperty(c)){var le=o[c];if(le!=null)switch(c){case"name":m=le;break;case"type":S=le;break;case"checked":L=le;break;case"defaultChecked":X=le;break;case"value":g=le;break;case"defaultValue":k=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,r));break;default:ft(n,r,c,le,o,null)}}Sy(n,g,k,L,X,S,m,!1);return;case"select":Ye("invalid",n),c=S=g=null;for(m in o)if(o.hasOwnProperty(m)&&(k=o[m],k!=null))switch(m){case"value":g=k;break;case"defaultValue":S=k;break;case"multiple":c=k;default:ft(n,r,m,k,o,null)}r=g,o=S,n.multiple=!!c,r!=null?Ja(n,!!c,r,!1):o!=null&&Ja(n,!!c,o,!0);return;case"textarea":Ye("invalid",n),g=m=c=null;for(S in o)if(o.hasOwnProperty(S)&&(k=o[S],k!=null))switch(S){case"value":c=k;break;case"defaultValue":m=k;break;case"children":g=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(a(91));break;default:ft(n,r,S,k,o,null)}Ny(n,c,m,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":ft(n,r,L,c,o,null));return;case"dialog":Ye("beforetoggle",n),Ye("toggle",n),Ye("cancel",n),Ye("close",n);break;case"iframe":case"object":Ye("load",n);break;case"video":case"audio":for(c=0;c<Jo.length;c++)Ye(Jo[c],n);break;case"image":Ye("error",n),Ye("load",n);break;case"details":Ye("toggle",n);break;case"embed":case"source":case"link":Ye("error",n),Ye("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(X in o)if(o.hasOwnProperty(X)&&(c=o[X],c!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:ft(n,r,X,c,o,null)}return;default:if(sf(r)){for(le in o)o.hasOwnProperty(le)&&(c=o[le],c!==void 0&&Hh(n,r,le,c,o,void 0));return}}for(k in o)o.hasOwnProperty(k)&&(c=o[k],c!=null&&ft(n,r,k,c,o,null))}function EA(n,r,o,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,g=null,S=null,k=null,L=null,X=null,le=null;for(ne in o){var de=o[ne];if(o.hasOwnProperty(ne)&&de!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":L=de;default:c.hasOwnProperty(ne)||ft(n,r,ne,null,c,de)}}for(var Q in c){var ne=c[Q];if(de=o[Q],c.hasOwnProperty(Q)&&(ne!=null||de!=null))switch(Q){case"type":g=ne;break;case"name":m=ne;break;case"checked":X=ne;break;case"defaultChecked":le=ne;break;case"value":S=ne;break;case"defaultValue":k=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,r));break;default:ne!==de&&ft(n,r,Q,ne,c,de)}}tf(n,S,k,L,X,le,g,m);return;case"select":ne=S=k=Q=null;for(g in o)if(L=o[g],o.hasOwnProperty(g)&&L!=null)switch(g){case"value":break;case"multiple":ne=L;default:c.hasOwnProperty(g)||ft(n,r,g,null,c,L)}for(m in c)if(g=c[m],L=o[m],c.hasOwnProperty(m)&&(g!=null||L!=null))switch(m){case"value":Q=g;break;case"defaultValue":k=g;break;case"multiple":S=g;default:g!==L&&ft(n,r,m,g,c,L)}r=k,o=S,c=ne,Q!=null?Ja(n,!!o,Q,!1):!!c!=!!o&&(r!=null?Ja(n,!!o,r,!0):Ja(n,!!o,o?[]:"",!1));return;case"textarea":ne=Q=null;for(k in o)if(m=o[k],o.hasOwnProperty(k)&&m!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:ft(n,r,k,null,c,m)}for(S in c)if(m=c[S],g=o[S],c.hasOwnProperty(S)&&(m!=null||g!=null))switch(S){case"value":Q=m;break;case"defaultValue":ne=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(a(91));break;default:m!==g&&ft(n,r,S,m,c,g)}Ey(n,Q,ne);return;case"option":for(var Ne in o)Q=o[Ne],o.hasOwnProperty(Ne)&&Q!=null&&!c.hasOwnProperty(Ne)&&(Ne==="selected"?n.selected=!1:ft(n,r,Ne,null,c,Q));for(L in c)Q=c[L],ne=o[L],c.hasOwnProperty(L)&&Q!==ne&&(Q!=null||ne!=null)&&(L==="selected"?n.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":ft(n,r,L,Q,c,ne));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 ze in o)Q=o[ze],o.hasOwnProperty(ze)&&Q!=null&&!c.hasOwnProperty(ze)&&ft(n,r,ze,null,c,Q);for(X in c)if(Q=c[X],ne=o[X],c.hasOwnProperty(X)&&Q!==ne&&(Q!=null||ne!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(a(137,r));break;default:ft(n,r,X,Q,c,ne)}return;default:if(sf(r)){for(var ht in o)Q=o[ht],o.hasOwnProperty(ht)&&Q!==void 0&&!c.hasOwnProperty(ht)&&Hh(n,r,ht,void 0,c,Q);for(le in c)Q=c[le],ne=o[le],!c.hasOwnProperty(le)||Q===ne||Q===void 0&&ne===void 0||Hh(n,r,le,Q,c,ne);return}}for(var q in o)Q=o[q],o.hasOwnProperty(q)&&Q!=null&&!c.hasOwnProperty(q)&&ft(n,r,q,null,c,Q);for(de in c)Q=c[de],ne=o[de],!c.hasOwnProperty(de)||Q===ne||Q==null&&ne==null||ft(n,r,de,Q,c,ne)}function Cb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NA(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var m=o[c],g=m.transferSize,S=m.initiatorType,k=m.duration;if(g&&k&&Cb(S)){for(S=0,k=m.responseEnd,c+=1;c<o.length;c++){var L=o[c],X=L.startTime;if(X>k)break;var le=L.transferSize,de=L.initiatorType;le&&Cb(de)&&(L=L.responseEnd,S+=le*(L<k?1:(k-X)/(L-X)))}if(--c,r+=8*(g+S)/(m.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Fh=null,qh=null;function nu(n){return n.nodeType===9?n:n.ownerDocument}function Rb(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 Ab(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function Yh(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Gh=null;function TA(){var n=window.event;return n&&n.type==="popstate"?n===Gh?!1:(Gh=n,!0):(Gh=null,!1)}var _b=typeof setTimeout=="function"?setTimeout:void 0,jA=typeof clearTimeout=="function"?clearTimeout:void 0,kb=typeof Promise=="function"?Promise:void 0,CA=typeof queueMicrotask=="function"?queueMicrotask:typeof kb<"u"?function(n){return kb.resolve(null).then(n).catch(RA)}:_b;function RA(n){setTimeout(function(){throw n})}function Dr(n){return n==="head"}function Mb(n,r){var o=r,c=0;do{var m=o.nextSibling;if(n.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(c===0){n.removeChild(m),_i(r);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")el(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,el(o);for(var g=o.firstChild;g;){var S=g.nextSibling,k=g.nodeName;g[vo]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=S}}else o==="body"&&el(n.ownerDocument.body);o=m}while(o);_i(r)}function Ob(n,r){var o=n;n=0;do{var c=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(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 r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.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 AA(n,r,o,c){for(;n.nodeType===1;){var m=o;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[vo])switch(r){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!==m.rel||n.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||n.getAttribute("title")!==(m.title==null?null:m.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(g=n.getAttribute("src"),(g!==(m.src==null?null:m.src)||n.getAttribute("type")!==(m.type==null?null:m.type)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&g&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var g=m.name==null?null:""+m.name;if(m.type==="hidden"&&n.getAttribute("name")===g)return n}else return n;if(n=rs(n.nextSibling),n===null)break}return null}function _A(n,r,o){if(r==="")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 Db(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(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 kA(n,r){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||o.readyState!=="loading")r();else{var c=function(){r(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function rs(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var Jh=null;function zb(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(r===0)return rs(n.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}n=n.nextSibling}return null}function Ib(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return n;r--}else o!=="/$"&&o!=="/&"||r++}n=n.previousSibling}return null}function Lb(n,r,o){switch(r=nu(o),n){case"html":if(n=r.documentElement,!n)throw Error(a(452));return n;case"head":if(n=r.head,!n)throw Error(a(453));return n;case"body":if(n=r.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function el(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);Qd(n)}var as=new Map,Pb=new Set;function su(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var lr=B.d;B.d={f:MA,r:OA,D:DA,C:zA,L:IA,m:LA,X:UA,S:PA,M:VA};function MA(){var n=lr.f(),r=Gc();return n||r}function OA(n){var r=Xa(n);r!==null&&r.tag===5&&r.type==="form"?t0(r):lr.r(n)}var Ci=typeof document>"u"?null:document;function Ub(n,r,o){var c=Ci;if(c&&typeof r=="string"&&r){var m=Wn(r);m='link[rel="'+n+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),Pb.has(m)||(Pb.add(m),n={rel:n,crossOrigin:o,href:r},c.querySelector(m)===null&&(r=c.createElement("link"),rn(r,"link",n),Kt(r),c.head.appendChild(r)))}}function DA(n){lr.D(n),Ub("dns-prefetch",n,null)}function zA(n,r){lr.C(n,r),Ub("preconnect",n,r)}function IA(n,r,o){lr.L(n,r,o);var c=Ci;if(c&&n&&r){var m='link[rel="preload"][as="'+Wn(r)+'"]';r==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Wn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Wn(o.imageSizes)+'"]')):m+='[href="'+Wn(n)+'"]';var g=m;switch(r){case"style":g=Ri(n);break;case"script":g=Ai(n)}as.has(g)||(n=v({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:n,as:r},o),as.set(g,n),c.querySelector(m)!==null||r==="style"&&c.querySelector(tl(g))||r==="script"&&c.querySelector(nl(g))||(r=c.createElement("link"),rn(r,"link",n),Kt(r),c.head.appendChild(r)))}}function LA(n,r){lr.m(n,r);var o=Ci;if(o&&n){var c=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Wn(c)+'"][href="'+Wn(n)+'"]',g=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Ai(n)}if(!as.has(g)&&(n=v({rel:"modulepreload",href:n},r),as.set(g,n),o.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(nl(g)))return}c=o.createElement("link"),rn(c,"link",n),Kt(c),o.head.appendChild(c)}}}function PA(n,r,o){lr.S(n,r,o);var c=Ci;if(c&&n){var m=Ka(c).hoistableStyles,g=Ri(n);r=r||"default";var S=m.get(g);if(!S){var k={loading:0,preload:null};if(S=c.querySelector(tl(g)))k.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":r},o),(o=as.get(g))&&Qh(n,o);var L=S=c.createElement("link");Kt(L),rn(L,"link",n),L._p=new Promise(function(X,le){L.onload=X,L.onerror=le}),L.addEventListener("load",function(){k.loading|=1}),L.addEventListener("error",function(){k.loading|=2}),k.loading|=4,ru(S,r,c)}S={type:"stylesheet",instance:S,count:1,state:k},m.set(g,S)}}}function UA(n,r){lr.X(n,r);var o=Ci;if(o&&n){var c=Ka(o).hoistableScripts,m=Ai(n),g=c.get(m);g||(g=o.querySelector(nl(m)),g||(n=v({src:n,async:!0},r),(r=as.get(m))&&ep(n,r),g=o.createElement("script"),Kt(g),rn(g,"link",n),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(m,g))}}function VA(n,r){lr.M(n,r);var o=Ci;if(o&&n){var c=Ka(o).hoistableScripts,m=Ai(n),g=c.get(m);g||(g=o.querySelector(nl(m)),g||(n=v({src:n,async:!0,type:"module"},r),(r=as.get(m))&&ep(n,r),g=o.createElement("script"),Kt(g),rn(g,"link",n),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(m,g))}}function Vb(n,r,o,c){var m=(m=ge.current)?su(m):null;if(!m)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Ri(o.href),o=Ka(m).hoistableStyles,c=o.get(r),c||(c={type:"style",instance:null,count:0,state:null},o.set(r,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=Ka(m).hoistableStyles,S=g.get(n);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,S),(g=m.querySelector(tl(n)))&&!g._p&&(S.instance=g,S.state.loading=5),as.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},as.set(n,o),g||$A(m,n,o,S.state))),r&&c===null)throw Error(a(528,""));return S}if(r&&c!==null)throw Error(a(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ai(o),o=Ka(m).hoistableScripts,c=o.get(r),c||(c={type:"script",instance:null,count:0,state:null},o.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function Ri(n){return'href="'+Wn(n)+'"'}function tl(n){return'link[rel="stylesheet"]['+n+"]"}function $b(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function $A(n,r,o,c){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=n.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),rn(r,"link",o),Kt(r),n.head.appendChild(r))}function Ai(n){return'[src="'+Wn(n)+'"]'}function nl(n){return"script[async]"+n}function Bb(n,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var c=n.querySelector('style[data-href~="'+Wn(o.href)+'"]');if(c)return r.instance=c,Kt(c),c;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Kt(c),rn(c,"style",m),ru(c,o.precedence,n),r.instance=c;case"stylesheet":m=Ri(o.href);var g=n.querySelector(tl(m));if(g)return r.state.loading|=4,r.instance=g,Kt(g),g;c=$b(o),(m=as.get(m))&&Qh(c,m),g=(n.ownerDocument||n).createElement("link"),Kt(g);var S=g;return S._p=new Promise(function(k,L){S.onload=k,S.onerror=L}),rn(g,"link",c),r.state.loading|=4,ru(g,o.precedence,n),r.instance=g;case"script":return g=Ai(o.src),(m=n.querySelector(nl(g)))?(r.instance=m,Kt(m),m):(c=o,(m=as.get(g))&&(c=v({},o),ep(c,m)),n=n.ownerDocument||n,m=n.createElement("script"),Kt(m),rn(m,"link",c),n.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(a(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,ru(c,o.precedence,n));return r.instance}function ru(n,r,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,g=m,S=0;S<c.length;S++){var k=c[S];if(k.dataset.precedence===r)g=k;else if(g!==m)break}g?g.parentNode.insertBefore(n,g.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(n,r.firstChild))}function Qh(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function ep(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var au=null;function Zb(n,r,o){if(au===null){var c=new Map,m=au=new Map;m.set(o,c)}else m=au,c=m.get(o),c||(c=new Map,m.set(o,c));if(c.has(n))return c;for(c.set(n,null),o=o.getElementsByTagName(n),m=0;m<o.length;m++){var g=o[m];if(!(g[vo]||g[en]||n==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var S=g.getAttribute(r)||"";S=n+S;var k=c.get(S);k?k.push(g):c.set(S,[g])}}return c}function Hb(n,r,o){n=n.ownerDocument||n,n.head.insertBefore(o,r==="title"?n.querySelector("head > title"):null)}function BA(n,r,o){if(o===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Fb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function ZA(n,r,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 m=Ri(c.href),g=r.querySelector(tl(m));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=iu.bind(n),r.then(n,n)),o.state.loading|=4,o.instance=g,Kt(g);return}g=r.ownerDocument||r,c=$b(c),(m=as.get(m))&&Qh(c,m),g=g.createElement("link"),Kt(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,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=iu.bind(n),r.addEventListener("load",o),r.addEventListener("error",o))}}var tp=0;function HA(n,r){return n.stylesheets&&n.count===0&&lu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var c=setTimeout(function(){if(n.stylesheets&&lu(n,n.stylesheets),n.unsuspend){var g=n.unsuspend;n.unsuspend=null,g()}},6e4+r);0<n.imgBytes&&tp===0&&(tp=62500*NA());var m=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&lu(n,n.stylesheets),n.unsuspend)){var g=n.unsuspend;n.unsuspend=null,g()}},(n.imgBytes>tp?50:800)+r);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function iu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var ou=null;function lu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,ou=new Map,r.forEach(FA,n),ou=null,iu.call(n))}function FA(n,r){if(!(r.state.loading&4)){var o=ou.get(n);if(o)var c=o.get(null);else{o=new Map,ou.set(n,o);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<m.length;g++){var S=m[g];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(o.set(S.dataset.precedence,S),c=S)}c&&o.set(null,c)}m=r.instance,S=m.getAttribute("data-precedence"),g=o.get(S)||c,g===c&&o.set(null,m),o.set(S,m),this.count++,c=iu.bind(this),m.addEventListener("load",c),m.addEventListener("error",c),g?g.parentNode.insertBefore(m,g.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(m,n.firstChild)),r.state.loading|=4}}var sl={$$typeof:E,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function qA(n,r,o,c,m,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=po(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=po(0),this.hiddenUpdates=po(null),this.identifierPrefix=c,this.onUncaughtError=m,this.onCaughtError=g,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function qb(n,r,o,c,m,g,S,k,L,X,le,de){return n=new qA(n,r,o,S,L,X,le,de,k),r=1,g===!0&&(r|=24),g=Pn(3,null,null,r),n.current=g,g.stateNode=n,r=Df(),r.refCount++,n.pooledCache=r,r.refCount++,g.memoizedState={element:c,isDehydrated:o,cache:r},Pf(g),n}function Yb(n){return n?(n=ii,n):ii}function Gb(n,r,o,c,m,g){m=Yb(m),c.context===null?c.context=m:c.pendingContext=m,c=Er(r),c.payload={element:o},g=g===void 0?null:g,g!==null&&(c.callback=g),o=Nr(n,c,r),o!==null&&(kn(o,n,r),zo(o,n,r))}function Xb(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<r?o:r}}function np(n,r){Xb(n,r),(n=n.alternate)&&Xb(n,r)}function Kb(n){if(n.tag===13||n.tag===31){var r=pa(n,67108864);r!==null&&kn(r,n,67108864),np(n,67108864)}}function Wb(n){if(n.tag===13||n.tag===31){var r=Zn();r=Hs(r);var o=pa(n,r);o!==null&&kn(o,n,r),np(n,r)}}var cu=!0;function YA(n,r,o,c){var m=I.T;I.T=null;var g=B.p;try{B.p=2,sp(n,r,o,c)}finally{B.p=g,I.T=m}}function GA(n,r,o,c){var m=I.T;I.T=null;var g=B.p;try{B.p=8,sp(n,r,o,c)}finally{B.p=g,I.T=m}}function sp(n,r,o,c){if(cu){var m=rp(c);if(m===null)Zh(n,r,c,uu,o),Qb(n,c);else if(KA(m,n,r,o,c))c.stopPropagation();else if(Qb(n,c),r&4&&-1<XA.indexOf(n)){for(;m!==null;){var g=Xa(m);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var S=mn(g.pendingLanes);if(S!==0){var k=g;for(k.pendingLanes|=2,k.entangledLanes|=2;S;){var L=1<<31-nt(S);k.entanglements[1]|=L,S&=~L}As(g),(at&6)===0&&(qc=Se()+500,Wo(0))}}break;case 31:case 13:k=pa(g,2),k!==null&&kn(k,g,2),Gc(),np(g,2)}if(g=rp(c),g===null&&Zh(n,r,c,uu,o),g===m)break;m=g}m!==null&&c.stopPropagation()}else Zh(n,r,c,null,o)}}function rp(n){return n=af(n),ap(n)}var uu=null;function ap(n){if(uu=null,n=Ga(n),n!==null){var r=l(n);if(r===null)n=null;else{var o=r.tag;if(o===13){if(n=u(r),n!==null)return n;n=null}else if(o===31){if(n=d(r),n!==null)return n;n=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return uu=n,null}function Jb(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(Ee()){case We:return 2;case it:return 8;case Fe:case Ft:return 32;case Xt:return 268435456;default:return 32}default:return 32}}var ip=!1,zr=null,Ir=null,Lr=null,rl=new Map,al=new Map,Pr=[],XA="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 Qb(n,r){switch(n){case"focusin":case"focusout":zr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Lr=null;break;case"pointerover":case"pointerout":rl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":al.delete(r.pointerId)}}function il(n,r,o,c,m,g){return n===null||n.nativeEvent!==g?(n={blockedOn:r,domEventName:o,eventSystemFlags:c,nativeEvent:g,targetContainers:[m]},r!==null&&(r=Xa(r),r!==null&&Kb(r)),n):(n.eventSystemFlags|=c,r=n.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),n)}function KA(n,r,o,c,m){switch(r){case"focusin":return zr=il(zr,n,r,o,c,m),!0;case"dragenter":return Ir=il(Ir,n,r,o,c,m),!0;case"mouseover":return Lr=il(Lr,n,r,o,c,m),!0;case"pointerover":var g=m.pointerId;return rl.set(g,il(rl.get(g)||null,n,r,o,c,m)),!0;case"gotpointercapture":return g=m.pointerId,al.set(g,il(al.get(g)||null,n,r,o,c,m)),!0}return!1}function ex(n){var r=Ga(n.target);if(r!==null){var o=l(r);if(o!==null){if(r=o.tag,r===13){if(r=u(o),r!==null){n.blockedOn=r,sc(n.priority,function(){Wb(o)});return}}else if(r===31){if(r=d(o),r!==null){n.blockedOn=r,sc(n.priority,function(){Wb(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function du(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var o=rp(n.nativeEvent);if(o===null){o=n.nativeEvent;var c=new o.constructor(o.type,o);rf=c,o.target.dispatchEvent(c),rf=null}else return r=Xa(o),r!==null&&Kb(r),n.blockedOn=o,!1;r.shift()}return!0}function tx(n,r,o){du(n)&&o.delete(r)}function WA(){ip=!1,zr!==null&&du(zr)&&(zr=null),Ir!==null&&du(Ir)&&(Ir=null),Lr!==null&&du(Lr)&&(Lr=null),rl.forEach(tx),al.forEach(tx)}function fu(n,r){n.blockedOn===r&&(n.blockedOn=null,ip||(ip=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,WA)))}var hu=null;function nx(n){hu!==n&&(hu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){hu===n&&(hu=null);for(var r=0;r<n.length;r+=3){var o=n[r],c=n[r+1],m=n[r+2];if(typeof c!="function"){if(ap(c||o)===null)continue;break}var g=Xa(o);g!==null&&(n.splice(r,3),r-=3,rh(g,{pending:!0,data:m,method:o.method,action:c},c,m))}}))}function _i(n){function r(L){return fu(L,n)}zr!==null&&fu(zr,n),Ir!==null&&fu(Ir,n),Lr!==null&&fu(Lr,n),rl.forEach(r),al.forEach(r);for(var o=0;o<Pr.length;o++){var c=Pr[o];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Pr.length&&(o=Pr[0],o.blockedOn===null);)ex(o),o.blockedOn===null&&Pr.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var m=o[c],g=o[c+1],S=m[Tn]||null;if(typeof g=="function")S||nx(o);else if(S){var k=null;if(g&&g.hasAttribute("formAction")){if(m=g,S=g[Tn]||null)k=S.formAction;else if(ap(m)!==null)continue}else k=S.action;typeof k=="function"?o[c+1]=k:(o.splice(c,3),c-=3),nx(o)}}}function sx(){function n(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=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,m=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function op(n){this._internalRoot=n}pu.prototype.render=op.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(a(409));var o=r.current,c=Zn();Gb(o,c,n,r,null,null)},pu.prototype.unmount=op.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;Gb(n.current,2,null,n,null,null),Gc(),r[Ya]=null}};function pu(n){this._internalRoot=n}pu.prototype.unstable_scheduleHydration=function(n){if(n){var r=nc();n={blockedOn:null,target:n,priority:r};for(var o=0;o<Pr.length&&r!==0&&r<Pr[o].priority;o++);Pr.splice(o,0,n),o===0&&ex(n)}};var rx=t.version;if(rx!=="19.2.3")throw Error(a(527,rx,"19.2.3"));B.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=h(r),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var JA={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mu.isDisabled&&mu.supportsFiber)try{Jt=mu.inject(JA),De=mu}catch{}}return ll.createRoot=function(n,r){if(!i(n))throw Error(a(299));var o=!1,c="",m=d0,g=f0,S=h0;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError)),r=qb(n,1,!1,null,null,o,c,null,m,g,S,sx),n[Ya]=r.current,Bh(n),new op(r)},ll.hydrateRoot=function(n,r,o){if(!i(n))throw Error(a(299));var c=!1,m="",g=d0,S=f0,k=h0,L=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=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)),r=qb(n,1,!0,r,o??null,c,m,L,g,S,k,sx),r.context=Yb(null),o=r.current,c=Zn(),c=Hs(c),m=Er(c),m.callback=null,Nr(o,m,c),o=c,r.current.lanes=o,ca(r,o),As(r),n[Ya]=r.current,Bh(n),new pu(r)},ll.version="19.2.3",ll}var px;function l_(){if(px)return up.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(),up.exports=o_(),up.exports}var c_=l_();const u_=({panOffset:e,scale:t,onPan:s,onPanStart:a,onPanEnd:i,isPanLocked:l=!1,onClick:u,showGuides:d=!1,onGuidesChange:p,gridOpacity:h=1})=>{const[y,v]=b.useState(d),[x,w]=b.useState(!1),N=b.useRef(!1),T=b.useRef({x:0,y:0}),_=b.useRef({active:!1,startX:0,startY:0}),C=b.useRef(null),j=b.useRef(null),E=b.useRef(null),A=4,R=b.useRef({x:0,y:0}),O=b.useRef(0),M=b.useRef(!1);b.useEffect(()=>{v(d)},[d]);const z=b.useCallback(J=>{const D=J;return D?D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable:!1},[]),F=b.useCallback(J=>{const D=J;return D?!!D.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),Z=b.useCallback(J=>{N.current=J,w(J)},[]);b.useEffect(()=>{const J=se=>{if(O.current=se.buttons,_.current.active&&(se.buttons&1)!==1&&(_.current.active=!1),N.current&&(se.buttons&1)!==1){Z(!1),_.current.active=!1,i?.(),document.body.style.cursor="";return}if(l&&N.current){Z(!1),_.current.active=!1,i?.(),document.body.style.cursor="";return}const te=C.current?.getBoundingClientRect(),ge=te?se.clientX-te.left:se.clientX,he=te?se.clientY-te.top:se.clientY;if(R.current={x:ge,y:he},j.current&&(j.current.style.left=`${ge}px`),E.current&&(E.current.style.top=`${he}px`),_.current.active&&!N.current){const pe=se.clientX-_.current.startX,xe=se.clientY-_.current.startY;Math.hypot(pe,xe)>=A&&(_.current.active=!1,Z(!0),M.current=!0,a?.(),T.current={x:se.clientX,y:se.clientY},document.body.style.cursor="grabbing")}N.current&&(s({x:(se.clientX-T.current.x)/t,y:(se.clientY-T.current.y)/t}),T.current={x:se.clientX,y:se.clientY})},D=se=>{O.current=se.buttons,_.current.active=!1,N.current&&(Z(!1),i?.(),document.body.style.cursor="")},P=se=>{(se.metaKey||se.ctrlKey)&&se.key==="\\"&&(se.preventDefault(),v(te=>{const ge=!te;return p?.(ge),ge}))},K=()=>{_.current.active=!1,D(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",D),window.addEventListener("keydown",P),window.addEventListener("blur",K),document.addEventListener("visibilitychange",K),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",D),window.removeEventListener("keydown",P),window.removeEventListener("blur",K),document.removeEventListener("visibilitychange",K)}},[s,i,a,t,z,F,l,Z,p]),b.useEffect(()=>{!l||!N.current||(Z(!1),i?.(),document.body.style.cursor="")},[l,i,Z]);const U=J=>{M.current=!1,!(l||J.button!==0)&&(z(J.target)||F(J.target)||(O.current=J.buttons,_.current={active:!0,startX:J.clientX,startY:J.clientY},J.preventDefault()))},H=J=>{!M.current&&u&&u(J),M.current=!1},[W,oe]=b.useState({w:0,h:0});b.useEffect(()=>{const J=()=>oe({w:window.innerWidth,h:window.innerHeight});return J(),window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[]);const ee=Math.max(.4,Math.min(2,t)),I=100*ee,B=20*ee,$=(W.w/2+e.x*t)%I,re=(W.h/2+e.y*t)%I;return f.jsxs("div",{ref:C,className:`absolute inset-0 z-0 overflow-hidden bg-black ${x?"cursor-grabbing":"cursor-grab"}`,onMouseDown:U,onClick:H,children:[f.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:`${B}px ${B}px`,backgroundPosition:`${$+100}px ${re+100}px`}}),f.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:`${I}px ${I}px`,backgroundPosition:`${$+100}px ${re+100}px`}}),y&&f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:j,className:"absolute top-0 bottom-0 w-px pointer-events-none bg-emerald-500/10",style:{left:0}}),f.jsx("div",{ref:E,className:"absolute left-0 right-0 h-px pointer-events-none bg-emerald-500/10",style:{top:0}})]})]})};const PS=(...e)=>e.filter((t,s,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===s).join(" ").trim();const d_=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const f_=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,a)=>a?a.toUpperCase():s.toLowerCase());const mx=e=>{const t=f_(e);return t.charAt(0).toUpperCase()+t.slice(1)};var h_={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 p_=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const m_=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:u,...d},p)=>b.createElement("svg",{ref:p,...h_,width:t,height:t,stroke:e,strokeWidth:a?Number(s)*24/Number(t):s,className:PS("lucide",i),...!l&&!p_(d)&&{"aria-hidden":"true"},...d},[...u.map(([h,y])=>b.createElement(h,y)),...Array.isArray(l)?l:[l]]));const Tt=(e,t)=>{const s=b.forwardRef(({className:a,...i},l)=>b.createElement(m_,{ref:l,iconNode:t,className:PS(`lucide-${d_(mx(e))}`,`lucide-${e}`,a),...i}));return s.displayName=mx(e),s};const g_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],y_=Tt("chevron-down",g_);const v_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],b_=Tt("chevron-right",v_);const x_=[["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"}]],w_=Tt("circle-alert",x_);const S_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],E_=Tt("clock",S_);const N_=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],T_=Tt("corner-down-left",N_);const j_=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],gx=Tt("loader-circle",j_);const C_=[["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"}]],R_=Tt("map",C_);const A_=[["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=Tt("maximize-2",A_);const __=[["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"}]],k_=Tt("mic",__);const M_=[["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"}]],O_=Tt("minimize-2",M_);const D_=[["path",{d:"M5 12h14",key:"1ays0h"}]],z_=Tt("minus",D_);const I_=[["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"}]],L_=Tt("panel-left-close",I_);const P_=[["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"}]],U_=Tt("panel-left-open",P_);const V_=[["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"}]],$_=Tt("panel-right-close",V_);const B_=[["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"}]],Z_=Tt("panel-right-open",B_);const H_=[["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"}]],F_=Tt("paperclip",H_);const q_=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Y_=Tt("plus",q_);const G_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ig=Tt("search",G_);const X_=[["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=Tt("sparkles",X_);const K_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],$S=Tt("square",K_);const W_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],BS=Tt("terminal",W_);const J_=[["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"}]],Q_=Tt("trash-2",J_);const ek=[["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"}]],tk=Tt("volume-2",ek);const nk=[["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"}]],sk=Tt("volume-x",nk);const rk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ZS=Tt("x",rk),ak=({scale:e,onZoom:t,min:s=.2,max:a=3,step:i=.1})=>{const[l,u]=b.useState(!1),[d,p]=b.useState(""),h=b.useRef(null),y=b.useCallback(_=>Math.min(a,Math.max(s,_)),[s,a]),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(()=>{p(Math.round(e*100).toString()),u(!0)},[e]),N=b.useCallback(()=>{u(!1);const _=parseInt(d,10);!isNaN(_)&&_>0&&t(y(_/100))},[d,t,y]),T=b.useCallback(_=>{_.key==="Enter"?N():_.key==="Escape"&&u(!1)},[N]);return b.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select())},[l]),f.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:[f.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:f.jsx(Y_,{size:14})}),f.jsx("div",{className:"w-full border-t border-b border-neutral-700/50",children:l?f.jsx("input",{ref:h,type:"text",value:d,onChange:_=>p(_.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"}):f.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),"%"]})}),f.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:f.jsx(z_,{size:14})})]})},ik={...IS};let yx=0;function ok(e,t="mui"){const[s,a]=b.useState(e),i=e||s;return b.useEffect(()=>{s==null&&(yx+=1,a(`${t}-${yx}`))},[s,t]),i}const vx=ik.useId;function ea(e,t){if(vx!==void 0){const s=vx();return e??(t?`${t}-${s}`:s)}return ok(e,t)}function Ha(e,...t){const s=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(a=>s.searchParams.append("args[]",a)),`Base UI error #${e}; visit ${s} for the full message.`}const HS=b.createContext(void 0);function kd(e=!0){const t=b.useContext(HS);if(t===void 0&&!e)throw new Error(Ha(25));return t}const FS=b.createContext(void 0);function qS(e){const t=b.useContext(FS);if(t===void 0&&!e)throw new Error(Ha(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(Ha(36));return t}const bx={};function us(e,t){const s=b.useRef(bx);return s.current===bx&&(s.current=e(t)),s}function Al(e,t,s,a){const i=us(YS).current;return ck(i,e,t,s,a)&&GS(i,[e,t,s,a]),i.callback}function lk(e){const t=us(YS).current;return uk(t,e)&&GS(t,e),t.callback}function YS(){return{callback:null,cleanup:null,refs:[]}}function ck(e,t,s,a,i){return e.refs[0]!==t||e.refs[1]!==s||e.refs[2]!==a||e.refs[3]!==i}function uk(e,t){return e.refs.length!==t.length||e.refs.some((s,a)=>s!==t[a])}function GS(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 a=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"&&(a[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=a[i];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}const dk=parseInt(b.version,10);function lg(e){return dk>=e}function xx(e){if(!b.isValidElement(e))return null;const t=e,s=t.props;return(lg(19)?s?.ref:t.ref)??null}function im(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function fk(e,t){const s={};for(const a in e){const i=e[a];if(t?.hasOwnProperty(a)){const l=t[a](i);l!=null&&Object.assign(s,l);continue}i===!0?s[`data-${a.toLowerCase()}`]="":i&&(s[`data-${a.toLowerCase()}`]=i.toString())}return s}function hk(e,t){return typeof e=="function"?e(t):e}function pk(e,t){return typeof e=="function"?e(t):e}const bl={};function Md(e,t,s,a,i){let l={...om(e,bl)};return t&&(l=$u(l,t)),s&&(l=$u(l,s)),a&&(l=$u(l,a)),l}function mk(e){if(e.length===0)return bl;if(e.length===1)return om(e[0],bl);let t={...om(e[0],bl)};for(let s=1;s<e.length;s+=1)t=$u(t,e[s]);return t}function $u(e,t){return XS(t)?t(e):gk(e,t)}function gk(e,t){if(!t)return e;for(const s in t){const a=t[s];switch(s){case"style":{e[s]=im(e.style,a);break}case"className":{e[s]=KS(e.className,a);break}default:yk(s,a)?e[s]=vk(e[s],a):e[s]=a}}return e}function yk(e,t){const s=e.charCodeAt(0),a=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&a===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function XS(e){return typeof e=="function"}function om(e,t){return XS(e)?e(t):e??bl}function vk(e,t){return t?e?s=>{if(bk(s)){const i=s;lm(i);const l=t(i);return i.baseUIHandlerPrevented||e?.(i),l}const a=t(s);return e?.(s),a}:t:e}function lm(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function KS(e,t){return t?e?t+" "+e:t:e}function bk(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function WS(){}const JS=Object.freeze([]),Dn=Object.freeze({}),xk=500,wk={style:{transition:"none"}},Sk="data-base-ui-click-trigger",Ek={fallbackAxisSide:"none"},Nk={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function ta(e,t,s={}){const a=t.render,i=Tk(t,s);if(s.enabled===!1)return null;const l=s.state??Dn;return jk(e,a,i,l)}function Tk(e,t={}){const{className:s,style:a,render:i}=e,{state:l=Dn,ref:u,props:d,stateAttributesMapping:p,enabled:h=!0}=t,y=h?hk(s,l):void 0,v=h?pk(a,l):void 0,x=h?fk(l,p):Dn,w=h?im(x,Array.isArray(d)?mk(d):d)??Dn:Dn;return typeof document<"u"&&(h?Array.isArray(u)?w.ref=lk([w.ref,xx(i),...u]):w.ref=Al(w.ref,xx(i),u):Al(null,null)),h?(y!==void 0&&(w.className=KS(w.className,y)),v!==void 0&&(w.style=im(w.style,v)),w):Dn}function jk(e,t,s,a){if(t){if(typeof t=="function")return t(s,a);const i=Md(s,t.props);return i.ref=s.ref,b.cloneElement(t,i)}return Ck(e,s)}function Ck(e,t){return b.createElement(e,t)}let td=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Rk={[td.startingStyle]:""},Ak={[td.endingStyle]:""},_k={transitionStatus(e){return e==="starting"?Rk:e==="ending"?Ak: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})({}),wx=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const kk={[wx.popupOpen]:"",[wx.pressed]:""},Mk={[cg.open]:""},Ok={[cg.closed]:""},Dk={[cg.anchorHidden]:""},zk={open(e){return e?kk:null}},QS={open(e){return e?Mk:Ok},anchorHidden(e){return e?Dk:null}},Ik="none",nd="trigger-press",Ia="trigger-hover",Sx="trigger-focus",ug="outside-press",eE="item-press",Od="focus-out",tE="escape-key",Bu="list-navigation",Lk="cancel-open",hl="sibling-open",Pk="imperative-action",pp=IS[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Uk=pp&&pp!==b.useLayoutEffect?pp:e=>e();function Ue(e){const t=us(Vk).current;return t.next=e,Uk(t.effect),t.trampoline}function Vk(){const e={next:void 0,callback:$k,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function $k(){}function Dd(){return typeof window<"u"}function na(e){return dg(e)?(e.nodeName||"").toLowerCase():"#document"}function cn(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 Dd()?e instanceof Node||e instanceof cn(e).Node:!1}function Nt(e){return Dd()?e instanceof Element||e instanceof cn(e).Element:!1}function Pt(e){return Dd()?e instanceof HTMLElement||e instanceof cn(e).HTMLElement:!1}function cm(e){return!Dd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof cn(e).ShadowRoot}const Bk=new Set(["inline","contents"]);function Fa(e){const{overflow:t,overflowX:s,overflowY:a,display:i}=Yn(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+s)&&!Bk.has(i)}const Zk=new Set(["table","td","th"]);function Hk(e){return Zk.has(na(e))}const Fk=[":popover-open",":modal"];function zd(e){return Fk.some(t=>{try{return e.matches(t)}catch{return!1}})}const qk=["transform","translate","scale","rotate","perspective"],Yk=["transform","translate","scale","rotate","perspective","filter"],Gk=["paint","layout","strict","content"];function fg(e){const t=Id(),s=Nt(e)?Yn(e):e;return qk.some(a=>s[a]?s[a]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!t&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!t&&(s.filter?s.filter!=="none":!1)||Yk.some(a=>(s.willChange||"").includes(a))||Gk.some(a=>(s.contain||"").includes(a))}function Xk(e){let t=Vs(e);for(;Pt(t)&&!Ls(t);){if(fg(t))return t;if(zd(t))return null;t=Vs(t)}return null}function Id(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Kk=new Set(["html","body","#document"]);function Ls(e){return Kk.has(na(e))}function Yn(e){return cn(e).getComputedStyle(e)}function Ld(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vs(e){if(na(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cm(e)&&e.host||Zs(e);return cm(t)?t.host:t}function nE(e){const t=Vs(e);return Ls(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pt(t)&&Fa(t)?t:nE(t)}function qr(e,t,s){var a;t===void 0&&(t=[]),s===void 0&&(s=!0);const i=nE(e),l=i===((a=e.ownerDocument)==null?void 0:a.body),u=cn(i);if(l){const d=um(u);return t.concat(u,u.visualViewport||[],Fa(i)?i:[],d&&s?qr(d):[])}return t.concat(i,qr(i,[],s))}function um(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Wk=()=>{},Le=typeof document<"u"?b.useLayoutEffect:Wk,Jk=b.createContext(void 0);function Qk(e=!1){const t=b.useContext(Jk);if(t===void 0&&!e)throw new Error(Ha(16));return t}function e2(e){const{focusableWhenDisabled:t,disabled:s,composite:a=!1,tabIndex:i=0,isNativeButton:l}=e,u=a&&t!==!1,d=a&&t===!1;return{props:b.useMemo(()=>{const h={onKeyDown(y){s&&t&&y.key!=="Tab"&&y.preventDefault()}};return a||(h.tabIndex=i,!l&&s&&(h.tabIndex=t?i:-1)),(l&&(t||u)||!l&&s)&&(h["aria-disabled"]=s),l&&(!t||d)&&(h.disabled=s),h},[a,s,t,u,d,l,i])}}function t2(e={}){const{disabled:t=!1,focusableWhenDisabled:s,tabIndex:a=0,native:i=!0}=e,l=b.useRef(null),u=Qk(!0)!==void 0,d=Ue(()=>{const x=l.current;return!!(x?.tagName==="A"&&x?.href)}),{props:p}=e2({focusableWhenDisabled:s,disabled:t,composite:u,tabIndex:a,isNativeButton:i}),h=b.useCallback(()=>{const x=l.current;n2(x)&&u&&t&&p.disabled===void 0&&x.disabled&&(x.disabled=!1)},[t,p.disabled,u]);Le(h,[h]);const y=b.useCallback((x={})=>{const{onClick:w,onMouseDown:N,onKeyUp:T,onKeyDown:_,onPointerDown:C,...j}=x;return Md({type:i?"button":void 0,onClick(A){if(t){A.preventDefault();return}w?.(A)},onMouseDown(A){t||N?.(A)},onKeyDown(A){if(t||(lm(A),_?.(A)),A.baseUIHandlerPrevented)return;const R=A.target===A.currentTarget&&!i&&!d()&&!t,O=A.key==="Enter",M=A.key===" ";R&&((M||O)&&A.preventDefault(),O&&w?.(A))},onKeyUp(A){t||(lm(A),T?.(A)),!A.baseUIHandlerPrevented&&A.target===A.currentTarget&&!i&&!t&&A.key===" "&&w?.(A)},onPointerDown(A){if(t){A.preventDefault();return}C?.(A)}},i?void 0:{role:"button"},p,j)},[t,p,i,d]),v=Ue(x=>{l.current=x,h()});return{getButtonProps:y,buttonRef:v}}function n2(e){return Pt(e)&&e.tagName==="BUTTON"}const s2={type:"regular-item"};function r2(e){const{closeOnClick:t,disabled:s=!1,highlighted:a,id:i,store:l,nativeButton:u,itemMetadata:d,nodeId:p}=e,h=b.useRef(null),y=kd(!0),v=y!==void 0,{events:x}=l.useState("floatingTreeRoot"),{getButtonProps:w,buttonRef:N}=t2({disabled:s,focusableWhenDisabled:!0,native:u}),T=b.useCallback(C=>Md({id:i,role:"menuitem",tabIndex:a?0:-1,onMouseMove(j){p&&x.emit("itemhover",{nodeId:p,target:j.currentTarget})},onMouseEnter(){d.type==="submenu-trigger"&&d.setActive()},onKeyUp(j){j.key===" "&&l.context.typingRef.current&&j.preventBaseUIHandler()},onClick(j){t&&x.emit("close",{domEvent:j,reason:eE})},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)&&d.type==="regular-item"&&h.current.click()}},C,w),[i,a,w,t,x,l,v,y,d,p]),_=Al(h,N);return b.useMemo(()=>({getItemProps:T,itemRef:_}),[T,_])}const sE=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function a2(){return b.useContext(sE)}let i2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function o2(e={}){const{label:t,metadata:s,textRef:a,indexGuessBehavior:i,index:l}=e,{register:u,unregister:d,subscribeMapChange:p,elementsRef:h,labelsRef:y,nextIndexRef:v}=a2(),x=b.useRef(-1),[w,N]=b.useState(l??(i===i2.GuessFromOrder?()=>{if(x.current===-1){const C=v.current;v.current+=1,x.current=C}return x.current}:-1)),T=b.useRef(null),_=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:a?.current?.textContent??C.textContent}},[w,h,y,t,a]);return Le(()=>{if(l!=null)return;const C=T.current;if(C)return u(C,s),()=>{d(C)}},[l,u,d,s]),Le(()=>{if(l==null)return p(C=>{const j=T.current?C.get(T.current)?.index:null;j!=null&&N(j)})},[l,p,N]),b.useMemo(()=>({ref:_,index:w}),[w,_])}function rE(e){return ea(e,"base-ui")}function Ht(e,t,s,a){let i=!1,l=!1;const u=Dn;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 Pa=LS();const l2=[];function aE(e){b.useEffect(e,l2)}const gu=null;class c2{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const s=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>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 yu=new c2;class zs{static create(){return new zs}static request(t){return yu.request(t)}static cancel(t){return yu.cancel(t)}currentId=gu;request(t){this.cancel(),this.currentId=yu.request(()=>{this.currentId=gu,t()})}cancel=()=>{this.currentId!==gu&&(yu.cancel(this.currentId),this.currentId=gu)};disposeEffect=()=>this.cancel}function hg(){const e=us(zs.create).current;return aE(e.disposeEffect),e}function u2(e,t=!1,s=!1){const[a,i]=b.useState(e&&t?"idle":void 0),[l,u]=b.useState(e);return e&&!l&&(u(!0),i("starting")),!e&&l&&a!=="ending"&&!s&&i("ending"),!e&&!l&&a==="ending"&&i(void 0),Le(()=>{if(!e&&l&&a!=="ending"&&s){const d=zs.request(()=>{i("ending")});return()=>{zs.cancel(d)}}},[e,l,a,s]),Le(()=>{if(!e||t)return;const d=zs.request(()=>{Pa.flushSync(()=>{i(void 0)})});return()=>{zs.cancel(d)}},[t,e]),Le(()=>{if(!e||!t)return;e&&l&&a!=="idle"&&i("starting");const d=zs.request(()=>{i("idle")});return()=>{zs.cancel(d)}},[t,e,l,i,a]),b.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:a}),[l,a])}function Mn(e){const t=us(d2,e).current;return t.next=e,Le(t.effect),t}function d2(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function _a(e){return e==null?e:"current"in e?e.current:e}function f2(e,t=!1,s=!0){const a=hg();return Ue((i,l=null)=>{a.cancel();const u=_a(e);u!=null&&(typeof u.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():a.request(()=>{function d(){u&&Promise.all(u.getAnimations().map(p=>p.finished)).then(()=>{l!=null&&l.aborted||Pa.flushSync(i)}).catch(()=>{if(s){if(l!=null&&l.aborted)return;Pa.flushSync(i)}else u.getAnimations().length>0&&u.getAnimations().some(p=>p.pending||p.playState!=="finished")&&d()})}t?a.request(d):d()}))})}function iE(e){const{enabled:t=!0,open:s,ref:a,onComplete:i}=e,l=Mn(s),u=Ue(i),d=f2(a,s);b.useEffect(()=>{t&&d(()=>{s===l.current&&u()})},[t,s,u,d,l])}const oE=b.createContext(void 0);function h2(){const e=b.useContext(oE);if(e===void 0)throw new Error(Ha(31));return e}const p2=b.forwardRef(function(t,s){const{render:a,className:i,...l}=t,[u,d]=b.useState(void 0),p=b.useMemo(()=>({setLabelId:d}),[d]),h=ta("div",t,{ref:s,props:{role:"group","aria-labelledby":u,...l}});return f.jsx(oE.Provider,{value:p,children:h})}),m2=b.forwardRef(function(t,s){const{className:a,render:i,id:l,...u}=t,d=rE(l),{setLabelId:p}=h2();return Le(()=>(p(d),()=>{p(void 0)}),[p,d]),ta("div",t,{ref:s,props:{id:d,role:"presentation",...u}})}),g2=b.forwardRef(function(t,s){const{render:a,className:i,id:l,label:u,nativeButton:d=!1,disabled:p=!1,closeOnClick:h=!0,...y}=t,v=o2({label:u}),x=qS(!0),w=rE(l),{store:N}=ro(),T=N.useState("isActive",v.index),_=N.useState("itemProps"),{getItemProps:C,itemRef:j}=r2({closeOnClick:h,disabled:p,highlighted:T,id:w,store:N,nativeButton:d,nodeId:x?.nodeId,itemMetadata:s2}),E=b.useMemo(()=>({disabled:p,highlighted:T}),[p,T]);return ta("div",t,{state:E,props:[_,y,C],ref:[j,s,v.ref]})}),cl=0;class Ki{static create(){return new Ki}currentId=cl;start(t,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=cl,s()},t)}isStarted(){return this.currentId!==cl}clear=()=>{this.currentId!==cl&&(clearTimeout(this.currentId),this.currentId=cl)};disposeEffect=()=>this.clear}function Es(){const e=us(Ki.create).current;return aE(e.disposeEffect),e}const ao=typeof navigator<"u",mp=w2(),lE=E2(),cE=S2(),y2=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),v2=mp.platform==="MacIntel"&&mp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(mp.platform),b2=ao&&/apple/i.test(navigator.vendor),dm=ao&&/android/i.test(lE)||/android/i.test(cE);ao&&lE.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const x2=cE.includes("jsdom/");function w2(){if(!ao)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 S2(){if(!ao)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:s})=>`${t}/${s}`).join(" "):navigator.userAgent}function E2(){if(!ao)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const fm="data-base-ui-focusable",uE="active",dE="selected",fE="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Yr="ArrowLeft",Gr="ArrowRight",pg="ArrowUp",Zl="ArrowDown";function Zr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Et(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&cm(s)){let a=t;for(;a;){if(e===a)return!0;a=a.parentNode||a.host}}return!1}function On(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ms(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 N2(e){return e.matches("html,body")}function on(e){return e?.ownerDocument||document}function T2(e){return Pt(e)&&e.matches(fE)}function hm(e){return e?e.getAttribute("role")==="combobox"&&T2(e):!1}function sd(e){return e?e.hasAttribute(fm)?e:e.querySelector(`[${fm}]`)||e:null}function Fi(e,t,s=!0){return e.filter(i=>i.parentId===t&&(!s||i.context?.open)).flatMap(i=>[i,...Fi(e,i.id,s)])}function Ex(e,t){let s=[],a=e.find(i=>i.id===t)?.parentId;for(;a;){const i=e.find(l=>l.id===a);a=i?.parentId,i&&(s=s.concat(i))}return s}function ln(e){e.preventDefault(),e.stopPropagation()}function j2(e){return"nativeEvent"in e}function hE(e){return e.mozInputSource===0&&e.isTrusted?!0:dm&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function pE(e){return x2?!1:!dm&&e.width===0&&e.height===0||dm&&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 C2(e,t){const s=["mouse","pen"];return s.push("",void 0),s.includes(e)}function R2(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const A2=["top","right","bottom","left"],Wi=Math.min,Hn=Math.max,rd=Math.round,Li=Math.floor,Ps=e=>({x:e,y:e}),_2={left:"right",right:"left",bottom:"top",top:"bottom"},k2={start:"end",end:"start"};function pm(e,t,s){return Hn(e,Wi(t,s))}function fr(e,t){return typeof e=="function"?e(t):e}function Fn(e){return e.split("-")[0]}function sa(e){return e.split("-")[1]}function mg(e){return e==="x"?"y":"x"}function gg(e){return e==="y"?"height":"width"}const M2=new Set(["top","bottom"]);function os(e){return M2.has(Fn(e))?"y":"x"}function yg(e){return mg(os(e))}function O2(e,t,s){s===void 0&&(s=!1);const a=sa(e),i=yg(e),l=gg(i);let u=i==="x"?a===(s?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=ad(u)),[u,ad(u)]}function D2(e){const t=ad(e);return[mm(e),t,mm(t)]}function mm(e){return e.replace(/start|end/g,t=>k2[t])}const Nx=["left","right"],Tx=["right","left"],z2=["top","bottom"],I2=["bottom","top"];function L2(e,t,s){switch(e){case"top":case"bottom":return s?t?Tx:Nx:t?Nx:Tx;case"left":case"right":return t?z2:I2;default:return[]}}function P2(e,t,s,a){const i=sa(e);let l=L2(Fn(e),s==="start",a);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(mm)))),l}function ad(e){return e.replace(/left|right|bottom|top/g,t=>_2[t])}function U2(e){return{top:0,right:0,bottom:0,left:0,...e}}function mE(e){return typeof e!="number"?U2(e):{top:e,right:e,bottom:e,left:e}}function id(e){const{x:t,y:s,width:a,height:i}=e;return{width:a,height:i,top:s,left:t,right:t+a,bottom:s+i,x:t,y:s}}function vu(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 dn(e,{disabledIndices:t})}function jx(e,t){return dn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function dn(e,{startingIndex:t=-1,decrement:s=!1,disabledIndices:a,amount:i=1}={}){let l=t;do l+=s?-i:i;while(l>=0&&l<=e.current.length-1&&wl(e,l,a));return l}function V2(e,{event:t,orientation:s,loopFocus:a,rtl:i,cols:l,disabledIndices:u,minIndex:d,maxIndex:p,prevIndex:h,stopEvent:y=!1}){let v=h;const x=[],w={};let N=!1;{let C=null,j=-1;e.current.forEach((E,A)=>{if(E==null)return;const R=E.closest('[role="row"]');R&&(N=!0),(R!==C||j===-1)&&(C=R,j+=1,x[j]=[]),x[j].push(A),w[A]=j})}const T=N&&x.length>0&&x.some(C=>C.length!==l);function _(C){if(!T||h===-1)return;const j=w[h];if(j==null)return;const E=x[j].indexOf(h);let A=C==="up"?j-1:j+1;a&&(A<0?A=x.length-1:A>=x.length&&(A=0));const R=new Set;for(;A>=0&&A<x.length&&!R.has(A);){R.add(A);const O=x[A];if(O.length===0){A=C==="up"?A-1:A+1;continue}const M=Math.min(E,O.length-1);for(let z=M;z>=0;z-=1){const F=O[z];if(!wl(e,F,u))return F}A=C==="up"?A-1:A+1,a&&(A<0?A=x.length-1:A>=x.length&&(A=0))}}if(t.key===pg){const C=_("up");if(C!==void 0)y&&ln(t),v=C;else{if(y&&ln(t),h===-1)v=p;else if(v=dn(e,{startingIndex:v,amount:l,decrement:!0,disabledIndices:u}),a&&(h-l<d||v<0)){const j=h%l,E=p%l,A=p-(E-j);E===j?v=p:v=E>j?A:A-l}xl(e,v)&&(v=h)}}if(t.key===Zl){const C=_("down");C!==void 0?(y&&ln(t),v=C):(y&&ln(t),h===-1?v=d:(v=dn(e,{startingIndex:h,amount:l,disabledIndices:u}),a&&h+l>p&&(v=dn(e,{startingIndex:h%l-l,amount:l,disabledIndices:u}))),xl(e,v)&&(v=h))}if(s==="both"){const C=Li(h/l);t.key===(i?Yr:Gr)&&(y&&ln(t),h%l!==l-1?(v=dn(e,{startingIndex:h,disabledIndices:u}),a&&vu(v,l,C)&&(v=dn(e,{startingIndex:h-h%l-1,disabledIndices:u}))):a&&(v=dn(e,{startingIndex:h-h%l-1,disabledIndices:u})),vu(v,l,C)&&(v=h)),t.key===(i?Gr:Yr)&&(y&&ln(t),h%l!==0?(v=dn(e,{startingIndex:h,decrement:!0,disabledIndices:u}),a&&vu(v,l,C)&&(v=dn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u}))):a&&(v=dn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u})),vu(v,l,C)&&(v=h));const j=Li(p/l)===C;xl(e,v)&&(a&&j?v=t.key===(i?Gr:Yr)?p:dn(e,{startingIndex:h-h%l-1,disabledIndices:u}):v=h)}return v}function $2(e,t,s){const a=[];let i=0;return e.forEach(({width:l,height:u},d)=>{let p=!1;for(s&&(i=0);!p;){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=>a[y]==null)?(h.forEach(y=>{a[y]=d}),p=!0):i+=1}}),[...a]}function B2(e,t,s,a,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)*a:l;case"br":return s.lastIndexOf(e);default:return-1}}function Z2(e,t){return t.flatMap((s,a)=>e.includes(s)?[a]:[])}function wl(e,t,s){if(typeof s=="function")return s(t);if(s)return s.includes(t);const a=e.current[t];return a?a.hasAttribute("disabled")||a.getAttribute("aria-disabled")==="true":!1}var H2=["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=H2.join(","),gE=typeof Element>"u",Ji=gE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ld=!gE&&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 a;s===void 0&&(s=!0);var i=t==null||(a=t.getAttribute)===null||a===void 0?void 0:a.call(t,"inert"),l=i===""||i==="true",u=l||s&&t&&(typeof t.closest=="function"?t.closest("[inert]"):cd(t.parentNode));return u},F2=function(t){var s,a=t==null||(s=t.getAttribute)===null||s===void 0?void 0:s.call(t,"contenteditable");return a===""||a==="true"},yE=function(t,s,a){if(cd(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(od));return s&&Ji.call(t,od)&&i.unshift(t),i=i.filter(a),i},ud=function(t,s,a){for(var i=[],l=Array.from(t);l.length;){var u=l.shift();if(!cd(u,!1))if(u.tagName==="SLOT"){var d=u.assignedElements(),p=d.length?d:u.children,h=ud(p,!0,a);a.flatten?i.push.apply(i,h):i.push({scopeParent:u,candidates:h})}else{var y=Ji.call(u,od);y&&a.filter(u)&&(s||!t.includes(u))&&i.push(u);var v=u.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(u),x=!cd(v,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(u));if(v&&x){var w=ud(v===!0?u.children:v.children,!0,a);a.flatten?i.push.apply(i,w):i.push({scopeParent:u,candidates:w})}else l.unshift.apply(l,u.children)}}return i},vE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},bE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||F2(t))&&!vE(t)?0:t.tabIndex},q2=function(t,s){var a=bE(t);return a<0&&s&&!vE(t)?0:a},Y2=function(t,s){return t.tabIndex===s.tabIndex?t.documentOrder-s.documentOrder:t.tabIndex-s.tabIndex},xE=function(t){return t.tagName==="INPUT"},G2=function(t){return xE(t)&&t.type==="hidden"},X2=function(t){var s=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(a){return a.tagName==="SUMMARY"});return s},K2=function(t,s){for(var a=0;a<t.length;a++)if(t[a].checked&&t[a].form===s)return t[a]},W2=function(t){if(!t.name)return!0;var s=t.form||ld(t),a=function(d){return s.querySelectorAll('input[type="radio"][name="'+d+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=a(window.CSS.escape(t.name));else try{i=a(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=K2(i,t.form);return!l||l===t},J2=function(t){return xE(t)&&t.type==="radio"},Q2=function(t){return J2(t)&&!W2(t)},eM=function(t){var s,a=t&&ld(t),i=(s=a)===null||s===void 0?void 0:s.host,l=!1;if(a&&a!==t){var u,d,p;for(l=!!((u=i)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(i)||t!=null&&(p=t.ownerDocument)!==null&&p!==void 0&&p.contains(t));!l&&i;){var h,y,v;a=ld(i),i=(h=a)===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},Cx=function(t){var s=t.getBoundingClientRect(),a=s.width,i=s.height;return a===0&&i===0},tM=function(t,s){var a=s.displayCheck,i=s.getShadowRoot;if(a==="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=Ji.call(t,"details>summary:first-of-type"),d=u?t.parentElement:t;if(Ji.call(d,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof i=="function"){for(var p=t;t;){var h=t.parentElement,y=ld(t);if(h&&!h.shadowRoot&&i(h)===!0)return Cx(t);t.assignedSlot?t=t.assignedSlot:!h&&y!==t.ownerDocument?t=y.host:t=h}t=p}if(eM(t))return!t.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return Cx(t);return!1},nM=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var s=t.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var a=0;a<s.children.length;a++){var i=s.children.item(a);if(i.tagName==="LEGEND")return Ji.call(s,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}s=s.parentElement}return!1},gm=function(t,s){return!(s.disabled||G2(s)||tM(s,t)||X2(s)||nM(s))},ym=function(t,s){return!(Q2(s)||bE(s)<0||!gm(t,s))},sM=function(t){var s=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},wE=function(t){var s=[],a=[];return t.forEach(function(i,l){var u=!!i.scopeParent,d=u?i.scopeParent:i,p=q2(d,u),h=u?wE(i.candidates):d;p===0?u?s.push.apply(s,h):s.push(d):a.push({documentOrder:l,tabIndex:p,item:i,isScope:u,content:h})}),a.sort(Y2).reduce(function(i,l){return l.isScope?i.push.apply(i,l.content):i.push(l.content),i},[]).concat(s)},Pd=function(t,s){s=s||{};var a;return s.getShadowRoot?a=ud([t],s.includeContainer,{filter:ym.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:sM}):a=yE(t,s.includeContainer,ym.bind(null,s)),wE(a)},rM=function(t,s){s=s||{};var a;return s.getShadowRoot?a=ud([t],s.includeContainer,{filter:gm.bind(null,s),flatten:!0,getShadowRoot:s.getShadowRoot}):a=yE(t,s.includeContainer,gm.bind(null,s)),a},SE=function(t,s){if(s=s||{},!t)throw new Error("No node provided");return Ji.call(t,od)===!1?!1:ym(s,t)};const Hl=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function EE(e,t){const s=Pd(e,Hl()),a=s.length;if(a===0)return;const i=Zr(on(e)),l=s.indexOf(i),u=l===-1?t===1?0:a-1:l+t;return s[u]}function NE(e){return EE(on(e).body,1)||e}function TE(e){return EE(on(e).body,-1)||e}function Sl(e,t){const s=t||e.currentTarget,a=e.relatedTarget;return!a||!Et(s,a)}function aM(e){Pd(e,Hl()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Rx(e){e.querySelectorAll("[data-tabindex]").forEach(s=>{const a=s.dataset.tabindex;delete s.dataset.tabindex,a?s.setAttribute("tabindex",a):s.removeAttribute("tabindex")})}function jE(){const e=new Map;return{emit(t,s){e.get(t)?.forEach(a=>a(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 CE{nodesRef={current:[]};events=jE();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const s=this.nodesRef.current.findIndex(a=>a===t);s!==-1&&this.nodesRef.current.splice(s,1)}}const RE=b.createContext(null),AE=b.createContext(null),ra=()=>b.useContext(RE)?.id||null,io=e=>{const t=b.useContext(AE);return e??t};function iM(e){const t=ea(),s=io(e),a=ra();return Le(()=>{if(!t)return;const i={id:t,parentId:a};return s?.addNode(i),()=>{s?.removeNode(i)}},[s,t,a]),t}function oM(e){const{children:t,id:s}=e,a=ra();return f.jsx(RE.Provider,{value:b.useMemo(()=>({id:s,parentId:a}),[s,a]),children:t})}function lM(e){const{children:t,externalTree:s}=e,a=us(()=>s??new CE).current;return f.jsx(AE.Provider,{value:a,children:t})}function _l(e){return`data-base-ui-${e}`}const _E={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 Ua(e){return e?.ownerDocument||document}const dd=b.forwardRef(function(t,s){const[a,i]=b.useState();Le(()=>{b2&&i("button")},[]);const l={tabIndex:0,role:a};return f.jsx("span",{...t,ref:s,style:_E,"aria-hidden":a?void 0:!0,...l,"data-base-ui-focus-guard":""})});let Ax=0;function Zu(e,t={}){const{preventScroll:s=!1,cancelPrevious:a=!0,sync:i=!1}=t;a&&cancelAnimationFrame(Ax);const l=()=>e?.focus({preventScroll:s});i?l():Ax=requestAnimationFrame(l)}const qi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function _x(e){return e==="inert"?qi.inert:e==="aria-hidden"?qi["aria-hidden"]:qi.none}let bu=new WeakSet,xu={},yp=0;const kE=e=>e&&(e.host||kE(e.parentNode)),cM=(e,t)=>t.map(s=>{if(e.contains(s))return s;const a=kE(s);return e.contains(a)?a:null}).filter(s=>s!=null);function uM(e,t,s,a){const i="data-base-ui-inert",l=a?"inert":s?"aria-hidden":null,u=cM(t,e),d=new Set,p=new Set(u),h=[];xu[i]||(xu[i]=new WeakMap);const y=xu[i];u.forEach(v),x(t),d.clear();function v(w){!w||d.has(w)||(d.add(w),w.parentNode&&v(w.parentNode))}function x(w){!w||p.has(w)||[].forEach.call(w.children,N=>{if(na(N)!=="script")if(d.has(N))x(N);else{const T=l?N.getAttribute(l):null,_=T!==null&&T!=="false",C=_x(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&&_&&bu.add(N),E===1&&N.setAttribute(i,""),!_&&l&&N.setAttribute(l,l==="inert"?"":"true")}})}return yp+=1,()=>{h.forEach(w=>{const N=_x(l),_=(N.get(w)||0)-1,C=(y.get(w)||0)-1;N.set(w,_),y.set(w,C),_||(!bu.has(w)&&l&&w.removeAttribute(l),bu.delete(w)),C||w.removeAttribute(i)}),yp-=1,yp||(qi.inert=new WeakMap,qi["aria-hidden"]=new WeakMap,qi.none=new WeakMap,bu=new WeakSet,xu={})}}function dM(e,t=!1,s=!1){const a=on(e[0]).body;return uM(e.concat(Array.from(a.querySelectorAll("[aria-live]"))),a,t,s)}const ME=b.createContext(null),OE=()=>b.useContext(ME),fM=_l("portal");function hM(e={}){const{ref:t,container:s,componentProps:a=Dn,elementProps:i,elementState:l}=e,u=ea(),p=OE()?.portalNode,[h,y]=b.useState(null),[v,x]=b.useState(null),w=b.useRef(null);Le(()=>{if(s===null){w.current&&(w.current=null,x(null),y(null));return}if(u==null)return;const _=(s&&(dg(s)?s:s.current))??p??document.body;if(_==null){w.current&&(w.current=null,x(null),y(null));return}w.current!==_&&(w.current=_,x(null),y(_))},[s,p,u]);const N=ta("div",a,{ref:[t,x],state:l,props:[{id:u,[fM]:""},i]});return{portalNode:v,portalSubtree:h&&N?Pa.createPortal(N,h):null}}const pM=b.forwardRef(function(t,s){const{children:a,container:i,className:l,render:u,renderGuards:d,...p}=t,{portalNode:h,portalSubtree:y}=hM({container:i,ref:s,componentProps:t,elementProps:p}),v=b.useRef(null),x=b.useRef(null),w=b.useRef(null),N=b.useRef(null),[T,_]=b.useState(null),C=T?.modal,j=T?.open,E=typeof d=="boolean"?d:!!T&&!T.modal&&T.open&&!!h;b.useEffect(()=>{if(!h||C)return;function R(O){h&&Sl(O)&&(O.type==="focusin"?Rx:aM)(h)}return h.addEventListener("focusin",R,!0),h.addEventListener("focusout",R,!0),()=>{h.removeEventListener("focusin",R,!0),h.removeEventListener("focusout",R,!0)}},[h,C]),b.useEffect(()=>{!h||j||Rx(h)},[j,h]);const A=b.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:x,beforeInsideRef:w,afterInsideRef:N,portalNode:h,setFocusManagerState:_}),[h]);return f.jsxs(b.Fragment,{children:[y,f.jsxs(ME.Provider,{value:A,children:[E&&h&&f.jsx(dd,{"data-type":"outside",ref:v,onFocus:R=>{if(Sl(R,h))w.current?.focus();else{const O=T?T.domReference:null;TE(O)?.focus()}}}),E&&h&&f.jsx("span",{"aria-owns":h.id,style:Nk}),h&&Pa.createPortal(a,h),E&&h&&f.jsx(dd,{"data-type":"outside",ref:x,onFocus:R=>{if(Sl(R,h))N.current?.focus();else{const O=T?T.domReference:null;NE(O)?.focus(),T?.closeOnFocusOut&&T?.onOpenChange(!1,Ht(Od,R.nativeEvent))}}})]})]})});function mM(e,t){const s=cn(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 kx=20;let Hr=[];function vg(){Hr=Hr.filter(e=>e.isConnected)}function gM(e){vg(),e&&na(e)!=="body"&&(Hr.push(e),Hr.length>kx&&(Hr=Hr.slice(-kx)))}function vp(){return vg(),Hr[Hr.length-1]}function yM(e){if(!e)return null;const t=Hl();return SE(e,t)?e:Pd(e,t)[0]||e}function vM(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Yn(e).display!=="none"}function Mx(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const s=Hl(),i=rM(e,s).filter(u=>{const d=u.getAttribute("data-tabindex")||"";return SE(u,s)||u.hasAttribute("data-tabindex")&&!d.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 bM(e){const{context:t,children:s,disabled:a=!1,order:i=["content"],initialFocus:l=!0,returnFocus:u=!0,restoreFocus:d=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:y="",getInsideElements:v=()=>[],nextFocusableElement:x,previousFocusableElement:w,beforeContentFocusGuardRef:N,externalTree:T}=e,_="rootStore"in t?t.rootStore:t,C=_.useState("open"),j=_.useState("domReferenceElement"),E=_.useState("floatingElement"),{events:A,dataRef:R}=_.context,O=Ue(()=>R.current.floatingContext?.nodeId),M=Ue(v),z=l===!1,F=hm(j)&&z,Z=Mn(i),U=Mn(l),H=Mn(u),W=Mn(y),oe=io(T),ee=OE(),I=b.useRef(null),B=b.useRef(null),$=b.useRef(!1),re=b.useRef(!1),J=b.useRef(!1),D=b.useRef(-1),P=b.useRef(""),K=b.useRef(""),se=Es(),te=Es(),ge=hg(),he=ee!=null,pe=sd(E),xe=Ue((Y=pe)=>Y?Pd(Y,Hl()):[]),Re=Ue(Y=>{const ae=xe(Y);return Z.current.map(()=>ae).filter(Boolean).flat()});b.useEffect(()=>{if(a||!p)return;function Y(ye){ye.key==="Tab"&&Et(pe,Zr(on(pe)))&&xe().length===0&&!F&&ln(ye)}const ae=on(pe);return ae.addEventListener("keydown",Y),()=>{ae.removeEventListener("keydown",Y)}},[a,j,pe,p,Z,F,xe,Re]),b.useEffect(()=>{if(a||!E)return;function Y(ae){const ye=On(ae),Ce=xe().indexOf(ye);Ce!==-1&&(D.current=Ce)}return E.addEventListener("focusin",Y),()=>{E.removeEventListener("focusin",Y)}},[a,E,xe]),b.useEffect(()=>{if(a||!C)return;const Y=on(pe);function ae(){J.current=!1}function ye(Ce){const me=On(Ce),Oe=Et(E,me)||Et(j,me)||Et(ee?.portalNode,me);J.current=!Oe,K.current=Ce.pointerType||"keyboard"}function we(){K.current="keyboard"}return Y.addEventListener("pointerdown",ye,!0),Y.addEventListener("pointerup",ae,!0),Y.addEventListener("pointercancel",ae,!0),Y.addEventListener("keydown",we,!0),()=>{Y.removeEventListener("pointerdown",ye,!0),Y.removeEventListener("pointerup",ae,!0),Y.removeEventListener("pointercancel",ae,!0),Y.removeEventListener("keydown",we,!0)}},[a,E,j,pe,C,ee]),b.useEffect(()=>{if(a||!h)return;function Y(){re.current=!0,te.start(0,()=>{re.current=!1})}function ae(me){const Oe=me.relatedTarget,ve=me.currentTarget,Se=On(me);queueMicrotask(()=>{const Ee=O(),We=_.context.triggerElements,it=!(Et(j,Oe)||Et(E,Oe)||Et(Oe,E)||Et(ee?.portalNode,Oe)||Oe!=null&&We.hasElement(Oe)||We.hasMatchingElement(Fe=>Et(Fe,Oe))||Oe?.hasAttribute(_l("focus-guard"))||oe&&(Fi(oe.nodesRef.current,Ee).find(Fe=>Et(Fe.context?.elements.floating,Oe)||Et(Fe.context?.elements.domReference,Oe))||Ex(oe.nodesRef.current,Ee).find(Fe=>[Fe.context?.elements.floating,sd(Fe.context?.elements.floating)].includes(Oe)||Fe.context?.elements.domReference===Oe)));if(ve===j&&pe&&Mx(pe,Z),d&&ve!==j&&!vM(Se)&&Zr(on(pe))===on(pe).body){if(Pt(pe)&&(pe.focus(),d==="popup")){ge.request(()=>{pe.focus()});return}const Fe=D.current,Ft=xe(),Xt=Ft[Fe]||Ft[Ft.length-1]||pe;Pt(Xt)&&Xt.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(F||!p)&&Oe&&it&&!re.current&&(F||Oe!==vp())&&($.current=!0,_.setOpen(!1,Ht(Od,me)))})}function ye(){J.current||(R.current.insideReactTree=!0,se.start(0,()=>{R.current.insideReactTree=!1}))}const we=Pt(j)?j:null,Ce=[];if(!(!E&&!we))return we&&(we.addEventListener("focusout",ae),we.addEventListener("pointerdown",Y),Ce.push(()=>{we.removeEventListener("focusout",ae),we.removeEventListener("pointerdown",Y)})),E&&(E.addEventListener("focusout",ae),ee&&(E.addEventListener("focusout",ye,!0),Ce.push(()=>{E.removeEventListener("focusout",ye,!0)})),Ce.push(()=>{E.removeEventListener("focusout",ae)})),()=>{Ce.forEach(me=>{me()})}},[a,j,E,pe,p,oe,ee,_,h,d,xe,F,O,Z,R,se,te,ge]);const fe=b.useRef(null),ke=b.useRef(null),Te=Al(fe,N,ee?.beforeInsideRef),He=Al(ke,ee?.afterInsideRef);b.useEffect(()=>{if(a||!E||!C)return;const Y=Array.from(ee?.portalNode?.querySelectorAll(`[${_l("portal")}]`)||[]),ye=(oe?Ex(oe.nodesRef.current,O()):[]).find(me=>hm(me.context?.elements.domReference||null))?.context?.elements.domReference,we=[E,ye,...Y,...M(),I.current,B.current,fe.current,ke.current,ee?.beforeOutsideRef.current,ee?.afterOutsideRef.current,_a(w),_a(x),F?j:null].filter(me=>me!=null),Ce=dM(we,p||F);return()=>{Ce()}},[C,a,j,E,p,Z,ee,F,oe,O,M,x,w]),Le(()=>{if(!C||a||!Pt(pe))return;const Y=on(pe),ae=Zr(Y);queueMicrotask(()=>{const ye=Re(pe),we=U.current,Ce=typeof we=="function"?we(W.current||""):we;if(Ce===void 0||Ce===!1)return;let me;Ce===!0||Ce===null?me=ye[0]||pe:me=_a(Ce),me=me||ye[0]||pe,!Et(pe,ae)&&Zu(me,{preventScroll:me===pe})})},[a,C,pe,z,Re,U,W]),Le(()=>{if(a||!pe)return;const Y=on(pe),ae=Zr(Y);gM(ae);function ye(me){if(me.open||(P.current=mM(me.nativeEvent,K.current)),me.reason===Ia&&me.nativeEvent.type==="mouseleave"&&($.current=!0),me.reason===ug)if(me.nested)$.current=!1;else if(hE(me.nativeEvent)||pE(me.nativeEvent))$.current=!1;else{let Oe=!1;document.createElement("div").focus({get preventScroll(){return Oe=!0,!1}}),Oe?$.current=!1:$.current=!0}}A.on("openchange",ye);const we=Y.createElement("span");we.setAttribute("tabindex","-1"),we.setAttribute("aria-hidden","true"),Object.assign(we.style,_E),he&&j&&j.insertAdjacentElement("afterend",we);function Ce(){const me=H.current;let Oe=typeof me=="function"?me(P.current):me;if(Oe===void 0||Oe===!1)return null;if(Oe===null&&(Oe=!0),typeof Oe=="boolean"){const Se=j||vp();return Se&&Se.isConnected?Se:we}const ve=j||vp()||we;return _a(Oe)||ve}return()=>{A.off("openchange",ye);const me=Zr(Y),Oe=Et(E,me)||oe&&Fi(oe.nodesRef.current,O(),!1).some(Se=>Et(Se.context?.elements.floating,me)),ve=Ce();queueMicrotask(()=>{const Se=yM(ve),Ee=typeof H.current!="boolean";H.current&&!$.current&&Pt(Se)&&(!(!Ee&&Se!==me&&me!==Y.body)||Oe)&&Se.focus({preventScroll:!0}),we.remove()})}},[a,E,pe,H,R,A,oe,he,j,O]),b.useEffect(()=>{queueMicrotask(()=>{$.current=!1})},[a]),b.useEffect(()=>{if(a||!C)return;function Y(ye){On(ye)?.closest(`[${Sk}]`)&&(re.current=!0)}const ae=on(pe);return ae.addEventListener("pointerdown",Y,!0),()=>{ae.removeEventListener("pointerdown",Y,!0)}},[a,C,pe]),Le(()=>{if(!a&&ee)return ee.setFocusManagerState({modal:p,closeOnFocusOut:h,open:C,onOpenChange:_.setOpen,domReference:j}),()=>{ee.setFocusManagerState(null)}},[a,ee,p,C,_,h,j]),Le(()=>{if(!(a||!pe))return Mx(pe,Z),()=>{queueMicrotask(vg)}},[a,pe,Z]);const ie=!a&&(p?!F:!0)&&(he||p);return f.jsxs(b.Fragment,{children:[ie&&f.jsx(dd,{"data-type":"inside",ref:Te,onFocus:Y=>{if(p){const ae=Re();Zu(ae[ae.length-1])}else ee?.portalNode&&($.current=!1,Sl(Y,ee.portalNode)?NE(j)?.focus():_a(w??ee.beforeOutsideRef)?.focus())}}),s,ie&&f.jsx(dd,{"data-type":"inside",ref:He,onFocus:Y=>{p?Zu(Re()[0]):ee?.portalNode&&(h&&($.current=!0),Sl(Y,ee.portalNode)?TE(j)?.focus():_a(x??ee.afterOutsideRef)?.focus())}})]})}function Ox(e,t,s){let{reference:a,floating:i}=e;const l=os(t),u=yg(t),d=gg(u),p=Fn(t),h=l==="y",y=a.x+a.width/2-i.width/2,v=a.y+a.height/2-i.height/2,x=a[d]/2-i[d]/2;let w;switch(p){case"top":w={x:y,y:a.y-i.height};break;case"bottom":w={x:y,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:v};break;case"left":w={x:a.x-i.width,y:v};break;default:w={x:a.x,y:a.y}}switch(sa(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 xM(e,t){var s;t===void 0&&(t={});const{x:a,y:i,platform:l,rects:u,elements:d,strategy:p}=e,{boundary:h="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:x=!1,padding:w=0}=fr(t,e),N=mE(w),_=d[x?v==="floating"?"reference":"floating":v],C=id(await l.getClippingRect({element:(s=await(l.isElement==null?void 0:l.isElement(_)))==null||s?_:_.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:h,rootBoundary:y,strategy:p})),j=v==="floating"?{x:a,y:i,width:u.floating.width,height:u.floating.height}:u.reference,E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),A=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},R=id(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:j,offsetParent:E,strategy:p}):j);return{top:(C.top-R.top+N.top)/A.y,bottom:(R.bottom-C.bottom+N.bottom)/A.y,left:(C.left-R.left+N.left)/A.x,right:(R.right-C.right+N.right)/A.x}}const wM=async(e,t,s)=>{const{placement:a="bottom",strategy:i="absolute",middleware:l=[],platform:u}=s,d=l.filter(Boolean),p=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:y,y:v}=Ox(h,a,p),x=a,w={},N=0;for(let _=0;_<d.length;_++){var T;const{name:C,fn:j}=d[_],{x:E,y:A,data:R,reset:O}=await j({x:y,y:v,initialPlacement:a,placement:x,strategy:i,middlewareData:w,rects:h,platform:{...u,detectOverflow:(T=u.detectOverflow)!=null?T:xM},elements:{reference:e,floating:t}});y=E??y,v=A??v,w={...w,[C]:{...w[C],...R}},O&&N<=50&&(N++,typeof O=="object"&&(O.placement&&(x=O.placement),O.rects&&(h=O.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:y,y:v}=Ox(h,x,p)),_=-1)}return{x:y,y:v,placement:x,strategy:i,middlewareData:w}},SM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,a;const{placement:i,middlewareData:l,rects:u,initialPlacement:d,platform:p,elements:h}=t,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:T=!0,..._}=fr(e,t);if((s=l.arrow)!=null&&s.alignmentOffset)return{};const C=Fn(i),j=os(d),E=Fn(d)===d,A=await(p.isRTL==null?void 0:p.isRTL(h.floating)),R=x||(E||!T?[ad(d)]:D2(d)),O=N!=="none";!x&&O&&R.push(...P2(d,T,N,A));const M=[d,...R],z=await p.detectOverflow(t,_),F=[];let Z=((a=l.flip)==null?void 0:a.overflows)||[];if(y&&F.push(z[C]),v){const oe=O2(i,u,A);F.push(z[oe[0]],z[oe[1]])}if(Z=[...Z,{placement:i,overflows:F}],!F.every(oe=>oe<=0)){var U,H;const oe=(((U=l.flip)==null?void 0:U.index)||0)+1,ee=M[oe];if(ee&&(!(v==="alignment"?j!==os(ee):!1)||Z.every($=>os($.placement)===j?$.overflows[0]>0:!0)))return{data:{index:oe,overflows:Z},reset:{placement:ee}};let I=(H=Z.filter(B=>B.overflows[0]<=0).sort((B,$)=>B.overflows[1]-$.overflows[1])[0])==null?void 0:H.placement;if(!I)switch(w){case"bestFit":{var W;const B=(W=Z.filter($=>{if(O){const re=os($.placement);return re===j||re==="y"}return!0}).map($=>[$.placement,$.overflows.filter(re=>re>0).reduce((re,J)=>re+J,0)]).sort(($,re)=>$[1]-re[1])[0])==null?void 0:W[0];B&&(I=B);break}case"initialPlacement":I=d;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function Dx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zx(e){return A2.some(t=>e[t]>=0)}const EM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:a}=t,{strategy:i="referenceHidden",...l}=fr(e,t);switch(i){case"referenceHidden":{const u=await a.detectOverflow(t,{...l,elementContext:"reference"}),d=Dx(u,s.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:zx(d)}}}case"escaped":{const u=await a.detectOverflow(t,{...l,altBoundary:!0}),d=Dx(u,s.floating);return{data:{escapedOffsets:d,escaped:zx(d)}}}default:return{}}}}},DE=new Set(["left","top"]);async function NM(e,t){const{placement:s,platform:a,elements:i}=e,l=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=Fn(s),d=sa(s),p=os(s)==="y",h=DE.has(u)?-1:1,y=l&&p?-1:1,v=fr(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 d&&typeof N=="number"&&(w=d==="end"?N*-1:N),p?{x:w*y,y:x*h}:{x:x*h,y:w*y}}const TM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,a;const{x:i,y:l,placement:u,middlewareData:d}=t,p=await NM(t,e);return u===((s=d.offset)==null?void 0:s.placement)&&(a=d.arrow)!=null&&a.alignmentOffset?{}:{x:i+p.x,y:l+p.y,data:{...p,placement:u}}}}},jM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:a,placement:i,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:p={fn:C=>{let{x:j,y:E}=C;return{x:j,y:E}}},...h}=fr(e,t),y={x:s,y:a},v=await l.detectOverflow(t,h),x=os(Fn(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],A=N-v[j];N=pm(E,N,A)}if(d){const C=x==="y"?"top":"left",j=x==="y"?"bottom":"right",E=T+v[C],A=T-v[j];T=pm(E,T,A)}const _=p.fn({...t,[w]:N,[x]:T});return{..._,data:{x:_.x-s,y:_.y-a,enabled:{[w]:u,[x]:d}}}}}},CM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:a,placement:i,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:p=!0,crossAxis:h=!0}=fr(e,t),y={x:s,y:a},v=os(i),x=mg(v);let w=y[x],N=y[v];const T=fr(d,t),_=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:0,crossAxis:0,...T};if(p){const E=x==="y"?"height":"width",A=l.reference[x]-l.floating[E]+_.mainAxis,R=l.reference[x]+l.reference[E]-_.mainAxis;w<A?w=A:w>R&&(w=R)}if(h){var C,j;const E=x==="y"?"width":"height",A=DE.has(Fn(i)),R=l.reference[v]-l.floating[E]+(A&&((C=u.offset)==null?void 0:C[v])||0)+(A?0:_.crossAxis),O=l.reference[v]+l.reference[E]+(A?0:((j=u.offset)==null?void 0:j[v])||0)-(A?_.crossAxis:0);N<R?N=R:N>O&&(N=O)}return{[x]:w,[v]:N}}}},RM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,a;const{placement:i,rects:l,platform:u,elements:d}=t,{apply:p=()=>{},...h}=fr(e,t),y=await u.detectOverflow(t,h),v=Fn(i),x=sa(i),w=os(i)==="y",{width:N,height:T}=l.floating;let _,C;v==="top"||v==="bottom"?(_=v,C=x===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=v,_=x==="end"?"top":"bottom");const j=T-y.top-y.bottom,E=N-y.left-y.right,A=Wi(T-y[_],j),R=Wi(N-y[C],E),O=!t.middlewareData.shift;let M=A,z=R;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(z=E),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(M=j),O&&!x){const Z=Hn(y.left,0),U=Hn(y.right,0),H=Hn(y.top,0),W=Hn(y.bottom,0);w?z=N-2*(Z!==0||U!==0?Z+U:Hn(y.left,y.right)):M=T-2*(H!==0||W!==0?H+W:Hn(y.top,y.bottom))}await p({...t,availableWidth:z,availableHeight:M});const F=await u.getDimensions(d.floating);return N!==F.width||T!==F.height?{reset:{rects:!0}}:{}}}};function zE(e){const t=Yn(e);let s=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=Pt(e),l=i?e.offsetWidth:s,u=i?e.offsetHeight:a,d=rd(s)!==l||rd(a)!==u;return d&&(s=l,a=u),{width:s,height:a,$:d}}function bg(e){return Nt(e)?e:e.contextElement}function Yi(e){const t=bg(e);if(!Pt(t))return Ps(1);const s=t.getBoundingClientRect(),{width:a,height:i,$:l}=zE(t);let u=(l?rd(s.width):s.width)/a,d=(l?rd(s.height):s.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const AM=Ps(0);function IE(e){const t=cn(e);return!Id()||!t.visualViewport?AM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _M(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==cn(e)?!1:t}function Va(e,t,s,a){t===void 0&&(t=!1),s===void 0&&(s=!1);const i=e.getBoundingClientRect(),l=bg(e);let u=Ps(1);t&&(a?Nt(a)&&(u=Yi(a)):u=Yi(e));const d=_M(l,s,a)?IE(l):Ps(0);let p=(i.left+d.x)/u.x,h=(i.top+d.y)/u.y,y=i.width/u.x,v=i.height/u.y;if(l){const x=cn(l),w=a&&Nt(a)?cn(a):a;let N=x,T=um(N);for(;T&&a&&w!==N;){const _=Yi(T),C=T.getBoundingClientRect(),j=Yn(T),E=C.left+(T.clientLeft+parseFloat(j.paddingLeft))*_.x,A=C.top+(T.clientTop+parseFloat(j.paddingTop))*_.y;p*=_.x,h*=_.y,y*=_.x,v*=_.y,p+=E,h+=A,N=cn(T),T=um(N)}}return id({width:y,height:v,x:p,y:h})}function Ud(e,t){const s=Ld(e).scrollLeft;return t?t.left+s:Va(Zs(e)).left+s}function LE(e,t){const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-Ud(e,s),i=s.top+t.scrollTop;return{x:a,y:i}}function kM(e){let{elements:t,rect:s,offsetParent:a,strategy:i}=e;const l=i==="fixed",u=Zs(a),d=t?zd(t.floating):!1;if(a===u||d&&l)return s;let p={scrollLeft:0,scrollTop:0},h=Ps(1);const y=Ps(0),v=Pt(a);if((v||!v&&!l)&&((na(a)!=="body"||Fa(u))&&(p=Ld(a)),Pt(a))){const w=Va(a);h=Yi(a),y.x=w.x+a.clientLeft,y.y=w.y+a.clientTop}const x=u&&!v&&!l?LE(u,p):Ps(0);return{width:s.width*h.x,height:s.height*h.y,x:s.x*h.x-p.scrollLeft*h.x+y.x+x.x,y:s.y*h.y-p.scrollTop*h.y+y.y+x.y}}function MM(e){return Array.from(e.getClientRects())}function OM(e){const t=Zs(e),s=Ld(e),a=e.ownerDocument.body,i=Hn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Hn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-s.scrollLeft+Ud(e);const d=-s.scrollTop;return Yn(a).direction==="rtl"&&(u+=Hn(t.clientWidth,a.clientWidth)-i),{width:i,height:l,x:u,y:d}}const Ix=25;function DM(e,t){const s=cn(e),a=Zs(e),i=s.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,p=0;if(i){l=i.width,u=i.height;const y=Id();(!y||y&&t==="fixed")&&(d=i.offsetLeft,p=i.offsetTop)}const h=Ud(a);if(h<=0){const y=a.ownerDocument,v=y.body,x=getComputedStyle(v),w=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,N=Math.abs(a.clientWidth-v.clientWidth-w);N<=Ix&&(l-=N)}else h<=Ix&&(l+=h);return{width:l,height:u,x:d,y:p}}const zM=new Set(["absolute","fixed"]);function IM(e,t){const s=Va(e,!0,t==="fixed"),a=s.top+e.clientTop,i=s.left+e.clientLeft,l=Pt(e)?Yi(e):Ps(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,p=i*l.x,h=a*l.y;return{width:u,height:d,x:p,y:h}}function Lx(e,t,s){let a;if(t==="viewport")a=DM(e,s);else if(t==="document")a=OM(Zs(e));else if(Nt(t))a=IM(t,s);else{const i=IE(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return id(a)}function PE(e,t){const s=Vs(e);return s===t||!Nt(s)||Ls(s)?!1:Yn(s).position==="fixed"||PE(s,t)}function LM(e,t){const s=t.get(e);if(s)return s;let a=qr(e,[],!1).filter(d=>Nt(d)&&na(d)!=="body"),i=null;const l=Yn(e).position==="fixed";let u=l?Vs(e):e;for(;Nt(u)&&!Ls(u);){const d=Yn(u),p=fg(u);!p&&d.position==="fixed"&&(i=null),(l?!p&&!i:!p&&d.position==="static"&&!!i&&zM.has(i.position)||Fa(u)&&!p&&PE(e,u))?a=a.filter(y=>y!==u):i=d,u=Vs(u)}return t.set(e,a),a}function PM(e){let{element:t,boundary:s,rootBoundary:a,strategy:i}=e;const u=[...s==="clippingAncestors"?zd(t)?[]:LM(t,this._c):[].concat(s),a],d=u[0],p=u.reduce((h,y)=>{const v=Lx(t,y,i);return h.top=Hn(v.top,h.top),h.right=Wi(v.right,h.right),h.bottom=Wi(v.bottom,h.bottom),h.left=Hn(v.left,h.left),h},Lx(t,d,i));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function UM(e){const{width:t,height:s}=zE(e);return{width:t,height:s}}function VM(e,t,s){const a=Pt(t),i=Zs(t),l=s==="fixed",u=Va(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const p=Ps(0);function h(){p.x=Ud(i)}if(a||!a&&!l)if((na(t)!=="body"||Fa(i))&&(d=Ld(t)),a){const w=Va(t,!0,l,t);p.x=w.x+t.clientLeft,p.y=w.y+t.clientTop}else i&&h();l&&!a&&i&&h();const y=i&&!a&&!l?LE(i,d):Ps(0),v=u.left+d.scrollLeft-p.x-y.x,x=u.top+d.scrollTop-p.y-y.y;return{x:v,y:x,width:u.width,height:u.height}}function bp(e){return Yn(e).position==="static"}function Px(e,t){if(!Pt(e)||Yn(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=cn(e);if(zd(e))return s;if(!Pt(e)){let i=Vs(e);for(;i&&!Ls(i);){if(Nt(i)&&!bp(i))return i;i=Vs(i)}return s}let a=Px(e,t);for(;a&&Hk(a)&&bp(a);)a=Px(a,t);return a&&Ls(a)&&bp(a)&&!fg(a)?s:a||Xk(e)||s}const $M=async function(e){const t=this.getOffsetParent||UE,s=this.getDimensions,a=await s(e.floating);return{reference:VM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function BM(e){return Yn(e).direction==="rtl"}const ZM={convertOffsetParentRelativeRectToViewportRelativeRect:kM,getDocumentElement:Zs,getClippingRect:PM,getOffsetParent:UE,getElementRects:$M,getClientRects:MM,getDimensions:UM,getScale:Yi,isElement:Nt,isRTL:BM};function VE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function HM(e,t){let s=null,a;const i=Zs(e);function l(){var d;clearTimeout(a),(d=s)==null||d.disconnect(),s=null}function u(d,p){d===void 0&&(d=!1),p===void 0&&(p=1),l();const h=e.getBoundingClientRect(),{left:y,top:v,width:x,height:w}=h;if(d||t(),!x||!w)return;const N=Li(v),T=Li(i.clientWidth-(y+x)),_=Li(i.clientHeight-(v+w)),C=Li(y),E={rootMargin:-N+"px "+-T+"px "+-_+"px "+-C+"px",threshold:Hn(0,Wi(1,p))||1};let A=!0;function R(O){const M=O[0].intersectionRatio;if(M!==p){if(!A)return u();M?u(!1,M):a=setTimeout(()=>{u(!1,1e-7)},1e3)}M===1&&!VE(h,e.getBoundingClientRect())&&u(),A=!1}try{s=new IntersectionObserver(R,{...E,root:i.ownerDocument})}catch{s=new IntersectionObserver(R,E)}s.observe(e)}return u(!0),l}function Ux(e,t,s,a){a===void 0&&(a={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=a,h=bg(e),y=i||l?[...h?qr(h):[],...qr(t)]:[];y.forEach(C=>{i&&C.addEventListener("scroll",s,{passive:!0}),l&&C.addEventListener("resize",s)});const v=h&&d?HM(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&&!p&&w.observe(h),w.observe(t));let N,T=p?Va(e):null;p&&_();function _(){const C=Va(e);T&&!VE(T,C)&&s(),T=C,N=requestAnimationFrame(_)}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,p&&cancelAnimationFrame(N)}}const FM=TM,qM=jM,YM=SM,GM=RM,XM=EM,KM=CM,WM=(e,t,s)=>{const a=new Map,i={platform:ZM,...s},l={...i.platform,_c:a};return wM(e,t,{...i,platform:l})};var JM=typeof document<"u",QM=function(){},Hu=JM?b.useLayoutEffect:QM;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,a,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(a=s;a--!==0;)if(!fd(e[a],t[a]))return!1;return!0}if(i=Object.keys(e),s=i.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!{}.hasOwnProperty.call(t,i[a]))return!1;for(a=s;a--!==0;){const l=i[a];if(!(l==="_owner"&&e.$$typeof)&&!fd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function $E(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vx(e,t){const s=$E(e);return Math.round(t*s)/s}function xp(e){const t=b.useRef(e);return Hu(()=>{t.current=e}),t}function eO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:a=[],platform:i,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:p,open:h}=e,[y,v]=b.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=b.useState(a);fd(x,a)||w(a);const[N,T]=b.useState(null),[_,C]=b.useState(null),j=b.useCallback($=>{$!==O.current&&(O.current=$,T($))},[]),E=b.useCallback($=>{$!==M.current&&(M.current=$,C($))},[]),A=l||N,R=u||_,O=b.useRef(null),M=b.useRef(null),z=b.useRef(y),F=p!=null,Z=xp(p),U=xp(i),H=xp(h),W=b.useCallback(()=>{if(!O.current||!M.current)return;const $={placement:t,strategy:s,middleware:x};U.current&&($.platform=U.current),WM(O.current,M.current,$).then(re=>{const J={...re,isPositioned:H.current!==!1};oe.current&&!fd(z.current,J)&&(z.current=J,Pa.flushSync(()=>{v(J)}))})},[x,t,s,U,H]);Hu(()=>{h===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,v($=>({...$,isPositioned:!1})))},[h]);const oe=b.useRef(!1);Hu(()=>(oe.current=!0,()=>{oe.current=!1}),[]),Hu(()=>{if(A&&(O.current=A),R&&(M.current=R),A&&R){if(Z.current)return Z.current(A,R,W);W()}},[A,R,W,Z,F]);const ee=b.useMemo(()=>({reference:O,floating:M,setReference:j,setFloating:E}),[j,E]),I=b.useMemo(()=>({reference:A,floating:R}),[A,R]),B=b.useMemo(()=>{const $={position:s,left:0,top:0};if(!I.floating)return $;const re=Vx(I.floating,y.x),J=Vx(I.floating,y.y);return d?{...$,transform:"translate("+re+"px, "+J+"px)",...$E(I.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:re,top:J}},[s,d,I.floating,y.x,y.y]);return b.useMemo(()=>({...y,update:W,refs:ee,elements:I,floatingStyles:B}),[y,W,ee,I,B])}const tO=(e,t)=>({...FM(e),options:[e,t]}),nO=(e,t)=>({...qM(e),options:[e,t]}),sO=(e,t)=>({...KM(e),options:[e,t]}),rO=(e,t)=>({...YM(e),options:[e,t]}),aO=(e,t)=>({...GM(e),options:[e,t]}),iO=(e,t)=>({...XM(e),options:[e,t]}),oO={intentional:"onClick",sloppy:"onPointerDown"};function lO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function cO(e,t={}){const s="rootStore"in e?e.rootStore:e,a=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("referenceElement"),u=s.useState("domReferenceElement"),{onOpenChange:d,dataRef:p}=s.context,{enabled:h=!0,escapeKey:y=!0,outsidePress:v=!0,outsidePressEvent:x="sloppy",referencePress:w=!1,referencePressEvent:N="sloppy",ancestorScroll:T=!1,bubbles:_,externalTree:C}=t,j=io(C),E=Ue(typeof v=="function"?v:()=>!1),A=typeof v=="function"?E:v,R=b.useRef(!1),{escapeKey:O,outsidePress:M}=lO(_),z=b.useRef(null),F=Es(),Z=Es(),U=Ue(()=>{Z.clear(),p.current.insideReactTree=!1}),H=b.useRef(!1),W=b.useRef(""),oe=Ue(fe=>{W.current=fe.pointerType}),ee=Ue(()=>{const fe=W.current,ke=fe==="pen"||!fe?"mouse":fe,Te=typeof x=="function"?x():x;return typeof Te=="string"?Te:Te[ke]}),I=Ue(fe=>{if(!a||!h||!y||fe.key!=="Escape"||H.current)return;const ke=p.current.floatingContext?.nodeId,Te=j?Fi(j.nodesRef.current,ke):[];if(!O&&Te.length>0){let Y=!0;if(Te.forEach(ae=>{ae.context?.open&&!ae.context.dataRef.current.__escapeKeyBubbles&&(Y=!1)}),!Y)return}const He=j2(fe)?fe.nativeEvent:fe,ie=Ht(tE,He);s.setOpen(!1,ie),!O&&!ie.isPropagationAllowed&&fe.stopPropagation()}),B=Ue(fe=>{const ke=ee();return ke==="intentional"&&fe.type!=="click"||ke==="sloppy"&&fe.type==="click"}),$=Ue(()=>{p.current.insideReactTree=!0,Z.start(0,U)}),re=Ue((fe,ke=!1)=>{if(B(fe)){U();return}if(p.current.insideReactTree){U();return}if(ee()==="intentional"&&ke||typeof A=="function"&&!A(fe))return;const Te=On(fe),He=`[${_l("inert")}]`,ie=on(s.select("floatingElement")).querySelectorAll(He),Y=s.context.triggerElements;if(Te&&(Y.hasElement(Te)||Y.hasMatchingElement(me=>Et(me,Te))))return;let ae=Nt(Te)?Te:null;for(;ae&&!Ls(ae);){const me=Vs(ae);if(Ls(me)||!Nt(me))break;ae=me}if(ie.length&&Nt(Te)&&!N2(Te)&&!Et(Te,s.select("floatingElement"))&&Array.from(ie).every(me=>!Et(ae,me)))return;if(Pt(Te)&&!("touches"in fe)){const me=Ls(Te),Oe=Yn(Te),ve=/auto|scroll/,Se=me||ve.test(Oe.overflowX),Ee=me||ve.test(Oe.overflowY),We=Se&&Te.clientWidth>0&&Te.scrollWidth>Te.clientWidth,it=Ee&&Te.clientHeight>0&&Te.scrollHeight>Te.clientHeight,Fe=Oe.direction==="rtl",Ft=it&&(Fe?fe.offsetX<=Te.offsetWidth-Te.clientWidth:fe.offsetX>Te.clientWidth),Xt=We&&fe.offsetY>Te.clientHeight;if(Ft||Xt)return}const ye=p.current.floatingContext?.nodeId,we=j&&Fi(j.nodesRef.current,ye).some(me=>ms(fe,me.context?.elements.floating));if(ms(fe,s.select("floatingElement"))||ms(fe,s.select("domReferenceElement"))||we)return;const Ce=j?Fi(j.nodesRef.current,ye):[];if(Ce.length>0){let me=!0;if(Ce.forEach(Oe=>{Oe.context?.open&&!Oe.context.dataRef.current.__outsidePressBubbles&&(me=!1)}),!me)return}s.setOpen(!1,Ht(ug,fe)),U()}),J=Ue(fe=>{ee()!=="sloppy"||fe.pointerType==="touch"||!s.select("open")||!h||ms(fe,s.select("floatingElement"))||ms(fe,s.select("domReferenceElement"))||re(fe)}),D=Ue(fe=>{if(ee()!=="sloppy"||!s.select("open")||!h||ms(fe,s.select("floatingElement"))||ms(fe,s.select("domReferenceElement")))return;const ke=fe.touches[0];ke&&(z.current={startTime:Date.now(),startX:ke.clientX,startY:ke.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{z.current&&(z.current.dismissOnTouchEnd=!1,z.current.dismissOnMouseDown=!1)}))}),P=Ue(fe=>{const ke=On(fe);function Te(){D(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)}),K=Ue(fe=>{const ke=R.current;if(R.current=!1,F.clear(),fe.type==="mousedown"&&z.current&&!z.current.dismissOnMouseDown)return;const Te=On(fe);function He(){fe.type==="pointerdown"?J(fe):re(fe,ke),Te?.removeEventListener(fe.type,He)}Te?.addEventListener(fe.type,He)}),se=Ue(fe=>{if(ee()!=="sloppy"||!z.current||ms(fe,s.select("floatingElement"))||ms(fe,s.select("domReferenceElement")))return;const ke=fe.touches[0];if(!ke)return;const Te=Math.abs(ke.clientX-z.current.startX),He=Math.abs(ke.clientY-z.current.startY),ie=Math.sqrt(Te*Te+He*He);ie>5&&(z.current.dismissOnTouchEnd=!0),ie>10&&(re(fe),F.clear(),z.current=null)}),te=Ue(fe=>{const ke=On(fe);function Te(){se(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)}),ge=Ue(fe=>{ee()!=="sloppy"||!z.current||ms(fe,s.select("floatingElement"))||ms(fe,s.select("domReferenceElement"))||(z.current.dismissOnTouchEnd&&re(fe),F.clear(),z.current=null)}),he=Ue(fe=>{const ke=On(fe);function Te(){ge(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)});b.useEffect(()=>{if(!a||!h)return;p.current.__escapeKeyBubbles=O,p.current.__outsidePressBubbles=M;const fe=new Ki;function ke(ae){s.setOpen(!1,Ht(Ik,ae))}function Te(){fe.clear(),H.current=!0}function He(){fe.start(Id()?5:0,()=>{H.current=!1})}const ie=on(i);ie.addEventListener("pointerdown",oe,!0),y&&(ie.addEventListener("keydown",I),ie.addEventListener("compositionstart",Te),ie.addEventListener("compositionend",He)),A&&(ie.addEventListener("click",K,!0),ie.addEventListener("pointerdown",K,!0),ie.addEventListener("touchstart",P,!0),ie.addEventListener("touchmove",te,!0),ie.addEventListener("touchend",he,!0),ie.addEventListener("mousedown",K,!0));let Y=[];return T&&(Nt(u)&&(Y=qr(u)),Nt(i)&&(Y=Y.concat(qr(i))),!Nt(l)&&l&&l.contextElement&&(Y=Y.concat(qr(l.contextElement)))),Y=Y.filter(ae=>ae!==ie.defaultView?.visualViewport),Y.forEach(ae=>{ae.addEventListener("scroll",ke,{passive:!0})}),()=>{ie.removeEventListener("pointerdown",oe,!0),y&&(ie.removeEventListener("keydown",I),ie.removeEventListener("compositionstart",Te),ie.removeEventListener("compositionend",He)),A&&(ie.removeEventListener("click",K,!0),ie.removeEventListener("pointerdown",K,!0),ie.removeEventListener("touchstart",P,!0),ie.removeEventListener("touchmove",te,!0),ie.removeEventListener("touchend",he,!0),ie.removeEventListener("mousedown",K,!0)),Y.forEach(ae=>{ae.removeEventListener("scroll",ke)}),fe.clear()}},[p,i,l,u,y,A,a,d,T,h,O,M,I,re,K,J,P,te,he,oe,s]),b.useEffect(U,[A,U]);const pe=b.useMemo(()=>({onKeyDown:I,...w&&{[oO[N]]:fe=>{s.setOpen(!1,Ht(nd,fe.nativeEvent))},...N!=="intentional"&&{onClick(fe){s.setOpen(!1,Ht(nd,fe.nativeEvent))}}}}),[I,s,w,N]),xe=Ue(fe=>{const ke=On(fe.nativeEvent);!Et(s.select("floatingElement"),ke)||fe.button!==0||(R.current=!0)}),Re=b.useMemo(()=>({onKeyDown:I,onPointerDown:xe,onMouseDown:xe,onMouseUp:xe,onClickCapture:$,onMouseDownCapture:$,onPointerDownCapture:$,onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[I,xe,$]);return b.useMemo(()=>h?{reference:pe,floating:Re,trigger:pe}:{},[h,pe,Re])}var hd=Symbol("NOT_FOUND");function uO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function dO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function fO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(s=>typeof s=="function")){const s=e.map(a=>typeof a=="function"?`function ${a.name||"unnamed"}()`:typeof a).join(", ");throw new TypeError(`${t}[${s}]`)}}var $x=e=>Array.isArray(e)?e:[e];function hO(e){const t=Array.isArray(e[0])?e[0]:e;return fO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function pO(e,t){const s=[],{length:a}=e;for(let i=0;i<a;i++)s.push(e[i].apply(null,t));return s}function mO(e){let t;return{get(s){return t&&e(t.key,s)?t.value:hd},put(s,a){t={key:s,value:a}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function gO(e,t){let s=[];function a(d){const p=s.findIndex(h=>t(d,h.key));if(p>-1){const h=s[p];return p>0&&(s.splice(p,1),s.unshift(h)),h.value}return hd}function i(d,p){a(d)===hd&&(s.unshift({key:d,value:p}),s.length>e&&s.pop())}function l(){return s}function u(){s=[]}return{get:a,put:i,getEntries:l,clear:u}}var yO=(e,t)=>e===t;function vO(e){return function(s,a){if(s===null||a===null||s.length!==a.length)return!1;const{length:i}=s;for(let l=0;l<i;l++)if(!e(s[l],a[l]))return!1;return!0}}function bO(e,t){const s=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:a=yO,maxSize:i=1,resultEqualityCheck:l}=s,u=vO(a);let d=0;const p=i<=1?mO(u):gO(i,u);function h(){let y=p.get(arguments);if(y===hd){if(y=e.apply(null,arguments),d++,l){const x=p.getEntries().find(w=>l(w.value,y));x&&(y=x.value,d!==0&&d--)}p.put(arguments,y)}return y}return h.clearCache=()=>{p.clear(),h.resetResultsCount()},h.resultsCount=()=>d,h.resetResultsCount=()=>{d=0},h}var xO=class{constructor(e){this.value=e}deref(){return this.value}},wO=typeof WeakRef<"u"?WeakRef:xO,SO=0,Bx=1;function wu(){return{s:SO,v:void 0,o:null,p:null}}function BE(e,t={}){let s=wu();const{resultEqualityCheck:a}=t;let i,l=0;function u(){let d=s;const{length:p}=arguments;for(let v=0,x=p;v<x;v++){const w=arguments[v];if(typeof w=="function"||typeof w=="object"&&w!==null){let N=d.o;N===null&&(d.o=N=new WeakMap);const T=N.get(w);T===void 0?(d=wu(),N.set(w,d)):d=T}else{let N=d.p;N===null&&(d.p=N=new Map);const T=N.get(w);T===void 0?(d=wu(),N.set(w,d)):d=T}}const h=d;let y;if(d.s===Bx)y=d.v;else if(y=e.apply(null,arguments),l++,a){const v=i?.deref?.()??i;v!=null&&a(v,y)&&(y=v,l!==0&&l--),i=typeof y=="object"&&y!==null||typeof y=="function"?new wO(y):y}return h.s=Bx,h.v=y,y}return u.clearCache=()=>{s=wu(),u.resetResultsCount()},u.resultsCount=()=>l,u.resetResultsCount=()=>{l=0},u}function ZE(e,...t){const s=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,a=(...i)=>{let l=0,u=0,d,p={},h=i.pop();typeof h=="object"&&(p=h,h=i.pop()),uO(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const y={...s,...p},{memoize:v,memoizeOptions:x=[],argsMemoize:w=BE,argsMemoizeOptions:N=[]}=y,T=$x(x),_=$x(N),C=hO(i),j=v(function(){return l++,h.apply(null,arguments)},...T),E=w(function(){u++;const R=pO(C,arguments);return d=j.apply(null,R),d},..._);return Object.assign(E,{resultFunc:h,memoizedResultFunc:j,dependencies:C,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>d,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:v,argsMemoize:w})};return Object.assign(a,{withTypes:()=>a}),a}var EO=ZE(BE),NO=Object.assign((e,t=EO)=>{dO(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),a=s.map(l=>e[l]);return t(a,(...l)=>l.reduce((u,d,p)=>(u[s[p]]=d,u),{}))},{withTypes:()=>NO});ZE({memoize:bO,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Ze=(e,t,s,a,i,l,...u)=>{if(u.length>0)throw new Error(Ha(1));let d;if(e)d=e;else throw new Error("Missing arguments");return d};var wp={exports:{}},Sp={};var Zx;function TO(){if(Zx)return Sp;Zx=1;var e=Bl();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,a=e.useState,i=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(v,x){var w=x(),N=a({inst:{value:w,getSnapshot:x}}),T=N[0].inst,_=N[1];return l(function(){T.value=w,T.getSnapshot=x,p(T)&&_({inst:T})},[v,w,x]),i(function(){return p(T)&&_({inst:T}),v(function(){p(T)&&_({inst:T})})},[v]),u(w),w}function p(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:d;return Sp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Sp}var Hx;function HE(){return Hx||(Hx=1,wp.exports=TO()),wp.exports}var jO=HE(),Ep={exports:{}},Np={};var Fx;function CO(){if(Fx)return Np;Fx=1;var e=Bl(),t=HE();function s(h,y){return h===y&&(h!==0||1/h===1/y)||h!==h&&y!==y}var a=typeof Object.is=="function"?Object.is:s,i=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,d=e.useMemo,p=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=d(function(){function C(O){if(!j){if(j=!0,E=O,O=x(O),w!==void 0&&T.hasValue){var M=T.value;if(w(M,O))return A=M}return A=O}if(M=A,a(E,O))return M;var z=x(O);return w!==void 0&&w(M,z)?(E=O,M):(E=O,A=z)}var j=!1,E,A,R=v===void 0?null:v;return[function(){return C(y())},R===null?void 0:function(){return C(R())}]},[y,v,x,w]);var _=i(h,N[0],N[1]);return u(function(){T.hasValue=!0,T.value=_},[_]),p(_),_},Np}var qx;function RO(){return qx||(qx=1,Ep.exports=CO()),Ep.exports}var AO=RO();const _O=lg(19),kO=_O?OO:DO;function MO(e,t,s,a,i){return kO(e,t,s,a,i)}function OO(e,t,s,a,i){const l=b.useCallback(()=>t(e.getSnapshot(),s,a,i),[e,t,s,a,i]);return jO.useSyncExternalStore(e.subscribe,l,l)}function DO(e,t,s,a,i){return AO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,s,a,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 a of this.listeners){if(s!==this.updateTick)return;a(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 FE extends El{constructor(t,s={},a){super(t),this.context=s,this.selectors=a}controlledValues=new Map;useSyncedValue(t,s){b.useDebugValue(t),Le(()=>{this.state[t]!==s&&this.set(t,s)},[t,s])}useSyncedValueWithCleanup(t,s){Le(()=>(this.state[t]!==s&&this.set(t,s),()=>{this.set(t,void 0)}),[t,s])}useSyncedValues(t){const s=Object.values(t);Le(()=>{this.update(t)},s)}useControlledProp(t,s,a){b.useDebugValue(t);const i=s!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,i),!i&&!Object.is(this.state[t],a)&&super.setState({...this.state,[t]:a})),Le(()=>{i&&!Object.is(this.state[t],s)&&super.setState({...this.state,[t]:s})},[t,s,a,i])}set(t,s){this.controlledValues.get(t)!==!0&&super.set(t,s)}update(t){const s={...t};for(const a in s)if(Object.hasOwn(s,a)&&this.controlledValues.get(a)===!0){delete s[a];continue}super.update(s)}setState(t){const s={...t};for(const a in s)if(Object.hasOwn(s,a)&&this.controlledValues.get(a)===!0){delete s[a];continue}super.setState({...this.state,...s})}select=(t,s,a,i)=>{const l=this.selectors[t];return l(this.state,s,a,i)};useState=(t,s,a,i)=>{b.useDebugValue(t);const l=this.selectors[t];return MO(this,l,s,a,i)};useContextCallback(t,s){b.useDebugValue(t);const a=Ue(s??WS);this.context[t]=a}useStateSetter(t){const s=b.useRef(void 0);return s.current===void 0&&(s.current=a=>{this.set(t,a)}),s.current}observe(t,s){let a;typeof t=="function"?a=t:a=this.selectors[t];let i=a(this.state);return s(i,i,this),this.subscribe(l=>{const u=a(l);if(!Object.is(i,u)){const d=i;i=u,s(u,d,this)}})}}const zO={open:Ze(e=>e.open),domReferenceElement:Ze(e=>e.domReferenceElement),referenceElement:Ze(e=>e.positionReference??e.referenceElement),floatingElement:Ze(e=>e.floatingElement),floatingId:Ze(e=>e.floatingId)};class xg extends FE{constructor(t){const{nested:s,noEmit:a,onOpenChange:i,triggerElements:l,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:jE(),nested:s,noEmit:a,triggerElements:l},zO)}setOpen=(t,s)=>{if((!t||!this.state.open||R2(s.event))&&(this.context.dataRef.current.openEvent=t?s.event:void 0),!this.context.noEmit){const a={open:t,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",a)}this.context.onOpenChange?.(t,s)}}function IO(e){const t=e.useState("open");Le(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const s=e.context.triggerElements.entries().next();if(!s.done){const[a,i]=s.value;e.update({activeTriggerId:a,activeTriggerElement:i})}}},[t,e])}function LO(e,t,s){const{mounted:a,setMounted:i,transitionStatus:l}=u2(e);t.useSyncedValues({mounted:a,transitionStatus:l});const u=Ue(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),s?.(),t.context.onOpenChangeComplete?.(!1)}),d=t.useState("preventUnmountingOnClose");return iE({enabled:!d,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 a=this.idMap.get(t);a!==s&&(a!==void 0&&this.elements.delete(a),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 PO(){return new xg({open:!1,floatingElement:null,referenceElement:null,triggerElements:new wg,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function UO(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:PO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Dn,inactiveTriggerProps:Dn,popupProps:Dn}}const VO={open:Ze(e=>e.open),mounted:Ze(e=>e.mounted),transitionStatus:Ze(e=>e.transitionStatus),floatingRootContext:Ze(e=>e.floatingRootContext),preventUnmountingOnClose:Ze(e=>e.preventUnmountingOnClose),payload:Ze(e=>e.payload),activeTriggerId:Ze(e=>e.activeTriggerId),activeTriggerElement:Ze(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Ze((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Ze(e=>e.popupProps),popupElement:Ze(e=>e.popupElement),positionerElement:Ze(e=>e.positionerElement)};function $O(e){const{open:t=!1,onOpenChange:s,elements:a={}}=e,i=ea(),l=ra()!=null,u=us(()=>new xg({open:t,onOpenChange:s,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:a.triggers??new wg,floatingId:i,nested:l,noEmit:e.noEmit||!1})).current;return Le(()=>{const d={open:t,floatingId:i};a.reference!==void 0&&(d.referenceElement=a.reference,d.domReferenceElement=Nt(a.reference)?a.reference:null),a.floating!==void 0&&(d.floatingElement=a.floating),u.update(d)},[t,i,a.reference,a.floating,u]),u.context.onOpenChange=s,u.context.nested=l,u.context.noEmit=e.noEmit||!1,u}function BO(e={}){const{nodeId:t,externalTree:s}=e,a=$O(e),i=e.rootContext||a,l={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[u,d]=b.useState(null),p=b.useRef(null),h=io(s);Le(()=>{l.domReference&&(p.current=l.domReference)},[l.domReference]);const y=eO({...e,elements:{...l,...u&&{reference:u}}}),v=b.useCallback(M=>{const z=Nt(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;d(z),y.refs.setReference(z)},[y.refs]),[x,w]=b.useState(null),[N,T]=b.useState(null);i.useSyncedValue("referenceElement",x),i.useSyncedValue("domReferenceElement",Nt(x)?x:null),i.useSyncedValue("floatingElement",N);const _=b.useCallback(M=>{(Nt(M)||M===null)&&(p.current=M,w(M)),(Nt(y.refs.reference.current)||y.refs.reference.current===null||M!==null&&!Nt(M))&&y.refs.setReference(M)},[y.refs,w]),C=b.useCallback(M=>{T(M),y.refs.setFloating(M)},[y.refs]),j=b.useMemo(()=>({...y.refs,setReference:_,setFloating:C,setPositionReference:v,domReference:p}),[y.refs,_,C,v]),E=b.useMemo(()=>({...y.elements,domReference:l.domReference}),[y.elements,l.domReference]),A=i.useState("open"),R=i.useState("floatingId"),O=b.useMemo(()=>({...y,dataRef:i.context.dataRef,open:A,onOpenChange:i.setOpen,events:i.context.events,floatingId:R,refs:j,elements:E,nodeId:t,rootStore:i}),[y,j,E,t,i,A,R]);return Le(()=>{i.context.dataRef.current.floatingContext=O;const M=h?.nodesRef.current.find(z=>z.id===t);M&&(M.context=O)}),b.useMemo(()=>({...y,context:O,refs:j,elements:E,rootStore:i}),[y,j,E,O,i])}function ZO(e){const{popupStore:t,noEmit:s=!1,treatPopupAsFloatingElement:a=!1,onOpenChange:i}=e,l=ea(),u=ra()!=null,d=t.useState("open"),p=t.useState("activeTriggerElement"),h=t.useState(a?"popupElement":"positionerElement"),y=t.context.triggerElements,v=us(()=>new xg({open:d,referenceElement:p,floatingElement:h,triggerElements:y,onOpenChange:i,floatingId:l,nested:u,noEmit:s})).current;return Le(()=>{const x={open:d,floatingId:l,referenceElement:p,floatingElement:h};Nt(p)&&(x.domReferenceElement=p),v.update(x)},[d,l,p,h,v]),v.context.onOpenChange=i,v.context.nested=u,v.context.noEmit=s,v}const Yx=_l("safe-polygon"),HO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${fE}`;function FO(e){return e?!!e.closest(HO):!1}function qO(e){const t=b.useRef(void 0),s=b.useRef(!1),a=b.useRef(void 0),i=b.useRef(!0),l=b.useRef(!1),u=b.useRef(()=>{}),d=b.useRef(!1),p=Es(),h=Es(),y=b.useRef(void 0);return b.useMemo(()=>{const v=e.context.dataRef.current;return v.hoverInteractionState||(v.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:s,handlerRef:a,blockMouseMoveRef:i,performedPointerEventsMutationRef:l,unbindMouseMoveRef:u,restTimeoutPendingRef:d,openChangeTimeout:p,restTimeout:h,handleCloseOptionsRef:y}),v.hoverInteractionState},[e,t,s,a,i,l,u,d,p,h,y])}const YO=new Set(["click","mousedown"]);function GO(e,t={}){const s="rootStore"in e?e.rootStore:e,a=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),{dataRef:u}=s.context,{enabled:d=!0,closeDelay:p=0,externalTree:h}=t,{pointerTypeRef:y,interactedInsideRef:v,handlerRef:x,performedPointerEventsMutationRef:w,unbindMouseMoveRef:N,restTimeoutPendingRef:T,openChangeTimeout:_,handleCloseOptionsRef:C}=qO(s),j=io(h),E=ra(),A=Ue(()=>v.current?!0:u.current.openEvent?YO.has(u.current.openEvent.type):!1),R=Ue(()=>{const Z=u.current.openEvent?.type;return Z?.includes("mouse")&&Z!=="mousedown"}),O=b.useCallback((Z,U=!0)=>{const H=XO(p,y.current);H&&!x.current?_.start(H,()=>s.setOpen(!1,Ht(Ia,Z))):U&&(_.clear(),s.setOpen(!1,Ht(Ia,Z)))},[p,x,s,y,_]),M=Ue(()=>{N.current(),x.current=void 0}),z=Ue(()=>{if(w.current){const Z=on(i).body;Z.style.pointerEvents="",Z.removeAttribute(Yx),w.current=!1}}),F=Ue(Z=>{const U=On(Z);if(!FO(U)){v.current=!1;return}v.current=!0});Le(()=>{a||(y.current=void 0,T.current=!1,v.current=!1,M(),z())},[a,y,T,v,M,z]),b.useEffect(()=>()=>{M()},[M]),b.useEffect(()=>z,[z]),Le(()=>{if(d&&a&&C.current?.blockPointerEvents&&R()&&Nt(l)&&i){w.current=!0;const Z=on(i).body;Z.setAttribute(Yx,"");const U=l,H=i,W=j?.nodesRef.current.find(oe=>oe.id===E)?.context?.elements.floating;return W&&(W.style.pointerEvents=""),Z.style.pointerEvents="none",U.style.pointerEvents="auto",H.style.pointerEvents="auto",()=>{Z.style.pointerEvents="",U.style.pointerEvents="",H.style.pointerEvents=""}}},[d,a,l,i,C,R,j,E,w]),b.useEffect(()=>{if(!d)return;function Z(oe){if(A()||!u.current.floatingContext)return;const ee=s.context.triggerElements;oe.relatedTarget&&ee.hasElement(oe.relatedTarget)||(z(),M(),A()||O(oe))}function U(oe){_.clear(),z(),x.current?.(oe),M()}function H(oe){A()||O(oe,!1)}const W=i;return W&&(W.addEventListener("mouseleave",Z),W.addEventListener("mouseenter",U),W.addEventListener("mouseleave",H),W.addEventListener("pointerdown",F,!0)),()=>{W&&(W.removeEventListener("mouseleave",Z),W.removeEventListener("mouseenter",U),W.removeEventListener("mouseleave",H),W.removeEventListener("pointerdown",F,!0))}})}function XO(e,t){return t&&!C2(t)?0:typeof e=="function"?e():e}function KO(e=[]){const t=e.map(h=>h?.reference),s=e.map(h=>h?.floating),a=e.map(h=>h?.item),i=e.map(h=>h?.trigger),l=b.useCallback(h=>Su(h,e,"reference"),t),u=b.useCallback(h=>Su(h,e,"floating"),s),d=b.useCallback(h=>Su(h,e,"item"),a),p=b.useCallback(h=>Su(h,e,"trigger"),i);return b.useMemo(()=>({getReferenceProps:l,getFloatingProps:u,getItemProps:d,getTriggerProps:p}),[l,u,d,p])}function Su(e,t,s){const a=new Map,i=s==="item",l={};s==="floating"&&(l.tabIndex=-1,l[fm]="");for(const u in e)i&&e&&(u===uE||u===dE)||(l[u]=e[u]);for(let u=0;u<t.length;u+=1){let d;const p=t[u]?.[s];typeof p=="function"?d=e?p(e):null:d=p,d&&Gx(l,d,i,a)}return Gx(l,e,i,a),l}function Gx(e,t,s,a){for(const i in t){const l=t[i];s&&(i===uE||i===dE)||(i.startsWith("on")?(a.has(i)||a.set(i,[]),typeof l=="function"&&(a.get(i)?.push(l),e[i]=(...u)=>a.get(i)?.map(d=>d(...u)).find(d=>d!==void 0))):e[i]=l)}}const WO="Escape";function Vd(e,t,s){switch(e){case"vertical":return t;case"horizontal":return s;default:return t||s}}function Eu(e,t){return Vd(t,e===pg||e===Zl,e===Yr||e===Gr)}function Tp(e,t,s){return Vd(t,e===Zl,s?e===Yr:e===Gr)||e==="Enter"||e===" "||e===""}function JO(e,t,s){return Vd(t,s?e===Yr:e===Gr,e===Zl)}function QO(e,t,s,a){const i=s?e===Gr:e===Yr,l=e===pg;return t==="both"||t==="horizontal"&&a&&a>1?e===WO:Vd(t,i,l)}function eD(e,t){const s="rootStore"in e?e.rootStore:e,a=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),u=s.context.dataRef,{listRef:d,activeIndex:p,onNavigate:h=()=>{},enabled:y=!0,selectedIndex:v=null,allowEscape:x=!1,loopFocus:w=!1,nested:N=!1,rtl:T=!1,virtual:_=!1,focusItemOnOpen:C="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:E=!0,disabledIndices:A=void 0,orientation:R="vertical",parentOrientation:O,cols:M=1,scrollItemIntoView:z=!0,itemSizes:F,dense:Z=!1,id:U,resetOnPointerLeave:H=!0,externalTree:W}=t,oe=sd(i),ee=Mn(oe),I=ra(),B=io(W);Le(()=>{u.current.orientation=R},[u,R]);const $=hm(l),re=b.useRef(C),J=b.useRef(v??-1),D=b.useRef(null),P=b.useRef(!0),K=Ue(ve=>{h(J.current===-1?null:J.current,ve)}),se=b.useRef(K),te=b.useRef(!!i),ge=b.useRef(a),he=b.useRef(!1),pe=b.useRef(!1),xe=Mn(A),Re=Mn(a),fe=Mn(z),ke=Mn(v),Te=Mn(H),He=Ue(()=>{function ve(it){_?B?.events.emit("virtualfocus",it):Zu(it,{sync:he.current,preventScroll:!0})}const Se=d.current[J.current],Ee=pe.current;Se&&ve(Se),(he.current?it=>it():requestAnimationFrame)(()=>{const it=d.current[J.current]||Se;if(!it)return;Se||ve(it);const Fe=fe.current;Fe&&Y&&(Ee||!P.current)&&it.scrollIntoView?.(typeof Fe=="boolean"?{block:"nearest",inline:"nearest"}:Fe)})});Le(()=>{y&&(a&&i?(J.current=v??-1,re.current&&v!=null&&(pe.current=!0,K())):te.current&&(J.current=-1,se.current()))},[y,a,i,v,K]),Le(()=>{if(y){if(!a){he.current=!1;return}if(i)if(p==null){if(he.current=!1,ke.current!=null)return;if(te.current&&(J.current=-1,He()),(!ge.current||!te.current)&&re.current&&(D.current!=null||re.current===!0&&D.current==null)){let ve=0;const Se=()=>{d.current[0]==null?(ve<2&&(ve?requestAnimationFrame:queueMicrotask)(Se),ve+=1):(J.current=D.current==null||Tp(D.current,R,T)||N?gp(d):jx(d),D.current=null,K())};Se()}}else xl(d,p)||(J.current=p,He(),pe.current=!1)}},[y,a,i,p,ke,N,d,R,T,K,He,xe]),Le(()=>{if(!y||i||!B||_||!te.current)return;const ve=B.nodesRef.current,Se=ve.find(it=>it.id===I)?.context?.elements.floating,Ee=Zr(on(i)),We=ve.some(it=>it.context&&Et(it.context.elements.floating,Ee));Se&&!We&&P.current&&Se.focus({preventScroll:!0})},[y,i,B,I,_]),Le(()=>{se.current=K,ge.current=a,te.current=!!i}),Le(()=>{a||(D.current=null,re.current=C)},[a,C]);const ie=p!=null,Y=b.useMemo(()=>{function ve(Ee){if(!Re.current)return;const We=d.current.indexOf(Ee.currentTarget);We!==-1&&J.current!==We&&(J.current=We,K(Ee))}return{onFocus(Ee){he.current=!0,ve(Ee)},onClick:({currentTarget:Ee})=>Ee.focus({preventScroll:!0}),onMouseMove(Ee){he.current=!0,pe.current=!1,j&&ve(Ee)},onPointerLeave(Ee){if(!Re.current||!P.current||Ee.pointerType==="touch")return;he.current=!0;const We=Ee.relatedTarget;!j||d.current.includes(We)||Te.current&&(J.current=-1,K(Ee),_||ee.current?.focus({preventScroll:!0}))}}},[Re,ee,j,d,K,Te,_]),ae=b.useCallback(()=>O??B?.nodesRef.current.find(ve=>ve.id===I)?.context?.dataRef?.current.orientation,[I,B,O]),ye=Ue(ve=>{if(P.current=!1,he.current=!0,ve.which===229||!Re.current&&ve.currentTarget===ee.current)return;if(N&&QO(ve.key,R,T,M)){Eu(ve.key,ae())||ln(ve),s.setOpen(!1,Ht(Bu,ve.nativeEvent)),Pt(l)&&(_?B?.events.emit("virtualfocus",l):l.focus());return}const Se=J.current,Ee=gp(d,A),We=jx(d,A);if($||(ve.key==="Home"&&(ln(ve),J.current=Ee,K(ve)),ve.key==="End"&&(ln(ve),J.current=We,K(ve))),M>1){const it=F||Array.from({length:d.current.length},()=>({width:1,height:1})),Fe=$2(it,M,Z),Ft=Fe.findIndex(hn=>hn!=null&&!wl(d,hn,A)),Xt=Fe.reduce((hn,Jt,De)=>Jt!=null&&!wl(d,Jt,A)?De:hn,-1),En=Fe[V2({current:Fe.map(hn=>hn!=null?d.current[hn]:null)},{event:ve,orientation:R,loopFocus:w,rtl:T,cols:M,disabledIndices:Z2([...(typeof A!="function"?A:null)||d.current.map((hn,Jt)=>wl(d,Jt,A)?Jt:void 0),void 0],Fe),minIndex:Ft,maxIndex:Xt,prevIndex:B2(J.current>We?Ee:J.current,it,Fe,M,ve.key===Zl?"bl":ve.key===(T?Yr:Gr)?"tr":"tl"),stopEvent:!0})];if(En!=null&&(J.current=En,K(ve)),R==="both")return}if(Eu(ve.key,R)){if(ln(ve),a&&!_&&Zr(ve.currentTarget.ownerDocument)===ve.currentTarget){J.current=Tp(ve.key,R,T)?Ee:We,K(ve);return}Tp(ve.key,R,T)?w?Se>=We?x&&Se!==d.current.length?J.current=-1:(he.current=!1,J.current=Ee):J.current=dn(d,{startingIndex:Se,disabledIndices:A}):J.current=Math.min(We,dn(d,{startingIndex:Se,disabledIndices:A})):w?Se<=Ee?x&&Se!==-1?J.current=d.current.length:(he.current=!1,J.current=We):J.current=dn(d,{startingIndex:Se,decrement:!0,disabledIndices:A}):J.current=Math.max(Ee,dn(d,{startingIndex:Se,decrement:!0,disabledIndices:A})),xl(d,J.current)&&(J.current=-1),K(ve)}}),we=b.useMemo(()=>_&&a&&ie&&{"aria-activedescendant":`${U}-${p}`},[_,a,ie,U,p]),Ce=b.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...$?{}:we,onKeyDown(ve){if(ve.key==="Tab"&&ve.shiftKey&&a&&!_){const Se=On(ve.nativeEvent);if(Se&&!Et(ee.current,Se))return;ln(ve),s.setOpen(!1,Ht(Od,ve.nativeEvent)),Pt(l)&&l.focus();return}ye(ve)},onPointerMove(){P.current=!0}}),[we,ye,ee,R,$,s,a,_,l]),me=b.useMemo(()=>{function ve(Ee){C==="auto"&&hE(Ee.nativeEvent)&&(re.current=!_)}function Se(Ee){re.current=C,C==="auto"&&pE(Ee.nativeEvent)&&(re.current=!0)}return{onKeyDown(Ee){const We=s.select("open");P.current=!1;const it=Ee.key.startsWith("Arrow"),Fe=JO(Ee.key,ae(),T),Ft=Eu(Ee.key,R),Xt=(N?Fe:Ft)||Ee.key==="Enter"||Ee.key.trim()==="";if(_&&We)return ye(Ee);if(!(!We&&!E&&it)){if(Xt){const En=Eu(Ee.key,ae());D.current=N&&En?null:Ee.key}if(N){Fe&&(ln(Ee),We?(J.current=gp(d,xe.current),K(Ee)):s.setOpen(!0,Ht(Bu,Ee.nativeEvent,Ee.currentTarget)));return}Ft&&(ke.current!=null&&(J.current=ke.current),ln(Ee),!We&&E?s.setOpen(!0,Ht(Bu,Ee.nativeEvent,Ee.currentTarget)):ye(Ee),We&&K(Ee))}},onFocus(Ee){s.select("open")&&!_&&(J.current=-1,K(Ee))},onPointerDown:Se,onPointerEnter:Se,onMouseDown:ve,onClick:ve}},[ye,xe,C,d,N,K,s,E,R,ae,T,ke,_]),Oe=b.useMemo(()=>({...we,...me}),[we,me]);return b.useMemo(()=>y?{reference:Oe,floating:Ce,item:Y,trigger:me}:{},[y,Oe,Ce,me,Y])}const tD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function nD(e,t={}){const s="rootStore"in e?e.rootStore:e,a=s.useState("open"),i=s.useState("floatingId"),l=s.useState("domReferenceElement"),u=s.useState("floatingElement"),{enabled:d=!0,role:p="dialog"}=t,h=ea(),y=l?.id||h,v=b.useMemo(()=>sd(u)?.id||i,[u,i]),x=tD.get(p)??p,N=ra()!=null,T=b.useMemo(()=>x==="tooltip"||p==="label"?Dn:{"aria-haspopup":x==="alertdialog"?"dialog":x,"aria-expanded":"false",...x==="listbox"&&{role:"combobox"},...x==="menu"&&N&&{role:"menuitem"},...p==="select"&&{"aria-autocomplete":"none"},...p==="combobox"&&{"aria-autocomplete":"list"}},[x,N,p]),_=b.useMemo(()=>x==="tooltip"||p==="label"?{[`aria-${p==="label"?"labelledby":"describedby"}`]:a?v:void 0}:{...T,"aria-expanded":a?"true":"false","aria-controls":a?v:void 0,...x==="menu"&&{id:y}},[x,v,a,y,p,T]),C=b.useMemo(()=>{const E={id:v,...x&&{role:x}};return x==="tooltip"||p==="label"?E:{...E,...x==="menu"&&{"aria-labelledby":y}}},[x,v,y,p]),j=b.useCallback(({active:E,selected:A})=>{const R={role:"option",...E&&{id:`${v}-fui-option`}};switch(p){case"select":case"combobox":return{...R,"aria-selected":A}}return{}},[v,p]);return b.useMemo(()=>d?{reference:_,floating:C,item:j,trigger:T}:{},[d,_,C,T,j])}function sD(e,t){const s="rootStore"in e?e.rootStore:e,a=s.useState("open"),i=s.context.dataRef,{listRef:l,activeIndex:u,onMatch:d,onTypingChange:p,enabled:h=!0,findMatch:y=null,resetMs:v=750,ignoreKeys:x=JS,selectedIndex:w=null}=t,N=Es(),T=b.useRef(""),_=b.useRef(w??u??-1),C=b.useRef(null);Le(()=>{a&&(N.clear(),C.current=null,T.current="")},[a,N]),Le(()=>{a&&T.current===""&&(_.current=w??u??-1)},[a,w,u]);const j=Ue(O=>{O?i.current.typing||(i.current.typing=O,p?.(O)):i.current.typing&&(i.current.typing=O,p?.(O))}),E=Ue(O=>{function M(H,W,oe){const ee=y?y(W,oe):W.find(I=>I?.toLocaleLowerCase().indexOf(oe.toLocaleLowerCase())===0);return ee?H.indexOf(ee):-1}const z=l.current;if(T.current.length>0&&T.current[0]!==" "&&(M(z,z,T.current)===-1?j(!1):O.key===" "&&ln(O)),z==null||x.includes(O.key)||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;a&&O.key!==" "&&(ln(O),j(!0)),z.every(H=>H?H[0]?.toLocaleLowerCase()!==H[1]?.toLocaleLowerCase():!0)&&T.current===O.key&&(T.current="",_.current=C.current),T.current+=O.key,N.start(v,()=>{T.current="",_.current=C.current,j(!1)});const Z=_.current,U=M(z,[...z.slice((Z||0)+1),...z.slice(0,(Z||0)+1)],T.current);U!==-1?(d?.(U),C.current=U):O.key!==" "&&(T.current="",j(!1))}),A=b.useMemo(()=>({onKeyDown:E}),[E]),R=b.useMemo(()=>({onKeyDown:E,onKeyUp(O){O.key===" "&&j(!1)}}),[E,j]);return b.useMemo(()=>h?{reference:A,floating:R}:{},[h,A,R])}const rD=b.createContext(void 0);function aD(e){return b.useContext(rD)}const qE="ArrowUp",YE="ArrowDown",GE="ArrowLeft",XE="ArrowRight",KE="Home",WE="End",iD=new Set([GE,XE]),oD=new Set([qE,YE]),lD=new Set([...iD,...oD]);[...lD];const cD=new Set([qE,YE,GE,XE,KE,WE]);function uD(e){return e==="starting"?wk:Dn}const dD={...QS,..._k},fD=b.forwardRef(function(t,s){const{render:a,className:i,finalFocus:l,...u}=t,{store:d}=ro(),{side:p,align:h}=qS(),y=aD()!=null,v=d.useState("open"),x=d.useState("transitionStatus"),w=d.useState("popupProps"),N=d.useState("mounted"),T=d.useState("instantType"),_=d.useState("activeTriggerElement"),C=d.useState("parent"),j=d.useState("lastOpenChangeReason"),E=d.useState("rootId"),A=d.useState("floatingRootContext"),R=d.useState("floatingTreeRoot"),O=d.useState("closeDelay"),M=d.useState("activeTriggerElement");iE({open:v,ref:d.context.popupRef,onComplete(){v&&d.context.onOpenChangeComplete?.(!0)}}),b.useEffect(()=>{function W(oe){d.setOpen(!1,Ht(oe.reason,oe.domEvent))}return R.events.on("close",W),()=>{R.events.off("close",W)}},[R.events,d]);const z=d.useState("hoverEnabled"),F=d.useState("disabled");GO(A,{enabled:z&&!F&&C.type!=="context-menu"&&C.type!=="menubar",closeDelay:O});const Z=b.useMemo(()=>({transitionStatus:x,side:p,align:h,open:v,nested:C.type==="menu",instant:T}),[x,p,h,v,C.type,T]),U=ta("div",t,{state:Z,ref:[s,d.context.popupRef],stateAttributesMapping:dD,props:[w,{onKeyDown(W){y&&cD.has(W.key)&&W.stopPropagation()}},uD(x),u,{"data-rootownerid":E}]});let H=C.type===void 0||C.type==="context-menu";return(_||C.type==="menubar"&&j!==ug)&&(H=!0),f.jsx(bM,{context:A,modal:!1,disabled:!N,returnFocus:l===void 0?H:l,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?R:void 0,previousFocusableElement:M,nextFocusableElement:C.type===void 0?d.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?d.context.beforeContentFocusGuardRef:void 0,children:U})}),JE=b.createContext(void 0);function hD(){const e=b.useContext(JE);if(e===void 0)throw new Error(Ha(32));return e}const pD=b.forwardRef(function(t,s){const{keepMounted:a=!1,...i}=t,{store:l}=ro();return l.useState("mounted")||a?f.jsx(JE.Provider,{value:a,children:f.jsx(pM,{ref:s,...i})}):null});function mD(e){return lg(19)?e:e?"true":void 0}const gD=b.createContext(void 0);function QE(){return b.useContext(gD)?.direction??"ltr"}const yD=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:a,placement:i,rects:l,platform:u,elements:d,middlewareData:p}=t,{element:h,padding:y=0,offsetParent:v="real"}=fr(e,t)||{};if(h==null)return{};const x=mE(y),w={x:s,y:a},N=yg(i),T=gg(N),_=await u.getDimensions(h),C=N==="y",j=C?"top":"left",E=C?"bottom":"right",A=C?"clientHeight":"clientWidth",R=l.reference[T]+l.reference[N]-w[N]-l.floating[T],O=w[N]-l.reference[N],M=v==="real"?await u.getOffsetParent?.(h):d.floating;let z=d.floating[A]||l.floating[T];(!z||!await u.isElement?.(M))&&(z=d.floating[A]||l.floating[T]);const F=R/2-O/2,Z=z/2-_[T]/2-1,U=Math.min(x[j],Z),H=Math.min(x[E],Z),W=U,oe=z-_[T]-H,ee=z/2-_[T]/2+F,I=pm(W,ee,oe),B=!p.arrow&&sa(i)!=null&&ee!==I&&l.reference[T]/2-(ee<W?U:H)-_[T]/2<0,$=B?ee<W?ee-W:ee-oe:0;return{[N]:w[N]+$,data:{[N]:I,centerOffset:ee-I-$,...B&&{alignmentOffset:$}},reset:B}}}),vD=(e,t)=>({...yD(e),options:[e,t]}),bD={name:"hide",async fn(e){const{width:t,height:s,x:a,y:i}=e.rects.reference,l=t===0&&s===0&&a===0&&i===0;return{data:{referenceHidden:(await iO().fn(e)).data?.referenceHidden||l}}}},xD={sideX:"left",sideY:"top"};function eN(e,t,s){const a=e==="inline-start"||e==="inline-end";return{top:"top",right:a?s?"inline-start":"inline-end":"right",bottom:"bottom",left:a?s?"inline-end":"inline-start":"left"}[t]}function Xx(e,t,s){const{rects:a,placement:i}=e;return{side:eN(t,Fn(i),s),align:sa(i)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function wD(e){const{anchor:t,positionMethod:s="absolute",side:a="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,collisionBoundary:d,collisionPadding:p=5,sticky:h=!1,arrowPadding:y=5,disableAnchorTracking:v=!1,keepMounted:x=!1,floatingRootContext:w,mounted:N,collisionAvoidance:T,shiftCrossAxis:_=!1,nodeId:C,adaptiveOrigin:j,lazyFlip:E=!1,externalTree:A}=e,[R,O]=b.useState(null);!N&&R!==null&&O(null);const M=T.side||"flip",z=T.align||"flip",F=T.fallbackAxisSide||"end",Z=typeof t=="function"?t:void 0,U=Ue(Z),H=Z?U:t,W=Mn(t),ee=QE()==="rtl",I=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ee?"left":"right","inline-start":ee?"right":"left"}[a],B=l==="center"?I:`${I}-${l}`;let $=p;const re=1,J=a==="bottom"?re:0,D=a==="top"?re:0,P=a==="right"?re:0,K=a==="left"?re:0;typeof $=="number"?$={top:$+J,right:$+K,bottom:$+D,left:$+P}:$&&($={top:($.top||0)+J,right:($.right||0)+K,bottom:($.bottom||0)+D,left:($.left||0)+P});const se={boundary:d==="clipping-ancestors"?"clippingAncestors":d,padding:$},te=b.useRef(null),ge=Mn(i),he=Mn(u),Re=[tO(gt=>{const zt=Xx(gt,a,ee),pn=typeof ge.current=="function"?ge.current(zt):ge.current,qt=typeof he.current=="function"?he.current(zt):he.current;return{mainAxis:pn,crossAxis:qt,alignmentAxis:qt}},[typeof i!="function"?i:0,typeof u!="function"?u:0,ee,a])],fe=z==="none"&&M!=="shift",ke=!fe&&(h||_||M==="shift"),Te=M==="none"?null:rO({...se,padding:{top:$.top+re,right:$.right+re,bottom:$.bottom+re,left:$.left+re},mainAxis:!_&&M==="flip",crossAxis:z==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),He=fe?null:nO(gt=>{const zt=Ua(gt.elements.floating).documentElement;return{...se,rootBoundary:_?{x:0,y:0,width:zt.clientWidth,height:zt.clientHeight}:void 0,mainAxis:z!=="none",crossAxis:ke,limiter:h||_?void 0:sO(pn=>{if(!te.current)return{};const{width:qt,height:Nn}=te.current.getBoundingClientRect(),Qt=os(Fn(pn.placement)),mn=Qt==="y"?qt:Nn,pr=Qt==="y"?$.left+$.right:$.top+$.bottom;return{offset:mn/2+pr/2}})}},[se,h,_,$,z]);M==="shift"||z==="shift"||l==="center"?Re.push(He,Te):Re.push(Te,He),Re.push(aO({...se,apply({elements:{floating:gt},rects:{reference:zt},availableWidth:pn,availableHeight:qt}){Object.entries({"--available-width":`${pn}px`,"--available-height":`${qt}px`,"--anchor-width":`${zt.width}px`,"--anchor-height":`${zt.height}px`}).forEach(([Nn,Qt])=>{gt.style.setProperty(Nn,Qt)})}}),vD(()=>({element:te.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(gt){const{elements:zt,middlewareData:pn,placement:qt,rects:Nn,y:Qt}=gt,mn=Fn(qt),pr=os(mn),mr=te.current,Wd=pn.arrow?.x||0,Ql=pn.arrow?.y||0,po=mr?.clientWidth||0,ca=mr?.clientHeight||0,mo=Wd+po/2,go=Ql+ca/2,ec=Math.abs(pn.shift?.y||0),tc=Nn.reference.height/2,Hs=typeof i=="function"?i(Xx(gt,a,ee)):i,yo=ec>Hs,nc={top:`${mo}px calc(100% + ${Hs}px)`,bottom:`${mo}px ${-Hs}px`,left:`calc(100% + ${Hs}px) ${go}px`,right:`${-Hs}px ${go}px`}[mn],sc=`${mo}px ${Nn.reference.y+tc-Qt}px`;return zt.floating.style.setProperty("--transform-origin",ke&&pr==="y"&&yo?sc:nc),{}}},bD,j),Le(()=>{!N&&w&&w.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[N,w]);const ie=b.useMemo(()=>({elementResize:!v&&typeof ResizeObserver<"u",layoutShift:!v&&typeof IntersectionObserver<"u"}),[v]),{refs:Y,elements:ae,x:ye,y:we,middlewareData:Ce,update:me,placement:Oe,context:ve,isPositioned:Se,floatingStyles:Ee}=BO({rootContext:w,placement:B,middleware:Re,strategy:s,whileElementsMounted:x?void 0:(...gt)=>Ux(...gt,ie),nodeId:C,externalTree:A}),{sideX:We,sideY:it}=Ce.adaptiveOrigin||xD,Fe=Se?s:"fixed",Ft=b.useMemo(()=>j?{position:Fe,[We]:ye,[it]:we}:{position:Fe,...Ee},[j,Fe,We,ye,it,we,Ee]),Xt=b.useRef(null);Le(()=>{if(!N)return;const gt=W.current,zt=typeof gt=="function"?gt():gt,qt=(Kx(zt)?zt.current:zt)||null||null;qt!==Xt.current&&(Y.setPositionReference(qt),Xt.current=qt)},[N,Y,H,W]),b.useEffect(()=>{if(!N)return;const gt=W.current;typeof gt!="function"&&Kx(gt)&>.current!==Xt.current&&(Y.setPositionReference(gt.current),Xt.current=gt.current)},[N,Y,H,W]),b.useEffect(()=>{if(x&&N&&ae.domReference&&ae.floating)return Ux(ae.domReference,ae.floating,me,ie)},[x,N,ae,me,ie]);const En=Fn(Oe),hn=eN(a,En,ee),Jt=sa(Oe)||"center",De=!!Ce.hide?.referenceHidden;Le(()=>{E&&N&&Se&&O(En)},[E,N,Se,En]);const et=b.useMemo(()=>({position:"absolute",top:Ce.arrow?.y,left:Ce.arrow?.x}),[Ce.arrow]),nt=Ce.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:Ft,arrowStyles:et,arrowRef:te,arrowUncentered:nt,side:hn,align:Jt,physicalSide:En,anchorHidden:De,refs:Y,context:ve,isPositioned:Se,update:me}),[Ft,et,te,nt,hn,Jt,En,De,Y,ve,Se,me])}function Kx(e){return e!=null&&"current"in e}function SD(e){const{children:t,elementsRef:s,labelsRef:a,onMapChange:i}=e,l=Ue(i),u=b.useRef(0),d=us(ND).current,p=us(ED).current,[h,y]=b.useState(0),v=b.useRef(h),x=Ue((C,j)=>{p.set(C,j??null),v.current+=1,y(v.current)}),w=Ue(C=>{p.delete(C),v.current+=1,y(v.current)}),N=b.useMemo(()=>{const C=new Map;return Array.from(p.keys()).filter(E=>E.isConnected).sort(TD).forEach((E,A)=>{const R=p.get(E)??{};C.set(E,{...R,index:A})}),C},[p,h]);Le(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const C=new MutationObserver(j=>{const E=new Set,A=R=>E.has(R)?E.delete(R):E.add(R);j.forEach(R=>{R.removedNodes.forEach(A),R.addedNodes.forEach(A)}),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]),Le(()=>{v.current===h&&(s.current.length!==N.size&&(s.current.length=N.size),a&&a.current.length!==N.size&&(a.current.length=N.size),u.current=N.size),l(N)},[l,N,s,a,h]),Le(()=>()=>{s.current=[]},[s]),Le(()=>()=>{a&&(a.current=[])},[a]);const T=Ue(C=>(d.add(C),()=>{d.delete(C)}));Le(()=>{d.forEach(C=>C(N))},[d,N]);const _=b.useMemo(()=>({register:x,unregister:w,subscribeMapChange:T,elementsRef:s,labelsRef:a,nextIndexRef:u}),[x,w,T,s,a,u]);return f.jsx(sE.Provider,{value:_,children:t})}function ED(){return new Map}function ND(){return new Set}function TD(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 jD=b.forwardRef(function(t,s){const{cutout:a,...i}=t;let l;if(a){const u=a?.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 f.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),CD=b.forwardRef(function(t,s){const{anchor:a,positionMethod:i="absolute",className:l,render:u,side:d,align:p,sideOffset:h=0,alignOffset:y=0,collisionBoundary:v="clipping-ancestors",collisionPadding:x=5,arrowPadding:w=5,sticky:N=!1,disableAnchorTracking:T=!1,collisionAvoidance:_=Ek,...C}=t,{store:j}=ro(),E=hD(),A=kd(!0),R=j.useState("parent"),O=j.useState("floatingRootContext"),M=j.useState("floatingTreeRoot"),z=j.useState("mounted"),F=j.useState("open"),Z=j.useState("modal"),U=j.useState("activeTriggerElement"),H=j.useState("lastOpenChangeReason"),W=j.useState("floatingNodeId"),oe=j.useState("floatingParentNodeId");let ee=a,I=h,B=y,$=p;R.type==="context-menu"&&(ee=a??R.context?.anchor,$=$??"start",!d&&$!=="center"&&(B=t.alignOffset??2,I=t.sideOffset??-5));let re=d,J=$;R.type==="menu"?(re=re??"inline-end",J=J??"start"):R.type==="menubar"&&(re=re??"bottom",J=J??"start");const D=R.type==="context-menu",P=wD({anchor:ee,floatingRootContext:O,positionMethod:A?"fixed":i,mounted:z,side:re,sideOffset:I,align:J,alignOffset:B,arrowPadding:D?0:w,collisionBoundary:v,collisionPadding:x,sticky:N,nodeId:W,keepMounted:E,disableAnchorTracking:T,collisionAvoidance:_,shiftCrossAxis:D,externalTree:M}),K=b.useMemo(()=>{const xe={};return F||(xe.pointerEvents="none"),{role:"presentation",hidden:!z,style:{...P.positionerStyles,...xe}}},[F,z,P.positionerStyles]);b.useEffect(()=>{function xe(Re){Re.open?(Re.parentNodeId===W&&j.set("hoverEnabled",!1),Re.nodeId!==W&&Re.parentNodeId===j.select("floatingParentNodeId")&&j.setOpen(!1,Ht(hl))):Re.parentNodeId===W&&Re.reason!==hl&&j.set("hoverEnabled",!0)}return M.events.on("menuopenchange",xe),()=>{M.events.off("menuopenchange",xe)}},[j,M.events,W]),b.useEffect(()=>{if(j.select("floatingParentNodeId")==null)return;function xe(Re){if(Re.open||Re.nodeId!==j.select("floatingParentNodeId"))return;const fe=Re.reason??hl;j.setOpen(!1,Ht(fe))}return M.events.on("menuopenchange",xe),()=>{M.events.off("menuopenchange",xe)}},[M.events,j]),b.useEffect(()=>{function xe(Re){!F||Re.nodeId!==j.select("floatingParentNodeId")||Re.target&&U&&U!==Re.target&&j.setOpen(!1,Ht(hl))}return M.events.on("itemhover",xe),()=>{M.events.off("itemhover",xe)}},[M.events,F,U,j]),b.useEffect(()=>{const xe={open:F,nodeId:W,parentNodeId:oe,reason:j.select("lastOpenChangeReason")};M.events.emit("menuopenchange",xe)},[M.events,F,j,W,oe]);const se=b.useMemo(()=>({open:F,side:P.side,align:P.align,anchorHidden:P.anchorHidden,nested:R.type==="menu"}),[F,P.side,P.align,P.anchorHidden,R.type]),te=b.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,nodeId:P.context.nodeId}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.context.nodeId]),ge=ta("div",t,{state:se,stateAttributesMapping:QS,ref:[s,j.useStateSetter("positionerElement")],props:[K,C]}),he=z&&R.type!=="menu"&&(R.type!=="menubar"&&Z&&H!==Ia||R.type==="menubar"&&R.context.modal);let pe=null;return R.type==="menubar"?pe=R.context.contentElement:R.type===void 0&&(pe=U),f.jsxs(FS.Provider,{value:te,children:[he&&f.jsx(jD,{ref:R.type==="context-menu"||R.type==="nested-context-menu"?R.context.internalBackdropRef:null,inert:mD(!F),cutout:pe}),f.jsx(oM,{id:W,children:f.jsx(SD,{elementsRef:j.context.itemDomElements,labelsRef:j.context.itemLabels,children:ge})})]})});let Wx={},Jx={},Qx="";function RD(e){if(typeof document>"u")return!1;const t=Ua(e);return cn(t).innerWidth-t.documentElement.clientWidth>0}function AD(e){const t=Ua(e),s=t.documentElement,a=t.body,i=Fa(s)?s:a,l=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=l}}function _D(e){const t=Ua(e),s=t.documentElement,a=t.body,i=cn(s);let l=0,u=0;const d=zs.create(),p=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(y2&&(i.visualViewport?.scale??1)!==1)return()=>{};function h(){const x=i.getComputedStyle(s),w=i.getComputedStyle(a),_=(x.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=s.scrollTop,u=s.scrollLeft,Wx={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},Qx=s.style.scrollBehavior,Jx={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const C=s.scrollHeight>s.clientHeight,j=s.scrollWidth>s.clientWidth,E=x.overflowY==="scroll"||w.overflowY==="scroll",A=x.overflowX==="scroll"||w.overflowX==="scroll",R=Math.max(0,i.innerWidth-s.clientWidth),O=Math.max(0,i.innerHeight-s.clientHeight),M=parseFloat(w.marginTop)+parseFloat(w.marginBottom),z=parseFloat(w.marginLeft)+parseFloat(w.marginRight),F=Fa(s)?s:a;if(p){s.style.scrollbarGutter=_,F.style.overflowY="hidden",F.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:_,overflowY:"hidden",overflowX:"hidden"}),(C||E)&&(s.style.overflowY="scroll"),(j||A)&&(s.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:M||O?`calc(100dvh - ${M+O}px)`:"100dvh",width:z||R?`calc(100vw - ${z+R}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),a.scrollTop=l,a.scrollLeft=u,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function y(){Object.assign(s.style,Wx),Object.assign(a.style,Jx),p||(s.scrollTop=l,s.scrollLeft=u,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=Qx)}function v(){y(),d.request(h)}return h(),i.addEventListener("resize",v),()=>{d.cancel(),y(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",v)}}class kD{lockCount=0;restore=null;timeoutLock=Ki.create();timeoutUnlock=Ki.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 a=Ua(t).documentElement,i=cn(a).getComputedStyle(a).overflowY;if(i==="hidden"||i==="clip"){this.restore=WS;return}const l=v2||!RD(t);this.restore=l?AD(t):_D(t)}}const MD=new kD;function OD(e=!0,t=null){Le(()=>{if(e)return MD.acquire(t)},[e,t])}const DD=b.createContext(null);function zD(e){return b.useContext(DD)}function ID(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 LD(e){const[t,s]=b.useState(null),a=Ue((d,p)=>{e||s(p)}),i=b.useCallback(()=>{s(null)},[]),{onClick:l,onPointerDown:u}=ID(a);return b.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:l,onPointerDown:u}}),[t,i,l,u])}const PD={...VO,disabled:Ze(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ze(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ze(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ze(e=>e.stickIfOpen),parent:Ze(e=>e.parent),rootId:Ze(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ze(e=>e.activeIndex),isActive:Ze((e,t)=>e.activeIndex===t),hoverEnabled:Ze(e=>e.hoverEnabled),instantType:Ze(e=>e.instantType),lastOpenChangeReason:Ze(e=>e.openChangeReason),floatingTreeRoot:Ze(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ze(e=>e.floatingNodeId),floatingParentNodeId:Ze(e=>e.floatingParentNodeId),itemProps:Ze(e=>e.itemProps),closeDelay:Ze(e=>e.closeDelay),keyboardEventRelay:Ze(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Sg extends FE{constructor(t){super({...UD(),...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},PD),this.observe(Ze(s=>s.allowMouseEnter),(s,a)=>{this.state.parent.type==="menu"&&s!==a&&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 us(()=>t??new Sg(s)).current}unsubscribeParentListener=null}function UD(){return{...UO(),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 CE,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Dn,keyboardEventRelay:void 0,closeDelay:0}}const VD=b.createContext(void 0);function $D(){return b.useContext(VD)}function BD(e){const{children:t,open:s,onOpenChange:a,onOpenChangeComplete:i,defaultOpen:l=!1,disabled:u=!1,modal:d,loopFocus:p=!0,orientation:h="vertical",actionsRef:y,closeParentOnEsc:v=!0,handle:x,triggerId:w,defaultTriggerId:N=null,highlightItemOnHover:T=!0}=e,_=kd(!0),C=ro(!0),j=zD(),E=$D(),A=b.useMemo(()=>E&&C?{type:"menu",store:C.store}:j?{type:"menubar",context:j}:_&&!C?{type:"context-menu",context:_}:{type:void 0},[_,C,j,E]),R=Sg.useStore(x?.store,{parent:A}),O=R.useState("floatingTreeRoot"),M=iM(O),z=ra();Le(()=>{_&&!C?R.update({parent:{type:"context-menu",context:_},floatingNodeId:M,floatingParentNodeId:z}):C&&R.update({floatingNodeId:M,floatingParentNodeId:z})},[_,C,M,z,R]),R.useControlledProp("open",s,l),R.useControlledProp("activeTriggerId",w,N),R.useContextCallback("onOpenChangeComplete",i);const F=R.useState("open"),Z=R.useState("activeTriggerElement"),U=R.useState("positionerElement"),H=R.useState("hoverEnabled"),W=R.useState("modal"),oe=R.useState("disabled"),ee=R.useState("lastOpenChangeReason"),I=R.useState("parent"),B=R.useState("activeIndex"),$=R.useState("payload"),re=R.useState("floatingParentNodeId"),J=b.useRef(null),D=re!=null;let P;R.useSyncedValues({disabled:u,modal:I.type===void 0?d:void 0,rootId:ea()});const{openMethod:K,triggerProps:se,reset:te}=LD(F);IO(R);const{forceUnmount:ge}=LO(F,R,()=>{R.update({allowMouseEnter:!1,stickIfOpen:!0}),te()}),he=b.useRef(I.type!=="context-menu"),pe=Es();b.useEffect(()=>{if(F||(J.current=null),I.type==="context-menu"){if(!F){pe.clear(),he.current=!1;return}pe.start(500,()=>{he.current=!0})}},[pe,F,I.type]),OD(F&&W&&ee!==Ia&&K!=="touch",U),Le(()=>{!F&&!H&&R.set("hoverEnabled",!0)},[F,H,R]);const xe=b.useRef(!0),Re=Es(),fe=Ue((De,et)=>{const nt=et.reason;if(F===De&&et.trigger===Z||(et.preventUnmountOnClose=()=>{R.set("preventUnmountingOnClose",!0)},!De&&et.trigger==null&&(et.trigger=Z??void 0),a?.(De,et),et.isCanceled))return;const gt={open:De,nativeEvent:et.event,reason:et.reason,nested:D};P?.emit("openchange",gt);const zt=et.event;if(De===!1&&zt?.type==="click"&&zt.pointerType==="touch"&&!xe.current)return;if(!De&&B!==null){const Qt=R.context.itemDomElements.current[B];queueMicrotask(()=>{Qt?.setAttribute("tabindex","-1")})}De&&nt===Sx?(xe.current=!1,Re.start(300,()=>{xe.current=!0})):(xe.current=!0,Re.clear());const pn=(nt===nd||nt===eE)&&zt.detail===0&&zt?.isTrusted,qt=!De&&(nt===tE||nt==null);function Nn(){const Qt={open:De,openChangeReason:nt};J.current=et.event??null;const mn=et.trigger?.id??null;(mn||De)&&(Qt.activeTriggerId=mn,Qt.activeTriggerElement=et.trigger??null),R.update(Qt)}nt===Ia?Pa.flushSync(Nn):Nn(),I.type==="menubar"&&(nt===Sx||nt===Od||nt===Ia||nt===Bu||nt===hl)?R.set("instantType","group"):pn||qt?R.set("instantType",pn?"click":"dismiss"):R.set("instantType",void 0)}),ke=b.useCallback(De=>{const et=Ht(De);return et.preventUnmountOnClose=()=>{R.set("preventUnmountingOnClose",!0)},et},[R]),Te=b.useCallback(()=>{R.setOpen(!1,ke(Pk))},[R,ke]);b.useImperativeHandle(y,()=>({unmount:ge,close:Te}),[ge,Te]);let He;I.type==="context-menu"&&(He=I.context),b.useImperativeHandle(He?.positionerRef,()=>U,[U]),b.useImperativeHandle(He?.actionsRef,()=>({setOpen:fe}),[fe]);const ie=ZO({popupStore:R,onOpenChange:fe});P=ie.context.events,b.useEffect(()=>{const De=({open:et,eventDetails:nt})=>fe(et,nt);return P.on("setOpen",De),()=>{P?.off("setOpen",De)}},[P,fe]);const Y=cO(ie,{enabled:!oe,bubbles:v&&I.type==="menu",outsidePress(){return I.type!=="context-menu"||J.current?.type==="contextmenu"?!0:he.current},externalTree:D?O:void 0}),ae=nD(ie,{role:"menu"}),ye=QE(),we=b.useCallback(De=>{R.select("activeIndex")!==De&&R.set("activeIndex",De)},[R]),Ce=eD(ie,{enabled:!oe,listRef:R.context.itemDomElements,activeIndex:B,nested:I.type!==void 0,loopFocus:p,orientation:h,parentOrientation:I.type==="menubar"?I.context.orientation:void 0,rtl:ye==="rtl",disabledIndices:JS,onNavigate:we,openOnArrowKeyDown:I.type!=="context-menu",externalTree:D?O:void 0,focusItemOnHover:T}),me=b.useCallback(De=>{R.context.typingRef.current=De},[R]),Oe=sD(ie,{listRef:R.context.itemLabels,activeIndex:B,resetMs:xk,onMatch:De=>{F&&De!==B&&R.set("activeIndex",De)},onTypingChange:me}),{getReferenceProps:ve,getFloatingProps:Se,getItemProps:Ee,getTriggerProps:We}=KO([Y,ae,Ce,Oe]),it=b.useMemo(()=>{const De=Md(ve(),{onMouseEnter(){R.set("hoverEnabled",!0)},onMouseMove(){R.set("allowMouseEnter",!0)}},se);return delete De.role,De},[ve,R,se]),Fe=b.useMemo(()=>{const De=We();if(!De)return De;const{role:et,["aria-controls"]:nt,...gt}=De;return gt},[We]),Ft=hg(),Xt=b.useMemo(()=>Se({onMouseEnter(){I.type==="menu"&&Ft.request(()=>R.set("hoverEnabled",!1))},onMouseMove(){R.set("allowMouseEnter",!0)},onClick(){R.select("hoverEnabled")&&R.set("hoverEnabled",!1)},onKeyDown(De){const et=R.select("keyboardEventRelay");et&&!De.isPropagationStopped()&&et(De)}}),[Se,I.type,Ft,R]),En=b.useMemo(()=>Ee(),[Ee]);R.useSyncedValues({floatingRootContext:ie,activeTriggerProps:it,inactiveTriggerProps:Fe,popupProps:Xt,itemProps:En});const hn=b.useMemo(()=>({store:R,parent:A}),[R,A]),Jt=f.jsx(og.Provider,{value:hn,children:typeof t=="function"?t({payload:$}):t});return I.type===void 0||I.type==="context-menu"?f.jsx(lM,{externalTree:O,children:Jt}):Jt}function tN(e){if(Pt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Ls(e))return tN(Vs(e))}const ZD=b.forwardRef(function(t,s){const{className:a,render:i,orientation:l="horizontal",...u}=t,d=b.useMemo(()=>({orientation:l}),[l]);return ta("div",t,{state:d,ref:s,props:[{role:"separator","aria-orientation":l},u]})});function HD(e){const[t,s]=b.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),a=b.useRef(null),i=b.useRef(null),l=b.useRef(null),u=b.useRef(null),d=b.useRef(!0),p=b.useRef(null),h=ea(),y=b.useMemo(()=>({anchor:t,setAnchor:s,actionsRef:l,backdropRef:a,internalBackdropRef:i,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:p,rootId:h}),[t,h]);return f.jsx(HS.Provider,{value:y,children:f.jsx(og.Provider,{value:void 0,children:f.jsx(BD,{...e})})})}const ew=500,FD=b.forwardRef(function(t,s){const{render:a,className:i,...l}=t,{setAnchor:u,actionsRef:d,internalBackdropRef:p,backdropRef:h,positionerRef:y,allowMouseUpTriggerRef:v,initialCursorPointRef:x,rootId:w}=kd(!1),{store:N}=ro(!1),T=N.useState("open"),_=b.useRef(null),C=b.useRef(null),j=Es(),E=Es(),A=b.useRef(!1);function R(H,W,oe){const ee=oe.type.startsWith("touch");x.current={x:H,y:W},u({getBoundingClientRect(){return DOMRect.fromRect({width:ee?10:0,height:ee?10:0,x:H,y:W})}}),A.current=!1,d.current?.setOpen(!0,Ht(nd,oe)),E.start(ew,()=>{A.current=!0})}function O(H){v.current=!0,ln(H),R(H.clientX,H.clientY,H.nativeEvent),Ua(_.current).addEventListener("mouseup",oe=>{if(v.current=!1,!A.current)return;E.clear(),A.current=!1;const ee=On(oe);Et(y.current,ee)||w&&ee&&tN(ee)===w||d.current?.setOpen(!1,Ht(Lk,oe))},{once:!0})}function M(H){if(v.current=!1,H.touches.length===1){H.stopPropagation();const W=H.touches[0];C.current={x:W.clientX,y:W.clientY},j.start(ew,()=>{C.current&&R(C.current.x,C.current.y,H.nativeEvent)})}}function z(H){if(j.isStarted()&&C.current&&H.touches.length===1){const W=H.touches[0],oe=10,ee=Math.abs(W.clientX-C.current.x),I=Math.abs(W.clientY-C.current.y);(ee>oe||I>oe)&&j.clear()}}function F(){j.clear(),C.current=null}b.useEffect(()=>{function H(oe){const I=On(oe);(Et(_.current,I)||Et(p.current,I)||Et(h.current,I))&&oe.preventDefault()}const W=Ua(_.current);return W.addEventListener("contextmenu",H),()=>{W.removeEventListener("contextmenu",H)}},[h,p]);const Z=b.useMemo(()=>({open:T}),[T]);return ta("div",t,{state:Z,ref:[_,s],props:[{onContextMenu:O,onTouchStart:M,onTouchMove:z,onTouchEnd:F,onTouchCancel:F,style:{WebkitTouchCallout:"none"}},l],stateAttributesMapping:zk})}),Eg=b.createContext({});function Ng(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const nN=typeof window<"u",sN=nN?b.useLayoutEffect:b.useEffect,$d=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 $s=(e,t,s)=>s>t?t:s<e?e:s;let jg=()=>{};const hr={},rN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function aN(e){return typeof e=="object"&&e!==null}const iN=e=>/^0[^.\s]+$/u.test(e);function oN(e){let t;return()=>(t===void 0&&(t=e()),t)}const cs=e=>e,qD=(e,t)=>s=>t(e(s)),Fl=(...e)=>e.reduce(qD),kl=(e,t,s)=>{const a=t-e;return a===0?1:(s-e)/a};class Cg{constructor(){this.subscriptions=[]}add(t){return Tg(this.subscriptions,t),()=>pd(this.subscriptions,t)}notify(t,s,a){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,s,a);else for(let l=0;l<i;l++){const u=this.subscriptions[l];u&&u(t,s,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ws=e=>e*1e3,ls=e=>e/1e3;function lN(e,t){return t?e*(1e3/t):0}const cN=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,YD=1e-7,GD=12;function XD(e,t,s,a,i){let l,u,d=0;do u=t+(s-t)/2,l=cN(u,a,i)-e,l>0?s=u:t=u;while(Math.abs(l)>YD&&++d<GD);return u}function ql(e,t,s,a){if(e===t&&s===a)return cs;const i=l=>XD(l,0,1,e,s);return l=>l===0||l===1?l:cN(i(l),t,a)}const uN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dN=e=>t=>1-e(1-t),fN=ql(.33,1.53,.69,.99),Rg=dN(fN),hN=uN(Rg),pN=e=>(e*=2)<1?.5*Rg(e):.5*(2-Math.pow(2,-10*(e-1))),Ag=e=>1-Math.sin(Math.acos(e)),mN=dN(Ag),gN=uN(Ag),KD=ql(.42,0,1,1),WD=ql(0,0,.58,1),yN=ql(.42,0,.58,1),JD=e=>Array.isArray(e)&&typeof e[0]!="number",vN=e=>Array.isArray(e)&&typeof e[0]=="number",QD={linear:cs,easeIn:KD,easeInOut:yN,easeOut:WD,circIn:Ag,circInOut:gN,circOut:mN,backIn:Rg,backInOut:hN,backOut:fN,anticipate:pN},ez=e=>typeof e=="string",tw=e=>{if(vN(e)){jg(e.length===4);const[t,s,a,i]=e;return ql(t,s,a,i)}else if(ez(e))return QD[e];return e},Nu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function tz(e,t){let s=new Set,a=new Set,i=!1,l=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(y){u.has(y)&&(h.schedule(y),e()),y(d)}const h={schedule:(y,v=!1,x=!1)=>{const N=x&&i?s:a;return v&&u.add(y),N.has(y)||N.add(y),y},cancel:y=>{a.delete(y),u.delete(y)},process:y=>{if(d=y,i){l=!0;return}i=!0,[s,a]=[a,s],s.forEach(p),s.clear(),i=!1,l&&(l=!1,h.process(y))}};return h}const nz=40;function bN(e,t){let s=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=Nu.reduce((E,A)=>(E[A]=tz(l),E),{}),{setup:d,read:p,resolveKeyframes:h,preUpdate:y,update:v,preRender:x,render:w,postRender:N}=u,T=()=>{const E=hr.useManualTiming?i.timestamp:performance.now();s=!1,hr.useManualTiming||(i.delta=a?1e3/60:Math.max(Math.min(E-i.timestamp,nz),1)),i.timestamp=E,i.isProcessing=!0,d.process(i),p.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&&(a=!1,e(T))},_=()=>{s=!0,a=!0,i.isProcessing||e(T)};return{schedule:Nu.reduce((E,A)=>{const R=u[A];return E[A]=(O,M=!1,z=!1)=>(s||_(),R.schedule(O,M,z)),E},{}),cancel:E=>{for(let A=0;A<Nu.length;A++)u[Nu[A]].cancel(E)},state:i,steps:u}}const{schedule:yt,cancel:Wr,state:an,steps:jp}=bN(typeof requestAnimationFrame<"u"?requestAnimationFrame:cs,!0);let Fu;function sz(){Fu=void 0}const xn={now:()=>(Fu===void 0&&xn.set(an.isProcessing||hr.useManualTiming?an.timestamp:performance.now()),Fu),set:e=>{Fu=e,queueMicrotask(sz)}},xN=e=>t=>typeof t=="string"&&t.startsWith(e),wN=xN("--"),rz=xN("var(--"),_g=e=>rz(e)?az.test(e.split("/*")[0].trim()):!1,az=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function nw(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const oo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ml={...oo,transform:e=>$s(0,1,e)},Tu={...oo,default:1},Nl=e=>Math.round(e*1e5)/1e5,kg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function iz(e){return e==null}const oz=/^(?:#[\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"&&oz.test(s)&&s.startsWith(e)||t&&!iz(s)&&Object.prototype.hasOwnProperty.call(s,t)),SN=(e,t,s)=>a=>{if(typeof a!="string")return a;const[i,l,u,d]=a.match(kg);return{[e]:parseFloat(i),[t]:parseFloat(l),[s]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},lz=e=>$s(0,255,e),Cp={...oo,transform:e=>Math.round(lz(e))},Oa={test:Mg("rgb","red"),parse:SN("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:a=1})=>"rgba("+Cp.transform(e)+", "+Cp.transform(t)+", "+Cp.transform(s)+", "+Nl(Ml.transform(a))+")"};function cz(e){let t="",s="",a="",i="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,s+=s,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}}const vm={test:Mg("#"),parse:cz,transform:Oa.transform},Yl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vr=Yl("deg"),Us=Yl("%"),je=Yl("px"),uz=Yl("vh"),dz=Yl("vw"),sw={...Us,parse:e=>Us.parse(e)/100,transform:e=>Us.transform(e*100)},Pi={test:Mg("hsl","hue"),parse:SN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:a=1})=>"hsla("+Math.round(e)+", "+Us.transform(Nl(t))+", "+Us.transform(Nl(s))+", "+Nl(Ml.transform(a))+")"},Zt={test:e=>Oa.test(e)||vm.test(e)||Pi.test(e),parse:e=>Oa.test(e)?Oa.parse(e):Pi.test(e)?Pi.parse(e):vm.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Oa.transform(e):Pi.transform(e),getAnimatableNone:e=>{const t=Zt.parse(e);return t.alpha=0,Zt.transform(t)}},fz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function hz(e){return isNaN(e)&&typeof e=="string"&&(e.match(kg)?.length||0)+(e.match(fz)?.length||0)>0}const EN="number",NN="color",pz="var",mz="var(",rw="${}",gz=/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 Ol(e){const t=e.toString(),s=[],a={color:[],number:[],var:[]},i=[];let l=0;const d=t.replace(gz,p=>(Zt.test(p)?(a.color.push(l),i.push(NN),s.push(Zt.parse(p))):p.startsWith(mz)?(a.var.push(l),i.push(pz),s.push(p)):(a.number.push(l),i.push(EN),s.push(parseFloat(p))),++l,rw)).split(rw);return{values:s,split:d,indexes:a,types:i}}function TN(e){return Ol(e).values}function jN(e){const{split:t,types:s}=Ol(e),a=t.length;return i=>{let l="";for(let u=0;u<a;u++)if(l+=t[u],i[u]!==void 0){const d=s[u];d===EN?l+=Nl(i[u]):d===NN?l+=Zt.transform(i[u]):l+=i[u]}return l}}const yz=e=>typeof e=="number"?0:Zt.test(e)?Zt.getAnimatableNone(e):e;function vz(e){const t=TN(e);return jN(e)(t.map(yz))}const Ss={test:hz,parse:TN,createTransformer:jN,getAnimatableNone:vz};function Rp(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 bz({hue:e,saturation:t,lightness:s,alpha:a}){e/=360,t/=100,s/=100;let i=0,l=0,u=0;if(!t)i=l=u=s;else{const d=s<.5?s*(1+t):s+t-s*t,p=2*s-d;i=Rp(p,d,e+1/3),l=Rp(p,d,e),u=Rp(p,d,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:a}}function md(e,t){return s=>s>0?t:e}const _t=(e,t,s)=>e+(t-e)*s,Ap=(e,t,s)=>{const a=e*e,i=s*(t*t-a)+a;return i<0?0:Math.sqrt(i)},xz=[vm,Oa,Pi],wz=e=>xz.find(t=>t.test(e));function aw(e){const t=wz(e);if(!t)return!1;let s=t.parse(e);return t===Pi&&(s=bz(s)),s}const iw=(e,t)=>{const s=aw(e),a=aw(t);if(!s||!a)return md(e,t);const i={...s};return l=>(i.red=Ap(s.red,a.red,l),i.green=Ap(s.green,a.green,l),i.blue=Ap(s.blue,a.blue,l),i.alpha=_t(s.alpha,a.alpha,l),Oa.transform(i))},bm=new Set(["none","hidden"]);function Sz(e,t){return bm.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Ez(e,t){return s=>_t(e,t,s)}function Og(e){return typeof e=="number"?Ez:typeof e=="string"?_g(e)?md:Zt.test(e)?iw:jz:Array.isArray(e)?CN:typeof e=="object"?Zt.test(e)?iw:Nz:md}function CN(e,t){const s=[...e],a=s.length,i=e.map((l,u)=>Og(l)(l,t[u]));return l=>{for(let u=0;u<a;u++)s[u]=i[u](l);return s}}function Nz(e,t){const s={...e,...t},a={};for(const i in s)e[i]!==void 0&&t[i]!==void 0&&(a[i]=Og(e[i])(e[i],t[i]));return i=>{for(const l in a)s[l]=a[l](i);return s}}function Tz(e,t){const s=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],u=e.indexes[l][a[l]],d=e.values[u]??0;s[i]=d,a[l]++}return s}const jz=(e,t)=>{const s=Ss.createTransformer(t),a=Ol(e),i=Ol(t);return a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length?bm.has(e)&&!i.values.length||bm.has(t)&&!a.values.length?Sz(e,t):Fl(CN(Tz(a,i),i.values),s):md(e,t)};function RN(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?_t(e,t,s):Og(e)(e,t)}const Cz=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>yt.update(t,s),stop:()=>Wr(t),now:()=>an.isProcessing?an.timestamp:xn.now()}},AN=(e,t,s=10)=>{let a="";const i=Math.max(Math.round(t/s),2);for(let l=0;l<i;l++)a+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},gd=2e4;function Dg(e){let t=0;const s=50;let a=e.next(t);for(;!a.done&&t<gd;)t+=s,a=e.next(t);return t>=gd?1/0:t}function Rz(e,t=100,s){const a=s({...e,keyframes:[0,t]}),i=Math.min(Dg(a),gd);return{type:"keyframes",ease:l=>a.next(i*l).value/t,duration:ls(i)}}const Az=5;function _N(e,t,s){const a=Math.max(t-Az,0);return lN(s-e(a),t-a)}const Dt={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 _z({duration:e=Dt.duration,bounce:t=Dt.bounce,velocity:s=Dt.velocity,mass:a=Dt.mass}){let i,l,u=1-t;u=$s(Dt.minDamping,Dt.maxDamping,u),e=$s(Dt.minDuration,Dt.maxDuration,ls(e)),u<1?(i=h=>{const y=h*u,v=y*e,x=y-s,w=xm(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=xm(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 d=5/e,p=Mz(i,l,d);if(e=ws(e),isNaN(p))return{stiffness:Dt.stiffness,damping:Dt.damping,duration:e};{const h=Math.pow(p,2)*a;return{stiffness:h,damping:u*2*Math.sqrt(a*h),duration:e}}}const kz=12;function Mz(e,t,s){let a=s;for(let i=1;i<kz;i++)a=a-e(a)/t(a);return a}function xm(e,t){return e*Math.sqrt(1-t*t)}const Oz=["duration","bounce"],Dz=["stiffness","damping","mass"];function ow(e,t){return t.some(s=>e[s]!==void 0)}function zz(e){let t={velocity:Dt.velocity,stiffness:Dt.stiffness,damping:Dt.damping,mass:Dt.mass,isResolvedFromDuration:!1,...e};if(!ow(e,Dz)&&ow(e,Oz))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,a=2*Math.PI/(s*1.2),i=a*a,l=2*$s(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Dt.mass,stiffness:i,damping:l}}else{const s=_z({...e,velocity:0});t={...t,...s,mass:Dt.mass},t.isResolvedFromDuration=!0}return t}function yd(e=Dt.visualDuration,t=Dt.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:i}=s;const l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],d={done:!1,value:l},{stiffness:p,damping:h,mass:y,duration:v,velocity:x,isResolvedFromDuration:w}=zz({...s,velocity:-ls(s.velocity||0)}),N=x||0,T=h/(2*Math.sqrt(p*y)),_=u-l,C=ls(Math.sqrt(p/y)),j=Math.abs(_)<5;a||(a=j?Dt.restSpeed.granular:Dt.restSpeed.default),i||(i=j?Dt.restDelta.granular:Dt.restDelta.default);let E;if(T<1){const R=xm(C,T);E=O=>{const M=Math.exp(-T*C*O);return u-M*((N+T*C*_)/R*Math.sin(R*O)+_*Math.cos(R*O))}}else if(T===1)E=R=>u-Math.exp(-C*R)*(_+(N+C*_)*R);else{const R=C*Math.sqrt(T*T-1);E=O=>{const M=Math.exp(-T*C*O),z=Math.min(R*O,300);return u-M*((N+T*C*_)*Math.sinh(z)+R*_*Math.cosh(z))/R}}const A={calculatedDuration:w&&v||null,next:R=>{const O=E(R);if(w)d.done=R>=v;else{let M=R===0?N:0;T<1&&(M=R===0?ws(N):_N(E,R,O));const z=Math.abs(M)<=a,F=Math.abs(u-O)<=i;d.done=z&&F}return d.value=d.done?u:O,d},toString:()=>{const R=Math.min(Dg(A),gd),O=AN(M=>A.next(R*M).value,R,30);return R+"ms "+O},toTransition:()=>{}};return A}yd.applyToOptions=e=>{const t=Rz(e,100,yd);return e.ease=t.ease,e.duration=ws(t.duration),e.type="keyframes",e};function wm({keyframes:e,velocity:t=0,power:s=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:p,restDelta:h=.5,restSpeed:y}){const v=e[0],x={done:!1,value:v},w=z=>d!==void 0&&z<d||p!==void 0&&z>p,N=z=>d===void 0?p:p===void 0||Math.abs(d-z)<Math.abs(p-z)?d:p;let T=s*t;const _=v+T,C=u===void 0?_:u(_);C!==_&&(T=C-v);const j=z=>-T*Math.exp(-z/a),E=z=>C+j(z),A=z=>{const F=j(z),Z=E(z);x.done=Math.abs(F)<=h,x.value=x.done?C:Z};let R,O;const M=z=>{w(x.value)&&(R=z,O=yd({keyframes:[x.value,N(x.value)],velocity:_N(E,z,x.value),damping:i,stiffness:l,restDelta:h,restSpeed:y}))};return M(0),{calculatedDuration:null,next:z=>{let F=!1;return!O&&R===void 0&&(F=!0,A(z),M(z)),R!==void 0&&z>=R?O.next(z-R):(!F&&A(z),x)}}}function Iz(e,t,s){const a=[],i=s||hr.mix||RN,l=e.length-1;for(let u=0;u<l;u++){let d=i(e[u],e[u+1]);if(t){const p=Array.isArray(t)?t[u]||cs:t;d=Fl(p,d)}a.push(d)}return a}function Lz(e,t,{clamp:s=!0,ease:a,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 d=Iz(t,a,i),p=d.length,h=y=>{if(u&&y<e[0])return t[0];let v=0;if(p>1)for(;v<e.length-2&&!(y<e[v+1]);v++);const x=kl(e[v],e[v+1],y);return d[v](x)};return s?y=>h($s(e[0],e[l-1],y)):h}function Pz(e,t){const s=e[e.length-1];for(let a=1;a<=t;a++){const i=kl(0,t,a);e.push(_t(s,1,i))}}function Uz(e){const t=[0];return Pz(t,e.length-1),t}function Vz(e,t){return e.map(s=>s*t)}function $z(e,t){return e.map(()=>t||yN).splice(0,e.length-1)}function Tl({duration:e=300,keyframes:t,times:s,ease:a="easeInOut"}){const i=JD(a)?a.map(tw):tw(a),l={done:!1,value:t[0]},u=Vz(s&&s.length===t.length?s:Uz(t),e),d=Lz(u,t,{ease:Array.isArray(i)?i:$z(t,i)});return{calculatedDuration:e,next:p=>(l.value=d(p),l.done=p>=e,l)}}const Bz=e=>e!==null;function zg(e,{repeat:t,repeatType:s="loop"},a,i=1){const l=e.filter(Bz),d=i<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!d||a===void 0?l[d]:a}const Zz={decay:wm,inertia:wm,tween:Tl,keyframes:Tl,spring:yd};function kN(e){typeof e.type=="string"&&(e.type=Zz[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 Hz=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!==xn.now()&&this.tick(xn.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;kN(t);const{type:s=Tl,repeat:a=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:d}=t;const p=s||Tl;p!==Tl&&typeof d[0]!="number"&&(this.mixKeyframes=Fl(Hz,RN(d[0],d[1])),d=[0,100]);const h=p({...t,keyframes:d});l==="mirror"&&(this.mirroredGenerator=p({...t,keyframes:[...d].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*(a+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:a,totalDuration:i,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:p}=this;if(this.startTime===null)return a.next(0);const{delay:h=0,keyframes:y,repeat:v,repeatType:x,repeatDelay:w,type:N,onUpdate:T,finalKeyframe:_}=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,A=a;if(v){const z=Math.min(this.currentTime,i)/d;let F=Math.floor(z),Z=z%1;!Z&&z>=1&&(Z=1),Z===1&&F--,F=Math.min(F,v+1),F%2&&(x==="reverse"?(Z=1-Z,w&&(Z-=w/d)):x==="mirror"&&(A=u)),E=$s(0,1,Z)*d}const R=j?{done:!1,value:y[0]}:A.next(E);l&&(R.value=l(R.value));let{done:O}=R;!j&&p!==null&&(O=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return M&&N!==wm&&(R.value=zg(y,this.options,_,this.speed)),T&&T(R.value),M&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return ls(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ls(t)}get time(){return ls(this.currentTime)}set time(t){t=ws(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(xn.now());const s=this.playbackSpeed!==t;this.playbackSpeed=t,s&&(this.time=ls(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Cz,startTime:s}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=s??a),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(xn.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 Fz(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Da=e=>e*180/Math.PI,Sm=e=>{const t=Da(Math.atan2(e[1],e[0]));return Em(t)},qz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Sm,rotateZ:Sm,skewX:e=>Da(Math.atan(e[1])),skewY:e=>Da(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Em=e=>(e=e%360,e<0&&(e+=360),e),lw=Sm,cw=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),uw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Yz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:cw,scaleY:uw,scale:e=>(cw(e)+uw(e))/2,rotateX:e=>Em(Da(Math.atan2(e[6],e[5]))),rotateY:e=>Em(Da(Math.atan2(-e[2],e[0]))),rotateZ:lw,rotate:lw,skewX:e=>Da(Math.atan(e[4])),skewY:e=>Da(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Nm(e){return e.includes("scale")?1:0}function Tm(e,t){if(!e||e==="none")return Nm(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(s)a=Yz,i=s;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=qz,i=d}if(!i)return Nm(t);const l=a[t],u=i[1].split(",").map(Xz);return typeof l=="function"?l(u):u[l]}const Gz=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Tm(s,t)};function Xz(e){return parseFloat(e.trim())}const lo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],co=new Set(lo),dw=e=>e===oo||e===je,Kz=new Set(["x","y","z"]),Wz=lo.filter(e=>!Kz.has(e));function Jz(e){const t=[];return Wz.forEach(s=>{const a=e.getValue(s);a!==void 0&&(t.push([s,a.get()]),a.set(s.startsWith("scale")?1:0))}),t}const Fr={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})=>Tm(t,"x"),y:(e,{transform:t})=>Tm(t,"y")};Fr.translateX=Fr.x;Fr.translateY=Fr.y;const La=new Set;let jm=!1,Cm=!1,Rm=!1;function MN(){if(Cm){const e=Array.from(La).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),s=new Map;t.forEach(a=>{const i=Jz(a);i.length&&(s.set(a,i),a.render())}),e.forEach(a=>a.measureInitialState()),t.forEach(a=>{a.render();const i=s.get(a);i&&i.forEach(([l,u])=>{a.getValue(l)?.set(u)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}Cm=!1,jm=!1,La.forEach(e=>e.complete(Rm)),La.clear()}function ON(){La.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Cm=!0)})}function Qz(){Rm=!0,ON(),MN(),Rm=!1}class Pg{constructor(t,s,a,i,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=a,this.motionValue=i,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(La.add(this),jm||(jm=!0,yt.read(ON),yt.resolveKeyframes(MN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:a,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(a&&s){const d=a.readValue(s,u);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=u),i&&l===void 0&&i.set(t[0])}Fz(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),La.delete(this)}cancel(){this.state==="scheduled"&&(La.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const e3=e=>e.startsWith("--");function t3(e,t,s){e3(t)?e.style.setProperty(t,s):e.style[t]=s}const n3={};function DN(e,t){const s=oN(e);return()=>n3[t]??s()}const s3=DN(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),zN=DN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),pl=([e,t,s,a])=>`cubic-bezier(${e}, ${t}, ${s}, ${a})`,fw={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 IN(e,t){if(e)return typeof e=="function"?zN()?AN(e,t):"ease-out":vN(e)?pl(e):Array.isArray(e)?e.map(s=>IN(s,t)||fw.easeOut):fw[e]}function r3(e,t,s,{delay:a=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:p}={},h=void 0){const y={[t]:s};p&&(y.offset=p);const v=IN(d,i);Array.isArray(v)&&(y.easing=v);const x={delay:a,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 LN(e){return typeof e=="function"&&"applyToOptions"in e}function a3({type:e,...t}){return LN(e)&&zN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class PN extends Ig{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:a,keyframes:i,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:d,onComplete:p}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,jg(typeof t.type!="string");const h=a3(t);this.animation=r3(s,a,i,h,l),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const y=zg(i,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):t3(s,a,y),this.animation.cancel()}p?.(),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 ls(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ls(t)}get time(){return ls(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ws(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&&s3()?(this.animation.timeline=t,cs):s(this)}}const UN={anticipate:pN,backInOut:hN,circInOut:gN};function i3(e){return e in UN}function o3(e){typeof e.ease=="string"&&i3(e.ease)&&(e.ease=UN[e.ease])}const kp=10;class l3 extends PN{constructor(t){o3(t),kN(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:a,onComplete:i,element:l,...u}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const d=new Lg({...u,autoplay:!1}),p=Math.max(kp,xn.now()-this.startTime),h=$s(0,kp,p-kp);s.setWithVelocity(d.sample(Math.max(0,p-h)).value,d.sample(p).value,h),d.stop()}}const hw=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ss.test(e)||e==="0")&&!e.startsWith("url("));function c3(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 u3(e,t,s,a){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=hw(i,t),d=hw(l,t);return!u||!d?!1:c3(e)||(s==="spring"||LN(s))&&a}function Am(e){e.duration=0,e.type="keyframes"}const d3=new Set(["opacity","clipPath","filter","transform"]),f3=oN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function h3(e){const{motionValue:t,name:s,repeatDelay:a,repeatType:i,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:h}=t.owner.getProps();return f3()&&s&&d3.has(s)&&(s!=="transform"||!h)&&!p&&!a&&i!=="mirror"&&l!==0&&u!=="inertia"}const p3=40;class m3 extends Ig{constructor({autoplay:t=!0,delay:s=0,type:a="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:u="loop",keyframes:d,name:p,motionValue:h,element:y,...v}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=xn.now();const x={autoplay:t,delay:s,type:a,repeat:i,repeatDelay:l,repeatType:u,name:p,motionValue:h,element:y,...v},w=y?.KeyframeResolver||Pg;this.keyframeResolver=new w(d,(N,T,_)=>this.onKeyframesResolved(N,T,x,!_),p,h,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,a,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:p,isHandoff:h,onUpdate:y}=a;this.resolvedAt=xn.now(),u3(t,l,u,d)||((hr.instantAnimations||!p)&&y?.(zg(t,a,s)),t[0]=t[t.length-1],Am(a),a.repeat=0);const x={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>p3?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...a,keyframes:t},w=!h&&h3(x),N=x.motionValue?.owner?.current,T=w?new l3({...x,element:N}):new Lg(x);T.finished.then(()=>{this.notifyFinished()}).catch(cs),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(),Qz()),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,a=0,i=1){const l=Array.from(e).sort((h,y)=>h.sortNodePosition(y)).indexOf(t),u=e.size,d=(u-1)*a;return typeof s=="function"?s(l,u):i===1?l*a:d-l*a}const g3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function y3(e){const t=g3.exec(e);if(!t)return[,];const[,s,a,i]=t;return[`--${s??a}`,i]}function $N(e,t,s=1){const[a,i]=y3(e);if(!a)return;const l=window.getComputedStyle(t).getPropertyValue(a);if(l){const u=l.trim();return rN(u)?parseFloat(u):u}return _g(i)?$N(i,t,s+1):i}const v3={type:"spring",stiffness:500,damping:25,restSpeed:10},b3=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),x3={type:"keyframes",duration:.8},w3={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},S3=(e,{keyframes:t})=>t.length>2?x3:co.has(e)?e.startsWith("scale")?b3(t[1]):v3:w3,E3=e=>e!==null;function N3(e,{repeat:t,repeatType:s="loop"},a){const i=e.filter(E3),l=t&&s!=="loop"&&t%2===1?0:i.length-1;return i[l]}function BN(e,t){if(e?.inherit&&t){const{inherit:s,...a}=e;return{...t,...a}}return e}function Ug(e,t){const s=e?.[t]??e?.default??e;return s!==e?BN(s,e):s}function T3({when:e,delay:t,delayChildren:s,staggerChildren:a,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:d,from:p,elapsed:h,...y}){return!!Object.keys(y).length}const Vg=(e,t,s,a={},i,l)=>u=>{const d=Ug(a,e)||{},p=d.delay||a.delay||0;let{elapsed:h=0}=a;h=h-ws(p);const y={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-h,onUpdate:x=>{t.set(x),d.onUpdate&&d.onUpdate(x)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:l?void 0:i};T3(d)||Object.assign(y,S3(e,y)),y.duration&&(y.duration=ws(y.duration)),y.repeatDelay&&(y.repeatDelay=ws(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)),(hr.instantAnimations||hr.skipAnimations||i?.shouldSkipAnimations)&&(v=!0,Am(y),y.delay=0),y.allowFlatten=!d.type&&!d.ease,v&&!l&&t.get()!==void 0){const x=N3(y.keyframes,d);if(x!==void 0){yt.update(()=>{y.onUpdate(x),y.onComplete()});return}}return d.isSync?new Lg(y):new m3(y)};function pw(e){const t=[{},{}];return e?.values.forEach((s,a)=>{t[0][a]=s.get(),t[1][a]=s.getVelocity()}),t}function $g(e,t,s,a){if(typeof t=="function"){const[i,l]=pw(a);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]=pw(a);t=t(s!==void 0?s:e.custom,i,l)}return t}function Gi(e,t,s){const a=e.getProps();return $g(a,t,s!==void 0?s:a.custom,e)}const ZN=new Set(["width","height","top","left","right","bottom",...lo]),mw=30,j3=e=>!isNaN(parseFloat(e));class C3{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=xn.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),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=xn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=j3(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 a=this.events[t].add(s);return t==="change"?()=>{a(),yt.read(()=>{this.events.change.getSize()||this.stop()})}:a}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,a){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}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=xn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>mw)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,mw);return lN(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 Qi(e,t){return new C3(e,t)}const _m=e=>Array.isArray(e);function R3(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,Qi(s))}function A3(e){return _m(e)?e[e.length-1]||0:e}function _3(e,t){const s=Gi(e,t);let{transitionEnd:a={},transition:i={},...l}=s||{};l={...l,...a};for(const u in l){const d=A3(l[u]);R3(e,u,d)}}const fn=e=>!!(e&&e.getVelocity);function k3(e){return!!(fn(e)&&e.add)}function km(e,t){const s=e.getValue("willChange");if(k3(s))return s.add(t);if(!s&&hr.WillChange){const a=new hr.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function Bg(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const M3="framerAppearId",HN="data-"+Bg(M3);function FN(e){return e.props[HN]}function O3({protectedKeys:e,needsAnimating:t},s){const a=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,a}function qN(e,t,{delay:s=0,transitionOverride:a,type:i}={}){let{transition:l,transitionEnd:u,...d}=t;const p=e.getDefaultTransition();l=l?BN(l,p):p;const h=l?.reduceMotion;a&&(l=a);const y=[],v=i&&e.animationState&&e.animationState.getState()[i];for(const x in d){const w=e.getValue(x,e.latestValues[x]??null),N=d[x];if(N===void 0||v&&O3(v,x))continue;const T={delay:s,...Ug(l||{},x)},_=w.get();if(_!==void 0&&!w.isAnimating&&!Array.isArray(N)&&N===_&&!T.velocity)continue;let C=!1;if(window.MotionHandoffAnimation){const A=FN(e);if(A){const R=window.MotionHandoffAnimation(A,x,yt);R!==null&&(T.startTime=R,C=!0)}}km(e,x);const j=h??e.shouldReduceMotion;w.start(Vg(x,w,N,j&&ZN.has(x)?{type:!1}:T,e,C));const E=w.animation;E&&y.push(E)}if(u){const x=()=>yt.update(()=>{u&&_3(e,u)});y.length?Promise.all(y).then(x):x()}return y}function Mm(e,t,s={}){const a=Gi(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};s.transitionOverride&&(i=s.transitionOverride);const l=a?()=>Promise.all(qN(e,a,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(p=0)=>{const{delayChildren:h=0,staggerChildren:y,staggerDirection:v}=i;return D3(e,t,p,h,y,v,s)}:()=>Promise.resolve(),{when:d}=i;if(d){const[p,h]=d==="beforeChildren"?[l,u]:[u,l];return p().then(()=>h())}else return Promise.all([l(),u(s.delay)])}function D3(e,t,s=0,a=0,i=0,l=1,u){const d=[];for(const p of e.variantChildren)p.notify("AnimationStart",t),d.push(Mm(p,t,{...u,delay:s+(typeof a=="function"?0:a)+VN(e.variantChildren,p,a,i,l)}).then(()=>p.notify("AnimationComplete",t)));return Promise.all(d)}function z3(e,t,s={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(l=>Mm(e,l,s));a=Promise.all(i)}else if(typeof t=="string")a=Mm(e,t,s);else{const i=typeof t=="function"?Gi(e,t,s.custom):t;a=Promise.all(qN(e,i,s))}return a.then(()=>{e.notify("AnimationComplete",t)})}const I3={test:e=>e==="auto",parse:e=>e},YN=e=>t=>t.test(e),GN=[oo,je,Us,Vr,dz,uz,I3],gw=e=>GN.find(YN(e));function L3(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||iN(e):!0}const P3=new Set(["brightness","contrast","saturate","opacity"]);function U3(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=s.match(kg)||[];if(!a)return e;const i=s.replace(a,"");let l=P3.has(t)?1:0;return a!==s&&(l*=100),t+"("+l+i+")"}const V3=/\b([a-z-]*)\(.*?\)/gu,Om={...Ss,getAnimatableNone:e=>{const t=e.match(V3);return t?t.map(U3).join(" "):e}},Dm={...Ss,getAnimatableNone:e=>{const t=Ss.parse(e);return Ss.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},yw={...oo,transform:Math.round},$3={rotate:Vr,rotateX:Vr,rotateY:Vr,rotateZ:Vr,scale:Tu,scaleX:Tu,scaleY:Tu,scaleZ:Tu,skew:Vr,skewX:Vr,skewY:Vr,distance:je,translateX:je,translateY:je,translateZ:je,x:je,y:je,z:je,perspective:je,transformPerspective:je,opacity:Ml,originX:sw,originY:sw,originZ:je},Zg={borderWidth:je,borderTopWidth:je,borderRightWidth:je,borderBottomWidth:je,borderLeftWidth:je,borderRadius:je,borderTopLeftRadius:je,borderTopRightRadius:je,borderBottomRightRadius:je,borderBottomLeftRadius:je,width:je,maxWidth:je,height:je,maxHeight:je,top:je,right:je,bottom:je,left:je,inset:je,insetBlock:je,insetBlockStart:je,insetBlockEnd:je,insetInline:je,insetInlineStart:je,insetInlineEnd:je,padding:je,paddingTop:je,paddingRight:je,paddingBottom:je,paddingLeft:je,paddingBlock:je,paddingBlockStart:je,paddingBlockEnd:je,paddingInline:je,paddingInlineStart:je,paddingInlineEnd:je,margin:je,marginTop:je,marginRight:je,marginBottom:je,marginLeft:je,marginBlock:je,marginBlockStart:je,marginBlockEnd:je,marginInline:je,marginInlineStart:je,marginInlineEnd:je,fontSize:je,backgroundPositionX:je,backgroundPositionY:je,...$3,zIndex:yw,fillOpacity:Ml,strokeOpacity:Ml,numOctaves:yw},B3={...Zg,color:Zt,backgroundColor:Zt,outlineColor:Zt,fill:Zt,stroke:Zt,borderColor:Zt,borderTopColor:Zt,borderRightColor:Zt,borderBottomColor:Zt,borderLeftColor:Zt,filter:Om,WebkitFilter:Om,mask:Dm,WebkitMask:Dm},XN=e=>B3[e],Z3=new Set([Om,Dm]);function KN(e,t){let s=XN(e);return Z3.has(s)||(s=Ss),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const H3=new Set(["auto","none","0"]);function F3(e,t,s){let a=0,i;for(;a<e.length&&!i;){const l=e[a];typeof l=="string"&&!H3.has(l)&&Ol(l).values.length&&(i=e[a]),a++}if(i&&s)for(const l of t)e[l]=KN(s,i)}class q3 extends Pg{constructor(t,s,a,i,l){super(t,s,a,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:a}=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=$N(v,s.current);x!==void 0&&(t[y]=x),y===t.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!ZN.has(a)||t.length!==2)return;const[i,l]=t,u=gw(i),d=gw(l),p=nw(i),h=nw(l);if(p!==h&&Fr[a]){this.needsMeasurement=!0;return}if(u!==d)if(dw(u)&&dw(d))for(let y=0;y<t.length;y++){const v=t[y];typeof v=="string"&&(t[y]=parseFloat(v))}else Fr[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,a=[];for(let i=0;i<t.length;i++)(t[i]===null||L3(t[i]))&&a.push(i);a.length&&F3(t,a,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Fr[a](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&t.getValue(a,i).jump(i,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:a}=this;if(!t||!t.current)return;const i=t.getValue(s);i&&i.jump(this.measuredOrigin,!1);const l=a.length-1,u=a[l];a[l]=Fr[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,p])=>{t.getValue(d).set(p)}),this.resolveNoneKeyframes()}}const Y3=new Set(["opacity","clipPath","filter","transform"]);function WN(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const i=s?.[e]??a.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(a=>a!=null)}const JN=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function zm(e){return aN(e)&&"offsetHeight"in e}const{schedule:Hg}=bN(queueMicrotask,!1),bs={x:!1,y:!1};function QN(){return bs.x||bs.y}function G3(e){return e==="x"||e==="y"?bs[e]?null:(bs[e]=!0,()=>{bs[e]=!1}):bs.x||bs.y?null:(bs.x=bs.y=!0,()=>{bs.x=bs.y=!1})}function eT(e,t){const s=WN(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[s,i,()=>a.abort()]}function X3(e){return!(e.pointerType==="touch"||QN())}function K3(e,t,s={}){const[a,i,l]=eT(e,s);return a.forEach(u=>{let d=!1,p=!1,h;const y=()=>{u.removeEventListener("pointerleave",N)},v=_=>{h&&(h(_),h=void 0),y()},x=_=>{d=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),p&&(p=!1,v(_))},w=()=>{d=!0,window.addEventListener("pointerup",x,i),window.addEventListener("pointercancel",x,i)},N=_=>{if(_.pointerType!=="touch"){if(d){p=!0;return}v(_)}},T=_=>{if(!X3(_))return;p=!1;const C=t(u,_);typeof C=="function"&&(h=C,u.addEventListener("pointerleave",N,i))};u.addEventListener("pointerenter",T,i),u.addEventListener("pointerdown",w,i)}),l}const tT=(e,t)=>t?e===t?!0:tT(e,t.parentElement):!1,Fg=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,W3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function J3(e){return W3.has(e.tagName)||e.isContentEditable===!0}const Q3=new Set(["INPUT","SELECT","TEXTAREA"]);function e4(e){return Q3.has(e.tagName)||e.isContentEditable===!0}const qu=new WeakSet;function vw(e){return t=>{t.key==="Enter"&&e(t)}}function Mp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const t4=(e,t)=>{const s=e.currentTarget;if(!s)return;const a=vw(()=>{if(qu.has(s))return;Mp(s,"down");const i=vw(()=>{Mp(s,"up")}),l=()=>Mp(s,"cancel");s.addEventListener("keyup",i,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",a,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",a),t)};function bw(e){return Fg(e)&&!QN()}const xw=new WeakSet;function n4(e,t,s={}){const[a,i,l]=eT(e,s),u=d=>{const p=d.currentTarget;if(!bw(d)||xw.has(d))return;qu.add(p),s.stopPropagation&&xw.add(d);const h=t(p,d),y=(w,N)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",x),qu.has(p)&&qu.delete(p),bw(w)&&typeof h=="function"&&h(w,{success:N})},v=w=>{y(w,p===window||p===document||s.useGlobalTarget||tT(p,w.target))},x=w=>{y(w,!1)};window.addEventListener("pointerup",v,i),window.addEventListener("pointercancel",x,i)};return a.forEach(d=>{(s.useGlobalTarget?window:d).addEventListener("pointerdown",u,i),zm(d)&&(d.addEventListener("focus",h=>t4(h,i)),!J3(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function qg(e){return aN(e)&&"ownerSVGElement"in e}const Yu=new WeakMap;let Gu;const nT=(e,t,s)=>(a,i)=>i&&i[0]?i[0][e+"Size"]:qg(a)&&"getBBox"in a?a.getBBox()[t]:a[s],s4=nT("inline","width","offsetWidth"),r4=nT("block","height","offsetHeight");function a4({target:e,borderBoxSize:t}){Yu.get(e)?.forEach(s=>{s(e,{get width(){return s4(e,t)},get height(){return r4(e,t)}})})}function i4(e){e.forEach(a4)}function o4(){typeof ResizeObserver>"u"||(Gu=new ResizeObserver(i4))}function l4(e,t){Gu||o4();const s=WN(e);return s.forEach(a=>{let i=Yu.get(a);i||(i=new Set,Yu.set(a,i)),i.add(t),Gu?.observe(a)}),()=>{s.forEach(a=>{const i=Yu.get(a);i?.delete(t),i?.size||Gu?.unobserve(a)})}}const Xu=new Set;let Ui;function c4(){Ui=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Xu.forEach(t=>t(e))},window.addEventListener("resize",Ui)}function u4(e){return Xu.add(e),Ui||c4(),()=>{Xu.delete(e),!Xu.size&&typeof Ui=="function"&&(window.removeEventListener("resize",Ui),Ui=void 0)}}function ww(e,t){return typeof e=="function"?u4(e):l4(e,t)}function d4(e){return qg(e)&&e.tagName==="svg"}const f4=[...GN,Zt,Ss],h4=e=>f4.find(YN(e)),Sw=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vi=()=>({x:Sw(),y:Sw()}),Ew=()=>({min:0,max:0}),Gt=()=>({x:Ew(),y:Ew()}),p4=new WeakMap;function Bd(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Dl(e){return typeof e=="string"||Array.isArray(e)}const Yg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Gg=["initial",...Yg];function Zd(e){return Bd(e.animate)||Gg.some(t=>Dl(e[t]))}function sT(e){return!!(Zd(e)||e.variants)}function m4(e,t,s){for(const a in t){const i=t[a],l=s[a];if(fn(i))e.addValue(a,i);else if(fn(l))e.addValue(a,Qi(i,{owner:e}));else if(l!==i)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(a);e.addValue(a,Qi(u!==void 0?u:i,{owner:e}))}}for(const a in s)t[a]===void 0&&e.removeValue(a);return t}const Im={current:null},rT={current:!1},g4=typeof window<"u";function y4(){if(rT.current=!0,!!g4)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Im.current=e.matches;e.addEventListener("change",t),t()}else Im.current=!1}const Nw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let vd={};function aT(e){vd=e}function v4(){return vd}class b4{scrapeMotionValuesFromProps(t,s,a){return{}}constructor({parent:t,props:s,presenceContext:a,reducedMotionConfig:i,skipAnimations:l,blockInitialAnimation:u,visualState:d},p={}){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=xn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,yt.render(this.render,!1,!0))};const{latestValues:h,renderState:y}=d;this.latestValues=h,this.baseTarget={...h},this.initialValues=s.initial?{...h}:{},this.renderState=y,this.parent=t,this.props=s,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=l,this.options=p,this.blockInitialAnimation=!!u,this.isControllingVariants=Zd(s),this.isVariantNode=sT(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&&fn(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,p4.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,a)=>this.bindToMotionValue(a,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(rT.current||y4(),this.shouldReduceMotion=Im.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(),Wr(this.notifyUpdate),Wr(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&&Y3.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:d,times:p,ease:h,duration:y}=s.accelerate,v=new PN({element:this.current,name:t,keyframes:d,times:p,ease:h,duration:ws(y)}),x=u(v);this.valueSubscriptions.set(t,()=>{x(),v.cancel()});return}const a=co.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&yt.preRender(this.notifyUpdate),a&&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:a,Feature:i}=s;if(!this.features[t]&&i&&a(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):Gt()}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 a=0;a<Nw.length;a++){const i=Nw[a];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=m4(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 a=this.values.get(t);s!==a&&(a&&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 a=this.values.get(t);return a===void 0&&s!==void 0&&(a=Qi(s===null?void 0:s,{owner:this}),this.addValue(t,a)),a}readValue(t,s){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(rN(a)||iN(a))?a=parseFloat(a):!h4(a)&&Ss.test(s)&&(a=KN(t,s)),this.setBaseTarget(t,fn(a)?a.get():a)),fn(a)?a.get():a}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let a;if(typeof s=="string"||typeof s=="object"){const l=$g(this.props,s,this.presenceContext?.custom);l&&(a=l[t])}if(s&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!fn(i)?i:this.initialValues[t]!==void 0&&a===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 iT extends b4{constructor(){super(...arguments),this.KeyframeResolver=q3}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const a=t.style;return a?a[s]:void 0}removeValueFromRenderState(t,{vars:s,style:a}){delete s[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;fn(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class aa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function oT({top:e,left:t,right:s,bottom:a}){return{x:{min:t,max:s},y:{min:e,max:a}}}function x4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function w4(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:a.y,right:a.x}}function Op(e){return e===void 0||e===1}function Lm({scale:e,scaleX:t,scaleY:s}){return!Op(e)||!Op(t)||!Op(s)}function ka(e){return Lm(e)||lT(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function lT(e){return Tw(e.x)||Tw(e.y)}function Tw(e){return e&&e!=="0%"}function bd(e,t,s){const a=e-s,i=t*a;return s+i}function jw(e,t,s,a,i){return i!==void 0&&(e=bd(e,i,a)),bd(e,s,a)+t}function Pm(e,t=0,s=1,a,i){e.min=jw(e.min,t,s,a,i),e.max=jw(e.max,t,s,a,i)}function cT(e,{x:t,y:s}){Pm(e.x,t.translate,t.scale,t.originPoint),Pm(e.y,s.translate,s.scale,s.originPoint)}const Cw=.999999999999,Rw=1.0000000000001;function S4(e,t,s,a=!1){const i=s.length;if(!i)return;t.x=t.y=1;let l,u;for(let d=0;d<i;d++){l=s[d],u=l.projectionDelta;const{visualElement:p}=l.options;p&&p.props.style&&p.props.style.display==="contents"||(a&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Bi(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,cT(e,u)),a&&ka(l.latestValues)&&Bi(e,l.latestValues))}t.x<Rw&&t.x>Cw&&(t.x=1),t.y<Rw&&t.y>Cw&&(t.y=1)}function $i(e,t){e.min=e.min+t,e.max=e.max+t}function Aw(e,t,s,a,i=.5){const l=_t(e.min,e.max,i);Pm(e,t,s,l,a)}function Bi(e,t){Aw(e.x,t.x,t.scaleX,t.scale,t.originX),Aw(e.y,t.y,t.scaleY,t.scale,t.originY)}function uT(e,t){return oT(w4(e.getBoundingClientRect(),t))}function E4(e,t,s){const a=uT(e,s),{scroll:i}=t;return i&&($i(a.x,i.offset.x),$i(a.y,i.offset.y)),a}const N4={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},T4=lo.length;function j4(e,t,s){let a="",i=!0;for(let l=0;l<T4;l++){const u=lo[l],d=e[u];if(d===void 0)continue;let p=!0;if(typeof d=="number")p=d===(u.startsWith("scale")?1:0);else{const h=parseFloat(d);p=u.startsWith("scale")?h===1:h===0}if(!p||s){const h=JN(d,Zg[u]);if(!p){i=!1;const y=N4[u]||u;a+=`${y}(${h}) `}s&&(t[u]=h)}}return a=a.trim(),s?a=s(t,i?"":a):i&&(a="none"),a}function Xg(e,t,s){const{style:a,vars:i,transformOrigin:l}=e;let u=!1,d=!1;for(const p in t){const h=t[p];if(co.has(p)){u=!0;continue}else if(wN(p)){i[p]=h;continue}else{const y=JN(h,Zg[p]);p.startsWith("origin")?(d=!0,l[p]=y):a[p]=y}}if(t.transform||(u||s?a.transform=j4(t,e.transform,s):a.transform&&(a.transform="none")),d){const{originX:p="50%",originY:h="50%",originZ:y=0}=l;a.transformOrigin=`${p} ${h} ${y}`}}function dT(e,{style:t,vars:s},a,i){const l=e.style;let u;for(u in t)l[u]=t[u];i?.applyProjectionStyles(l,a);for(u in s)l.setProperty(u,s[u])}function _w(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ul={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(je.test(e))e=parseFloat(e);else return e;const s=_w(e,t.target.x),a=_w(e,t.target.y);return`${s}% ${a}%`}},C4={correct:(e,{treeScale:t,projectionDelta:s})=>{const a=e,i=Ss.parse(e);if(i.length>5)return a;const l=Ss.createTransformer(e),u=typeof i[0]!="number"?1:0,d=s.x.scale*t.x,p=s.y.scale*t.y;i[0+u]/=d,i[1+u]/=p;const h=_t(d,p,.5);return typeof i[2+u]=="number"&&(i[2+u]/=h),typeof i[3+u]=="number"&&(i[3+u]/=h),l(i)}},Um={borderRadius:{...ul,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ul,borderTopRightRadius:ul,borderBottomLeftRadius:ul,borderBottomRightRadius:ul,boxShadow:C4};function fT(e,{layout:t,layoutId:s}){return co.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Um[e]||e==="opacity")}function Kg(e,t,s){const a=e.style,i=t?.style,l={};if(!a)return l;for(const u in a)(fn(a[u])||i&&fn(i[u])||fT(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=a[u]);return l}function R4(e){return window.getComputedStyle(e)}class A4 extends iT{constructor(){super(...arguments),this.type="html",this.renderInstance=dT}readValueFromInstance(t,s){if(co.has(s))return this.projection?.isProjecting?Nm(s):Gz(t,s);{const a=R4(t),i=(wN(s)?a.getPropertyValue(s):a[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:s}){return uT(t,s)}build(t,s,a){Xg(t,s,a.transformTemplate)}scrapeMotionValuesFromProps(t,s,a){return Kg(t,s,a)}}const _4={offset:"stroke-dashoffset",array:"stroke-dasharray"},k4={offset:"strokeDashoffset",array:"strokeDasharray"};function M4(e,t,s=1,a=0,i=!0){e.pathLength=1;const l=i?_4:k4;e[l.offset]=`${-a}`,e[l.array]=`${t} ${s}`}const O4=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function hT(e,{attrX:t,attrY:s,attrScale:a,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...d},p,h,y){if(Xg(e,d,h),p){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 O4)v[w]!==void 0&&(x[w]=v[w],delete v[w]);t!==void 0&&(v.x=t),s!==void 0&&(v.y=s),a!==void 0&&(v.scale=a),i!==void 0&&M4(v,i,l,u,!1)}const pT=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"]),mT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function D4(e,t,s,a){dT(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(pT.has(i)?i:Bg(i),t.attrs[i])}function gT(e,t,s){const a=Kg(e,t,s);for(const i in e)if(fn(e[i])||fn(t[i])){const l=lo.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[l]=e[i]}return a}class z4 extends iT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Gt}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(co.has(s)){const a=XN(s);return a&&a.default||0}return s=pT.has(s)?s:Bg(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,a){return gT(t,s,a)}build(t,s,a){hT(t,s,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,s,a,i){D4(t,s,a,i)}mount(t){this.isSVGTag=mT(t.tagName),super.mount(t)}}const I4=Gg.length;function yT(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?yT(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<I4;s++){const a=Gg[s],i=e.props[a];(Dl(i)||i===!1)&&(t[a]=i)}return t}function vT(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let a=0;a<s;a++)if(t[a]!==e[a])return!1;return!0}const L4=[...Yg].reverse(),P4=Yg.length;function U4(e){return t=>Promise.all(t.map(({animation:s,options:a})=>z3(e,s,a)))}function V4(e){let t=U4(e),s=kw(),a=!0;const i=p=>(h,y)=>{const v=Gi(e,y,p==="exit"?e.presenceContext?.custom:void 0);if(v){const{transition:x,transitionEnd:w,...N}=v;h={...h,...N,...w}}return h};function l(p){t=p(e)}function u(p){const{props:h}=e,y=yT(e.parent)||{},v=[],x=new Set;let w={},N=1/0;for(let _=0;_<P4;_++){const C=L4[_],j=s[C],E=h[C]!==void 0?h[C]:y[C],A=Dl(E),R=C===p?j.isActive:null;R===!1&&(N=_);let O=E===y[C]&&E!==h[C]&&A;if(O&&a&&e.manuallyAnimateOnMount&&(O=!1),j.protectedKeys={...w},!j.isActive&&R===null||!E&&!j.prevProp||Bd(E)||typeof E=="boolean")continue;if(C==="exit"&&j.isActive&&R!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const M=$4(j.prevProp,E);let z=M||C===p&&j.isActive&&!O&&A||_>N&&A,F=!1;const Z=Array.isArray(E)?E:[E];let U=Z.reduce(i(C),{});R===!1&&(U={});const{prevResolvedValues:H={}}=j,W={...H,...U},oe=B=>{z=!0,x.has(B)&&(F=!0,x.delete(B)),j.needsAnimating[B]=!0;const $=e.getValue(B);$&&($.liveStyle=!1)};for(const B in W){const $=U[B],re=H[B];if(w.hasOwnProperty(B))continue;let J=!1;_m($)&&_m(re)?J=!vT($,re):J=$!==re,J?$!=null?oe(B):x.add(B):$!==void 0&&x.has(B)?oe(B):j.protectedKeys[B]=!0}j.prevProp=E,j.prevResolvedValues=U,j.isActive&&(w={...w,...U}),a&&e.blockInitialAnimation&&(z=!1);const ee=O&&M;z&&(!ee||F)&&v.push(...Z.map(B=>{const $={type:C};if(typeof B=="string"&&a&&!ee&&e.manuallyAnimateOnMount&&e.parent){const{parent:re}=e,J=Gi(re,B);if(re.enteringChildren&&J){const{delayChildren:D}=J.transition||{};$.delay=VN(re.enteringChildren,e,D)}}return{animation:B,options:$}}))}if(x.size){const _={};if(typeof h.initial!="boolean"){const C=Gi(e,Array.isArray(h.initial)?h.initial[0]:h.initial);C&&C.transition&&(_.transition=C.transition)}x.forEach(C=>{const j=e.getBaseTarget(C),E=e.getValue(C);E&&(E.liveStyle=!0),_[C]=j??null}),v.push({animation:_})}let T=!!v.length;return a&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(T=!1),a=!1,T?t(v):Promise.resolve()}function d(p,h){if(s[p].isActive===h)return Promise.resolve();e.variantChildren?.forEach(v=>v.animationState?.setActive(p,h)),s[p].isActive=h;const y=u(p);for(const v in s)s[v].protectedKeys={};return y}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>s,reset:()=>{s=kw()}}}function $4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!vT(t,e):!1}function Ca(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kw(){return{animate:Ca(!0),whileInView:Ca(),whileHover:Ca(),whileTap:Ca(),whileDrag:Ca(),whileFocus:Ca(),exit:Ca()}}function Mw(e,t){e.min=t.min,e.max=t.max}function gs(e,t){Mw(e.x,t.x),Mw(e.y,t.y)}function Ow(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const bT=1e-4,B4=1-bT,Z4=1+bT,xT=.01,H4=0-xT,F4=0+xT;function wn(e){return e.max-e.min}function q4(e,t,s){return Math.abs(e-t)<=s}function Dw(e,t,s,a=.5){e.origin=a,e.originPoint=_t(t.min,t.max,e.origin),e.scale=wn(s)/wn(t),e.translate=_t(s.min,s.max,e.origin)-e.originPoint,(e.scale>=B4&&e.scale<=Z4||isNaN(e.scale))&&(e.scale=1),(e.translate>=H4&&e.translate<=F4||isNaN(e.translate))&&(e.translate=0)}function jl(e,t,s,a){Dw(e.x,t.x,s.x,a?a.originX:void 0),Dw(e.y,t.y,s.y,a?a.originY:void 0)}function zw(e,t,s){e.min=s.min+t.min,e.max=e.min+wn(t)}function Y4(e,t,s){zw(e.x,t.x,s.x),zw(e.y,t.y,s.y)}function Iw(e,t,s){e.min=t.min-s.min,e.max=e.min+wn(t)}function xd(e,t,s){Iw(e.x,t.x,s.x),Iw(e.y,t.y,s.y)}function Lw(e,t,s,a,i){return e-=t,e=bd(e,1/s,a),i!==void 0&&(e=bd(e,1/i,a)),e}function G4(e,t=0,s=1,a=.5,i,l=e,u=e){if(Us.test(t)&&(t=parseFloat(t),t=_t(u.min,u.max,t/100)-u.min),typeof t!="number")return;let d=_t(l.min,l.max,a);e===l&&(d-=t),e.min=Lw(e.min,t,s,d,i),e.max=Lw(e.max,t,s,d,i)}function Pw(e,t,[s,a,i],l,u){G4(e,t[s],t[a],t[i],t.scale,l,u)}const X4=["x","scaleX","originX"],K4=["y","scaleY","originY"];function Uw(e,t,s,a){Pw(e.x,t,X4,s?s.x:void 0,a?a.x:void 0),Pw(e.y,t,K4,s?s.y:void 0,a?a.y:void 0)}function Vw(e){return e.translate===0&&e.scale===1}function wT(e){return Vw(e.x)&&Vw(e.y)}function $w(e,t){return e.min===t.min&&e.max===t.max}function W4(e,t){return $w(e.x,t.x)&&$w(e.y,t.y)}function Bw(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ST(e,t){return Bw(e.x,t.x)&&Bw(e.y,t.y)}function Zw(e){return wn(e.x)/wn(e.y)}function Hw(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Os(e){return[e("x"),e("y")]}function J4(e,t,s){let a="";const i=e.x.translate/t.x,l=e.y.translate/t.y,u=s?.z||0;if((i||l||u)&&(a=`translate3d(${i}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:h,rotate:y,rotateX:v,rotateY:x,skewX:w,skewY:N}=s;h&&(a=`perspective(${h}px) ${a}`),y&&(a+=`rotate(${y}deg) `),v&&(a+=`rotateX(${v}deg) `),x&&(a+=`rotateY(${x}deg) `),w&&(a+=`skewX(${w}deg) `),N&&(a+=`skewY(${N}deg) `)}const d=e.x.scale*t.x,p=e.y.scale*t.y;return(d!==1||p!==1)&&(a+=`scale(${d}, ${p})`),a||"none"}const ET=["TopLeft","TopRight","BottomLeft","BottomRight"],Q4=ET.length,Fw=e=>typeof e=="string"?parseFloat(e):e,qw=e=>typeof e=="number"||je.test(e);function eI(e,t,s,a,i,l){i?(e.opacity=_t(0,s.opacity??1,tI(a)),e.opacityExit=_t(t.opacity??1,0,nI(a))):l&&(e.opacity=_t(t.opacity??1,s.opacity??1,a));for(let u=0;u<Q4;u++){const d=`border${ET[u]}Radius`;let p=Yw(t,d),h=Yw(s,d);if(p===void 0&&h===void 0)continue;p||(p=0),h||(h=0),p===0||h===0||qw(p)===qw(h)?(e[d]=Math.max(_t(Fw(p),Fw(h),a),0),(Us.test(h)||Us.test(p))&&(e[d]+="%")):e[d]=h}(t.rotate||s.rotate)&&(e.rotate=_t(t.rotate||0,s.rotate||0,a))}function Yw(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const tI=NT(0,.5,mN),nI=NT(.5,.95,cs);function NT(e,t,s){return a=>a<e?0:a>t?1:s(kl(e,t,a))}function sI(e,t,s){const a=fn(e)?e:Qi(e);return a.start(Vg("",a,t,s)),a.animation}function zl(e,t,s,a={passive:!0}){return e.addEventListener(t,s,a),()=>e.removeEventListener(t,s)}const rI=(e,t)=>e.depth-t.depth;class aI{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(rI),this.isDirty=!1,this.children.forEach(t)}}function iI(e,t){const s=xn.now(),a=({timestamp:i})=>{const l=i-s;l>=t&&(Wr(a),e(l-t))};return yt.setup(a,!0),()=>Wr(a)}function Ku(e){return fn(e)?e.get():e}class oI{constructor(){this.members=[]}add(t){Tg(this.members,t);for(let s=this.members.length-1;s>=0;s--){const a=this.members[s];if(a===t||a===this.lead||a===this.prevLead)continue;const i=a.instance;i&&i.isConnected===!1&&a.isPresent!==!1&&!a.snapshot&&pd(this.members,a)}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 a;for(let i=s;i>=0;i--){const l=this.members[i],u=l.instance;if(l.isPresent!==!1&&(!u||u.isConnected!==!1)){a=l;break}}return a?(this.promote(a),!0):!1}promote(t,s){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.instance&&a.scheduleRender(),t.scheduleRender();const i=a.options.layoutDependency,l=t.options.layoutDependency;if(!(i!==void 0&&l!==void 0&&i===l)){const p=a.instance;p&&p.isConnected===!1&&!a.snapshot||(t.resumeFrom=a,s&&(t.resumeFrom.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:d}=t.options;d===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:s,resumingFrom:a}=t;s.onExitComplete&&s.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Wu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Dp=["","X","Y","Z"],lI=1e3;let cI=0;function zp(e,t,s,a){const{latestValues:i}=t;i[e]&&(s[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function TT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=FN(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",yt,!(i||l))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&TT(a)}function jT({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},d=t?.()){this.id=cI++,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(fI),this.nodes.forEach(gI),this.nodes.forEach(yI),this.nodes.forEach(hI)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new aI)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Cg),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const p=this.eventHandlers.get(u);p&&p.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=qg(u)&&!d4(u),this.instance=u;const{layoutId:d,layout:p,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&&(p||d)&&(this.isLayoutDirty=!0),e){let y,v=0;const x=()=>this.root.updateBlockedByResize=!1;yt.read(()=>{v=window.innerWidth}),e(u,()=>{const w=window.innerWidth;w!==v&&(v=w,this.root.updateBlockedByResize=!0,y&&y(),y=iI(x,250),Wu.hasAnimatedSinceResize&&(Wu.hasAnimatedSinceResize=!1,this.nodes.forEach(Kw)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&h&&(d||p)&&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()||SI,{onLayoutAnimationStart:T,onLayoutAnimationComplete:_}=h.getProps(),C=!this.targetLayout||!ST(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={...Ug(N,"layout"),onPlay:T,onComplete:_};(h.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(y,j)}else v||Kw(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(),Wr(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(vI),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&&TT(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:d,layout:p}=this.options;if(d===void 0&&!p)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(Gw);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Xw);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(mI),this.nodes.forEach(uI),this.nodes.forEach(dI)):this.nodes.forEach(Xw),this.clearAllSnapshots();const d=xn.now();an.delta=$s(0,1e3/60,d-an.timestamp),an.timestamp=d,an.isProcessing=!0,jp.update.process(an),jp.preRender.process(an),jp.render.process(an),an.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Hg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pI),this.sharedNodes.forEach(bI)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,yt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){yt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!wn(this.snapshot.measuredBox.x)&&!wn(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 p=0;p<this.path.length;p++)this.path[p].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Gt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const p=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:p,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:p}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!wT(this.projectionDelta),p=this.getTransformTemplate(),h=p?p(this.latestValues,""):void 0,y=h!==this.prevTransformTemplateValue;u&&this.instance&&(d||ka(this.latestValues)||y)&&(i(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let p=this.removeElementScroll(d);return u&&(p=this.removeTransform(p)),EI(p),{animationId:this.root.animationId,measuredBox:d,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Gt();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(NI))){const{scroll:h}=this.root;h&&($i(d.x,h.offset.x),$i(d.y,h.offset.y))}return d}removeElementScroll(u){const d=Gt();if(gs(d,u),this.scroll?.wasRoot)return d;for(let p=0;p<this.path.length;p++){const h=this.path[p],{scroll:y,options:v}=h;h!==this.root&&y&&v.layoutScroll&&(y.wasRoot&&gs(d,u),$i(d.x,y.offset.x),$i(d.y,y.offset.y))}return d}applyTransform(u,d=!1){const p=Gt();gs(p,u);for(let h=0;h<this.path.length;h++){const y=this.path[h];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&Bi(p,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ka(y.latestValues)&&Bi(p,y.latestValues)}return ka(this.latestValues)&&Bi(p,this.latestValues),p}removeTransform(u){const d=Gt();gs(d,u);for(let p=0;p<this.path.length;p++){const h=this.path[p];if(!h.instance||!ka(h.latestValues))continue;Lm(h.latestValues)&&h.updateSnapshot();const y=Gt(),v=h.measurePageBox();gs(y,v),Uw(d,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,y)}return ka(this.latestValues)&&Uw(d,this.latestValues),d}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!==an.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const p=!!this.resumingFrom||this!==d;if(!(u||p&&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=an.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=Gt(),this.targetWithTransforms=Gt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Y4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):gs(this.target,this.layout.layoutBox),cT(this.target,this.targetDelta)):gs(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||Lm(this.parent.latestValues)||lT(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,d,p){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Gt(),this.relativeTargetOrigin=Gt(),xd(this.relativeTargetOrigin,d,p),gs(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),d=!!this.resumingFrom||this!==u;let p=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(p=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(p=!1),this.resolvedRelativeTargetAt===an.timestamp&&(p=!1),p)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;gs(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,x=this.treeScale.y;S4(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Gt());const{target:w}=u;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ow(this.prevProjectionDelta.x,this.projectionDelta.x),Ow(this.prevProjectionDelta.y,this.projectionDelta.y)),jl(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==x||!Hw(this.projectionDelta.x,this.prevProjectionDelta.x)||!Hw(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 d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Vi(),this.projectionDelta=Vi(),this.projectionDeltaWithTransform=Vi()}setAnimationOrigin(u,d=!1){const p=this.snapshot,h=p?p.latestValues:{},y={...this.latestValues},v=Vi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const x=Gt(),w=p?p.source:void 0,N=this.layout?this.layout.source:void 0,T=w!==N,_=this.getStack(),C=!_||_.members.length<=1,j=!!(T&&!C&&this.options.crossfade===!0&&!this.path.some(wI));this.animationProgress=0;let E;this.mixTargetDelta=A=>{const R=A/1e3;Ww(v.x,u.x,R),Ww(v.y,u.y,R),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(xd(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),xI(this.relativeTarget,this.relativeTargetOrigin,x,R),E&&W4(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Gt()),gs(E,this.relativeTarget)),T&&(this.animationValues=y,eI(y,h,this.latestValues,R,j,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Wr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=yt.update(()=>{Wu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Qi(0)),this.motionValue.jump(0,!1),this.currentAnimation=sI(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},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(lI),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:p,layout:h,latestValues:y}=u;if(!(!d||!p||!h)){if(this!==u&&this.layout&&h&&CT(this.options.animationType,this.layout.layoutBox,h.layoutBox)){p=this.target||Gt();const v=wn(this.layout.layoutBox.x);p.x.min=u.target.x.min,p.x.max=p.x.min+v;const x=wn(this.layout.layoutBox.y);p.y.min=u.target.y.min,p.y.max=p.y.min+x}gs(d,p),Bi(d,y),jl(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new oI),this.sharedNodes.get(u).add(d);const h=d.options.initialPromotionConfig;d.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(d):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:d,preserveFollowOpacity:p}={}){const h=this.getStack();h&&h.promote(this,p),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:p}=u;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(d=!0),!d)return;const h={};p.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,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const p=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Ku(d?.pointerEvents)||"",u.transform=p?p(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=Ku(d?.pointerEvents)||""),this.hasProjected&&!ka(this.latestValues)&&(u.transform=p?p({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=h.animationValues||h.latestValues;this.applyTransformsToTarget();let v=J4(this.projectionDeltaWithTransform,this.treeScale,y);p&&(v=p(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 Um){if(y[N]===void 0)continue;const{correct:T,applyTo:_,isCSSVariable:C}=Um[N],j=v==="none"?y[N]:T(y[N],h);if(_){const E=_.length;for(let A=0;A<E;A++)u[_[A]]=j}else C?this.options.visualElement.renderState.vars[N]=j:u[N]=j}this.options.layoutId&&(u.pointerEvents=h===this?Ku(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(Gw),this.root.sharedNodes.clear()}}}function uI(e){e.updateLayout()}function dI(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:a}=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=wn(v);v.min=s[y].min,v.max=v.min+x}):CT(i,t.layoutBox,s)&&Os(y=>{const v=l?t.measuredBox[y]:t.layoutBox[y],x=wn(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 d=Vi();l?jl(d,e.applyTransform(a,!0),t.measuredBox):jl(d,s,t.layoutBox);const p=!wT(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=Gt();xd(w,t.layoutBox,v.layoutBox);const N=Gt();xd(N,s,x.layoutBox),ST(w,N)||(h=!0),y.options.layoutRoot&&(e.relativeTarget=N,e.relativeTargetOrigin=w,e.relativeParent=y)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:d,layoutDelta:u,hasLayoutChanged:p,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function fI(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 hI(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function pI(e){e.clearSnapshot()}function Gw(e){e.clearMeasurements()}function Xw(e){e.isLayoutDirty=!1}function mI(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Kw(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function gI(e){e.resolveTargetDelta()}function yI(e){e.calcProjection()}function vI(e){e.resetSkewAndRotation()}function bI(e){e.removeLeadSnapshot()}function Ww(e,t,s){e.translate=_t(t.translate,0,s),e.scale=_t(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function Jw(e,t,s,a){e.min=_t(t.min,s.min,a),e.max=_t(t.max,s.max,a)}function xI(e,t,s,a){Jw(e.x,t.x,s.x,a),Jw(e.y,t.y,s.y,a)}function wI(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const SI={duration:.45,ease:[.4,0,.1,1]},Qw=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),e1=Qw("applewebkit/")&&!Qw("chrome/")?Math.round:cs;function t1(e){e.min=e1(e.min),e.max=e1(e.max)}function EI(e){t1(e.x),t1(e.y)}function CT(e,t,s){return e==="position"||e==="preserve-aspect"&&!q4(Zw(t),Zw(s),.2)}function NI(e){return e!==e.root&&e.scroll?.wasRoot}const TI=jT({attachResizeListener:(e,t)=>zl(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=jT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ip.current){const e=new TI({});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 n1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jI(...e){return t=>{let s=!1;const a=e.map(i=>{const l=n1(i,t);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let i=0;i<a.length;i++){const l=a[i];typeof l=="function"?l():n1(e[i],null)}}}}function CI(...e){return b.useCallback(jI(...e),e)}class RI extends b.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=s.offsetParent,i=zm(a)&&a.offsetWidth||0,l=zm(a)&&a.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 AI({children:e,isPresent:t,anchorX:s,anchorY:a,root:i,pop:l}){const u=b.useId(),d=b.useRef(null),p=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=CI(d,y);return b.useInsertionEffect(()=>{const{width:x,height:w,top:N,left:T,right:_,bottom:C}=p.current;if(t||l===!1||!d.current||!x||!w)return;const j=s==="left"?`left: ${T}`:`right: ${_}`,E=a==="bottom"?`bottom: ${C}`:`top: ${N}`;d.current.dataset.motionPopId=u;const A=document.createElement("style");h&&(A.nonce=h);const R=i??document.head;return R.appendChild(A),A.sheet&&A.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
|
+
`),()=>{R.contains(A)&&R.removeChild(A)}},[t]),f.jsx(RI,{isPresent:t,childRef:d,sizeRef:p,pop:l,children:l===!1?e:b.cloneElement(e,{ref:v})})}const _I=({children:e,initial:t,isPresent:s,onExitComplete:a,custom:i,presenceAffectsLayout:l,mode:u,anchorX:d,anchorY:p,root:h})=>{const y=Ng(kI),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;a&&a()},register:N=>(y.set(N,!1),()=>y.delete(N))}),[s,y,a]);return l&&x&&(w={...w}),b.useMemo(()=>{y.forEach((N,T)=>y.set(T,!1))},[s]),b.useEffect(()=>{!s&&!y.size&&a&&a()},[s]),e=f.jsx(AI,{pop:u==="popLayout",isPresent:s,anchorX:d,anchorY:p,root:h,children:e}),f.jsx($d.Provider,{value:w,children:e})};function kI(){return new Map}function AT(e=!0){const t=b.useContext($d);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:a,register:i}=t,l=b.useId();b.useEffect(()=>{if(e)return i(l)},[e]);const u=b.useCallback(()=>e&&a&&a(l),[l,a,e]);return!s&&a?[!1,u]:[!0]}const ju=e=>e.key||"";function s1(e){const t=[];return b.Children.forEach(e,s=>{b.isValidElement(s)&&t.push(s)}),t}const MI=({children:e,custom:t,initial:s=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:l="sync",propagate:u=!1,anchorX:d="left",anchorY:p="top",root:h})=>{const[y,v]=AT(u),x=b.useMemo(()=>s1(e),[e]),w=u&&!y?[]:x.map(ju),N=b.useRef(!0),T=b.useRef(x),_=Ng(()=>new Map),C=b.useRef(new Set),[j,E]=b.useState(x),[A,R]=b.useState(x);sN(()=>{N.current=!1,T.current=x;for(let z=0;z<A.length;z++){const F=ju(A[z]);w.includes(F)?(_.delete(F),C.current.delete(F)):_.get(F)!==!0&&_.set(F,!1)}},[A,w.length,w.join("-")]);const O=[];if(x!==j){let z=[...x];for(let F=0;F<A.length;F++){const Z=A[F],U=ju(Z);w.includes(U)||(z.splice(F,0,Z),O.push(Z))}return l==="wait"&&O.length&&(z=O),R(s1(z)),E(x),null}const{forceRender:M}=b.useContext(Eg);return f.jsx(f.Fragment,{children:A.map(z=>{const F=ju(z),Z=u&&!y?!1:x===A||w.includes(F),U=()=>{if(C.current.has(F))return;if(C.current.add(F),_.has(F))_.set(F,!0);else return;let H=!0;_.forEach(W=>{W||(H=!1)}),H&&(M?.(),R(T.current),u&&v?.(),a&&a())};return f.jsx(_I,{isPresent:Z,initial:!N.current||s?void 0:!1,custom:t,presenceAffectsLayout:i,mode:l,root:h,onExitComplete:Z?void 0:U,anchorX:d,anchorY:p,children:z},F)})})},_T=b.createContext({strict:!1}),r1={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 a1=!1;function OI(){if(a1)return;const e={};for(const t in r1)e[t]={isEnabled:s=>r1[t].some(a=>!!s[a])};aT(e),a1=!0}function kT(){return OI(),v4()}function DI(e){const t=kT();for(const s in e)t[s]={...t[s],...e[s]};aT(t)}const zI=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")||zI.has(e)}let MT=e=>!wd(e);function II(e){typeof e=="function"&&(MT=t=>t.startsWith("on")?!wd(t):e(t))}try{II(require("@emotion/is-prop-valid").default)}catch{}function LI(e,t,s){const a={};for(const i in e)i==="values"&&typeof e.values=="object"||(MT(i)||s===!0&&wd(i)||!t&&!wd(i)||e.draggable&&i.startsWith("onDrag"))&&(a[i]=e[i]);return a}const Hd=b.createContext({});function PI(e,t){if(Zd(e)){const{initial:s,animate:a}=e;return{initial:s===!1||Dl(s)?s:void 0,animate:Dl(a)?a:void 0}}return e.inherit!==!1?t:{}}function UI(e){const{initial:t,animate:s}=PI(e,b.useContext(Hd));return b.useMemo(()=>({initial:t,animate:s}),[i1(t),i1(s)])}function i1(e){return Array.isArray(e)?e.join(" "):e}const Jg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function OT(e,t,s){for(const a in t)!fn(t[a])&&!fT(a,s)&&(e[a]=t[a])}function VI({transformTemplate:e},t){return b.useMemo(()=>{const s=Jg();return Xg(s,t,e),Object.assign({},s.vars,s.style)},[t])}function $I(e,t){const s=e.style||{},a={};return OT(a,s,e),Object.assign(a,VI(e,t)),a}function BI(e,t){const s={},a=$I(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=a,s}const DT=()=>({...Jg(),attrs:{}});function ZI(e,t,s,a){const i=b.useMemo(()=>{const l=DT();return hT(l,t,mT(a),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};OT(l,e.style,e),i.style={...l,...i.style}}return i}const HI=["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:!!(HI.indexOf(e)>-1||/[A-Z]/u.test(e))}function FI(e,t,s,{latestValues:a},i,l=!1,u){const p=(u??Qg(e)?ZI:BI)(t,a,i,e),h=LI(t,typeof e=="string",l),y=e!==b.Fragment?{...h,...p,ref:s}:{},{children:v}=t,x=b.useMemo(()=>fn(v)?v.get():v,[v]);return b.createElement(e,{...y,children:x})}function qI({scrapeMotionValuesFromProps:e,createRenderState:t},s,a,i){return{latestValues:YI(s,a,i,e),renderState:t()}}function YI(e,t,s,a){const i={},l=a(e,{});for(const x in l)i[x]=Ku(l[x]);let{initial:u,animate:d}=e;const p=Zd(e),h=sT(e);t&&h&&!p&&e.inherit!==!1&&(u===void 0&&(u=t.initial),d===void 0&&(d=t.animate));let y=s?s.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!Bd(v)){const x=Array.isArray(v)?v:[v];for(let w=0;w<x.length;w++){const N=$g(e,x[w]);if(N){const{transitionEnd:T,transition:_,...C}=N;for(const j in C){let E=C[j];if(Array.isArray(E)){const A=y?E.length-1:0;E=E[A]}E!==null&&(i[j]=E)}for(const j in T)i[j]=T[j]}}}return i}const zT=e=>(t,s)=>{const a=b.useContext(Hd),i=b.useContext($d),l=()=>qI(e,t,a,i);return s?l():Ng(l)},GI=zT({scrapeMotionValuesFromProps:Kg,createRenderState:Jg}),XI=zT({scrapeMotionValuesFromProps:gT,createRenderState:DT}),KI=Symbol.for("motionComponentSymbol");function WI(e,t,s){const a=b.useRef(s);b.useInsertionEffect(()=>{a.current=s});const i=b.useRef(null);return b.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=a.current;if(typeof u=="function")if(l){const d=u(l);typeof d=="function"&&(i.current=d)}else i.current?(i.current(),i.current=null):u(l);else u&&(u.current=l)},[t])}const IT=b.createContext({});function Di(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function JI(e,t,s,a,i,l){const{visualElement:u}=b.useContext(Hd),d=b.useContext(_T),p=b.useContext($d),h=b.useContext(Wg),y=h.reducedMotion,v=h.skipAnimations,x=b.useRef(null),w=b.useRef(!1);a=a||d.renderer,!x.current&&a&&(x.current=a(e,{visualState:t,parent:u,props:s,presenceContext:p,blockInitialAnimation:p?p.initial===!1:!1,reducedMotionConfig:y,skipAnimations:v,isSVG:l}),w.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const N=x.current,T=b.useContext(IT);N&&!N.projection&&i&&(N.type==="html"||N.type==="svg")&&QI(x.current,s,i,T);const _=b.useRef(!1);b.useInsertionEffect(()=>{N&&_.current&&N.update(s,p)});const C=s[HN],j=b.useRef(!!C&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return sN(()=>{w.current=!0,N&&(_.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 QI(e,t,s,a){const{layoutId:i,layout:l,drag:u,dragConstraints:d,layoutScroll:p,layoutRoot:h,layoutCrossfade:y}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:LT(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!u||d&&Di(d),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:a,crossfade:y,layoutScroll:p,layoutRoot:h})}function LT(e){if(e)return e.options.allowProjection!==!1?e.projection:LT(e.parent)}function Lp(e,{forwardMotionProps:t=!1,type:s}={},a,i){a&&DI(a);const l=s?s==="svg":Qg(e),u=l?XI:GI;function d(h,y){let v;const x={...b.useContext(Wg),...h,layoutId:e5(h)},{isStatic:w}=x,N=UI(h),T=u(h,w);if(!w&&nN){t5();const _=n5(x);v=_.MeasureLayout,N.visualElement=JI(e,T,x,i,_.ProjectionNode,l)}return f.jsxs(Hd.Provider,{value:N,children:[v&&N.visualElement?f.jsx(v,{visualElement:N.visualElement,...x}):null,FI(e,h,WI(T,N.visualElement,y),T,w,t,l)]})}d.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const p=b.forwardRef(d);return p[KI]=e,p}function e5({layoutId:e}){const t=b.useContext(Eg).id;return t&&e!==void 0?t+"-"+e:e}function t5(e,t){b.useContext(_T).strict}function n5(e){const t=kT(),{drag:s,layout:a}=t;if(!s&&!a)return{};const i={...s,...a};return{MeasureLayout:s?.isEnabled(e)||a?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function s5(e,t){if(typeof Proxy>"u")return Lp;const s=new Map,a=(l,u)=>Lp(l,u,e,t),i=(l,u)=>a(l,u);return new Proxy(i,{get:(l,u)=>u==="create"?a:(s.has(u)||s.set(u,Lp(u,void 0,e,t)),s.get(u))})}const r5=(e,t)=>t.isSVG??Qg(e)?new z4(t):new A4(t,{allowProjection:e!==b.Fragment});class a5 extends aa{constructor(t){super(t),t.animationState||(t.animationState=V4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Bd(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 i5=0;class o5 extends aa{constructor(){super(...arguments),this.id=i5++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)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 l5={animation:{Feature:a5},exit:{Feature:o5}};function Gl(e){return{point:{x:e.pageX,y:e.pageY}}}const c5=e=>t=>Fg(t)&&e(t,Gl(t));function Cl(e,t,s,a){return zl(e,t,c5(s),a)}const PT=({current:e})=>e?e.ownerDocument.defaultView:null,o1=(e,t)=>Math.abs(e-t);function u5(e,t){const s=o1(e.x,t.x),a=o1(e.y,t.y);return Math.sqrt(s**2+a**2)}const l1=new Set(["auto","scroll"]);class UT{constructor(t,s,{transformPagePoint:a,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:d}={}){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=Up(this.lastMoveEventInfo,this.history),N=this.startEvent!==null,T=u5(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!N&&!T)return;const{point:_}=w,{timestamp:C}=an;this.history.push({..._,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),yt.update(this.updatePoint,!0)},this.handlePointerUp=(w,N)=>{this.end();const{onEnd:T,onSessionEnd:_,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Up(w.type==="pointercancel"?this.lastMoveEventInfo:Pp(N,this.transformPagePoint),this.history);this.startEvent&&T&&T(w,j),_&&_(w,j)},!Fg(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const p=Gl(t),h=Pp(p,this.transformPagePoint),{point:y}=h,{timestamp:v}=an;this.history=[{...y,timestamp:v}];const{onSessionStart:x}=s;x&&x(t,Up(h,this.history)),this.removeListeners=Fl(Cl(this.contextWindow,"pointermove",this.handlePointerMove),Cl(this.contextWindow,"pointerup",this.handlePointerUp),Cl(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(t){let s=t.parentElement;for(;s;){const a=getComputedStyle(s);(l1.has(a.overflowX)||l1.has(a.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 a=t===window,i=a?{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||(a?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),yt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Wr(this.updatePoint)}}function Pp(e,t){return t?{point:t(e.point)}:e}function c1(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Up({point:e},t){return{point:e,delta:c1(e,VT(t)),offset:c1(e,d5(t)),velocity:f5(t,.1)}}function d5(e){return e[0]}function VT(e){return e[e.length-1]}function f5(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,a=null;const i=VT(e);for(;s>=0&&(a=e[s],!(i.timestamp-a.timestamp>ws(t)));)s--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&i.timestamp-a.timestamp>ws(t)*2&&(a=e[1]);const l=ls(i.timestamp-a.timestamp);if(l===0)return{x:0,y:0};const u={x:(i.x-a.x)/l,y:(i.y-a.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function h5(e,{min:t,max:s},a){return t!==void 0&&e<t?e=a?_t(t,e,a.min):Math.max(e,t):s!==void 0&&e>s&&(e=a?_t(s,e,a.max):Math.min(e,s)),e}function u1(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 p5(e,{top:t,left:s,bottom:a,right:i}){return{x:u1(e.x,s,i),y:u1(e.y,t,a)}}function d1(e,t){let s=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,a]=[a,s]),{min:s,max:a}}function m5(e,t){return{x:d1(e.x,t.x),y:d1(e.y,t.y)}}function g5(e,t){let s=.5;const a=wn(e),i=wn(t);return i>a?s=kl(t.min,t.max-a,e.min):a>i&&(s=kl(e.min,e.max-i,t.min)),$s(0,1,s)}function y5(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 Vm=.35;function v5(e=Vm){return e===!1?e=0:e===!0&&(e=Vm),{x:f1(e,"left","right"),y:f1(e,"top","bottom")}}function f1(e,t,s){return{min:h1(e,t),max:h1(e,s)}}function h1(e,t){return typeof e=="number"?e:e[t]||0}const b5=new WeakMap;class x5{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=Gt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:a}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=v=>{s&&this.snapToCursor(Gl(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=G3(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(Us.test(j)){const{projection:E}=this.visualElement;if(E&&E.layout){const A=E.layout.layoutBox[C];A&&(j=wn(A)*(parseFloat(j)/100))}}this.originPoint[C]=j}),T&&yt.update(()=>T(v,x),!1,!0),km(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},d=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x;const{dragPropagation:w,dragDirectionLock:N,onDirectionLock:T,onDrag:_}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:C}=x;if(N&&this.currentDirection===null){this.currentDirection=S5(C),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),_&&yt.update(()=>_(v,x),!1,!0)},p=(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:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:a,contextWindow:PT(this.visualElement),element:this.visualElement.current})}stop(t,s){const a=t||this.latestPointerEvent,i=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!a)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&yt.postRender(()=>d(a,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&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,a){const{drag:i}=this.getProps();if(!a||!Cu(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=h5(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&Di(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=p5(a.layoutBox,t):this.constraints=!1,this.elastic=v5(s),i!==this.constraints&&!Di(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&Os(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=y5(a.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Di(t))return!1;const a=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=E4(a,i.root,this.visualElement.getTransformPagePoint());let u=m5(i.layout.layoutBox,l);if(s){const d=s(x4(u));this.hasMutatedConstraints=!!d,d&&(u=oT(d))}return u}startAnimation(t){const{drag:s,dragMomentum:a,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),p=this.constraints||{},h=Os(y=>{if(!Cu(y,s,this.currentDirection))return;let v=p&&p[y]||{};u&&(v={min:0,max:0});const x=i?200:1e6,w=i?40:1e7,N={type:"inertia",velocity:a?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(d)}startAxisValueAnimation(t,s){const a=this.getAxisMotionValue(t);return km(this.visualElement,t),a.start(Vg(t,a,0,s,this.visualElement,!1))}stopAnimation(){Os(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,a=this.visualElement.getProps(),i=a[s];return i||this.visualElement.getValue(t,(a.initial?a.initial[t]:void 0)||0)}snapToCursor(t){Os(s=>{const{drag:a}=this.getProps();if(!Cu(s,a,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(s);if(i&&i.layout){const{min:u,max:d}=i.layout.layoutBox[s],p=l.get()||0;l.set(t[s]-_t(u,d,.5)+p)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:a}=this.visualElement;if(!Di(s)||!a||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Os(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const p=d.get();i[u]=g5({min:p,max:p},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),Os(u=>{if(!Cu(u,t,null))return;const d=this.getAxisMotionValue(u),{min:p,max:h}=this.constraints[u];d.set(_t(p,h,i[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;b5.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&&e4(x);y&&v&&!w&&this.start(h)});let a;const i=()=>{const{dragConstraints:h}=this.getProps();Di(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=w5(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",i);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),yt.read(i);const d=zl(window,"resize",()=>this.scalePositionWithinConstraints()),p=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()=>{d(),s(),u(),p&&p(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:a=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:u=Vm,dragMomentum:d=!0}=t;return{...t,drag:s,dragDirectionLock:a,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function p1(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function w5(e,t,s){const a=ww(e,p1(s)),i=ww(t,p1(s));return()=>{a(),i()}}function Cu(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function S5(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class E5 extends aa{constructor(t){super(t),this.removeGroupControls=cs,this.removeListeners=cs,this.controls=new x5(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||cs}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 Vp=e=>(t,s)=>{e&&yt.update(()=>e(t,s),!1,!0)};class N5 extends aa{constructor(){super(...arguments),this.removePointerDownListener=cs}onPointerDown(t){this.session=new UT(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:PT(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:Vp(t),onStart:Vp(s),onMove:Vp(a),onEnd:(l,u)=>{delete this.session,i&&yt.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 $p=!1;class T5 extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:a,layoutId:i}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),a&&a.register&&i&&a.register(l),$p&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Wu.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:a,drag:i,isPresent:l}=this.props,{projection:u}=a;return u&&(u.isPresent=l,t.layoutDependency!==s&&u.setOptions({...u.options,layoutDependency:s}),$p=!0,i||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||yt.postRender(()=>{const d=u.getStack();(!d||!d.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:a}=this.props,{projection:i}=t;$p=!0,i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),a&&a.deregister&&a.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function $T(e){const[t,s]=AT(),a=b.useContext(Eg);return f.jsx(T5,{...e,layoutGroup:a,switchLayoutGroup:b.useContext(IT),isPresent:t,safeToRemove:s})}const j5={pan:{Feature:N5},drag:{Feature:E5,ProjectionNode:RT,MeasureLayout:$T}};function m1(e,t,s){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",s==="Start");const i="onHover"+s,l=a[i];l&&yt.postRender(()=>l(t,Gl(t)))}class C5 extends aa{mount(){const{current:t}=this.node;t&&(this.unmount=K3(t,(s,a)=>(m1(this.node,a,"Start"),i=>m1(this.node,i,"End"))))}unmount(){}}class R5 extends aa{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=Fl(zl(this.node.current,"focus",()=>this.onFocus()),zl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function g1(e,t,s){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",s==="Start");const i="onTap"+(s==="End"?"":s),l=a[i];l&&yt.postRender(()=>l(t,Gl(t)))}class A5 extends aa{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:a}=this.node.props;this.unmount=n4(t,(i,l)=>(g1(this.node,l,"Start"),(u,{success:d})=>g1(this.node,u,d?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:a?.tap===!1})}unmount(){}}const $m=new WeakMap,Bp=new WeakMap,_5=e=>{const t=$m.get(e.target);t&&t(e)},k5=e=>{e.forEach(_5)};function M5({root:e,...t}){const s=e||document;Bp.has(s)||Bp.set(s,{});const a=Bp.get(s),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(k5,{root:e,...t})),a[i]}function O5(e,t,s){const a=M5(t);return $m.set(e,s),a.observe(e),()=>{$m.delete(e),a.unobserve(e)}}const D5={some:0,all:1};class z5 extends aa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:s,margin:a,amount:i="some",once:l}=t,u={root:s?s.current:void 0,rootMargin:a,threshold:typeof i=="number"?i:D5[i]},d=p=>{const{isIntersecting:h}=p;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(p)};return O5(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(I5(t,s))&&this.startObserver()}unmount(){}}function I5({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const L5={inView:{Feature:z5},tap:{Feature:A5},focus:{Feature:R5},hover:{Feature:C5}},P5={layout:{ProjectionNode:RT,MeasureLayout:$T}},U5={...l5,...L5,...j5,...P5},V5=s5(U5,r5);function $5(e){return"type"in e&&e.type==="separator"}function B5(e){return"type"in e&&e.type==="group"}function y1({item:e}){return f.jsxs(g2,{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&&f.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-neutral-400",children:e.icon}),f.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&f.jsx("span",{className:"text-neutral-400 text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}const BT=zS.forwardRef(({items:e},t)=>f.jsx(V5.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:f.jsx(fD,{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,a)=>$5(s)?f.jsx(ZD,{className:"h-px bg-neutral-700/50 my-1"},`sep-${a}`):B5(s)?f.jsxs(p2,{children:[f.jsx(m2,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-neutral-400",children:s.label}),s.items.map(i=>f.jsx(y1,{item:i},i.id))]},`grp-${a}`):f.jsx(y1,{item:s},s.id))})}));BT.displayName="PopupContent";function Z5({items:e,children:t}){return e.length===0?f.jsx(f.Fragment,{children:t}):f.jsxs(HD,{children:[f.jsx(FD,{render:f.jsx("div",{style:{display:"contents"}}),children:t}),f.jsx(pD,{children:f.jsx(CD,{className:"z-[200]",sideOffset:4,children:f.jsx(MI,{children:f.jsx(BT,{items:e})})})})]})}const v1=()=>{},H5={x:0,y:0},F5=({children:e,hud:t,mode:s="canvas",panOffset:a=H5,scale:i=1,onPan:l=v1,onZoom:u=v1,onPanStart:d,onPanEnd:p,isTransitioning:h=!1,onViewportChange:y,onCanvasClick:v,canvasProps:x,zoomSensitivity:w,zoomControlsRightOffset:N,canvasContextMenuItems:T})=>{const _=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 A=b.useRef(d);A.current=d;const R=b.useRef(p);R.current=p;const O=b.useRef(w);O.current=w;const[M,z]=b.useState(!1),F=b.useRef(!1),[Z,U]=b.useState(!1),H=b.useRef(!1),W=b.useRef({x:0,y:0}),oe=b.useRef(I=>{const B=I.target||document.activeElement;if(!B)return!1;const $=B.tagName;return!!($==="INPUT"||$==="TEXTAREA"||B.isContentEditable||B.closest?.(".xterm"))});b.useEffect(()=>{if(s!=="canvas")return;const I=re=>{re.key!==" "||re.repeat||oe.current(re)||h||(re.preventDefault(),F.current=!0,z(!0))},B=re=>{re.key===" "&&F.current&&(F.current=!1,z(!1),H.current&&(H.current=!1,U(!1),R.current?.()))},$=()=>{F.current&&(F.current=!1,z(!1),H.current&&(H.current=!1,U(!1),R.current?.()))};return window.addEventListener("keydown",I),window.addEventListener("keyup",B),window.addEventListener("blur",$),()=>{window.removeEventListener("keydown",I),window.removeEventListener("keyup",B),window.removeEventListener("blur",$)}},[s,h]);const ee=b.useCallback(I=>{I.button===0&&(I.preventDefault(),H.current=!0,U(!0),W.current={x:I.clientX,y:I.clientY},A.current?.())},[]);return b.useEffect(()=>{if(!M)return;const I=$=>{if(!H.current)return;const re=($.clientX-W.current.x)/C.current,J=($.clientY-W.current.y)/C.current;W.current={x:$.clientX,y:$.clientY},E.current({x:re,y:J})},B=()=>{H.current&&(H.current=!1,U(!1),R.current?.())};return window.addEventListener("mousemove",I),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",B)}},[M]),b.useEffect(()=>{if(s!=="canvas")return;const I=B=>{if(B.ctrlKey||B.metaKey){B.preventDefault();const $=C.current,re=-B.deltaY*.001*(O.current??1),J=Math.min(Math.max(.2,$+re),3);C.current=J,j.current(J)}};return window.addEventListener("wheel",I,{passive:!1}),()=>window.removeEventListener("wheel",I)},[s]),b.useEffect(()=>{if(!y)return;let I=null;const B=()=>{I&&cancelAnimationFrame(I),I=requestAnimationFrame(()=>{y({width:window.innerWidth,height:window.innerHeight})})};return B(),window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B),I&&cancelAnimationFrame(I)}},[y]),s==="panel"?f.jsxs("div",{ref:_,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[f.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar",children:e}),f.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]}):f.jsxs("div",{ref:_,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[f.jsx(Z5,{items:T??[],children:f.jsx(u_,{panOffset:a,scale:i,onPan:l,onPanStart:d,onPanEnd:p,isPanLocked:h,onClick:v,showGuides:x?.showGuides,onGuidesChange:x?.onGuidesChange,gridOpacity:x?.gridOpacity})}),f.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:i},children:f.jsx("div",{style:{position:"absolute",left:a.x,top:a.y},children:e})}),M&&f.jsx("div",{className:`fixed inset-0 z-20 ${Z?"cursor-grabbing":"cursor-grab"}`,onMouseDown:ee}),f.jsx("div",{className:"fixed bottom-[36px] z-30",style:{right:(N??280)+16},children:f.jsx(ak,{scale:i,onZoom:I=>u(I)})}),f.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]})},q5={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},Y5=b.createContext(q5);function Xl(){return b.useContext(Y5)}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}},G5=Fd.panels;function ey(){const{titleBarInset:e}=Xl();return b.useMemo(()=>{const t=Fd.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}const X5=({title:e,subtitle:t,center:s,actions:a,onTitleClick:i,search:l})=>{const{dragRegionProps:u,onInteractiveMouseDown:d}=Xl(),{navTotalHeight:p}=ey(),h=l&&l.value&&l.value.length>0;return f.jsx("div",{"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...u,children:f.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:p},children:[f.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/8 to-transparent"}),f.jsxs("div",{className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-3 select-none",onMouseDown:d,children:[f.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&&f.jsx("span",{className:"text-xs font-mono text-neutral-400",children:t})]}),s&&f.jsx("div",{className:"flex-1 flex justify-center h-12 items-center",onMouseDown:d,children:s}),f.jsxs("div",{className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:d,children:[a,l&&f.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:[f.jsx(ig,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-400"}),f.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&&f.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:f.jsx(ZS,{size:12})})]})]})]})})},b1=({side:e,title:t,icon:s,isCollapsed:a=!1,onToggleCollapse:i,headerActions:l,footer:u,style:d,width:p,onResizeStart:h,children:y})=>{if(a){const C=e==="left"?U_:Z_;return f.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:f.jsx(C,{size:14,className:"text-neutral-400 group-hover:text-emerald-400 transition-colors",strokeWidth:1.5})})}const v=e==="left"?L_:$_,{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"}`,_={...d,position:"fixed",top:x,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${p||280}px`};return f.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector",className:`${T} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:_,children:[h&&f.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:[f.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`}),f.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"})]})]}),!h&&f.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px bg-neutral-700/80`}),f.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"}),f.jsxs("div",{className:"pointer-events-auto flex-1 flex flex-col overflow-hidden",children:[t&&f.jsx("div",{className:"shrink-0 p-4 border-b border-neutral-700/50",children:f.jsxs("div",{className:"flex items-center justify-between text-neutral-200 text-[12px]",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&f.jsx("span",{className:"text-neutral-400",children:s}),f.jsx("span",{className:"tracking-widest font-bold uppercase",children:t})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l,i&&f.jsx("button",{onClick:i,className:"p-1 hover:bg-white/10 rounded transition-colors text-neutral-400 hover:text-white",title:"Collapse panel",children:f.jsx(v,{size:12})})]})]})}),f.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:y}),u&&f.jsx("div",{className:"shrink-0",children:u})]})]})},K5={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"}},W5=({left:e,viewport:t,right:s,isMinimapCollapsed:a=!1,onExpandMinimap:i,status:l={label:"READY",color:"emerald"},onToggleTerminal:u,isTerminalOpen:d=!1})=>{const[p,h]=b.useState(new Date),[y,v]=b.useState(!1),[x,w]=b.useState(!1);b.useEffect(()=>{w(!0);const _=setInterval(()=>h(new Date),1e3);return()=>clearInterval(_)},[]);const N=K5[l.color],T=async()=>{if(!t)return;const _=`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(_),v(!0),setTimeout(()=>v(!1),1500)}catch{}};return f.jsxs("div",{"data-frame-panel":"status-bar",className:`${G5.statusBar} h-7 flex items-center justify-between px-3 select-none font-mono text-[12px] text-neutral-200 pointer-events-auto`,children:[f.jsxs("div",{className:"flex items-center gap-4",children:[a&&i&&f.jsxs(f.Fragment,{children:[f.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:[f.jsx(R_,{size:10}),f.jsx("span",{className:"text-[11px] font-bold",children:"MAP"}),f.jsx(US,{size:8,className:"opacity-60"})]}),f.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),f.jsxs("div",{className:`flex items-center gap-2 ${N.text}`,children:[f.jsxs("div",{className:"relative flex h-2 w-2",children:[f.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${N.ping} opacity-75`}),f.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${N.dot}`})]}),f.jsx("span",{className:"font-bold tracking-wider",children:l.label})]}),e&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"h-3 w-px bg-neutral-700"}),e]})]}),t&&f.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-3 opacity-70 hover:opacity-100 transition-opacity",children:f.jsxs("button",{onClick:T,className:"flex items-center gap-3 hover:text-neutral-200 transition-colors cursor-pointer",title:"Copy viewport data",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-neutral-400",children:"PAN:"}),f.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),f.jsx("div",{className:"h-3 w-px bg-neutral-700"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-neutral-400",children:"SIZE:"}),f.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),f.jsx("div",{className:"h-3 w-px bg-neutral-700"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-neutral-400",children:"ZOOM:"}),f.jsxs("span",{className:`tabular-nums ${y?"text-emerald-500":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),f.jsxs("div",{className:"flex items-center gap-4",children:[s,s&&f.jsx("div",{className:"h-3 w-px bg-neutral-700"}),u&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:u,className:`flex items-center gap-1.5 px-2 py-1 rounded transition-all ${d?"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:[f.jsxs("span",{className:"text-[12px]",children:[">","_"]}),f.jsx("span",{className:"uppercase text-[11px] font-semibold tracking-wider",children:"Console"})]}),f.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),f.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-200 min-w-[60px] justify-end",children:[f.jsx(E_,{size:11,className:"text-neutral-400"}),f.jsx("span",{children:x?p.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},J5=({onOpenCommandPalette:e,extraControls:t})=>f.jsx("div",{className:"select-none font-mono text-[12px] border-t border-neutral-700/50",children:f.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[f.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-neutral-400 hover:text-white transition-colors",children:[f.jsx(ig,{size:10}),f.jsx("span",{className:"tracking-widest font-bold uppercase",children:"Command Palette"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[t,f.jsx("kbd",{className:"text-[11px] text-neutral-400 font-mono",children:"⌘K"})]})]})}),Q5=({isOpen:e,onClose:t,commands:s})=>{const[a,i]=b.useState(""),[l,u]=b.useState(0),d=b.useRef(null),p=b.useRef(null),h=s.filter(v=>v.label.toLowerCase().includes(a.toLowerCase()));b.useEffect(()=>{e&&(setTimeout(()=>d.current?.focus(),10),i(""),u(0))},[e]),b.useEffect(()=>{u(0)},[a]),b.useEffect(()=>{p.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?f.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:f.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:[f.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-neutral-700 gap-3",children:[f.jsx(ig,{className:"text-neutral-400",size:18}),f.jsx("input",{ref:d,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:a,onChange:v=>i(v.target.value),onKeyDown:y,autoFocus:!0}),f.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"})]}),f.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[f.jsx("div",{className:"pb-2",children:h.length===0?f.jsx("div",{className:"px-4 py-8 text-center text-neutral-400 text-xs font-mono",children:"No matching commands"}):h.map((v,x)=>f.jsxs("div",{ref:x===l?p: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&&f.jsx("div",{className:`text-neutral-300 ${x===l?"text-emerald-400":""}`,children:v.icon}),f.jsx("div",{className:"flex-1",children:f.jsx("div",{className:`text-sm ${x===l?"text-emerald-100":"text-neutral-200"}`,children:v.label})}),v.shortcut&&f.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&&f.jsx(T_,{size:14,className:"text-emerald-500 ml-2"})]},v.id))}),h.length>6&&f.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-[#111] to-transparent pointer-events-none"})]}),f.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:[f.jsx("span",{children:"Command Palette"}),f.jsxs("span",{children:[h.length," matches"]})]})]})}):null},{statusBarHeight:Ru}=Fd.layout,x1=120,eL=({isOpen:e,onClose:t,onToggleMaximize:s,isMaximized:a=!1,height:i=320,onHeightChange:l,title:u,headerActions:d,children:p})=>{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 _=j=>{const E=N-j.clientY,A=window.innerHeight-Ru,R=Math.max(x1,Math.min(A,T+E));y.current&&(y.current.style.height=`${R}px`)},C=j=>{h.current=!1,document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",C),y.current&&(y.current.style.transition="");const E=N-j.clientY,A=window.innerHeight-Ru;l(Math.max(x1,Math.min(A,T+E)))};document.addEventListener("mousemove",_),document.addEventListener("mouseup",C)},[i,l]),x=a?`calc(100vh - ${Ru}px)`:`${i}px`;return f.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:Ru,height:x,zIndex:Fd.zIndex.drawer},children:[f.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:[f.jsxs("div",{className:"flex items-center gap-3",children:[u||f.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[f.jsx(BS,{size:14}),f.jsx("span",{className:"text-xs font-bold tracking-widest font-mono",children:"TERMINAL"})]}),d]}),f.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:f.jsx("div",{className:"w-16 h-1 rounded-full bg-neutral-700 group-hover:bg-neutral-500 transition-colors"})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-neutral-700 text-neutral-400 hover:text-white transition-colors",title:a?"Restore":"Maximize",children:a?f.jsx(O_,{size:14}):f.jsx(US,{size:14})}),f.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:f.jsx(ZS,{size:14})})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:p})]})};var ZT="vercel.ai.error",tL=Symbol.for(ZT),w1,S1,Bs=class HT extends(S1=Error,w1=tL,S1){constructor({name:t,message:s,cause:a}){super(s),this[w1]=!0,this.name=t,this.cause=a}static isInstance(t){return HT.hasMarker(t,ZT)}static hasMarker(t,s){const a=Symbol.for(s);return t!=null&&typeof t=="object"&&a in t&&typeof t[a]=="boolean"&&t[a]===!0}};function FT(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var qT="AI_InvalidArgumentError",YT=`vercel.ai.error.${qT}`,nL=Symbol.for(YT),E1,N1,sL=class extends(N1=Bs,E1=nL,N1){constructor({message:e,cause:t,argument:s}){super({name:qT,message:e,cause:t}),this[E1]=!0,this.argument=s}static isInstance(e){return Bs.hasMarker(e,YT)}},GT="AI_JSONParseError",XT=`vercel.ai.error.${GT}`,rL=Symbol.for(XT),T1,j1,C1=class extends(j1=Bs,T1=rL,j1){constructor({text:e,cause:t}){super({name:GT,message:`JSON parsing failed: Text: ${e}.
|
|
39
|
+
Error message: ${FT(t)}`,cause:t}),this[T1]=!0,this.text=e}static isInstance(e){return Bs.hasMarker(e,XT)}},KT="AI_TypeValidationError",WT=`vercel.ai.error.${KT}`,aL=Symbol.for(WT),R1,A1,eo=class Bm extends(A1=Bs,R1=aL,A1){constructor({value:t,cause:s,context:a}){let i="Type validation failed";if(a?.field&&(i+=` for ${a.field}`),a?.entityName||a?.entityId){i+=" (";const l=[];a.entityName&&l.push(a.entityName),a.entityId&&l.push(`id: "${a.entityId}"`),i+=l.join(", "),i+=")"}super({name:KT,message:`${i}: Value: ${JSON.stringify(t)}.
|
|
40
|
+
Error message: ${FT(s)}`,cause:s}),this[R1]=!0,this.value=t,this.context=a}static isInstance(t){return Bs.hasMarker(t,WT)}static wrap({value:t,cause:s,context:a}){var i,l,u;return Bm.isInstance(s)&&s.value===t&&((i=s.context)==null?void 0:i.field)===a?.field&&((l=s.context)==null?void 0:l.entityName)===a?.entityName&&((u=s.context)==null?void 0:u.entityId)===a?.entityId?s:new Bm({value:t,cause:s,context:a})}};function ce(e,t,s){function a(d,p){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:p,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,p);const h=u.prototype,y=Object.keys(h);for(let v=0;v<y.length;v++){const x=y[v];x in d||(d[x]=h[x].bind(d))}}const i=s?.Parent??Object;class l extends i{}Object.defineProperty(l,"name",{value:e});function u(d){var p;const h=s?.Parent?new l:this;a(h,d),(p=h._zod).deferred??(p.deferred=[]);for(const y of h._zod.deferred)y();return h}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>s?.Parent&&d instanceof s.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Xi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class JT extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const QT={};function Jr(e){return QT}function ej(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,i])=>t.indexOf(+a)===-1).map(([a,i])=>i)}function Zm(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 iL(e,t){const s=(e.toString().split(".")[1]||"").length,a=t.toString();let i=(a.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(a)){const p=a.match(/\d?e-(\d?)/);p?.[1]&&(i=Number.parseInt(p[1]))}const l=s>i?s:i,u=Number.parseInt(e.toFixed(l).replace(".","")),d=Number.parseInt(t.toFixed(l).replace(".",""));return u%d/10**l}const _1=Symbol("evaluating");function Qe(e,t,s){let a;Object.defineProperty(e,t,{get(){if(a!==_1)return a===void 0&&(a=_1,a=s()),a},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function qa(e,t,s){Object.defineProperty(e,t,{value:s,writable:!0,enumerable:!0,configurable:!0})}function ia(...e){const t={};for(const s of e){const a=Object.getOwnPropertyDescriptors(s);Object.assign(t,a)}return Object.defineProperties({},t)}function k1(e){return JSON.stringify(e)}function oL(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const tj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const lL=qd(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function to(e){if(Il(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const s=t.prototype;return!(Il(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function nj(e){return to(e)?{...e}:Array.isArray(e)?[...e]:e}const cL=new Set(["string","number","symbol"]);function no(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oa(e,t,s){const a=new e._zod.constr(t??e._zod.def);return(!t||s?.parent)&&(a._zod.parent=e),a}function _e(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 uL(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const dL={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 fL(e,t){const s=e._zod.def,a=s.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=ia(e._zod.def,{get shape(){const u={};for(const d in t){if(!(d in s.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(u[d]=s.shape[d])}return qa(this,"shape",u),u},checks:[]});return oa(e,l)}function hL(e,t){const s=e._zod.def,a=s.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=ia(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in t){if(!(d in s.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete u[d]}return qa(this,"shape",u),u},checks:[]});return oa(e,l)}function pL(e,t){if(!to(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=ia(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return qa(this,"shape",l),l}});return oa(e,i)}function mL(e,t){if(!to(t))throw new Error("Invalid input to safeExtend: expected a plain object");const s=ia(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return qa(this,"shape",a),a}});return oa(e,s)}function gL(e,t){const s=ia(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return qa(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return oa(e,s)}function yL(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=ia(t._zod.def,{get shape(){const d=t._zod.def.shape,p={...d};if(s)for(const h in s){if(!(h in d))throw new Error(`Unrecognized key: "${h}"`);s[h]&&(p[h]=e?new e({type:"optional",innerType:d[h]}):d[h])}else for(const h in d)p[h]=e?new e({type:"optional",innerType:d[h]}):d[h];return qa(this,"shape",p),p},checks:[]});return oa(t,u)}function vL(e,t,s){const a=ia(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 qa(this,"shape",l),l}});return oa(t,a)}function Zi(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 Hi(e,t){return t.map(s=>{var a;return(a=s).path??(a.path=[]),s.path.unshift(e),s})}function Au(e){return typeof e=="string"?e:e?.message}function Qr(e,t,s){const a={...e,path:e.path??[]};if(!e.message){const i=Au(e.inst?._zod.def?.error?.(e))??Au(t?.error?.(e))??Au(s.customError?.(e))??Au(s.localeError?.(e))??"Invalid input";a.message=i}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function sy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ll(...e){const[t,s,a]=e;return typeof t=="string"?{message:t,code:"custom",input:s,inst:a}:{...t}}const sj=(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,Zm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rj=ce("$ZodError",sj),aj=ce("$ZodError",sj,{Parent:Error});function bL(e,t=s=>s.message){const s={},a=[];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))):a.push(t(i));return{formErrors:a,fieldErrors:s}}function xL(e,t=s=>s.message){const s={_errors:[]},a=i=>{for(const l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>a({issues:u}));else if(l.code==="invalid_key")a({issues:l.issues});else if(l.code==="invalid_element")a({issues:l.issues});else if(l.path.length===0)s._errors.push(t(l));else{let u=s,d=0;for(;d<l.path.length;){const p=l.path[d];d===l.path.length-1?(u[p]=u[p]||{_errors:[]},u[p]._errors.push(t(l))):u[p]=u[p]||{_errors:[]},u=u[p],d++}}};return a(e),s}const ry=e=>(t,s,a,i)=>{const l=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise)throw new Xi;if(u.issues.length){const d=new(i?.Err??e)(u.issues.map(p=>Qr(p,l,Jr())));throw tj(d,i?.callee),d}return u.value},ay=e=>async(t,s,a,i)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:s,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(i?.Err??e)(u.issues.map(p=>Qr(p,l,Jr())));throw tj(d,i?.callee),d}return u.value},Yd=e=>(t,s,a)=>{const i=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:s,issues:[]},i);if(l instanceof Promise)throw new Xi;return l.issues.length?{success:!1,error:new(e??rj)(l.issues.map(u=>Qr(u,i,Jr())))}:{success:!0,data:l.value}},wL=Yd(aj),Gd=e=>async(t,s,a)=>{const i=a?Object.assign(a,{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=>Qr(u,i,Jr())))}:{success:!0,data:l.value}},SL=Gd(aj),EL=e=>(t,s,a)=>{const i=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ry(e)(t,s,i)},NL=e=>(t,s,a)=>ry(e)(t,s,a),TL=e=>async(t,s,a)=>{const i=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ay(e)(t,s,i)},jL=e=>async(t,s,a)=>ay(e)(t,s,a),CL=e=>(t,s,a)=>{const i=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Yd(e)(t,s,i)},RL=e=>(t,s,a)=>Yd(e)(t,s,a),AL=e=>async(t,s,a)=>{const i=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Gd(e)(t,s,i)},_L=e=>async(t,s,a)=>Gd(e)(t,s,a),kL=/^[cC][^\s-]{8,}$/,ML=/^[0-9a-z]+$/,OL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,DL=/^[0-9a-vA-V]{20}$/,zL=/^[A-Za-z0-9]{27}$/,IL=/^[a-zA-Z0-9_-]{21}$/,LL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,PL=/^([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})$/,M1=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)$/,UL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,VL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $L(){return new RegExp(VL,"u")}const BL=/^(?:(?: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])$/,ZL=/^(([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}|:))$/,HL=/^((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])$/,FL=/^(([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])$/,qL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ij=/^[A-Za-z0-9_-]*$/,YL=/^\+[1-9]\d{6,14}$/,oj="(?:(?:\\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])))",GL=new RegExp(`^${oj}$`);function lj(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 XL(e){return new RegExp(`^${lj(e)}$`)}function KL(e){const t=lj({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${s.join("|")})`;return new RegExp(`^${oj}T(?:${a})$`)}const WL=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},JL=/^-?\d+$/,cj=/^-?\d+(?:\.\d+)?$/,QL=/^(?:true|false)$/i,e6=/^null$/i,t6=/^[^A-Z]*$/,n6=/^[^a-z]*$/,In=ce("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),uj={number:"number",bigint:"bigint",object:"date"},dj=ce("$ZodCheckLessThan",(e,t)=>{In.init(e,t);const s=uj[typeof t.value];e._zod.onattach.push(a=>{const i=a._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=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:s,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fj=ce("$ZodCheckGreaterThan",(e,t)=>{In.init(e,t);const s=uj[typeof t.value];e._zod.onattach.push(a=>{const i=a._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=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:s,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),s6=ce("$ZodCheckMultipleOf",(e,t)=>{In.init(e,t),e._zod.onattach.push(s=>{var a;(a=s._zod.bag).multipleOf??(a.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):iL(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})}}),r6=ce("$ZodCheckNumberFormat",(e,t)=>{In.init(e,t),t.format=t.format||"float64";const s=t.format?.includes("int"),a=s?"int":"number",[i,l]=dL[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=i,d.maximum=l,s&&(d.pattern=JL)}),e._zod.check=u=>{const d=u.value;if(s){if(!Number.isInteger(d)){u.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}d<i&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),d>l&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),a6=ce("$ZodCheckMaxLength",(e,t)=>{var s;In.init(e,t),(s=e._zod.def).when??(s.when=a=>{const i=a.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(a=>{const i=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const i=a.value;if(i.length<=t.maximum)return;const u=sy(i);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),i6=ce("$ZodCheckMinLength",(e,t)=>{var s;In.init(e,t),(s=e._zod.def).when??(s.when=a=>{const i=a.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(a=>{const i=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const i=a.value;if(i.length>=t.minimum)return;const u=sy(i);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),o6=ce("$ZodCheckLengthEquals",(e,t)=>{var s;In.init(e,t),(s=e._zod.def).when??(s.when=a=>{const i=a.value;return!ty(i)&&i.length!==void 0}),e._zod.onattach.push(a=>{const i=a._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=a=>{const i=a.value,l=i.length;if(l===t.length)return;const u=sy(i),d=l>t.length;a.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Xd=ce("$ZodCheckStringFormat",(e,t)=>{var s,a;In.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})}):(a=e._zod).check??(a.check=()=>{})}),l6=ce("$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})}}),c6=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t6),Xd.init(e,t)}),u6=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=n6),Xd.init(e,t)}),d6=ce("$ZodCheckIncludes",(e,t)=>{In.init(e,t);const s=no(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${s}`:s);t.pattern=a,e._zod.onattach.push(i=>{const l=i._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),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})}}),f6=ce("$ZodCheckStartsWith",(e,t)=>{In.init(e,t);const s=new RegExp(`^${no(t.prefix)}.*`);t.pattern??(t.pattern=s),e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),h6=ce("$ZodCheckEndsWith",(e,t)=>{In.init(e,t);const s=new RegExp(`.*${no(t.suffix)}$`);t.pattern??(t.pattern=s),e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),p6=ce("$ZodCheckOverwrite",(e,t)=>{In.init(e,t),e._zod.check=s=>{s.value=t.tx(s.value)}});class m6{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 a=t.split(`
|
|
41
|
+
`).filter(u=>u),i=Math.min(...a.map(u=>u.length-u.trimStart().length)),l=a.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 g6={major:4,minor:3,patch:6},jt=ce("$ZodType",(e,t)=>{var s;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=g6;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const i of a)for(const l of i._zod.onattach)l(e);if(a.length===0)(s=e._zod).deferred??(s.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(u,d,p)=>{let h=Zi(u),y;for(const v of d){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&&p?.async===!1)throw new Xi;if(y||w instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await w,u.issues.length!==x&&(h||(h=Zi(u,x)))});else{if(u.issues.length===x)continue;h||(h=Zi(u,x))}}return y?y.then(()=>u):u},l=(u,d,p)=>{if(Zi(u))return u.aborted=!0,u;const h=i(d,a,p);if(h instanceof Promise){if(p.async===!1)throw new Xi;return h.then(y=>e._zod.parse(y,p))}return e._zod.parse(h,p)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return h instanceof Promise?h.then(y=>l(y,u,d)):l(h,u,d)}const p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new Xi;return p.then(h=>i(h,a,d))}return i(p,a,d)}}Qe(e,"~standard",()=>({validate:i=>{try{const l=wL(e,i);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return SL(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),iy=ce("$ZodString",(e,t)=>{jt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??WL(e._zod.bag),e._zod.parse=(s,a)=>{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}}),At=ce("$ZodStringFormat",(e,t)=>{Xd.init(e,t),iy.init(e,t)}),y6=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=PL),At.init(e,t)}),v6=ce("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=M1(a))}else t.pattern??(t.pattern=M1());At.init(e,t)}),b6=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=UL),At.init(e,t)}),x6=ce("$ZodURL",(e,t)=>{At.init(e,t),e._zod.check=s=>{try{const a=s.value.trim(),i=new URL(a);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=a;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:e,continue:!t.abort})}}}),w6=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$L()),At.init(e,t)}),S6=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=IL),At.init(e,t)}),E6=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kL),At.init(e,t)}),N6=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ML),At.init(e,t)}),T6=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=OL),At.init(e,t)}),j6=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=DL),At.init(e,t)}),C6=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zL),At.init(e,t)}),R6=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=KL(t)),At.init(e,t)}),A6=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=GL),At.init(e,t)}),_6=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=XL(t)),At.init(e,t)}),k6=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=LL),At.init(e,t)}),M6=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=BL),At.init(e,t),e._zod.bag.format="ipv4"}),O6=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ZL),At.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})}}}),D6=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=HL),At.init(e,t)}),z6=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=FL),At.init(e,t),e._zod.check=s=>{const a=s.value.split("/");try{if(a.length!==2)throw new Error;const[i,l]=a;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 hj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const I6=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qL),At.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=s=>{hj(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:e,continue:!t.abort})}});function L6(e){if(!ij.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),s=t.padEnd(Math.ceil(t.length/4)*4,"=");return hj(s)}const P6=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ij),At.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=s=>{L6(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:e,continue:!t.abort})}}),U6=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=YL),At.init(e,t)});function V6(e,t=null){try{const s=e.split(".");if(s.length!==3)return!1;const[a]=s;if(!a)return!1;const i=JSON.parse(atob(a));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const $6=ce("$ZodJWT",(e,t)=>{At.init(e,t),e._zod.check=s=>{V6(s.value,t.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:e,continue:!t.abort})}}),pj=ce("$ZodNumber",(e,t)=>{jt.init(e,t),e._zod.pattern=e._zod.bag.pattern??cj,e._zod.parse=(s,a)=>{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}}),B6=ce("$ZodNumberFormat",(e,t)=>{r6.init(e,t),pj.init(e,t)}),Z6=ce("$ZodBoolean",(e,t)=>{jt.init(e,t),e._zod.pattern=QL,e._zod.parse=(s,a)=>{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}}),H6=ce("$ZodNull",(e,t)=>{jt.init(e,t),e._zod.pattern=e6,e._zod.values=new Set([null]),e._zod.parse=(s,a)=>{const i=s.value;return i===null||s.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),s}}),F6=ce("$ZodUnknown",(e,t)=>{jt.init(e,t),e._zod.parse=s=>s}),q6=ce("$ZodNever",(e,t)=>{jt.init(e,t),e._zod.parse=(s,a)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:e}),s)});function O1(e,t,s){e.issues.length&&t.issues.push(...Hi(s,e.issues)),t.value[s]=e.value}const Y6=ce("$ZodArray",(e,t)=>{jt.init(e,t),e._zod.parse=(s,a)=>{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 d=i[u],p=t.element._zod.run({value:d,issues:[]},a);p instanceof Promise?l.push(p.then(h=>O1(h,s,u))):O1(p,s,u)}return l.length?Promise.all(l).then(()=>s):s}});function Sd(e,t,s,a,i){if(e.issues.length){if(i&&!(s in a))return;t.issues.push(...Hi(s,e.issues))}e.value===void 0?s in a&&(t.value[s]=void 0):t.value[s]=e.value}function mj(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const s=uL(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function gj(e,t,s,a,i,l){const u=[],d=i.keySet,p=i.catchall._zod,h=p.def.type,y=p.optout==="optional";for(const v in t){if(d.has(v))continue;if(h==="never"){u.push(v);continue}const x=p.run({value:t[v],issues:[]},a);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 G6=ce("$ZodObject",(e,t)=>{if(jt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const p={...d};return Object.defineProperty(t,"shape",{value:p}),p}})}const a=qd(()=>mj(t));Qe(e._zod,"propValues",()=>{const d=t.shape,p={};for(const h in d){const y=d[h]._zod;if(y.values){p[h]??(p[h]=new Set);for(const v of y.values)p[h].add(v)}}return p});const i=Il,l=t.catchall;let u;e._zod.parse=(d,p)=>{u??(u=a.value);const h=d.value;if(!i(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;d.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:[]},p);T instanceof Promise?y.push(T.then(_=>Sd(_,d,x,h,N))):Sd(T,d,x,h,N)}return l?gj(y,h,d,p,a.value,e):y.length?Promise.all(y).then(()=>d):d}}),X6=ce("$ZodObjectJIT",(e,t)=>{G6.init(e,t);const s=e._zod.parse,a=qd(()=>mj(t)),i=x=>{const w=new m6(["shape","payload","ctx"]),N=a.value,T=E=>{const A=k1(E);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};w.write("const input = payload.value;");const _=Object.create(null);let C=0;for(const E of N.keys)_[E]=`key_${C++}`;w.write("const newResult = {};");for(const E of N.keys){const A=_[E],R=k1(E),M=x[E]?._zod?.optout==="optional";w.write(`const ${A} = ${T(E)};`),M?w.write(`
|
|
43
|
+
if (${A}.issues.length) {
|
|
44
|
+
if (${R} in input) {
|
|
45
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
46
|
+
...iss,
|
|
47
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (${A}.value === undefined) {
|
|
53
|
+
if (${R} in input) {
|
|
54
|
+
newResult[${R}] = undefined;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
newResult[${R}] = ${A}.value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
`):w.write(`
|
|
61
|
+
if (${A}.issues.length) {
|
|
62
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
63
|
+
...iss,
|
|
64
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
65
|
+
})));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (${A}.value === undefined) {
|
|
69
|
+
if (${R} in input) {
|
|
70
|
+
newResult[${R}] = undefined;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
newResult[${R}] = ${A}.value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const j=w.compile();return(E,A)=>j(x,E,A)};let l;const u=Il,d=!QT.jitless,h=d&&lL.value,y=t.catchall;let v;e._zod.parse=(x,w)=>{v??(v=a.value);const N=x.value;return u(N)?d&&h&&w?.async===!1&&w.jitless!==!0?(l||(l=i(t.shape)),x=l(x,w),y?gj([],N,x,w,v,e):x):s(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:N,inst:e}),x)}});function D1(e,t,s,a){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const i=e.filter(l=>!Zi(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=>Qr(u,a,Jr())))}),t)}const yj=ce("$ZodUnion",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Qe(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Qe(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Qe(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,a=t.options[0]._zod.run;e._zod.parse=(i,l)=>{if(s)return a(i,l);let u=!1;const d=[];for(const p of t.options){const h=p._zod.run({value:i.value,issues:[]},l);if(h instanceof Promise)d.push(h),u=!0;else{if(h.issues.length===0)return h;d.push(h)}}return u?Promise.all(d).then(p=>D1(p,i,e,l)):D1(d,i,e,l)}}),K6=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,yj.init(e,t);const s=e._zod.parse;Qe(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[d,p]of Object.entries(u)){i[d]||(i[d]=new Set);for(const h of p)i[d].add(h)}}return i});const a=qd(()=>{const i=t.options,l=new Map;for(const u of i){const d=u._zod.propValues?.[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const p of d){if(l.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);l.set(p,u)}}return l});e._zod.parse=(i,l)=>{const u=i.value;if(!Il(u))return i.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),i;const d=a.value.get(u?.[t.discriminator]);return d?d._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)}}),W6=ce("$ZodIntersection",(e,t)=>{jt.init(e,t),e._zod.parse=(s,a)=>{const i=s.value,l=t.left._zod.run({value:i,issues:[]},a),u=t.right._zod.run({value:i,issues:[]},a);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([p,h])=>z1(s,p,h)):z1(s,l,u)}});function Hm(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(to(e)&&to(t)){const s=Object.keys(t),a=Object.keys(e).filter(l=>s.indexOf(l)!==-1),i={...e,...t};for(const l of a){const u=Hm(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 a=0;a<e.length;a++){const i=e[a],l=t[a],u=Hm(i,l);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};s.push(u.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function z1(e,t,s){const a=new Map;let i;for(const d of t.issues)if(d.code==="unrecognized_keys"){i??(i=d);for(const p of d.keys)a.has(p)||a.set(p,{}),a.get(p).l=!0}else e.issues.push(d);for(const d of s.issues)if(d.code==="unrecognized_keys")for(const p of d.keys)a.has(p)||a.set(p,{}),a.get(p).r=!0;else e.issues.push(d);const l=[...a].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(l.length&&i&&e.issues.push({...i,keys:l}),Zi(e))return e;const u=Hm(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 J6=ce("$ZodRecord",(e,t)=>{jt.init(e,t),e._zod.parse=(s,a)=>{const i=s.value;if(!to(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 d=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){d.add(typeof h=="number"?h.toString():h);const y=t.valueType._zod.run({value:i[h],issues:[]},a);y instanceof Promise?l.push(y.then(v=>{v.issues.length&&s.issues.push(...Hi(h,v.issues)),s.value[h]=v.value})):(y.issues.length&&s.issues.push(...Hi(h,y.issues)),s.value[h]=y.value)}let p;for(const h in i)d.has(h)||(p=p??[],p.push(h));p&&p.length>0&&s.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:p})}else{s.value={};for(const d of Reflect.ownKeys(i)){if(d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},a);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&cj.test(d)&&p.issues.length){const v=t.keyType._zod.run({value:Number(d),issues:[]},a);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(p=v)}if(p.issues.length){t.mode==="loose"?s.value[d]=i[d]:s.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(v=>Qr(v,a,Jr())),input:d,path:[d],inst:e});continue}const y=t.valueType._zod.run({value:i[d],issues:[]},a);y instanceof Promise?l.push(y.then(v=>{v.issues.length&&s.issues.push(...Hi(d,v.issues)),s.value[p.value]=v.value})):(y.issues.length&&s.issues.push(...Hi(d,y.issues)),s.value[p.value]=y.value)}}return l.length?Promise.all(l).then(()=>s):s}}),Q6=ce("$ZodEnum",(e,t)=>{jt.init(e,t);const s=ej(t.entries),a=new Set(s);e._zod.values=a,e._zod.pattern=new RegExp(`^(${s.filter(i=>cL.has(typeof i)).map(i=>typeof i=="string"?no(i):i.toString()).join("|")})$`),e._zod.parse=(i,l)=>{const u=i.value;return a.has(u)||i.issues.push({code:"invalid_value",values:s,input:u,inst:e}),i}}),eP=ce("$ZodLiteral",(e,t)=>{if(jt.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(a=>typeof a=="string"?no(a):a?no(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,i)=>{const l=a.value;return s.has(l)||a.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),a}}),tP=ce("$ZodTransform",(e,t)=>{jt.init(e,t),e._zod.parse=(s,a)=>{if(a.direction==="backward")throw new JT(e.constructor.name);const i=t.transform(s.value,s);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(s.value=u,s));if(i instanceof Promise)throw new Xi;return s.value=i,s}});function I1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const vj=ce("$ZodOptional",(e,t)=>{jt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Qe(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ny(s.source)})?$`):void 0}),e._zod.parse=(s,a)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(s,a);return i instanceof Promise?i.then(l=>I1(l,s.value)):I1(i,s.value)}return s.value===void 0?s:t.innerType._zod.run(s,a)}}),nP=ce("$ZodExactOptional",(e,t)=>{vj.init(e,t),Qe(e._zod,"values",()=>t.innerType._zod.values),Qe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(s,a)=>t.innerType._zod.run(s,a)}),sP=ce("$ZodNullable",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.innerType._zod.optin),Qe(e._zod,"optout",()=>t.innerType._zod.optout),Qe(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ny(s.source)}|null)$`):void 0}),Qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(s,a)=>s.value===null?s:t.innerType._zod.run(s,a)}),rP=ce("$ZodDefault",(e,t)=>{jt.init(e,t),e._zod.optin="optional",Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,a)=>{if(a.direction==="backward")return t.innerType._zod.run(s,a);if(s.value===void 0)return s.value=t.defaultValue,s;const i=t.innerType._zod.run(s,a);return i instanceof Promise?i.then(l=>L1(l,t)):L1(i,t)}});function L1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const aP=ce("$ZodPrefault",(e,t)=>{jt.init(e,t),e._zod.optin="optional",Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,a)=>(a.direction==="backward"||s.value===void 0&&(s.value=t.defaultValue),t.innerType._zod.run(s,a))}),iP=ce("$ZodNonOptional",(e,t)=>{jt.init(e,t),Qe(e._zod,"values",()=>{const s=t.innerType._zod.values;return s?new Set([...s].filter(a=>a!==void 0)):void 0}),e._zod.parse=(s,a)=>{const i=t.innerType._zod.run(s,a);return i instanceof Promise?i.then(l=>P1(l,e)):P1(i,e)}});function P1(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 oP=ce("$ZodCatch",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.innerType._zod.optin),Qe(e._zod,"optout",()=>t.innerType._zod.optout),Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,a)=>{if(a.direction==="backward")return t.innerType._zod.run(s,a);const i=t.innerType._zod.run(s,a);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=>Qr(u,a,Jr()))},input:s.value}),s.issues=[]),s)):(s.value=i.value,i.issues.length&&(s.value=t.catchValue({...s,error:{issues:i.issues.map(l=>Qr(l,a,Jr()))},input:s.value}),s.issues=[]),s)}}),lP=ce("$ZodPipe",(e,t)=>{jt.init(e,t),Qe(e._zod,"values",()=>t.in._zod.values),Qe(e._zod,"optin",()=>t.in._zod.optin),Qe(e._zod,"optout",()=>t.out._zod.optout),Qe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(s,a)=>{if(a.direction==="backward"){const l=t.out._zod.run(s,a);return l instanceof Promise?l.then(u=>_u(u,t.in,a)):_u(l,t.in,a)}const i=t.in._zod.run(s,a);return i instanceof Promise?i.then(l=>_u(l,t.out,a)):_u(i,t.out,a)}});function _u(e,t,s){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},s)}const cP=ce("$ZodReadonly",(e,t)=>{jt.init(e,t),Qe(e._zod,"propValues",()=>t.innerType._zod.propValues),Qe(e._zod,"values",()=>t.innerType._zod.values),Qe(e._zod,"optin",()=>t.innerType?._zod?.optin),Qe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(s,a)=>{if(a.direction==="backward")return t.innerType._zod.run(s,a);const i=t.innerType._zod.run(s,a);return i instanceof Promise?i.then(U1):U1(i)}});function U1(e){return e.value=Object.freeze(e.value),e}const uP=ce("$ZodLazy",(e,t)=>{jt.init(e,t),Qe(e._zod,"innerType",()=>t.getter()),Qe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Qe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Qe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Qe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(s,a)=>e._zod.innerType._zod.run(s,a)}),dP=ce("$ZodCustom",(e,t)=>{In.init(e,t),jt.init(e,t),e._zod.parse=(s,a)=>s,e._zod.check=s=>{const a=s.value,i=t.fn(a);if(i instanceof Promise)return i.then(l=>V1(l,s,a,e));V1(i,s,a,e)}});function V1(e,t,s,a){if(!e){const i={code:"custom",input:s,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(i.params=a._zod.def.params),t.issues.push(Ll(i))}}var $1;class fP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...s){const a=s[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.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 a={...this.get(s)??{}};delete a.id;const i={...a,...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 hP(){return new fP}($1=globalThis).__zod_globalRegistry??($1.__zod_globalRegistry=hP());const ml=globalThis.__zod_globalRegistry;function pP(e,t){return new e({type:"string",..._e(t)})}function mP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function B1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function gP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function yP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function vP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function bP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function xP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function wP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function SP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function EP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function NP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function TP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function jP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function CP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function RP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function AP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function _P(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function kP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function MP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function OP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function DP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function zP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function IP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function LP(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function PP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function UP(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function VP(e,t){return new e({type:"number",checks:[],..._e(t)})}function $P(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function BP(e,t){return new e({type:"boolean",..._e(t)})}function ZP(e,t){return new e({type:"null",..._e(t)})}function HP(e){return new e({type:"unknown"})}function FP(e,t){return new e({type:"never",..._e(t)})}function Z1(e,t){return new dj({check:"less_than",..._e(t),value:e,inclusive:!1})}function Zp(e,t){return new dj({check:"less_than",..._e(t),value:e,inclusive:!0})}function H1(e,t){return new fj({check:"greater_than",..._e(t),value:e,inclusive:!1})}function Hp(e,t){return new fj({check:"greater_than",..._e(t),value:e,inclusive:!0})}function F1(e,t){return new s6({check:"multiple_of",..._e(t),value:e})}function bj(e,t){return new a6({check:"max_length",..._e(t),maximum:e})}function Ed(e,t){return new i6({check:"min_length",..._e(t),minimum:e})}function xj(e,t){return new o6({check:"length_equals",..._e(t),length:e})}function qP(e,t){return new l6({check:"string_format",format:"regex",..._e(t),pattern:e})}function YP(e){return new c6({check:"string_format",format:"lowercase",..._e(e)})}function GP(e){return new u6({check:"string_format",format:"uppercase",..._e(e)})}function XP(e,t){return new d6({check:"string_format",format:"includes",..._e(t),includes:e})}function KP(e,t){return new f6({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function WP(e,t){return new h6({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function uo(e){return new p6({check:"overwrite",tx:e})}function JP(e){return uo(t=>t.normalize(e))}function QP(){return uo(e=>e.trim())}function e8(){return uo(e=>e.toLowerCase())}function t8(){return uo(e=>e.toUpperCase())}function n8(){return uo(e=>oL(e))}function s8(e,t,s){return new e({type:"array",element:t,..._e(s)})}function r8(e,t,s){const a=_e(s);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:t,...a})}function a8(e,t,s){return new e({type:"custom",check:"custom",fn:t,..._e(s)})}function i8(e){const t=o8(s=>(s.addIssue=a=>{if(typeof a=="string")s.issues.push(Ll(a,s.value,t._zod.def));else{const i=a;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(Ll(i))}},e(s.value,s)));return t}function o8(e,t){const s=new In({check:"custom",..._e(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 vt(e,t,s={path:[],schemaPath:[]}){var a;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 d=e._zod.toJSONSchema?.();if(d)u.schema=d;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),vt(v,t,y),t.seen.get(v).isParent=!0)}const p=t.metadataRegistry.get(e);return p&&Object.assign(u.schema,p),t.io==="input"&&vn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((a=u.schema).default??(a.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 a=new Map;for(const u of e.seen.entries()){const d=e.metadataRegistry.get(u[0])?.id;if(d){const p=a.get(d);if(p&&p!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(d,u[0])}}const i=u=>{const d=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")}#/${d}/${w}`}}if(u[1]===s)return{ref:"#"};const h=`#/${d}/`,y=u[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:h+y}},l=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:p,defId:h}=i(u);d.def={...d.schema},h&&(d.defId=h);const y=d.schema;for(const v in y)delete y[v];y.$ref=p};if(e.cycles==="throw")for(const u of e.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.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 d=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(d.cycle){l(u);continue}if(d.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 a=u=>{const d=e.seen.get(u);if(d.ref===null)return;const p=d.def??d.schema,h={...p},y=d.ref;if(d.ref=null,y){a(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")?(p.allOf=p.allOf??[],p.allOf.push(w)):Object.assign(p,w),Object.assign(p,h),u._zod.parent===y)for(const T in p)T==="$ref"||T==="allOf"||T in h||delete p[T];if(w.$ref&&x.def)for(const T in p)T==="$ref"||T==="allOf"||T in x.def&&JSON.stringify(p[T])===JSON.stringify(x.def[T])&&delete p[T]}const v=u._zod.parent;if(v&&v!==y){a(v);const x=e.seen.get(v);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const w in p)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(p[w])===JSON.stringify(x.def[w])&&delete p[w]}e.override({zodSchema:u,jsonSchema:p,path:d.path??[]})};for(const u of[...e.seen.entries()].reverse())a(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 d=u[1];d.def&&d.defId&&(l[d.defId]=d.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 vn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return vn(a.element,s);if(a.type==="set")return vn(a.valueType,s);if(a.type==="lazy")return vn(a.getter(),s);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return vn(a.innerType,s);if(a.type==="intersection")return vn(a.left,s)||vn(a.right,s);if(a.type==="record"||a.type==="map")return vn(a.keyType,s)||vn(a.valueType,s);if(a.type==="pipe")return vn(a.in,s)||vn(a.out,s);if(a.type==="object"){for(const i in a.shape)if(vn(a.shape[i],s))return!0;return!1}if(a.type==="union"){for(const i of a.options)if(vn(i,s))return!0;return!1}if(a.type==="tuple"){for(const i of a.items)if(vn(i,s))return!0;return!!(a.rest&&vn(a.rest,s))}return!1}const l8=(e,t={})=>s=>{const a=Nd({...s,processors:t});return vt(e,a),Td(a,e),jd(a,e)},Cd=(e,t,s={})=>a=>{const{libraryOptions:i,target:l}=a??{},u=Nd({...i??{},target:l,io:t,processors:s});return vt(e,u),Td(u,e),jd(u,e)},c8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wj=(e,t,s,a)=>{const i=s;i.type="string";const{minimum:l,maximum:u,format:d,patterns:p,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(i.minLength=l),typeof u=="number"&&(i.maxLength=u),d&&(i.format=c8[d]??d,i.format===""&&delete i.format,d==="time"&&delete i.format),h&&(i.contentEncoding=h),p&&p.size>0){const y=[...p];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}))])}},Sj=(e,t,s,a)=>{const i=s,{minimum:l,maximum:u,format:d,multipleOf:p,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof d=="string"&&d.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 p=="number"&&(i.multipleOf=p)},Ej=(e,t,s,a)=>{s.type="boolean"},u8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},d8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Nj=(e,t,s,a)=>{t.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},f8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},h8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Tj=(e,t,s,a)=>{s.not={}},p8=(e,t,s,a)=>{},jj=(e,t,s,a)=>{},m8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Cj=(e,t,s,a)=>{const i=e._zod.def,l=ej(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,a)=>{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},g8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},y8=(e,t,s,a)=>{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},v8=(e,t,s,a)=>{const i=s,l={type:"string",format:"binary",contentEncoding:"binary"},{minimum:u,maximum:d,mime:p}=e._zod.bag;u!==void 0&&(l.minLength=u),d!==void 0&&(l.maxLength=d),p?p.length===1?(l.contentMediaType=p[0],Object.assign(i,l)):(Object.assign(i,l),i.anyOf=p.map(h=>({contentMediaType:h}))):Object.assign(i,l)},b8=(e,t,s,a)=>{s.type="boolean"},Aj=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},x8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},_j=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},w8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},S8=(e,t,s,a)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},kj=(e,t,s,a)=>{const i=s,l=e._zod.def,{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d),i.type="array",i.items=vt(l.element,t,{...a,path:[...a.path,"items"]})},Mj=(e,t,s,a)=>{const i=s,l=e._zod.def;i.type="object",i.properties={};const u=l.shape;for(const h in u)i.properties[h]=vt(u[h],t,{...a,path:[...a.path,"properties",h]});const d=new Set(Object.keys(u)),p=new Set([...d].filter(h=>{const y=l.shape[h]._zod;return t.io==="input"?y.optin===void 0:y.optout===void 0}));p.size>0&&(i.required=Array.from(p)),l.catchall?._zod.def.type==="never"?i.additionalProperties=!1:l.catchall?l.catchall&&(i.additionalProperties=vt(l.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Oj=(e,t,s,a)=>{const i=e._zod.def,l=i.inclusive===!1,u=i.options.map((d,p)=>vt(d,t,{...a,path:[...a.path,l?"oneOf":"anyOf",p]}));l?s.oneOf=u:s.anyOf=u},Dj=(e,t,s,a)=>{const i=e._zod.def,l=vt(i.left,t,{...a,path:[...a.path,"allOf",0]}),u=vt(i.right,t,{...a,path:[...a.path,"allOf",1]}),d=h=>"allOf"in h&&Object.keys(h).length===1,p=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];s.allOf=p},E8=(e,t,s,a)=>{const i=s,l=e._zod.def;i.type="array";const u=t.target==="draft-2020-12"?"prefixItems":"items",d=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",p=l.items.map((x,w)=>vt(x,t,{...a,path:[...a.path,u,w]})),h=l.rest?vt(l.rest,t,{...a,path:[...a.path,d,...t.target==="openapi-3.0"?[l.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=p,h&&(i.items=h)):t.target==="openapi-3.0"?(i.items={anyOf:p},h&&i.items.anyOf.push(h),i.minItems=p.length,h||(i.maxItems=p.length)):(i.items=p,h&&(i.additionalItems=h));const{minimum:y,maximum:v}=e._zod.bag;typeof y=="number"&&(i.minItems=y),typeof v=="number"&&(i.maxItems=v)},zj=(e,t,s,a)=>{const i=s,l=e._zod.def;i.type="object";const u=l.keyType,p=u._zod.bag?.patterns;if(l.mode==="loose"&&p&&p.size>0){const y=vt(l.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});i.patternProperties={};for(const v of p)i.patternProperties[v.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=vt(l.keyType,t,{...a,path:[...a.path,"propertyNames"]})),i.additionalProperties=vt(l.valueType,t,{...a,path:[...a.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)}},Ij=(e,t,s,a)=>{const i=e._zod.def,l=vt(i.innerType,t,a),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=i.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},Lj=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);const l=t.seen.get(e);l.ref=i.innerType},Pj=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);const l=t.seen.get(e);l.ref=i.innerType,s.default=JSON.parse(JSON.stringify(i.defaultValue))},Uj=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);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,a)=>{const i=e._zod.def;vt(i.innerType,t,a);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},$j=(e,t,s,a)=>{const i=e._zod.def,l=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;vt(l,t,a);const u=t.seen.get(e);u.ref=l},Bj=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);const l=t.seen.get(e);l.ref=i.innerType,s.readOnly=!0},N8=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);const l=t.seen.get(e);l.ref=i.innerType},oy=(e,t,s,a)=>{const i=e._zod.def;vt(i.innerType,t,a);const l=t.seen.get(e);l.ref=i.innerType},Zj=(e,t,s,a)=>{const i=e._zod.innerType;vt(i,t,a);const l=t.seen.get(e);l.ref=i},q1={string:wj,number:Sj,boolean:Ej,bigint:u8,symbol:d8,null:Nj,undefined:f8,void:h8,never:Tj,any:p8,unknown:jj,date:m8,enum:Cj,literal:Rj,nan:g8,template_literal:y8,file:v8,success:b8,custom:Aj,function:x8,transform:_j,map:w8,set:S8,array:kj,object:Mj,union:Oj,intersection:Dj,tuple:E8,record:zj,nullable:Ij,nonoptional:Lj,default:Pj,prefault:Uj,catch:Vj,pipe:$j,readonly:Bj,promise:N8,optional:oy,lazy:Zj};function T8(e,t){if("_idmap"in e){const a=e,i=Nd({...t,processors:q1}),l={};for(const p of a._idmap.entries()){const[h,y]=p;vt(y,i)}const u={},d={registry:a,uri:t?.uri,defs:l};i.external=d;for(const p of a._idmap.entries()){const[h,y]=p;Td(i,y),u[h]=jd(i,y)}if(Object.keys(l).length>0){const p=i.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[p]:l}}return{schemas:u}}const s=Nd({...t,processors:q1});return vt(e,s),Td(s,e),jd(s,e)}const j8=ce("ZodISODateTime",(e,t)=>{R6.init(e,t),kt.init(e,t)});function C8(e){return IP(j8,e)}const R8=ce("ZodISODate",(e,t)=>{A6.init(e,t),kt.init(e,t)});function A8(e){return LP(R8,e)}const _8=ce("ZodISOTime",(e,t)=>{_6.init(e,t),kt.init(e,t)});function k8(e){return PP(_8,e)}const M8=ce("ZodISODuration",(e,t)=>{k6.init(e,t),kt.init(e,t)});function O8(e){return UP(M8,e)}const D8=(e,t)=>{rj.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>xL(e,s)},flatten:{value:s=>bL(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Zm,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Zm,2)}},isEmpty:{get(){return e.issues.length===0}}})},ds=ce("ZodError",D8,{Parent:Error}),z8=ry(ds),I8=ay(ds),L8=Yd(ds),Hj=Gd(ds),P8=EL(ds),U8=NL(ds),V8=TL(ds),$8=jL(ds),B8=CL(ds),Z8=RL(ds),H8=AL(ds),F8=_L(ds),Ct=ce("ZodType",(e,t)=>(jt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Cd(e,"input"),output:Cd(e,"output")}}),e.toJSONSchema=l8(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(ia(t,{checks:[...t.checks??[],...s.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(s,a)=>oa(e,s,a),e.brand=()=>e,e.register=((s,a)=>(s.add(e,a),e)),e.parse=(s,a)=>z8(e,s,a,{callee:e.parse}),e.safeParse=(s,a)=>L8(e,s,a),e.parseAsync=async(s,a)=>I8(e,s,a,{callee:e.parseAsync}),e.safeParseAsync=async(s,a)=>Hj(e,s,a),e.spa=e.safeParseAsync,e.encode=(s,a)=>P8(e,s,a),e.decode=(s,a)=>U8(e,s,a),e.encodeAsync=async(s,a)=>V8(e,s,a),e.decodeAsync=async(s,a)=>$8(e,s,a),e.safeEncode=(s,a)=>B8(e,s,a),e.safeDecode=(s,a)=>Z8(e,s,a),e.safeEncodeAsync=async(s,a)=>H8(e,s,a),e.safeDecodeAsync=async(s,a)=>F8(e,s,a),e.refine=(s,a)=>e.check($U(s,a)),e.superRefine=s=>e.check(BU(s)),e.overwrite=s=>e.check(uo(s)),e.optional=()=>X1(e),e.exactOptional=()=>CU(e),e.nullable=()=>K1(e),e.nullish=()=>X1(K1(e)),e.nonoptional=s=>OU(e,s),e.array=()=>fo(e),e.or=s=>Sn([e,s]),e.and=s=>wU(e,s),e.transform=s=>W1(e,TU(s)),e.default=s=>_U(e,s),e.prefault=s=>MU(e,s),e.catch=s=>zU(e,s),e.pipe=s=>W1(e,s),e.readonly=()=>PU(e),e.describe=s=>{const a=e.clone();return ml.add(a,{description:s}),a},Object.defineProperty(e,"description",{get(){return ml.get(e)?.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return ml.get(e);const a=e.clone();return ml.add(a,s[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),Fj=ce("_ZodString",(e,t)=>{iy.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(a,i,l)=>wj(e,a,i);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...a)=>e.check(qP(...a)),e.includes=(...a)=>e.check(XP(...a)),e.startsWith=(...a)=>e.check(KP(...a)),e.endsWith=(...a)=>e.check(WP(...a)),e.min=(...a)=>e.check(Ed(...a)),e.max=(...a)=>e.check(bj(...a)),e.length=(...a)=>e.check(xj(...a)),e.nonempty=(...a)=>e.check(Ed(1,...a)),e.lowercase=a=>e.check(YP(a)),e.uppercase=a=>e.check(GP(a)),e.trim=()=>e.check(QP()),e.normalize=(...a)=>e.check(JP(...a)),e.toLowerCase=()=>e.check(e8()),e.toUpperCase=()=>e.check(t8()),e.slugify=()=>e.check(n8())}),q8=ce("ZodString",(e,t)=>{iy.init(e,t),Fj.init(e,t),e.email=s=>e.check(mP(Y8,s)),e.url=s=>e.check(xP(G8,s)),e.jwt=s=>e.check(zP(cU,s)),e.emoji=s=>e.check(wP(X8,s)),e.guid=s=>e.check(B1(Y1,s)),e.uuid=s=>e.check(gP(ku,s)),e.uuidv4=s=>e.check(yP(ku,s)),e.uuidv6=s=>e.check(vP(ku,s)),e.uuidv7=s=>e.check(bP(ku,s)),e.nanoid=s=>e.check(SP(K8,s)),e.guid=s=>e.check(B1(Y1,s)),e.cuid=s=>e.check(EP(W8,s)),e.cuid2=s=>e.check(NP(J8,s)),e.ulid=s=>e.check(TP(Q8,s)),e.base64=s=>e.check(MP(iU,s)),e.base64url=s=>e.check(OP(oU,s)),e.xid=s=>e.check(jP(eU,s)),e.ksuid=s=>e.check(CP(tU,s)),e.ipv4=s=>e.check(RP(nU,s)),e.ipv6=s=>e.check(AP(sU,s)),e.cidrv4=s=>e.check(_P(rU,s)),e.cidrv6=s=>e.check(kP(aU,s)),e.e164=s=>e.check(DP(lU,s)),e.datetime=s=>e.check(C8(s)),e.date=s=>e.check(A8(s)),e.time=s=>e.check(k8(s)),e.duration=s=>e.check(O8(s))});function be(e){return pP(q8,e)}const kt=ce("ZodStringFormat",(e,t)=>{At.init(e,t),Fj.init(e,t)}),Y8=ce("ZodEmail",(e,t)=>{b6.init(e,t),kt.init(e,t)}),Y1=ce("ZodGUID",(e,t)=>{y6.init(e,t),kt.init(e,t)}),ku=ce("ZodUUID",(e,t)=>{v6.init(e,t),kt.init(e,t)}),G8=ce("ZodURL",(e,t)=>{x6.init(e,t),kt.init(e,t)}),X8=ce("ZodEmoji",(e,t)=>{w6.init(e,t),kt.init(e,t)}),K8=ce("ZodNanoID",(e,t)=>{S6.init(e,t),kt.init(e,t)}),W8=ce("ZodCUID",(e,t)=>{E6.init(e,t),kt.init(e,t)}),J8=ce("ZodCUID2",(e,t)=>{N6.init(e,t),kt.init(e,t)}),Q8=ce("ZodULID",(e,t)=>{T6.init(e,t),kt.init(e,t)}),eU=ce("ZodXID",(e,t)=>{j6.init(e,t),kt.init(e,t)}),tU=ce("ZodKSUID",(e,t)=>{C6.init(e,t),kt.init(e,t)}),nU=ce("ZodIPv4",(e,t)=>{M6.init(e,t),kt.init(e,t)}),sU=ce("ZodIPv6",(e,t)=>{O6.init(e,t),kt.init(e,t)}),rU=ce("ZodCIDRv4",(e,t)=>{D6.init(e,t),kt.init(e,t)}),aU=ce("ZodCIDRv6",(e,t)=>{z6.init(e,t),kt.init(e,t)}),iU=ce("ZodBase64",(e,t)=>{I6.init(e,t),kt.init(e,t)}),oU=ce("ZodBase64URL",(e,t)=>{P6.init(e,t),kt.init(e,t)}),lU=ce("ZodE164",(e,t)=>{U6.init(e,t),kt.init(e,t)}),cU=ce("ZodJWT",(e,t)=>{$6.init(e,t),kt.init(e,t)}),qj=ce("ZodNumber",(e,t)=>{pj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(a,i,l)=>Sj(e,a,i),e.gt=(a,i)=>e.check(H1(a,i)),e.gte=(a,i)=>e.check(Hp(a,i)),e.min=(a,i)=>e.check(Hp(a,i)),e.lt=(a,i)=>e.check(Z1(a,i)),e.lte=(a,i)=>e.check(Zp(a,i)),e.max=(a,i)=>e.check(Zp(a,i)),e.int=a=>e.check(G1(a)),e.safe=a=>e.check(G1(a)),e.positive=a=>e.check(H1(0,a)),e.nonnegative=a=>e.check(Hp(0,a)),e.negative=a=>e.check(Z1(0,a)),e.nonpositive=a=>e.check(Zp(0,a)),e.multipleOf=(a,i)=>e.check(F1(a,i)),e.step=(a,i)=>e.check(F1(a,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 uU(e){return VP(qj,e)}const dU=ce("ZodNumberFormat",(e,t)=>{B6.init(e,t),qj.init(e,t)});function G1(e){return $P(dU,e)}const fU=ce("ZodBoolean",(e,t)=>{Z6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Ej(e,s,a)});function bn(e){return BP(fU,e)}const hU=ce("ZodNull",(e,t)=>{H6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Nj(e,s,a)});function pU(e){return ZP(hU,e)}const mU=ce("ZodUnknown",(e,t)=>{F6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>jj()});function Ds(){return HP(mU)}const gU=ce("ZodNever",(e,t)=>{q6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Tj(e,s,a)});function Yj(e){return FP(gU,e)}const yU=ce("ZodArray",(e,t)=>{Y6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>kj(e,s,a,i),e.element=t.element,e.min=(s,a)=>e.check(Ed(s,a)),e.nonempty=s=>e.check(Ed(1,s)),e.max=(s,a)=>e.check(bj(s,a)),e.length=(s,a)=>e.check(xj(s,a)),e.unwrap=()=>e.element});function fo(e,t){return s8(yU,e,t)}const Gj=ce("ZodObject",(e,t)=>{X6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Mj(e,s,a,i),Qe(e,"shape",()=>t.shape),e.keyof=()=>Kj(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:Yj()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>pL(e,s),e.safeExtend=s=>mL(e,s),e.merge=s=>gL(e,s),e.pick=s=>fL(e,s),e.omit=s=>hL(e,s),e.partial=(...s)=>yL(Wj,e,s[0]),e.required=(...s)=>vL(Jj,e,s[0])});function mt(e,t){const s={type:"object",shape:e??{},..._e(t)};return new Gj(s)}function wt(e,t){return new Gj({type:"object",shape:e,catchall:Yj(),..._e(t)})}const Xj=ce("ZodUnion",(e,t)=>{yj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Oj(e,s,a,i),e.options=t.options});function Sn(e,t){return new Xj({type:"union",options:e,..._e(t)})}const vU=ce("ZodDiscriminatedUnion",(e,t)=>{Xj.init(e,t),K6.init(e,t)});function bU(e,t,s){return new vU({type:"union",options:t,discriminator:e,..._e(s)})}const xU=ce("ZodIntersection",(e,t)=>{W6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Dj(e,s,a,i)});function wU(e,t){return new xU({type:"intersection",left:e,right:t})}const SU=ce("ZodRecord",(e,t)=>{J6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>zj(e,s,a,i),e.keyType=t.keyType,e.valueType=t.valueType});function Pl(e,t,s){return new SU({type:"record",keyType:e,valueType:t,..._e(s)})}const Fm=ce("ZodEnum",(e,t)=>{Q6.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(a,i,l)=>Cj(e,a,i),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(a,i)=>{const l={};for(const u of a)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Fm({...t,checks:[],..._e(i),entries:l})},e.exclude=(a,i)=>{const l={...t.entries};for(const u of a)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Fm({...t,checks:[],..._e(i),entries:l})}});function Kj(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Fm({type:"enum",entries:s,..._e(t)})}const EU=ce("ZodLiteral",(e,t)=>{eP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Rj(e,s,a),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 Ie(e,t){return new EU({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const NU=ce("ZodTransform",(e,t)=>{tP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>_j(e,s),e._zod.parse=(s,a)=>{if(a.direction==="backward")throw new JT(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(Ll(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(Ll(u))}};const i=t.transform(s.value,s);return i instanceof Promise?i.then(l=>(s.value=l,s)):(s.value=i,s)}});function TU(e){return new NU({type:"transform",transform:e})}const Wj=ce("ZodOptional",(e,t)=>{vj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>oy(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function X1(e){return new Wj({type:"optional",innerType:e})}const jU=ce("ZodExactOptional",(e,t)=>{nP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>oy(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function CU(e){return new jU({type:"optional",innerType:e})}const RU=ce("ZodNullable",(e,t)=>{sP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Ij(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function K1(e){return new RU({type:"nullable",innerType:e})}const AU=ce("ZodDefault",(e,t)=>{rP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Pj(e,s,a,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _U(e,t){return new AU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():nj(t)}})}const kU=ce("ZodPrefault",(e,t)=>{aP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Uj(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function MU(e,t){return new kU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():nj(t)}})}const Jj=ce("ZodNonOptional",(e,t)=>{iP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Lj(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function OU(e,t){return new Jj({type:"nonoptional",innerType:e,..._e(t)})}const DU=ce("ZodCatch",(e,t)=>{oP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Vj(e,s,a,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zU(e,t){return new DU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const IU=ce("ZodPipe",(e,t)=>{lP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>$j(e,s,a,i),e.in=t.in,e.out=t.out});function W1(e,t){return new IU({type:"pipe",in:e,out:t})}const LU=ce("ZodReadonly",(e,t)=>{cP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Bj(e,s,a,i),e.unwrap=()=>e._zod.def.innerType});function PU(e){return new LU({type:"readonly",innerType:e})}const UU=ce("ZodLazy",(e,t)=>{uP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Zj(e,s,a,i),e.unwrap=()=>e._zod.def.getter()});function VU(e){return new UU({type:"lazy",getter:e})}const ly=ce("ZodCustom",(e,t)=>{dP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Aj(e,s)});function Qj(e,t){return r8(ly,e??(()=>!0),t)}function $U(e,t={}){return a8(ly,e,t)}function BU(e){return i8(e)}function Rd(e,t={}){const s=new ly({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,..._e(t)});return s._zod.bag.Class=e,s._zod.check=a=>{a.value instanceof e||a.issues.push({code:"invalid_type",expected:e.name,input:a.value,inst:s,path:[...s._zod.def.path??[]]})},s}var Ul;(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(d=>typeof i[i[d]]!="number"),u={};for(const d of l)u[d]=i[d];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 a(i,l=" | "){return i.map(u=>typeof u=="string"?`'${u}'`:u).join(l)}e.joinValues=a,e.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Ul||(Ul={}));var J1;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(J1||(J1={}));Ul.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ul.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 Ad extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};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},a={_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)a._errors.push(s(u));else{let d=a,p=0;for(;p<u.path.length;){const h=u.path[p];p===u.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(s(u))):d[h]=d[h]||{_errors:[]},d=d[h],p++}}};return i(this),a}static assert(t){if(!(t instanceof Ad))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ul.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s=Object.create(null),a=[];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 a.push(t(i));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}}Ad.create=e=>new Ad(e);var Q1;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Q1||(Q1={}));var Ve;(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"})(Ve||(Ve={}));class eS 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 tS=10,ZU=13,Ra=32;function Fp(e){}function HU(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:a=Fp,onComment:i}=e;let l="",u=!0,d,p="",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 A=j.indexOf(`
|
|
79
|
+
`,E);for(;A!==-1;){if(E===A){h>0&&t({id:d,event:y,data:p}),d=void 0,p="",h=0,y=void 0,E=A+1,A=j.indexOf(`
|
|
80
|
+
`,E);continue}const R=j.charCodeAt(E);if(nS(j,E,R)){const O=j.charCodeAt(E+5)===Ra?E+6:E+5,M=j.slice(O,A);if(h===0&&j.charCodeAt(A+1)===tS){t({id:d,event:y,data:M}),d=void 0,p="",y=void 0,E=A+2,A=j.indexOf(`
|
|
81
|
+
`,E);continue}p=h===0?M:`${p}
|
|
82
|
+
${M}`,h++}else sS(j,E,R)?y=j.slice(j.charCodeAt(E+6)===Ra?E+7:E+6,A)||void 0:N(j,E,A);E=A+1,A=j.indexOf(`
|
|
83
|
+
`,E)}return j.slice(E)}for(;E<j.length;){const A=j.indexOf("\r",E),R=j.indexOf(`
|
|
84
|
+
`,E);let O=-1;if(A!==-1&&R!==-1?O=A<R?A:R:A!==-1?A===j.length-1?O=-1:O=A:R!==-1&&(O=R),O===-1)break;N(j,E,O),E=O+1,j.charCodeAt(E-1)===ZU&&j.charCodeAt(E)===tS&&E++}return j.slice(E)}function N(j,E,A){if(E===A){_();return}const R=j.charCodeAt(E);if(nS(j,E,R)){const U=j.charCodeAt(E+5)===Ra?E+6:E+5,H=j.slice(U,A);p=h===0?H:`${p}
|
|
85
|
+
${H}`,h++;return}if(sS(j,E,R)){y=j.slice(j.charCodeAt(E+6)===Ra?E+7:E+6,A)||void 0;return}if(R===105&&j.charCodeAt(E+1)===100&&j.charCodeAt(E+2)===58){const U=j.slice(j.charCodeAt(E+3)===Ra?E+4:E+3,A);d=U.includes("\0")?void 0:U;return}if(R===58){if(i){const U=j.slice(E,A);i(U.slice(j.charCodeAt(E+1)===Ra?2:1))}return}const O=j.slice(E,A),M=O.indexOf(":");if(M===-1){T(O,"",O);return}const z=O.slice(0,M),F=O.charCodeAt(M+1)===Ra?2:1,Z=O.slice(M+F);T(z,Z,O)}function T(j,E,A){switch(j){case"event":y=E||void 0;break;case"data":p=h===0?E:`${p}
|
|
86
|
+
${E}`,h++;break;case"id":d=E.includes("\0")?void 0:E;break;case"retry":/^\d+$/.test(E)?a(parseInt(E,10)):s(new eS(`Invalid \`retry\` value: "${E}"`,{type:"invalid-retry",value:E,line:A}));break;default:s(new eS(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:E,line:A}));break}}function _(){h>0&&t({id:d,event:y,data:p}),d=void 0,p="",h=0,y=void 0}function C(j={}){l&&j.consume&&N(l,0,l.length),u=!0,d=void 0,p="",h=0,y=void 0,l=""}return{feed:v,reset:C}}function nS(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 sS(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 FU extends TransformStream{constructor({onError:t,onRetry:s,onComment:a}={}){let i;super({start(l){i=HU({onEvent:u=>{l.enqueue(u)},onError(u){t==="terminate"?l.error(u):typeof t=="function"&&t(u)},onRetry:s,onComment:a})},transform(l){i.feed(l)}})}}var Kl=({prefix:e,size:t=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const i=()=>{const l=s.length,u=new Array(t);for(let d=0;d<t;d++)u[d]=s[Math.random()*l|0];return u.join("")};if(e==null)return i;if(s.includes(a))throw new sL({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${s}".`});return()=>`${e}${a}${i()}`},qU=Kl();function ki(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((s,a)=>{t[a.toLowerCase()]=s});else{Array.isArray(e)||(e=Object.entries(e));for(const[s,a]of e)a!=null&&(t[s.toLowerCase()]=a)}return t}var YU=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,GU=/"(?: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 rS(e){const t=JSON.parse(e);return t===null||typeof t!="object"||YU.test(e)===!1&&GU.test(e)===!1?t:XU(t)}function XU(e){let t=[e];for(;t.length;){const s=t;t=[];for(const a of s){if(Object.prototype.hasOwnProperty.call(a,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(a,"constructor")&&a.constructor!==null&&typeof a.constructor=="object"&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in a){const l=a[i];l&&typeof l=="object"&&t.push(l)}}}return e}function KU(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return rS(e)}try{return rS(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 a of Object.keys(s))s[a]=Aa(s[a])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Aa):Aa(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Aa)),e.allOf!=null&&(e.allOf=e.allOf.map(Aa)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Aa));const{definitions:t}=e;if(t!=null)for(const s of Object.keys(t))t[s]=Aa(t[s]);return e}function Aa(e){return typeof e=="boolean"?e:cy(e)}var WU=Symbol("Let zodToJsonSchema decide on which parser to use"),aS={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"},JU=e=>typeof e=="string"?{...aS,name:e}:{...aS,...e};function Gn(){return{}}function QU(e,t){var s,a,i;const l={type:"array"};return(s=e.type)!=null&&s._def&&((i=(a=e.type)==null?void 0:a._def)==null?void 0:i.typeName)!==Ve.ZodAny&&(l.items=ut(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 eV(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 tV(){return{type:"boolean"}}function eC(e,t){return ut(e.type._def,t)}var nV=(e,t)=>ut(e.innerType._def,t);function tC(e,t,s){const a=s??t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((i,l)=>tC(e,t,i))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return sV(e)}}var sV=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 rV(e,t){return{...ut(e.innerType._def,t),default:e.defaultValue()}}function aV(e,t){return t.effectStrategy==="input"?ut(e.schema._def,t):Gn()}function iV(e){return{type:"string",enum:Array.from(e.values)}}var oV=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function lV(e,t){const s=[ut(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ut(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),a=[];return s.forEach(i=>{if(oV(i))a.push(...i.allOf);else{let l=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:u,...d}=i;l=d}a.push(l)}}),a.length?{allOf:a}:void 0}function cV(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,ys={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 nC(e,t){const s={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":vs(s,"email",a.message,t);break;case"format:idn-email":vs(s,"idn-email",a.message,t);break;case"pattern:zod":yn(s,ys.email,a.message,t);break}break;case"url":vs(s,"uri",a.message,t);break;case"uuid":vs(s,"uuid",a.message,t);break;case"regex":yn(s,a.regex,a.message,t);break;case"cuid":yn(s,ys.cuid,a.message,t);break;case"cuid2":yn(s,ys.cuid2,a.message,t);break;case"startsWith":yn(s,RegExp(`^${Yp(a.value,t)}`),a.message,t);break;case"endsWith":yn(s,RegExp(`${Yp(a.value,t)}$`),a.message,t);break;case"datetime":vs(s,"date-time",a.message,t);break;case"date":vs(s,"date",a.message,t);break;case"time":vs(s,"time",a.message,t);break;case"duration":vs(s,"duration",a.message,t);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"includes":{yn(s,RegExp(Yp(a.value,t)),a.message,t);break}case"ip":{a.version!=="v6"&&vs(s,"ipv4",a.message,t),a.version!=="v4"&&vs(s,"ipv6",a.message,t);break}case"base64url":yn(s,ys.base64url,a.message,t);break;case"jwt":yn(s,ys.jwt,a.message,t);break;case"cidr":{a.version!=="v6"&&yn(s,ys.ipv4Cidr,a.message,t),a.version!=="v4"&&yn(s,ys.ipv6Cidr,a.message,t);break}case"emoji":yn(s,ys.emoji(),a.message,t);break;case"ulid":{yn(s,ys.ulid,a.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{vs(s,"binary",a.message,t);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{yn(s,ys.base64,a.message,t);break}}break}case"nanoid":yn(s,ys.nanoid,a.message,t)}return s}function Yp(e,t){return t.patternStrategy==="escape"?dV(e):e}var uV=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function dV(e){let t="";for(let s=0;s<e.length;s++)uV.has(e[s])||(t+="\\"),t+=e[s];return t}function vs(e,t,s,a){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&&a.errorMessages&&{errorMessage:{format:s}}})):e.format=t}function yn(e,t,s,a){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:iS(t,a),...s&&a.errorMessages&&{errorMessage:{pattern:s}}})):e.pattern=iS(t,a)}function iS(e,t){var s;if(!t.applyRegexFlags||!e.flags)return e.source;const a={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=a.i?e.source.toLowerCase():e.source;let l="",u=!1,d=!1,p=!1;for(let h=0;h<i.length;h++){if(u){l+=i[h],u=!1;continue}if(a.i){if(d){if(i[h].match(/[a-z]/)){p?(l+=i[h],l+=`${i[h-2]}-${i[h]}`.toUpperCase(),p=!1):i[h+1]==="-"&&((s=i[h+2])!=null&&s.match(/[a-z]/))?(l+=i[h],p=!0):l+=`${i[h]}${i[h].toUpperCase()}`;continue}}else if(i[h].match(/[a-z]/)){l+=`[${i[h]}${i[h].toUpperCase()}]`;continue}}if(a.m){if(i[h]==="^"){l+=`(^|(?<=[\r
|
|
87
|
+
]))`;continue}else if(i[h]==="$"){l+=`($|(?=[\r
|
|
88
|
+
]))`;continue}}if(a.s&&i[h]==="."){l+=d?`${i[h]}\r
|
|
89
|
+
`:`[${i[h]}\r
|
|
90
|
+
]`;continue}l+=i[h],i[h]==="\\"?u=!0:d&&i[h]==="]"?d=!1:!d&&i[h]==="["&&(d=!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 sC(e,t){var s,a,i,l,u,d;const p={type:"object",additionalProperties:(s=ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?s:t.allowedAdditionalProperties};if(((a=e.keyType)==null?void 0:a._def.typeName)===Ve.ZodString&&((i=e.keyType._def.checks)!=null&&i.length)){const{type:h,...y}=nC(e.keyType._def,t);return{...p,propertyNames:y}}else{if(((l=e.keyType)==null?void 0:l._def.typeName)===Ve.ZodEnum)return{...p,propertyNames:{enum:e.keyType._def.values}};if(((u=e.keyType)==null?void 0:u._def.typeName)===Ve.ZodBranded&&e.keyType._def.type._def.typeName===Ve.ZodString&&((d=e.keyType._def.type._def.checks)!=null&&d.length)){const{type:h,...y}=eC(e.keyType._def,t);return{...p,propertyNames:y}}}return p}function fV(e,t){if(t.mapStrategy==="record")return sC(e,t);const s=ut(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Gn(),a=ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Gn();return{type:"array",maxItems:125,items:{type:"array",items:[s,a],minItems:2,maxItems:2}}}function hV(e){const t=e.values,a=Object.keys(e.values).filter(l=>typeof t[t[l]]!="number").map(l=>t[l]),i=Array.from(new Set(a.map(l=>typeof l)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:a}}function pV(){return{not:Gn()}}function mV(){return{type:"null"}}var qm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function gV(e,t){const s=e.options instanceof Map?Array.from(e.options.values()):e.options;if(s.every(a=>a._def.typeName in qm&&(!a._def.checks||!a._def.checks.length))){const a=s.reduce((i,l)=>{const u=qm[l._def.typeName];return u&&!i.includes(u)?[...i,u]:i},[]);return{type:a.length>1?a:a[0]}}else if(s.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){const a=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(a.length===s.length){const i=a.filter((l,u,d)=>d.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(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((a,i)=>[...a,...i._def.values.filter(l=>!a.includes(l))],[])};return yV(e,t)}var yV=(e,t)=>{const s=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((a,i)=>ut(a._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(a=>!!a&&(!t.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return s.length?{anyOf:s}:void 0};function vV(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[qm[e.innerType._def.typeName],"null"]};const s=ut(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function bV(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 xV(e,t){const s={type:"object",properties:{}},a=[],i=e.shape();for(const u in i){let d=i[u];if(d===void 0||d._def===void 0)continue;const p=SV(d),h=ut(d._def,{...t,currentPath:[...t.currentPath,"properties",u],propertyPath:[...t.currentPath,"properties",u]});h!==void 0&&(s.properties[u]=h,p||a.push(u))}a.length&&(s.required=a);const l=wV(e,t);return l!==void 0&&(s.additionalProperties=l),s}function wV(e,t){if(e.catchall._def.typeName!=="ZodNever")return ut(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 SV(e){try{return e.isOptional()}catch{return!0}}var EV=(e,t)=>{var s;if(t.currentPath.toString()===((s=t.propertyPath)==null?void 0:s.toString()))return ut(e.innerType._def,t);const a=ut(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Gn()},a]}:Gn()},NV=(e,t)=>{if(t.pipeStrategy==="input")return ut(e.in._def,t);if(t.pipeStrategy==="output")return ut(e.out._def,t);const s=ut(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),a=ut(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,a].filter(i=>i!==void 0)}};function TV(e,t){return ut(e.type._def,t)}function jV(e,t){const a={type:"array",uniqueItems:!0,items:ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(a.minItems=e.minSize.value),e.maxSize&&(a.maxItems=e.maxSize.value),a}function CV(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((s,a)=>ut(s._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[]),additionalItems:ut(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((s,a)=>ut(s._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[])}}function RV(){return{not:Gn()}}function AV(){return Gn()}var _V=(e,t)=>ut(e.innerType._def,t),kV=(e,t,s)=>{switch(t){case Ve.ZodString:return nC(e,s);case Ve.ZodNumber:return bV(e);case Ve.ZodObject:return xV(e,s);case Ve.ZodBigInt:return eV(e);case Ve.ZodBoolean:return tV();case Ve.ZodDate:return tC(e,s);case Ve.ZodUndefined:return RV();case Ve.ZodNull:return mV();case Ve.ZodArray:return QU(e,s);case Ve.ZodUnion:case Ve.ZodDiscriminatedUnion:return gV(e,s);case Ve.ZodIntersection:return lV(e,s);case Ve.ZodTuple:return CV(e,s);case Ve.ZodRecord:return sC(e,s);case Ve.ZodLiteral:return cV(e);case Ve.ZodEnum:return iV(e);case Ve.ZodNativeEnum:return hV(e);case Ve.ZodNullable:return vV(e,s);case Ve.ZodOptional:return EV(e,s);case Ve.ZodMap:return fV(e,s);case Ve.ZodSet:return jV(e,s);case Ve.ZodLazy:return()=>e.getter()._def;case Ve.ZodPromise:return TV(e,s);case Ve.ZodNaN:case Ve.ZodNever:return pV();case Ve.ZodEffects:return aV(e,s);case Ve.ZodAny:return Gn();case Ve.ZodUnknown:return AV();case Ve.ZodDefault:return rV(e,s);case Ve.ZodBranded:return eC(e,s);case Ve.ZodReadonly:return _V(e,s);case Ve.ZodCatch:return nV(e,s);case Ve.ZodPipeline:return NV(e,s);case Ve.ZodFunction:case Ve.ZodVoid:case Ve.ZodSymbol:return;default:return(a=>{})()}},MV=(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 ut(e,t,s=!1){var a;const i=t.seen.get(e);if(t.override){const p=(a=t.override)==null?void 0:a.call(t,e,t,i,s);if(p!==WU)return p}if(i&&!s){const p=OV(i,t);if(p!==void 0)return p}const l={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,l);const u=kV(e,e.typeName,t),d=typeof u=="function"?ut(u(),t):u;if(d&&DV(e,t,d),t.postProcess){const p=t.postProcess(d,e,t);return l.jsonSchema=d,p}return l.jsonSchema=d,d}var OV=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:MV(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((s,a)=>t.currentPath[a]===s)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Gn()):t.$refStrategy==="seen"?Gn():void 0}},DV=(e,t,s)=>(e.description&&(s.description=e.description),s),zV=e=>{const t=JU(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(([a,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,a],jsonSchema:void 0}]))}},IV=(e,t)=>{var s;const a=zV(t);let i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((h,[y,v])=>{var x;return{...h,[y]:(x=ut(v._def,{...a,currentPath:[...a.basePath,a.definitionPath,y]},!0))!=null?x:Gn()}},{}):void 0;const l=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,u=(s=ut(e._def,l===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,l]},!1))!=null?s:Gn(),d=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;d!==void 0&&(u.title=d);const p=l===void 0?i?{...u,[a.definitionPath]:i}:u:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,l].join("/"),[a.definitionPath]:{...i,[l]:u}};return p.$schema="http://json-schema.org/draft-07/schema#",p},Ym=Symbol.for("vercel.ai.schema");function LV(e){let t;return()=>(t==null&&(t=e()),t)}function Kd(e,{validate:t}={}){return{[Ym]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function PV(e){return typeof e=="object"&&e!==null&&Ym in e&&e[Ym]===!0&&"jsonSchema"in e&&"validate"in e}function uy(e){return e==null?Kd({properties:{},additionalProperties:!1}):PV(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?rC(e):UV(e):e()}function UV(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 eo({value:t,cause:s.issues})}}})}function VV(e,t){var s;const a=(s=void 0)!=null?s:!1;return Kd(()=>IV(e,{$refStrategy:a?"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 $V(e,t){var s;const a=(s=void 0)!=null?s:!1;return Kd(()=>cy(T8(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"})),{validate:async i=>{const l=await Hj(e,i);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function BV(e){return"_zod"in e}function rC(e,t){return BV(e)?$V(e):VV(e)}async function oS({value:e,schema:t,context:s}){const a=await Vl({value:e,schema:t,context:s});if(!a.success)throw eo.wrap({value:e,cause:a.error,context:s});return a.value}async function Vl({value:e,schema:t,context:s}){const a=uy(t);try{if(a.validate==null)return{success:!0,value:e,rawValue:e};const i=await a.validate(e);return i.success?{success:!0,value:i.value,rawValue:e}:{success:!1,error:eo.wrap({value:e,cause:i.error,context:s}),rawValue:e}}catch(i){return{success:!1,error:eo.wrap({value:e,cause:i,context:s}),rawValue:e}}}async function $a({text:e,schema:t}){try{const s=KU(e);return t==null?{success:!0,value:s,rawValue:s}:await Vl({value:s,schema:t})}catch(s){return{success:!1,error:C1.isInstance(s)?s:new C1({text:e,cause:s}),rawValue:void 0}}}function ZV({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new FU).pipeThrough(new TransformStream({async transform({data:s},a){s!=="[DONE]"&&a.enqueue(await $a({text:s,schema:t}))}}))}async function Br(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var HV=Object.defineProperty,FV=(e,t)=>{for(var s in t)HV(e,s,{get:t[s],enumerable:!0})},aC="AI_NoObjectGeneratedError",iC=`vercel.ai.error.${aC}`,qV=Symbol.for(iC),oC,Xr=class extends Bs{constructor({message:e="No object generated.",cause:t,text:s,response:a,usage:i,finishReason:l}){super({name:aC,message:e,cause:t}),this[oC]=!0,this.text=s,this.response=a,this.usage=i,this.finishReason=l}static isInstance(e){return Bs.hasMarker(e,iC)}};oC=qV;var lC="AI_UIMessageStreamError",cC=`vercel.ai.error.${lC}`,YV=Symbol.for(cC),uC,Mi=class extends Bs{constructor({chunkType:e,chunkId:t,message:s}){super({name:lC,message:s}),this[uC]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Bs.hasMarker(e,cC)}};uC=YV;var dC=Sn([be(),Rd(Uint8Array),Rd(ArrayBuffer),Qj(e=>{var t,s;return(s=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?s:!1},{message:"Must be a Buffer"})]),$l=VU(()=>Sn([pU(),be(),uU(),bn(),Pl(be(),$l.optional()),fo($l)])),Ge=Pl(be(),Pl(be(),$l.optional())),fC=mt({type:Ie("text"),text:be(),providerOptions:Ge.optional()}),GV=mt({type:Ie("image"),image:Sn([dC,Rd(URL)]),mediaType:be().optional(),providerOptions:Ge.optional()}),hC=mt({type:Ie("file"),data:Sn([dC,Rd(URL)]),filename:be().optional(),mediaType:be(),providerOptions:Ge.optional()}),XV=mt({type:Ie("reasoning"),text:be(),providerOptions:Ge.optional()}),KV=mt({type:Ie("tool-call"),toolCallId:be(),toolName:be(),input:Ds(),providerOptions:Ge.optional(),providerExecuted:bn().optional()}),WV=bU("type",[mt({type:Ie("text"),value:be(),providerOptions:Ge.optional()}),mt({type:Ie("json"),value:$l,providerOptions:Ge.optional()}),mt({type:Ie("execution-denied"),reason:be().optional(),providerOptions:Ge.optional()}),mt({type:Ie("error-text"),value:be(),providerOptions:Ge.optional()}),mt({type:Ie("error-json"),value:$l,providerOptions:Ge.optional()}),mt({type:Ie("content"),value:fo(Sn([mt({type:Ie("text"),text:be(),providerOptions:Ge.optional()}),mt({type:Ie("media"),data:be(),mediaType:be()}),mt({type:Ie("file-data"),data:be(),mediaType:be(),filename:be().optional(),providerOptions:Ge.optional()}),mt({type:Ie("file-url"),url:be(),providerOptions:Ge.optional()}),mt({type:Ie("file-id"),fileId:Sn([be(),Pl(be(),be())]),providerOptions:Ge.optional()}),mt({type:Ie("image-data"),data:be(),mediaType:be(),providerOptions:Ge.optional()}),mt({type:Ie("image-url"),url:be(),providerOptions:Ge.optional()}),mt({type:Ie("image-file-id"),fileId:Sn([be(),Pl(be(),be())]),providerOptions:Ge.optional()}),mt({type:Ie("custom"),providerOptions:Ge.optional()})]))})]),pC=mt({type:Ie("tool-result"),toolCallId:be(),toolName:be(),output:WV,providerOptions:Ge.optional()}),JV=mt({type:Ie("tool-approval-request"),approvalId:be(),toolCallId:be()}),QV=mt({type:Ie("tool-approval-response"),approvalId:be(),approved:bn(),reason:be().optional()}),e$=mt({role:Ie("system"),content:be(),providerOptions:Ge.optional()}),t$=mt({role:Ie("user"),content:Sn([be(),fo(Sn([fC,GV,hC]))]),providerOptions:Ge.optional()}),n$=mt({role:Ie("assistant"),content:Sn([be(),fo(Sn([fC,hC,XV,KV,pC,JV]))]),providerOptions:Ge.optional()}),s$=mt({role:Ie("tool"),content:fo(Sn([pC,QV])),providerOptions:Ge.optional()});Sn([e$,t$,n$,s$]);function mC(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 a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];if(i===void 0)continue;const l=a in e?e[a]:void 0,u=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),d=l!=null&&typeof l=="object"&&!Array.isArray(l)&&!(l instanceof Date)&&!(l instanceof RegExp);u&&d?s[a]=mC(l,i):s[a]=i}return s}var r$={};FV(r$,{array:()=>l$,choice:()=>c$,json:()=>u$,object:()=>o$,text:()=>i$});function a$(e){const t=["ROOT"];let s=-1,a=null;function i(p,h,y){switch(p){case'"':{s=h,t.pop(),t.push(y),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=h,a=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(p,h){switch(p){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=h,t.pop();break}}}function u(p,h){switch(p){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=h,t.pop();break}}}for(let p=0;p<e.length;p++){const h=e[p];switch(t[t.length-1]){case"ROOT":i(h,p,"FINISH");break;case"INSIDE_OBJECT_START":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{s=p,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,p,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{l(h,p);break}case"INSIDE_STRING":{switch(h){case'"':{t.pop(),s=p;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:s=p}break}case"INSIDE_ARRAY_START":{h==="]"?(s=p,t.pop()):(s=p,i(h,p,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(h){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=p,t.pop();break}default:{s=p;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(h,p,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),s=p;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=p;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,p),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,p);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,p);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,p);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const v=e.substring(a,p+1);!"false".startsWith(v)&&!"true".startsWith(v)&&!"null".startsWith(v)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,p):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,p)):s=p;break}}}let d=e.slice(0,s+1);for(let p=t.length-1;p>=0;p--)switch(t[p]){case"INSIDE_STRING":{d+='"';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":{d+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{d+="]";break}case"INSIDE_LITERAL":{const y=e.substring(a,e.length);"true".startsWith(y)?d+="true".slice(y.length):"false".startsWith(y)?d+="false".slice(y.length):"null".startsWith(y)&&(d+="null".slice(y.length))}}return d}async function Wl(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await $a({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await $a({text:a$(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var i$=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),o$=({schema:e,name:t,description:s})=>{const a=uy(e);return{name:"object",responseFormat:Br(a.jsonSchema).then(i=>({type:"json",schema:i,...t!=null&&{name:t},...s!=null&&{description:s}})),async parseCompleteOutput({text:i},l){const u=await $a({text:i});if(!u.success)throw new Xr({message:"No object generated: could not parse the response.",cause:u.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const d=await Vl({value:u.value,schema:a});if(!d.success)throw new Xr({message:"No object generated: response did not match schema.",cause:d.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});return d.value},async parsePartialOutput({text:i}){const l=await Wl(i);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:l.value}}},createElementStreamTransform(){}}},l$=({element:e,name:t,description:s})=>{const a=uy(e);return{name:"array",responseFormat:Br(a.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 $a({text:i});if(!u.success)throw new Xr({message:"No object generated: could not parse the response.",cause:u.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const d=u.value;if(d==null||typeof d!="object"||!("elements"in d)||!Array.isArray(d.elements))throw new Xr({message:"No object generated: response did not match schema.",cause:new eo({value:d,cause:"response must be an object with an elements array"}),text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});for(const p of d.elements){const h=await Vl({value:p,schema:a});if(!h.success)throw new Xr({message:"No object generated: response did not match schema.",cause:h.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason})}return d.elements},async parsePartialOutput({text:i}){const l=await Wl(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 d=l.state==="repaired-parse"&&u.elements.length>0?u.elements.slice(0,-1):u.elements,p=[];for(const h of d){const y=await Vl({value:h,schema:a});y.success&&p.push(y.value)}return{partial:p}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:l},u){if(l!=null)for(;i<l.length;i++)u.enqueue(l[i])}})}}},c$=({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:a},i){const l=await $a({text:a});if(!l.success)throw new Xr({message:"No object generated: could not parse the response.",cause:l.error,text:a,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 Xr({message:"No object generated: response did not match schema.",cause:new eo({value:u,cause:"response must be an object that contains a choice value."}),text:a,response:i.response,usage:i.usage,finishReason:i.finishReason});return u.result},async parsePartialOutput({text:a}){const i=await Wl(a);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(d=>d.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(){}}),u$=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:s},a){const i=await $a({text:s});if(!i.success)throw new Xr({message:"No object generated: could not parse the response.",cause:i.error,text:s,response:a.response,usage:a.usage,finishReason:a.finishReason});return i.value},async parsePartialOutput({text:s}){const a=await Wl(s);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return a.value===void 0?void 0:{partial:a.value}}},createElementStreamTransform(){}});Kl({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 d$=LV(()=>rC(Sn([wt({type:Ie("text-start"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("text-delta"),id:be(),delta:be(),providerMetadata:Ge.optional()}),wt({type:Ie("text-end"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("error"),errorText:be()}),wt({type:Ie("tool-input-start"),toolCallId:be(),toolName:be(),providerExecuted:bn().optional(),providerMetadata:Ge.optional(),dynamic:bn().optional(),title:be().optional()}),wt({type:Ie("tool-input-delta"),toolCallId:be(),inputTextDelta:be()}),wt({type:Ie("tool-input-available"),toolCallId:be(),toolName:be(),input:Ds(),providerExecuted:bn().optional(),providerMetadata:Ge.optional(),dynamic:bn().optional(),title:be().optional()}),wt({type:Ie("tool-input-error"),toolCallId:be(),toolName:be(),input:Ds(),providerExecuted:bn().optional(),providerMetadata:Ge.optional(),dynamic:bn().optional(),errorText:be(),title:be().optional()}),wt({type:Ie("tool-approval-request"),approvalId:be(),toolCallId:be()}),wt({type:Ie("tool-output-available"),toolCallId:be(),output:Ds(),providerExecuted:bn().optional(),providerMetadata:Ge.optional(),dynamic:bn().optional(),preliminary:bn().optional()}),wt({type:Ie("tool-output-error"),toolCallId:be(),errorText:be(),providerExecuted:bn().optional(),providerMetadata:Ge.optional(),dynamic:bn().optional()}),wt({type:Ie("tool-output-denied"),toolCallId:be()}),wt({type:Ie("reasoning-start"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("reasoning-delta"),id:be(),delta:be(),providerMetadata:Ge.optional()}),wt({type:Ie("reasoning-end"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("source-url"),sourceId:be(),url:be(),title:be().optional(),providerMetadata:Ge.optional()}),wt({type:Ie("source-document"),sourceId:be(),mediaType:be(),title:be(),filename:be().optional(),providerMetadata:Ge.optional()}),wt({type:Ie("file"),url:be(),mediaType:be(),providerMetadata:Ge.optional()}),wt({type:Qj(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:be().optional(),data:Ds(),transient:bn().optional()}),wt({type:Ie("start-step")}),wt({type:Ie("finish-step")}),wt({type:Ie("start"),messageId:be().optional(),messageMetadata:Ds().optional()}),wt({type:Ie("finish"),finishReason:Kj(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Ds().optional()}),wt({type:Ie("abort"),reason:be().optional()}),wt({type:Ie("message-metadata"),messageMetadata:Ds()})])));function f$(e){return e.type.startsWith("data-")}function Gm(e){return e.type.startsWith("tool-")}function gC(e){return e.type==="dynamic-tool"}function Ba(e){return Gm(e)||gC(e)}function Xm(e){return e.type.split("-").slice(1).join("-")}function yC(e){return gC(e)?e.toolName:Xm(e)}function h$({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function p$({stream:e,messageMetadataSchema:t,dataPartSchemas:s,runUpdateMessageJob:a,onError:i,onToolCall:l,onData:u}){return e.pipeThrough(new TransformStream({async transform(d,p){await a(async({state:h,write:y})=>{var v,x,w,N;function T(E){const R=h.message.parts.filter(Ba).find(O=>O.toolCallId===E);if(R==null)throw new Mi({chunkType:"tool-invocation",chunkId:E,message:`No tool invocation found for tool call ID "${E}".`});return R}function _(E){var A;const R=h.message.parts.find(z=>Gm(z)&&z.toolCallId===E.toolCallId),O=E,M=R;if(R!=null){R.state=E.state,M.input=O.input,M.output=O.output,M.errorText=O.errorText,M.rawInput=O.rawInput,M.preliminary=O.preliminary,E.title!==void 0&&(M.title=E.title),M.providerExecuted=(A=O.providerExecuted)!=null?A:R.providerExecuted;const z=O.providerMetadata;if(z!=null)if(E.state==="output-available"||E.state==="output-error"){const F=R;F.resultProviderMetadata=z}else R.callProviderMetadata=z}else h.message.parts.push({type:`tool-${E.toolName}`,toolCallId:E.toolCallId,state:E.state,title:E.title,input:O.input,output:O.output,rawInput:O.rawInput,errorText:O.errorText,providerExecuted:O.providerExecuted,preliminary:O.preliminary,...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}:{}})}function C(E){var A,R;const O=h.message.parts.find(F=>F.type==="dynamic-tool"&&F.toolCallId===E.toolCallId),M=E,z=O;if(O!=null){O.state=E.state,z.toolName=E.toolName,z.input=M.input,z.output=M.output,z.errorText=M.errorText,z.rawInput=(A=M.rawInput)!=null?A:z.rawInput,z.preliminary=M.preliminary,E.title!==void 0&&(z.title=E.title),z.providerExecuted=(R=M.providerExecuted)!=null?R:O.providerExecuted;const F=M.providerMetadata;if(F!=null)if(E.state==="output-available"||E.state==="output-error"){const Z=O;Z.resultProviderMetadata=F}else O.callProviderMetadata=F}else h.message.parts.push({type:"dynamic-tool",toolName:E.toolName,toolCallId:E.toolCallId,state:E.state,input:M.input,output:M.output,errorText:M.errorText,preliminary:M.preliminary,providerExecuted:M.providerExecuted,title:E.title,...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}:{}})}async function j(E){if(E!=null){const A=h.message.metadata!=null?mC(h.message.metadata,E):E;t!=null&&await oS({value:A,schema:t,context:{field:"message.metadata",entityId:h.message.id}}),h.message.metadata=A}}switch(d.type){case"text-start":{const E={type:"text",text:"",providerMetadata:d.providerMetadata,state:"streaming"};h.activeTextParts[d.id]=E,h.message.parts.push(E),y();break}case"text-delta":{const E=h.activeTextParts[d.id];if(E==null)throw new Mi({chunkType:"text-delta",chunkId:d.id,message:`Received text-delta for missing text part with ID "${d.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});E.text+=d.delta,E.providerMetadata=(v=d.providerMetadata)!=null?v:E.providerMetadata,y();break}case"text-end":{const E=h.activeTextParts[d.id];if(E==null)throw new Mi({chunkType:"text-end",chunkId:d.id,message:`Received text-end for missing text part with ID "${d.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});E.state="done",E.providerMetadata=(x=d.providerMetadata)!=null?x:E.providerMetadata,delete h.activeTextParts[d.id],y();break}case"reasoning-start":{const E={type:"reasoning",text:"",providerMetadata:d.providerMetadata,state:"streaming"};h.activeReasoningParts[d.id]=E,h.message.parts.push(E),y();break}case"reasoning-delta":{const E=h.activeReasoningParts[d.id];if(E==null)throw new Mi({chunkType:"reasoning-delta",chunkId:d.id,message:`Received reasoning-delta for missing reasoning part with ID "${d.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});E.text+=d.delta,E.providerMetadata=(w=d.providerMetadata)!=null?w:E.providerMetadata,y();break}case"reasoning-end":{const E=h.activeReasoningParts[d.id];if(E==null)throw new Mi({chunkType:"reasoning-end",chunkId:d.id,message:`Received reasoning-end for missing reasoning part with ID "${d.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});E.providerMetadata=(N=d.providerMetadata)!=null?N:E.providerMetadata,E.state="done",delete h.activeReasoningParts[d.id],y();break}case"file":{h.message.parts.push({type:"file",mediaType:d.mediaType,url:d.url,...d.providerMetadata!=null?{providerMetadata:d.providerMetadata}:{}}),y();break}case"source-url":{h.message.parts.push({type:"source-url",sourceId:d.sourceId,url:d.url,title:d.title,providerMetadata:d.providerMetadata}),y();break}case"source-document":{h.message.parts.push({type:"source-document",sourceId:d.sourceId,mediaType:d.mediaType,title:d.title,filename:d.filename,providerMetadata:d.providerMetadata}),y();break}case"tool-input-start":{const E=h.message.parts.filter(Gm);h.partialToolCalls[d.toolCallId]={text:"",toolName:d.toolName,index:E.length,dynamic:d.dynamic,title:d.title},d.dynamic?C({toolCallId:d.toolCallId,toolName:d.toolName,state:"input-streaming",input:void 0,providerExecuted:d.providerExecuted,title:d.title,providerMetadata:d.providerMetadata}):_({toolCallId:d.toolCallId,toolName:d.toolName,state:"input-streaming",input:void 0,providerExecuted:d.providerExecuted,title:d.title,providerMetadata:d.providerMetadata}),y();break}case"tool-input-delta":{const E=h.partialToolCalls[d.toolCallId];if(E==null)throw new Mi({chunkType:"tool-input-delta",chunkId:d.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${d.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});E.text+=d.inputTextDelta;const{value:A}=await Wl(E.text);E.dynamic?C({toolCallId:d.toolCallId,toolName:E.toolName,state:"input-streaming",input:A,title:E.title}):_({toolCallId:d.toolCallId,toolName:E.toolName,state:"input-streaming",input:A,title:E.title}),y();break}case"tool-input-available":{d.dynamic?C({toolCallId:d.toolCallId,toolName:d.toolName,state:"input-available",input:d.input,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata,title:d.title}):_({toolCallId:d.toolCallId,toolName:d.toolName,state:"input-available",input:d.input,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata,title:d.title}),y(),l&&!d.providerExecuted&&await l({toolCall:d});break}case"tool-input-error":{const E=h.message.parts.filter(Ba).find(R=>R.toolCallId===d.toolCallId);(E!=null?E.type==="dynamic-tool":!!d.dynamic)?C({toolCallId:d.toolCallId,toolName:d.toolName,state:"output-error",input:d.input,errorText:d.errorText,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata}):_({toolCallId:d.toolCallId,toolName:d.toolName,state:"output-error",input:void 0,rawInput:d.input,errorText:d.errorText,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata}),y();break}case"tool-approval-request":{const E=T(d.toolCallId);E.state="approval-requested",E.approval={id:d.approvalId},y();break}case"tool-output-denied":{const E=T(d.toolCallId);E.state="output-denied",y();break}case"tool-output-available":{const E=T(d.toolCallId);E.type==="dynamic-tool"?C({toolCallId:d.toolCallId,toolName:E.toolName,state:"output-available",input:E.input,output:d.output,preliminary:d.preliminary,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata,title:E.title}):_({toolCallId:d.toolCallId,toolName:Xm(E),state:"output-available",input:E.input,output:d.output,providerExecuted:d.providerExecuted,preliminary:d.preliminary,providerMetadata:d.providerMetadata,title:E.title}),y();break}case"tool-output-error":{const E=T(d.toolCallId);E.type==="dynamic-tool"?C({toolCallId:d.toolCallId,toolName:E.toolName,state:"output-error",input:E.input,errorText:d.errorText,providerExecuted:d.providerExecuted,providerMetadata:d.providerMetadata,title:E.title}):_({toolCallId:d.toolCallId,toolName:Xm(E),state:"output-error",input:E.input,rawInput:E.rawInput,errorText:d.errorText,providerExecuted:d.providerExecuted,providerMetadata:d.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":{d.messageId!=null&&(h.message.id=d.messageId),await j(d.messageMetadata),(d.messageId!=null||d.messageMetadata!=null)&&y();break}case"finish":{d.finishReason!=null&&(h.finishReason=d.finishReason),await j(d.messageMetadata),d.messageMetadata!=null&&y();break}case"message-metadata":{await j(d.messageMetadata),d.messageMetadata!=null&&y();break}case"error":{i?.(new Error(d.errorText));break}default:if(f$(d)){if(s?.[d.type]!=null){const R=h.message.parts.findIndex(M=>"id"in M&&"data"in M&&M.id===d.id&&M.type===d.type),O=R>=0?R:h.message.parts.length;await oS({value:d.data,schema:s[d.type],context:{field:`message.parts[${O}].data`,entityName:d.type,entityId:d.id}})}const E=d;if(E.transient){u?.(E);break}const A=E.id!=null?h.message.parts.find(R=>E.type===R.type&&E.id===R.id):void 0;A!=null?A.data=E.data:h.message.parts.push(E),u?.(E),y()}}p.enqueue(d)})}}))}async function m$({stream:e,onError:t}){const s=e.getReader();try{for(;;){const{done:a}=await s.read();if(a)break}}catch(a){t?.(a)}finally{s.releaseLock()}}Kl({prefix:"aitxt",size:24});Kl({prefix:"aiobj",size:24});var g$=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(a){s(a)}}),this.processQueue()})}};Kl({prefix:"aiobj",size:24});async function y$(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:a}=t,i=await new Promise((l,u)=>{const d=new FileReader;d.onload=p=>{var h;l((h=p.target)==null?void 0:h.result)},d.onerror=p=>u(p),d.readAsDataURL(t)});return{type:"file",mediaType:a,filename:s,url:i}}))}var v$=class{constructor({api:e="/api/chat",credentials:t,headers:s,body:a,fetch:i,prepareSendMessagesRequest:l,prepareReconnectToStreamRequest:u}){this.api=e,this.credentials=t,this.headers=s,this.body=a,this.fetch=i,this.prepareSendMessagesRequest=l,this.prepareReconnectToStreamRequest=u}async sendMessages({abortSignal:e,...t}){var s,a,i,l,u;const d=await Br(this.body),p=await Br(this.headers),h=await Br(this.credentials),y={...ki(p),...ki(t.headers)},v=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...d,...t.body},headers:y,credentials:h,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),x=(a=v?.api)!=null?a:this.api,w=v?.headers!==void 0?ki(v.headers):y,N=v?.body!==void 0?v.body:{...d,...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,a,i,l;const u=await Br(this.body),d=await Br(this.headers),p=await Br(this.credentials),h={...ki(d),...ki(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:p,requestMetadata:e.metadata})),v=(s=y?.api)!=null?s:`${this.api}/${e.chatId}/stream`,x=y?.headers!==void 0?ki(y.headers):h,w=(a=y?.credentials)!=null?a:p,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)}},vC=class extends v${constructor(e={}){super(e)}processResponseStream(e){return ZV({stream:e,schema:d$}).pipeThrough(new TransformStream({async transform(t,s){if(!t.success)throw t.error;s.enqueue(t.value)}}))}},b$=class{constructor({generateId:e=qU,id:t=e(),transport:s=new vC,messageMetadataSchema:a,dataPartSchemas:i,state:l,onError:u,onToolCall:d,onFinish:p,onData:h,sendAutomaticallyWhen:y}){this.activeResponse=void 0,this.jobExecutor=new g$,this.sendMessage=async(v,x)=>{var w,N,T,_;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 y$(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:(_=C.role)!=null?_:"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,_=T[T.length-1],C=j=>Ba(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,{..._,parts:_.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 _=this.state.messages,C=_[_.length-1],j=E=>Ba(E)&&E.toolCallId===x?{...E,state:v,output:w,errorText:N}:E;this.state.replaceMessage(_.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 A;E&&this.makeRequest({trigger:"submit-message",messageId:(A=this.lastMessage)==null?void 0:A.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=a,this.dataPartSchemas=i,this.state=l,this.onError=u,this.onToolCall=d,this.onFinish=p,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:a,messageId:i}){var l,u,d;let p;if(e==="resume-stream")try{const w=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:s,body:a});if(w==null)return;p=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:h$({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=p:N=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:w.abortController.signal,metadata:t,headers:s,body:a,trigger:e,messageId:i});const T=_=>this.jobExecutor.run(()=>_({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 m$({stream:p$({stream:N,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:T,onError:_=>{throw _}}),onError:_=>{throw _}}),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:(d=this.lastMessage)==null?void 0:d.id,metadata:t,headers:s,body:a})}};function x$({chat:e,placeholder:t="Ask AI...",inputExtras:s,inputStatus:a,inputValue:i,onInputChange:l}){const{messages:u,sendMessage:d,stop:p,status:h,clearChat:y,error:v,attachments:x,activeAttachments:w,toggleAttachment:N}=e,[T,_]=b.useState(""),C=i!==void 0,j=C?i:T,E=Z=>{C?l?.(Z):_(Z)},A=b.useRef(null),R=b.useRef(null),O=h==="streaming"||h==="submitted",M=x.length>0;b.useEffect(()=>{const Z=A.current;Z&&(Z.scrollTop=Z.scrollHeight)},[u]),b.useEffect(()=>{R.current?.focus()},[]);const z=Z=>{Z.preventDefault();const U=j.trim();!U||O||(E(""),d({text:U}))},F=Z=>{Z.stopPropagation(),Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),z(Z))};return f.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[f.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[u.length===0&&f.jsx("div",{className:"text-neutral-500 text-center py-8 select-none",children:t}),u.map(Z=>f.jsx("div",{className:`flex ${Z.role==="user"?"justify-end":"justify-start"}`,children:f.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${Z.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:(Z.parts??[]).map((U,H)=>{if(!U)return null;if(U.type==="text")return f.jsx("span",{children:U.text},H);if(Ba(U)){const W=yC(U),oe=Object.entries(U.input??{}).map(([ee,I])=>`${ee}: ${JSON.stringify(I)}`).join(", ");return f.jsxs("div",{className:"text-[11px] text-cyan-400/70 mt-1 font-mono",children:[f.jsx("span",{className:"text-neutral-500",children:"↳ "}),W,"(",oe,")"]},H)}return null})})},Z.id)),O&&u[u.length-1]?.role!=="assistant"&&f.jsx("div",{className:"flex justify-start",children:f.jsx("div",{className:"bg-neutral-800/50 border border-neutral-700/50 rounded-lg px-3 py-2 text-neutral-400",children:f.jsx("span",{className:"animate-pulse",children:"..."})})})]}),v&&f.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:[f.jsx(w_,{size:12}),f.jsx("span",{className:"truncate",children:v.message||"An error occurred"})]}),f.jsxs("div",{className:"px-3 py-2.5 border-t border-neutral-700/50 bg-neutral-900/50",children:[M&&f.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[f.jsx(F_,{size:11,className:"text-neutral-500 shrink-0"}),x.map(Z=>{const U=w.has(Z.label);return f.jsx("button",{type:"button",onClick:()=>N(Z.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${U?"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:Z.label},Z.label)}),w.size>0&&f.jsx("span",{className:"text-[10px] text-neutral-600 ml-1",children:"attached"})]}),f.jsxs("form",{onSubmit:z,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&&f.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:f.jsx(Q_,{size:12})}),f.jsx("input",{ref:R,type:"text",value:j,onChange:Z=>E(Z.target.value),onKeyDown:F,placeholder:t,className:"flex-1 bg-transparent outline-none text-neutral-100 placeholder:text-neutral-500 caret-emerald-400",disabled:O}),O?f.jsx("button",{type:"button",onClick:()=>p(),className:"p-1.5 rounded text-amber-400 hover:bg-amber-900/20 transition-colors",title:"Stop",children:f.jsx($S,{size:12})}):f.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 w$="modulepreload",S$=function(e){return"/"+e},lS={},Rl=function(t,s,a){let i=Promise.resolve();if(s&&s.length>0){let p=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]"),d=u?.nonce||u?.getAttribute("nonce");i=p(s.map(h=>{if(h=S$(h),h in lS)return;lS[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":w$,y||(x.as="script"),x.crossOrigin="",x.href=h,d&&x.setAttribute("nonce",d),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 d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return i.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},E$={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"},N$=`
|
|
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 T$(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const e=document.createElement("style");e.setAttribute("data-xterm-css",""),e.textContent=N$,document.head.appendChild(e)}function j$(e){return new Promise((t,s)=>{const a=new FileReader;a.onload=()=>{const i=a.result;t(i.split(",")[1])},a.onerror=s,a.readAsDataURL(e)})}function C$({relay:e,fontSize:t=12,fontFamily:s="'JetBrains Mono', 'Hack Nerd Font', monospace",configItems:a,onOpenSettings:i,onStartService:l}){const{status:u,error:d,exitCode:p,cwd:h,setCwd:y,sendInput:v,resize:x,onData:w,connect:N,disconnect:T}=e,[_,C]=b.useState(!1),{apiBaseUrl:j}=Xl(),E=b.useRef(null),A=b.useRef(null),R=b.useRef(null),O=b.useRef(null),[M,z]=b.useState(!1),[F,Z]=b.useState(!1),U=b.useRef(0);b.useEffect(()=>{const P=E.current;if(!P)return;const K=se=>{se.key===" "&&!se.metaKey&&!se.ctrlKey&&!se.altKey&&se.stopPropagation()};return P.addEventListener("keydown",K),()=>P.removeEventListener("keydown",K)},[]);const H=`${j}/api/relay/upload`,W=b.useCallback(async P=>{try{const K=await j$(P),se=await fetch(H,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,data:K})}),{path:te}=await se.json();return te||null}catch(K){return console.error("File upload failed:",K),null}},[H]);b.useEffect(()=>{const P=E.current;if(!P)return;const K=async se=>{if(!se.clipboardData)return;const te=Array.from(se.clipboardData.items).filter(ge=>ge.type.startsWith("image/"));if(te.length!==0){se.preventDefault(),se.stopPropagation();for(const ge of te){const he=ge.getAsFile();if(!he)continue;const pe=await W(he);pe&&v(pe)}}};return P.addEventListener("paste",K),()=>P.removeEventListener("paste",K)},[v,W]);const oe=b.useCallback(P=>{P.preventDefault(),P.dataTransfer.dropEffect="copy"},[]),ee=b.useCallback(P=>{P.preventDefault(),U.current++,P.dataTransfer.types.includes("Files")&&Z(!0)},[]),I=b.useCallback(P=>{P.preventDefault(),U.current--,U.current===0&&Z(!1)},[]),B=b.useCallback(async P=>{P.preventDefault(),U.current=0,Z(!1);const K=Array.from(P.dataTransfer.files).filter(se=>se.type.startsWith("image/"));if(K.length!==0)for(const se of K){const te=await W(se);te&&v(te)}},[v,W]);b.useEffect(()=>{let P=!1,K=null;async function se(){const[{Terminal:te},{FitAddon:ge},he]=await Promise.all([Rl(()=>import("./xterm-B-qIQCd3.js"),[]),Rl(()=>import("./addon-fit-DX4qG4td.js"),[]),Rl(()=>import("./addon-webgl-DCtw1yLn.js"),[]).catch(()=>null)]);if(T$(),P||!A.current)return;K=new te({fontSize:t,fontFamily:s,theme:E$,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:5e3,convertEol:!1,allowProposedApi:!0});const pe=new ge;if(K.loadAddon(pe),K.open(A.current),he)try{const xe=new he.WebglAddon;xe.onContextLoss(()=>{xe.dispose()}),K.loadAddon(xe)}catch{}try{pe.fit()}catch{}R.current=K,O.current=pe,x(K.cols,K.rows),K.onData(xe=>{v(xe)}),z(!0)}return se(),()=>{P=!0,K&&(K.dispose(),R.current=null,O.current=null)}},[]),b.useEffect(()=>{const P=R.current;if(P){P.options.fontSize=t,P.options.fontFamily=s;try{O.current?.fit()}catch{}}},[t,s]),b.useEffect(()=>{if(M)return w(P=>{R.current?.write(P)}),()=>{w(()=>{})}},[M,w]),b.useEffect(()=>{const P=A.current;if(!P||!M)return;const K=new ResizeObserver(()=>{const se=O.current,te=R.current;if(!(!se||!te))try{se.fit(),x(te.cols,te.rows)}catch{}});return K.observe(P),()=>K.disconnect()},[M,x]),b.useEffect(()=>{u==="connected"&&R.current&&R.current.focus()},[u]);const $=b.useCallback(()=>{u==="connected"&&R.current&&R.current.focus()},[u]),re=u==="error"&&d==="Relay service is not running",J=b.useCallback(async()=>{if(l){C(!0);try{await l()&&setTimeout(()=>N(),500)}finally{C(!1)}}},[l,N]);let D=null;return re?D=f.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[f.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:f.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Relay service not running"}),f.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."})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l&&f.jsx("button",{type:"button",onClick:J,disabled:_,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:_?"Starting...":"Start Service"}),f.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&&f.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"&&d?D=f.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[f.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:f.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),f.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),f.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:d}),p!==null&&p!==0&&f.jsxs("span",{className:"text-[10px] text-neutral-600",children:["Exit code ",p]}),f.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=f.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[f.jsx("div",{className:"w-8 h-8 rounded-full bg-neutral-800 border border-neutral-700 flex items-center justify-center",children:f.jsx("span",{className:"text-neutral-500 text-[14px]",children:"▷"})}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Terminal relay disconnected"}),f.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:"Set working directory and connect."})]}),f.jsxs("form",{className:"w-full",onSubmit:P=>{P.preventDefault(),N()},children:[f.jsx("label",{className:"text-[10px] font-mono text-neutral-500 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),f.jsx("input",{type:"text",value:h,onChange:P=>y(P.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"})]}),a&&a.length>0&&f.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:a.map(P=>f.jsxs("div",{className:"contents",children:[f.jsx("span",{className:"text-neutral-500",children:P.label}),f.jsx("span",{className:"text-neutral-400 truncate text-left",children:P.value})]},P.label))}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.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&&f.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=f.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[f.jsx("div",{className:"w-6 h-6 border-2 border-neutral-600 border-t-cyan-400 rounded-full animate-spin"}),f.jsx("span",{className:"text-[12px] text-neutral-400",children:"Connecting to relay..."}),f.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"})]})),f.jsxs("div",{ref:E,className:"relative flex flex-col h-full overflow-hidden",onClick:$,onDragOver:oe,onDragEnter:ee,onDragLeave:I,onDrop:B,children:[D&&f.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}),F&&f.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:f.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),f.jsx("div",{ref:A,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:D?"hidden":"visible",padding:"4px 8px"}})]})}function R$(e={}){const{url:t="ws://localhost:3600",systemPrompt:s,cwd:a,workspaceFiles:i,autoConnect:l=!1,sessionKey:u,orphanTTL:d,backend:p,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{}},[_,C]=b.useState("disconnected"),[j,E]=b.useState(null),[A,R]=b.useState(null),[O,M]=b.useState(null),[z,F]=b.useState(a||"~"),Z=b.useRef(null),U=b.useRef(null),H=b.useRef({cols:80,rows:24}),W=b.useRef(!1),oe=b.useRef(z);oe.current=z;const ee=b.useRef(N()),I=b.useRef(null),B=b.useCallback(he=>{const pe=Z.current;pe&&pe.readyState===WebSocket.OPEN&&pe.send(JSON.stringify(he))},[]),$=b.useCallback(()=>{U.current&&(clearTimeout(U.current),U.current=null);const he=Z.current;he&&(he.close(),Z.current=null),W.current=!1,C("disconnected")},[]),re=b.useCallback(()=>{const he=oe.current;return{type:"session:init",cols:H.current.cols,rows:H.current.rows,...s?{systemPrompt:s}:{},...he?{cwd:he}:{},...i?{workspaceFiles:i}:{},...d?{orphanTTL:d}:{},...p?{backend:p}:{},...h?{tmuxSession:h}:{},...y?{agent:y}:{},...v?{provider:v}:{},...x?{model:x}:{}}},[s,i,d,p,h,y,v,x]),J=b.useCallback(()=>{W.current||(W.current=!0,ee.current?B({type:"session:reconnect",sessionId:ee.current,cols:H.current.cols,rows:H.current.rows}):B(re()))},[B,re]),D=b.useCallback(async()=>{Z.current&&(Z.current.close(),Z.current=null),W.current=!1,C("connecting"),R(null),M(null);const he=t.replace(/^ws(s?):\/\//,"http$1://");try{await fetch(`${he}/health`,{signal:AbortSignal.timeout(2e3)})}catch{C("error"),R("Relay service is not running");return}const pe=new WebSocket(t);Z.current=pe,pe.onopen=()=>{J()},pe.onmessage=xe=>{try{const Re=JSON.parse(xe.data);switch(Re.type){case"session:ready":ee.current=Re.sessionId,T(Re.sessionId),E(Re.sessionId),C("connected"),R(null),M(null);break;case"session:expired":{ee.current=null,T(null),W.current=!1,I.current&&I.current("\x1B[2J\x1B[H"),B(re()),W.current=!0;break}case"session:error":C("error"),R(Re.error||"Session failed to start");break;case"terminal:data":I.current&&Re.data&&I.current(Re.data);break;case"session:exit":ee.current=null,T(null),E(null),M(Re.exitCode??null),Re.exitCode!==0?(C("error"),R(Re.reason||`Process exited with code ${Re.exitCode}`)):C("disconnected");break;case"session:detached":ee.current=null,T(null),E(null);break}}catch{}},pe.onclose=()=>{Z.current=null,W.current=!1,C(xe=>xe==="error"?xe:"disconnected")},pe.onerror=()=>{C("error"),R("Could not connect to relay")}},[t,J,B,s,i]),P=b.useCallback(he=>{B({type:"terminal:input",data:he})},[B]),K=b.useCallback(he=>{B({type:"terminal:input",data:he+"\r"})},[B]),se=b.useCallback((he,pe)=>{H.current={cols:he,rows:pe},W.current&&B({type:"terminal:resize",cols:he,rows:pe})},[B]),te=b.useCallback(he=>{I.current=he},[]);b.useEffect(()=>(l&&D(),()=>{$()}),[]);const ge=b.useCallback(()=>{if($(),ee.current=null,E(null),u)try{sessionStorage.removeItem(`hudson.relay.${u}`)}catch{}R(null),M(null),setTimeout(()=>D(),200)},[$,D,u]);return{status:_,sessionId:j,error:A,exitCode:O,cwd:z,setCwd:F,onData:te,sendInput:P,sendLine:K,resize:se,connect:D,disconnect:$,restart:ge}}var Gp,cS;function A$(){if(cS)return Gp;cS=1;function e(t,s){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let a,i=0;return function(...u){clearTimeout(a);const d=Date.now(),p=d-i,h=s-p;h<=0?(i=d,t.apply(this,u)):a=setTimeout(()=>{i=Date.now(),t.apply(this,u)},h)}}return Gp=e,Gp}var _$=A$();const k$=DS(_$);var bC=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},St=(e,t,s)=>(bC(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)},$r=(e,t,s,a)=>(bC(e,t,"write to private field"),t.set(e,s),s);function M$(e,t){return t!=null?k$(e,t):e}var is,Ju,Qu,gl,yl,vl,zi,Km,Wm,O$=class{constructor(e=[]){Ms(this,is,void 0),Ms(this,Ju,"ready"),Ms(this,Qu,void 0),Ms(this,gl,new Set),Ms(this,yl,new Set),Ms(this,vl,new Set),this.pushMessage=t=>{$r(this,is,St(this,is).concat(t)),St(this,zi).call(this)},this.popMessage=()=>{$r(this,is,St(this,is).slice(0,-1)),St(this,zi).call(this)},this.replaceMessage=(t,s)=>{$r(this,is,[...St(this,is).slice(0,t),this.snapshot(s),...St(this,is).slice(t+1)]),St(this,zi).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,s)=>{const a=s?M$(t,s):t;return St(this,gl).add(a),()=>{St(this,gl).delete(a)}},this["~registerStatusCallback"]=t=>(St(this,yl).add(t),()=>{St(this,yl).delete(t)}),this["~registerErrorCallback"]=t=>(St(this,vl).add(t),()=>{St(this,vl).delete(t)}),Ms(this,zi,()=>{St(this,gl).forEach(t=>t())}),Ms(this,Km,()=>{St(this,yl).forEach(t=>t())}),Ms(this,Wm,()=>{St(this,vl).forEach(t=>t())}),$r(this,is,e)}get status(){return St(this,Ju)}set status(e){$r(this,Ju,e),St(this,Km).call(this)}get error(){return St(this,Qu)}set error(e){$r(this,Qu,e),St(this,Wm).call(this)}get messages(){return St(this,is)}set messages(e){$r(this,is,[...e]),St(this,zi).call(this)}};is=new WeakMap;Ju=new WeakMap;Qu=new WeakMap;gl=new WeakMap;yl=new WeakMap;vl=new WeakMap;zi=new WeakMap;Km=new WeakMap;Wm=new WeakMap;var Ii,uS=class extends b${constructor({messages:e,...t}){const s=new O$(e);super({...t,state:s}),Ms(this,Ii,void 0),this["~registerMessagesCallback"]=(a,i)=>St(this,Ii)["~registerMessagesCallback"](a,i),this["~registerStatusCallback"]=a=>St(this,Ii)["~registerStatusCallback"](a),this["~registerErrorCallback"]=a=>St(this,Ii)["~registerErrorCallback"](a),$r(this,Ii,s)}};Ii=new WeakMap;function D$({experimental_throttle:e,resume:t=!1,...s}={}){const a=b.useRef("chat"in s?{}:{onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});"chat"in s||(a.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=a.current).onToolCall)==null?void 0:N.call(w,x)},onData:x=>{var w,N;return(N=(w=a.current).onData)==null?void 0:N.call(w,x)},onFinish:x=>{var w,N;return(N=(w=a.current).onFinish)==null?void 0:N.call(w,x)},onError:x=>{var w,N;return(N=(w=a.current).onError)==null?void 0:N.call(w,x)},sendAutomaticallyWhen:x=>{var w,N,T;return(T=(N=(w=a.current).sendAutomaticallyWhen)==null?void 0:N.call(w,x))!=null?T:!1}},l=b.useRef("chat"in s?s.chat:new uS(i));("chat"in s&&s.chat!==l.current||"id"in s&&l.current.id!==s.id)&&(l.current="chat"in s?s.chat:new uS(i));const d=b.useCallback(x=>l.current["~registerMessagesCallback"](x,e),[e,l.current.id]),p=b.useSyncExternalStore(d,()=>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:p,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 z$(e){try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}}function I$(e,t){try{localStorage.setItem(e,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("hudson:saved",{detail:{key:e}}))}catch{}}const L$=()=>()=>{},P$=()=>!0,U$=()=>!1;function V$(){return b.useSyncExternalStore(L$,P$,U$)}function ur(e,t){const s=V$(),[a,i]=b.useState(t),l=b.useRef(!1);if(s&&!l.current){l.current=!0;const u=z$(e);u!==void 0&&i(u)}return b.useEffect(()=>{s&&I$(e,a)},[e,a,s]),[a,i]}function $$(e){const t={};for(const s of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(s.label)){const a=s.content();a!==null&&(t[s.label.toLowerCase()]=a)}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 B$(e,t){e.current?.(t)}function Z$(e,t){e.current?.(t)}function H$(e){const t=new Set;for(const s of e??[])if(s.role==="assistant")for(const a of s.parts??[])a&&Ba(a)&&t.add(a.toolCallId);return t}function F$({toolset:e,chatId:t,initialMessages:s,context:a,onToolCall:i,mode:l,attachments:u,provider:d,model:p,sessionId:h,onSessionIdChange:y,onFinish:v,onError:x}){const w=b.useRef(i),N=b.useRef(v),T=b.useRef(x),_=b.useRef(h??crypto.randomUUID()),[C,j]=b.useState(new Set),E=b.useCallback($=>{j(re=>{const J=new Set(re);return J.has($)?J.delete($):J.add($),J})},[]),[A]=ur("hudson.settings",{}),R=l??A.aiMode??"api",O=b.useRef(C),M=b.useRef(u),z=b.useRef(a),F=b.useRef(e),Z=b.useRef(R),U=b.useRef(d),H=b.useRef(p);b.useEffect(()=>{w.current=i},[i]),b.useEffect(()=>{N.current=v},[v]),b.useEffect(()=>{T.current=x},[x]),b.useEffect(()=>{h&&h!==_.current&&(_.current=h)},[h]),b.useEffect(()=>{y?.(_.current)},[y]),b.useEffect(()=>{O.current=C},[C]),b.useEffect(()=>{M.current=u},[u]),b.useEffect(()=>{z.current=a},[a]),b.useEffect(()=>{F.current=e},[e]),b.useEffect(()=>{Z.current=R},[R]),b.useEffect(()=>{U.current=d},[d]),b.useEffect(()=>{H.current=p},[p]);const W=b.useMemo(()=>new vC({api:"/api/ai/chat",body:()=>$$({activeAttachmentsRef:O,attachmentsRef:M,contextRef:z,toolsetRef:F,modeRef:Z,sessionIdRef:_,providerRef:U,modelRef:H})}),[]),oe=D$({id:t,messages:s,transport:W,onFinish:$=>B$(N,$),onError:$=>Z$(T,$)}),ee=b.useRef(H$(s)),I=b.useCallback(()=>{const $=crypto.randomUUID();_.current=$,y?.($),ee.current.clear(),oe.setMessages([])},[oe,y]),{messages:B}=oe;return b.useEffect(()=>{if(w.current){for(const $ of B)if($.role==="assistant"){for(const re of $.parts??[])if(re&&Ba(re)){if("state"in re&&re.state==="input-streaming")continue;const J=re.toolCallId;if(!ee.current.has(J)){ee.current.add(J);const D=yC(re);w.current?.(D,re.input??{})}}}}},[B]),{messages:B,sendMessage:oe.sendMessage,stop:oe.stop,status:oe.status,setMessages:oe.setMessages,clearChat:I,error:oe.error,mode:R,attachments:u??[],activeAttachments:C,toggleAttachment:E}}function q$({app:e,commands:t,state:s,provider:a,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]),d=b.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:u,state:s}),[e.id,e.name,e.description,u,s]),p=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 F$({toolset:"intents",context:d,provider:a,model:i,onFinish:l,onToolCall:(h,y)=>{if(h!=="dispatch")return;const v=y.commandId;typeof v=="string"&&p(v)}})}const Y$="audio/ogg;codecs=opus";function G$(){return typeof MediaRecorder>"u"?void 0:["audio/ogg;codecs=opus","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function Xp(e){e?.getTracks().forEach(t=>t.stop())}function X$(e){return e.includes("wav")?"wav":e.includes("aac")||e.includes("mp4")?"aac":"opus"}function dS(e,t){return t||e.find(a=>a.type)?.type||Y$}function fS(e){const t=typeof window<"u"?window.location.origin:"this origin";if(e&&typeof e=="object"&&"code"in e&&"message"in e){const s=e;if(s.code==="network_error")return{status:"unavailable",message:"Vox Companion is not reachable on 127.0.0.1:43115. Install Vox.app, or launch it if it is already installed."};if(s.code==="http_error"){const a=s.message??"";return a.includes("Origin not allowed")||a.includes("403")?{status:"error",message:`Vox rejected this origin. Allowlist ${t} in Vox settings and try again.`}:{status:"error",message:"Vox returned an error while transcribing. Check Vox and try again."}}}if(e instanceof DOMException){if(e.name==="NotAllowedError")return{status:"error",message:"Microphone access was denied."};if(e.name==="NotFoundError")return{status:"error",message:"No microphone is available."}}return e instanceof Error?{status:"error",message:e.message}:{status:"error",message:"Voice capture failed."}}async function K$(){const t=(await Rl(()=>import("./index-TVkH_WDG.js"),[])).createVoxdClient();return{probe:()=>t.probe(),transcribe:({audio:s,format:a,language:i,metadata:l})=>t.transcribe({audio:s,format:a,language:i,metadata:l})}}function W$(e){const{onTranscript:t,surface:s="hudson-assistant",metadata:a,language:i="en",transcribe:l,probe:u}=e,[d,p]=b.useState("idle"),[h,y]=b.useState(null),[v,x]=b.useState(null),w=b.useRef(null),N=b.useRef(null),T=b.useRef([]),_=b.useRef(t);_.current=t;const C=b.useRef(a);C.current=a;const j=b.useRef(null),E=b.useMemo(()=>typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia,[]),A=b.useCallback(async()=>l?{probe:u??(async()=>!0),transcribe:l}:(j.current||(j.current=await K$()),j.current),[l,u]),R=b.useCallback(async(z,F)=>{if(Xp(N.current),N.current=null,w.current=null,z.length===0){p("error"),y("No audio was captured.");return}p("transcribing"),y(null);try{const Z=await A(),U=dS(z,F),W=(await Z.transcribe({audio:new Blob(z,{type:U}),format:X$(U),language:i,metadata:{surface:s,...C.current}})).text.trim();if(!W)throw new Error("Transcription returned empty text.");x(W),p("ready"),_.current(W)}catch(Z){const U=fS(Z);p(U.status),y(U.message)}},[A,i,s]),O=b.useCallback(async()=>{if(!(d==="recording"||d==="transcribing")){if(!E){p("error"),y("This browser cannot capture microphone audio.");return}y(null),x(null);try{if(!await(await A()).probe()){p("unavailable"),y("Vox Companion is not reachable on 127.0.0.1:43115. Install Vox.app, or launch it if it is already installed.");return}const Z=await navigator.mediaDevices.getUserMedia({audio:!0}),U=G$(),H=U?new MediaRecorder(Z,{mimeType:U}):new MediaRecorder(Z);T.current=[],N.current=Z,w.current=H,H.ondataavailable=W=>{W.data.size>0&&T.current.push(W.data)},H.onerror=()=>{Xp(N.current),N.current=null,w.current=null,T.current=[],p("error"),y("Voice capture failed while recording.")},H.onstop=()=>{const W=[...T.current];T.current=[],R(W,dS(W,H.mimeType||U||""))},H.start(),p("recording")}catch(z){const F=fS(z);p(F.status),y(F.message)}}},[R,A,E,d]),M=b.useCallback(()=>{const z=w.current;!z||z.state!=="recording"||(p("transcribing"),z.stop())},[]);return b.useEffect(()=>()=>{const z=w.current;if(z&&z.state==="recording")try{z.stop()}catch{}Xp(N.current),N.current=null,w.current=null,T.current=[]},[]),{status:d,error:h,lastTranscript:v,start:O,stop:M,isSupported:E}}function J$(){return typeof document>"u"?"wav":document.createElement("audio").canPlayType('audio/mp4; codecs="mp4a.40.2"')?"aac":"wav"}function Q$(){const{apiBaseUrl:e}=Xl(),[t,s]=b.useState("idle"),[a,i]=b.useState(null),l=b.useRef(null),u=b.useRef(null),d=b.useRef(0),p=b.useCallback(()=>{d.current+=1;const y=l.current;y&&(y.onended=null,y.onerror=null,y.pause(),l.current=null),u.current&&(URL.revokeObjectURL(u.current),u.current=null),s(v=>v==="speaking"||v==="synthesizing"?"idle":v)},[]),h=b.useCallback(async(y,v={})=>{if(!y||!y.trim())return;const x=d.current+1;d.current=x,s("synthesizing"),i(null);try{const w=await fetch(`${e}/v1/audio/speech`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:y,provider:v.provider,model:v.model,voice:v.voice||void 0,rate:v.rate,format:J$(),metadata:v.metadata})}),N=await w.json();if(!w.ok)throw new Error(N.error||`Speech synthesis failed (${w.status}).`);const T=N.audio?.base64??N.audioBase64,_=N.audio?.mimeType??N.mimeType??"audio/wav";if(!T)throw new Error("Speech synthesis returned no audio.");if(d.current!==x)return;l.current&&(l.current.pause(),l.current=null),u.current&&(URL.revokeObjectURL(u.current),u.current=null);const C=Uint8Array.from(atob(T),R=>R.charCodeAt(0)),j=new Blob([C],{type:_}),E=URL.createObjectURL(j),A=new Audio(E);l.current=A,u.current=E,s("speaking"),A.onended=()=>{l.current===A&&(l.current=null),u.current===E&&(URL.revokeObjectURL(E),u.current=null),s(R=>R==="speaking"?"idle":R)},A.onerror=()=>{l.current===A&&(l.current=null),u.current===E&&(URL.revokeObjectURL(E),u.current=null),s("error"),i("Reply audio could not be played in this browser.")},await A.play()}catch(w){if(d.current!==x)return;p(),s("error"),i(w instanceof Error?w.message:"Reply speech failed.")}},[e,p]);return b.useEffect(()=>()=>{const y=l.current;y&&(y.onended=null,y.onerror=null,y.pause()),u.current&&URL.revokeObjectURL(u.current),l.current=null,u.current=null},[]),{status:t,error:a,speak:h,stop:p,isPlaying:t==="synthesizing"||t==="speaking"}}const e9=3,t9=6,n9=4,s9=320,r9=760,a9=480,i9={balanced:{spokenReplyStyle:"adaptive",spokenReplyLongResponse:"invite",spokenReplyCodeResponse:"summary",spokenReplyMaxChars:720}},dl=i9.balanced;function Kr(e){return e.replace(/\s+/g," ").trim()}function xC(e){return e.replace(/<think>[\s\S]*?<\/think>/g," ")}function hS(e){return Kr(e.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^\s*>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/\|/g," ").replace(/\n{2,}/g,`
|
|
139
|
+
`).replace(/\n/g," "))}function o9(e){return Kr(e).split(new RegExp("(?<=[.!?])\\s+")).map(t=>t.trim()).filter(Boolean)}function Kp(e,t){if(e.length<=t)return e;const s=e.slice(0,t).trim(),a=s.lastIndexOf(" ");return(a>Math.floor(t*.6)?s.slice(0,a):s).replace(/[,:; -]+$/,"").trim()}function Mu(e){return e&&(/[.!?]$/.test(e)?e:`${e}.`)}function wC(e,t,s){const a=o9(e);if(a.length===0)return Mu(Kp(Kr(e),s));const i=[];for(const u of a){const d=Kr([...i,u].join(" "));if(i.length>0&&d.length>s||(i.push(u),i.length>=t))break}if(i.length===0)return Mu(Kp(a[0]??e,s));const l=Kr(i.join(" "));return l.length<=s?Mu(l):Mu(Kp(l,s))}function l9(e){return typeof e=="string"?{...dl,spokenReplyStyle:e}:{spokenReplyStyle:e.spokenReplyStyle??dl.spokenReplyStyle,spokenReplyLongResponse:e.spokenReplyLongResponse??dl.spokenReplyLongResponse,spokenReplyCodeResponse:e.spokenReplyCodeResponse??dl.spokenReplyCodeResponse,spokenReplyMaxChars:e.spokenReplyMaxChars??dl.spokenReplyMaxChars}}function c9(e){switch(e){case"full":return{maxSentences:t9,maxChars:r9};case"adaptive":return{maxSentences:n9,maxChars:a9};default:return{maxSentences:e9,maxChars:s9}}}function u9(e){const t=xC(e),s=[...t.matchAll(/```[\s\S]*?```/g)],a=[...t.matchAll(/`[^`]+`/g)],i=t.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g," $1 "),l=hS(t),u=hS(i),d=s.reduce((h,y)=>h+y[0].length,0)+a.reduce((h,y)=>h+y[0].length,0),p=s.length>0||a.length>=2||d>120&&d>l.length*.18||/(const|let|function|class|interface|return|import|export)\s+/.test(t)&&/[{}();]/.test(t);return{cleaned:l,proseOnly:u,codeHeavy:p}}function dy(e,t){const{maxSentences:s,maxChars:a}=c9(t);return wC(e,s,a)}function Jm(e){return wC(e,3,260)}function d9(e,t){switch(t.spokenReplyLongResponse){case"summary":return Jm(e.cleaned);case"invite":{const s=Jm(e.cleaned);return Kr(`${s} The full details are in the written reply. We can talk through any part you want.`)}default:return dy(e.cleaned,t.spokenReplyStyle)}}function f9(e,t){switch(t.spokenReplyCodeResponse){case"read":return dy(e.cleaned,t.spokenReplyStyle);case"mention":return"I included code in the written reply. I can walk through the implementation if you want.";default:{const s=e.proseOnly||e.cleaned,a=s?Jm(s):"";return a?Kr(`${a} I also included code in the written reply. I can walk through the implementation if you want.`):"I included code in the written reply. I can walk through the implementation or focus on one piece if you want."}}}function h9(e){const t=(e.parts??[]).filter(s=>s.type==="text").map(s=>"text"in s?s.text??"":"").join("");return Kr(xC(t))}function p9(e,t){const s=l9(t),a=u9(e);return a.cleaned?a.codeHeavy&&s.spokenReplyCodeResponse!=="read"?f9(a,s):a.cleaned.length>s.spokenReplyMaxChars&&s.spokenReplyLongResponse!=="verbatim"?d9(a,s):dy(a.cleaned,s.spokenReplyStyle):""}const m9={autoSend:!0,speakReplies:!1,replyProvider:"system",replyModel:"system",replyVoice:"",replyRate:1,spokenReplyStyle:"adaptive",spokenReplyLongResponse:"invite",spokenReplyCodeResponse:"summary",spokenReplyMaxChars:720};function g9({app:e,commands:t,state:s,relayUrl:a="ws://localhost:3600",cwd:i,agent:l="pi",provider:u,model:d,backend:p="pty",tmuxSession:h,workspaceFiles:y,onOpenSettings:v,onStartService:x,voice:w,voiceEnabled:N=!0}){const[T,_]=ur(`assistant.${e.id}.mode`,"relay"),[C,j]=b.useState(""),E=b.useMemo(()=>({...m9,...w}),[w]),[A,R]=ur(`assistant.${e.id}.voice.speakReplies`,E.speakReplies),{serviceApiUrl:O}=Xl(),M=b.useMemo(()=>v9(e),[e]),z=R$({url:a,systemPrompt:M,cwd:i,workspaceFiles:y,sessionKey:`assistant-${e.id}`,backend:p,tmuxSession:h,agent:l,provider:l==="pi"?u:void 0,model:l==="pi"?d:void 0}),F=b.useCallback(async()=>{if(x)return x();try{return(await(await fetch(`${O}/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,O]),Z=b.useMemo(()=>{const D=[{label:"Relay",value:a},{label:"Agent",value:l}];return i&&D.push({label:"CWD",value:i}),l==="pi"&&d&&D.push({label:"Model",value:d}),D},[a,l,i,d]),U=Q$(),[H,W]=b.useState("text"),oe=q$({app:e,commands:t,state:s,provider:u,model:d,onFinish:({message:D,isAbort:P,isDisconnect:K,isError:se})=>{if(!N||!A||P||K||se||D.role!=="assistant")return;const te=h9(D),ge=p9(te,E);ge&&U.speak(ge,{provider:E.replyProvider,model:E.replyModel,voice:E.replyVoice||void 0,rate:E.replyRate,metadata:{surface:"hudson-assistant",appId:e.id,source:H}})}}),ee=W$({surface:"hudson-assistant",metadata:{appId:e.id},onTranscript:D=>{const P=[C.trim(),D].filter(Boolean).join(" ");E.autoSend&&oe.status!=="streaming"&&oe.status!=="submitted"?(j(""),W("voice"),oe.sendMessage({text:P})):j(P)}}),I=b.useCallback(()=>{ee.status==="recording"?ee.stop():ee.start()},[ee]),B=e.intents?.length??0,$=N,re=ee.status==="transcribing",J=ee.status==="recording";return f.jsxs("div",{className:"flex flex-col h-full",children:[f.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:[f.jsx(VS,{size:11,className:"text-cyan-400/60"}),f.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-neutral-500",children:"Assistant"}),f.jsxs("span",{className:"text-[10px] font-mono text-neutral-600",children:["· ",e.name]}),f.jsx("div",{className:"flex-1"}),$&&T==="chat"&&f.jsx("button",{type:"button",onClick:()=>{A&&U.stop(),R(!A)},className:`p-1 rounded transition-colors ${A?"text-cyan-300 hover:text-cyan-200":"text-neutral-500 hover:text-neutral-300"}`,title:A?"Speaker on (click to mute)":"Speaker off (click to enable)",children:U.isPlaying?f.jsx(gx,{size:12,className:"animate-spin"}):A?f.jsx(tk,{size:12}):f.jsx(sk,{size:12})}),f.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-neutral-700 p-0.5",children:[f.jsx(mS,{active:T==="relay",onClick:()=>_("relay"),children:"Relay"}),f.jsx(mS,{active:T==="chat",onClick:()=>_("chat"),children:"Chat"})]}),T==="relay"&&z.status==="connected"&&f.jsx("button",{type:"button",onClick:()=>z.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"}),T==="relay"&&z.status==="connected"&&f.jsx("button",{type:"button",onClick:()=>z.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"}),T==="relay"&&z.status!=="connected"&&z.status!=="connecting"&&f.jsx("button",{type:"button",onClick:()=>z.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"})]}),f.jsx("div",{className:"flex-1 min-h-0",children:T==="relay"?f.jsx(C$,{relay:z,configItems:Z,onOpenSettings:v,onStartService:F}):f.jsx(x$,{chat:oe,placeholder:B===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${B} intent${B===1?"":"s"})`,inputValue:C,onInputChange:D=>{H==="voice"&&D.length===0&&W("text"),j(D)},inputExtras:$&&ee.isSupported?f.jsx("button",{type:"button",onClick:I,disabled:re,className:`p-1 rounded transition-colors disabled:opacity-30 ${J?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-neutral-500 hover:text-cyan-400"}`,title:J?"Stop recording":"Record voice prompt",children:re?f.jsx(gx,{size:12,className:"animate-spin"}):J?f.jsx($S,{size:11}):f.jsx(k_,{size:12})}):void 0,inputStatus:$?f.jsx(y9,{inputStatus:ee.status,inputError:ee.error,outputStatus:U.status,outputError:U.error}):void 0})})]})}function y9({inputStatus:e,inputError:t,outputStatus:s,outputError:a}){const i=pS(e)??pS(s),l=t??a;return!i&&!l?null:f.jsxs("div",{className:"flex items-center gap-2",children:[i&&f.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${i.className}`,children:i.label}),l&&f.jsx("span",{className:"text-[10px] text-neutral-500 truncate flex-1",title:l,children:l})]})}function pS(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 mS({active:e,onClick:t,children:s}){return f.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 v9(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 a of s)t.push(`- ${a.title} — ${a.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(`
|
|
140
|
+
`)}function b9({app:e,assistant:t=!0}){return f.jsx(e.Provider,{children:f.jsx(x9,{app:e,assistantEnabled:t})})}function x9({app:e,assistantEnabled:t}){const{navTotalHeight:s}=ey(),a=e.hooks.useCommands(),i=e.hooks.useStatus(),l=e.hooks.useSearch?.()??null,u=e.hooks.useNavCenter?.()??null,d=e.hooks.useNavActions?.()??null,p=e.hooks.useLayoutMode?.()??e.mode,h=e.hooks.useActiveToolHint?.()??null,[y,v]=b.useState("ws://localhost:3600");b.useEffect(()=>{v(`ws://${window.location.host}`)},[]);const[x,w]=ur(`appshell.${e.id}.left`,!1),[N,T]=ur(`appshell.${e.id}.right`,!1),[_,C]=ur(`appshell.${e.id}.leftW`,260),[j,E]=ur(`appshell.${e.id}.rightW`,280),[A,R]=b.useState({x:0,y:0}),[O,M]=b.useState(1),z=b.useCallback(Y=>{R(ae=>({x:ae.x+Y.x,y:ae.y+Y.y}))},[]),F=b.useCallback(Y=>{M(Y)},[]),[Z,U]=b.useState(!1),[H,W]=b.useState(!1),[oe,ee]=ur(`appshell.${e.id}.termH`,320),I=!!e.slots.Terminal,B=b.useMemo(()=>{const Y=[];return I&&Y.push("terminal"),t&&Y.push("assistant"),Y},[I,t]),$=B[0]??"terminal",[re,J]=ur(`appshell.${e.id}.drawerTab`,$),D=B.includes(re)?re:$,[P,K]=b.useState(!1),[se,te]=b.useState(new Set),ge=b.useCallback(Y=>{te(ae=>{const ye=new Set(ae);return ye.has(Y)?ye.delete(Y):ye.add(Y),ye})},[]),he=b.useCallback(Y=>ae=>{ae.preventDefault();const ye=ae.clientX,we=Y==="left"?_:j,Ce=Y==="left"?C:E,me=Y==="left"?1:-1,Oe=Se=>{const Ee=(Se.clientX-ye)*me;Ce(Math.max(200,Math.min(500,we+Ee)))},ve=()=>{document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",ve)};document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",ve)},[_,j,C,E]),pe=b.useMemo(()=>{const Y=[{id:"shell:toggle-left",label:"Toggle Left Panel",shortcut:"Cmd+[",action:()=>w(ae=>!ae)},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>T(ae=>!ae)},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>U(ae=>!ae)}];return t&&Y.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{J("assistant"),U(ae=>!ae||re!=="assistant")}}),Y},[w,T,t,re,J]),xe=b.useMemo(()=>[...a,...pe],[a,pe]);b.useEffect(()=>{const Y=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="k"&&(ae.preventDefault(),K(!0)),(ae.metaKey||ae.ctrlKey)&&ae.key==="["&&(ae.preventDefault(),w(ye=>!ye)),(ae.metaKey||ae.ctrlKey)&&ae.key==="]"&&(ae.preventDefault(),T(ye=>!ye)),ae.ctrlKey&&ae.key==="`"&&(ae.preventDefault(),U(ye=>!ye)),t&&(ae.metaKey||ae.ctrlKey)&&ae.key==="j"&&(ae.preventDefault(),J("assistant"),U(ye=>!(ye&&D==="assistant")))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[w,T,t,D,J]);const Re=e.slots.Inspector,fe=e.slots.RightPanel,ke=e.tools&&e.tools.length>0,Te=f.jsxs(f.Fragment,{children:[Re&&f.jsx(Re,{}),!Re&&fe&&f.jsx(fe,{}),ke&&f.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(Y=>{const ae=se.has(Y.id);return f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>ge(Y.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===Y.id?"text-emerald-400":"text-neutral-300"}`,children:[ae?f.jsx(y_,{size:10}):f.jsx(b_,{size:10}),f.jsx("span",{className:"text-neutral-400",children:Y.icon}),f.jsx("span",{className:"font-bold",children:Y.name})]}),ae&&f.jsx("div",{className:"px-4 pb-3",children:f.jsx(Y.Component,{})})]},Y.id)})})]}),He=f.jsxs(f.Fragment,{children:[e.slots.LeftFooter&&f.jsx(e.slots.LeftFooter,{}),f.jsx(J5,{onOpenCommandPalette:()=>K(!0)})]}),ie=p==="panel"?{position:"absolute",top:s,bottom:28,left:x?0:_,right:N?0:j,overflow:"auto",transition:"left 200ms ease, right 200ms ease"}:{};return f.jsx(F5,{mode:p,panOffset:A,scale:O,onPan:z,onZoom:F,hud:f.jsxs(f.Fragment,{children:[f.jsx(X5,{title:e.name.toUpperCase(),search:l??void 0,center:u,actions:d}),f.jsx(b1,{side:"left",title:e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:x,onToggleCollapse:()=>w(!x),width:_,onResizeStart:he("left"),footer:He,headerActions:e.leftPanel?.headerActions&&f.jsx(e.leftPanel.headerActions,{}),children:e.slots.LeftPanel&&f.jsx(e.slots.LeftPanel,{})}),f.jsx(b1,{side:"right",title:e.rightPanel?.title??"Inspector",icon:e.rightPanel?.icon,isCollapsed:N,onToggleCollapse:()=>T(!N),width:j,onResizeStart:he("right"),headerActions:e.rightPanel?.headerActions&&f.jsx(e.rightPanel.headerActions,{}),children:Te}),f.jsx(W5,{status:i,onToggleTerminal:()=>U(Y=>!Y),isTerminalOpen:Z}),f.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:x?0:_,right:N?0:j,bottom:0,top:0,zIndex:45,transition:"left 200ms ease, right 200ms ease",transform:"translateZ(0)"},children:f.jsxs(eL,{isOpen:Z,onClose:()=>U(!1),onToggleMaximize:()=>W(Y=>!Y),isMaximized:H,height:oe,onHeightChange:ee,title:f.jsx(w9,{tabs:B,active:D,onSelect:J}),children:[D==="terminal"&&(e.slots.Terminal?f.jsx(e.slots.Terminal,{}):f.jsx("div",{className:"p-4 font-mono text-[12px] text-neutral-400",children:"No terminal content"})),D==="assistant"&&f.jsx(g9,{app:e,commands:a,relayUrl:y})]})}),f.jsx(Q5,{isOpen:P,onClose:()=>K(!1),commands:xe})]}),children:f.jsx("div",{style:ie,className:"frame-scrollbar",children:f.jsx(e.slots.Content,{})})})}function w9({tabs:e,active:t,onSelect:s}){return e.length===0?null:f.jsx("div",{className:"flex items-center gap-0.5",children:e.map(a=>{const i=a===t,l=a==="terminal"?BS:VS,u=a==="terminal"?"TERMINAL":"ASSISTANT",d=a==="terminal"?"text-emerald-400":"text-cyan-400";return f.jsxs("button",{type:"button",onClick:()=>s(a),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${i?`${d} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[f.jsx(l,{size:13}),f.jsx("span",{children:u})]},a)})})}const SC=(...e)=>e.filter((t,s,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===s).join(" ").trim();const S9=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const E9=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,a)=>a?a.toUpperCase():s.toLowerCase());const gS=e=>{const t=E9(e);return t.charAt(0).toUpperCase()+t.slice(1)};var N9={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 T9=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const j9=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:u,...d},p)=>b.createElement("svg",{ref:p,...N9,width:t,height:t,stroke:e,strokeWidth:a?Number(s)*24/Number(t):s,className:SC("lucide",i),...!l&&!T9(d)&&{"aria-hidden":"true"},...d},[...u.map(([h,y])=>b.createElement(h,y)),...Array.isArray(l)?l:[l]]));const la=(e,t)=>{const s=b.forwardRef(({className:a,...i},l)=>b.createElement(j9,{ref:l,iconNode:t,className:SC(`lucide-${S9(gS(e))}`,`lucide-${e}`,a),...i}));return s.displayName=gS(e),s};const C9=[["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"}]],R9=la("activity",C9);const A9=[["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"}]],_9=la("house",A9);const k9=[["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"}]],M9=la("layers",k9);const O9=[["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"}]],D9=la("messages-square",O9);const z9=[["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"}]],I9=la("network",z9);const L9=[["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"}]],P9=la("radio",L9);const U9=[["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"}]],V9=la("settings",U9);const $9=[["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"}]],B9=la("users",$9);function Wp(){const e=window.location.pathname.replace(/^\/+/,"").split("/").filter(Boolean);return e[0]==="agent"&&e[1]?{view:"agent-info",conversationId:decodeURIComponent(e[1])}:e[0]==="agents"&&e[1]&&e[2]==="c"&&e[3]?{view:"agents",agentId:decodeURIComponent(e[1]),conversationId:decodeURIComponent(e[3])}:e[0]==="agents"&&e[1]?{view:"agents",agentId:decodeURIComponent(e[1])}:e[0]==="agents"?{view:"agents"}:e[0]==="fleet"?{view:"fleet"}:e[0]==="c"&&e[1]?{view:"conversation",conversationId:decodeURIComponent(e[1])}:e[0]==="sessions"&&e[1]?{view:"sessions",sessionId:decodeURIComponent(e[1])}:e[0]==="sessions"?{view:"sessions"}:e[0]==="mesh"?{view:"mesh"}:e[0]==="activity"?{view:"activity"}:e[0]==="work"&&e[1]?{view:"work",workId:decodeURIComponent(e[1])}:e[0]==="settings"?{view:"settings"}:{view:"inbox"}}function Z9(e){switch(e.view){case"inbox":return"/";case"conversation":return`/c/${encodeURIComponent(e.conversationId)}`;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 Jp(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 H9(){const[e,t]=b.useState(Wp),s=b.useRef({});b.useEffect(()=>{const i=()=>{const l=Wp();t(l),requestAnimationFrame(()=>{window.scrollTo(0,s.current[Jp(l)]??0)})};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const a=b.useCallback(i=>{s.current[Jp(Wp())]=window.scrollY,window.history.pushState(null,"",Z9(i)),t(i),requestAnimationFrame(()=>{window.scrollTo(0,s.current[Jp(i)]??0)})},[]);return{route:e,navigate:a}}function EC(e){const t=e.match(/^dm\.operator\.(.+)$/);return t?t[1]:null}function Qm(e){return`dm.operator.${e}`}async function ct(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();throw new Error(i||`HTTP ${s.status}`)}const a=await s.text();if(a)return JSON.parse(a)}const F9=["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 q9(e){try{return JSON.parse(e)}catch{return{kind:"unknown"}}}function Xn(e){const t=b.useRef(e);t.current=e,b.useEffect(()=>{let s=null,a=null;function i(){s=new EventSource("/api/events");const l=u=>{t.current(q9(u.data))};s.onmessage=l;for(const u of F9)s.addEventListener(u,l);s.onerror=()=>{s?.close(),a=setTimeout(i,3e3)}}return i(),()=>{s?.close(),a&&clearTimeout(a)}},[])}function xs(e){return e==="working"||e==="active"||e==="waiting"?"working":!e||e==="offline"?"offline":"available"}function Za(e){return xs(e)!=="offline"}function so(e){switch(xs(e)){case"working":return"Working";case"available":return"Available";default:return"Offline"}}const NC={current:null,setMenu:null};function ho(){return b.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),NC.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function Y9({children:e}){const[t,s]=b.useState(null),a=b.useRef(null);NC.setMenu=s;const i=b.useCallback(()=>s(null),[]);return b.useEffect(()=>{if(!t)return;const l=()=>i(),u=p=>{p.key==="Escape"&&i()},d=()=>i();return window.addEventListener("mousedown",l,!0),window.addEventListener("keydown",u),window.addEventListener("scroll",d,!0),window.addEventListener("contextmenu",i,!0),()=>{window.removeEventListener("mousedown",l,!0),window.removeEventListener("keydown",u),window.removeEventListener("scroll",d,!0),window.removeEventListener("contextmenu",i,!0)}},[t,i]),b.useEffect(()=>{if(!t||!a.current)return;const l=a.current,u=l.getBoundingClientRect(),d=window.innerWidth,p=window.innerHeight;let h=t.position.x,y=t.position.y;h+u.width>d-8&&(h=d-u.width-8),y+u.height>p-8&&(y=p-u.height-8),h<8&&(h=8),y<8&&(y=8),l.style.left=`${h}px`,l.style.top=`${y}px`},[t]),t?f.jsxs(f.Fragment,{children:[e,f.jsx("div",{ref:a,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"?f.jsx("div",{className:"s-context-menu-sep",role:"separator"},u):f.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{l.onSelect(),i()},children:[f.jsx("span",{className:"s-context-menu-label",children:l.label}),l.shortcut&&f.jsx("span",{className:"s-context-menu-shortcut",children:l.shortcut})]},u))})]}):f.jsx(f.Fragment,{children:e})}const TC=b.createContext(null);function Ns(){const e=b.useContext(TC);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function G9({children:e}){const{route:t,navigate:s}=H9(),[a,i]=b.useState([]),[l,u]=b.useState([]),d=b.useCallback(async()=>{const[y,v]=await Promise.allSettled([ct("/api/agents"),ct("/api/messages")]);y.status==="fulfilled"&&i(y.value),v.status==="fulfilled"&&u(v.value)},[]);b.useEffect(()=>{d()},[d]),Xn(d);const p=b.useMemo(()=>a.filter(y=>Za(y.state)).length,[a]),h=b.useMemo(()=>({route:t,navigate:s,agents:a,messages:l,onlineCount:p,reload:d}),[t,s,a,l,p,d]);return f.jsx(TC.Provider,{value:h,children:f.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:f.jsx(Y9,{children:e})})})}const X9={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 K9(e){return X9[e]??e.replace(/_/g," ")}const yS=["#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 yS[Math.abs(t)%yS.length]}function Jl(e){switch(xs(e)){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}const W9={workspace:"workspace",worktree:"workspace",branch:"workspace",profile:"profile",persona:"profile",harness:"harness",runtime:"harness",node:"node",host:"node"};function J9(e){return e.trim().replace(/^@+/,"").replace(/[.,!?;)\]]+$/,"")}function Is(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const Q9="scout";function eB(e){return W9[Is(e)]??null}function jC(e){const t=Is(e.definitionId),s=e.workspaceQualifier?Is(e.workspaceQualifier):void 0,a=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}:{},...a?{profile:a}:{},...i?{harness:i}:{},...l?{nodeQualifier:l}:{}}:null}function tB(e){const t=e.split(".").filter(Boolean),s=t.shift();if(!s)return null;const a={definitionId:s},i=[];for(const l of t){if(l.includes(":")){const[u,d=""]=l.split(":",2),p=eB(u),h=Is(d);if(!p||!h)return null;p==="workspace"?a.workspaceQualifier=h:p==="profile"?a.profile=h:p==="harness"?a.harness=h:p==="node"&&(a.nodeQualifier=h);continue}i.push(l)}if(i.length===1){const l=Is(i[0]);if(!l)return null;a.workspaceQualifier=l}else if(i.length===2){const l=Is(i[0]),u=Is(i[1]);if(!l||!u)return null;a.workspaceQualifier||(a.workspaceQualifier=l),a.nodeQualifier||(a.nodeQualifier=u)}else if(i.length>2)return null;return sB(a,{raw:e})}function nB(e){const t=J9(e);return!t||t.includes("@")||t.includes("#")?null:tB(t)}function vS(e,t={}){const s=jC(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 sB(e,t={}){const s=jC(e);return s?{raw:t.raw??vS(s,{includeSigil:!1}),label:vS(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 rB(e){return aB(e).parsed}function aB(e){const t=Array.from(e.matchAll(/(^|\s)@([a-z0-9][a-z0-9._/:-]*)/gi)),s=new Map,a=[];for(const i of t){const l=i[2]??"",u=nB(l);if(!u){l&&a.push(`@${l}`);continue}s.set(u.label,u)}return{parsed:Array.from(s.values()),unparsed:Array.from(new Set(a))}}function iB(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 a=[];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){a.push({kind:"text",value:i});break}u.index>0&&a.push({kind:"text",value:i.slice(0,u.index)});const d=u[0],p=d.toLowerCase(),h=s.get(p);h?a.push({kind:"mention",identity:h}):a.push({kind:"text",value:d}),i=i.slice(u.index+d.length)}return a}function oB(e,t){const s=[],a=/\*\*(.+?)\*\*/g;let i=0,l,u=0;for(;(l=a.exec(e))!==null;)l.index>i&&s.push(f.jsx("span",{children:e.slice(i,l.index)},`${t}-${u++}`)),s.push(f.jsx("strong",{children:l[1]},`${t}-${u++}`)),i=l.index+l[0].length;return i<e.length&&s.push(f.jsx("span",{children:e.slice(i)},`${t}-${u++}`)),s.length>0?s:[f.jsx("span",{children:e},t)]}function qn(e){if(!e)return e??"";const t=rB(e);return iB(e,t).flatMap((a,i)=>{if(a.kind==="text")return oB(a.value,i*100);const{identity:l}=a,d=l.definitionId===Q9?"var(--accent)":Ts(l.definitionId);return f.jsx("span",{className:"s-mention",style:{"--mention-color":d},children:l.label},i)})}function tt(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 za(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 lB={"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"},cB={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 CC(e){return lB[e]??e.replace(/[._]/g," ")}function uB(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 dB(e){return(e??"system").charAt(0).toUpperCase()}function RC(e){return e.length<=14?e:`${e.slice(0,8)}...${e.slice(-4)}`}function fB(e){if(!e)return null;const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function hB(e){return`${e.actorName??"system"} ${CC(e.kind)}`}function pB(e){return e.workspaceRoot?`Recorded from ${e.workspaceRoot}.`:e.conversationId?`Linked to thread ${RC(e.conversationId)}.`:"No additional detail was captured for this event."}function mB({navigate:e}){const[t,s]=b.useState([]),[a,i]=b.useState(null),[l,u]=b.useState(!0),[d,p]=b.useState(!1),[h,y]=b.useState(null),[v,x]=b.useState(null),w=b.useRef([]),N=b.useRef(0),T=b.useRef(null),_=ho();b.useEffect(()=>{w.current=t},[t]);const C=b.useCallback(async(O="initial")=>{const M=++N.current;!(w.current.length>0)&&O!=="background"?(u(!0),y(null)):p(!0);try{const F=await ct("/api/activity");if(M!==N.current)return;s(F),y(null),x(Date.now()),i(Z=>F.some(U=>U.id===Z)?Z:null)}catch(F){if(M!==N.current)return;y(F instanceof Error?F.message:String(F))}finally{M===N.current&&(u(!1),p(!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]),Xn(j);const E=b.useMemo(()=>{const O=new Set(t.map(z=>z.actorName??"system")),M=new Set(t.map(z=>z.conversationId).filter(z=>!!z));return[{label:"Events",value:`${t.length}`,detail:t.length>0?`Latest ${tt(t[0].ts)}`:"Waiting for records"},{label:"Actors",value:`${O.size}`,detail:O.size>0?"Distinct event owners":"No actors yet"},{label:"Threads",value:`${M.size}`,detail:M.size>0?"Conversation-linked records":"No linked threads"}]},[t]),A=!l&&t.length===0&&!!h,R=!l&&t.length===0&&!h;return f.jsxs("div",{className:"sys-surface-page",children:[f.jsxs("div",{className:"sys-page-head",children:[f.jsxs("div",{className:"sys-page-title-group",children:[f.jsx("h2",{className:"sys-page-title",children:"Activity"}),f.jsx("p",{className:"sys-page-subtitle",children:"Broker events, task execution, and collaboration handoffs."})]}),f.jsxs("div",{className:"sys-page-actions",children:[f.jsx("div",{className:"sys-sync-note",children:l?"Loading audit ledger...":h&&t.length>0?`Showing last confirmed snapshot from ${v?tt(v):"earlier"}`:v?`Updated ${tt(v)}`:"Waiting for first snapshot"}),f.jsx("button",{type:"button",className:"s-btn",disabled:l||d,onClick:()=>{C("manual")},children:d?"Refreshing...":"Refresh"})]})]}),f.jsx("div",{className:"sys-stat-grid",children:E.map(O=>f.jsxs("div",{className:"sys-stat-card",children:[f.jsx("span",{className:"sys-stat-label",children:O.label}),f.jsx("strong",{className:"sys-stat-value",children:O.value}),f.jsx("span",{className:"sys-stat-detail",children:O.detail})]},O.label))}),h&&t.length>0&&f.jsxs("div",{className:"sys-banner sys-banner-warning",children:[f.jsx("strong",{children:"Refresh failed."}),f.jsx("span",{children:h})]}),l&&t.length===0&&f.jsxs("div",{className:"sys-panel sys-state-card",children:[f.jsx("h3",{className:"sys-state-title",children:"Loading activity"}),f.jsx("p",{className:"sys-state-body",children:"Pulling the latest records from the broker database."})]}),A&&f.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[f.jsx("h3",{className:"sys-state-title",children:"Activity is unavailable"}),f.jsx("p",{className:"sys-state-body",children:h}),f.jsx("div",{className:"sys-inline-actions",children:f.jsx("button",{type:"button",className:"s-btn",onClick:()=>{C("manual")},children:"Try again"})})]}),R&&f.jsxs("div",{className:"sys-panel sys-state-card",children:[f.jsx("h3",{className:"sys-state-title",children:"No activity yet"}),f.jsx("p",{className:"sys-state-body",children:"Events appear here after agents register, send messages, or advance work."})]}),t.length>0&&f.jsx("div",{className:"sys-audit-list",children:t.map(O=>{const M=a===O.id,z=uB(O.kind),F=cB[z],Z=fB(O.workspaceRoot),U=O.summary&&O.summary!==O.title?O.summary:pB(O);return f.jsxs("article",{className:`sys-audit-entry${M?" sys-audit-entry-expanded":""}`,onContextMenu:H=>{const W=window.getSelection()?.toString().trim(),oe=[];W&&(oe.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(W)}),oe.push({kind:"separator"}));const ee=O.title??O.summary??"";ee&&oe.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(ee)}),O.actorName&&oe.push({kind:"action",label:"Copy Actor",onSelect:()=>navigator.clipboard.writeText(O.actorName)}),oe.push({kind:"action",label:"Copy Event ID",onSelect:()=>navigator.clipboard.writeText(O.id)}),O.conversationId&&(oe.push({kind:"separator"}),oe.push({kind:"action",label:"Open Thread",onSelect:()=>e({view:"conversation",conversationId:O.conversationId})})),_(H,oe)},children:[f.jsxs("button",{type:"button",className:"sys-audit-toggle","aria-expanded":M,onClick:()=>i(M?null:O.id),children:[f.jsxs("div",{className:"sys-audit-stamp",children:[f.jsx("span",{className:"sys-audit-time",children:tt(O.ts)}),f.jsx("span",{className:"sys-audit-date",children:za(O.ts)})]}),f.jsx("div",{className:`sys-audit-marker sys-audit-marker-${F.tone}`,children:f.jsx("span",{})}),f.jsxs("div",{className:"sys-audit-body",children:[f.jsxs("div",{className:"sys-audit-topline",children:[f.jsx("span",{className:"sys-audit-category",children:F.label}),f.jsx("span",{className:"sys-audit-kind",children:CC(O.kind)})]}),f.jsx("h3",{className:"sys-audit-title",children:qn(O.title??hB(O))}),f.jsx("p",{className:"sys-audit-summary",children:qn(U)}),f.jsxs("div",{className:"sys-audit-meta",children:[f.jsxs("span",{className:"sys-audit-meta-item",children:[f.jsx("span",{className:"sys-audit-avatar",style:{background:Ts(O.actorName??"system")},children:dB(O.actorName)}),O.actorName??"system"]}),Z&&f.jsxs("span",{className:"sys-audit-meta-item",children:["Workspace ",Z]}),O.conversationId&&f.jsxs("span",{className:"sys-audit-meta-item",children:["Thread ",RC(O.conversationId)]})]})]}),f.jsx("div",{className:"sys-audit-expand",children:M?"Close":"Details"})]}),M&&f.jsxs("div",{className:"sys-audit-details",children:[f.jsxs("div",{className:"sys-detail-grid",children:[f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Event"}),f.jsx("code",{className:"sys-detail-value",children:O.kind})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Recorded"}),f.jsx("span",{className:"sys-detail-value",children:za(O.ts)})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Actor"}),f.jsx("span",{className:"sys-detail-value",children:O.actorName??"system"})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Workspace"}),f.jsx("span",{className:"sys-detail-value",children:O.workspaceRoot??"Not attached"})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Thread"}),f.jsx("span",{className:"sys-detail-value",children:O.conversationId??"Not attached"})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Record id"}),f.jsx("code",{className:"sys-detail-value",children:O.id})]})]}),O.conversationId&&f.jsx("div",{className:"sys-inline-actions",children:f.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:()=>e({view:"conversation",conversationId:O.conversationId}),children:"Open thread"})})]})]},O.id)})})]})}function gB(e){const t=e.split(".");return t[t.length-1]||e}function fl(e){return e?e.replace(/_/g," "):null}function yB({values:e}){return f.jsx("span",{className:"s-agent-token-list",children:e.map(t=>f.jsx("span",{className:"s-agent-token",children:t},t))})}function Ou({title:e,items:t}){return t.length===0?null:f.jsxs("section",{className:"s-agent-profile-card",children:[f.jsx("div",{className:"s-agent-profile-card-header",children:f.jsx("div",{className:"s-agent-profile-card-title",children:e})}),f.jsx("div",{className:"s-agent-meta-card-body",children:t.map(s=>f.jsxs("div",{className:"s-agent-meta-row",children:[f.jsx("span",{className:"s-agent-meta-label",children:s.label}),f.jsx("span",{className:"s-agent-meta-value",children:s.value})]},s.label))})]})}function vB({conversationId:e,navigate:t}){const[s,a]=b.useState(null),[i,l]=b.useState(null),[u,d]=b.useState(null),p=EC(e),h=b.useCallback(async()=>{d(null);try{const[N,T]=await Promise.all([ct("/api/agents"),ct(`/api/session/${encodeURIComponent(e)}`).catch(()=>null)]),_=T?.agentId??p;a(N.find(C=>C.id===_)??null),l(T)}catch(N){d(N instanceof Error?N.message:String(N)),l(null)}},[e,p]);if(b.useEffect(()=>{h()},[h]),Xn(h),!s)return f.jsxs("div",{children:[f.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Back"}),u&&f.jsx("p",{className:"s-error",children:u}),f.jsx("div",{className:"s-empty",children:f.jsx("p",{children:"Agent not found"})})]});const y=[{label:"Agent ID",value:s.id},...s.handle?[{label:"Handle",value:`@${s.handle}`}]:[],{label:"Class",value:fl(s.agentClass)??"—"},...s.role?[{label:"Role",value:s.role}]:[],...s.selector?[{label:"Selector",value:s.selector}]:[]],v=[...s.project?[{label:"Project",value:s.project}]:[],...s.branch?[{label:"Branch",value:s.branch}]:[],...s.projectRoot?[{label:"Path",value:s.projectRoot}]:[],...s.cwd?[{label:"Working dir",value:s.cwd}]:[]],x=[{label:"State",value:so(s.state)},...s.harness?[{label:"Harness",value:s.harness}]:[],...s.transport?[{label:"Transport",value:fl(s.transport)??s.transport}]:[],...s.wakePolicy?[{label:"Wake policy",value:fl(s.wakePolicy)??s.wakePolicy}]:[],...s.capabilities.length>0?[{label:"Capabilities",value:f.jsx(yB,{values:s.capabilities})}]:[]],w=[{label:"Conversation ID",value:e},...i?.title?[{label:"Title",value:i.title}]:[],...i?.workspaceRoot?[{label:"Workspace",value:i.workspaceRoot}]:[],...i?.currentBranch?[{label:"Session branch",value:i.currentBranch}]:[],...i?.messageCount!=null?[{label:"Messages",value:String(i.messageCount)}]:[],...i?.lastMessageAt?[{label:"Last message",value:za(i.lastMessageAt)}]:[],...s.harnessSessionId?[{label:"Harness session",value:s.harnessSessionId}]:[],...s.harnessLogPath?[{label:"Harness log",value:s.harnessLogPath}]:[]];return f.jsxs("div",{className:"s-agent-profile-page",children:[f.jsxs("div",{className:"s-agent-profile-page-topbar",children:[f.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Conversation"}),f.jsx("button",{type:"button",className:"s-btn",onClick:()=>t({view:"agents",agentId:s.id}),children:"Open in Agents"})]}),u&&f.jsx("p",{className:"s-error",children:u}),f.jsxs("section",{className:"s-agent-profile-hero",children:[f.jsx("div",{className:"s-agent-profile-hero-main",children:f.jsxs("div",{className:"s-agent-profile-hero-title-row",children:[f.jsx("div",{className:"s-avatar s-agent-profile-hero-avatar",style:{background:Ts(s.name)},children:s.name[0].toUpperCase()}),f.jsxs("div",{className:"s-agent-profile-hero-copy",children:[f.jsxs("div",{className:"s-agent-casefile-title-meta",children:[f.jsx("span",{className:"s-agent-casefile-record",children:gB(s.id)}),f.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${xs(s.state)}`,children:[f.jsx("span",{className:"s-dot",style:{background:Jl(s.state)}}),so(s.state)]})]}),f.jsx("h1",{className:"s-agent-profile-hero-title",children:s.name}),f.jsx("p",{className:"s-agent-profile-hero-copyline",children:[s.handle?`@${s.handle}`:null,s.project,s.branch,fl(s.role)??fl(s.agentClass)].filter(Boolean).join(" • ")}),f.jsxs("p",{className:"s-agent-profile-hero-context",children:[i?.title?`Conversation: ${i.title}.`:"Attached to the current conversation.",s.updatedAt?` Updated ${tt(s.updatedAt)}.`:""]})]})]})}),f.jsx("div",{className:"s-agent-profile-hero-actions",children:f.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>t({view:"conversation",conversationId:e}),children:"Open conversation"})})]}),f.jsxs("div",{className:"s-agent-profile-grid",children:[f.jsx(Ou,{title:"Identity",items:y}),f.jsx(Ou,{title:"Workspace",items:v}),f.jsx(Ou,{title:"Runtime",items:x}),f.jsx(Ou,{title:"Conversation context",items:w})]})]})}function bB(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function xB(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 wB(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function SB({items:e,navigate:t,emptyTitle:s,emptyDetail:a}){if(e.length===0){const i=[{titleWidth:"56%",metaWidths:["18%","14%","16%"],summaryWidth:"74%"},{titleWidth:"48%",metaWidths:["16%","20%","12%"],summaryWidth:"62%"}];return f.jsxs("div",{className:"s-work-empty-state",children:[f.jsxs("div",{className:"s-work-empty-copy",children:[f.jsx("p",{className:"s-work-empty-kicker",children:"Quiet for now"}),f.jsx("p",{className:"s-work-empty-title",children:s}),a&&f.jsx("p",{className:"s-work-empty-detail",children:a})]}),f.jsx("div",{className:"s-work-empty-skeleton","aria-hidden":"true",children:i.map((l,u)=>f.jsxs("div",{className:"s-work-empty-row",children:[f.jsxs("div",{className:"s-work-empty-row-header",children:[f.jsx("span",{className:"s-work-empty-line s-work-empty-line-title",style:{width:l.titleWidth}}),f.jsx("span",{className:"s-work-empty-pill"})]}),f.jsx("div",{className:"s-work-empty-row-meta",children:l.metaWidths.map(d=>f.jsx("span",{className:"s-work-empty-line s-work-empty-line-meta",style:{width:d}},d))}),f.jsx("span",{className:"s-work-empty-line s-work-empty-line-summary",style:{width:l.summaryWidth}})]},u))})]})}return f.jsx("div",{className:"s-work-list",children:e.map(i=>{const l=!!i.id||!!i.conversationId,u=wB(i.attention),d=i.ownerName??i.ownerId??"Unassigned",p=i.id?()=>t({view:"work",workId:i.id}):i.conversationId?()=>t({view:"conversation",conversationId:i.conversationId}):void 0;return f.jsxs("div",{className:`s-work-row${l?" s-work-row-clickable":""}`,onClick:p,children:[f.jsxs("div",{className:"s-work-row-header",children:[f.jsxs("div",{className:"s-work-row-title-wrap",children:[f.jsx("span",{className:"s-work-row-title",children:i.title}),i.priority&&f.jsx("span",{className:"s-badge",children:i.priority})]}),f.jsx("span",{className:`s-pill s-pill-${bB(i)}`,children:i.currentPhase})]}),f.jsxs("div",{className:"s-work-row-meta",children:[f.jsx("span",{children:d}),f.jsx("span",{children:xB(i.state)}),i.activeChildWorkCount>0&&f.jsxs("span",{children:[i.activeChildWorkCount," child",i.activeChildWorkCount===1?"":"ren"]}),i.activeFlightCount>0&&f.jsxs("span",{children:[i.activeFlightCount," flight",i.activeFlightCount===1?"":"s"]}),u&&f.jsx("span",{children:u}),f.jsx("span",{children:tt(i.lastMeaningfulAt)})]}),i.lastMeaningfulSummary&&f.jsx("p",{className:"s-work-row-summary",children:qn(i.lastMeaningfulSummary)})]},i.id)})})}const eg=new Set(["completed","failed","cancelled"]),EB={direct:"Direct message",channel:"Channel",group_direct:"Group",thread:"Thread"};function zn(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1e12?e*1e3:e}function NB(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 Qp(e){const t=zn(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function jB(e,t){const s=zn(e),a=zn(t);if(s===null||a===null)return!1;const i=new Date(s),l=new Date(a);return i.getFullYear()===l.getFullYear()&&i.getMonth()===l.getMonth()&&i.getDate()===l.getDate()}function bS(e){const t=zn(e);if(t===null)return"";const s=new Date(t),a=new Date,i=new Date(a.getFullYear(),a.getMonth(),a.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 CB(e){switch(e){case"status":return"Status";case"system":return"System";case"scout.dispatch":return"Dispatch";default:return null}}function Du(e){return[...e].sort((t,s)=>(zn(t.createdAt)??0)-(zn(s.createdAt)??0))}function RB(e){return e.filter(t=>!eg.has(t.state)).sort((t,s)=>(zn(s.startedAt)??0)-(zn(t.startedAt)??0))[0]??null}function xS(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 AB(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 tg(e,t){if(e.class==="operator")return!0;const s=e.actorName?.toLowerCase()??"";return s===t.toLowerCase()||s==="operator"||s==="you"}function _B(e,t){return e.reduce((s,a)=>{if(tg(a,t))return s;const i=zn(a.createdAt);return i===null?s:s===null||i>s?i:s},null)}function kB(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 MB(e){const{agentName:t,agentState:s,sending:a,currentFlight:i,showWorkingTurn:l}=e;if(a&&!i)return{label:"Sending",detail:`Handing your message to ${t}.`,tone:"pending",showStrip:!0,showTyping:!1};if(i&&l){const u=i.summary?.trim()||kB(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 Za(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 OB(e,t){switch(e.tone){case"pending":return"var(--accent)";case"working":return"var(--green)";case"offline":return"var(--dim)";default:return Jl(t)}}function DB(){return f.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:[f.jsx("path",{d:"m3 11 18-8-8 18-2.8-7.2L3 11Z"}),f.jsx("path",{d:"M10.2 13.8 21 3"})]})}function zB(){return f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:f.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function wS({label:e,value:t}){return f.jsxs("div",{className:"s-conv-meta-row",children:[f.jsx("span",{className:"s-conv-meta-label",children:e}),f.jsx("span",{className:"s-conv-meta-value",children:t})]})}function IB(e){if(!e)return null;const t=e.participantIds.filter(s=>s!=="operator");return t.length===0?null:t.join(", ")}function ng({conversationId:e,navigate:t}){const[s,a]=b.useState(null),[i,l]=b.useState(null),[u,d]=b.useState([]),[p,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),_=b.useRef(0),C=EC(e),j=i?.agentId??C,E=i?.kind==="direct"||C!==null,A=b.useCallback(async()=>{v(null);try{const[ie,Y]=await Promise.all([ct("/api/agents"),ct(`/api/session/${encodeURIComponent(e)}`).catch(()=>null)]);l(Y);const ae=Y?.agentId??C;a(ae?ie.find(me=>me.id===ae)??null:null);const ye=Y?.kind==="direct"&&ae&&ae.startsWith("local-session-agent-")?Qm(ae):e;if(ye!==e){t({view:"conversation",conversationId:ye});return}const[we,Ce]=await Promise.all([ct(`/api/messages?conversationId=${encodeURIComponent(ye)}&limit=300`),ct(`/api/flights?conversationId=${encodeURIComponent(ye)}`)]);d(Du(we)),N.current=new Set(Ce.map(me=>me.invocationId)),h(RB(Ce))}catch(ie){v(ie instanceof Error?ie.message:String(ie))}},[e,C,t]);b.useEffect(()=>{A()},[A]),b.useEffect(()=>{T.current=p},[p]);const[R,O]=b.useState(""),[M,z]=b.useState(!1),[F,Z]=b.useState("operator"),[U,H]=b.useState(null);b.useEffect(()=>{const ie=w.current;if(!ie)return;ie.style.height="0px";const Y=Math.min(Math.max(ie.scrollHeight,40),160);ie.style.height=`${Y}px`,ie.style.overflowY=ie.scrollHeight>Y?"auto":"hidden"},[R]),b.useEffect(()=>{ct("/api/user").then(ie=>Z(ie.name)).catch(()=>{})},[]);const W=b.useMemo(()=>_B(u,F),[u,F]);b.useEffect(()=>{U===null||W===null||W>=U&&H(null)},[U,W]);const oe=b.useMemo(()=>!p||eg.has(p.state)?!1:(zn(p.startedAt)??U??Date.now())>=(W??0),[U,p,W]),ee=M||U!==null||oe,I=s?.name??i?.agentName??i?.title??j??"Conversation",B=b.useMemo(()=>MB({agentName:I,agentState:s?.state??null,sending:M,currentFlight:p,showWorkingTurn:oe}),[s?.state,I,p,M,oe]),$=i?TB(i):I,re=i?.kind?EB[i.kind]??i.kind:"Conversation",J=IB(i)??e,D=NB(i?.workspaceRoot),P=i?.lastMessageAt??u[u.length-1]?.createdAt??null,K=[D?{label:D,title:i?.workspaceRoot??void 0}:null,i?.currentBranch?{label:i.currentBranch,title:i.currentBranch}:null,s?.harness??i?.harness?{label:s?.harness??i?.harness??"",title:void 0}:null].filter(ie=>!!ie);Xn(b.useCallback(ie=>{if(ie.kind==="message.posted"){const Y=ie.payload?.message;if(!Y||Y.conversationId!==e)return;const ae=Y.actorId===j,ye={id:Y.id,conversationId:Y.conversationId,actorName:ae?I:F,body:Y.body,createdAt:Y.createdAt,class:ae?Y.class:"operator"};if(d(we=>{if(we.some(Ce=>Ce.id===Y.id))return we;if(!ae){const Ce=we.findIndex(me=>me.id.startsWith("optimistic-")&&me.body===Y.body&&Math.abs((zn(me.createdAt)??0)-(zn(Y.createdAt)??0))<=6e4);if(Ce!==-1){const me=[...we];return me[Ce]=ye,Du(me)}}return Du([...we,ye])}),ae){const we=zn(Y.createdAt)??Date.now();H(Ce=>Ce===null||we<Ce?Ce:null),h(Ce=>{if(!Ce)return Ce;const me=zn(Ce.startedAt)??0;return we>=me?null:Ce})}return}if(ie.kind==="invocation.requested"){const Y=ie.payload?.invocation;if(!Y||Y.targetAgentId!==j||Y.conversationId!==e)return;N.current.add(Y.id),H(ae=>ae??Date.now());return}if(ie.kind==="flight.updated"){const Y=ie.payload?.flight;if(!Y||Y.targetAgentId!==j||!(N.current.has(Y.invocationId)||T.current?.id===Y.id))return;if(eg.has(Y.state)){h(ye=>ye?.id===Y.id?null:ye),A();return}N.current.add(Y.invocationId),h(xS(Y,e,j??""));return}if(ie.kind==="agent.endpoint.upserted"){const Y=ie.payload?.endpoint;if(!Y||Y.agentId!==j)return;a(ae=>ae&&{...ae,harness:Y.harness??ae.harness,state:Y.state,updatedAt:Date.now()});return}ie.kind==="unknown"&&A()},[j,I,e,A,F])),b.useEffect(()=>{if(!ee)return;const ie=setInterval(()=>{A()},5e3);return()=>clearInterval(ie)},[ee,A]),b.useEffect(()=>{const ie=()=>{if(document.visibilityState!=="visible")return;const Y=Date.now();Y-_.current<1e3||(_.current=Y,A())};return window.addEventListener("focus",ie),document.addEventListener("visibilitychange",ie),()=>{window.removeEventListener("focus",ie),document.removeEventListener("visibilitychange",ie)}},[A]);const se=u.length+(B.showTyping?1:0),te=b.useRef(0);b.useEffect(()=>{se>te.current&&x.current?.scrollIntoView({behavior:"smooth"}),te.current=se},[se]);const[,ge]=b.useState(0);b.useEffect(()=>{const ie=setInterval(()=>ge(Y=>Y+1),15e3);return()=>clearInterval(ie)},[]);const he=async ie=>{const Y=ie.trim();if(!Y||M)return;const ae=Date.now(),ye={id:`optimistic-${ae}`,conversationId:e,actorName:F,body:Y,createdAt:ae,class:"operator"};z(!0),H(ae),v(null),d(we=>Du([...we,ye]));try{const we=await ct("/api/send",{method:"POST",body:JSON.stringify({body:Y,conversationId:e})});we.flight&&(N.current.add(we.flight.invocationId),h(xS(we.flight,e,j??"")))}catch(we){d(Ce=>Ce.filter(me=>me.id!==ye.id)),H(null),v(we instanceof Error?we.message:String(we))}finally{z(!1)}},pe=async()=>{const ie=R.trim();ie&&(O(""),await he(ie))},xe=async()=>{if(j)try{await ct("/api/agents/"+encodeURIComponent(j)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},Re=B.tone==="working"||B.tone==="pending",fe=!R.trim()&&Re,ke=ho(),Te=b.useCallback((ie,Y)=>{const ae=window.getSelection()?.toString().trim(),ye=[];ae&&(ye.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(ae)}),ye.push({kind:"separator"})),ye.push({kind:"action",label:"Copy Message",onSelect:()=>navigator.clipboard.writeText(Y.body)}),Y.actorName&&!tg(Y,F)&&ye.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(Y.actorName??"")}),ye.push({kind:"separator"}),ye.push({kind:"action",label:"Copy Message ID",onSelect:()=>navigator.clipboard.writeText(Y.id)}),ke(ie,ye)},[F,ke]),He=async(ie,Y)=>{const ae=`@${Y.agentId} `,ye=R.trim();if(ye){O(""),await he(`${ae}${ye}`);return}O(ae),w.current?.focus()};return f.jsxs("div",{className:"s-conversation s-inbox-thread-redesign",children:[f.jsxs("div",{className:"s-conv-header",onClick:()=>E?t({view:"agent-info",conversationId:e}):void 0,style:E?void 0:{cursor:"default"},onContextMenu:ie=>{const Y=[{kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText($)}];j&&Y.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(j)}),Y.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(e)}),ke(ie,Y)},children:[f.jsx("button",{type:"button",className:"s-back",onClick:ie=>{ie.stopPropagation(),t(E?{view:"inbox"}:{view:"sessions"})},children:"←"}),f.jsxs("div",{className:"s-thread-header-copy",children:[f.jsxs("div",{className:"s-thread-header-main",children:[f.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(I)},children:I[0]?.toUpperCase()??"?"}),f.jsxs("div",{className:"s-conv-header-info",children:[f.jsx("span",{className:"s-conv-header-name",children:$}),f.jsxs("span",{className:"s-conv-header-state",title:E?B.detail:J,children:[f.jsx("span",{className:"s-dot s-dot-sm",style:{background:OB(B,s?.state??null)}}),E?B.label:J]})]})]}),f.jsxs("div",{className:"s-thread-header-meta",children:[f.jsx("span",{className:"s-thread-kicker",children:re}),P&&f.jsx("span",{className:"s-thread-header-updated s-tabular",title:Qp(P),children:tt(P)})]})]}),K.length>0&&f.jsx("div",{className:"s-thread-header-chips","aria-label":"Thread details",children:K.map((ie,Y)=>f.jsx("span",{className:"s-thread-chip",title:ie.title,children:ie.label},`${ie.label}-${Y}`))}),E&&j&&f.jsx("span",{className:"s-chevron"})]}),B.showStrip&&f.jsxs("div",{className:`s-conv-status s-conv-status-${B.tone}`,"aria-live":"polite",children:[f.jsx("span",{className:"s-conv-status-dot"}),f.jsxs("div",{className:"s-conv-status-copy",children:[f.jsx("span",{className:"s-conv-status-label",children:B.label}),f.jsx("span",{className:"s-conv-status-detail",children:B.detail})]})]}),E&&s&&(s.harnessSessionId||s.harnessLogPath)&&f.jsxs("details",{className:"s-conv-meta-disclosure",children:[f.jsx("summary",{className:"s-conv-meta-toggle",children:"Session details"}),f.jsxs("div",{className:"s-conv-meta","aria-label":"Agent session metadata",children:[s.harnessSessionId&&f.jsx(wS,{label:"Harness Session",value:s.harnessSessionId}),s.harnessLogPath&&f.jsx(wS,{label:"Harness Log",value:s.harnessLogPath})]})]}),y&&f.jsx("p",{className:"s-error",children:y}),f.jsxs("div",{className:"s-messages",children:[u.length===0?f.jsxs("div",{className:"s-empty s-thread-empty",children:[f.jsx("p",{children:"No messages yet"}),f.jsx("p",{children:E?`Start a conversation with ${I}.`:"Start the thread below."})]}):u.map((ie,Y)=>{const ae=tg(ie,F),ye=AB(ie),we=ye?"scout.dispatch":ie.class,Ce=CB(we),me=Y===0||!jB(u[Y-1]?.createdAt,ie.createdAt),Oe=Qp(ie.createdAt);return f.jsxs("div",{className:"s-thread-message-block",children:[me&&f.jsxs("div",{className:"s-thread-day-divider","aria-label":bS(ie.createdAt),children:[f.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),f.jsx("span",{className:"s-thread-day-label",children:bS(ie.createdAt)}),f.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]}),f.jsx("article",{className:`s-msg s-row-message${ae?" s-msg-you":""}`,"data-class":we,onContextMenu:ve=>Te(ve,ie),children:f.jsxs("div",{className:"s-msg-card",children:[f.jsxs("div",{className:"s-msg-header",children:[f.jsxs("div",{className:"s-msg-meta",children:[f.jsx("span",{className:"s-msg-actor",children:ae?"You":ie.actorName}),Ce&&f.jsx("span",{className:"s-msg-kind",children:Ce})]}),f.jsx("span",{className:"s-msg-time",title:Oe,children:tt(ie.createdAt)})]}),f.jsx("div",{className:"s-msg-body",title:Oe,children:qn(ie.body)}),ye&&ye.candidates.length>0&&f.jsx("div",{className:"s-scout-dispatch",children:ye.candidates.map(ve=>f.jsxs("button",{type:"button",className:"s-scout-tile",onClick:()=>{He(ye,ve)},children:[f.jsxs("span",{className:"s-scout-tile-id",children:["@",ve.agentId]}),f.jsx("span",{className:"s-scout-tile-state",children:ve.endpointState}),f.jsx("span",{className:"s-scout-tile-meta",children:[ve.workspace,ve.node,ve.projectRoot].filter(Boolean).join(" · ")||ve.displayName})]},ve.agentId))})]})})]},ie.id)}),B.showTyping&&f.jsx("div",{className:"s-thread-message-block",children:f.jsx("div",{className:"s-msg s-msg-working","aria-live":"polite",children:f.jsxs("div",{className:"s-msg-card s-msg-working-card",children:[f.jsxs("div",{className:"s-msg-header",children:[f.jsxs("div",{className:"s-msg-meta",children:[f.jsx("span",{className:"s-msg-actor",children:I}),f.jsx("span",{className:"s-msg-kind",children:"Live"})]}),f.jsx("span",{className:"s-msg-time",title:p?.startedAt?Qp(p.startedAt):"now",children:p?.startedAt?tt(p.startedAt):"now"})]}),f.jsxs("div",{className:"s-msg-working-body",children:[f.jsxs("span",{className:"s-typing-indicator","aria-hidden":"true",children:[f.jsx("span",{className:"s-typing-dot"}),f.jsx("span",{className:"s-typing-dot"}),f.jsx("span",{className:"s-typing-dot"})]}),f.jsx("span",{className:"s-msg-working-copy",children:B.detail})]})]})})}),f.jsx("div",{ref:x})]}),f.jsx("form",{className:"s-compose",onSubmit:ie=>{ie.preventDefault(),pe()},children:f.jsxs("div",{className:"s-thread-compose-shell",children:[f.jsx("textarea",{ref:w,className:"s-compose-input",placeholder:`Message ${I}...`,value:R,onChange:ie=>O(ie.target.value),onKeyDown:ie=>{ie.key!=="Enter"||ie.shiftKey||ie.nativeEvent.isComposing||(ie.preventDefault(),!M&&R.trim()&&pe())},rows:1}),f.jsxs("div",{className:"s-thread-compose-footer",children:[f.jsx("span",{className:"s-thread-compose-hint",children:M?"Sending…":fe?"Stop":Re?f.jsxs(f.Fragment,{children:[f.jsx("kbd",{className:"s-kbd",children:"↵"})," steer"]}):f.jsxs(f.Fragment,{children:[f.jsx("kbd",{className:"s-kbd",children:"↵"})," send",f.jsx("kbd",{className:"s-kbd",children:"⇧↵"})," newline"]})}),fe?f.jsx("button",{type:"button",className:"s-compose-send s-compose-stop",onClick:()=>{xe()},"aria-label":"Stop agent",children:f.jsx(zB,{})}):f.jsx("button",{type:"submit",className:"s-compose-send",disabled:M||!R.trim(),"aria-label":"Send message",children:f.jsx(DB,{})})]})]})})]})}function AC(e,t){if(t.filter(i=>i.name===e.name).length<=1)return{name:e.name,qualifier:null};const a=e.project??e.branch??e.id.replace(/^.*\./,"");return{name:e.name,qualifier:a}}function em(e){return e?e.replace(/_/g," "):null}function LB(e){return e?tt(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,a=new Map;for(const i of t){const l=i.agentId;s.has(l)||(s.set(l,i.id),a.set(l,i))}return{conversationByAgentId:s,sessionByAgentId:a}}function UB({label:e,value:t}){return f.jsxs("div",{className:"s-agent-meta-row",children:[f.jsx("span",{className:"s-agent-meta-label",children:e}),f.jsx("span",{className:"s-agent-meta-value",children:t})]})}function VB({values:e}){return f.jsx("span",{className:"s-agent-token-list",children:e.map(t=>f.jsx("span",{className:"s-agent-token",children:t},t))})}function $B({title:e,count:t,children:s}){return f.jsxs("section",{className:"s-agent-roster-section",children:[f.jsxs("div",{className:"s-agent-roster-section-header",children:[f.jsx("div",{className:"s-agent-roster-section-title",children:e}),f.jsx("span",{className:"s-agent-roster-section-count",children:t})]}),f.jsx("div",{className:"s-agent-roster-stack",children:s})]})}function BB({agents:e}){return e.length===0?null:f.jsxs("div",{className:"s-agent-overview-empty",children:[f.jsx("h2",{className:"s-agent-overview-empty-title",children:"Select an agent"}),f.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 ZB({agent:e,allAgents:t,session:s,conversationId:a,navigate:i}){const{name:l,qualifier:u}=AC(e,t),[d,p]=b.useState([]),h=xs(e.state),y=ho(),v=b.useCallback(async()=>{try{p(await ct(`/api/work?agentId=${encodeURIComponent(e.id)}`))}catch{p([])}},[e.id]);b.useEffect(()=>{v()},[v]),Xn(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:em(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 f.jsxs("div",{className:"s-agent-casefile",children:[f.jsx("button",{type:"button",className:"s-back s-agent-mobile-back",onClick:()=>i({view:"agents"}),children:"← All agents"}),f.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:[f.jsx("div",{className:"s-avatar s-agent-casefile-avatar",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),f.jsxs("div",{className:"s-agent-detail-identity-copy",children:[f.jsxs("h2",{className:"s-agent-detail-identity-name",children:[l,u&&f.jsx("span",{className:"s-agent-casefile-title-qualifier",children:u})]}),f.jsxs("div",{className:"s-agent-detail-identity-meta",children:[e.handle&&f.jsxs("span",{className:"s-agent-detail-handle",children:["@",e.handle]}),f.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${h}`,children:[f.jsx("span",{className:"s-dot",style:{background:Jl(e.state)}}),so(e.state)]}),e.updatedAt&&f.jsx("span",{className:"s-agent-detail-updated",children:tt(e.updatedAt)})]}),f.jsx("p",{className:"s-agent-detail-identity-desc",children:[em(e.role)??em(e.agentClass),e.project].filter(Boolean).join(" · ")}),f.jsxs("div",{className:"s-agent-detail-actions",children:[f.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>a&&i({view:"agents",agentId:e.id,conversationId:a}),disabled:!a,children:a?"Open conversation":"No conversation"}),e.capabilities.length>0&&f.jsx("div",{className:"s-agent-detail-capabilities",children:f.jsx(VB,{values:e.capabilities})})]})]})]}),x.length>0&&f.jsxs("section",{className:"s-agent-detail-context",children:[f.jsx("h3",{className:"s-agent-detail-section-title",children:"Context"}),f.jsx("div",{className:"s-agent-meta-card-body",children:x.map(w=>f.jsx(UB,{label:w.label,value:w.value},w.label))})]}),f.jsxs("section",{className:"s-agent-detail-work",children:[f.jsx("h3",{className:"s-agent-detail-section-title",children:"Active work"}),f.jsx(SB,{items:d,navigate:i,emptyTitle:"Nothing in flight",emptyDetail:"New asks, handoffs, and follow-ups will stack here once this agent picks up work."})]})]})}function HB({navigate:e,selectedAgentId:t,conversationId:s}){const[a,i]=b.useState([]),[l,u]=b.useState([]),d=b.useCallback(async()=>{const[O,M]=await Promise.allSettled([ct("/api/agents"),ct("/api/sessions")]);O.status==="fulfilled"&&i(O.value),M.status==="fulfilled"&&u(M.value)},[]);b.useEffect(()=>{d()},[d]),Xn(d);const p=[...a].sort((O,M)=>{const z={working:0,available:1,offline:2},F=z[xs(O.state)]-z[xs(M.state)];if(F!==0)return F;const Z=(M.updatedAt??0)-(O.updatedAt??0);return Z!==0?Z:O.name.localeCompare(M.name)}),h=[{key:"working",title:"Working",agents:p.filter(O=>xs(O.state)==="working")},{key:"available",title:"Available",agents:p.filter(O=>xs(O.state)==="available")},{key:"offline",title:"Offline",agents:p.filter(O=>xs(O.state)==="offline")}],y=t?a.find(O=>O.id===t)??null:null,{conversationByAgentId:v,sessionByAgentId:x}=PB(l),w=a.length>0,N=200,T=440,_="scout-agents-roster-w",[C,j]=b.useState(()=>{try{const O=localStorage.getItem(_);if(O){const M=Number(O);if(M>=N&&M<=T)return M}}catch{}return 280}),E=b.useRef(!1),A=b.useRef(null);b.useEffect(()=>{try{localStorage.setItem(_,String(C))}catch{}},[C]);const R=b.useCallback(O=>{O.preventDefault(),E.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const M=A.current?.getBoundingClientRect().left??0,z=Z=>{E.current&&j(Math.min(T,Math.max(N,Z.clientX-M)))},F=()=>{E.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",z),document.addEventListener("mouseup",F)},[]);return f.jsxs("div",{className:["s-agents-layout","s-agents-browser",w?"s-agents-layout-split":"",y?"s-agents-browser-selected":""].filter(Boolean).join(" "),style:{"--agents-roster-w":`${C}px`},children:[f.jsx("div",{ref:A,className:"s-agents-list-panel s-agents-browser-list",children:f.jsxs("div",{className:"s-agent-roster",children:[f.jsx("div",{className:"s-agent-roster-header",children:f.jsxs("div",{children:[f.jsx("h2",{className:"s-section-title s-agent-roster-title",children:"Agents"}),f.jsxs("p",{className:"s-agent-roster-copy",children:[a.length," total · ",h[0].agents.length," working · ",h[1].agents.length," available"]})]})}),a.length===0?f.jsxs("div",{className:"s-empty s-agent-roster-empty",children:[f.jsx("p",{children:"No agents"}),f.jsx("p",{children:"Agents appear here when they connect to the broker."})]}):h.filter(O=>O.agents.length>0).map(O=>f.jsx($B,{title:O.title,count:O.agents.length,children:O.agents.map(M=>f.jsx(FB,{agent:M,allAgents:a,selected:M.id===t,onClick:()=>e({view:"agents",agentId:M.id})},M.id))},O.key))]})}),w&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"s-agents-roster-resize",onMouseDown:R,role:"separator","aria-orientation":"vertical"}),f.jsx("div",{className:"s-agents-detail-panel s-agents-browser-detail",children:s&&y?f.jsx(ng,{conversationId:s,navigate:e}):y?f.jsx(ZB,{agent:y,allAgents:a,session:x.get(y.id)??null,conversationId:v.get(y.id)??y.conversationId??null,navigate:e}):f.jsx(BB,{agents:a})})]})]})}function FB({agent:e,allAgents:t,selected:s,onClick:a}){const{name:i,qualifier:l}=AC(e,t),u=xs(e.state),d=ho();return f.jsxs("div",{className:`s-agent-list-row s-agent-roster-row${s?" s-agent-list-row-active":""}`,onClick:a,onContextMenu:p=>{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}`)}),d(p,h)},children:[f.jsxs("div",{className:"s-agent-roster-avatar-wrap",children:[f.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),f.jsx("span",{className:`s-agent-roster-avatar-status s-agent-roster-avatar-status-${u}`,style:{background:Jl(e.state)}})]}),f.jsx("div",{className:"s-agent-list-body s-agent-roster-row-body",children:f.jsxs("div",{className:"s-agent-roster-row-top",children:[f.jsxs("div",{className:"s-agent-list-header",children:[f.jsx("span",{className:"s-agent-list-name",children:i}),l&&f.jsx("span",{className:"s-agent-list-qualifier",children:l})]}),f.jsx("span",{className:"s-agent-roster-row-time",children:LB(e.updatedAt)})]})})]})}function qB(e){switch(e){case"queued":case"working":return"working";case"needs_attention":return"updated";case"failed":return"failed";default:return"completed"}}function YB(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId}}function GB(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 XB(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 zu({title:e,detail:t,count:s}){return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"s-dashboard-panel-header",children:[f.jsx("div",{children:f.jsx("h3",{children:e})}),f.jsx("span",{className:"s-dashboard-count",style:s===0?{opacity:.4}:void 0,children:s})]}),f.jsx("p",{className:"s-dashboard-panel-copy",children:t})]})}function SS({ask:e,navigate:t,section:s}){const a=YB(e),i=e.completedAt?`finished ${tt(e.completedAt)}`:e.startedAt?`started ${tt(e.startedAt)}`:`updated ${tt(e.updatedAt)}`;return f.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(a),children:[f.jsxs("div",{className:"s-work-row-header",children:[f.jsxs("div",{className:"s-fleet-row-title-wrap",children:[f.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.agentName??e.agentId)},children:(e.agentName??e.agentId)[0]?.toUpperCase()??"?"}),f.jsxs("div",{className:"s-fleet-row-title-copy",children:[f.jsxs("div",{className:"s-work-row-title-wrap",children:[f.jsx("span",{className:"s-work-row-title",children:e.agentName??e.agentId}),e.harness&&f.jsx("span",{className:"s-badge",children:e.harness})]}),f.jsxs("div",{className:"s-work-row-meta",style:{marginTop:2},children:[f.jsx("span",{className:"s-dot",style:{background:Jl(e.agentState)}}),f.jsx("span",{children:so(e.agentState)}),f.jsx("span",{children:i})]})]})]}),f.jsx("span",{className:`s-pill s-pill-${qB(e.status)}`,children:e.statusLabel})]}),f.jsx("p",{className:"s-work-row-summary",children:qn(e.task)}),e.summary&&f.jsx("p",{className:"s-work-row-summary",style:{marginTop:8},children:qn(e.summary)})]})}function KB({item:e,navigate:t}){const s=GB(e),a=e.kind==="question"?"question":e.state.replace(/_/g," "),i=e.acceptanceState!=="none"?e.acceptanceState.replace(/_/g," "):e.kind==="question"?"awaiting answer":"your move";return f.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:[f.jsxs("div",{className:"s-work-row-header",children:[f.jsx("div",{className:"s-work-row-title-wrap",children:f.jsx("span",{className:"s-work-row-title",children:e.title})}),f.jsx("span",{className:"s-pill s-pill-updated",children:"Needs your input"})]}),f.jsxs("div",{className:"s-work-row-meta",children:[f.jsx("span",{children:e.kind==="question"?"question":"work item"}),e.agentName&&f.jsx("span",{children:e.agentName}),f.jsx("span",{children:a}),f.jsx("span",{children:i}),f.jsx("span",{children:tt(e.updatedAt)})]}),e.summary&&f.jsx("p",{className:"s-work-row-summary",children:qn(e.summary)})]})}function WB({item:e,navigate:t}){const s=XB(e);return f.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>t(s):void 0,children:[f.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"}),f.jsxs("div",{className:"s-dashboard-activity-body",children:[f.jsxs("div",{className:"s-dashboard-activity-header",children:[f.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),f.jsx("span",{className:"s-dashboard-activity-kind",children:K9(e.kind)}),f.jsx("span",{className:"s-time",children:tt(e.ts)})]}),(e.title||e.summary)&&f.jsx("p",{className:"s-dashboard-activity-summary",children:qn(e.title??e.summary??"")}),e.title&&e.summary&&f.jsx("p",{className:"s-dashboard-activity-note",children:qn(e.summary)})]})]})}function JB({navigate:e}){const[t,s]=b.useState(null),a=b.useCallback(async()=>{try{s(await ct("/api/fleet"))}catch{s(null)}},[]);b.useEffect(()=>{a()},[a]),Xn(a);const i=t?.activeAsks??[],l=t?.recentCompleted??[],u=t?.needsAttention??[],d=t?.activity??[],p=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 f.jsxs("div",{className:"s-home s-dashboard-screen s-dashboard-fleet",children:[f.jsx("div",{className:"s-dashboard-hero s-dashboard-hero-fleet",children:f.jsxs("div",{className:"s-dashboard-hero-copy",children:[f.jsxs("div",{className:"s-dashboard-hero-head",children:[f.jsx("h2",{children:"Fleet"}),t&&f.jsxs("span",{className:"s-time",children:["Updated ",tt(t.generatedAt)]})]}),f.jsx("p",{children:p}),f.jsxs("div",{className:"s-dashboard-summary-grid",children:[f.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.needsAttention??0)>0?" s-dashboard-summary-card-attention":""}`,children:[f.jsx("div",{className:"s-dashboard-summary-label",children:"Needs input"}),f.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.needsAttention??0}),f.jsx("div",{className:"s-dashboard-summary-meta",children:"Questions, reviews, or decisions waiting on you"})]}),f.jsxs("div",{className:"s-dashboard-summary-card",children:[f.jsx("div",{className:"s-dashboard-summary-label",children:"Active asks"}),f.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.active??0}),f.jsx("div",{className:"s-dashboard-summary-meta",children:"Currently in flight across the fleet"})]}),f.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.recentCompleted??0)>0?" s-dashboard-summary-card-finished":""}`,children:[f.jsx("div",{className:"s-dashboard-summary-label",children:"Finished"}),f.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.recentCompleted??0}),f.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent completions and failures to review"})]}),f.jsxs("div",{className:"s-dashboard-summary-card",children:[f.jsx("div",{className:"s-dashboard-summary-label",children:"Activity"}),f.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.activity??0}),f.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent events across the fleet"})]})]})]})}),f.jsxs("div",{className:"s-dashboard-fleet-stack",children:[f.jsxs("section",{className:`s-dashboard-panel${u.length>0?" s-dashboard-panel-attention":""}`,children:[f.jsx(zu,{title:"Needs your input",detail:"Handle interruptions, pending answers, and review requests first.",count:u.length}),u.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"Nothing is waiting on you"}),f.jsx("p",{children:"When agents ask a question or a work item needs review, it will land here first."})]}):f.jsx("div",{className:"s-work-list",children:u.map(h=>f.jsx(KB,{item:h,navigate:e},h.recordId))})]}),f.jsxs("div",{className:"s-dashboard-fleet-columns",children:[f.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-active",children:[f.jsx(zu,{title:"Active asks",detail:"The asks still in flight across the fleet.",count:i.length}),i.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"No active asks"}),f.jsx("p",{children:"New agent work will appear here while it is still in progress."})]}):f.jsx("div",{className:"s-work-list",children:i.map(h=>f.jsx(SS,{ask:h,navigate:e,section:"active"},h.invocationId))})]}),f.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-finished",children:[f.jsx(zu,{title:"Recent finishes",detail:"Review completions and failures once the active queue is stable.",count:l.length}),l.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"No recent finishes"}),f.jsx("p",{children:"Completed asks and failures will show up here once they settle."})]}):f.jsx("div",{className:"s-work-list",children:l.map(h=>f.jsx(SS,{ask:h,navigate:e,section:"finished"},h.invocationId))})]})]}),f.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-activity",children:[f.jsx(zu,{title:"Recent activity",detail:"The broader event stream behind the queue.",count:d.length}),d.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"No recent fleet activity"}),f.jsx("p",{children:"Messages, asks, and other agent activity will stream here."})]}):f.jsx("div",{className:"s-dashboard-activity-feed",children:d.slice(0,20).map(h=>f.jsx(WB,{item:h,navigate:e},h.id))})]})]})]})}function QB(){const e=window.getSelection();return e!==null&&e.toString().trim().length>0}function _C(e){QB()||e()}const e7={"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 t7(e){return e7[e]??e.replace(/[._]/g," ")}function n7({item:e,navigate:t}){const s=e.conversationId?{view:"conversation",conversationId:e.conversationId}:null,a=ho(),i=b.useCallback(l=>{const u=e.title??e.summary??"",d=window.getSelection()?.toString().trim(),p=[];d&&(p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(d)}),p.push({kind:"separator"})),u&&p.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(u)}),e.actorName&&p.push({kind:"action",label:"Copy Actor Name",onSelect:()=>navigator.clipboard.writeText(e.actorName)}),s&&(p.push({kind:"separator"}),p.push({kind:"action",label:"Open Conversation",onSelect:()=>t(s)})),p.length>0&&a(l,p)},[e,s,t,a]);return f.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>_C(()=>t(s)):void 0,onContextMenu:i,children:[f.jsx("div",{className:"s-dashboard-activity-time",children:tt(e.ts)}),f.jsxs("div",{className:"s-dashboard-activity-body",children:[f.jsxs("div",{className:"s-dashboard-activity-header",children:[f.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),f.jsx("span",{className:"s-dashboard-activity-kind",children:t7(e.kind)})]}),(e.title||e.summary)&&f.jsx("p",{className:"s-dashboard-activity-summary",children:qn(e.title??e.summary??"")})]})]})}function s7({navigate:e}){const[t,s]=b.useState([]),a=b.useCallback(async()=>{try{const l=await ct("/api/activity");s(l)}catch{}},[]);b.useEffect(()=>{a()},[a]),Xn(a);const i=t.slice(0,20);return f.jsx("div",{className:"s-home s-dashboard-screen",children:f.jsx("div",{className:"s-dashboard-body s-dashboard-body-solo",children:f.jsxs("main",{className:"s-dashboard-main",children:[f.jsxs("div",{className:"s-dashboard-section-head",children:[f.jsx("h3",{children:"Activity"}),t.length>0&&f.jsx("span",{className:"s-dashboard-count",children:t.length})]}),i.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"No activity yet"}),f.jsx("p",{children:"Events appear here as agents connect and work."})]}):f.jsx("div",{className:"s-dashboard-activity-feed",children:i.map(l=>f.jsx(n7,{item:l,navigate:e},l.id))}),t.length>20&&f.jsx("button",{type:"button",className:"s-dashboard-see-all",onClick:()=>e({view:"activity"}),children:"See all activity"})]})})})}const r7=b.lazy(()=>Rl(()=>import("./arc.es-DndjiskC.js"),[]).then(e=>({default:e.ArcDiagram})));function _d(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[s]=t.split(":");return s.split(".")[0]}function a7(e){return e.brokerUrl?_d(e.brokerUrl):e.hostName?_d(e.hostName):e.id.slice(0,10)}function i7(e,t){return Math.abs(e)>=Math.abs(t)?e>=0?["right","left"]:["left","right"]:t>=0?["bottom","top"]:["top","bottom"]}function o7(e){if(!e.localNode)return null;const t=e.localNode.id,s=Object.values(e.nodes).filter(y=>y.id!==t),a=800,i=300,l=a/2,u=i/2,d={[t]:{x:l,y:u,size:"m"}},p={[t]:{icon:"Database",name:_d(e.localNode.hostName)||e.localNode.name||"broker",subtitle:"this node",color:"violet"}},h=[];if(s.length===0)d.__placeholder={x:l+220,y:u,size:"m"},p.__placeholder={icon:"CircleDashed",name:"No peers yet",subtitle:"awaiting discovery",color:"zinc"},h.push({from:t,to:"__placeholder",fromAnchor:"right",toAnchor:"left",style:"pending"});else{const y=s.length,v=Math.min(170,100+y*10);s.forEach((x,w)=>{const N=w/y*Math.PI*2-Math.PI/2,T=Math.round(l+v*Math.cos(N)),_=Math.round(u+v*Math.sin(N));d[x.id]={x:T,y:_,size:"m"},p[x.id]={icon:"Database",name:_d(x.hostName)||x.name||"peer",subtitle:a7(x),color:x.advertiseScope==="mesh"?"emerald":"zinc"};const[C,j]=i7(T-l,_-u);h.push({from:t,to:x.id,fromAnchor:C,toAnchor:j,style:x.advertiseScope==="mesh"?"mesh":"local"})})}return{layout:{width:a,height:i},nodes:d,nodeData:p,connectors:h,connectorStyles:{mesh:{color:"emerald",strokeWidth:2,label:"mesh"},local:{color:"zinc",strokeWidth:1.5},pending:{color:"zinc",strokeWidth:1.5,dashed:!0}}}}function l7({mesh:e}){const t=b.useMemo(()=>o7(e),[e]);return t?f.jsx("div",{className:"s-mesh-topology",children:f.jsx(b.Suspense,{fallback:f.jsx("div",{className:"s-mesh-topology-fallback"}),children:f.jsx(r7,{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 c7(e){return e.code==="local_only"?"notice":e.severity==="error"?"error":"warning"}function u7(e){switch(e.code){case"local_only":return"Local only";case"mesh_loopback":return"Unreachable";case"discovery_unconfigured":return"Needs setup";default:return"Offline"}}function d7(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function tm(e){return e==="mesh"?"Mesh visible":e==="local"?"Local only":e||"Not advertised"}function f7(e){return!e.health.reachable||e.issues.some(t=>t.severity==="error")?"danger":e.issues.length>0?"warning":"success"}function h7(e){return e.health.reachable?e.issues.some(t=>t.severity==="error")?"Degraded":e.issues.length>0?"Needs attention":"Healthy":"Broker unreachable"}function p7({issue:e}){const t=c7(e);return f.jsxs("article",{className:`sys-issue-card sys-issue-card-${t}`,children:[f.jsxs("div",{className:"sys-issue-head",children:[f.jsx("h3",{className:"sys-issue-title",children:e.title}),f.jsx("span",{className:`sys-chip sys-chip-${t==="error"?"failed":t}`,children:u7(e)})]}),f.jsx("p",{className:"sys-issue-body",children:e.summary}),(e.action||e.actionCommand)&&f.jsxs("div",{className:"sys-issue-action",children:[e.actionCommand&&f.jsx("code",{className:"sys-code-inline",children:e.actionCommand}),e.action&&f.jsx("span",{children:e.action})]})]})}function m7({navigate:e}){const[t,s]=b.useState(null),[a,i]=b.useState(!0),[l,u]=b.useState(!1),[d,p]=b.useState(null),[h,y]=b.useState(null),v=b.useRef(null),x=b.useRef(0);b.useEffect(()=>{v.current=t},[t]);const w=b.useCallback(async(M="initial")=>{const z=++x.current;!(v.current!==null)&&M!=="background"?(i(!0),p(null)):u(!0);try{const Z=await ct("/api/mesh");if(z!==x.current)return;s(Z),p(null),y(Date.now())}catch(Z){if(z!==x.current)return;p(Z instanceof Error?Z.message:String(Z))}finally{z===x.current&&(i(!1),u(!1))}},[]);b.useEffect(()=>{w("initial")},[w]),b.useEffect(()=>{const M=setInterval(()=>{w("background")},1e4);return()=>clearInterval(M)},[w]);const N=t?f7(t):"warning",T=t?h7(t):"Loading",_=t?Object.values(t.nodes):[],C=t?.localNode?.id,j=t?.localNode?.hostName?.toLowerCase(),E=_.filter(M=>M.id!==C),A=(t?.tailscale.peers??[]).filter(M=>{const z=M.hostName?.toLowerCase();return z?!(z==="localhost"||j&&(z===j||z.startsWith(`${j.split(".")[0]}.`))):!0}),R=t?t.issues.length>0?t.issues:t.warnings.map((M,z)=>({code:`fallback-${z}`,severity:"warning",title:"Mesh notice",summary:M,action:null,actionCommand:null})):[],O=b.useMemo(()=>t?[{label:"Broker",value:t.health.reachable?"Reachable":"Unavailable",detail:t.health.error??d7(t.brokerUrl)},{label:"Visibility",value:tm(t.localNode?.advertiseScope),detail:t.localNode?.hostName??"Local registration unavailable"},{label:"Mesh peers",value:`${E.length}`,detail:E.length>0?"Remote brokers in this mesh":"No remote brokers discovered"},{label:"Tailnet",value:t.tailscale.available?`${A.filter(M=>M.online).length}/${A.length}`:"Unavailable",detail:t.tailscale.available?"Online peers / visible peers":"Tailscale peers not detected"}]:[],[A,t,E.length]);return f.jsxs("div",{className:"sys-surface-page",children:[f.jsxs("div",{className:"sys-page-head",children:[f.jsxs("div",{className:"sys-page-title-group",children:[f.jsx("h2",{className:"sys-page-title",children:"Mesh"}),f.jsx("p",{className:"sys-page-subtitle",children:"Broker reachability, discovery posture, and peer visibility."})]}),f.jsxs("div",{className:"sys-page-actions",children:[f.jsx("span",{className:`sys-chip sys-chip-${N}`,children:T}),f.jsx("div",{className:"sys-sync-note",children:a?"Loading system snapshot...":d&&t?`Showing last confirmed snapshot from ${h?tt(h):"earlier"}`:h?`Confirmed ${tt(h)}`:"Waiting for first snapshot"}),f.jsx("button",{type:"button",className:"s-btn",disabled:a||l,onClick:()=>{w("manual")},children:l?"Refreshing...":"Refresh"})]})]}),d&&t&&f.jsxs("div",{className:"sys-banner sys-banner-warning",children:[f.jsx("strong",{children:"Mesh refresh failed."}),f.jsx("span",{children:d})]}),a&&!t&&f.jsxs("div",{className:"sys-panel sys-state-card",children:[f.jsx("h3",{className:"sys-state-title",children:"Loading mesh status"}),f.jsx("p",{className:"sys-state-body",children:"Inspecting broker reachability and peer discovery inputs."})]}),!a&&!t&&d&&f.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[f.jsx("h3",{className:"sys-state-title",children:"Mesh status is unavailable"}),f.jsx("p",{className:"sys-state-body",children:d}),f.jsx("div",{className:"sys-inline-actions",children:f.jsx("button",{type:"button",className:"s-btn",onClick:()=>{w("manual")},children:"Try again"})})]}),t&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"sys-stat-grid",children:O.map(M=>f.jsxs("div",{className:"sys-stat-card",children:[f.jsx("span",{className:"sys-stat-label",children:M.label}),f.jsx("strong",{className:"sys-stat-value",children:M.value}),f.jsx("span",{className:"sys-stat-detail",children:M.detail})]},M.label))}),f.jsxs("section",{className:"sys-panel sys-mesh-identity",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Local node"}),f.jsx("p",{className:"sys-section-subtitle",children:"The broker identity other peers can discover and dial."})]})}),t.localNode?f.jsxs("div",{className:"sys-detail-grid",children:[f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Node"}),f.jsx("span",{className:"sys-detail-value",children:t.localNode.name})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Node id"}),f.jsx("code",{className:"sys-detail-value",children:t.localNode.id})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Mesh"}),f.jsx("code",{className:"sys-detail-value",children:t.meshId??"Unassigned"})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Advertise scope"}),f.jsx("span",{className:"sys-detail-value",children:tm(t.localNode.advertiseScope)})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Broker URL"}),f.jsx("code",{className:"sys-detail-value",children:t.localNode.brokerUrl??t.brokerUrl})]}),f.jsxs("div",{className:"sys-detail-card",children:[f.jsx("span",{className:"sys-detail-label",children:"Host"}),f.jsx("span",{className:"sys-detail-value",children:t.localNode.hostName??"Unavailable"})]})]}):f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"No local node registration"}),f.jsx("p",{children:"The broker answered health checks, but it has not published a local node record yet."})]})]}),f.jsxs("section",{className:"sys-panel",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Health notices"}),f.jsx("p",{className:"sys-section-subtitle",children:"Warnings and errors from the current broker and discovery snapshot."})]})}),R.length>0?f.jsx("div",{className:"sys-issue-grid",children:R.map((M,z)=>f.jsx(p7,{issue:M},`${M.code}-${z}`))}):f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"No active mesh warnings"}),f.jsx("p",{children:"The broker is reachable and discovery inputs look healthy from this page."})]})]}),f.jsxs("section",{className:"sys-panel",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Topology"}),f.jsx("p",{className:"sys-section-subtitle",children:"Current broker relationships inside the visible mesh."})]})}),t.localNode?f.jsx(l7,{mesh:t}):f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"Topology unavailable"}),f.jsx("p",{children:"A local node record is required before the topology view can render."})]})]}),f.jsxs("section",{className:"sys-panel",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Discovered peers"}),f.jsxs("p",{className:"sys-section-subtitle",children:["Remote brokers registered in ",t.meshId??"this mesh","."]})]})}),E.length===0?f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"No remote brokers discovered"}),f.jsx("p",{children:"This can be normal on a single-node setup. If you expect peers, check the health notices above."})]}):f.jsx("div",{className:"sys-list-grid",children:E.map(M=>f.jsxs("article",{className:"sys-list-card",children:[f.jsxs("div",{className:"sys-list-card-head",children:[f.jsx("h3",{className:"sys-list-card-title",children:M.name}),f.jsx("span",{className:`sys-chip sys-chip-${M.advertiseScope==="mesh"?"success":"neutral"}`,children:tm(M.advertiseScope)})]}),f.jsxs("div",{className:"sys-list-card-detail",children:[f.jsx("span",{className:"sys-detail-label",children:"Node id"}),f.jsx("code",{className:"sys-detail-value",children:M.id})]}),M.brokerUrl&&f.jsxs("div",{className:"sys-list-card-detail",children:[f.jsx("span",{className:"sys-detail-label",children:"Broker"}),f.jsx("code",{className:"sys-detail-value",children:M.brokerUrl})]}),f.jsxs("div",{className:"sys-list-card-detail",children:[f.jsx("span",{className:"sys-detail-label",children:"Last seen"}),f.jsx("span",{className:"sys-detail-value",children:M.lastSeenAt?tt(M.lastSeenAt):"Recently registered"})]})]},M.id))})]}),f.jsxs("section",{className:"sys-panel",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Tailnet"}),f.jsx("p",{className:"sys-section-subtitle",children:"External Tailscale peers visible from this machine."})]})}),A.length===0?f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"No external tailnet peers"}),f.jsx("p",{children:t.tailscale.available?"Only this host is visible in the current tailnet snapshot.":"Tailscale peers were not detected on this machine."})]}):f.jsx("div",{className:"sys-list-grid",children:A.map(M=>f.jsxs("article",{className:"sys-list-card",children:[f.jsxs("div",{className:"sys-list-card-head",children:[f.jsx("h3",{className:"sys-list-card-title",children:M.hostName||M.name}),f.jsx("span",{className:`sys-chip sys-chip-${M.online?"success":"failed"}`,children:M.online?"Online":"Offline"})]}),f.jsxs("div",{className:"sys-list-card-detail",children:[f.jsx("span",{className:"sys-detail-label",children:"Address"}),f.jsx("code",{className:"sys-detail-value",children:M.addresses?.[0]??"Unavailable"})]}),f.jsxs("div",{className:"sys-list-card-detail",children:[f.jsx("span",{className:"sys-detail-label",children:"Platform"}),f.jsx("span",{className:"sys-detail-value",children:M.os??"Unknown"})]})]},M.id))})]})]})]})}const g7=[[/```[\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 y7(e,t=140){if(!e)return"";let s=e;for(const[a,i]of g7)s=s.replace(a,i);return s=s.replace(/\s+/g," ").trim(),s.length>t&&(s=`${s.slice(0,t-1)}…`),s}const kC="scout:sessions:lastViewed";function MC(){if(typeof localStorage>"u")return{};try{const e=localStorage.getItem(kC);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function v7(e,t=Date.now()){const s=MC();s[e]=t;try{localStorage.setItem(kC,JSON.stringify(s))}catch{}return s}function nm(e,t,s){return e?e>(s[t]??0):!1}const ES={direct:"DM",channel:"Channel",group_direct:"Group",thread:"Thread"},b7=new Set(["all","direct","channel","group_direct","thread"]);function sg(e){return typeof window>"u"?"":new URLSearchParams(window.location.search).get(e)??""}function x7(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);for(const[a,i]of Object.entries(e))i===null||i===""?t.delete(a):t.set(a,i);const s=t.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:""))}function w7(){const e=sg("view");return b7.has(e)?e:"all"}function S7(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function E7(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function N7(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 T7({navigate:e}){const[t,s]=b.useState([]),[a,i]=b.useState(()=>w7()),[l,u]=b.useState(()=>sg("q")),[d,p]=b.useState(()=>sg("unread")==="1"),[h,y]=b.useState(()=>MC()),[v,x]=b.useState(0),[w,N]=b.useState(null),T=b.useRef(null),_=b.useRef(null),C=ho(),j=b.useCallback(async()=>{N(null);try{const U=await ct("/api/sessions");s(U.sort((H,W)=>(W.lastMessageAt??0)-(H.lastMessageAt??0)))}catch(U){N(U instanceof Error?U.message:String(U))}},[]);b.useEffect(()=>{j()},[j]),Xn(j);const[,E]=b.useState(0);b.useEffect(()=>{const U=setInterval(()=>E(H=>H+1),15e3);return()=>clearInterval(U)},[]),b.useEffect(()=>{x7({view:a==="all"?null:a,q:l.trim()||null,unread:d?"1":null})},[a,l,d]);const A=b.useMemo(()=>Array.from(new Set(t.map(U=>U.kind))),[t]),R=b.useMemo(()=>{const U={all:t.length};for(const H of t)U[H.kind]=(U[H.kind]??0)+1;return U},[t]),O=b.useMemo(()=>t.filter(U=>nm(U.lastMessageAt,U.id,h)).length,[t,h]),M=b.useMemo(()=>{const U=l.trim().toLowerCase();return t.filter(H=>!(a!=="all"&&H.kind!==a||d&&!nm(H.lastMessageAt,H.id,h)||U&&![H.title,H.preview,H.agentName??"",H.harness??"",...H.participantIds].join(" ").toLowerCase().includes(U)))},[t,a,d,h,l]);b.useEffect(()=>{v>=M.length&&x(Math.max(0,M.length-1))},[M.length,v]);const z=b.useCallback(U=>{y(v7(U.id)),e({view:"conversation",conversationId:U.id})},[e]);b.useEffect(()=>{function U(H){const W=H.target,oe=W instanceof HTMLInputElement||W instanceof HTMLTextAreaElement||W instanceof HTMLElement&&W.isContentEditable;if((H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="k"){H.preventDefault(),T.current?.focus(),T.current?.select();return}if(oe){H.key==="Escape"&&W===T.current&&T.current?.blur();return}if(H.key==="/"){H.preventDefault(),T.current?.focus();return}if(H.key==="j"||H.key==="ArrowDown"){H.preventDefault(),x(ee=>Math.min(M.length-1,ee+1));return}if(H.key==="k"||H.key==="ArrowUp"){H.preventDefault(),x(ee=>Math.max(0,ee-1));return}if(H.key==="Enter"||H.key==="o"){const ee=M[v];ee&&(H.preventDefault(),z(ee))}}return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[M,v,z]),b.useEffect(()=>{_.current?.querySelector(`[data-idx="${v}"]`)?.scrollIntoView({block:"nearest"})},[v]);const F=A.length>1,Z=d?O>0?`${O} unread threads need attention.`:"No unread threads right now.":M.length===t.length?"Recent activity across every conversation.":`${M.length} conversations match the current filters.`;return f.jsxs("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:[f.jsx("section",{className:"s-thread-overview",children:f.jsxs("div",{className:"s-thread-overview-copy",children:[f.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[f.jsx("h2",{className:"s-page-title",children:"Sessions"}),f.jsxs("span",{className:"s-meta s-tabular",children:[M.length," of ",t.length]})]}),f.jsx("p",{className:"s-thread-overview-summary",children:Z})]})}),f.jsxs("section",{className:"s-thread-panel s-thread-panel-list",children:[f.jsxs("div",{className:"s-sessions-toolbar",children:[F&&f.jsxs("div",{className:"s-seg",role:"tablist","aria-label":"Session kind",children:[f.jsx(NS,{label:"All",count:R.all,pressed:a==="all",onClick:()=>i("all")}),A.map(U=>f.jsx(NS,{label:ES[U]??U,count:R[U]??0,pressed:a===U,onClick:()=>i(U)},U))]}),f.jsxs("button",{type:"button",className:`s-seg-standalone${d?" is-on":""}`,onClick:()=>p(U=>!U),"aria-pressed":d,title:"Show unread only",children:[f.jsx("span",{className:"s-dot s-dot-sm","aria-hidden":"true"}),f.jsx("span",{children:"Unread"}),O>0&&f.jsx("span",{className:"s-seg-count",children:O})]}),f.jsxs("div",{className:"s-search",children:[f.jsx("input",{ref:T,type:"text",className:"s-search-input",placeholder:"Search conversations…",value:l,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(l?u(""):U.target.blur())}}),f.jsx("kbd",{className:"s-search-kbd",children:"⌘K"})]})]}),w&&f.jsx("p",{className:"s-error",children:w}),M.length===0?f.jsxs("div",{className:"s-empty s-thread-empty-state",children:[f.jsx("p",{children:l||d?"No matches":"No conversations"}),f.jsx("p",{children:l?"Try a different search term.":d?"You're all caught up.":"Conversations appear here when agents communicate."})]}):f.jsx("div",{className:"s-inbox",ref:_,role:"listbox","aria-label":"Sessions",children:M.map((U,H)=>{const W=S7(U),oe=(U.agentName??W)[0]?.toUpperCase()??"?",ee=nm(U.lastMessageAt,U.id,h),I=H===v,B=y7(U.preview,160),$=ES[U.kind]??U.kind,re=E7(U.workspaceRoot);return f.jsxs("div",{"data-idx":H,"data-unread":ee?"true":"false","data-selected":I?"true":"false",className:"s-inbox-row",role:"option","aria-selected":I,tabIndex:I?0:-1,onClick:()=>{_C(()=>{x(H),z(U)})},onMouseEnter:()=>x(H),onContextMenu:J=>{const D=window.getSelection()?.toString().trim(),P=[];D&&(P.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(D)}),P.push({kind:"separator"})),P.push({kind:"action",label:"Open Conversation",onSelect:()=>z(U)}),P.push({kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(W)}),U.id&&P.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(U.id)}),C(J,P)},children:[f.jsxs("div",{className:"s-session-avatar-wrap",children:[f.jsx("div",{className:"s-avatar",style:{background:Ts(U.agentName??W)},"aria-hidden":"true",children:oe}),ee&&f.jsx("span",{className:"s-session-unread-dot","aria-hidden":"true"})]}),f.jsxs("div",{className:"s-inbox-body",children:[f.jsxs("div",{className:"s-inbox-header",children:[f.jsx("div",{className:"s-session-heading",children:f.jsx("span",{className:"s-inbox-name",title:W,children:W})}),f.jsx("div",{className:"s-session-trailing",children:U.lastMessageAt&&f.jsx("span",{className:"s-inbox-time s-tabular",title:N7(U.lastMessageAt),children:tt(U.lastMessageAt)})})]}),B?f.jsx("p",{className:"s-inbox-preview",children:B}):f.jsx("p",{className:"s-inbox-preview s-inbox-preview-empty",children:"No messages yet"}),f.jsxs("div",{className:"s-session-meta-row","aria-label":"Conversation details",children:[f.jsx("span",{className:"s-session-pill",children:$}),re&&f.jsx("span",{className:"s-session-pill",title:U.workspaceRoot??void 0,children:re}),U.currentBranch&&f.jsx("span",{className:"s-session-pill",title:U.currentBranch,children:U.currentBranch})]})]})]},U.id)})})]})]})}function NS({label:e,count:t,pressed:s,onClick:a}){return f.jsxs("button",{type:"button",className:"s-seg-btn","aria-pressed":s,onClick:a,children:[f.jsx("span",{children:e}),f.jsx("span",{className:"s-seg-count",children:t})]})}var Ma=(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))(Ma||{});const j7=[0,1],OC=[1,0],DC=[2,3],zC=[3,2],C7={L:j7,M:OC,Q:DC,H:zC},R7=/^\d*$/,A7=/^[A-Z0-9 $%*+./:-]*$/,sm="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",fy=1,hy=40,TS=3,_7=3,Iu=40,k7=10,IC=[[-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]],LC=[[-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,a,i){if(this.version=t,this.ecc=s,t<fy||t>hy)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 d=0;d<this.size;d++)this.modules.push(l.slice()),this.types.push(l.map(()=>0));this.drawFunctionPatterns();const u=this.addEccAndInterleave(a);if(this.drawCodewords(u),i===-1){let d=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<d&&(i=p,d=h),this.applyMask(p)}}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 a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2===0,Ma.Timing),this.setFunctionModule(a,6,a%2===0,Ma.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 a=0;a<s;a++)for(let i=0;i<s;i++)a===0&&i===0||a===0&&i===s-1||a===s-1&&i===0||this.drawAlignmentPattern(t[a],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const s=this.ecc[1]<<3|t;let a=s;for(let l=0;l<10;l++)a=a<<1^(a>>>9)*1335;const i=(s<<10|a)^21522;for(let l=0;l<=5;l++)this.setFunctionModule(8,l,cr(i,l));this.setFunctionModule(8,7,cr(i,6)),this.setFunctionModule(8,8,cr(i,7)),this.setFunctionModule(7,8,cr(i,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,cr(i,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,cr(i,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,cr(i,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let a=0;a<12;a++)t=t<<1^(t>>>11)*7973;const s=this.version<<12|t;for(let a=0;a<18;a++){const i=cr(s,a),l=this.size-11+a%3,u=Math.floor(a/3);this.setFunctionModule(l,u,i),this.setFunctionModule(u,l,i)}}drawFinderPattern(t,s){for(let a=-4;a<=4;a++)for(let i=-4;i<=4;i++){const l=Math.max(Math.abs(i),Math.abs(a)),u=t+i,d=s+a;u>=0&&u<this.size&&d>=0&&d<this.size&&this.setFunctionModule(u,d,l!==2&&l!==4,Ma.Position)}}drawAlignmentPattern(t,s){for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,s+a,Math.max(Math.abs(i),Math.abs(a))!==1,Ma.Alignment)}setFunctionModule(t,s,a,i=Ma.Function){this.modules[s][t]=a,this.types[s][t]=i}addEccAndInterleave(t){const s=this.version,a=this.ecc;if(t.length!==ed(s,a))throw new RangeError("Invalid argument");const i=LC[a[0]][s],l=IC[a[0]][s],u=Math.floor(rg(s)/8),d=i-u%i,p=Math.floor(u/i),h=[],y=$7(l);for(let x=0,w=0;x<i;x++){const N=t.slice(w,w+p-l+(x<d?0:1));w+=N.length;const T=B7(N,y);x<d&&N.push(0),h.push(N.concat(T))}const v=[];for(let x=0;x<h[0].length;x++)h.forEach((w,N)=>{(x!==p-l||N>=d)&&v.push(w[x])});return v}drawCodewords(t){if(t.length!==Math.floor(rg(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let a=this.size-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<this.size;i++)for(let l=0;l<2;l++){const u=a-l,p=(a+1&2)===0?this.size-1-i:i;!this.types[p][u]&&s<t.length*8&&(this.modules[p][u]=cr(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 a=0;a<this.size;a++){let i;switch(t){case 0:i=(a+s)%2===0;break;case 1:i=s%2===0;break;case 2:i=a%3===0;break;case 3:i=(a+s)%3===0;break;case 4:i=(Math.floor(a/3)+Math.floor(s/2))%2===0;break;case 5:i=a*s%2+a*s%3===0;break;case 6:i=(a*s%2+a*s%3)%2===0;break;case 7:i=((a+s)%2+a*s%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[s][a]&&i&&(this.modules[s][a]=!this.modules[s][a])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let u=!1,d=0;const p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[l][h]===u?(d++,d===5?t+=TS:d>5&&t++):(this.finderPenaltyAddHistory(d,p),u||(t+=this.finderPenaltyCountPatterns(p)*Iu),u=this.modules[l][h],d=1);t+=this.finderPenaltyTerminateAndCount(u,d,p)*Iu}for(let l=0;l<this.size;l++){let u=!1,d=0;const p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][l]===u?(d++,d===5?t+=TS:d>5&&t++):(this.finderPenaltyAddHistory(d,p),u||(t+=this.finderPenaltyCountPatterns(p)*Iu),u=this.modules[h][l],d=1);t+=this.finderPenaltyTerminateAndCount(u,d,p)*Iu}for(let l=0;l<this.size-1;l++)for(let u=0;u<this.size-1;u++){const d=this.modules[l][u];d===this.modules[l][u+1]&&d===this.modules[l+1][u]&&d===this.modules[l+1][u+1]&&(t+=_7)}let s=0;for(const l of this.modules)s=l.reduce((u,d)=>u+(d?1:0),s);const a=this.size*this.size,i=Math.ceil(Math.abs(s*20-a*10)/a)-1;return t+=i*k7,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,a=[6];for(let i=this.size-7;a.length<t;i-=s)a.splice(1,0,i);return a}}finderPenaltyCountPatterns(t){const s=t[1],a=s>0&&t[2]===s&&t[3]===s*3&&t[4]===s&&t[5]===s;return(a&&t[0]>=s*4&&t[6]>=s?1:0)+(a&&t[6]>=s*4&&t[0]>=s?1:0)}finderPenaltyTerminateAndCount(t,s,a){return t&&(this.finderPenaltyAddHistory(s,a),s=0),s+=this.size,this.finderPenaltyAddHistory(s,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(t,s){s[0]===0&&(t+=this.size),s.pop(),s.unshift(t)}}function dr(e,t,s){if(t<0||t>31||e>>>t)throw new RangeError("Value out of range");for(let a=t-1;a>=0;a--)s.push(e>>>a&1)}function cr(e,t){return(e>>>t&1)!==0}class py{constructor(t,s,a){if(this.mode=t,this.numChars=s,this.bitData=a,s<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}getData(){return this.bitData.slice()}}const O7=[1,10,12,14],D7=[2,9,11,13],z7=[4,8,16,16];function PC(e,t){return e[Math.floor((t+7)/17)+1]}function UC(e){const t=[];for(const s of e)dr(s,8,t);return new py(z7,e.length,t)}function I7(e){if(!VC(e))throw new RangeError("String contains non-numeric characters");const t=[];for(let s=0;s<e.length;){const a=Math.min(e.length-s,3);dr(Number.parseInt(e.substring(s,s+a),10),a*3+1,t),s+=a}return new py(O7,e.length,t)}function L7(e){if(!$C(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 a=sm.indexOf(e.charAt(s))*45;a+=sm.indexOf(e.charAt(s+1)),dr(a,11,t)}return s<e.length&&dr(sm.indexOf(e.charAt(s)),6,t),new py(D7,e.length,t)}function P7(e){return e===""?[]:VC(e)?[I7(e)]:$C(e)?[L7(e)]:[UC(V7(e))]}function VC(e){return R7.test(e)}function $C(e){return A7.test(e)}function U7(e,t){let s=0;for(const a of e){const i=PC(a.mode,t);if(a.numChars>=1<<i)return Number.POSITIVE_INFINITY;s+=4+i+a.bitData.length}return s}function V7(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 rg(e){if(e<fy||e>hy)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 ed(e,t){return Math.floor(rg(e)/8)-IC[t[0]][e]*LC[t[0]][e]}function $7(e){if(e<1||e>255)throw new RangeError("Degree out of range");const t=[];for(let a=0;a<e-1;a++)t.push(0);t.push(1);let s=1;for(let a=0;a<e;a++){for(let i=0;i<t.length;i++)t[i]=ag(t[i],s),i+1<t.length&&(t[i]^=t[i+1]);s=ag(s,2)}return t}function B7(e,t){const s=t.map(a=>0);for(const a of e){const i=a^s.shift();s.push(0),t.forEach((l,u)=>s[u]^=ag(l,i))}return s}function ag(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let s=0;for(let a=7;a>=0;a--)s=s<<1^(s>>>7)*285,s^=(t>>>a&1)*e;return s}function Z7(e,t,s=1,a=40,i=-1,l=!0){if(!(fy<=s&&s<=a&&a<=hy)||i<-1||i>7)throw new RangeError("Invalid value");let u,d;for(u=s;;u++){const v=ed(u,t)*8,x=U7(e,u);if(x<=v){d=x;break}if(u>=a)throw new RangeError("Data too long")}for(const v of[OC,DC,zC])l&&d<=ed(u,v)*8&&(t=v);const p=[];for(const v of e){dr(v.mode[0],4,p),dr(v.numChars,PC(v.mode,u),p);for(const x of v.getData())p.push(x)}const h=ed(u,t)*8;dr(0,Math.min(4,h-p.length),p),dr(0,(8-p.length%8)%8,p);for(let v=236;p.length<h;v^=253)dr(v,8,p);const y=Array.from({length:Math.ceil(p.length/8)},()=>0);return p.forEach((v,x)=>y[x>>>3]|=v<<7-(x&7)),new M7(u,t,y,i)}function H7(e,t){const{ecc:s="L",boostEcc:a=!1,minVersion:i=1,maxVersion:l=40,maskPattern:u=-1,border:d=1}=t||{},p=typeof e=="string"?P7(e):Array.isArray(e)?[UC(e)]:void 0;if(!p)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);const h=Z7(p,C7[s],i,l,u,a),y=F7({version:h.version,maskPattern:h.mask,size:h.size,data:h.modules,types:h.types},d);return t?.invert&&(y.data=y.data.map(v=>v.map(x=>!x))),t?.onEncoded?.(y),y}function F7(e,t=1){if(!t)return e;const{size:s}=e,a=s+t*2;e.size=a,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:a},u=>!1)),e.data.push(Array.from({length:a},u=>!1));const i=Ma.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:a},u=>i)),e.types.push(Array.from({length:a},u=>i));return e}function jS(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function q7(e,t={}){const s=H7(e,t),{pixelSize:a=10,whiteColor:i="white",blackColor:l="black"}=t,u=s.size*a,d=s.size*a;let p=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${d} ${u}">`;const h=[];for(let y=0;y<s.size;y++)for(let v=0;v<s.size;v++){const x=v*a,w=y*a;s.data[y][v]&&h.push(`M${x},${w}h${a}v${a}h-${a}z`)}return p+=`<rect fill="${jS(i)}" width="${d}" height="${u}"/>`,p+=`<path fill="${jS(l)}" d="${h.join("")}"/>`,p+="</svg>",p}function Y7(e){return e?e.replace(/^wss?:\/\//,"").replace(/:\d+$/,""):null}function CS(e){return e?e.length<=18?e:`${e.slice(0,10)}...${e.slice(-6)}`:null}function G7(e){return e?e.status==="paired"||e.status==="connected"?"success":e.status==="error"||e.status==="closed"?"danger":"warning":"warning"}function X7(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 a=Math.floor(s/60),i=s%60;return i>0?`${a}m ${i}s`:`${a}m`}function RS({value:e}){const[t,s]=b.useState(!1),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[e]);return f.jsx("button",{type:"button",className:"sys-copy-btn",onClick:a,title:"Copy",children:t?f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f.jsx("polyline",{points:"20 6 9 17 4 12"})}):f.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),f.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}function K7({navigate:e}){const[t,s]=b.useState(null),[a,i]=b.useState(""),[l,u]=b.useState(""),[d,p]=b.useState(!0),[h,y]=b.useState(!1),[v,x]=b.useState(!1),[w,N]=b.useState(null),[T,_]=b.useState(null),[C,j]=b.useState(null),[E,A]=b.useState(null),[R,O]=b.useState(()=>Date.now()),[M,z]=b.useState(null),F=b.useRef(null),Z=b.useRef(0),U=b.useRef(null);b.useEffect(()=>{F.current=t},[t]),b.useEffect(()=>{U.current=w},[w]);const H=b.useCallback(async(te="initial")=>{if(te==="background"&&U.current)return;const ge=++Z.current;!(F.current!==null)&&te!=="background"?(p(!0),_(null)):y(!0);try{const pe=await ct(te==="manual"?"/api/pairing-state/refresh":"/api/pairing-state");if(ge!==Z.current)return;s(pe),_(null),A(Date.now())}catch(pe){if(ge!==Z.current)return;_(pe instanceof Error?pe.message:String(pe))}finally{ge===Z.current&&(p(!1),y(!1))}},[]),W=b.useCallback(async()=>{try{const te=await ct("/api/user");u(te.name),i(te.name),j(null)}catch(te){j(te instanceof Error?te.message:String(te))}},[]);b.useEffect(()=>{H("initial"),W()},[H,W]),b.useEffect(()=>{const te=setInterval(()=>{H("background")},1e4);return()=>clearInterval(te)},[H]),b.useEffect(()=>{if(!t?.pairing?.expiresAt)return;O(Date.now());const te=setInterval(()=>{O(Date.now())},1e3);return()=>clearInterval(te)},[t?.pairing?.expiresAt]);const oe=b.useCallback(async()=>{x(!0),j(null);try{const te=await ct("/api/user",{method:"POST",body:JSON.stringify({name:a})});u(te.name),i(te.name)}catch(te){j(te instanceof Error?te.message:String(te))}finally{x(!1)}},[a]),ee=b.useCallback(async te=>{const ge=++Z.current;N(te),_(null);try{const he=await ct("/api/pairing/control",{method:"POST",body:JSON.stringify({action:te})});if(ge!==Z.current)return;s(he),A(Date.now())}catch(he){if(ge!==Z.current)return;_(he instanceof Error?he.message:String(he))}finally{ge===Z.current&&N(null)}},[]),I=b.useCallback(async te=>{z(te);try{await ct(`/api/pairing/peers/${encodeURIComponent(te)}`,{method:"DELETE"}),H("manual")}catch{}finally{z(null)}},[H]),B=b.useMemo(()=>{const te=t?.pairing?.qrValue?.trim();return te?q7(te,{border:2,ecc:"M",pixelSize:8}):null},[t?.pairing?.qrValue]),$=Y7(t?.pairing?.relay??t?.relay??null),re=X7(t?.pairing?.expiresAt,R),D=(t?.trustedPeers.find(te=>te.fingerprint===t.connectedPeerFingerprint)??null)?.name??CS(t?.connectedPeerFingerprint??null),P=G7(t),K=a.trim()!==l,se=!d&&!t&&!!T;return f.jsxs("div",{className:"sys-surface-page sys-settings-page",children:[f.jsxs("div",{className:"sys-page-head",children:[f.jsxs("div",{className:"sys-page-title-group",children:[f.jsx("h2",{className:"sys-page-title",children:"Settings"}),f.jsx("p",{className:"sys-page-subtitle",children:"Identity, pairing, and trusted devices."})]}),f.jsxs("div",{className:"sys-page-actions",children:[t&&f.jsx("span",{className:`sys-chip sys-chip-${P}`,children:t.statusLabel}),f.jsx("div",{className:"sys-sync-note",children:d?"Loading...":T&&t?`Snapshot from ${E?tt(E):"earlier"}`:E?`Updated ${tt(E)}`:""}),f.jsx("button",{type:"button",className:"s-btn",disabled:d||h||!!w,onClick:()=>{H("manual")},children:h?"Refreshing...":"Refresh"})]})]}),T&&t&&f.jsxs("div",{className:"sys-banner sys-banner-warning",children:[f.jsx("strong",{children:"Refresh failed."}),f.jsx("span",{children:T})]}),C&&f.jsxs("div",{className:"sys-banner sys-banner-warning",children:[f.jsx("strong",{children:"Identity error."}),f.jsx("span",{children:C})]}),d&&!t&&f.jsxs("div",{className:"sys-panel sys-state-card",children:[f.jsx("h3",{className:"sys-state-title",children:"Loading settings"}),f.jsx("p",{className:"sys-state-body",children:"Checking relay status and trusted peers."})]}),se&&f.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[f.jsx("h3",{className:"sys-state-title",children:"Pairing unavailable"}),f.jsx("p",{className:"sys-state-body",children:T}),f.jsx("div",{className:"sys-inline-actions",children:f.jsx("button",{type:"button",className:"s-btn",onClick:()=>{H("manual")},children:"Try again"})})]}),f.jsxs("div",{className:"sys-settings-hero",children:[f.jsx("div",{className:"sys-settings-qr-col",children:B?f.jsxs("div",{className:"sys-settings-qr-frame",children:[f.jsx("div",{className:"s-qr",dangerouslySetInnerHTML:{__html:B}}),re&&f.jsxs("span",{className:"sys-settings-qr-expires",children:["Expires in ",re]})]}):f.jsx("div",{className:"sys-settings-qr-empty",children:f.jsx("span",{className:"sys-settings-qr-empty-label",children:t?.isRunning?"Waiting for QR...":"Start pairing to generate QR"})})}),f.jsxs("div",{className:"sys-settings-info-col",children:[f.jsxs("div",{className:"sys-input-row",children:[f.jsx("input",{className:"sys-input",type:"text",placeholder:"Your name",value:a,onChange:te=>i(te.target.value),onKeyDown:te=>{te.key==="Enter"&&K&&!v&&oe()}}),f.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!K||v,onClick:()=>{oe()},children:v?"Saving...":"Save"})]}),f.jsxs("div",{className:"sys-settings-kv-list",children:[t?.identityFingerprint&&f.jsxs("div",{className:"sys-settings-kv",children:[f.jsx("span",{className:"sys-settings-kv-label",children:"Fingerprint"}),f.jsxs("span",{className:"sys-settings-kv-value",children:[f.jsx("code",{children:t.identityFingerprint}),f.jsx(RS,{value:t.identityFingerprint})]})]}),$&&f.jsxs("div",{className:"sys-settings-kv",children:[f.jsx("span",{className:"sys-settings-kv-label",children:"Relay"}),f.jsxs("span",{className:"sys-settings-kv-value",children:[f.jsx("code",{children:$}),f.jsx(RS,{value:$})]})]}),t?.statusDetail&&f.jsxs("div",{className:"sys-settings-kv",children:[f.jsx("span",{className:"sys-settings-kv-label",children:"Status"}),f.jsx("span",{className:"sys-settings-kv-value sys-settings-kv-nowrap",children:t.statusDetail})]}),D&&f.jsxs("div",{className:"sys-settings-kv",children:[f.jsx("span",{className:"sys-settings-kv-label",children:"Connected"}),f.jsx("span",{className:"sys-settings-kv-value",children:D})]}),t?.secure&&f.jsxs("div",{className:"sys-settings-kv",children:[f.jsx("span",{className:"sys-settings-kv-label",children:"Security"}),f.jsx("span",{className:"sys-settings-kv-value",children:f.jsx("span",{className:"sys-chip sys-chip-success",style:{margin:0},children:"Noise XX"})})]})]}),t&&f.jsx("div",{className:"sys-inline-actions sys-settings-controls",children:t.isRunning?f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("restart")},children:w==="restart"?"Restarting...":"Restart"}),f.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("stop")},children:w==="stop"?"Stopping...":"Stop"})]}):f.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!!w,onClick:()=>{ee("start")},children:w==="start"?"Starting...":"Start pairing"})})]})]}),t&&f.jsxs("section",{className:"sys-settings-peers",children:[f.jsx("div",{className:"sys-section-head",children:f.jsxs("div",{children:[f.jsx("h3",{className:"sys-section-title",children:"Trusted peers"}),f.jsxs("p",{className:"sys-section-subtitle",children:[t.trustedPeers.length," device",t.trustedPeers.length!==1?"s":""," paired with this broker."]})]})}),t.trustedPeers.length===0?f.jsxs("div",{className:"sys-list-empty",children:[f.jsx("h3",{children:"No trusted peers"}),f.jsx("p",{children:"Devices appear here after completing pairing."})]}):f.jsxs("table",{className:"sys-peers-table",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:"Device"}),f.jsx("th",{children:"Fingerprint"}),f.jsx("th",{children:"Paired"}),f.jsx("th",{children:"Last seen"}),f.jsx("th",{})]})}),f.jsx("tbody",{children:t.trustedPeers.map(te=>{const ge=te.fingerprint===t.connectedPeerFingerprint;return f.jsxs("tr",{className:ge?"sys-peers-row-connected":"",children:[f.jsx("td",{children:f.jsxs("span",{className:"sys-peers-name",children:[te.name??CS(te.fingerprint)??"Peer",ge&&f.jsx("span",{className:"sys-chip sys-chip-success sys-peers-badge",children:"Connected"})]})}),f.jsx("td",{children:f.jsx("code",{className:"sys-peers-fp",children:te.fingerprint})}),f.jsx("td",{children:te.pairedAtLabel??"—"}),f.jsx("td",{children:te.lastSeenLabel??"—"}),f.jsx("td",{children:f.jsx("button",{type:"button",className:"sys-peers-remove",disabled:M===te.fingerprint,onClick:()=>{I(te.fingerprint)},title:"Remove peer",children:M===te.fingerprint?"...":"Remove"})})]},te.fingerprint)})})]})]})]})}function W7(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function rm(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 J7(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function Q7(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 am({title:e,items:t}){return t.length===0?null:f.jsxs("section",{className:"s-work-fact-card",children:[f.jsx("div",{className:"s-work-fact-card-header",children:f.jsx("div",{className:"s-work-fact-card-title",children:e})}),f.jsx("div",{className:"s-work-fact-card-body",children:t.map(s=>f.jsxs("div",{className:"s-work-fact-row",children:[f.jsx("span",{className:"s-work-fact-label",children:s.label}),f.jsx("span",{className:"s-work-fact-value",children:s.value})]},s.label))})]})}function _S({label:e,value:t,onClick:s}){return f.jsxs("button",{type:"button",className:"s-work-action-row",onClick:s,children:[f.jsx("span",{className:"s-work-action-row-label",children:e}),f.jsx("span",{className:"s-work-action-row-value",children:t})]})}function eZ(e){const t=e.split(".");return t[t.length-1]||e}function tZ({workId:e,navigate:t}){const[s,a]=b.useState(null),[i,l]=b.useState(null),[u,d]=b.useState(!1),p=b.useCallback(async()=>{l(null);try{const T=await ct(`/api/work/${encodeURIComponent(e)}`);a(T)}catch(T){l(T instanceof Error?T.message:String(T)),a(null)}finally{d(!0)}},[e]);if(b.useEffect(()=>{d(!1),p()},[p]),Xn(p),!u)return f.jsxs("div",{children:[f.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),f.jsx("div",{className:"s-empty",children:f.jsx("p",{children:"Loading…"})})]});if(!s)return f.jsxs("div",{children:[f.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),i&&f.jsx("p",{className:"s-error",children:i}),f.jsx("div",{className:"s-empty",children:f.jsx("p",{children:"Work item not found"})})]});const h=J7(s.attention),y=s.ownerName??s.ownerId??"Unassigned",v=s.nextMoveOwnerName??s.nextMoveOwnerId??"—",x=[{label:"State",value:rm(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:za(s.createdAt)},{label:"Updated",value:za(s.updatedAt)},{label:"Last activity",value:za(s.lastMeaningfulAt)}];return f.jsxs("div",{className:"s-work-detail s-work-casefile",children:[f.jsxs("div",{className:"s-work-casefile-topbar",children:[f.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),f.jsxs("span",{className:"s-work-casefile-record",children:["Case ",eZ(s.id)]})]}),i&&f.jsx("p",{className:"s-error",children:i}),f.jsx("section",{className:"s-work-casefile-hero",children:f.jsxs("div",{className:"s-work-casefile-hero-main",children:[f.jsxs("div",{className:"s-work-casefile-title-row",children:[f.jsx("h1",{className:"s-work-casefile-title",children:s.title}),f.jsx("span",{className:`s-pill s-pill-${W7(s)}`,children:s.currentPhase})]}),s.lastMeaningfulSummary&&f.jsx("div",{className:"s-work-casefile-summary",children:qn(s.lastMeaningfulSummary)}),f.jsxs("div",{className:"s-work-casefile-meta",children:[f.jsxs("span",{children:["Updated ",tt(s.updatedAt)]}),f.jsx("span",{children:y}),f.jsx("span",{children:rm(s.state)}),h&&f.jsx("span",{children:h}),s.priority&&f.jsxs("span",{children:["Priority ",s.priority]})]})]})}),f.jsxs("div",{className:"s-work-casefile-layout",children:[f.jsxs("div",{className:"s-work-casefile-main",children:[f.jsxs("section",{className:"s-work-casefile-section",children:[f.jsx("div",{className:"s-agent-section-heading",children:f.jsx("h2",{className:"s-agent-section-title",children:"Case facts"})}),f.jsxs("div",{className:"s-work-fact-grid",children:[f.jsx(am,{title:"Status",items:x}),f.jsx(am,{title:"Assignment",items:w})]})]}),s.activeFlights.length>0&&f.jsxs("section",{className:"s-work-casefile-section",children:[f.jsx("div",{className:"s-agent-section-heading",children:f.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),f.jsx("div",{className:"s-work-flight-list",children:s.activeFlights.map(T=>f.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:T.conversationId?()=>t({view:"conversation",conversationId:T.conversationId}):void 0,disabled:!T.conversationId,children:[f.jsxs("div",{className:"s-work-flight-card-header",children:[f.jsx("span",{className:"s-work-flight-card-title",children:T.agentName??T.agentId}),f.jsx("span",{className:"s-pill s-pill-working",children:T.state})]}),f.jsxs("div",{className:"s-work-flight-card-meta",children:[f.jsx("span",{children:T.startedAt?`Started ${tt(T.startedAt)}`:"Start time unavailable"}),T.completedAt&&f.jsxs("span",{children:["Completed ",tt(T.completedAt)]})]}),T.summary&&f.jsx("div",{className:"s-work-flight-card-copy",children:T.summary})]},T.id))})]}),s.childWork.length>0&&f.jsxs("section",{className:"s-work-casefile-section",children:[f.jsx("div",{className:"s-agent-section-heading",children:f.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),f.jsx("div",{className:"s-work-related-list",children:s.childWork.map(T=>f.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>t({view:"work",workId:T.id}),children:[f.jsxs("div",{className:"s-work-related-card-header",children:[f.jsx("span",{className:"s-work-related-card-title",children:T.title}),f.jsx("span",{className:`s-pill s-pill-${T.attention==="interrupt"?"failed":"updated"}`,children:T.currentPhase})]}),f.jsxs("div",{className:"s-work-related-card-meta",children:[f.jsx("span",{children:T.ownerName??T.ownerId??"Unassigned"}),f.jsx("span",{children:rm(T.state)}),f.jsx("span",{children:tt(T.lastMeaningfulAt)})]}),T.lastMeaningfulSummary&&f.jsx("div",{className:"s-work-related-card-copy",children:qn(T.lastMeaningfulSummary)})]},T.id))})]}),f.jsxs("section",{className:"s-work-casefile-section",children:[f.jsx("div",{className:"s-agent-section-heading",children:f.jsx("h2",{className:"s-agent-section-title",children:"Timeline"})}),s.timeline.length===0?f.jsxs("div",{className:"s-empty",children:[f.jsx("p",{children:"No activity yet."}),f.jsx("p",{children:"Timeline events will appear once the case receives messages or coordination updates."})]}):f.jsx("div",{className:"s-work-timeline",children:s.timeline.map(T=>f.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:[f.jsx("span",{className:`s-work-timeline-marker s-work-timeline-marker-${AS(T)}`}),f.jsxs("div",{className:"s-work-timeline-content",children:[f.jsxs("div",{className:"s-work-timeline-header",children:[f.jsx("span",{className:"s-work-timeline-time",children:tt(T.at)}),f.jsx("span",{className:`s-work-timeline-kind s-work-timeline-kind-${AS(T)}`,children:Q7(T)})]}),f.jsx("div",{className:"s-work-timeline-actor",children:T.actorName??"system"}),T.title&&f.jsx("div",{className:"s-work-timeline-title",children:T.title}),T.summary&&f.jsx("div",{className:"s-work-timeline-summary",children:qn(T.summary)}),f.jsx("div",{className:"s-work-timeline-stamp",children:za(T.at)})]})]},T.id))})]})]}),f.jsxs("aside",{className:"s-work-casefile-side",children:[f.jsx(am,{title:"Record",items:N}),f.jsxs("section",{className:"s-work-fact-card",children:[f.jsx("div",{className:"s-work-fact-card-header",children:f.jsx("div",{className:"s-work-fact-card-title",children:"Links"})}),f.jsxs("div",{className:"s-work-action-list",children:[s.conversationId?f.jsx(_S,{label:"Conversation",value:"Open thread",onClick:()=>t({view:"conversation",conversationId:s.conversationId})}):f.jsx("div",{className:"s-work-action-list-empty",children:"No conversation attached."}),s.parentId&&s.parentTitle?f.jsx(_S,{label:"Parent",value:s.parentTitle,onClick:()=>t({view:"work",workId:s.parentId})}):f.jsx("div",{className:"s-work-action-list-empty",children:"No parent work item."})]})]})]})]})]})}function nZ(){const{route:e,navigate:t}=Ns();return f.jsx(sZ,{children:rZ(e,t)})}function sZ({children:e}){return f.jsx("div",{style:{background:"var(--bg)",color:"var(--ink)",minHeight:"100%",height:"100%",display:"flex",flexDirection:"column"},children:e})}function rZ(e,t){switch(e.view){case"conversation":return f.jsx(ng,{conversationId:e.conversationId,navigate:t});case"agent-info":return f.jsx(vB,{conversationId:e.conversationId,navigate:t});case"settings":return f.jsx(K7,{navigate:t});case"agents":return f.jsx(HB,{navigate:t,selectedAgentId:e.agentId,conversationId:e.conversationId});case"fleet":return f.jsx(JB,{navigate:t});case"sessions":return e.sessionId?f.jsx(ng,{conversationId:e.sessionId,navigate:t}):f.jsx(T7,{navigate:t});case"mesh":return f.jsx(m7,{navigate:t});case"activity":return f.jsx(mB,{navigate:t});case"work":return f.jsx(tZ,{workId:e.workId,navigate:t});default:return f.jsx(s7,{navigate:t})}}function aZ(){const{route:e,agents:t}=Ns();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=>Za(l.state)).length;return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsx(_s,{label:"Total",value:`${t.length}`}),f.jsx(_s,{label:"Working",value:`${i}`}),f.jsx(_s,{label:"Available",value:`${t.length-i}`}),f.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 a=Za(s.state);return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsxs("div",{className:"flex items-center gap-3 pb-3 border-b border-white/[0.04]",children:[f.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()??"?",a&&f.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"})]}),f.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[f.jsx("span",{className:"text-[13px] text-white/90 truncate",children:s.name}),s.handle&&f.jsxs("span",{className:"text-[10px] font-mono text-cyan-400/70",children:["@",s.handle]})]})]}),f.jsxs(Lu,{label:"State",children:[f.jsxs("div",{className:"flex items-baseline gap-2",children:[f.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${a?"bg-emerald-400":"bg-white/20"}`}),f.jsx("span",{className:"text-[12px] text-white/80 capitalize",children:so(s.state)})]}),s.updatedAt&&f.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Updated ",tt(s.updatedAt)]})]}),f.jsxs(Lu,{label:"Identity",children:[f.jsx(_s,{label:"Class",value:s.agentClass}),s.role&&f.jsx(_s,{label:"Role",value:s.role}),s.harness&&f.jsx(_s,{label:"Harness",value:s.harness}),s.transport&&f.jsx(_s,{label:"Transport",value:s.transport})]}),(s.project||s.branch||s.cwd)&&f.jsxs(Lu,{label:"Project",children:[s.project&&f.jsx(_s,{label:"Name",value:s.project}),s.branch&&f.jsx(_s,{label:"Branch",value:s.branch}),s.cwd&&f.jsx(_s,{label:"Cwd",value:s.cwd})]}),s.capabilities.length>0&&f.jsx(Lu,{label:`Capabilities · ${s.capabilities.length}`,children:f.jsx("div",{className:"flex flex-wrap gap-1",children:s.capabilities.map(i=>f.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 Lu({label:e,children:t}){return f.jsxs("div",{className:"flex flex-col",children:[f.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 f.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[f.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),f.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function iZ(){const[e,t]=b.useState(null),s=b.useCallback(async()=>{try{t(await ct("/api/fleet"))}catch{}},[]);if(b.useEffect(()=>{s()},[s]),Xn(s),!e)return f.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 a=e.totals;return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:["Updated ",tt(e.generatedAt)]}),f.jsx(Pu,{label:"Needs Input",value:a.needsAttention,emphasis:a.needsAttention>0?"warn":"muted"}),f.jsx(Pu,{label:"Active Asks",value:a.active}),f.jsx(Pu,{label:"Recent Finished",value:a.recentCompleted,emphasis:a.recentCompleted>0?"good":"muted"}),f.jsx(Pu,{label:"Activity",value:a.activity})]})}function Pu({label:e,value:t,emphasis:s}){const a=s==="good"?"text-emerald-300/90":s==="warn"?"text-amber-300/90":s==="muted"?"text-white/40":"text-white/80";return f.jsxs("div",{className:"flex flex-col pb-3 border-b border-white/[0.04] last:border-b-0",children:[f.jsx("span",{className:`text-[24px] font-mono tabular-nums leading-none ${a}`,children:t}),f.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mt-1",children:e})]})}function oZ(){const{agents:e,navigate:t}=Ns();if(e.length===0)return f.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:[f.jsx("div",{className:"mb-1 uppercase tracking-[0.15em]",children:"No agents"}),f.jsx("div",{children:"Connect an agent to see your roster here."})]});const s=e.filter(i=>Za(i.state)),a=e.filter(i=>!Za(i.state));return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[s.length>0&&f.jsx(kS,{label:"Online",count:s.length,children:s.map(i=>f.jsx(MS,{agent:i,navigate:t},i.id))}),a.length>0&&f.jsx(kS,{label:"Standby",count:a.length,children:a.map(i=>f.jsx(MS,{agent:i,navigate:t,dim:!0},i.id))})]})}function kS({label:e,count:t,children:s}){return f.jsxs("div",{className:"flex flex-col",children:[f.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[f.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:e}),f.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25",children:t})]}),f.jsx("div",{className:"flex flex-col gap-0.5",children:s})]})}function MS({agent:e,navigate:t,dim:s}){const a=Za(e.state);return f.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:[f.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()??"?",a&&f.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-emerald-400 ring-2 ring-neutral-950"})]}),f.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[f.jsx("span",{className:"text-[12px] text-white/80 truncate group-hover:text-white transition-colors",children:e.name}),f.jsx("span",{className:"text-[10px] font-mono text-white/30 truncate",children:so(e.state)})]}),e.updatedAt&&f.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25 shrink-0",children:tt(e.updatedAt)})]})}function lZ(){const{route:e}=Ns(),[t,s]=b.useState([]),a=b.useCallback(async()=>{try{s(await ct("/api/sessions"))}catch{}},[]);if(b.useEffect(()=>{a()},[a]),Xn(a),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(d=>d.kind)),u=t.filter(d=>d.currentBranch).length;return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsx(ks,{label:"Total",value:`${t.length}`}),f.jsx(ks,{label:"Kinds",value:`${l.size}`}),f.jsx(ks,{label:"Branched",value:`${u}`}),f.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 f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[f.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:i.title}),f.jsx("div",{className:"text-[10px] font-mono uppercase tracking-wider text-cyan-400/70 mt-1",children:i.kind})]}),i.agentName&&f.jsxs(Uu,{label:"Agent",children:[f.jsx(ks,{label:"Name",value:i.agentName}),i.harness&&f.jsx(ks,{label:"Harness",value:i.harness})]}),(i.currentBranch||i.workspaceRoot)&&f.jsxs(Uu,{label:"Workspace",children:[i.currentBranch&&f.jsx(ks,{label:"Branch",value:i.currentBranch}),i.workspaceRoot&&f.jsx(ks,{label:"Root",value:i.workspaceRoot})]}),f.jsxs(Uu,{label:"Activity",children:[f.jsx(ks,{label:"Messages",value:`${i.messageCount}`}),i.lastMessageAt&&f.jsx(ks,{label:"Last",value:tt(i.lastMessageAt)}),i.participantIds.length>0&&f.jsx(ks,{label:"Participants",value:`${i.participantIds.length}`})]}),i.preview&&f.jsx(Uu,{label:"Preview",children:f.jsxs("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:['"',i.preview,'"']})})]})}function Uu({label:e,children:t}){return f.jsxs("div",{className:"flex flex-col",children:[f.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 f.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[f.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),f.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function cZ(){const{route:e}=Ns(),t=e.view==="work"?e.workId:null,[s,a]=b.useState(null),i=b.useCallback(async()=>{if(!t){a(null);return}try{a(await ct(`/api/work/${encodeURIComponent(t)}`))}catch{a(null)}},[t]);if(b.useEffect(()=>{i()},[i]),Xn(i),e.view!=="work")return null;if(!s)return f.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=dZ(s.state);return f.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[f.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[f.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-cyan-400/70 mb-1",children:["Case ",uZ(s.id)]}),f.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:s.title})]}),f.jsxs(Vu,{label:"State",children:[f.jsxs("div",{className:"flex items-baseline gap-2",children:[f.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),f.jsx("span",{className:`text-[12px] capitalize ${l.text}`,children:s.state.replace(/_/g," ")})]}),f.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Phase · ",s.currentPhase]})]}),f.jsxs(Vu,{label:"Ownership",children:[s.ownerName&&f.jsx(Oi,{label:"Owner",value:s.ownerName}),s.nextMoveOwnerName&&f.jsx(Oi,{label:"Next move",value:s.nextMoveOwnerName}),s.priority&&f.jsx(Oi,{label:"Priority",value:s.priority})]}),f.jsxs(Vu,{label:"Activity",children:[f.jsx(Oi,{label:"Children",value:`${s.activeChildWorkCount}`}),f.jsx(Oi,{label:"Flights",value:`${s.activeFlightCount}`}),s.lastMeaningfulAt&&f.jsx(Oi,{label:"Last update",value:tt(s.lastMeaningfulAt)})]}),s.attention!=="silent"&&f.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&&f.jsx(Vu,{label:"Latest",children:f.jsx("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:s.lastMeaningfulSummary})})]})}function uZ(e){return e.length>10?`${e.slice(0,8)}…`:e}function dZ(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 Vu({label:e,children:t}){return f.jsxs("div",{className:"flex flex-col",children:[f.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function Oi({label:e,value:t}){return f.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[f.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),f.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function fZ(){const{route:e}=Ns();switch(e.view){case"inbox":return f.jsx(oZ,{});case"agents":case"agent-info":return f.jsx(aZ,{});case"fleet":return f.jsx(iZ,{});case"sessions":case"conversation":return f.jsx(lZ,{});case"work":return f.jsx(cZ,{});default:return null}}const hZ=[{view:"inbox",label:"Home",icon:_9,target:{view:"inbox"}},{view:"agents",label:"Agents",icon:B9,target:{view:"agents"}},{view:"fleet",label:"Fleet",icon:M9,target:{view:"fleet"}},{view:"sessions",label:"Sessions",icon:D9,target:{view:"sessions"}},{view:"activity",label:"Activity",icon:R9,target:{view:"activity"}},{view:"mesh",label:"Mesh",icon:I9,target:{view:"mesh"}}],pZ=[{view:"settings",label:"Settings",icon:V9,target:{view:"settings"}}];function mZ(){const{route:e,navigate:t}=Ns();return f.jsxs("div",{className:"flex flex-col h-full py-2",children:[f.jsx("nav",{className:"flex flex-col",children:hZ.map(s=>f.jsx(OS,{item:s,activeView:e.view,navigate:t},s.view))}),f.jsx("div",{className:"flex-1"}),f.jsx("nav",{className:"flex flex-col",children:pZ.map(s=>f.jsx(OS,{item:s,activeView:e.view,navigate:t},s.view))})]})}function OS({item:e,activeView:t,navigate:s}){const a=t===e.view,i=e.icon;return f.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 ${a?"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:[f.jsx(i,{size:13,strokeWidth:1.5,className:a?"text-cyan-400/70":"text-white/30 group-hover:text-white/50"}),f.jsx("span",{className:"text-[12px]",children:e.label})]})}function gZ(){const{navigate:e,agents:t,reload:s}=Ns(),a=b.useCallback(async i=>{await ct(`/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:Qm(l.id)})}),i.push({id:`scout:send:${l.id}`,label:`Send message to ${l.name}`,action:()=>e({view:"conversation",conversationId:Qm(l.id)})}),i.push({id:`scout:interrupt:${l.id}`,label:`Interrupt ${l.name}`,action:()=>{a(l.id)}});return i},[t,a,e,s])}function yZ(){const{agents:e,onlineCount:t}=Ns();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 vZ={inbox:"Home",conversation:"Conversation","agent-info":"Agent",agents:"Agents",fleet:"Fleet",sessions:"Sessions",activity:"Activity",mesh:"Mesh",settings:"Settings",work:"Work"};function bZ(){const{route:e}=Ns(),t=vZ[e.view]??e.view;return b.createElement("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/40"},t)}function xZ(){const{navigate:e}=Ns();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 wZ(){return"panel"}const SZ=[{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 a direct message conversation with a specific agent. The commandId is scout:open:{agentId} where agentId comes from the current agent roster.",category:"navigation",keywords:["open","chat","conversation","dm","message"],params:[{name:"agentId",description:"The agent identifier to open",type:"string"}]},{commandId:"scout:send:*",title:"Send Message to Agent",description:"Send a text message to a specific agent. The commandId is scout:send:{agentId}. Requires a message parameter.",category:"workspace",keywords:["send","message","tell","ask","request"],params:[{name:"agentId",description:"The agent identifier to message",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"}]}],EZ={id:"openscout",name:"Scout",description:"All your agents, one message away. Scout is a control plane for managing coding agents — it shows their status, routes messages between them, and lets you steer, interrupt, or dispatch work to any agent in the fleet.",mode:"panel",Provider:G9,leftPanel:{title:"Scout",icon:b.createElement(P9,{size:12})},slots:{Content:nZ,LeftPanel:mZ,Inspector:fZ},intents:SZ,hooks:{useCommands:gZ,useStatus:yZ,useNavCenter:bZ,useNavActions:xZ,useLayoutMode:wZ}},BC=document.getElementById("root");if(!BC)throw new Error("missing #root");c_.createRoot(BC).render(f.jsx(b.StrictMode,{children:f.jsx(b9,{app:EZ})}));export{IS as F,zS as f,f as j,b as r};
|