pockcode 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],ee=-1;function B(e){return{current:e}}function V(e){0>ee||(e.current=z[ee],z[ee]=null,ee--)}function H(e,t){ee++,z[ee]=e.current,e.current=t}var U=B(null),W=B(null),te=B(null),G=B(null);function ne(e,t){switch(H(te,t),H(W,e),H(U,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(U),H(U,e)}function re(){V(U),V(W),V(te)}function ie(e){e.memoizedState!==null&&H(G,e);var t=U.current,n=Wd(t,e.type);t!==n&&(H(W,e),H(U,n))}function ae(e){W.current===e&&(V(U),V(W)),G.current===e&&(V(G),ep._currentValue=R)}var oe,se;function ce(e){if(oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);oe=t&&t[1]||``,se=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+oe+e+se}var le=!1;function ue(e,t){if(!e||le)return``;le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ce(n):``}function de(e,t){switch(e.tag){case 26:case 27:case 5:return ce(e.type);case 16:return ce(`Lazy`);case 13:return e.child!==t&&t!==null?ce(`Suspense Fallback`):ce(`Suspense`);case 19:return ce(`SuspenseList`);case 0:case 15:return ue(e.type,!1);case 11:return ue(e.type.render,!1);case 1:return ue(e.type,!0);case 31:return ce(`Activity`);default:return``}}function fe(e){try{var t=``,n=null;do t+=de(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var pe=Object.prototype.hasOwnProperty,me=t.unstable_scheduleCallback,he=t.unstable_cancelCallback,ge=t.unstable_shouldYield,_e=t.unstable_requestPaint,ve=t.unstable_now,ye=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,Se=t.unstable_NormalPriority,Ce=t.unstable_LowPriority,we=t.unstable_IdlePriority,Te=t.log,Ee=t.unstable_setDisableYieldValue,De=null,Oe=null;function ke(e){if(typeof Te==`function`&&Ee(e),Oe&&typeof Oe.setStrictMode==`function`)try{Oe.setStrictMode(De,e)}catch{}}var Ae=Math.clz32?Math.clz32:Ne,je=Math.log,Me=Math.LN2;function Ne(e){return e>>>=0,e===0?32:31-(je(e)/Me|0)|0}var Pe=256,Fe=262144,Ie=4194304;function Le(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Re(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Le(n))):i=Le(o):i=Le(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Le(n))):i=Le(o)):i=Le(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Be(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ve(){var e=Ie;return Ie<<=1,!(Ie&62914560)&&(Ie=4194304),e}function He(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function K(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ue(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ae(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&We(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function We(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ae(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ge(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ae(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ke(e,t){var n=t&-t;return n=n&42?1:qe(n),(n&(e.suspendedLanes|t))===0?n:0}function qe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Je(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ye(){var e=L.p;return e===0?(e=window.event,e===void 0?32:gp(e.type)):e}function Xe(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Ze=Math.random().toString(36).slice(2),Qe=`__reactFiber$`+Ze,$e=`__reactProps$`+Ze,et=`__reactContainer$`+Ze,tt=`__reactEvents$`+Ze,nt=`__reactListeners$`+Ze,rt=`__reactHandles$`+Ze,it=`__reactResources$`+Ze,at=`__reactMarker$`+Ze;function ot(e){delete e[Qe],delete e[$e],delete e[tt],delete e[nt],delete e[rt]}function st(e){var t=e[Qe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[et]||n[Qe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pf(e);e!==null;){if(n=e[Qe])return n;e=pf(e)}return t}e=n,n=e.parentNode}return null}function ct(e){if(e=e[Qe]||e[et]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function lt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ut(e){var t=e[it];return t||=e[it]={hoistableStyles:new Map,hoistableScripts:new Map},t}function dt(e){e[at]=!0}var ft=new Set,pt={};function mt(e,t){ht(e,t),ht(e+`Capture`,t)}function ht(e,t){for(pt[e]=t,e=0;e<t.length;e++)ft.add(t[e])}var gt=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]*$`),_t={},vt={};function yt(e){return pe.call(vt,e)?!0:pe.call(_t,e)?!1:gt.test(e)?vt[e]=!0:(_t[e]=!0,!1)}function bt(e,t,n){if(yt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function xt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function St(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ct(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function wt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Tt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Et(e){if(!e._valueTracker){var t=wt(e)?`checked`:`value`;e._valueTracker=Tt(e,t,``+e[t])}}function Dt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=wt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ot(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var kt=/[\n"\\]/g;function At(e){return e.replace(kt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function jt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ct(t)):e.value!==``+Ct(t)&&(e.value=``+Ct(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Nt(e,o,Ct(n)):Nt(e,o,Ct(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ct(s):e.removeAttribute(`name`)}function Mt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Et(e);return}n=n==null?``:``+Ct(n),t=t==null?n:``+Ct(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Et(e)}function Nt(e,t,n){t===`number`&&Ot(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Pt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ct(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ft(e,t,n){if(t!=null&&(t=``+Ct(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ct(n)}function It(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ct(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Et(e)}function Lt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rt=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 zt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Rt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Bt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&zt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&zt(e,o,t[o])}function Vt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ht=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`]]),Ut=/^[\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 Wt(e){return Ut.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Gt(){}var Kt=null;function qt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jt=null,Yt=null;function Xt(e){var t=ct(e);if(t&&(e=t.stateNode)){var n=e[$e]||null;a:switch(e=t.stateNode,t.type){case`input`:if(jt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+At(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[$e]||null;if(!a)throw Error(i(90));jt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Dt(r)}break a;case`textarea`:Ft(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Pt(e,!!n.multiple,t,!1)}}}var Zt=!1;function Qt(e,t,n){if(Zt)return e(t,n);Zt=!0;try{return e(t)}finally{if(Zt=!1,(Jt!==null||Yt!==null)&&(yu(),Jt&&(t=Jt,e=Yt,Yt=Jt=null,Xt(t),e)))for(t=0;t<e.length;t++)Xt(e[t])}}function $t(e,t){var n=e.stateNode;if(n===null)return null;var r=n[$e]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var en=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),tn=!1;if(en)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){tn=!0}}),window.addEventListener(`test`,nn,nn),window.removeEventListener(`test`,nn,nn)}catch{tn=!1}var rn=null,an=null,on=null;function sn(){if(on)return on;var e,t=an,n=t.length,r,i=`value`in rn?rn.value:rn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return on=i.slice(e,1<r?1-r:void 0)}function cn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ln(){return!0}function un(){return!1}function dn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?ln:un,this.isPropagationStopped=un,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=ln)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=ln)},persist:function(){},isPersistent:ln}),t}var fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=dn(fn),mn=m({},fn,{view:0,detail:0}),hn=dn(mn),gn,_n,vn,yn=m({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:An,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==vn&&(vn&&e.type===`mousemove`?(gn=e.screenX-vn.screenX,_n=e.screenY-vn.screenY):_n=gn=0,vn=e),gn)},movementY:function(e){return`movementY`in e?e.movementY:_n}}),bn=dn(yn),xn=dn(m({},yn,{dataTransfer:0})),Sn=dn(m({},mn,{relatedTarget:0})),Cn=dn(m({},fn,{animationName:0,elapsedTime:0,pseudoElement:0})),wn=dn(m({},fn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Tn=dn(m({},fn,{data:0})),En={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Dn={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`},On={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function kn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=On[e])?!!t[e]:!1}function An(){return kn}var jn=dn(m({},mn,{key:function(e){if(e.key){var t=En[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Dn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:An,charCode:function(e){return e.type===`keypress`?cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Mn=dn(m({},yn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Nn=dn(m({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:An})),Pn=dn(m({},fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Fn=dn(m({},yn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),In=dn(m({},fn,{newState:0,oldState:0})),Ln=[9,13,27,32],Rn=en&&`CompositionEvent`in window,zn=null;en&&`documentMode`in document&&(zn=document.documentMode);var Bn=en&&`TextEvent`in window&&!zn,Vn=en&&(!Rn||zn&&8<zn&&11>=zn),Hn=` `,Un=!1;function Wn(e,t){switch(e){case`keyup`:return Ln.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Gn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Kn=!1;function qn(e,t){switch(e){case`compositionend`:return Gn(t);case`keypress`:return t.which===32?(Un=!0,Hn):null;case`textInput`:return e=t.data,e===Hn&&Un?null:e;default:return null}}function Jn(e,t){if(Kn)return e===`compositionend`||!Rn&&Wn(e,t)?(e=sn(),on=an=rn=null,Kn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Vn&&t.locale!==`ko`?null:t.data;default:return null}}var Yn={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 Xn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Yn[e.type]:t===`textarea`}function Zn(e,t,n,r){Jt?Yt?Yt.push(r):Yt=[r]:Jt=r,t=Dd(t,`onChange`),0<t.length&&(n=new pn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Qn=null,$n=null;function er(e){yd(e,0)}function tr(e){if(Dt(lt(e)))return e}function nr(e,t){if(e===`change`)return t}var rr=!1;if(en){var ir;if(en){var ar=`oninput`in document;if(!ar){var or=document.createElement(`div`);or.setAttribute(`oninput`,`return;`),ar=typeof or.oninput==`function`}ir=ar}else ir=!1;rr=ir&&(!document.documentMode||9<document.documentMode)}function sr(){Qn&&(Qn.detachEvent(`onpropertychange`,cr),$n=Qn=null)}function cr(e){if(e.propertyName===`value`&&tr($n)){var t=[];Zn(t,$n,e,qt(e)),Qt(er,t)}}function lr(e,t,n){e===`focusin`?(sr(),Qn=t,$n=n,Qn.attachEvent(`onpropertychange`,cr)):e===`focusout`&&sr()}function ur(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return tr($n)}function dr(e,t){if(e===`click`)return tr(t)}function fr(e,t){if(e===`input`||e===`change`)return tr(t)}function pr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var mr=typeof Object.is==`function`?Object.is:pr;function hr(e,t){if(mr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!pe.call(t,i)||!mr(e[i],t[i]))return!1}return!0}function gr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _r(e,t){var n=gr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=gr(n)}}function vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ot(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ot(e.document)}return t}function br(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var xr=en&&`documentMode`in document&&11>=document.documentMode,Sr=null,Cr=null,wr=null,Tr=!1;function Er(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tr||Sr==null||Sr!==Ot(r)||(r=Sr,`selectionStart`in r&&br(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),wr&&hr(wr,r)||(wr=r,r=Dd(Cr,`onSelect`),0<r.length&&(t=new pn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Sr)))}function Dr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Or={animationend:Dr(`Animation`,`AnimationEnd`),animationiteration:Dr(`Animation`,`AnimationIteration`),animationstart:Dr(`Animation`,`AnimationStart`),transitionrun:Dr(`Transition`,`TransitionRun`),transitionstart:Dr(`Transition`,`TransitionStart`),transitioncancel:Dr(`Transition`,`TransitionCancel`),transitionend:Dr(`Transition`,`TransitionEnd`)},kr={},Ar={};en&&(Ar=document.createElement(`div`).style,`AnimationEvent`in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),`TransitionEvent`in window||delete Or.transitionend.transition);function jr(e){if(kr[e])return kr[e];if(!Or[e])return e;var t=Or[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ar)return kr[e]=t[n];return e}var Mr=jr(`animationend`),Nr=jr(`animationiteration`),Pr=jr(`animationstart`),Fr=jr(`transitionrun`),Ir=jr(`transitionstart`),Lr=jr(`transitioncancel`),Rr=jr(`transitionend`),zr=new Map,Br=`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(` `);Br.push(`scrollEnd`);function Vr(e,t){zr.set(e,t),mt(t,[e])}var Hr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Ur=[],Wr=0,Gr=0;function Kr(){for(var e=Wr,t=Gr=Wr=0;t<e;){var n=Ur[t];Ur[t++]=null;var r=Ur[t];Ur[t++]=null;var i=Ur[t];Ur[t++]=null;var a=Ur[t];if(Ur[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Xr(n,i,a)}}function qr(e,t,n,r){Ur[Wr++]=e,Ur[Wr++]=t,Ur[Wr++]=n,Ur[Wr++]=r,Gr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Jr(e,t,n,r){return qr(e,t,n,r),Zr(e)}function Yr(e,t){return qr(e,null,null,t),Zr(e)}function Xr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ae(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Zr(e){if(50<uu)throw uu=0,du=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Qr={};function $r(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ei(e,t,n,r){return new $r(e,t,n,r)}function ti(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ni(e,t){var n=e.alternate;return n===null?(n=ei(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ri(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ii(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ti(e)&&(s=1);else if(typeof e==`string`)s=Gf(e,n,U.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ei(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ai(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ei(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ei(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ei(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ei(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ai(e,t,n,r){return e=ei(7,e,r,t),e.lanes=n,e}function oi(e,t,n){return e=ei(6,e,null,t),e.lanes=n,e}function si(e){var t=ei(18,null,null,0);return t.stateNode=e,t}function ci(e,t,n){return t=ei(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var li=new WeakMap;function ui(e,t){if(typeof e==`object`&&e){var n=li.get(e);return n===void 0?(t={value:e,source:t,stack:fe(t)},li.set(e,t),t):n}return{value:e,source:t,stack:fe(t)}}var di=[],fi=0,pi=null,mi=0,hi=[],gi=0,_i=null,vi=1,yi=``;function bi(e,t){di[fi++]=mi,di[fi++]=pi,pi=e,mi=t}function xi(e,t,n){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,_i=e;var r=vi;e=yi;var i=32-Ae(r)-1;r&=~(1<<i),n+=1;var a=32-Ae(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,vi=1<<32-Ae(t)+i|n<<i|r,yi=a+e}else vi=1<<a|n<<i|r,yi=e}function Si(e){e.return!==null&&(bi(e,1),xi(e,1,0))}function Ci(e){for(;e===pi;)pi=di[--fi],di[fi]=null,mi=di[--fi],di[fi]=null;for(;e===_i;)_i=hi[--gi],hi[gi]=null,yi=hi[--gi],hi[gi]=null,vi=hi[--gi],hi[gi]=null}function wi(e,t){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,vi=t.id,yi=t.overflow,_i=e}var Ti=null,Ei=null,Di=!1,Oi=null,ki=!1,Ai=Error(i(519));function ji(e){throw Li(ui(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ai}function Mi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Qe]=e,t[$e]=r,n){case`dialog`:bd(`cancel`,t),bd(`close`,t);break;case`iframe`:case`object`:case`embed`:bd(`load`,t);break;case`video`:case`audio`:for(n=0;n<_d.length;n++)bd(_d[n],t);break;case`source`:bd(`error`,t);break;case`img`:case`image`:case`link`:bd(`error`,t),bd(`load`,t);break;case`details`:bd(`toggle`,t);break;case`input`:bd(`invalid`,t),Mt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:bd(`invalid`,t);break;case`textarea`:bd(`invalid`,t),It(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Nd(t.textContent,n)?(r.popover!=null&&(bd(`beforetoggle`,t),bd(`toggle`,t)),r.onScroll!=null&&bd(`scroll`,t),r.onScrollEnd!=null&&bd(`scrollend`,t),r.onClick!=null&&(t.onclick=Gt),t=!0):t=!1,t||ji(e,!0)}function Ni(e){for(Ti=e.return;Ti;)switch(Ti.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Ti=Ti.return}}function Pi(e){if(e!==Ti)return!1;if(!Di)return Ni(e),Di=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Gd(e.type,e.memoizedProps)),n=!n),n&&Ei&&ji(e),Ni(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ei=ff(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ei=ff(e)}else t===27?(t=Ei,$d(e.type)?(e=df,df=null,Ei=e):Ei=t):Ei=Ti?uf(e.stateNode.nextSibling):null;return!0}function Fi(){Ei=Ti=null,Di=!1}function Ii(){var e=Oi;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),Oi=null),e}function Li(e){Oi===null?Oi=[e]:Oi.push(e)}var Ri=B(null),zi=null,Bi=null;function Vi(e,t,n){H(Ri,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=Ri.current,V(Ri)}function Ui(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Wi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ui(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ui(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Gi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;mr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===G.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ep]:e.push(ep))}a=a.return}e!==null&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!mr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){zi=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(zi,e)}function Yi(e,t){return zi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(i(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=dd(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=I.S;I.S=function(e,t){$l=ve(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=B(null);function fa(){var e=da.current;return e===null?Pl.pooledCache:e}function pa(e,t){t===null?H(da,da.current):H(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Gt,Gt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(Gt,Gt);else{if(e=Pl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ni(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=oi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ii(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ci(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ai(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=oi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ii(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=ci(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(F(t)||M(t))return t=ai(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=xa(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=xa(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Di&&bi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Di&&bi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Di&&bi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Di&&bi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Di&&bi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Di&&bi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ai(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ii(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ci(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=oi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ei(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Zr(e),Xr(e,null,n),t}return qr(e,r,t,n),Zr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ge(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Il&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=B(null),Ka=B(0);function qa(e,t){e=Hl,H(Ka,e),H(Ga,t),Hl=e|t.baseLanes}function Ja(){H(Ka,Hl),H(Ga,Ga.current)}function Ya(){Hl=Ka.current,V(Ga),V(Ka)}var Xa=B(null),Za=null;function q(e){var t=e.alternate;H(no,no.current&1),H(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function Qa(e){H(no,no.current),H(Xa,e),Za===null&&(Za=e)}function $a(e){e.tag===22?(H(no,no.current),H(Xa,e),Za===null&&(Za=e)):eo(e)}function eo(){H(no,no.current),H(Xa,Xa.current)}function to(e){V(Xa),Za===e&&(Za=null),V(no)}var no=B(0);function ro(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sf(n)||cf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var io=0,J=null,ao=null,oo=null,so=!1,co=!1,lo=!1,uo=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!mr(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return io=a,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ps:Fs,lo=!1,a=n(r,i),lo=!1,co&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){I.H=Ns;var t=ao!==null&&ao.next!==null;if(io=0,oo=ao=J=null,so=!1,fo=0,po=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Ki(e)&&(Qs=!0))}function yo(e,t,n,r){J=e;var a=0;do{if(co&&(po=null),fo=0,co=!1,25<=a)throw Error(i(301));if(a+=1,oo=ao=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Is,o=t(n,r)}while(co);return o}function bo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Do(t):t,e=e.useState()[0],(ao===null?null:ao.memoizedState)!==e&&(J.flags|=1024),t}function xo(){var e=uo!==0;return uo=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Co(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}io=0,oo=ao=J=null,co=!1,fo=uo=0,po=null}function wo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oo===null?J.memoizedState=oo=e:oo=oo.next=e,oo}function To(){if(ao===null){var e=J.alternate;e=e===null?null:e.memoizedState}else e=ao.next;var t=oo===null?J.memoizedState:oo.next;if(t!==null)oo=t,ao=e;else{if(e===null)throw J.alternate===null?Error(i(467)):Error(i(310));ao=e,e={memoizedState:ao.memoizedState,baseState:ao.baseState,baseQueue:ao.baseQueue,queue:ao.queue,next:null},oo===null?J.memoizedState=oo=e:oo=oo.next=e}return oo}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(e){var t=fo;return fo+=1,po===null&&(po=[]),e=ba(po,e,t),t=J,(oo===null?t.memoizedState:oo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ps:Fs),e}function Oo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Do(e);if(e.$$typeof===C)return Ji(e)}throw Error(i(438,String(e)))}function ko(e){var t=null,n=J.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=J.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Eo(),J.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Ao(e,t){return typeof t==`function`?t(e):t}function jo(e){return Mo(To(),ao,e)}function Mo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(io&f)===f:(Il&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((io&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,J.lanes|=p,Wl|=p;f=u.action,lo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,J.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!mr(o,e.memoizedState)&&(Qs=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function No(e){var t=To(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);mr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Po(e,t,n){var r=J,a=To(),o=Di;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!mr((ao||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,as(Lo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||oo!==null&&oo.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,a,n,t),null),Pl===null)throw Error(i(349));o||io&127||Fo(r,t,n)}return n}function Fo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t=Eo(),J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Io(e,t,n,r){t.value=n,t.getSnapshot=r,Ro(t)&&zo(e)}function Lo(e,t,n){return n(function(){Ro(t)&&zo(e)})}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!mr(e,n)}catch{return!0}}function zo(e){var t=Yr(e,2);t!==null&&mu(t,e,2)}function Bo(e){var t=wo();if(typeof e==`function`){var n=e;if(e=n(),lo){ke(!0);try{n()}finally{ke(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:e},t}function Vo(e,t,n,r){return e.baseState=n,Mo(e,ao,typeof r==`function`?r:Ao)}function Ho(e,t,n,r,a){if(As(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Uo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(Di){var n=Pl.formState;if(n!==null){a:{var r=J;if(Di){if(Ei){b:{for(var i=Ei,a=ki;i.nodeType!==8;){if(!a){i=null;break b}if(i=uf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ei=uf(i.nextSibling),r=i.data===`F!`;break a}}ji(r)}r=!1}r&&(t=n[0])}}return n=wo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,J,r),r.dispatch=n,r=Bo(!1),a=ks.bind(null,J,!1,r.queue),r=wo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ho.bind(null,J,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(To(),ao,e)}function Zo(e,t,n){if(t=Mo(e,t,Jo)[0],e=jo(Ao)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Do(t)}catch(e){throw e===ha?_a:e}else r=t;t=To();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(J.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=To(),n=ao;if(n!==null)return Zo(t,n,e);To(),t=t.memoizedState,n=To();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=J.updateQueue,t===null&&(t=Eo(),J.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ts(){return To().memoizedState}function ns(e,t,n,r){var i=wo();J.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=To();r=r===void 0?null:r;var a=i.memoizedState.inst;ao!==null&&r!==null&&go(r,ao.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(J.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function as(e,t){rs(2048,8,e,t)}function os(e){J.flags|=4;var t=J.updateQueue;if(t===null)t=Eo(),J.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=To().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Nl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return rs(4,2,e,t)}function ls(e,t){return rs(4,4,e,t)}function us(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ds(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),lo){ke(!0);try{e()}finally{ke(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||io&1073741824&&!(Il&261930)?e.memoizedState=t:(e.memoizedState=n,e=pu(),J.lanes|=e,Wl|=e,n)}function gs(e,t,n,r){return mr(n,t)?n:Ga.current===null?!(io&42)||io&1073741824&&!(Il&261930)?(Qs=!0,e.memoizedState=n):(e=pu(),J.lanes|=e,Wl|=e,t):(e=hs(e,n,r),mr(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,ks(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,la(c,r),fu(e)):Os(e,t,r,fu(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},fu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,R,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},fu())}function Ss(){return Ji(ep)}function Cs(){return To().memoizedState}function ws(){return To().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fu();e=Ia(n);var r=La(t,e,n);r!==null&&(mu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=fu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=Jr(e,t,n,r),n!==null&&(mu(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,fu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,mr(s,o))return qr(e,t,i,0),Pl===null&&Kr(),!1}catch{}if(n=Jr(e,t,i,r),n!==null)return mu(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=Jr(e,n,r,2),t!==null&&mu(t,e,2)}function As(e){var t=e.alternate;return e===J||t!==null&&t===J}function js(e,t){co=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ge(e,n)}}var Ns={readContext:Ji,use:Oo,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};Ns.useEffectEvent=ho;var Ps={readContext:Ji,use:Oo,useCallback:function(e,t){return wo().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=wo();t=t===void 0?null:t;var r=e();if(lo){ke(!0);try{e()}finally{ke(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=wo();if(n!==void 0){var i=n(t);if(lo){ke(!0);try{n(t)}finally{ke(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Es.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=wo();return e={current:e},t.memoizedState=e},useState:function(e){e=Bo(e);var t=e.queue,n=Ds.bind(null,J,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(wo(),e,t)},useTransition:function(){var e=Bo(!1);return e=_s.bind(null,J,e.queue,!0,!1),wo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=J,a=wo();if(Di){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Pl===null)throw Error(i(349));Il&127||Fo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Lo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,o,n,t),null),n},useId:function(){var e=wo(),t=Pl.identifierPrefix;if(Di){var n=yi,r=vi;n=(r&~(1<<32-Ae(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=uo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=wo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,J,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return wo().memoizedState=Ts.bind(null,J)},useEffectEvent:function(e){var t=wo(),n={impl:e};return t.memoizedState=n,function(){if(Nl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Ji,use:Oo,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:jo,useRef:ts,useState:function(){return jo(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(To(),ao.memoizedState,e,t)},useTransition:function(){var e=jo(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Vo(To(),ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:Ji,use:Oo,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:No,useRef:ts,useState:function(){return No(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){var n=To();return ao===null?hs(n,e,t):gs(n,ao.memoizedState,e,t)},useTransition:function(){var e=No(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=To();return ao===null?(n.baseState=e,[e,n.queue.dispatch]):Vo(n,ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(mu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(mu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(mu(t,e,n),Ra(t,e,n))}};function zs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!hr(n,r)||!hr(i,a):!0}function Bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Hr(e)}function Us(e){console.error(e)}function Ws(e){Hr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Ia(e),e.tag=3,e}function Ys(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(nu===null?nu=new Set([this]):nu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Eu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Gu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Gu(e,r,a)),!1}throw Error(i(435,n.tag))}return Gu(e,r,a),Eu(),!1}if(Di)return t=Xa.current,t===null?(r!==Ai&&(t=Error(i(423),{cause:r}),Li(ui(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ui(r,n),a=qs(e.stateNode,r,a),za(e,a),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ai&&(e=Error(i(422),{cause:r}),Li(ui(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ui(o,n),Yl===null?Yl=[o]:Yl.push(o),Ul!==4&&(Ul=2),t===null)return!0;r=ui(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(nu===null||!nu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Di&&s&&Si(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ti(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?hr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ni(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(hr(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),$a(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),eo(t)):(pa(t,a.cachePool),qa(t,a),eo(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),$a(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return ja(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,to(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Di){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if(Qa(t),(e=Ei)?(e=of(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Qa(t),a)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Qs||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Pl,r!==null&&(s=Ke(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Yr(e,s),mu(r,e,s),Zs;Eu(),t=sc(e,t,n)}else e=o.treeContext,Ei=uf(s.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ni(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function uc(e,t,n,r,i){return qi(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Di&&r&&Si(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Qs?(So(e,t,a),wc(e,t,a)):(Di&&r&&Si(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=Qr,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):Qr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Rs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Qr,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Na||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Qr,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Na||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Fi(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:ma()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(no.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Di){if(a?q(t):eo(t),(e=Ei)?(e=of(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return cf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(eo(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=ai(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(q(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(q(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(eo(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=ai(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(eo(t),t.child=e.child,t.flags|=128,t=null);else if(q(t),cf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Li({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Pl,s!==null&&(r=Ke(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Yr(e,r),mu(s,e,r),Zs;sf(c)||Eu(),t=bc(e,t,n)}else sf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ei=uf(c.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?(eo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ni(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ai(c,a,n,null),c.flags|=2):c=ni(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(q(t),n=e.child,e=n.sibling,n=ni(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=ei(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ja(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function Sc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=no.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,H(no,o),$s(e,t,r,n),r=Di?mi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ro(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ro(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:ne(t,t.stateNode.containerInfo),Vi(t,ea,e.memoizedState.cache),Fi();break;case 27:case 5:ie(t);break;case 4:ne(t,t.stateNode.containerInfo);break;case 10:Vi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Qa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(q(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(q(t),t.flags|=128,null);q(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(no,no.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Vi(t,ea,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,Di&&t.flags&1048576&&xi(t,mi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ti(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(ne(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Vi(t,ea,r),r!==o.cache&&Wi(t,[ea],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=pc(e,t,r,n);break a}else if(r!==a){a=ui(Error(i(424)),t),Li(a),t=pc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ei=uf(e.firstChild),Ti=t,Di=!0,Oi=null,ki=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Fi(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=jf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Di||(n=t.type,e=t.pendingProps,r=Hd(te.current).createElement(n),r[Qe]=t,r[$e]=e,Id(r,n,e),dt(r),t.stateNode=r):t.memoizedState=jf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ie(t),e===null&&Di&&(r=t.stateNode=mf(t.type,t.pendingProps,te.current),Ti=t,ki=!0,a=Ei,$d(t.type)?(df=a,Ei=uf(r.firstChild)):Ei=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Di&&((a=r=Ei)&&(r=rf(r,t.type,t.pendingProps,ki),r===null?a=!1:(t.stateNode=r,Ti=t,Ei=uf(r.firstChild),ki=!1,a=!0)),a||ji(t)),ie(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Gd(a,o)?r=null:s!==null&&Gd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),ep._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&Di&&((e=n=Ei)&&(n=af(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Ti=t,Ei=null,e=!0)),e||ji(t)),null;case 13:return _c(e,t,n);case 4:return ne(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Vi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Pl,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Vi(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Vi(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Vi(t,ea,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Cu())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Kf(t))if(Cu())e.flags|=8192;else throw Sa=va,ga}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ve(),e.lanes|=t,Jl|=t)}function Mc(e,t){if(!Di)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Pc(e,t,n){var r=t.pendingProps;switch(Ci(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),re(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ii())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(ae(t),n=te.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=U.current,Pi(t)?Mi(t,e):(e=mf(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(ae(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=U.current,Pi(t))Mi(t,o);else{var s=Hd(te.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Qe]=t,o[$e]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Id(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=te.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ti,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Nd(e.nodeValue,n)),e||ji(t,!0)}else e=Hd(e).createTextNode(r),e[Qe]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Qe]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(to(t),t):(to(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Pi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Qe]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(to(t),t):(to(t),null)}return to(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return re(),e===null&&Cd(t.stateNode.containerInfo),Nc(t),null;case 10:return Hi(t.type),Nc(t),null;case 19:if(V(no),r=t.memoizedState,r===null)return Nc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Mc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ro(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ri(n,e),n=n.sibling;return H(no,no.current&1|2),Di&&bi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ve()>eu&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ro(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Di)return Nc(t),null}else 2*ve()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ve(),e.sibling=null,n=no.current,H(no,a?n&1|2:n&1),Di&&bi(t,r.treeForkCount),e);case 22:case 23:return to(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Ci(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),re(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ae(t),null;case 31:if(t.memoizedState!==null){if(to(t),t.alternate===null)throw Error(i(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(to(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(no),null;case 4:return re(),null;case 10:return Hi(t.type),null;case 22:case 23:return to(t),Ya(),e!==null&&V(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Ic(e,t){switch(Ci(t),t.tag){case 3:Hi(ea),re();break;case 26:case 27:case 5:ae(t);break;case 4:re();break;case 31:t.memoizedState!==null&&to(t);break;case 13:to(t);break;case 19:V(no);break;case 10:Hi(t.type);break;case 22:case 23:to(t),Ya(),e!==null&&V(da);break;case 24:Hi(ea)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Wu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Wu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Wu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Wu(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Wu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Wu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Wu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Wu(e,t,n)}else n.current=null}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Wu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Ld(r,e.type,n,t),r[$e]=t}catch(t){Wu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$d(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$d(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Gt));else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Y(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Id(t,r,n),t[Qe]=e,t[$e]=n}catch(t){Wu(e,e.return,t)}}var Yc=!1,Xc=!1,Zc=!1,Qc=typeof WeakSet==`function`?WeakSet:Set,$c=null;function el(e,t){if(e=e.containerInfo,Bd=lp,e=yr(e),br(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},lp=!1,$c=t;$c!==null;)if(t=$c,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$c=e;else for(;$c!==null;){switch(t=$c,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Wu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)nf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:nf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,$c=e;break}$c=t.return}}function tl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Lc(5,n);break;case 1:if(hl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Wu(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Wu(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Wu(n,n.return,e)}}break;case 27:t===null&&r&4&&Y(n);case 26:case 5:hl(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ju.bind(null,n),lf(e,n))));break;case 22:if(r=n.memoizedState!==null||Yc,!r){t=t!==null&&t.memoizedState!==null||Xc,i=Yc;var a=Xc;Yc=r,(Xc=t)&&!a?_l(e,n,(n.subtreeFlags&8772)!=0):hl(e,n),Yc=i,Xc=a}break;case 30:break;default:hl(e,n)}}function X(e){var t=e.alternate;t!==null&&(e.alternate=null,X(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ot(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Oe&&typeof Oe.onCommitFiberUnmount==`function`)try{Oe.onCommitFiberUnmount(De,n)}catch{}switch(n.tag){case 26:Xc||Hc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xc||Hc(n,t);var r=nl,i=rl;$d(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),hf(n.stateNode),nl=r,rl=i;break;case 5:Xc||Hc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null)if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Wu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Wu(n,t,e)}break;case 18:nl!==null&&(rl?(e=nl,ef(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Fp(e)):ef(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Xc||Rc(4,n,t),il(e,t,n);break;case 1:Xc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Xc=(r=Xc)||n.memoizedState!==null,il(e,t,n),Xc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fp(e)}catch(e){Wu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fp(e)}catch(e){Wu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qc),t;default:throw Error(i(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Yu.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if($d(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(i(160));al(o,s,a),nl=null,rl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Xc||n===null||Hc(n,n.return)),r&64&&Yc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=dl;if(ul(t,e),pl(e),r&512&&(Xc||n===null||Hc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[at]||o[Qe]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Id(o,r,n),o[Qe]=e,dt(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Id(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Uf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Id(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[Qe]=e,dt(o),r=o}e.stateNode=r}else Wf(a,e.type,e.stateNode);else e.stateNode=Rf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Wf(a,e.type,e.stateNode):Rf(a,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Xc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Xc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Lt(a,``)}catch(t){Wu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Zc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Wu(e,e.return,t)}}break;case 3:if(Hf=null,a=dl,dl=vf(t.containerInfo),ul(t,e),dl=a,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fp(t.containerInfo)}catch(t){Wu(e,e.return,t)}Zc&&(Zc=!1,ml(e));break;case 4:r=dl,dl=vf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Yc,d=Xc;if(Yc=u||a,Xc=d||l,ul(t,e),Xc=d,Yc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Yc||Xc||gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Wu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Wu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?tf(m,!0):tf(l.stateNode,!1)}catch(e){Wu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Lt(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Wu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tl(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),gl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),gl(t);break;case 27:hf(t.stateNode);case 26:case 5:Hc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:_l(i,a,n),Lc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Wu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Wu(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Y(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),Vc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Z(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)bl(e,t,n,r),t=t.sibling}function bl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Z(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Z(e,t,n,r);break;case 3:Z(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){Z(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Wu(t,t.return,e)}}else Z(e,t,n,r);break;case 31:Z(e,t,n,r);break;case 13:Z(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Z(e,t,n,r):(a._visibility|=2,xl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Z(e,t,n,r):Sl(e,t),i&2048&&vl(o,t);break;case 24:Z(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:Z(e,t,n,r)}}function xl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:xl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,xl(a,o,s,c,i)):u._visibility&2?xl(a,o,s,c,i):Sl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:xl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:xl(a,o,s,c,i)}t=t.sibling}}function Sl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Sl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Sl(n,r),i&2048&&yl(r.alternate,r);break;default:Sl(n,r)}t=t.sibling}}var Cl=8192;function wl(e,t,n){if(e.subtreeFlags&Cl)for(e=e.child;e!==null;)Tl(e,t,n),e=e.sibling}function Tl(e,t,n){switch(e.tag){case 26:wl(e,t,n),e.flags&Cl&&e.memoizedState!==null&&qf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:wl(e,t,n);break;case 3:case 4:var r=dl;dl=vf(e.stateNode.containerInfo),wl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Cl,Cl=16777216,wl(e,t,n),Cl=r):wl(e,t,n));break;default:wl(e,t,n)}}function El(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Al(r,e)}El(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ol(e),e=e.sibling}function Ol(e){switch(e.tag){case 0:case 11:case 15:Dl(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Dl(e);break;case 12:Dl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kl(e)):Dl(e);break;default:Dl(e)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Al(r,e)}El(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,kl(t));break;default:kl(t)}e=e.sibling}}function Al(e,t){for(;$c!==null;){var n=$c;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,$c=r;else a:for(n=e;$c!==null;){r=$c;var i=r.sibling,a=r.return;if(X(r),r===n){$c=null;break a}if(i!==null){i.return=a,$c=i;break a}$c=a}}}var jl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Ml=typeof WeakMap==`function`?WeakMap:Map,Nl=0,Pl=null,Fl=null,Il=0,Ll=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,nu=null,ru=0,iu=null,au=null,ou=0,su=0,cu=null,lu=null,uu=0,du=null;function fu(){return Nl&2&&Il!==0?Il&-Il:I.T===null?Ye():dd()}function pu(){if(ql===0)if(!(Il&536870912)||Di){var e=Fe;Fe<<=1,!(Fe&3932160)&&(Fe=262144),ql=e}else ql=536870912;return e=Xa.current,e!==null&&(e.flags|=32),ql}function mu(e,t,n){(e===Pl&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)&&(xu(e,0),vu(e,Il,ql,!1)),K(e,n),(!(Nl&2)||e!==Pl)&&(e===Pl&&(!(Nl&2)&&(Gl|=n),Ul===4&&vu(e,Il,ql,!1)),rd(e))}function hu(e,t,n){if(Nl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||ze(e,t),a=r?ku(e,t):Du(e,t,!0),o=r;do{if(a===0){Bl&&!r&&vu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!_u(n)){a=Du(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(xu(c,s).flags|=256),s=Du(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=o,Gl|=o,a=4;break a}o=Xl,Xl=a,o!==null&&(Xl===null?Xl=o:Xl.push.apply(Xl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){xu(e,0),vu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:vu(r,t,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ql+300-ve(),10<a)){if(vu(r,t,ql,!zl),Re(r,0,!0)!==0)break a;ou=t,r.timeoutHandle=Jd(gu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,`Throttled`,-0,0),a);break a}gu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,null,-0,0)}}break}while(1);rd(e)}function gu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gt},Tl(t,a,d);var m=(a&62914560)===a?Ql-ve():(a&4194048)===a?$l-ve():0;if(m=Yf(d,m),m!==null){ou=a,e.cancelPendingCommit=m(Iu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),vu(e,a,o,!l);return}}Iu(e,t,a,n,r,i,o,s,c)}function _u(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!mr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vu(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ae(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&We(e,n,t)}function yu(){return Nl&6?!0:(id(0,!1),!1)}function bu(){if(Fl!==null){if(Ll===0)var e=Fl.return;else e=Fl,Bi=zi=null,Co(e),Ta=null,Ea=0,e=Fl;for(;e!==null;)Ic(e.alternate,e),e=e.return;Fl=null}}function xu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Yd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ou=0,bu(),Pl=e,Fl=n=ni(e.current,null),Il=t,Ll=0,Rl=null,zl=!1,Bl=ze(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ae(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Kr(),n}function Su(e,t){J=null,I.H=Ns,t===ha||t===_a?(t=Ca(),Ll=3):t===ga?(t=Ca(),Ll=4):Ll=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Fl===null&&(Ul=1,Gs(e,ui(t,e.current)))}function Cu(){var e=Xa.current;return e===null?!0:(Il&4194048)===Il?Za===null:(Il&62914560)===Il||Il&536870912?e===Za:!1}function wu(){var e=I.H;return I.H=Ns,e===null?Ns:e}function Tu(){var e=I.A;return I.A=jl,e}function Eu(){Ul=4,zl||(Il&4194048)!==Il&&Xa.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Pl===null||vu(Pl,Il,ql,!1)}function Du(e,t,n){var r=Nl;Nl|=2;var i=wu(),a=Tu();(Pl!==e||Il!==t)&&(tu=null,xu(e,t)),t=!1;var o=Ul;a:do try{if(Ll!==0&&Fl!==null){var s=Fl,c=Rl;switch(Ll){case 8:bu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Ll;if(Ll=0,Rl=null,Nu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Ll,Ll=0,Rl=null,Nu(e,s,c,l)}}Ou(),o=Ul;break}catch(t){Su(e,t)}while(1);return t&&e.shellSuspendCounter++,Bi=zi=null,Nl=r,I.H=i,I.A=a,Fl===null&&(Pl=null,Il=0,Kr()),o}function Ou(){for(;Fl!==null;)ju(Fl)}function ku(e,t){var n=Nl;Nl|=2;var r=wu(),a=Tu();Pl!==e||Il!==t?(tu=null,eu=ve()+500,xu(e,t)):Bl=ze(e,t);a:do try{if(Ll!==0&&Fl!==null){t=Fl;var o=Rl;b:switch(Ll){case 1:Ll=0,Rl=null,Nu(e,t,o,1);break;case 2:case 9:if(ya(o)){Ll=0,Rl=null,Mu(t);break}t=function(){Ll!==2&&Ll!==9||Pl!==e||(Ll=7),rd(e)},o.then(t,t);break a;case 3:Ll=7;break a;case 4:Ll=5;break a;case 7:ya(o)?(Ll=0,Rl=null,Mu(t)):(Ll=0,Rl=null,Nu(e,t,o,7));break;case 5:var s=null;switch(Fl.tag){case 26:s=Fl.memoizedState;case 5:case 27:var c=Fl;if(s?Kf(s):c.stateNode.complete){Ll=0,Rl=null;var l=c.sibling;if(l!==null)Fl=l;else{var u=c.return;u===null?Fl=null:(Fl=u,Pu(u))}break b}}Ll=0,Rl=null,Nu(e,t,o,5);break;case 6:Ll=0,Rl=null,Nu(e,t,o,6);break;case 8:bu(),Ul=6;break a;default:throw Error(i(462))}}Au();break}catch(t){Su(e,t)}while(1);return Bi=zi=null,I.H=r,I.A=a,Nl=n,Fl===null?(Pl=null,Il=0,Kr(),Ul):0}function Au(){for(;Fl!==null&&!ge();)ju(Fl)}function ju(e){var t=Dc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Pu(e):Fl=t}function Mu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,Il);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,Il);break;case 5:Co(t);default:Ic(n,t),t=Fl=ri(t,Hl),t=Dc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Pu(e):Fl=t}function Nu(e,t,n,r){Bi=zi=null,Co(t),Ta=null,Ea=0;var i=t.return;try{if(Xs(e,i,t,n,Il)){Ul=1,Gs(e,ui(n,e.current)),Fl=null;return}}catch(t){if(i!==null)throw Fl=i,t;Ul=1,Gs(e,ui(n,e.current)),Fl=null;return}t.flags&32768?(Di||r===1?e=!0:Bl||Il&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Fu(t,e)):Pu(t)}function Pu(e){var t=e;do{if(t.flags&32768){Fu(t,zl);return}e=t.return;var n=Pc(t.alternate,t,Hl);if(n!==null){Fl=n;return}if(t=t.sibling,t!==null){Fl=t;return}Fl=t=e}while(t!==null);Ul===0&&(Ul=5)}function Fu(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Fl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Fl=e;return}Fl=e=n}while(e!==null);Ul=6,Fl=null}function Iu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Vu();while(ru!==0);if(Nl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Gr,Ue(e,n,o,s,c,l),e===Pl&&(Fl=Pl=null,Il=0),au=t,iu=e,ou=n,su=o,cu=a,lu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Xu(Se,function(){return Hu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Nl,Nl|=4;try{el(e,t,n)}finally{Nl=s,L.p=a,I.T=r}}ru=1,Lu(),Ru(),zu()}}function Lu(){if(ru===1){ru=0;var e=iu,t=au,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{fl(t,e);var a=Vd,o=yr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&vr(s.ownerDocument.documentElement,s)){if(c!==null&&br(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=_r(s,h),v=_r(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}lp=!!Bd,Vd=Bd=null}finally{Nl=i,L.p=r,I.T=n}}e.current=t,ru=2}}function Ru(){if(ru===2){ru=0;var e=iu,t=au,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{tl(e,t.alternate,t)}finally{Nl=i,L.p=r,I.T=n}}ru=3}}function zu(){if(ru===4||ru===3){ru=0,_e();var e=iu,t=au,n=ou,r=lu;t.subtreeFlags&10256||t.flags&10256?ru=5:(ru=0,au=iu=null,Bu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(nu=null),Je(n),t=t.stateNode,Oe&&typeof Oe.onCommitFiberRoot==`function`)try{Oe.onCommitFiberRoot(De,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}ou&3&&Vu(),rd(e),i=e.pendingLanes,n&261930&&i&42?e===du?uu++:(uu=0,du=e):uu=0,id(0,!1)}}function Bu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Vu(){return Lu(),Ru(),zu(),Hu()}function Hu(){if(ru!==5)return!1;var e=iu,t=su;su=0;var n=Je(ou),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=cu,cu=null;var o=iu,s=ou;if(ru=0,au=iu=null,ou=0,Nl&6)throw Error(i(331));var c=Nl;if(Nl|=4,Ol(o.current),bl(o,o.current,s,n),Nl=c,id(0,!1),Oe&&typeof Oe.onPostCommitFiberRoot==`function`)try{Oe.onPostCommitFiberRoot(De,o)}catch{}return!0}finally{L.p=a,I.T=r,Bu(e,t)}}function Uu(e,t,n){t=ui(n,t),t=qs(e.stateNode,t,2),e=La(e,t,2),e!==null&&(K(e,2),rd(e))}function Wu(e,t,n){if(e.tag===3)Uu(e,e,n);else for(;t!==null;){if(t.tag===3){Uu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=ui(n,e),n=Js(2),r=La(t,n,2),r!==null&&(Ys(n,r,t,e),K(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ml;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Pl===e&&(Il&n)===n&&(Ul===4||Ul===3&&(Il&62914560)===Il&&300>ve()-Ql?!(Nl&2)&&xu(e,0):Kl|=n,Jl===Il&&(Jl=0)),rd(e)}function qu(e,t){t===0&&(t=Ve()),e=Yr(e,t),e!==null&&(K(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return me(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ae(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=Il,a=Re(r,r===Pl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ze(r,a)||(n=!0,ld(r,a));r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&qd()&&(e=nd);for(var t=ve(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}ru!==0&&ru!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ae(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Be(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Pl,n=Il,n=Re(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&he(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ze(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&he(r),Je(n)){case 2:case 8:n=xe;break;case 32:n=Se;break;case 268435456:n=we;break;default:n=Se}return r=cd.bind(null,e),n=me(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&he(r),e.callbackPriority=2,e.callbackNode=null,2}function cd(e,t){if(ru!==0&&ru!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var r=Il;return r=Re(e,e===Pl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(hu(e,r,t),sd(e,ve()),e.callbackNode!=null&&e.callbackNode===n?cd.bind(null,e):null)}function ld(e,t){if(Vu())return null;hu(e,t,!0)}function ud(){Zd(function(){Nl&6?me(be,ad):od()})}function dd(){if(nd===0){var e=aa;e===0&&(e=Pe,Pe<<=1,!(Pe&261888)&&(Pe=256)),nd=e}return nd}function fd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Wt(``+e)}function pd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function md(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=fd((i[$e]||null).action),o=r.submitter;o&&(t=(t=o[$e]||null)?fd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new pn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(nd!==0){var e=o?pd(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?pd(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var hd=0;hd<Br.length;hd++){var gd=Br[hd];Vr(gd.toLowerCase(),`on`+(gd[0].toUpperCase()+gd.slice(1)))}Vr(Mr,`onAnimationEnd`),Vr(Nr,`onAnimationIteration`),Vr(Pr,`onAnimationStart`),Vr(`dblclick`,`onDoubleClick`),Vr(`focusin`,`onFocus`),Vr(`focusout`,`onBlur`),Vr(Fr,`onTransitionRun`),Vr(Ir,`onTransitionStart`),Vr(Lr,`onTransitionCancel`),Vr(Rr,`onTransitionEnd`),ht(`onMouseEnter`,[`mouseout`,`mouseover`]),ht(`onMouseLeave`,[`mouseout`,`mouseover`]),ht(`onPointerEnter`,[`pointerout`,`pointerover`]),ht(`onPointerLeave`,[`pointerout`,`pointerover`]),mt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),mt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),mt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),mt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),mt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),mt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var _d=`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(` `),vd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(_d));function yd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Hr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Hr(e)}i.currentTarget=null,a=c}}}}function bd(e,t){var n=t[tt];n===void 0&&(n=t[tt]=new Set);var r=e+`__bubble`;n.has(r)||(wd(t,e,2,!1),n.add(r))}function xd(e,t,n){var r=0;t&&(r|=4),wd(n,e,r,t)}var Sd=`_reactListening`+Math.random().toString(36).slice(2);function Cd(e){if(!e[Sd]){e[Sd]=!0,ft.forEach(function(t){t!==`selectionchange`&&(vd.has(t)||xd(t,!1,e),xd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Sd]||(t[Sd]=!0,xd(`selectionchange`,!1,t))}}function wd(e,t,n,r){switch(gp(t)){case 2:var i=up;break;case 8:i=dp;break;default:i=fp}n=i.bind(null,t,n,e),i=void 0,!tn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Td(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=st(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Qt(function(){var r=a,i=qt(n),s=[];a:{var c=zr.get(e);if(c!==void 0){var l=pn,u=e;switch(e){case`keypress`:if(cn(n)===0)break a;case`keydown`:case`keyup`:l=jn;break;case`focusin`:u=`focus`,l=Sn;break;case`focusout`:u=`blur`,l=Sn;break;case`beforeblur`:case`afterblur`:l=Sn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Nn;break;case Mr:case Nr:case Pr:l=Cn;break;case Rr:l=Pn;break;case`scroll`:case`scrollend`:l=hn;break;case`wheel`:l=Fn;break;case`copy`:case`cut`:case`paste`:l=wn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Mn;break;case`toggle`:case`beforetoggle`:l=In}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=$t(m,p),g!=null&&d.push(Ed(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Kt&&(u=n.relatedTarget||n.fromElement)&&(st(u)||u[et]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?st(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Mn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:lt(l),h=u==null?c:lt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,st(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Od,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&kd(s,c,l,d,!1),u!==null&&f!==null&&kd(s,f,u,d,!0)}}a:{if(c=r?lt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=nr;else if(Xn(c))if(rr)v=fr;else{v=ur;var y=lr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Vt(r.elementType)&&(v=nr):v=dr;if(v&&=v(e,r)){Zn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Nt(c,`number`,c.value)}switch(y=r?lt(r):window,e){case`focusin`:(Xn(y)||y.contentEditable===`true`)&&(Sr=y,Cr=r,wr=null);break;case`focusout`:wr=Cr=Sr=null;break;case`mousedown`:Tr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Tr=!1,Er(s,n,i);break;case`selectionchange`:if(xr)break;case`keydown`:case`keyup`:Er(s,n,i)}var b;if(Rn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Kn?Wn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Vn&&n.locale!==`ko`&&(Kn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Kn&&(b=sn()):(rn=i,an=`value`in rn?rn.value:rn.textContent,Kn=!0)),y=Dd(r,x),0<y.length&&(x=new Tn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Gn(n),b!==null&&(x.data=b)))),(b=Bn?qn(e,n):Jn(e,n))&&(x=Dd(r,`onBeforeInput`),0<x.length&&(y=new Tn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),md(s,e,r,n,i)}yd(s,t)})}function Ed(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=$t(e,n),i!=null&&r.unshift(Ed(e,i,a)),i=$t(e,t),i!=null&&r.push(Ed(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Od(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=$t(n,a),l!=null&&o.unshift(Ed(n,l,c))):i||(l=$t(n,a),l!=null&&o.push(Ed(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ad=/\r\n?/g,jd=/\u0000|\uFFFD/g;function Md(e){return(typeof e==`string`?e:``+e).replace(Ad,`
9
+ `).replace(jd,``)}function Nd(e,t){return t=Md(t),Md(e)===t}function Pd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Lt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Lt(e,``+r);break;case`className`:xt(e,`class`,r);break;case`tabIndex`:xt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:xt(e,n,r);break;case`style`:Bt(e,r,o);break;case`data`:if(t!==`object`){xt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Wt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Pd(e,t,`name`,a.name,a,null),Pd(e,t,`formEncType`,a.formEncType,a,null),Pd(e,t,`formMethod`,a.formMethod,a,null),Pd(e,t,`formTarget`,a.formTarget,a,null)):(Pd(e,t,`encType`,a.encType,a,null),Pd(e,t,`method`,a.method,a,null),Pd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Wt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Gt);break;case`onScroll`:r!=null&&bd(`scroll`,e);break;case`onScrollEnd`:r!=null&&bd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Wt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:bd(`beforetoggle`,e),bd(`toggle`,e),bt(e,`popover`,r);break;case`xlinkActuate`:St(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:St(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:St(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:St(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:bt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Ht.get(n)||n,bt(e,n,r))}}function Fd(e,t,n,r,a,o){switch(n){case`style`:Bt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Lt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Lt(e,``+r);break;case`onScroll`:r!=null&&bd(`scroll`,e);break;case`onScrollEnd`:r!=null&&bd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Gt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!pt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[$e]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):bt(e,n,r)}}}function Id(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:bd(`error`,e),bd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,o,s,n,null)}}a&&Pd(e,t,`srcSet`,n.srcSet,n,null),r&&Pd(e,t,`src`,n.src,n,null);return;case`input`:bd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Pd(e,t,r,d,n,null)}}Mt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in bd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Pd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Pt(e,!!r,n,!0):Pt(e,!!r,t,!1);return;case`textarea`:for(s in bd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Pd(e,t,s,c,n,null)}It(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Pd(e,t,l,r,n,null)}return;case`dialog`:bd(`beforetoggle`,e),bd(`toggle`,e),bd(`cancel`,e),bd(`close`,e);break;case`iframe`:case`object`:bd(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)bd(_d[r],e);break;case`image`:bd(`error`,e),bd(`load`,e);break;case`details`:bd(`toggle`,e);break;case`embed`:case`source`:case`link`:bd(`error`,e),bd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,u,r,n,null)}return;default:if(Vt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Fd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Pd(e,t,c,r,n,null))}function Ld(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Pd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Pd(e,t,p,m,r,f)}}jt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Pd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Pd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Pt(e,!!n,n?[]:``,!1):Pt(e,!!n,t,!0)):Pt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Pd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Pd(e,t,s,a,r,o)}Ft(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Pd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Pd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Pd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Pd(e,t,u,p,r,m)}return;default:if(Vt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Fd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Fd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Pd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Pd(e,t,f,p,r,m)}function Rd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function zd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Rd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Bd=null,Vd=null;function Hd(e){return e.nodeType===9?e:e.ownerDocument}function Ud(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Wd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Gd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Kd=null;function qd(){var e=window.event;return e&&e.type===`popstate`?e===Kd?!1:(Kd=e,!0):(Kd=null,!1)}var Jd=typeof setTimeout==`function`?setTimeout:void 0,Yd=typeof clearTimeout==`function`?clearTimeout:void 0,Xd=typeof Promise==`function`?Promise:void 0,Zd=typeof queueMicrotask==`function`?queueMicrotask:Xd===void 0?Jd:function(e){return Xd.resolve(null).then(e).catch(Qd)};function Qd(e){setTimeout(function(){throw e})}function $d(e){return e===`head`}function ef(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)hf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,hf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[at]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&hf(e.ownerDocument.body);n=i}while(n);Fp(t)}function tf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function nf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nf(n),ot(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[at])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=uf(e.nextSibling),e===null)break}return null}function af(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=uf(e.nextSibling),e===null))return null;return e}function of(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=uf(e.nextSibling),e===null))return null;return e}function sf(e){return e.data===`$?`||e.data===`$~`}function cf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function uf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var df=null;function ff(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return uf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mf(e,t,n){switch(t=Hd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function hf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ot(e)}var gf=new Map,_f=new Set;function vf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var yf=L.d;L.d={f:bf,r:xf,D:wf,C:Tf,L:Ef,m:Df,X:kf,S:Of,M:Af};function bf(){var e=yf.f(),t=yu();return e||t}function xf(e){var t=ct(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):yf.r(e)}var Sf=typeof document>`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=At(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Id(t,`link`,e),dt(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+At(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+At(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+At(n.imageSizes)+`"]`)):i+=`[href="`+At(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}gf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Id(t,`link`,e),dt(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+At(r)+`"][href="`+At(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!gf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Id(r,`link`,e),dt(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=ut(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);dt(c),Id(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=ut(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=m({src:e,async:!0},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),dt(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=ut(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),dt(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=te.current)?vf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=ut(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=ut(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=ut(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+At(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Id(t,`link`,n),dt(t),e.head.appendChild(t))}function If(e){return`[src="`+At(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+At(n.href)+`"]`);if(r)return t.instance=r,dt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),dt(r),Id(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,dt(o),o;r=Pf(n),(a=gf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),dt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Id(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,dt(a),a):(r=n,(a=gf.get(o))&&(r=m({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),dt(a),Id(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Hf=null;function Uf(e,t,n){if(Hf===null){var r=new Map,i=Hf=new Map;i.set(n,r)}else i=Hf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[at]||a[Qe]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Wf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,dt(a);return}a=t.ownerDocument||t,r=Pf(r),(i=gf.get(i))&&Bf(r,i),a=a.createElement(`link`),dt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Id(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Jf===0&&(Jf=62500*zd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Xf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ep={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function tp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=He(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=He(0),this.hiddenUpdates=He(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function np(e,t,n,r,i,a,o,s,c,l,u,d){return e=new tp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ei(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function rp(e){return e?(e=Qr,e):Qr}function ip(e,t,n,r,i,a){i=rp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(mu(n,e,t),Ra(n,e,t))}function ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function op(e,t){ap(e,t),(e=e.alternate)&&ap(e,t)}function sp(e){if(e.tag===13||e.tag===31){var t=Yr(e,67108864);t!==null&&mu(t,e,67108864),op(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=fu();t=qe(t);var n=Yr(e,t);n!==null&&mu(n,e,t),op(e,t)}}var lp=!0;function up(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,fp(e,t,n,r)}finally{L.p=a,I.T=i}}function dp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,fp(e,t,n,r)}finally{L.p=a,I.T=i}}function fp(e,t,n,r){if(lp){var i=pp(r);if(i===null)Td(e,t,r,mp,n),Tp(e,r);else if(Dp(i,e,t,n,r))r.stopPropagation();else if(Tp(e,r),t&4&&-1<wp.indexOf(e)){for(;i!==null;){var a=ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Le(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ae(o);s.entanglements[1]|=c,o&=~c}rd(a),!(Nl&6)&&(eu=ve()+500,id(0,!1))}}break;case 31:case 13:s=Yr(a,2),s!==null&&mu(s,a,2),yu(),op(a,2)}if(a=pp(r),a===null&&Td(e,t,r,mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Td(e,t,r,null,n)}}function pp(e){return e=qt(e),hp(e)}var mp=null;function hp(e){if(mp=null,e=st(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mp=e,null}function gp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(ye()){case be:return 2;case xe:return 8;case Se:case Ce:return 32;case we:return 268435456;default:return 32}default:return 32}}var _p=!1,vp=null,yp=null,bp=null,xp=new Map,Sp=new Map,Cp=[],wp=`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 Tp(e,t){switch(e){case`focusin`:case`focusout`:vp=null;break;case`dragenter`:case`dragleave`:yp=null;break;case`mouseover`:case`mouseout`:bp=null;break;case`pointerover`:case`pointerout`:xp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Sp.delete(t.pointerId)}}function Ep(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ct(t),t!==null&&sp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Dp(e,t,n,r,i){switch(t){case`focusin`:return vp=Ep(vp,e,t,n,r,i),!0;case`dragenter`:return yp=Ep(yp,e,t,n,r,i),!0;case`mouseover`:return bp=Ep(bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return xp.set(a,Ep(xp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Sp.set(a,Ep(Sp.get(a)||null,e,t,n,r,i)),!0}return!1}function Op(e){var t=st(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Xe(e.priority,function(){cp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Xe(e.priority,function(){cp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function kp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Kt=r,n.target.dispatchEvent(r),Kt=null}else return t=ct(n),t!==null&&sp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ap(e,t,n){kp(e)&&n.delete(t)}function jp(){_p=!1,vp!==null&&kp(vp)&&(vp=null),yp!==null&&kp(yp)&&(yp=null),bp!==null&&kp(bp)&&(bp=null),xp.forEach(Ap),Sp.forEach(Ap)}function Mp(e,n){e.blockedOn===n&&(e.blockedOn=null,_p||(_p=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(hp(r||n)===null)continue;break}var a=ct(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Mp(t,e)}vp!==null&&Mp(vp,e),yp!==null&&Mp(yp,e),bp!==null&&Mp(bp,e),xp.forEach(t),Sp.forEach(t);for(var n=0;n<Cp.length;n++){var r=Cp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cp.length&&(n=Cp[0],n.blockedOn===null);)Op(n),n.blockedOn===null&&Cp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[$e]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[$e]||null)s=o.formAction;else if(hp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Ip(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ip(n,fu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ip(e.current,2,null,e,null,null),yu(),t[et]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ye();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cp.length&&t!==0&&t<Cp[n].priority;n++);Cp.splice(n,0,e),n===0&&Op(e)}};var zp=n.version;if(zp!==`19.2.7`)throw Error(i(527,zp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{De=Vp.inject(Bp),Oe=Vp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=np(e,1,!1,null,null,n,r,null,o,s,c,Ip),e[et]=t.current,Cd(e),new Lp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),y=o(((e,t)=>{t.exports=v()})),b=_(),x=l(d(),1),S=y(),C=`dark`,w=`pockcode-theme`,T=(0,x.createContext)({resolvedTheme:C,setTheme:()=>void 0,theme:C});function E(e){return e===`dark`||e===`light`||e===`system`}function D(){return typeof window>`u`?C:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function O(e){return e===`system`?D():e}function k(e,t){if(typeof window>`u`)return t;let n=window.localStorage.getItem(e);return E(n)?n:t}function A(e){let t=window.document.documentElement;t.classList.remove(`light`,`dark`),t.classList.add(e),t.style.colorScheme=e}function j({children:e,defaultTheme:t=C,storageKey:n=w}){let[r,i]=(0,x.useState)(()=>k(n,t)),[a,o]=(0,x.useState)(()=>O(r));(0,x.useEffect)(()=>{let e=O(r);if(A(e),o(e),r!==`system`)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=D();A(e),o(e)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[r]);let s=(0,x.useMemo)(()=>({resolvedTheme:a,theme:r,setTheme:e=>{window.localStorage.setItem(n,e),i(e)}}),[a,n,r]);return(0,S.jsx)(T.Provider,{value:s,children:e})}function M(){return(0,x.useContext)(T)}var N={};function P(e,t){let n=x.useRef(N);return n.current===N&&(n.current=e(t)),n}var F=[],I=void 0;function L(){return I}function R(e){F.push(e)}function z(e){let t=(t,n)=>{let r=P(B).current,i;try{I=r;for(let e of F)e.before(r);i=e(t,n);for(let e of F)e.after(r);r.didInitialize=!0}finally{I=void 0}return i};return t.displayName=e.displayName||e.name,t}function ee(e){return x.forwardRef(z(e))}function B(){return{didInitialize:!1}}var V=typeof document<`u`?x.useLayoutEffect:()=>{};function H(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var U=H(`https://base-ui.com/production-error`,`Base UI`),W=[];function te(e){x.useEffect(e,W)}var G=0,ne=class e{static create(){return new e}currentId=G;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=G,t()},e)}isStarted(){return this.currentId!==G}clear=()=>{this.currentId!==G&&(clearTimeout(this.currentId),this.currentId=G)};disposeEffect=()=>this.clear};function re(){let e=P(ne.create).current;return te(e.disposeEffect),e}function ie(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:ae,platform:oe,maxTouchPoints:se}=ie(),ce=ae.toLowerCase(),le=oe.toLowerCase(),ue=/^i(os$|p)/.test(le)||le===`macintel`&&se>1,de=`android`,fe=le===de||ce.includes(de),pe=!ue&&le.startsWith(`mac`);le.startsWith(`win`),!fe&&/^(linux|chrome os)/.test(le);var me=pe||ue,he=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!he&&ce.includes(`firefox`),!he&&ce.includes(`chrom`);var ge=me,_e=/jsdom|happydom/.test(ce);function ve(e){e.preventDefault(),e.stopPropagation()}function ye(e){return`nativeEvent`in e}function be(e){return e.pointerType===``&&e.isTrusted?!0:fe&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function xe(e){return _e?!1:!fe&&e.width===0&&e.height===0||fe&&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 Se(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Ce(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function we(){return typeof window<`u`}function Te(e){return Oe(e)?(e.nodeName||``).toLowerCase():`#document`}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function De(e){return((Oe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Oe(e){return we()?e instanceof Node||e instanceof Ee(e).Node:!1}function ke(e){return we()?e instanceof Element||e instanceof Ee(e).Element:!1}function Ae(e){return we()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function je(e){return!we()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}function Me(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=K(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ne(e){return/^(table|td|th)$/.test(Te(e))}function Pe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Fe=/transform|translate|scale|rotate|perspective|filter/,Ie=/paint|layout|strict|content/,Le=e=>!!e&&e!==`none`,Re;function ze(e){let t=ke(e)?K(e):e;return Le(t.transform)||Le(t.translate)||Le(t.scale)||Le(t.rotate)||Le(t.perspective)||!Ve()&&(Le(t.backdropFilter)||Le(t.filter))||Fe.test(t.willChange||``)||Ie.test(t.contain||``)}function Be(e){let t=We(e);for(;Ae(t)&&!He(t);){if(ze(t))return t;if(Pe(t))return null;t=We(t)}return null}function Ve(){return Re??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Re}function He(e){return/^(html|body|#document)$/.test(Te(e))}function K(e){return Ee(e).getComputedStyle(e)}function Ue(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function We(e){if(Te(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||je(e)&&e.host||De(e);return je(t)?t.host:t}function Ge(e){let t=We(e);return He(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ae(t)&&Me(t)?t:Ge(t)}function Ke(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ge(e),i=r===e.ownerDocument?.body,a=Ee(r);if(i){let e=qe(a);return t.concat(a,a.visualViewport||[],Me(r)?r:[],e&&n?Ke(e):[])}else return t.concat(r,Ke(r,[],n))}function qe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Je=`data-base-ui-focusable`,Ye=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Xe=`ArrowLeft`,Ze=`ArrowRight`,Qe=`ArrowUp`,$e=`ArrowDown`;function et(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function tt(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&je(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function nt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function rt(e,t){if(!ke(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(tt(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function it(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function at(e){return e.matches(`html,body`)}function ot(e){return Ae(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function st(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ye}`)!=null}function ct(e){return e?e.getAttribute(`role`)===`combobox`&&ot(e):!1}function lt(e){if(!e||_e)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function ut(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function dt(e,t){return t!=null&&!Se(t)?0:typeof e==`function`?e():e}function ft(e,t,n){let r=dt(e,n);return typeof r==`number`?r:r?.[t]}function pt(e){return typeof e==`function`?e():e}function mt(e,t){return t||e===`click`||e===`mousedown`}function ht(e){return e?.includes(`mouse`)&&e!==`mousedown`}function gt(){}var _t=Object.freeze([]),vt=Object.freeze({}),yt=`none`,bt=`trigger-press`,xt=`trigger-hover`,St=`trigger-focus`,Ct=`outside-press`,wt=`item-press`,Tt=`close-press`,Et=`focus-out`,Dt=`escape-key`,Ot=`list-navigation`,kt=`cancel-open`,At=`sibling-open`,jt=`imperative-action`,Mt=`window-resize`;function Nt(e,t,n,r){let i=!1,a=!1,o=r??vt;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Pt=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ne,currentIdRef:{current:null},currentContextRef:{current:null}});function Ft(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=x.useRef(n),a=x.useRef(n),o=x.useRef(null),s=x.useRef(null),c=re();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:ft(i.current,`open`),close:ft(n,`close`)}},[n,o,i,a]),(0,S.jsx)(Pt.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function It(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Lt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Rt(e,t,n,r){let i=P(Bt).current;return Vt(i,e,t,n,r)&&Ut(i,[e,t,n,r]),i.callback}function zt(e){let t=P(Bt).current;return Ht(t,e)&&Ut(t,e),t.callback}function Bt(){return{callback:null,cleanup:null,refs:[]}}function Vt(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Ht(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Ut(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function Wt(e){let t=P(Gt,e).current;return t.next=e,V(t.effect),t}function Gt(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Kt={...x},qt=Kt.useInsertionEffect,Jt=qt&&qt!==Kt.useLayoutEffect?qt:e=>e();function Yt(e){let t=P(Xt).current;return t.next=e,Jt(t.effect),t.trampoline}function Xt(){let e={next:void 0,callback:Zt,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Zt(){}var Qt=null;globalThis.requestAnimationFrame;var $t=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},en=class e{static create(){return new e}static request(e){return $t.request(e)}static cancel(e){return $t.cancel(e)}currentId=Qt;request(e){this.cancel(),this.currentId=$t.request(()=>{this.currentId=Qt,e()})}cancel=()=>{this.currentId!==Qt&&($t.cancel(this.currentId),this.currentId=Qt)};disposeEffect=()=>this.cancel};function tn(){let e=P(en.create).current;return te(e.disposeEffect),e}function nn(e){return e?.ownerDocument||document}var rn={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},an={...rn,position:`fixed`,top:0,left:0},on={...rn,position:`absolute`},sn=x.forwardRef(function(e,t){let[n,r]=x.useState();V(()=>{ge&&he&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,S.jsx)(`span`,{...e,ref:t,style:an,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),cn=[`top`,`right`,`bottom`,`left`],ln=Math.min,un=Math.max,dn=Math.round,fn=Math.floor,pn=e=>({x:e,y:e}),mn={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function hn(e,t,n){return un(e,ln(t,n))}function gn(e,t){return typeof e==`function`?e(t):e}function _n(e){return e.split(`-`)[0]}function vn(e){return e.split(`-`)[1]}function yn(e){return e===`x`?`y`:`x`}function bn(e){return e===`y`?`height`:`width`}function xn(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Sn(e){return yn(xn(e))}function Cn(e,t,n){n===void 0&&(n=!1);let r=vn(e),i=Sn(e),a=bn(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Mn(o)),[o,Mn(o)]}function wn(e){let t=Mn(e);return[Tn(e),t,Tn(t)]}function Tn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var En=[`left`,`right`],Dn=[`right`,`left`],On=[`top`,`bottom`],kn=[`bottom`,`top`];function An(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Dn:En:t?En:Dn;case`left`:case`right`:return t?On:kn;default:return[]}}function jn(e,t,n,r){let i=vn(e),a=An(_n(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Tn)))),a}function Mn(e){let t=_n(e);return mn[t]+e.slice(t.length)}function Nn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Nn(e)}function Fn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function In(e,t){return t<0||t>=e.length}function Ln(e,t){return zn(e.current,{disabledIndices:t})}function Rn(e,t){return zn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function zn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Bn(e,a,r));return a}function Bn(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Hn(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Vn(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Hn(e,t=e?K(e):null){return!e||!e.isConnected||!t||Vn(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Un=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Wn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return je(n)?n.host:null}function Gn(e){for(let t of Array.from(e.children))if(Te(t)===`summary`)return t;return null}function Kn(e,t){let n=Gn(t);return!!n&&(e===n||tt(n,e))}function qn(e){let t=e?Te(e):``;return e!=null&&e.matches(Un)&&(t!==`summary`||e.parentElement!=null&&Te(e.parentElement)===`details`&&Gn(e.parentElement)===e)&&(t!==`details`||Gn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Jn(e){if(!qn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Wn(t)){let n=t!==e,r=Te(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Te(t)===`details`&&!t.open&&!Kn(e,t)||t.hasAttribute(`hidden`)||!r&&!Yn(t,n))return!1}return!0}function Yn(e,t){let n=K(e);return t?n.display!==`none`:Hn(e,n)}function Xn(e){let t=e.tabIndex;if(t<0){let t=Te(e);if(t===`details`||t===`audio`||t===`video`||Ae(e)&&e.isContentEditable)return 0}return t}function Zn(e){if(Te(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Qn(e,t){let n=Zn(e);if(!n)return!0;let r=t.find(e=>{let t=Zn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Zn(e);return t?.name===n.name&&t.form===n.form})===n}function $n(e){if(Ae(e)&&Te(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ae(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function er(e,t){$n(e).forEach(e=>{qn(e)&&t.push(e),er(e,t)})}function tr(e,t,n){$n(e).forEach(e=>{Ae(e)&&e.matches(t)&&n.push(e),tr(e,t,n)})}function nr(e){return Jn(e)&&Xn(e)>=0}function rr(e){let t=[];return er(e,t),t.filter(Jn)}function ir(e){let t=rr(e);return t.filter(e=>Xn(e)>=0&&Qn(e,t))}function ar(e,t){let n=ir(e),r=n.length;if(r===0)return;let i=et(nn(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function or(e){return ar(nn(e).body,1)||e}function sr(e){return ar(nn(e).body,-1)||e}function cr(e,t){if(!e)return null;let n=ir(nn(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function lr(e){return cr(e,1)}function ur(e){return cr(e,-1)}function dr(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!tt(n,r)}function fr(e){ir(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function pr(e){let t=[];tr(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function mr(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...mr(e,t.id,n)])}function hr(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function gr(e){return`data-base-ui-${e}`}var _r=0;function vr(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(_r);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),gt;let o=requestAnimationFrame(a);return _r=o,()=>{_r===o&&(cancelAnimationFrame(o),_r=0)}}var yr={inert:new WeakMap,"aria-hidden":new WeakMap},br=`data-base-ui-inert`,xr={inert:new WeakSet,"aria-hidden":new WeakSet},Sr=new WeakMap,Cr=0;function wr(e){return xr[e]}function Tr(e){return e?je(e)?e.host:Tr(e.parentNode):null}var Er=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Tr(t);return e.contains(n)?n:null}).filter(e=>e!=null),Dr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Or=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Te(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function kr(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=Er(t,e),l=i?Or(t,Dr(c),new Set(c)):[],u=[],d=[];if(a){let e=yr[a],n=wr(a);s=n,o=e;let r=Er(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);Or(t,Dr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Sr.get(e)||0)+1;Sr.set(e,t),d.push(e),t===1&&e.setAttribute(br,``)}),Cr+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Sr.get(e)||0)-1;Sr.set(e,t),t||e.removeAttribute(br)}),--Cr,Cr||(yr.inert=new WeakMap,yr[`aria-hidden`]=new WeakMap,xr.inert=new WeakSet,xr[`aria-hidden`]=new WeakSet,Sr=new WeakMap)}}function Ar(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=nn(e[0]).body;return kr(e,a,n,r,{mark:i})}var jr=0;function Mr(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(jr+=1,r(`${t}-${jr}`))},[n,t]),i}var Nr=Kt.useId;function Pr(e,t){if(Nr!==void 0){let n=Nr();return e??(t?`${t}-${n}`:n)}return Mr(e,t)}var Fr=19;function Ir(e){return Fr>=e}function Lr(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(Ir(19)?n?.ref:t.ref)??null}function Rr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function zr(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Br(e,t){return typeof e==`function`?e(t):e}function Vr(e,t){return typeof e==`function`?e(t):e}var Hr={};function Ur(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Gr(t);let a=Gr(e);return t&&(a=Kr(a,t)),n&&(a=Kr(a,n)),r&&(a=Kr(a,r)),i&&(a=Kr(a,i)),a}function Wr(e){if(e.length===0)return Hr;if(e.length===1)return Gr(e[0]);let t=Gr(e[0]);for(let n=1;n<e.length;n+=1)t=Kr(t,e[n]);return t}function Gr(e){return Xr(e)?{...Zr(e,Hr)}:qr(e)}function Kr(e,t){return Xr(t)?Zr(t,e):Jr(e,t)}function qr(e){let t={...e};for(let e in t){let n=t[e];Yr(e,n)&&(t[e]=$r(n))}return t}function Jr(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Rr(e.style,r);break;case`className`:e[n]=ti(e.className,r);break;default:Yr(n,r)?e[n]=Qr(e[n],r):e[n]=r}}return e}function Yr(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Xr(e){return typeof e==`function`}function Zr(e,t){return Xr(e)?e(t):e??Hr}function Qr(e,t){return t?e?(...n)=>{let r=n[0];if(ni(r)){let i=r;ei(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:$r(t):e}function $r(e){return e&&((...t)=>{let n=t[0];return ni(n)&&ei(n),e(...t)})}function ei(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ti(e,t){return t?e?t+` `+e:t:e}function ni(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function ri(e,t,n={}){let r=t.render,i=ii(t,n);return n.enabled===!1?null:si(e,r,i,n.state??vt)}function ii(e,t={}){let{className:n,style:r,render:i}=e,{state:a=vt,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Br(n,a):void 0,d=l?Vr(r,a):void 0,f=l?zr(a,c):vt,p=l&&s?ai(s):void 0,m=l?Rr(f,p)??{}:vt;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=zt([m.ref,Lr(i),...o]):m.ref=Rt(m.ref,Lr(i),o):Rt(null,null)),l?(u!==void 0&&(m.className=ti(m.className,u)),d!==void 0&&(m.style=Rr(m.style,d)),m):vt}function ai(e){return Array.isArray(e)?Wr(e):Ur(void 0,e)}var oi=Symbol.for(`react.lazy`);function si(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Ur(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===oi&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return ci(e,n);throw Error(U(8))}function ci(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var li={style:{transition:`none`}},ui={fallbackAxisSide:`none`},di={fallbackAxisSide:`end`},fi={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},pi=l(h(),1),mi=x.createContext(null),hi=()=>x.useContext(mi),gi=gr(`portal`);function _i(e={}){let{ref:t,container:n,componentProps:r=vt,elementProps:i}=e,a=Pr(),o=hi()?.portalNode,[s,c]=x.useState(null),[l,u]=x.useState(null),d=Yt(e=>{e!==null&&u(e)}),f=x.useRef(null);V(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(Oe(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=ri(`div`,r,{ref:[t,d],props:[{id:a,[gi]:``},i]});return{portalNode:l,portalSubtree:s&&p?pi.createPortal(p,s):null}}var vi=x.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=_i({container:o,ref:t,componentProps:e,elementProps:c}),d=x.useRef(null),f=x.useRef(null),p=x.useRef(null),m=x.useRef(null),[h,g]=x.useState(null),_=x.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;x.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&dr(e)&&(e.type===`focusin`?_.current&&=(pr(l),!1):(fr(l),_.current=!0))}return Lt(It(l,`focusin`,e,!0),It(l,`focusout`,e,!0))},[l,v]),V(()=>{!l||y!==!0||!_.current||(pr(l),_.current=!1)},[y,l]);let C=x.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,S.jsxs)(x.Fragment,{children:[u,(0,S.jsxs)(mi.Provider,{value:C,children:[b&&l&&(0,S.jsx)(sn,{"data-type":`outside`,ref:d,onFocus:e=>{dr(e,l)?p.current?.focus():sr(h?h.domReference:null)?.focus()}}),b&&l&&(0,S.jsx)(`span`,{"aria-owns":l.id,style:fi}),l&&pi.createPortal(a,l),b&&l&&(0,S.jsx)(sn,{"data-type":`outside`,ref:f,onFocus:e=>{dr(e,l)?m.current?.focus():(or(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,Nt(`focus-out`,e.nativeEvent)))}})]})]})});function yi(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var bi=class{nodesRef={current:[]};events=yi();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},xi=x.createContext(null),Si=x.createContext(null),Ci=()=>x.useContext(xi)?.id||null,wi=e=>{let t=x.useContext(Si);return e??t};function Ti(e){let t=Pr(),n=wi(e),r=Ci();return V(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Ei(e){let{children:t,id:n}=e,r=Ci();return(0,S.jsx)(xi.Provider,{value:x.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Di(e){let{children:t,externalTree:n}=e,r=P(()=>n??new bi).current;return(0,S.jsx)(Si.Provider,{value:r,children:t})}function Oi(e){return e==null?e:`current`in e?e.current:e}function ki(e,t){let n=Ee(nt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Ai=20,ji=[];function Mi(){ji=ji.filter(e=>e.deref()?.isConnected)}function Ni(e){Mi(),e&&Te(e)!==`body`&&(ji.push(new WeakRef(e)),ji.length>Ai&&(ji=ji.slice(-20)))}function Pi(){return Mi(),ji[ji.length-1]?.deref()}function Fi(e){return e?nr(e)?e:ir(e)[0]||e:null}function Ii(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=rr(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return nr(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Li(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,C=Yt(()=>b.current.floatingContext?.nodeId),w=i===!1,T=ct(_)&&w,E=Wt(i),D=Wt(a),O=Wt(l),k=Wt(g),A=wi(p),j=hi(),M=x.useRef(!1),N=x.useRef(!1),P=x.useRef(!1),F=x.useRef(null),I=x.useRef(``),L=x.useRef(``),R=x.useRef(null),z=x.useRef(null),ee=Rt(R,f,j?.beforeInsideRef),B=Rt(z,j?.afterInsideRef),H=re(),U=re(),W=tn(),te=j!=null,G=ut(v),ne=Yt((e=G)=>e?ir(e):[]),ie=Yt(()=>m?.().filter(e=>e!=null)??[]);x.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&tt(G,et(nn(G)))&&ne().length===0&&!T&&ve(e)}return It(nn(G),`keydown`,e)},[r,G,s,T,ne]),x.useEffect(()=>{if(r||!g)return;let e=nn(G);function t(){P.current=!1}function n(e){let t=nt(e),n=ie();P.current=!(tt(v,t)||tt(_,t)||tt(j?.portalNode,t)||n.some(e=>e===t||tt(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0,U.start(0,()=>{N.current=!1}))}function i(){L.current=`keyboard`}return Lt(It(e,`pointerdown`,n,!0),It(e,`pointerup`,t,!0),It(e,`pointercancel`,t,!0),It(e,`keydown`,i,!0),t)},[r,v,_,G,g,j,U,ie]),x.useEffect(()=>{if(r||!c)return;let e=nn(G);function t(){N.current=!0,U.start(0,()=>{N.current=!1})}function n(e){let t=nt(e);nr(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=nt(t);s&&n==null&&i!=null&&tt(v,i)&&Ni(i),queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ie(),f=n?.hasAttribute(gr(`focus-guard`))&&[R.current,z.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,Oi(d),Oi(u)].includes(n),p=!(tt(_,n)||tt(v,n)||tt(n,v)||tt(j?.portalNode,n)||l.some(e=>e===n||tt(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>tt(e,n))||f||A&&(mr(A.nodesRef.current,a).find(e=>tt(e.context?.elements.floating,n)||tt(e.context?.elements.domReference,n))||hr(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,ut(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&G&&Ii(G),o&&r!==_&&!Hn(i)&&et(e)===e.body){if(Ae(G)&&(G.focus(),o===`popup`)){W.request(()=>{G.focus()});return}let e=ne(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||G;Ae(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==Pi())&&(M.current=!0,h.setOpen(!1,Nt(Et,t)))})}function a(){P.current||(b.current.insideReactTree=!0,H.start(0,()=>{b.current.insideReactTree=!1}))}let l=Ae(_)?_:null;if(!(!v&&!l))return Lt(l&&It(l,`focusout`,i),l&&It(l,`pointerdown`,t),v&&It(v,`focusin`,n),v&&It(v,`focusout`,i),v&&j&&It(v,`focusout`,a,!0))},[r,_,v,G,s,A,j,h,c,o,ne,T,C,b,H,U,W,u,d,ie]),x.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${gr(`portal`)}]`)||[]),t=(A?hr(A.nodesRef.current,C()):[]).find(e=>ct(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Ar([v,...e,R.current,z.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ie(),t,Oi(d),Oi(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=Ar([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,j,T,A,C,u,d,ie]),V(()=>{if(!g||r||!Ae(G))return;let e=nn(G),t=et(e);queueMicrotask(()=>{let n=E.current,r=typeof n==`function`?n(O.current||``):n;if(r===void 0||r===!1||tt(G,t))return;let i=null,a=()=>(i??=ne(G),i[0]||G),o;o=r===!0||r===null?a():Oi(r),o||=a();let s=tt(G,et(e));vr(o,{preventScroll:o===G,shouldFocus(){if(!k.current)return!1;if(s)return!0;let t=et(e);return!(t!==o&&tt(G,t))}})})},[r,g,G,ne,E,O,k]),V(()=>{if(r||!G)return;let e=nn(G),t=et(e),n=O.current==null;Ni(t);function i(e){if(e.open||(I.current=ki(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(be(e.nativeEvent)||xe(e.nativeEvent))M.current=!1;else{let e=!1;nn(G).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}y.on(`openchange`,i);function a(){let e=D.current,r=typeof e==`function`?e(I.current):e;if(r===void 0||r===!1)return null;r===null&&(r=!0);let i=_?.isConnected?_:null,a=t?.isConnected&&Te(t)!==`body`?t:null,o=n?a||i:i||a;return o||=Pi()||null,typeof r==`boolean`?o:Oi(r)||o||null}return()=>{y.off(`openchange`,i);let t=et(e),n=ie(),r=tt(v,t)||n.some(e=>e===t||tt(e,t))||A&&mr(A.nodesRef.current,C(),!1).some(e=>tt(e.context?.elements.floating,t)),o=D.current,s=a();queueMicrotask(()=>{let n=Fi(s),i=typeof o!=`boolean`;o&&!M.current&&Ae(n)&&(!(!i&&n!==t&&t!==e.body)||r)&&n.focus({preventScroll:!0}),M.current=!1})}},[r,v,G,D,O,y,A,_,C,ie]),V(()=>{if(!he||g||!v)return;let e=et(nn(v));!Ae(e)||!ot(e)||tt(v,e)&&e.blur()},[g,v]),V(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),V(()=>{if(!(r||!G))return Ii(G),()=>{queueMicrotask(Mi)}},[r,G]);let ae=!r&&(s?!T:!0)&&(te||s);return(0,S.jsxs)(x.Fragment,{children:[ae&&(0,S.jsx)(sn,{"data-type":`inside`,ref:ee,onFocus:e=>{if(s){let e=ne();vr(e[e.length-1])}else j?.portalNode&&(M.current=!1,dr(e,j.portalNode)?or(_)?.focus():Oi(d??j.beforeOutsideRef)?.focus())}}),n,ae&&(0,S.jsx)(sn,{"data-type":`inside`,ref:B,onFocus:e=>{s?vr(ne()[0]):j?.portalNode&&(c&&(M.current=!0),dr(e,j.portalNode)?sr(_)?.focus():Oi(u??j.afterOutsideRef)?.focus())}})]})}function Ri(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=bt}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=x.useRef(void 0),f=tn(),p=re(),m=x.useMemo(()=>{function e(e,t,n,r){let i=Nt(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||Se(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=nt(o);if(ot(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}Se(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return x.useMemo(()=>n?{reference:m}:vt,[n,m])}function zi(){return!1}function Bi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Vi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=zi,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=wi(c),m=Yt(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Yt(()=>a),{escapeKey:v,outsidePress:y}=Bi(s),b=x.useRef(!1),S=x.useRef(!1),C=x.useRef(!1),w=x.useRef(!1),T=x.useRef(``),E=x.useRef(null),D=re(),O=re(),k=Yt(()=>{O.clear(),f.current.insideReactTree=!1}),A=Yt(e=>{let t=f.current.floatingContext?.nodeId;return(p?mr(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),j=Yt(e=>it(e,l.select(`floatingElement`))||it(e,l.select(`domReferenceElement`))),M=Yt(e=>{o()&&l.setOpen(!1,Nt(bt,e.nativeEvent))}),N=Yt(e=>{if(!u||!n||!r||e.key!==`Escape`||w.current||!v&&A(`__escapeKeyBubbles`))return;let t=Nt(Dt,ye(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),P=Yt(()=>{f.current.insideReactTree=!0,O.start(0,k)}),F=Yt(e=>{if(!u||!n||e.button!==0)return;let t=nt(e.nativeEvent);tt(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,S.current=!1))}),I=Yt(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(S.current=!0)});x.useEffect(()=>{if(!u||!n)return;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new ne,t=new ne;function i(){e.clear(),w.current=!0}function a(){e.start(he?5:0,()=>{w.current=!1})}function o(){C.current=!0,t.start(0,()=>{C.current=!1})}function s(){b.current=!1,S.current=!1}function c(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function x(e){let t=f.current.floatingContext?.nodeId,n=p&&mr(p.nodesRef.current,t).some(t=>it(e,t.context?.elements.floating));return j(e)||n}function O(e){if(m(e)){e.type!==`click`&&!j(e)&&(t.clear(),C.current=!1),k();return}if(f.current.insideReactTree){k();return}let n=nt(e),r=`[${gr(`inert`)}]`,i=ke(n)?n.getRootNode():null,a=Array.from((je(i)?i:nn(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>tt(e,n))))return;let s=ke(n)?n:null;for(;s&&!He(s);){let e=We(s);if(He(e)||!ke(e))break;s=e}if(!(a.length&&ke(n)&&!at(n)&&!tt(n,l.select(`floatingElement`))&&a.every(e=>!tt(s,e)))){if(Ae(n)&&!(`touches`in e)){let t=He(n),r=K(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!x(e)){if(c()===`intentional`&&C.current){t.clear(),C.current=!1;return}typeof h==`function`&&!h(e)||A(`__outsidePressBubbles`)||(l.setOpen(!1,Nt(Ct,e)),k())}}}function M(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||j(e)||O(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||j(e))return;let t=e.touches[0];t&&(E.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=nt(e);if(!n)return;let r=It(n,e.type,()=>{t(e),r()})}function I(e){T.current=`touch`,F(e,P)}function L(e){D.clear(),e.type===`pointerdown`&&(T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?M(e):O(e)})}function R(e){if(!b.current)return;let n=S.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!x(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),C.current=!0,k())}}}function z(e){if(c()!==`sloppy`||!E.current||j(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(O(e),D.clear(),E.current=null)}function ee(e){F(e,z)}function B(e){c()!==`sloppy`||!E.current||j(e)||(E.current.dismissOnTouchEnd&&O(e),D.clear(),E.current=null)}function V(e){F(e,B)}let H=nn(d),U=Lt(r&&Lt(It(H,`keydown`,N),It(H,`compositionstart`,i),It(H,`compositionend`,a)),g&&Lt(It(H,`click`,L,!0),It(H,`pointerdown`,L,!0),It(H,`pointerup`,R,!0),It(H,`pointercancel`,R,!0),It(H,`mousedown`,L,!0),It(H,`mouseup`,R,!0),It(H,`touchstart`,I,!0),It(H,`touchmove`,ee,!0),It(H,`touchend`,V,!0)));return()=>{U(),e.clear(),t.clear(),s(),C.current=!1}},[f,d,r,g,h,u,n,v,y,N,k,_,A,j,p,l,D]),x.useEffect(k,[h,k]);let L=x.useMemo(()=>({onKeyDown:N,onPointerDown:M,onClick:M}),[N,M]),R=x.useMemo(()=>({onKeyDown:N,onPointerDown:I,onMouseDown:I,onClickCapture:P,onMouseDownCapture(e){P(),F(e)},onPointerDownCapture(e){P(),F(e)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[N,P,F,I]);return x.useMemo(()=>n?{reference:L,floating:R,trigger:L}:{},[n,L,R])}function Hi(e,t,n){let{reference:r,floating:i}=e,a=xn(t),o=Sn(t),s=bn(o),c=_n(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(vn(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ui(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=gn(t,e),p=Pn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Fn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Fn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Wi=50,Gi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ui},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Hi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Wi&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Hi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ki=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=gn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=_n(r),_=xn(o),v=_n(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Mn(o)]:wn(o)),x=p!==`none`;!d&&x&&b.push(...jn(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Cn(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==xn(t))||T.every(e=>xn(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=xn(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function qi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ji(e){return cn.some(t=>e[t]>=0)}var Yi=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=gn(e,t);switch(i){case`referenceHidden`:{let e=qi(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ji(e)}}}case`escaped`:{let e=qi(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ji(e)}}}default:return{}}}}},Xi=new Set([`left`,`top`]);async function Zi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_n(n),s=vn(n),c=xn(n)===`y`,l=Xi.has(o)?-1:1,u=a&&c?-1:1,d=gn(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Qi=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Zi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},$i=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=gn(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=xn(_n(i)),p=yn(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=hn(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=hn(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ea=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=gn(e,t),u={x:n,y:r},d=xn(i),f=yn(d),p=u[f],m=u[d],h=gn(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Xi.has(_n(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ta=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=gn(e,t),u=await o.detectOverflow(t,l),d=_n(i),f=vn(i),p=xn(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=ln(h-u[g],v),x=ln(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=un(u.left,0),t=un(u.right,0),n=un(u.top,0),r=un(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:un(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:un(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function na(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ae(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=dn(n)!==a||dn(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ra(e){return ke(e)?e:e.contextElement}function ia(e){let t=ra(e);if(!Ae(t))return pn(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=na(t),o=(a?dn(n.width):n.width)/r,s=(a?dn(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var aa=pn(0);function oa(e){let t=Ee(e);return!Ve()||!t.visualViewport?aa:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ee(e)?!1:t}function ca(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ra(e),o=pn(1);t&&(r?ke(r)&&(o=ia(r)):o=ia(e));let s=sa(a,n,r)?oa(a):pn(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ee(a),t=r&&ke(r)?Ee(r):r,n=e,i=qe(n);for(;i&&r&&t!==n;){let e=ia(i),t=i.getBoundingClientRect(),r=K(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ee(i),i=qe(n)}}return Fn({width:u,height:d,x:c,y:l})}function la(e,t){let n=Ue(e).scrollLeft;return t?t.left+n:ca(De(e)).left+n}function ua(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-la(e,n),y:n.top+t.scrollTop}}function da(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=De(r),s=t?Pe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=pn(1),u=pn(0),d=Ae(r);if((d||!d&&!a)&&((Te(r)!==`body`||Me(o))&&(c=Ue(r)),d)){let e=ca(r);l=ia(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ua(o,c):pn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fa(e){return Array.from(e.getClientRects())}function pa(e){let t=De(e),n=Ue(e),r=e.ownerDocument.body,i=un(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=un(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+la(e),s=-n.scrollTop;return K(r).direction===`rtl`&&(o+=un(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ma=25;function ha(e,t){let n=Ee(e),r=De(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ve();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=la(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ma&&(a-=o)}else l<=ma&&(a+=l);return{width:a,height:o,x:s,y:c}}function ga(e,t){let n=ca(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ae(e)?ia(e):pn(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _a(e,t,n){let r;if(t===`viewport`)r=ha(e,n);else if(t===`document`)r=pa(De(e));else if(ke(t))r=ga(t,n);else{let n=oa(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Fn(r)}function va(e,t){let n=We(e);return n===t||!ke(n)||He(n)?!1:K(n).position===`fixed`||va(n,t)}function ya(e,t){let n=t.get(e);if(n)return n;let r=Ke(e,[],!1).filter(e=>ke(e)&&Te(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?We(e):e;for(;ke(o)&&!He(o);){let t=K(o),n=ze(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Me(o)&&!n&&va(e,o))?r=r.filter(e=>e!==o):i=t,o=We(o)}return t.set(e,r),r}function ba(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Pe(t)?[]:ya(t,this._c):[].concat(n),r],o=_a(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_a(t,a[e],i);s=un(n.top,s),c=ln(n.right,c),l=ln(n.bottom,l),u=un(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xa(e){let{width:t,height:n}=na(e);return{width:t,height:n}}function Sa(e,t,n){let r=Ae(t),i=De(t),a=n===`fixed`,o=ca(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=pn(0);function l(){c.x=la(i)}if(r||!r&&!a)if((Te(t)!==`body`||Me(i))&&(s=Ue(t)),r){let e=ca(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ua(i,s):pn(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ca(e){return K(e).position===`static`}function wa(e,t){if(!Ae(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return De(e)===n&&(n=n.ownerDocument.body),n}function Ta(e,t){let n=Ee(e);if(Pe(e))return n;if(!Ae(e)){let t=We(e);for(;t&&!He(t);){if(ke(t)&&!Ca(t))return t;t=We(t)}return n}let r=wa(e,t);for(;r&&Ne(r)&&Ca(r);)r=wa(r,t);return r&&He(r)&&Ca(r)&&!ze(r)?n:r||Be(e)||n}var Ea=async function(e){let t=this.getOffsetParent||Ta,n=this.getDimensions,r=await n(e.floating);return{reference:Sa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Da(e){return K(e).direction===`rtl`}var Oa={convertOffsetParentRelativeRectToViewportRelativeRect:da,getDocumentElement:De,getClippingRect:ba,getOffsetParent:Ta,getElementRects:Ea,getClientRects:fa,getDimensions:xa,getScale:ia,isElement:ke,isRTL:Da};function ka(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Aa(e,t){let n=null,r,i=De(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=fn(d),h=fn(i.clientWidth-(u+f)),g=fn(i.clientHeight-(d+p)),_=fn(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:un(0,ln(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ka(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ja(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ra(e),u=i||a?[...l?Ke(l):[],...t?Ke(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Aa(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?ca(e):null;c&&g();function g(){let t=ca(e);h&&!ka(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ma=Qi,Na=$i,Pa=Ki,Fa=ta,Ia=Yi,La=ea,Ra=(e,t,n)=>{let r=new Map,i={platform:Oa,...n},a={...i.platform,_c:r};return Gi(e,t,{...i,platform:a})},za=typeof document<`u`?x.useLayoutEffect:function(){};function Ba(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ba(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ba(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Va(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ha(e,t){let n=Va(e);return Math.round(t*n)/n}function Ua(e){let t=x.useRef(e);return za(()=>{t.current=e}),t}function Wa(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);Ba(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=x.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,S=o||g,C=x.useRef(null),w=x.useRef(null),T=x.useRef(u),E=c!=null,D=Ua(c),O=Ua(i),k=Ua(l),A=x.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Ra(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ba(T.current,t)&&(T.current=t,pi.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);za(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=x.useRef(!1);za(()=>(j.current=!0,()=>{j.current=!1}),[]),za(()=>{if(b&&(C.current=b),S&&(w.current=S),b&&S){if(D.current)return D.current(b,S,A);A()}},[b,S,A,D,E]);let M=x.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=x.useMemo(()=>({reference:b,floating:S}),[b,S]),P=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ha(N.floating,u.x),r=Ha(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Va(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Ga=(e,t)=>{let n=Ma(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ka=(e,t)=>{let n=Na(e);return{name:n.name,fn:n.fn,options:[e,t]}},qa=(e,t)=>({fn:La(e).fn,options:[e,t]}),Ja=(e,t)=>{let n=Pa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ya=(e,t)=>{let n=Fa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xa=(e,t)=>{let n=Ia(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Za(e){let t=x.useRef(!0);t.current&&(t.current=!1,e())}var q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(U(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Qa=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),$a=o(((e,t)=>{t.exports=Qa()})),eo=o((e=>{var t=d(),n=$a();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),to=o(((e,t)=>{t.exports=eo()})),no=$a(),ro=to(),io=Ir(19)?oo:so;function J(e,t,n,r,i){return io(e,t,n,r,i)}function ao(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,no.useSyncExternalStore)(e.subscribe,a,a)}R({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,no.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function oo(e,t,n,r,i){let a=L();if(!a)return ao(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function so(e,t,n,r,i){return(0,ro.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var co=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return J(this,e,t,n,r)}},lo=class extends co{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e);let n=this;V(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;V(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;V(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=this,r=t!==void 0;V(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),J(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=Yt(t??gt);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},uo={open:q(e=>e.open),transitionStatus:q(e=>e.transitionStatus),domReferenceElement:q(e=>e.domReferenceElement),referenceElement:q(e=>e.positionReference??e.referenceElement),floatingElement:q(e=>e.floatingElement),floatingId:q(e=>e.floatingId)},fo=class extends lo{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:yi(),nested:n,triggerElements:i},uo),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Ce(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function po(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=x.useRef(null);r===void 0&&f.current===null&&(f.current=new fo({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),V(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ke(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function mo(e,t=!1,n=!1){let[r,i]=x.useState(e&&t?`idle`:void 0),[a,o]=x.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),V(()=>{if(!e&&a&&r!==`ending`&&n){let e=en.request(()=>{i(`ending`)});return()=>{en.cancel(e)}}},[e,a,r,n]),V(()=>{if(!e||t)return;let n=en.request(()=>{i(void 0)});return()=>{en.cancel(n)}},[t,e]),V(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=en.request(()=>{i(`idle`)});return()=>{en.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var ho=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),go={[ho.startingStyle]:``},_o={[ho.endingStyle]:``},vo={transitionStatus(e){return e===`starting`?go:e===`ending`?_o:null}};function yo(e,t=!1,n=!0){let r=tn();return Yt((i,a=null)=>{r.cancel();let o=Oi(e);if(o==null)return;let s=o,c=()=>{pi.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=ho.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function bo(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Yt(i),o=yo(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var xo={tabIndex:-1,[Je]:``};function So(e){return t=>t===`touch`?e.current:!0}function Co(e,t,n=!1){let r=Pr(),i=Ci()!=null,a=x.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return po({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function wo(e,t){let n=x.useRef(null),r=x.useRef(null);return x.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function To(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function Eo(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Do(e,t,n,r){Za(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function Oo(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=wo(e,n),o=Yt(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return V(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function ko(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);V(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=Nt(yt);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function Ao(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=mo(e),o=t.useState(`preventUnmountingOnClose`),s=e?!1:o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=Yt(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return bo({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function jo(e,t){e.useSyncedValues(t),V(()=>()=>{e.update({activeTriggerProps:vt,inactiveTriggerProps:vt,popupProps:vt})},[e])}function Mo(e,t){V(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),V(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var No=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function Po(){return new fo({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new No,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Fo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Po(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:vt,inactiveTriggerProps:vt,popupProps:vt}}function Io(e,t,n=!1){return new fo({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var Lo=q(e=>e.triggerIdProp??e.activeTriggerId),Ro=q(e=>e.openProp??e.open),zo=q(e=>(e.popupElement?.id??e.floatingId)||void 0);function Bo(e,t){return t!==void 0&&Ro(e)&&Lo(e)===t}function Vo(e,t){return Bo(e,t)?!0:t!==void 0&&Ro(e)&&Lo(e)==null&&e.triggerCount===1}var Ho={open:Ro,mounted:q(e=>e.mounted),transitionStatus:q(e=>e.transitionStatus),floatingRootContext:q(e=>e.floatingRootContext),triggerCount:q(e=>e.triggerCount),preventUnmountingOnClose:q(e=>e.preventUnmountingOnClose),payload:q(e=>e.payload),activeTriggerId:Lo,activeTriggerElement:q(e=>e.mounted?e.activeTriggerElement:null),popupId:zo,isTriggerActive:q((e,t)=>t!==void 0&&Lo(e)===t),isOpenedByTrigger:q((e,t)=>Bo(e,t)),isMountedByTrigger:q((e,t)=>t!==void 0&&Lo(e)===t&&e.mounted),triggerProps:q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:q((e,t)=>Vo(e,t)?zo(e):void 0),popupProps:q(e=>e.popupProps),popupElement:q(e=>e.popupElement),positionerElement:q(e=>e.positionerElement)};function Uo(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Pr(),a=Ci()!=null,o=P(()=>new fo({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new No,floatingId:i,syncOnly:!1,nested:a})).current;return V(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ke(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Wo(e={}){let{nodeId:t,externalTree:n}=e,r=Uo(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=x.useState(null),[f,p]=x.useState(void 0),[m,h]=x.useState(void 0),g=x.useRef(null),_=wi(n),v=x.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=Wa({...e,elements:{...v,...u&&{reference:u}}}),b=ke(f)?f:null,S=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,S);let C=x.useCallback(e=>{let t=ke(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),w=x.useCallback(e=>{(ke(e)||e===null)&&(g.current=e,p(e)),(ke(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!ke(e))&&y.refs.setReference(e)},[y.refs,p]),T=x.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),E=x.useMemo(()=>({...y.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:g}),[y.refs,w,T,C]),D=x.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),O=x.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[y,E,D,t,i,c,l]);return V(()=>{s&&(g.current=s)},[s]),V(()=>{i.context.dataRef.current.floatingContext=O;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),x.useMemo(()=>({...y,context:O,refs:E,elements:D,rootStore:i}),[y,E,D,O,i])}var Go=pe&&he;function Ko(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=x.useRef(!1),c=x.useRef(null),l=x.useRef(!0),u=re();x.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=Ee(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&Ae(e)&&e===et(nn(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return Lt(It(t,`blur`,r),Go&&It(t,`keydown`,a,!0),Go&&It(t,`pointerdown`,o,!0))},[i,n]),x.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ke(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=x.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=nt(t.nativeEvent);if(ke(a)){if(Go&&!t.relatedTarget){if(!l.current&&!ot(a))return}else if(!lt(a))return}let o=rt(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Nt(St,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Nt(St,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ke(n)&&n.hasAttribute(gr(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=et(nn(e));!n&&t===e||tt(o.current.floatingContext?.refs.floating.current,t)||tt(e,t)||a||rt(n??t,i.context.triggerElements)||i.setOpen(!1,Nt(St,r))})}}},[o,r,i,u]);return x.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var qo=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ne,this.restTimeout=new ne,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Jo=new WeakMap;function Yo(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Jo.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Jo.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Xo(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Jo.get(n);a&&a!==e&&Yo(a),Yo(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Jo.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Zo(e){let t=e.context.dataRef.current,n=P(()=>t.hoverInteractionState??qo.create()).current;return t.hoverInteractionState||=n,te(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Qo(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=wi(),d=Ci(),f=Zo(a),p=re(),m=Yt(()=>mt(l.current.openEvent?.type,f.interactedInside)),h=Yt(()=>ht(l.current.openEvent?.type)),g=Yt(()=>{Yo(f)});V(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),x.useEffect(()=>g,[g]),V(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&ke(c)&&s){let e=c,t=s,n=nn(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return Xo(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),x.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&mr(u.nodesRef.current,d).length>0)}function t(e){let t=ft(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Nt(xt,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=nt(e);if(!st(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(rt(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&ke(o)&&mr(u.nodesRef.current,r,!1).some(e=>tt(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,Nt(xt,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Lt(y&&It(y,`mouseenter`,c),y&&It(y,`mouseleave`,_),y&&It(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var $o={current:null};function es(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=$o,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=wi(l),v=Zo(m),y=x.useRef(!1),b=Wt(i),S=Wt(r),C=Wt(o),w=Wt(n),T=Wt(p),E=Wt(f),D=Yt(()=>mt(h.current.openEvent?.type,v.interactedInside)),O=Yt(()=>T.current?.()!==!1),k=Yt((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!tt(e,t);if(!ke(n))return!1;let i=n;return r.hasMatchingElement(e=>tt(e,i))&&(!e||!tt(e,i))}),A=Yt(()=>{v.handler&&=(nn(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),j=Yt(()=>{Yo(v)});return u&&(v.handleCloseOptions=b.current?.__options),x.useEffect(()=>A,[A]),x.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===xt,A(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,A]),x.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=ft(S.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,Nt(xt,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,Nt(xt,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!ke(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Se(v.pointerType))return;let t=pt(C.current),n=ft(S.current,`open`,v.pointerType),r=nt(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(ke(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(tt(e,r)){s=e;break}}ke(i)&&ke(o)&&!m.context.triggerElements.hasElement(i)&&tt(i,o)&&(s=o);let c=s==null?!1:k(o,s,r),l=m.select(`open`),u=E.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&ke(s)&&ke(o)&&tt(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){O()&&m.setOpen(!0,Nt(xt,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&O()&&m.setOpen(!0,Nt(xt,e,s))}):g&&O()&&m.setOpen(!0,Nt(xt,e,s)))}function i(t){if(D()){j();return}A();let n=nn(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!rt(t.relatedTarget,m.context.triggerElements)){if(b.current&&r){m.select(`open`)||v.openChangeTimeout.clear();let i=c.current;v.handler=b.current({...r,tree:_,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!tt(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?Lt(It(t,`mousemove`,r,{once:!0}),It(t,`mouseenter`,r),It(t,`mouseleave`,i)):Lt(It(t,`mouseenter`,r),It(t,`mouseleave`,i))},[A,j,h,S,m,n,b,v,u,k,D,a,s,C,c,_,w,d,E,O]),x.useMemo(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=k(r,n,e.target);if(a&&!Se(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);e&&Xo(v,{scopeElement:v.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=pt(C.current);if(i&&!o||s===0||!o&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function c(){if(v.restTimeoutPending=!1,D())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&O()&&m.setOpen(!0,Nt(xt,t,n))}v.pointerType===`touch`?pi.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,D,k,a,m,C,O])}var ts=`Escape`;function ns(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function rs(e,t){return ns(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function is(e,t,n){return ns(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function as(e,t,n){return ns(t,n?e===Xe:e===Ze,e===$e)}function os(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===ts:ns(t,n?e===Ze:e===Xe,e===Qe)}function ss(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:S}=t,C=S!=null,w=`rootStore`in e?e.rootStore:e,T=w.useState(`open`),E=w.useState(`floatingElement`),D=w.useState(`domReferenceElement`),O=w.context.dataRef,k=ut(E),A=ct(D),j=Wt(k),M=Ci(),N=wi(b),P=x.useRef(f),F=x.useRef(o??-1),I=x.useRef(null),L=x.useRef(!0),R=Yt(e=>{i(F.current===-1?null:F.current,e)}),z=x.useRef(!!E),ee=x.useRef(T),B=x.useRef(!1),H=x.useRef(!1),U=x.useRef(null),W=Wt(h),te=Wt(T),G=Wt(o),ne=Wt(y),re=tn(),ie=tn(),ae=Yt(()=>{function e(e){d?N?.events.emit(`virtualfocus`,e):U.current=vr(e,{sync:B.current,preventScroll:!0})}let t=n.current[F.current],r=H.current;t&&e(t),(B.current?e=>e():e=>re.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),de&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});V(()=>{O.current.orientation=g},[O,g]),V(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(H.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),V(()=>{if(a){if(!T){B.current=!1;return}if(E)if(r==null){if(B.current=!1,G.current!=null)return;if(z.current&&(F.current=-1,ae()),(!ee.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ie.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||is(I.current,g,u)||l?Ln(n):Rn(n),I.current=null,R())};t()}}else In(n.current,r)||(F.current=r,ae(),H.current=!1)}},[a,T,E,r,G,l,n,g,u,R,ae,ie]),V(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=et(nn(D??t??null)),r=e.some(e=>e.context&&tt(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),V(()=>{ee.current=T,z.current=!!E}),V(()=>{T||(I.current=null,P.current=f)},[T,f]);let oe=r!=null,se=Yt(e=>{if(!te.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),ce=Yt(()=>_??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),le=Yt(()=>Ln(n,W.current)),ue=Yt(e=>{if(L.current=!1,B.current=!0,e.which===229||!te.current&&e.currentTarget===j.current)return;if(l&&os(e.key,g,u,C)){rs(e.key,ce())||ve(e),w.setOpen(!1,Nt(Ot,e.nativeEvent)),Ae(D)&&(d?N?.events.emit(`virtualfocus`,D):D.focus());return}let t=F.current,r=Ln(n,h),i=Rn(n,h);if(A||(e.key===`Home`&&(ve(e),F.current=r,R(e)),e.key===`End`&&(ve(e),F.current=i,R(e))),S!=null){let t=S(e,F.current,n,g,c,u,h,r,i);if(t!=null&&(F.current=t,R(e)),g===`both`)return}if(rs(e.key,g)){if(ve(e),T&&!d&&et(e.currentTarget.ownerDocument)===e.currentTarget){F.current=is(e.key,g,u)?r:i,R(e);return}is(e.key,g,u)?c?t>=i?s&&t!==n.current.length?F.current=-1:(B.current=!1,F.current=r):F.current=zn(n.current,{startingIndex:t,disabledIndices:h}):F.current=Math.min(i,zn(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?F.current=n.current.length:(B.current=!1,F.current=i):F.current=zn(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):F.current=Math.max(r,zn(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),In(n.current,F.current)&&(F.current=-1),R(e)}}),de=x.useMemo(()=>({onFocus(e){B.current=!0,se(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){B.current=!0,H.current=!1,p&&se(e)},onPointerLeave(e){if(!te.current||!L.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ne.current&&(U.current?.(),U.current=null,F.current=-1,R(e),!d)){let e=j.current,t=et(nn(e));e&&tt(e,t)&&e.focus({preventScroll:!0})}}}),[se,te,j,p,n,R,ne,d]),fe=x.useMemo(()=>d&&T&&oe&&{"aria-activedescendant":`${v}-${r}`},[d,T,oe,v,r]),pe=x.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...A?{}:fe,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&T&&!d){let t=nt(e.nativeEvent);if(t&&!tt(j.current,t))return;ve(e),w.setOpen(!1,Nt(Et,e.nativeEvent)),Ae(D)&&D.focus();return}ue(e)},onPointerMove(){L.current=!0}}),[fe,ue,j,g,A,w,T,d,D]),me=x.useMemo(()=>{function e(e){w.setOpen(!0,Nt(Ot,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&be(e.nativeEvent)&&(P.current=!d)}function n(e){P.current=f,f===`auto`&&xe(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=w.select(`open`);L.current=!1;let r=t.key.startsWith(`Arrow`),i=as(t.key,ce(),u),a=rs(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ue(t);if(!(!n&&!m&&r)){if(o){let e=rs(t.key,ce());I.current=l&&e?null:t.key}if(l){i&&(ve(t),n?(F.current=le(),R(t)):e(t));return}a&&(G.current!=null&&(F.current=G.current),ve(t),!n&&m?e(t):ue(t),n&&R(t))}},onFocus(e){w.select(`open`)&&!d&&(F.current=-1,R(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ue,f,le,l,R,w,m,g,ce,u,G,d]),he=x.useMemo(()=>({...fe,...me}),[fe,me]);return x.useMemo(()=>a?{reference:he,floating:pe,item:de,trigger:me}:{},[a,he,pe,me,de])}function cs(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=re(),m=x.useRef(``),h=x.useRef(u??i??-1),g=x.useRef(null),_=Yt(e=>{function t(e){let t=r?.current[e];return!t||Hn(t)}function c(e){return t(e)?o==null||!Bn(_t,e,o):!1}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(ve(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(ve(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=Yt(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);tt(n,t)||tt(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});V(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]),V(()=>{f&&m.current===``&&(h.current=u??i??-1)},[f,u,i]);let y=x.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return x.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var ls=.1,us=ls*ls,ds=.5;function fs(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function ps(e,t,n,r,i,a,o,s,c,l){let u=!1;return fs(e,t,n,r,i,a)&&(u=!u),fs(e,t,i,a,o,s)&&(u=!u),fs(e,t,o,s,c,l)&&(u=!u),fs(e,t,c,l,n,r)&&(u=!u),u}function ms(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function hs(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function gs(e={}){let{blockPointerEvents:t=!1}=e,n=new ne,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*us;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=nt(r),g=r.type===`mouseleave`,_=tt(u,h),v=tt(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ke(r.relatedTarget)&&tt(u,r.relatedTarget))return;function y(){return!!(s&&mr(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=hs(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=hs(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=hs(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=hs(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!ms(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?ds/2:ds*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+ds+1,o=C||T?S.bottom-ds:S.top,s=C?T?S.bottom-ds:S.top:S.bottom-ds;M=ps(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?ds/2:ds*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-ds,o=C||T?S.top+ds:S.bottom,s=C?T?S.top+ds:S.bottom:S.top+ds;M=ps(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?ds/2:ds*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+ds+1,o=w||E?S.right-ds:S.left,s=w?E?S.right-ds:S.left:S.right-ds;M=ps(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?ds/2:ds*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-ds,o=w||E?S.left+ds:S.right,s=w?E?S.left+ds:S.right:S.left+ds;M=ps(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var _s=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=ho.startingStyle]=`startingStyle`,e[e.endingStyle=ho.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),vs=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ys={[vs.popupOpen]:``},bs={[vs.popupOpen]:``,[vs.pressed]:``},xs={[_s.open]:``},Ss={[_s.closed]:``},Cs={[_s.anchorHidden]:``},ws={open(e){return e?ys:null}},Ts={open(e){return e?bs:null}},Es={open(e){return e?xs:Ss},anchorHidden(e){return e?Cs:null}};function Ds(e){return Pr(e,`base-ui`)}var Os=x.createContext(void 0),ks=x.createContext(void 0);function As(){return x.useContext(ks)?.direction??`ltr`}var js=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=gn(e,t)||{};if(l==null)return{};let f=Pn(u),p={x:n,y:r},m=Sn(i),h=bn(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=hn(k,j,A),N=!c.arrow&&vn(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Ms=(e,t)=>({...js(e),options:[e,t]}),Ns=Xa().fn,Ps={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Ns(e)).data?.referenceHidden||a}}}},Fs={sideX:`left`,sideY:`top`},Is={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Ee(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Fs};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=nn(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=_n(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Fs.sideX,g=f===`top`?`bottom`:Fs.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Ls(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Rs(e,t,n){let{rects:r,placement:i}=e;return{side:Ls(t,_n(i),n),align:vn(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function zs(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:S}=e,[C,w]=x.useState(null);!h&&C!==null&&w(null);let T=g.side||`flip`,E=g.align||`flip`,D=g.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=Yt(O),A=O?k:t,j=Wt(t),M=Wt(h),N=As()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),R=+(r===`top`),z=+(r===`right`),ee=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+ee,bottom:I+R,left:I+z}:I&&={top:(I.top||0)+L,right:(I.right||0)+ee,bottom:(I.bottom||0)+R,left:(I.left||0)+z};let B={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},H=x.useRef(null),U=Wt(i),W=Wt(o),te=typeof i==`function`?0:i,G=typeof o==`function`?0:o,ne=[];f&&ne.push(f),ne.push(Ga(e=>{let t=Rs(e,r,N),n=typeof U.current==`function`?U.current(t):U.current,i=typeof W.current==`function`?W.current(t):W.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[te,G,N,r]));let re=E===`none`&&T!==`shift`,ie=!re&&(l||_||T===`shift`),ae=T===`none`?null:Ja({...B,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),oe=re?null:Ka(e=>{let t=nn(e.elements.floating).documentElement;return{...B,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:ie,limiter:l||_?void 0:qa(e=>{if(!H.current)return{};let{width:t,height:n}=H.current.getBoundingClientRect(),r=xn(_n(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[B,l,_,I,E]);T===`shift`||E===`shift`||a===`center`?ne.push(oe,ae):ne.push(ae,oe),ne.push(Ya({...B,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=Ee(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Ms(e=>({element:H.current||nn(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=_n(a),l=xn(c),u=H.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Rs(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ie&&l===`y`&&b?S:x),{}}},Ps,y),V(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let se=x.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ce,elements:le,x:ue,y:de,middlewareData:fe,update:pe,placement:me,context:he,isPositioned:ge,floatingStyles:_e}=Wo({rootContext:m,open:p?h:void 0,placement:F,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...e)=>ja(...e,se),nodeId:v,externalTree:S}),{sideX:ve,sideY:ye}=fe.adaptiveOrigin||Fs,be=ge?n:`fixed`,xe=x.useMemo(()=>{let e=y?{position:be,[ve]:ue,[ye]:de}:{position:be,..._e};return ge||(e.opacity=0),e},[y,be,ve,ue,ye,de,_e,ge]),Se=x.useRef(null);V(()=>{if(!h)return;let e=j.current,t=typeof e==`function`?e():e,n=(Bs(t)?t.current:t)||null;n!==Se.current&&(ce.setPositionReference(n),Se.current=n)},[h,ce,A,j]),x.useEffect(()=>{if(!h)return;let e=j.current;typeof e!=`function`&&Bs(e)&&e.current!==Se.current&&(ce.setPositionReference(e.current),Se.current=e.current)},[h,ce,A,j]),x.useEffect(()=>{if(p&&h&&le.reference&&le.floating)return ja(le.reference,le.floating,pe,se)},[p,h,le,pe,se]);let Ce=_n(me),we=Ls(r,Ce,N),Te=vn(me)||`center`,De=!!fe.hide?.referenceHidden;V(()=>{b&&h&&ge&&w(Ce)},[b,h,ge,Ce]);let Oe=x.useMemo(()=>({position:`absolute`,top:fe.arrow?.y,left:fe.arrow?.x}),[fe.arrow]),ke=fe.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:xe,arrowStyles:Oe,arrowRef:H,arrowUncentered:ke,side:we,align:Te,physicalSide:Ce,anchorHidden:De,refs:ce,context:he,isPositioned:ge,update:pe}),[xe,Oe,H,ke,we,Te,Ce,De,ce,he,ge,pe])}function Bs(e){return e!=null&&`current`in e}function Vs(e){return e===`starting`?li:vt}function Hs(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ri(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vs(r),i],stateAttributesMapping:Es})}var Us=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=x.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=x.useMemo(()=>({open:t,close:n}),[t,n]);return(0,S.jsx)(Os.Provider,{value:i,children:(0,S.jsx)(Ft,{delay:a,timeoutMs:r,children:e.children})})};function Ws(e){return Ir(19)?e:e?`true`:void 0}function Gs(e){let[t,n]=x.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Ks(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ks(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function qs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ks(e))&&(r&&(r+=` `),r+=t);return r}var Js=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ys=(e,t)=>({classGroupId:e,validator:t}),Xs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Zs=`-`,Qs=[],$s=`arbitrary..`,ec=e=>{let t=rc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return nc(e);let n=e.split(Zs);return tc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Js(i,t):t:i||Qs}return n[e]||Qs}}},tc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=tc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Zs):e.slice(t).join(Zs),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},nc=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?$s+r:void 0})(),rc=e=>{let{theme:t,classGroups:n}=e;return ic(n,t)},ic=(e,t)=>{let n=Xs();for(let r in e){let i=e[r];ac(i,n,r,t)}return n},ac=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];oc(i,t,n,r)}},oc=(e,t,n,r)=>{if(typeof e==`string`){sc(e,t,n);return}if(typeof e==`function`){cc(e,t,n,r);return}lc(e,t,n,r)},sc=(e,t,n)=>{let r=e===``?t:uc(t,e);r.classGroupId=n},cc=(e,t,n,r)=>{if(dc(e)){ac(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ys(n,e))},lc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ac(o,uc(t,a),n,r)}},uc=(e,t)=>{let n=e,r=t.split(Zs),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Xs(),n.nextPart.set(t,i)),n=i}return n},dc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,fc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},pc=`!`,mc=`:`,hc=[],gc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),_c=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===mc){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(pc)?(c=s.slice(0,-1),l=!0):s.startsWith(pc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return gc(t,l,c,u)};if(t){let e=t+mc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):gc(hc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},vc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},yc=e=>({cache:fc(e.cacheSize),parseClassName:_c(e),sortModifiers:vc(e),postfixLookupClassGroupIds:bc(e),...ec(e)}),bc=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},xc=/\s+/,Sc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(xc),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+pc:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Cc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=wc(n))&&(i&&(i+=` `),i+=r);return i},wc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=wc(e[r]))&&(n&&(n+=` `),n+=t);return n},Tc=(e,...t)=>{let n,r,i,a,o=o=>(n=yc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Sc(e,n);return i(e,a),a};return a=o,(...e)=>a(Cc(...e))},Ec=[],Dc=e=>{let t=t=>t[e]||Ec;return t.isThemeGetter=!0,t},Oc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ac=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Nc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ic=e=>Ac.test(e),Lc=e=>!!e&&!Number.isNaN(Number(e)),Rc=e=>!!e&&Number.isInteger(Number(e)),zc=e=>e.endsWith(`%`)&&Lc(e.slice(0,-1)),Bc=e=>jc.test(e),Vc=()=>!0,Hc=e=>Mc.test(e)&&!Nc.test(e),Uc=()=>!1,Wc=e=>Pc.test(e),Gc=e=>Fc.test(e),Kc=e=>!Y(e)&&!X(e),qc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Jc=e=>ll(e,pl,Uc),Y=e=>Oc.test(e),Yc=e=>ll(e,ml,Hc),Xc=e=>ll(e,hl,Lc),Zc=e=>ll(e,_l,Vc),Qc=e=>ll(e,gl,Uc),$c=e=>ll(e,dl,Uc),el=e=>ll(e,fl,Gc),tl=e=>ll(e,vl,Wc),X=e=>kc.test(e),nl=e=>ul(e,ml),rl=e=>ul(e,gl),il=e=>ul(e,dl),al=e=>ul(e,pl),ol=e=>ul(e,fl),sl=e=>ul(e,vl,!0),cl=e=>ul(e,_l,!0),ll=(e,t,n)=>{let r=Oc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ul=(e,t,n=!1)=>{let r=kc.exec(e);return r?r[1]?t(r[1]):n:!1},dl=e=>e===`position`||e===`percentage`,fl=e=>e===`image`||e===`url`,pl=e=>e===`length`||e===`size`||e===`bg-size`,ml=e=>e===`length`,hl=e=>e===`number`,gl=e=>e===`family-name`,_l=e=>e===`number`||e===`weight`,vl=e=>e===`shadow`,yl=Tc(()=>{let e=Dc(`color`),t=Dc(`font`),n=Dc(`text`),r=Dc(`font-weight`),i=Dc(`tracking`),a=Dc(`leading`),o=Dc(`breakpoint`),s=Dc(`container`),c=Dc(`spacing`),l=Dc(`radius`),u=Dc(`shadow`),d=Dc(`inset-shadow`),f=Dc(`text-shadow`),p=Dc(`drop-shadow`),m=Dc(`blur`),h=Dc(`perspective`),g=Dc(`aspect`),_=Dc(`ease`),v=Dc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[Ic,`full`,`auto`,...w()],E=()=>[Rc,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Rc,X,Y]},Rc,X,Y],O=()=>[Rc,`auto`,X,Y],k=()=>[`auto`,`min`,`max`,`fr`,X,Y],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Ic,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Ic,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Ic,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,X,Y],L=()=>[...b(),il,$c,{position:[X,Y]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,al,Jc,{size:[X,Y]}],ee=()=>[zc,nl,Yc],B=()=>[``,`none`,`full`,l,X,Y],V=()=>[``,Lc,nl,Yc],H=()=>[`solid`,`dashed`,`dotted`,`double`],U=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],W=()=>[Lc,zc,il,$c],te=()=>[``,`none`,m,X,Y],G=()=>[`none`,Lc,X,Y],ne=()=>[`none`,Lc,X,Y],re=()=>[Lc,X,Y],ie=()=>[Ic,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Bc],breakpoint:[Bc],color:[Vc],container:[Bc],"drop-shadow":[Bc],ease:[`in`,`out`,`in-out`],font:[Kc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Bc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Bc],shadow:[Bc],spacing:[`px`,Lc],text:[Bc],"text-shadow":[Bc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ic,Y,X,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,X,Y]}],"container-named":[qc],columns:[{columns:[Lc,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Rc,`auto`,X,Y]}],basis:[{basis:[Ic,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Lc,Ic,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Lc,X,Y]}],shrink:[{shrink:[``,Lc,X,Y]}],order:[{order:[Rc,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,nl,Yc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,cl,Zc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,zc,Y]}],"font-family":[{font:[rl,Qc,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[Lc,`none`,X,Xc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[Lc,`from-font`,`auto`,X,Yc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Lc,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Rc,X,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Rc,X,Y],radial:[``,X,Y],conic:[Rc,X,Y]},ol,el]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Lc,X,Y]}],"outline-w":[{outline:[``,Lc,nl,Yc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,sl,tl]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,sl,tl]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Lc,Yc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,sl,tl]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Lc,X,Y]}],"mix-blend":[{"mix-blend":[...U(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Lc]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Lc]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:te()}],brightness:[{brightness:[Lc,X,Y]}],contrast:[{contrast:[Lc,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,sl,tl]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Lc,X,Y]}],"hue-rotate":[{"hue-rotate":[Lc,X,Y]}],invert:[{invert:[``,Lc,X,Y]}],saturate:[{saturate:[Lc,X,Y]}],sepia:[{sepia:[``,Lc,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Lc,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Lc,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Lc,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Lc,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Lc,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Lc,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Lc,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Lc,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Lc,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[Lc,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:G()}],"rotate-x":[{"rotate-x":G()}],"rotate-y":[{"rotate-y":G()}],"rotate-z":[{"rotate-z":G()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":[`scale-3d`],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],zoom:[{zoom:[Rc,X,Y]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Lc,nl,Yc,Xc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Z(...e){return yl(qs(e))}function bl({delay:e=0,...t}){return(0,S.jsx)(Us,{"data-slot":`tooltip-provider`,delay:e,...t})}function xl({children:e}){return(0,S.jsx)(j,{defaultTheme:`dark`,storageKey:`pockcode-theme`,children:(0,S.jsx)(bl,{children:e})})}var Sl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Cl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),wl=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Tl=e=>{let t=wl(e);return t.charAt(0).toUpperCase()+t.slice(1)},El={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`},Dl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ol=(0,x.createContext)({}),kl=()=>(0,x.useContext)(Ol),Al=(0,x.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=kl()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,x.createElement)(`svg`,{ref:c,...El,width:t??l??El.width,height:t??l??El.height,stroke:e??f,strokeWidth:m,className:Sl(`lucide`,p,i),...!a&&!Dl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,x.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),jl=(e,t)=>{let n=(0,x.forwardRef)(({className:n,...r},i)=>(0,x.createElement)(Al,{ref:i,iconNode:t,className:Sl(`lucide-${Cl(Tl(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Tl(e),n},Ml=jl(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Nl=jl(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Pl=jl(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Fl=jl(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Il=jl(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ll=jl(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Rl=jl(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zl=jl(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Bl=jl(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Vl=jl(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Hl=jl(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Ul=jl(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Wl=jl(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Gl=jl(`dock`,[[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`M6 16h12`,key:`u522kt`}]]),Kl=jl(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ql=jl(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Jl=jl(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Yl=jl(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xl=jl(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Zl=jl(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ql=jl(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),$l=jl(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),eu=jl(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),tu=jl(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),nu=jl(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ru=jl(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),iu=jl(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),au=jl(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),ou=jl(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),su=jl(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),cu=jl(`picture-in-picture-2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),lu=jl(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),uu=jl(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),du=jl(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),fu=jl(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),pu=jl(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mu=jl(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),hu=jl(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),gu=jl(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),_u=jl(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),vu=jl(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),yu=jl(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),bu=jl(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),xu=jl(`trash-2`,[[`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`}]]),Su=jl(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Cu=jl(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),wu=jl(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Tu=Object.create(null);Tu.open=`0`,Tu.close=`1`,Tu.ping=`2`,Tu.pong=`3`,Tu.message=`4`,Tu.upgrade=`5`,Tu.noop=`6`;var Eu=Object.create(null);Object.keys(Tu).forEach(e=>{Eu[Tu[e]]=e});var Du={type:`error`,data:`parser error`},Ou=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,ku=typeof ArrayBuffer==`function`,Au=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ju=({type:e,data:t},n,r)=>Ou&&t instanceof Blob?n?r(t):Mu(t,r):ku&&(t instanceof ArrayBuffer||Au(t))?n?r(t):Mu(new Blob([t]),r):r(Tu[e]+(t||``)),Mu=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Nu(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Pu;function Fu(e,t){if(Ou&&e.data instanceof Blob)return e.data.arrayBuffer().then(Nu).then(t);if(ku&&(e.data instanceof ArrayBuffer||Au(e.data)))return t(Nu(e.data));ju(e,!1,e=>{Pu||=new TextEncoder,t(Pu.encode(e))})}var Iu=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Lu=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Lu[Iu.charCodeAt(e)]=e;var Ru=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Lu[e.charCodeAt(r)],o=Lu[e.charCodeAt(r+1)],s=Lu[e.charCodeAt(r+2)],c=Lu[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},zu=typeof ArrayBuffer==`function`,Bu=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Hu(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Vu(e.substring(1),t)}:Eu[n]?e.length>1?{type:Eu[n],data:e.substring(1)}:{type:Eu[n]}:Du},Vu=(e,t)=>zu?Hu(Ru(e),t):{base64:!0,data:e},Hu=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Uu=``,Wu=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{ju(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Uu))})})},Gu=(e,t)=>{let n=e.split(Uu),r=[];for(let e=0;e<n.length;e++){let i=Bu(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Ku(){return new TransformStream({transform(e,t){Fu(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var qu;function Ju(e){return e.reduce((e,t)=>e+t.length,0)}function Yu(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Xu(e,t){qu||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Ju(n)<1)break;let e=Yu(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Ju(n)<2)break;let e=Yu(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Ju(n)<8)break;let e=Yu(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Du);break}i=a*2**32+t.getUint32(4),r=3}else{if(Ju(n)<i)break;let e=Yu(n,i);s.enqueue(Bu(a?e:qu.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Du);break}}}})}function Zu(e){if(e)return Qu(e)}function Qu(e){for(var t in Zu.prototype)e[t]=Zu.prototype[t];return e}Zu.prototype.on=Zu.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Zu.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Zu.prototype.off=Zu.prototype.removeListener=Zu.prototype.removeAllListeners=Zu.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},Zu.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Zu.prototype.emitReserved=Zu.prototype.emit,Zu.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Zu.prototype.hasListeners=function(e){return!!this.listeners(e).length};var $u=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ed=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),td=`arraybuffer`;function nd(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var rd=ed.setTimeout,id=ed.clearTimeout;function ad(e,t){t.useNativeTimers?(e.setTimeoutFn=rd.bind(ed),e.clearTimeoutFn=id.bind(ed)):(e.setTimeoutFn=ed.setTimeout.bind(ed),e.clearTimeoutFn=ed.clearTimeout.bind(ed))}var od=1.33;function sd(e){return typeof e==`string`?cd(e):Math.ceil((e.byteLength||e.size)*od)}function cd(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function ld(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ud(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function dd(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var fd=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},pd=class extends Zu{constructor(e){super(),this.writable=!1,ad(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new fd(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=Bu(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=ud(e);return t.length?`?`+t:``}},md=class extends pd{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){Gu(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Wu(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ld()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},hd=!1;try{hd=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var gd=hd;function _d(){}var vd=class extends md{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},yd=class e extends Zu{constructor(e,t,n){super(),this.createRequest=e,ad(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=nd(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=_d,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(yd.requestsCount=0,yd.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,bd);else if(typeof addEventListener==`function`){let e=`onpagehide`in ed?`pagehide`:`unload`;addEventListener(e,bd,!1)}}function bd(){for(let e in yd.requests)yd.requests.hasOwnProperty(e)&&yd.requests[e].abort()}var xd=(function(){let e=Cd({xdomain:!1});return e&&e.responseType!==null})(),Sd=class extends vd{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=xd&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new yd(Cd,this.uri(),e)}};function Cd(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||gd))return new XMLHttpRequest}catch{}if(!t)try{return new ed[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var wd=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Td=class extends pd{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=wd?{}:nd(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;ju(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&$u(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ld()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Ed=ed.WebSocket||ed.MozWebSocket,Dd={websocket:class extends Td{createSocket(e,t,n){return wd?new Ed(e,t,n):t?new Ed(e,t):new Ed(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends pd{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Xu(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Ku();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&$u(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:Sd},Od=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kd=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function Ad(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=Od.exec(e||``),a={},o=14;for(;o--;)a[kd[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=jd(a,a.path),a.queryKey=Md(a,a.query),a}function jd(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function Md(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Nd=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Pd=[];Nd&&addEventListener(`offline`,()=>{Pd.forEach(e=>e())},!1);var Fd=class e extends Zu{constructor(e,t){if(super(),this.binaryType=td,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=Ad(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Ad(t.host).host);ad(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=dd(this.opts.query)),Nd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},Pd.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=sd(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,$u(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),Nd&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Pd.indexOf(this._offlineEventListener);e!==-1&&Pd.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};Fd.protocol=4;var Id=class extends Fd{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Fd.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;Fd.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},Ld=class extends Id{constructor(e,t={}){let n=typeof e==`object`,r=n?{...e}:{...t};(!r.transports||r.transports&&typeof r.transports[0]==`string`)&&(r.transports=(r.transports||[`polling`,`websocket`,`webtransport`]).map(e=>Dd[e]).filter(e=>!!e)),super(n?r:e,r)}};Ld.protocol;function Rd(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=Ad(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var zd=typeof ArrayBuffer==`function`,Bd=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Vd=Object.prototype.toString,Hd=typeof Blob==`function`||typeof Blob<`u`&&Vd.call(Blob)===`[object BlobConstructor]`,Ud=typeof File==`function`||typeof File<`u`&&Vd.call(File)===`[object FileConstructor]`;function Wd(e){return zd&&(e instanceof ArrayBuffer||Bd(e))||Hd&&e instanceof Blob||Ud&&e instanceof File}function Gd(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Gd(e[t]))return!0;return!1}if(Wd(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return Gd(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Gd(e[t]))return!0;return!1}function Kd(e){let t=[],n=e.data,r=e;return r.data=qd(n,t),r.attachments=t.length,{packet:r,buffers:t}}function qd(e,t){if(!e)return e;if(Wd(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=qd(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=qd(e[r],t));return n}return e}function Jd(e,t){return e.data=Yd(e.data,t),delete e.attachments,e}function Yd(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Yd(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Yd(e[n],t));return e}var Xd=s({Decoder:()=>ef,Encoder:()=>$d,PacketType:()=>Qd,isPacketValid:()=>cf,protocol:()=>5}),Zd=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],Qd;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(Qd||={});var $d=class{constructor(e){this.replacer=e}encode(e){return(e.type===Qd.EVENT||e.type===Qd.ACK)&&Gd(e)?this.encodeAsBinary({type:e.type===Qd.EVENT?Qd.BINARY_EVENT:Qd.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===Qd.BINARY_EVENT||e.type===Qd.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Kd(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},ef=class e extends Zu{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===Qd.BINARY_EVENT;n||t.type===Qd.BINARY_ACK?(t.type=n?Qd.EVENT:Qd.ACK,this.reconstructor=new tf(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(Wd(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(Qd[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===Qd.BINARY_EVENT||r.type===Qd.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!rf(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case Qd.CONNECT:return of(t);case Qd.DISCONNECT:return t===void 0;case Qd.CONNECT_ERROR:return typeof t==`string`||of(t);case Qd.EVENT:case Qd.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Zd.indexOf(t[0])===-1);case Qd.ACK:case Qd.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},tf=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=Jd(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function nf(e){return typeof e==`string`}var rf=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function af(e){return e===void 0||rf(e)}function of(e){return Object.prototype.toString.call(e)===`[object Object]`}function sf(e,t){switch(e){case Qd.CONNECT:return t===void 0||of(t);case Qd.DISCONNECT:return t===void 0;case Qd.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Zd.indexOf(t[0])===-1);case Qd.ACK:return Array.isArray(t);case Qd.CONNECT_ERROR:return typeof t==`string`||of(t);default:return!1}}function cf(e){return nf(e.nsp)&&af(e.id)&&sf(e.type,e.data)}function lf(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var uf=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),df=class extends Zu{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[lf(e,`open`,this.onopen.bind(this)),lf(e,`packet`,this.onpacket.bind(this)),lf(e,`error`,this.onerror.bind(this)),lf(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(uf.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:Qd.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Qd.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Qd.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case Qd.EVENT:case Qd.BINARY_EVENT:this.onevent(e);break;case Qd.ACK:case Qd.BINARY_ACK:this.onack(e);break;case Qd.DISCONNECT:this.ondisconnect();break;case Qd.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:Qd.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Qd.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function ff(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ff.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},ff.prototype.reset=function(){this.attempts=0},ff.prototype.setMin=function(e){this.ms=e},ff.prototype.setMax=function(e){this.max=e},ff.prototype.setJitter=function(e){this.jitter=e};var pf=class extends Zu{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,ad(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new ff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||Xd;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new Ld(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=lf(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=lf(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(lf(e,`ping`,this.onping.bind(this)),lf(e,`data`,this.ondata.bind(this)),lf(e,`error`,this.onerror.bind(this)),lf(e,`close`,this.onclose.bind(this)),lf(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){$u(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new df(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},mf={};function hf(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=Rd(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=mf[i]&&a in mf[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new pf(r,t):(mf[i]||(mf[i]=new pf(r,t)),c=mf[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(hf,{Manager:pf,Socket:df,io:hf,connect:hf});function gf(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function _f({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var vf=x.createContext(null),yf=x.createContext(null);function bf(){let e=x.useContext(vf);if(e===null)throw Error(U(60));return e}function xf(){let e=x.useContext(yf);if(e===null)throw Error(U(61));return e}var Sf=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Cf={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},wf={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Tf={disabled:!1,...wf},Ef={valid(e){return e===null?null:e?{[Sf.valid]:``}:{[Sf.invalid]:``}}},Df={invalid:void 0,name:void 0,validityData:{state:Cf,errors:[],error:``,value:``,initialValue:null},setValidityData:gt,disabled:void 0,touched:wf.touched,setTouched:gt,dirty:wf.dirty,setDirty:gt,filled:wf.filled,setFilled:gt,focused:wf.focused,setFocused:gt,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Tf,markedDirtyRef:{current:!1},registerFieldControl:gt,validation:{getValidationProps:(e,t=vt)=>t,inputRef:{current:null},registerInput:gt,commit:async()=>{},change:gt}},Of=x.createContext(Df);function kf(e=!0){let t=x.useContext(Of);if(t.setValidityData===gt&&!e)throw Error(U(28));return t}function Af(e,t,n,r,i=!0,a){let{registerFieldControl:o}=kf(),s=x.useRef(null);s.current||=Symbol(),V(()=>{let c=s.current;if(!(!c||!i))return o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}),()=>{o(c,void 0)}},[e,i,r,t,a,o,n])}var jf=x.createContext({controlId:void 0,registerControlId:gt,labelId:void 0,setLabelId:gt,messageIds:[],setMessageIds:gt,getDescriptionProps:e=>e});function Mf(){return x.useContext(jf)}function Nf(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Mf(),o=Ds(t),s=n?i:void 0,c=P(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=Yt(()=>{!l.current||a===gt||(l.current=!1,a(c.current,void 0))});return V(()=>{if(a===gt)return;let e;if(n){let n=r?.current;e=ke(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var Pf=(e,t)=>Object.is(e,t);function Ff(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function If(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Ff(t,e,n))}function Lf(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Ff(e,t,n))}function Rf(e,t,n){return e.filter(e=>!Ff(t,e,n))}function zf(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Bf(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Vf(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Bf(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Hf(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return zf(e)}function Uf(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?zf(e.value):zf(e)}var Wf={id:q(e=>e.id),labelId:q(e=>e.labelId),modal:q(e=>e.modal),multiple:q(e=>e.multiple),items:q(e=>e.items),itemToStringLabel:q(e=>e.itemToStringLabel),itemToStringValue:q(e=>e.itemToStringValue),isItemEqualToValue:q(e=>e.isItemEqualToValue),value:q(e=>e.value),hasSelectedValue:q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Uf(t,r)!==``}),hasNullItemLabel:q((e,t)=>t?Vf(e.items):!1),open:q(e=>e.open),mounted:q(e=>e.mounted),forceMount:q(e=>e.forceMount),transitionStatus:q(e=>e.transitionStatus),openMethod:q(e=>e.openMethod),activeIndex:q(e=>e.activeIndex),selectedIndex:q(e=>e.selectedIndex),isActive:q((e,t)=>e.activeIndex===t),isSelected:q((e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Ff(t,e,n)):Ff(t,r,n)}),isSelectedByFocus:q((e,t)=>e.selectedIndex===t),popupProps:q(e=>e.popupProps),triggerProps:q(e=>e.triggerProps),triggerElement:q(e=>e.triggerElement),positionerElement:q(e=>e.positionerElement),listElement:q(e=>e.listElement),popupSide:q(e=>e.popupSide),scrollUpArrowVisible:q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:q(e=>e.scrollDownArrowVisible),hasScrollArrows:q(e=>e.hasScrollArrows)},Gf=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:gt,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Kf(){return x.useContext(Gf)}function qf(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Jf(e,t){let n=x.useRef(e),r=Yt(t);V(()=>{n.current!==e&&r(n.current)},[e,r]),V(()=>{n.current=e},[e])}function Yf(e){let t=x.useRef(``),n=x.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:x.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Xf(e,t){let{onClick:n,onPointerDown:r}=Yf(Yt((n,r)=>{(typeof e==`function`?e():e)||t(r||(ue?`touch`:``))}));return x.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Zf(e){let[t,n]=x.useState(null),r=Xf(e,n);return Jf(e,t=>{t&&!e&&n(null)}),x.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Qf(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function $f(e,t){return Math.max(0,e-t)}function ep(e,t){if(t<=0)return 0;let n=Qf(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function tp(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w=Pf,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=Kf(),{setDirty:O,setTouched:k,setFocused:A,validityData:j,setFilled:M,name:N,disabled:F,validation:I,validationMode:L}=kf(),R=Nf({id:t}),z=F||d,ee=N??c,[B,H]=_f({controlled:n,default:y?r??_t:r,name:`Select`,state:`value`}),[U,W]=_f({controlled:a,default:o,name:`Select`,state:`open`}),te=x.useRef([]),G=x.useRef([]),ne=x.useRef(null),re=x.useRef(null),ie=x.useRef(0),ae=x.useRef(null),oe=x.useRef([]),se=x.useRef(!1),ce=x.useRef(null),le=x.useRef(null),ue=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=x.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=mo(U),{openMethod:he,triggerProps:ge}=Zf(U),_e=P(()=>new co({id:R,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,value:B,open:U,mounted:fe,transitionStatus:me,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ve=J(_e,Wf.activeIndex),ye=J(_e,Wf.selectedIndex),be=J(_e,Wf.triggerElement),xe=J(_e,Wf.positionerElement),Se=Gs(he),Ce=he??Se??null,we=x.useMemo(()=>y?``:Uf(B,C),[y,B,C]),Te=x.useMemo(()=>y&&Array.isArray(B)?B.map(e=>Uf(e,C)):Uf(B,C),[y,B,C]);Af(Wt(_e.state.triggerElement),R,B,Yt(()=>Te),!z,c);let Ee=x.useRef(B),De=y?Array.isArray(B)&&B.length>0:B!=null&&Uf(B,C)!==``;V(()=>{B!==Ee.current&&_e.set(`forceMount`,!0)},[_e,B]),V(()=>{M(De)},[De,M]),V(function(){let e=oe.current,t;if(y){let n=Array.isArray(B)?B:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=Lf(e,r,w);t=i===-1?null:i}}else{let n=Lf(e,B,w);t=n===-1?null:n}t===null&&(le.current=null),!U&&_e.set(`selectedIndex`,t)},[De,y,U,B,oe,w,_e,le]);function Oe(e){let t=j.initialValue;return Array.isArray(e)&&Array.isArray(t)?!qf(e,t,(e,t)=>Ff(e,t,w)):e!==t}Jf(B,()=>{D(ee),O(Oe(B)),I.change(B)});let ke=Yt((e,t)=>{s?.(e,t),!t.isCanceled&&(W(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(B)))}),Ae=Yt(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null}),_?.(!1)});bo({enabled:!h,open:U,ref:ne,onComplete(){U||Ae()}}),x.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=Yt((e,t)=>{i?.(e,t),!t.isCanceled&&H(e)}),Me=Yt(()=>{let e=_e.state.listElement||ne.current;if(!e)return;let t=$f(e.scrollHeight,e.clientHeight),n=ep(e.scrollTop,t),r=n>0,i=n<t;_e.state.scrollUpArrowVisible!==r&&_e.set(`scrollUpArrowVisible`,r),_e.state.scrollDownArrowVisible!==i&&_e.set(`scrollDownArrowVisible`,i)}),Ne=Uo({open:U,onOpenChange:ke,elements:{reference:be,floating:xe}}),Pe=Ri(Ne,{enabled:!f&&!z,event:`mousedown`}),Fe=Vi(Ne),Ie=ss(Ne,{enabled:!f&&!z,listRef:te,activeIndex:ve,selectedIndex:ye,disabledIndices:_t,onNavigate(e){e===null&&!U||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Le=cs(Ne,{enabled:!f&&!z&&(U||!y),listRef:G,activeIndex:ve,selectedIndex:ye,disabledIndices:e=>gf(te.current[e]),onMatch(e){U?_e.set(`activeIndex`,e):je(oe.current[e],Nt(`none`))},onTyping(e){se.current=e}}),Re=x.useMemo(()=>{let e=Ur(Le.reference,Ie.reference,Fe.reference,Pe.reference,ge);return R&&(e.id=R),e},[Pe.reference,Le.reference,Ie.reference,Fe.reference,ge,R]),ze=x.useMemo(()=>Ur(xo,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??vt;Za(()=>{_e.update({popupProps:ze,triggerProps:Re})}),V(()=>{_e.update({id:R,modal:m,multiple:y,value:B,open:U,mounted:fe,transitionStatus:me,popupProps:ze,triggerProps:Re,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,y,B,U,fe,me,ze,Re,v,b,C,w,Ce]);let Ve=x.useMemo(()=>({store:_e,name:ee,required:p,disabled:z,readOnly:f,multiple:y,highlightItemOnHover:T,setValue:je,setOpen:ke,listRef:te,popupRef:ne,scrollHandlerRef:re,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:ie,itemProps:Be,valueRef:ae,valuesRef:oe,labelsRef:G,typingRef:se,selectionRef:ue,firstItemTextRef:ce,selectedItemTextRef:le,validation:I,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,ee,p,z,f,y,T,je,ke,Be,I,_,Me]),He=Rt(g,I.inputRef),K=y&&Array.isArray(B)&&B.length>0,Ue=y?void 0:ee,We=x.useMemo(()=>!y||!Array.isArray(B)||!ee?null:B.map(e=>{let t=Uf(e,C);return(0,S.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t,disabled:z},t)}),[y,B,l,ee,C,z]);return(0,S.jsx)(vf.Provider,{value:Ve,children:(0,S.jsxs)(yf.Provider,{value:Ne,children:[E,(0,S.jsx)(`input`,{...I.getValidationProps(z,{onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||z||f)return;let t=e.currentTarget.value,n=Nt(yt,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=oe.current.findIndex(t=>Uf(t,C).toLowerCase()===e||Hf(t,b).toLowerCase()===e);r===-1&&(r=oe.current.findIndex((t,n)=>{let r=G.current[n];return r!=null&&r.toLowerCase()===e}));let i=r===-1?void 0:oe.current[r];i!=null&&je(i,n)}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:R&&Ue==null?`${R}-hidden-input`:void 0,form:l,name:Ue,autoComplete:u,value:we,disabled:z,required:p&&!K,readOnly:f,ref:He,style:ee?on:an,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),We]})})}function np(e,t){return e??t}function rp(e){let t=e.getBoundingClientRect(),n=Ee(e);if(_e)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var ip=x.createContext(void 0);function ap(e=!1){let t=x.useContext(ip);if(t===void 0&&!e)throw Error(U(16));return t}function op(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function sp(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=x.useRef(null),s=ap(!0),c=a??s!==void 0,{props:l}=op({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=x.useCallback(()=>{let e=o.current;cp(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return V(u,[u]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Ur({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(ei(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=cp(a),l=!i&&lp(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(ei(e),a?.(e),e.target===e.currentTarget&&i&&c&&cp(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Yt(e=>{o.current=e,u()})}}function cp(e){return Ae(e)&&e.tagName===`BUTTON`}function lp(e){return!!(e?.tagName===`A`&&e?.href)}var up=2,dp=400,fp={...Ts,...Ef,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},pp=x.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=kf(),{labelId:m}=Mf(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:S,disabled:C}=bf(),w=p||C||a,T=J(h,Wf.open),E=J(h,Wf.mounted),D=J(h,Wf.value),O=J(h,Wf.triggerProps),k=J(h,Wf.positionerElement),A=J(h,Wf.listElement),j=J(h,Wf.popupSide),M=J(h,Wf.id),N=J(h,Wf.labelId),P=J(h,Wf.hasSelectedValue),F=E&&k?j:null,I=i??M,L=np(m,N);Nf({id:I});let R=Wt(k),z=x.useRef(null),{getButtonProps:ee,buttonRef:B}=sp({disabled:w,native:o}),V=Yt(e=>{h.set(`triggerElement`,e)}),H=re(),U=re(),W=re();x.useEffect(()=>{if(T)return W.start(dp,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{W.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[T,_,U,W]);let te=Ur(O,{id:I,role:`combobox`,"aria-expanded":T?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":T?A?.id??ut(k)?.id:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:w?-1:0,onFocus(e){u(!0),T&&S.current&&g(!1,Nt(yt,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){tt(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onMouseDown(e){if(T)return;let t=nn(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(tt(z.current,t)||tt(R.current,t))return;let n=rp(z.current);e.clientX>=n.left-up&&e.clientX<=n.right+up&&e.clientY>=n.top-up&&e.clientY<=n.bottom+up||g(!1,Nt(kt,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,ee),G=v.getValidationProps(w,te);G.role=`combobox`;let ne={...f,open:T,disabled:w,value:D,readOnly:y,popupSide:F,placeholder:!P};return ri(`button`,e,{ref:[t,z,B,V],state:ne,stateAttributesMapping:fp,props:G})}),mp=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=bf();return ri(`span`,e,{state:{open:J(o,Wf.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ws})}),hp=x.createContext(void 0),gp=x.forwardRef(function(e,t){let{store:n}=bf(),r=J(n,Wf.mounted),i=J(n,Wf.forceMount);return r||i?(0,S.jsx)(hp.Provider,{value:!0,children:(0,S.jsx)(vi,{ref:t,...e})}):null}),_p=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function vp(){return x.useContext(_p)}function yp(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Yt(i),o=x.useRef(0),s=P(xp).current,c=P(bp).current,[l,u]=x.useState(0),d=x.useRef(l),f=Yt((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Yt(e=>{c.delete(e),d.current+=1,u(d.current)}),m=x.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Sp).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);V(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),V(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),V(()=>()=>{n.current=[]},[n]),V(()=>()=>{r&&(r.current=[])},[r]);let h=Yt(e=>(s.add(e),()=>{s.delete(e)}));V(()=>{s.forEach(e=>e(m))},[s,m]);let g=x.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,S.jsx)(_p.Provider,{value:g,children:t})}function bp(){return new Map}function xp(){return new Set}function Sp(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var Cp=x.createContext(void 0);function wp(){let e=x.useContext(Cp);if(!e)throw Error(U(59));return e}var Tp=x.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,S.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Ep(e,t){e&&Object.assign(e.style,t)}var Dp={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Op={},kp={},Ap=``;function jp(e){if(typeof document>`u`)return!1;let t=nn(e);return Ee(t).innerWidth-t.documentElement.clientWidth>0}function Mp(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=nn(e),n=t.documentElement,r=t.body,i=Me(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Np(e){let t=nn(e),n=t.documentElement,r=t.body,i=Me(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Pp(e){let t=nn(e),n=t.documentElement,r=t.body,i=Ee(n),a=0,o=0,s=!1,c=en.create();if(he&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Op={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ap=n.style.scrollBehavior,kp={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Me(n)?n:r;if(s=Mp(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Op),Object.assign(r.style,kp),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Ap)}function d(){u(),c.request(l)}l();let f=It(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Fp=new class{lockCount=0;restore=null;timeoutLock=ne.create();timeoutUnlock=ne.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=nn(e).documentElement,n=Ee(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=gt;return}let r=ue||!jp(e);this.restore=r?Np(e):Pp(e)}};function Ip(e=!0,t=null){V(()=>{if(e)return Fp.acquire(t)},[e,t])}var Lp=20;function Rp(e,t,n,r){let[i,a]=x.useState(!1);V(()=>{if(!e||!t||n==null){a(!1);return}let r=nn(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Lp)},[e,t,n]),Ip(e&&(!t||i),r)}var zp={position:`fixed`},Bp=x.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=ui,style:_,...v}=e,{store:y,listRef:b,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=bf(),A=xf(),j=J(y,Wf.open),M=J(y,Wf.mounted),N=J(y,Wf.modal),P=J(y,Wf.value),F=J(y,Wf.openMethod),I=J(y,Wf.positionerElement),L=J(y,Wf.triggerElement),R=J(y,Wf.isItemEqualToValue),z=J(y,Wf.transitionStatus),ee=x.useRef(null),B=x.useRef(null),[H,U]=x.useState(h),W=M&&H&&F!==`touch`;!M&&H!==h&&U(h),V(()=>{M||(Wf.scrollUpArrowVisible(y.state)&&y.set(`scrollUpArrowVisible`,!1),Wf.scrollDownArrowVisible(y.state)&&y.set(`scrollDownArrowVisible`,!1))},[y,M]),x.useImperativeHandle(w,()=>W),Rp((W||N)&&j,F===`touch`,I,L);let te=zs({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??W,collisionAvoidance:g,keepMounted:!0}),G=W?`none`:te.side,ne=W?zp:te.positionerStyles,re={open:j,side:G,align:te.align,anchorHidden:te.anchorHidden};V(()=>{y.set(`popupSide`,te.side)},[y,te.side]);let ie=Hs(e,re,{styles:ne,transitionStatus:z,props:v,refs:[t,Yt(e=>{y.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ae=x.useRef(0),oe=Yt(e=>{if(e.size===0&&ae.current===0||E.current.length===0)return;let t=ae.current;if(ae.current=e.size,e.size===t)return;let n=Nt(yt);if(t!==0&&!y.state.multiple&&P!==null&&Lf(E.current,P,R)===-1){let e=D.current,t=e!=null&&Lf(E.current,e,R)!==-1?e:null;k(t,n),t===null&&(y.set(`selectedIndex`,null),T.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(P)){let e=e=>Lf(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!If(P,e,R)))&&(k(t,n),t.length===0&&(y.set(`selectedIndex`,null),T.current=null))}if(j&&W){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Ep(I,e),Ep(O.current,e)}}),se=x.useMemo(()=>({...te,side:G,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:U,scrollUpArrowRef:ee,scrollDownArrowRef:B}),[te,G,W,U]);return(0,S.jsx)(yp,{elementsRef:b,labelsRef:C,onMapChange:oe,children:(0,S.jsxs)(Cp.Provider,{value:se,children:[M&&N&&(0,S.jsx)(Tp,{inert:Ws(!j),cutout:L}),ie]})})}),Vp=`base-ui-disable-scrollbar`,Hp={className:Vp,getElement(e){return(0,S.jsx)(`style`,{nonce:e,href:Vp,precedence:`base-ui:low`,children:`.${Vp}{scrollbar-width:none}.${Vp}::-webkit-scrollbar{display:none}`})}},Up=x.createContext(void 0);function Wp(e){let t=x.useContext(Up);if(t===void 0&&!e)throw Error(U(69));return t}var Gp=`ArrowUp`,Kp=`ArrowDown`,qp=`ArrowLeft`,Jp=`ArrowRight`,Yp=`Home`,Xp=new Set([qp,Jp]),Zp=new Set([Gp,Kp]),Qp=new Set([...Xp,...Zp]),$p=new Set([...Qp,Yp,`End`]),em=x.createContext(void 0),tm={disableStyleElements:!1};function nm(){return x.useContext(em)??tm}var rm={...Es,...vo},im=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=bf(),{side:y,align:b,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T}=wp(),E=Wp(!0)!=null,D=xf(),O=As(),{nonce:k,disableStyleElements:A}=nm(),j=J(s,Wf.id),M=J(s,Wf.open),N=J(s,Wf.openMethod),P=J(s,Wf.mounted),F=J(s,Wf.popupProps),I=J(s,Wf.transitionStatus),L=J(s,Wf.triggerElement),R=J(s,Wf.positionerElement),z=J(s,Wf.listElement),ee=x.useRef(!1),B=x.useRef(!1),H=x.useRef({}),U=tn(),W=Yt(e=>{if(!R||!c.current||!B.current)return;if(ee.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=sm(R),i=cm(R.getBoundingClientRect().height,`y`,r),a=nn(R),o=Ee(R),s=o.getComputedStyle(R),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=am(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=om(e),g=0,_=null,v=!1,y=!1,b=e=>{R.style.height=`${e}px`},x=(t,n)=>{let r=Qf(t,0,f-i);r>0&&b(i+r),e.scrollTop=n,f-(i+r)<=1&&(ee.current=!0),h()},S=t?m-p:p,w=Math.min(i+S,f);if(g=w,S<=1){x(S,t?m:0);return}if(f-w>1?t?y=!0:_=0:(v=!0,n&&p<m&&(_=p-(S-(i+S-f)))),g=Math.ceil(g),g!==0&&b(g),y||_!=null){let t=om(e),n=y?t:Qf(_,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(v||g>=f-1)&&(ee.current=!0),h()});x.useImperativeHandle(g,()=>W,[W]),bo({open:M,ref:c,onComplete(){M&&l?.(!0)}});let te={open:M,transitionStatus:I,side:y,align:b};V(()=>{!R||!c.current||Object.keys(H.current).length||(H.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),V(()=>{M||C||(B.current=!1,ee.current=!1,Ep(R,H.current))},[M,C,R,c]),V(()=>{let e=c.current;if(!M||!L||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,U.request(h),e.style.removeProperty(`--transform-origin`);return}let t=dm(e);e.style.removeProperty(`--transform-origin`);try{let t=p.current;t?.isConnected||(t=!Wf.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=Ee(R),i=r.getComputedStyle(R),a=r.getComputedStyle(e),o=nn(L),c=sm(L),l=lm(L.getBoundingClientRect(),c),u=lm(R.getBoundingClientRect(),c),m=l.height,g=z||e,y=g.scrollHeight,b=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,w=am(a),E=o.documentElement.clientHeight-x-S,D=o.documentElement.clientWidth,k=E-l.bottom+m,A,j=O===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=lm(n.getBoundingClientRect(),c);A=lm(t.getBoundingClientRect(),c),j=u.left+(O===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let N=k+M+S+b,P=Math.min(E,N),F=E-x-S,I=N-P,V=D-5;R.style.left=`${Qf(j,5,V-u.width)}px`,R.style.height=`${P}px`,R.style.maxHeight=`none`,R.style.marginTop=`${x}px`,R.style.marginBottom=`${S}px`,e.style.height=`100%`;let U=om(g),W=I>=U-1;W&&(P=Math.min(E,u.height)-(I-U));let te=l.top<20||l.bottom>E-20||Math.ceil(P)+1<Math.min(y,C),G=(r.visualViewport?.scale??1)!==1&&he;if(te||G){B.current=!0,Ep(R,H.current),T(!1);return}let ne=Math.max(C,P);if(W){let e=Math.max(0,E-N);R.style.top=u.height>=F?`0`:`${e}px`,R.style.height=`${P}px`,g.scrollTop=om(g)}else R.style.bottom=`0`,g.scrollTop=I;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=Qf(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===E||P>=w)&&(ee.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,M,R,L,d,f,p,c,h,C,T,U,z,_,v,O,w]),x.useEffect(()=>{if(!C||!R||!M)return;let e=Ee(R);function t(e){u(!1,Nt(Mt,e))}return It(e,`resize`,t)},[u,C,R,M]);let G={...z?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${j}-list`},onKeyDown(e){E&&$p.has(e.key)&&e.stopPropagation()},onScroll(e){z||W(e.currentTarget)},...C&&{style:z?{height:`100%`}:Dp}},ne=ri(`div`,e,{ref:[t,c],state:te,stateAttributesMapping:rm,props:[F,G,Vs(I),{className:!z&&C?Hp.className:void 0},o]});return(0,S.jsxs)(x.Fragment,{children:[!A&&Hp.getElement(k),(0,S.jsx)(Li,{context:D,modal:!1,disabled:!P,openInteractionType:N,returnFocus:a,restoreFocus:!0,children:ne})]})});function am(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function om(e){return $f(e.scrollHeight,e.clientHeight)}function sm(e){return Oa.getScale(e)}function cm(e,t,n){return e/n[t]}function lm(e,t){return Fn({x:cm(e.x,`x`,t),y:cm(e.y,`y`,t),width:cm(e.width,`x`,t),height:cm(e.height,`y`,t)})}var um=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function dm(e){let{style:t}=e,n={};for(let[e,r]of um)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of um){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var fm=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=bf(),{alignItemWithTriggerActive:c}=wp(),l=J(o,Wf.hasScrollArrows),u=J(o,Wf.openMethod),d=J(o,Wf.multiple),f={id:`${J(o,Wf.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:Dp},className:l&&u!==`touch`?Hp.className:void 0};return ri(`div`,e,{ref:[t,Yt(e=>{o.set(`listElement`,e)})],props:[f,a]})}),pm=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function mm(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=vp(),f=x.useRef(-1),[p,m]=x.useState(a??(i===pm.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=x.useRef(null),g=x.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return V(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),V(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),{ref:g,index:p}}var hm=x.createContext(void 0);function gm(){let e=x.useContext(hm);if(!e)throw Error(U(57));return e}var _m=x.memo(x.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=x.useRef(null),d=mm({label:o,textRef:u,indexGuessBehavior:pm.GuessFromOrder}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:C,readOnly:w}=bf(),T=J(f,Wf.isActive,d.index),E=J(f,Wf.open),D=J(f,Wf.isSelected,a),O=J(f,Wf.isSelectedByFocus,d.index),k=J(f,Wf.isItemEqualToValue),A=d.index,j=A!==-1,M=x.useRef(null);V(()=>{if(!j)return;let e=v.current;return e[A]=a,()=>{delete e[A]}},[j,A,a,v]),V(()=>{if(!j)return;let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Ff(a,t,k)&&(f.set(`selectedIndex`,A),u.current&&(b.current=u.current))},[j,A,y,k,f,a,b]);let N=x.useRef(null),P=x.useRef(`mouse`),F=x.useRef(!1),{getButtonProps:I,buttonRef:L}=sp({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),R={disabled:s,selected:D,highlighted:T};function z(e){if(C||w)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[];h(D?Rf(n,a,k):[...n,a],Nt(wt,e))}else h(a,Nt(wt,e)),m(!1,Nt(wt,e))}function ee(){g.current.dragY=0}let B={role:`option`,"aria-selected":D,tabIndex:E&&T?0:-1,onKeyDown(e){N.current=e.key,f.set(`activeIndex`,A),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&P.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&be(e.nativeEvent)&&(n!==void 0||T),i=t&&!r&&!F.current;F.current=!1,!(e.type===`keydown`&&N.current===null)&&(s||e.type===`keydown`&&N.current===` `&&_.current||i||(N.current=null,z(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){P.current=e.pointerType,F.current=!0,ee()},onMouseUp(){if(ee(),s||P.current===`touch`||F.current)return;let e=!g.current.allowSelectedMouseUp&&D,t=!g.current.allowUnselectedMouseUp&&!D;e||t||(F.current=!0,M.current?.click(),F.current=!1)}},H=ri(`div`,e,{ref:[L,t,d.ref,M],state:R,props:[p,B,l,I]}),U=x.useMemo(()=>({selected:D,index:A,textRef:u,selectedByFocus:O,hasRegistered:j}),[D,A,u,O,j]);return(0,S.jsx)(hm.Provider,{value:U,children:H})})),vm=x.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=gm();return n||r?(0,S.jsx)(ym,{...e,ref:t}):null}),ym=x.memo(x.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=gm(),c=x.useRef(null),{transitionStatus:l,setMounted:u}=mo(s),d=ri(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:vo});return bo({open:s,ref:c,onComplete(){s||u(!1)}}),d})),bm=x.memo(x.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=gm(),{firstItemTextRef:o,selectedItemTextRef:s}=bf(),{render:c,className:l,style:u,...d}=e;return ri(`div`,e,{ref:[x.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:d})})),xm=x.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=bf(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=wp(),_=J(l,c?Wf.scrollUpArrowVisible:Wf.scrollDownArrowVisible),v=J(l,Wf.openMethod),y=_&&v!==`touch`,b=re(),x=c?g:h,{mounted:S,transitionStatus:C,setMounted:w}=mo(y);V(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),bo({open:y,ref:x,onComplete(){y||w(!1)}});let T=ri(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:C},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=$f(e.scrollHeight,e.clientHeight),r=ep(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=Sm(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s],stateAttributesMapping:vo});return S||o?T:null});function Sm(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?ep(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?ep(l.offsetTop+l.offsetHeight-r+i,a):a}var Cm=x.forwardRef(function(e,t){return(0,S.jsx)(xm,{...e,ref:t,direction:`down`})}),wm=x.forwardRef(function(e,t){return(0,S.jsx)(xm,{...e,ref:t,direction:`up`})});function Tm({className:e,children:t,onValueChange:n,...r}){return(0,S.jsx)(tp,{"data-slot":`select`,onValueChange:e=>{e!==null&&n?.(e)},...r,children:(0,S.jsx)(`div`,{className:Z(`relative inline-block`,e),children:t})})}function Em({className:e,size:t=`default`,children:n,...r}){return(0,S.jsxs)(pp,{"data-slot":`select-trigger`,"data-size":t,className:Z(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,S.jsx)(mp,{render:(0,S.jsx)(zl,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Dm({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,S.jsx)(gp,{children:(0,S.jsx)(Bp,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,S.jsxs)(im,{"data-slot":`select-content`,"data-align-trigger":o,className:Z(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,S.jsx)(km,{}),(0,S.jsx)(fm,{children:t}),(0,S.jsx)(Am,{})]})})})}function Om({className:e,children:t,...n}){return(0,S.jsxs)(_m,{"data-slot":`select-item`,className:Z(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,S.jsx)(bm,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,S.jsx)(vm,{render:(0,S.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,S.jsx)(Rl,{className:`pointer-events-none`})})]})}function km({className:e,...t}){return(0,S.jsx)(wm,{"data-slot":`select-scroll-up-button`,className:Z(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(Vl,{})})}function Am({className:e,...t}){return(0,S.jsx)(Cm,{"data-slot":`select-scroll-down-button`,className:Z(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(zl,{})})}var Q={chats:{create(e){return Mm(`/api/chats`,{body:JSON.stringify(e),fallbackMessage:`Unable to create chat.`,headers:{"Content-Type":`application/json`},method:`POST`})},delete(e){return Mm(`/api/chats/${e}`,{fallbackMessage:`Unable to archive chat.`,method:`DELETE`})},compact(e,t={}){return Mm(`/api/chats/${e}/compact`,{body:JSON.stringify(t),fallbackMessage:`Unable to compact chat.`,headers:{"Content-Type":`application/json`},method:`POST`})},execute(e,t){return Mm(`/api/chats/${e}/messages`,{body:JSON.stringify(t),fallbackMessage:`Unable to send message.`,headers:{"Content-Type":`application/json`},method:`POST`})},fork(e,t={}){return Mm(`/api/chats/${e}/fork`,{body:JSON.stringify(t),fallbackMessage:`Unable to fork chat.`,headers:{"Content-Type":`application/json`},method:`POST`})},interrupt(e){return Mm(`/api/chats/${e}/interrupt`,{fallbackMessage:`Unable to stop chat.`,method:`POST`})},respondToServerRequest(e,t,n){return Mm(`/api/chats/${e}/server-requests/${encodeURIComponent(t)}`,{body:JSON.stringify(n),fallbackMessage:`Unable to respond to request.`,headers:{"Content-Type":`application/json`},method:`POST`})},deleteQueuedRun(e,t){return Mm(`/api/chats/${e}/runs/${t}`,{fallbackMessage:`Unable to delete queued message.`,method:`DELETE`})},list(e){return Mm(`/api/chats${e?`?workingDirectory=${encodeURIComponent(e)}`:``}`,{fallbackMessage:`Unable to load chats.`})},listMessages(e){return Mm(`/api/chats/${e}/messages`,{fallbackMessage:`Unable to load messages.`})},refresh(e){return Mm(`/api/chats/${e}/refresh`,{fallbackMessage:`Unable to refresh chat.`,method:`POST`})},reorderQueuedRuns(e,t){return Mm(`/api/chats/${e}/runs/reorder`,{body:JSON.stringify(t),fallbackMessage:`Unable to reorder queued messages.`,headers:{"Content-Type":`application/json`},method:`POST`})},review(e,t={}){return Mm(`/api/chats/${e}/review`,{body:JSON.stringify(t),fallbackMessage:`Unable to start review.`,headers:{"Content-Type":`application/json`},method:`POST`})},steerQueuedRun(e,t){return Mm(`/api/chats/${e}/runs/${t}/steer`,{fallbackMessage:`Unable to steer queued message.`,method:`POST`})},update(e,t){return Mm(`/api/chats/${e}`,{body:JSON.stringify(t),fallbackMessage:`Unable to update chat.`,headers:{"Content-Type":`application/json`},method:`PATCH`})},updateQueuedRun(e,t,n){return Mm(`/api/chats/${e}/runs/${t}`,{body:JSON.stringify(n),fallbackMessage:`Unable to update queued message.`,headers:{"Content-Type":`application/json`},method:`PATCH`})}},schedules:{create(e){return Mm(`/api/schedules`,{body:JSON.stringify(e),fallbackMessage:`Unable to create schedule.`,headers:{"Content-Type":`application/json`},method:`POST`})},delete(e){return Mm(`/api/schedules/${e}`,{fallbackMessage:`Unable to delete schedule.`,method:`DELETE`})},get(e){return Mm(`/api/schedules/${e}`,{fallbackMessage:`Unable to load schedule.`})},list(e){return Mm(`/api/schedules${e?`?workingDirectory=${encodeURIComponent(e)}`:``}`,{fallbackMessage:`Unable to load schedules.`})},listRuns(e){return Mm(`/api/schedules/${e}/runs`,{fallbackMessage:`Unable to load schedule history.`})},update(e,t){return Mm(`/api/schedules/${e}`,{body:JSON.stringify(t),fallbackMessage:`Unable to update schedule.`,headers:{"Content-Type":`application/json`},method:`PATCH`})}},providerAccounts:{authenticate(e,t=`browser`){return Mm(`/api/provider-accounts/${e}/authenticate`,{body:JSON.stringify({mode:t}),fallbackMessage:`Unable to authenticate provider account.`,headers:{"Content-Type":`application/json`},method:`POST`})},create(e){return Mm(`/api/provider-accounts`,{body:JSON.stringify(e),fallbackMessage:`Unable to add provider account.`,headers:{"Content-Type":`application/json`},method:`POST`})},delete(e){return Mm(`/api/provider-accounts/${e}`,{fallbackMessage:`Unable to delete provider account.`,method:`DELETE`})},list(){return Mm(`/api/provider-accounts`,{fallbackMessage:`Unable to load provider accounts.`})},limits(){return Mm(`/api/provider-accounts/limits`,{fallbackMessage:`Unable to load provider limits.`})},models(e){return Mm(`/api/provider-accounts/${e}/models`,{fallbackMessage:`Unable to load provider models.`})},update(e,t){return Mm(`/api/provider-accounts/${e}`,{body:JSON.stringify(t),fallbackMessage:`Unable to update provider account.`,headers:{"Content-Type":`application/json`},method:`PATCH`})}},providers:{codexInstructions(){return Mm(`/api/providers/codex/instructions`,{fallbackMessage:`Unable to load Codex instructions.`})},list(){return Mm(`/api/providers`,{fallbackMessage:`Unable to load providers.`})},updateCodexInstructions(e){return Mm(`/api/providers/codex/instructions`,{body:JSON.stringify(e),fallbackMessage:`Unable to save Codex instructions.`,headers:{"Content-Type":`application/json`},method:`PUT`})}},plugins:{action(e,t){return Mm(`/api/plugins/${encodeURIComponent(e)}/actions/${encodeURIComponent(t)}`,{fallbackMessage:`Unable to run plugin action.`,method:`POST`})},list(){return Mm(`/api/plugins`,{fallbackMessage:`Unable to load plugins.`})},update(e,t){return Mm(`/api/plugins/${encodeURIComponent(e)}`,{body:JSON.stringify(t),fallbackMessage:`Unable to update plugin.`,headers:{"Content-Type":`application/json`},method:`PATCH`})}},mcpServers:{create(e){return Mm(`/api/mcp-servers`,{body:JSON.stringify(e),fallbackMessage:`Unable to add MCP server.`,headers:{"Content-Type":`application/json`},method:`POST`})},delete(e){return Mm(`/api/mcp-servers/${e}`,{fallbackMessage:`Unable to delete MCP server.`,method:`DELETE`})},get(e){return Mm(`/api/mcp-servers/${e}`,{fallbackMessage:`Unable to load MCP server.`})},list(){return Mm(`/api/mcp-servers`,{fallbackMessage:`Unable to load MCP servers.`})},oauthLogin(e,t){return Mm(`/api/mcp-servers/${e}/oauth-login`,{body:JSON.stringify(t),fallbackMessage:`Unable to start MCP OAuth login.`,headers:{"Content-Type":`application/json`},method:`POST`})},status(e){return Mm(`/api/mcp-servers/status?accountId=${encodeURIComponent(e)}`,{fallbackMessage:`Unable to refresh MCP status.`})},sync(e,t={}){return Mm(`/api/mcp-servers/${e}/sync`,{body:JSON.stringify(t),fallbackMessage:`Unable to sync MCP server.`,headers:{"Content-Type":`application/json`},method:`POST`})},update(e,t){return Mm(`/api/mcp-servers/${e}`,{body:JSON.stringify(t),fallbackMessage:`Unable to update MCP server.`,headers:{"Content-Type":`application/json`},method:`PATCH`})}},cloudflared:{deleteNamedTunnel(e){return Mm(`/api/cloudflared/tunnels/${encodeURIComponent(e)}`,{fallbackMessage:`Unable to delete tunnel.`,method:`DELETE`})},startTemporary(e){return Mm(`/api/cloudflared/temporary`,{body:JSON.stringify({url:e}),fallbackMessage:`Unable to start temporary tunnel.`,headers:{"Content-Type":`application/json`},method:`POST`})},status(){return Mm(`/api/cloudflared/status`,{fallbackMessage:`Unable to load cloudflared tunnels.`})},stopTemporary(e){return Mm(`/api/cloudflared/temporary/${encodeURIComponent(e)}`,{fallbackMessage:`Unable to stop temporary tunnel.`,method:`DELETE`})}},git:{commit(e,t){return jm(`/api/git/commit`,{message:t,path:e},`Unable to commit changes.`)},discard(e,t){return jm(`/api/git/discard`,{path:e,paths:t},`Unable to discard changes.`)},init(e){return jm(`/api/git/init`,{path:e},`Unable to initialize repository.`)},pull(e){return jm(`/api/git/pull`,{path:e},`Unable to pull changes.`)},push(e){return jm(`/api/git/push`,{path:e},`Unable to push changes.`)},stage(e,t){return jm(`/api/git/stage`,{path:e,paths:t},`Unable to stage changes.`)},status(e){return Mm(`/api/git/status?path=${encodeURIComponent(e)}`,{fallbackMessage:`Unable to load Git status.`})},unstage(e,t){return jm(`/api/git/unstage`,{path:e,paths:t},`Unable to unstage changes.`)}},workspaces:{deleteHistory(e){return Mm(`/api/workspaces?path=${encodeURIComponent(e)}`,{fallbackMessage:`Unable to remove workspace history.`,method:`DELETE`})},listHistory(){return Mm(`/api/workspaces`,{fallbackMessage:`Unable to load workspace history.`})},listDirectory(e,t=!1){return Mm(`/api/workspaces/directories${Pm(e,t)}`,{fallbackMessage:`Unable to list folder.`})},readTree(e,t=!1){return Mm(`/api/workspaces/tree${Pm(e,t)}`,{fallbackMessage:`Unable to open folder.`})},readResource(e){return Mm(`/api/workspaces/resource?path=${encodeURIComponent(e)}`,{fallbackMessage:`Unable to open file.`})},saveHistory(e){return Mm(`/api/workspaces`,{body:JSON.stringify({path:e}),fallbackMessage:`Unable to save workspace history.`,headers:{"Content-Type":`application/json`},method:`POST`})}}};function jm(e,t,n){return Mm(e,{body:JSON.stringify(t),fallbackMessage:n,headers:{"Content-Type":`application/json`},method:`POST`})}async function Mm(e,t){let{fallbackMessage:n,...r}=t,i=await fetch(e,r),a=await i.text(),o=null;if(a.trim())try{o=JSON.parse(a)}catch{throw Error(n)}if(!i.ok)throw Error(Nm(o)??n);return o}function Nm(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.error;return typeof t==`string`&&t.trim()?t:null}function Pm(e,t){let n=new URLSearchParams;e&&n.set(`path`,e),t&&n.set(`hidden`,`1`);let r=n.toString();return r?`?${r}`:``}function Fm(e){return JSON.stringify(e??{},null,2)}function Im(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function $(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return``;let n=e[t];return typeof n==`string`?n:``}function Lm(e){return $(e,`personality`)===`friendly`?`friendly`:`pragmatic`}function Rm(e,t){return $(e.authState,`codexHomeMode`)===`shared`?Bm(t):$(e.settings,`codexHome`)||zm(e,t)}function zm(e,t){return Vm($(t.defaultSettings,`accountsHome`)||`~/.pockcode/providers/codex/accounts`,e.id)}function Bm(e){return $(e.defaultSettings,`sharedChatHome`)||`~/.codex`}function Vm(e,t){let n=e.trim();return n.endsWith(`/`)?`${n}${t}`:`${n}/${t}`}function Hm(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return{};let n={...e};for(let e of t)delete n[e];return n}function Um(e,t){let n=JSON.parse(e||`{}`);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`${t} must be a JSON object.`);return n}function Wm(e){return new Promise(t=>window.setTimeout(t,e))}function Gm(e){let t=e?.rateLimits;if(!t)return null;let n=[{fallbackLabel:`5H`,window:t.primary},{fallbackLabel:`W`,window:t.secondary}].filter(e=>!!e.window).sort((e,t)=>qm(e)-qm(t)).map(({fallbackLabel:e,window:t})=>{let n=Jm(100-t.usedPercent);return`${Km(t.windowDurationMins,e)}: ${Math.round(n)}%`});return n.length?n.join(` | `):null}function Km(e,t){return!e||!Number.isFinite(e)?t:e>=8640?`W`:e>=60?`${Math.round(e/60)}H`:`${Math.round(e)}M`}function qm(e){return e.window.windowDurationMins&&Number.isFinite(e.window.windowDurationMins)?e.window.windowDurationMins:e.fallbackLabel===`5H`?300:10080}function Jm(e){return Math.min(100,Math.max(0,Number.isFinite(e)?e:0))}var Ym=[`accessMode`,`fileAttachment`,`folderAttachment`,`goal`,`imageAttachment`,`planMode`],Xm=`gpt-5.5`,Zm=[{description:`None`,reasoningEffort:`none`},{description:`Minimal`,reasoningEffort:`minimal`},{description:`Low`,reasoningEffort:`low`},{description:`Medium`,reasoningEffort:`medium`},{description:`High`,reasoningEffort:`high`},{description:`Extra High`,reasoningEffort:`xhigh`}],Qm=[{id:`gpt-5.5`,model:`gpt-5.5`,displayName:`GPT-5.5`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:Zm},{id:`gpt-5.4`,model:`gpt-5.4`,displayName:`GPT-5.4`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:Zm},{id:`gpt-5.4-mini`,model:`gpt-5.4-mini`,displayName:`GPT-5.4-Mini`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:Zm},{id:`gpt-5.3-codex-spark`,model:`gpt-5.3-codex-spark`,displayName:`GPT-5.3-Codex-Spark`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:Zm}],$m=[{label:`None`,value:`none`},{label:`Minimal`,value:`minimal`},{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`},{label:`Extra High`,value:`extraHigh`}],eh=[{description:`Default speed`,label:`Standard`,value:`standard`},{description:`1.5x speed, increased usage`,label:`Fast`,value:`fast`}],th=[{id:`model`,usage:`/model <name>`,description:`Switch the chat model`},{id:`fast`,usage:`/fast`,description:`Use the fast service tier`},{id:`permissions`,usage:`/permissions <ask|full>`,description:`Change access mode`},{id:`plan`,usage:`/plan [prompt]`,description:`Toggle or send in plan mode`},{id:`goal`,usage:`/goal <objective>`,description:`Attach a goal to the next turn`},{id:`review`,usage:`/review [instructions]`,description:`Start a Codex review`},{id:`compact`,usage:`/compact`,description:`Compact the current thread`},{id:`fork`,usage:`/fork`,description:`Fork the current thread`},{id:`new`,usage:`/new`,description:`Start a new chat`},{id:`status`,usage:`/status`,description:`Refresh chat status`},{id:`usage`,usage:`/usage`,description:`Open provider usage`},{id:`mcp`,usage:`/mcp`,description:`Open MCP servers`},{id:`skills`,usage:`/skills`,description:`Check Codex skills support`},{id:`plugins`,usage:`/plugins`,description:`Open plugins`},{id:`hooks`,usage:`/hooks`,description:`Check Codex hooks support`},{id:`diff`,usage:`/diff`,description:`Ask Codex for the current diff`},{id:`clear`,usage:`/clear`,description:`Clear the composer`}];function nh(e){let t=e.trim();if(!t.startsWith(`/`)||t===`/`)return null;let n=t.match(/^\/([a-zA-Z][\w-]*)(?:\s+([\s\S]*))?$/u);if(!n)return null;let r=n[1]?.toLowerCase(),i=th.find(e=>e.id===r);return i?{command:i,argument:n[2]?.trim()??``}:null}function rh(e){let t=e.trim();if(!t.startsWith(`/`))return[];let n=t.slice(1).split(/\s/u,1)[0]?.toLowerCase()??``;return th.filter(e=>e.id.startsWith(n)).slice(0,8)}function ih(e){return e===`codex`?Ym:[]}function ah(e){return e===`fullAccess`?`fullAccess`:`askForApproval`}function oh(e){return e===`codex`?Qm:[]}function sh(e,t){return e===`codex`?t===`model`?Xm:t===`permissionMode`?`askForApproval`:t===`reasoningEffort`?`medium`:t===`serviceTier`?`standard`:``:``}function ch(e,t){let n=new Map,r=e=>{let t=hh(e),r=n.get(t);n.set(t,r?gh(r,e):e)};return oh(e).forEach(r),t.forEach(r),[...n.values()]}function lh(e){return e===`none`?`none`:e===`minimal`?`minimal`:e===`low`||e===`fast`?`low`:e===`high`||e===`deep`?`high`:e===`extraHigh`||e===`extra-high`||e===`extra_high`||e===`xhigh`?`extraHigh`:`medium`}function uh(e){return e===`none`?`none`:e===`minimal`?`minimal`:e===`low`?`low`:e===`high`?`high`:e===`extraHigh`?`xhigh`:`medium`}function dh(e){return e===`none`?`None`:e===`minimal`?`Minimal`:e===`low`?`Low`:e===`high`?`High`:e===`extraHigh`?`Extra High`:`Medium`}function fh(e){return e===`fast`?`fast`:`standard`}function ph(e){return e}function mh(e){return e===`fast`?`Fast`:`Standard`}function hh(e){return(e.model||e.id).trim().toLowerCase()}function gh(e,t){return{...e,...t,defaultReasoningEffort:t.defaultReasoningEffort??e.defaultReasoningEffort,supportedReasoningEfforts:t.supportedReasoningEfforts?.length?t.supportedReasoningEfforts:e.supportedReasoningEfforts}}function _h(e){return e.length?e.some(e=>e.kind!==`image`)?`Attached context.`:`Attached image.`:``}async function vh(e,t){return Promise.all(e.map(async e=>{let n=bh(e)??e.name;return t&&e.type.startsWith(`image/`)?{dataUrl:await yh(e),id:xh(),kind:`image`,mimeType:e.type,name:e.name,path:n,size:e.size}:{id:xh(),kind:`file`,mimeType:e.type||void 0,name:e.name,path:n,size:e.size}}))}function yh(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`Unable to read file.`)),r.onload=()=>t(String(r.result??``)),r.readAsDataURL(e)})}function bh(e){return e.webkitRelativePath?.trim()||null}function xh(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function Sh(e,t,n){return{chatId:e,content:t,createdAt:new Date().toISOString(),id:`client:${xh()}`,kind:`CHAT`,metadata:{optimistic:!0},role:`USER`,sequence:Math.max(0,...n.map(e=>e.sequence))+1,status:`PENDING`}}function Ch(e){return e.role===`TOOL`||e.kind===`APPROVAL`||e.kind===`COMPACTION`||e.kind===`COMMAND_EXECUTION`||e.kind===`FILE_CHANGE`||e.kind===`REVIEW`||e.kind===`SUBAGENT_ACTIVITY`||e.kind===`USER_INPUT_PROMPT`||e.kind===`TOOL_ACTIVITY`||e.kind===`WARNING`}function wh(e,t){let n=Th($(Im(e.metadata),`serverRequestMethod`));return n.includes(`permissionsrequestapproval`)?{kind:`permissions`,result:{permissions:t?jh(e):{},scope:`turn`}}:n.endsWith(`requestuserinput`)?{kind:`userInput`,result:{answers:{}}}:{kind:`approval`,result:{decision:t?`accept`:`decline`}}}function Th(e){return e.toLowerCase().replace(/[^a-z0-9]/gu,``)}function Eh(e){return e.kind===`USER_INPUT_PROMPT`&&e.status===`PENDING`&&!!e.requestId}function Dh(e){let t=Oh(e),n=t.questions;if(!Array.isArray(n))return[kh(t)];let r=n.flatMap((e,t)=>{let n=Im(e),r=$(n,`id`)||$(n,`name`)||`question_${t+1}`,i=$(n,`question`)||$(n,`prompt`)||$(n,`label`)||$(n,`header`);return i?[{header:$(n,`header`),id:r,isSecret:n.isSecret===!0||n.is_secret===!0,options:Ah(n.options),question:i}]:[]});return r.length?r:[kh(t)]}function Oh(e){let t=Im(e);for(let e of[`arguments`,`input`,`payload`,`request`]){let n=Im(t[e]);if(Array.isArray(n.questions))return n}return t}function kh(e){return{header:``,id:$(e,`id`)||`answer`,isSecret:e.isSecret===!0||e.is_secret===!0,options:Ah(e.options),question:$(e,`question`)||$(e,`prompt`)||$(e,`message`)||`Response`}}function Ah(e){return Array.isArray(e)?e.flatMap(e=>{if(typeof e==`string`&&e.trim())return[{description:``,label:e.trim()}];let t=Im(e),n=$(t,`label`)||$(t,`value`)||$(t,`text`);return n?[{description:$(t,`description`)??``,label:n}]:[]}):[]}function jh(e){let t=Im(Im(e.rawPayload).permissions),n={},r=Im(t.network),i=Im(t.fileSystem);return Object.keys(r).length&&(n.network=r),Object.keys(i).length&&(n.fileSystem=i),n}function Mh(e){return e.match(/^- (.+)$/mu)?.[1]?.trim()??null}function Nh(e){return e.replace(/`([^`]+)`/gu,`$1`)}function Ph(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r];if(!i)break;if(i.role===`USER`){n.push({type:`message`,message:i}),r+=1;continue}let a=n.at(-1),o=a?.type===`message`?a.message:null,s=[];for(;r<e.length&&e[r]?.role!==`USER`;)s.push(e[r]),r+=1;n.push(...Fh(s,o?.role===`USER`?o:null,t&&r>=e.length))}return n}function Fh(e,t,n){let r=Hh(e,zh),i=r>=0?e[r]:null,a=Hh(e,e=>e.kind===`PLAN`&&Bh(e)),o=i??(a>=0?e[a]??null:null),s=!n&&!!(o&&Bh(o)),c=[],l=[],u=[],d=()=>{c.length&&=(u.push({type:`work`,completedAt:Wh(e),finished:s,id:`work:${c[0]?.runId??c[0]?.id??`unknown`}`,messages:[...c],startedAt:t?.createdAt??c[0]?.createdAt??null}),0)};return e.forEach((e,t)=>{if(!(s&&t===r)&&!(Gh(e)&&(!n||Kh(e)))){if(e.kind===`PLAN`){d(),u.push({type:`message`,message:e});return}c.push(e),s&&Vh(e)&&l.push(e)}}),d(),s&&i&&u.push({type:`message`,message:i}),l.length&&u.push({type:`fileChange`,id:`file-change:${l[0]?.runId??l[0]?.id??`unknown`}`,messages:l}),u}function Ih(e){return e.type===`message`?`message:${e.message.id}`:e.id}function Lh(e){let t=[];for(let n of e)n.role===`USER`&&n.status===`PENDING`&&n.runId&&!t.includes(n.runId)&&t.push(n.runId);return t}function Rh(e,t,n,r){let i=e.filter(e=>e!==t),a=i.indexOf(n);return a<0?e:(i.splice(r===`after`?a+1:a,0,t),i)}function zh(e){return e.role===`ASSISTANT`&&(e.kind===`CHAT`||e.kind===`ERROR`)}function Bh(e){return e.status===`COMPLETED`||e.status===`FAILED`}function Vh(e){return e.kind===`FILE_CHANGE`}function Hh(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function Uh(e,t){let n=Hh(e,t);return n>=0?e[n]:null}function Wh(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.completedAt||n?.createdAt)return n.completedAt??n.createdAt}return null}function Gh(e){return e.role===`ASSISTANT`&&e.status===`STREAMING`&&e.content.trim()===`Running`}function Kh(e){if(!e||!Gh(e))return!1;let t=Date.parse(e.createdAt);return Number.isFinite(t)&&Date.now()-t>6e4}function qh(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r];if(!i)break;if(!Ch(i)){n.push({type:`message`,message:i}),r+=1;continue}let a=[];for(;r<e.length&&e[r]&&Ch(e[r]);)a.push(e[r]),r+=1;let o=r<e.length;if(a.length>1&&a.every(e=>e.status!==`STREAMING`)&&(t||o)){n.push({type:`actionGroup`,id:`actions:${a[0]?.id??`unknown`}:${a.length}`,messages:a});continue}for(let e of a)n.push({type:`message`,message:e})}return n}function Jh(e,t){return e.length===1?`Edited ${e[0].path}`:`Edited ${e.length||t} files`}function Yh(e){let t=new Map;for(let n of e){let e=t.get(n.path);if(e){e.additions+=n.additions,e.deletions+=n.deletions;continue}t.set(n.path,{...n})}return[...t.values()]}function Xh(e){let t=[];for(let n of e.content.matchAll(/^`([^`]+)`[^\n]*?\+(\d+)\s+-(\d+)\s*$/gmu))t.push({path:n[1]??`unknown file`,additions:Number.parseInt(n[2]??`0`,10),deletions:Number.parseInt(n[3]??`0`,10)});if(t.length)return t;for(let n of e.content.matchAll(/^`([^`]+)`[^\n]*\n\n~~~diff\n([\s\S]*?)\n~~~/gmu)){let e=n[2]??``;t.push({path:n[1]??`unknown file`,...tg(e)})}return t}function Zh(e,t){let n=s_(o_(e.trim())),r=s_(o_(t.trim()));return!n||!r||n===r?n||e:n.startsWith(`${r}/`)?n.slice(r.length+1):e}function Qh(e,t){let n=$h(e);if(!n)return null;let r=s_(o_(n.path)),i=s_(o_(t.path));return r?r.startsWith(`/`)?r.startsWith(`${i}/`)?{...n,path:r.slice(i.length+1)}:null:{...n,path:r.replace(/^\.\//u,``)}:null}function $h(e){let t=e.trim().replace(/^<|>$/gu,``);if(!t||/^(https?:|mailto:)/iu.test(t))return null;if(/^file:/iu.test(t))try{t=decodeURIComponent(new URL(t).pathname)}catch{return null}else try{t=decodeURIComponent(t)}catch{return null}let n=t.indexOf(`#`),r=n>=0?t.slice(n):``;n>=0&&(t=t.slice(0,n));let i=t.indexOf(`?`);i>=0&&(t=t.slice(0,i));let a=r.match(/^#L?(\d+)(?:C(\d+))?$/iu),o=t.match(/^(.*):(\d+)(?::(\d+))?$/u),s=o?o[1]:t,c=eg(a?.[1]??o?.[2]),l=eg(a?.[2]??o?.[3]);return{path:s,...c?{lineNumber:c}:{},...l?{column:l}:{}}}function eg(e){if(!e)return;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function tg(e){let t=0,n=0;for(let r of e.split(/\r?\n/u))r.startsWith(`+++`)||r.startsWith(`---`)||(r.startsWith(`+`)?t+=1:r.startsWith(`-`)&&(n+=1));return{additions:t,deletions:n}}function ng(e,t,n,r=!0,i=Date.now()){let a=Date.parse(t??e[0]?.createdAt??``);if(!Number.isFinite(a))return null;let o=Date.parse(n??``),s=rg(e);return ig(Math.max(0,(r&&Number.isFinite(o)?o:r&&Number.isFinite(s)?s:i)-a))}function rg(e){let t=NaN;for(let n of e)for(let e of[n.completedAt,n.createdAt]){let n=Date.parse(e??``);Number.isFinite(n)&&(t=Number.isFinite(t)?Math.max(t,n):n)}return t}function ig(e){let t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n<=0?`${r}s`:r?`${n}m ${r}s`:`${n}m`}function ag(e){return e.type===`code`?`code:${e.language}:${e.value}`:e.type===`heading`?`heading:${e.level}:${e.text}`:e.type===`list`?`list:${e.ordered}:${e.items.join(`
10
+ `)}`:e.type===`blockquote`?`blockquote:${e.lines.join(`
11
+ `)}`:e.type===`table`?`table:${e.headers.join(`|`)}:${e.rows.map(e=>e.join(`|`)).join(`
12
+ `)}`:e.type===`hr`?`hr`:`paragraph:${e.lines.join(`
13
+ `)}`}function og(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return(t>>>0).toString(36)}function sg(e){let t=e.replace(/\r\n/g,`
14
+ `).split(`
15
+ `),n=[],r=0;for(;r<t.length;){let e=t[r]??``;if(!e.trim()){r+=1;continue}let i=e.match(/^\s*(```|~~~)\s*([\w.-]+)?\s*$/);if(i){let e=i[1],a=i[2]??``,o=[];for(r+=1;r<t.length&&!(t[r]??``).trim().startsWith(e);)o.push(t[r]??``),r+=1;r<t.length&&(r+=1),n.push({type:`code`,language:a,value:o.join(`
16
+ `)});continue}let a=e.match(/^(#{1,6})\s+(.+)$/);if(a){n.push({type:`heading`,level:a[1].length,text:a[2].trim()}),r+=1;continue}if(/^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/.test(e)){n.push({type:`hr`}),r+=1;continue}if(e.includes(`|`)&&lg(t[r+1]??``)){let i=ug(e),a=[];for(r+=2;r<t.length&&t[r]?.includes(`|`);)a.push(ug(t[r]??``)),r+=1;n.push({type:`table`,headers:i,rows:a});continue}let o=e.match(/^(\s*)([-*+]|\d+[.)])\s+(.+)$/);if(o){let e=/\d/u.test(o[2][0]??``),i=[];for(;r<t.length;){let n=(t[r]??``).match(/^(\s*)([-*+]|\d+[.)])\s+(.+)$/);if(!n||/\d/u.test(n[2][0]??``)!==e)break;i.push(n[3].trim()),r+=1}n.push({type:`list`,items:i,ordered:e});continue}if(/^\s*>\s?/.test(e)){let e=[];for(;r<t.length&&/^\s*>\s?/.test(t[r]??``);)e.push((t[r]??``).replace(/^\s*>\s?/u,``)),r+=1;n.push({type:`blockquote`,lines:e});continue}let s=[];for(;r<t.length&&t[r]?.trim();){let e=t[r]??``;if(e.match(/^\s*(```|~~~)/)||e.match(/^(#{1,6})\s+/)||e.match(/^(\s*)([-*+]|\d+[.)])\s+/)||e.match(/^\s*>\s?/))break;s.push(e),r+=1}n.push({type:`paragraph`,lines:s})}return n.length?n:[{type:`paragraph`,lines:[e]}]}function cg(e){return/^(https?:|mailto:)/iu.test(e)?e:`#`}function lg(e){return/^\s*\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)+\|?\s*$/u.test(e)}function ug(e){return e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim())}function dg(e,t,n=1,r){return e.flatMap(e=>{let i={level:n,node:e,parentId:r};return e.type!==`folder`||!t.has(e.id)?[i]:[i,...dg(e.children??[],t,n+1,e.id)]})}function fg(e,t){return`file-tree-item-${e}-${t.replace(/[^a-zA-Z0-9_-]/g,`-`)}`}function pg(){return typeof window>`u`||window.matchMedia(`(min-width: 1024px)`).matches}function mg(e,t){let n={...e};return delete n[t],n}function hg(e){return{name:a_(e.path),path:e.path,type:`directory`,children:e.entries}}function gg(e,t,n){return yg(e.path,t)?{...e,children:n}:{...e,children:e.children?.map(e=>gg(e,t,n))}}function _g(e){let t=s_(o_(e)),n=t.lastIndexOf(`/`);return n<=0?null:t.slice(0,n)}function vg(e,t){let n=s_(o_(e.trim())),r=s_(o_(t));return!n||n===r?``:n.startsWith(`${r}/`)?n.slice(r.length+1).split(`/`).filter(Boolean).at(-1)??``:n.split(`/`).filter(Boolean).at(-1)??n}function yg(e,t){return c_(e)===c_(t)}var bg=`pockcode.detachedEditor`;function xg(){return typeof window>`u`?!1:window.localStorage.getItem(bg)===`1`}function Sg(e){typeof window>`u`||window.localStorage.setItem(bg,e?`1`:`0`)}function Cg(){if(typeof window>`u`)return{chatId:null,workspaceId:null};let e=new URLSearchParams(window.location.search);return{chatId:e.get(`chat`),workspaceId:e.get(`workspace`)}}function wg(e,t){let n=new URL(window.location.href);n.searchParams.set(`workspace`,e),t?n.searchParams.set(`chat`,t):n.searchParams.delete(`chat`);let r=`${n.pathname}${n.search}${n.hash}`;r!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,r)}function Tg(){let e=new URL(window.location.href);e.searchParams.delete(`workspace`),e.searchParams.delete(`chat`);let t=`${e.pathname}${e.search}${e.hash}`;t!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,t)}function Eg(e,t){let n=t.trim().toLocaleLowerCase();return(n?e.filter(e=>Dg(e,n)):e).slice(0,400)}function Dg(e,t){return e.name.toLocaleLowerCase().includes(t)?!0:(e.children??[]).some(e=>Dg(e,t))}function Og(e){return e instanceof Error?e.message:`Failed`}async function kg(e,t){try{return $g(await Q.workspaces.readTree(e.path),t,e.id)}catch{return null}}function Ag(e){let t=e.fileTree[0]?.id;return t?[t]:[]}function jg(e){return e.selectedFileId?[e.selectedFileId]:[]}function Mg(e){let t=Im(e),n=$(t,`type`);return n?{payload:t.payload,threadId:$(t,`threadId`),type:n}:null}function Ng(e){let t=Im(e),n=$(t,`chatId`),r=$(t,`toAccountId`),i=$(t,`phase`);return!n||!r||i!==`preparing`&&i!==`syncingSource`&&i!==`hydratingTarget`&&i!==`refreshingMessages`&&i!==`completed`&&i!==`failed`?null:{chatId:n,toAccountId:r,phase:i,error:$(t,`error`)||null,fromAccountId:$(t,`fromAccountId`)||null}}function Pg(e){let t=Im(e),n=Lg(t.status);return!$(t,`id`)||!n?null:t}function Fg(e){let t=Im(e);return!$(t,`id`)||!$(t,`chatId`)||!Rg(t.role)||!zg(t.kind)||!Bg(t.status)||typeof t.content!=`string`?null:t}function Ig(e){let t=$(Im(e),`status`);return t===`QUEUED`||t===`RUNNING`?`RUNNING`:t===`COMPLETED`||t===`FAILED`||t===`CANCELLED`?`IDLE`:null}function Lg(e){return e===`IDLE`||e===`RUNNING`||e===`ARCHIVED`?e:null}function Rg(e){return e===`USER`||e===`ASSISTANT`||e===`SYSTEM`||e===`TOOL`?e:null}function zg(e){return e===`CHAT`||e===`THINKING`||e===`TOOL_ACTIVITY`||e===`COMMAND_EXECUTION`||e===`FILE_CHANGE`||e===`PLAN`||e===`APPROVAL`||e===`USER_INPUT_PROMPT`||e===`REVIEW`||e===`WARNING`||e===`COMPACTION`||e===`SUBAGENT_ACTIVITY`||e===`ERROR`?e:null}function Bg(e){return e===`PENDING`||e===`STREAMING`||e===`COMPLETED`||e===`FAILED`?e:null}function Vg(e,t,n){if(e?.accountId)return t.find(t=>t.id===e.accountId)??null;if(n){let e=t.find(e=>e.id===n);if(e)return e}return e?.providerId?t.find(t=>t.providerId===e.providerId)??null:t[0]??null}function Hg(e,t){return e?.providerId?t.filter(t=>t.providerId===e.providerId):t}function Ug(e,t){let n=e.find(e=>e.id===t.id);if(n)return[{...t,stats:t.stats??n.stats??null},...e.filter(e=>e.id!==t.id&&!Wg(e,t))];let r=e.find(e=>Wg(e,t)),i=r&&!Gg(t,r)?r:{...t,stats:t.stats??r?.stats??null};return[i,...e.filter(e=>e.id!==i.id&&e.id!==t.id&&!Wg(e,t))]}function Wg(e,t){return!!(e.externalThreadId&&t.externalThreadId&&e.providerId===t.providerId&&e.accountId===t.accountId&&e.externalThreadId===t.externalThreadId)}function Gg(e,t){if(e.status!==t.status)return e.status===`RUNNING`;let n=Date.parse(e.lastActivityAt),r=Date.parse(t.lastActivityAt);return n===r?Date.parse(e.updatedAt)>Date.parse(t.updatedAt):n>r}function Kg(e,t){return Date.parse(t.lastActivityAt)-Date.parse(e.lastActivityAt)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt)}function qg(e,t){let n=Yg(t)?e:Jg(e,t);return n.findIndex(e=>e.id===t.id)===-1?[...n,t].sort((e,t)=>e.sequence-t.sequence):n.map(e=>e.id===t.id?t:e).sort((e,t)=>e.sequence-t.sequence)}function Jg(e,t){return t.role===`USER`?e.filter(e=>!(Yg(e)&&e.content.trim()===t.content.trim())):e}function Yg(e){let t=e.metadata;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.optimistic===!0)}function Xg(e){return!!(e&&(e.additions>0||e.deletions>0))}function Zg(e){return e.trim().replace(/\s+/g,` `).slice(0,80)||`New chat`}function Qg(e){let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function $g(e,t,n){let r=n||e_(e,t),i=[n_(e,`${r}:root`)],a=i_(i);return{id:r,name:a_(e.path),branch:`main`,path:e.path,selectedFileId:a?.id??``,fileTree:i}}function e_(e,t){let n=t_(e.path),r=n,i=2;for(;t.some(e=>e.id===r);)r=`${n}-${i}`,i+=1;return r}function t_(e){return a_(e).toLocaleLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`workspace`}function n_(e,t){return e.type===`directory`?{id:t,name:e.name,path:e.path,type:`folder`,children:e.children?.map((e,n)=>n_(e,`${t}/${n}-${t_(e.name)}`))}:{content:e.content,id:t,icon:m_(e.name),name:e.name,path:e.path,type:`file`}}function r_(e,t,n){return e.map(e=>e.id===t&&e.type===`folder`?{...e,children:n}:e.children?{...e,children:r_(e.children,t,n)}:e)}function i_(e){for(let t of e){if(t.type===`file`)return t;let e=t.children?i_(t.children):null;if(e)return e}return null}function a_(e){let t=s_(o_(e));return t.split(`/`).filter(Boolean).at(-1)||t||e}function o_(e){return e.replace(/\\/g,`/`).replace(/\/+/g,`/`)}function s_(e){return e===`/`?e:e.replace(/\/+$/,``)}function c_(e){return s_(o_(e)).toLocaleLowerCase()}function l_(e,t){for(let n of e){if(n.id===t&&n.type===`file`)return n;let e=n.children?l_(n.children,t):null;if(e)return e}return null}function u_(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?u_(n.children,t):null;if(e)return e}return null}function d_(e,t){let n=c_(t);return n?f_(e,n):null}function f_(e,t,n=[]){for(let r of e){let e=[...n,r.name];if(r.type===`file`&&[e.join(`/`),e.slice(1).join(`/`),r.name].filter(Boolean).some(e=>c_(e)===t))return r;let i=r.children?f_(r.children,t,e):null;if(i)return i}return null}function p_(e,t,n=[]){for(let r of e){let e=[...n,r.name];if(r.id===t)return e;let i=r.children?p_(r.children,t,e):null;if(i)return i}return null}function m_(e){return e.endsWith(`.sh`)?`shell`:e.endsWith(`.ts`)||e.endsWith(`.tsx`)||e.endsWith(`.js`)||e.endsWith(`.jsx`)?`js`:e.endsWith(`.json`)?`json`:e.endsWith(`.md`)?`info`:e.endsWith(`.yml`)||e.endsWith(`.yaml`)||e.includes(`docker`)?`docker`:e===`Makefile`?`make`:e.endsWith(`.rs`)||e===`Cargo.toml`||e===`Cargo.lock`?`rust`:e.startsWith(`.env`)?`env`:e.includes(`git`)?`git`:`text`}function h_(e){return e.endsWith(`.tsx`)?`TypeScript React`:e.endsWith(`.ts`)?`TypeScript`:e.endsWith(`.js`)?`JavaScript`:e.endsWith(`.json`)?`JSON`:e.endsWith(`.md`)?`Markdown`:e.endsWith(`.sh`)?`Shell`:e.endsWith(`.yml`)||e.endsWith(`.yaml`)?`YAML`:e.endsWith(`.toml`)?`TOML`:e===`Makefile`?`Makefile`:`Plain Text`}function g_(e){return e.endsWith(`.tsx`)||e.endsWith(`.ts`)?`typescript`:e.endsWith(`.jsx`)||e.endsWith(`.js`)?`javascript`:e.endsWith(`.json`)?`json`:e.endsWith(`.md`)?`markdown`:e.endsWith(`.sh`)?`shell`:e.endsWith(`.yml`)||e.endsWith(`.yaml`)?`yaml`:e.endsWith(`.toml`)?`toml`:e.endsWith(`.rs`)?`rust`:e.endsWith(`.css`)?`css`:e.endsWith(`.html`)?`html`:e===`Makefile`?`makefile`:e===`.env.example`?`ini`:e===`Dockerfile`?`dockerfile`:`plaintext`}function __(e){return e.content?e.content:``}var v_=(0,x.createContext)(null),y_=(0,x.createContext)(null);function b_(){let e=(0,x.useContext)(y_);if(!e)throw Error(`useChatPane must be used within ChatPaneStateContext.`);return e}function x_(){let e=b_();return(0,S.jsx)(`footer`,{className:`px-3 pb-3`,children:(0,S.jsxs)(`div`,{className:`mx-auto rounded-lg border border-border bg-secondary p-3 shadow-inner`,children:[(0,S.jsx)(S_,{}),(0,S.jsx)(T_,{}),(0,S.jsx)(D_,{attachments:e.attachments,onRemove:e.removeAttachment}),(0,S.jsx)(`textarea`,{className:`min-h-8 w-full resize-none bg-transparent text-[13px] font-medium leading-5 text-foreground outline-none placeholder:text-muted-foreground`,placeholder:`Describe the outcome you want`,ref:e.textareaRef,value:e.draft,onChange:t=>e.setDraft(t.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),e.submit())}}),(0,S.jsx)(C_,{}),(0,S.jsx)(O_,{})]})})}function S_(){let e=b_(),t=e.actionError??e.error;return t?(0,S.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] font-medium leading-5 text-destructive`,children:t}):null}function C_(){let e=b_();return!e.slashMatches.length||!e.draft.trim().startsWith(`/`)?null:(0,S.jsx)(`div`,{className:`mb-2 max-h-56 overflow-auto rounded-md border border-border bg-popover p-1 text-foreground shadow-lg`,children:e.slashMatches.map(e=>(0,S.jsx)(w_,{command:e},e.id))})}function w_({command:e}){let t=b_(),n=`/${e.id}`,r=e.usage.includes(`<`)||e.usage.includes(`[`);return(0,S.jsxs)(`button`,{className:`grid min-h-8 w-full grid-cols-[minmax(5rem,auto)_minmax(0,1fr)] items-center gap-2 rounded-sm px-2 text-left text-[12px] hover:bg-accent`,type:`button`,onClick:()=>{t.setDraft(r?`${n} `:n),t.textareaRef.current?.focus()},children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.usage}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:e.description})]})}function T_(){let e=b_(),t=e.activeUserInputQuestion;if(!e.pendingUserInputPrompt||!t)return null;let n=e.pendingUserInputQuestions.length;return(0,S.jsxs)(`div`,{className:`mb-3 grid gap-2.5 rounded-md border border-border bg-card p-2.5 text-[12px] text-foreground`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-muted-foreground`,children:t.header||`User input`}),n>1?(0,S.jsxs)(`span`,{className:`shrink-0 text-[11px] font-medium text-muted-foreground`,children:[e.userInputStageIndex+1,`/`,n]}):null]}),(0,S.jsx)(E_,{question:t}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsx)(`button`,{className:`h-7 rounded-md border border-border px-2.5 text-[11px] font-semibold text-muted-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-45`,disabled:e.userInputStageIndex===0||e.userInputSubmitting,type:`button`,onClick:e.goToPreviousUserInputStage,children:`Back`}),(0,S.jsx)(`button`,{className:`h-7 rounded-md bg-primary px-2.5 text-[11px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:!e.canContinueUserInput||e.userInputSubmitting,type:`button`,onClick:e.goToNextUserInputStage,children:e.userInputSubmitting?`Sending`:e.userInputIsLastStage?`Submit`:`Next`})]})]})}function E_({question:e}){let t=b_(),n=t.userInputAnswerValue(e),r=t.userInputUsesFreeform(e);return(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsx)(`div`,{className:`font-medium leading-5 text-foreground`,children:e.question}),e.options.length?(0,S.jsxs)(`div`,{className:`grid gap-1.5`,children:[e.options.map(i=>(0,S.jsxs)(`button`,{className:Z(`grid min-h-9 w-full gap-0.5 rounded-md border px-2.5 py-1.5 text-left text-[11px] font-medium`,n===i.label&&!r?`border-primary bg-primary/20 text-foreground`:`border-border bg-secondary text-muted-foreground hover:bg-accent`),title:i.description,type:`button`,onClick:()=>t.chooseUserInputOption(e,i.label),children:[(0,S.jsx)(`span`,{className:`text-[12px] text-foreground`,children:i.label}),i.description?(0,S.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:i.description}):null]},i.label)),(0,S.jsx)(`button`,{className:Z(`grid min-h-9 w-full gap-0.5 rounded-md border px-2.5 py-1.5 text-left text-[11px] font-medium`,r?`border-primary bg-primary/20 text-foreground`:`border-border bg-secondary text-muted-foreground hover:bg-accent`),type:`button`,onClick:()=>t.chooseUserInputFreeform(e),children:(0,S.jsx)(`span`,{className:`text-[12px] text-foreground`,children:`Other`})})]}):null,r?(0,S.jsx)(`input`,{className:`h-8 min-w-0 rounded-md border border-border bg-background px-2 text-[12px] text-foreground outline-none focus:border-primary`,autoFocus:!0,type:e.isSecret?`password`:`text`,value:n,onChange:n=>t.updateUserInputAnswer(e.id,n.target.value,{freeform:!0}),onKeyDown:e=>{e.key===`Enter`&&t.canContinueUserInput&&!t.userInputSubmitting&&(e.preventDefault(),t.goToNextUserInputStage())}}):null]})}function D_({attachments:e,onRemove:t}){return e.length?(0,S.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:e.map(e=>(0,S.jsxs)(`button`,{className:`flex max-w-[12rem] items-center gap-1 rounded-md border border-border bg-secondary px-1.5 py-1 hover:bg-accent`,title:e.path??e.name,type:`button`,onClick:()=>t(e.id),children:[e.kind===`folder`?(0,S.jsx)(Yl,{className:`size-3.5 shrink-0`}):(0,S.jsx)(ql,{className:`size-3.5 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,S.jsx)(Cu,{className:`size-3 shrink-0`})]},e.id))}):null}function O_(){let e=b_();return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[12px] font-medium text-muted-foreground -mb-2 -mx-1 sm:gap-1.5 sm:-mx-2`,children:[(0,S.jsx)(k_,{}),e.supportsAccessMode?(0,S.jsx)(M_,{}):null,(0,S.jsx)(L_,{}),(0,S.jsx)(R_,{}),(0,S.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1 sm:gap-1.5`,children:[e.supportsModels||e.supportsReasoningEffort||e.supportsServiceTier?(0,S.jsx)(P_,{}):null,(0,S.jsx)(z_,{})]})]})}function k_(){let e=b_();return(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`button`,{"aria-expanded":e.composerMenuOpen,"aria-label":`Add context`,className:`grid size-7 shrink-0 place-items-center rounded-md text-foreground hover:bg-accent`,type:`button`,onClick:()=>e.setComposerMenuOpen(e=>!e),children:(0,S.jsx)(uu,{className:`size-4`})}),e.composerMenuOpen?(0,S.jsx)(A_,{}):null,(0,S.jsx)(`input`,{className:`hidden`,multiple:!0,ref:e.fileInputRef,type:`file`,onChange:t=>void e.attachFiles(t)}),(0,S.jsx)(`input`,{className:`hidden`,multiple:!0,ref:e.folderInputRef,type:`file`,onChange:e.attachFolder,webkitdirectory:``,directory:``})]})}function A_(){let e=b_();return(0,S.jsxs)(`div`,{className:`absolute bottom-full left-0 z-20 mb-2 w-56 rounded-md border border-border bg-popover p-1 text-foreground shadow-lg`,children:[(0,S.jsx)(j_,{disabled:!e.supportsFiles,icon:(0,S.jsx)(ql,{className:`size-3.5`}),label:`Attach files`,onClick:()=>{e.setComposerMenuOpen(!1),e.fileInputRef.current?.click()}}),(0,S.jsx)(j_,{disabled:!e.supportsFolders,icon:(0,S.jsx)(Yl,{className:`size-3.5`}),label:`Attach folder`,onClick:()=>{e.setComposerMenuOpen(!1),e.folderInputRef.current?.click()}}),(0,S.jsx)(j_,{disabled:!e.supportsGoal,icon:(0,S.jsx)(gu,{className:`size-3.5`}),label:`Goal`,onClick:e.promptForGoal}),(0,S.jsx)(j_,{disabled:!e.supportsPlanMode,icon:(0,S.jsx)(fu,{className:`size-3.5`}),label:`Plan mode`,suffix:e.planMode?`On`:null,onClick:()=>{e.setPlanMode(e=>!e),e.setComposerMenuOpen(!1)}})]})}function j_({disabled:e,icon:t,label:n,suffix:r,onClick:i}){return(0,S.jsxs)(`button`,{className:`flex h-8 w-full items-center gap-2 rounded-sm px-2 text-left text-[12px] hover:bg-accent disabled:cursor-not-allowed disabled:opacity-45`,disabled:e,type:`button`,onClick:i,children:[t,(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),r?(0,S.jsx)(`span`,{className:`text-[11px] text-info`,children:r}):null]})}function M_(){let e=b_(),t=e.accessMode===`fullAccess`;return(0,S.jsxs)(Tm,{className:`!size-7 shrink-0 lg:!w-auto`,disabled:e.sending||e.isSwitchingAccount,value:e.accessMode,onValueChange:e.changeAccessMode,children:[(0,S.jsx)(Em,{"aria-label":`Access mode`,className:Z(`!size-7 shrink-0 justify-center gap-0 !rounded-md border p-0 text-[12px] font-semibold shadow-none [&>svg:last-child]:hidden lg:!h-7 lg:!w-auto lg:gap-1.5 lg:px-2 lg:[&>svg:last-child]:block`,t?`border-warning/35 bg-warning/15 text-warning hover:bg-warning/20`:`border-success/35 bg-success/15 text-success hover:bg-success/20`),size:`sm`,title:N_(e.accessMode),children:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center justify-center gap-0 lg:justify-start lg:gap-1.5`,children:[(0,S.jsx)(gu,{className:`size-3.5 shrink-0`}),(0,S.jsx)(`span`,{className:`hidden min-w-0 truncate lg:inline`,children:N_(e.accessMode)})]})}),(0,S.jsxs)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:[(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`askForApproval`,children:`Normal access`}),(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`fullAccess`,children:`Full access`})]})]})}function N_(e){return e===`fullAccess`?`Full access`:`Normal access`}function P_(){let e=b_(),t=[e.supportsModels?e.selectedModelOption?.displayName??e.model:null,e.supportsReasoningEffort?dh(e.reasoningEffort):null,e.supportsServiceTier?mh(e.serviceTier):null].filter(Boolean).join(` / `),n=[e.supportsModels?(e.selectedModelOption?.displayName??e.model).trim().replace(/^gpt[-\s]?/iu,``):null,e.supportsReasoningEffort?{extraHigh:`XHigh`,high:`High`,low:`Low`,medium:`Med`,minimal:`Min`,none:`None`}[e.reasoningEffort]:null,e.supportsServiceTier?e.serviceTier===`fast`?`F`:`S`:null].filter(Boolean).join(` / `),r=e.sending||e.running||e.isSwitchingAccount;return(0,S.jsxs)(`div`,{className:`relative min-w-0`,ref:e.runtimeSettingsRef,children:[(0,S.jsxs)(`button`,{"aria-expanded":e.runtimeSettingsOpen,"aria-label":`Runtime settings`,className:`flex h-7 max-w-[11rem] items-center gap-1.5 rounded-md px-2 text-[12px] font-medium text-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-55 lg:max-w-[16rem]`,disabled:r,title:t,type:`button`,onClick:()=>e.setRuntimeSettingsOpen(e=>!e),children:[(0,S.jsx)(_u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate lg:hidden`,children:n}),(0,S.jsx)(`span`,{className:`hidden min-w-0 truncate lg:inline`,children:t}),(0,S.jsx)(zl,{className:Z(`size-3.5 shrink-0 text-muted-foreground transition-transform`,e.runtimeSettingsOpen&&`rotate-180`)})]}),e.runtimeSettingsOpen?(0,S.jsxs)(`div`,{className:`absolute bottom-9 right-0 z-40 w-64 overflow-hidden rounded-md border border-border bg-popover py-1 text-foreground shadow-xl`,children:[e.supportsReasoningEffort?(0,S.jsx)(F_,{icon:(0,S.jsx)(Ll,{className:`size-3.5 text-muted-foreground`}),label:`Reasoning`,children:$m.map(t=>(0,S.jsx)(I_,{selected:e.reasoningEffort===t.value,title:t.label,onClick:()=>e.changeReasoningEffort(t.value)},t.value))}):null,e.supportsModels?(0,S.jsx)(F_,{icon:(0,S.jsx)(Wl,{className:`size-3.5 text-muted-foreground`}),label:`Model`,children:e.visibleModelOptions.map(t=>(0,S.jsx)(I_,{selected:(e.model||e.selectedModelOption?.model)===t.model||e.model===t.id,title:t.displayName,onClick:()=>e.changeModel(t.model)},t.id))}):null,e.supportsServiceTier?(0,S.jsx)(F_,{icon:(0,S.jsx)(wu,{className:`size-3.5 text-muted-foreground`}),label:`Speed`,children:eh.map(t=>(0,S.jsx)(I_,{description:t.description,selected:e.serviceTier===t.value,title:t.label,onClick:()=>e.changeServiceTier(t.value)},t.value))}):null]}):null]})}function F_({children:e,icon:t,label:n}){return(0,S.jsxs)(`div`,{className:`border-t border-border first:border-t-0`,children:[(0,S.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-2 text-[11px] font-medium text-muted-foreground`,children:[t,(0,S.jsx)(`span`,{children:n})]}),(0,S.jsx)(`div`,{className:`pb-1`,children:e})]})}function I_({description:e,selected:t,title:n,onClick:r}){return(0,S.jsxs)(`button`,{className:`flex min-h-8 w-full min-w-0 items-center gap-2 px-2 text-left text-[12px] hover:bg-accent`,type:`button`,onClick:r,children:[(0,S.jsxs)(`span`,{className:`grid min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:n}),e?(0,S.jsx)(`span`,{className:`truncate text-[11px] font-normal text-muted-foreground`,children:e}):null]}),(0,S.jsx)(Rl,{className:Z(`size-3.5 shrink-0 text-info`,t?`opacity-100`:`opacity-0`)})]})}function L_(){let e=b_();return e.goalObjective?(0,S.jsxs)(`button`,{className:`flex h-7 max-w-[14rem] items-center gap-1 rounded-md border border-border bg-secondary px-2 text-[11px] text-foreground hover:bg-accent`,title:e.goalObjective,type:`button`,onClick:()=>e.setGoalObjective(null),children:[(0,S.jsx)(gu,{className:`size-3.5 shrink-0`}),(0,S.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Goal: `,e.goalObjective]}),(0,S.jsx)(Cu,{className:`size-3 shrink-0`})]}):null}function R_(){let e=b_();return e.planMode?(0,S.jsxs)(`button`,{"aria-label":`Turn off Plan mode`,className:`flex size-7 shrink-0 items-center justify-center rounded-md border border-primary/20 bg-primary/15 px-0 text-[11px] text-primary hover:bg-primary/20 lg:w-auto lg:gap-1 lg:px-2`,title:`Plan mode`,type:`button`,onClick:()=>e.setPlanMode(!1),children:[(0,S.jsx)(fu,{className:`size-3.5 shrink-0`}),(0,S.jsx)(`span`,{className:`hidden lg:inline`,children:`Plan mode`}),(0,S.jsx)(Cu,{className:`hidden size-3 shrink-0 lg:block`})]}):null}function z_(){let e=b_();return(0,S.jsx)(`button`,{className:Z(`grid size-7 shrink-0 place-items-center text-lg disabled:cursor-not-allowed disabled:opacity-45`,e.showStopAction?`rounded-full bg-foreground text-background hover:bg-foreground/90`:`rounded-md text-foreground hover:bg-accent`),"aria-label":e.showStopAction?`Stop chat`:`Send message`,disabled:e.showStopAction?!1:!e.canSend,type:`button`,onClick:()=>e.showStopAction?void e.onStopChat():void e.submit(),children:e.showStopAction?(0,S.jsx)(vu,{className:`size-3 fill-current`}):`↵`})}function B_({animateChanges:e,compact:t,content:n,openFileLink:r,scopeKey:i}){let a=(0,x.useMemo)(()=>sg(n),[n]),o=(0,x.useMemo)(()=>a.map(ag),[a]),s=V_(o,i??null,!!e);return(0,S.jsx)(`div`,{className:Z(`chat-markdown min-w-0 max-w-full`,t?`space-y-2`:`space-y-3`),children:a.map((e,n)=>(0,S.jsx)(`div`,{className:Z(`min-w-0 max-w-full`,s.has(n)&&`chat-append-enter`),children:H_(e,n,!!t,r)},`${n}:${og(o[n]??``)}`))})}function V_(e,t,n){let r=(0,x.useRef)({scopeKey:null,signatures:[]});return(0,x.useMemo)(()=>{if(!n)return new Set;let i=r.current;if(i.scopeKey!==t)return r.current={scopeKey:t,signatures:e},new Set;let a=new Set;return e.forEach((e,t)=>{i.signatures[t]!==e&&a.add(t)}),r.current={scopeKey:t,signatures:e},a},[n,t,e,e.map(og).join(`:`)])}function H_(e,t,n,r){return e.type===`code`?(0,S.jsx)(`pre`,{className:`min-w-0 max-w-full overflow-auto rounded-md border border-border bg-background p-3 font-mono text-[12px] leading-5 text-foreground ide-scrollbar`,children:(0,S.jsx)(`code`,{children:e.value})},t):e.type===`heading`?(0,S.jsx)(`h${Math.min(e.level,4)}`,{className:Z(`font-semibold text-foreground`,e.level<=2?`text-[15px]`:`text-[14px]`),children:W_(e.text,`heading-${t}`,r)},t):e.type===`list`?(0,S.jsx)(e.ordered?`ol`:`ul`,{className:Z(`grid gap-1 pl-5`,e.ordered?`list-decimal`:`list-disc`),children:e.items.map((e,n)=>(0,S.jsx)(`li`,{className:`min-w-0`,children:W_(e,`list-${t}-${n}`,r)},n))},t):e.type===`blockquote`?(0,S.jsx)(`blockquote`,{className:`min-w-0 border-l-2 border-border pl-3 text-muted-foreground`,children:U_(e.lines,`quote-${t}`,r)},t):e.type===`table`?(0,S.jsx)(`div`,{className:`min-w-0 max-w-full overflow-auto ide-scrollbar`,children:(0,S.jsxs)(`table`,{className:`w-full border-collapse text-left text-[12px]`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsx)(`tr`,{children:e.headers.map((e,n)=>(0,S.jsx)(`th`,{className:`border border-border bg-accent px-2 py-1 font-semibold text-foreground`,children:W_(e,`table-${t}-header-${n}`,r)},n))})}),(0,S.jsx)(`tbody`,{children:e.rows.map((e,n)=>(0,S.jsx)(`tr`,{children:e.map((e,i)=>(0,S.jsx)(`td`,{className:`border border-border px-2 py-1 align-top`,children:W_(e,`table-${t}-${n}-${i}`,r)},i))},n))})]})},t):e.type===`hr`?(0,S.jsx)(`hr`,{className:`border-border`},t):(0,S.jsx)(`p`,{className:Z(`min-w-0`,n?`leading-5`:`leading-6`),children:U_(e.lines,`paragraph-${t}`,r)},t)}function U_(e,t,n){return e.flatMap((e,r)=>[...r?[(0,S.jsx)(`br`,{},`${t}-br-${r}`)]:[],...W_(e,`${t}-${r}`,n)])}function W_(e,t,n){let r=[],i=/(`[^`]+`|\*\*[^*]+\*\*|__[^_]+__|\*[^*]+\*|_[^_]+_|\[[^\]]+\]\([^)]+\))/gu,a=0,o;for(;o=i.exec(e);){o.index>a&&r.push(e.slice(a,o.index));let s=o[0],c=`${t}-${r.length}`;if(s.startsWith("`"))r.push((0,S.jsx)(`code`,{className:`rounded bg-background px-1 py-0.5 font-mono text-[12px] text-foreground`,children:s.slice(1,-1)},c));else if(s.startsWith(`**`)||s.startsWith(`__`))r.push((0,S.jsx)(`strong`,{children:W_(s.slice(2,-2),`${c}-strong`,n)},c));else if(s.startsWith(`*`)||s.startsWith(`_`))r.push((0,S.jsx)(`em`,{children:W_(s.slice(1,-1),`${c}-em`,n)},c));else{let e=s.match(/^\[([^\]]+)\]\(([^)]+)\)$/u),t=e?.[2]?.trim()??``,i=cg(t);r.push((0,S.jsx)(`a`,{className:`text-info underline decoration-info/40 underline-offset-2 hover:text-info`,href:i,rel:i===`#`?void 0:`noreferrer`,target:i===`#`?void 0:`_blank`,onClick:e=>{if(n?.(t)){e.preventDefault();return}i===`#`&&e.preventDefault()},children:W_(e?.[1]??s,`${c}-link`,n)},c))}a=i.lastIndex}return a<e.length&&r.push(e.slice(a)),r}function G_(e){if(e.kind===`FILE_CHANGE`)return ql;if(e.kind===`COMMAND_EXECUTION`){let t=Mh(e.content);return t?.startsWith(`read `)||t?.startsWith(`list `)?ql:t?.startsWith(`search`)?pu:bu}return e.content.toLowerCase().startsWith(`web search`)?pu:Su}function K_(e){if(e.status===`STREAMING`){if(e.kind===`FILE_CHANGE`){let t=Xh(e);return t.length===1?`Editing ${t[0].path}`:t.length?`Editing ${t.length} files`:`Editing files`}if(e.kind===`COMMAND_EXECUTION`){let t=Mh(e.content);if(t?.startsWith(`read `)||t?.startsWith(`list `))return`Reading ${t.slice(5)}`;if(t?.startsWith(`search`)){let e=t.slice(6).trim();return e?`Searching ${e}`:`Searching code`}let n=e.content.match(/~~~sh\n([\s\S]*?)\n~~~/u)?.[1]?.split(/\r?\n/u)[0]?.trim();return n?`Running ${n}`:`Running command`}let t=Nh(e.content.split(/\r?\n/u)[0]?.trim()||`tool`).replace(/\s+(inProgress|completed|failed|declined)$/u,``).trim(),n=e.content.match(/~~~text\n([\s\S]*?)\n~~~/u)?.[1]?.split(/\r?\n/u)[0]?.trim();return t.toLowerCase().startsWith(`web search`)?n?`Searching web for ${n}`:`Searching web`:t.startsWith(`MCP tool `)?`Using ${t.slice(9)}`:t.startsWith(`Tool `)?`Using ${t.slice(5)}`:t.toLowerCase().startsWith(`image generation`)?`Generating image`:`Using ${t}`}if(e.kind===`FILE_CHANGE`){let t=Xh(e);return t.length===1?`Edited ${t[0].path}`:t.length?`Edited ${t.length} files`:`Edited files`}if(e.kind===`COMMAND_EXECUTION`){let t=Mh(e.content);if(t?.startsWith(`read `))return`Read ${t.slice(5)}`;if(t?.startsWith(`list `))return`Listed ${t.slice(5)}`;if(t?.startsWith(`search`))return`Searched code`;let n=e.content.match(/~~~sh\n([\s\S]*?)\n~~~/u)?.[1]?.split(/\r?\n/u)[0]?.trim();return n?`Ran ${n}`:`Ran command`}return Nh(e.content.split(/\r?\n/u)[0]?.trim()||`Used tool`)}function q_({animateIn:e,dragOverQueuedRunId:t,message:n,onDeleteQueuedMessage:r,onEditQueuedMessage:i,onQueuedDragEnd:a,onQueuedDragEnter:o,onQueuedDrop:s,onSteerQueuedMessage:c}){let l=(0,x.useContext)(v_);if(n.kind===`PLAN`)return(0,S.jsx)(Y_,{animateIn:e,message:n});if(Ch(n))return(0,S.jsx)(Z_,{animateIn:e,message:n});let u=n.role===`USER`,d=n.kind===`ERROR`,f=u&&n.status===`PENDING`&&!!n.runId,p=Yg(n),m=n.content||(n.status===`STREAMING`?`Running`:``),h=f&&!!s,g=f&&n.runId===t,_=n.role===`ASSISTANT`&&n.kind===`CHAT`&&n.status===`COMPLETED`;return(0,S.jsxs)(`article`,{className:Z(`grid min-w-0 gap-1`,e&&`chat-append-enter`,u&&`justify-items-end`,p&&`opacity-60 transition-opacity`,g&&`rounded-md outline outline-1 outline-primary/70`),draggable:h,onDragEnd:()=>a?.(),onDragEnter:()=>{f&&n.runId&&o?.(n.runId)},onDragOver:e=>{f&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},onDragStart:e=>{!f||!n.runId||(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.runId))},onDrop:e=>{if(!f||!n.runId)return;e.preventDefault();let t=e.dataTransfer.getData(`text/plain`);if(t){let r=e.currentTarget.getBoundingClientRect(),i=e.clientY>r.top+r.height/2?`after`:`before`;s?.(t,n.runId,i)}},children:[(0,S.jsx)(`div`,{className:Z(`min-w-0 max-w-full text-[13px] leading-6`,u?`max-w-[min(680px,100%)] rounded-md bg-muted px-3 py-2 text-foreground`:d?`w-full text-destructive`:`w-full text-foreground`),children:(0,S.jsx)(B_,{animateChanges:!u,compact:u,content:m,openFileLink:l?.openFileLink,scopeKey:n.id})}),_?(0,S.jsx)(J_,{message:n}):null,f&&n.runId?(0,S.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,S.jsx)(`span`,{className:`grid size-5 cursor-grab place-items-center rounded text-muted-foreground`,title:`Drag to reorder`,children:(0,S.jsx)(Zl,{className:`size-3.5`})}),(0,S.jsx)(`button`,{className:`rounded px-1.5 py-0.5 hover:bg-accent hover:text-foreground`,type:`button`,onClick:()=>void c?.(n.chatId,n.runId),children:`Steer`}),(0,S.jsx)(`button`,{className:`rounded px-1.5 py-0.5 hover:bg-accent hover:text-foreground`,type:`button`,onClick:()=>void i?.(n.chatId,n.runId,n.content),children:`Edit`}),(0,S.jsx)(`button`,{className:`rounded px-1.5 py-0.5 hover:bg-accent hover:text-destructive`,type:`button`,onClick:()=>void r?.(n.chatId,n.runId),children:`Delete`})]}):null]})}function J_({message:e}){let t=b_(),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(!1),o=!!e.content.trim(),s=!!e.turnId&&!t.running&&!t.isSwitchingAccount&&!t.threadAction,c=async()=>{if(o){if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e.content);else{let t=document.createElement(`textarea`);t.value=e.content,t.style.left=`-9999px`,t.style.position=`fixed`,t.style.top=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`)}finally{document.body.removeChild(t)}}r(!0),window.setTimeout(()=>r(!1),1400)}},l=async()=>{if(s){a(!0);try{await t.forkChat(e.turnId)}finally{a(!1)}}};return(0,S.jsxs)(`div`,{className:`flex min-h-6 items-center gap-1 text-[11px] font-medium text-muted-foreground`,children:[(0,S.jsxs)(`button`,{"aria-label":`Copy response`,className:`inline-flex h-6 items-center gap-1 rounded px-1.5 hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:!o,title:`Copy response`,type:`button`,onClick:()=>void c(),children:[n?(0,S.jsx)(Rl,{className:`size-3.5 text-success`}):(0,S.jsx)(Ul,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:n?`Copied`:`Copy`})]}),(0,S.jsxs)(`button`,{"aria-label":`Fork chat from this response`,className:`inline-flex h-6 items-center gap-1 rounded px-1.5 hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:!s,title:e.turnId?`Fork chat from this response`:`Fork point unavailable`,type:`button`,onClick:()=>void l(),children:[i?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(Xl,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:i?`Forking`:`Fork chat`})]})]})}function Y_({animateIn:e,message:t}){let n=b_(),[r,i]=(0,x.useState)(!1),a=(0,x.useContext)(v_),o=t.content.trim(),s=t.status===`STREAMING`,c=(0,x.useMemo)(()=>{let e=Im(t.metadata).planSteps;return Array.isArray(e)?e.map(e=>{let t=Im(e),n=$(t,`step`),r=$(t,`status`);return n?{status:r===`completed`||r===`inProgress`||r===`pending`?r:`pending`,step:n}:null}).filter(e=>!!e):[]},[t.metadata]),l=c.length?`Updated Plan`:`Plan`,u=!s&&t.status===`COMPLETED`&&!!o&&!c.length,d=r||n.sending||n.running||n.isSwitchingAccount||!!n.threadAction,f=async()=>{if(!d){i(!0);try{await n.acceptPlan()}catch{}finally{i(!1)}}};return(0,S.jsxs)(`article`,{className:Z(`min-w-0 rounded-md border border-border bg-card p-3 text-[13px] text-foreground`,e&&`chat-append-enter`),children:[(0,S.jsxs)(`div`,{className:`mb-2 flex min-h-6 items-center gap-2 text-[12px] font-semibold text-muted-foreground`,children:[s?(0,S.jsx)(eu,{className:`size-3.5 shrink-0 animate-spin text-info`}):(0,S.jsx)(fu,{className:`size-3.5 shrink-0 text-info`}),(0,S.jsx)(`span`,{children:l})]}),o?(0,S.jsx)(B_,{animateChanges:s,content:o,openFileLink:a?.openFileLink,scopeKey:t.id}):c.length?null:(0,S.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:`Planning`}),c.length?(0,S.jsx)(`div`,{className:Z(`grid gap-1.5`,o&&`mt-3`),children:c.map((e,t)=>(0,S.jsx)(X_,{step:e},`${e.status}:${t}:${e.step}`))}):null,u?(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border pt-3`,children:[(0,S.jsxs)(`button`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-2.5 text-[12px] font-semibold text-primary-foreground hover:bg-primary/80 disabled:cursor-not-allowed disabled:opacity-45`,disabled:d,title:`Switch to Default mode and implement this plan`,type:`button`,onClick:()=>void f(),children:[r?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(Rl,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:r?`Accepting`:`Accept plan`})]}),(0,S.jsxs)(`button`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-secondary px-2.5 text-[12px] font-semibold text-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-45`,disabled:d,title:`Stay in Plan mode and revise with your next message`,type:`button`,onClick:n.keepPlanning,children:[(0,S.jsx)(su,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:`Keep planning`})]})]}):null]})}function X_({step:e}){let t=e.status===`completed`,n=e.status===`inProgress`;return(0,S.jsxs)(`div`,{className:Z(`grid grid-cols-[1rem_minmax(0,1fr)] items-start gap-2 text-[12px] leading-5`,t?`text-muted-foreground`:`text-foreground`),children:[(0,S.jsx)(`span`,{className:`mt-0.5 grid size-4 place-items-center`,children:t?(0,S.jsx)(Rl,{className:`size-3.5 text-success`}):n?(0,S.jsx)(eu,{className:`size-3.5 animate-spin text-info`}):(0,S.jsx)(vu,{className:`size-3 text-muted-foreground`})}),(0,S.jsx)(`span`,{className:Z(`min-w-0`,t&&`line-through decoration-muted-foreground/70`),children:e.step})]})}function Z_({animateIn:e,message:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=(0,x.useContext)(v_),s=G_(t),c=K_(t),l=t.kind===`FILE_CHANGE`?Xh(t):[],u=t.kind===`FILE_CHANGE`?null:t.kind===`COMMAND_EXECUTION`?(()=>{let e=Mh(t.content);if(e?.startsWith(`read `)||e?.startsWith(`list `)||e?.startsWith(`search`))return null;let n=t.content.match(/(?:^|\n)Output\s*\n~~~([\w.-]*)\n([\s\S]*?)\n~~~/u),r=n?.[1]?.trim()||`text`,i=n?.[2]?.trim();return i?`~~~${r}\n${i}\n~~~`:t.content.trim()||null})():t.content.trim()||null,d=t.kind===`FILE_CHANGE`||!!u,f=t.status===`PENDING`&&!!t.requestId&&t.kind===`APPROVAL`,p=async e=>{if(t.requestId){a(e?`approve`:`deny`);try{await Q.chats.respondToServerRequest(t.chatId,t.requestId,wh(t,e))}finally{a(null)}}};return(0,S.jsxs)(`article`,{className:Z(`min-w-0 text-[13px] text-muted-foreground`,e&&`chat-append-enter`),children:[(0,S.jsxs)(`div`,{className:`flex min-h-7 max-w-full items-center gap-2`,children:[(0,S.jsxs)(`button`,{className:Z(`flex min-w-0 flex-1 items-center gap-2 text-left`,d&&`hover:text-foreground`,!d&&`cursor-default`),disabled:!d,type:`button`,onClick:()=>{d&&r(e=>!e)},children:[(0,S.jsx)(s,{className:`size-3.5 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c}),d?(0,S.jsx)(Bl,{className:Z(`size-3.5 shrink-0 transition-transform`,n&&`rotate-90`)}):null]}),f?(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,S.jsx)(`button`,{className:`rounded px-1.5 py-0.5 text-[11px] text-success hover:bg-success/10 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!!i,type:`button`,onClick:()=>void p(!0),children:i===`approve`?`Approving`:`Approve`}),(0,S.jsx)(`button`,{className:`rounded px-1.5 py-0.5 text-[11px] text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!!i,type:`button`,onClick:()=>void p(!1),children:i===`deny`?`Denying`:`Deny`})]}):null]}),n&&d?(0,S.jsx)(`div`,{className:`ml-5 mt-1 min-w-0 border-l border-border pl-3 text-foreground`,children:t.kind===`FILE_CHANGE`?(0,S.jsx)(Q_,{changes:l,fallbackCount:1}):(0,S.jsx)(B_,{compact:!0,content:u||c,openFileLink:o?.openFileLink})}):null]})}function Q_({changes:e,fallbackCount:t}){return e.length?(0,S.jsx)(`div`,{className:`grid gap-1.5`,children:e.map((e,t)=>(0,S.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 text-[12px]`,children:[(0,S.jsx)(`span`,{className:`truncate text-foreground`,children:e.path}),(0,S.jsxs)(`span`,{className:`text-diff-addition-foreground`,children:[`+`,e.additions,` `,(0,S.jsxs)(`span`,{className:`text-diff-deletion-foreground`,children:[`-`,e.deletions]})]})]},`${e.path}:${t}`))}):(0,S.jsxs)(`div`,{className:`text-[12px] text-muted-foreground`,children:[`Edited `,t,` files`]})}function $_(e,t,n=!0){let r=(0,x.useRef)({scopeKey:null,seenIds:new Set});return(0,x.useMemo)(()=>{if(!n)return new Set;let i=r.current;if(i.scopeKey!==t)return r.current={scopeKey:t,seenIds:new Set(e)},new Set;let a=new Set(e.filter(e=>!i.seenIds.has(e)));for(let t of e)i.seenIds.add(t);return a},[n,e.join(``),t])}function ev({messages:e}){let t=Uh(e,e=>Ch(e)&&e.status===`STREAMING`),n=t?G_(t):eu,r=t?K_(t):`Thinking`;return(0,S.jsxs)(`div`,{className:`chat-append-enter flex min-h-7 max-w-full items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,S.jsx)(n,{className:Z(`size-3.5 shrink-0`,t?``:`animate-spin`)}),(0,S.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r,(0,S.jsx)(tv,{})]})]})}function tv(){return(0,S.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex w-4`,children:[(0,S.jsx)(`span`,{className:`chat-status-dot`,children:`.`}),(0,S.jsx)(`span`,{className:`chat-status-dot`,children:`.`}),(0,S.jsx)(`span`,{className:`chat-status-dot`,children:`.`})]})}function nv({animateIn:e,completedAt:t,dragOverQueuedRunId:n,finished:r,messages:i,startedAt:a,onDeleteQueuedMessage:o,onEditQueuedMessage:s,onQueuedDragEnd:c,onQueuedDragEnter:l,onQueuedDrop:u,onSteerQueuedMessage:d}){let[f,p]=(0,x.useState)(!r),m=(0,x.useMemo)(()=>i.filter(e=>!Gh(e)),[i]),h=(0,x.useMemo)(()=>qh(m,r),[r,m]),g=$_((0,x.useMemo)(()=>m.map(e=>e.id),[m]),m[0]?.runId??m[0]?.id??i[0]?.runId??i[0]?.id??null,!r&&f),[_,v]=(0,x.useState)(()=>Date.now()),y=ng(i,a,t,r,_);return(0,x.useEffect)(()=>{p(!r)},[r]),(0,x.useEffect)(()=>{if(r)return;v(Date.now());let e=window.setInterval(()=>v(Date.now()),1e3);return()=>window.clearInterval(e)},[r]),(0,S.jsxs)(`section`,{className:Z(`min-w-0 text-[13px] text-muted-foreground`,e&&`chat-append-enter`),children:[(0,S.jsxs)(`button`,{className:`flex h-6 max-w-full items-center gap-1.5 text-left font-medium hover:text-foreground`,type:`button`,onClick:()=>{r&&p(e=>!e)},children:[(0,S.jsx)(Bl,{className:Z(`size-3.5 shrink-0 transition-transform`,f&&`rotate-90`)}),(0,S.jsx)(`span`,{className:`truncate`,children:y?`Worked for ${y}`:`Worked`})]}),f?(0,S.jsxs)(`div`,{className:`mt-2 grid gap-3`,children:[h.map(e=>e.type===`actionGroup`?(0,S.jsx)(rv,{animateIn:e.messages.some(e=>g.has(e.id)),dragOverQueuedRunId:n,messages:e.messages,onDeleteQueuedMessage:o,onEditQueuedMessage:s,onQueuedDragEnd:c,onQueuedDragEnter:l,onQueuedDrop:u,onSteerQueuedMessage:d},e.id):(0,S.jsx)(q_,{animateIn:g.has(e.message.id),dragOverQueuedRunId:n,message:e.message,onDeleteQueuedMessage:o,onEditQueuedMessage:s,onQueuedDragEnd:c,onQueuedDragEnter:l,onQueuedDrop:u,onSteerQueuedMessage:d},e.message.id)),r?null:(0,S.jsx)(ev,{messages:i})]}):null]})}function rv({animateIn:e,dragOverQueuedRunId:t,messages:n,onDeleteQueuedMessage:r,onEditQueuedMessage:i,onQueuedDragEnd:a,onQueuedDragEnter:o,onQueuedDrop:s,onSteerQueuedMessage:c}){let[l,u]=(0,x.useState)(!1),d=n.find(Ch),f=d?G_(d):Su,p=(0,x.useMemo)(()=>{let e=n.reduce((e,t)=>{if(t.kind===`FILE_CHANGE`)return e.edits+=Math.max(1,Xh(t).length),e;if(t.kind===`COMMAND_EXECUTION`){let n=Mh(t.content);return n?.startsWith(`read `)||n?.startsWith(`list `)?(e.reads+=1,e):n?.startsWith(`search`)?(e.searches+=1,e):(e.commands+=1,e)}return Ch(t)&&(e.tools+=1),e},{commands:0,edits:0,reads:0,searches:0,tools:0}),t=[e.reads?`Read ${e.reads} ${e.reads===1?`file`:`files`}`:``,e.searches?e.searches===1?`searched code`:`searched code ${e.searches} times`:``,e.commands?`ran ${e.commands===1?`a command`:`${e.commands} commands`}`:``,e.edits?`edited ${e.edits===1?`a file`:`${e.edits} files`}`:``,e.tools?`used ${e.tools===1?`a tool`:`${e.tools} tools`}`:``].filter(Boolean);return t.length?t.length===1?t[0]??`Completed actions`:`${t.slice(0,-1).join(`, `)} and ${t.at(-1)}`:`Completed actions`},[n]);return(0,S.jsxs)(`article`,{className:Z(`min-w-0 text-[13px] text-muted-foreground`,e&&`chat-append-enter`),children:[(0,S.jsxs)(`button`,{className:`flex min-h-7 max-w-full items-center gap-2 text-left hover:text-foreground`,type:`button`,onClick:()=>u(e=>!e),children:[(0,S.jsx)(f,{className:`size-3.5 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p}),(0,S.jsx)(Bl,{className:Z(`size-3.5 shrink-0 transition-transform`,l&&`rotate-90`)})]}),l?(0,S.jsx)(`div`,{className:`ml-5 mt-1 grid gap-2 border-l border-border pl-3`,children:n.map(e=>(0,S.jsx)(q_,{dragOverQueuedRunId:t,message:e,onDeleteQueuedMessage:r,onEditQueuedMessage:i,onQueuedDragEnd:a,onQueuedDragEnter:o,onQueuedDrop:s,onSteerQueuedMessage:c},e.id))}):null]})}function iv({animateIn:e,messages:t,workspacePath:n}){let[r,i]=(0,x.useState)(!1),a=Yh(t.flatMap(Xh).map(e=>({...e,path:Zh(e.path,n)}))),o=r?a:a.slice(0,3),s=Math.max(0,a.length-o.length),c=a.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0});return(0,S.jsxs)(`section`,{className:Z(`min-w-0 rounded-lg border border-border bg-card p-3 text-[13px]`,e&&`chat-append-enter`),children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,S.jsx)(ql,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-semibold text-foreground`,children:Jh(a,t.length)}),(0,S.jsxs)(`div`,{className:`mt-0.5 text-[12px] text-diff-addition-foreground`,children:[`+`,c.additions,` `,(0,S.jsxs)(`span`,{className:`text-diff-deletion-foreground`,children:[`-`,c.deletions]})]})]})]}),a.length>1?(0,S.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-border pt-3`,children:[o.map((e,t)=>(0,S.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 text-[12px]`,children:[(0,S.jsx)(`span`,{className:`truncate text-foreground`,children:e.path}),(0,S.jsxs)(`span`,{className:`text-diff-addition-foreground`,children:[`+`,e.additions,` `,(0,S.jsxs)(`span`,{className:`text-diff-deletion-foreground`,children:[`-`,e.deletions]})]})]},`${e.path}:${t}`)),a.length>3?(0,S.jsxs)(`button`,{className:`mt-1 flex h-6 w-fit items-center gap-1 text-[12px] font-medium text-muted-foreground hover:text-foreground`,type:`button`,onClick:()=>i(e=>!e),children:[(0,S.jsx)(zl,{className:Z(`size-3.5 transition-transform`,r&&`rotate-180`)}),r?`Collapse files`:`Show ${s} more ${s===1?`file`:`files`}`]}):null]}):null]})}function av(){let e=b_();return(0,S.jsx)(`div`,{className:`min-h-0 overflow-auto px-4 py-4 ide-scrollbar`,ref:e.scrollRef,children:(e.isLoading||e.isMessagesLoading)&&!e.messages.length?(0,S.jsx)(ov,{}):e.renderEntries.length?(0,S.jsx)(`div`,{className:`mx-auto grid w-full max-w-3xl gap-3`,children:e.renderEntries.map(e=>(0,S.jsx)(sv,{entry:e},Ih(e)))}):(0,S.jsx)(`div`,{className:`grid h-full place-items-center text-[13px] text-muted-foreground`,children:e.accounts.length?`New chat`:`Connect a provider`})})}function ov(){return(0,S.jsx)(`div`,{className:`grid h-full place-items-center text-[13px] text-muted-foreground`,children:(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(eu,{className:`size-4 animate-spin text-info`}),`Loading`]})})}function sv({entry:e}){let t=b_(),n=Ih(e),r=t.appendedEntryIds.has(n);return e.type===`work`?(0,S.jsx)(nv,{animateIn:r,completedAt:e.completedAt,dragOverQueuedRunId:t.dragOverQueuedRunId,finished:e.finished,messages:e.messages,startedAt:e.startedAt,onDeleteQueuedMessage:t.onDeleteQueuedMessage,onEditQueuedMessage:t.onEditQueuedMessage,onQueuedDragEnd:()=>t.setDragOverQueuedRunId(null),onQueuedDragEnter:t.setDragOverQueuedRunId,onQueuedDrop:t.reorderQueuedMessage,onSteerQueuedMessage:t.onSteerQueuedMessage}):e.type===`fileChange`?(0,S.jsx)(iv,{animateIn:r,messages:e.messages,workspacePath:t.workspace.path}):(0,S.jsx)(q_,{animateIn:r,dragOverQueuedRunId:t.dragOverQueuedRunId,message:e.message,onDeleteQueuedMessage:t.onDeleteQueuedMessage,onEditQueuedMessage:t.onEditQueuedMessage,onQueuedDragEnd:()=>t.setDragOverQueuedRunId(null),onQueuedDragEnter:t.setDragOverQueuedRunId,onQueuedDrop:t.reorderQueuedMessage,onSteerQueuedMessage:t.onSteerQueuedMessage})}function cv({mode:e,onClick:t}){let n=e===`editor`;return(0,S.jsx)(`button`,{"aria-label":n?`Switch to chat`:`Switch to code`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:n?`Chat`:`Code`,type:`button`,onClick:t,children:n?(0,S.jsx)(tu,{className:`size-4`}):(0,S.jsx)(Hl,{className:`size-4`})})}function lv({icon:e}){return e===`codex`?(0,S.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-foreground text-background`,children:(0,S.jsx)(uv,{icon:e,className:`size-5`})}):(0,S.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-info/15 text-info`,children:(0,S.jsx)(Il,{className:`size-4`})})}function uv({className:e,icon:t}){return t===`codex`?(0,S.jsx)(dv,{className:Z(`shrink-0`,e)}):(0,S.jsx)(Il,{className:Z(`shrink-0`,e)})}function dv({className:e}){return(0,S.jsx)(`svg`,{"aria-hidden":`true`,className:e,fill:`currentColor`,fillRule:`evenodd`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,S.jsx)(`path`,{clipRule:`evenodd`,d:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`})})}function fv({status:e}){return(0,S.jsx)(`span`,{className:Z(`rounded px-1.5 py-0.5 text-[11px] font-semibold`,e===`CONNECTED`&&`bg-success/10 text-success`,e===`AUTHENTICATING`&&`bg-warning/10 text-warning`,e===`DISCONNECTED`&&`bg-muted text-muted-foreground`,e===`INVALIDATED`&&`bg-warning/10 text-warning`,e===`ERROR`&&`bg-destructive/10 text-destructive`),children:e.toLowerCase()})}var pv=x.createContext(void 0);function mv(e){let t=x.useContext(pv);if(t===void 0&&!e)throw Error(U(33));return t}var hv=x.createContext(void 0);function gv(e){let t=x.useContext(hv);if(t===void 0&&!e)throw Error(U(36));return t}var _v=x.createContext(void 0);function vv(e=!0){let t=x.useContext(_v);if(t===void 0&&!e)throw Error(U(25));return t}function yv(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=vv(!0),f=d!==void 0;return x.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:wt})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!pe&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var bv={type:`regular-item`};function xv(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=a.useState(`disabled`),d=n||u,f=x.useRef(null),{getButtonProps:p,buttonRef:m}=sp({disabled:d,focusableWhenDisabled:!0,native:s,composite:!0}),h=yv({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:f,itemMetadata:c}),g=x.useCallback(e=>Ur(h,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,p),[h,p,c]),_=Rt(f,m);return x.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var Sv=x.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=mm({label:a}),f=mv(!0),p=Ds(i),{store:m}=gv(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=xv({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:bv});return ri(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),Cv={...Es,...vo},wv=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=gv(),{side:c,align:l}=mv(),u=Wp(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),C=s.useState(`floatingTreeRoot`),w=s.useState(`closeDelay`),T=s.useState(`activeTriggerElement`),E=s.useState(`hoverEnabled`),D=s.useState(`disabled`),O=s.useState(`openMethod`),k=_.type===`context-menu`;bo({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function e(e){s.setOpen(!1,Nt(e.reason,e.domEvent))}return C.events.on(`close`,e),()=>{C.events.off(`close`,e)}},[C.events,s]),Qo(b,{enabled:E&&!D&&!k&&_.type!==`menubar`,closeDelay:w});let A=x.useCallback(e=>{s.set(`popupElement`,e)},[s]),j=ri(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,A],stateAttributesMapping:Cv,props:[p,{onKeyDown(e){u&&$p.has(e.key)&&e.stopPropagation()}},Vs(f),o,{"data-rootownerid":y}]}),M=_.type===void 0||k;return(g||_.type===`menubar`&&v!==`outside-press`)&&(M=!0),(0,S.jsx)(Li,{context:b,openInteractionType:O,modal:k,disabled:!m,returnFocus:a===void 0?M:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:C,previousFocusableElement:T,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:j})}),Tv=x.createContext(void 0);function Ev(){let e=x.useContext(Tv);if(e===void 0)throw Error(U(32));return e}var Dv=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=gv();return i.useState(`mounted`)||n?(0,S.jsx)(Tv.Provider,{value:n,children:(0,S.jsx)(vi,{ref:t,...r})}):null}),Ov=x.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=ui,style:g,..._}=e,{store:v}=gv(),y=Ev(),b=vv(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`hasViewport`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),z=x.useRef(null),ee=yo(M,!1,!1),B=n,H=c,U=l,W=s,te=h;C.type===`context-menu`&&(B=n??C.context?.anchor,W??=`start`,!o&&W!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let G=o,ne=W;C.type===`menu`?(G??=`inline-end`,ne??=`start`,te=e.collisionAvoidance??di):C.type===`menubar`&&(G??=C.context.orientation===`vertical`?`inline-end`:`bottom`,ne??=`start`);let ie=C.type===`context-menu`,ae=zs({anchor:B,floatingRootContext:w,positionMethod:b?`fixed`:r,mounted:E,side:G,sideOffset:H,align:ne,alignOffset:U,arrowPadding:ie?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:te,shiftCrossAxis:ie&&!(`side`in te&&te.side===`flip`),externalTree:T,adaptiveOrigin:P?Is:void 0});x.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Nt(At)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),x.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,Nt(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let oe=re();x.useEffect(()=>{D||oe.clear()},[D,oe]),x.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?oe.isStarted()||oe.start(e,()=>{v.setOpen(!1,Nt(At))}):v.setOpen(!1,Nt(At))}else oe.clear()}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,oe]),x.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),V(()=>{let e=R,t=z.current;if(e&&(z.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ee(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,ee,v]);let se={open:D,side:ae.side,align:ae.align,anchorHidden:ae.anchorHidden,nested:C.type===`menu`,instant:N},ce=C.type===`menubar`&&C.context.modal;Rp(D&&(ce||O&&F!==`trigger-hover`),k===`touch`,M,A);let le=Hs(e,se,{styles:ae.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),ue=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),de=null;return C.type===`menubar`?de=C.context.contentElement:C.type===void 0&&(de=A),(0,S.jsxs)(pv.Provider,{value:ae,children:[ue&&(0,S.jsx)(Tp,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Ws(!D),cutout:de}),(0,S.jsx)(Ei,{id:I,children:(0,S.jsx)(yp,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:le})})]})}),kv=x.createContext(null);function Av(e){let t=x.useContext(kv);if(t===null&&!e)throw Error(U(5));return t}var jv={...Ho,disabled:q(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:q(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:q(e=>e.openMethod),allowMouseEnter:q(e=>e.allowMouseEnter),highlightItemOnHover:q(e=>e.highlightItemOnHover),stickIfOpen:q(e=>e.stickIfOpen),parent:q(e=>e.parent),rootId:q(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:q(e=>e.activeIndex),isActive:q((e,t)=>e.activeIndex===t),hoverEnabled:q(e=>e.hoverEnabled),instantType:q(e=>e.instantType),lastOpenChangeReason:q(e=>e.openChangeReason),floatingTreeRoot:q(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:q(e=>e.floatingNodeId),floatingParentNodeId:q(e=>e.floatingParentNodeId),itemProps:q(e=>e.itemProps),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport),keyboardEventRelay:q(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Mv=class e extends lo{constructor(e){super({...Nv(),...e},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new No},jv),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=P(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function Nv(){return{...Fo(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new bi,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:vt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Pv=x.createContext(void 0);function Fv(){return x.useContext(Pv)}var Iv=z(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=vv(!0),_=gv(!0),v=Av(!0),y=Fv(),b=x.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),C=Mv.useStore(f?.store,{open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});Do(C,n,a,m),C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,p),C.useContextCallback(`onOpenChangeComplete`,i);let w=Pr(),T=Pr(),E=C.useState(`floatingTreeRoot`),D=Ti(E),O=Ci(),k=C.useState(`open`),A=C.useState(`activeTriggerElement`),j=C.useState(`positionerElement`),M=C.useState(`hoverEnabled`),N=C.useState(`disabled`),P=C.useState(`lastOpenChangeReason`),F=C.useState(`parent`),I=C.useState(`activeIndex`),L=C.useState(`payload`),R=C.useState(`floatingParentNodeId`),z=x.useRef(null),ee=x.useRef(F.type!==`context-menu`),B=re(),H=x.useRef(!0),U=re(),W=R!=null,{openMethod:te,triggerProps:G}=Zf(k);C.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:F.type===void 0?s:void 0,openMethod:te,rootId:w}),ko(C);let{forceUnmount:ne}=Ao(k,C,()=>{C.update({allowMouseEnter:!1,stickIfOpen:!0})});V(()=>{g&&!_?C.update({parent:{type:`context-menu`,context:g},floatingNodeId:D,floatingParentNodeId:O}):_&&C.update({floatingNodeId:D,floatingParentNodeId:O})},[g,_,D,O,C]),x.useEffect(()=>{if(k||(z.current=null),F.type===`context-menu`){if(!k){B.clear(),ee.current=!1;return}B.start(500,()=>{ee.current=!0})}},[B,k,F.type]),V(()=>{!k&&!M&&C.set(`hoverEnabled`,!0)},[k,M,C]);let ie=Yt((e,t)=>{let n=t.reason;if(k===e&&t.trigger===A&&P===n)return;let i=Eo(t);if(!e&&t.trigger==null&&(t.trigger=A??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!H.current)return;e&&n===`trigger-focus`?(H.current=!1,U.start(300,()=>{H.current=!0})):(H.current=!0,U.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};z.current=t.event??null,To(c,e,t.trigger,i()),C.update(c),F.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),ae=po({popupStore:C,floatingId:T,nested:O!=null,onOpenChange:ie}),oe=ae.context.events;x.useEffect(()=>{let e=({open:e,eventDetails:t})=>ie(e,t);return oe.on(`setOpen`,e),()=>{oe?.off(`setOpen`,e)}},[oe,ie]);let se=x.useCallback(()=>{C.setOpen(!1,Nt(jt))},[C]);x.useImperativeHandle(u,()=>({unmount:ne,close:se}),[ne,se]);let ce;F.type===`context-menu`&&(ce=F.context),x.useImperativeHandle(ce?.positionerRef,()=>j,[j]),x.useImperativeHandle(ce?.actionsRef,()=>({setOpen:ie}),[ie]);let le=Vi(ae,{enabled:!N,bubbles:{escapeKey:d&&F.type===`menu`},outsidePress(){return F.type!==`context-menu`||z.current?.type===`contextmenu`?!0:ee.current},externalTree:W?E:void 0}),ue=As(),de=x.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),fe=ss(ae,{enabled:!N,listRef:C.context.itemDomElements,activeIndex:I,nested:F.type!==void 0,loopFocus:c,orientation:l,parentOrientation:F.type===`menubar`?F.context.orientation:void 0,rtl:ue===`rtl`,disabledIndices:_t,onNavigate:de,openOnArrowKeyDown:F.type!==`context-menu`,externalTree:W?E:void 0,focusItemOnHover:h}),pe=x.useCallback(e=>{C.context.typingRef.current=e},[C]),me=cs(ae,{enabled:!N,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:I,resetMs:500,onMatch:e=>{k&&e!==I&&C.set(`activeIndex`,e)},onTyping:pe});jo(C,{floatingRootContext:ae,activeTriggerProps:x.useMemo(()=>{let e=Ur(me.reference,fe.reference,le.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=k,e},[C,me.reference,fe.reference,le.reference,G,k]),inactiveTriggerProps:x.useMemo(()=>{let e=Ur(fe.trigger,le.trigger,G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[fe.trigger,le.trigger,G]),popupProps:x.useMemo(()=>Ur(xo,{id:T,role:`menu`,"aria-labelledby":A?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),F.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},me.floating,fe.floating,le.floating),[A,T,F.type,C,me.floating,fe.floating,le.floating]),itemProps:fe.item??vt});let he=x.useMemo(()=>({store:C,parent:b}),[C,b]),ge=(0,S.jsx)(hv.Provider,{value:he,children:typeof t==`function`?t({payload:L}):t});return F.type===void 0||F.type===`context-menu`?(0,S.jsx)(Di,{externalTree:E,children:ge}):ge});function Lv(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ap(),{ref:i,index:a}=mm(e),o=n===a,s=x.useRef(null),c=Rt(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Rv(e){let{render:t,className:n,style:r,state:i=vt,props:a=_t,refs:o=_t,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Lv({metadata:s});return ri(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function zv(e){if(Ae(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!He(e))return zv(We(e))}function Bv(e,t){let n=x.useRef(null);function r(t){pi.flushSync(()=>{e.setOpen(!1,Nt(Et,t.nativeEvent,t.currentTarget))}),ur(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&dr(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{pi.flushSync(()=>{e.setOpen(!1,Nt(Et,n.nativeEvent,n.currentTarget))});let i=lr(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&tt(r,i);){let e=i;if(i=or(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Vv(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,nn(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:vt,[t,n,r])}var Hv=2,Uv=ee(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=gv(!0),h=d?.store??m?.store;if(!h)throw Error(U(85));let g=Ds(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),C=x.useRef(null),w=Gv(),T=ap(!0),E=wi(),D=x.useMemo(()=>E??new bi,[E]),{registerTrigger:O,isMountedByThisTrigger:k}=Oo(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:D,floatingNodeId:Ti(D),floatingParentNodeId:Ci(),keyboardEventRelay:T?.relayKeyboardEvent}),A=w.type===`menubar`,j=h.useState(`disabled`),M=a||j||A&&w.context.disabled,{getButtonProps:N,buttonRef:P}=sp({disabled:M,native:o});x.useEffect(()=>{!y&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,w.type]);let F=x.useRef(null),I=re(),L=Yt(e=>{if(!F.current)return;I.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(tt(F.current,t)||tt(h.select(`positionerElement`),t)||t===F.current||t!=null&&zv(t)===h.select(`rootId`))return;let n=rp(F.current);e.clientX>=n.left-Hv&&e.clientX<=n.right+Hv&&e.clientY>=n.top-Hv&&e.clientY<=n.bottom+Hv||D.events.emit(`close`,{domEvent:e,reason:kt})});x.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&nn(F.current).addEventListener(`mouseup`,L,{once:!0})},[y,L,h]);let R=A&&w.context.hasSubmenuOpen,z=es(v,{enabled:(c??R)&&!M&&w.type!==`context-menu`&&(!A||R&&!k),handleClose:gs({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:D,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ee=Wv(y,h.select(`lastOpenChangeReason`)),B=Ri(v,{enabled:!M&&w.type!==`context-menu`,event:y&&A?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?ee:!1}),V=Ko(v,{enabled:!M&&R}),H=Vv({open:y,enabled:A,mouseDownAction:`open`}),W=x.useMemo(()=>Ur(V.reference,B.reference),[V.reference,B.reference]),te=h.useState(`triggerProps`,k),{preFocusGuardRef:G,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:ie}=Bv(h,C),ae={disabled:M,open:y},oe=[F,t,P,O,C],se=[W,z??vt,te,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(I.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),nn(e.currentTarget).addEventListener(`mouseup`,L,{once:!0}))}},A?{role:`menuitem`}:{},H,p,N],ce=ri(`button`,e,{enabled:!A,stateAttributesMapping:Ts,state:ae,ref:oe,props:se});return A?(0,S.jsx)(Rv,{tag:`button`,render:n,className:r,style:i,state:ae,refs:oe,props:se,stateAttributesMapping:Ts}):y?(0,S.jsxs)(x.Fragment,{children:[(0,S.jsx)(sn,{ref:G,onFocus:ne},`${g}-pre-focus-guard`),(0,S.jsx)(x.Fragment,{children:ce},g),(0,S.jsx)(sn,{ref:h.context.triggerFocusTargetRef,onFocus:ie},`${g}-post-focus-guard`)]}):(0,S.jsx)(x.Fragment,{children:ce},g)});function Wv(e,t){let n=re(),[r,i]=x.useState(!1);return V(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Gv(){let e=vv(!0),t=gv(!0),n=Av(!0);return x.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function Kv({...e}){return(0,S.jsx)(Iv,{"data-slot":`dropdown-menu`,...e})}function qv({...e}){return(0,S.jsx)(Uv,{"data-slot":`dropdown-menu-trigger`,...e})}function Jv({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,S.jsx)(Dv,{children:(0,S.jsx)(Ov,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,S.jsx)(wv,{"data-slot":`dropdown-menu-content`,className:Z(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Yv({className:e,inset:t,variant:n=`default`,...r}){return(0,S.jsx)(Sv,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Z(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Xv(){let e=b_();return(0,S.jsxs)(`header`,{className:`flex h-10 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:e.chat?.title??e.workspace.name}),e.accountSwitchPhase?(0,S.jsx)(`span`,{className:`hidden shrink-0 items-center gap-1 rounded-md border border-info/30 bg-info/10 px-1.5 py-0.5 text-[11px] font-medium text-info sm:flex`,children:{completed:`Switching`,failed:`Switch failed`,hydratingTarget:`Hydrating`,preparing:`Preparing`,refreshingMessages:`Refreshing`,syncingSource:`Syncing`}[e.accountSwitchPhase]??`Switching`}):null,e.chat?(0,S.jsx)(Zv,{}):null,e.selectableAccounts.length?(0,S.jsx)($v,{}):(0,S.jsx)(Qv,{}),e.telegramDeepLink?(0,S.jsx)(`a`,{"aria-label":`Subscribe in Telegram`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,href:e.telegramDeepLink,rel:`noreferrer`,target:`_blank`,title:`Subscribe in Telegram`,children:(0,S.jsx)(mu,{className:`size-3.5`})}):null,(0,S.jsx)(cv,{mode:`chat`,onClick:e.onToggleMode})]})}function Zv(){let e=b_(),t=!e.chat||e.running||e.isSwitchingAccount||!!e.threadAction,n=e.threadAction===`rename`||e.threadAction===`archive`;return(0,S.jsxs)(Kv,{children:[(0,S.jsx)(qv,{render:(0,S.jsx)(`button`,{"aria-label":`Chat actions`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:t,title:`Chat actions`,type:`button`}),children:n?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(su,{className:`size-3.5`})}),(0,S.jsxs)(Jv,{align:`end`,className:`w-40`,children:[(0,S.jsxs)(Yv,{className:`text-[12px]`,disabled:t,onClick:()=>void e.renameChat(),children:[(0,S.jsx)(su,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:`Edit chat name`})]}),(0,S.jsxs)(Yv,{className:`text-[12px]`,disabled:t,onClick:()=>void e.archiveChat(),children:[(0,S.jsx)(Ml,{className:`size-3.5`}),(0,S.jsx)(`span`,{children:`Archive chat`})]})]})]})}function Qv(){return(0,S.jsx)(`button`,{className:`h-7 rounded-md border border-border px-2 text-[12px] font-medium text-foreground hover:bg-accent`,type:`button`,onClick:b_().onOpenProviders,children:`Providers`})}function $v(){let e=b_();return(0,S.jsxs)(S.Fragment,{children:[e.accountQuota?(0,S.jsx)(`span`,{className:`hidden shrink-0 text-[11px] font-medium text-muted-foreground sm:inline`,children:e.accountQuota}):null,(0,S.jsxs)(Tm,{className:`min-w-0 shrink-0`,disabled:e.running||e.isSwitchingAccount,value:e.account?.id??``,onValueChange:t=>void e.onSwitchAccount(t),children:[(0,S.jsx)(Em,{"aria-label":`Provider account`,className:`h-7 w-[min(42vw,11rem)] border-border bg-secondary px-2 text-[12px] font-medium text-foreground hover:bg-accent`,title:e.account?e.account.displayName+` · `+e.account.providerId:void 0,children:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.isSwitchingAccount?(0,S.jsx)(eu,{className:`size-3.5 shrink-0 animate-spin text-info`}):(0,S.jsx)(uv,{icon:e.providerDefinition?.icon,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:e.account?.displayName??`Provider`})]})}),(0,S.jsx)(Dm,{align:`end`,className:`border-border bg-popover text-foreground`,children:e.selectableAccounts.map(t=>{let n=Gm(e.accountLimits[t.id]);return(0,S.jsx)(Om,{className:`text-[12px] text-foreground hover:bg-accent focus-visible:bg-accent`,label:t.displayName+` · `+(n??t.providerId),value:t.id,children:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(uv,{icon:e.providerIconById.get(t.providerId),className:`size-3.5 shrink-0 text-muted-foreground`}),(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:t.displayName}),(0,S.jsxs)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,children:[t.providerId,n?` · `+n:``]})]})]})},t.id)})})]})]})}var ey=(0,x.createContext)(null),ty=6e4;function ny({children:e}){let[t,n]=(0,x.useState)({}),[r,i]=(0,x.useState)(!1),a=(0,x.useRef)(!1),o=(0,x.useCallback)(async()=>{if(!a.current){a.current=!0,i(!0);try{n((await Q.providerAccounts.limits()).data)}catch{n({})}finally{a.current=!1,i(!1)}}},[]);(0,x.useEffect)(()=>{let e=!1,t=null,n=async()=>{await o(),e||(t=window.setTimeout(n,ty))};return t=window.setTimeout(n,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[o]);let s=(0,x.useMemo)(()=>({accountLimits:t,isLoading:r,refreshQuotas:o}),[t,r,o]);return(0,S.jsx)(ey.Provider,{value:s,children:e})}function ry(){let e=(0,x.useContext)(ey);if(!e)throw Error(`useProviderQuotas must be used within ProviderQuotaProvider.`);return e}function iy({account:e,chat:t,providerDefinition:n,onRuntimeSettingsChange:r}){let[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(`medium`),[u,d]=(0,x.useState)(`standard`),f=!!(e&&n?.capabilities.includes(`models`)),p=!!n?.runtimeFields.some(e=>e.key===`reasoningEffort`),m=!!n?.runtimeFields.some(e=>e.key===`serviceTier`);(0,x.useEffect)(()=>{let n=$(e?.runtimeDefaults,`model`)||sh(e?.providerId,`model`),r=$(e?.runtimeDefaults,`reasoningEffort`)||sh(e?.providerId,`reasoningEffort`),i=$(e?.runtimeDefaults,`serviceTier`)||sh(e?.providerId,`serviceTier`);a(t?.model??n),l(lh(t?.reasoningEffort??r)),d(fh(t?.serviceTier??i))},[e?.id,e?.providerId,e?.runtimeDefaults,t?.id,t?.model,t?.reasoningEffort,t?.serviceTier]),(0,x.useEffect)(()=>{let t=!1;if(s([]),!(!e||!f))return Q.providerAccounts.models(e.id).then(e=>{t||s(e.data)}).catch(()=>{t||s([])}),()=>{t=!0}},[e?.id,f]);let h=ch(e?.providerId,o),g=(0,x.useMemo)(()=>(i&&!h.some(e=>e.model===i||e.id===i)?[{id:i,model:i,displayName:i},...h]:h).filter(e=>!e.hidden),[h,i]);return{changeModel:e=>{let n=i;a(e),t&&(t.model??``)!==e&&r(t.id,{model:e||null}).catch(()=>a(n))},changeReasoningEffort:e=>{let n=c,i=lh(e);l(i);let a=uh(i);t&&(t.reasoningEffort??``)!==a&&r(t.id,{reasoningEffort:a}).catch(()=>{l(n)})},changeServiceTier:e=>{let n=u,i=fh(e);d(i);let a=ph(i);t&&(t.serviceTier??``)!==a&&r(t.id,{serviceTier:a}).catch(()=>{d(n)})},model:i,reasoningEffort:c,selectedModelOption:g.find(e=>e.model===i||e.id===i)??g[0]??null,serviceTier:u,supportsModels:f,supportsReasoningEffort:p,supportsServiceTier:m,visibleModelOptions:g}}function ay(e){let[t,n]=(0,x.useState)(null);return(0,x.useEffect)(()=>{let t=!1,r=()=>{n(null),e&&Q.plugins.list().then(r=>{if(t)return;let i=$(Im(r.find(e=>e.id===`telegram`&&e.enabled)?.stateSummary),`botUsername`);n(i?`https://t.me/${i}?start=${encodeURIComponent(`sub_`+e)}`:null)}).catch(()=>{t||n(null)})};return r(),window.addEventListener(`pockcode:plugins-changed`,r),()=>{t=!0,window.removeEventListener(`pockcode:plugins-changed`,r)}},[e]),t}function oy({chat:e,messages:t,setActionError:n}){let[r,i]=(0,x.useState)(new Set),[a,o]=(0,x.useState)({}),[s,c]=(0,x.useState)({}),[l,u]=(0,x.useState)(0),[d,f]=(0,x.useState)(!1),p=(0,x.useMemo)(()=>Uh(t,e=>Eh(e)&&!r.has(e.requestId??``)),[r,t]),m=(0,x.useMemo)(()=>p?Dh(p.rawPayload):[],[p]),h=p?.requestId??null,g=p?.id??null;(0,x.useEffect)(()=>{u(0)},[p?.id]),(0,x.useEffect)(()=>{u(e=>Math.min(e,Math.max(0,m.length-1)))},[m.length]);let _=(e,t={})=>{let n=g?a[g]:void 0;return t[e.id]??n?.[e.id]??``},v=e=>{if(!e.options.length)return!0;let t=_(e);return!!(g?s[g]:void 0)?.[e.id]||!!(t&&!e.options.some(e=>e.label===t))},y=(e,t,n={})=>{g&&(o(n=>({...n,[g]:{...n[g],[e]:t}})),c(t=>({...t,[g]:{...t[g],[e]:n.freeform===!0}})))},b=async(t={})=>{if(!e||!h||!m.length)return;let r=Object.fromEntries(m.map(e=>[e.id,{answers:[_(e,t)]}]));f(!0),n(null);try{await Q.chats.respondToServerRequest(e.id,h,{kind:`userInput`,result:{answers:r}}),i(e=>new Set(e).add(h)),u(0)}catch(e){n(Og(e))}finally{f(!1)}},S=m[l]??m[0]??null,C=m.length>0&&l>=m.length-1,w=S?!!_(S).trim():!1;return{activeUserInputQuestion:S,canContinueUserInput:w,chooseUserInputFreeform:e=>{let t=_(e),n=e.options.some(e=>e.label===t)?``:t;y(e.id,n,{freeform:!0})},chooseUserInputOption:(e,t)=>{if(!d){if(y(e.id,t,{freeform:!1}),C){b({[e.id]:t});return}u(e=>Math.min(m.length-1,e+1))}},goToNextUserInputStage:()=>{if(w){if(C){b();return}u(e=>Math.min(m.length-1,e+1))}},goToPreviousUserInputStage:()=>{u(e=>Math.max(0,e-1))},pendingUserInputPrompt:p,pendingUserInputQuestions:m,submitUserInput:b,updateUserInputAnswer:y,userInputAnswerValue:_,userInputIsLastStage:C,userInputStageIndex:l,userInputSubmitting:d,userInputUsesFreeform:v}}function sy({accounts:e,chat:t,error:n,isLoading:r,isMessagesLoading:i,isSwitchingAccount:a,accountSwitchPhase:o,messages:s,preferredAccountId:c,providerDefinitions:l,workspace:u,onArchiveChat:d,onCompactChat:f,onDeleteQueuedMessage:p,onEditQueuedMessage:m,onFileLinkOpen:h,onForkChat:g,onNewChat:_,onOpenMcpServers:v,onOpenProviders:y,onOpenPlugins:b,onRefreshChat:S,onRenameChat:C,onReviewChat:w,onToggleMode:T,onReorderQueuedMessages:E,onPermissionModeChange:D,onRuntimeSettingsChange:O,onSendMessage:k,onSteerQueuedMessage:A,onSwitchAccount:j,onStopChat:M}){let[N,P]=(0,x.useState)(``),[F,I]=(0,x.useState)(`askForApproval`),[L,R]=(0,x.useState)([]),[z,ee]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(!1),[W,te]=(0,x.useState)(!1),[G,ne]=(0,x.useState)(!1),[re,ie]=(0,x.useState)(null),[ae,oe]=(0,x.useState)(null),[se,ce]=(0,x.useState)(null),le=(0,x.useRef)(null),ue=(0,x.useRef)(null),de=(0,x.useRef)(null),fe=(0,x.useRef)(null),pe=(0,x.useRef)(null),{accountLimits:me}=ry(),he=Hg(t,e),ge=Vg(t,he,c),_e=ge?Gm(me[ge.id]):null,ve=l.find(e=>e.id===ge?.providerId)??null,ye=(0,x.useMemo)(()=>new Map(l.map(e=>[e.id,e.icon])),[l]),be=ve?.composerFeatures??ih(ge?.providerId),xe=t?.status===`RUNNING`||s.some(e=>e.status===`STREAMING`),Se=(0,x.useMemo)(()=>Ph(s,xe),[s,xe]),Ce=(0,x.useMemo)(()=>Se.map(Ih),[Se]),we=(0,x.useMemo)(()=>Lh(s),[s]),Te=$_(Ce,t?.id??null),Ee=(0,x.useMemo)(()=>({openFileLink:h}),[h]),De=!!N.trim()||L.length>0,Oe=De&&!G&&!re&&!a,ke=xe&&!De,Ae=be.includes(`accessMode`),je=be.includes(`fileAttachment`),Me=be.includes(`folderAttachment`),Ne=be.includes(`goal`),Pe=be.includes(`imageAttachment`),Fe=be.includes(`planMode`),Ie=ay(t?.id),{changeModel:Le,changeReasoningEffort:Re,changeServiceTier:ze,model:Be,reasoningEffort:Ve,selectedModelOption:He,serviceTier:K,supportsModels:Ue,supportsReasoningEffort:We,supportsServiceTier:Ge,visibleModelOptions:Ke}=iy({account:ge,chat:t,providerDefinition:ve,onRuntimeSettingsChange:O}),{activeUserInputQuestion:qe,canContinueUserInput:Je,chooseUserInputFreeform:Ye,chooseUserInputOption:Xe,goToNextUserInputStage:Ze,goToPreviousUserInputStage:Qe,pendingUserInputPrompt:$e,pendingUserInputQuestions:et,submitUserInput:tt,updateUserInputAnswer:nt,userInputAnswerValue:rt,userInputIsLastStage:it,userInputStageIndex:at,userInputSubmitting:ot,userInputUsesFreeform:st}=oy({chat:t,messages:s,setActionError:oe}),ct=(0,x.useMemo)(()=>rh(N),[N]);(0,x.useEffect)(()=>{let e=$(ge?.runtimeDefaults,`permissionMode`)||sh(ge?.providerId,`permissionMode`);I(ah(t?.permissionMode??e)),V(null),U(t?.collaborationMode===`plan`)},[ge?.id,ge?.providerId,ge?.runtimeDefaults,t?.id,t?.permissionMode,t?.collaborationMode]),(0,x.useEffect)(()=>{if(!W)return;let e=e=>{let t=e.target;de.current?.contains(t)||te(!1)};return document.addEventListener(`pointerdown`,e),()=>{document.removeEventListener(`pointerdown`,e)}},[W]),(0,x.useEffect)(()=>{let e=fe.current;e&&window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})},[ae,t?.id,s.length,s.at(-1)?.id,s.at(-1)?.content]),(0,x.useEffect)(()=>{let e=pe.current;if(!e)return;let t=(Number.parseFloat(window.getComputedStyle(e).lineHeight)||20)*12;e.style.height=`0px`,e.style.height=String(Math.min(e.scrollHeight,t))+`px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`},[N]);let lt=(0,x.useCallback)((e,n,r)=>{if(!t||e===n||!we.includes(e)||!we.includes(n)){ce(null);return}let i=Rh(we,e,n,r);ce(null),i.join(``)!==we.join(``)&&E(t.id,i)},[t,E,we]),ut=async(e,t={})=>{ne(!0),oe(null);try{await k({attachments:(t.attachments??L).map(({id:e,...t})=>t),collaborationMode:t.collaborationMode??(Fe?H?`plan`:`default`:null),content:e,delivery:xe?`queue`:void 0,goalObjective:`goalObjective`in t?t.goalObjective??null:B,model:Ue&&(Be||He?.model)||null,permissionMode:F,reasoningEffort:We?uh(Ve):null,serviceTier:t.serviceTier??(Ge?ph(K):null)}),P(``),R([]),V(null)}finally{ne(!1)}},dt=async()=>{try{await ut(`Implement the plan.`,{attachments:[],collaborationMode:`default`,goalObjective:null}),U(!1)}catch(e){throw oe(Og(e)),window.requestAnimationFrame(()=>{pe.current?.scrollIntoView({block:`end`}),pe.current?.focus()}),e}},ft=()=>{Fe&&U(!0),oe(null),window.requestAnimationFrame(()=>{pe.current?.scrollIntoView({block:`end`}),pe.current?.focus()})},pt=async(e,t)=>{if(!re){ie(e),oe(null);try{await t()}catch(e){oe(Og(e)),window.requestAnimationFrame(()=>{pe.current?.scrollIntoView({block:`end`}),pe.current?.focus()})}finally{ie(null)}}},mt=async e=>{let n=e.argument;switch(e.command.id){case`model`:return n?Le(n):te(!0),P(``),!0;case`fast`:return ze(`fast`),P(``),!0;case`permissions`:return gt(n.toLowerCase().includes(`full`)?`fullAccess`:`askForApproval`),P(``),!0;case`plan`:return n?await ut(n,{collaborationMode:`plan`}):(U(e=>!e),P(``)),!0;case`goal`:return n?V(n):yt(),P(``),!0;case`review`:return t&&await pt(`review`,()=>w(t.id,n||null)),P(``),!0;case`compact`:return t&&await pt(`compact`,()=>f(t.id)),P(``),!0;case`fork`:return t&&await pt(`fork`,()=>g(t.id)),P(``),!0;case`new`:return _(),P(``),R([]),V(null),!0;case`status`:return t&&await pt(`refresh`,()=>S(t.id)),P(``),!0;case`usage`:return y(),P(``),!0;case`mcp`:return v(),P(``),!0;case`plugins`:return b(),P(``),!0;case`skills`:return await ut(`List the available Codex skills for this workspace.`),!0;case`hooks`:return await ut(`List the active Codex hooks for this workspace.`),!0;case`diff`:return await ut(n||`Show the current diff.`),!0;case`clear`:return P(``),R([]),!0}},ht=async()=>{if(!Oe)return;let e=nh(N);e&&await mt(e)||await ut(N.trim()||_h(L))},gt=e=>{let n=F,r=ah(e);I(r),t&&t.permissionMode!==r&&D(t.id,r).catch(()=>I(n))},_t=async e=>{let t=Array.from(e.target.files??[]);if(e.target.value=``,!t.length)return;let n=await vh(t,Pe);R(e=>[...e,...n])},vt=e=>{let t=Array.from(e.target.files??[]);if(e.target.value=``,!t.length)return;let n=(bh(t[0])??t[0].name).split(`/`)[0]||`Folder`;R(e=>[...e,{id:xh(),kind:`folder`,name:n,path:n+`/ (`+t.length+` files)`,size:t.reduce((e,t)=>e+t.size,0)}])},yt=()=>{let e=window.prompt(`Goal objective`,B??``);e!==null&&(V(e.trim()||null),ee(!1))};return{accessMode:F,acceptPlan:dt,account:ge,accountSwitchPhase:o,accountLimits:me,accountQuota:_e,accounts:e,actionError:ae,activeUserInputQuestion:qe,appendedEntryIds:Te,archiveChat:async()=>{t&&await pt(`archive`,()=>d(t.id))},attachFiles:_t,attachFolder:vt,attachments:L,canSend:Oe,changeAccessMode:gt,changeModel:Le,changeReasoningEffort:Re,changeServiceTier:ze,chat:t,canContinueUserInput:Je,chooseUserInputFreeform:Ye,chooseUserInputOption:Xe,composerMenuOpen:z,draft:N,dragOverQueuedRunId:se,error:n,fileInputRef:le,fileLinkContext:Ee,folderInputRef:ue,goalObjective:B,isLoading:r,isMessagesLoading:i,isSwitchingAccount:a,messages:s,model:Be,keepPlanning:ft,onDeleteQueuedMessage:p,onEditQueuedMessage:m,onOpenProviders:y,onSteerQueuedMessage:A,onStopChat:M,onSwitchAccount:j,onToggleMode:T,pendingUserInputPrompt:$e,pendingUserInputQuestions:et,goToNextUserInputStage:Ze,goToPreviousUserInputStage:Qe,planMode:H,promptForGoal:yt,providerDefinition:ve,providerIconById:ye,reasoningEffort:Ve,removeAttachment:e=>{R(t=>t.filter(t=>t.id!==e))},renderEntries:Se,reorderQueuedMessage:lt,compactChat:async()=>{t&&await pt(`compact`,()=>f(t.id))},forkChat:async e=>{t&&await pt(`fork`,()=>g(t.id,e))},refreshChat:async()=>{t&&await pt(`refresh`,()=>S(t.id))},renameChat:async()=>{if(!t)return;let e=window.prompt(`Rename chat`,t.title);e===null||!e.trim()||e.trim()===t.title||await pt(`rename`,()=>C(t.id,e.trim()))},reviewChat:async()=>{t&&await pt(`review`,()=>w(t.id,null))},running:xe,runtimeSettingsOpen:W,runtimeSettingsRef:de,scrollRef:fe,selectedModelOption:He,selectableAccounts:he,sending:G,serviceTier:K,setAttachments:R,setComposerMenuOpen:ee,setDraft:P,setDragOverQueuedRunId:ce,setGoalObjective:V,setPlanMode:U,setRuntimeSettingsOpen:te,showStopAction:ke,slashMatches:ct,submit:ht,submitUserInput:tt,supportsAccessMode:Ae,supportsFiles:je,supportsFolders:Me,supportsGoal:Ne,supportsModels:Ue,supportsPlanMode:Fe,supportsReasoningEffort:We,supportsServiceTier:Ge,telegramDeepLink:Ie,textareaRef:pe,threadAction:re,updateUserInputAnswer:nt,userInputAnswerValue:rt,userInputIsLastStage:it,userInputSubmitting:ot,userInputStageIndex:at,userInputUsesFreeform:st,visibleModelOptions:Ke,workspace:u}}function cy(e){let t=sy(e);return(0,S.jsx)(y_.Provider,{value:t,children:(0,S.jsx)(v_.Provider,{value:t.fileLinkContext,children:(0,S.jsxs)(`section`,{className:`grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-xl border border-border bg-card`,children:[(0,S.jsx)(Xv,{}),(0,S.jsx)(av,{}),(0,S.jsx)(x_,{})]})})})}var ly=(0,x.createContext)(null);function uy({children:e,chats:t,isLoading:n,messagesByChatId:r}){let i=(0,x.useMemo)(()=>Object.fromEntries(t.map(e=>[e.id,e.status===`RUNNING`||(r[e.id]??[]).some(e=>e.status===`STREAMING`)?`RUNNING`:e.status])),[t,r]),a=(0,x.useMemo)(()=>({chatStatusById:i,chats:t,isChatRunning:e=>i[e]===`RUNNING`,isLoading:n}),[i,t,n]);return(0,S.jsx)(ly.Provider,{value:a,children:e})}function dy(){let e=(0,x.useContext)(ly);if(!e)throw Error(`useChatList must be used within ChatListProvider.`);return e}function fy(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{n(e=>e??`refresh`),i(null);try{o(await Q.cloudflared.status())}catch(e){i({kind:`error`,text:Og(e)})}finally{n(e=>e===`refresh`?null:e)}},[]);(0,x.useEffect)(()=>{e&&s()},[e,s]);let c=(0,x.useCallback)(async(e,t,r)=>{n(e),i(null);try{o(await t()),i({kind:`info`,text:r})}catch(e){i({kind:`error`,text:Og(e)})}finally{n(null)}},[]);return{busyAction:t,deleteNamedTunnel:e=>c(`delete:${e}`,()=>Q.cloudflared.deleteNamedTunnel(e),`Tunnel deleted.`),isBusy:!!t,isLoading:t===`refresh`&&!a,notice:r,refresh:s,startTemporary:e=>c(`start`,()=>Q.cloudflared.startTemporary(e),`Temporary tunnel started.`),status:a,stopTemporary:e=>c(`stop:${e}`,()=>Q.cloudflared.stopTemporary(e),`Temporary tunnel stopped.`)}}function py({cloudflaredPanel:e}){let[t,n]=(0,x.useState)(`http://localhost:5173`),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=e.status,c=!!(s?.installed&&t.trim()&&!e.isBusy),l=s?.temporaryTunnels.find(e=>e.id===a)??null,u=(0,x.useCallback)(async e=>{try{await navigator.clipboard.writeText(e),i(e),window.setTimeout(()=>i(t=>t===e?null:t),1400)}catch{i(null)}},[]);return s?s.installed?(0,S.jsxs)(`div`,{className:`grid min-w-0 max-w-full gap-3 text-[13px] text-muted-foreground`,children:[(0,S.jsxs)(`section`,{className:`grid min-w-0 gap-2 px-1.5`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-1.5 text-foreground`,children:[(0,S.jsx)(hu,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`cloudflared`}),s.version?(0,S.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,title:s.version,children:s.version}):null]}),(0,S.jsxs)(`form`,{className:`grid min-w-0 gap-2`,onSubmit:n=>{n.preventDefault(),c&&e.startTemporary(t)},children:[(0,S.jsx)(`input`,{"aria-label":`Local service URL`,className:`h-8 min-w-0 rounded-md border border-border bg-background px-2 text-[12px] text-foreground outline-none placeholder:text-muted-foreground focus:border-primary`,placeholder:`http://localhost:3000`,value:t,onChange:e=>n(e.target.value)}),(0,S.jsxs)(`button`,{className:`flex h-8 items-center justify-center gap-1.5 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-45`,disabled:!c,type:`submit`,children:[e.busyAction===`start`?(0,S.jsx)(eu,{className:`size-4 animate-spin`}):(0,S.jsx)(uu,{className:`size-4`}),`Temporary Tunnel`]})]}),e.notice?(0,S.jsx)(_y,{notice:e.notice}):null]}),(0,S.jsxs)(`section`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex h-7 min-w-0 items-center gap-2 px-1.5 text-[12px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,S.jsx)(zl,{className:`size-4 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Temporary`}),(0,S.jsx)(`span`,{className:`grid min-w-5 place-items-center rounded-full bg-secondary px-1 text-[10px] leading-5 text-secondary-foreground`,children:s.temporaryTunnels.length})]}),s.temporaryTunnels.length?(0,S.jsx)(`div`,{className:`grid min-w-0 gap-1`,children:s.temporaryTunnels.map(t=>(0,S.jsx)(my,{copied:!!(t.publicUrl&&r===t.publicUrl),stopping:e.busyAction===`stop:${t.id}`,tunnel:t,onCopy:u,onViewLogs:t.logs.length?()=>o(t.id):void 0,onStop:()=>void e.stopTemporary(t.id)},t.id))}):(0,S.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:`No temporary tunnels`})]}),(0,S.jsxs)(`section`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex h-7 min-w-0 items-center gap-2 px-1.5 text-[12px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,S.jsx)(zl,{className:`size-4 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Named Tunnels`}),(0,S.jsx)(`span`,{className:`grid min-w-5 place-items-center rounded-full bg-secondary px-1 text-[10px] leading-5 text-secondary-foreground`,children:s.namedTunnels.length})]}),s.namedTunnelsError?(0,S.jsx)(_y,{notice:{kind:s.namedTunnelsAuthRequired?`info`:`error`,text:s.namedTunnelsError}}):s.namedTunnels.length?(0,S.jsx)(`div`,{className:`grid min-w-0 gap-1`,children:s.namedTunnels.map(t=>(0,S.jsx)(gy,{deleting:e.busyAction===`delete:${t.id}`,tunnel:t,onDelete:()=>void e.deleteNamedTunnel(t.id)},t.id))}):(0,S.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:`No named tunnels`})]}),(0,S.jsx)(hy,{tunnel:l,onClose:()=>o(null)})]}):(0,S.jsxs)(`div`,{className:`grid min-w-0 max-w-full gap-3 px-3 py-4 text-[13px] text-muted-foreground`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-foreground`,children:[(0,S.jsx)(hu,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:`cloudflared`})]}),(0,S.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap text-[12px] leading-5 text-muted-foreground [overflow-wrap:anywhere]`,children:s.message??`cloudflared is not available on PATH.`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.isBusy,type:`button`,onClick:()=>void e.refresh(),children:`Refresh`}),e.notice?(0,S.jsx)(_y,{notice:e.notice}):null]}):(0,S.jsx)(`div`,{className:`grid h-40 min-w-0 place-items-center text-[12px] text-muted-foreground`,children:`Loading tunnels`})}function my({copied:e,stopping:t,tunnel:n,onCopy:r,onViewLogs:i,onStop:a}){let o=n.status===`running`||n.status===`starting`;return(0,S.jsxs)(`div`,{className:`grid min-w-0 gap-1 rounded-md px-2 py-1.5 text-[12px] hover:bg-accent/70`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:Z(`size-2 shrink-0 rounded-full`,by(n.status))}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,title:n.publicUrl??n.originUrl,children:n.publicUrl??n.originUrl}),(0,S.jsx)(`span`,{className:Z(`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold`,yy(n.status)),children:vy(n.status)})]}),(0,S.jsx)(`div`,{className:`min-w-0 truncate pl-4 text-[11px]`,title:n.originUrl,children:n.originUrl}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 pl-4`,children:[n.publicUrl?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`min-w-0 flex-1 truncate text-info underline decoration-info/40 underline-offset-2 hover:text-info`,href:n.publicUrl,rel:`noreferrer`,target:`_blank`,children:n.publicUrl}),(0,S.jsx)(`button`,{"aria-label":`Copy tunnel URL`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground`,title:`Copy tunnel URL`,type:`button`,onClick:()=>r(n.publicUrl??``),children:e?(0,S.jsx)(Rl,{className:`size-3.5 text-success`}):(0,S.jsx)(Ul,{className:`size-3.5`})}),(0,S.jsx)(`a`,{"aria-label":`Open tunnel`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground`,href:n.publicUrl,rel:`noreferrer`,target:`_blank`,title:`Open tunnel`,children:(0,S.jsx)(Kl,{className:`size-3.5`})})]}):(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:`Waiting for public URL`}),i?(0,S.jsx)(`button`,{"aria-label":`View tunnel logs`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground`,title:`View tunnel logs`,type:`button`,onClick:i,children:(0,S.jsx)(ql,{className:`size-3.5`})}):null,(0,S.jsx)(`button`,{"aria-label":`Stop temporary tunnel`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-background hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40`,disabled:!o||t,title:`Stop temporary tunnel`,type:`button`,onClick:a,children:t?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(Cu,{className:`size-3.5`})})]})]})}function hy({tunnel:e,onClose:t}){if(!e)return null;let n=e.logs.map(e=>e.trim()).filter(Boolean),r=e.publicUrl??e.originUrl;return(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-labelledby":`cloudflared-logs-title`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close tunnel logs`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:t}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[82vh] min-h-72 w-full max-w-2xl grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-12 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(ql,{className:`size-4 shrink-0 text-info`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-foreground`,id:`cloudflared-logs-title`,children:`Tunnel logs`}),(0,S.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,title:r,children:r})]}),(0,S.jsx)(`button`,{"aria-label":`Close tunnel logs`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:t,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsx)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:n.length?(0,S.jsx)(`pre`,{className:`min-h-full whitespace-pre-wrap break-words rounded-md bg-background p-3 font-mono text-[11px] leading-4 text-muted-foreground`,children:n.join(`
17
+ `)}):(0,S.jsx)(`div`,{className:`grid h-full place-items-center rounded-md bg-background p-4 text-center text-[12px] text-muted-foreground`,children:`No logs yet`})})]})]})}function gy({deleting:e,tunnel:t,onDelete:n}){return(0,S.jsxs)(`div`,{className:`group grid min-w-0 gap-1 rounded-md px-2 py-1.5 text-[12px] hover:bg-accent/70`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:Z(`size-2 shrink-0 rounded-full`,xy(t.status))}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,title:t.name,children:t.name}),(0,S.jsx)(`span`,{className:`shrink-0 rounded bg-secondary px-1.5 py-0.5 text-[10px] font-semibold text-secondary-foreground`,children:t.connectionCount}),(0,S.jsx)(`button`,{"aria-label":`Delete named tunnel`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground opacity-100 hover:bg-background hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100`,disabled:e,title:`Delete named tunnel`,type:`button`,onClick:()=>{window.confirm(`Delete ${t.name}?`)&&n()},children:e?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(xu,{className:`size-3.5`})})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pl-4 text-[11px]`,children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate`,title:t.id,children:Sy(t.id)}),(0,S.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Cy(t.createdAt)})]})]})}function _y({notice:e}){return(0,S.jsx)(`div`,{className:Z(`min-w-0 max-w-full overflow-hidden whitespace-pre-wrap rounded-md px-2 py-1 text-[11px] leading-4 [overflow-wrap:anywhere]`,e.kind===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`),title:e.text,children:e.text})}function vy(e){return{exited:`Exited`,running:`Live`,starting:`Starting`,stopped:`Stopped`}[e]}function yy(e){return e===`running`?`bg-success/10 text-success`:e===`starting`?`bg-info/10 text-info`:e===`stopped`?`bg-muted text-muted-foreground`:`bg-destructive/10 text-destructive`}function by(e){return e===`running`?`bg-success`:e===`starting`?`bg-info`:e===`stopped`?`bg-muted-foreground`:`bg-destructive`}function xy(e){return e===`active`?`bg-success`:e===`inactive`?`bg-muted-foreground`:`bg-warning`}function Sy(e){return e.length>18?`${e.slice(0,8)}...${e.slice(-6)}`:e}function Cy(e){if(!e)return`Unknown`;let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{day:`numeric`,hour:`2-digit`,minute:`2-digit`,month:`short`}).format(new Date(t)):e}function wy({icon:e}){let t=`size-4 shrink-0`;return e===`shell`?(0,S.jsx)(`span`,{className:`w-4 shrink-0 text-center text-sm font-bold text-success`,children:`$`}):e===`js`?(0,S.jsx)(`span`,{className:`w-4 shrink-0 text-center text-[11px] font-bold text-ide-file-yellow`,children:`JS`}):e===`json`?(0,S.jsx)(`span`,{className:`w-4 shrink-0 text-center text-sm font-bold text-ide-file-yellow`,children:`{}`}):e===`make`?(0,S.jsx)(`span`,{className:`w-4 shrink-0 text-center text-sm font-bold text-warning`,children:`M`}):e===`docker`?(0,S.jsx)(Ql,{className:Z(t,`text-muted-foreground`)}):e===`info`?(0,S.jsx)(`span`,{className:`w-4 shrink-0 text-center text-sm text-ide-file-blue`,children:`i`}):(0,S.jsx)(ql,{className:Z(t,`text-muted-foreground`)})}function Ty({expandedFolderIds:e,loadingFolderIds:t,nodes:n,selectedFileId:r,treeId:i,onFileSelect:a,onFolderToggle:o}){let s=(0,x.useMemo)(()=>dg(n,e),[e,n]),c=s.some(e=>e.node.id===r),[l,u]=(0,x.useState)(c?r:s[0]?.node.id),d=s.some(e=>e.node.id===l)?l:c?r:s[0]?.node.id,f=e=>{e&&(u(e),window.requestAnimationFrame(()=>{document.getElementById(fg(i,e))?.focus()}))},p=e=>{if(e.type===`file`){a(e.id);return}o(e.id)},m=(t,n)=>{let r=s.findIndex(e=>e.node.id===n.node.id),i=n.node.type===`folder`&&(n.node.children===void 0||n.node.children.length>0),a=n.node.type===`folder`&&e.has(n.node.id);if(t.key===`ArrowDown`){t.preventDefault(),f(s[Math.min(r+1,s.length-1)]?.node.id);return}if(t.key===`ArrowUp`){t.preventDefault(),f(s[Math.max(r-1,0)]?.node.id);return}if(t.key===`Home`){t.preventDefault(),f(s[0]?.node.id);return}if(t.key===`End`){t.preventDefault(),f(s[s.length-1]?.node.id);return}if(t.key===`ArrowRight`&&n.node.type===`folder`){if(t.preventDefault(),!i)return;if(!a){o(n.node.id);return}f(n.node.children?.[0]?.id);return}if(t.key===`ArrowLeft`){if(t.preventDefault(),n.node.type===`folder`&&a){o(n.node.id);return}f(n.parentId);return}(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),p(n.node))};return(0,S.jsx)(`div`,{"aria-label":`Workspace files`,role:`tree`,children:s.map(n=>{let a=n.node,o=a.type===`folder`&&(a.children===void 0||a.children.length>0),s=a.type===`folder`&&e.has(a.id),c=a.type===`folder`&&t.has(a.id),l=a.id===r;return(0,S.jsxs)(`div`,{"aria-busy":c||void 0,"aria-expanded":a.type===`folder`&&o?s:void 0,"aria-level":n.level,"aria-selected":l,className:Z(`flex h-[26px] w-full min-w-0 cursor-default items-center gap-1.5 rounded-sm px-2 text-left text-[13px] font-medium text-foreground outline-none hover:bg-accent focus-visible:bg-accent`,l&&`bg-accent text-foreground hover:bg-accent focus-visible:bg-accent`),id:fg(i,a.id),role:`treeitem`,style:{paddingLeft:8+(n.level-1)*14},tabIndex:a.id===d?0:-1,title:a.name,onClick:()=>p(a),onFocus:()=>u(a.id),onKeyDown:e=>m(e,n),children:[a.type===`folder`?c?(0,S.jsx)(eu,{className:`size-4 shrink-0 animate-spin text-info`}):o&&s?(0,S.jsx)(zl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,S.jsx)(Bl,{className:Z(`size-4 shrink-0 text-muted-foreground`,!o&&`opacity-35`)}):(0,S.jsx)(wy,{icon:a.icon}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:a.name})]},a.id)})})}function Ey(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=(0,x.useCallback)(async()=>{n(e=>e??`refresh`),i(null);try{o(await Q.git.status(e))}catch(e){i({kind:`error`,text:Og(e)})}finally{n(e=>e===`refresh`?null:e)}},[e]);(0,x.useEffect)(()=>{o(null),s()},[s]);let c=(0,x.useCallback)(async(e,t,r)=>{n(e),i(null);try{o(await t()),i({kind:`info`,text:r})}catch(e){i({kind:`error`,text:Og(e)})}finally{n(null)}},[]);return{busyAction:t,canUseRepository:!!a?.isRepository,init:()=>c(`init`,()=>Q.git.init(e),`Repository initialized.`),isBusy:!!t,isLoading:t===`refresh`&&!a,notice:r,refresh:s,stage:t=>c(`stage`,()=>Q.git.stage(e,t),`Changes staged.`),status:a,unstage:t=>c(`unstage`,()=>Q.git.unstage(e,t),`Changes unstaged.`),discard:t=>c(`discard`,()=>Q.git.discard(e,t),`Changes discarded.`),commit:t=>c(`commit`,()=>Q.git.commit(e,t),`Commit created.`),pull:()=>c(`pull`,()=>Q.git.pull(e),`Pulled latest changes.`),push:()=>c(`push`,()=>Q.git.push(e),`Pushed local commits.`)}}function Dy({gitPanel:e,workspace:t}){let[n,r]=(0,x.useState)(``),i=e.status,a=i?.changes??[],o=a.filter(e=>e.staged),s=a.filter(e=>!e.staged),c=!!(n.trim()&&o.length&&!e.isBusy);return i?i.isRepository?(0,S.jsxs)(`div`,{className:`grid gap-3 text-[13px] text-muted-foreground`,children:[(0,S.jsxs)(`div`,{className:`grid gap-2 px-1.5`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-1.5 text-foreground`,children:[(0,S.jsx)(Xl,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i.branch||t.branch}),i.ahead||i.behind?(0,S.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[i.ahead?`↑${i.ahead}`:``,i.behind?` ↓${i.behind}`:``]}):null]}),(0,S.jsx)(`input`,{className:`h-8 rounded-md border border-border bg-background px-2 text-[12px] text-foreground outline-none placeholder:text-muted-foreground focus:border-primary`,placeholder:`Message (Ctrl+Enter to commit)`,value:n,onChange:e=>r(e.target.value),onKeyDown:t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&c&&e.commit(n).then(()=>r(``))}}),(0,S.jsxs)(`button`,{className:`flex h-8 items-center justify-center gap-1.5 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-45`,disabled:!c,type:`button`,onClick:()=>void e.commit(n).then(()=>r(``)),children:[(0,S.jsx)(Rl,{className:`size-4`}),`Commit`]}),e.notice?(0,S.jsx)(Oy,{notice:e.notice}):null]}),a.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ky,{actionLabel:`Unstage all`,changes:o,count:o.length,title:`Staged Changes`,onAction:()=>void e.unstage(o.map(e=>e.path)),onDiscardAll:()=>void e.discard(o.map(e=>e.path)),onDiscard:t=>void e.discard([t]),onToggle:t=>void e.unstage([t])}),(0,S.jsx)(ky,{actionLabel:`Stage all`,changes:s,count:s.length,title:`Changes`,onAction:()=>void e.stage(s.map(e=>e.path)),onDiscardAll:()=>void e.discard(s.map(e=>e.path)),onDiscard:t=>void e.discard([t]),onToggle:t=>void e.stage([t])})]}):(0,S.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:`No changes`}),i.commits.length?(0,S.jsx)(jy,{status:i}):null]}):(0,S.jsxs)(`div`,{className:`grid gap-3 px-3 py-4 text-[13px] text-muted-foreground`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground`,children:[(0,S.jsx)(Xl,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:t.name})]}),(0,S.jsx)(`p`,{className:`text-[12px] leading-5 text-muted-foreground`,children:`This workspace is not initialized as a Git repository.`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.isBusy,type:`button`,onClick:()=>void e.init(),children:`Initialize Repository`}),e.notice?(0,S.jsx)(Oy,{notice:e.notice}):null]}):(0,S.jsx)(`div`,{className:`grid h-40 place-items-center text-[12px] text-muted-foreground`,children:`Loading source control`})}function Oy({notice:e}){return(0,S.jsx)(`div`,{className:Z(`truncate rounded-md px-2 py-1 text-[11px]`,e.kind===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`),title:e.text,children:e.text})}function ky({actionLabel:e,changes:t,count:n,title:r,onAction:i,onDiscardAll:a,onDiscard:o,onToggle:s}){return n?(0,S.jsxs)(`section`,{children:[(0,S.jsxs)(`div`,{className:`group flex h-7 min-w-0 items-center gap-1 px-1.5 text-[12px] font-semibold text-muted-foreground`,children:[(0,S.jsx)(zl,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:r}),(0,S.jsx)(`span`,{className:`grid min-w-5 place-items-center rounded-full bg-secondary px-1 text-[10px] leading-5 text-secondary-foreground`,children:n}),(0,S.jsx)(`button`,{"aria-label":e,className:`grid size-6 place-items-center rounded-md text-muted-foreground opacity-0 hover:bg-accent hover:text-accent-foreground group-hover:opacity-100`,title:e,type:`button`,onClick:i,children:e.startsWith(`Unstage`)?(0,S.jsx)(nu,{className:`size-4`}):(0,S.jsx)(uu,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":`Discard all ${r.toLowerCase()}`,className:`grid size-6 place-items-center rounded-md text-muted-foreground opacity-0 hover:bg-accent hover:text-destructive group-hover:opacity-100`,title:`Discard all ${r.toLowerCase()}`,type:`button`,onClick:a,children:(0,S.jsx)(xu,{className:`size-4`})})]}),(0,S.jsx)(`div`,{children:t.map(e=>(0,S.jsx)(Ay,{change:e,onDiscard:()=>o(e.path),onToggle:()=>s(e.path)},`${e.staged}:${e.path}:${e.indexStatus}:${e.workingTreeStatus}`))})]}):null}function Ay({change:e,onDiscard:t,onToggle:n}){return(0,S.jsxs)(`div`,{className:`group flex h-[26px] min-w-0 items-center gap-2 rounded-sm px-2 text-[12px] text-muted-foreground hover:bg-accent hover:text-accent-foreground`,title:e.originalPath?`${e.originalPath} -> ${e.path}`:e.path,children:[(0,S.jsx)(`span`,{className:Z(`w-4 shrink-0 text-center font-mono text-[13px]`,Ny(e.status)),children:My(e.status)}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,S.jsxs)(`div`,{className:`hidden shrink-0 items-center gap-0.5 group-hover:flex`,children:[(0,S.jsx)(`button`,{"aria-label":e.staged?`Unstage change`:`Stage change`,className:`grid size-5 place-items-center rounded text-muted-foreground hover:bg-background hover:text-foreground`,type:`button`,onClick:n,children:e.staged?(0,S.jsx)(nu,{className:`size-3.5`}):(0,S.jsx)(uu,{className:`size-3.5`})}),(0,S.jsx)(`button`,{"aria-label":`Discard change`,className:`grid size-5 place-items-center rounded text-muted-foreground hover:bg-background hover:text-destructive`,type:`button`,onClick:t,children:(0,S.jsx)(xu,{className:`size-3.5`})})]})]})}function jy({status:e}){return(0,S.jsxs)(`section`,{className:`border-t border-border pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-1.5 text-[12px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,S.jsx)(zl,{className:`size-4`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Graph`}),(0,S.jsx)(Xl,{className:`size-3.5`}),(0,S.jsx)(`span`,{className:`truncate normal-case tracking-normal`,children:e.branch})]}),(0,S.jsx)(`div`,{children:e.commits.map((e,t)=>(0,S.jsxs)(`div`,{className:`grid h-7 min-w-0 grid-cols-[24px_minmax(0,1fr)] items-center gap-1 px-1.5 text-[12px]`,children:[(0,S.jsxs)(`span`,{className:`relative grid h-full place-items-center`,children:[(0,S.jsx)(`span`,{className:`absolute bottom-0 top-0 left-1/2 w-px -translate-x-1/2 bg-border`}),(0,S.jsx)(`span`,{className:`relative size-2 rounded-full border border-border bg-background`})]}),(0,S.jsxs)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:[e.subject,e.refs?(0,S.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:e.refs}):null]})]},`${e.hash}:${t}`))})]})}function My(e){return{added:`A`,deleted:`D`,modified:`M`,renamed:`R`,untracked:`U`}[e]}function Ny(e){return e===`added`||e===`untracked`?`text-diff-addition-foreground`:e===`deleted`?`text-diff-deletion-foreground`:e===`renamed`?`text-info`:`text-warning`}function Py({children:e,disabled:t,label:n,onClick:r}){return(0,S.jsx)(`button`,{"aria-label":n,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:t,title:n,type:`button`,onClick:r,children:e})}function Fy({activeTab:e,expandedFolderIds:t,loadingFolderIds:n,selectedFileId:r,treeId:i,workspace:a,onFileSelect:o,onFolderToggle:s,onTabChange:c}){let l=Ey(a.path),u=fy(e===`tunnels`);return(0,S.jsxs)(`aside`,{className:`grid h-full min-h-0 min-w-0 max-w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-xl border border-border bg-card`,children:[(0,S.jsxs)(`div`,{className:`flex h-10 min-w-0 items-center gap-3 px-3`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 gap-1 text-[12px] font-semibold`,children:[(0,S.jsx)(`button`,{className:Z(`rounded-md px-1.5 py-0.5`,e===`files`?`bg-accent text-foreground`:`text-muted-foreground`),type:`button`,onClick:()=>c(`files`),children:`Files`}),(0,S.jsx)(`button`,{className:Z(`rounded-md px-1.5 py-0.5`,e===`git`?`bg-accent text-foreground`:`text-muted-foreground`),type:`button`,onClick:()=>c(`git`),children:`Git`}),(0,S.jsx)(`button`,{className:Z(`rounded-md px-1.5 py-0.5`,e===`tunnels`?`bg-accent text-foreground`:`text-muted-foreground`),type:`button`,onClick:()=>c(`tunnels`),children:`Tunnels`})]}),(0,S.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1 text-muted-foreground`,children:e===`files`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Py,{label:`Refresh files`,children:(0,S.jsx)(du,{className:`size-4`})}),(0,S.jsx)(Py,{label:`Search files`,children:(0,S.jsx)(pu,{className:`size-4`})}),(0,S.jsx)(Py,{label:`Filter files`,children:(0,S.jsx)($l,{className:`size-4`})})]}):e===`git`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Py,{disabled:!l.canUseRepository||l.isBusy,label:`Pull`,onClick:()=>void l.pull(),children:(0,S.jsx)(Nl,{className:`size-4`})}),(0,S.jsx)(Py,{disabled:!l.canUseRepository||l.isBusy,label:`Push`,onClick:()=>void l.push(),children:(0,S.jsx)(Fl,{className:`size-4`})}),(0,S.jsx)(Py,{disabled:l.isBusy,label:`Refresh source control`,onClick:()=>void l.refresh(),children:(0,S.jsx)(du,{className:Z(`size-4`,l.isLoading&&`animate-spin`)})})]}):e===`tunnels`?(0,S.jsx)(Py,{disabled:u.isBusy,label:`Refresh tunnels`,onClick:()=>void u.refresh(),children:(0,S.jsx)(du,{className:Z(`size-4`,u.isLoading&&`animate-spin`)})}):null})]}),(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 max-w-full overflow-auto px-1.5 pb-3 pt-1 ide-scrollbar`,children:e===`files`?(0,S.jsx)(Ty,{expandedFolderIds:t,loadingFolderIds:n,nodes:a.fileTree,selectedFileId:r,treeId:i,onFileSelect:o,onFolderToggle:s}):e===`git`?(0,S.jsx)(Dy,{gitPanel:l,workspace:a}):(0,S.jsx)(py,{cloudflaredPanel:u})})]})}function Iy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ly(e){if(Array.isArray(e))return e}function Ry(e,t,n){return(t=qy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zy(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function By(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vy(Object(n),!0).forEach(function(t){Ry(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Uy(e,t){if(e==null)return{};var n,r,i=Wy(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Wy(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Gy(e,t){return Ly(e)||zy(e,t)||Jy(e,t)||By()}function Ky(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function qy(e){var t=Ky(e,`string`);return typeof t==`symbol`?t:t+``}function Jy(e,t){if(e){if(typeof e==`string`)return Iy(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Iy(e,t):void 0}}function Yy(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Xy(Object(n),!0).forEach(function(t){Yy(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qy(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function $y(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function eb(e){return{}.toString.call(e).includes(`Object`)}function tb(e){return!Object.keys(e).length}function nb(e){return typeof e==`function`}function rb(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ib(e,t){return eb(t)||lb(`changeType`),Object.keys(t).some(function(t){return!rb(e,t)})&&lb(`changeField`),t}function ab(e){nb(e)||lb(`selectorType`)}function ob(e){nb(e)||eb(e)||lb(`handlerType`),eb(e)&&Object.values(e).some(function(e){return!nb(e)})&&lb(`handlersType`)}function sb(e){e||lb(`initialIsRequired`),eb(e)||lb(`initialType`),tb(e)&&lb(`initialContent`)}function cb(e,t){throw Error(e[t]||e.default)}var lb=$y(cb)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),ub={changes:ib,selector:ab,handler:ob,initial:sb};function db(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ub.initial(e),ub.handler(t);var n={current:e},r=$y(mb)(n,t),i=$y(pb)(n),a=$y(ub.changes)(e),o=$y(fb)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return ub.selector(e),e(n.current)}function c(e){Qy(r,i,a,o)(e)}return[s,c]}function fb(e,t){return nb(t)?t(e.current):t}function pb(e,t){return e.current=Zy(Zy({},e.current),t),t}function mb(e,t,n){return nb(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var hb={create:db},gb={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function _b(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function vb(e){return{}.toString.call(e).includes(`Object`)}function yb(e){return e||Cb(`configIsRequired`),vb(e)||Cb(`configType`),e.urls?(bb(),{paths:{vs:e.urls.monacoBase}}):e}function bb(){console.warn(Sb.deprecation)}function xb(e,t){throw Error(e[t]||e.default)}var Sb={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
19
+ You are using deprecated way of configuration.
20
+
21
+ Instead of using
22
+ monaco.config({ urls: { monacoBase: '...' } })
23
+ use
24
+ monaco.config({ paths: { vs: '...' } })
25
+
26
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
27
+ `},Cb=_b(xb)(Sb),wb={config:yb},Tb=function(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}};function Eb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Eb(e[n],t[n]))}),Hy(Hy({},e),t)}var Db={type:`cancelation`,msg:`operation is manually canceled`};function Ob(e){var t=!1,n=new Promise(function(n,r){e.then(function(e){return t?r(Db):n(e)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var kb=[`monaco`],Ab=Gy(hb.create({config:gb,isInitialized:!1,resolve:null,reject:null,monaco:null}),2),jb=Ab[0],Mb=Ab[1];function Nb(e){var t=wb.config(e),n=t.monaco,r=Uy(t,kb);Mb(function(e){return{config:Eb(e.config,r),monaco:n}})}function Pb(){var e=jb(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(Mb({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ob(Vb);if(window.monaco&&window.monaco.editor)return zb(window.monaco),e.resolve(window.monaco),Ob(Vb);Tb(Fb,Lb)(Rb)}return Ob(Vb)}function Fb(e){return document.body.appendChild(e)}function Ib(e){var t=document.createElement(`script`);return e&&(t.src=e),t}function Lb(e){var t=jb(function(e){return{config:e.config,reject:e.reject}}),n=Ib(`${t.config.paths.vs}/loader.js`);return n.onload=function(){return e()},n.onerror=t.reject,n}function Rb(){var e=jb(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t([`vs/editor/editor.main`],function(t){var n=t.m||t;zb(n),e.resolve(n)},function(t){e.reject(t)})}function zb(e){jb().monaco||Mb({monaco:e})}function Bb(){return jb(function(e){return e.monaco})}var Vb=new Promise(function(e,t){return Mb({resolve:e,reject:t})}),Hb={config:Nb,init:Pb,__getMonacoInstance:Bb},Ub={wrapper:{display:`flex`,position:`relative`,textAlign:`initial`},fullWidth:{width:`100%`},hide:{display:`none`}},Wb={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}};function Gb({children:e}){return x.createElement(`div`,{style:Wb.container},e)}var Kb=Gb;function qb({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:a,wrapperProps:o}){return x.createElement(`section`,{style:{...Ub.wrapper,width:e,height:t},...o},!n&&x.createElement(Kb,null,r),x.createElement(`div`,{ref:i,style:{...Ub.fullWidth,...!n&&Ub.hide},className:a}))}var Jb=(0,x.memo)(qb);function Yb(e){(0,x.useEffect)(e,[])}var Xb=Yb;function Zb(e,t,n=!0){let r=(0,x.useRef)(!0);(0,x.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)}var Qb=Zb;function $b(){}function ex(e,t,n,r){return tx(e,r)||nx(e,t,n,r)}function tx(e,t){return e.editor.getModel(rx(e,t))}function nx(e,t,n,r){return e.editor.createModel(t,n,r?rx(e,r):void 0)}function rx(e,t){return e.Uri.parse(t)}function ix({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:c=!1,theme:l=`light`,loading:u=`Loading...`,options:d={},height:f=`100%`,width:p=`100%`,className:m,wrapperProps:h={},beforeMount:g=$b,onMount:_=$b}){let[v,y]=(0,x.useState)(!1),[b,S]=(0,x.useState)(!0),C=(0,x.useRef)(null),w=(0,x.useRef)(null),T=(0,x.useRef)(null),E=(0,x.useRef)(_),D=(0,x.useRef)(g),O=(0,x.useRef)(!1);Xb(()=>{let e=Hb.init();return e.then(e=>(w.current=e)&&S(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>C.current?j():e.cancel()}),Qb(()=>{if(C.current&&w.current){let t=C.current.getOriginalEditor(),i=ex(w.current,e||``,r||n||`text`,a||``);i!==t.getModel()&&t.setModel(i)}},[a],v),Qb(()=>{if(C.current&&w.current){let e=C.current.getModifiedEditor(),r=ex(w.current,t||``,i||n||`text`,o||``);r!==e.getModel()&&e.setModel(r)}},[o],v),Qb(()=>{let e=C.current.getModifiedEditor();e.getOption(w.current.editor.EditorOption.readOnly)?e.setValue(t||``):t!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:t||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[t],v),Qb(()=>{C.current?.getModel()?.original.setValue(e||``)},[e],v),Qb(()=>{let{original:e,modified:t}=C.current.getModel();w.current.editor.setModelLanguage(e,r||n||`text`),w.current.editor.setModelLanguage(t,i||n||`text`)},[n,r,i],v),Qb(()=>{w.current?.editor.setTheme(l)},[l],v),Qb(()=>{C.current?.updateOptions(d)},[d],v);let k=(0,x.useCallback)(()=>{if(!w.current)return;D.current(w.current);let s=ex(w.current,e||``,r||n||`text`,a||``),c=ex(w.current,t||``,i||n||`text`,o||``);C.current?.setModel({original:s,modified:c})},[n,t,i,e,r,a,o]),A=(0,x.useCallback)(()=>{!O.current&&T.current&&(C.current=w.current.editor.createDiffEditor(T.current,{automaticLayout:!0,...d}),k(),w.current?.editor.setTheme(l),y(!0),O.current=!0)},[d,l,k]);(0,x.useEffect)(()=>{v&&E.current(C.current,w.current)},[v]),(0,x.useEffect)(()=>{!b&&!v&&A()},[b,v,A]);function j(){let e=C.current?.getModel();s||e?.original?.dispose(),c||e?.modified?.dispose(),C.current?.dispose()}return x.createElement(Jb,{width:p,height:f,isEditorReady:v,loading:u,_ref:T,className:m,wrapperProps:h})}(0,x.memo)(ix);function ax(e){let t=(0,x.useRef)();return(0,x.useEffect)(()=>{t.current=e},[e]),t.current}var ox=ax,sx=new Map;function cx({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:a,theme:o=`light`,line:s,loading:c=`Loading...`,options:l={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p=`100%`,height:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=$b,onMount:v=$b,onChange:y,onValidate:b=$b}){let[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(!0),E=(0,x.useRef)(null),D=(0,x.useRef)(null),O=(0,x.useRef)(null),k=(0,x.useRef)(v),A=(0,x.useRef)(_),j=(0,x.useRef)(),M=(0,x.useRef)(r),N=ox(a),P=(0,x.useRef)(!1),F=(0,x.useRef)(!1);Xb(()=>{let e=Hb.init();return e.then(e=>(E.current=e)&&T(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>D.current?L():e.cancel()}),Qb(()=>{let o=ex(E.current,e||r||``,t||i||``,a||n||``);o!==D.current?.getModel()&&(d&&sx.set(N,D.current?.saveViewState()),D.current?.setModel(o),d&&D.current?.restoreViewState(sx.get(a)))},[a],S),Qb(()=>{D.current?.updateOptions(l)},[l],S),Qb(()=>{!D.current||r===void 0||(D.current.getOption(E.current.editor.EditorOption.readOnly)?D.current.setValue(r):r!==D.current.getValue()&&(F.current=!0,D.current.executeEdits(``,[{range:D.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),D.current.pushUndoStop(),F.current=!1))},[r],S),Qb(()=>{let e=D.current?.getModel();e&&i&&E.current?.editor.setModelLanguage(e,i)},[i],S),Qb(()=>{s!==void 0&&D.current?.revealLine(s)},[s],S),Qb(()=>{E.current?.editor.setTheme(o)},[o],S);let I=(0,x.useCallback)(()=>{if(!(!O.current||!E.current)&&!P.current){A.current(E.current);let c=a||n,f=ex(E.current,r||e||``,t||i||``,c||``);D.current=E.current?.editor.create(O.current,{model:f,automaticLayout:!0,...l},u),d&&D.current.restoreViewState(sx.get(c)),E.current.editor.setTheme(o),s!==void 0&&D.current.revealLine(s),C(!0),P.current=!0}},[e,t,n,r,i,a,l,u,d,o,s]);(0,x.useEffect)(()=>{S&&k.current(D.current,E.current)},[S]),(0,x.useEffect)(()=>{!w&&!S&&I()},[w,S,I]),M.current=r,(0,x.useEffect)(()=>{S&&y&&(j.current?.dispose(),j.current=D.current?.onDidChangeModelContent(e=>{F.current||y(D.current.getValue(),e)}))},[S,y]),(0,x.useEffect)(()=>{if(S){let e=E.current.editor.onDidChangeMarkers(e=>{let t=D.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=E.current.editor.getModelMarkers({resource:t});b?.(e)}});return()=>{e?.dispose()}}return()=>{}},[S,b]);function L(){j.current?.dispose(),f?d&&sx.set(a,D.current.saveViewState()):D.current.getModel()?.dispose(),D.current.dispose()}return x.createElement(Jb,{width:p,height:m,isEditorReady:S,loading:c,_ref:O,className:h,wrapperProps:g})}var lx=(0,x.memo)(cx);function ux(e){let t=e.languages.typescript,n={noSemanticValidation:!0,noSuggestionDiagnostics:!0,noSyntaxValidation:!1};t.typescriptDefaults?.setDiagnosticsOptions(n),t.javascriptDefaults?.setDiagnosticsOptions(n)}var dx=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function fx(e){if(typeof document>`u`||!document.body)return mx(e)??e;let t=document.createElement(`span`);t.style.color=e,t.style.position=`absolute`,t.style.pointerEvents=`none`,t.style.visibility=`hidden`,document.body.appendChild(t);let n=window.getComputedStyle(t).color;return t.remove(),mx(n)??mx(e)??e}function px(e,t){return typeof window>`u`?mx(t)??t:fx(window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t)}function mx(e){let t=e.trim();return t?dx.test(t)?hx(t):t.startsWith(`oklch(`)?vx(t):t.startsWith(`rgb(`)||t.startsWith(`rgba(`)?gx(t):t.startsWith(`color(srgb `)?_x(t):null:null}function hx(e){let t=e.slice(1);return t.length===3||t.length===4?`#${t.slice(0,3).split(``).map(e=>`${e}${e}`).join(``)}`:`#${t.slice(0,6)}`}function gx(e){let t=e.replace(/^rgba?\(/,``).replace(/\)$/,``).replace(/\s*\/\s*[\d.]+%?$/,``).replaceAll(`,`,` `).trim().split(/\s+/).slice(0,3).map(yx);return t.length!==3||t.some(e=>e===null)?null:Cx(t)}function _x(e){let t=e.replace(/^color\(srgb\s+/,``).replace(/\)$/,``).replace(/\s*\/\s*[\d.]+%?$/,``).trim().split(/\s+/).slice(0,3).map(e=>wx(Number(e))*255);return t.length!==3||t.some(e=>Number.isNaN(e))?null:Cx(t)}function vx(e){let t=e.replace(/^oklch\(/,``).replace(/\)$/,``).replace(/\s*\/\s*[\d.]+%?$/,``).trim().split(/\s+/);if(t.length<3)return null;let n=bx(t[0]),r=Number(t[1]),i=xx(t[2]);if([n,r,i].some(e=>Number.isNaN(e)))return null;let a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3;return Cx([Sx(4.0767416621*d-3.3077115913*f+.2309699292*p)*255,Sx(-1.2684380046*d+2.6097574011*f-.3413193965*p)*255,Sx(-.0041960863*d-.7034186147*f+1.707614701*p)*255])}function yx(e){if(e.endsWith(`%`)){let t=Number(e.slice(0,-1));return Number.isNaN(t)?null:wx(t/100)*255}let t=Number(e);return Number.isNaN(t)?null:Tx(t,0,255)}function bx(e){return e.endsWith(`%`)?wx(Number(e.slice(0,-1))/100):wx(Number(e))}function xx(e){return e===`none`?0:e.endsWith(`turn`)?Number(e.slice(0,-4))*360:e.endsWith(`rad`)?Number(e.slice(0,-3))*180/Math.PI:e.endsWith(`deg`)?Number(e.slice(0,-3)):Number(e)}function Sx(e){let t=wx(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function Cx(e){return`#${e.map(e=>Math.round(Tx(e,0,255)).toString(16).padStart(2,`0`)).join(``)}`}function wx(e){return Tx(e,0,1)}function Tx(e,t,n){return Math.min(Math.max(e,t),n)}function Ex(){let e=px(`--ide-terminal`,`oklch(0.14 0.004 285)`),t=px(`--foreground`,`oklch(0.88 0.006 285)`),n=px(`--muted-foreground`,`oklch(0.67 0.006 285)`),r=px(`--info`,`oklch(0.75 0.13 250)`),i=px(`--success`,`oklch(0.7 0.16 150)`),a=px(`--warning`,`oklch(0.78 0.14 82)`),o=px(`--destructive`,`oklch(0.66 0.2 25)`),s=px(`--primary`,`oklch(0.58 0.16 276)`);return{background:e,black:e,blue:r,brightBlack:n,brightBlue:r,brightCyan:px(`--chart-2`,`oklch(0.696 0.17 162.48)`),brightGreen:i,brightMagenta:px(`--chart-4`,`oklch(0.627 0.265 303.9)`),brightRed:o,brightWhite:px(`--foreground`,`oklch(0.985 0 0)`),brightYellow:a,cursor:t,cyan:px(`--chart-2`,`oklch(0.696 0.17 162.48)`),foreground:t,green:i,magenta:s,red:o,selectionBackground:px(`--primary`,`oklch(0.58 0.16 276)`),white:t,yellow:a}}function Dx(e,t){let n=Ox(t);return e.editor.defineTheme(n,{base:t===`dark`?`vs-dark`:`vs`,inherit:!0,rules:[],colors:{"editor.background":px(`--ide-editor`,`oklch(0.19 0.004 285)`),"editor.lineHighlightBackground":px(`--accent`,`oklch(0.27 0.006 285)`),"editor.selectionBackground":px(`--primary`,`oklch(0.58 0.16 276)`),"editorCursor.foreground":px(`--foreground`,`oklch(0.88 0.006 285)`),"editorLineNumber.activeForeground":px(`--foreground`,`oklch(0.88 0.006 285)`),"editorLineNumber.foreground":px(`--muted-foreground`,`oklch(0.67 0.006 285)`)}}),n}function Ox(e){return`pockcode-${e}`}function kx({content:e,file:t,openFiles:n,revealTarget:r,workspace:i,onFileClose:a,onContentChange:o,onFileSelect:s,onOpenDialog:c,onToggleMode:l}){return(0,S.jsxs)(`section`,{className:`grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-xl border border-border bg-card`,children:[(0,S.jsxs)(`div`,{className:`flex h-10 min-w-0 items-stretch border-b border-border bg-secondary/40 text-[12px] font-medium text-muted-foreground`,children:[(0,S.jsx)(`div`,{className:`flex min-w-0 flex-1 overflow-x-auto ide-scrollbar`,children:n.map(e=>{let n=e.id===t.id,r=p_(i.fileTree,e.id)?.join(` / `)??e.name;return(0,S.jsxs)(`div`,{className:Z(`group relative flex h-full min-w-32 max-w-48 shrink-0 items-center border-l border-border`,n?`bg-accent text-foreground`:`bg-secondary/40 text-muted-foreground hover:bg-accent/50`),title:r,children:[n?(0,S.jsx)(`span`,{className:`absolute inset-x-0 top-0 h-0.5 bg-primary`}):null,(0,S.jsxs)(`button`,{className:`flex h-full min-w-0 flex-1 items-center gap-2 px-2 text-left`,type:`button`,onClick:()=>s(e.id),children:[(0,S.jsx)(wy,{icon:e.icon}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]}),(0,S.jsx)(`button`,{"aria-label":`Close ${e.name}`,className:Z(`mr-1 grid size-5 shrink-0 place-items-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground`,n?`opacity-100`:`opacity-0 group-hover:opacity-100`),type:`button`,onClick:()=>a(e.id),children:(0,S.jsx)(Cu,{className:`size-3`})})]},e.id)})}),(0,S.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-l border-border px-2`,children:(0,S.jsx)(cv,{mode:`editor`,onClick:l})})]}),(0,S.jsx)(jx,{content:e,file:t,revealTarget:r,workspace:i,onContentChange:o,footerAction:(0,S.jsx)(`button`,{"aria-label":`Open current file in dialog`,className:`grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Open current file in dialog`,type:`button`,onClick:c,children:(0,S.jsx)(cu,{className:`size-3.5`})})})]})}function Ax({content:e,file:t,revealTarget:n,workspace:r,onClose:i,onContentChange:a,onOpenInMain:o}){let s=p_(r.fileTree,t.id)?.join(` / `)??t.name;return(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-6`,role:`dialog`,"aria-modal":`true`,children:(0,S.jsxs)(`div`,{className:`grid h-[72vh] w-full max-w-4xl grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`flex h-11 min-w-0 items-center gap-2 px-3 text-[12px] font-medium text-muted-foreground`,children:[(0,S.jsx)(wy,{icon:t.icon}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:s}),(0,S.jsx)(`button`,{"aria-label":`Close file dialog`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:i,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsx)(jx,{content:e,file:t,revealTarget:n,workspace:r,onContentChange:a,footerAction:(0,S.jsx)(`button`,{"aria-label":`Collapse file to main editor`,className:`grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Collapse to main editor`,type:`button`,onClick:o,children:(0,S.jsx)(Gl,{className:`size-3.5`})})})]})})}function jx({content:e,file:t,footerAction:n,revealTarget:r,workspace:i,onContentChange:a}){let o=t.language??h_(t.name),s=t.language??g_(t.name),c=t.path??`${i.id}/${t.id.replace(/[:/]/g,`_`)}/${t.name}`,l=e.split(`
28
+ `),u=(0,x.useRef)(null),[d,f]=(0,x.useState)(null),{resolvedTheme:p}=M(),m=Ox(p),h=(0,x.useCallback)(e=>{let n=u.current;if(!n||e.fileId!==t.id)return;let r=n.getModel()?.getLineCount()??l.length,i=Mx(e.lineNumber??1,1,Math.max(1,r)),a=Mx(e.column??1,1,n.getModel()?.getLineMaxColumn(i)??1);n.setPosition({lineNumber:i,column:a}),n.revealLineInCenter(i),n.focus()},[t.id,l.length]);return(0,x.useEffect)(()=>{if(!r)return;let e=window.requestAnimationFrame(()=>h(r));return()=>window.cancelAnimationFrame(e)},[h,r?.nonce]),(0,x.useEffect)(()=>{d&&d.editor.setTheme(Dx(d,p))},[d,p]),(0,S.jsxs)(`div`,{className:`grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto] bg-card`,children:[(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,S.jsx)(lx,{height:`100%`,language:s,path:c,theme:m,value:e,beforeMount:e=>{ux(e),Dx(e,p)},onChange:e=>a(t.id,e??``),onMount:(e,t)=>{u.current=e,f(t),r&&window.requestAnimationFrame(()=>h(r))},options:{automaticLayout:!0,bracketPairColorization:{enabled:!0},contextmenu:!0,cursorBlinking:`smooth`,fixedOverflowWidgets:!0,fontFamily:`"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace`,fontSize:12,guides:{bracketPairs:!0,indentation:!0},lineHeight:20,minimap:{enabled:!1},overviewRulerBorder:!1,padding:{bottom:12,top:12},renderLineHighlight:`all`,scrollBeyondLastLine:!1,smoothScrolling:!0,tabSize:2,wordWrap:`off`}})}),(0,S.jsxs)(`div`,{className:`flex h-8 items-center gap-2 border-t border-border px-3 text-[11px] font-medium text-muted-foreground`,children:[(0,S.jsx)(`span`,{children:o}),(0,S.jsx)(`span`,{className:`h-3 w-px bg-border`}),(0,S.jsxs)(`span`,{children:[l.length,` lines`]}),n?(0,S.jsx)(`div`,{className:`ml-auto`,children:n}):null]})]})}function Mx(e,t,n){return Math.min(Math.max(e,t),n)}function Nx(){return{accountIds:[],argsText:``,bearerTokenEnvVar:``,command:``,cwd:``,defaultToolsApprovalMode:``,disabledToolsText:``,displayName:``,enabled:!0,enabledToolsText:``,envHttpHeadersText:``,envText:``,envVarsText:``,httpHeadersText:``,name:``,oauthClientId:``,oauthResource:``,required:!1,scopesText:``,startupTimeoutSec:``,toolOverridesText:``,toolTimeoutSec:``,transportType:`stdio`,url:``}}function Px(e){let t=Nx(),n=e.toolPolicy,r=e.transport;return{...t,accountIds:e.installations.map(e=>e.accountId),defaultToolsApprovalMode:n.defaultToolsApprovalMode??``,disabledToolsText:Lx(n.disabledTools??[]),displayName:e.displayName??``,enabled:e.enabled,enabledToolsText:Lx(n.enabledTools??[]),name:e.name,required:e.required,startupTimeoutSec:e.startupTimeoutSec===null||e.startupTimeoutSec===void 0?``:String(e.startupTimeoutSec),toolOverridesText:Hx(n.tools),toolTimeoutSec:e.toolTimeoutSec===null||e.toolTimeoutSec===void 0?``:String(e.toolTimeoutSec),transportType:r.type,...r.type===`stdio`?{argsText:Lx(r.args),command:r.command,cwd:r.cwd??``,envText:zx(r.env),envVarsText:Lx(r.envVars.map(e=>typeof e==`string`?e:e.name))}:{bearerTokenEnvVar:r.bearerTokenEnvVar??``,envHttpHeadersText:zx(r.envHttpHeaders),httpHeadersText:zx(r.httpHeaders),oauthClientId:r.oauthClientId??``,oauthResource:r.oauthResource??``,scopesText:Lx(r.scopes),url:r.url}}}function Fx(e){let t=Bx(e.startupTimeoutSec,`Startup timeout`),n=Bx(e.toolTimeoutSec,`Tool timeout`),r=e.transportType===`stdio`?{args:Ix(e.argsText),command:e.command.trim(),cwd:e.cwd.trim()||null,env:Rx(e.envText,`Env`),envVars:Ix(e.envVarsText),type:`stdio`}:{bearerTokenEnvVar:e.bearerTokenEnvVar.trim()||null,envHttpHeaders:Rx(e.envHttpHeadersText,`Env headers`),httpHeaders:Rx(e.httpHeadersText,`Headers`),oauthClientId:e.oauthClientId.trim()||null,oauthResource:e.oauthResource.trim()||null,scopes:Ix(e.scopesText),type:`streamable_http`,url:e.url.trim()};return{accountIds:e.accountIds,displayName:e.displayName.trim()||null,enabled:e.enabled,name:e.name.trim(),required:e.required,startupTimeoutSec:t,toolPolicy:{defaultToolsApprovalMode:e.defaultToolsApprovalMode||null,disabledTools:Ix(e.disabledToolsText),enabledTools:Ix(e.enabledToolsText),tools:Vx(e.toolOverridesText)},toolTimeoutSec:n,transport:r}}function Ix(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter((e,t,n)=>!!e&&n.indexOf(e)===t)}function Lx(e){return e.join(`
29
+ `)}function Rx(e,t){let n={};for(let r of e.split(/\r?\n/)){let e=r.trim();if(!e)continue;let i=e.indexOf(`=`);if(i<=0)throw Error(`${t} entries must use KEY=VALUE.`);n[e.slice(0,i).trim()]=e.slice(i+1).trim()}return n}function zx(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
30
+ `)}function Bx(e,t){if(!e.trim())return null;let n=Number(e);if(!Number.isFinite(n)||n<0)throw Error(`${t} must be a positive number.`);return n}function Vx(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let r=e.includes(`=`)?e.indexOf(`=`):e.indexOf(`:`);if(r<=0)throw Error(`Tool approval entries must use tool=mode.`);let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();if(a!==`auto`&&a!==`prompt`&&a!==`approve`)throw Error(`Tool approval modes must be auto, prompt, or approve.`);t[i]={approvalMode:a}}return t}function Hx(e){return e?Object.entries(e).filter(([,e])=>e.approvalMode).map(([e,t])=>`${e}=${t.approvalMode}`).join(`
31
+ `):``}function Ux({open:e,onClose:t}){let[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(()=>Nx()),[o,s]=(0,x.useState)(!0),[c,l]=(0,x.useState)(null),[u,d]=(0,x.useState)(!1),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)([]),[b,C]=(0,x.useState)(``),[w,T]=(0,x.useState)([]),[E,D]=(0,x.useState)(!1),O=n.filter(e=>e.providerId===`codex`),k=v.find(e=>e.id===g)??null,A=k?w.find(e=>e.name===k.name):null,j=async(e=g)=>{s(!0),l(null);try{let[t,n]=await Promise.all([Q.mcpServers.list(),Q.providerAccounts.list()]);y(t),r(n);let i=t.find(t=>t.id===e)??t[0]??null;_(i?.id??null),a(i?Px(i):Nx());let o=n.find(e=>e.providerId===`codex`)?.id??``;C(e=>e||i?.installations[0]?.accountId||o)}catch(e){l({kind:`error`,text:Og(e)})}finally{s(!1)}};(0,x.useEffect)(()=>{e&&j()},[e]);let M=e=>{_(e.id),a(Px(e)),l(null)},N=()=>{_(null),a(Nx()),T([]),l(null)},P=async()=>{h(!0),l(null);try{let e=Fx(i),t=k?await Q.mcpServers.update(k.id,e):await Q.mcpServers.create(e);_(t.id),a(Px(t)),await j(t.id),l({kind:`info`,text:`Saved`})}catch(e){l({kind:`error`,text:Og(e)})}finally{h(!1)}},F=async()=>{if(!(!k||!window.confirm(`Delete MCP server?`))){h(!0),l(null);try{await Q.mcpServers.delete(k.id),_(null),a(Nx()),await j(null),l({kind:`info`,text:`Deleted`})}catch(e){l({kind:`error`,text:Og(e)})}finally{h(!1)}}},I=async()=>{if(!k){await P();return}D(!0),l(null);try{a(Px(await Q.mcpServers.sync(k.id,{accountIds:i.accountIds}))),await j(),l({kind:`info`,text:`Synced`});let e=b||i.accountIds[0];e&&await L(e)}catch(e){l({kind:`error`,text:Og(e)})}finally{D(!1)}},L=async(e=b||i.accountIds[0]||O[0]?.id||``)=>{if(!e){l({kind:`error`,text:`Choose a Codex account.`});return}p(!0),l(null);try{let t=await Q.mcpServers.status(e);C(e),T(t.data)}catch(e){l({kind:`error`,text:Og(e)})}finally{p(!1)}},R=async()=>{if(!k){l({kind:`error`,text:`Save this MCP server before OAuth login.`});return}let e=b||i.accountIds[0]||O[0]?.id;if(!e){l({kind:`error`,text:`Choose a Codex account.`});return}d(!0),l(null);try{let t=await Q.mcpServers.oauthLogin(k.id,{accountId:e,scopes:Ix(i.scopesText)});window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`),await Wm(800),await L(e),l({kind:`info`,text:`OAuth started`})}catch(e){l({kind:`error`,text:Og(e)})}finally{d(!1)}},z=(e,t)=>{a(n=>({...n,[e]:t}))};return e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close MCP servers`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:t}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[86vh] w-full max-w-5xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(hu,{className:`size-4 shrink-0 text-info`}),(0,S.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:`MCP Servers`}),(0,S.jsx)(`button`,{"aria-label":`Add MCP server`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Add`,type:`button`,onClick:N,children:(0,S.jsx)(uu,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":`Refresh MCP servers`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Refresh`,type:`button`,onClick:()=>void j(),children:(0,S.jsx)(du,{className:Z(`size-4`,o&&`animate-spin`)})}),(0,S.jsx)(`button`,{"aria-label":`Close MCP servers`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:t,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[260px_minmax(0,1fr)] overflow-hidden`,children:[(0,S.jsx)(`aside`,{className:`min-h-0 overflow-auto border-r border-border p-2 ide-scrollbar`,children:o?(0,S.jsx)(`div`,{className:`grid min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`Loading`}):v.length?(0,S.jsx)(`div`,{className:`space-y-1`,children:v.map(e=>{let t=e.id===g,n=e.installations.find(e=>e.lastError)?.lastError;return(0,S.jsxs)(`button`,{"aria-pressed":t||void 0,className:Z(`grid w-full gap-1 rounded-md px-2 py-2 text-left hover:bg-accent`,t&&`bg-accent`),type:`button`,onClick:()=>M(e),children:[(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.displayName||e.name}),(0,S.jsx)(`span`,{className:`shrink-0 rounded border border-border px-1.5 py-0.5 text-[10px] uppercase text-muted-foreground`,children:e.transport.type===`stdio`?`stdio`:`http`})]}),(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e.name}),(0,S.jsx)(`span`,{className:`ml-auto shrink-0`,children:e.installations.length})]}),n?(0,S.jsx)(`span`,{className:`truncate text-[11px] text-destructive`,children:n}):null]},e.id)})}):(0,S.jsx)(`div`,{className:`grid min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`No MCP servers`})}),(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[c?(0,S.jsx)(`div`,{className:Z(`mb-3 rounded-md border px-3 py-2 text-[12px]`,c.kind===`error`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-success/30 bg-success/10 text-success`),children:c.text}):null,(0,S.jsxs)(`div`,{className:`grid gap-4`,children:[(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,S.jsx)(Wx,{label:`Name`,value:i.name,onChange:e=>z(`name`,e)}),(0,S.jsx)(Wx,{label:`Display`,value:i.displayName,onChange:e=>z(`displayName`,e)})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`flex overflow-hidden rounded-md border border-border`,children:[`stdio`,`streamable_http`].map(e=>(0,S.jsx)(`button`,{className:Z(`h-8 px-3 text-[12px] font-medium`,i.transportType===e?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent`),type:`button`,onClick:()=>z(`transportType`,e),children:e===`stdio`?`stdio`:`HTTP`},e))}),(0,S.jsxs)(`label`,{className:`flex h-8 items-center gap-2 rounded-md border border-border px-2 text-[12px] text-foreground`,children:[(0,S.jsx)(`input`,{checked:i.enabled,className:`accent-primary`,type:`checkbox`,onChange:e=>z(`enabled`,e.currentTarget.checked)}),`Enabled`]}),(0,S.jsxs)(`label`,{className:`flex h-8 items-center gap-2 rounded-md border border-border px-2 text-[12px] text-foreground`,children:[(0,S.jsx)(`input`,{checked:i.required,className:`accent-primary`,type:`checkbox`,onChange:e=>z(`required`,e.currentTarget.checked)}),`Required`]})]}),i.transportType===`stdio`?(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,S.jsx)(Wx,{label:`Command`,value:i.command,onChange:e=>z(`command`,e)}),(0,S.jsx)(Wx,{label:`cwd`,value:i.cwd,onChange:e=>z(`cwd`,e)}),(0,S.jsx)(Gx,{label:`Args`,value:i.argsText,onChange:e=>z(`argsText`,e)}),(0,S.jsx)(Gx,{label:`Env`,value:i.envText,onChange:e=>z(`envText`,e)}),(0,S.jsx)(Gx,{label:`Env vars`,value:i.envVarsText,onChange:e=>z(`envVarsText`,e)})]}):(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,S.jsx)(Wx,{label:`URL`,value:i.url,onChange:e=>z(`url`,e)}),(0,S.jsx)(Wx,{label:`Bearer env`,value:i.bearerTokenEnvVar,onChange:e=>z(`bearerTokenEnvVar`,e)}),(0,S.jsx)(Gx,{label:`Headers`,value:i.httpHeadersText,onChange:e=>z(`httpHeadersText`,e)}),(0,S.jsx)(Gx,{label:`Env headers`,value:i.envHttpHeadersText,onChange:e=>z(`envHttpHeadersText`,e)}),(0,S.jsx)(Wx,{label:`OAuth client`,value:i.oauthClientId,onChange:e=>z(`oauthClientId`,e)}),(0,S.jsx)(Wx,{label:`OAuth resource`,value:i.oauthResource,onChange:e=>z(`oauthResource`,e)}),(0,S.jsx)(Gx,{label:`Scopes`,value:i.scopesText,onChange:e=>z(`scopesText`,e)})]}),(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,S.jsx)(Wx,{label:`Startup timeout`,value:i.startupTimeoutSec,onChange:e=>z(`startupTimeoutSec`,e)}),(0,S.jsx)(Wx,{label:`Tool timeout`,value:i.toolTimeoutSec,onChange:e=>z(`toolTimeoutSec`,e)}),(0,S.jsxs)(`label`,{className:`grid gap-1 text-[12px] text-muted-foreground`,children:[`Approval`,(0,S.jsxs)(`select`,{className:`h-8 rounded-md border border-border bg-background px-2 text-[13px] text-foreground outline-none focus:border-primary`,value:i.defaultToolsApprovalMode,onChange:e=>z(`defaultToolsApprovalMode`,e.currentTarget.value),children:[(0,S.jsx)(`option`,{value:``,children:`Default`}),(0,S.jsx)(`option`,{value:`auto`,children:`Auto`}),(0,S.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,S.jsx)(`option`,{value:`approve`,children:`Approve`})]})]}),(0,S.jsx)(Gx,{label:`Enabled tools`,value:i.enabledToolsText,onChange:e=>z(`enabledToolsText`,e)}),(0,S.jsx)(Gx,{label:`Disabled tools`,value:i.disabledToolsText,onChange:e=>z(`disabledToolsText`,e)}),(0,S.jsx)(Gx,{label:`Tool approvals`,value:i.toolOverridesText,onChange:e=>z(`toolOverridesText`,e)})]}),(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:`Accounts`}),O.length?(0,S.jsx)(`div`,{className:`grid gap-1 md:grid-cols-2`,children:O.map(e=>(0,S.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-border px-2 py-1.5 text-[12px] text-foreground`,children:[(0,S.jsx)(`input`,{checked:i.accountIds.includes(e.id),className:`accent-primary`,type:`checkbox`,onChange:t=>{z(`accountIds`,t.currentTarget.checked?[...i.accountIds,e.id]:i.accountIds.filter(t=>t!==e.id))}}),(0,S.jsx)(uv,{icon:`codex`,className:`size-3.5 shrink-0 text-info`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.displayName}),(0,S.jsx)(fv,{status:e.status})]},e.id))}):(0,S.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:`No Codex accounts`})]}),(0,S.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(`select`,{className:`h-8 min-w-56 rounded-md border border-border bg-background px-2 text-[13px] text-foreground outline-none focus:border-primary`,value:b,onChange:e=>C(e.currentTarget.value),children:[(0,S.jsx)(`option`,{value:``,children:`Account`}),O.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.displayName},e.id))]}),(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md border border-border px-2 text-[12px] text-foreground hover:bg-accent`,type:`button`,onClick:()=>void L(),children:[(0,S.jsx)(du,{className:Z(`size-3.5`,f&&`animate-spin`)}),`Refresh`]}),A?(0,S.jsxs)(`span`,{className:`text-[12px] text-muted-foreground`,children:[A.authStatus,` · `,A.toolCount,` tools`]}):null]}),A?.error||A?.lastError?(0,S.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive`,children:A.error||A.lastError}):A?(0,S.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:A.tools.slice(0,12).join(`, `)||`No tools reported`}):null]})]})]})]}),(0,S.jsxs)(`footer`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-t border-border px-3 py-2`,children:[(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md border border-destructive/30 px-2 text-[12px] text-destructive hover:bg-destructive/10 disabled:opacity-50`,disabled:!k||m,type:`button`,onClick:()=>void F(),children:[(0,S.jsx)(xu,{className:`size-3.5`}),`Delete`]}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md border border-border px-2 text-[12px] text-foreground hover:bg-accent disabled:opacity-50`,disabled:!k||E,type:`button`,onClick:()=>void I(),children:[(0,S.jsx)(du,{className:Z(`size-3.5`,E&&`animate-spin`)}),`Sync`]}),(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md border border-border px-2 text-[12px] text-foreground hover:bg-accent disabled:opacity-50`,disabled:!k||i.transportType!==`streamable_http`||u,type:`button`,onClick:()=>void R(),children:[(0,S.jsx)(Kl,{className:`size-3.5`}),`OAuth`]}),(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground hover:bg-primary/80 disabled:opacity-60`,disabled:m,type:`button`,onClick:()=>void P(),children:[m?(0,S.jsx)(eu,{className:`size-3.5 animate-spin`}):(0,S.jsx)(Rl,{className:`size-3.5`}),`Save`]})]})]})]})]}):null}function Wx({label:e,value:t,onChange:n}){return(0,S.jsxs)(`label`,{className:`grid gap-1 text-[12px] text-muted-foreground`,children:[e,(0,S.jsx)(`input`,{className:`h-8 min-w-0 rounded-md border border-border bg-background px-2 text-[13px] text-foreground outline-none placeholder:text-muted-foreground focus:border-primary`,value:t,onChange:e=>n(e.currentTarget.value)})]})}function Gx({label:e,value:t,onChange:n}){return(0,S.jsxs)(`label`,{className:`grid gap-1 text-[12px] text-muted-foreground`,children:[e,(0,S.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[12px] text-foreground outline-none placeholder:text-muted-foreground focus:border-primary`,value:t,onChange:e=>n(e.currentTarget.value)})]})}function Kx(e,t,n,r,i){let[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(``),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(`medium`),[h,g]=(0,x.useState)(`standard`),[_,v]=(0,x.useState)(!1),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)([]),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(`pragmatic`),[O,k]=(0,x.useState)(`{}`),[A,j]=(0,x.useState)(!1),[M,N]=(0,x.useState)(`{}`),P=!!(t?.capabilities.includes(`models`)&&t.runtimeFields.some(e=>e.key===`model`)),F=!!t?.runtimeFields.some(e=>e.key===`reasoningEffort`),I=!!t?.runtimeFields.some(e=>e.key===`serviceTier`),L=(0,x.useMemo)(()=>[P?`model`:null,F?`reasoningEffort`:null,I?`serviceTier`:null].filter(e=>!!e),[P,F,I]);(0,x.useEffect)(()=>{!e||!t||(c(!1),u(Rm(e,t)),f($(e.runtimeDefaults,`model`)||sh(t.id,`model`)||(oh(t.id)[0]?.model??``)),m(lh($(e.runtimeDefaults,`reasoningEffort`)||sh(t.id,`reasoningEffort`))),g(fh($(e.runtimeDefaults,`serviceTier`)||sh(t.id,`serviceTier`))),b(e.displayName),D(Lm(e.settings)),k(Fm(Hm(e.runtimeDefaults,L))),N(Fm(Hm(e.settings,[`codexHome`,`personality`]))),T(null))},[e,t,L]),(0,x.useEffect)(()=>{let n=!1;if(C(oh(t?.id)),!(!e||!P||e.status!==`CONNECTED`))return Q.providerAccounts.models(e.id).then(e=>{n||C(e.data)}).catch(()=>{n||C(oh(t?.id))}),()=>{n=!0}},[e?.id,e?.status,P,t?.id]);let R=e?$(e.authState,`codexHomeMode`)===`shared`:!1,z=e&&t?zm(e,t):``,ee=t?Bm(t):``;function B(){if(!e||!t)throw Error(`No provider account selected.`);let n=Um(M,`Settings`),r=Um(O,`Runtime defaults`),i=R?``:l.trim();if(i===`~/.codex`||i===ee)throw Error(`Use Local account to use ${ee}.`);if(i&&i!==z?n.codexHome=i:delete n.codexHome,t.id===`codex`&&(n.personality=E),P){let e=d||ae?.model||sh(t.id,`model`);if(!e)throw Error(`Choose a default model.`);r.model=e}return F&&(r.reasoningEffort=uh(p)),I&&(r.serviceTier=ph(h)),{displayName:y,runtimeDefaults:r,settings:n}}async function V(){if(!e)throw Error(`No provider account selected.`);let t=await Q.providerAccounts.update(e.id,B());return n(t),t}async function H(e=`browser`){o(!0),c(!1),T(null);try{let t=await V(),n=await Q.providerAccounts.authenticate(t.id,e);n.authUrl&&window.open(n.authUrl,`_blank`,`noopener,noreferrer`);let r=await U();if(n.status===`CONNECTED`||r?.status===`CONNECTED`){T({kind:`info`,text:n.message??`Connected`}),await i();return}if(n.status===`ERROR`){T({kind:`error`,text:n.message??`Authentication failed.`});return}T({kind:`info`,text:n.message??`Authentication started.`}),await W()}catch(e){T({kind:`error`,text:Og(e)})}finally{o(!1)}}async function U(){if(!e)return await i(),null;let t=(await Q.providerAccounts.list()).find(t=>t.id===e.id)??null;return t?n(t):await i(),t}async function W(){for(let e=0;e<60;e+=1){await Wm(1e3);let e=await U();if(e?.status===`CONNECTED`){T({kind:`info`,text:`Connected`}),await i();return}if(e?.status===`ERROR`){T({kind:`error`,text:e.lastError??`Authentication failed.`});return}}}async function te(){if(e){j(!0),T(null);try{n(await Q.providerAccounts.update(e.id,{...B()})),T({kind:`info`,text:`Saved`})}catch(e){T({kind:`error`,text:Og(e)})}finally{j(!1)}}}async function G(){if(e&&window.confirm(`Delete provider account?`)){v(!0),T(null);try{await Q.providerAccounts.delete(e.id),r(e.id)}catch(e){T({kind:`error`,text:Og(e)})}finally{v(!1)}}}let ne=e?.status===`CONNECTED`,re=!!t?.accountFields.some(e=>e.key===`codexHome`),ie=ch(t?.id,S).filter(e=>!e.hidden),ae=ie.find(e=>e.model===d||e.id===d)??ie[0]??null;return{authenticating:a,authMenuOpen:s,authenticate:H,codexHome:l,connected:ne,defaultModel:d,defaultReasoningEffort:p,defaultServiceTier:h,deleteProviderAccount:G,deleting:_,displayName:y,hasCodexHomeField:re,hasDefaultModelField:P,hasDefaultReasoningField:F,hasDefaultServiceTierField:I,modelOptions:ie,notice:w,personality:E,runtimeDefaultsJson:O,saveConfig:te,saving:A,setAuthMenuOpen:c,setCodexHome:u,setDefaultModel:f,setDefaultReasoningEffort:m,setDefaultServiceTier:g,setDisplayName:b,setPersonality:D,setRuntimeDefaultsJson:k,setSettingsJson:N,selectedDefaultModelOption:ae,settingsJson:M,usingSharedCodexHome:R}}function qx({account:e,provider:t,onAccountChange:n,onAccountDelete:r,onClose:i,onReload:a}){let o=Kx(e,t,n,r,a);return!e||!t?null:(0,S.jsxs)(`div`,{className:`fixed inset-0 z-[70] grid place-items-center bg-black/55 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close provider account`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:i}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[84vh] w-full max-w-lg grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsx)(Jx,{account:e,provider:t,onClose:i}),(0,S.jsx)(Yx,{account:e,dialog:o,provider:t}),(0,S.jsx)(iS,{connected:o.connected,deleting:o.deleting,saving:o.saving,onClose:i,onDelete:o.deleteProviderAccount,onSave:o.saveConfig})]})]})}function Jx({account:e,provider:t,onClose:n}){return(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(lv,{icon:t.icon}),(0,S.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:t.label}),(0,S.jsx)(fv,{status:e.status}),(0,S.jsx)(`button`,{"aria-label":`Close provider account`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:n,children:(0,S.jsx)(Cu,{className:`size-4`})})]})}function Yx({account:e,dialog:t,provider:n}){return(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[(0,S.jsx)(Xx,{notice:t.notice}),(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(Zx,{dialog:t}),n.id===`codex`?(0,S.jsx)(eS,{dialog:t}):null,t.hasCodexHomeField?(0,S.jsx)(tS,{dialog:t}):null,t.hasDefaultModelField||t.hasDefaultReasoningField||t.hasDefaultServiceTierField?(0,S.jsx)(nS,{dialog:t}):null,e.status===`CONNECTED`?(0,S.jsx)(rS,{dialog:t}):null]})]})}function Xx({notice:e}){return e?(0,S.jsx)(`div`,{className:Z(`mb-3 rounded-md border px-3 py-2 text-[12px]`,e.kind===`error`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-info/20 bg-info/10 text-info`),children:e.text}):null}function Zx({dialog:e}){return(0,S.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2`,children:[(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Name`}),(0,S.jsx)(`input`,{className:`h-8 w-full rounded-md border border-input bg-background px-2 text-[13px] text-foreground outline-none focus:border-primary`,value:e.displayName,onChange:t=>e.setDisplayName(t.target.value)})]}),(0,S.jsx)(Qx,{dialog:e})]})}function Qx({dialog:e}){return(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsxs)(`button`,{className:`flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-55`,disabled:e.authenticating,type:`button`,onClick:()=>e.setAuthMenuOpen(e=>!e),children:[(0,S.jsx)(Kl,{className:`size-3.5`}),(0,S.jsx)(`span`,{className:`whitespace-nowrap`,children:e.connected?`Re-authenticate`:e.authenticating?`Authenticating`:`Authenticate`}),(0,S.jsx)(zl,{className:`size-3.5 text-muted-foreground`})]}),e.authMenuOpen?(0,S.jsx)($x,{dialog:e}):null]})}function $x({dialog:e}){return(0,S.jsxs)(`div`,{className:`absolute right-0 top-9 z-10 w-40 overflow-hidden rounded-md border border-border bg-popover py-1 shadow-xl`,children:[(0,S.jsxs)(`button`,{className:`flex h-8 w-full items-center gap-2 px-2.5 text-left text-[12px] text-foreground hover:bg-accent`,type:`button`,onClick:()=>void e.authenticate(`browser`),children:[(0,S.jsx)(Kl,{className:`size-3.5 text-info`}),`Browser`]}),(0,S.jsxs)(`button`,{className:`flex h-8 w-full items-center gap-2 px-2.5 text-left text-[12px] text-foreground hover:bg-accent`,type:`button`,onClick:()=>void e.authenticate(`local`),children:[(0,S.jsx)(Ql,{className:`size-3.5 text-info`}),`Local account`]})]})}function eS({dialog:e}){return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Personality`}),(0,S.jsx)(`div`,{className:`inline-flex rounded-md border border-input bg-background p-0.5`,children:[`pragmatic`,`friendly`].map(t=>(0,S.jsx)(`button`,{className:Z(`h-7 rounded px-2.5 text-[12px] font-medium`,e.personality===t?`bg-primary/20 text-foreground`:`text-muted-foreground hover:bg-accent hover:text-foreground`),type:`button`,onClick:()=>e.setPersonality(t),children:t===`pragmatic`?`Pragmatic`:`Friendly`},t))})]})}function tS({dialog:e}){return(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Codex home`}),(0,S.jsx)(`input`,{className:`h-8 w-full rounded-md border border-input bg-background px-2 font-mono text-[12px] text-foreground outline-none focus:border-primary disabled:opacity-65`,disabled:e.usingSharedCodexHome,value:e.codexHome,onChange:t=>e.setCodexHome(t.target.value)})]})}function nS({dialog:e}){let t=e.modelOptions.some(t=>t.model===e.defaultModel||t.id===e.defaultModel),n=e.defaultModel&&!t?[{id:e.defaultModel,model:e.defaultModel,displayName:e.defaultModel},...e.modelOptions]:e.modelOptions;return(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsx)(`span`,{className:`block text-[11px] font-medium text-muted-foreground`,children:`Defaults`}),(0,S.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[e.hasDefaultModelField?(0,S.jsxs)(`label`,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] text-muted-foreground`,children:`Model`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:e.defaultModel||(e.selectedDefaultModelOption?.model??``),onValueChange:e.setDefaultModel,children:[(0,S.jsx)(Em,{"aria-label":`Default model`,className:`h-8 w-full border-input bg-background px-2 text-[12px] text-foreground shadow-none hover:bg-secondary/60`,children:(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:t||!e.defaultModel?e.selectedDefaultModelOption?.displayName??e.defaultModel:e.defaultModel})}),(0,S.jsx)(Dm,{align:`start`,className:`max-h-72 border-border bg-popover text-foreground`,children:n.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.model,children:e.displayName},e.id))})]})]}):null,e.hasDefaultReasoningField?(0,S.jsxs)(`label`,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] text-muted-foreground`,children:`Reasoning`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:e.defaultReasoningEffort,onValueChange:t=>e.setDefaultReasoningEffort(lh(t)),children:[(0,S.jsx)(Em,{"aria-label":`Default reasoning`,className:`h-8 w-full border-input bg-background px-2 text-[12px] text-foreground shadow-none hover:bg-secondary/60`,children:(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:dh(e.defaultReasoningEffort)})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:$m.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.value,children:e.label},e.value))})]})]}):null,e.hasDefaultServiceTierField?(0,S.jsxs)(`label`,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] text-muted-foreground`,children:`Speed`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:e.defaultServiceTier,onValueChange:t=>e.setDefaultServiceTier(fh(t)),children:[(0,S.jsx)(Em,{"aria-label":`Default speed`,className:`h-8 w-full border-input bg-background px-2 text-[12px] text-foreground shadow-none hover:bg-secondary/60`,children:(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:mh(e.defaultServiceTier)})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:eh.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.value,children:(0,S.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),(0,S.jsx)(`span`,{className:`truncate text-[11px] font-normal text-muted-foreground`,children:e.description})]})},e.value))})]})]}):null]})]})}function rS({dialog:e}){return(0,S.jsxs)(`div`,{className:`grid gap-3`,children:[(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Settings`}),(0,S.jsx)(`textarea`,{className:`h-28 w-full resize-none rounded-md border border-input bg-background px-2 py-2 font-mono text-[12px] text-foreground outline-none focus:border-primary`,spellCheck:!1,value:e.settingsJson,onChange:t=>e.setSettingsJson(t.target.value)})]}),(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Runtime defaults`}),(0,S.jsx)(`textarea`,{className:`h-28 w-full resize-none rounded-md border border-input bg-background px-2 py-2 font-mono text-[12px] text-foreground outline-none focus:border-primary`,spellCheck:!1,value:e.runtimeDefaultsJson,onChange:t=>e.setRuntimeDefaultsJson(t.target.value)})]})]})}function iS({connected:e,deleting:t,saving:n,onClose:r,onDelete:i,onSave:a}){return(0,S.jsxs)(`footer`,{className:`flex h-11 items-center justify-between gap-2 border-t border-border px-3`,children:[(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-destructive/30 px-3 text-[12px] font-medium text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-55`,disabled:t,type:`button`,onClick:()=>void i(),children:t?`Deleting`:`Delete`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-border px-3 text-[12px] font-medium text-foreground hover:bg-accent`,type:`button`,onClick:r,children:`Close`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:!e||n,type:`button`,onClick:()=>void a(),children:n?`Saving`:`Save`})]})]})}function aS({open:e,onClose:t,onProviderDataChange:n}){let[r,i]=(0,x.useState)([]),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!0),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)([]),{accountLimits:h}=ry(),g=r.find(e=>e.id===a)??null,_=g?p.find(e=>e.id===g.providerId)??null:null,v=async()=>{c(!0),f(null);try{let[e,t]=await Promise.all([Q.providers.list(),Q.providerAccounts.list()]);m(e),i(t),n(e,t)}catch(e){f(Og(e))}finally{c(!1)}};(0,x.useEffect)(()=>{e&&v()},[e]);let y=async e=>{f(null);try{let t=await Q.providerAccounts.create({providerId:e}),a=[...r,t];i(a),n(p,a),o(t.id),u(!1)}catch(e){f(Og(e))}};return e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close providers`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:t}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[82vh] min-h-72 w-full max-w-lg grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(uv,{icon:p[0]?.icon??`codex`,className:`size-4 shrink-0 text-info`}),(0,S.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:`Providers`}),(0,S.jsx)(`button`,{"aria-label":`Add provider account`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Add`,type:`button`,onClick:()=>u(!0),children:(0,S.jsx)(uu,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":`Refresh providers`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Refresh`,type:`button`,onClick:()=>void v(),children:(0,S.jsx)(du,{className:Z(`size-4`,s&&`animate-spin`)})}),(0,S.jsx)(`button`,{"aria-label":`Close providers`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:t,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[d?(0,S.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive`,children:d}):null,s?(0,S.jsx)(`div`,{className:`grid h-full min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`Loading`}):r.length?(0,S.jsx)(`div`,{className:`space-y-1.5`,children:r.map(e=>{let t=p.find(t=>t.id===e.providerId),n=Gm(h[e.id]);return(0,S.jsxs)(`button`,{className:`grid w-full grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-accent`,type:`button`,onClick:()=>o(e.id),children:[(0,S.jsx)(lv,{icon:t?.icon??`bot`}),(0,S.jsxs)(`span`,{className:`min-w-0`,children:[(0,S.jsx)(`span`,{className:`block truncate text-[13px] font-medium text-foreground`,children:e.displayName}),(0,S.jsxs)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:[t?.label??e.providerId,n?` · ${n}`:``]})]}),(0,S.jsx)(fv,{status:e.status}),(0,S.jsx)(Su,{className:`size-4 text-muted-foreground`})]},e.id)})}):(0,S.jsx)(`div`,{className:`grid h-full min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`No accounts`})]})]}),(0,S.jsx)(oS,{open:l,providers:p,onClose:()=>u(!1),onSelect:e=>void y(e)}),(0,S.jsx)(qx,{account:g,provider:_,onAccountChange:e=>{let t=r.map(t=>t.id===e.id?e:t);i(t),n(p,t)},onAccountDelete:e=>{let t=r.filter(t=>t.id!==e);i(t),n(p,t),o(null)},onClose:()=>o(null),onReload:v})]}):null}function oS({open:e,providers:t,onClose:n,onSelect:r}){return e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-[60] grid place-items-center bg-black/55 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close provider picker`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:n}),(0,S.jsxs)(`section`,{className:`relative w-full max-w-sm overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(uu,{className:`size-4 text-info`}),(0,S.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:`Add provider`}),(0,S.jsx)(`button`,{"aria-label":`Close provider picker`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:n,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsx)(`div`,{className:`p-2`,children:t.map(e=>(0,S.jsxs)(`button`,{className:`flex h-12 w-full min-w-0 items-center gap-3 rounded-md px-2 text-left hover:bg-accent`,type:`button`,onClick:()=>r(e.id),children:[(0,S.jsx)(lv,{icon:e.icon}),(0,S.jsxs)(`span`,{className:`min-w-0`,children:[(0,S.jsx)(`span`,{className:`block truncate text-[13px] font-medium text-foreground`,children:e.label}),(0,S.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.id})]})]},e.id))})]})]}):null}var sS=x.createContext(void 0);function cS(){let e=x.useContext(sS);if(e===void 0)throw Error(U(63));return e}var lS=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),uS={...Ef,checked(e){return e?{[lS.checked]:``}:{[lS.unchecked]:``}}};function dS(e,t,n,r=!0,i){let[a,o]=x.useState(),s=Ds(i?`${i}-label`:void 0),c=e??t??a;return V(()=>{let i=e||t||!r?void 0:fS(n.current,s);a!==i&&o(i)}),c}function fS(e,t){let n=pS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function pS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var mS=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=Kf(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,validationMode:k,disabled:A,name:j,validation:M}=kf(),{labelId:N}=Mf(),P=A||m,F=j??l,I=x.useRef(null),L=Rt(I,c,M.inputRef),R=x.useRef(null),z=Ds(),ee=Nf({id:s,implicit:!1,controlRef:R}),B=u?void 0:ee,[H,U]=_f({controlled:n,default:!!i,name:`Switch`,state:`checked`});Af(R,z,H,void 0,!P,l),V(()=>{I.current&&D(I.current.checked)},[I,D]),Jf(H,()=>{b(F),T(H!==E.initialValue),D(H),M.change(H)});let{getButtonProps:W,buttonRef:te}=sp({disabled:P,native:u}),G=dS(a,N,I,!u,B),ne={id:u?ee:z,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":G,onFocus(){P||O(!0)},onBlur(){let e=I.current;!e||P||(w(!0),O(!1),k===`onBlur`&&M.commit(e.checked))},onClick(e){if(f||P)return;e.preventDefault();let t=I.current;t&&t.dispatchEvent(new(Ee(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},re=Ur({checked:H,disabled:P,form:o,id:B,name:F,required:p,style:F?on:an,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:L,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Nt(yt,e.nativeEvent);d?.(t,n),!n.isCanceled&&U(t)},onFocus(){R.current?.focus()}},e=>M.getValidationProps(P,e),_===void 0?vt:{value:_}),ie=x.useMemo(()=>({...C,checked:H,disabled:P,readOnly:f,required:p}),[C,H,P,f,p]),ae=ri(`span`,e,{state:ie,ref:[t,R,te],props:[ne,y,W,e=>M.getValidationProps(P,e)],stateAttributesMapping:uS});return(0,S.jsxs)(sS.Provider,{value:ie,children:[ae,!H&&F&&g!==void 0&&(0,S.jsx)(`input`,{type:`hidden`,form:o,name:F,value:g,disabled:P}),(0,S.jsx)(`input`,{...re,suppressHydrationWarning:!0})]})}),hS=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return ri(`span`,e,{state:cS(),ref:t,stateAttributesMapping:uS,props:a})});function gS({className:e,size:t=`default`,...n}){return(0,S.jsx)(mS,{"data-slot":`switch`,"data-size":t,className:Z(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,S.jsx)(hS,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function _S({open:e,onClose:t}){let[n,r]=(0,x.useState)({}),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)([]),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),m=c.find(e=>e.id===u)??null,h=async()=>{a(!0),s(null);try{let e=await Q.plugins.list();l(e),r(Object.fromEntries(e.map(e=>[e.id,yS(e)])))}catch(e){s({kind:`error`,text:Og(e)})}finally{a(!1)}};(0,x.useEffect)(()=>{e&&h()},[e]);let g=(e,t)=>{r(n=>({...n,[e]:{...n[e]??{botToken:``,enabled:!1},...t}}))},_=async e=>{let t=n[e.id]??{botToken:``,enabled:e.enabled};p(e.id),s(null);try{let n=await Q.plugins.update(e.id,{enabled:t.enabled,secrets:{botToken:t.botToken.trim()}});l(e=>e.map(e=>e.id===n.id?n:e)),g(e.id,yS(n)),window.dispatchEvent(new Event(`pockcode:plugins-changed`)),s({kind:`info`,text:`Saved`})}catch(e){s({kind:`error`,text:Og(e)})}finally{p(null)}},v=async(e,t)=>{p(e.id),s(null);try{let n=await Q.plugins.action(e.id,t);l(e=>e.map(e=>e.id===n.plugin.id?n.plugin:e)),window.dispatchEvent(new Event(`pockcode:plugins-changed`)),s({kind:`info`,text:n.message??`Updated`})}catch(e){s({kind:`error`,text:Og(e)})}finally{p(null)}};return e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close plugins`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:t}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[82vh] min-h-72 w-full max-w-lg grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(lu,{className:`size-4 shrink-0 text-info`}),(0,S.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:`Plugins`}),(0,S.jsx)(`button`,{"aria-label":`Refresh plugins`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Refresh`,type:`button`,onClick:()=>void h(),children:(0,S.jsx)(du,{className:Z(`size-4`,i&&`animate-spin`)})}),(0,S.jsx)(`button`,{"aria-label":`Close plugins`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:t,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[o?(0,S.jsx)(`div`,{className:Z(`mb-3 rounded-md border px-3 py-2 text-[12px]`,o.kind===`error`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-info/20 bg-info/10 text-info`),children:o.text}):null,i?(0,S.jsx)(`div`,{className:`grid h-full min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`Loading`}):c.length?(0,S.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:c.map(e=>(0,S.jsx)(vS,{plugin:e,onSelect:()=>d(e.id)},e.id))}):(0,S.jsx)(`div`,{className:`grid h-full min-h-44 place-items-center text-[13px] text-muted-foreground`,children:`No plugins`})]})]}),(0,S.jsx)(SS,{draft:m?n[m.id]??{botToken:``,enabled:m.enabled}:null,plugin:m,saving:m?f===m.id:!1,onAction:e=>{m&&v(m,e)},onClose:()=>d(null),onDraftChange:e=>{m&&g(m.id,e)},onSave:()=>{m&&_(m)}})]}):null}function vS({plugin:e,onSelect:t}){let n=e.enabled?e.status.state:`disabled`;return(0,S.jsx)(`button`,{className:`grid aspect-square min-w-0 place-items-center rounded-md border border-border bg-secondary/30 p-3 text-center hover:bg-accent/70`,type:`button`,onClick:t,children:(0,S.jsxs)(`div`,{className:`grid min-w-0 place-items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`grid size-12 place-items-center rounded-md bg-info/15 text-info`,children:(0,S.jsx)(bS,{icon:e.icon,className:`size-6`})}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-semibold text-foreground`,children:e.label}),(0,S.jsx)(`span`,{className:Z(`rounded px-1.5 py-0.5 text-[10px] font-semibold`,CS(n)),children:n})]})})}function yS(e){return{botToken:$(e.secrets,`botToken`),enabled:e.enabled}}function bS({className:e,icon:t}){return t===`telegram`?(0,S.jsx)(xS,{className:e}):(0,S.jsx)(lu,{className:e})}function xS({className:e}){return(0,S.jsx)(`svg`,{"aria-hidden":`true`,className:Z(`shrink-0`,e),fill:`currentColor`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,S.jsx)(`path`,{d:`M21.8 3.5 18.6 20c-.2 1.2-.9 1.5-1.9.9l-5.1-3.8-2.5 2.4c-.3.3-.5.5-1 .5l.4-5.2 9.5-8.6c.4-.4-.1-.6-.6-.2L5.7 13.4.6 11.8c-1.1-.4-1.1-1.1.2-1.6L20.7 2.5c.9-.3 1.7.2 1.1 1Z`})})}function SS({draft:e,plugin:t,saving:n,onAction:r,onClose:i,onDraftChange:a,onSave:o}){if(!t||!e)return null;let s=Im(t.stateSummary),c=$(s,`pairingCode`),l=$(s,`ownerLabel`),u=s.ownerUserId,d=typeof s.subscriptionCount==`number`?s.subscriptionCount:0,f=t.secretConfigured.botToken;return(0,S.jsxs)(`div`,{className:`fixed inset-0 z-[60] grid place-items-center bg-black/55 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close plugin settings`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:i}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[84vh] w-full max-w-lg grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(bS,{icon:t.icon,className:`size-4 shrink-0 text-info`}),(0,S.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:t.label}),(0,S.jsx)(`span`,{className:Z(`rounded px-1.5 py-0.5 text-[10px] font-semibold`,CS(t.status.state)),children:t.status.state}),(0,S.jsx)(`button`,{"aria-label":`Close plugin settings`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:i,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded-md border border-border bg-secondary/30 px-3 py-2`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,S.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] text-muted-foreground`,children:t.status.message||t.description})]}),(0,S.jsx)(gS,{"aria-label":e.enabled?`Disable plugin`:`Enable plugin`,checked:e.enabled,size:`sm`,onCheckedChange:e=>a({enabled:e})})]}),(0,S.jsxs)(`div`,{className:`grid gap-3`,children:[(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Bot token`}),(0,S.jsx)(`input`,{className:`h-8 w-full rounded-md border border-input bg-background px-2 font-mono text-[12px] text-foreground outline-none focus:border-primary`,placeholder:f?`Configured`:`123456:ABC...`,type:`text`,value:e.botToken,onChange:e=>a({botToken:e.target.value})})]}),(0,S.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-border bg-background/60 px-3 py-2 text-[12px]`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-24 shrink-0 text-muted-foreground`,children:`Pairing`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-foreground`,children:l?`paired`:c||`not ready`})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-24 shrink-0 text-muted-foreground`,children:`Owner`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:l?`${l}${typeof u==`number`?` (${u})`:``}`:`none`})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-24 shrink-0 text-muted-foreground`,children:`Subscriptions`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:d})]})]})]})]}),(0,S.jsxs)(`footer`,{className:`flex min-h-11 flex-wrap items-center justify-end gap-2 border-t border-border px-3 py-1.5`,children:[(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-border px-3 text-[12px] font-medium text-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-55`,disabled:n,type:`button`,onClick:()=>r(`refreshPairingCode`),children:`Refresh code`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-destructive/30 px-3 text-[12px] font-medium text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-55`,disabled:n||!l,type:`button`,onClick:()=>r(`clearOwner`),children:`Clear owner`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:n,type:`button`,onClick:o,children:n?`Saving`:`Save`})]})]})]})}function CS(e){return e===`running`?`bg-success/10 text-success`:e===`starting`?`bg-warning/10 text-warning`:e===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}function wS({open:e,onClose:t}){let[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),u=(0,x.useRef)(0),d=async()=>{let e=u.current+1;u.current=e,a(!0),s(null);try{let t=await Q.providers.codexInstructions();if(u.current!==e)return;r(t.instructions)}catch(t){if(u.current!==e)return;s({kind:`error`,text:Og(t)})}finally{u.current===e&&a(!1)}};(0,x.useEffect)(()=>{e&&d()},[e]);let f=async()=>{l(!0),s(null);try{let e=await Q.providers.updateCodexInstructions({instructions:n});r(e.instructions),s({kind:`info`,text:`Saved to ${e.paths.length} Codex homes`})}catch(e){s({kind:`error`,text:Og(e)})}finally{l(!1)}};return e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close instructions`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:t}),(0,S.jsxs)(`section`,{className:`relative grid max-h-[82vh] min-h-72 w-full max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-lg border border-border bg-card shadow-2xl`,children:[(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(ql,{className:`size-4 shrink-0 text-info`}),(0,S.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:`Instructions`}),(0,S.jsx)(`button`,{"aria-label":`Reload instructions`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Refresh`,type:`button`,onClick:()=>void d(),children:(0,S.jsx)(du,{className:Z(`size-4`,i&&`animate-spin`)})}),(0,S.jsx)(`button`,{"aria-label":`Close instructions`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:t,children:(0,S.jsx)(Cu,{className:`size-4`})})]}),(0,S.jsxs)(`div`,{className:`min-h-0 overflow-auto p-3 ide-scrollbar`,children:[o?(0,S.jsx)(`div`,{className:Z(`mb-3 rounded-md border px-3 py-2 text-[12px]`,o.kind===`error`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-info/20 bg-info/10 text-info`),children:o.text}):null,(0,S.jsxs)(`label`,{className:`block`,children:[(0,S.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`AGENTS.md`}),(0,S.jsx)(`textarea`,{className:`h-[min(52vh,28rem)] w-full resize-none rounded-md border border-input bg-background px-3 py-2 font-mono text-[12px] leading-5 text-foreground outline-none focus:border-primary disabled:opacity-65`,disabled:i,spellCheck:!1,value:n,onChange:e=>r(e.target.value)})]})]}),(0,S.jsxs)(`footer`,{className:`flex h-11 items-center justify-end gap-2 border-t border-border px-3`,children:[(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-border px-3 text-[12px] font-medium text-foreground hover:bg-accent`,type:`button`,onClick:t,children:`Close`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:i||c,type:`button`,onClick:()=>void f(),children:c?`Saving`:`Save`})]})]})]}):null}function TS({open:e,openWorkspacePaths:t,onClose:n,onSelect:r}){let i=ES(e,t,r);return(0,x.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[n,e]),e?(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/65 p-4`,role:`dialog`,"aria-modal":`true`,children:[(0,S.jsx)(`button`,{"aria-label":`Close folder browser`,className:`absolute inset-0 cursor-default`,type:`button`,onClick:n}),(0,S.jsxs)(`section`,{className:`relative grid h-[80vh] min-h-[560px] w-full max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-xl border border-border bg-card shadow-2xl`,children:[(0,S.jsx)(DS,{onClose:n}),(0,S.jsx)(OS,{browser:i}),(0,S.jsx)(AS,{browser:i,onClose:n})]})]}):null}function ES(e,t,n){let[r,i]=(0,x.useState)(new Set),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(new Set),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(null),[_,v]=(0,x.useState)(!1),y=(0,x.useRef)(new Set),b=!!(h&&t.some(e=>yg(e,h.path))),S=!!(h&&h.type===`directory`&&!h.error&&!a),C=p?vg(d,p.path):``,w=(e,t)=>{let n=new Set(y.current);t?n.add(e):n.delete(e),y.current=n,c(n)},T=(0,x.useCallback)(async(e,t=_)=>{let n=new Set;y.current=n,c(n),o(!0),u(null);try{let n=hg(await Q.workspaces.listDirectory(e,t));m(n),g(n),f(n.path),i(new Set([n.path]))}catch(e){u({kind:`error`,text:Og(e)})}finally{o(!1)}},[_]);(0,x.useEffect)(()=>{e&&(i(new Set),u(null),f(``),m(null),g(null),v(!1),T(void 0,!1))},[T,e]);let E=e=>{e.type===`directory`&&(g(e),u(e.error?{kind:`error`,text:e.error}:null))};return{canOpen:S,chooseSelectedFolder:async()=>{if(!(!h||h.type!==`directory`||h.error)){if(b){n(h);return}o(!0),u(null);try{n(await Q.workspaces.readTree(h.path,_))}catch(e){u({kind:`error`,text:Og(e)})}finally{o(!1)}}},expandedPaths:r,isLoading:a,loadingDirectoryPaths:s,loadBrowserRoot:T,moveParent:()=>{if(!p)return;let e=_g(p.path);e&&T(e)},notice:l,openPathInput:()=>{T(d.trim()||void 0)},pathFilter:C,pathInput:d,refreshBrowser:()=>{T(p?.path)},rootEntry:p,selectEntry:E,selectedAlreadyOpen:b,selectedEntry:h,setPathInput:f,showHidden:_,toggleDirectory:async e=>{if(E(e),!(e.type!==`directory`||e.error||y.current.has(e.path))){if(r.has(e.path)){i(t=>{let n=new Set(t);return n.delete(e.path),n});return}if(!e.children){u(null),w(e.path,!0);try{let t=await Q.workspaces.listDirectory(e.path,_);m(n=>n&&gg(n,e.path,t.entries))}catch(e){u({kind:`error`,text:Og(e)});return}finally{w(e.path,!1)}}i(t=>new Set(t).add(e.path))}},toggleHidden:e=>{v(e),T(p?.path,e)}}}function DS({onClose:e}){return(0,S.jsxs)(`header`,{className:`flex h-11 min-w-0 items-center gap-2 border-b border-border px-3`,children:[(0,S.jsx)(Yl,{className:`size-4 shrink-0 text-ide-folder`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-semibold text-foreground`,children:`Open Folder`}),(0,S.jsx)(`button`,{"aria-label":`Close folder browser`,className:`ml-auto grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:e,children:(0,S.jsx)(Cu,{className:`size-3.5`})})]})}function OS({browser:e}){return(0,S.jsxs)(`div`,{className:`grid min-h-0 grid-rows-[auto_minmax(0,1fr)]`,children:[(0,S.jsx)(kS,{browser:e}),(0,S.jsx)(`div`,{className:`min-h-0 overflow-auto px-1.5 py-2 ide-scrollbar`,children:e.isLoading&&!e.rootEntry?(0,S.jsx)(`div`,{className:`grid h-full place-items-center text-[12px] text-muted-foreground`,children:`Loading`}):e.rootEntry?(0,S.jsx)(MS,{entry:e.rootEntry,expandedPaths:e.expandedPaths,filter:e.pathFilter,level:1,loadingDirectoryPaths:e.loadingDirectoryPaths,selectedPath:e.selectedEntry?.path??``,onSelect:e.selectEntry,onToggle:e.toggleDirectory}):(0,S.jsx)(`div`,{className:`grid h-full place-items-center text-[12px] text-muted-foreground`,children:`No folder`})})]})}function kS({browser:e}){return(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 border-b border-border px-2 py-2`,children:[(0,S.jsx)(FS,{label:`Back`,onClick:e.moveParent,children:(0,S.jsx)(Pl,{className:`size-4`})}),(0,S.jsx)(FS,{label:`Home`,onClick:()=>void e.loadBrowserRoot(),children:(0,S.jsx)(Yl,{className:`size-4`})}),(0,S.jsx)(FS,{label:`Refresh`,onClick:e.refreshBrowser,children:(0,S.jsx)(du,{className:Z(`size-4`,e.isLoading&&`animate-spin`)})}),(0,S.jsx)(`input`,{autoCapitalize:`none`,className:`h-8 min-w-0 flex-1 rounded-md border border-input bg-background px-2 font-mono text-[12px] text-foreground outline-none placeholder:text-muted-foreground focus:border-primary`,placeholder:`~`,spellCheck:!1,value:e.pathInput,onChange:t=>e.setPathInput(t.target.value),onKeyDown:t=>{t.key===`Enter`&&e.openPathInput()}})]})}function AS({browser:e,onClose:t}){return(0,S.jsxs)(`footer`,{className:`flex h-11 min-w-0 items-center gap-2 border-t border-border bg-secondary/30 px-2`,children:[(0,S.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[12px] text-muted-foreground`,children:[(0,S.jsx)(`input`,{checked:e.showHidden,className:`size-3.5 accent-primary`,type:`checkbox`,onChange:t=>e.toggleHidden(t.target.checked)}),`Hidden`]}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,S.jsx)(jS,{browser:e}),(0,S.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,S.jsx)(`button`,{className:`h-8 rounded-md border border-border px-3 text-[12px] font-medium text-foreground hover:bg-accent`,type:`button`,onClick:t,children:`Cancel`}),(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground disabled:cursor-not-allowed disabled:opacity-45`,disabled:!e.canOpen,type:`button`,onClick:e.chooseSelectedFolder,children:e.selectedAlreadyOpen?`Focus`:`Open`})]})]})}function jS({browser:e}){return e.notice?(0,S.jsx)(`div`,{className:Z(`max-w-64 shrink-0 truncate text-[11px]`,e.notice.kind===`error`?`text-destructive`:`text-muted-foreground`),title:e.notice.text,children:e.notice.text}):e.selectedAlreadyOpen?(0,S.jsx)(`div`,{className:`max-w-64 shrink-0 truncate text-[11px] text-muted-foreground`,children:`Already open`}):null}function MS({entry:e,expandedPaths:t,filter:n,level:r,loadingDirectoryPaths:i,selectedPath:a,onSelect:o,onToggle:s}){let c=t.has(e.path),l=i.has(e.path),u=yg(a,e.path),d=(0,x.useMemo)(()=>Eg(e.children??[],n),[e.children,n]),f=d.filter(e=>e.type===`directory`),p=d.filter(e=>e.type!==`directory`);return(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(NS,{entry:e,expanded:c,level:r,loading:l,selected:u,onSelect:o,onToggle:s}),c?(0,S.jsxs)(`div`,{className:`min-w-0`,children:[e.error?(0,S.jsx)(`div`,{className:`h-7 truncate px-2 text-[12px] leading-7 text-destructive`,style:{paddingLeft:24+r*16},children:e.error}):null,!e.error&&f.map(e=>(0,S.jsx)(MS,{entry:e,expandedPaths:t,filter:n,level:r+1,loadingDirectoryPaths:i,selectedPath:a,onSelect:o,onToggle:s},e.path)),!e.error&&p.map(e=>(0,S.jsx)(PS,{entry:e,level:r+1},e.path)),!e.error&&!d.length?(0,S.jsx)(`div`,{className:`h-7 truncate px-2 text-[12px] leading-7 text-muted-foreground`,style:{paddingLeft:24+r*16},children:n.trim()?`No match`:`Empty`}):null]}):null]})}function NS({entry:e,expanded:t,level:n,loading:r,selected:i,onSelect:a,onToggle:o}){let s=e.type===`directory`;return(0,S.jsxs)(`div`,{"aria-busy":r||void 0,className:Z(`group grid h-7 min-w-0 grid-cols-[1.5rem_1rem_minmax(0,1fr)_auto] items-center gap-1 rounded-sm px-1 text-[13px] font-medium`,i?`bg-accent text-foreground`:`text-foreground hover:bg-accent`),style:{paddingLeft:4+(n-1)*16},children:[(0,S.jsx)(`button`,{"aria-label":t?`Collapse ${e.name}`:`Expand ${e.name}`,className:Z(`grid size-6 place-items-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground`,!s&&`pointer-events-none opacity-35`,r&&`cursor-wait opacity-70`),disabled:r,type:`button`,onClick:()=>o(e),children:(0,S.jsx)(Bl,{className:Z(`size-4 transition-transform`,t&&`rotate-90`)})}),r?(0,S.jsx)(eu,{className:`size-4 shrink-0 animate-spin text-info`}):t?(0,S.jsx)(Jl,{className:`size-4 shrink-0 text-ide-folder`}):(0,S.jsx)(Yl,{className:`size-4 shrink-0 text-ide-folder`}),(0,S.jsx)(`button`,{className:`min-w-0 truncate text-left`,title:e.path,type:`button`,onClick:()=>a(e),onDoubleClick:()=>o(e),children:e.name}),e.error?(0,S.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded bg-destructive/10 text-destructive`,title:`Blocked`,children:(0,S.jsx)(Cu,{className:`size-3`})}):null]})}function PS({entry:e,level:t}){return(0,S.jsxs)(`div`,{className:`grid h-7 min-w-0 grid-cols-[1.5rem_1rem_minmax(0,1fr)_auto] items-center gap-1 rounded-sm px-1 text-[13px] text-muted-foreground`,style:{paddingLeft:4+(t-1)*16},title:`${e.path} is not a folder`,children:[(0,S.jsx)(`span`,{}),(0,S.jsx)(ql,{className:`size-4 shrink-0`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,S.jsx)(`span`,{className:`size-5 shrink-0`})]})}function FS({children:e,label:t,onClick:n,pressed:r}){return(0,S.jsx)(`button`,{"aria-label":t,"aria-pressed":r,className:Z(`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,r&&`bg-accent text-foreground`),title:t,type:`button`,onClick:n,children:e})}function IS({children:e}){let t=(0,x.useRef)(null),n=(0,x.useRef)(null),r=(0,x.useRef)(null),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)({height:0,isScrollable:!1,offset:0}),c=(0,x.useCallback)(()=>{let e=r.current;if(!e)return;let t=e.scrollHeight-e.clientHeight;if(t<=1){s(e=>e.height===0&&!e.isScrollable&&e.offset===0?e:{height:0,isScrollable:!1,offset:0});return}let n=Math.max(28,Math.round(e.clientHeight/e.scrollHeight*e.clientHeight)),i=Math.max(0,e.clientHeight-n),a=Math.round(e.scrollTop/t*i);s(e=>e.height===n&&e.isScrollable&&e.offset===a?e:{height:n,isScrollable:!0,offset:a})},[]);return(0,x.useEffect)(()=>{let e=t.current,n=r.current;if(!e||!n)return;c();let i=new ResizeObserver(c);return i.observe(e),i.observe(n),()=>i.disconnect()},[c]),(0,x.useEffect)(()=>{c()},[e,c]),(0,x.useEffect)(()=>{if(!i)return;function e(e){let t=n.current,i=r.current;if(!t||!i)return;e.preventDefault();let a=i.scrollHeight-i.clientHeight,s=i.clientHeight-o.height;a<=0||s<=0||(i.scrollTop=t.scrollStartTop+(e.clientY-t.pointerStartY)/s*a,c())}function t(){n.current=null,a(!1)}return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[i,o.height,c]),(0,S.jsx)(`div`,{className:`relative mt-2 min-h-0 flex-1`,children:(0,S.jsx)(`div`,{className:`chat-list-scroll-viewport h-full min-h-0 overflow-auto`,ref:r,onScroll:c,children:(0,S.jsx)(`div`,{ref:t,children:e})})})}function LS(e,t){return(e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[t,...e]).sort(zS)}function RS(e,t){return(e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[t,...e]).sort((e,t)=>Date.parse(t.scheduledFor)-Date.parse(e.scheduledFor))}function zS(e,t){return(e.nextRunAt?Date.parse(e.nextRunAt):1/0)-(t.nextRunAt?Date.parse(t.nextRunAt):1/0)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt)}function BS(e){if(e.frequency===`none`)return`One time`;let t=e.frequency===`daily`?`day`:e.frequency===`weekly`?`week`:`month`;return e.interval>1?`Every ${e.interval} ${t}s`:`Every ${t}`}function VS(e){return e===`daily`?`Daily`:e===`weekly`?`Weekly`:e===`monthly`?`Monthly`:`One time`}function HS(e){return e===`daily`||e===`weekly`||e===`monthly`?e:`none`}function US(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString([],{day:`2-digit`,hour:`2-digit`,minute:`2-digit`,month:`short`}):``}function WS(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return``;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function GS(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toISOString():new Date().toISOString()}function KS(e){return e===`COMPLETED`?`bg-success/10 text-success`:e===`FAILED`||e===`CANCELLED`?`bg-destructive/10 text-destructive`:e===`RUNNING`?`bg-info/15 text-info`:`bg-warning/10 text-warning`}function qS(e){let t=Im(e),n=$(t,`id`),r=t.status===`ACTIVE`||t.status===`PAUSED`||t.status===`COMPLETED`||t.status===`ARCHIVED`;return!n||!r||typeof t.message!=`string`||!$(t,`workingDirectory`)?null:t}function JS(e){let t=Im(e),n=$(t,`id`),r=$(t,`scheduleId`),i=t.status===`QUEUED`||t.status===`RUNNING`||t.status===`COMPLETED`||t.status===`FAILED`||t.status===`CANCELLED`;return!n||!r||!i||!$(t,`scheduledFor`)?null:t}var YS=[{id:`providers`,label:`Providers`,providerIcon:`codex`},{icon:ql,id:`instructions`,label:`Instructions`},{icon:Su,label:`Hooks`},{icon:hu,id:`mcpServers`,label:`MCP Servers`},{icon:lu,id:`plugins`,label:`Plugins`}];function XS({shell:e}){let{chats:t,isChatRunning:n,isLoading:r}=dy(),[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(``),c=(0,x.useRef)(null),l=e.providersDialogOpen?`providers`:e.instructionsDialogOpen?`instructions`:e.mcpServersDialogOpen?`mcpServers`:e.pluginsDialogOpen?`plugins`:null,u=(0,x.useMemo)(()=>new Map(e.providerDefinitions.map(e=>[e.id,e.icon])),[e.providerDefinitions]),d=(0,x.useMemo)(()=>new Map(e.providerDefinitions.map(e=>[e.id,e.label])),[e.providerDefinitions]),f=(0,x.useMemo)(()=>[...t].filter(e=>{let t=o.trim().toLocaleLowerCase();return t?[e.title,e.providerId,d.get(e.providerId)??``].some(e=>e.toLocaleLowerCase().includes(t)):!0}).sort(Kg),[o,t,d]),p=(0,x.useMemo)(()=>[...e.schedules].sort(zS),[e.schedules]),m=e.chatAccounts.length,h=(0,x.useMemo)(()=>YS.map(e=>e.id===`providers`?{...e,count:m}:e),[m]);if(!e.activeWorkspace)return null;let g=e.sidebarTab;return(0,S.jsxs)(`aside`,{className:`chat-list-panel flex h-full min-h-0 flex-col overflow-hidden bg-background px-2 py-2`,children:[i&&g===`chats`?(0,S.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-md border border-border bg-secondary/40 px-2`,children:[(0,S.jsx)(pu,{className:`size-4 shrink-0 text-muted-foreground`}),(0,S.jsx)(`input`,{"aria-label":`Search chats`,autoFocus:!0,className:`min-w-0 flex-1 bg-transparent text-[13px] text-foreground outline-none placeholder:text-muted-foreground`,placeholder:`Search chats`,ref:c,value:o,onBlur:()=>{o.trim()||a(!1)},onChange:e=>s(e.target.value)}),o?(0,S.jsx)(`button`,{"aria-label":`Clear chat search`,className:`grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{s(``),a(!1)},children:(0,S.jsx)(Cu,{className:`size-3.5`})}):null]}):(0,S.jsxs)(`div`,{className:`flex h-9 items-center gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex gap-1 text-[12px] font-semibold`,children:[(0,S.jsx)(`button`,{className:Z(`rounded-md px-1.5 py-0.5`,g===`chats`?`bg-accent text-foreground`:`text-muted-foreground`),type:`button`,onClick:()=>e.setSidebarTab(`chats`),children:`Chats`}),(0,S.jsx)(`button`,{className:Z(`rounded-md px-1.5 py-0.5`,g===`scheduler`?`bg-accent text-foreground`:`text-muted-foreground`),type:`button`,onClick:()=>e.setSidebarTab(`scheduler`),children:`Scheduler`})]}),(0,S.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:g===`chats`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{className:`flex h-7 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-[13px] text-foreground shadow-sm`,type:`button`,onClick:()=>{e.setActiveChatId(null),e.switchToChat()},children:`New`}),(0,S.jsx)(Py,{label:`Search chats`,onClick:()=>{a(!0),window.requestAnimationFrame(()=>c.current?.focus())},children:(0,S.jsx)(pu,{className:`size-4`})})]}):(0,S.jsx)(Py,{label:`New schedule`,onClick:()=>void e.createSchedule(),children:(0,S.jsx)(uu,{className:`size-4`})})})]}),g===`chats`?(0,S.jsx)(IS,{children:r?(0,S.jsx)(`div`,{className:`py-3 text-[12px] text-muted-foreground`,children:`Loading`}):f.length?(0,S.jsx)(`div`,{className:`space-y-1`,children:f.map(t=>{let r=t.id===e.activeChatId&&e.mainMode===`chat`,i=n(t.id);return(0,S.jsxs)(`button`,{"aria-busy":i||void 0,"aria-pressed":r||void 0,className:Z(`block w-full rounded-md px-2 py-2 text-left hover:bg-accent`,r&&`bg-accent`),type:`button`,onClick:()=>{e.setActiveChatId(t.id),e.switchToChat()},children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground`,children:[(0,S.jsx)(uv,{icon:u.get(t.providerId)??t.providerId,className:Z(`size-4 shrink-0 text-muted-foreground`,i&&`text-foreground`)}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.title}),i?(0,S.jsx)(eu,{className:`size-3.5 shrink-0 animate-spin text-info`,"aria-hidden":`true`}):null]}),(0,S.jsxs)(`div`,{className:`ml-6 mt-1 flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:Qg(t.lastActivityAt)}),Xg(t.stats)?(0,S.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 font-medium`,children:[(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,t.stats.additions]}),(0,S.jsxs)(`span`,{className:`text-diff-deletion-foreground`,children:[`-`,t.stats.deletions]})]}):null]})]},t.id)})}):(0,S.jsx)(`div`,{className:`py-3 text-[12px] text-muted-foreground`,children:o.trim()?`No matching chats`:`No chats`})}):(0,S.jsx)(IS,{children:e.isSchedulesLoading?(0,S.jsx)(`div`,{className:`py-3 text-[12px] text-muted-foreground`,children:`Loading`}):p.length?(0,S.jsx)(`div`,{className:`space-y-1`,children:p.map(t=>(0,S.jsx)(ZS,{active:e.activeScheduleId===t.id&&e.mainMode===`schedule`,schedule:t,onSelect:()=>e.selectSchedule(t.id)},t.id))}):(0,S.jsx)(`div`,{className:`py-3 text-[12px] text-muted-foreground`,children:`No schedules`})}),(0,S.jsxs)(`div`,{className:`mt-3 border-t border-border pt-4`,children:[(0,S.jsx)(`h3`,{className:`mb-3 text-[13px] font-semibold text-foreground`,children:`Managements`}),(0,S.jsx)(`div`,{className:`space-y-1`,children:h.map(t=>{let n=t.id,r=n===l;return(0,S.jsxs)(`button`,{"aria-pressed":r||void 0,className:Z(`flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[13px] font-medium text-foreground hover:bg-accent hover:text-foreground`,r&&`bg-accent text-foreground`),type:`button`,onClick:n?()=>e.selectManagementView(n):void 0,children:[t.providerIcon?(0,S.jsx)(uv,{icon:t.providerIcon,className:Z(`size-4 text-muted-foreground`,r&&`text-foreground`)}):t.icon?(0,S.jsx)(t.icon,{className:Z(`size-4 text-muted-foreground`,r&&`text-foreground`)}):null,(0,S.jsx)(`span`,{children:t.label}),t.count===void 0?null:(0,S.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] tabular-nums text-muted-foreground`,title:t.id===`providers`?`Connected providers`:void 0,children:t.count})]},t.label)})})]})]})}function ZS({active:e,schedule:t,onSelect:n}){return(0,S.jsxs)(`button`,{"aria-pressed":e||void 0,className:Z(`block w-full rounded-md px-2 py-2 text-left hover:bg-accent`,e&&`bg-accent`),type:`button`,onClick:n,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px] font-medium text-foreground`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.title}),(0,S.jsx)(`span`,{className:Z(`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold`,t.status===`ACTIVE`&&`bg-success/10 text-success`,t.status===`PAUSED`&&`bg-warning/10 text-warning`,t.status===`COMPLETED`&&`bg-info/15 text-info`),children:t.status.toLowerCase()})]}),(0,S.jsx)(`div`,{className:`mt-1 min-w-0 truncate text-[11px] text-muted-foreground`,children:t.nextRunAt?`Next ${US(t.nextRunAt)}`:`No upcoming run`}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:BS(t.recurrence)}),t.lastRunStatus?(0,S.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`Last `,t.lastRunStatus.toLowerCase()]}):null]})]})}function QS({className:e,...t}){return(0,S.jsx)(`label`,{"data-slot":`label`,className:Z(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function $S({shell:e}){let t=e.activeSchedule,n=e.activeScheduleRuns,[r,i]=(0,x.useState)(()=>t?eC(t):null),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!1),l=e.chatAccounts.find(e=>e.id===r?.accountId)??e.chatAccounts.find(e=>e.id===t?.accountId)??null,u=e.providerDefinitions.find(e=>e.id===l?.providerId)??e.providerDefinitions.find(e=>e.id===t?.providerId)??null,d=!!(l&&u?.capabilities.includes(`models`)),f=!!u?.runtimeFields.some(e=>e.key===`reasoningEffort`),p=!!u?.runtimeFields.some(e=>e.key===`serviceTier`),m=t?e.chatAccounts.filter(e=>e.providerId===t.providerId):e.chatAccounts,h=ch(l?.providerId,a).filter(e=>!e.hidden),g=h.find(e=>e.model===r?.model||e.id===r?.model)?.displayName??r?.model??`Default`;if((0,x.useEffect)(()=>{i(t?eC(t):null)},[t?.id]),(0,x.useEffect)(()=>{let e=!1;if(o([]),!(!l||!d))return Q.providerAccounts.models(l.id).then(t=>{e||o(t.data)}).catch(()=>{e||o([])}),()=>{e=!0}},[l?.id,d]),!t||!r)return(0,S.jsx)(`section`,{className:`grid h-full min-h-0 place-items-center rounded-xl border border-border bg-card p-6 text-center`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-[15px] font-semibold text-foreground`,children:`Scheduler`}),(0,S.jsx)(`p`,{className:`mt-2 max-w-sm text-[13px] text-muted-foreground`,children:`Select a schedule or create one from the scheduler tab.`}),(0,S.jsxs)(`button`,{className:`mt-4 inline-flex h-8 items-center gap-2 rounded-md border border-border bg-secondary px-3 text-[13px] text-foreground hover:bg-accent`,type:`button`,onClick:()=>void e.createSchedule(),children:[(0,S.jsx)(uu,{className:`size-4`}),`New schedule`]})]})});let _=!!(r.title.trim()&&r.message.trim()&&r.firstRunAt&&r.accountId),v=`border-input bg-background text-foreground shadow-none focus-visible:border-ring focus-visible:ring-ring/35`,y=`mb-1 block text-[11px] font-medium leading-none text-muted-foreground`,b=`h-8 w-full border-input bg-background px-2 text-[12px] text-foreground shadow-none hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-ring/35`,C=async()=>{if(_){c(!0);try{await e.updateSchedule(t.id,{accountId:r.accountId,collaborationMode:r.collaborationMode,firstRunAt:GS(r.firstRunAt),message:r.message,model:r.model||null,permissionMode:r.permissionMode,reasoningEffort:f?uh(r.reasoningEffort):null,recurrence:{endAt:r.endAt?GS(r.endAt):null,frequency:r.recurrenceFrequency,interval:Number.parseInt(r.interval,10)||1,maxRuns:r.maxRuns&&Number.parseInt(r.maxRuns,10)||null},serviceTier:p?ph(r.serviceTier):null,status:r.active?`ACTIVE`:`PAUSED`,title:r.title})}finally{c(!1)}}};return(0,S.jsxs)(`section`,{className:`grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-xl border border-border bg-card`,children:[(0,S.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3 border-b border-border px-3`,children:[(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`h2`,{className:`truncate text-[13px] font-semibold text-foreground`,children:r.title.trim()||t.title})}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-[12px] font-medium text-muted-foreground`,children:r.active?`On`:`Off`}),(0,S.jsx)(gS,{"aria-label":r.active?`Turn schedule off`:`Turn schedule on`,className:Z(`h-5 w-9 border-border bg-accent data-[state=checked]:border-success/60 data-[state=checked]:bg-success`),checked:r.active,title:r.active?`Schedule is on`:`Schedule is off`,onCheckedChange:e=>i({...r,active:e})})]})]}),(0,S.jsxs)(`div`,{className:`grid min-h-0 gap-4 overflow-auto p-3 ide-scrollbar lg:grid-cols-[minmax(0,1fr)_minmax(280px,0.85fr)]`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[e.scheduleError?(0,S.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive`,children:e.scheduleError}):null,(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`text-[12px] font-semibold text-foreground`,children:`Details`}),(0,S.jsxs)(QS,{className:`block`,children:[(0,S.jsx)(`span`,{className:y,children:`Title`}),(0,S.jsx)(`input`,{className:Z(`h-8 px-2 text-[13px]`,v),value:r.title,onChange:e=>i({...r,title:e.target.value})})]}),(0,S.jsxs)(QS,{className:`block`,children:[(0,S.jsx)(`span`,{className:y,children:`Message`}),(0,S.jsx)(`textarea`,{className:Z(`min-h-36 resize-none px-2 py-2 text-[13px] leading-5`,v),value:r.message,onChange:e=>i({...r,message:e.target.value})})]})]}),(0,S.jsxs)(`div`,{className:`space-y-3 border-t border-border pt-4`,children:[(0,S.jsx)(`h3`,{className:`text-[12px] font-semibold text-foreground`,children:`Timing`}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`First run`}),(0,S.jsx)(`input`,{className:Z(`h-8 px-2 text-[12px]`,v),type:`datetime-local`,value:r.firstRunAt,onChange:e=>i({...r,firstRunAt:e.target.value})})]}),(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Repeat`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.recurrenceFrequency,onValueChange:e=>i({...r,recurrenceFrequency:HS(e)}),children:[(0,S.jsx)(Em,{"aria-label":`Repeat`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:VS(r.recurrenceFrequency)})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:[`none`,`daily`,`weekly`,`monthly`].map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e,children:VS(e)},e))})]})]}),(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Interval`}),(0,S.jsx)(`input`,{className:Z(`h-8 px-2 text-[12px]`,v),disabled:r.recurrenceFrequency===`none`,min:1,type:`number`,value:r.interval,onChange:e=>i({...r,interval:e.target.value})})]})]}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`End after`}),(0,S.jsx)(`input`,{className:Z(`h-8 px-2 text-[12px]`,v),disabled:r.recurrenceFrequency===`none`,min:1,placeholder:`Run count`,type:`number`,value:r.maxRuns,onChange:e=>i({...r,maxRuns:e.target.value})})]}),(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`End date`}),(0,S.jsx)(`input`,{className:Z(`h-8 px-2 text-[12px]`,v),disabled:r.recurrenceFrequency===`none`,type:`datetime-local`,value:r.endAt,onChange:e=>i({...r,endAt:e.target.value})})]})]})]}),(0,S.jsxs)(`div`,{className:`space-y-3 border-t border-border pt-4`,children:[(0,S.jsx)(`h3`,{className:`text-[12px] font-semibold text-foreground`,children:`Execution`}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Provider account`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.accountId,onValueChange:e=>i({...r,accountId:e}),children:[(0,S.jsx)(Em,{"aria-label":`Provider account`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:m.find(e=>e.id===r.accountId)?.displayName??`Choose account`})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:m.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.id,children:e.displayName},e.id))})]})]}),(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Access`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.permissionMode,onValueChange:e=>i({...r,permissionMode:ah(e)}),children:[(0,S.jsx)(Em,{"aria-label":`Access mode`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:r.permissionMode===`fullAccess`?`Full access`:`Ask for approval`})}),(0,S.jsxs)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:[(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`askForApproval`,children:`Ask for approval`}),(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`fullAccess`,children:`Full access`})]})]})]}),(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Mode`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.collaborationMode,onValueChange:e=>i({...r,collaborationMode:e===`plan`?`plan`:`default`}),children:[(0,S.jsx)(Em,{"aria-label":`Mode`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:r.collaborationMode===`plan`?`Plan`:`Default`})}),(0,S.jsxs)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:[(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`default`,children:`Default`}),(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:`plan`,children:`Plan`})]})]})]})]})]}),d||f||p?(0,S.jsxs)(`div`,{className:`space-y-3 border-t border-border pt-4`,children:[(0,S.jsx)(`h3`,{className:`text-[12px] font-semibold text-foreground`,children:`Runtime`}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[d?(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Model`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.model||h[0]?.model||``,onValueChange:e=>i({...r,model:e}),children:[(0,S.jsx)(Em,{"aria-label":`Model`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:g})}),(0,S.jsx)(Dm,{align:`start`,className:`max-h-72 border-border bg-popover text-foreground`,children:h.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.model,children:e.displayName},e.id))})]})]}):null,f?(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Reasoning`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.reasoningEffort,onValueChange:e=>i({...r,reasoningEffort:lh(e)}),children:[(0,S.jsx)(Em,{"aria-label":`Reasoning`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:dh(r.reasoningEffort)})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:$m.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.value,children:e.label},e.value))})]})]}):null,p?(0,S.jsxs)(QS,{className:`block min-w-0`,children:[(0,S.jsx)(`span`,{className:y,children:`Speed`}),(0,S.jsxs)(Tm,{className:`w-full min-w-0`,value:r.serviceTier,onValueChange:e=>i({...r,serviceTier:fh(e)}),children:[(0,S.jsx)(Em,{"aria-label":`Speed`,className:b,children:(0,S.jsx)(`span`,{className:`truncate`,children:mh(r.serviceTier)})}),(0,S.jsx)(Dm,{align:`start`,className:`border-border bg-popover text-foreground`,children:eh.map(e=>(0,S.jsx)(Om,{className:`text-[12px] hover:bg-accent focus-visible:bg-accent`,value:e.value,children:e.label},e.value))})]})]}):null]})]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4`,children:[(0,S.jsxs)(`button`,{className:`h-8 gap-2 rounded-md border-destructive/30 bg-destructive/10 px-3 text-[12px] text-destructive hover:bg-destructive/10`,type:`button`,onClick:()=>void e.deleteSchedule(t.id),children:[(0,S.jsx)(xu,{className:`size-3.5`}),`Delete`]}),(0,S.jsxs)(`button`,{className:`h-8 gap-2 rounded-md border-border bg-secondary px-3 text-[12px] text-foreground hover:bg-accent`,disabled:!_||s,type:`button`,onClick:()=>void C(),children:[(0,S.jsx)(Rl,{className:`size-3.5`}),s?`Saving`:`Save`]})]})]}),(0,S.jsxs)(`div`,{className:`min-w-0 border-t border-border pt-3 lg:border-l lg:border-t-0 lg:pl-4 lg:pt-0`,children:[(0,S.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Execution History`}),(0,S.jsx)(`div`,{className:`mt-3 space-y-2`,children:n.length?n.map(t=>(0,S.jsxs)(`button`,{className:`block w-full rounded-md border border-border bg-secondary/40 px-3 py-2 text-left hover:bg-popover`,type:`button`,onClick:()=>void e.openScheduleRunChat(t),children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium text-foreground`,children:US(t.scheduledFor)}),(0,S.jsx)(`span`,{className:Z(`rounded px-1.5 py-0.5 text-[10px] font-semibold`,KS(t.status)),children:t.status.toLowerCase()})]}),(0,S.jsxs)(`div`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[t.startedAt?`Started ${Qg(t.startedAt)}`:`Waiting`,t.endedAt?` / Ended ${Qg(t.endedAt)}`:``]}),t.error?(0,S.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] text-destructive`,children:t.error}):null]},t.id)):(0,S.jsx)(`div`,{className:`rounded-md border border-border bg-secondary/40 px-3 py-3 text-[12px] text-muted-foreground`,children:`No runs yet`})})]})]})]})}function eC(e){return{accountId:e.accountId??``,active:e.status===`ACTIVE`,collaborationMode:e.collaborationMode===`plan`?`plan`:`default`,endAt:e.recurrence.endAt?WS(e.recurrence.endAt):``,firstRunAt:WS(e.nextRunAt??new Date(Date.now()+3600*1e3).toISOString()),interval:String(e.recurrence.interval||1),maxRuns:e.recurrence.maxRuns?String(e.recurrence.maxRuns):``,message:e.message,model:e.model??``,permissionMode:ah(e.permissionMode),reasoningEffort:lh(e.reasoningEffort),recurrenceFrequency:e.recurrence.frequency,serviceTier:fh(e.serviceTier),title:e.title}}var tC=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=sp({disabled:i,focusableWhenDisabled:a,native:o});return ri(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),nC=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,rC=qs,iC=((e,t)=>n=>{if(t?.variants==null)return rC(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=nC(t)||nC(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return rC(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)})(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function aC({className:e,variant:t=`default`,size:n=`default`,type:r,...i}){return(0,S.jsx)(tC,{"data-slot":`button`,className:Z(iC({variant:t,size:n,className:e})),type:r??`button`,...i})}var oC=[{icon:iu,label:`Dark`,value:`dark`},{icon:yu,label:`Light`,value:`light`},{icon:ru,label:`System`,value:`system`}];function sC({className:e}){let{resolvedTheme:t,setTheme:n,theme:r}=M(),i=t===`dark`?iu:yu;return(0,S.jsxs)(Kv,{children:[(0,S.jsx)(qv,{render:(0,S.jsx)(aC,{"aria-label":`Change theme`,className:Z(`size-7 rounded-md text-muted-foreground hover:text-foreground`,e),size:`icon-sm`,variant:`ghost`}),children:(0,S.jsx)(i,{className:`size-4`})}),(0,S.jsx)(Jv,{align:`end`,className:`w-32`,children:oC.map(e=>{let t=e.icon;return(0,S.jsxs)(Yv,{onClick:()=>n(e.value),children:[(0,S.jsx)(t,{className:`size-4`}),(0,S.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,S.jsx)(`span`,{className:Z(`size-1.5 rounded-full bg-primary`,r===e.value?`opacity-100`:`opacity-0`)})]},e.value)})})]})}var cC=x.createContext(!1),lC=x.createContext(void 0);function uC(e){let t=x.useContext(lC);if(e===!1&&t===void 0)throw Error(U(27));return t}var dC={...Es,...vo},fC=x.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=uC(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ri(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:dC,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),pC=x.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=uC(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=sp({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,Nt(Tt,e.nativeEvent))}return ri(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),mC=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),hC=function(e){return e[e.open=_s.open]=`open`,e[e.closed=_s.closed]=`closed`,e[e.startingStyle=_s.startingStyle]=`startingStyle`,e[e.endingStyle=_s.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),gC=x.createContext(void 0);function _C(){let e=x.useContext(gC);if(e===void 0)throw Error(U(26));return e}var vC={...Es,...vo,nestedDialogOpen(e){return e?{[hC.nestedDialogOpen]:``}:null}},yC=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=uC(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),C=d.useState(`floatingId`),w=s.id??C;_C(),bo({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let T=o===void 0?So(c.context.popupRef):o,E=g>0,D=c.useStateSetter(`popupElement`),O=ri(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:E},props:[f,{id:w,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,...xo,hidden:!m,onKeyDown(e){$p.has(e.key)&&e.stopPropagation()},style:{[mC.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,D],stateAttributesMapping:vC});return(0,S.jsx)(Li,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:T,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:O})}),bC=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=uC(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,S.jsx)(gC.Provider,{value:n,children:(0,S.jsxs)(vi,{ref:t,...r,children:[a&&o===!0&&(0,S.jsx)(Tp,{ref:i.context.internalBackdropRef,inert:Ws(!s)}),e.children]})}):null});function xC(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);Mo(t,r),ko(t);let{forceUnmount:i}=Ao(r,t),a=x.useCallback(()=>{t.setOpen(!1,Nt(jt))},[t]);x.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function SC({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=x.useState(0),[u,d]=x.useState(0),f=c===0,p=Vi(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=nt(t);return f&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||tt(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:f});return Ip(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{l(0),d(0)}),x.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(c+1,u+ +!!n),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,c,u,t]),jo(e,{activeTriggerProps:p.reference??vt,inactiveTriggerProps:p.trigger??vt,popupProps:p.floating??vt,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var CC={...Ho,modal:q(e=>e.modal),nested:q(e=>e.nested),nestedOpenDialogCount:q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:q(e=>e.disablePointerDismissal),openMethod:q(e=>e.openMethod),descriptionElementId:q(e=>e.descriptionElementId),titleElementId:q(e=>e.titleElementId),viewportElement:q(e=>e.viewportElement),role:q(e=>e.role)},wC=class e extends lo{constructor(e,t,n=!1){let r=new No,i=TC(e);i.floatingRootContext=Io(r,t,n),super(i,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},CC)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};To(n,e,t.trigger),this.update(n)};static useStore(t,n){return Co(t,(t,r)=>new e(n,t,r),!0).store}};function TC(e={}){return{...Fo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function EC(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=uC(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=wC.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});Za(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let C=b.useState(`open`),w=b.useState(`mounted`),T=b.useState(`payload`);xC({store:b,actionsRef:l});let E=C||w,D=x.useMemo(()=>({store:b}),[b]);return(0,S.jsx)(cC.Provider,{value:!1,children:(0,S.jsxs)(lC.Provider,{value:D,children:[E&&(0,S.jsx)(SC,{store:b,parentContext:v?.store.context,isDrawer:p}),typeof n==`function`?n({payload:T}):n]})})}function DC(e){return EC(e,x.useContext(cC)?`drawer`:`dialog`)}var OC=x.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=uC(),c=Ds(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ri(`h2`,e,{ref:t,props:[{id:c},o]})});function kC({...e}){return(0,S.jsx)(DC,{"data-slot":`sheet`,...e})}function AC({...e}){return(0,S.jsx)(bC,{"data-slot":`sheet-portal`,...e})}function jC({className:e,...t}){return(0,S.jsx)(fC,{"data-slot":`sheet-overlay`,className:Z(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function MC({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,S.jsxs)(AC,{children:[(0,S.jsx)(jC,{}),(0,S.jsxs)(yC,{"data-slot":`sheet-content`,"data-side":n,className:Z(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,S.jsxs)(pC,{"data-slot":`sheet-close`,render:(0,S.jsx)(aC,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,S.jsx)(Cu,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function NC({className:e,...t}){return(0,S.jsx)(OC,{"data-slot":`sheet-title`,className:Z(`font-heading text-base font-medium text-foreground`,e),...t})}function PC({activeWorkspaceId:e,isFilesPanelOpen:t,isTerminalPanelOpen:n,workspaces:r,onAddWorkspace:i,onCloseWorkspace:a,onOpenFilesDrawer:o,onOpenSessionsDrawer:s,onSelectWorkspace:c,onToggleFilesPanel:l,onToggleTerminalPanel:u}){return(0,S.jsxs)(`header`,{className:`flex min-w-0 items-center bg-background`,children:[(0,S.jsx)(`div`,{className:`flex h-full shrink-0 items-center pl-2 md:hidden`,children:(0,S.jsx)(`button`,{"aria-label":`Open chats panel`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:s,children:(0,S.jsx)(au,{className:`size-4`})})}),(0,S.jsx)(FC,{activeWorkspaceId:e,workspaces:r,onAddWorkspace:i,onCloseWorkspace:a,onSelectWorkspace:c}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center justify-end gap-2 px-3`,children:[(0,S.jsx)(`button`,{"aria-label":n?`Hide terminal panel`:`Show terminal panel`,"aria-pressed":n,className:Z(`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,n&&`bg-accent text-foreground`),type:`button`,onClick:u,children:(0,S.jsx)(bu,{className:`size-4`})}),(0,S.jsx)(sC,{}),(0,S.jsx)(`button`,{"aria-label":`Open files panel`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground md:hidden`,type:`button`,onClick:o,children:(0,S.jsx)(ou,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":t?`Hide files panel`:`Show files panel`,"aria-pressed":t,className:Z(`hidden size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground md:grid`,t&&`bg-accent text-foreground`),type:`button`,onClick:l,children:(0,S.jsx)(ou,{className:`size-4`})})]})]})}function FC({activeWorkspaceId:e,workspaces:t,onAddWorkspace:n,onCloseWorkspace:r,onSelectWorkspace:i}){return(0,S.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 items-center gap-1 overflow-hidden px-2`,children:[t.map(t=>(0,S.jsx)(IC,{active:t.id===e,label:t.name,onClose:()=>r(t.id),onSelect:()=>i(t.id)},t.id)),(0,S.jsx)(`button`,{"aria-label":`Open workspace`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:n,children:(0,S.jsx)(uu,{className:`size-4`})})]})}function IC({active:e,label:t,onClose:n,onSelect:r}){return(0,S.jsxs)(`div`,{className:Z(`group relative flex h-6 min-w-0 max-w-34 shrink-0 items-center rounded-md border border-transparent text-[11px] font-medium transition-colors`,e?`border-border bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),title:t,children:[(0,S.jsx)(`button`,{className:`min-w-0 flex-1 px-1.5 text-left`,type:`button`,onClick:r,children:(0,S.jsx)(`span`,{className:`block truncate`,children:t})}),(0,S.jsx)(`button`,{"aria-label":`Close ${t}`,className:Z(`mr-1 grid size-3 shrink-0 place-items-center rounded-sm text-muted-foreground hover:text-foreground`,e?`opacity-100`:`opacity-0 group-hover:opacity-100`),type:`button`,onClick:e=>{e.stopPropagation(),n()},children:(0,S.jsx)(Cu,{className:`size-2`})})]})}function LC({children:e,open:t,side:n,title:r,onClose:i}){return(0,S.jsx)(kC,{open:t,onOpenChange:e=>{e||i()},children:(0,S.jsxs)(MC,{className:`grid !w-[min(88vw,380px)] grid-rows-[40px_minmax(0,1fr)] gap-0 border-border bg-background p-0 shadow-2xl md:hidden`,showCloseButton:!1,side:n,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-3`,children:[(0,S.jsx)(NC,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-foreground`,children:r}),(0,S.jsx)(`button`,{"aria-label":`Close ${r.toLowerCase()} drawer`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,type:`button`,onClick:i,children:(0,S.jsx)(Cu,{className:`size-3`})})]}),(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:e})]})})}var RC=`modulepreload`,zC=function(e){return`/`+e},BC={},VC=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=zC(t,n),t in BC)return;BC[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:RC,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function HC({activeTerminalId:e,connectionState:t,error:n,outputByTerminalId:r,terminals:i,workspaceName:a,workspacePath:o,onActivateTerminal:s,onCloseTerminal:c,onCreateTerminal:l,onHide:u,onInput:d,onResize:f,onResizeStart:p}){let m=i.find(t=>t.id===e)??i[0]??null;return(0,S.jsxs)(`section`,{className:`relative grid h-full min-h-0 grid-rows-[4px_36px_minmax(0,1fr)] overflow-hidden rounded-lg border border-border bg-background`,children:[(0,S.jsx)(`button`,{"aria-label":`Resize terminal panel`,className:`group flex cursor-row-resize items-center justify-center bg-background outline-none hover:bg-accent/50 focus-visible:bg-accent/50`,type:`button`,onPointerDown:p,children:(0,S.jsx)(`span`,{className:`h-px w-14 rounded-full bg-transparent group-hover:bg-border group-focus-visible:bg-primary`})}),(0,S.jsxs)(`header`,{className:`flex min-w-0 items-center border-b border-border bg-secondary/40 px-2`,children:[(0,S.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden pr-2 ide-scrollbar`,role:`tablist`,children:i.length?i.map(e=>{let t=e.id===m?.id;return(0,S.jsxs)(`div`,{className:Z(`group flex h-7 min-w-28 max-w-48 shrink-0 items-center rounded-md text-[12px]`,t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent`),children:[(0,S.jsxs)(`button`,{"aria-selected":t,className:`flex h-full min-w-0 flex-1 items-center gap-1.5 px-2 text-left`,role:`tab`,title:`${e.cwd} - ${a}`,type:`button`,onClick:()=>s(e.id),children:[(0,S.jsx)(bu,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:UC(e,i)}),(0,S.jsx)(`span`,{className:Z(`size-1.5 shrink-0 rounded-full`,e.status===`running`&&`bg-success`,e.status===`connecting`&&`bg-info`,e.status===`exited`&&`bg-muted-foreground`)})]}),(0,S.jsx)(`button`,{"aria-label":`Close ${UC(e,i)}`,className:`mr-1 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100`,type:`button`,onClick:()=>c(e.id),children:(0,S.jsx)(Cu,{className:`size-3`})})]},e.id)}):(0,S.jsxs)(`div`,{className:`flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2 text-[12px] text-muted-foreground`,title:o,children:[(0,S.jsx)(bu,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`truncate`,children:t===`connecting`?`Connecting`:`No terminal`}),t===`connecting`?(0,S.jsx)(eu,{className:`size-3.5 shrink-0 animate-spin text-info`}):null]})}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,S.jsx)(`button`,{"aria-label":`New terminal`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`New terminal`,type:`button`,onClick:l,children:(0,S.jsx)(uu,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":`Close terminal`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40`,disabled:!m,title:`Close terminal`,type:`button`,onClick:()=>m?c(m.id):void 0,children:(0,S.jsx)(xu,{className:`size-4`})}),(0,S.jsx)(`button`,{"aria-label":`Hide terminal panel`,className:`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:`Hide terminal panel`,type:`button`,onClick:u,children:(0,S.jsx)(Cu,{className:`size-4`})})]})]}),(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-background`,children:m?(0,S.jsx)(WC,{output:r[m.id]??``,terminal:m,onInput:e=>d(m.id,e),onResize:(e,t)=>f(m.id,e,t)},m.id):(0,S.jsx)(`div`,{className:`grid h-full place-items-center p-4 text-center text-[12px] text-muted-foreground`,children:(0,S.jsxs)(`button`,{className:`inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 font-semibold text-primary-foreground hover:bg-primary/80`,type:`button`,onClick:l,children:[(0,S.jsx)(bu,{className:`size-4`}),`Start terminal`]})})}),n?(0,S.jsx)(`div`,{className:`pointer-events-none absolute bottom-3 left-3 right-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive`,children:n}):null]})}function UC(e,t){let n=t.filter(t=>t.name===e.name);return n.length<=1?e.name:`${e.name} ${n.findIndex(t=>t.id===e.id)+1}`}function WC({output:e,terminal:t,onInput:n,onResize:r}){let i=(0,x.useRef)(null),a=(0,x.useRef)(0),o=(0,x.useRef)(n),s=(0,x.useRef)(r),c=(0,x.useRef)(e),l=(0,x.useRef)(null),{resolvedTheme:u}=M();return(0,x.useEffect)(()=>{o.current=n,s.current=r,c.current=e},[n,r,e]),(0,x.useEffect)(()=>{let e=!1,t=()=>void 0;return i.current?(Promise.all([VC(()=>import(`./xterm-DooSxjI5.js`),[]),VC(()=>import(`./addon-fit-DthTIhi3.js`),[])]).then(([n,r])=>{if(e||!i.current)return;let u=new n.Terminal({allowProposedApi:!1,convertEol:!0,cursorBlink:!0,cursorStyle:`block`,fontFamily:`SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace`,fontSize:12,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,scrollback:5e3,theme:Ex()}),d=new r.FitAddon;u.loadAddon(d),u.open(i.current),l.current=u;let f=()=>{try{d.fit(),s.current(u.cols,u.rows)}catch{}},p=u.onData(e=>o.current(e)),m=new ResizeObserver(f);m.observe(i.current),requestAnimationFrame(f);let h=c.current;h&&u.write(h),a.current=h.length,u.focus(),t=()=>{p.dispose(),m.disconnect(),u.dispose(),l.current=null,a.current=0}}),()=>{e=!0,t()}):t},[t.id]),(0,x.useEffect)(()=>{l.current&&(l.current.options.theme=Ex())},[u]),(0,x.useEffect)(()=>{let t=l.current;if(!t)return;let n=a.current;e.length<n?(t.reset(),e&&t.write(e)):e.length>n&&t.write(e.slice(n)),a.current=e.length},[e]),(0,S.jsx)(`div`,{ref:i,className:Z(`h-full min-h-0 w-full overflow-hidden px-2 py-1`,t.status===`exited`&&`opacity-80`)})}var GC=26e4;function KC(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(`offline`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)({}),[l,u]=(0,x.useState)([]),d=(0,x.useRef)({cols:80,rows:24}),f=(0,x.useRef)(!1),p=(0,x.useRef)(null),m=(0,x.useCallback)(e=>{u(t=>{let r=t.findIndex(t=>t.id===e),i=t.filter(t=>t.id!==e);return n(t=>t===e?i[Math.max(0,r-1)]?.id??i[0]?.id??null:t),i}),c(t=>mg(t,e))},[]);(0,x.useEffect)(()=>{if(f.current=!1,n(null),o(null),c({}),u([]),!e){i(`offline`),p.current=null;return}i(`connecting`);let t=hf({path:`/socket.io`});p.current=t;let r=(e,t)=>{c(n=>{let r=(n[e]??``)+t;return{...n,[e]:r.length>GC?r.slice(-26e4):r}})},a=()=>i(`connected`),s=()=>{i(`offline`),u(e=>e.map(e=>e.status===`running`?{...e,status:`exited`}:e))},l=e=>{let t=Im(e),n=$(t,`id`),i=$(t,`data`);n&&i&&r(n,i)},d=e=>{let t=Im(e),n=$(t,`id`);if(!n)return;let i=typeof t.exitCode==`number`&&Number.isFinite(t.exitCode)?t.exitCode:null;u(e=>e.map(e=>e.id===n?{...e,exitCode:i,status:`exited`}:e)),r(n,`\r\n[process exited${i===null?``:` with code ${i}`}]\r\n`)},h=e=>{let t=$(Im(e),`id`);t&&m(t)},g=e=>{o($(Im(e),`error`)||`Terminal host error.`)};return t.on(`connect`,a),t.on(`disconnect`,s),t.on(`terminal.output`,l),t.on(`terminal.exit`,d),t.on(`terminal.closed`,h),t.on(`terminal.error`,g),()=>{t.off(`connect`,a),t.off(`disconnect`,s),t.off(`terminal.output`,l),t.off(`terminal.exit`,d),t.off(`terminal.closed`,h),t.off(`terminal.error`,g),t.disconnect(),p.current===t&&(p.current=null)}},[e?.path,m]);let h=(0,x.useCallback)(()=>{let t=p.current;if(!e||!t||f.current)return;f.current=!0,o(null);let r=`pending-terminal-`+Date.now(),i={cwd:e.path,id:r,name:`starting`,shell:``,status:`connecting`};u(e=>[...e,i]),n(r),t.emit(`terminal.create`,{cols:d.current.cols,rows:d.current.rows,workspacePath:e.path},e=>{f.current=!1;let t=Im(e),i=Im(t.terminal),a=$(i,`cwd`),s=$(i,`id`),c=$(i,`name`),l=$(i,`shell`);if(t.ok!==!0||!a||!s||!c||!l){o($(t,`error`)||`Unable to start terminal.`),m(r);return}let d={cwd:a,id:s,name:c,shell:l,status:`running`};u(e=>{let t=e.filter(e=>e.id!==r);return t.some(e=>e.id===d.id)?t.map(e=>e.id===d.id?d:e):[...t,d]}),n(d.id)})},[e?.path,m]);return{activeTerminalId:t,closeTerminal:(0,x.useCallback)(e=>{p.current?.emit(`terminal.close`,{id:e}),m(e)},[m]),connectionState:r,createTerminal:h,error:a,outputByTerminalId:s,resizeTerminal:(0,x.useCallback)((e,t,n)=>{d.current={cols:t,rows:n},p.current?.emit(`terminal.resize`,{cols:t,id:e,rows:n})},[]),setActiveTerminalId:n,terminals:l,writeTerminalInput:(0,x.useCallback)((e,t)=>{p.current?.emit(`terminal.input`,{data:t,id:e})},[])}}function qC(e,t){e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let n=e.clientX,r=YC(`col-resize`),i=e=>{let r=t.origin===`left`?e.clientX-n:n-e.clientX;t.onResize(XC(t.initialWidth+r,t.min,t.max))},a=()=>{r(),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,a)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,a)}function JC(e,t){e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let n=e.clientY,r=YC(`row-resize`),i=e=>{let r=t.origin===`top`?n-e.clientY:e.clientY-n;t.onResize(XC(t.initialHeight+r,t.min,t.max))},a=()=>{r(),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,a)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,a)}function YC(e){let t=document.body.style.cursor,n=document.body.style.userSelect;return document.body.style.cursor=e,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=t,document.body.style.userSelect=n}}function XC(e,t,n){return Math.min(n,Math.max(t,Math.round(e)))}var ZC=(0,x.createContext)(null);function QC(){let e=(0,x.useContext)(ZC);if(!e)throw Error(`useSessionShellState must be used within SessionShellContext.`);return e}function $C(){let e=ew();return(0,S.jsx)(uy,{chats:e.chats,isLoading:e.isChatsLoading,messagesByChatId:e.messagesByChatId,children:(0,S.jsx)(ny,{children:(0,S.jsx)(ZC.Provider,{value:e,children:(0,S.jsx)(tw,{})})})})}function ew(){let[e]=(0,x.useState)(()=>Cg()),[t,n]=(0,x.useState)(()=>!!e.workspaceId),[r,i]=(0,x.useState)(`files`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)([]),[p,m]=(0,x.useState)([]),[h,g]=(0,x.useState)([]),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)({}),[w,T]=(0,x.useState)(!1),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)({}),[P,F]=(0,x.useState)([]),[I,L]=(0,x.useState)(`chats`),[R,z]=(0,x.useState)(!0),[ee,B]=(0,x.useState)([]),[V,H]=(0,x.useState)(null),[U,W]=(0,x.useState)(new Set),[te,G]=(0,x.useState)(new Set),[ne,re]=(0,x.useState)({}),[ie,ae]=(0,x.useState)(380),[oe,se]=(0,x.useState)(()=>pg()),[ce,le]=(0,x.useState)(!1),[ue,de]=(0,x.useState)(`chat`),[fe,pe]=(0,x.useState)({}),[me,he]=(0,x.useState)(null),[ge,_e]=(0,x.useState)({}),[ve,ye]=(0,x.useState)(280),[be,xe]=(0,x.useState)({}),[Se,Ce]=(0,x.useState)(290),[we,Te]=(0,x.useState)(!1),[Ee,De]=(0,x.useState)(!1),[Oe,ke]=(0,x.useState)(!1),[Ae,je]=(0,x.useState)(!1),[Me,Ne]=(0,x.useState)(null),[Pe,Fe]=(0,x.useState)(!1),[Ie,Le]=(0,x.useState)([]),Re=(0,x.useRef)(null),ze=(0,x.useRef)(null),Be=(0,x.useRef)(new Set),Ve=(0,x.useRef)(null),He=(0,x.useRef)(null),K=(0,x.useMemo)(()=>Ie.find(e=>e.id===s)??Ie[0]??null,[s,Ie]),Ue=(0,x.useMemo)(()=>d.find(e=>e.id===a)??null,[a,d]),We=(0,x.useMemo)(()=>P.find(e=>e.id===E)??null,[E,P]),Ge=K?be[K.id]??K.selectedFileId:``,Ke=(0,x.useMemo)(()=>K?l_(K.fileTree,Ge):null,[K,Ge]),qe=(0,x.useMemo)(()=>K?(ge[K.id]??[]).map(e=>l_(K.fileTree,e)).filter(e=>!!e):[],[K,ge]),Je=Ke?ne[Ke.id]??__(Ke):``,Ye=Ue?fe[Ue.id]??[]:[],Xe=Ue?Object.prototype.hasOwnProperty.call(fe,Ue.id):!0,Ze=oe?`${ve}px minmax(420px, 1fr) ${ie}px`:`${ve}px minmax(420px, 1fr)`,Qe=KC(K),$e=(e,t)=>{g(e),m(t.filter(e=>e.status===`CONNECTED`))},et=async()=>{z(!0),Ne(null);try{let t=await Q.workspaces.listHistory();B(t);let n=[],r=t.find(t=>t.id===e.workspaceId);if(r){let e=await kg(r,n);e&&n.push(e)}Le(n),W(new Set(n.flatMap(e=>Ag(e)))),_e(Object.fromEntries(n.map(e=>[e.id,jg(e)]))),xe(Object.fromEntries(n.map(e=>[e.id,e.selectedFileId]))),c(t=>n.find(e=>e.id===t)?.id??n.find(t=>t.id===e.workspaceId)?.id??null)}catch(e){Ne(Og(e)),Le([]),c(null)}finally{z(!1)}},tt=async(t,r,i)=>{i?.silent||(T(!0),k(!0)),u(null),j(null);try{let[s,c,l,u]=await Promise.all([Q.chats.list(t),Q.providerAccounts.list(),Q.providers.list(),Q.schedules.list(t)]);f(s),F(u),$e(l,c);let d=r&&e.workspaceId===r?e.chatId:null,p=s.find(e=>e.id===a)?.id??s.find(e=>e.id===d)?.id??s[0]?.id??null;o(p),p&&!i?.silent&&nt(p),r&&e.workspaceId===r&&n(!1)}catch(e){u(Og(e)),i?.silent||(f([]),F([]),o(null))}finally{i?.silent||(T(!1),k(!1))}},nt=async e=>{try{let t=await Q.chats.listMessages(e);pe(n=>({...n,[e]:t.data}))}catch(t){u(Og(t)),pe(t=>Object.prototype.hasOwnProperty.call(t,e)?t:{...t,[e]:[]})}},rt=async e=>{j(null);try{let t=await Q.schedules.listRuns(e);N(n=>({...n,[e]:t}))}catch(e){j(Og(e))}};(0,x.useEffect)(()=>{let e=window.matchMedia(`(min-width: 1024px)`),t=e=>{e.matches||se(!1)};return t(e),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,x.useEffect)(()=>{et()},[]),(0,x.useEffect)(()=>{if(!K){f([]),F([]),o(null),D(null);return}tt(K.path,K.id)},[K?.path]),(0,x.useEffect)(()=>{E&&rt(E)},[E]),(0,x.useEffect)(()=>{a&&nt(a)},[a]),(0,x.useEffect)(()=>{if(!K)return;let n=t&&e.workspaceId===K.id?e.chatId:null;wg(K.id,a??n)},[a,K?.id,e.chatId,e.workspaceId,t]),(0,x.useEffect)(()=>{Re.current=a},[a]),(0,x.useEffect)(()=>{ze.current=E},[E]),(0,x.useEffect)(()=>{if(!(!ce||!K)){if(Qe.terminals.length>0){He.current=K.id;return}He.current!==K.id&&(He.current=K.id,Qe.createTerminal())}},[K?.id,ce,Qe.createTerminal,Qe.terminals.length]),(0,x.useEffect)(()=>{if(!K)return;let e=hf({path:`/socket.io`});Ve.current=e;let t=()=>{e.emit(`workspace.join`,K.path),Re.current&&e.emit(`chat.join`,Re.current)};t();let n=e=>{let t=Mg(e);if(t){if(t.type===`chat.accountSwitch`){let e=Ng(t.payload);if(!e)return;C(t=>e.phase===`completed`||e.phase===`failed`?mg(t,e.chatId):{...t,[e.chatId]:e.phase}),e.phase===`failed`&&(v(e.fromAccountId??null),b(!1),u(e.error??`Unable to switch provider account.`)),e.phase===`completed`&&b(!1);return}if(t.type===`chat.updated`){let e=Pg(t.payload);if(!e||e.workingDirectory&&!yg(e.workingDirectory,K.path))return;f(t=>e.status===`ARCHIVED`?t.filter(t=>t.id!==e.id):Ug(t,e));return}if(t.type===`run.status`&&t.threadId){let e=Ig(t.payload);if(!e)return;f(n=>n.map(n=>n.id===t.threadId?{...n,status:e}:n));return}if(t.type===`schedule.updated`){let e=qS(t.payload);if(!e||!yg(e.workingDirectory,K.path))return;F(t=>e.status===`ARCHIVED`?t.filter(t=>t.id!==e.id):LS(t,e)),e.status===`ARCHIVED`&&ze.current===e.id&&(D(null),de(`chat`));return}if(t.type===`schedule.run.updated`){let e=JS(t.payload);if(!e)return;N(t=>({...t,[e.scheduleId]:RS(t[e.scheduleId]??[],e)}))}}},r=e=>{let t=Fg(e);t&&pe(e=>({...e,[t.chatId]:qg(e[t.chatId]??[],t)}))},i=e=>{let t=Im(e),n=$(t,`chatId`),r=$(t,`messageId`);!n||!r||pe(e=>({...e,[n]:(e[n]??[]).filter(e=>e.id!==r)}))};return e.on(`connect`,t),e.on(`provider.event`,n),e.on(`message.created`,r),e.on(`message.deleted`,i),()=>{e.emit(`workspace.leave`,K.path),e.off(`connect`,t),e.off(`provider.event`,n),e.off(`message.created`,r),e.off(`message.deleted`,i),Ve.current=null,e.disconnect()}},[K?.path]),(0,x.useEffect)(()=>{let e=Ve.current;if(!(!e||!a))return e.emit(`chat.join`,a),()=>{e.emit(`chat.leave`,a)}},[a,K?.path]);let it=async e=>{if(e.type!==`directory`||e.error)return;let t=Ie.find(t=>yg(t.path,e.path));if(t){c(t.id),await Q.workspaces.saveHistory(t.path).catch(()=>void 0),n(!1),Fe(!1),he(null);return}let r=$g(e,Ie,(await Q.workspaces.saveHistory(e.path).catch(e=>(Ne(Og(e)),null)))?.id);Le(e=>[...e,r]),_e(e=>({...e,[r.id]:jg(r)})),xe(e=>({...e,[r.id]:r.selectedFileId})),W(e=>{let t=new Set(e);for(let e of Ag(r))t.add(e);return t}),i(`files`),c(r.id),Te(!1),ke(!1),de(`chat`),he(null),Fe(!1),n(!1)},at=async e=>{let t=Ie.find(t=>t.id===e.id||yg(t.path,e.path));if(t){c(t.id),await Q.workspaces.saveHistory(t.path).catch(()=>void 0),Fe(!1),he(null),n(!1);return}Ne(null);try{let t=await kg(e,Ie);if(!t){Ne(`Unable to open workspace.`);return}Le(e=>[...e,t]),_e(e=>({...e,[t.id]:jg(t)})),xe(e=>({...e,[t.id]:t.selectedFileId})),W(e=>{let n=new Set(e);for(let e of Ag(t))n.add(e);return n}),c(t.id),Te(!1),ke(!1),de(`chat`),he(null),n(!1);let r=await Q.workspaces.saveHistory(t.path).catch(()=>null);r&&B(e=>[r,...e.filter(e=>e.id!==r.id)])}catch(e){Ne(Og(e))}},ot=e=>{let t=Ie.find(t=>t.id===e);t&&(Le(t=>{let n=t.findIndex(t=>t.id===e),r=t.filter(t=>t.id!==e);if(e===s){let e=r[Math.max(0,n-1)]??r[0];c(e?.id??null),e||(Tg(),o(null),de(`chat`),he(null))}return r}),_e(t=>mg(t,e)),xe(t=>mg(t,e)),Q.workspaces.deleteHistory(t.path).catch(()=>void 0))},st=async e=>{if(!(!e.path||ne[e.id]!==void 0))try{let t=await Q.workspaces.readResource(e.path);re(n=>n[e.id]===void 0?{...n,[e.id]:t.content}:n)}catch(t){re(n=>n[e.id]===void 0?{...n,[e.id]:Og(t)}:n)}},ct=(e,t)=>{let n=new Set(Be.current);t?n.add(e):n.delete(e),Be.current=n,G(n)},lt=async e=>{if(!K||e.type!==`folder`||e.children||!e.path||Be.current.has(e.id))return;let t=e.id,n=K.id;ct(t,!0);try{let r=((await Q.workspaces.readTree(e.path)).children??[]).map((e,n)=>n_(e,`${t}/${n}-${t_(e.name)}`));Le(e=>e.map(e=>e.id===n?{...e,fileTree:r_(e.fileTree,t,r)}:e))}catch{Le(e=>e.map(e=>e.id===n?{...e,fileTree:r_(e.fileTree,t,[])}:e))}finally{ct(t,!1)}},ut=(e,t)=>{if(!K)return;let n=l_(K.fileTree,e);n&&st(n),_e(t=>{let n=t[K.id]??[];return n.includes(e)?t:{...t,[K.id]:[...n,e]}}),xe(t=>({...t,[K.id]:e})),Te(!1),ke(!1),he(null),de(xg()?`dialog`:`editor`),H(t?.lineNumber?{fileId:e,lineNumber:t.lineNumber,column:t.column,nonce:Date.now()}:null)},dt=e=>{if(!K)return!1;let t=Qh(e,K);if(!t)return!1;let n=d_(K.fileTree,t.path);return n?(ut(n.id,{lineNumber:t.lineNumber,column:t.column}),!0):!1},ft=e=>{if(!K)return;let t=ge[K.id]??[],n=t.filter(t=>t!==e);if(_e(e=>({...e,[K.id]:n})),Ge!==e)return;let r=t.indexOf(e),i=n[Math.max(0,r-1)]??n[0];if(i){xe(e=>({...e,[K.id]:i}));return}de(`chat`)},pt=async(e,t,n)=>{if(!K)return!1;let r=mw(K.fileTree,e);if(!r){let t=await hw(K,e).catch(()=>null);if(!t)return!1;r=t.file,Le(e=>e.map(e=>e.id===K.id?{...e,fileTree:t.fileTree}:e)),W(e=>{let n=new Set(e);for(let e of t.expandedFolderIds)n.add(e);return n})}return st(r),_e(e=>{let t=e[K.id]??[];return t.includes(r.id)?e:{...e,[K.id]:[...t,r.id]}}),xe(e=>({...e,[K.id]:r.id})),de(`editor`),H({column:n,fileId:r.id,lineNumber:t,nonce:Date.now()}),!0},mt=e=>{let t=K?u_(K.fileTree,e):null;t?.type===`folder`&&!t.children&&lt(t),W(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ht=(e,t)=>{re(n=>({...n,[e]:t}))},gt=()=>{Ke&&(st(Ke),Sg(!0),de(`dialog`))},_t=async e=>{let t=e.content.trim();if(!t||!K)return;u(null);let n=null;try{let r=Vg(Ue,p,_);if(!r){u(`Connect a provider account before sending a message.`),Te(!0);return}let i=Ue??await Q.chats.create({accountId:r.id,collaborationMode:e.collaborationMode,model:e.model,permissionMode:e.permissionMode,providerId:r.providerId,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,title:Zg(t),workingDirectory:K.path});o(i.id),f(e=>Ug(e,i));let a=Sh(i.id,t,fe[i.id]??[]);n=i.id,pe(e=>({...e,[i.id]:qg(e[i.id]??[],a)}));let s=await Q.chats.execute(i.id,{accountId:r.id,attachments:e.attachments,collaborationMode:e.collaborationMode,content:t,delivery:e.delivery,goalObjective:e.goalObjective,metadata:{model:e.model,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier},permissionMode:e.permissionMode});pe(e=>({...e,[i.id]:[s.message,s.assistantMessage].filter(e=>!!e).reduce((e,t)=>qg(e,t),e[i.id]??[])}))}catch(e){if(u(Og(e)),n){let e=n;pe(n=>({...n,[e]:Jg(n[e]??[],{content:t,role:`USER`})}))}}},vt=async(e,t)=>{u(null);try{await Q.chats.deleteQueuedRun(e,t)}catch(e){u(Og(e))}},yt=async(e,t,n)=>{let r=window.prompt(`Edit queued message`,n);if(r===null)return;let i=r.trim();if(i){u(null);try{await Q.chats.updateQueuedRun(e,t,{content:i})}catch(e){u(Og(e))}}},bt=async(e,t)=>{u(null);try{await Q.chats.steerQueuedRun(e,t)}catch(e){u(Og(e))}},xt=async(e,t)=>{u(null);try{await Q.chats.reorderQueuedRuns(e,{runIds:t})}catch(e){u(Og(e))}},St=async()=>{if(!Ue)return;let e=Ue.id;u(null);try{let t=await Q.chats.interrupt(e);f(t=>t.map(t=>t.id===e?{...t,status:`IDLE`}:t)),pe(n=>({...n,[e]:(n[e]??[]).filter(e=>e.status!==`STREAMING`||(t.runId?e.runId!==t.runId:!1))})),await nt(e)}catch(e){u(Og(e))}},Ct=async e=>{if(!p.find(t=>t.id===e)){Te(!0);return}let t=Ue?.accountId??_;if(v(e),!(!Ue||Ue.accountId===e)){b(!0),u(null);try{let t=await Q.chats.update(Ue.id,{accountId:e});f(e=>Ug(e,t)),await nt(t.id)}catch(e){v(t??null),u(Og(e))}finally{b(!1)}}},wt=async(e,t)=>{u(null);try{let n=await Q.chats.update(e,{permissionMode:t});f(e=>Ug(e,n))}catch(e){throw u(Og(e)),e}},Tt=async(e,t)=>{u(null);try{let n=await Q.chats.update(e,t);f(e=>Ug(e,n))}catch(e){throw u(Og(e)),e}},Et=async e=>{u(null);try{await Q.chats.delete(e),f(t=>{let n=t.filter(t=>t.id!==e);return a===e&&o(n[0]?.id??null),n}),pe(t=>mg(t,e))}catch(e){u(Og(e))}},Dt=async e=>{u(null);try{let t=await Q.chats.compact(e);f(e=>Ug(e,t)),await nt(e)}catch(e){u(Og(e))}},Ot=async(e,t)=>{u(null);try{let n=await Q.chats.fork(e,t?{lastTurnId:t}:{});f(e=>Ug(e,n)),o(n.id),await nt(n.id)}catch(e){u(Og(e))}},kt=async e=>{u(null);try{let t=await Q.chats.refresh(e);f(e=>Ug(e,t.chat)),pe(n=>({...n,[e]:t.messages.data}))}catch(e){u(Og(e))}},At=async(e,t)=>{u(null);try{let n=await Q.chats.update(e,{title:t});f(e=>Ug(e,n))}catch(e){throw u(Og(e)),e}},jt=async(e,t)=>{u(null);try{let n=await Q.chats.review(e,t?.trim()?{target:`custom`,instructions:t.trim()}:{target:`uncommittedChanges`});f(e=>Ug(e,n)),await nt(e)}catch(e){u(Og(e))}},Mt=()=>{o(null),u(null),de(`chat`),he(null)},Nt=async()=>{if(!K)return;let e=Vg(Ue,p,_);if(!e){j(`Connect a provider account before creating a schedule.`),Te(!0);return}j(null);try{let t=await Q.schedules.create({accountId:e.id,collaborationMode:`default`,firstRunAt:new Date(Date.now()+3600*1e3).toISOString(),message:`Describe the scheduled task.`,permissionMode:`default`,recurrence:{frequency:`none`,interval:1},status:`PAUSED`,title:`New schedule`,workingDirectory:K.path});F(e=>LS(e,t)),D(t.id),L(`scheduler`),de(`schedule`),he(null),rt(t.id),tt(K.path,K.id,{silent:!0})}catch(e){j(Og(e))}},Pt=e=>{D(e),L(`scheduler`),Te(!1),De(!1),ke(!1),de(`schedule`),he(null)},Ft=async(e,t)=>{j(null);try{let n=await Q.schedules.update(e,t);return F(e=>LS(e,n)),n}catch(e){throw j(Og(e)),e}},It=async e=>{j(null);try{await Q.schedules.delete(e),F(t=>t.filter(t=>t.id!==e)),N(t=>mg(t,e)),E===e&&(D(null),de(`chat`))}catch(e){j(Og(e))}},Lt=async e=>{let t=e.chatId??We?.chatId;if(!t){j(`This schedule run is not linked to a chat yet.`);return}o(t),await nt(t),Rt()},Rt=()=>{Te(!1),De(!1),ke(!1),de(`chat`),he(null)};return{activeChat:Ue,activeChatId:a,activeMessages:Ye,activeMessagesLoaded:Xe,activePanelTab:r,activeSchedule:We,activeScheduleId:E,activeScheduleRuns:E?M[E]??[]:[],activeTerminalId:Qe.activeTerminalId,activeWorkspace:K,accountSwitchPhase:a?S[a]??null:null,archiveChat:Et,chatAccounts:p,chatError:l,chats:d,compactChat:Dt,closeTerminal:Qe.closeTerminal,closeFile:ft,closeWorkspace:ot,createSchedule:Nt,createTerminal:Qe.createTerminal,deleteSchedule:It,deleteQueuedMessage:vt,desktopGridColumns:Ze,editQueuedMessage:yt,editorRevealTarget:V,expandedFolderIds:U,filesWidth:ie,forkChat:Ot,instructionsDialogOpen:Ee,isChatsLoading:w,isFilesPanelOpen:oe,isSchedulesLoading:O,isSwitchingAccount:y,isTerminalPanelOpen:ce,isWorkspaceHistoryLoading:R,loadingFolderIds:te,mainMode:ue,mcpServersDialogOpen:Oe,messagesByChatId:fe,mobileDrawer:me,openChatFileLink:dt,openFiles:qe,openRecentWorkspace:at,openSelectedFileDialog:gt,openWorkspaceFilePath:pt,openWorkspaceFromFolder:it,pluginsDialogOpen:Ae,preferredAccountId:_,providerDefinitions:h,providersDialogOpen:we,recentWorkspaces:ee,refreshChat:kt,renameChat:At,reorderQueuedMessages:xt,reviewChat:jt,selectFile:ut,selectManagementView:e=>{Te(e===`providers`),De(e===`instructions`),ke(e===`mcpServers`),je(e===`plugins`),he(null)},selectSchedule:Pt,selectedFile:Ke,selectedFileContent:Je,selectedFileId:Ge,sendChatMessage:_t,setActiveChatId:o,setActivePanelTab:i,setActiveScheduleId:D,setActiveTerminalId:Qe.setActiveTerminalId,setActiveWorkspaceId:c,setFilesWidth:ae,setInstructionsDialogOpen:De,setIsFilesPanelOpen:se,setIsTerminalPanelOpen:le,setMainMode:de,setMcpServersDialogOpen:ke,setPluginsDialogOpen:je,setMobileDrawer:he,setProvidersDialogOpen:Te,setSidebarWidth:ye,setSidebarTab:L,setTerminalHeight:Ce,setWorkspaceBrowserOpen:Fe,sidebarWidth:ve,sidebarTab:I,startNewChat:Mt,steerQueuedMessage:bt,stopActiveChat:St,switchChatAccount:Ct,switchToChat:Rt,switchToEditor:()=>{Sg(!1),de(`editor`),he(null)},openScheduleRunChat:Lt,scheduleError:A,schedules:P,terminalConnectionState:Qe.connectionState,terminalError:Qe.error,terminalHeight:Se,terminalOutputByTerminalId:Qe.outputByTerminalId,terminals:Qe.terminals,toggleFolder:mt,updateChatPermissionMode:wt,updateChatRuntimeSettings:Tt,updateSchedule:Ft,updateProviderData:$e,updateFileContent:ht,resizeTerminal:Qe.resizeTerminal,writeTerminalInput:Qe.writeTerminalInput,workspaceBrowserOpen:Pe,workspaceLoadError:Me,workspaces:Ie}}function tw(){let e=QC();return(0,S.jsxs)(`div`,{className:`h-svh overflow-hidden bg-background text-foreground`,children:[(0,S.jsxs)(`main`,{className:`grid h-full overflow-hidden bg-background`,style:{gridTemplateRows:`40px minmax(0, 1fr)`},children:[(0,S.jsx)(PC,{activeWorkspaceId:e.activeWorkspace?.id??null,isFilesPanelOpen:e.isFilesPanelOpen,isTerminalPanelOpen:e.isTerminalPanelOpen,workspaces:e.workspaces,onAddWorkspace:()=>e.setWorkspaceBrowserOpen(!0),onCloseWorkspace:e.closeWorkspace,onOpenFilesDrawer:()=>e.setMobileDrawer(`files`),onOpenSessionsDrawer:()=>e.setMobileDrawer(`sessions`),onSelectWorkspace:e.setActiveWorkspaceId,onToggleFilesPanel:()=>e.setIsFilesPanelOpen(e=>!e),onToggleTerminalPanel:()=>e.setIsTerminalPanelOpen(e=>!e)}),(0,S.jsx)(nw,{})]}),(0,S.jsx)(lw,{}),(0,S.jsx)(uw,{})]})}function nw(){let e=QC();return e.activeWorkspace?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(rw,{}),(0,S.jsx)(iw,{})]}):(0,S.jsx)(dw,{error:e.workspaceLoadError,isLoading:e.isWorkspaceHistoryLoading,recentWorkspaces:e.recentWorkspaces,onOpenFolder:()=>e.setWorkspaceBrowserOpen(!0),onOpenRecent:e.openRecentWorkspace})}function rw(){let e=QC(),t=e.isFilesPanelOpen?4:3;return(0,S.jsxs)(`div`,{className:`hidden min-h-0 gap-2 overflow-hidden bg-background p-2 pt-0 md:grid`,style:{gridTemplateColumns:e.desktopGridColumns,gridTemplateRows:e.isTerminalPanelOpen?`minmax(0, 1fr) ${e.terminalHeight}px`:`minmax(0, 1fr)`},children:[(0,S.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,style:{gridColumn:`1`,gridRow:`1 / -1`},children:[(0,S.jsx)(aw,{}),(0,S.jsx)(fw,{edge:`right`,label:`chats panel`,onPointerDown:t=>xw(t,{max:440,min:220,side:`left`,startWidth:e.sidebarWidth,onResize:e.setSidebarWidth})})]}),(0,S.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden rounded-xl`,style:{gridColumn:`2`,gridRow:`1`},children:[(0,S.jsx)(ow,{onBackToChat:()=>e.setMainMode(`chat`)}),e.isFilesPanelOpen?(0,S.jsx)(fw,{edge:`right`,label:`files panel`,onPointerDown:t=>xw(t,{max:560,min:300,side:`right`,startWidth:e.filesWidth,onResize:e.setFilesWidth})}):null]}),e.isFilesPanelOpen?(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,style:{gridColumn:`3`,gridRow:`1`},children:(0,S.jsx)(sw,{treeId:`desktop-files`})}):null,e.isTerminalPanelOpen?(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,style:{gridColumn:`2 / ${t}`,gridRow:`2`},children:(0,S.jsx)(cw,{onResizeStart:t=>Sw(t,{startHeight:e.terminalHeight,onResize:e.setTerminalHeight})})}):null]})}function iw(){let e=QC();return(0,S.jsxs)(`div`,{className:Z(`grid h-full min-h-0 overflow-hidden bg-background md:hidden`,e.isTerminalPanelOpen&&`gap-2 p-2 pt-0`),style:{gridTemplateRows:e.isTerminalPanelOpen?`minmax(0, 1fr) clamp(160px, ${e.terminalHeight}px, 46dvh)`:`minmax(0, 1fr)`},children:[(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,S.jsx)(ow,{onBackToChat:e.switchToChat})}),e.isTerminalPanelOpen?(0,S.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,S.jsx)(cw,{onResizeStart:t=>Sw(t,{startHeight:e.terminalHeight,onResize:e.setTerminalHeight})})}):null]})}function aw(){let e=QC();return e.activeWorkspace?(0,S.jsx)(XS,{shell:e}):null}function ow({onBackToChat:e}){return QC().activeWorkspace?(0,S.jsx)(pw,{onBackToChat:e}):null}function sw({treeId:e}){let t=QC();return t.activeWorkspace?(0,S.jsx)(Fy,{activeTab:t.activePanelTab,expandedFolderIds:t.expandedFolderIds,loadingFolderIds:t.loadingFolderIds,selectedFileId:t.selectedFileId,treeId:e,workspace:t.activeWorkspace,onFileSelect:t.selectFile,onFolderToggle:t.toggleFolder,onTabChange:t.setActivePanelTab}):null}function cw({onResizeStart:e}){let t=QC();return t.activeWorkspace?(0,S.jsx)(HC,{activeTerminalId:t.activeTerminalId,connectionState:t.terminalConnectionState,error:t.terminalError,outputByTerminalId:t.terminalOutputByTerminalId,terminals:t.terminals,workspaceName:t.activeWorkspace.name,workspacePath:t.activeWorkspace.path,onActivateTerminal:t.setActiveTerminalId,onCloseTerminal:t.closeTerminal,onCreateTerminal:t.createTerminal,onHide:()=>t.setIsTerminalPanelOpen(!1),onInput:t.writeTerminalInput,onResize:t.resizeTerminal,onResizeStart:e}):null}function lw(){let e=QC();return e.activeWorkspace?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(LC,{side:`left`,title:`Chats`,open:e.mobileDrawer===`sessions`,onClose:()=>e.setMobileDrawer(null),children:(0,S.jsx)(aw,{})}),(0,S.jsx)(LC,{side:`right`,title:`Files`,open:e.mobileDrawer===`files`,onClose:()=>e.setMobileDrawer(null),children:(0,S.jsx)(sw,{treeId:`mobile-files`})})]}):null}function uw(){let e=QC(),t=e.selectedFile&&e.editorRevealTarget?.fileId===e.selectedFile.id?e.editorRevealTarget:null;return(0,S.jsxs)(S.Fragment,{children:[e.activeWorkspace&&e.selectedFile&&e.mainMode===`dialog`?(0,S.jsx)(Ax,{content:e.selectedFileContent,file:e.selectedFile,revealTarget:t,workspace:e.activeWorkspace,onClose:()=>e.setMainMode(`chat`),onContentChange:e.updateFileContent,onOpenInMain:()=>{Sg(!1),e.setMainMode(`editor`)}}):null,(0,S.jsx)(TS,{open:e.workspaceBrowserOpen,openWorkspacePaths:e.workspaces.map(e=>e.path),onClose:()=>e.setWorkspaceBrowserOpen(!1),onSelect:e.openWorkspaceFromFolder}),(0,S.jsx)(wS,{open:e.instructionsDialogOpen,onClose:()=>e.setInstructionsDialogOpen(!1)}),(0,S.jsx)(aS,{open:e.providersDialogOpen,onClose:()=>e.setProvidersDialogOpen(!1),onProviderDataChange:e.updateProviderData}),(0,S.jsx)(Ux,{open:e.mcpServersDialogOpen,onClose:()=>e.setMcpServersDialogOpen(!1)}),(0,S.jsx)(_S,{open:e.pluginsDialogOpen,onClose:()=>e.setPluginsDialogOpen(!1)})]})}function dw({error:e,isLoading:t,recentWorkspaces:n,onOpenFolder:r,onOpenRecent:i}){return t?(0,S.jsx)(`section`,{className:`grid min-h-0 place-items-center p-4`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,S.jsx)(eu,{className:`size-4 animate-spin text-info`}),`Loading workspace data`]})}):(0,S.jsx)(`section`,{className:`grid min-h-0 place-items-center p-4`,children:(0,S.jsxs)(`div`,{className:`grid w-full max-w-md gap-3 rounded-lg border border-border bg-card p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-semibold text-foreground`,children:[(0,S.jsx)(Jl,{className:`size-4 text-ide-folder`}),`Open a workspace`]}),e?(0,S.jsx)(`div`,{className:`text-[12px] text-destructive`,children:e}):null,(0,S.jsx)(`button`,{className:`h-8 rounded-md bg-primary px-3 text-[12px] font-semibold text-primary-foreground`,type:`button`,onClick:r,children:`Open Folder`}),n.length?(0,S.jsxs)(`div`,{className:`mt-1 border-t border-border pt-3`,children:[(0,S.jsx)(`div`,{className:`mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Recent`}),(0,S.jsx)(`div`,{className:`grid gap-1`,children:n.slice(0,8).map(e=>(0,S.jsxs)(`button`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-accent`,type:`button`,onClick:()=>i(e),children:[(0,S.jsx)(Yl,{className:`size-4 text-muted-foreground`}),(0,S.jsxs)(`span`,{className:`min-w-0`,children:[(0,S.jsx)(`span`,{className:`block truncate text-[13px] font-medium text-foreground`,children:e.name}),(0,S.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.path})]})]},e.id))})]}):null]})})}function fw({edge:e,label:t,onPointerDown:n}){return(0,S.jsx)(`button`,{"aria-label":`Resize ${t}`,className:Z(`absolute top-0 z-20 h-full w-2 cursor-col-resize bg-transparent outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent hover:after:bg-accent focus-visible:after:bg-primary`,e===`right`&&`right-[-4px]`),type:`button`,onPointerDown:n})}function pw({onBackToChat:e}){let t=QC(),n=t.activeWorkspace,r=t.selectedFile;return n?t.mainMode===`editor`&&r?(0,S.jsx)(kx,{content:t.selectedFileContent,file:r,openFiles:t.openFiles,revealTarget:t.editorRevealTarget?.fileId===r.id?t.editorRevealTarget:null,workspace:n,onFileClose:t.closeFile,onContentChange:t.updateFileContent,onFileSelect:t.selectFile,onOpenDialog:t.openSelectedFileDialog,onToggleMode:e}):t.mainMode===`schedule`?(0,S.jsx)($S,{shell:t}):(0,S.jsx)(cy,{accounts:t.chatAccounts,chat:t.activeChat,error:t.chatError,isLoading:t.isChatsLoading,isMessagesLoading:!!(t.activeChat&&!t.activeMessagesLoaded),isSwitchingAccount:t.isSwitchingAccount,accountSwitchPhase:t.accountSwitchPhase,messages:t.activeMessages,preferredAccountId:t.preferredAccountId,providerDefinitions:t.providerDefinitions,workspace:n,onArchiveChat:t.archiveChat,onCompactChat:t.compactChat,onDeleteQueuedMessage:t.deleteQueuedMessage,onEditQueuedMessage:t.editQueuedMessage,onFileLinkOpen:t.openChatFileLink,onForkChat:t.forkChat,onNewChat:t.startNewChat,onOpenMcpServers:()=>t.setMcpServersDialogOpen(!0),onOpenProviders:()=>t.setProvidersDialogOpen(!0),onOpenPlugins:()=>t.setPluginsDialogOpen(!0),onRefreshChat:t.refreshChat,onRenameChat:t.renameChat,onReviewChat:t.reviewChat,onToggleMode:t.switchToEditor,onReorderQueuedMessages:t.reorderQueuedMessages,onPermissionModeChange:t.updateChatPermissionMode,onRuntimeSettingsChange:t.updateChatRuntimeSettings,onSendMessage:t.sendChatMessage,onSteerQueuedMessage:t.steerQueuedMessage,onSwitchAccount:t.switchChatAccount,onStopChat:t.stopActiveChat}):null}function mw(e,t){for(let n of e){if(n.type===`file`&&n.path&&yg(n.path,t))return n;let e=n.children?mw(n.children,t):null;if(e)return e}return null}async function hw(e,t){let n=vw(e.path,t);if(!n?.length)return null;let r=_w(e.fileTree),i=r[0],a=[];for(let e of n.slice(0,-1)){if(!i||i.type!==`folder`||!i.path)return null;a.push(i.id),i.children||=await gw(i);let t=i.children.find(t=>t.type===`folder`&&t.name===e);if(!t)return null;i=t}if(!i||i.type!==`folder`||!i.path)return null;a.push(i.id),i.children||=await gw(i);let o=n.at(-1),s=i.children.find(e=>e.type===`file`&&e.name===o);return s?{expandedFolderIds:a,file:s,fileTree:r}:null}async function gw(e){return e.path?((await Q.workspaces.readTree(e.path)).children??[]).map((t,n)=>n_(t,`${e.id}/${n}-${t_(t.name)}`)):[]}function _w(e){return e.map(e=>({...e,children:e.children?_w(e.children):void 0}))}function vw(e,t){let n=bw(yw(e)),r=bw(yw(t));return r===n||!r.startsWith(`${n}/`)?null:r.slice(n.length+1).split(`/`).filter(Boolean)}function yw(e){return e.replace(/\\/g,`/`).replace(/\/+/g,`/`)}function bw(e){return e===`/`?e:e.replace(/\/+$/u,``)}function xw(e,t){qC(e,{initialWidth:t.startWidth,max:t.max,min:t.min,onResize:t.onResize,origin:t.side})}function Sw(e,t){JC(e,{initialHeight:t.startHeight,max:typeof window>`u`?560:Math.min(560,Math.max(160,window.innerHeight-180)),min:160,onResize:t.onResize,origin:`top`})}function Cw(){return(0,S.jsx)(xl,{children:(0,S.jsx)($C,{})})}(0,b.createRoot)(document.getElementById(`root`)).render((0,S.jsx)(x.StrictMode,{children:(0,S.jsx)(Cw,{})}));