@khanglvm/llm-router 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- (()=>{var SR=Object.create;var Oh=Object.defineProperty;var wR=Object.getOwnPropertyDescriptor;var AR=Object.getOwnPropertyNames;var CR=Object.getPrototypeOf,RR=Object.prototype.hasOwnProperty;var wr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ER=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of AR(t))!RR.call(e,a)&&a!==n&&Oh(e,a,{get:()=>t[a],enumerable:!(r=wR(t,a))||r.enumerable});return e};var K=(e,t,n)=>(n=e!=null?SR(CR(e)):{},ER(t||!e||!e.__esModule?Oh(n,"default",{value:e,enumerable:!0}):n,e));var Ph=wr(vt=>{"use strict";function Xd(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<Ws(a,t))e[r]=t,e[n]=a,n=r;else break e}}function Ar(e){return e.length===0?null:e[0]}function Xs(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length,o=a>>>1;r<o;){var i=2*(r+1)-1,s=e[i],c=i+1,u=e[c];if(0>Ws(s,n))c<a&&0>Ws(u,s)?(e[r]=u,e[c]=n,r=c):(e[r]=s,e[i]=n,r=i);else if(c<a&&0>Ws(u,n))e[r]=u,e[c]=n,r=c;else break e}}return t}function Ws(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}vt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(_h=performance,vt.unstable_now=function(){return _h.now()}):(Yd=Date,kh=Yd.now(),vt.unstable_now=function(){return Yd.now()-kh});var _h,Yd,kh,Fr=[],Ca=[],TR=1,Pn=null,tn=3,Zd=!1,bl=!1,xl=!1,Jd=!1,zh=typeof setTimeout=="function"?setTimeout:null,Bh=typeof clearTimeout=="function"?clearTimeout:null,Lh=typeof setImmediate<"u"?setImmediate:null;function Qs(e){for(var t=Ar(Ca);t!==null;){if(t.callback===null)Xs(Ca);else if(t.startTime<=e)Xs(Ca),t.sortIndex=t.expirationTime,Xd(Fr,t);else break;t=Ar(Ca)}}function ef(e){if(xl=!1,Qs(e),!bl)if(Ar(Fr)!==null)bl=!0,ci||(ci=!0,si());else{var t=Ar(Ca);t!==null&&tf(ef,t.startTime-e)}}var ci=!1,Sl=-1,Ih=5,Uh=-1;function jh(){return Jd?!0:!(vt.unstable_now()-Uh<Ih)}function Wd(){if(Jd=!1,ci){var e=vt.unstable_now();Uh=e;var t=!0;try{e:{bl=!1,xl&&(xl=!1,Bh(Sl),Sl=-1),Zd=!0;var n=tn;try{t:{for(Qs(e),Pn=Ar(Fr);Pn!==null&&!(Pn.expirationTime>e&&jh());){var r=Pn.callback;if(typeof r=="function"){Pn.callback=null,tn=Pn.priorityLevel;var a=r(Pn.expirationTime<=e);if(e=vt.unstable_now(),typeof a=="function"){Pn.callback=a,Qs(e),t=!0;break t}Pn===Ar(Fr)&&Xs(Fr),Qs(e)}else Xs(Fr);Pn=Ar(Fr)}if(Pn!==null)t=!0;else{var o=Ar(Ca);o!==null&&tf(ef,o.startTime-e),t=!1}}break e}finally{Pn=null,tn=n,Zd=!1}t=void 0}}finally{t?si():ci=!1}}}var si;typeof Lh=="function"?si=function(){Lh(Wd)}:typeof MessageChannel<"u"?(Qd=new MessageChannel,Dh=Qd.port2,Qd.port1.onmessage=Wd,si=function(){Dh.postMessage(null)}):si=function(){zh(Wd,0)};var Qd,Dh;function tf(e,t){Sl=zh(function(){e(vt.unstable_now())},t)}vt.unstable_IdlePriority=5;vt.unstable_ImmediatePriority=1;vt.unstable_LowPriority=4;vt.unstable_NormalPriority=3;vt.unstable_Profiling=null;vt.unstable_UserBlockingPriority=2;vt.unstable_cancelCallback=function(e){e.callback=null};vt.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"):Ih=0<e?Math.floor(1e3/e):5};vt.unstable_getCurrentPriorityLevel=function(){return tn};vt.unstable_next=function(e){switch(tn){case 1:case 2:case 3:var t=3;break;default:t=tn}var n=tn;tn=t;try{return e()}finally{tn=n}};vt.unstable_requestPaint=function(){Jd=!0};vt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=tn;tn=e;try{return t()}finally{tn=n}};vt.unstable_scheduleCallback=function(e,t,n){var r=vt.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=n+a,e={id:TR++,callback:t,priorityLevel:e,startTime:n,expirationTime:a,sortIndex:-1},n>r?(e.sortIndex=n,Xd(Ca,e),Ar(Fr)===null&&e===Ar(Ca)&&(xl?(Bh(Sl),Sl=-1):xl=!0,tf(ef,n-r))):(e.sortIndex=a,Xd(Fr,e),bl||Zd||(bl=!0,ci||(ci=!0,si()))),e};vt.unstable_shouldYield=jh;vt.unstable_wrapCallback=function(e){var t=tn;return function(){var n=tn;tn=t;try{return e.apply(this,arguments)}finally{tn=n}}}});var Hh=wr((CL,Vh)=>{"use strict";Vh.exports=Ph()});var Jh=wr(Ae=>{"use strict";var af=Symbol.for("react.transitional.element"),NR=Symbol.for("react.portal"),MR=Symbol.for("react.fragment"),OR=Symbol.for("react.strict_mode"),_R=Symbol.for("react.profiler"),kR=Symbol.for("react.consumer"),LR=Symbol.for("react.context"),DR=Symbol.for("react.forward_ref"),zR=Symbol.for("react.suspense"),BR=Symbol.for("react.memo"),Gh=Symbol.for("react.lazy"),IR=Symbol.for("react.activity"),qh=Symbol.iterator;function UR(e){return e===null||typeof e!="object"?null:(e=qh&&e[qh]||e["@@iterator"],typeof e=="function"?e:null)}var Yh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wh=Object.assign,Qh={};function di(e,t,n){this.props=e,this.context=t,this.refs=Qh,this.updater=n||Yh}di.prototype.isReactComponent={};di.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")};di.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Xh(){}Xh.prototype=di.prototype;function of(e,t,n){this.props=e,this.context=t,this.refs=Qh,this.updater=n||Yh}var lf=of.prototype=new Xh;lf.constructor=of;Wh(lf,di.prototype);lf.isPureReactComponent=!0;var $h=Array.isArray;function rf(){}var ut={H:null,A:null,T:null,S:null},Zh=Object.prototype.hasOwnProperty;function sf(e,t,n){var r=n.ref;return{$$typeof:af,type:e,key:t,ref:r!==void 0?r:null,props:n}}function jR(e,t){return sf(e.type,t,e.props)}function cf(e){return typeof e=="object"&&e!==null&&e.$$typeof===af}function PR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Kh=/\/+/g;function nf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?PR(""+e.key):t.toString(36)}function VR(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(rf,rf):(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 ui(e,t,n,r,a){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case af:case NR:i=!0;break;case Gh:return i=e._init,ui(i(e._payload),t,n,r,a)}}if(i)return a=a(e),i=r===""?"."+nf(e,0):r,$h(a)?(n="",i!=null&&(n=i.replace(Kh,"$&/")+"/"),ui(a,t,n,"",function(u){return u})):a!=null&&(cf(a)&&(a=jR(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(Kh,"$&/")+"/")+i)),t.push(a)),1;i=0;var s=r===""?".":r+":";if($h(e))for(var c=0;c<e.length;c++)r=e[c],o=s+nf(r,c),i+=ui(r,t,n,o,a);else if(c=UR(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,o=s+nf(r,c++),i+=ui(r,t,n,o,a);else if(o==="object"){if(typeof e.then=="function")return ui(VR(e),t,n,r,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function Zs(e,t,n){if(e==null)return e;var r=[],a=0;return ui(e,r,"","",function(o){return t.call(n,o,a++)}),r}function HR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Fh=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!==null&&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)},qR={map:Zs,forEach:function(e,t,n){Zs(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Zs(e,function(){t++}),t},toArray:function(e){return Zs(e,function(t){return t})||[]},only:function(e){if(!cf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Activity=IR;Ae.Children=qR;Ae.Component=di;Ae.Fragment=MR;Ae.Profiler=_R;Ae.PureComponent=of;Ae.StrictMode=OR;Ae.Suspense=zR;Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ut;Ae.__COMPILER_RUNTIME={__proto__:null,c:function(e){return ut.H.useMemoCache(e)}};Ae.cache=function(e){return function(){return e.apply(null,arguments)}};Ae.cacheSignal=function(){return null};Ae.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=Wh({},e.props),a=e.key;if(t!=null)for(o in t.key!==void 0&&(a=""+t.key),t)!Zh.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(r[o]=t[o]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var i=Array(o),s=0;s<o;s++)i[s]=arguments[s+2];r.children=i}return sf(e.type,a,r)};Ae.createContext=function(e){return e={$$typeof:LR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:kR,_context:e},e};Ae.createElement=function(e,t,n){var r,a={},o=null;if(t!=null)for(r in t.key!==void 0&&(o=""+t.key),t)Zh.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(a[r]=t[r]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var s=Array(i),c=0;c<i;c++)s[c]=arguments[c+2];a.children=s}if(e&&e.defaultProps)for(r in i=e.defaultProps,i)a[r]===void 0&&(a[r]=i[r]);return sf(e,o,a)};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:DR,render:e}};Ae.isValidElement=cf;Ae.lazy=function(e){return{$$typeof:Gh,_payload:{_status:-1,_result:e},_init:HR}};Ae.memo=function(e,t){return{$$typeof:BR,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=ut.T,n={};ut.T=n;try{var r=e(),a=ut.S;a!==null&&a(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(rf,Fh)}catch(o){Fh(o)}finally{t!==null&&n.types!==null&&(t.types=n.types),ut.T=t}};Ae.unstable_useCacheRefresh=function(){return ut.H.useCacheRefresh()};Ae.use=function(e){return ut.H.use(e)};Ae.useActionState=function(e,t,n){return ut.H.useActionState(e,t,n)};Ae.useCallback=function(e,t){return ut.H.useCallback(e,t)};Ae.useContext=function(e){return ut.H.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e,t){return ut.H.useDeferredValue(e,t)};Ae.useEffect=function(e,t){return ut.H.useEffect(e,t)};Ae.useEffectEvent=function(e){return ut.H.useEffectEvent(e)};Ae.useId=function(){return ut.H.useId()};Ae.useImperativeHandle=function(e,t,n){return ut.H.useImperativeHandle(e,t,n)};Ae.useInsertionEffect=function(e,t){return ut.H.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return ut.H.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return ut.H.useMemo(e,t)};Ae.useOptimistic=function(e,t){return ut.H.useOptimistic(e,t)};Ae.useReducer=function(e,t,n){return ut.H.useReducer(e,t,n)};Ae.useRef=function(e){return ut.H.useRef(e)};Ae.useState=function(e){return ut.H.useState(e)};Ae.useSyncExternalStore=function(e,t,n){return ut.H.useSyncExternalStore(e,t,n)};Ae.useTransition=function(){return ut.H.useTransition()};Ae.version="19.2.4"});var xe=wr((EL,ey)=>{"use strict";ey.exports=Jh()});var ny=wr(an=>{"use strict";var $R=xe();function ty(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 Ra(){}var rn={d:{f:Ra,r:function(){throw Error(ty(522))},D:Ra,C:Ra,L:Ra,m:Ra,X:Ra,S:Ra,M:Ra},p:0,findDOMNode:null},KR=Symbol.for("react.portal");function FR(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:KR,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var wl=$R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Js(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}an.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=rn;an.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(ty(299));return FR(e,t,null,n)};an.flushSync=function(e){var t=wl.T,n=rn.p;try{if(wl.T=null,rn.p=2,e)return e()}finally{wl.T=t,rn.p=n,rn.d.f()}};an.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,rn.d.C(e,t))};an.prefetchDNS=function(e){typeof e=="string"&&rn.d.D(e)};an.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=Js(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,o=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?rn.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n==="script"&&rn.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};an.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Js(t.as,t.crossOrigin);rn.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==null&&rn.d.M(e)};an.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=Js(n,t.crossOrigin);rn.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})}};an.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Js(t.as,t.crossOrigin);rn.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 rn.d.m(e)};an.requestFormReset=function(e){rn.d.r(e)};an.unstable_batchedUpdates=function(e,t){return e(t)};an.useFormState=function(e,t,n){return wl.H.useFormState(e,t,n)};an.useFormStatus=function(){return wl.H.useHostTransitionStatus()};an.version="19.2.4"});var ho=wr((NL,ay)=>{"use strict";function ry(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ry)}catch(e){console.error(e)}}ry(),ay.exports=ny()});var hx=wr(Cu=>{"use strict";var Ut=Hh(),Ov=xe(),GR=ho();function L(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 _v(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ss(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function kv(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 Lv(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 oy(e){if(ss(e)!==e)throw Error(L(188))}function YR(e){var t=e.alternate;if(!t){if(t=ss(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return oy(a),e;if(o===r)return oy(a),t;o=o.sibling}throw Error(L(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function Dv(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Dv(e),t!==null)return t;e=e.sibling}return null}var mt=Object.assign,WR=Symbol.for("react.element"),ec=Symbol.for("react.transitional.element"),Ol=Symbol.for("react.portal"),yi=Symbol.for("react.fragment"),zv=Symbol.for("react.strict_mode"),qf=Symbol.for("react.profiler"),Bv=Symbol.for("react.consumer"),ea=Symbol.for("react.context"),Um=Symbol.for("react.forward_ref"),$f=Symbol.for("react.suspense"),Kf=Symbol.for("react.suspense_list"),jm=Symbol.for("react.memo"),Ea=Symbol.for("react.lazy"),Ff=Symbol.for("react.activity"),QR=Symbol.for("react.memo_cache_sentinel"),iy=Symbol.iterator;function Al(e){return e===null||typeof e!="object"?null:(e=iy&&e[iy]||e["@@iterator"],typeof e=="function"?e:null)}var XR=Symbol.for("react.client.reference");function Gf(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===XR?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yi:return"Fragment";case qf:return"Profiler";case zv:return"StrictMode";case $f:return"Suspense";case Kf:return"SuspenseList";case Ff:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Ol:return"Portal";case ea:return e.displayName||"Context";case Bv:return(e._context.displayName||"Context")+".Consumer";case Um:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case jm:return t=e.displayName||null,t!==null?t:Gf(e.type)||"Memo";case Ea:t=e._payload,e=e._init;try{return Gf(e(t))}catch{}}return null}var _l=Array.isArray,ve=Ov.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Fe=GR.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,wo={pending:!1,data:null,method:null,action:null},Yf=[],vi=-1;function Nr(e){return{current:e}}function Kt(e){0>vi||(e.current=Yf[vi],Yf[vi]=null,vi--)}function lt(e,t){vi++,Yf[vi]=e.current,e.current=t}var Tr=Nr(null),Yl=Nr(null),Ia=Nr(null),Lc=Nr(null);function Dc(e,t){switch(lt(Ia,t),lt(Yl,e),lt(Tr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?mv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=mv(t),e=nx(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Kt(Tr),lt(Tr,e)}function Bi(){Kt(Tr),Kt(Yl),Kt(Ia)}function Wf(e){e.memoizedState!==null&&lt(Lc,e);var t=Tr.current,n=nx(t,e.type);t!==n&&(lt(Yl,e),lt(Tr,n))}function zc(e){Yl.current===e&&(Kt(Tr),Kt(Yl)),Lc.current===e&&(Kt(Lc),os._currentValue=wo)}var uf,ly;function vo(e){if(uf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);uf=t&&t[1]||"",ly=-1<n.stack.indexOf(`
1
+ (()=>{var wR=Object.create;var _h=Object.defineProperty;var AR=Object.getOwnPropertyDescriptor;var CR=Object.getOwnPropertyNames;var RR=Object.getPrototypeOf,ER=Object.prototype.hasOwnProperty;var wr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var NR=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of CR(t))!ER.call(e,a)&&a!==n&&_h(e,a,{get:()=>t[a],enumerable:!(r=AR(t,a))||r.enumerable});return e};var K=(e,t,n)=>(n=e!=null?wR(RR(e)):{},NR(t||!e||!e.__esModule?_h(n,"default",{value:e,enumerable:!0}):n,e));var Vh=wr(vt=>{"use strict";function Xd(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<Qs(a,t))e[r]=t,e[n]=a,n=r;else break e}}function Ar(e){return e.length===0?null:e[0]}function Zs(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length,o=a>>>1;r<o;){var i=2*(r+1)-1,s=e[i],c=i+1,u=e[c];if(0>Qs(s,n))c<a&&0>Qs(u,s)?(e[r]=u,e[c]=n,r=c):(e[r]=s,e[i]=n,r=i);else if(c<a&&0>Qs(u,n))e[r]=u,e[c]=n,r=c;else break e}}return t}function Qs(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}vt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(kh=performance,vt.unstable_now=function(){return kh.now()}):(Yd=Date,Lh=Yd.now(),vt.unstable_now=function(){return Yd.now()-Lh});var kh,Yd,Lh,Fr=[],Ca=[],TR=1,Pn=null,tn=3,Zd=!1,xl=!1,Sl=!1,Jd=!1,Bh=typeof setTimeout=="function"?setTimeout:null,Ih=typeof clearTimeout=="function"?clearTimeout:null,Dh=typeof setImmediate<"u"?setImmediate:null;function Xs(e){for(var t=Ar(Ca);t!==null;){if(t.callback===null)Zs(Ca);else if(t.startTime<=e)Zs(Ca),t.sortIndex=t.expirationTime,Xd(Fr,t);else break;t=Ar(Ca)}}function ef(e){if(Sl=!1,Xs(e),!xl)if(Ar(Fr)!==null)xl=!0,ci||(ci=!0,si());else{var t=Ar(Ca);t!==null&&tf(ef,t.startTime-e)}}var ci=!1,wl=-1,Uh=5,jh=-1;function Ph(){return Jd?!0:!(vt.unstable_now()-jh<Uh)}function Wd(){if(Jd=!1,ci){var e=vt.unstable_now();jh=e;var t=!0;try{e:{xl=!1,Sl&&(Sl=!1,Ih(wl),wl=-1),Zd=!0;var n=tn;try{t:{for(Xs(e),Pn=Ar(Fr);Pn!==null&&!(Pn.expirationTime>e&&Ph());){var r=Pn.callback;if(typeof r=="function"){Pn.callback=null,tn=Pn.priorityLevel;var a=r(Pn.expirationTime<=e);if(e=vt.unstable_now(),typeof a=="function"){Pn.callback=a,Xs(e),t=!0;break t}Pn===Ar(Fr)&&Zs(Fr),Xs(e)}else Zs(Fr);Pn=Ar(Fr)}if(Pn!==null)t=!0;else{var o=Ar(Ca);o!==null&&tf(ef,o.startTime-e),t=!1}}break e}finally{Pn=null,tn=n,Zd=!1}t=void 0}}finally{t?si():ci=!1}}}var si;typeof Dh=="function"?si=function(){Dh(Wd)}:typeof MessageChannel<"u"?(Qd=new MessageChannel,zh=Qd.port2,Qd.port1.onmessage=Wd,si=function(){zh.postMessage(null)}):si=function(){Bh(Wd,0)};var Qd,zh;function tf(e,t){wl=Bh(function(){e(vt.unstable_now())},t)}vt.unstable_IdlePriority=5;vt.unstable_ImmediatePriority=1;vt.unstable_LowPriority=4;vt.unstable_NormalPriority=3;vt.unstable_Profiling=null;vt.unstable_UserBlockingPriority=2;vt.unstable_cancelCallback=function(e){e.callback=null};vt.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"):Uh=0<e?Math.floor(1e3/e):5};vt.unstable_getCurrentPriorityLevel=function(){return tn};vt.unstable_next=function(e){switch(tn){case 1:case 2:case 3:var t=3;break;default:t=tn}var n=tn;tn=t;try{return e()}finally{tn=n}};vt.unstable_requestPaint=function(){Jd=!0};vt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=tn;tn=e;try{return t()}finally{tn=n}};vt.unstable_scheduleCallback=function(e,t,n){var r=vt.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=n+a,e={id:TR++,callback:t,priorityLevel:e,startTime:n,expirationTime:a,sortIndex:-1},n>r?(e.sortIndex=n,Xd(Ca,e),Ar(Fr)===null&&e===Ar(Ca)&&(Sl?(Ih(wl),wl=-1):Sl=!0,tf(ef,n-r))):(e.sortIndex=a,Xd(Fr,e),xl||Zd||(xl=!0,ci||(ci=!0,si()))),e};vt.unstable_shouldYield=Ph;vt.unstable_wrapCallback=function(e){var t=tn;return function(){var n=tn;tn=t;try{return e.apply(this,arguments)}finally{tn=n}}}});var qh=wr((NL,Hh)=>{"use strict";Hh.exports=Vh()});var ey=wr(Ae=>{"use strict";var af=Symbol.for("react.transitional.element"),MR=Symbol.for("react.portal"),OR=Symbol.for("react.fragment"),_R=Symbol.for("react.strict_mode"),kR=Symbol.for("react.profiler"),LR=Symbol.for("react.consumer"),DR=Symbol.for("react.context"),zR=Symbol.for("react.forward_ref"),BR=Symbol.for("react.suspense"),IR=Symbol.for("react.memo"),Yh=Symbol.for("react.lazy"),UR=Symbol.for("react.activity"),$h=Symbol.iterator;function jR(e){return e===null||typeof e!="object"?null:(e=$h&&e[$h]||e["@@iterator"],typeof e=="function"?e:null)}var Wh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Qh=Object.assign,Xh={};function di(e,t,n){this.props=e,this.context=t,this.refs=Xh,this.updater=n||Wh}di.prototype.isReactComponent={};di.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")};di.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Zh(){}Zh.prototype=di.prototype;function of(e,t,n){this.props=e,this.context=t,this.refs=Xh,this.updater=n||Wh}var lf=of.prototype=new Zh;lf.constructor=of;Qh(lf,di.prototype);lf.isPureReactComponent=!0;var Kh=Array.isArray;function rf(){}var ut={H:null,A:null,T:null,S:null},Jh=Object.prototype.hasOwnProperty;function sf(e,t,n){var r=n.ref;return{$$typeof:af,type:e,key:t,ref:r!==void 0?r:null,props:n}}function PR(e,t){return sf(e.type,t,e.props)}function cf(e){return typeof e=="object"&&e!==null&&e.$$typeof===af}function VR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Fh=/\/+/g;function nf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?VR(""+e.key):t.toString(36)}function HR(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(rf,rf):(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 ui(e,t,n,r,a){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case af:case MR:i=!0;break;case Yh:return i=e._init,ui(i(e._payload),t,n,r,a)}}if(i)return a=a(e),i=r===""?"."+nf(e,0):r,Kh(a)?(n="",i!=null&&(n=i.replace(Fh,"$&/")+"/"),ui(a,t,n,"",function(u){return u})):a!=null&&(cf(a)&&(a=PR(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(Fh,"$&/")+"/")+i)),t.push(a)),1;i=0;var s=r===""?".":r+":";if(Kh(e))for(var c=0;c<e.length;c++)r=e[c],o=s+nf(r,c),i+=ui(r,t,n,o,a);else if(c=jR(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,o=s+nf(r,c++),i+=ui(r,t,n,o,a);else if(o==="object"){if(typeof e.then=="function")return ui(HR(e),t,n,r,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function Js(e,t,n){if(e==null)return e;var r=[],a=0;return ui(e,r,"","",function(o){return t.call(n,o,a++)}),r}function qR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Gh=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!==null&&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)},$R={map:Js,forEach:function(e,t,n){Js(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Js(e,function(){t++}),t},toArray:function(e){return Js(e,function(t){return t})||[]},only:function(e){if(!cf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Activity=UR;Ae.Children=$R;Ae.Component=di;Ae.Fragment=OR;Ae.Profiler=kR;Ae.PureComponent=of;Ae.StrictMode=_R;Ae.Suspense=BR;Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ut;Ae.__COMPILER_RUNTIME={__proto__:null,c:function(e){return ut.H.useMemoCache(e)}};Ae.cache=function(e){return function(){return e.apply(null,arguments)}};Ae.cacheSignal=function(){return null};Ae.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=Qh({},e.props),a=e.key;if(t!=null)for(o in t.key!==void 0&&(a=""+t.key),t)!Jh.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(r[o]=t[o]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var i=Array(o),s=0;s<o;s++)i[s]=arguments[s+2];r.children=i}return sf(e.type,a,r)};Ae.createContext=function(e){return e={$$typeof:DR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:LR,_context:e},e};Ae.createElement=function(e,t,n){var r,a={},o=null;if(t!=null)for(r in t.key!==void 0&&(o=""+t.key),t)Jh.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(a[r]=t[r]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var s=Array(i),c=0;c<i;c++)s[c]=arguments[c+2];a.children=s}if(e&&e.defaultProps)for(r in i=e.defaultProps,i)a[r]===void 0&&(a[r]=i[r]);return sf(e,o,a)};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:zR,render:e}};Ae.isValidElement=cf;Ae.lazy=function(e){return{$$typeof:Yh,_payload:{_status:-1,_result:e},_init:qR}};Ae.memo=function(e,t){return{$$typeof:IR,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=ut.T,n={};ut.T=n;try{var r=e(),a=ut.S;a!==null&&a(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(rf,Gh)}catch(o){Gh(o)}finally{t!==null&&n.types!==null&&(t.types=n.types),ut.T=t}};Ae.unstable_useCacheRefresh=function(){return ut.H.useCacheRefresh()};Ae.use=function(e){return ut.H.use(e)};Ae.useActionState=function(e,t,n){return ut.H.useActionState(e,t,n)};Ae.useCallback=function(e,t){return ut.H.useCallback(e,t)};Ae.useContext=function(e){return ut.H.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e,t){return ut.H.useDeferredValue(e,t)};Ae.useEffect=function(e,t){return ut.H.useEffect(e,t)};Ae.useEffectEvent=function(e){return ut.H.useEffectEvent(e)};Ae.useId=function(){return ut.H.useId()};Ae.useImperativeHandle=function(e,t,n){return ut.H.useImperativeHandle(e,t,n)};Ae.useInsertionEffect=function(e,t){return ut.H.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return ut.H.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return ut.H.useMemo(e,t)};Ae.useOptimistic=function(e,t){return ut.H.useOptimistic(e,t)};Ae.useReducer=function(e,t,n){return ut.H.useReducer(e,t,n)};Ae.useRef=function(e){return ut.H.useRef(e)};Ae.useState=function(e){return ut.H.useState(e)};Ae.useSyncExternalStore=function(e,t,n){return ut.H.useSyncExternalStore(e,t,n)};Ae.useTransition=function(){return ut.H.useTransition()};Ae.version="19.2.4"});var xe=wr((ML,ty)=>{"use strict";ty.exports=ey()});var ry=wr(an=>{"use strict";var KR=xe();function ny(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 Ra(){}var rn={d:{f:Ra,r:function(){throw Error(ny(522))},D:Ra,C:Ra,L:Ra,m:Ra,X:Ra,S:Ra,M:Ra},p:0,findDOMNode:null},FR=Symbol.for("react.portal");function GR(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:FR,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Al=KR.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function ec(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}an.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=rn;an.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(ny(299));return GR(e,t,null,n)};an.flushSync=function(e){var t=Al.T,n=rn.p;try{if(Al.T=null,rn.p=2,e)return e()}finally{Al.T=t,rn.p=n,rn.d.f()}};an.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,rn.d.C(e,t))};an.prefetchDNS=function(e){typeof e=="string"&&rn.d.D(e)};an.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=ec(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,o=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?rn.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n==="script"&&rn.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};an.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=ec(t.as,t.crossOrigin);rn.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==null&&rn.d.M(e)};an.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=ec(n,t.crossOrigin);rn.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})}};an.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=ec(t.as,t.crossOrigin);rn.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 rn.d.m(e)};an.requestFormReset=function(e){rn.d.r(e)};an.unstable_batchedUpdates=function(e,t){return e(t)};an.useFormState=function(e,t,n){return Al.H.useFormState(e,t,n)};an.useFormStatus=function(){return Al.H.useHostTransitionStatus()};an.version="19.2.4"});var ho=wr((_L,oy)=>{"use strict";function ay(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ay)}catch(e){console.error(e)}}ay(),oy.exports=ry()});var yx=wr(Ru=>{"use strict";var It=qh(),_v=xe(),YR=ho();function L(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 kv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function cs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Lv(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 Dv(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 iy(e){if(cs(e)!==e)throw Error(L(188))}function WR(e){var t=e.alternate;if(!t){if(t=cs(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return iy(a),e;if(o===r)return iy(a),t;o=o.sibling}throw Error(L(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function zv(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=zv(e),t!==null)return t;e=e.sibling}return null}var mt=Object.assign,QR=Symbol.for("react.element"),tc=Symbol.for("react.transitional.element"),_l=Symbol.for("react.portal"),yi=Symbol.for("react.fragment"),Bv=Symbol.for("react.strict_mode"),qf=Symbol.for("react.profiler"),Iv=Symbol.for("react.consumer"),ea=Symbol.for("react.context"),Um=Symbol.for("react.forward_ref"),$f=Symbol.for("react.suspense"),Kf=Symbol.for("react.suspense_list"),jm=Symbol.for("react.memo"),Ea=Symbol.for("react.lazy"),Ff=Symbol.for("react.activity"),XR=Symbol.for("react.memo_cache_sentinel"),ly=Symbol.iterator;function Cl(e){return e===null||typeof e!="object"?null:(e=ly&&e[ly]||e["@@iterator"],typeof e=="function"?e:null)}var ZR=Symbol.for("react.client.reference");function Gf(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ZR?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yi:return"Fragment";case qf:return"Profiler";case Bv:return"StrictMode";case $f:return"Suspense";case Kf:return"SuspenseList";case Ff:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _l:return"Portal";case ea:return e.displayName||"Context";case Iv:return(e._context.displayName||"Context")+".Consumer";case Um:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case jm:return t=e.displayName||null,t!==null?t:Gf(e.type)||"Memo";case Ea:t=e._payload,e=e._init;try{return Gf(e(t))}catch{}}return null}var kl=Array.isArray,ve=_v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Fe=YR.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,wo={pending:!1,data:null,method:null,action:null},Yf=[],vi=-1;function Tr(e){return{current:e}}function $t(e){0>vi||(e.current=Yf[vi],Yf[vi]=null,vi--)}function lt(e,t){vi++,Yf[vi]=e.current,e.current=t}var Nr=Tr(null),Wl=Tr(null),Ia=Tr(null),Dc=Tr(null);function zc(e,t){switch(lt(Ia,t),lt(Wl,e),lt(Nr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?pv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=pv(t),e=rx(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$t(Nr),lt(Nr,e)}function Bi(){$t(Nr),$t(Wl),$t(Ia)}function Wf(e){e.memoizedState!==null&&lt(Dc,e);var t=Nr.current,n=rx(t,e.type);t!==n&&(lt(Wl,e),lt(Nr,n))}function Bc(e){Wl.current===e&&($t(Nr),$t(Wl)),Dc.current===e&&($t(Dc),is._currentValue=wo)}var uf,sy;function vo(e){if(uf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);uf=t&&t[1]||"",sy=-1<n.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+uf+e+ly}var df=!1;function ff(e,t){if(!e||df)return"";df=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var p=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){p=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){p=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&p&&typeof m.stack=="string")return[m.stack,p.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=r.DetermineComponentFrameRoot(),i=o[0],s=o[1];if(i&&s){var c=i.split(`
3
+ `+uf+e+sy}var df=!1;function ff(e,t){if(!e||df)return"";df=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var p=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){p=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){p=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&p&&typeof m.stack=="string")return[m.stack,p.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=r.DetermineComponentFrameRoot(),i=o[0],s=o[1];if(i&&s){var c=i.split(`
4
4
  `),u=s.split(`
5
5
  `);for(a=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;if(r===c.length||a===u.length)for(r=c.length-1,a=u.length-1;1<=r&&0<=a&&c[r]!==u[a];)a--;for(;1<=r&&0<=a;r--,a--)if(c[r]!==u[a]){if(r!==1||a!==1)do if(r--,a--,0>a||c[r]!==u[a]){var f=`
6
- `+c[r].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=r&&0<=a);break}}}finally{df=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?vo(n):""}function ZR(e,t){switch(e.tag){case 26:case 27:case 5:return vo(e.type);case 16:return vo("Lazy");case 13:return e.child!==t&&t!==null?vo("Suspense Fallback"):vo("Suspense");case 19:return vo("SuspenseList");case 0:case 15:return ff(e.type,!1);case 11:return ff(e.type.render,!1);case 1:return ff(e.type,!0);case 31:return vo("Activity");default:return""}}function sy(e){try{var t="",n=null;do t+=ZR(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
6
+ `+c[r].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=r&&0<=a);break}}}finally{df=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?vo(n):""}function JR(e,t){switch(e.tag){case 26:case 27:case 5:return vo(e.type);case 16:return vo("Lazy");case 13:return e.child!==t&&t!==null?vo("Suspense Fallback"):vo("Suspense");case 19:return vo("SuspenseList");case 0:case 15:return ff(e.type,!1);case 11:return ff(e.type.render,!1);case 1:return ff(e.type,!0);case 31:return vo("Activity");default:return""}}function cy(e){try{var t="",n=null;do t+=JR(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
7
7
  Error generating stack: `+r.message+`
8
- `+r.stack}}var Qf=Object.prototype.hasOwnProperty,Pm=Ut.unstable_scheduleCallback,mf=Ut.unstable_cancelCallback,JR=Ut.unstable_shouldYield,eE=Ut.unstable_requestPaint,Mn=Ut.unstable_now,tE=Ut.unstable_getCurrentPriorityLevel,Iv=Ut.unstable_ImmediatePriority,Uv=Ut.unstable_UserBlockingPriority,Bc=Ut.unstable_NormalPriority,nE=Ut.unstable_LowPriority,jv=Ut.unstable_IdlePriority,rE=Ut.log,aE=Ut.unstable_setDisableYieldValue,cs=null,On=null;function ka(e){if(typeof rE=="function"&&aE(e),On&&typeof On.setStrictMode=="function")try{On.setStrictMode(cs,e)}catch{}}var _n=Math.clz32?Math.clz32:lE,oE=Math.log,iE=Math.LN2;function lE(e){return e>>>=0,e===0?32:31-(oE(e)/iE|0)|0}var tc=256,nc=262144,rc=4194304;function bo(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 su(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,o=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~o,r!==0?a=bo(r):(i&=s,i!==0?a=bo(i):n||(n=s&~e,n!==0&&(a=bo(n))))):(s=r&~o,s!==0?a=bo(s):i!==0?a=bo(i):n||(n=r&~e,n!==0&&(a=bo(n)))),a===0?0:t!==0&&t!==a&&(t&o)===0&&(o=a&-a,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:a}function us(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function sE(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 Pv(){var e=rc;return rc<<=1,(rc&62914560)===0&&(rc=4194304),e}function pf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ds(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function cE(e,t,n,r,a,o){var i=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,u=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-_n(n),d=1<<f;s[f]=0,c[f]=-1;var p=u[f];if(p!==null)for(u[f]=null,f=0;f<p.length;f++){var m=p[f];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&Vv(e,r,0),o!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=o&~(i&~t))}function Vv(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-_n(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Hv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-_n(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function qv(e,t){var n=t&-t;return n=(n&42)!==0?1:Vm(n),(n&(e.suspendedLanes|t))!==0?0:n}function Vm(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 Hm(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function $v(){var e=Fe.p;return e!==0?e:(e=window.event,e===void 0?32:mx(e.type))}function cy(e,t){var n=Fe.p;try{return Fe.p=e,t()}finally{Fe.p=n}}var Qa=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Qa,yn="__reactProps$"+Qa,Gi="__reactContainer$"+Qa,Xf="__reactEvents$"+Qa,uE="__reactListeners$"+Qa,dE="__reactHandles$"+Qa,uy="__reactResources$"+Qa,fs="__reactMarker$"+Qa;function qm(e){delete e[Qt],delete e[yn],delete e[Xf],delete e[uE],delete e[dE]}function bi(e){var t=e[Qt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gi]||n[Qt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vv(e);e!==null;){if(n=e[Qt])return n;e=vv(e)}return t}e=n,n=e.parentNode}return null}function Yi(e){if(e=e[Qt]||e[Gi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Mi(e){var t=e[uy];return t||(t=e[uy]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function $t(e){e[fs]=!0}var Kv=new Set,Fv={};function ko(e,t){Ii(e,t),Ii(e+"Capture",t)}function Ii(e,t){for(Fv[e]=t,e=0;e<t.length;e++)Kv.add(t[e])}var fE=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]*$"),dy={},fy={};function mE(e){return Qf.call(fy,e)?!0:Qf.call(dy,e)?!1:fE.test(e)?fy[e]=!0:(dy[e]=!0,!1)}function vc(e,t,n){if(mE(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 ac(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 Gr(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 Hn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pE(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){n=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zf(e){if(!e._valueTracker){var t=Gv(e)?"checked":"value";e._valueTracker=pE(e,t,""+e[t])}}function Yv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ic(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gE=/[\n"\\]/g;function Kn(e){return e.replace(gE,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jf(e,t,n,r,a,o,i,s){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Hn(t)):e.value!==""+Hn(t)&&(e.value=""+Hn(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?em(e,i,Hn(t)):n!=null?em(e,i,Hn(n)):r!=null&&e.removeAttribute("value"),a==null&&o!=null&&(e.defaultChecked=!!o),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Hn(s):e.removeAttribute("name")}function Wv(e,t,n,r,a,o,i,s){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){Zf(e);return}n=n!=null?""+Hn(n):"",t=t!=null?""+Hn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??a,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),Zf(e)}function em(e,t,n){t==="number"&&Ic(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Oi(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Hn(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Qv(e,t,n){if(t!=null&&(t=""+Hn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Hn(n):""}function Xv(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(L(92));if(_l(r)){if(1<r.length)throw Error(L(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Hn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Zf(e)}function Ui(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var hE=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 my(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||hE.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Zv(e,t,n){if(t!=null&&typeof t!="object")throw Error(L(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&&my(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&my(e,o,t[o])}function $m(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 yE=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"]]),vE=/^[\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 bc(e){return vE.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var tm=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xi=null,_i=null;function py(e){var t=Yi(e);if(t&&(e=t.stateNode)){var n=e[yn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Jf(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="'+Kn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[yn]||null;if(!a)throw Error(L(90));Jf(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&&Yv(r)}break e;case"textarea":Qv(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Oi(e,!!n.multiple,t,!1)}}}var gf=!1;function Jv(e,t,n){if(gf)return e(t,n);gf=!0;try{var r=e(t);return r}finally{if(gf=!1,(xi!==null||_i!==null)&&(xu(),xi&&(t=xi,e=_i,_i=xi=null,py(t),e)))for(t=0;t<e.length;t++)py(e[t])}}function Wl(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yn]||null;if(r===null)return null;n=r[t];e: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 e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(L(231,t,typeof n));return n}var ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nm=!1;if(ia)try{fi={},Object.defineProperty(fi,"passive",{get:function(){nm=!0}}),window.addEventListener("test",fi,fi),window.removeEventListener("test",fi,fi)}catch{nm=!1}var fi,La=null,Fm=null,xc=null;function eb(){if(xc)return xc;var e,t=Fm,n=t.length,r,a="value"in La?La.value:La.textContent,o=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===a[o-r];r++);return xc=a.slice(e,1<r?1-r:void 0)}function Sc(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 oc(){return!0}function gy(){return!1}function vn(e){function t(n,r,a,o,i){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(o):o[s]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?oc:gy,this.isPropagationStopped=gy,this}return mt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=oc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=oc)},persist:function(){},isPersistent:oc}),t}var Lo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cu=vn(Lo),ms=mt({},Lo,{view:0,detail:0}),bE=vn(ms),hf,yf,Cl,uu=mt({},ms,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gm,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!==Cl&&(Cl&&e.type==="mousemove"?(hf=e.screenX-Cl.screenX,yf=e.screenY-Cl.screenY):yf=hf=0,Cl=e),hf)},movementY:function(e){return"movementY"in e?e.movementY:yf}}),hy=vn(uu),xE=mt({},uu,{dataTransfer:0}),SE=vn(xE),wE=mt({},ms,{relatedTarget:0}),vf=vn(wE),AE=mt({},Lo,{animationName:0,elapsedTime:0,pseudoElement:0}),CE=vn(AE),RE=mt({},Lo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),EE=vn(RE),TE=mt({},Lo,{data:0}),yy=vn(TE),NE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ME={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"},OE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _E(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=OE[e])?!!t[e]:!1}function Gm(){return _E}var kE=mt({},ms,{key:function(e){if(e.key){var t=NE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Sc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ME[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gm,charCode:function(e){return e.type==="keypress"?Sc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Sc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LE=vn(kE),DE=mt({},uu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vy=vn(DE),zE=mt({},ms,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gm}),BE=vn(zE),IE=mt({},Lo,{propertyName:0,elapsedTime:0,pseudoElement:0}),UE=vn(IE),jE=mt({},uu,{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}),PE=vn(jE),VE=mt({},Lo,{newState:0,oldState:0}),HE=vn(VE),qE=[9,13,27,32],Ym=ia&&"CompositionEvent"in window,zl=null;ia&&"documentMode"in document&&(zl=document.documentMode);var $E=ia&&"TextEvent"in window&&!zl,tb=ia&&(!Ym||zl&&8<zl&&11>=zl),by=" ",xy=!1;function nb(e,t){switch(e){case"keyup":return qE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function KE(e,t){switch(e){case"compositionend":return rb(t);case"keypress":return t.which!==32?null:(xy=!0,by);case"textInput":return e=t.data,e===by&&xy?null:e;default:return null}}function FE(e,t){if(Si)return e==="compositionend"||!Ym&&nb(e,t)?(e=eb(),xc=Fm=La=null,Si=!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 tb&&t.locale!=="ko"?null:t.data;default:return null}}var GE={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 Sy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GE[e.type]:t==="textarea"}function ab(e,t,n,r){xi?_i?_i.push(r):_i=[r]:xi=r,t=tu(t,"onChange"),0<t.length&&(n=new cu("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Bl=null,Ql=null;function YE(e){J0(e,0)}function du(e){var t=kl(e);if(Yv(t))return e}function wy(e,t){if(e==="change")return t}var ob=!1;ia&&(ia?(lc="oninput"in document,lc||(bf=document.createElement("div"),bf.setAttribute("oninput","return;"),lc=typeof bf.oninput=="function"),ic=lc):ic=!1,ob=ic&&(!document.documentMode||9<document.documentMode));var ic,lc,bf;function Ay(){Bl&&(Bl.detachEvent("onpropertychange",ib),Ql=Bl=null)}function ib(e){if(e.propertyName==="value"&&du(Ql)){var t=[];ab(t,Ql,e,Km(e)),Jv(YE,t)}}function WE(e,t,n){e==="focusin"?(Ay(),Bl=t,Ql=n,Bl.attachEvent("onpropertychange",ib)):e==="focusout"&&Ay()}function QE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return du(Ql)}function XE(e,t){if(e==="click")return du(t)}function ZE(e,t){if(e==="input"||e==="change")return du(t)}function JE(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ln=typeof Object.is=="function"?Object.is:JE;function Xl(e,t){if(Ln(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)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 a=n[r];if(!Qf.call(t,a)||!Ln(e[a],t[a]))return!1}return!0}function Cy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ry(e,t){var n=Cy(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}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Cy(n)}}function lb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ic(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=Ic(e.document)}return t}function Wm(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 eT=ia&&"documentMode"in document&&11>=document.documentMode,wi=null,rm=null,Il=null,am=!1;function Ey(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;am||wi==null||wi!==Ic(r)||(r=wi,"selectionStart"in r&&Wm(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}),Il&&Xl(Il,r)||(Il=r,r=tu(rm,"onSelect"),0<r.length&&(t=new cu("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=wi)))}function yo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ai={animationend:yo("Animation","AnimationEnd"),animationiteration:yo("Animation","AnimationIteration"),animationstart:yo("Animation","AnimationStart"),transitionrun:yo("Transition","TransitionRun"),transitionstart:yo("Transition","TransitionStart"),transitioncancel:yo("Transition","TransitionCancel"),transitionend:yo("Transition","TransitionEnd")},xf={},cb={};ia&&(cb=document.createElement("div").style,"AnimationEvent"in window||(delete Ai.animationend.animation,delete Ai.animationiteration.animation,delete Ai.animationstart.animation),"TransitionEvent"in window||delete Ai.transitionend.transition);function Do(e){if(xf[e])return xf[e];if(!Ai[e])return e;var t=Ai[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in cb)return xf[e]=t[n];return e}var ub=Do("animationend"),db=Do("animationiteration"),fb=Do("animationstart"),tT=Do("transitionrun"),nT=Do("transitionstart"),rT=Do("transitioncancel"),mb=Do("transitionend"),pb=new Map,om="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(" ");om.push("scrollEnd");function fr(e,t){pb.set(e,t),ko(t,[e])}var Uc=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!==null&&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)},Vn=[],Ci=0,Qm=0;function fu(){for(var e=Ci,t=Qm=Ci=0;t<e;){var n=Vn[t];Vn[t++]=null;var r=Vn[t];Vn[t++]=null;var a=Vn[t];Vn[t++]=null;var o=Vn[t];if(Vn[t++]=null,r!==null&&a!==null){var i=r.pending;i===null?a.next=a:(a.next=i.next,i.next=a),r.pending=a}o!==0&&gb(n,a,o)}}function mu(e,t,n,r){Vn[Ci++]=e,Vn[Ci++]=t,Vn[Ci++]=n,Vn[Ci++]=r,Qm|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xm(e,t,n,r){return mu(e,t,n,r),jc(e)}function zo(e,t){return mu(e,null,null,t),jc(e)}function gb(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var a=!1,o=e.return;o!==null;)o.childLanes|=n,r=o.alternate,r!==null&&(r.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(a=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,a&&t!==null&&(a=31-_n(n),e=o.hiddenUpdates,r=e[a],r===null?e[a]=[t]:r.push(t),t.lane=n|536870912),o):null}function jc(e){if(50<Fl)throw Fl=0,Em=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ri={};function aT(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 Tn(e,t,n,r){return new aT(e,t,n,r)}function Zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ra(e,t){var n=e.alternate;return n===null?(n=Tn(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 hb(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 wc(e,t,n,r,a,o){var i=0;if(r=e,typeof e=="function")Zm(e)&&(i=1);else if(typeof e=="string")i=lN(e,n,Tr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ff:return e=Tn(31,n,t,a),e.elementType=Ff,e.lanes=o,e;case yi:return Ao(n.children,a,o,t);case zv:i=8,a|=24;break;case qf:return e=Tn(12,n,t,a|2),e.elementType=qf,e.lanes=o,e;case $f:return e=Tn(13,n,t,a),e.elementType=$f,e.lanes=o,e;case Kf:return e=Tn(19,n,t,a),e.elementType=Kf,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ea:i=10;break e;case Bv:i=9;break e;case Um:i=11;break e;case jm:i=14;break e;case Ea:i=16,r=null;break e}i=29,n=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=Tn(i,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ao(e,t,n,r){return e=Tn(7,e,r,t),e.lanes=n,e}function Sf(e,t,n){return e=Tn(6,e,null,t),e.lanes=n,e}function yb(e){var t=Tn(18,null,null,0);return t.stateNode=e,t}function wf(e,t,n){return t=Tn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ty=new WeakMap;function Fn(e,t){if(typeof e=="object"&&e!==null){var n=Ty.get(e);return n!==void 0?n:(t={value:e,source:t,stack:sy(t)},Ty.set(e,t),t)}return{value:e,source:t,stack:sy(t)}}var Ei=[],Ti=0,Pc=null,Zl=0,qn=[],$n=0,Fa=null,Cr=1,Rr="";function Zr(e,t){Ei[Ti++]=Zl,Ei[Ti++]=Pc,Pc=e,Zl=t}function vb(e,t,n){qn[$n++]=Cr,qn[$n++]=Rr,qn[$n++]=Fa,Fa=e;var r=Cr;e=Rr;var a=32-_n(r)-1;r&=~(1<<a),n+=1;var o=32-_n(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Cr=1<<32-_n(t)+a|n<<a|r,Rr=o+e}else Cr=1<<o|n<<a|r,Rr=e}function Jm(e){e.return!==null&&(Zr(e,1),vb(e,1,0))}function ep(e){for(;e===Pc;)Pc=Ei[--Ti],Ei[Ti]=null,Zl=Ei[--Ti],Ei[Ti]=null;for(;e===Fa;)Fa=qn[--$n],qn[$n]=null,Rr=qn[--$n],qn[$n]=null,Cr=qn[--$n],qn[$n]=null}function bb(e,t){qn[$n++]=Cr,qn[$n++]=Rr,qn[$n++]=Fa,Cr=t.id,Rr=t.overflow,Fa=e}var Xt=null,ft=null,je=!1,Ua=null,Gn=!1,im=Error(L(519));function Ga(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(Fn(t,e)),im}function Ny(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Qt]=e,t[yn]=r,n){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(n=0;n<rs.length;n++)De(rs[n],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),Wv(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),Xv(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||tx(t.textContent,n)?(r.popover!=null&&(De("beforetoggle",t),De("toggle",t)),r.onScroll!=null&&De("scroll",t),r.onScrollEnd!=null&&De("scrollend",t),r.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||Ga(e,!0)}function My(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Gn=!1;return;case 27:case 3:Gn=!0;return;default:Xt=Xt.return}}function mi(e){if(e!==Xt)return!1;if(!je)return My(e),je=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||_m(e.type,e.memoizedProps)),n=!n),n&&ft&&Ga(e),My(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));ft=yv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));ft=yv(e)}else t===27?(t=ft,Xa(e.type)?(e=zm,zm=null,ft=e):ft=t):ft=Xt?Wn(e.stateNode.nextSibling):null;return!0}function To(){ft=Xt=null,je=!1}function Af(){var e=Ua;return e!==null&&(gn===null?gn=e:gn.push.apply(gn,e),Ua=null),e}function Jl(e){Ua===null?Ua=[e]:Ua.push(e)}var lm=Nr(null),Bo=null,na=null;function Na(e,t,n){lt(lm,t._currentValue),t._currentValue=n}function aa(e){e._currentValue=lm.current,Kt(lm)}function sm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function cm(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var i=a.child;o=o.firstContext;e:for(;o!==null;){var s=o;o=a;for(var c=0;c<t.length;c++)if(s.context===t[c]){o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),sm(o.return,n,e),r||(i=null);break e}o=s.next}}else if(a.tag===18){if(i=a.return,i===null)throw Error(L(341));i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),sm(i,n,e),i=null}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===e){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}}function Wi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if((a.flags&524288)!==0)o=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var i=a.alternate;if(i===null)throw Error(L(387));if(i=i.memoizedProps,i!==null){var s=a.type;Ln(a.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(a===Lc.current){if(i=a.alternate,i===null)throw Error(L(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(os):e=[os])}a=a.return}e!==null&&cm(t,e,n,r),t.flags|=262144}function Vc(e){for(e=e.firstContext;e!==null;){if(!Ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function No(e){Bo=e,na=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zt(e){return xb(Bo,e)}function sc(e,t){return Bo===null&&No(e),xb(e,t)}function xb(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},na===null){if(e===null)throw Error(L(308));na=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else na=na.next=t;return n}var oT=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},iT=Ut.unstable_scheduleCallback,lT=Ut.unstable_NormalPriority,kt={$$typeof:ea,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tp(){return{controller:new oT,data:new Map,refCount:0}}function ps(e){e.refCount--,e.refCount===0&&iT(lT,function(){e.controller.abort()})}var Ul=null,um=0,ji=0,ki=null;function sT(e,t){if(Ul===null){var n=Ul=[];um=0,ji=Ep(),ki={status:"pending",value:void 0,then:function(r){n.push(r)}}}return um++,t.then(Oy,Oy),t}function Oy(){if(--um===0&&Ul!==null){ki!==null&&(ki.status="fulfilled");var e=Ul;Ul=null,ji=0,ki=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cT(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(r.status="rejected",r.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),r}var _y=ve.S;ve.S=function(e,t){D0=Mn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&sT(e,t),_y!==null&&_y(e,t)};var Co=Nr(null);function np(){var e=Co.current;return e!==null?e:rt.pooledCache}function Ac(e,t){t===null?lt(Co,Co.current):lt(Co,t.pool)}function Sb(){var e=np();return e===null?null:{parent:kt._currentValue,pool:e}}var Qi=Error(L(460)),rp=Error(L(474)),pu=Error(L(542)),Hc={then:function(){}};function ky(e){return e=e.status,e==="fulfilled"||e==="rejected"}function wb(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ta,ta),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dy(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=r}},function(r){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dy(e),e}throw Ro=t,Qi}}function xo(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ro=n,Qi):n}}var Ro=null;function Ly(){if(Ro===null)throw Error(L(459));var e=Ro;return Ro=null,e}function Dy(e){if(e===Qi||e===pu)throw Error(L(483))}var Li=null,es=0;function cc(e){var t=es;return es+=1,Li===null&&(Li=[]),wb(Li,e,t)}function Rl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function uc(e,t){throw t.$$typeof===WR?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ab(e){function t(y,h){if(e){var v=y.deletions;v===null?(y.deletions=[h],y.flags|=16):v.push(h)}}function n(y,h){if(!e)return null;for(;h!==null;)t(y,h),h=h.sibling;return null}function r(y){for(var h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function a(y,h){return y=ra(y,h),y.index=0,y.sibling=null,y}function o(y,h,v){return y.index=v,e?(v=y.alternate,v!==null?(v=v.index,v<h?(y.flags|=67108866,h):v):(y.flags|=67108866,h)):(y.flags|=1048576,h)}function i(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function s(y,h,v,S){return h===null||h.tag!==6?(h=Sf(v,y.mode,S),h.return=y,h):(h=a(h,v),h.return=y,h)}function c(y,h,v,S){var C=v.type;return C===yi?f(y,h,v.props.children,S,v.key):h!==null&&(h.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&xo(C)===h.type)?(h=a(h,v.props),Rl(h,v),h.return=y,h):(h=wc(v.type,v.key,v.props,null,y.mode,S),Rl(h,v),h.return=y,h)}function u(y,h,v,S){return h===null||h.tag!==4||h.stateNode.containerInfo!==v.containerInfo||h.stateNode.implementation!==v.implementation?(h=wf(v,y.mode,S),h.return=y,h):(h=a(h,v.children||[]),h.return=y,h)}function f(y,h,v,S,C){return h===null||h.tag!==7?(h=Ao(v,y.mode,S,C),h.return=y,h):(h=a(h,v),h.return=y,h)}function d(y,h,v){if(typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint")return h=Sf(""+h,y.mode,v),h.return=y,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case ec:return v=wc(h.type,h.key,h.props,null,y.mode,v),Rl(v,h),v.return=y,v;case Ol:return h=wf(h,y.mode,v),h.return=y,h;case Ea:return h=xo(h),d(y,h,v)}if(_l(h)||Al(h))return h=Ao(h,y.mode,v,null),h.return=y,h;if(typeof h.then=="function")return d(y,cc(h),v);if(h.$$typeof===ea)return d(y,sc(y,h),v);uc(y,h)}return null}function p(y,h,v,S){var C=h!==null?h.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return C!==null?null:s(y,h,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ec:return v.key===C?c(y,h,v,S):null;case Ol:return v.key===C?u(y,h,v,S):null;case Ea:return v=xo(v),p(y,h,v,S)}if(_l(v)||Al(v))return C!==null?null:f(y,h,v,S,null);if(typeof v.then=="function")return p(y,h,cc(v),S);if(v.$$typeof===ea)return p(y,h,sc(y,v),S);uc(y,v)}return null}function m(y,h,v,S,C){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return y=y.get(v)||null,s(h,y,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ec:return y=y.get(S.key===null?v:S.key)||null,c(h,y,S,C);case Ol:return y=y.get(S.key===null?v:S.key)||null,u(h,y,S,C);case Ea:return S=xo(S),m(y,h,v,S,C)}if(_l(S)||Al(S))return y=y.get(v)||null,f(h,y,S,C,null);if(typeof S.then=="function")return m(y,h,v,cc(S),C);if(S.$$typeof===ea)return m(y,h,v,sc(h,S),C);uc(h,S)}return null}function b(y,h,v,S){for(var C=null,T=null,w=h,R=h=0,M=null;w!==null&&R<v.length;R++){w.index>R?(M=w,w=null):M=w.sibling;var k=p(y,w,v[R],S);if(k===null){w===null&&(w=M);break}e&&w&&k.alternate===null&&t(y,w),h=o(k,h,R),T===null?C=k:T.sibling=k,T=k,w=M}if(R===v.length)return n(y,w),je&&Zr(y,R),C;if(w===null){for(;R<v.length;R++)w=d(y,v[R],S),w!==null&&(h=o(w,h,R),T===null?C=w:T.sibling=w,T=w);return je&&Zr(y,R),C}for(w=r(w);R<v.length;R++)M=m(w,y,R,v[R],S),M!==null&&(e&&M.alternate!==null&&w.delete(M.key===null?R:M.key),h=o(M,h,R),T===null?C=M:T.sibling=M,T=M);return e&&w.forEach(function(I){return t(y,I)}),je&&Zr(y,R),C}function g(y,h,v,S){if(v==null)throw Error(L(151));for(var C=null,T=null,w=h,R=h=0,M=null,k=v.next();w!==null&&!k.done;R++,k=v.next()){w.index>R?(M=w,w=null):M=w.sibling;var I=p(y,w,k.value,S);if(I===null){w===null&&(w=M);break}e&&w&&I.alternate===null&&t(y,w),h=o(I,h,R),T===null?C=I:T.sibling=I,T=I,w=M}if(k.done)return n(y,w),je&&Zr(y,R),C;if(w===null){for(;!k.done;R++,k=v.next())k=d(y,k.value,S),k!==null&&(h=o(k,h,R),T===null?C=k:T.sibling=k,T=k);return je&&Zr(y,R),C}for(w=r(w);!k.done;R++,k=v.next())k=m(w,y,R,k.value,S),k!==null&&(e&&k.alternate!==null&&w.delete(k.key===null?R:k.key),h=o(k,h,R),T===null?C=k:T.sibling=k,T=k);return e&&w.forEach(function(H){return t(y,H)}),je&&Zr(y,R),C}function x(y,h,v,S){if(typeof v=="object"&&v!==null&&v.type===yi&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ec:e:{for(var C=v.key;h!==null;){if(h.key===C){if(C=v.type,C===yi){if(h.tag===7){n(y,h.sibling),S=a(h,v.props.children),S.return=y,y=S;break e}}else if(h.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&xo(C)===h.type){n(y,h.sibling),S=a(h,v.props),Rl(S,v),S.return=y,y=S;break e}n(y,h);break}else t(y,h);h=h.sibling}v.type===yi?(S=Ao(v.props.children,y.mode,S,v.key),S.return=y,y=S):(S=wc(v.type,v.key,v.props,null,y.mode,S),Rl(S,v),S.return=y,y=S)}return i(y);case Ol:e:{for(C=v.key;h!==null;){if(h.key===C)if(h.tag===4&&h.stateNode.containerInfo===v.containerInfo&&h.stateNode.implementation===v.implementation){n(y,h.sibling),S=a(h,v.children||[]),S.return=y,y=S;break e}else{n(y,h);break}else t(y,h);h=h.sibling}S=wf(v,y.mode,S),S.return=y,y=S}return i(y);case Ea:return v=xo(v),x(y,h,v,S)}if(_l(v))return b(y,h,v,S);if(Al(v)){if(C=Al(v),typeof C!="function")throw Error(L(150));return v=C.call(v),g(y,h,v,S)}if(typeof v.then=="function")return x(y,h,cc(v),S);if(v.$$typeof===ea)return x(y,h,sc(y,v),S);uc(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,h!==null&&h.tag===6?(n(y,h.sibling),S=a(h,v),S.return=y,y=S):(n(y,h),S=Sf(v,y.mode,S),S.return=y,y=S),i(y)):n(y,h)}return function(y,h,v,S){try{es=0;var C=x(y,h,v,S);return Li=null,C}catch(w){if(w===Qi||w===pu)throw w;var T=Tn(29,w,null,y.mode);return T.lanes=S,T.return=y,T}}}var Mo=Ab(!0),Cb=Ab(!1),Ta=!1;function ap(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function dm(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 ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ke&2)!==0){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=jc(e),gb(e,null,n),t}return mu(e,r,t,n),jc(e)}function jl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hv(e,n)}}function Cf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,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 fm=!1;function Pl(){if(fm){var e=ki;if(e!==null)throw e}}function Vl(e,t,n,r){fm=!1;var a=e.updateQueue;Ta=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var c=s,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,s=f.lastBaseUpdate,s!==i&&(s===null?f.firstBaseUpdate=u:s.next=u,f.lastBaseUpdate=c))}if(o!==null){var d=a.baseState;i=0,f=u=c=null,s=o;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Ie&p)===p:(r&p)===p){p!==0&&p===ji&&(fm=!0),f!==null&&(f=f.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var b=e,g=s;p=t;var x=n;switch(g.tag){case 1:if(b=g.payload,typeof b=="function"){d=b.call(x,d,p);break e}d=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,p=typeof b=="function"?b.call(x,d,p):b,p==null)break e;d=mt({},d,p);break e;case 2:Ta=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=a.callbacks,m===null?a.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},f===null?(u=f=m,c=d):f=f.next=m,i|=p;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;m=s,s=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);f===null&&(c=d),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=f,o===null&&(a.shared.lanes=0),Wa|=i,e.lanes=i,e.memoizedState=d}}function Rb(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function Eb(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Rb(n[e],t)}var Pi=Nr(null),qc=Nr(0);function zy(e,t){e=ua,lt(qc,e),lt(Pi,t),ua=e|t.baseLanes}function mm(){lt(qc,ua),lt(Pi,Pi.current)}function op(){ua=qc.current,Kt(Pi),Kt(qc)}var Dn=Nr(null),Yn=null;function Ma(e){var t=e.alternate;lt(Rt,Rt.current&1),lt(Dn,e),Yn===null&&(t===null||Pi.current!==null||t.memoizedState!==null)&&(Yn=e)}function pm(e){lt(Rt,Rt.current),lt(Dn,e),Yn===null&&(Yn=e)}function Tb(e){e.tag===22?(lt(Rt,Rt.current),lt(Dn,e),Yn===null&&(Yn=e)):Oa(e)}function Oa(){lt(Rt,Rt.current),lt(Dn,Dn.current)}function En(e){Kt(Dn),Yn===e&&(Yn=null),Kt(Rt)}var Rt=Nr(0);function $c(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Lm(n)||Dm(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)!==0)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 la=0,Ce=null,et=null,Ot=null,Kc=!1,Di=!1,Oo=!1,Fc=0,ts=0,zi=null,uT=0;function wt(){throw Error(L(321))}function ip(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ln(e[n],t[n]))return!1;return!0}function lp(e,t,n,r,a,o){return la=o,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ve.H=e===null||e.memoizedState===null?a0:vp,Oo=!1,o=n(r,a),Oo=!1,Di&&(o=Mb(t,n,r,a)),Nb(e),o}function Nb(e){ve.H=ns;var t=et!==null&&et.next!==null;if(la=0,Ot=et=Ce=null,Kc=!1,ts=0,zi=null,t)throw Error(L(300));e===null||Lt||(e=e.dependencies,e!==null&&Vc(e)&&(Lt=!0))}function Mb(e,t,n,r){Ce=e;var a=0;do{if(Di&&(zi=null),ts=0,Di=!1,25<=a)throw Error(L(301));if(a+=1,Ot=et=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}ve.H=o0,o=t(n,r)}while(Di);return o}function dT(){var e=ve.H,t=e.useState()[0];return t=typeof t.then=="function"?gs(t):t,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Ce.flags|=1024),t}function sp(){var e=Fc!==0;return Fc=0,e}function cp(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function up(e){if(Kc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Kc=!1}la=0,Ot=et=Ce=null,Di=!1,ts=Fc=0,zi=null}function on(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Et(){if(et===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var t=Ot===null?Ce.memoizedState:Ot.next;if(t!==null)Ot=t,et=e;else{if(e===null)throw Ce.alternate===null?Error(L(467)):Error(L(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function gu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gs(e){var t=ts;return ts+=1,zi===null&&(zi=[]),e=wb(zi,e,t),t=Ce,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,ve.H=t===null||t.memoizedState===null?a0:vp),e}function hu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return gs(e);if(e.$$typeof===ea)return Zt(e)}throw Error(L(438,String(e)))}function dp(e){var t=null,n=Ce.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Ce.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=gu(),Ce.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]=QR;return t.index++,n}function sa(e,t){return typeof t=="function"?t(e):t}function Cc(e){var t=Et();return fp(t,et,e)}function fp(e,t,n){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var i=a.next;a.next=o.next,o.next=i}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var s=i=null,c=null,u=t,f=!1;do{var d=u.lane&-536870913;if(d!==u.lane?(Ie&d)===d:(la&d)===d){var p=u.revertLane;if(p===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),d===ji&&(f=!0);else if((la&p)===p){u=u.next,p===ji&&(f=!0);continue}else d={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(s=c=d,i=o):c=c.next=d,Ce.lanes|=p,Wa|=p;d=u.action,Oo&&n(o,d),o=u.hasEagerState?u.eagerState:n(o,d)}else p={lane:d,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(s=c=p,i=o):c=c.next=p,Ce.lanes|=d,Wa|=d;u=u.next}while(u!==null&&u!==t);if(c===null?i=o:c.next=s,!Ln(o,e.memoizedState)&&(Lt=!0,f&&(n=ki,n!==null)))throw n;e.memoizedState=o,e.baseState=i,e.baseQueue=c,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Rf(e){var t=Et(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do o=e(o,i.action),i=i.next;while(i!==a);Ln(o,t.memoizedState)||(Lt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ob(e,t,n){var r=Ce,a=Et(),o=je;if(o){if(n===void 0)throw Error(L(407));n=n()}else n=t();var i=!Ln((et||a).memoizedState,n);if(i&&(a.memoizedState=n,Lt=!0),a=a.queue,mp(Lb.bind(null,r,a,e),[e]),a.getSnapshot!==t||i||Ot!==null&&Ot.memoizedState.tag&1){if(r.flags|=2048,Vi(9,{destroy:void 0},kb.bind(null,r,a,n,t),null),rt===null)throw Error(L(349));o||(la&127)!==0||_b(r,t,n)}return n}function _b(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t=gu(),Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kb(e,t,n,r){t.value=n,t.getSnapshot=r,Db(t)&&zb(e)}function Lb(e,t,n){return n(function(){Db(t)&&zb(e)})}function Db(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ln(e,n)}catch{return!0}}function zb(e){var t=zo(e,2);t!==null&&hn(t,e,2)}function gm(e){var t=on();if(typeof e=="function"){var n=e;if(e=n(),Oo){ka(!0);try{n()}finally{ka(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:e},t}function Bb(e,t,n,r){return e.baseState=n,fp(e,et,typeof r=="function"?r:sa)}function fT(e,t,n,r,a){if(vu(e))throw Error(L(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(i){o.listeners.push(i)}};ve.T!==null?n(!0):o.isTransition=!1,r(o),n=t.pending,n===null?(o.next=t.pending=o,Ib(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ib(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var o=ve.T,i={};ve.T=i;try{var s=n(a,r),c=ve.S;c!==null&&c(i,s),By(e,t,s)}catch(u){hm(e,t,u)}finally{o!==null&&i.types!==null&&(o.types=i.types),ve.T=o}}else try{o=n(a,r),By(e,t,o)}catch(u){hm(e,t,u)}}function By(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Iy(e,t,r)},function(r){return hm(e,t,r)}):Iy(e,t,n)}function Iy(e,t,n){t.status="fulfilled",t.value=n,Ub(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ib(e,n)))}function hm(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,Ub(t),t=t.next;while(t!==r)}e.action=null}function Ub(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jb(e,t){return t}function Uy(e,t){if(je){var n=rt.formState;if(n!==null){e:{var r=Ce;if(je){if(ft){t:{for(var a=ft,o=Gn;a.nodeType!==8;){if(!o){a=null;break t}if(a=Wn(a.nextSibling),a===null){a=null;break t}}o=a.data,a=o==="F!"||o==="F"?a:null}if(a){ft=Wn(a.nextSibling),r=a.data==="F!";break e}}Ga(r)}r=!1}r&&(t=n[0])}}return n=on(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jb,lastRenderedState:t},n.queue=r,n=t0.bind(null,Ce,r),r.dispatch=n,r=gm(!1),o=yp.bind(null,Ce,!1,r.queue),r=on(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=fT.bind(null,Ce,a,o,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function jy(e){var t=Et();return Pb(t,et,e)}function Pb(e,t,n){if(t=fp(e,t,jb)[0],e=Cc(sa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=gs(t)}catch(i){throw i===Qi?pu:i}else r=t;t=Et();var a=t.queue,o=a.dispatch;return n!==t.memoizedState&&(Ce.flags|=2048,Vi(9,{destroy:void 0},mT.bind(null,a,n),null)),[r,o,e]}function mT(e,t){e.action=t}function Py(e){var t=Et(),n=et;if(n!==null)return Pb(t,n,e);Et(),t=t.memoizedState,n=Et();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Vi(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Ce.updateQueue,t===null&&(t=gu(),Ce.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 Vb(){return Et().memoizedState}function Rc(e,t,n,r){var a=on();Ce.flags|=e,a.memoizedState=Vi(1|t,{destroy:void 0},n,r===void 0?null:r)}function yu(e,t,n,r){var a=Et();r=r===void 0?null:r;var o=a.memoizedState.inst;et!==null&&r!==null&&ip(r,et.memoizedState.deps)?a.memoizedState=Vi(t,o,n,r):(Ce.flags|=e,a.memoizedState=Vi(1|t,o,n,r))}function Vy(e,t){Rc(8390656,8,e,t)}function mp(e,t){yu(2048,8,e,t)}function pT(e){Ce.flags|=4;var t=Ce.updateQueue;if(t===null)t=gu(),Ce.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Hb(e){var t=Et().memoizedState;return pT({ref:t,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function qb(e,t){return yu(4,2,e,t)}function $b(e,t){return yu(4,4,e,t)}function Kb(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 Fb(e,t,n){n=n!=null?n.concat([e]):null,yu(4,4,Kb.bind(null,t,e),n)}function pp(){}function Gb(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ip(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Yb(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ip(t,r[1]))return r[0];if(r=e(),Oo){ka(!0);try{e()}finally{ka(!1)}}return n.memoizedState=[r,t],r}function gp(e,t,n){return n===void 0||(la&1073741824)!==0&&(Ie&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=B0(),Ce.lanes|=e,Wa|=e,n)}function Wb(e,t,n,r){return Ln(n,t)?n:Pi.current!==null?(e=gp(e,n,r),Ln(e,t)||(Lt=!0),e):(la&42)===0||(la&1073741824)!==0&&(Ie&261930)===0?(Lt=!0,e.memoizedState=n):(e=B0(),Ce.lanes|=e,Wa|=e,t)}function Qb(e,t,n,r,a){var o=Fe.p;Fe.p=o!==0&&8>o?o:8;var i=ve.T,s={};ve.T=s,yp(e,!1,t,n);try{var c=a(),u=ve.S;if(u!==null&&u(s,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=cT(c,r);Hl(e,t,f,kn(e))}else Hl(e,t,r,kn(e))}catch(d){Hl(e,t,{then:function(){},status:"rejected",reason:d},kn())}finally{Fe.p=o,i!==null&&s.types!==null&&(i.types=s.types),ve.T=i}}function gT(){}function ym(e,t,n,r){if(e.tag!==5)throw Error(L(476));var a=Xb(e).queue;Qb(e,a,t,wo,n===null?gT:function(){return Zb(e),n(r)})}function Xb(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:wo,baseState:wo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:wo},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zb(e){var t=Xb(e);t.next===null&&(t=e.alternate.memoizedState),Hl(e,t.next.queue,{},kn())}function hp(){return Zt(os)}function Jb(){return Et().memoizedState}function e0(){return Et().memoizedState}function hT(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kn();e=ja(n);var r=Pa(t,e,n);r!==null&&(hn(r,t,n),jl(r,t,n)),t={cache:tp()},e.payload=t;return}t=t.return}}function yT(e,t,n){var r=kn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},vu(e)?n0(t,n):(n=Xm(e,t,n,r),n!==null&&(hn(n,e,r),r0(n,t,r)))}function t0(e,t,n){var r=kn();Hl(e,t,n,r)}function Hl(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(vu(e))n0(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,Ln(s,i))return mu(e,t,a,0),rt===null&&fu(),!1}catch{}if(n=Xm(e,t,a,r),n!==null)return hn(n,e,r),r0(n,t,r),!0}return!1}function yp(e,t,n,r){if(r={lane:2,revertLane:Ep(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},vu(e)){if(t)throw Error(L(479))}else t=Xm(e,n,r,2),t!==null&&hn(t,e,2)}function vu(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function n0(e,t){Di=Kc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function r0(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hv(e,n)}}var ns={readContext:Zt,use:hu,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};ns.useEffectEvent=wt;var a0={readContext:Zt,use:hu,useCallback:function(e,t){return on().memoizedState=[e,t===void 0?null:t],e},useContext:Zt,useEffect:Vy,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Rc(4194308,4,Kb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rc(4194308,4,e,t)},useInsertionEffect:function(e,t){Rc(4,2,e,t)},useMemo:function(e,t){var n=on();t=t===void 0?null:t;var r=e();if(Oo){ka(!0);try{e()}finally{ka(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=on();if(n!==void 0){var a=n(t);if(Oo){ka(!0);try{n(t)}finally{ka(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=yT.bind(null,Ce,e),[r.memoizedState,e]},useRef:function(e){var t=on();return e={current:e},t.memoizedState=e},useState:function(e){e=gm(e);var t=e.queue,n=t0.bind(null,Ce,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:pp,useDeferredValue:function(e,t){var n=on();return gp(n,e,t)},useTransition:function(){var e=gm(!1);return e=Qb.bind(null,Ce,e.queue,!0,!1),on().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ce,a=on();if(je){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),rt===null)throw Error(L(349));(Ie&127)!==0||_b(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Vy(Lb.bind(null,r,o,e),[e]),r.flags|=2048,Vi(9,{destroy:void 0},kb.bind(null,r,o,n,t),null),n},useId:function(){var e=on(),t=rt.identifierPrefix;if(je){var n=Rr,r=Cr;n=(r&~(1<<32-_n(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Fc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=uT++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:hp,useFormState:Uy,useActionState:Uy,useOptimistic:function(e){var t=on();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=yp.bind(null,Ce,!0,n),n.dispatch=t,[e,t]},useMemoCache:dp,useCacheRefresh:function(){return on().memoizedState=hT.bind(null,Ce)},useEffectEvent:function(e){var t=on(),n={impl:e};return t.memoizedState=n,function(){if((Ke&2)!==0)throw Error(L(440));return n.impl.apply(void 0,arguments)}}},vp={readContext:Zt,use:hu,useCallback:Gb,useContext:Zt,useEffect:mp,useImperativeHandle:Fb,useInsertionEffect:qb,useLayoutEffect:$b,useMemo:Yb,useReducer:Cc,useRef:Vb,useState:function(){return Cc(sa)},useDebugValue:pp,useDeferredValue:function(e,t){var n=Et();return Wb(n,et.memoizedState,e,t)},useTransition:function(){var e=Cc(sa)[0],t=Et().memoizedState;return[typeof e=="boolean"?e:gs(e),t]},useSyncExternalStore:Ob,useId:Jb,useHostTransitionStatus:hp,useFormState:jy,useActionState:jy,useOptimistic:function(e,t){var n=Et();return Bb(n,et,e,t)},useMemoCache:dp,useCacheRefresh:e0};vp.useEffectEvent=Hb;var o0={readContext:Zt,use:hu,useCallback:Gb,useContext:Zt,useEffect:mp,useImperativeHandle:Fb,useInsertionEffect:qb,useLayoutEffect:$b,useMemo:Yb,useReducer:Rf,useRef:Vb,useState:function(){return Rf(sa)},useDebugValue:pp,useDeferredValue:function(e,t){var n=Et();return et===null?gp(n,e,t):Wb(n,et.memoizedState,e,t)},useTransition:function(){var e=Rf(sa)[0],t=Et().memoizedState;return[typeof e=="boolean"?e:gs(e),t]},useSyncExternalStore:Ob,useId:Jb,useHostTransitionStatus:hp,useFormState:Py,useActionState:Py,useOptimistic:function(e,t){var n=Et();return et!==null?Bb(n,et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:dp,useCacheRefresh:e0};o0.useEffectEvent=Hb;function Ef(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:mt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vm={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kn(),a=ja(r);a.payload=t,n!=null&&(a.callback=n),t=Pa(e,a,r),t!==null&&(hn(t,e,r),jl(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kn(),a=ja(r);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Pa(e,a,r),t!==null&&(hn(t,e,r),jl(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kn(),r=ja(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(hn(t,e,n),jl(t,e,n))}};function Hy(e,t,n,r,a,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Xl(n,r)||!Xl(a,o):!0}function qy(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&&vm.enqueueReplaceState(t,t.state,null)}function _o(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=mt({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function i0(e){Uc(e)}function l0(e){console.error(e)}function s0(e){Uc(e)}function Gc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function $y(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function bm(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Gc(e,t)},n}function c0(e){return e=ja(e),e.tag=3,e}function u0(e,t,n,r){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var o=r.value;e.payload=function(){return a(o)},e.callback=function(){$y(t,n,r)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){$y(t,n,r),typeof a!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var s=r.stack;this.componentDidCatch(r.value,{componentStack:s!==null?s:""})})}function vT(e,t,n,r,a){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Wi(t,n,a,!0),n=Dn.current,n!==null){switch(n.tag){case 31:case 13:return Yn===null?Zc():n.alternate===null&&At===0&&(At=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Hc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),If(e,r,a)),!1;case 22:return n.flags|=65536,r===Hc?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)),If(e,r,a)),!1}throw Error(L(435,n.tag))}return If(e,r,a),Zc(),!1}if(je)return t=Dn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==im&&(e=Error(L(422),{cause:r}),Jl(Fn(e,n)))):(r!==im&&(t=Error(L(423),{cause:r}),Jl(Fn(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Fn(r,n),a=bm(e.stateNode,r,a),Cf(e,a),At!==4&&(At=2)),!1;var o=Error(L(520),{cause:r});if(o=Fn(o,n),Kl===null?Kl=[o]:Kl.push(o),At!==4&&(At=2),t===null)return!0;r=Fn(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=bm(n.stateNode,r,e),Cf(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(Va===null||!Va.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=c0(a),u0(a,e,n,r),Cf(n,a),!1}n=n.return}while(n!==null);return!1}var bp=Error(L(461)),Lt=!1;function Wt(e,t,n,r){t.child=e===null?Cb(t,null,n,r):Mo(t,e.child,n,r)}function Ky(e,t,n,r,a){n=n.render;var o=t.ref;if("ref"in r){var i={};for(var s in r)s!=="ref"&&(i[s]=r[s])}else i=r;return No(t),r=lp(e,t,n,i,o,a),s=sp(),e!==null&&!Lt?(cp(e,t,a),ca(e,t,a)):(je&&s&&Jm(t),t.flags|=1,Wt(e,t,r,a),t.child)}function Fy(e,t,n,r,a){if(e===null){var o=n.type;return typeof o=="function"&&!Zm(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,d0(e,t,o,r,a)):(e=wc(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!xp(e,a)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Xl,n(i,r)&&e.ref===t.ref)return ca(e,t,a)}return t.flags|=1,e=ra(o,r),e.ref=t.ref,e.return=t,t.child=e}function d0(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Xl(o,r)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=r=o,xp(e,a))(e.flags&131072)!==0&&(Lt=!0);else return t.lanes=e.lanes,ca(e,t,a)}return xm(e,t,n,r,a)}function f0(e,t,n,r){var a=r.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){for(r=t.child=e.child,a=0;r!==null;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~o}else r=0,t.child=null;return Gy(e,t,o,n,r)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ac(t,o!==null?o.cachePool:null),o!==null?zy(t,o):mm(),Tb(t);else return r=t.lanes=536870912,Gy(e,t,o!==null?o.baseLanes|n:n,n,r)}else o!==null?(Ac(t,o.cachePool),zy(t,o),Oa(t),t.memoizedState=null):(e!==null&&Ac(t,null),mm(),Oa(t));return Wt(e,t,a,n),t.child}function Ll(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Gy(e,t,n,r,a){var o=np();return o=o===null?null:{parent:kt._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&Ac(t,null),mm(),Tb(t),e!==null&&Wi(e,t,r,!0),t.childLanes=a,null}function Ec(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 Yy(e,t,n){return Mo(t,e.child,null,n),e=Ec(t,t.pendingProps),e.flags|=2,En(t),t.memoizedState=null,e}function bT(e,t,n){var r=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(je){if(r.mode==="hidden")return e=Ec(t,r),t.lanes=536870912,Ll(null,e);if(pm(t),(e=ft)?(e=ax(e,Gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Fa!==null?{id:Cr,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=yb(e),n.return=t,t.child=n,Xt=t,ft=null)):e=null,e===null)throw Ga(t);return t.lanes=536870912,null}return Ec(t,r)}var o=e.memoizedState;if(o!==null){var i=o.dehydrated;if(pm(t),a)if(t.flags&256)t.flags&=-257,t=Yy(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(Lt||Wi(e,t,n,!1),a=(n&e.childLanes)!==0,Lt||a){if(r=rt,r!==null&&(i=qv(r,n),i!==0&&i!==o.retryLane))throw o.retryLane=i,zo(e,i),hn(r,e,i),bp;Zc(),t=Yy(e,t,n)}else e=o.treeContext,ft=Wn(i.nextSibling),Xt=t,je=!0,Ua=null,Gn=!1,e!==null&&bb(t,e),t=Ec(t,r),t.flags|=4096;return t}return e=ra(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Tc(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(L(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function xm(e,t,n,r,a){return No(t),n=lp(e,t,n,r,void 0,a),r=sp(),e!==null&&!Lt?(cp(e,t,a),ca(e,t,a)):(je&&r&&Jm(t),t.flags|=1,Wt(e,t,n,a),t.child)}function Wy(e,t,n,r,a,o){return No(t),t.updateQueue=null,n=Mb(t,r,n,a),Nb(e),r=sp(),e!==null&&!Lt?(cp(e,t,o),ca(e,t,o)):(je&&r&&Jm(t),t.flags|=1,Wt(e,t,n,o),t.child)}function Qy(e,t,n,r,a){if(No(t),t.stateNode===null){var o=Ri,i=n.contextType;typeof i=="object"&&i!==null&&(o=Zt(i)),o=new n(r,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=vm,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=r,o.state=t.memoizedState,o.refs={},ap(t),i=n.contextType,o.context=typeof i=="object"&&i!==null?Zt(i):Ri,o.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Ef(t,n,i,r),o.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(i=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),i!==o.state&&vm.enqueueReplaceState(o,o.state,null),Vl(t,r,o,a),Pl(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){o=t.stateNode;var s=t.memoizedProps,c=_o(n,s);o.props=c;var u=o.context,f=n.contextType;i=Ri,typeof f=="object"&&f!==null&&(i=Zt(f));var d=n.getDerivedStateFromProps;f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function",s=t.pendingProps!==s,f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s||u!==i)&&qy(t,o,r,i),Ta=!1;var p=t.memoizedState;o.state=p,Vl(t,r,o,a),Pl(),u=t.memoizedState,s||p!==u||Ta?(typeof d=="function"&&(Ef(t,n,d,r),u=t.memoizedState),(c=Ta||Hy(t,n,c,r,p,u,i))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=i,r=c):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,dm(e,t),i=t.memoizedProps,f=_o(n,i),o.props=f,d=t.pendingProps,p=o.context,u=n.contextType,c=Ri,typeof u=="object"&&u!==null&&(c=Zt(u)),s=n.getDerivedStateFromProps,(u=typeof s=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==d||p!==c)&&qy(t,o,r,c),Ta=!1,p=t.memoizedState,o.state=p,Vl(t,r,o,a),Pl();var m=t.memoizedState;i!==d||p!==m||Ta||e!==null&&e.dependencies!==null&&Vc(e.dependencies)?(typeof s=="function"&&(Ef(t,n,s,r),m=t.memoizedState),(f=Ta||Hy(t,n,f,r,p,m,c)||e!==null&&e.dependencies!==null&&Vc(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=f):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Tc(e,t),r=(t.flags&128)!==0,o||r?(o=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&r?(t.child=Mo(t,e.child,null,a),t.child=Mo(t,null,n,a)):Wt(e,t,n,a),t.memoizedState=o.state,e=t.child):e=ca(e,t,a),e}function Xy(e,t,n,r){return To(),t.flags|=256,Wt(e,t,n,r),t.child}var Tf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nf(e){return{baseLanes:e,cachePool:Sb()}}function Mf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Nn),e}function m0(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!==0,i;if((i=o)||(i=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),i&&(a=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(je){if(a?Ma(t):Oa(t),(e=ft)?(e=ax(e,Gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Fa!==null?{id:Cr,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=yb(e),n.return=t,t.child=n,Xt=t,ft=null)):e=null,e===null)throw Ga(t);return Dm(e)?t.lanes=32:t.lanes=536870912,null}var s=r.children;return r=r.fallback,a?(Oa(t),a=t.mode,s=Yc({mode:"hidden",children:s},a),r=Ao(r,a,n,null),s.return=t,r.return=t,s.sibling=r,t.child=s,r=t.child,r.memoizedState=Nf(n),r.childLanes=Mf(e,i,n),t.memoizedState=Tf,Ll(null,r)):(Ma(t),Sm(t,s))}var c=e.memoizedState;if(c!==null&&(s=c.dehydrated,s!==null)){if(o)t.flags&256?(Ma(t),t.flags&=-257,t=Of(e,t,n)):t.memoizedState!==null?(Oa(t),t.child=e.child,t.flags|=128,t=null):(Oa(t),s=r.fallback,a=t.mode,r=Yc({mode:"visible",children:r.children},a),s=Ao(s,a,n,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,Mo(t,e.child,null,n),r=t.child,r.memoizedState=Nf(n),r.childLanes=Mf(e,i,n),t.memoizedState=Tf,t=Ll(null,r));else if(Ma(t),Dm(s)){if(i=s.nextSibling&&s.nextSibling.dataset,i)var u=i.dgst;i=u,r=Error(L(419)),r.stack="",r.digest=i,Jl({value:r,source:null,stack:null}),t=Of(e,t,n)}else if(Lt||Wi(e,t,n,!1),i=(n&e.childLanes)!==0,Lt||i){if(i=rt,i!==null&&(r=qv(i,n),r!==0&&r!==c.retryLane))throw c.retryLane=r,zo(e,r),hn(i,e,r),bp;Lm(s)||Zc(),t=Of(e,t,n)}else Lm(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ft=Wn(s.nextSibling),Xt=t,je=!0,Ua=null,Gn=!1,e!==null&&bb(t,e),t=Sm(t,r.children),t.flags|=4096);return t}return a?(Oa(t),s=r.fallback,a=t.mode,c=e.child,u=c.sibling,r=ra(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,u!==null?s=ra(u,s):(s=Ao(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,Ll(null,r),r=t.child,s=e.child.memoizedState,s===null?s=Nf(n):(a=s.cachePool,a!==null?(c=kt._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=Sb(),s={baseLanes:s.baseLanes|n,cachePool:a}),r.memoizedState=s,r.childLanes=Mf(e,i,n),t.memoizedState=Tf,Ll(e.child,r)):(Ma(t),n=e.child,e=n.sibling,n=ra(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Sm(e,t){return t=Yc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Yc(e,t){return e=Tn(22,e,null,t),e.lanes=0,e}function Of(e,t,n){return Mo(t,e.child,null,n),e=Sm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zy(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),sm(e.return,t,n)}function _f(e,t,n,r,a,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a,i.treeForkCount=o)}function p0(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;r=r.children;var i=Rt.current,s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,lt(Rt,i),Wt(e,t,r,n),r=je?Zl:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zy(e,n,t);else if(e.tag===19)Zy(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&$c(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),_f(t,!1,a,n,o,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&$c(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}_f(t,!0,n,null,o,r);break;case"together":_f(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function ca(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wa|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Wi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=ra(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ra(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Vc(e)))}function xT(e,t,n){switch(t.tag){case 3:Dc(t,t.stateNode.containerInfo),Na(t,kt,e.memoizedState.cache),To();break;case 27:case 5:Wf(t);break;case 4:Dc(t,t.stateNode.containerInfo);break;case 10:Na(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,pm(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Ma(t),t.flags|=128,null):(n&t.child.childLanes)!==0?m0(e,t,n):(Ma(t),e=ca(e,t,n),e!==null?e.sibling:null);Ma(t);break;case 19:var a=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Wi(e,t,n,!1),r=(n&t.childLanes)!==0),a){if(r)return p0(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),lt(Rt,Rt.current),r)break;return null;case 22:return t.lanes=0,f0(e,t,n,t.pendingProps);case 24:Na(t,kt,e.memoizedState.cache)}return ca(e,t,n)}function g0(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Lt=!0;else{if(!xp(e,n)&&(t.flags&128)===0)return Lt=!1,xT(e,t,n);Lt=(e.flags&131072)!==0}else Lt=!1,je&&(t.flags&1048576)!==0&&vb(t,Zl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=xo(t.elementType),t.type=e,typeof e=="function")Zm(e)?(r=_o(e,r),t.tag=1,t=Qy(null,t,e,r,n)):(t.tag=0,t=xm(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===Um){t.tag=11,t=Ky(null,t,e,r,n);break e}else if(a===jm){t.tag=14,t=Fy(null,t,e,r,n);break e}}throw t=Gf(e)||e,Error(L(306,t,""))}}return t;case 0:return xm(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_o(r,t.pendingProps),Qy(e,t,r,a,n);case 3:e:{if(Dc(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,dm(e,t),Vl(t,r,null,n);var i=t.memoizedState;if(r=i.cache,Na(t,kt,r),r!==o.cache&&cm(t,[kt],n,!0),Pl(),r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Xy(e,t,r,n);break e}else if(r!==a){a=Fn(Error(L(424)),t),Jl(a),t=Xy(e,t,r,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,ft=Wn(e.firstChild),Xt=t,je=!0,Ua=null,Gn=!0,n=Cb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(To(),r===a){t=ca(e,t,n);break e}Wt(e,t,r,n)}t=t.child}return t;case 26:return Tc(e,t),e===null?(n=xv(t.type,null,t.pendingProps,null))?t.memoizedState=n:je||(n=t.type,e=t.pendingProps,r=nu(Ia.current).createElement(n),r[Qt]=t,r[yn]=e,Jt(r,n,e),$t(r),t.stateNode=r):t.memoizedState=xv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Wf(t),e===null&&je&&(r=t.stateNode=ox(t.type,t.pendingProps,Ia.current),Xt=t,Gn=!0,a=ft,Xa(t.type)?(zm=a,ft=Wn(r.firstChild)):ft=a),Wt(e,t,t.pendingProps.children,n),Tc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&je&&((a=r=ft)&&(r=YT(r,t.type,t.pendingProps,Gn),r!==null?(t.stateNode=r,Xt=t,ft=Wn(r.firstChild),Gn=!1,a=!0):a=!1),a||Ga(t)),Wf(t),a=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,r=o.children,_m(a,o)?r=null:i!==null&&_m(a,i)&&(t.flags|=32),t.memoizedState!==null&&(a=lp(e,t,dT,null,null,n),os._currentValue=a),Tc(e,t),Wt(e,t,r,n),t.child;case 6:return e===null&&je&&((e=n=ft)&&(n=WT(n,t.pendingProps,Gn),n!==null?(t.stateNode=n,Xt=t,ft=null,e=!0):e=!1),e||Ga(t)),null;case 13:return m0(e,t,n);case 4:return Dc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Mo(t,null,r,n):Wt(e,t,r,n),t.child;case 11:return Ky(e,t,t.type,t.pendingProps,n);case 7:return Wt(e,t,t.pendingProps,n),t.child;case 8:return Wt(e,t,t.pendingProps.children,n),t.child;case 12:return Wt(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Na(t,t.type,r.value),Wt(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,No(t),a=Zt(a),r=r(a),t.flags|=1,Wt(e,t,r,n),t.child;case 14:return Fy(e,t,t.type,t.pendingProps,n);case 15:return d0(e,t,t.type,t.pendingProps,n);case 19:return p0(e,t,n);case 31:return bT(e,t,n);case 22:return f0(e,t,n,t.pendingProps);case 24:return No(t),r=Zt(kt),e===null?(a=np(),a===null&&(a=rt,o=tp(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ap(t),Na(t,kt,a)):((e.lanes&n)!==0&&(dm(e,t),Vl(t,null,null,n),Pl()),a=e.memoizedState,o=t.memoizedState,a.parent!==r?(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Na(t,kt,r)):(r=o.cache,Na(t,kt,r),r!==a.cache&&cm(t,[kt],n,!0))),Wt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Yr(e){e.flags|=4}function kf(e,t,n,r,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(j0())e.flags|=8192;else throw Ro=Hc,rp}else e.flags&=-16777217}function Jy(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!sx(t))if(j0())e.flags|=8192;else throw Ro=Hc,rp}function dc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Pv():536870912,e.lanes|=t,Hi|=t)}function El(e,t){if(!je)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 dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&65011712,r|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ST(e,t,n){var r=t.pendingProps;switch(ep(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return dt(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),aa(kt),Bi(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(mi(t)?Yr(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Af())),dt(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Yr(t),o!==null?(dt(t),Jy(t,o)):(dt(t),kf(t,a,null,r,n))):o?o!==e.memoizedState?(Yr(t),dt(t),Jy(t,o)):(dt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Yr(t),dt(t),kf(t,a,e,r,n)),null;case 27:if(zc(t),n=Ia.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return dt(t),null}e=Tr.current,mi(t)?Ny(t,e):(e=ox(a,r,n),t.stateNode=e,Yr(t))}return dt(t),null;case 5:if(zc(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return dt(t),null}if(o=Tr.current,mi(t))Ny(t,o);else{var i=nu(Ia.current);switch(o){case 1:o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":o=i.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof r.is=="string"?i.createElement("select",{is:r.is}):i.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is=="string"?i.createElement(a,{is:r.is}):i.createElement(a)}}o[Qt]=t,o[yn]=r;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)o.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=o;e:switch(Jt(o,a,r),a){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Yr(t)}}return dt(t),kf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Ia.current,mi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Xt,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Qt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||tx(e.nodeValue,n)),e||Ga(t,!0)}else e=nu(e).createTextNode(r),e[Qt]=t,t.stateNode=e}return dt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=mi(t),n!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Qt]=t}else To(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),e=!1}else n=Af(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(En(t),t):(En(t),null);if((t.flags&128)!==0)throw Error(L(558))}return dt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=mi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(L(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(L(317));a[Qt]=t}else To(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),a=!1}else a=Af(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(En(t),t):(En(t),null)}return En(t),(t.flags&128)!==0?(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),dc(t,t.updateQueue),dt(t),null);case 4:return Bi(),e===null&&Tp(t.stateNode.containerInfo),dt(t),null;case 10:return aa(t.type),dt(t),null;case 19:if(Kt(Rt),r=t.memoizedState,r===null)return dt(t),null;if(a=(t.flags&128)!==0,o=r.rendering,o===null)if(a)El(r,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=$c(e),o!==null){for(t.flags|=128,El(r,!1),e=o.updateQueue,t.updateQueue=e,dc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)hb(n,e),n=n.sibling;return lt(Rt,Rt.current&1|2),je&&Zr(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Mn()>Qc&&(t.flags|=128,a=!0,El(r,!1),t.lanes=4194304)}else{if(!a)if(e=$c(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,dc(t,e),El(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!je)return dt(t),null}else 2*Mn()-r.renderingStartTime>Qc&&n!==536870912&&(t.flags|=128,a=!0,El(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e!==null?e.sibling=o:t.child=o,r.last=o)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Mn(),e.sibling=null,n=Rt.current,lt(Rt,a?n&1|2:n&1),je&&Zr(t,r.treeForkCount),e):(dt(t),null);case 22:case 23:return En(t),op(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),n=t.updateQueue,n!==null&&dc(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&&Kt(Co),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),aa(kt),dt(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function wT(e,t){switch(ep(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return aa(kt),Bi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zc(t),null;case 31:if(t.memoizedState!==null){if(En(t),t.alternate===null)throw Error(L(340));To()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(En(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));To()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kt(Rt),null;case 4:return Bi(),null;case 10:return aa(t.type),null;case 22:case 23:return En(t),op(),e!==null&&Kt(Co),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return aa(kt),null;case 25:return null;default:return null}}function h0(e,t){switch(ep(t),t.tag){case 3:aa(kt),Bi();break;case 26:case 27:case 5:zc(t);break;case 4:Bi();break;case 31:t.memoizedState!==null&&En(t);break;case 13:En(t);break;case 19:Kt(Rt);break;case 10:aa(t.type);break;case 22:case 23:En(t),op(),e!==null&&Kt(Co);break;case 24:aa(kt)}}function hs(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var o=n.create,i=n.inst;r=o(),i.destroy=r}n=n.next}while(n!==a)}}catch(s){Qe(t,t.return,s)}}function Ya(e,t,n){try{var r=t.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var o=a.next;r=o;do{if((r.tag&e)===e){var i=r.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,a=t;var c=n,u=s;try{u()}catch(f){Qe(a,c,f)}}}r=r.next}while(r!==o)}}catch(f){Qe(t,t.return,f)}}function y0(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eb(t,n)}catch(r){Qe(e,e.return,r)}}}function v0(e,t,n){n.props=_o(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Qe(e,t,r)}}function ql(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(a){Qe(e,t,a)}}function Er(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(a){Qe(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){Qe(e,t,a)}else n.current=null}function b0(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){Qe(e,e.return,a)}}function Lf(e,t,n){try{var r=e.stateNode;HT(r,e.type,n,t),r[yn]=t}catch(a){Qe(e,e.return,a)}}function x0(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Xa(e.type)||e.tag===4}function Df(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||x0(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&&Xa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wm(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=ta));else if(r!==4&&(r===27&&Xa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(wm(e,t,n),e=e.sibling;e!==null;)wm(e,t,n),e=e.sibling}function Wc(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&&Xa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function S0(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Jt(t,r,n),t[Qt]=e,t[yn]=n}catch(o){Qe(e,e.return,o)}}var Jr=!1,_t=!1,zf=!1,ev=typeof WeakSet=="function"?WeakSet:Set,qt=null;function AT(e,t){if(e=e.containerInfo,Mm=iu,e=sb(e),Wm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{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 e}var i=0,s=-1,c=-1,u=0,f=0,d=e,p=null;t:for(;;){for(var m;d!==n||a!==0&&d.nodeType!==3||(s=i+a),d!==o||r!==0&&d.nodeType!==3||(c=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===n&&++u===a&&(s=i),p===o&&++f===r&&(c=i),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}n=s===-1||c===-1?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Om={focusedElem:e,selectionRange:n},iu=!1,qt=t;qt!==null;)if(t=qt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,qt=e;else for(;qt!==null;){switch(t=qt,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,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)!==0&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var b=_o(n.type,a);e=r.getSnapshotBeforeUpdate(b,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(g){Qe(n,n.return,g)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)km(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":km(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,qt=e;break}qt=t.return}}function w0(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Qr(e,n),r&4&&hs(5,n);break;case 1:if(Qr(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Qe(n,n.return,i)}else{var a=_o(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Qe(n,n.return,i)}}r&64&&y0(n),r&512&&ql(n,n.return);break;case 3:if(Qr(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{Eb(e,t)}catch(i){Qe(n,n.return,i)}}break;case 27:t===null&&r&4&&S0(n);case 26:case 5:Qr(e,n),t===null&&r&4&&b0(n),r&512&&ql(n,n.return);break;case 12:Qr(e,n);break;case 31:Qr(e,n),r&4&&R0(e,n);break;case 13:Qr(e,n),r&4&&E0(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=kT.bind(null,n),QT(e,n))));break;case 22:if(r=n.memoizedState!==null||Jr,!r){t=t!==null&&t.memoizedState!==null||_t,a=Jr;var o=_t;Jr=r,(_t=t)&&!o?Xr(e,n,(n.subtreeFlags&8772)!==0):Qr(e,n),Jr=a,_t=o}break;case 30:break;default:Qr(e,n)}}function A0(e){var t=e.alternate;t!==null&&(e.alternate=null,A0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&qm(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 bt=null,pn=!1;function Wr(e,t,n){for(n=n.child;n!==null;)C0(e,t,n),n=n.sibling}function C0(e,t,n){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(cs,n)}catch{}switch(n.tag){case 26:_t||Er(n,t),Wr(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:_t||Er(n,t);var r=bt,a=pn;Xa(n.type)&&(bt=n.stateNode,pn=!1),Wr(e,t,n),Gl(n.stateNode),bt=r,pn=a;break;case 5:_t||Er(n,t);case 6:if(r=bt,a=pn,bt=null,Wr(e,t,n),bt=r,pn=a,bt!==null)if(pn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(n.stateNode)}catch(o){Qe(n,t,o)}else try{bt.removeChild(n.stateNode)}catch(o){Qe(n,t,o)}break;case 18:bt!==null&&(pn?(e=bt,gv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Fi(e)):gv(bt,n.stateNode));break;case 4:r=bt,a=pn,bt=n.stateNode.containerInfo,pn=!0,Wr(e,t,n),bt=r,pn=a;break;case 0:case 11:case 14:case 15:Ya(2,n,t),_t||Ya(4,n,t),Wr(e,t,n);break;case 1:_t||(Er(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&v0(n,t,r)),Wr(e,t,n);break;case 21:Wr(e,t,n);break;case 22:_t=(r=_t)||n.memoizedState!==null,Wr(e,t,n),_t=r;break;default:Wr(e,t,n)}}function R0(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fi(e)}catch(n){Qe(t,t.return,n)}}}function E0(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fi(e)}catch(n){Qe(t,t.return,n)}}function CT(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ev),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ev),t;default:throw Error(L(435,e.tag))}}function fc(e,t){var n=CT(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var a=LT.bind(null,e,r);r.then(a,a)}})}function fn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,i=t,s=i;e:for(;s!==null;){switch(s.tag){case 27:if(Xa(s.type)){bt=s.stateNode,pn=!1;break e}break;case 5:bt=s.stateNode,pn=!1;break e;case 3:case 4:bt=s.stateNode.containerInfo,pn=!0;break e}s=s.return}if(bt===null)throw Error(L(160));C0(o,i,a),bt=null,pn=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)T0(t,e),t=t.sibling}var dr=null;function T0(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(t,e),mn(e),r&4&&(Ya(3,e,e.return),hs(3,e),Ya(5,e,e.return));break;case 1:fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),r&64&&Jr&&(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=dr;if(fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),r&4){var o=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(r){case"title":o=a.getElementsByTagName("title")[0],(!o||o[fs]||o[Qt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector("head > title"))),Jt(o,r,n),o[Qt]=e,$t(o),r=o;break e;case"link":var i=wv("link","href",a).get(r+(n.href||""));if(i){for(var s=0;s<i.length;s++)if(o=i[s],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)){i.splice(s,1);break t}}o=a.createElement(r),Jt(o,r,n),a.head.appendChild(o);break;case"meta":if(i=wv("meta","content",a).get(r+(n.content||""))){for(s=0;s<i.length;s++)if(o=i[s],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)){i.splice(s,1);break t}}o=a.createElement(r),Jt(o,r,n),a.head.appendChild(o);break;default:throw Error(L(468,r))}o[Qt]=e,$t(o),r=o}e.stateNode=r}else Av(a,e.type,e.stateNode);else e.stateNode=Sv(a,r,e.memoizedProps);else o!==r?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Av(a,e.type,e.stateNode):Sv(a,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Lf(e,e.memoizedProps,n.memoizedProps)}break;case 27:fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),n!==null&&r&4&&Lf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),e.flags&32){a=e.stateNode;try{Ui(a,"")}catch(b){Qe(e,e.return,b)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Lf(e,a,n!==null?n.memoizedProps:a)),r&1024&&(zf=!0);break;case 6:if(fn(t,e),mn(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(b){Qe(e,e.return,b)}}break;case 3:if(Oc=null,a=dr,dr=ru(t.containerInfo),fn(t,e),dr=a,mn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fi(t.containerInfo)}catch(b){Qe(e,e.return,b)}zf&&(zf=!1,N0(e));break;case 4:r=dr,dr=ru(e.stateNode.containerInfo),fn(t,e),mn(e),dr=r;break;case 12:fn(t,e),mn(e);break;case 31:fn(t,e),mn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fc(e,r)));break;case 13:fn(t,e),mn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(bu=Mn()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fc(e,r)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Jr,f=_t;if(Jr=u||a,_t=f||c,fn(t,e),_t=f,Jr=u,mn(e),r&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Jr||_t||So(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(o=c.stateNode,a)i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{s=c.stateNode;var d=c.memoizedProps.style,p=d!=null&&d.hasOwnProperty("display")?d.display:null;s.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(b){Qe(c,c.return,b)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(b){Qe(c,c.return,b)}}}else if(t.tag===18){if(n===null){c=t;try{var m=c.stateNode;a?hv(m,!0):hv(c.stateNode,!1)}catch(b){Qe(c,c.return,b)}}}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 e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;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,fc(e,n))));break;case 19:fn(t,e),mn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fc(e,r)));break;case 30:break;case 21:break;default:fn(t,e),mn(e)}}function mn(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(x0(r)){n=r;break}r=r.return}if(n==null)throw Error(L(160));switch(n.tag){case 27:var a=n.stateNode,o=Df(e);Wc(e,o,a);break;case 5:var i=n.stateNode;n.flags&32&&(Ui(i,""),n.flags&=-33);var s=Df(e);Wc(e,s,i);break;case 3:case 4:var c=n.stateNode.containerInfo,u=Df(e);wm(e,u,c);break;default:throw Error(L(161))}}catch(f){Qe(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function N0(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;N0(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Qr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)w0(e,t.alternate,t),t=t.sibling}function So(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ya(4,t,t.return),So(t);break;case 1:Er(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&v0(t,t.return,n),So(t);break;case 27:Gl(t.stateNode);case 26:case 5:Er(t,t.return),So(t);break;case 22:t.memoizedState===null&&So(t);break;case 30:So(t);break;default:So(t)}e=e.sibling}}function Xr(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,a=e,o=t,i=o.flags;switch(o.tag){case 0:case 11:case 15:Xr(a,o,n),hs(4,o);break;case 1:if(Xr(a,o,n),r=o,a=r.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(u){Qe(r,r.return,u)}if(r=o,a=r.updateQueue,a!==null){var s=r.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)Rb(c[a],s)}catch(u){Qe(r,r.return,u)}}n&&i&64&&y0(o),ql(o,o.return);break;case 27:S0(o);case 26:case 5:Xr(a,o,n),n&&r===null&&i&4&&b0(o),ql(o,o.return);break;case 12:Xr(a,o,n);break;case 31:Xr(a,o,n),n&&i&4&&R0(a,o);break;case 13:Xr(a,o,n),n&&i&4&&E0(a,o);break;case 22:o.memoizedState===null&&Xr(a,o,n),ql(o,o.return);break;case 30:break;default:Xr(a,o,n)}t=t.sibling}}function Sp(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&&ps(n))}function wp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ps(e))}function ur(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)M0(e,t,n,r),t=t.sibling}function M0(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:ur(e,t,n,r),a&2048&&hs(9,t);break;case 1:ur(e,t,n,r);break;case 3:ur(e,t,n,r),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ps(e)));break;case 12:if(a&2048){ur(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,i=o.id,s=o.onPostCommit;typeof s=="function"&&s(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Qe(t,t.return,c)}}else ur(e,t,n,r);break;case 31:ur(e,t,n,r);break;case 13:ur(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,i=t.alternate,t.memoizedState!==null?o._visibility&2?ur(e,t,n,r):$l(e,t):o._visibility&2?ur(e,t,n,r):(o._visibility|=2,gi(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),a&2048&&Sp(i,t);break;case 24:ur(e,t,n,r),a&2048&&wp(t.alternate,t);break;default:ur(e,t,n,r)}}function gi(e,t,n,r,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,i=t,s=n,c=r,u=i.flags;switch(i.tag){case 0:case 11:case 15:gi(o,i,s,c,a),hs(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?gi(o,i,s,c,a):$l(o,i):(f._visibility|=2,gi(o,i,s,c,a)),a&&u&2048&&Sp(i.alternate,i);break;case 24:gi(o,i,s,c,a),a&&u&2048&&wp(i.alternate,i);break;default:gi(o,i,s,c,a)}t=t.sibling}}function $l(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:$l(n,r),a&2048&&Sp(r.alternate,r);break;case 24:$l(n,r),a&2048&&wp(r.alternate,r);break;default:$l(n,r)}t=t.sibling}}var Dl=8192;function pi(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)O0(e,t,n),e=e.sibling}function O0(e,t,n){switch(e.tag){case 26:pi(e,t,n),e.flags&Dl&&e.memoizedState!==null&&sN(n,dr,e.memoizedState,e.memoizedProps);break;case 5:pi(e,t,n);break;case 3:case 4:var r=dr;dr=ru(e.stateNode.containerInfo),pi(e,t,n),dr=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,pi(e,t,n),Dl=r):pi(e,t,n));break;default:pi(e,t,n)}}function _0(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 Tl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];qt=r,L0(r,e)}_0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)k0(e),e=e.sibling}function k0(e){switch(e.tag){case 0:case 11:case 15:Tl(e),e.flags&2048&&Ya(9,e,e.return);break;case 3:Tl(e);break;case 12:Tl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nc(e)):Tl(e);break;default:Tl(e)}}function Nc(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];qt=r,L0(r,e)}_0(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ya(8,t,t.return),Nc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nc(t));break;default:Nc(t)}e=e.sibling}}function L0(e,t){for(;qt!==null;){var n=qt;switch(n.tag){case 0:case 11:case 15:Ya(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:ps(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,qt=r;else e:for(n=e;qt!==null;){r=qt;var a=r.sibling,o=r.return;if(A0(r),r===n){qt=null;break e}if(a!==null){a.return=o,qt=a;break e}qt=o}}}var RT={getCacheForType:function(e){var t=Zt(kt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zt(kt).controller.signal}},ET=typeof WeakMap=="function"?WeakMap:Map,Ke=0,rt=null,ze=null,Ie=0,We=0,Rn=null,Da=!1,Xi=!1,Ap=!1,ua=0,At=0,Wa=0,Eo=0,Cp=0,Nn=0,Hi=0,Kl=null,gn=null,Am=!1,bu=0,D0=0,Qc=1/0,Xc=null,Va=null,It=0,Ha=null,qi=null,oa=0,Cm=0,Rm=null,z0=null,Fl=0,Em=null;function kn(){return(Ke&2)!==0&&Ie!==0?Ie&-Ie:ve.T!==null?Ep():$v()}function B0(){if(Nn===0)if((Ie&536870912)===0||je){var e=nc;nc<<=1,(nc&3932160)===0&&(nc=262144),Nn=e}else Nn=536870912;return e=Dn.current,e!==null&&(e.flags|=32),Nn}function hn(e,t,n){(e===rt&&(We===2||We===9)||e.cancelPendingCommit!==null)&&($i(e,0),za(e,Ie,Nn,!1)),ds(e,n),((Ke&2)===0||e!==rt)&&(e===rt&&((Ke&2)===0&&(Eo|=n),At===4&&za(e,Ie,Nn,!1)),Mr(e))}function I0(e,t,n){if((Ke&6)!==0)throw Error(L(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||us(e,t),a=r?MT(e,t):Bf(e,t,!0),o=r;do{if(a===0){Xi&&!r&&za(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!TT(n)){a=Bf(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;a=Kl;var c=s.current.memoizedState.isDehydrated;if(c&&($i(s,i).flags|=256),i=Bf(s,i,!1),i!==2){if(Ap&&!c){s.errorRecoveryDisabledLanes|=o,Eo|=o,a=4;break e}o=gn,gn=a,o!==null&&(gn===null?gn=o:gn.push.apply(gn,o))}a=i}if(o=!1,a!==2)continue}}if(a===1){$i(e,0),za(e,t,0,!0);break}e:{switch(r=e,o=a,o){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:za(r,t,Nn,!Da);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(a=bu+300-Mn(),10<a)){if(za(r,t,Nn,!Da),su(r,0,!0)!==0)break e;oa=t,r.timeoutHandle=rx(tv.bind(null,r,n,gn,Xc,Am,t,Nn,Eo,Hi,Da,o,"Throttled",-0,0),a);break e}tv(r,n,gn,Xc,Am,t,Nn,Eo,Hi,Da,o,null,-0,0)}}break}while(!0);Mr(e)}function tv(e,t,n,r,a,o,i,s,c,u,f,d,p,m){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:ta},O0(t,o,d);var b=(o&62914560)===o?bu-Mn():(o&4194048)===o?D0-Mn():0;if(b=cN(d,b),b!==null){oa=o,e.cancelPendingCommit=b(rv.bind(null,e,t,o,n,r,a,i,s,c,f,d,null,p,m)),za(e,o,i,!u);return}}rv(e,t,o,n,r,a,i,s,c)}function TT(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 a=n[r],o=a.getSnapshot;a=a.value;try{if(!Ln(o(),a))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 za(e,t,n,r){t&=~Cp,t&=~Eo,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var o=31-_n(a),i=1<<o;r[o]=-1,a&=~i}n!==0&&Vv(e,n,t)}function xu(){return(Ke&6)===0?(ys(0,!1),!1):!0}function Rp(){if(ze!==null){if(We===0)var e=ze.return;else e=ze,na=Bo=null,up(e),Li=null,es=0,e=ze;for(;e!==null;)h0(e.alternate,e),e=e.return;ze=null}}function $i(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,KT(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),oa=0,Rp(),rt=e,ze=n=ra(e.current,null),Ie=t,We=0,Rn=null,Da=!1,Xi=us(e,t),Ap=!1,Hi=Nn=Cp=Eo=Wa=At=0,gn=Kl=null,Am=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var a=31-_n(r),o=1<<a;t|=e[a],r&=~o}return ua=t,fu(),n}function U0(e,t){Ce=null,ve.H=ns,t===Qi||t===pu?(t=Ly(),We=3):t===rp?(t=Ly(),We=4):We=t===bp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rn=t,ze===null&&(At=1,Gc(e,Fn(t,e.current)))}function j0(){var e=Dn.current;return e===null?!0:(Ie&4194048)===Ie?Yn===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?e===Yn:!1}function P0(){var e=ve.H;return ve.H=ns,e===null?ns:e}function V0(){var e=ve.A;return ve.A=RT,e}function Zc(){At=4,Da||(Ie&4194048)!==Ie&&Dn.current!==null||(Xi=!0),(Wa&134217727)===0&&(Eo&134217727)===0||rt===null||za(rt,Ie,Nn,!1)}function Bf(e,t,n){var r=Ke;Ke|=2;var a=P0(),o=V0();(rt!==e||Ie!==t)&&(Xc=null,$i(e,t)),t=!1;var i=At;e:do try{if(We!==0&&ze!==null){var s=ze,c=Rn;switch(We){case 8:Rp(),i=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(t=!0);var u=We;if(We=0,Rn=null,Ni(e,s,c,u),n&&Xi){i=0;break e}break;default:u=We,We=0,Rn=null,Ni(e,s,c,u)}}NT(),i=At;break}catch(f){U0(e,f)}while(!0);return t&&e.shellSuspendCounter++,na=Bo=null,Ke=r,ve.H=a,ve.A=o,ze===null&&(rt=null,Ie=0,fu()),i}function NT(){for(;ze!==null;)H0(ze)}function MT(e,t){var n=Ke;Ke|=2;var r=P0(),a=V0();rt!==e||Ie!==t?(Xc=null,Qc=Mn()+500,$i(e,t)):Xi=us(e,t);e:do try{if(We!==0&&ze!==null){t=ze;var o=Rn;t:switch(We){case 1:We=0,Rn=null,Ni(e,t,o,1);break;case 2:case 9:if(ky(o)){We=0,Rn=null,nv(t);break}t=function(){We!==2&&We!==9||rt!==e||(We=7),Mr(e)},o.then(t,t);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:ky(o)?(We=0,Rn=null,nv(t)):(We=0,Rn=null,Ni(e,t,o,7));break;case 5:var i=null;switch(ze.tag){case 26:i=ze.memoizedState;case 5:case 27:var s=ze;if(i?sx(i):s.stateNode.complete){We=0,Rn=null;var c=s.sibling;if(c!==null)ze=c;else{var u=s.return;u!==null?(ze=u,Su(u)):ze=null}break t}}We=0,Rn=null,Ni(e,t,o,5);break;case 6:We=0,Rn=null,Ni(e,t,o,6);break;case 8:Rp(),At=6;break e;default:throw Error(L(462))}}OT();break}catch(f){U0(e,f)}while(!0);return na=Bo=null,ve.H=r,ve.A=a,Ke=n,ze!==null?0:(rt=null,Ie=0,fu(),At)}function OT(){for(;ze!==null&&!JR();)H0(ze)}function H0(e){var t=g0(e.alternate,e,ua);e.memoizedProps=e.pendingProps,t===null?Su(e):ze=t}function nv(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Wy(n,t,t.pendingProps,t.type,void 0,Ie);break;case 11:t=Wy(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:up(t);default:h0(n,t),t=ze=hb(t,ua),t=g0(n,t,ua)}e.memoizedProps=e.pendingProps,t===null?Su(e):ze=t}function Ni(e,t,n,r){na=Bo=null,up(t),Li=null,es=0;var a=t.return;try{if(vT(e,a,t,n,Ie)){At=1,Gc(e,Fn(n,e.current)),ze=null;return}}catch(o){if(a!==null)throw ze=a,o;At=1,Gc(e,Fn(n,e.current)),ze=null;return}t.flags&32768?(je||r===1?e=!0:Xi||(Ie&536870912)!==0?e=!1:(Da=e=!0,(r===2||r===9||r===3||r===6)&&(r=Dn.current,r!==null&&r.tag===13&&(r.flags|=16384))),q0(t,e)):Su(t)}function Su(e){var t=e;do{if((t.flags&32768)!==0){q0(t,Da);return}e=t.return;var n=ST(t.alternate,t,ua);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);At===0&&(At=5)}function q0(e,t){do{var n=wT(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);At=6,ze=null}function rv(e,t,n,r,a,o,i,s,c){e.cancelPendingCommit=null;do wu();while(It!==0);if((Ke&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(o=t.lanes|t.childLanes,o|=Qm,cE(e,n,o,i,s,c),e===rt&&(ze=rt=null,Ie=0),qi=t,Ha=e,oa=n,Cm=o,Rm=a,z0=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,DT(Bc,function(){return Y0(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=ve.T,ve.T=null,a=Fe.p,Fe.p=2,i=Ke,Ke|=4;try{AT(e,t,n)}finally{Ke=i,Fe.p=a,ve.T=r}}It=1,$0(),K0(),F0()}}function $0(){if(It===1){It=0;var e=Ha,t=qi,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=ve.T,ve.T=null;var r=Fe.p;Fe.p=2;var a=Ke;Ke|=4;try{T0(t,e);var o=Om,i=sb(e.containerInfo),s=o.focusedElem,c=o.selectionRange;if(i!==s&&s&&s.ownerDocument&&lb(s.ownerDocument.documentElement,s)){if(c!==null&&Wm(s)){var u=c.start,f=c.end;if(f===void 0&&(f=u),"selectionStart"in s)s.selectionStart=u,s.selectionEnd=Math.min(f,s.value.length);else{var d=s.ownerDocument||document,p=d&&d.defaultView||window;if(p.getSelection){var m=p.getSelection(),b=s.textContent.length,g=Math.min(c.start,b),x=c.end===void 0?g:Math.min(c.end,b);!m.extend&&g>x&&(i=x,x=g,g=i);var y=Ry(s,g),h=Ry(s,x);if(y&&h&&(m.rangeCount!==1||m.anchorNode!==y.node||m.anchorOffset!==y.offset||m.focusNode!==h.node||m.focusOffset!==h.offset)){var v=d.createRange();v.setStart(y.node,y.offset),m.removeAllRanges(),g>x?(m.addRange(v),m.extend(h.node,h.offset)):(v.setEnd(h.node,h.offset),m.addRange(v))}}}}for(d=[],m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<d.length;s++){var S=d[s];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}iu=!!Mm,Om=Mm=null}finally{Ke=a,Fe.p=r,ve.T=n}}e.current=t,It=2}}function K0(){if(It===2){It=0;var e=Ha,t=qi,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=ve.T,ve.T=null;var r=Fe.p;Fe.p=2;var a=Ke;Ke|=4;try{w0(e,t.alternate,t)}finally{Ke=a,Fe.p=r,ve.T=n}}It=3}}function F0(){if(It===4||It===3){It=0,eE();var e=Ha,t=qi,n=oa,r=z0;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?It=5:(It=0,qi=Ha=null,G0(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Va=null),Hm(n),t=t.stateNode,On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(cs,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=ve.T,a=Fe.p,Fe.p=2,ve.T=null;try{for(var o=e.onRecoverableError,i=0;i<r.length;i++){var s=r[i];o(s.value,{componentStack:s.stack})}}finally{ve.T=t,Fe.p=a}}(oa&3)!==0&&wu(),Mr(e),a=e.pendingLanes,(n&261930)!==0&&(a&42)!==0?e===Em?Fl++:(Fl=0,Em=e):Fl=0,ys(0,!1)}}function G0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ps(t)))}function wu(){return $0(),K0(),F0(),Y0()}function Y0(){if(It!==5)return!1;var e=Ha,t=Cm;Cm=0;var n=Hm(oa),r=ve.T,a=Fe.p;try{Fe.p=32>n?32:n,ve.T=null,n=Rm,Rm=null;var o=Ha,i=oa;if(It=0,qi=Ha=null,oa=0,(Ke&6)!==0)throw Error(L(331));var s=Ke;if(Ke|=4,k0(o.current),M0(o,o.current,i,n),Ke=s,ys(0,!1),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(cs,o)}catch{}return!0}finally{Fe.p=a,ve.T=r,G0(e,t)}}function av(e,t,n){t=Fn(n,t),t=bm(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(ds(e,2),Mr(e))}function Qe(e,t,n){if(e.tag===3)av(e,e,n);else for(;t!==null;){if(t.tag===3){av(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Va===null||!Va.has(r))){e=Fn(n,e),n=c0(2),r=Pa(t,n,2),r!==null&&(u0(n,r,t,e),ds(r,2),Mr(r));break}}t=t.return}}function If(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ET;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(Ap=!0,a.add(n),e=_T.bind(null,e,t,n),t.then(e,e))}function _T(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,rt===e&&(Ie&n)===n&&(At===4||At===3&&(Ie&62914560)===Ie&&300>Mn()-bu?(Ke&2)===0&&$i(e,0):Cp|=n,Hi===Ie&&(Hi=0)),Mr(e)}function W0(e,t){t===0&&(t=Pv()),e=zo(e,t),e!==null&&(ds(e,t),Mr(e))}function kT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),W0(e,n)}function LT(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(L(314))}r!==null&&r.delete(t),W0(e,n)}function DT(e,t){return Pm(e,t)}var Jc=null,hi=null,Tm=!1,eu=!1,Uf=!1,Ba=0;function Mr(e){e!==hi&&e.next===null&&(hi===null?Jc=hi=e:hi=hi.next=e),eu=!0,Tm||(Tm=!0,BT())}function ys(e,t){if(!Uf&&eu){Uf=!0;do for(var n=!1,r=Jc;r!==null;){if(!t)if(e!==0){var a=r.pendingLanes;if(a===0)var o=0;else{var i=r.suspendedLanes,s=r.pingedLanes;o=(1<<31-_n(42|e)+1)-1,o&=a&~(i&~s),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,ov(r,o))}else o=Ie,o=su(r,r===rt?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(o&3)===0||us(r,o)||(n=!0,ov(r,o));r=r.next}while(n);Uf=!1}}function zT(){Q0()}function Q0(){eu=Tm=!1;var e=0;Ba!==0&&$T()&&(e=Ba);for(var t=Mn(),n=null,r=Jc;r!==null;){var a=r.next,o=X0(r,t);o===0?(r.next=null,n===null?Jc=a:n.next=a,a===null&&(hi=n)):(n=r,(e!==0||(o&3)!==0)&&(eu=!0)),r=a}It!==0&&It!==5||ys(e,!1),Ba!==0&&(Ba=0)}function X0(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var i=31-_n(o),s=1<<i,c=a[i];c===-1?((s&n)===0||(s&r)!==0)&&(a[i]=sE(s,t)):c<=t&&(e.expiredLanes|=s),o&=~s}if(t=rt,n=Ie,n=su(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(We===2||We===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&mf(r),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||us(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&mf(r),Hm(n)){case 2:case 8:n=Uv;break;case 32:n=Bc;break;case 268435456:n=jv;break;default:n=Bc}return r=Z0.bind(null,e),n=Pm(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&mf(r),e.callbackPriority=2,e.callbackNode=null,2}function Z0(e,t){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(wu()&&e.callbackNode!==n)return null;var r=Ie;return r=su(e,e===rt?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(I0(e,r,t),X0(e,Mn()),e.callbackNode!=null&&e.callbackNode===n?Z0.bind(null,e):null)}function ov(e,t){if(wu())return null;I0(e,t,!0)}function BT(){FT(function(){(Ke&6)!==0?Pm(Iv,zT):Q0()})}function Ep(){if(Ba===0){var e=ji;e===0&&(e=tc,tc<<=1,(tc&261888)===0&&(tc=256)),Ba=e}return Ba}function iv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bc(""+e)}function lv(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 IT(e,t,n,r,a){if(t==="submit"&&n&&n.stateNode===a){var o=iv((a[yn]||null).action),i=r.submitter;i&&(t=(t=i[yn]||null)?iv(t.formAction):i.getAttribute("formAction"),t!==null&&(o=t,i=null));var s=new cu("action","action",null,r,a);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ba!==0){var c=i?lv(a,i):new FormData(a);ym(n,{pending:!0,data:c,method:a.method,action:o},null,c)}}else typeof o=="function"&&(s.preventDefault(),c=i?lv(a,i):new FormData(a),ym(n,{pending:!0,data:c,method:a.method,action:o},o,c))},currentTarget:a}]})}}for(mc=0;mc<om.length;mc++)pc=om[mc],sv=pc.toLowerCase(),cv=pc[0].toUpperCase()+pc.slice(1),fr(sv,"on"+cv);var pc,sv,cv,mc;fr(ub,"onAnimationEnd");fr(db,"onAnimationIteration");fr(fb,"onAnimationStart");fr("dblclick","onDoubleClick");fr("focusin","onFocus");fr("focusout","onBlur");fr(tT,"onTransitionRun");fr(nT,"onTransitionStart");fr(rT,"onTransitionCancel");fr(mb,"onTransitionEnd");Ii("onMouseEnter",["mouseout","mouseover"]);Ii("onMouseLeave",["mouseout","mouseover"]);Ii("onPointerEnter",["pointerout","pointerover"]);Ii("onPointerLeave",["pointerout","pointerover"]);ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ko("onBeforeInput",["compositionend","keypress","textInput","paste"]);ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rs="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(" "),UT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rs));function J0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],c=s.instance,u=s.currentTarget;if(s=s.listener,c!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=u;try{o(a)}catch(f){Uc(f)}a.currentTarget=null,o=c}else for(i=0;i<r.length;i++){if(s=r[i],c=s.instance,u=s.currentTarget,s=s.listener,c!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=u;try{o(a)}catch(f){Uc(f)}a.currentTarget=null,o=c}}}}function De(e,t){var n=t[Xf];n===void 0&&(n=t[Xf]=new Set);var r=e+"__bubble";n.has(r)||(ex(t,e,2,!1),n.add(r))}function jf(e,t,n){var r=0;t&&(r|=4),ex(n,e,r,t)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Tp(e){if(!e[gc]){e[gc]=!0,Kv.forEach(function(n){n!=="selectionchange"&&(UT.has(n)||jf(n,!1,e),jf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gc]||(t[gc]=!0,jf("selectionchange",!1,t))}}function ex(e,t,n,r){switch(mx(t)){case 2:var a=fN;break;case 8:a=mN;break;default:a=_p}n=a.bind(null,t,n,e),a=void 0,!nm||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Pf(e,t,n,r,a){var o=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var s=r.stateNode.containerInfo;if(s===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===a)return;i=i.return}for(;s!==null;){if(i=bi(s),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){r=o=i;continue e}s=s.parentNode}}r=r.return}Jv(function(){var u=o,f=Km(n),d=[];e:{var p=pb.get(e);if(p!==void 0){var m=cu,b=e;switch(e){case"keypress":if(Sc(n)===0)break e;case"keydown":case"keyup":m=LE;break;case"focusin":b="focus",m=vf;break;case"focusout":b="blur",m=vf;break;case"beforeblur":case"afterblur":m=vf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=hy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=SE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=BE;break;case ub:case db:case fb:m=CE;break;case mb:m=UE;break;case"scroll":case"scrollend":m=bE;break;case"wheel":m=PE;break;case"copy":case"cut":case"paste":m=EE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=vy;break;case"toggle":case"beforetoggle":m=HE}var g=(t&4)!==0,x=!g&&(e==="scroll"||e==="scrollend"),y=g?p!==null?p+"Capture":null:p;g=[];for(var h=u,v;h!==null;){var S=h;if(v=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||v===null||y===null||(S=Wl(h,y),S!=null&&g.push(as(h,S,v))),x)break;h=h.return}0<g.length&&(p=new m(p,b,null,n,f),d.push({event:p,listeners:g}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==tm&&(b=n.relatedTarget||n.fromElement)&&(bi(b)||b[Gi]))break e;if((m||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=u,b=b?bi(b):null,b!==null&&(x=ss(b),g=b.tag,b!==x||g!==5&&g!==27&&g!==6)&&(b=null)):(m=null,b=u),m!==b)){if(g=hy,S="onMouseLeave",y="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(g=vy,S="onPointerLeave",y="onPointerEnter",h="pointer"),x=m==null?p:kl(m),v=b==null?p:kl(b),p=new g(S,h+"leave",m,n,f),p.target=x,p.relatedTarget=v,S=null,bi(f)===u&&(g=new g(y,h+"enter",b,n,f),g.target=v,g.relatedTarget=x,S=g),x=S,m&&b)t:{for(g=jT,y=m,h=b,v=0,S=y;S;S=g(S))v++;S=0;for(var C=h;C;C=g(C))S++;for(;0<v-S;)y=g(y),v--;for(;0<S-v;)h=g(h),S--;for(;v--;){if(y===h||h!==null&&y===h.alternate){g=y;break t}y=g(y),h=g(h)}g=null}else g=null;m!==null&&uv(d,p,m,g,!1),b!==null&&x!==null&&uv(d,x,b,g,!0)}}e:{if(p=u?kl(u):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var T=wy;else if(Sy(p))if(ob)T=ZE;else{T=QE;var w=WE}else m=p.nodeName,!m||m.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?u&&$m(u.elementType)&&(T=wy):T=XE;if(T&&(T=T(e,u))){ab(d,T,n,f);break e}w&&w(e,p,u),e==="focusout"&&u&&p.type==="number"&&u.memoizedProps.value!=null&&em(p,"number",p.value)}switch(w=u?kl(u):window,e){case"focusin":(Sy(w)||w.contentEditable==="true")&&(wi=w,rm=u,Il=null);break;case"focusout":Il=rm=wi=null;break;case"mousedown":am=!0;break;case"contextmenu":case"mouseup":case"dragend":am=!1,Ey(d,n,f);break;case"selectionchange":if(eT)break;case"keydown":case"keyup":Ey(d,n,f)}var R;if(Ym)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Si?nb(e,n)&&(M="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(tb&&n.locale!=="ko"&&(Si||M!=="onCompositionStart"?M==="onCompositionEnd"&&Si&&(R=eb()):(La=f,Fm="value"in La?La.value:La.textContent,Si=!0)),w=tu(u,M),0<w.length&&(M=new yy(M,e,null,n,f),d.push({event:M,listeners:w}),R?M.data=R:(R=rb(n),R!==null&&(M.data=R)))),(R=$E?KE(e,n):FE(e,n))&&(M=tu(u,"onBeforeInput"),0<M.length&&(w=new yy("onBeforeInput","beforeinput",null,n,f),d.push({event:w,listeners:M}),w.data=R)),IT(d,e,u,n,f)}J0(d,t)})}function as(e,t,n){return{instance:e,listener:t,currentTarget:n}}function tu(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,o=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||o===null||(a=Wl(e,n),a!=null&&r.unshift(as(e,a,o)),a=Wl(e,t),a!=null&&r.push(as(e,a,o))),e.tag===3)return r;e=e.return}return[]}function jT(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function uv(e,t,n,r,a){for(var o=t._reactName,i=[];n!==null&&n!==r;){var s=n,c=s.alternate,u=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||u===null||(c=u,a?(u=Wl(n,o),u!=null&&i.unshift(as(n,u,c))):a||(u=Wl(n,o),u!=null&&i.push(as(n,u,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var PT=/\r\n?/g,VT=/\u0000|\uFFFD/g;function dv(e){return(typeof e=="string"?e:""+e).replace(PT,`
9
- `).replace(VT,"")}function tx(e,t){return t=dv(t),dv(e)===t}function Je(e,t,n,r,a,o){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Ui(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Ui(e,""+r);break;case"className":ac(e,"class",r);break;case"tabIndex":ac(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":ac(e,n,r);break;case"style":Zv(e,r,o);break;case"data":if(t!=="object"){ac(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=bc(""+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"&&Je(e,t,"name",a.name,a,null),Je(e,t,"formEncType",a.formEncType,a,null),Je(e,t,"formMethod",a.formMethod,a,null),Je(e,t,"formTarget",a.formTarget,a,null)):(Je(e,t,"encType",a.encType,a,null),Je(e,t,"method",a.method,a,null),Je(e,t,"target",a.target,a,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=bc(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=ta);break;case"onScroll":r!=null&&De("scroll",e);break;case"onScrollEnd":r!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(L(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=bc(""+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":r===!0?e.setAttribute(n,""):r!==!1&&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":De("beforetoggle",e),De("toggle",e),vc(e,"popover",r);break;case"xlinkActuate":Gr(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Gr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Gr(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Gr(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Gr(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Gr(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":vc(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=yE.get(n)||n,vc(e,n,r))}}function Nm(e,t,n,r,a,o){switch(n){case"style":Zv(e,r,o);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(L(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Ui(e,r):(typeof r=="number"||typeof r=="bigint")&&Ui(e,""+r);break;case"onScroll":r!=null&&De("scroll",e);break;case"onScrollEnd":r!=null&&De("scrollend",e);break;case"onClick":r!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fv.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),o=e[yn]||null,o=o!=null?o[n]:null,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 e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):vc(e,n,r)}}}function Jt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var i=n[o];if(i!=null)switch(o){case"src":r=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Je(e,t,o,i,n,null)}}a&&Je(e,t,"srcSet",n.srcSet,n,null),r&&Je(e,t,"src",n.src,n,null);return;case"input":De("invalid",e);var s=o=i=a=null,c=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"name":a=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":u=f;break;case"value":o=f;break;case"defaultValue":s=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Je(e,t,r,f,n,null)}}Wv(e,o,s,c,u,i,a,!1);return;case"select":De("invalid",e),r=i=o=null;for(a in n)if(n.hasOwnProperty(a)&&(s=n[a],s!=null))switch(a){case"value":o=s;break;case"defaultValue":i=s;break;case"multiple":r=s;default:Je(e,t,a,s,n,null)}t=o,n=i,e.multiple=!!r,t!=null?Oi(e,!!r,t,!1):n!=null&&Oi(e,!!r,n,!0);return;case"textarea":De("invalid",e),o=a=r=null;for(i in n)if(n.hasOwnProperty(i)&&(s=n[i],s!=null))switch(i){case"value":r=s;break;case"defaultValue":a=s;break;case"children":o=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(L(91));break;default:Je(e,t,i,s,n,null)}Xv(e,r,a,o);return;case"option":for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Je(e,t,c,r,n,null));return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(r=0;r<rs.length;r++)De(rs[r],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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(L(137,t));default:Je(e,t,u,r,n,null)}return;default:if($m(t)){for(f in n)n.hasOwnProperty(f)&&(r=n[f],r!==void 0&&Nm(e,t,f,r,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(r=n[s],r!=null&&Je(e,t,s,r,n,null))}function HT(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,i=null,s=null,c=null,u=null,f=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":c=d;default:r.hasOwnProperty(m)||Je(e,t,m,null,r,d)}}for(var p in r){var m=r[p];if(d=n[p],r.hasOwnProperty(p)&&(m!=null||d!=null))switch(p){case"type":o=m;break;case"name":a=m;break;case"checked":u=m;break;case"defaultChecked":f=m;break;case"value":i=m;break;case"defaultValue":s=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(L(137,t));break;default:m!==d&&Je(e,t,p,m,r,d)}}Jf(e,i,s,c,u,f,o,a);return;case"select":m=i=s=p=null;for(o in n)if(c=n[o],n.hasOwnProperty(o)&&c!=null)switch(o){case"value":break;case"multiple":m=c;default:r.hasOwnProperty(o)||Je(e,t,o,null,r,c)}for(a in r)if(o=r[a],c=n[a],r.hasOwnProperty(a)&&(o!=null||c!=null))switch(a){case"value":p=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:o!==c&&Je(e,t,a,o,r,c)}t=s,n=i,r=m,p!=null?Oi(e,!!n,p,!1):!!r!=!!n&&(t!=null?Oi(e,!!n,t,!0):Oi(e,!!n,n?[]:"",!1));return;case"textarea":m=p=null;for(s in n)if(a=n[s],n.hasOwnProperty(s)&&a!=null&&!r.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:Je(e,t,s,null,r,a)}for(i in r)if(a=r[i],o=n[i],r.hasOwnProperty(i)&&(a!=null||o!=null))switch(i){case"value":p=a;break;case"defaultValue":m=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(L(91));break;default:a!==o&&Je(e,t,i,a,r,o)}Qv(e,p,m);return;case"option":for(var b in n)p=n[b],n.hasOwnProperty(b)&&p!=null&&!r.hasOwnProperty(b)&&(b==="selected"?e.selected=!1:Je(e,t,b,null,r,p));for(c in r)p=r[c],m=n[c],r.hasOwnProperty(c)&&p!==m&&(p!=null||m!=null)&&(c==="selected"?e.selected=p&&typeof p!="function"&&typeof p!="symbol":Je(e,t,c,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)&&Je(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(L(137,t));break;default:Je(e,t,u,p,r,m)}return;default:if($m(t)){for(var x in n)p=n[x],n.hasOwnProperty(x)&&p!==void 0&&!r.hasOwnProperty(x)&&Nm(e,t,x,void 0,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p===void 0&&m===void 0||Nm(e,t,f,p,r,m);return}}for(var y in n)p=n[y],n.hasOwnProperty(y)&&p!=null&&!r.hasOwnProperty(y)&&Je(e,t,y,null,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p==null&&m==null||Je(e,t,d,p,r,m)}function fv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qT(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],o=a.transferSize,i=a.initiatorType,s=a.duration;if(o&&s&&fv(i)){for(i=0,s=a.responseEnd,r+=1;r<n.length;r++){var c=n[r],u=c.startTime;if(u>s)break;var f=c.transferSize,d=c.initiatorType;f&&fv(d)&&(c=c.responseEnd,i+=f*(c<s?1:(s-u)/(c-u)))}if(--r,t+=8*(o+i)/(a.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 Mm=null,Om=null;function nu(e){return e.nodeType===9?e:e.ownerDocument}function mv(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 nx(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 _m(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 Vf=null;function $T(){var e=window.event;return e&&e.type==="popstate"?e===Vf?!1:(Vf=e,!0):(Vf=null,!1)}var rx=typeof setTimeout=="function"?setTimeout:void 0,KT=typeof clearTimeout=="function"?clearTimeout:void 0,pv=typeof Promise=="function"?Promise:void 0,FT=typeof queueMicrotask=="function"?queueMicrotask:typeof pv<"u"?function(e){return pv.resolve(null).then(e).catch(GT)}:rx;function GT(e){setTimeout(function(){throw e})}function Xa(e){return e==="head"}function gv(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(a),Fi(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Gl(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Gl(n);for(var o=n.firstChild;o;){var i=o.nextSibling,s=o.nodeName;o[fs]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=i}}else n==="body"&&Gl(e.ownerDocument.body);n=a}while(n);Fi(t)}function hv(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 km(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":km(n),qm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function YT(e,t,n,r){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[fs])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=Wn(e.nextSibling),e===null)break}return null}function WT(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Wn(e.nextSibling),e===null))return null;return e}function ax(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Wn(e.nextSibling),e===null))return null;return e}function Lm(e){return e.data==="$?"||e.data==="$~"}function Dm(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function QT(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 Wn(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 zm=null;function yv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Wn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function vv(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 ox(e,t,n){switch(t=nu(n),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function Gl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);qm(e)}var Qn=new Map,bv=new Set;function ru(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var da=Fe.d;Fe.d={f:XT,r:ZT,D:JT,C:eN,L:tN,m:nN,X:aN,S:rN,M:oN};function XT(){var e=da.f(),t=xu();return e||t}function ZT(e){var t=Yi(e);t!==null&&t.tag===5&&t.type==="form"?Zb(t):da.r(e)}var Zi=typeof document>"u"?null:document;function ix(e,t,n){var r=Zi;if(r&&typeof t=="string"&&t){var a=Kn(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),bv.has(a)||(bv.add(a),e={rel:e,crossOrigin:n,href:t},r.querySelector(a)===null&&(t=r.createElement("link"),Jt(t,"link",e),$t(t),r.head.appendChild(t)))}}function JT(e){da.D(e),ix("dns-prefetch",e,null)}function eN(e,t){da.C(e,t),ix("preconnect",e,t)}function tN(e,t,n){da.L(e,t,n);var r=Zi;if(r&&e&&t){var a='link[rel="preload"][as="'+Kn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Kn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Kn(n.imageSizes)+'"]')):a+='[href="'+Kn(e)+'"]';var o=a;switch(t){case"style":o=Ki(e);break;case"script":o=Ji(e)}Qn.has(o)||(e=mt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Qn.set(o,e),r.querySelector(a)!==null||t==="style"&&r.querySelector(vs(o))||t==="script"&&r.querySelector(bs(o))||(t=r.createElement("link"),Jt(t,"link",e),$t(t),r.head.appendChild(t)))}}function nN(e,t){da.m(e,t);var n=Zi;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Kn(r)+'"][href="'+Kn(e)+'"]',o=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Ji(e)}if(!Qn.has(o)&&(e=mt({rel:"modulepreload",href:e},t),Qn.set(o,e),n.querySelector(a)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(bs(o)))return}r=n.createElement("link"),Jt(r,"link",e),$t(r),n.head.appendChild(r)}}}function rN(e,t,n){da.S(e,t,n);var r=Zi;if(r&&e){var a=Mi(r).hoistableStyles,o=Ki(e);t=t||"default";var i=a.get(o);if(!i){var s={loading:0,preload:null};if(i=r.querySelector(vs(o)))s.loading=5;else{e=mt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Qn.get(o))&&Np(e,n);var c=i=r.createElement("link");$t(c),Jt(c,"link",e),c._p=new Promise(function(u,f){c.onload=u,c.onerror=f}),c.addEventListener("load",function(){s.loading|=1}),c.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Mc(i,t,r)}i={type:"stylesheet",instance:i,count:1,state:s},a.set(o,i)}}}function aN(e,t){da.X(e,t);var n=Zi;if(n&&e){var r=Mi(n).hoistableScripts,a=Ji(e),o=r.get(a);o||(o=n.querySelector(bs(a)),o||(e=mt({src:e,async:!0},t),(t=Qn.get(a))&&Mp(e,t),o=n.createElement("script"),$t(o),Jt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}}function oN(e,t){da.M(e,t);var n=Zi;if(n&&e){var r=Mi(n).hoistableScripts,a=Ji(e),o=r.get(a);o||(o=n.querySelector(bs(a)),o||(e=mt({src:e,async:!0,type:"module"},t),(t=Qn.get(a))&&Mp(e,t),o=n.createElement("script"),$t(o),Jt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}}function xv(e,t,n,r){var a=(a=Ia.current)?ru(a):null;if(!a)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ki(n.href),n=Mi(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=Ki(n.href);var o=Mi(a).hoistableStyles,i=o.get(e);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,i),(o=a.querySelector(vs(e)))&&!o._p&&(i.instance=o,i.state.loading=5),Qn.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},Qn.set(e,n),o||iN(a,e,n,i.state))),t&&r===null)throw Error(L(528,""));return i}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ji(n),n=Mi(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(L(444,e))}}function Ki(e){return'href="'+Kn(e)+'"'}function vs(e){return'link[rel="stylesheet"]['+e+"]"}function lx(e){return mt({},e,{"data-precedence":e.precedence,precedence:null})}function iN(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}),Jt(t,"link",n),$t(t),e.head.appendChild(t))}function Ji(e){return'[src="'+Kn(e)+'"]'}function bs(e){return"script[async]"+e}function Sv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Kn(n.href)+'"]');if(r)return t.instance=r,$t(r),r;var a=mt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),$t(r),Jt(r,"style",a),Mc(r,n.precedence,e),t.instance=r;case"stylesheet":a=Ki(n.href);var o=e.querySelector(vs(a));if(o)return t.state.loading|=4,t.instance=o,$t(o),o;r=lx(n),(a=Qn.get(a))&&Np(r,a),o=(e.ownerDocument||e).createElement("link"),$t(o);var i=o;return i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Jt(o,"link",r),t.state.loading|=4,Mc(o,n.precedence,e),t.instance=o;case"script":return o=Ji(n.src),(a=e.querySelector(bs(o)))?(t.instance=a,$t(a),a):(r=n,(a=Qn.get(o))&&(r=mt({},n),Mp(r,a)),e=e.ownerDocument||e,a=e.createElement("script"),$t(a),Jt(a,"link",r),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Mc(r,n.precedence,e));return t.instance}function Mc(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,o=a,i=0;i<r.length;i++){var s=r[i];if(s.dataset.precedence===t)o=s;else if(o!==a)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Np(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Mp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oc=null;function wv(e,t,n){if(Oc===null){var r=new Map,a=Oc=new Map;a.set(n,r)}else a=Oc,r=a.get(n),r||(r=new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var o=n[a];if(!(o[fs]||o[Qt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var i=o.getAttribute(t)||"";i=e+i;var s=r.get(i);s?s.push(o):r.set(i,[o])}}return r}function Av(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function lN(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;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!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 sx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sN(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var a=Ki(r.href),o=t.querySelector(vs(a));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=au.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,$t(o);return}o=t.ownerDocument||t,r=lx(r),(a=Qn.get(a))&&Np(r,a),o=o.createElement("link"),$t(o);var i=o;i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Jt(o,"link",r),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=au.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Hf=0;function cN(e,t){return e.stylesheets&&e.count===0&&_c(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Hf===0&&(Hf=62500*qT());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Hf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}function au(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_c(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ou=null;function _c(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ou=new Map,t.forEach(uN,e),ou=null,au.call(e))}function uN(e,t){if(!(t.state.loading&4)){var n=ou.get(e);if(n)var r=n.get(null);else{n=new Map,ou.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<a.length;o++){var i=a[o];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),r=i)}r&&n.set(null,r)}a=t.instance,i=a.getAttribute("data-precedence"),o=n.get(i)||r,o===r&&n.set(null,a),n.set(i,a),this.count++,r=au.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),o?o.parentNode.insertBefore(a,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var os={$$typeof:ea,Provider:null,Consumer:null,_currentValue:wo,_currentValue2:wo,_threadCount:0};function dN(e,t,n,r,a,o,i,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=pf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pf(0),this.hiddenUpdates=pf(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function cx(e,t,n,r,a,o,i,s,c,u,f,d){return e=new dN(e,t,n,i,c,u,f,d,s),t=1,o===!0&&(t|=24),o=Tn(3,null,null,t),e.current=o,o.stateNode=e,t=tp(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},ap(o),e}function ux(e){return e?(e=Ri,e):Ri}function dx(e,t,n,r,a,o){a=ux(a),r.context===null?r.context=a:r.pendingContext=a,r=ja(t),r.payload={element:n},o=o===void 0?null:o,o!==null&&(r.callback=o),n=Pa(e,r,t),n!==null&&(hn(n,e,t),jl(n,e,t))}function Cv(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){Cv(e,t),(e=e.alternate)&&Cv(e,t)}function fx(e){if(e.tag===13||e.tag===31){var t=zo(e,67108864);t!==null&&hn(t,e,67108864),Op(e,67108864)}}function Rv(e){if(e.tag===13||e.tag===31){var t=kn();t=Vm(t);var n=zo(e,t);n!==null&&hn(n,e,t),Op(e,t)}}var iu=!0;function fN(e,t,n,r){var a=ve.T;ve.T=null;var o=Fe.p;try{Fe.p=2,_p(e,t,n,r)}finally{Fe.p=o,ve.T=a}}function mN(e,t,n,r){var a=ve.T;ve.T=null;var o=Fe.p;try{Fe.p=8,_p(e,t,n,r)}finally{Fe.p=o,ve.T=a}}function _p(e,t,n,r){if(iu){var a=Bm(r);if(a===null)Pf(e,t,r,lu,n),Ev(e,r);else if(gN(a,e,t,n,r))r.stopPropagation();else if(Ev(e,r),t&4&&-1<pN.indexOf(e)){for(;a!==null;){var o=Yi(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var i=bo(o.pendingLanes);if(i!==0){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;i;){var c=1<<31-_n(i);s.entanglements[1]|=c,i&=~c}Mr(o),(Ke&6)===0&&(Qc=Mn()+500,ys(0,!1))}}break;case 31:case 13:s=zo(o,2),s!==null&&hn(s,o,2),xu(),Op(o,2)}if(o=Bm(r),o===null&&Pf(e,t,r,lu,n),o===a)break;a=o}a!==null&&r.stopPropagation()}else Pf(e,t,r,null,n)}}function Bm(e){return e=Km(e),kp(e)}var lu=null;function kp(e){if(lu=null,e=bi(e),e!==null){var t=ss(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=kv(t),e!==null)return e;e=null}else if(n===31){if(e=Lv(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 lu=e,null}function mx(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(tE()){case Iv:return 2;case Uv:return 8;case Bc:case nE:return 32;case jv:return 268435456;default:return 32}default:return 32}}var Im=!1,qa=null,$a=null,Ka=null,is=new Map,ls=new Map,_a=[],pN="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 Ev(e,t){switch(e){case"focusin":case"focusout":qa=null;break;case"dragenter":case"dragleave":$a=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":is.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ls.delete(t.pointerId)}}function Nl(e,t,n,r,a,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},t!==null&&(t=Yi(t),t!==null&&fx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function gN(e,t,n,r,a){switch(t){case"focusin":return qa=Nl(qa,e,t,n,r,a),!0;case"dragenter":return $a=Nl($a,e,t,n,r,a),!0;case"mouseover":return Ka=Nl(Ka,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return is.set(o,Nl(is.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,ls.set(o,Nl(ls.get(o)||null,e,t,n,r,a)),!0}return!1}function px(e){var t=bi(e.target);if(t!==null){var n=ss(t);if(n!==null){if(t=n.tag,t===13){if(t=kv(n),t!==null){e.blockedOn=t,cy(e.priority,function(){Rv(n)});return}}else if(t===31){if(t=Lv(n),t!==null){e.blockedOn=t,cy(e.priority,function(){Rv(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 kc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Bm(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tm=r,n.target.dispatchEvent(r),tm=null}else return t=Yi(n),t!==null&&fx(t),e.blockedOn=n,!1;t.shift()}return!0}function Tv(e,t,n){kc(e)&&n.delete(t)}function hN(){Im=!1,qa!==null&&kc(qa)&&(qa=null),$a!==null&&kc($a)&&($a=null),Ka!==null&&kc(Ka)&&(Ka=null),is.forEach(Tv),ls.forEach(Tv)}function hc(e,t){e.blockedOn===t&&(e.blockedOn=null,Im||(Im=!0,Ut.unstable_scheduleCallback(Ut.unstable_NormalPriority,hN)))}var yc=null;function Nv(e){yc!==e&&(yc=e,Ut.unstable_scheduleCallback(Ut.unstable_NormalPriority,function(){yc===e&&(yc=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if(typeof r!="function"){if(kp(r||n)===null)continue;break}var o=Yi(n);o!==null&&(e.splice(t,3),t-=3,ym(o,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Fi(e){function t(c){return hc(c,e)}qa!==null&&hc(qa,e),$a!==null&&hc($a,e),Ka!==null&&hc(Ka,e),is.forEach(t),ls.forEach(t);for(var n=0;n<_a.length;n++){var r=_a[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<_a.length&&(n=_a[0],n.blockedOn===null);)px(n),n.blockedOn===null&&_a.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var a=n[r],o=n[r+1],i=a[yn]||null;if(typeof o=="function")i||Nv(n);else if(i){var s=null;if(o&&o.hasAttribute("formAction")){if(a=o,i=o[yn]||null)s=i.formAction;else if(kp(a)!==null)continue}else s=i.action;typeof s=="function"?n[r+1]=s:(n.splice(r,3),r-=3),Nv(n)}}}function gx(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(i){return a=i})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,a=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),a!==null&&(a(),a=null)}}}function Lp(e){this._internalRoot=e}Au.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var n=t.current,r=kn();dx(n,r,e,t,null,null)};Au.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dx(e.current,2,null,e,null,null),xu(),t[Gi]=null}};function Au(e){this._internalRoot=e}Au.prototype.unstable_scheduleHydration=function(e){if(e){var t=$v();e={blockedOn:null,target:e,priority:t};for(var n=0;n<_a.length&&t!==0&&t<_a[n].priority;n++);_a.splice(n,0,e),n===0&&px(e)}};var Mv=Ov.version;if(Mv!=="19.2.4")throw Error(L(527,Mv,"19.2.4"));Fe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=YR(t),e=e!==null?Dv(e):null,e=e===null?null:e.stateNode,e};var yN={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:ve,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ml=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ml.isDisabled&&Ml.supportsFiber))try{cs=Ml.inject(yN),On=Ml}catch{}var Ml;Cu.createRoot=function(e,t){if(!_v(e))throw Error(L(299));var n=!1,r="",a=i0,o=l0,i=s0;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=cx(e,1,!1,null,null,n,r,null,a,o,i,gx),e[Gi]=t.current,Tp(e),new Lp(t)};Cu.hydrateRoot=function(e,t,n){if(!_v(e))throw Error(L(299));var r=!1,a="",o=i0,i=l0,s=s0,c=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(s=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=cx(e,1,!0,t,n??null,r,a,c,o,i,s,gx),t.context=ux(null),n=t.current,r=kn(),r=Vm(r),a=ja(r),a.callback=null,Pa(n,a,r),n=r,t.current.lanes=n,ds(t,n),Mr(t),e[Gi]=t.current,Tp(e),new Au(t)};Cu.version="19.2.4"});var bx=wr((OL,vx)=>{"use strict";function yx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yx)}catch(e){console.error(e)}}yx(),vx.exports=hx()});var $x=wr(Mu=>{"use strict";var iM=Symbol.for("react.transitional.element"),lM=Symbol.for("react.fragment");function qx(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:iM,type:e,key:r,ref:t!==void 0?t:null,props:n}}Mu.Fragment=lM;Mu.jsx=qx;Mu.jsxs=qx});var Be=wr((jL,Kx)=>{"use strict";Kx.exports=$x()});var LC=K(bx(),1);var E=K(xe(),1),uC=K(ho(),1);function xx(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=xx(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ru(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=xx(e))&&(r&&(r+=" "),r+=t);return r}var Sx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,wx=Ru,Eu=(e,t)=>n=>{var r;if(t?.variants==null)return wx(e,n?.class,n?.className);let{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(u=>{let f=n?.[u],d=o?.[u];if(f===null)return null;let p=Sx(f)||Sx(d);return a[u][p]}),s=n&&Object.entries(n).reduce((u,f)=>{let[d,p]=f;return p===void 0||(u[d]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,f)=>{let{class:d,className:p,...m}=f;return Object.entries(m).every(b=>{let[g,x]=b;return Array.isArray(x)?x.includes({...o,...s}[g]):{...o,...s}[g]===x})?[...u,d,p]:u},[]);return wx(e,i,c,n?.class,n?.className)};var vN=(e,t)=>{let n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},bN=(e,t)=>({classGroupId:e,validator:t}),Nx=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var Ax=[],xN="arbitrary..",SN=e=>{let t=AN(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return wN(i);let s=i.split("-"),c=s[0]===""&&s.length>1?1:0;return Mx(s,c,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let c=r[i],u=n[i];return c?u?vN(u,c):c:u||Ax}return n[i]||Ax}}},Mx=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let a=e[t],o=n.nextPart.get(a);if(o){let u=Mx(e,t+1,o);if(u)return u}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),c=i.length;for(let u=0;u<c;u++){let f=i[u];if(f.validator(s))return f.classGroupId}},wN=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?xN+r:void 0})(),AN=e=>{let{theme:t,classGroups:n}=e;return CN(n,t)},CN=(e,t)=>{let n=Nx();for(let r in e){let a=e[r];zp(a,n,r,t)}return n},zp=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++){let i=e[o];RN(i,t,n,r)}},RN=(e,t,n,r)=>{if(typeof e=="string"){EN(e,t,n);return}if(typeof e=="function"){TN(e,t,n,r);return}NN(e,t,n,r)},EN=(e,t,n)=>{let r=e===""?t:Ox(t,e);r.classGroupId=n},TN=(e,t,n,r)=>{if(MN(e)){zp(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bN(n,e))},NN=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){let[s,c]=a[i];zp(c,Ox(t,s),n,r)}},Ox=(e,t)=>{let n=e,r=t.split("-"),a=r.length;for(let o=0;o<a;o++){let i=r[o],s=n.nextPart.get(i);s||(s=Nx(),n.nextPart.set(i,s)),n=s}return n},MN=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ON=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return a(o,i),i},set(o,i){o in n?n[o]=i:a(o,i)}}};var _N=[],Cx=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),kN=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=a=>{let o=[],i=0,s=0,c=0,u,f=a.length;for(let g=0;g<f;g++){let x=a[g];if(i===0&&s===0){if(x===":"){o.push(a.slice(c,g)),c=g+1;continue}if(x==="/"){u=g;continue}}x==="["?i++:x==="]"?i--:x==="("?s++:x===")"&&s--}let d=o.length===0?a:a.slice(c),p=d,m=!1;d.endsWith("!")?(p=d.slice(0,-1),m=!0):d.startsWith("!")&&(p=d.slice(1),m=!0);let b=u&&u>c?u-c:void 0;return Cx(o,m,p,b)};if(t){let a=t+":",o=r;r=i=>i.startsWith(a)?o(i.slice(a.length)):Cx(_N,!1,i,void 0,!0)}if(n){let a=r;r=o=>n({className:o,parseClassName:a})}return r},LN=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{let r=[],a=[];for(let o=0;o<n.length;o++){let i=n[o],s=i[0]==="[",c=t.has(i);s||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},DN=e=>({cache:ON(e.cacheSize),parseClassName:kN(e),sortModifiers:LN(e),...SN(e)}),zN=/\s+/,BN=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(zN),c="";for(let u=s.length-1;u>=0;u-=1){let f=s[u],{isExternal:d,modifiers:p,hasImportantModifier:m,baseClassName:b,maybePostfixModifierPosition:g}=n(f);if(d){c=f+(c.length>0?" "+c:c);continue}let x=!!g,y=r(x?b.substring(0,g):b);if(!y){if(!x){c=f+(c.length>0?" "+c:c);continue}if(y=r(b),!y){c=f+(c.length>0?" "+c:c);continue}x=!1}let h=p.length===0?"":p.length===1?p[0]:o(p).join(":"),v=m?h+"!":h,S=v+y;if(i.indexOf(S)>-1)continue;i.push(S);let C=a(y,x);for(let T=0;T<C.length;++T){let w=C[T];i.push(v+w)}c=f+(c.length>0?" "+c:c)}return c},IN=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=_x(n))&&(a&&(a+=" "),a+=r);return a},_x=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=_x(e[r]))&&(n&&(n+=" "),n+=t);return n},UN=(e,...t)=>{let n,r,a,o,i=c=>{let u=t.reduce((f,d)=>d(f),e());return n=DN(u),r=n.cache.get,a=n.cache.set,o=s,s(c)},s=c=>{let u=r(c);if(u)return u;let f=BN(c,n);return a(c,f),f};return o=i,(...c)=>o(IN(...c))},jN=[],jt=e=>{let t=n=>n[e]||jN;return t.isThemeGetter=!0,t},kx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PN=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,VN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HN=/\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$/,qN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$N=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Za=e=>PN.test(e),Me=e=>!!e&&!Number.isNaN(Number(e)),Ja=e=>!!e&&Number.isInteger(Number(e)),Dp=e=>e.endsWith("%")&&Me(e.slice(0,-1)),fa=e=>VN.test(e),Dx=()=>!0,FN=e=>HN.test(e)&&!qN.test(e),Bp=()=>!1,GN=e=>$N.test(e),YN=e=>KN.test(e),WN=e=>!ie(e)&&!le(e),QN=e=>eo(e,Ix,Bp),ie=e=>kx.test(e),Io=e=>eo(e,Ux,FN),Rx=e=>eo(e,aM,Me),XN=e=>eo(e,Px,Dx),ZN=e=>eo(e,jx,Bp),Ex=e=>eo(e,zx,Bp),JN=e=>eo(e,Bx,YN),Tu=e=>eo(e,Vx,GN),le=e=>Lx.test(e),xs=e=>Uo(e,Ux),eM=e=>Uo(e,jx),Tx=e=>Uo(e,zx),tM=e=>Uo(e,Ix),nM=e=>Uo(e,Bx),Nu=e=>Uo(e,Vx,!0),rM=e=>Uo(e,Px,!0),eo=(e,t,n)=>{let r=kx.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Uo=(e,t,n=!1)=>{let r=Lx.exec(e);return r?r[1]?t(r[1]):n:!1},zx=e=>e==="position"||e==="percentage",Bx=e=>e==="image"||e==="url",Ix=e=>e==="length"||e==="size"||e==="bg-size",Ux=e=>e==="length",aM=e=>e==="number",jx=e=>e==="family-name",Px=e=>e==="number"||e==="weight",Vx=e=>e==="shadow";var oM=()=>{let e=jt("color"),t=jt("font"),n=jt("text"),r=jt("font-weight"),a=jt("tracking"),o=jt("leading"),i=jt("breakpoint"),s=jt("container"),c=jt("spacing"),u=jt("radius"),f=jt("shadow"),d=jt("inset-shadow"),p=jt("text-shadow"),m=jt("drop-shadow"),b=jt("blur"),g=jt("perspective"),x=jt("aspect"),y=jt("ease"),h=jt("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),le,ie],T=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto","contain","none"],R=()=>[le,ie,c],M=()=>[Za,"full","auto",...R()],k=()=>[Ja,"none","subgrid",le,ie],I=()=>["auto",{span:["full",Ja,le,ie]},Ja,le,ie],H=()=>[Ja,"auto",le,ie],Q=()=>["auto","min","max","fr",le,ie],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...R()],te=()=>[Za,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],Y=()=>[Za,"screen","full","dvw","lvw","svw","min","max","fit",...R()],q=()=>[Za,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],V=()=>[e,le,ie],_e=()=>[...S(),Tx,Ex,{position:[le,ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],he=()=>["auto","cover","contain",tM,QN,{size:[le,ie]}],Z=()=>[Dp,xs,Io],ae=()=>["","none","full",u,le,ie],Se=()=>["",Me,xs,Io],U=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[Me,Dp,Tx,Ex],me=()=>["","none",b,le,ie],re=()=>["none",Me,le,ie],oe=()=>["none",Me,le,ie],Ne=()=>[Me,le,ie],Re=()=>[Za,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fa],breakpoint:[fa],color:[Dx],container:[fa],"drop-shadow":[fa],ease:["in","out","in-out"],font:[WN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fa],shadow:[fa],spacing:["px",Me],text:[fa],"text-shadow":[fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Za,ie,le,x]}],container:["container"],columns:[{columns:[Me,ie,le,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"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:C()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Ja,"auto",le,ie]}],basis:[{basis:[Za,"full","auto",s,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Me,Za,"auto","initial","none",ie]}],grow:[{grow:["",Me,le,ie]}],shrink:[{shrink:["",Me,le,ie]}],order:[{order:[Ja,"first","last","none",le,ie]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],"inline-size":[{inline:["auto",...Y()]}],"min-inline-size":[{"min-inline":["auto",...Y()]}],"max-inline-size":[{"max-inline":["none",...Y()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[s,"screen",...te()]}],"min-w":[{"min-w":[s,"screen","none",...te()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",n,xs,Io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,rM,XN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dp,ie]}],"font-family":[{font:[eM,ZN,t]}],"font-features":[{"font-features":[ie]}],"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:[a,le,ie]}],"line-clamp":[{"line-clamp":[Me,"none",le,Rx]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",le,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Me,"from-font","auto",le,Io]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Me,"auto",le,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,ie]}],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",le,ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:he()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ja,le,ie],radial:["",le,ie],conic:[Ja,le,ie]},nM,JN]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:Se()}],"border-w-x":[{"border-x":Se()}],"border-w-y":[{"border-y":Se()}],"border-w-s":[{"border-s":Se()}],"border-w-e":[{"border-e":Se()}],"border-w-bs":[{"border-bs":Se()}],"border-w-be":[{"border-be":Se()}],"border-w-t":[{"border-t":Se()}],"border-w-r":[{"border-r":Se()}],"border-w-b":[{"border-b":Se()}],"border-w-l":[{"border-l":Se()}],"divide-x":[{"divide-x":Se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Me,le,ie]}],"outline-w":[{outline:["",Me,xs,Io]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",f,Nu,Tu]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",d,Nu,Tu]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:Se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Me,Io]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":Se()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",p,Nu,Tu]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Me,le,ie]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Me]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[le,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[Me]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_e()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:he()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,ie]}],filter:[{filter:["","none",le,ie]}],blur:[{blur:me()}],brightness:[{brightness:[Me,le,ie]}],contrast:[{contrast:[Me,le,ie]}],"drop-shadow":[{"drop-shadow":["","none",m,Nu,Tu]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Me,le,ie]}],"hue-rotate":[{"hue-rotate":[Me,le,ie]}],invert:[{invert:["",Me,le,ie]}],saturate:[{saturate:[Me,le,ie]}],sepia:[{sepia:["",Me,le,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",le,ie]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[Me,le,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Me,le,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Me,le,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Me,le,ie]}],"backdrop-invert":[{"backdrop-invert":["",Me,le,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Me,le,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Me,le,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Me,le,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Me,"initial",le,ie]}],ease:[{ease:["linear","initial",y,le,ie]}],delay:[{delay:[Me,le,ie]}],animate:[{animate:["none",h,le,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,le,ie]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[le,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"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",le,ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",le,ie]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Me,xs,Io,Rx]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var Hx=UN(oM);function W(...e){return Hx(Ru(e))}var Fx=K(Be(),1),sM=Eu("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium tracking-wide",{variants:{variant:{default:"border-border bg-secondary text-secondary-foreground",success:"border-emerald-200 bg-emerald-50 text-emerald-700",warning:"border-amber-200 bg-amber-50 text-amber-700",danger:"border-rose-200 bg-rose-50 text-rose-700",info:"border-sky-200 bg-sky-50 text-sky-700",outline:"border-border bg-background/70 text-muted-foreground"}},defaultVariants:{variant:"default"}});function Tt({className:e,variant:t,...n}){return(0,Fx.jsx)("span",{className:W(sM({variant:t}),e),...n})}var Gx=K(Be(),1),cM=Eu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium uppercase tracking-[0.16em] transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/92",outline:"border border-border bg-background/80 text-foreground hover:bg-accent hover:text-accent-foreground",ghost:"text-muted-foreground hover:bg-accent hover:text-accent-foreground",danger:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/92"},size:{default:"h-9 px-3.5",sm:"h-8 px-3 text-xs",lg:"h-10 px-4"}},defaultVariants:{variant:"default",size:"default"}});function ce({className:e,variant:t,size:n,type:r="button",...a}){return(0,Gx.jsx)("button",{className:W(cM({variant:t,size:n}),e),type:r,...a})}var tl=K(Be(),1);function Xn({className:e,...t}){return(0,tl.jsx)("section",{className:W("rounded-2xl border border-border/70 bg-card/92 shadow-sm backdrop-blur",e),...t})}function jo({className:e,...t}){return(0,tl.jsx)("div",{className:W("flex flex-col gap-1.5 p-5 pb-0",e),...t})}function el({className:e,...t}){return(0,tl.jsx)("h2",{className:W("text-sm font-semibold tracking-tight text-foreground",e),...t})}function Ss({className:e,...t}){return(0,tl.jsx)("p",{className:W("text-sm text-muted-foreground",e),...t})}function Zn({className:e,...t}){return(0,tl.jsx)("div",{className:W("p-5",e),...t})}var Yx=K(xe(),1);var Wx=K(Be(),1),Dt=(0,Yx.forwardRef)(function({className:t,...n},r){return(0,Wx.jsx)("input",{ref:r,className:W("flex h-9 w-full rounded-lg border border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40",t),...n})});var mr=K(xe(),1);var QL=!!(typeof window<"u"&&window.document&&window.document.createElement);function Pe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}var Xx=K(xe(),1);function Qx(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ip(...e){return t=>{let n=!1,r=e.map(a=>{let o=Qx(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a<r.length;a++){let o=r[a];typeof o=="function"?o():Qx(e[a],null)}}}}function Xe(...e){return Xx.useCallback(Ip(...e),e)}var ma=K(xe(),1),Zx=K(Be(),1);function Jn(e,t=[]){let n=[];function r(o,i){let s=ma.createContext(i),c=n.length;n=[...n,i];let u=d=>{let{scope:p,children:m,...b}=d,g=p?.[e]?.[c]||s,x=ma.useMemo(()=>b,Object.values(b));return(0,Zx.jsx)(g.Provider,{value:x,children:m})};u.displayName=o+"Provider";function f(d,p){let m=p?.[e]?.[c]||s,b=ma.useContext(m);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[u,f]}let a=()=>{let o=n.map(i=>ma.createContext(i));return function(s){let c=s?.[e]||o;return ma.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return a.scopeName=e,[r,uM(a,...t)]}function uM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){let i=r.reduce((s,{useScope:c,scopeName:u})=>{let d=c(o)[`__scope${u}`];return{...s,...d}},{});return ma.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var er=K(xe(),1);var Jx=K(xe(),1),xt=globalThis?.document?Jx.useLayoutEffect:()=>{};var Ou=K(xe(),1);var dM=er[" useInsertionEffect ".trim().toString()]||xt;function pa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[a,o,i]=fM({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:a;{let f=er.useRef(e!==void 0);er.useEffect(()=>{let d=f.current;d!==s&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}let u=er.useCallback(f=>{if(s){let d=mM(f)?f(e):f;d!==e&&i.current?.(d)}else o(f)},[s,e,o,i]);return[c,u]}function fM({defaultProp:e,onChange:t}){let[n,r]=er.useState(e),a=er.useRef(n),o=er.useRef(t);return dM(()=>{o.current=t},[t]),er.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function mM(e){return typeof e=="function"}var _u=K(xe(),1);function ku(e){let t=_u.useRef({value:e,previous:e});return _u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var eS=K(xe(),1);function Lu(e){let[t,n]=eS.useState(void 0);return xt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;let o=a[0],i,s;if("borderBoxSize"in o){let c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,s=u.blockSize}else i=e.offsetWidth,s=e.offsetHeight;n({width:i,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var tS=K(xe(),1),nS=K(ho(),1);var Pt=K(xe(),1);var Du=K(Be(),1);function Po(e){let t=pM(e),n=Pt.forwardRef((r,a)=>{let{children:o,...i}=r,s=Pt.Children.toArray(o),c=s.find(hM);if(c){let u=c.props.children,f=s.map(d=>d===c?Pt.Children.count(u)>1?Pt.Children.only(null):Pt.isValidElement(u)?u.props.children:null:d);return(0,Du.jsx)(t,{...i,ref:a,children:Pt.isValidElement(u)?Pt.cloneElement(u,void 0,f):null})}return(0,Du.jsx)(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function pM(e){let t=Pt.forwardRef((n,r)=>{let{children:a,...o}=n;if(Pt.isValidElement(a)){let i=vM(a),s=yM(o,a.props);return a.type!==Pt.Fragment&&(s.ref=r?Ip(r,i):i),Pt.cloneElement(a,s)}return Pt.Children.count(a)>1?Pt.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gM=Symbol("radix.slottable");function hM(e){return Pt.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gM}function yM(e,t){let n={...t};for(let r in t){let a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...s)=>{let c=o(...s);return a(...s),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function vM(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rS=K(Be(),1),bM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=bM.reduce((e,t)=>{let n=Po(`Primitive.${t}`),r=tS.forwardRef((a,o)=>{let{asChild:i,...s}=a,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,rS.jsx)(c,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function aS(e,t){e&&nS.flushSync(()=>e.dispatchEvent(t))}var Vo=K(Be(),1),zu="Switch",[xM,yD]=Jn(zu),[SM,wM]=xM(zu),oS=mr.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:i,disabled:s,value:c="on",onCheckedChange:u,form:f,...d}=e,[p,m]=mr.useState(null),b=Xe(t,v=>m(v)),g=mr.useRef(!1),x=p?f||!!p.closest("form"):!0,[y,h]=pa({prop:a,defaultProp:o??!1,onChange:u,caller:zu});return(0,Vo.jsxs)(SM,{scope:n,checked:y,disabled:s,children:[(0,Vo.jsx)(Oe.button,{type:"button",role:"switch","aria-checked":y,"aria-required":i,"data-state":cS(y),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:b,onClick:Pe(e.onClick,v=>{h(S=>!S),x&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})}),x&&(0,Vo.jsx)(sS,{control:p,bubbles:!g.current,name:r,value:c,checked:y,required:i,disabled:s,form:f,style:{transform:"translateX(-100%)"}})]})});oS.displayName=zu;var iS="SwitchThumb",lS=mr.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,a=wM(iS,n);return(0,Vo.jsx)(Oe.span,{"data-state":cS(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});lS.displayName=iS;var AM="SwitchBubbleInput",sS=mr.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},o)=>{let i=mr.useRef(null),s=Xe(i,o),c=ku(n),u=Lu(t);return mr.useEffect(()=>{let f=i.current;if(!f)return;let d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==n&&m){let b=new Event("click",{bubbles:r});m.call(f,n),f.dispatchEvent(b)}},[c,n,r]),(0,Vo.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:s,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sS.displayName=AM;function cS(e){return e?"checked":"unchecked"}var uS=oS,dS=lS;var Up=K(Be(),1);function fS({className:e,...t}){return(0,Up.jsx)(uS,{className:W("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-muted transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-secondary",e),...t,children:(0,Up.jsx)(dS,{className:"pointer-events-none block size-4 rounded-full bg-background shadow-sm transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5"})})}var ha=K(xe(),1);var Ft=K(xe(),1);var to=K(xe(),1);var Bu=K(Be(),1),RM=K(xe(),1);var EM=K(Be(),1);function Iu(e){let t=e+"CollectionProvider",[n,r]=Jn(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{let{scope:x,children:y}=g,h=to.default.useRef(null),v=to.default.useRef(new Map).current;return(0,Bu.jsx)(a,{scope:x,itemMap:v,collectionRef:h,children:y})};i.displayName=t;let s=e+"CollectionSlot",c=Po(s),u=to.default.forwardRef((g,x)=>{let{scope:y,children:h}=g,v=o(s,y),S=Xe(x,v.collectionRef);return(0,Bu.jsx)(c,{ref:S,children:h})});u.displayName=s;let f=e+"CollectionItemSlot",d="data-radix-collection-item",p=Po(f),m=to.default.forwardRef((g,x)=>{let{scope:y,children:h,...v}=g,S=to.default.useRef(null),C=Xe(x,S),T=o(f,y);return to.default.useEffect(()=>(T.itemMap.set(S,{ref:S,...v}),()=>{T.itemMap.delete(S)})),(0,Bu.jsx)(p,{[d]:"",ref:C,children:h})});m.displayName=f;function b(g){let x=o(e+"CollectionConsumer",g);return to.default.useCallback(()=>{let h=x.collectionRef.current;if(!h)return[];let v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((T,w)=>v.indexOf(T.ref.current)-v.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:m},b,r]}var jp=K(xe(),1);var TM=jp[" useId ".trim().toString()]||(()=>{}),NM=0;function no(e){let[t,n]=jp.useState(TM());return xt(()=>{e||n(r=>r??String(NM++))},[e]),e||(t?`radix-${t}`:"")}var nl=K(xe(),1);function bn(e){let t=nl.useRef(e);return nl.useEffect(()=>{t.current=e}),nl.useMemo(()=>(...n)=>t.current?.(...n),[])}var Uu=K(xe(),1),MM=K(Be(),1),OM=Uu.createContext(void 0);function rl(e){let t=Uu.useContext(OM);return e||t||"ltr"}var ro=K(Be(),1),Pp="rovingFocusGroup.onEntryFocus",_M={bubbles:!1,cancelable:!0},ws="RovingFocusGroup",[Vp,mS,kM]=Iu(ws),[LM,Hp]=Jn(ws,[kM]),[DM,zM]=LM(ws),pS=Ft.forwardRef((e,t)=>(0,ro.jsx)(Vp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,ro.jsx)(Vp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,ro.jsx)(BM,{...e,ref:t})})}));pS.displayName=ws;var BM=Ft.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,p=Ft.useRef(null),m=Xe(t,p),b=rl(o),[g,x]=pa({prop:i,defaultProp:s??null,onChange:c,caller:ws}),[y,h]=Ft.useState(!1),v=bn(u),S=mS(n),C=Ft.useRef(!1),[T,w]=Ft.useState(0);return Ft.useEffect(()=>{let R=p.current;if(R)return R.addEventListener(Pp,v),()=>R.removeEventListener(Pp,v)},[v]),(0,ro.jsx)(DM,{scope:n,orientation:r,dir:b,loop:a,currentTabStopId:g,onItemFocus:Ft.useCallback(R=>x(R),[x]),onItemShiftTab:Ft.useCallback(()=>h(!0),[]),onFocusableItemAdd:Ft.useCallback(()=>w(R=>R+1),[]),onFocusableItemRemove:Ft.useCallback(()=>w(R=>R-1),[]),children:(0,ro.jsx)(Oe.div,{tabIndex:y||T===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{C.current=!0}),onFocus:Pe(e.onFocus,R=>{let M=!C.current;if(R.target===R.currentTarget&&M&&!y){let k=new CustomEvent(Pp,_M);if(R.currentTarget.dispatchEvent(k),!k.defaultPrevented){let I=S().filter(z=>z.focusable),H=I.find(z=>z.active),Q=I.find(z=>z.id===g),X=[H,Q,...I].filter(Boolean).map(z=>z.ref.current);yS(X,f)}}C.current=!1}),onBlur:Pe(e.onBlur,()=>h(!1))})})}),gS="RovingFocusGroupItem",hS=Ft.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:o,children:i,...s}=e,c=no(),u=o||c,f=zM(gS,n),d=f.currentTabStopId===u,p=mS(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:g}=f;return Ft.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),(0,ro.jsx)(Vp.ItemSlot,{scope:n,id:u,focusable:r,active:a,children:(0,ro.jsx)(Oe.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:Pe(e.onMouseDown,x=>{r?f.onItemFocus(u):x.preventDefault()}),onFocus:Pe(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:Pe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;let y=jM(x,f.orientation,f.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let v=p().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")v.reverse();else if(y==="prev"||y==="next"){y==="prev"&&v.reverse();let S=v.indexOf(x.currentTarget);v=f.loop?PM(v,S+1):v.slice(S+1)}setTimeout(()=>yS(v))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:g!=null}):i})})});hS.displayName=gS;var IM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jM(e,t,n){let r=UM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return IM[r]}function yS(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function PM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vS=pS,bS=hS;var xn=K(xe(),1);var xS=K(xe(),1);function HM(e,t){return xS.useReducer((n,r)=>t[n][r]??n,e)}var qp=e=>{let{present:t,children:n}=e,r=qM(t),a=typeof n=="function"?n({present:r.isPresent}):xn.Children.only(n),o=Xe(r.ref,$M(a));return typeof n=="function"||r.isPresent?xn.cloneElement(a,{ref:o}):null};qp.displayName="Presence";function qM(e){let[t,n]=xn.useState(),r=xn.useRef(null),a=xn.useRef(e),o=xn.useRef("none"),i=e?"mounted":"unmounted",[s,c]=HM(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return xn.useEffect(()=>{let u=ju(r.current);o.current=s==="mounted"?u:"none"},[s]),xt(()=>{let u=r.current,f=a.current;if(f!==e){let p=o.current,m=ju(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),xt(()=>{if(t){let u,f=t.ownerDocument.defaultView??window,d=m=>{let g=ju(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(c("ANIMATION_END"),!a.current)){let x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=m=>{m.target===t&&(o.current=ju(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:xn.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function ju(e){return e?.animationName||"none"}function $M(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ga=K(Be(),1),Pu="Tabs",[KM,ZD]=Jn(Pu,[Hp]),SS=Hp(),[FM,$p]=KM(Pu),wS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:i="horizontal",dir:s,activationMode:c="automatic",...u}=e,f=rl(s),[d,p]=pa({prop:r,onChange:a,defaultProp:o??"",caller:Pu});return(0,ga.jsx)(FM,{scope:n,baseId:no(),value:d,onValueChange:p,orientation:i,dir:f,activationMode:c,children:(0,ga.jsx)(Oe.div,{dir:f,"data-orientation":i,...u,ref:t})})});wS.displayName=Pu;var AS="TabsList",CS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...a}=e,o=$p(AS,n),i=SS(n);return(0,ga.jsx)(vS,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:(0,ga.jsx)(Oe.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});CS.displayName=AS;var RS="TabsTrigger",ES=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,i=$p(RS,n),s=SS(n),c=MS(i.baseId,r),u=OS(i.baseId,r),f=r===i.value;return(0,ga.jsx)(bS,{asChild:!0,...s,focusable:!a,active:f,children:(0,ga.jsx)(Oe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...o,ref:t,onMouseDown:Pe(e.onMouseDown,d=>{!a&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:Pe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:Pe(e.onFocus,()=>{let d=i.activationMode!=="manual";!f&&!a&&d&&i.onValueChange(r)})})})});ES.displayName=RS;var TS="TabsContent",NS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:a,children:o,...i}=e,s=$p(TS,n),c=MS(s.baseId,r),u=OS(s.baseId,r),f=r===s.value,d=ha.useRef(f);return ha.useEffect(()=>{let p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),(0,ga.jsx)(qp,{present:a||f,children:({present:p})=>(0,ga.jsx)(Oe.div,{"data-state":f?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});NS.displayName=TS;function MS(e,t){return`${e}-trigger-${t}`}function OS(e,t){return`${e}-content-${t}`}var _S=wS,kS=CS,LS=ES,DS=NS;var As=K(Be(),1);function Vu(e){return(0,As.jsx)(_S,{...e})}function Hu({className:e,...t}){return(0,As.jsx)(kS,{className:W("inline-flex h-9 items-center gap-1 rounded-xl border border-border/70 bg-secondary/70 p-1",e),...t})}function Or({className:e,...t}){return(0,As.jsx)(LS,{className:W("inline-flex h-7 items-center justify-center rounded-lg px-3 text-sm text-muted-foreground transition data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t})}function _r({className:e,...t}){return(0,As.jsx)(DS,{className:W("mt-4 outline-none",e),...t})}var YM=K(Be(),1);var Ue=K(xe(),1);var J=K(xe(),1),Lg=K(ho(),1);function Kp(e,[t,n]){return Math.min(n,Math.max(t,e))}var St=K(xe(),1);var zS=K(xe(),1);function BS(e,t=globalThis?.document){let n=bn(e);zS.useEffect(()=>{let r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Gp=K(Be(),1),WM="DismissableLayer",Fp="dismissableLayer.update",QM="dismissableLayer.pointerDownOutside",XM="dismissableLayer.focusOutside",IS,jS=St.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yp=St.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:s,...c}=e,u=St.useContext(jS),[f,d]=St.useState(null),p=f?.ownerDocument??globalThis?.document,[,m]=St.useState({}),b=Xe(t,w=>d(w)),g=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(x),h=f?g.indexOf(f):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,S=h>=y,C=eO(w=>{let R=w.target,M=[...u.branches].some(k=>k.contains(R));!S||M||(a?.(w),i?.(w),w.defaultPrevented||s?.())},p),T=tO(w=>{let R=w.target;[...u.branches].some(k=>k.contains(R))||(o?.(w),i?.(w),w.defaultPrevented||s?.())},p);return BS(w=>{h===u.layers.size-1&&(r?.(w),!w.defaultPrevented&&s&&(w.preventDefault(),s()))},p),St.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(IS=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),US(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=IS)}},[f,p,n,u]),St.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),US())},[f,u]),St.useEffect(()=>{let w=()=>m({});return document.addEventListener(Fp,w),()=>document.removeEventListener(Fp,w)},[]),(0,Gp.jsx)(Oe.div,{...c,ref:b,style:{pointerEvents:v?S?"auto":"none":void 0,...e.style},onFocusCapture:Pe(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Pe(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Pe(e.onPointerDownCapture,C.onPointerDownCapture)})});Yp.displayName=WM;var ZM="DismissableLayerBranch",JM=St.forwardRef((e,t)=>{let n=St.useContext(jS),r=St.useRef(null),a=Xe(t,r);return St.useEffect(()=>{let o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),(0,Gp.jsx)(Oe.div,{...e,ref:a})});JM.displayName=ZM;function eO(e,t=globalThis?.document){let n=bn(e),r=St.useRef(!1),a=St.useRef(()=>{});return St.useEffect(()=>{let o=s=>{if(s.target&&!r.current){let u=function(){PS(QM,n,f,{discrete:!0})};var c=u;let f={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tO(e,t=globalThis?.document){let n=bn(e),r=St.useRef(!1);return St.useEffect(()=>{let a=o=>{o.target&&!r.current&&PS(XM,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function US(){let e=new CustomEvent(Fp);document.dispatchEvent(e)}function PS(e,t,n,{discrete:r}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?aS(a,o):a.dispatchEvent(o)}var HS=K(xe(),1),Wp=0;function qS(){HS.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??VS()),document.body.insertAdjacentElement("beforeend",e[1]??VS()),Wp++,()=>{Wp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wp--}},[])}function VS(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var tr=K(xe(),1);var YS=K(Be(),1),Qp="focusScope.autoFocusOnMount",Xp="focusScope.autoFocusOnUnmount",$S={bubbles:!1,cancelable:!0},nO="FocusScope",Zp=tr.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[s,c]=tr.useState(null),u=bn(a),f=bn(o),d=tr.useRef(null),p=Xe(t,g=>c(g)),m=tr.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;tr.useEffect(()=>{if(r){let h=function(T){if(m.paused||!s)return;let w=T.target;s.contains(w)?d.current=w:ao(d.current,{select:!0})},v=function(T){if(m.paused||!s)return;let w=T.relatedTarget;w!==null&&(s.contains(w)||ao(d.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(let R of T)R.removedNodes.length>0&&ao(s)};var g=h,x=v,y=S;document.addEventListener("focusin",h),document.addEventListener("focusout",v);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),C.disconnect()}}},[r,s,m.paused]),tr.useEffect(()=>{if(s){FS.add(m);let g=document.activeElement;if(!s.contains(g)){let y=new CustomEvent(Qp,$S);s.addEventListener(Qp,u),s.dispatchEvent(y),y.defaultPrevented||(rO(sO(WS(s)),{select:!0}),document.activeElement===g&&ao(s))}return()=>{s.removeEventListener(Qp,u),setTimeout(()=>{let y=new CustomEvent(Xp,$S);s.addEventListener(Xp,f),s.dispatchEvent(y),y.defaultPrevented||ao(g??document.body,{select:!0}),s.removeEventListener(Xp,f),FS.remove(m)},0)}}},[s,u,f,m]);let b=tr.useCallback(g=>{if(!n&&!r||m.paused)return;let x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(x&&y){let h=g.currentTarget,[v,S]=aO(h);v&&S?!g.shiftKey&&y===S?(g.preventDefault(),n&&ao(v,{select:!0})):g.shiftKey&&y===v&&(g.preventDefault(),n&&ao(S,{select:!0})):y===h&&g.preventDefault()}},[n,r,m.paused]);return(0,YS.jsx)(Oe.div,{tabIndex:-1,...i,ref:p,onKeyDown:b})});Zp.displayName=nO;function rO(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ao(r,{select:t}),document.activeElement!==n)return}function aO(e){let t=WS(e),n=KS(t,e),r=KS(t.reverse(),e);return[n,r]}function WS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function KS(e,t){for(let n of e)if(!oO(n,{upTo:t}))return n}function oO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function iO(e){return e instanceof HTMLInputElement&&"select"in e}function ao(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iO(e)&&t&&e.select()}}var FS=lO();function lO(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=GS(e,t),e.unshift(t)},remove(t){e=GS(e,t),e[0]?.resume()}}}function GS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function sO(e){return e.filter(t=>t.tagName!=="A")}var wn=K(xe(),1);var ZS=["top","right","bottom","left"];var kr=Math.min,ln=Math.max,Rs=Math.round,Es=Math.floor,pr=e=>({x:e,y:e}),cO={left:"right",right:"left",bottom:"top",top:"bottom"};function $u(e,t,n){return ln(e,kr(t,n))}function Lr(e,t){return typeof e=="function"?e(t):e}function Dr(e){return e.split("-")[0]}function Ho(e){return e.split("-")[1]}function Ku(e){return e==="x"?"y":"x"}function Fu(e){return e==="y"?"height":"width"}function gr(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Gu(e){return Ku(gr(e))}function JS(e,t,n){n===void 0&&(n=!1);let r=Ho(e),a=Gu(e),o=Fu(a),i=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Cs(i)),[i,Cs(i)]}function ew(e){let t=Cs(e);return[qu(e),t,qu(t)]}function qu(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var QS=["left","right"],XS=["right","left"],uO=["top","bottom"],dO=["bottom","top"];function fO(e,t,n){switch(e){case"top":case"bottom":return n?t?XS:QS:t?QS:XS;case"left":case"right":return t?uO:dO;default:return[]}}function tw(e,t,n,r){let a=Ho(e),o=fO(Dr(e),n==="start",r);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(qu)))),o}function Cs(e){let t=Dr(e);return cO[t]+e.slice(t.length)}function mO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jp(e){return typeof e!="number"?mO(e):{top:e,right:e,bottom:e,left:e}}function qo(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function nw(e,t,n){let{reference:r,floating:a}=e,o=gr(t),i=Gu(t),s=Fu(i),c=Dr(t),u=o==="y",f=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,p=r[s]/2-a[s]/2,m;switch(c){case"top":m={x:f,y:r.y-a.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-a.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Ho(t)){case"start":m[i]-=p*(n&&u?-1:1);break;case"end":m[i]+=p*(n&&u?-1:1);break}return m}async function ow(e,t){var n;t===void 0&&(t={});let{x:r,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:m=0}=Lr(t,e),b=Jp(m),x=s[p?d==="floating"?"reference":"floating":d],y=qo(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:f,strategy:c})),h=d==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),S=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},C=qo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:h,offsetParent:v,strategy:c}):h);return{top:(y.top-C.top+b.top)/S.y,bottom:(C.bottom-y.bottom+b.bottom)/S.y,left:(y.left-C.left+b.left)/S.x,right:(C.right-y.right+b.right)/S.x}}var pO=50,iw=async(e,t,n)=>{let{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,s=i.detectOverflow?i:{...i,detectOverflow:ow},c=await(i.isRTL==null?void 0:i.isRTL(t)),u=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:d}=nw(u,r,c),p=r,m=0,b={};for(let g=0;g<o.length;g++){let x=o[g];if(!x)continue;let{name:y,fn:h}=x,{x:v,y:S,data:C,reset:T}=await h({x:f,y:d,initialPlacement:r,placement:p,strategy:a,middlewareData:b,rects:u,platform:s,elements:{reference:e,floating:t}});f=v??f,d=S??d,b[y]={...b[y],...C},T&&m<pO&&(m++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(u=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:f,y:d}=nw(u,p,c)),g=-1)}return{x:f,y:d,placement:p,strategy:a,middlewareData:b}},lw=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:u,padding:f=0}=Lr(e,t)||{};if(u==null)return{};let d=Jp(f),p={x:n,y:r},m=Gu(a),b=Fu(m),g=await i.getDimensions(u),x=m==="y",y=x?"top":"left",h=x?"bottom":"right",v=x?"clientHeight":"clientWidth",S=o.reference[b]+o.reference[m]-p[m]-o.floating[b],C=p[m]-o.reference[m],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u)),w=T?T[v]:0;(!w||!await(i.isElement==null?void 0:i.isElement(T)))&&(w=s.floating[v]||o.floating[b]);let R=S/2-C/2,M=w/2-g[b]/2-1,k=kr(d[y],M),I=kr(d[h],M),H=k,Q=w-g[b]-I,ee=w/2-g[b]/2+R,X=$u(H,ee,Q),z=!c.arrow&&Ho(a)!=null&&ee!==X&&o.reference[b]/2-(ee<H?k:I)-g[b]/2<0,te=z?ee<H?ee-H:ee-Q:0;return{[m]:p[m]+te,data:{[m]:X,centerOffset:ee-X-te,...z&&{alignmentOffset:te}},reset:z}}});var sw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;let{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...x}=Lr(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let y=Dr(a),h=gr(s),v=Dr(s)===s,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=p||(v||!g?[Cs(s)]:ew(s)),T=b!=="none";!p&&T&&C.push(...tw(s,g,b,S));let w=[s,...C],R=await c.detectOverflow(t,x),M=[],k=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&M.push(R[y]),d){let ee=JS(a,i,S);M.push(R[ee[0]],R[ee[1]])}if(k=[...k,{placement:a,overflows:M}],!M.every(ee=>ee<=0)){var I,H;let ee=(((I=o.flip)==null?void 0:I.index)||0)+1,X=w[ee];if(X&&(!(d==="alignment"?h!==gr(X):!1)||k.every(Y=>gr(Y.placement)===h?Y.overflows[0]>0:!0)))return{data:{index:ee,overflows:k},reset:{placement:X}};let z=(H=k.filter(te=>te.overflows[0]<=0).sort((te,Y)=>te.overflows[1]-Y.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(m){case"bestFit":{var Q;let te=(Q=k.filter(Y=>{if(T){let q=gr(Y.placement);return q===h||q==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(q=>q>0).reduce((q,V)=>q+V,0)]).sort((Y,q)=>Y[1]-q[1])[0])==null?void 0:Q[0];te&&(z=te);break}case"initialPlacement":z=s;break}if(a!==z)return{reset:{placement:z}}}return{}}}};function rw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aw(e){return ZS.some(t=>e[t]>=0)}var cw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=Lr(e,t);switch(a){case"referenceHidden":{let i=await r.detectOverflow(t,{...o,elementContext:"reference"}),s=rw(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:aw(s)}}}case"escaped":{let i=await r.detectOverflow(t,{...o,altBoundary:!0}),s=rw(i,n.floating);return{data:{escapedOffsets:s,escaped:aw(s)}}}default:return{}}}}};var uw=new Set(["left","top"]);async function gO(e,t){let{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Dr(n),s=Ho(n),c=gr(n)==="y",u=uw.has(i)?-1:1,f=o&&c?-1:1,d=Lr(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof b=="number"&&(m=s==="end"?b*-1:b),c?{x:m*f,y:p*u}:{x:p*u,y:m*f}}var dw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:a,y:o,placement:i,middlewareData:s}=t,c=await gO(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},fw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:h,y:v}=y;return{x:h,y:v}}},...u}=Lr(e,t),f={x:n,y:r},d=await o.detectOverflow(t,u),p=gr(Dr(a)),m=Ku(p),b=f[m],g=f[p];if(i){let y=m==="y"?"top":"left",h=m==="y"?"bottom":"right",v=b+d[y],S=b-d[h];b=$u(v,b,S)}if(s){let y=p==="y"?"top":"left",h=p==="y"?"bottom":"right",v=g+d[y],S=g-d[h];g=$u(v,g,S)}let x=c.fn({...t,[m]:b,[p]:g});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[m]:i,[p]:s}}}}}},mw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:u=!0}=Lr(e,t),f={x:n,y:r},d=gr(a),p=Ku(d),m=f[p],b=f[d],g=Lr(s,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){let v=p==="y"?"height":"width",S=o.reference[p]-o.floating[v]+x.mainAxis,C=o.reference[p]+o.reference[v]-x.mainAxis;m<S?m=S:m>C&&(m=C)}if(u){var y,h;let v=p==="y"?"width":"height",S=uw.has(Dr(a)),C=o.reference[d]-o.floating[v]+(S&&((y=i.offset)==null?void 0:y[d])||0)+(S?0:x.crossAxis),T=o.reference[d]+o.reference[v]+(S?0:((h=i.offset)==null?void 0:h[d])||0)-(S?x.crossAxis:0);b<C?b=C:b>T&&(b=T)}return{[p]:m,[d]:b}}}},pw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;let{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...u}=Lr(e,t),f=await i.detectOverflow(t,u),d=Dr(a),p=Ho(a),m=gr(a)==="y",{width:b,height:g}=o.floating,x,y;d==="top"||d==="bottom"?(x=d,y=p===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,x=p==="end"?"top":"bottom");let h=g-f.top-f.bottom,v=b-f.left-f.right,S=kr(g-f[x],h),C=kr(b-f[y],v),T=!t.middlewareData.shift,w=S,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=h),T&&!p){let k=ln(f.left,0),I=ln(f.right,0),H=ln(f.top,0),Q=ln(f.bottom,0);m?R=b-2*(k!==0||I!==0?k+I:ln(f.left,f.right)):w=g-2*(H!==0||Q!==0?H+Q:ln(f.top,f.bottom))}await c({...t,availableWidth:R,availableHeight:w});let M=await i.getDimensions(s.floating);return b!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Yu(){return typeof window<"u"}function Fo(e){return hw(e)?(e.nodeName||"").toLowerCase():"#document"}function Sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hr(e){var t;return(t=(hw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hw(e){return Yu()?e instanceof Node||e instanceof Sn(e).Node:!1}function nr(e){return Yu()?e instanceof Element||e instanceof Sn(e).Element:!1}function zr(e){return Yu()?e instanceof HTMLElement||e instanceof Sn(e).HTMLElement:!1}function gw(e){return!Yu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function al(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=rr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function yw(e){return/^(table|td|th)$/.test(Fo(e))}function Ts(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var hO=/transform|translate|scale|rotate|perspective|filter/,yO=/paint|layout|strict|content/,$o=e=>!!e&&e!=="none",eg;function Wu(e){let t=nr(e)?rr(e):e;return $o(t.transform)||$o(t.translate)||$o(t.scale)||$o(t.rotate)||$o(t.perspective)||!Qu()&&($o(t.backdropFilter)||$o(t.filter))||hO.test(t.willChange||"")||yO.test(t.contain||"")}function vw(e){let t=ya(e);for(;zr(t)&&!Go(t);){if(Wu(t))return t;if(Ts(t))return null;t=ya(t)}return null}function Qu(){return eg==null&&(eg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),eg}function Go(e){return/^(html|body|#document)$/.test(Fo(e))}function rr(e){return Sn(e).getComputedStyle(e)}function Ns(e){return nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ya(e){if(Fo(e)==="html")return e;let t=e.assignedSlot||e.parentNode||gw(e)&&e.host||hr(e);return gw(t)?t.host:t}function bw(e){let t=ya(e);return Go(t)?e.ownerDocument?e.ownerDocument.body:e.body:zr(t)&&al(t)?t:bw(t)}function Ko(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let a=bw(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),i=Sn(a);if(o){let s=Xu(i);return t.concat(i,i.visualViewport||[],al(a)?a:[],s&&n?Ko(s):[])}else return t.concat(a,Ko(a,[],n))}function Xu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Aw(e){let t=rr(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=zr(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,s=Rs(n)!==o||Rs(r)!==i;return s&&(n=o,r=i),{width:n,height:r,$:s}}function ng(e){return nr(e)?e:e.contextElement}function ol(e){let t=ng(e);if(!zr(t))return pr(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=Aw(t),i=(o?Rs(n.width):n.width)/r,s=(o?Rs(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var vO=pr(0);function Cw(e){let t=Sn(e);return!Qu()||!t.visualViewport?vO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sn(e)?!1:t}function Yo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=ng(e),i=pr(1);t&&(r?nr(r)&&(i=ol(r)):i=ol(e));let s=bO(o,n,r)?Cw(o):pr(0),c=(a.left+s.x)/i.x,u=(a.top+s.y)/i.y,f=a.width/i.x,d=a.height/i.y;if(o){let p=Sn(o),m=r&&nr(r)?Sn(r):r,b=p,g=Xu(b);for(;g&&r&&m!==b;){let x=ol(g),y=g.getBoundingClientRect(),h=rr(g),v=y.left+(g.clientLeft+parseFloat(h.paddingLeft))*x.x,S=y.top+(g.clientTop+parseFloat(h.paddingTop))*x.y;c*=x.x,u*=x.y,f*=x.x,d*=x.y,c+=v,u+=S,b=Sn(g),g=Xu(b)}}return qo({width:f,height:d,x:c,y:u})}function Zu(e,t){let n=Ns(e).scrollLeft;return t?t.left+n:Yo(hr(e)).left+n}function Rw(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zu(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function xO(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a==="fixed",i=hr(r),s=t?Ts(t.floating):!1;if(r===i||s&&o)return n;let c={scrollLeft:0,scrollTop:0},u=pr(1),f=pr(0),d=zr(r);if((d||!d&&!o)&&((Fo(r)!=="body"||al(i))&&(c=Ns(r)),d)){let m=Yo(r);u=ol(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}let p=i&&!d&&!o?Rw(i,c):pr(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+p.x,y:n.y*u.y-c.scrollTop*u.y+f.y+p.y}}function SO(e){return Array.from(e.getClientRects())}function wO(e){let t=hr(e),n=Ns(e),r=e.ownerDocument.body,a=ln(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ln(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),i=-n.scrollLeft+Zu(e),s=-n.scrollTop;return rr(r).direction==="rtl"&&(i+=ln(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:s}}var xw=25;function AO(e,t){let n=Sn(e),r=hr(e),a=n.visualViewport,o=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;let f=Qu();(!f||f&&t==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}let u=Zu(r);if(u<=0){let f=r.ownerDocument,d=f.body,p=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(r.clientWidth-d.clientWidth-m);b<=xw&&(o-=b)}else u<=xw&&(o+=u);return{width:o,height:i,x:s,y:c}}function CO(e,t){let n=Yo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=zr(e)?ol(e):pr(1),i=e.clientWidth*o.x,s=e.clientHeight*o.y,c=a*o.x,u=r*o.y;return{width:i,height:s,x:c,y:u}}function Sw(e,t,n){let r;if(t==="viewport")r=AO(e,n);else if(t==="document")r=wO(hr(e));else if(nr(t))r=CO(t,n);else{let a=Cw(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return qo(r)}function Ew(e,t){let n=ya(e);return n===t||!nr(n)||Go(n)?!1:rr(n).position==="fixed"||Ew(n,t)}function RO(e,t){let n=t.get(e);if(n)return n;let r=Ko(e,[],!1).filter(s=>nr(s)&&Fo(s)!=="body"),a=null,o=rr(e).position==="fixed",i=o?ya(e):e;for(;nr(i)&&!Go(i);){let s=rr(i),c=Wu(i);!c&&s.position==="fixed"&&(a=null),(o?!c&&!a:!c&&s.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||al(i)&&!c&&Ew(e,i))?r=r.filter(f=>f!==i):a=s,i=ya(i)}return t.set(e,r),r}function EO(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,i=[...n==="clippingAncestors"?Ts(t)?[]:RO(t,this._c):[].concat(n),r],s=Sw(t,i[0],a),c=s.top,u=s.right,f=s.bottom,d=s.left;for(let p=1;p<i.length;p++){let m=Sw(t,i[p],a);c=ln(m.top,c),u=kr(m.right,u),f=kr(m.bottom,f),d=ln(m.left,d)}return{width:u-d,height:f-c,x:d,y:c}}function TO(e){let{width:t,height:n}=Aw(e);return{width:t,height:n}}function NO(e,t,n){let r=zr(t),a=hr(t),o=n==="fixed",i=Yo(e,!0,o,t),s={scrollLeft:0,scrollTop:0},c=pr(0);function u(){c.x=Zu(a)}if(r||!r&&!o)if((Fo(t)!=="body"||al(a))&&(s=Ns(t)),r){let m=Yo(t,!0,o,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else a&&u();o&&!r&&a&&u();let f=a&&!r&&!o?Rw(a,s):pr(0),d=i.left+s.scrollLeft-c.x-f.x,p=i.top+s.scrollTop-c.y-f.y;return{x:d,y:p,width:i.width,height:i.height}}function tg(e){return rr(e).position==="static"}function ww(e,t){if(!zr(e)||rr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return hr(e)===n&&(n=n.ownerDocument.body),n}function Tw(e,t){let n=Sn(e);if(Ts(e))return n;if(!zr(e)){let a=ya(e);for(;a&&!Go(a);){if(nr(a)&&!tg(a))return a;a=ya(a)}return n}let r=ww(e,t);for(;r&&yw(r)&&tg(r);)r=ww(r,t);return r&&Go(r)&&tg(r)&&!Wu(r)?n:r||vw(e)||n}var MO=async function(e){let t=this.getOffsetParent||Tw,n=this.getDimensions,r=await n(e.floating);return{reference:NO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function OO(e){return rr(e).direction==="rtl"}var Nw={convertOffsetParentRelativeRectToViewportRelativeRect:xO,getDocumentElement:hr,getClippingRect:EO,getOffsetParent:Tw,getElementRects:MO,getClientRects:SO,getDimensions:TO,getScale:ol,isElement:nr,isRTL:OO};function Mw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _O(e,t){let n=null,r,a=hr(e);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),o();let u=e.getBoundingClientRect(),{left:f,top:d,width:p,height:m}=u;if(s||t(),!p||!m)return;let b=Es(d),g=Es(a.clientWidth-(f+p)),x=Es(a.clientHeight-(d+m)),y=Es(f),v={rootMargin:-b+"px "+-g+"px "+-x+"px "+-y+"px",threshold:ln(0,kr(1,c))||1},S=!0;function C(T){let w=T[0].intersectionRatio;if(w!==c){if(!S)return i();w?i(!1,w):r=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!Mw(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...v,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return i(!0),o}function rg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ng(e),f=a||o?[...u?Ko(u):[],...t?Ko(t):[]]:[];f.forEach(y=>{a&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});let d=u&&s?_O(u,n):null,p=-1,m=null;i&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let b,g=c?Yo(e):null;c&&x();function x(){let y=Yo(e);g&&!Mw(g,y)&&n(),g=y,b=requestAnimationFrame(x)}return n(),()=>{var y;f.forEach(h=>{a&&h.removeEventListener("scroll",n),o&&h.removeEventListener("resize",n)}),d?.(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(b)}}var Ow=dw;var _w=fw,kw=sw,Lw=pw,Dw=cw,ag=lw;var zw=mw,og=(e,t,n)=>{let r=new Map,a={platform:Nw,...n},o={...a.platform,_c:r};return iw(e,t,{...a,platform:o})};var zt=K(xe(),1),Iw=K(xe(),1),Uw=K(ho(),1),kO=typeof document<"u",LO=function(){},Ju=kO?Iw.useLayoutEffect:LO;function ed(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,a;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(!ed(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){let o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!ed(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function jw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bw(e,t){let n=jw(e);return Math.round(t*n)/n}function ig(e){let t=zt.useRef(e);return Ju(()=>{t.current=e}),t}function Pw(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[f,d]=zt.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=zt.useState(r);ed(p,r)||m(r);let[b,g]=zt.useState(null),[x,y]=zt.useState(null),h=zt.useCallback(Y=>{Y!==T.current&&(T.current=Y,g(Y))},[]),v=zt.useCallback(Y=>{Y!==w.current&&(w.current=Y,y(Y))},[]),S=o||b,C=i||x,T=zt.useRef(null),w=zt.useRef(null),R=zt.useRef(f),M=c!=null,k=ig(c),I=ig(a),H=ig(u),Q=zt.useCallback(()=>{if(!T.current||!w.current)return;let Y={placement:t,strategy:n,middleware:p};I.current&&(Y.platform=I.current),og(T.current,w.current,Y).then(q=>{let V={...q,isPositioned:H.current!==!1};ee.current&&!ed(R.current,V)&&(R.current=V,Uw.flushSync(()=>{d(V)}))})},[p,t,n,I,H]);Ju(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,d(Y=>({...Y,isPositioned:!1})))},[u]);let ee=zt.useRef(!1);Ju(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Ju(()=>{if(S&&(T.current=S),C&&(w.current=C),S&&C){if(k.current)return k.current(S,C,Q);Q()}},[S,C,Q,k,M]);let X=zt.useMemo(()=>({reference:T,floating:w,setReference:h,setFloating:v}),[h,v]),z=zt.useMemo(()=>({reference:S,floating:C}),[S,C]),te=zt.useMemo(()=>{let Y={position:n,left:0,top:0};if(!z.floating)return Y;let q=Bw(z.floating,f.x),V=Bw(z.floating,f.y);return s?{...Y,transform:"translate("+q+"px, "+V+"px)",...jw(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:V}},[n,s,z.floating,f.x,f.y]);return zt.useMemo(()=>({...f,update:Q,refs:X,elements:z,floatingStyles:te}),[f,Q,X,z,te])}var DO=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){let{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ag({element:r.current,padding:a}).fn(n):{}:r?ag({element:r,padding:a}).fn(n):{}}}},Vw=(e,t)=>{let n=Ow(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hw=(e,t)=>{let n=_w(e);return{name:n.name,fn:n.fn,options:[e,t]}},qw=(e,t)=>({fn:zw(e).fn,options:[e,t]}),$w=(e,t)=>{let n=kw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kw=(e,t)=>{let n=Lw(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Fw=(e,t)=>{let n=Dw(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Gw=(e,t)=>{let n=DO(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yw=K(xe(),1);var lg=K(Be(),1),zO="Arrow",Ww=Yw.forwardRef((e,t)=>{let{children:n,width:r=10,height:a=5,...o}=e;return(0,lg.jsx)(Oe.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,lg.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Ww.displayName=zO;var Qw=Ww;var oo=K(Be(),1);var sg="Popper",[Xw,cg]=Jn(sg),[IO,Zw]=Xw(sg),Jw=e=>{let{__scopePopper:t,children:n}=e,[r,a]=wn.useState(null);return(0,oo.jsx)(IO,{scope:t,anchor:r,onAnchorChange:a,children:n})};Jw.displayName=sg;var eA="PopperAnchor",tA=wn.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=Zw(eA,n),i=wn.useRef(null),s=Xe(t,i),c=wn.useRef(null);return wn.useEffect(()=>{let u=c.current;c.current=r?.current||i.current,u!==c.current&&o.onAnchorChange(c.current)}),r?null:(0,oo.jsx)(Oe.div,{...a,ref:s})});tA.displayName=eA;var ug="PopperContent",[UO,jO]=Xw(ug),nA=wn.forwardRef((e,t)=>{let{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:b,...g}=e,x=Zw(ug,n),[y,h]=wn.useState(null),v=Xe(t,U=>h(U)),[S,C]=wn.useState(null),T=Lu(S),w=T?.width??0,R=T?.height??0,M=r+(o!=="center"?"-"+o:""),k=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},I=Array.isArray(u)?u:[u],H=I.length>0,Q={padding:k,boundary:I.filter(VO),altBoundary:H},{refs:ee,floatingStyles:X,placement:z,isPositioned:te,middlewareData:Y}=Pw({strategy:"fixed",placement:M,whileElementsMounted:(...U)=>rg(...U,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[Vw({mainAxis:a+R,alignmentAxis:i}),c&&Hw({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?qw():void 0,...Q}),c&&$w({...Q}),Kw({...Q,apply:({elements:U,rects:ne,availableWidth:ue,availableHeight:me})=>{let{width:re,height:oe}=ne.reference,Ne=U.floating.style;Ne.setProperty("--radix-popper-available-width",`${ue}px`),Ne.setProperty("--radix-popper-available-height",`${me}px`),Ne.setProperty("--radix-popper-anchor-width",`${re}px`),Ne.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),S&&Gw({element:S,padding:s}),HO({arrowWidth:w,arrowHeight:R}),p&&Fw({strategy:"referenceHidden",...Q})]}),[q,V]=oA(z),_e=bn(b);xt(()=>{te&&_e?.()},[te,_e]);let F=Y.arrow?.x,he=Y.arrow?.y,Z=Y.arrow?.centerOffset!==0,[ae,Se]=wn.useState();return xt(()=>{y&&Se(window.getComputedStyle(y).zIndex)},[y]),(0,oo.jsx)("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:te?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[Y.transformOrigin?.x,Y.transformOrigin?.y].join(" "),...Y.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,oo.jsx)(UO,{scope:n,placedSide:q,onArrowChange:C,arrowX:F,arrowY:he,shouldHideArrow:Z,children:(0,oo.jsx)(Oe.div,{"data-side":q,"data-align":V,...g,ref:v,style:{...g.style,animation:te?void 0:"none"}})})})});nA.displayName=ug;var rA="PopperArrow",PO={top:"bottom",right:"left",bottom:"top",left:"right"},aA=wn.forwardRef(function(t,n){let{__scopePopper:r,...a}=t,o=jO(rA,r),i=PO[o.placedSide];return(0,oo.jsx)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:(0,oo.jsx)(Qw,{...a,ref:n,style:{...a.style,display:"block"}})})});aA.displayName=rA;function VO(e){return e!==null}var HO=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=oA(n),d={start:"0%",center:"50%",end:"100%"}[f],p=(a.arrow?.x??0)+s/2,m=(a.arrow?.y??0)+c/2,b="",g="";return u==="bottom"?(b=i?d:`${p}px`,g=`${-c}px`):u==="top"?(b=i?d:`${p}px`,g=`${r.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=i?d:`${m}px`):u==="left"&&(b=`${r.floating.width+c}px`,g=i?d:`${m}px`),{data:{x:b,y:g}}}});function oA(e){let[t,n="center"]=e.split("-");return[t,n]}var iA=Jw,lA=tA,sA=nA,cA=aA;var td=K(xe(),1),uA=K(ho(),1);var dA=K(Be(),1),$O="Portal",dg=td.forwardRef((e,t)=>{let{container:n,...r}=e,[a,o]=td.useState(!1);xt(()=>o(!0),[]);let i=n||a&&globalThis?.document?.body;return i?uA.default.createPortal((0,dA.jsx)(Oe.div,{...r,ref:t}),i):null});dg.displayName=$O;var fA=K(xe(),1);var mA=K(Be(),1),fg=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),KO="VisuallyHidden",FO=fA.forwardRef((e,t)=>(0,mA.jsx)(Oe.span,{...e,ref:t,style:{...fg,...e.style}}));FO.displayName=KO;var GO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},il=new WeakMap,nd=new WeakMap,rd={},mg=0,pA=function(e){return e&&(e.host||pA(e.parentNode))},YO=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pA(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},WO=function(e,t,n,r){var a=YO(t,Array.isArray(e)?e:[e]);rd[n]||(rd[n]=new WeakMap);var o=rd[n],i=[],s=new Set,c=new Set(a),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};a.forEach(u);var f=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(s.has(p))f(p);else try{var m=p.getAttribute(r),b=m!==null&&m!=="false",g=(il.get(p)||0)+1,x=(o.get(p)||0)+1;il.set(p,g),o.set(p,x),i.push(p),g===1&&b&&nd.set(p,!0),x===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return f(t),s.clear(),mg++,function(){i.forEach(function(d){var p=il.get(d)-1,m=o.get(d)-1;il.set(d,p),o.set(d,m),p||(nd.has(d)||d.removeAttribute(r),nd.delete(d)),m||d.removeAttribute(n)}),mg--,mg||(il=new WeakMap,il=new WeakMap,nd=new WeakMap,rd={})}},gA=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||GO(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),WO(r,a,n,"aria-hidden")):function(){return null}};var An=function(){return An=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},An.apply(this,arguments)};function ad(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function hA(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var cd=K(xe());var nn=K(xe());var Wo="right-scroll-bar-position",Qo="width-before-scroll-bar",pg="with-scroll-bars-hidden",gg="--removed-body-scroll-bar-size";function od(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var yA=K(xe());function vA(e,t){var n=(0,yA.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var id=K(xe());var QO=typeof window<"u"?id.useLayoutEffect:id.useEffect,bA=new WeakMap;function hg(e,t){var n=vA(t||null,function(r){return e.forEach(function(a){return od(a,r)})});return QO(function(){var r=bA.get(n);if(r){var a=new Set(r),o=new Set(e),i=n.current;a.forEach(function(s){o.has(s)||od(s,null)}),o.forEach(function(s){a.has(s)||od(s,i)})}bA.set(n,e)},[e]),n}function XO(e){return e}function ZO(e,t){t===void 0&&(t=XO);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(s){return o(s)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(o),i=n}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return a}function yg(e){e===void 0&&(e={});var t=ZO(null);return t.options=An({async:!0,ssr:!1},e),t}var xA=K(xe()),SA=function(e){var t=e.sideCar,n=ad(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return xA.createElement(r,An({},n))};SA.isSideCarExport=!0;function vg(e,t){return e.useMedium(t),SA}var ld=yg();var bg=function(){},Ms=nn.forwardRef(function(e,t){var n=nn.useRef(null),r=nn.useState({onScrollCapture:bg,onWheelCapture:bg,onTouchMoveCapture:bg}),a=r[0],o=r[1],i=e.forwardProps,s=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,p=e.sideCar,m=e.noRelative,b=e.noIsolation,g=e.inert,x=e.allowPinchZoom,y=e.as,h=y===void 0?"div":y,v=e.gapMode,S=ad(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,T=hg([n,t]),w=An(An({},S),a);return nn.createElement(nn.Fragment,null,f&&nn.createElement(C,{sideCar:ld,removeScrollBar:u,shards:d,noRelative:m,noIsolation:b,inert:g,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:v}),i?nn.cloneElement(nn.Children.only(s),An(An({},w),{ref:T})):nn.createElement(h,An({},w,{className:c,ref:T}),s))});Ms.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ms.classNames={fullWidth:Qo,zeroRight:Wo};var pt=K(xe());var sl=K(xe());var CA=K(xe());var wA;var AA=function(){if(wA)return wA;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=AA();return t&&e.setAttribute("nonce",t),e}function e_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function t_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=JO())&&(e_(t,n),t_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var Sg=function(){var e=xg();return function(t,n){CA.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};var Os=function(){var e=Sg(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t};var n_={left:0,top:0,right:0,gap:0},wg=function(e){return parseInt(e||"",10)||0},r_=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[wg(n),wg(r),wg(a)]},Ag=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return n_;var t=r_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}};var a_=Os(),ll="data-scroll-locked",o_=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),`
8
+ `+r.stack}}var Qf=Object.prototype.hasOwnProperty,Pm=It.unstable_scheduleCallback,mf=It.unstable_cancelCallback,eE=It.unstable_shouldYield,tE=It.unstable_requestPaint,Mn=It.unstable_now,nE=It.unstable_getCurrentPriorityLevel,Uv=It.unstable_ImmediatePriority,jv=It.unstable_UserBlockingPriority,Ic=It.unstable_NormalPriority,rE=It.unstable_LowPriority,Pv=It.unstable_IdlePriority,aE=It.log,oE=It.unstable_setDisableYieldValue,us=null,On=null;function ka(e){if(typeof aE=="function"&&oE(e),On&&typeof On.setStrictMode=="function")try{On.setStrictMode(us,e)}catch{}}var _n=Math.clz32?Math.clz32:sE,iE=Math.log,lE=Math.LN2;function sE(e){return e>>>=0,e===0?32:31-(iE(e)/lE|0)|0}var nc=256,rc=262144,ac=4194304;function bo(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 cu(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,o=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~o,r!==0?a=bo(r):(i&=s,i!==0?a=bo(i):n||(n=s&~e,n!==0&&(a=bo(n))))):(s=r&~o,s!==0?a=bo(s):i!==0?a=bo(i):n||(n=r&~e,n!==0&&(a=bo(n)))),a===0?0:t!==0&&t!==a&&(t&o)===0&&(o=a&-a,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:a}function ds(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function cE(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 Vv(){var e=ac;return ac<<=1,(ac&62914560)===0&&(ac=4194304),e}function pf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function fs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function uE(e,t,n,r,a,o){var i=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,u=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-_n(n),d=1<<f;s[f]=0,c[f]=-1;var p=u[f];if(p!==null)for(u[f]=null,f=0;f<p.length;f++){var m=p[f];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&Hv(e,r,0),o!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=o&~(i&~t))}function Hv(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-_n(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-_n(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function $v(e,t){var n=t&-t;return n=(n&42)!==0?1:Vm(n),(n&(e.suspendedLanes|t))!==0?0:n}function Vm(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 Hm(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Kv(){var e=Fe.p;return e!==0?e:(e=window.event,e===void 0?32:px(e.type))}function uy(e,t){var n=Fe.p;try{return Fe.p=e,t()}finally{Fe.p=n}}var Qa=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Qa,yn="__reactProps$"+Qa,Gi="__reactContainer$"+Qa,Xf="__reactEvents$"+Qa,dE="__reactListeners$"+Qa,fE="__reactHandles$"+Qa,dy="__reactResources$"+Qa,ms="__reactMarker$"+Qa;function qm(e){delete e[Qt],delete e[yn],delete e[Xf],delete e[dE],delete e[fE]}function bi(e){var t=e[Qt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gi]||n[Qt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bv(e);e!==null;){if(n=e[Qt])return n;e=bv(e)}return t}e=n,n=e.parentNode}return null}function Yi(e){if(e=e[Qt]||e[Gi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ll(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Mi(e){var t=e[dy];return t||(t=e[dy]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function qt(e){e[ms]=!0}var Fv=new Set,Gv={};function ko(e,t){Ii(e,t),Ii(e+"Capture",t)}function Ii(e,t){for(Gv[e]=t,e=0;e<t.length;e++)Fv.add(t[e])}var mE=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]*$"),fy={},my={};function pE(e){return Qf.call(my,e)?!0:Qf.call(fy,e)?!1:mE.test(e)?my[e]=!0:(fy[e]=!0,!1)}function bc(e,t,n){if(pE(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 oc(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 Gr(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 Hn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gE(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){n=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zf(e){if(!e._valueTracker){var t=Yv(e)?"checked":"value";e._valueTracker=gE(e,t,""+e[t])}}function Wv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Uc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hE=/[\n"\\]/g;function Kn(e){return e.replace(hE,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jf(e,t,n,r,a,o,i,s){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Hn(t)):e.value!==""+Hn(t)&&(e.value=""+Hn(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?em(e,i,Hn(t)):n!=null?em(e,i,Hn(n)):r!=null&&e.removeAttribute("value"),a==null&&o!=null&&(e.defaultChecked=!!o),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Hn(s):e.removeAttribute("name")}function Qv(e,t,n,r,a,o,i,s){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){Zf(e);return}n=n!=null?""+Hn(n):"",t=t!=null?""+Hn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??a,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),Zf(e)}function em(e,t,n){t==="number"&&Uc(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Oi(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Hn(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Xv(e,t,n){if(t!=null&&(t=""+Hn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Hn(n):""}function Zv(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(L(92));if(kl(r)){if(1<r.length)throw Error(L(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Hn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Zf(e)}function Ui(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yE=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 py(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||yE.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Jv(e,t,n){if(t!=null&&typeof t!="object")throw Error(L(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&&py(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&py(e,o,t[o])}function $m(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 vE=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"]]),bE=/^[\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 xc(e){return bE.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var tm=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xi=null,_i=null;function gy(e){var t=Yi(e);if(t&&(e=t.stateNode)){var n=e[yn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Jf(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="'+Kn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[yn]||null;if(!a)throw Error(L(90));Jf(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&&Wv(r)}break e;case"textarea":Xv(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Oi(e,!!n.multiple,t,!1)}}}var gf=!1;function eb(e,t,n){if(gf)return e(t,n);gf=!0;try{var r=e(t);return r}finally{if(gf=!1,(xi!==null||_i!==null)&&(Su(),xi&&(t=xi,e=_i,_i=xi=null,gy(t),e)))for(t=0;t<e.length;t++)gy(e[t])}}function Ql(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yn]||null;if(r===null)return null;n=r[t];e: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 e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(L(231,t,typeof n));return n}var ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nm=!1;if(ia)try{fi={},Object.defineProperty(fi,"passive",{get:function(){nm=!0}}),window.addEventListener("test",fi,fi),window.removeEventListener("test",fi,fi)}catch{nm=!1}var fi,La=null,Fm=null,Sc=null;function tb(){if(Sc)return Sc;var e,t=Fm,n=t.length,r,a="value"in La?La.value:La.textContent,o=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===a[o-r];r++);return Sc=a.slice(e,1<r?1-r:void 0)}function wc(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 ic(){return!0}function hy(){return!1}function vn(e){function t(n,r,a,o,i){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(o):o[s]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?ic:hy,this.isPropagationStopped=hy,this}return mt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ic)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ic)},persist:function(){},isPersistent:ic}),t}var Lo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uu=vn(Lo),ps=mt({},Lo,{view:0,detail:0}),xE=vn(ps),hf,yf,Rl,du=mt({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gm,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!==Rl&&(Rl&&e.type==="mousemove"?(hf=e.screenX-Rl.screenX,yf=e.screenY-Rl.screenY):yf=hf=0,Rl=e),hf)},movementY:function(e){return"movementY"in e?e.movementY:yf}}),yy=vn(du),SE=mt({},du,{dataTransfer:0}),wE=vn(SE),AE=mt({},ps,{relatedTarget:0}),vf=vn(AE),CE=mt({},Lo,{animationName:0,elapsedTime:0,pseudoElement:0}),RE=vn(CE),EE=mt({},Lo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),NE=vn(EE),TE=mt({},Lo,{data:0}),vy=vn(TE),ME={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OE={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"},_E={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_E[e])?!!t[e]:!1}function Gm(){return kE}var LE=mt({},ps,{key:function(e){if(e.key){var t=ME[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?OE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gm,charCode:function(e){return e.type==="keypress"?wc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),DE=vn(LE),zE=mt({},du,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),by=vn(zE),BE=mt({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gm}),IE=vn(BE),UE=mt({},Lo,{propertyName:0,elapsedTime:0,pseudoElement:0}),jE=vn(UE),PE=mt({},du,{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}),VE=vn(PE),HE=mt({},Lo,{newState:0,oldState:0}),qE=vn(HE),$E=[9,13,27,32],Ym=ia&&"CompositionEvent"in window,Bl=null;ia&&"documentMode"in document&&(Bl=document.documentMode);var KE=ia&&"TextEvent"in window&&!Bl,nb=ia&&(!Ym||Bl&&8<Bl&&11>=Bl),xy=" ",Sy=!1;function rb(e,t){switch(e){case"keyup":return $E.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ab(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function FE(e,t){switch(e){case"compositionend":return ab(t);case"keypress":return t.which!==32?null:(Sy=!0,xy);case"textInput":return e=t.data,e===xy&&Sy?null:e;default:return null}}function GE(e,t){if(Si)return e==="compositionend"||!Ym&&rb(e,t)?(e=tb(),Sc=Fm=La=null,Si=!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 nb&&t.locale!=="ko"?null:t.data;default:return null}}var YE={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 wy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!YE[e.type]:t==="textarea"}function ob(e,t,n,r){xi?_i?_i.push(r):_i=[r]:xi=r,t=nu(t,"onChange"),0<t.length&&(n=new uu("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Il=null,Xl=null;function WE(e){ex(e,0)}function fu(e){var t=Ll(e);if(Wv(t))return e}function Ay(e,t){if(e==="change")return t}var ib=!1;ia&&(ia?(sc="oninput"in document,sc||(bf=document.createElement("div"),bf.setAttribute("oninput","return;"),sc=typeof bf.oninput=="function"),lc=sc):lc=!1,ib=lc&&(!document.documentMode||9<document.documentMode));var lc,sc,bf;function Cy(){Il&&(Il.detachEvent("onpropertychange",lb),Xl=Il=null)}function lb(e){if(e.propertyName==="value"&&fu(Xl)){var t=[];ob(t,Xl,e,Km(e)),eb(WE,t)}}function QE(e,t,n){e==="focusin"?(Cy(),Il=t,Xl=n,Il.attachEvent("onpropertychange",lb)):e==="focusout"&&Cy()}function XE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fu(Xl)}function ZE(e,t){if(e==="click")return fu(t)}function JE(e,t){if(e==="input"||e==="change")return fu(t)}function eN(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ln=typeof Object.is=="function"?Object.is:eN;function Zl(e,t){if(Ln(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)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 a=n[r];if(!Qf.call(t,a)||!Ln(e[a],t[a]))return!1}return!0}function Ry(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ey(e,t){var n=Ry(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}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ry(n)}}function sb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Uc(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=Uc(e.document)}return t}function Wm(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 tN=ia&&"documentMode"in document&&11>=document.documentMode,wi=null,rm=null,Ul=null,am=!1;function Ny(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;am||wi==null||wi!==Uc(r)||(r=wi,"selectionStart"in r&&Wm(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}),Ul&&Zl(Ul,r)||(Ul=r,r=nu(rm,"onSelect"),0<r.length&&(t=new uu("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=wi)))}function yo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ai={animationend:yo("Animation","AnimationEnd"),animationiteration:yo("Animation","AnimationIteration"),animationstart:yo("Animation","AnimationStart"),transitionrun:yo("Transition","TransitionRun"),transitionstart:yo("Transition","TransitionStart"),transitioncancel:yo("Transition","TransitionCancel"),transitionend:yo("Transition","TransitionEnd")},xf={},ub={};ia&&(ub=document.createElement("div").style,"AnimationEvent"in window||(delete Ai.animationend.animation,delete Ai.animationiteration.animation,delete Ai.animationstart.animation),"TransitionEvent"in window||delete Ai.transitionend.transition);function Do(e){if(xf[e])return xf[e];if(!Ai[e])return e;var t=Ai[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ub)return xf[e]=t[n];return e}var db=Do("animationend"),fb=Do("animationiteration"),mb=Do("animationstart"),nN=Do("transitionrun"),rN=Do("transitionstart"),aN=Do("transitioncancel"),pb=Do("transitionend"),gb=new Map,om="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(" ");om.push("scrollEnd");function fr(e,t){gb.set(e,t),ko(t,[e])}var jc=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!==null&&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)},Vn=[],Ci=0,Qm=0;function mu(){for(var e=Ci,t=Qm=Ci=0;t<e;){var n=Vn[t];Vn[t++]=null;var r=Vn[t];Vn[t++]=null;var a=Vn[t];Vn[t++]=null;var o=Vn[t];if(Vn[t++]=null,r!==null&&a!==null){var i=r.pending;i===null?a.next=a:(a.next=i.next,i.next=a),r.pending=a}o!==0&&hb(n,a,o)}}function pu(e,t,n,r){Vn[Ci++]=e,Vn[Ci++]=t,Vn[Ci++]=n,Vn[Ci++]=r,Qm|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xm(e,t,n,r){return pu(e,t,n,r),Pc(e)}function zo(e,t){return pu(e,null,null,t),Pc(e)}function hb(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var a=!1,o=e.return;o!==null;)o.childLanes|=n,r=o.alternate,r!==null&&(r.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(a=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,a&&t!==null&&(a=31-_n(n),e=o.hiddenUpdates,r=e[a],r===null?e[a]=[t]:r.push(t),t.lane=n|536870912),o):null}function Pc(e){if(50<Gl)throw Gl=0,Em=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ri={};function oN(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 Nn(e,t,n,r){return new oN(e,t,n,r)}function Zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ra(e,t){var n=e.alternate;return n===null?(n=Nn(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 yb(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 Ac(e,t,n,r,a,o){var i=0;if(r=e,typeof e=="function")Zm(e)&&(i=1);else if(typeof e=="string")i=sT(e,n,Nr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ff:return e=Nn(31,n,t,a),e.elementType=Ff,e.lanes=o,e;case yi:return Ao(n.children,a,o,t);case Bv:i=8,a|=24;break;case qf:return e=Nn(12,n,t,a|2),e.elementType=qf,e.lanes=o,e;case $f:return e=Nn(13,n,t,a),e.elementType=$f,e.lanes=o,e;case Kf:return e=Nn(19,n,t,a),e.elementType=Kf,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ea:i=10;break e;case Iv:i=9;break e;case Um:i=11;break e;case jm:i=14;break e;case Ea:i=16,r=null;break e}i=29,n=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=Nn(i,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ao(e,t,n,r){return e=Nn(7,e,r,t),e.lanes=n,e}function Sf(e,t,n){return e=Nn(6,e,null,t),e.lanes=n,e}function vb(e){var t=Nn(18,null,null,0);return t.stateNode=e,t}function wf(e,t,n){return t=Nn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ty=new WeakMap;function Fn(e,t){if(typeof e=="object"&&e!==null){var n=Ty.get(e);return n!==void 0?n:(t={value:e,source:t,stack:cy(t)},Ty.set(e,t),t)}return{value:e,source:t,stack:cy(t)}}var Ei=[],Ni=0,Vc=null,Jl=0,qn=[],$n=0,Fa=null,Cr=1,Rr="";function Zr(e,t){Ei[Ni++]=Jl,Ei[Ni++]=Vc,Vc=e,Jl=t}function bb(e,t,n){qn[$n++]=Cr,qn[$n++]=Rr,qn[$n++]=Fa,Fa=e;var r=Cr;e=Rr;var a=32-_n(r)-1;r&=~(1<<a),n+=1;var o=32-_n(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Cr=1<<32-_n(t)+a|n<<a|r,Rr=o+e}else Cr=1<<o|n<<a|r,Rr=e}function Jm(e){e.return!==null&&(Zr(e,1),bb(e,1,0))}function ep(e){for(;e===Vc;)Vc=Ei[--Ni],Ei[Ni]=null,Jl=Ei[--Ni],Ei[Ni]=null;for(;e===Fa;)Fa=qn[--$n],qn[$n]=null,Rr=qn[--$n],qn[$n]=null,Cr=qn[--$n],qn[$n]=null}function xb(e,t){qn[$n++]=Cr,qn[$n++]=Rr,qn[$n++]=Fa,Cr=t.id,Rr=t.overflow,Fa=e}var Xt=null,ft=null,je=!1,Ua=null,Gn=!1,im=Error(L(519));function Ga(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw es(Fn(t,e)),im}function My(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Qt]=e,t[yn]=r,n){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(n=0;n<as.length;n++)De(as[n],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),Qv(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),Zv(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||nx(t.textContent,n)?(r.popover!=null&&(De("beforetoggle",t),De("toggle",t)),r.onScroll!=null&&De("scroll",t),r.onScrollEnd!=null&&De("scrollend",t),r.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||Ga(e,!0)}function Oy(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Gn=!1;return;case 27:case 3:Gn=!0;return;default:Xt=Xt.return}}function mi(e){if(e!==Xt)return!1;if(!je)return Oy(e),je=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||_m(e.type,e.memoizedProps)),n=!n),n&&ft&&Ga(e),Oy(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));ft=vv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));ft=vv(e)}else t===27?(t=ft,Xa(e.type)?(e=zm,zm=null,ft=e):ft=t):ft=Xt?Wn(e.stateNode.nextSibling):null;return!0}function No(){ft=Xt=null,je=!1}function Af(){var e=Ua;return e!==null&&(gn===null?gn=e:gn.push.apply(gn,e),Ua=null),e}function es(e){Ua===null?Ua=[e]:Ua.push(e)}var lm=Tr(null),Bo=null,na=null;function Ta(e,t,n){lt(lm,t._currentValue),t._currentValue=n}function aa(e){e._currentValue=lm.current,$t(lm)}function sm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function cm(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var i=a.child;o=o.firstContext;e:for(;o!==null;){var s=o;o=a;for(var c=0;c<t.length;c++)if(s.context===t[c]){o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),sm(o.return,n,e),r||(i=null);break e}o=s.next}}else if(a.tag===18){if(i=a.return,i===null)throw Error(L(341));i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),sm(i,n,e),i=null}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===e){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}}function Wi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if((a.flags&524288)!==0)o=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var i=a.alternate;if(i===null)throw Error(L(387));if(i=i.memoizedProps,i!==null){var s=a.type;Ln(a.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(a===Dc.current){if(i=a.alternate,i===null)throw Error(L(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}a=a.return}e!==null&&cm(t,e,n,r),t.flags|=262144}function Hc(e){for(e=e.firstContext;e!==null;){if(!Ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function To(e){Bo=e,na=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zt(e){return Sb(Bo,e)}function cc(e,t){return Bo===null&&To(e),Sb(e,t)}function Sb(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},na===null){if(e===null)throw Error(L(308));na=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else na=na.next=t;return n}var iN=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},lN=It.unstable_scheduleCallback,sN=It.unstable_NormalPriority,kt={$$typeof:ea,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tp(){return{controller:new iN,data:new Map,refCount:0}}function gs(e){e.refCount--,e.refCount===0&&lN(sN,function(){e.controller.abort()})}var jl=null,um=0,ji=0,ki=null;function cN(e,t){if(jl===null){var n=jl=[];um=0,ji=Ep(),ki={status:"pending",value:void 0,then:function(r){n.push(r)}}}return um++,t.then(_y,_y),t}function _y(){if(--um===0&&jl!==null){ki!==null&&(ki.status="fulfilled");var e=jl;jl=null,ji=0,ki=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uN(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(r.status="rejected",r.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),r}var ky=ve.S;ve.S=function(e,t){z0=Mn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&cN(e,t),ky!==null&&ky(e,t)};var Co=Tr(null);function np(){var e=Co.current;return e!==null?e:rt.pooledCache}function Cc(e,t){t===null?lt(Co,Co.current):lt(Co,t.pool)}function wb(){var e=np();return e===null?null:{parent:kt._currentValue,pool:e}}var Qi=Error(L(460)),rp=Error(L(474)),gu=Error(L(542)),qc={then:function(){}};function Ly(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ab(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ta,ta),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zy(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=r}},function(r){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zy(e),e}throw Ro=t,Qi}}function xo(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ro=n,Qi):n}}var Ro=null;function Dy(){if(Ro===null)throw Error(L(459));var e=Ro;return Ro=null,e}function zy(e){if(e===Qi||e===gu)throw Error(L(483))}var Li=null,ts=0;function uc(e){var t=ts;return ts+=1,Li===null&&(Li=[]),Ab(Li,e,t)}function El(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function dc(e,t){throw t.$$typeof===QR?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Cb(e){function t(y,h){if(e){var v=y.deletions;v===null?(y.deletions=[h],y.flags|=16):v.push(h)}}function n(y,h){if(!e)return null;for(;h!==null;)t(y,h),h=h.sibling;return null}function r(y){for(var h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function a(y,h){return y=ra(y,h),y.index=0,y.sibling=null,y}function o(y,h,v){return y.index=v,e?(v=y.alternate,v!==null?(v=v.index,v<h?(y.flags|=67108866,h):v):(y.flags|=67108866,h)):(y.flags|=1048576,h)}function i(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function s(y,h,v,S){return h===null||h.tag!==6?(h=Sf(v,y.mode,S),h.return=y,h):(h=a(h,v),h.return=y,h)}function c(y,h,v,S){var C=v.type;return C===yi?f(y,h,v.props.children,S,v.key):h!==null&&(h.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&xo(C)===h.type)?(h=a(h,v.props),El(h,v),h.return=y,h):(h=Ac(v.type,v.key,v.props,null,y.mode,S),El(h,v),h.return=y,h)}function u(y,h,v,S){return h===null||h.tag!==4||h.stateNode.containerInfo!==v.containerInfo||h.stateNode.implementation!==v.implementation?(h=wf(v,y.mode,S),h.return=y,h):(h=a(h,v.children||[]),h.return=y,h)}function f(y,h,v,S,C){return h===null||h.tag!==7?(h=Ao(v,y.mode,S,C),h.return=y,h):(h=a(h,v),h.return=y,h)}function d(y,h,v){if(typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint")return h=Sf(""+h,y.mode,v),h.return=y,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case tc:return v=Ac(h.type,h.key,h.props,null,y.mode,v),El(v,h),v.return=y,v;case _l:return h=wf(h,y.mode,v),h.return=y,h;case Ea:return h=xo(h),d(y,h,v)}if(kl(h)||Cl(h))return h=Ao(h,y.mode,v,null),h.return=y,h;if(typeof h.then=="function")return d(y,uc(h),v);if(h.$$typeof===ea)return d(y,cc(y,h),v);dc(y,h)}return null}function p(y,h,v,S){var C=h!==null?h.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return C!==null?null:s(y,h,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case tc:return v.key===C?c(y,h,v,S):null;case _l:return v.key===C?u(y,h,v,S):null;case Ea:return v=xo(v),p(y,h,v,S)}if(kl(v)||Cl(v))return C!==null?null:f(y,h,v,S,null);if(typeof v.then=="function")return p(y,h,uc(v),S);if(v.$$typeof===ea)return p(y,h,cc(y,v),S);dc(y,v)}return null}function m(y,h,v,S,C){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return y=y.get(v)||null,s(h,y,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case tc:return y=y.get(S.key===null?v:S.key)||null,c(h,y,S,C);case _l:return y=y.get(S.key===null?v:S.key)||null,u(h,y,S,C);case Ea:return S=xo(S),m(y,h,v,S,C)}if(kl(S)||Cl(S))return y=y.get(v)||null,f(h,y,S,C,null);if(typeof S.then=="function")return m(y,h,v,uc(S),C);if(S.$$typeof===ea)return m(y,h,v,cc(h,S),C);dc(h,S)}return null}function b(y,h,v,S){for(var C=null,N=null,w=h,R=h=0,M=null;w!==null&&R<v.length;R++){w.index>R?(M=w,w=null):M=w.sibling;var k=p(y,w,v[R],S);if(k===null){w===null&&(w=M);break}e&&w&&k.alternate===null&&t(y,w),h=o(k,h,R),N===null?C=k:N.sibling=k,N=k,w=M}if(R===v.length)return n(y,w),je&&Zr(y,R),C;if(w===null){for(;R<v.length;R++)w=d(y,v[R],S),w!==null&&(h=o(w,h,R),N===null?C=w:N.sibling=w,N=w);return je&&Zr(y,R),C}for(w=r(w);R<v.length;R++)M=m(w,y,R,v[R],S),M!==null&&(e&&M.alternate!==null&&w.delete(M.key===null?R:M.key),h=o(M,h,R),N===null?C=M:N.sibling=M,N=M);return e&&w.forEach(function(I){return t(y,I)}),je&&Zr(y,R),C}function g(y,h,v,S){if(v==null)throw Error(L(151));for(var C=null,N=null,w=h,R=h=0,M=null,k=v.next();w!==null&&!k.done;R++,k=v.next()){w.index>R?(M=w,w=null):M=w.sibling;var I=p(y,w,k.value,S);if(I===null){w===null&&(w=M);break}e&&w&&I.alternate===null&&t(y,w),h=o(I,h,R),N===null?C=I:N.sibling=I,N=I,w=M}if(k.done)return n(y,w),je&&Zr(y,R),C;if(w===null){for(;!k.done;R++,k=v.next())k=d(y,k.value,S),k!==null&&(h=o(k,h,R),N===null?C=k:N.sibling=k,N=k);return je&&Zr(y,R),C}for(w=r(w);!k.done;R++,k=v.next())k=m(w,y,R,k.value,S),k!==null&&(e&&k.alternate!==null&&w.delete(k.key===null?R:k.key),h=o(k,h,R),N===null?C=k:N.sibling=k,N=k);return e&&w.forEach(function(H){return t(y,H)}),je&&Zr(y,R),C}function x(y,h,v,S){if(typeof v=="object"&&v!==null&&v.type===yi&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case tc:e:{for(var C=v.key;h!==null;){if(h.key===C){if(C=v.type,C===yi){if(h.tag===7){n(y,h.sibling),S=a(h,v.props.children),S.return=y,y=S;break e}}else if(h.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&xo(C)===h.type){n(y,h.sibling),S=a(h,v.props),El(S,v),S.return=y,y=S;break e}n(y,h);break}else t(y,h);h=h.sibling}v.type===yi?(S=Ao(v.props.children,y.mode,S,v.key),S.return=y,y=S):(S=Ac(v.type,v.key,v.props,null,y.mode,S),El(S,v),S.return=y,y=S)}return i(y);case _l:e:{for(C=v.key;h!==null;){if(h.key===C)if(h.tag===4&&h.stateNode.containerInfo===v.containerInfo&&h.stateNode.implementation===v.implementation){n(y,h.sibling),S=a(h,v.children||[]),S.return=y,y=S;break e}else{n(y,h);break}else t(y,h);h=h.sibling}S=wf(v,y.mode,S),S.return=y,y=S}return i(y);case Ea:return v=xo(v),x(y,h,v,S)}if(kl(v))return b(y,h,v,S);if(Cl(v)){if(C=Cl(v),typeof C!="function")throw Error(L(150));return v=C.call(v),g(y,h,v,S)}if(typeof v.then=="function")return x(y,h,uc(v),S);if(v.$$typeof===ea)return x(y,h,cc(y,v),S);dc(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,h!==null&&h.tag===6?(n(y,h.sibling),S=a(h,v),S.return=y,y=S):(n(y,h),S=Sf(v,y.mode,S),S.return=y,y=S),i(y)):n(y,h)}return function(y,h,v,S){try{ts=0;var C=x(y,h,v,S);return Li=null,C}catch(w){if(w===Qi||w===gu)throw w;var N=Nn(29,w,null,y.mode);return N.lanes=S,N.return=y,N}}}var Mo=Cb(!0),Rb=Cb(!1),Na=!1;function ap(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function dm(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 ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ke&2)!==0){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=Pc(e),hb(e,null,n),t}return pu(e,r,t,n),Pc(e)}function Pl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qv(e,n)}}function Cf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,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 fm=!1;function Vl(){if(fm){var e=ki;if(e!==null)throw e}}function Hl(e,t,n,r){fm=!1;var a=e.updateQueue;Na=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var c=s,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,s=f.lastBaseUpdate,s!==i&&(s===null?f.firstBaseUpdate=u:s.next=u,f.lastBaseUpdate=c))}if(o!==null){var d=a.baseState;i=0,f=u=c=null,s=o;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Ie&p)===p:(r&p)===p){p!==0&&p===ji&&(fm=!0),f!==null&&(f=f.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var b=e,g=s;p=t;var x=n;switch(g.tag){case 1:if(b=g.payload,typeof b=="function"){d=b.call(x,d,p);break e}d=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,p=typeof b=="function"?b.call(x,d,p):b,p==null)break e;d=mt({},d,p);break e;case 2:Na=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=a.callbacks,m===null?a.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},f===null?(u=f=m,c=d):f=f.next=m,i|=p;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;m=s,s=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);f===null&&(c=d),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=f,o===null&&(a.shared.lanes=0),Wa|=i,e.lanes=i,e.memoizedState=d}}function Eb(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function Nb(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Eb(n[e],t)}var Pi=Tr(null),$c=Tr(0);function By(e,t){e=ua,lt($c,e),lt(Pi,t),ua=e|t.baseLanes}function mm(){lt($c,ua),lt(Pi,Pi.current)}function op(){ua=$c.current,$t(Pi),$t($c)}var Dn=Tr(null),Yn=null;function Ma(e){var t=e.alternate;lt(Rt,Rt.current&1),lt(Dn,e),Yn===null&&(t===null||Pi.current!==null||t.memoizedState!==null)&&(Yn=e)}function pm(e){lt(Rt,Rt.current),lt(Dn,e),Yn===null&&(Yn=e)}function Tb(e){e.tag===22?(lt(Rt,Rt.current),lt(Dn,e),Yn===null&&(Yn=e)):Oa(e)}function Oa(){lt(Rt,Rt.current),lt(Dn,Dn.current)}function En(e){$t(Dn),Yn===e&&(Yn=null),$t(Rt)}var Rt=Tr(0);function Kc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Lm(n)||Dm(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)!==0)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 la=0,Ce=null,et=null,Ot=null,Fc=!1,Di=!1,Oo=!1,Gc=0,ns=0,zi=null,dN=0;function wt(){throw Error(L(321))}function ip(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ln(e[n],t[n]))return!1;return!0}function lp(e,t,n,r,a,o){return la=o,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ve.H=e===null||e.memoizedState===null?o0:vp,Oo=!1,o=n(r,a),Oo=!1,Di&&(o=Ob(t,n,r,a)),Mb(e),o}function Mb(e){ve.H=rs;var t=et!==null&&et.next!==null;if(la=0,Ot=et=Ce=null,Fc=!1,ns=0,zi=null,t)throw Error(L(300));e===null||Lt||(e=e.dependencies,e!==null&&Hc(e)&&(Lt=!0))}function Ob(e,t,n,r){Ce=e;var a=0;do{if(Di&&(zi=null),ns=0,Di=!1,25<=a)throw Error(L(301));if(a+=1,Ot=et=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}ve.H=i0,o=t(n,r)}while(Di);return o}function fN(){var e=ve.H,t=e.useState()[0];return t=typeof t.then=="function"?hs(t):t,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Ce.flags|=1024),t}function sp(){var e=Gc!==0;return Gc=0,e}function cp(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function up(e){if(Fc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Fc=!1}la=0,Ot=et=Ce=null,Di=!1,ns=Gc=0,zi=null}function on(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Et(){if(et===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var t=Ot===null?Ce.memoizedState:Ot.next;if(t!==null)Ot=t,et=e;else{if(e===null)throw Ce.alternate===null?Error(L(467)):Error(L(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Ot===null?Ce.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function hu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hs(e){var t=ns;return ns+=1,zi===null&&(zi=[]),e=Ab(zi,e,t),t=Ce,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,ve.H=t===null||t.memoizedState===null?o0:vp),e}function yu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return hs(e);if(e.$$typeof===ea)return Zt(e)}throw Error(L(438,String(e)))}function dp(e){var t=null,n=Ce.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Ce.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=hu(),Ce.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]=XR;return t.index++,n}function sa(e,t){return typeof t=="function"?t(e):t}function Rc(e){var t=Et();return fp(t,et,e)}function fp(e,t,n){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var i=a.next;a.next=o.next,o.next=i}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var s=i=null,c=null,u=t,f=!1;do{var d=u.lane&-536870913;if(d!==u.lane?(Ie&d)===d:(la&d)===d){var p=u.revertLane;if(p===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),d===ji&&(f=!0);else if((la&p)===p){u=u.next,p===ji&&(f=!0);continue}else d={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(s=c=d,i=o):c=c.next=d,Ce.lanes|=p,Wa|=p;d=u.action,Oo&&n(o,d),o=u.hasEagerState?u.eagerState:n(o,d)}else p={lane:d,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(s=c=p,i=o):c=c.next=p,Ce.lanes|=d,Wa|=d;u=u.next}while(u!==null&&u!==t);if(c===null?i=o:c.next=s,!Ln(o,e.memoizedState)&&(Lt=!0,f&&(n=ki,n!==null)))throw n;e.memoizedState=o,e.baseState=i,e.baseQueue=c,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Rf(e){var t=Et(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do o=e(o,i.action),i=i.next;while(i!==a);Ln(o,t.memoizedState)||(Lt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function _b(e,t,n){var r=Ce,a=Et(),o=je;if(o){if(n===void 0)throw Error(L(407));n=n()}else n=t();var i=!Ln((et||a).memoizedState,n);if(i&&(a.memoizedState=n,Lt=!0),a=a.queue,mp(Db.bind(null,r,a,e),[e]),a.getSnapshot!==t||i||Ot!==null&&Ot.memoizedState.tag&1){if(r.flags|=2048,Vi(9,{destroy:void 0},Lb.bind(null,r,a,n,t),null),rt===null)throw Error(L(349));o||(la&127)!==0||kb(r,t,n)}return n}function kb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t=hu(),Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lb(e,t,n,r){t.value=n,t.getSnapshot=r,zb(t)&&Bb(e)}function Db(e,t,n){return n(function(){zb(t)&&Bb(e)})}function zb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ln(e,n)}catch{return!0}}function Bb(e){var t=zo(e,2);t!==null&&hn(t,e,2)}function gm(e){var t=on();if(typeof e=="function"){var n=e;if(e=n(),Oo){ka(!0);try{n()}finally{ka(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:e},t}function Ib(e,t,n,r){return e.baseState=n,fp(e,et,typeof r=="function"?r:sa)}function mN(e,t,n,r,a){if(bu(e))throw Error(L(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(i){o.listeners.push(i)}};ve.T!==null?n(!0):o.isTransition=!1,r(o),n=t.pending,n===null?(o.next=t.pending=o,Ub(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ub(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var o=ve.T,i={};ve.T=i;try{var s=n(a,r),c=ve.S;c!==null&&c(i,s),Iy(e,t,s)}catch(u){hm(e,t,u)}finally{o!==null&&i.types!==null&&(o.types=i.types),ve.T=o}}else try{o=n(a,r),Iy(e,t,o)}catch(u){hm(e,t,u)}}function Iy(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Uy(e,t,r)},function(r){return hm(e,t,r)}):Uy(e,t,n)}function Uy(e,t,n){t.status="fulfilled",t.value=n,jb(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ub(e,n)))}function hm(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,jb(t),t=t.next;while(t!==r)}e.action=null}function jb(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Pb(e,t){return t}function jy(e,t){if(je){var n=rt.formState;if(n!==null){e:{var r=Ce;if(je){if(ft){t:{for(var a=ft,o=Gn;a.nodeType!==8;){if(!o){a=null;break t}if(a=Wn(a.nextSibling),a===null){a=null;break t}}o=a.data,a=o==="F!"||o==="F"?a:null}if(a){ft=Wn(a.nextSibling),r=a.data==="F!";break e}}Ga(r)}r=!1}r&&(t=n[0])}}return n=on(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pb,lastRenderedState:t},n.queue=r,n=n0.bind(null,Ce,r),r.dispatch=n,r=gm(!1),o=yp.bind(null,Ce,!1,r.queue),r=on(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=mN.bind(null,Ce,a,o,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function Py(e){var t=Et();return Vb(t,et,e)}function Vb(e,t,n){if(t=fp(e,t,Pb)[0],e=Rc(sa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=hs(t)}catch(i){throw i===Qi?gu:i}else r=t;t=Et();var a=t.queue,o=a.dispatch;return n!==t.memoizedState&&(Ce.flags|=2048,Vi(9,{destroy:void 0},pN.bind(null,a,n),null)),[r,o,e]}function pN(e,t){e.action=t}function Vy(e){var t=Et(),n=et;if(n!==null)return Vb(t,n,e);Et(),t=t.memoizedState,n=Et();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Vi(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Ce.updateQueue,t===null&&(t=hu(),Ce.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 Hb(){return Et().memoizedState}function Ec(e,t,n,r){var a=on();Ce.flags|=e,a.memoizedState=Vi(1|t,{destroy:void 0},n,r===void 0?null:r)}function vu(e,t,n,r){var a=Et();r=r===void 0?null:r;var o=a.memoizedState.inst;et!==null&&r!==null&&ip(r,et.memoizedState.deps)?a.memoizedState=Vi(t,o,n,r):(Ce.flags|=e,a.memoizedState=Vi(1|t,o,n,r))}function Hy(e,t){Ec(8390656,8,e,t)}function mp(e,t){vu(2048,8,e,t)}function gN(e){Ce.flags|=4;var t=Ce.updateQueue;if(t===null)t=hu(),Ce.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function qb(e){var t=Et().memoizedState;return gN({ref:t,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function $b(e,t){return vu(4,2,e,t)}function Kb(e,t){return vu(4,4,e,t)}function Fb(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 Gb(e,t,n){n=n!=null?n.concat([e]):null,vu(4,4,Fb.bind(null,t,e),n)}function pp(){}function Yb(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ip(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Wb(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ip(t,r[1]))return r[0];if(r=e(),Oo){ka(!0);try{e()}finally{ka(!1)}}return n.memoizedState=[r,t],r}function gp(e,t,n){return n===void 0||(la&1073741824)!==0&&(Ie&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=I0(),Ce.lanes|=e,Wa|=e,n)}function Qb(e,t,n,r){return Ln(n,t)?n:Pi.current!==null?(e=gp(e,n,r),Ln(e,t)||(Lt=!0),e):(la&42)===0||(la&1073741824)!==0&&(Ie&261930)===0?(Lt=!0,e.memoizedState=n):(e=I0(),Ce.lanes|=e,Wa|=e,t)}function Xb(e,t,n,r,a){var o=Fe.p;Fe.p=o!==0&&8>o?o:8;var i=ve.T,s={};ve.T=s,yp(e,!1,t,n);try{var c=a(),u=ve.S;if(u!==null&&u(s,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=uN(c,r);ql(e,t,f,kn(e))}else ql(e,t,r,kn(e))}catch(d){ql(e,t,{then:function(){},status:"rejected",reason:d},kn())}finally{Fe.p=o,i!==null&&s.types!==null&&(i.types=s.types),ve.T=i}}function hN(){}function ym(e,t,n,r){if(e.tag!==5)throw Error(L(476));var a=Zb(e).queue;Xb(e,a,t,wo,n===null?hN:function(){return Jb(e),n(r)})}function Zb(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:wo,baseState:wo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:wo},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Jb(e){var t=Zb(e);t.next===null&&(t=e.alternate.memoizedState),ql(e,t.next.queue,{},kn())}function hp(){return Zt(is)}function e0(){return Et().memoizedState}function t0(){return Et().memoizedState}function yN(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kn();e=ja(n);var r=Pa(t,e,n);r!==null&&(hn(r,t,n),Pl(r,t,n)),t={cache:tp()},e.payload=t;return}t=t.return}}function vN(e,t,n){var r=kn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},bu(e)?r0(t,n):(n=Xm(e,t,n,r),n!==null&&(hn(n,e,r),a0(n,t,r)))}function n0(e,t,n){var r=kn();ql(e,t,n,r)}function ql(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(bu(e))r0(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,Ln(s,i))return pu(e,t,a,0),rt===null&&mu(),!1}catch{}if(n=Xm(e,t,a,r),n!==null)return hn(n,e,r),a0(n,t,r),!0}return!1}function yp(e,t,n,r){if(r={lane:2,revertLane:Ep(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},bu(e)){if(t)throw Error(L(479))}else t=Xm(e,n,r,2),t!==null&&hn(t,e,2)}function bu(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function r0(e,t){Di=Fc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function a0(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qv(e,n)}}var rs={readContext:Zt,use:yu,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};rs.useEffectEvent=wt;var o0={readContext:Zt,use:yu,useCallback:function(e,t){return on().memoizedState=[e,t===void 0?null:t],e},useContext:Zt,useEffect:Hy,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ec(4194308,4,Fb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ec(4194308,4,e,t)},useInsertionEffect:function(e,t){Ec(4,2,e,t)},useMemo:function(e,t){var n=on();t=t===void 0?null:t;var r=e();if(Oo){ka(!0);try{e()}finally{ka(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=on();if(n!==void 0){var a=n(t);if(Oo){ka(!0);try{n(t)}finally{ka(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=vN.bind(null,Ce,e),[r.memoizedState,e]},useRef:function(e){var t=on();return e={current:e},t.memoizedState=e},useState:function(e){e=gm(e);var t=e.queue,n=n0.bind(null,Ce,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:pp,useDeferredValue:function(e,t){var n=on();return gp(n,e,t)},useTransition:function(){var e=gm(!1);return e=Xb.bind(null,Ce,e.queue,!0,!1),on().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ce,a=on();if(je){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),rt===null)throw Error(L(349));(Ie&127)!==0||kb(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hy(Db.bind(null,r,o,e),[e]),r.flags|=2048,Vi(9,{destroy:void 0},Lb.bind(null,r,o,n,t),null),n},useId:function(){var e=on(),t=rt.identifierPrefix;if(je){var n=Rr,r=Cr;n=(r&~(1<<32-_n(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Gc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=dN++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:hp,useFormState:jy,useActionState:jy,useOptimistic:function(e){var t=on();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=yp.bind(null,Ce,!0,n),n.dispatch=t,[e,t]},useMemoCache:dp,useCacheRefresh:function(){return on().memoizedState=yN.bind(null,Ce)},useEffectEvent:function(e){var t=on(),n={impl:e};return t.memoizedState=n,function(){if((Ke&2)!==0)throw Error(L(440));return n.impl.apply(void 0,arguments)}}},vp={readContext:Zt,use:yu,useCallback:Yb,useContext:Zt,useEffect:mp,useImperativeHandle:Gb,useInsertionEffect:$b,useLayoutEffect:Kb,useMemo:Wb,useReducer:Rc,useRef:Hb,useState:function(){return Rc(sa)},useDebugValue:pp,useDeferredValue:function(e,t){var n=Et();return Qb(n,et.memoizedState,e,t)},useTransition:function(){var e=Rc(sa)[0],t=Et().memoizedState;return[typeof e=="boolean"?e:hs(e),t]},useSyncExternalStore:_b,useId:e0,useHostTransitionStatus:hp,useFormState:Py,useActionState:Py,useOptimistic:function(e,t){var n=Et();return Ib(n,et,e,t)},useMemoCache:dp,useCacheRefresh:t0};vp.useEffectEvent=qb;var i0={readContext:Zt,use:yu,useCallback:Yb,useContext:Zt,useEffect:mp,useImperativeHandle:Gb,useInsertionEffect:$b,useLayoutEffect:Kb,useMemo:Wb,useReducer:Rf,useRef:Hb,useState:function(){return Rf(sa)},useDebugValue:pp,useDeferredValue:function(e,t){var n=Et();return et===null?gp(n,e,t):Qb(n,et.memoizedState,e,t)},useTransition:function(){var e=Rf(sa)[0],t=Et().memoizedState;return[typeof e=="boolean"?e:hs(e),t]},useSyncExternalStore:_b,useId:e0,useHostTransitionStatus:hp,useFormState:Vy,useActionState:Vy,useOptimistic:function(e,t){var n=Et();return et!==null?Ib(n,et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:dp,useCacheRefresh:t0};i0.useEffectEvent=qb;function Ef(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:mt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vm={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kn(),a=ja(r);a.payload=t,n!=null&&(a.callback=n),t=Pa(e,a,r),t!==null&&(hn(t,e,r),Pl(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kn(),a=ja(r);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Pa(e,a,r),t!==null&&(hn(t,e,r),Pl(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kn(),r=ja(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(hn(t,e,n),Pl(t,e,n))}};function qy(e,t,n,r,a,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Zl(n,r)||!Zl(a,o):!0}function $y(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&&vm.enqueueReplaceState(t,t.state,null)}function _o(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=mt({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function l0(e){jc(e)}function s0(e){console.error(e)}function c0(e){jc(e)}function Yc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Ky(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function bm(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Yc(e,t)},n}function u0(e){return e=ja(e),e.tag=3,e}function d0(e,t,n,r){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var o=r.value;e.payload=function(){return a(o)},e.callback=function(){Ky(t,n,r)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){Ky(t,n,r),typeof a!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var s=r.stack;this.componentDidCatch(r.value,{componentStack:s!==null?s:""})})}function bN(e,t,n,r,a){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Wi(t,n,a,!0),n=Dn.current,n!==null){switch(n.tag){case 31:case 13:return Yn===null?Jc():n.alternate===null&&At===0&&(At=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===qc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),If(e,r,a)),!1;case 22:return n.flags|=65536,r===qc?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)),If(e,r,a)),!1}throw Error(L(435,n.tag))}return If(e,r,a),Jc(),!1}if(je)return t=Dn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==im&&(e=Error(L(422),{cause:r}),es(Fn(e,n)))):(r!==im&&(t=Error(L(423),{cause:r}),es(Fn(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Fn(r,n),a=bm(e.stateNode,r,a),Cf(e,a),At!==4&&(At=2)),!1;var o=Error(L(520),{cause:r});if(o=Fn(o,n),Fl===null?Fl=[o]:Fl.push(o),At!==4&&(At=2),t===null)return!0;r=Fn(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=bm(n.stateNode,r,e),Cf(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(Va===null||!Va.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=u0(a),d0(a,e,n,r),Cf(n,a),!1}n=n.return}while(n!==null);return!1}var bp=Error(L(461)),Lt=!1;function Wt(e,t,n,r){t.child=e===null?Rb(t,null,n,r):Mo(t,e.child,n,r)}function Fy(e,t,n,r,a){n=n.render;var o=t.ref;if("ref"in r){var i={};for(var s in r)s!=="ref"&&(i[s]=r[s])}else i=r;return To(t),r=lp(e,t,n,i,o,a),s=sp(),e!==null&&!Lt?(cp(e,t,a),ca(e,t,a)):(je&&s&&Jm(t),t.flags|=1,Wt(e,t,r,a),t.child)}function Gy(e,t,n,r,a){if(e===null){var o=n.type;return typeof o=="function"&&!Zm(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,f0(e,t,o,r,a)):(e=Ac(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!xp(e,a)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Zl,n(i,r)&&e.ref===t.ref)return ca(e,t,a)}return t.flags|=1,e=ra(o,r),e.ref=t.ref,e.return=t,t.child=e}function f0(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Zl(o,r)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=r=o,xp(e,a))(e.flags&131072)!==0&&(Lt=!0);else return t.lanes=e.lanes,ca(e,t,a)}return xm(e,t,n,r,a)}function m0(e,t,n,r){var a=r.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){for(r=t.child=e.child,a=0;r!==null;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~o}else r=0,t.child=null;return Yy(e,t,o,n,r)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Cc(t,o!==null?o.cachePool:null),o!==null?By(t,o):mm(),Tb(t);else return r=t.lanes=536870912,Yy(e,t,o!==null?o.baseLanes|n:n,n,r)}else o!==null?(Cc(t,o.cachePool),By(t,o),Oa(t),t.memoizedState=null):(e!==null&&Cc(t,null),mm(),Oa(t));return Wt(e,t,a,n),t.child}function Dl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Yy(e,t,n,r,a){var o=np();return o=o===null?null:{parent:kt._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&Cc(t,null),mm(),Tb(t),e!==null&&Wi(e,t,r,!0),t.childLanes=a,null}function Nc(e,t){return t=Wc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wy(e,t,n){return Mo(t,e.child,null,n),e=Nc(t,t.pendingProps),e.flags|=2,En(t),t.memoizedState=null,e}function xN(e,t,n){var r=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(je){if(r.mode==="hidden")return e=Nc(t,r),t.lanes=536870912,Dl(null,e);if(pm(t),(e=ft)?(e=ox(e,Gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Fa!==null?{id:Cr,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=vb(e),n.return=t,t.child=n,Xt=t,ft=null)):e=null,e===null)throw Ga(t);return t.lanes=536870912,null}return Nc(t,r)}var o=e.memoizedState;if(o!==null){var i=o.dehydrated;if(pm(t),a)if(t.flags&256)t.flags&=-257,t=Wy(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(Lt||Wi(e,t,n,!1),a=(n&e.childLanes)!==0,Lt||a){if(r=rt,r!==null&&(i=$v(r,n),i!==0&&i!==o.retryLane))throw o.retryLane=i,zo(e,i),hn(r,e,i),bp;Jc(),t=Wy(e,t,n)}else e=o.treeContext,ft=Wn(i.nextSibling),Xt=t,je=!0,Ua=null,Gn=!1,e!==null&&xb(t,e),t=Nc(t,r),t.flags|=4096;return t}return e=ra(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Tc(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(L(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function xm(e,t,n,r,a){return To(t),n=lp(e,t,n,r,void 0,a),r=sp(),e!==null&&!Lt?(cp(e,t,a),ca(e,t,a)):(je&&r&&Jm(t),t.flags|=1,Wt(e,t,n,a),t.child)}function Qy(e,t,n,r,a,o){return To(t),t.updateQueue=null,n=Ob(t,r,n,a),Mb(e),r=sp(),e!==null&&!Lt?(cp(e,t,o),ca(e,t,o)):(je&&r&&Jm(t),t.flags|=1,Wt(e,t,n,o),t.child)}function Xy(e,t,n,r,a){if(To(t),t.stateNode===null){var o=Ri,i=n.contextType;typeof i=="object"&&i!==null&&(o=Zt(i)),o=new n(r,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=vm,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=r,o.state=t.memoizedState,o.refs={},ap(t),i=n.contextType,o.context=typeof i=="object"&&i!==null?Zt(i):Ri,o.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Ef(t,n,i,r),o.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(i=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),i!==o.state&&vm.enqueueReplaceState(o,o.state,null),Hl(t,r,o,a),Vl(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){o=t.stateNode;var s=t.memoizedProps,c=_o(n,s);o.props=c;var u=o.context,f=n.contextType;i=Ri,typeof f=="object"&&f!==null&&(i=Zt(f));var d=n.getDerivedStateFromProps;f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function",s=t.pendingProps!==s,f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s||u!==i)&&$y(t,o,r,i),Na=!1;var p=t.memoizedState;o.state=p,Hl(t,r,o,a),Vl(),u=t.memoizedState,s||p!==u||Na?(typeof d=="function"&&(Ef(t,n,d,r),u=t.memoizedState),(c=Na||qy(t,n,c,r,p,u,i))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=i,r=c):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,dm(e,t),i=t.memoizedProps,f=_o(n,i),o.props=f,d=t.pendingProps,p=o.context,u=n.contextType,c=Ri,typeof u=="object"&&u!==null&&(c=Zt(u)),s=n.getDerivedStateFromProps,(u=typeof s=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==d||p!==c)&&$y(t,o,r,c),Na=!1,p=t.memoizedState,o.state=p,Hl(t,r,o,a),Vl();var m=t.memoizedState;i!==d||p!==m||Na||e!==null&&e.dependencies!==null&&Hc(e.dependencies)?(typeof s=="function"&&(Ef(t,n,s,r),m=t.memoizedState),(f=Na||qy(t,n,f,r,p,m,c)||e!==null&&e.dependencies!==null&&Hc(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=f):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Tc(e,t),r=(t.flags&128)!==0,o||r?(o=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&r?(t.child=Mo(t,e.child,null,a),t.child=Mo(t,null,n,a)):Wt(e,t,n,a),t.memoizedState=o.state,e=t.child):e=ca(e,t,a),e}function Zy(e,t,n,r){return No(),t.flags|=256,Wt(e,t,n,r),t.child}var Nf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tf(e){return{baseLanes:e,cachePool:wb()}}function Mf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Tn),e}function p0(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!==0,i;if((i=o)||(i=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),i&&(a=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(je){if(a?Ma(t):Oa(t),(e=ft)?(e=ox(e,Gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Fa!==null?{id:Cr,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=vb(e),n.return=t,t.child=n,Xt=t,ft=null)):e=null,e===null)throw Ga(t);return Dm(e)?t.lanes=32:t.lanes=536870912,null}var s=r.children;return r=r.fallback,a?(Oa(t),a=t.mode,s=Wc({mode:"hidden",children:s},a),r=Ao(r,a,n,null),s.return=t,r.return=t,s.sibling=r,t.child=s,r=t.child,r.memoizedState=Tf(n),r.childLanes=Mf(e,i,n),t.memoizedState=Nf,Dl(null,r)):(Ma(t),Sm(t,s))}var c=e.memoizedState;if(c!==null&&(s=c.dehydrated,s!==null)){if(o)t.flags&256?(Ma(t),t.flags&=-257,t=Of(e,t,n)):t.memoizedState!==null?(Oa(t),t.child=e.child,t.flags|=128,t=null):(Oa(t),s=r.fallback,a=t.mode,r=Wc({mode:"visible",children:r.children},a),s=Ao(s,a,n,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,Mo(t,e.child,null,n),r=t.child,r.memoizedState=Tf(n),r.childLanes=Mf(e,i,n),t.memoizedState=Nf,t=Dl(null,r));else if(Ma(t),Dm(s)){if(i=s.nextSibling&&s.nextSibling.dataset,i)var u=i.dgst;i=u,r=Error(L(419)),r.stack="",r.digest=i,es({value:r,source:null,stack:null}),t=Of(e,t,n)}else if(Lt||Wi(e,t,n,!1),i=(n&e.childLanes)!==0,Lt||i){if(i=rt,i!==null&&(r=$v(i,n),r!==0&&r!==c.retryLane))throw c.retryLane=r,zo(e,r),hn(i,e,r),bp;Lm(s)||Jc(),t=Of(e,t,n)}else Lm(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ft=Wn(s.nextSibling),Xt=t,je=!0,Ua=null,Gn=!1,e!==null&&xb(t,e),t=Sm(t,r.children),t.flags|=4096);return t}return a?(Oa(t),s=r.fallback,a=t.mode,c=e.child,u=c.sibling,r=ra(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,u!==null?s=ra(u,s):(s=Ao(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,Dl(null,r),r=t.child,s=e.child.memoizedState,s===null?s=Tf(n):(a=s.cachePool,a!==null?(c=kt._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=wb(),s={baseLanes:s.baseLanes|n,cachePool:a}),r.memoizedState=s,r.childLanes=Mf(e,i,n),t.memoizedState=Nf,Dl(e.child,r)):(Ma(t),n=e.child,e=n.sibling,n=ra(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Sm(e,t){return t=Wc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Wc(e,t){return e=Nn(22,e,null,t),e.lanes=0,e}function Of(e,t,n){return Mo(t,e.child,null,n),e=Sm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jy(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),sm(e.return,t,n)}function _f(e,t,n,r,a,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a,i.treeForkCount=o)}function g0(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;r=r.children;var i=Rt.current,s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,lt(Rt,i),Wt(e,t,r,n),r=je?Jl:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jy(e,n,t);else if(e.tag===19)Jy(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Kc(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),_f(t,!1,a,n,o,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Kc(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}_f(t,!0,n,null,o,r);break;case"together":_f(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function ca(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wa|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Wi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=ra(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ra(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Hc(e)))}function SN(e,t,n){switch(t.tag){case 3:zc(t,t.stateNode.containerInfo),Ta(t,kt,e.memoizedState.cache),No();break;case 27:case 5:Wf(t);break;case 4:zc(t,t.stateNode.containerInfo);break;case 10:Ta(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,pm(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Ma(t),t.flags|=128,null):(n&t.child.childLanes)!==0?p0(e,t,n):(Ma(t),e=ca(e,t,n),e!==null?e.sibling:null);Ma(t);break;case 19:var a=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Wi(e,t,n,!1),r=(n&t.childLanes)!==0),a){if(r)return g0(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),lt(Rt,Rt.current),r)break;return null;case 22:return t.lanes=0,m0(e,t,n,t.pendingProps);case 24:Ta(t,kt,e.memoizedState.cache)}return ca(e,t,n)}function h0(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Lt=!0;else{if(!xp(e,n)&&(t.flags&128)===0)return Lt=!1,SN(e,t,n);Lt=(e.flags&131072)!==0}else Lt=!1,je&&(t.flags&1048576)!==0&&bb(t,Jl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=xo(t.elementType),t.type=e,typeof e=="function")Zm(e)?(r=_o(e,r),t.tag=1,t=Xy(null,t,e,r,n)):(t.tag=0,t=xm(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===Um){t.tag=11,t=Fy(null,t,e,r,n);break e}else if(a===jm){t.tag=14,t=Gy(null,t,e,r,n);break e}}throw t=Gf(e)||e,Error(L(306,t,""))}}return t;case 0:return xm(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_o(r,t.pendingProps),Xy(e,t,r,a,n);case 3:e:{if(zc(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,dm(e,t),Hl(t,r,null,n);var i=t.memoizedState;if(r=i.cache,Ta(t,kt,r),r!==o.cache&&cm(t,[kt],n,!0),Vl(),r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Zy(e,t,r,n);break e}else if(r!==a){a=Fn(Error(L(424)),t),es(a),t=Zy(e,t,r,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,ft=Wn(e.firstChild),Xt=t,je=!0,Ua=null,Gn=!0,n=Rb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(No(),r===a){t=ca(e,t,n);break e}Wt(e,t,r,n)}t=t.child}return t;case 26:return Tc(e,t),e===null?(n=Sv(t.type,null,t.pendingProps,null))?t.memoizedState=n:je||(n=t.type,e=t.pendingProps,r=ru(Ia.current).createElement(n),r[Qt]=t,r[yn]=e,Jt(r,n,e),qt(r),t.stateNode=r):t.memoizedState=Sv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Wf(t),e===null&&je&&(r=t.stateNode=ix(t.type,t.pendingProps,Ia.current),Xt=t,Gn=!0,a=ft,Xa(t.type)?(zm=a,ft=Wn(r.firstChild)):ft=a),Wt(e,t,t.pendingProps.children,n),Tc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&je&&((a=r=ft)&&(r=WN(r,t.type,t.pendingProps,Gn),r!==null?(t.stateNode=r,Xt=t,ft=Wn(r.firstChild),Gn=!1,a=!0):a=!1),a||Ga(t)),Wf(t),a=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,r=o.children,_m(a,o)?r=null:i!==null&&_m(a,i)&&(t.flags|=32),t.memoizedState!==null&&(a=lp(e,t,fN,null,null,n),is._currentValue=a),Tc(e,t),Wt(e,t,r,n),t.child;case 6:return e===null&&je&&((e=n=ft)&&(n=QN(n,t.pendingProps,Gn),n!==null?(t.stateNode=n,Xt=t,ft=null,e=!0):e=!1),e||Ga(t)),null;case 13:return p0(e,t,n);case 4:return zc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Mo(t,null,r,n):Wt(e,t,r,n),t.child;case 11:return Fy(e,t,t.type,t.pendingProps,n);case 7:return Wt(e,t,t.pendingProps,n),t.child;case 8:return Wt(e,t,t.pendingProps.children,n),t.child;case 12:return Wt(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ta(t,t.type,r.value),Wt(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,To(t),a=Zt(a),r=r(a),t.flags|=1,Wt(e,t,r,n),t.child;case 14:return Gy(e,t,t.type,t.pendingProps,n);case 15:return f0(e,t,t.type,t.pendingProps,n);case 19:return g0(e,t,n);case 31:return xN(e,t,n);case 22:return m0(e,t,n,t.pendingProps);case 24:return To(t),r=Zt(kt),e===null?(a=np(),a===null&&(a=rt,o=tp(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ap(t),Ta(t,kt,a)):((e.lanes&n)!==0&&(dm(e,t),Hl(t,null,null,n),Vl()),a=e.memoizedState,o=t.memoizedState,a.parent!==r?(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ta(t,kt,r)):(r=o.cache,Ta(t,kt,r),r!==a.cache&&cm(t,[kt],n,!0))),Wt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Yr(e){e.flags|=4}function kf(e,t,n,r,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(P0())e.flags|=8192;else throw Ro=qc,rp}else e.flags&=-16777217}function ev(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!cx(t))if(P0())e.flags|=8192;else throw Ro=qc,rp}function fc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Vv():536870912,e.lanes|=t,Hi|=t)}function Nl(e,t){if(!je)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 dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&65011712,r|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function wN(e,t,n){var r=t.pendingProps;switch(ep(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return dt(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),aa(kt),Bi(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(mi(t)?Yr(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Af())),dt(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Yr(t),o!==null?(dt(t),ev(t,o)):(dt(t),kf(t,a,null,r,n))):o?o!==e.memoizedState?(Yr(t),dt(t),ev(t,o)):(dt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Yr(t),dt(t),kf(t,a,e,r,n)),null;case 27:if(Bc(t),n=Ia.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return dt(t),null}e=Nr.current,mi(t)?My(t,e):(e=ix(a,r,n),t.stateNode=e,Yr(t))}return dt(t),null;case 5:if(Bc(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return dt(t),null}if(o=Nr.current,mi(t))My(t,o);else{var i=ru(Ia.current);switch(o){case 1:o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":o=i.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof r.is=="string"?i.createElement("select",{is:r.is}):i.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is=="string"?i.createElement(a,{is:r.is}):i.createElement(a)}}o[Qt]=t,o[yn]=r;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)o.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=o;e:switch(Jt(o,a,r),a){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Yr(t)}}return dt(t),kf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Yr(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Ia.current,mi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Xt,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Qt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||nx(e.nodeValue,n)),e||Ga(t,!0)}else e=ru(e).createTextNode(r),e[Qt]=t,t.stateNode=e}return dt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=mi(t),n!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Qt]=t}else No(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),e=!1}else n=Af(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(En(t),t):(En(t),null);if((t.flags&128)!==0)throw Error(L(558))}return dt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=mi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(L(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(L(317));a[Qt]=t}else No(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),a=!1}else a=Af(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(En(t),t):(En(t),null)}return En(t),(t.flags&128)!==0?(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),fc(t,t.updateQueue),dt(t),null);case 4:return Bi(),e===null&&Np(t.stateNode.containerInfo),dt(t),null;case 10:return aa(t.type),dt(t),null;case 19:if($t(Rt),r=t.memoizedState,r===null)return dt(t),null;if(a=(t.flags&128)!==0,o=r.rendering,o===null)if(a)Nl(r,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Kc(e),o!==null){for(t.flags|=128,Nl(r,!1),e=o.updateQueue,t.updateQueue=e,fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)yb(n,e),n=n.sibling;return lt(Rt,Rt.current&1|2),je&&Zr(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Mn()>Xc&&(t.flags|=128,a=!0,Nl(r,!1),t.lanes=4194304)}else{if(!a)if(e=Kc(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,fc(t,e),Nl(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!je)return dt(t),null}else 2*Mn()-r.renderingStartTime>Xc&&n!==536870912&&(t.flags|=128,a=!0,Nl(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e!==null?e.sibling=o:t.child=o,r.last=o)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Mn(),e.sibling=null,n=Rt.current,lt(Rt,a?n&1|2:n&1),je&&Zr(t,r.treeForkCount),e):(dt(t),null);case 22:case 23:return En(t),op(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),n=t.updateQueue,n!==null&&fc(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&&$t(Co),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),aa(kt),dt(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function AN(e,t){switch(ep(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return aa(kt),Bi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Bc(t),null;case 31:if(t.memoizedState!==null){if(En(t),t.alternate===null)throw Error(L(340));No()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(En(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));No()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $t(Rt),null;case 4:return Bi(),null;case 10:return aa(t.type),null;case 22:case 23:return En(t),op(),e!==null&&$t(Co),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return aa(kt),null;case 25:return null;default:return null}}function y0(e,t){switch(ep(t),t.tag){case 3:aa(kt),Bi();break;case 26:case 27:case 5:Bc(t);break;case 4:Bi();break;case 31:t.memoizedState!==null&&En(t);break;case 13:En(t);break;case 19:$t(Rt);break;case 10:aa(t.type);break;case 22:case 23:En(t),op(),e!==null&&$t(Co);break;case 24:aa(kt)}}function ys(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var o=n.create,i=n.inst;r=o(),i.destroy=r}n=n.next}while(n!==a)}}catch(s){Qe(t,t.return,s)}}function Ya(e,t,n){try{var r=t.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var o=a.next;r=o;do{if((r.tag&e)===e){var i=r.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,a=t;var c=n,u=s;try{u()}catch(f){Qe(a,c,f)}}}r=r.next}while(r!==o)}}catch(f){Qe(t,t.return,f)}}function v0(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Nb(t,n)}catch(r){Qe(e,e.return,r)}}}function b0(e,t,n){n.props=_o(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Qe(e,t,r)}}function $l(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(a){Qe(e,t,a)}}function Er(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(a){Qe(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){Qe(e,t,a)}else n.current=null}function x0(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){Qe(e,e.return,a)}}function Lf(e,t,n){try{var r=e.stateNode;qN(r,e.type,n,t),r[yn]=t}catch(a){Qe(e,e.return,a)}}function S0(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Xa(e.type)||e.tag===4}function Df(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||S0(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&&Xa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wm(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=ta));else if(r!==4&&(r===27&&Xa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(wm(e,t,n),e=e.sibling;e!==null;)wm(e,t,n),e=e.sibling}function Qc(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&&Xa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function w0(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Jt(t,r,n),t[Qt]=e,t[yn]=n}catch(o){Qe(e,e.return,o)}}var Jr=!1,_t=!1,zf=!1,tv=typeof WeakSet=="function"?WeakSet:Set,Ht=null;function CN(e,t){if(e=e.containerInfo,Mm=lu,e=cb(e),Wm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{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 e}var i=0,s=-1,c=-1,u=0,f=0,d=e,p=null;t:for(;;){for(var m;d!==n||a!==0&&d.nodeType!==3||(s=i+a),d!==o||r!==0&&d.nodeType!==3||(c=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===n&&++u===a&&(s=i),p===o&&++f===r&&(c=i),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}n=s===-1||c===-1?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Om={focusedElem:e,selectionRange:n},lu=!1,Ht=t;Ht!==null;)if(t=Ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ht=e;else for(;Ht!==null;){switch(t=Ht,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,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)!==0&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var b=_o(n.type,a);e=r.getSnapshotBeforeUpdate(b,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(g){Qe(n,n.return,g)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)km(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":km(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,Ht=e;break}Ht=t.return}}function A0(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Qr(e,n),r&4&&ys(5,n);break;case 1:if(Qr(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Qe(n,n.return,i)}else{var a=_o(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Qe(n,n.return,i)}}r&64&&v0(n),r&512&&$l(n,n.return);break;case 3:if(Qr(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{Nb(e,t)}catch(i){Qe(n,n.return,i)}}break;case 27:t===null&&r&4&&w0(n);case 26:case 5:Qr(e,n),t===null&&r&4&&x0(n),r&512&&$l(n,n.return);break;case 12:Qr(e,n);break;case 31:Qr(e,n),r&4&&E0(e,n);break;case 13:Qr(e,n),r&4&&N0(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=LN.bind(null,n),XN(e,n))));break;case 22:if(r=n.memoizedState!==null||Jr,!r){t=t!==null&&t.memoizedState!==null||_t,a=Jr;var o=_t;Jr=r,(_t=t)&&!o?Xr(e,n,(n.subtreeFlags&8772)!==0):Qr(e,n),Jr=a,_t=o}break;case 30:break;default:Qr(e,n)}}function C0(e){var t=e.alternate;t!==null&&(e.alternate=null,C0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&qm(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 bt=null,pn=!1;function Wr(e,t,n){for(n=n.child;n!==null;)R0(e,t,n),n=n.sibling}function R0(e,t,n){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(us,n)}catch{}switch(n.tag){case 26:_t||Er(n,t),Wr(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:_t||Er(n,t);var r=bt,a=pn;Xa(n.type)&&(bt=n.stateNode,pn=!1),Wr(e,t,n),Yl(n.stateNode),bt=r,pn=a;break;case 5:_t||Er(n,t);case 6:if(r=bt,a=pn,bt=null,Wr(e,t,n),bt=r,pn=a,bt!==null)if(pn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(n.stateNode)}catch(o){Qe(n,t,o)}else try{bt.removeChild(n.stateNode)}catch(o){Qe(n,t,o)}break;case 18:bt!==null&&(pn?(e=bt,hv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Fi(e)):hv(bt,n.stateNode));break;case 4:r=bt,a=pn,bt=n.stateNode.containerInfo,pn=!0,Wr(e,t,n),bt=r,pn=a;break;case 0:case 11:case 14:case 15:Ya(2,n,t),_t||Ya(4,n,t),Wr(e,t,n);break;case 1:_t||(Er(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&b0(n,t,r)),Wr(e,t,n);break;case 21:Wr(e,t,n);break;case 22:_t=(r=_t)||n.memoizedState!==null,Wr(e,t,n),_t=r;break;default:Wr(e,t,n)}}function E0(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fi(e)}catch(n){Qe(t,t.return,n)}}}function N0(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fi(e)}catch(n){Qe(t,t.return,n)}}function RN(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tv),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tv),t;default:throw Error(L(435,e.tag))}}function mc(e,t){var n=RN(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var a=DN.bind(null,e,r);r.then(a,a)}})}function fn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,i=t,s=i;e:for(;s!==null;){switch(s.tag){case 27:if(Xa(s.type)){bt=s.stateNode,pn=!1;break e}break;case 5:bt=s.stateNode,pn=!1;break e;case 3:case 4:bt=s.stateNode.containerInfo,pn=!0;break e}s=s.return}if(bt===null)throw Error(L(160));R0(o,i,a),bt=null,pn=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)T0(t,e),t=t.sibling}var dr=null;function T0(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(t,e),mn(e),r&4&&(Ya(3,e,e.return),ys(3,e),Ya(5,e,e.return));break;case 1:fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),r&64&&Jr&&(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=dr;if(fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),r&4){var o=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(r){case"title":o=a.getElementsByTagName("title")[0],(!o||o[ms]||o[Qt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector("head > title"))),Jt(o,r,n),o[Qt]=e,qt(o),r=o;break e;case"link":var i=Av("link","href",a).get(r+(n.href||""));if(i){for(var s=0;s<i.length;s++)if(o=i[s],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)){i.splice(s,1);break t}}o=a.createElement(r),Jt(o,r,n),a.head.appendChild(o);break;case"meta":if(i=Av("meta","content",a).get(r+(n.content||""))){for(s=0;s<i.length;s++)if(o=i[s],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)){i.splice(s,1);break t}}o=a.createElement(r),Jt(o,r,n),a.head.appendChild(o);break;default:throw Error(L(468,r))}o[Qt]=e,qt(o),r=o}e.stateNode=r}else Cv(a,e.type,e.stateNode);else e.stateNode=wv(a,r,e.memoizedProps);else o!==r?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Cv(a,e.type,e.stateNode):wv(a,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Lf(e,e.memoizedProps,n.memoizedProps)}break;case 27:fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),n!==null&&r&4&&Lf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fn(t,e),mn(e),r&512&&(_t||n===null||Er(n,n.return)),e.flags&32){a=e.stateNode;try{Ui(a,"")}catch(b){Qe(e,e.return,b)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Lf(e,a,n!==null?n.memoizedProps:a)),r&1024&&(zf=!0);break;case 6:if(fn(t,e),mn(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(b){Qe(e,e.return,b)}}break;case 3:if(_c=null,a=dr,dr=au(t.containerInfo),fn(t,e),dr=a,mn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fi(t.containerInfo)}catch(b){Qe(e,e.return,b)}zf&&(zf=!1,M0(e));break;case 4:r=dr,dr=au(e.stateNode.containerInfo),fn(t,e),mn(e),dr=r;break;case 12:fn(t,e),mn(e);break;case 31:fn(t,e),mn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mc(e,r)));break;case 13:fn(t,e),mn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(xu=Mn()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mc(e,r)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Jr,f=_t;if(Jr=u||a,_t=f||c,fn(t,e),_t=f,Jr=u,mn(e),r&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Jr||_t||So(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(o=c.stateNode,a)i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{s=c.stateNode;var d=c.memoizedProps.style,p=d!=null&&d.hasOwnProperty("display")?d.display:null;s.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(b){Qe(c,c.return,b)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(b){Qe(c,c.return,b)}}}else if(t.tag===18){if(n===null){c=t;try{var m=c.stateNode;a?yv(m,!0):yv(c.stateNode,!1)}catch(b){Qe(c,c.return,b)}}}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 e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;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,mc(e,n))));break;case 19:fn(t,e),mn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mc(e,r)));break;case 30:break;case 21:break;default:fn(t,e),mn(e)}}function mn(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(S0(r)){n=r;break}r=r.return}if(n==null)throw Error(L(160));switch(n.tag){case 27:var a=n.stateNode,o=Df(e);Qc(e,o,a);break;case 5:var i=n.stateNode;n.flags&32&&(Ui(i,""),n.flags&=-33);var s=Df(e);Qc(e,s,i);break;case 3:case 4:var c=n.stateNode.containerInfo,u=Df(e);wm(e,u,c);break;default:throw Error(L(161))}}catch(f){Qe(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function M0(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;M0(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Qr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)A0(e,t.alternate,t),t=t.sibling}function So(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ya(4,t,t.return),So(t);break;case 1:Er(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&b0(t,t.return,n),So(t);break;case 27:Yl(t.stateNode);case 26:case 5:Er(t,t.return),So(t);break;case 22:t.memoizedState===null&&So(t);break;case 30:So(t);break;default:So(t)}e=e.sibling}}function Xr(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,a=e,o=t,i=o.flags;switch(o.tag){case 0:case 11:case 15:Xr(a,o,n),ys(4,o);break;case 1:if(Xr(a,o,n),r=o,a=r.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(u){Qe(r,r.return,u)}if(r=o,a=r.updateQueue,a!==null){var s=r.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)Eb(c[a],s)}catch(u){Qe(r,r.return,u)}}n&&i&64&&v0(o),$l(o,o.return);break;case 27:w0(o);case 26:case 5:Xr(a,o,n),n&&r===null&&i&4&&x0(o),$l(o,o.return);break;case 12:Xr(a,o,n);break;case 31:Xr(a,o,n),n&&i&4&&E0(a,o);break;case 13:Xr(a,o,n),n&&i&4&&N0(a,o);break;case 22:o.memoizedState===null&&Xr(a,o,n),$l(o,o.return);break;case 30:break;default:Xr(a,o,n)}t=t.sibling}}function Sp(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&&gs(n))}function wp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gs(e))}function ur(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)O0(e,t,n,r),t=t.sibling}function O0(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:ur(e,t,n,r),a&2048&&ys(9,t);break;case 1:ur(e,t,n,r);break;case 3:ur(e,t,n,r),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gs(e)));break;case 12:if(a&2048){ur(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,i=o.id,s=o.onPostCommit;typeof s=="function"&&s(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Qe(t,t.return,c)}}else ur(e,t,n,r);break;case 31:ur(e,t,n,r);break;case 13:ur(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,i=t.alternate,t.memoizedState!==null?o._visibility&2?ur(e,t,n,r):Kl(e,t):o._visibility&2?ur(e,t,n,r):(o._visibility|=2,gi(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),a&2048&&Sp(i,t);break;case 24:ur(e,t,n,r),a&2048&&wp(t.alternate,t);break;default:ur(e,t,n,r)}}function gi(e,t,n,r,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,i=t,s=n,c=r,u=i.flags;switch(i.tag){case 0:case 11:case 15:gi(o,i,s,c,a),ys(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?gi(o,i,s,c,a):Kl(o,i):(f._visibility|=2,gi(o,i,s,c,a)),a&&u&2048&&Sp(i.alternate,i);break;case 24:gi(o,i,s,c,a),a&&u&2048&&wp(i.alternate,i);break;default:gi(o,i,s,c,a)}t=t.sibling}}function Kl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:Kl(n,r),a&2048&&Sp(r.alternate,r);break;case 24:Kl(n,r),a&2048&&wp(r.alternate,r);break;default:Kl(n,r)}t=t.sibling}}var zl=8192;function pi(e,t,n){if(e.subtreeFlags&zl)for(e=e.child;e!==null;)_0(e,t,n),e=e.sibling}function _0(e,t,n){switch(e.tag){case 26:pi(e,t,n),e.flags&zl&&e.memoizedState!==null&&cT(n,dr,e.memoizedState,e.memoizedProps);break;case 5:pi(e,t,n);break;case 3:case 4:var r=dr;dr=au(e.stateNode.containerInfo),pi(e,t,n),dr=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=zl,zl=16777216,pi(e,t,n),zl=r):pi(e,t,n));break;default:pi(e,t,n)}}function k0(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 Tl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Ht=r,D0(r,e)}k0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)L0(e),e=e.sibling}function L0(e){switch(e.tag){case 0:case 11:case 15:Tl(e),e.flags&2048&&Ya(9,e,e.return);break;case 3:Tl(e);break;case 12:Tl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Mc(e)):Tl(e);break;default:Tl(e)}}function Mc(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Ht=r,D0(r,e)}k0(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ya(8,t,t.return),Mc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Mc(t));break;default:Mc(t)}e=e.sibling}}function D0(e,t){for(;Ht!==null;){var n=Ht;switch(n.tag){case 0:case 11:case 15:Ya(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:gs(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Ht=r;else e:for(n=e;Ht!==null;){r=Ht;var a=r.sibling,o=r.return;if(C0(r),r===n){Ht=null;break e}if(a!==null){a.return=o,Ht=a;break e}Ht=o}}}var EN={getCacheForType:function(e){var t=Zt(kt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zt(kt).controller.signal}},NN=typeof WeakMap=="function"?WeakMap:Map,Ke=0,rt=null,ze=null,Ie=0,We=0,Rn=null,Da=!1,Xi=!1,Ap=!1,ua=0,At=0,Wa=0,Eo=0,Cp=0,Tn=0,Hi=0,Fl=null,gn=null,Am=!1,xu=0,z0=0,Xc=1/0,Zc=null,Va=null,Bt=0,Ha=null,qi=null,oa=0,Cm=0,Rm=null,B0=null,Gl=0,Em=null;function kn(){return(Ke&2)!==0&&Ie!==0?Ie&-Ie:ve.T!==null?Ep():Kv()}function I0(){if(Tn===0)if((Ie&536870912)===0||je){var e=rc;rc<<=1,(rc&3932160)===0&&(rc=262144),Tn=e}else Tn=536870912;return e=Dn.current,e!==null&&(e.flags|=32),Tn}function hn(e,t,n){(e===rt&&(We===2||We===9)||e.cancelPendingCommit!==null)&&($i(e,0),za(e,Ie,Tn,!1)),fs(e,n),((Ke&2)===0||e!==rt)&&(e===rt&&((Ke&2)===0&&(Eo|=n),At===4&&za(e,Ie,Tn,!1)),Mr(e))}function U0(e,t,n){if((Ke&6)!==0)throw Error(L(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ds(e,t),a=r?ON(e,t):Bf(e,t,!0),o=r;do{if(a===0){Xi&&!r&&za(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!TN(n)){a=Bf(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;a=Fl;var c=s.current.memoizedState.isDehydrated;if(c&&($i(s,i).flags|=256),i=Bf(s,i,!1),i!==2){if(Ap&&!c){s.errorRecoveryDisabledLanes|=o,Eo|=o,a=4;break e}o=gn,gn=a,o!==null&&(gn===null?gn=o:gn.push.apply(gn,o))}a=i}if(o=!1,a!==2)continue}}if(a===1){$i(e,0),za(e,t,0,!0);break}e:{switch(r=e,o=a,o){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:za(r,t,Tn,!Da);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(a=xu+300-Mn(),10<a)){if(za(r,t,Tn,!Da),cu(r,0,!0)!==0)break e;oa=t,r.timeoutHandle=ax(nv.bind(null,r,n,gn,Zc,Am,t,Tn,Eo,Hi,Da,o,"Throttled",-0,0),a);break e}nv(r,n,gn,Zc,Am,t,Tn,Eo,Hi,Da,o,null,-0,0)}}break}while(!0);Mr(e)}function nv(e,t,n,r,a,o,i,s,c,u,f,d,p,m){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:ta},_0(t,o,d);var b=(o&62914560)===o?xu-Mn():(o&4194048)===o?z0-Mn():0;if(b=uT(d,b),b!==null){oa=o,e.cancelPendingCommit=b(av.bind(null,e,t,o,n,r,a,i,s,c,f,d,null,p,m)),za(e,o,i,!u);return}}av(e,t,o,n,r,a,i,s,c)}function TN(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 a=n[r],o=a.getSnapshot;a=a.value;try{if(!Ln(o(),a))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 za(e,t,n,r){t&=~Cp,t&=~Eo,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var o=31-_n(a),i=1<<o;r[o]=-1,a&=~i}n!==0&&Hv(e,n,t)}function Su(){return(Ke&6)===0?(vs(0,!1),!1):!0}function Rp(){if(ze!==null){if(We===0)var e=ze.return;else e=ze,na=Bo=null,up(e),Li=null,ts=0,e=ze;for(;e!==null;)y0(e.alternate,e),e=e.return;ze=null}}function $i(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,FN(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),oa=0,Rp(),rt=e,ze=n=ra(e.current,null),Ie=t,We=0,Rn=null,Da=!1,Xi=ds(e,t),Ap=!1,Hi=Tn=Cp=Eo=Wa=At=0,gn=Fl=null,Am=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var a=31-_n(r),o=1<<a;t|=e[a],r&=~o}return ua=t,mu(),n}function j0(e,t){Ce=null,ve.H=rs,t===Qi||t===gu?(t=Dy(),We=3):t===rp?(t=Dy(),We=4):We=t===bp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rn=t,ze===null&&(At=1,Yc(e,Fn(t,e.current)))}function P0(){var e=Dn.current;return e===null?!0:(Ie&4194048)===Ie?Yn===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?e===Yn:!1}function V0(){var e=ve.H;return ve.H=rs,e===null?rs:e}function H0(){var e=ve.A;return ve.A=EN,e}function Jc(){At=4,Da||(Ie&4194048)!==Ie&&Dn.current!==null||(Xi=!0),(Wa&134217727)===0&&(Eo&134217727)===0||rt===null||za(rt,Ie,Tn,!1)}function Bf(e,t,n){var r=Ke;Ke|=2;var a=V0(),o=H0();(rt!==e||Ie!==t)&&(Zc=null,$i(e,t)),t=!1;var i=At;e:do try{if(We!==0&&ze!==null){var s=ze,c=Rn;switch(We){case 8:Rp(),i=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(t=!0);var u=We;if(We=0,Rn=null,Ti(e,s,c,u),n&&Xi){i=0;break e}break;default:u=We,We=0,Rn=null,Ti(e,s,c,u)}}MN(),i=At;break}catch(f){j0(e,f)}while(!0);return t&&e.shellSuspendCounter++,na=Bo=null,Ke=r,ve.H=a,ve.A=o,ze===null&&(rt=null,Ie=0,mu()),i}function MN(){for(;ze!==null;)q0(ze)}function ON(e,t){var n=Ke;Ke|=2;var r=V0(),a=H0();rt!==e||Ie!==t?(Zc=null,Xc=Mn()+500,$i(e,t)):Xi=ds(e,t);e:do try{if(We!==0&&ze!==null){t=ze;var o=Rn;t:switch(We){case 1:We=0,Rn=null,Ti(e,t,o,1);break;case 2:case 9:if(Ly(o)){We=0,Rn=null,rv(t);break}t=function(){We!==2&&We!==9||rt!==e||(We=7),Mr(e)},o.then(t,t);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:Ly(o)?(We=0,Rn=null,rv(t)):(We=0,Rn=null,Ti(e,t,o,7));break;case 5:var i=null;switch(ze.tag){case 26:i=ze.memoizedState;case 5:case 27:var s=ze;if(i?cx(i):s.stateNode.complete){We=0,Rn=null;var c=s.sibling;if(c!==null)ze=c;else{var u=s.return;u!==null?(ze=u,wu(u)):ze=null}break t}}We=0,Rn=null,Ti(e,t,o,5);break;case 6:We=0,Rn=null,Ti(e,t,o,6);break;case 8:Rp(),At=6;break e;default:throw Error(L(462))}}_N();break}catch(f){j0(e,f)}while(!0);return na=Bo=null,ve.H=r,ve.A=a,Ke=n,ze!==null?0:(rt=null,Ie=0,mu(),At)}function _N(){for(;ze!==null&&!eE();)q0(ze)}function q0(e){var t=h0(e.alternate,e,ua);e.memoizedProps=e.pendingProps,t===null?wu(e):ze=t}function rv(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Qy(n,t,t.pendingProps,t.type,void 0,Ie);break;case 11:t=Qy(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:up(t);default:y0(n,t),t=ze=yb(t,ua),t=h0(n,t,ua)}e.memoizedProps=e.pendingProps,t===null?wu(e):ze=t}function Ti(e,t,n,r){na=Bo=null,up(t),Li=null,ts=0;var a=t.return;try{if(bN(e,a,t,n,Ie)){At=1,Yc(e,Fn(n,e.current)),ze=null;return}}catch(o){if(a!==null)throw ze=a,o;At=1,Yc(e,Fn(n,e.current)),ze=null;return}t.flags&32768?(je||r===1?e=!0:Xi||(Ie&536870912)!==0?e=!1:(Da=e=!0,(r===2||r===9||r===3||r===6)&&(r=Dn.current,r!==null&&r.tag===13&&(r.flags|=16384))),$0(t,e)):wu(t)}function wu(e){var t=e;do{if((t.flags&32768)!==0){$0(t,Da);return}e=t.return;var n=wN(t.alternate,t,ua);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);At===0&&(At=5)}function $0(e,t){do{var n=AN(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);At=6,ze=null}function av(e,t,n,r,a,o,i,s,c){e.cancelPendingCommit=null;do Au();while(Bt!==0);if((Ke&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(o=t.lanes|t.childLanes,o|=Qm,uE(e,n,o,i,s,c),e===rt&&(ze=rt=null,Ie=0),qi=t,Ha=e,oa=n,Cm=o,Rm=a,B0=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zN(Ic,function(){return W0(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=ve.T,ve.T=null,a=Fe.p,Fe.p=2,i=Ke,Ke|=4;try{CN(e,t,n)}finally{Ke=i,Fe.p=a,ve.T=r}}Bt=1,K0(),F0(),G0()}}function K0(){if(Bt===1){Bt=0;var e=Ha,t=qi,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=ve.T,ve.T=null;var r=Fe.p;Fe.p=2;var a=Ke;Ke|=4;try{T0(t,e);var o=Om,i=cb(e.containerInfo),s=o.focusedElem,c=o.selectionRange;if(i!==s&&s&&s.ownerDocument&&sb(s.ownerDocument.documentElement,s)){if(c!==null&&Wm(s)){var u=c.start,f=c.end;if(f===void 0&&(f=u),"selectionStart"in s)s.selectionStart=u,s.selectionEnd=Math.min(f,s.value.length);else{var d=s.ownerDocument||document,p=d&&d.defaultView||window;if(p.getSelection){var m=p.getSelection(),b=s.textContent.length,g=Math.min(c.start,b),x=c.end===void 0?g:Math.min(c.end,b);!m.extend&&g>x&&(i=x,x=g,g=i);var y=Ey(s,g),h=Ey(s,x);if(y&&h&&(m.rangeCount!==1||m.anchorNode!==y.node||m.anchorOffset!==y.offset||m.focusNode!==h.node||m.focusOffset!==h.offset)){var v=d.createRange();v.setStart(y.node,y.offset),m.removeAllRanges(),g>x?(m.addRange(v),m.extend(h.node,h.offset)):(v.setEnd(h.node,h.offset),m.addRange(v))}}}}for(d=[],m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<d.length;s++){var S=d[s];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}lu=!!Mm,Om=Mm=null}finally{Ke=a,Fe.p=r,ve.T=n}}e.current=t,Bt=2}}function F0(){if(Bt===2){Bt=0;var e=Ha,t=qi,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=ve.T,ve.T=null;var r=Fe.p;Fe.p=2;var a=Ke;Ke|=4;try{A0(e,t.alternate,t)}finally{Ke=a,Fe.p=r,ve.T=n}}Bt=3}}function G0(){if(Bt===4||Bt===3){Bt=0,tE();var e=Ha,t=qi,n=oa,r=B0;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Bt=5:(Bt=0,qi=Ha=null,Y0(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Va=null),Hm(n),t=t.stateNode,On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(us,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=ve.T,a=Fe.p,Fe.p=2,ve.T=null;try{for(var o=e.onRecoverableError,i=0;i<r.length;i++){var s=r[i];o(s.value,{componentStack:s.stack})}}finally{ve.T=t,Fe.p=a}}(oa&3)!==0&&Au(),Mr(e),a=e.pendingLanes,(n&261930)!==0&&(a&42)!==0?e===Em?Gl++:(Gl=0,Em=e):Gl=0,vs(0,!1)}}function Y0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,gs(t)))}function Au(){return K0(),F0(),G0(),W0()}function W0(){if(Bt!==5)return!1;var e=Ha,t=Cm;Cm=0;var n=Hm(oa),r=ve.T,a=Fe.p;try{Fe.p=32>n?32:n,ve.T=null,n=Rm,Rm=null;var o=Ha,i=oa;if(Bt=0,qi=Ha=null,oa=0,(Ke&6)!==0)throw Error(L(331));var s=Ke;if(Ke|=4,L0(o.current),O0(o,o.current,i,n),Ke=s,vs(0,!1),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(us,o)}catch{}return!0}finally{Fe.p=a,ve.T=r,Y0(e,t)}}function ov(e,t,n){t=Fn(n,t),t=bm(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(fs(e,2),Mr(e))}function Qe(e,t,n){if(e.tag===3)ov(e,e,n);else for(;t!==null;){if(t.tag===3){ov(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Va===null||!Va.has(r))){e=Fn(n,e),n=u0(2),r=Pa(t,n,2),r!==null&&(d0(n,r,t,e),fs(r,2),Mr(r));break}}t=t.return}}function If(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new NN;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(Ap=!0,a.add(n),e=kN.bind(null,e,t,n),t.then(e,e))}function kN(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,rt===e&&(Ie&n)===n&&(At===4||At===3&&(Ie&62914560)===Ie&&300>Mn()-xu?(Ke&2)===0&&$i(e,0):Cp|=n,Hi===Ie&&(Hi=0)),Mr(e)}function Q0(e,t){t===0&&(t=Vv()),e=zo(e,t),e!==null&&(fs(e,t),Mr(e))}function LN(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Q0(e,n)}function DN(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(L(314))}r!==null&&r.delete(t),Q0(e,n)}function zN(e,t){return Pm(e,t)}var eu=null,hi=null,Nm=!1,tu=!1,Uf=!1,Ba=0;function Mr(e){e!==hi&&e.next===null&&(hi===null?eu=hi=e:hi=hi.next=e),tu=!0,Nm||(Nm=!0,IN())}function vs(e,t){if(!Uf&&tu){Uf=!0;do for(var n=!1,r=eu;r!==null;){if(!t)if(e!==0){var a=r.pendingLanes;if(a===0)var o=0;else{var i=r.suspendedLanes,s=r.pingedLanes;o=(1<<31-_n(42|e)+1)-1,o&=a&~(i&~s),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,iv(r,o))}else o=Ie,o=cu(r,r===rt?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(o&3)===0||ds(r,o)||(n=!0,iv(r,o));r=r.next}while(n);Uf=!1}}function BN(){X0()}function X0(){tu=Nm=!1;var e=0;Ba!==0&&KN()&&(e=Ba);for(var t=Mn(),n=null,r=eu;r!==null;){var a=r.next,o=Z0(r,t);o===0?(r.next=null,n===null?eu=a:n.next=a,a===null&&(hi=n)):(n=r,(e!==0||(o&3)!==0)&&(tu=!0)),r=a}Bt!==0&&Bt!==5||vs(e,!1),Ba!==0&&(Ba=0)}function Z0(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var i=31-_n(o),s=1<<i,c=a[i];c===-1?((s&n)===0||(s&r)!==0)&&(a[i]=cE(s,t)):c<=t&&(e.expiredLanes|=s),o&=~s}if(t=rt,n=Ie,n=cu(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(We===2||We===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&mf(r),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ds(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&mf(r),Hm(n)){case 2:case 8:n=jv;break;case 32:n=Ic;break;case 268435456:n=Pv;break;default:n=Ic}return r=J0.bind(null,e),n=Pm(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&mf(r),e.callbackPriority=2,e.callbackNode=null,2}function J0(e,t){if(Bt!==0&&Bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Au()&&e.callbackNode!==n)return null;var r=Ie;return r=cu(e,e===rt?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(U0(e,r,t),Z0(e,Mn()),e.callbackNode!=null&&e.callbackNode===n?J0.bind(null,e):null)}function iv(e,t){if(Au())return null;U0(e,t,!0)}function IN(){GN(function(){(Ke&6)!==0?Pm(Uv,BN):X0()})}function Ep(){if(Ba===0){var e=ji;e===0&&(e=nc,nc<<=1,(nc&261888)===0&&(nc=256)),Ba=e}return Ba}function lv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:xc(""+e)}function sv(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 UN(e,t,n,r,a){if(t==="submit"&&n&&n.stateNode===a){var o=lv((a[yn]||null).action),i=r.submitter;i&&(t=(t=i[yn]||null)?lv(t.formAction):i.getAttribute("formAction"),t!==null&&(o=t,i=null));var s=new uu("action","action",null,r,a);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ba!==0){var c=i?sv(a,i):new FormData(a);ym(n,{pending:!0,data:c,method:a.method,action:o},null,c)}}else typeof o=="function"&&(s.preventDefault(),c=i?sv(a,i):new FormData(a),ym(n,{pending:!0,data:c,method:a.method,action:o},o,c))},currentTarget:a}]})}}for(pc=0;pc<om.length;pc++)gc=om[pc],cv=gc.toLowerCase(),uv=gc[0].toUpperCase()+gc.slice(1),fr(cv,"on"+uv);var gc,cv,uv,pc;fr(db,"onAnimationEnd");fr(fb,"onAnimationIteration");fr(mb,"onAnimationStart");fr("dblclick","onDoubleClick");fr("focusin","onFocus");fr("focusout","onBlur");fr(nN,"onTransitionRun");fr(rN,"onTransitionStart");fr(aN,"onTransitionCancel");fr(pb,"onTransitionEnd");Ii("onMouseEnter",["mouseout","mouseover"]);Ii("onMouseLeave",["mouseout","mouseover"]);Ii("onPointerEnter",["pointerout","pointerover"]);Ii("onPointerLeave",["pointerout","pointerover"]);ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ko("onBeforeInput",["compositionend","keypress","textInput","paste"]);ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),jN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(as));function ex(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],c=s.instance,u=s.currentTarget;if(s=s.listener,c!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=u;try{o(a)}catch(f){jc(f)}a.currentTarget=null,o=c}else for(i=0;i<r.length;i++){if(s=r[i],c=s.instance,u=s.currentTarget,s=s.listener,c!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=u;try{o(a)}catch(f){jc(f)}a.currentTarget=null,o=c}}}}function De(e,t){var n=t[Xf];n===void 0&&(n=t[Xf]=new Set);var r=e+"__bubble";n.has(r)||(tx(t,e,2,!1),n.add(r))}function jf(e,t,n){var r=0;t&&(r|=4),tx(n,e,r,t)}var hc="_reactListening"+Math.random().toString(36).slice(2);function Np(e){if(!e[hc]){e[hc]=!0,Fv.forEach(function(n){n!=="selectionchange"&&(jN.has(n)||jf(n,!1,e),jf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[hc]||(t[hc]=!0,jf("selectionchange",!1,t))}}function tx(e,t,n,r){switch(px(t)){case 2:var a=mT;break;case 8:a=pT;break;default:a=_p}n=a.bind(null,t,n,e),a=void 0,!nm||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Pf(e,t,n,r,a){var o=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var s=r.stateNode.containerInfo;if(s===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===a)return;i=i.return}for(;s!==null;){if(i=bi(s),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){r=o=i;continue e}s=s.parentNode}}r=r.return}eb(function(){var u=o,f=Km(n),d=[];e:{var p=gb.get(e);if(p!==void 0){var m=uu,b=e;switch(e){case"keypress":if(wc(n)===0)break e;case"keydown":case"keyup":m=DE;break;case"focusin":b="focus",m=vf;break;case"focusout":b="blur",m=vf;break;case"beforeblur":case"afterblur":m=vf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=yy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=wE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=IE;break;case db:case fb:case mb:m=RE;break;case pb:m=jE;break;case"scroll":case"scrollend":m=xE;break;case"wheel":m=VE;break;case"copy":case"cut":case"paste":m=NE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=by;break;case"toggle":case"beforetoggle":m=qE}var g=(t&4)!==0,x=!g&&(e==="scroll"||e==="scrollend"),y=g?p!==null?p+"Capture":null:p;g=[];for(var h=u,v;h!==null;){var S=h;if(v=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||v===null||y===null||(S=Ql(h,y),S!=null&&g.push(os(h,S,v))),x)break;h=h.return}0<g.length&&(p=new m(p,b,null,n,f),d.push({event:p,listeners:g}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==tm&&(b=n.relatedTarget||n.fromElement)&&(bi(b)||b[Gi]))break e;if((m||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=u,b=b?bi(b):null,b!==null&&(x=cs(b),g=b.tag,b!==x||g!==5&&g!==27&&g!==6)&&(b=null)):(m=null,b=u),m!==b)){if(g=yy,S="onMouseLeave",y="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(g=by,S="onPointerLeave",y="onPointerEnter",h="pointer"),x=m==null?p:Ll(m),v=b==null?p:Ll(b),p=new g(S,h+"leave",m,n,f),p.target=x,p.relatedTarget=v,S=null,bi(f)===u&&(g=new g(y,h+"enter",b,n,f),g.target=v,g.relatedTarget=x,S=g),x=S,m&&b)t:{for(g=PN,y=m,h=b,v=0,S=y;S;S=g(S))v++;S=0;for(var C=h;C;C=g(C))S++;for(;0<v-S;)y=g(y),v--;for(;0<S-v;)h=g(h),S--;for(;v--;){if(y===h||h!==null&&y===h.alternate){g=y;break t}y=g(y),h=g(h)}g=null}else g=null;m!==null&&dv(d,p,m,g,!1),b!==null&&x!==null&&dv(d,x,b,g,!0)}}e:{if(p=u?Ll(u):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var N=Ay;else if(wy(p))if(ib)N=JE;else{N=XE;var w=QE}else m=p.nodeName,!m||m.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?u&&$m(u.elementType)&&(N=Ay):N=ZE;if(N&&(N=N(e,u))){ob(d,N,n,f);break e}w&&w(e,p,u),e==="focusout"&&u&&p.type==="number"&&u.memoizedProps.value!=null&&em(p,"number",p.value)}switch(w=u?Ll(u):window,e){case"focusin":(wy(w)||w.contentEditable==="true")&&(wi=w,rm=u,Ul=null);break;case"focusout":Ul=rm=wi=null;break;case"mousedown":am=!0;break;case"contextmenu":case"mouseup":case"dragend":am=!1,Ny(d,n,f);break;case"selectionchange":if(tN)break;case"keydown":case"keyup":Ny(d,n,f)}var R;if(Ym)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Si?rb(e,n)&&(M="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(nb&&n.locale!=="ko"&&(Si||M!=="onCompositionStart"?M==="onCompositionEnd"&&Si&&(R=tb()):(La=f,Fm="value"in La?La.value:La.textContent,Si=!0)),w=nu(u,M),0<w.length&&(M=new vy(M,e,null,n,f),d.push({event:M,listeners:w}),R?M.data=R:(R=ab(n),R!==null&&(M.data=R)))),(R=KE?FE(e,n):GE(e,n))&&(M=nu(u,"onBeforeInput"),0<M.length&&(w=new vy("onBeforeInput","beforeinput",null,n,f),d.push({event:w,listeners:M}),w.data=R)),UN(d,e,u,n,f)}ex(d,t)})}function os(e,t,n){return{instance:e,listener:t,currentTarget:n}}function nu(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,o=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||o===null||(a=Ql(e,n),a!=null&&r.unshift(os(e,a,o)),a=Ql(e,t),a!=null&&r.push(os(e,a,o))),e.tag===3)return r;e=e.return}return[]}function PN(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dv(e,t,n,r,a){for(var o=t._reactName,i=[];n!==null&&n!==r;){var s=n,c=s.alternate,u=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||u===null||(c=u,a?(u=Ql(n,o),u!=null&&i.unshift(os(n,u,c))):a||(u=Ql(n,o),u!=null&&i.push(os(n,u,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var VN=/\r\n?/g,HN=/\u0000|\uFFFD/g;function fv(e){return(typeof e=="string"?e:""+e).replace(VN,`
9
+ `).replace(HN,"")}function nx(e,t){return t=fv(t),fv(e)===t}function Je(e,t,n,r,a,o){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Ui(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Ui(e,""+r);break;case"className":oc(e,"class",r);break;case"tabIndex":oc(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":oc(e,n,r);break;case"style":Jv(e,r,o);break;case"data":if(t!=="object"){oc(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=xc(""+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"&&Je(e,t,"name",a.name,a,null),Je(e,t,"formEncType",a.formEncType,a,null),Je(e,t,"formMethod",a.formMethod,a,null),Je(e,t,"formTarget",a.formTarget,a,null)):(Je(e,t,"encType",a.encType,a,null),Je(e,t,"method",a.method,a,null),Je(e,t,"target",a.target,a,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=xc(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=ta);break;case"onScroll":r!=null&&De("scroll",e);break;case"onScrollEnd":r!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(L(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=xc(""+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":r===!0?e.setAttribute(n,""):r!==!1&&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":De("beforetoggle",e),De("toggle",e),bc(e,"popover",r);break;case"xlinkActuate":Gr(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Gr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Gr(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Gr(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Gr(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Gr(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Gr(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":bc(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=vE.get(n)||n,bc(e,n,r))}}function Tm(e,t,n,r,a,o){switch(n){case"style":Jv(e,r,o);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(L(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Ui(e,r):(typeof r=="number"||typeof r=="bigint")&&Ui(e,""+r);break;case"onScroll":r!=null&&De("scroll",e);break;case"onScrollEnd":r!=null&&De("scrollend",e);break;case"onClick":r!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Gv.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),o=e[yn]||null,o=o!=null?o[n]:null,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 e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):bc(e,n,r)}}}function Jt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var i=n[o];if(i!=null)switch(o){case"src":r=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Je(e,t,o,i,n,null)}}a&&Je(e,t,"srcSet",n.srcSet,n,null),r&&Je(e,t,"src",n.src,n,null);return;case"input":De("invalid",e);var s=o=i=a=null,c=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"name":a=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":u=f;break;case"value":o=f;break;case"defaultValue":s=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Je(e,t,r,f,n,null)}}Qv(e,o,s,c,u,i,a,!1);return;case"select":De("invalid",e),r=i=o=null;for(a in n)if(n.hasOwnProperty(a)&&(s=n[a],s!=null))switch(a){case"value":o=s;break;case"defaultValue":i=s;break;case"multiple":r=s;default:Je(e,t,a,s,n,null)}t=o,n=i,e.multiple=!!r,t!=null?Oi(e,!!r,t,!1):n!=null&&Oi(e,!!r,n,!0);return;case"textarea":De("invalid",e),o=a=r=null;for(i in n)if(n.hasOwnProperty(i)&&(s=n[i],s!=null))switch(i){case"value":r=s;break;case"defaultValue":a=s;break;case"children":o=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(L(91));break;default:Je(e,t,i,s,n,null)}Zv(e,r,a,o);return;case"option":for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Je(e,t,c,r,n,null));return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(r=0;r<as.length;r++)De(as[r],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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(L(137,t));default:Je(e,t,u,r,n,null)}return;default:if($m(t)){for(f in n)n.hasOwnProperty(f)&&(r=n[f],r!==void 0&&Tm(e,t,f,r,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(r=n[s],r!=null&&Je(e,t,s,r,n,null))}function qN(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,i=null,s=null,c=null,u=null,f=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":c=d;default:r.hasOwnProperty(m)||Je(e,t,m,null,r,d)}}for(var p in r){var m=r[p];if(d=n[p],r.hasOwnProperty(p)&&(m!=null||d!=null))switch(p){case"type":o=m;break;case"name":a=m;break;case"checked":u=m;break;case"defaultChecked":f=m;break;case"value":i=m;break;case"defaultValue":s=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(L(137,t));break;default:m!==d&&Je(e,t,p,m,r,d)}}Jf(e,i,s,c,u,f,o,a);return;case"select":m=i=s=p=null;for(o in n)if(c=n[o],n.hasOwnProperty(o)&&c!=null)switch(o){case"value":break;case"multiple":m=c;default:r.hasOwnProperty(o)||Je(e,t,o,null,r,c)}for(a in r)if(o=r[a],c=n[a],r.hasOwnProperty(a)&&(o!=null||c!=null))switch(a){case"value":p=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:o!==c&&Je(e,t,a,o,r,c)}t=s,n=i,r=m,p!=null?Oi(e,!!n,p,!1):!!r!=!!n&&(t!=null?Oi(e,!!n,t,!0):Oi(e,!!n,n?[]:"",!1));return;case"textarea":m=p=null;for(s in n)if(a=n[s],n.hasOwnProperty(s)&&a!=null&&!r.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:Je(e,t,s,null,r,a)}for(i in r)if(a=r[i],o=n[i],r.hasOwnProperty(i)&&(a!=null||o!=null))switch(i){case"value":p=a;break;case"defaultValue":m=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(L(91));break;default:a!==o&&Je(e,t,i,a,r,o)}Xv(e,p,m);return;case"option":for(var b in n)p=n[b],n.hasOwnProperty(b)&&p!=null&&!r.hasOwnProperty(b)&&(b==="selected"?e.selected=!1:Je(e,t,b,null,r,p));for(c in r)p=r[c],m=n[c],r.hasOwnProperty(c)&&p!==m&&(p!=null||m!=null)&&(c==="selected"?e.selected=p&&typeof p!="function"&&typeof p!="symbol":Je(e,t,c,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)&&Je(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(L(137,t));break;default:Je(e,t,u,p,r,m)}return;default:if($m(t)){for(var x in n)p=n[x],n.hasOwnProperty(x)&&p!==void 0&&!r.hasOwnProperty(x)&&Tm(e,t,x,void 0,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p===void 0&&m===void 0||Tm(e,t,f,p,r,m);return}}for(var y in n)p=n[y],n.hasOwnProperty(y)&&p!=null&&!r.hasOwnProperty(y)&&Je(e,t,y,null,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p==null&&m==null||Je(e,t,d,p,r,m)}function mv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $N(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],o=a.transferSize,i=a.initiatorType,s=a.duration;if(o&&s&&mv(i)){for(i=0,s=a.responseEnd,r+=1;r<n.length;r++){var c=n[r],u=c.startTime;if(u>s)break;var f=c.transferSize,d=c.initiatorType;f&&mv(d)&&(c=c.responseEnd,i+=f*(c<s?1:(s-u)/(c-u)))}if(--r,t+=8*(o+i)/(a.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 Mm=null,Om=null;function ru(e){return e.nodeType===9?e:e.ownerDocument}function pv(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 rx(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 _m(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 Vf=null;function KN(){var e=window.event;return e&&e.type==="popstate"?e===Vf?!1:(Vf=e,!0):(Vf=null,!1)}var ax=typeof setTimeout=="function"?setTimeout:void 0,FN=typeof clearTimeout=="function"?clearTimeout:void 0,gv=typeof Promise=="function"?Promise:void 0,GN=typeof queueMicrotask=="function"?queueMicrotask:typeof gv<"u"?function(e){return gv.resolve(null).then(e).catch(YN)}:ax;function YN(e){setTimeout(function(){throw e})}function Xa(e){return e==="head"}function hv(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(a),Fi(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Yl(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Yl(n);for(var o=n.firstChild;o;){var i=o.nextSibling,s=o.nodeName;o[ms]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=i}}else n==="body"&&Yl(e.ownerDocument.body);n=a}while(n);Fi(t)}function yv(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 km(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":km(n),qm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function WN(e,t,n,r){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[ms])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=Wn(e.nextSibling),e===null)break}return null}function QN(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Wn(e.nextSibling),e===null))return null;return e}function ox(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Wn(e.nextSibling),e===null))return null;return e}function Lm(e){return e.data==="$?"||e.data==="$~"}function Dm(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function XN(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 Wn(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 zm=null;function vv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Wn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function bv(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 ix(e,t,n){switch(t=ru(n),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function Yl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);qm(e)}var Qn=new Map,xv=new Set;function au(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var da=Fe.d;Fe.d={f:ZN,r:JN,D:eT,C:tT,L:nT,m:rT,X:oT,S:aT,M:iT};function ZN(){var e=da.f(),t=Su();return e||t}function JN(e){var t=Yi(e);t!==null&&t.tag===5&&t.type==="form"?Jb(t):da.r(e)}var Zi=typeof document>"u"?null:document;function lx(e,t,n){var r=Zi;if(r&&typeof t=="string"&&t){var a=Kn(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),xv.has(a)||(xv.add(a),e={rel:e,crossOrigin:n,href:t},r.querySelector(a)===null&&(t=r.createElement("link"),Jt(t,"link",e),qt(t),r.head.appendChild(t)))}}function eT(e){da.D(e),lx("dns-prefetch",e,null)}function tT(e,t){da.C(e,t),lx("preconnect",e,t)}function nT(e,t,n){da.L(e,t,n);var r=Zi;if(r&&e&&t){var a='link[rel="preload"][as="'+Kn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Kn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Kn(n.imageSizes)+'"]')):a+='[href="'+Kn(e)+'"]';var o=a;switch(t){case"style":o=Ki(e);break;case"script":o=Ji(e)}Qn.has(o)||(e=mt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Qn.set(o,e),r.querySelector(a)!==null||t==="style"&&r.querySelector(bs(o))||t==="script"&&r.querySelector(xs(o))||(t=r.createElement("link"),Jt(t,"link",e),qt(t),r.head.appendChild(t)))}}function rT(e,t){da.m(e,t);var n=Zi;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Kn(r)+'"][href="'+Kn(e)+'"]',o=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Ji(e)}if(!Qn.has(o)&&(e=mt({rel:"modulepreload",href:e},t),Qn.set(o,e),n.querySelector(a)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xs(o)))return}r=n.createElement("link"),Jt(r,"link",e),qt(r),n.head.appendChild(r)}}}function aT(e,t,n){da.S(e,t,n);var r=Zi;if(r&&e){var a=Mi(r).hoistableStyles,o=Ki(e);t=t||"default";var i=a.get(o);if(!i){var s={loading:0,preload:null};if(i=r.querySelector(bs(o)))s.loading=5;else{e=mt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Qn.get(o))&&Tp(e,n);var c=i=r.createElement("link");qt(c),Jt(c,"link",e),c._p=new Promise(function(u,f){c.onload=u,c.onerror=f}),c.addEventListener("load",function(){s.loading|=1}),c.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Oc(i,t,r)}i={type:"stylesheet",instance:i,count:1,state:s},a.set(o,i)}}}function oT(e,t){da.X(e,t);var n=Zi;if(n&&e){var r=Mi(n).hoistableScripts,a=Ji(e),o=r.get(a);o||(o=n.querySelector(xs(a)),o||(e=mt({src:e,async:!0},t),(t=Qn.get(a))&&Mp(e,t),o=n.createElement("script"),qt(o),Jt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}}function iT(e,t){da.M(e,t);var n=Zi;if(n&&e){var r=Mi(n).hoistableScripts,a=Ji(e),o=r.get(a);o||(o=n.querySelector(xs(a)),o||(e=mt({src:e,async:!0,type:"module"},t),(t=Qn.get(a))&&Mp(e,t),o=n.createElement("script"),qt(o),Jt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}}function Sv(e,t,n,r){var a=(a=Ia.current)?au(a):null;if(!a)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ki(n.href),n=Mi(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=Ki(n.href);var o=Mi(a).hoistableStyles,i=o.get(e);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,i),(o=a.querySelector(bs(e)))&&!o._p&&(i.instance=o,i.state.loading=5),Qn.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},Qn.set(e,n),o||lT(a,e,n,i.state))),t&&r===null)throw Error(L(528,""));return i}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ji(n),n=Mi(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(L(444,e))}}function Ki(e){return'href="'+Kn(e)+'"'}function bs(e){return'link[rel="stylesheet"]['+e+"]"}function sx(e){return mt({},e,{"data-precedence":e.precedence,precedence:null})}function lT(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}),Jt(t,"link",n),qt(t),e.head.appendChild(t))}function Ji(e){return'[src="'+Kn(e)+'"]'}function xs(e){return"script[async]"+e}function wv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Kn(n.href)+'"]');if(r)return t.instance=r,qt(r),r;var a=mt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),qt(r),Jt(r,"style",a),Oc(r,n.precedence,e),t.instance=r;case"stylesheet":a=Ki(n.href);var o=e.querySelector(bs(a));if(o)return t.state.loading|=4,t.instance=o,qt(o),o;r=sx(n),(a=Qn.get(a))&&Tp(r,a),o=(e.ownerDocument||e).createElement("link"),qt(o);var i=o;return i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Jt(o,"link",r),t.state.loading|=4,Oc(o,n.precedence,e),t.instance=o;case"script":return o=Ji(n.src),(a=e.querySelector(xs(o)))?(t.instance=a,qt(a),a):(r=n,(a=Qn.get(o))&&(r=mt({},n),Mp(r,a)),e=e.ownerDocument||e,a=e.createElement("script"),qt(a),Jt(a,"link",r),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Oc(r,n.precedence,e));return t.instance}function Oc(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,o=a,i=0;i<r.length;i++){var s=r[i];if(s.dataset.precedence===t)o=s;else if(o!==a)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Tp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Mp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var _c=null;function Av(e,t,n){if(_c===null){var r=new Map,a=_c=new Map;a.set(n,r)}else a=_c,r=a.get(n),r||(r=new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var o=n[a];if(!(o[ms]||o[Qt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var i=o.getAttribute(t)||"";i=e+i;var s=r.get(i);s?s.push(o):r.set(i,[o])}}return r}function Cv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function sT(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;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!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 cx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function cT(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var a=Ki(r.href),o=t.querySelector(bs(a));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ou.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,qt(o);return}o=t.ownerDocument||t,r=sx(r),(a=Qn.get(a))&&Tp(r,a),o=o.createElement("link"),qt(o);var i=o;i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Jt(o,"link",r),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=ou.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Hf=0;function uT(e,t){return e.stylesheets&&e.count===0&&kc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&kc(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Hf===0&&(Hf=62500*$N());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&kc(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Hf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}function ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var iu=null;function kc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,iu=new Map,t.forEach(dT,e),iu=null,ou.call(e))}function dT(e,t){if(!(t.state.loading&4)){var n=iu.get(e);if(n)var r=n.get(null);else{n=new Map,iu.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<a.length;o++){var i=a[o];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),r=i)}r&&n.set(null,r)}a=t.instance,i=a.getAttribute("data-precedence"),o=n.get(i)||r,o===r&&n.set(null,a),n.set(i,a),this.count++,r=ou.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),o?o.parentNode.insertBefore(a,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var is={$$typeof:ea,Provider:null,Consumer:null,_currentValue:wo,_currentValue2:wo,_threadCount:0};function fT(e,t,n,r,a,o,i,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=pf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pf(0),this.hiddenUpdates=pf(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ux(e,t,n,r,a,o,i,s,c,u,f,d){return e=new fT(e,t,n,i,c,u,f,d,s),t=1,o===!0&&(t|=24),o=Nn(3,null,null,t),e.current=o,o.stateNode=e,t=tp(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},ap(o),e}function dx(e){return e?(e=Ri,e):Ri}function fx(e,t,n,r,a,o){a=dx(a),r.context===null?r.context=a:r.pendingContext=a,r=ja(t),r.payload={element:n},o=o===void 0?null:o,o!==null&&(r.callback=o),n=Pa(e,r,t),n!==null&&(hn(n,e,t),Pl(n,e,t))}function Rv(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){Rv(e,t),(e=e.alternate)&&Rv(e,t)}function mx(e){if(e.tag===13||e.tag===31){var t=zo(e,67108864);t!==null&&hn(t,e,67108864),Op(e,67108864)}}function Ev(e){if(e.tag===13||e.tag===31){var t=kn();t=Vm(t);var n=zo(e,t);n!==null&&hn(n,e,t),Op(e,t)}}var lu=!0;function mT(e,t,n,r){var a=ve.T;ve.T=null;var o=Fe.p;try{Fe.p=2,_p(e,t,n,r)}finally{Fe.p=o,ve.T=a}}function pT(e,t,n,r){var a=ve.T;ve.T=null;var o=Fe.p;try{Fe.p=8,_p(e,t,n,r)}finally{Fe.p=o,ve.T=a}}function _p(e,t,n,r){if(lu){var a=Bm(r);if(a===null)Pf(e,t,r,su,n),Nv(e,r);else if(hT(a,e,t,n,r))r.stopPropagation();else if(Nv(e,r),t&4&&-1<gT.indexOf(e)){for(;a!==null;){var o=Yi(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var i=bo(o.pendingLanes);if(i!==0){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;i;){var c=1<<31-_n(i);s.entanglements[1]|=c,i&=~c}Mr(o),(Ke&6)===0&&(Xc=Mn()+500,vs(0,!1))}}break;case 31:case 13:s=zo(o,2),s!==null&&hn(s,o,2),Su(),Op(o,2)}if(o=Bm(r),o===null&&Pf(e,t,r,su,n),o===a)break;a=o}a!==null&&r.stopPropagation()}else Pf(e,t,r,null,n)}}function Bm(e){return e=Km(e),kp(e)}var su=null;function kp(e){if(su=null,e=bi(e),e!==null){var t=cs(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Lv(t),e!==null)return e;e=null}else if(n===31){if(e=Dv(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 su=e,null}function px(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(nE()){case Uv:return 2;case jv:return 8;case Ic:case rE:return 32;case Pv:return 268435456;default:return 32}default:return 32}}var Im=!1,qa=null,$a=null,Ka=null,ls=new Map,ss=new Map,_a=[],gT="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 Nv(e,t){switch(e){case"focusin":case"focusout":qa=null;break;case"dragenter":case"dragleave":$a=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":ls.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ss.delete(t.pointerId)}}function Ml(e,t,n,r,a,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},t!==null&&(t=Yi(t),t!==null&&mx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function hT(e,t,n,r,a){switch(t){case"focusin":return qa=Ml(qa,e,t,n,r,a),!0;case"dragenter":return $a=Ml($a,e,t,n,r,a),!0;case"mouseover":return Ka=Ml(Ka,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return ls.set(o,Ml(ls.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,ss.set(o,Ml(ss.get(o)||null,e,t,n,r,a)),!0}return!1}function gx(e){var t=bi(e.target);if(t!==null){var n=cs(t);if(n!==null){if(t=n.tag,t===13){if(t=Lv(n),t!==null){e.blockedOn=t,uy(e.priority,function(){Ev(n)});return}}else if(t===31){if(t=Dv(n),t!==null){e.blockedOn=t,uy(e.priority,function(){Ev(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 Lc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Bm(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tm=r,n.target.dispatchEvent(r),tm=null}else return t=Yi(n),t!==null&&mx(t),e.blockedOn=n,!1;t.shift()}return!0}function Tv(e,t,n){Lc(e)&&n.delete(t)}function yT(){Im=!1,qa!==null&&Lc(qa)&&(qa=null),$a!==null&&Lc($a)&&($a=null),Ka!==null&&Lc(Ka)&&(Ka=null),ls.forEach(Tv),ss.forEach(Tv)}function yc(e,t){e.blockedOn===t&&(e.blockedOn=null,Im||(Im=!0,It.unstable_scheduleCallback(It.unstable_NormalPriority,yT)))}var vc=null;function Mv(e){vc!==e&&(vc=e,It.unstable_scheduleCallback(It.unstable_NormalPriority,function(){vc===e&&(vc=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if(typeof r!="function"){if(kp(r||n)===null)continue;break}var o=Yi(n);o!==null&&(e.splice(t,3),t-=3,ym(o,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Fi(e){function t(c){return yc(c,e)}qa!==null&&yc(qa,e),$a!==null&&yc($a,e),Ka!==null&&yc(Ka,e),ls.forEach(t),ss.forEach(t);for(var n=0;n<_a.length;n++){var r=_a[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<_a.length&&(n=_a[0],n.blockedOn===null);)gx(n),n.blockedOn===null&&_a.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var a=n[r],o=n[r+1],i=a[yn]||null;if(typeof o=="function")i||Mv(n);else if(i){var s=null;if(o&&o.hasAttribute("formAction")){if(a=o,i=o[yn]||null)s=i.formAction;else if(kp(a)!==null)continue}else s=i.action;typeof s=="function"?n[r+1]=s:(n.splice(r,3),r-=3),Mv(n)}}}function hx(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(i){return a=i})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,a=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),a!==null&&(a(),a=null)}}}function Lp(e){this._internalRoot=e}Cu.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var n=t.current,r=kn();fx(n,r,e,t,null,null)};Cu.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fx(e.current,2,null,e,null,null),Su(),t[Gi]=null}};function Cu(e){this._internalRoot=e}Cu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Kv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<_a.length&&t!==0&&t<_a[n].priority;n++);_a.splice(n,0,e),n===0&&gx(e)}};var Ov=_v.version;if(Ov!=="19.2.4")throw Error(L(527,Ov,"19.2.4"));Fe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=WR(t),e=e!==null?zv(e):null,e=e===null?null:e.stateNode,e};var vT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:ve,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ol=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ol.isDisabled&&Ol.supportsFiber))try{us=Ol.inject(vT),On=Ol}catch{}var Ol;Ru.createRoot=function(e,t){if(!kv(e))throw Error(L(299));var n=!1,r="",a=l0,o=s0,i=c0;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=ux(e,1,!1,null,null,n,r,null,a,o,i,hx),e[Gi]=t.current,Np(e),new Lp(t)};Ru.hydrateRoot=function(e,t,n){if(!kv(e))throw Error(L(299));var r=!1,a="",o=l0,i=s0,s=c0,c=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(s=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=ux(e,1,!0,t,n??null,r,a,c,o,i,s,hx),t.context=dx(null),n=t.current,r=kn(),r=Vm(r),a=ja(r),a.callback=null,Pa(n,a,r),n=r,t.current.lanes=n,fs(t,n),Mr(t),e[Gi]=t.current,Np(e),new Cu(t)};Ru.version="19.2.4"});var xx=wr((LL,bx)=>{"use strict";function vx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vx)}catch(e){console.error(e)}}vx(),bx.exports=yx()});var Kx=wr(Ou=>{"use strict";var lM=Symbol.for("react.transitional.element"),sM=Symbol.for("react.fragment");function $x(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:lM,type:e,key:r,ref:t!==void 0?t:null,props:n}}Ou.Fragment=sM;Ou.jsx=$x;Ou.jsxs=$x});var Be=wr((HL,Fx)=>{"use strict";Fx.exports=Kx()});var DC=K(xx(),1);var E=K(xe(),1),dC=K(ho(),1);function Sx(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Sx(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Eu(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Sx(e))&&(r&&(r+=" "),r+=t);return r}var wx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ax=Eu,Nu=(e,t)=>n=>{var r;if(t?.variants==null)return Ax(e,n?.class,n?.className);let{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(u=>{let f=n?.[u],d=o?.[u];if(f===null)return null;let p=wx(f)||wx(d);return a[u][p]}),s=n&&Object.entries(n).reduce((u,f)=>{let[d,p]=f;return p===void 0||(u[d]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,f)=>{let{class:d,className:p,...m}=f;return Object.entries(m).every(b=>{let[g,x]=b;return Array.isArray(x)?x.includes({...o,...s}[g]):{...o,...s}[g]===x})?[...u,d,p]:u},[]);return Ax(e,i,c,n?.class,n?.className)};var bT=(e,t)=>{let n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},xT=(e,t)=>({classGroupId:e,validator:t}),Mx=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var Cx=[],ST="arbitrary..",wT=e=>{let t=CT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return AT(i);let s=i.split("-"),c=s[0]===""&&s.length>1?1:0;return Ox(s,c,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let c=r[i],u=n[i];return c?u?bT(u,c):c:u||Cx}return n[i]||Cx}}},Ox=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let a=e[t],o=n.nextPart.get(a);if(o){let u=Ox(e,t+1,o);if(u)return u}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),c=i.length;for(let u=0;u<c;u++){let f=i[u];if(f.validator(s))return f.classGroupId}},AT=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?ST+r:void 0})(),CT=e=>{let{theme:t,classGroups:n}=e;return RT(n,t)},RT=(e,t)=>{let n=Mx();for(let r in e){let a=e[r];zp(a,n,r,t)}return n},zp=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++){let i=e[o];ET(i,t,n,r)}},ET=(e,t,n,r)=>{if(typeof e=="string"){NT(e,t,n);return}if(typeof e=="function"){TT(e,t,n,r);return}MT(e,t,n,r)},NT=(e,t,n)=>{let r=e===""?t:_x(t,e);r.classGroupId=n},TT=(e,t,n,r)=>{if(OT(e)){zp(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xT(n,e))},MT=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){let[s,c]=a[i];zp(c,_x(t,s),n,r)}},_x=(e,t)=>{let n=e,r=t.split("-"),a=r.length;for(let o=0;o<a;o++){let i=r[o],s=n.nextPart.get(i);s||(s=Mx(),n.nextPart.set(i,s)),n=s}return n},OT=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_T=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return a(o,i),i},set(o,i){o in n?n[o]=i:a(o,i)}}};var kT=[],Rx=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),LT=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=a=>{let o=[],i=0,s=0,c=0,u,f=a.length;for(let g=0;g<f;g++){let x=a[g];if(i===0&&s===0){if(x===":"){o.push(a.slice(c,g)),c=g+1;continue}if(x==="/"){u=g;continue}}x==="["?i++:x==="]"?i--:x==="("?s++:x===")"&&s--}let d=o.length===0?a:a.slice(c),p=d,m=!1;d.endsWith("!")?(p=d.slice(0,-1),m=!0):d.startsWith("!")&&(p=d.slice(1),m=!0);let b=u&&u>c?u-c:void 0;return Rx(o,m,p,b)};if(t){let a=t+":",o=r;r=i=>i.startsWith(a)?o(i.slice(a.length)):Rx(kT,!1,i,void 0,!0)}if(n){let a=r;r=o=>n({className:o,parseClassName:a})}return r},DT=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{let r=[],a=[];for(let o=0;o<n.length;o++){let i=n[o],s=i[0]==="[",c=t.has(i);s||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},zT=e=>({cache:_T(e.cacheSize),parseClassName:LT(e),sortModifiers:DT(e),...wT(e)}),BT=/\s+/,IT=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(BT),c="";for(let u=s.length-1;u>=0;u-=1){let f=s[u],{isExternal:d,modifiers:p,hasImportantModifier:m,baseClassName:b,maybePostfixModifierPosition:g}=n(f);if(d){c=f+(c.length>0?" "+c:c);continue}let x=!!g,y=r(x?b.substring(0,g):b);if(!y){if(!x){c=f+(c.length>0?" "+c:c);continue}if(y=r(b),!y){c=f+(c.length>0?" "+c:c);continue}x=!1}let h=p.length===0?"":p.length===1?p[0]:o(p).join(":"),v=m?h+"!":h,S=v+y;if(i.indexOf(S)>-1)continue;i.push(S);let C=a(y,x);for(let N=0;N<C.length;++N){let w=C[N];i.push(v+w)}c=f+(c.length>0?" "+c:c)}return c},UT=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=kx(n))&&(a&&(a+=" "),a+=r);return a},kx=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=kx(e[r]))&&(n&&(n+=" "),n+=t);return n},jT=(e,...t)=>{let n,r,a,o,i=c=>{let u=t.reduce((f,d)=>d(f),e());return n=zT(u),r=n.cache.get,a=n.cache.set,o=s,s(c)},s=c=>{let u=r(c);if(u)return u;let f=IT(c,n);return a(c,f),f};return o=i,(...c)=>o(UT(...c))},PT=[],Ut=e=>{let t=n=>n[e]||PT;return t.isThemeGetter=!0,t},Lx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,VT=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,HT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qT=/\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$/,$T=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,KT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,FT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Za=e=>VT.test(e),Me=e=>!!e&&!Number.isNaN(Number(e)),Ja=e=>!!e&&Number.isInteger(Number(e)),Dp=e=>e.endsWith("%")&&Me(e.slice(0,-1)),fa=e=>HT.test(e),zx=()=>!0,GT=e=>qT.test(e)&&!$T.test(e),Bp=()=>!1,YT=e=>KT.test(e),WT=e=>FT.test(e),QT=e=>!ie(e)&&!le(e),XT=e=>eo(e,Ux,Bp),ie=e=>Lx.test(e),Io=e=>eo(e,jx,GT),Ex=e=>eo(e,oM,Me),ZT=e=>eo(e,Vx,zx),JT=e=>eo(e,Px,Bp),Nx=e=>eo(e,Bx,Bp),eM=e=>eo(e,Ix,WT),Tu=e=>eo(e,Hx,YT),le=e=>Dx.test(e),Ss=e=>Uo(e,jx),tM=e=>Uo(e,Px),Tx=e=>Uo(e,Bx),nM=e=>Uo(e,Ux),rM=e=>Uo(e,Ix),Mu=e=>Uo(e,Hx,!0),aM=e=>Uo(e,Vx,!0),eo=(e,t,n)=>{let r=Lx.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Uo=(e,t,n=!1)=>{let r=Dx.exec(e);return r?r[1]?t(r[1]):n:!1},Bx=e=>e==="position"||e==="percentage",Ix=e=>e==="image"||e==="url",Ux=e=>e==="length"||e==="size"||e==="bg-size",jx=e=>e==="length",oM=e=>e==="number",Px=e=>e==="family-name",Vx=e=>e==="number"||e==="weight",Hx=e=>e==="shadow";var iM=()=>{let e=Ut("color"),t=Ut("font"),n=Ut("text"),r=Ut("font-weight"),a=Ut("tracking"),o=Ut("leading"),i=Ut("breakpoint"),s=Ut("container"),c=Ut("spacing"),u=Ut("radius"),f=Ut("shadow"),d=Ut("inset-shadow"),p=Ut("text-shadow"),m=Ut("drop-shadow"),b=Ut("blur"),g=Ut("perspective"),x=Ut("aspect"),y=Ut("ease"),h=Ut("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),le,ie],N=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto","contain","none"],R=()=>[le,ie,c],M=()=>[Za,"full","auto",...R()],k=()=>[Ja,"none","subgrid",le,ie],I=()=>["auto",{span:["full",Ja,le,ie]},Ja,le,ie],H=()=>[Ja,"auto",le,ie],Q=()=>["auto","min","max","fr",le,ie],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...R()],te=()=>[Za,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[Za,"screen","full","dvw","lvw","svw","min","max","fit",...R()],q=()=>[Za,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],V=()=>[e,le,ie],_e=()=>[...S(),Tx,Nx,{position:[le,ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],he=()=>["auto","cover","contain",nM,XT,{size:[le,ie]}],Z=()=>[Dp,Ss,Io],ae=()=>["","none","full",u,le,ie],Se=()=>["",Me,Ss,Io],U=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[Me,Dp,Tx,Nx],me=()=>["","none",b,le,ie],re=()=>["none",Me,le,ie],oe=()=>["none",Me,le,ie],Te=()=>[Me,le,ie],Re=()=>[Za,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fa],breakpoint:[fa],color:[zx],container:[fa],"drop-shadow":[fa],ease:["in","out","in-out"],font:[QT],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fa],shadow:[fa],spacing:["px",Me],text:[fa],"text-shadow":[fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Za,ie,le,x]}],container:["container"],columns:[{columns:[Me,ie,le,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"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:C()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Ja,"auto",le,ie]}],basis:[{basis:[Za,"full","auto",s,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Me,Za,"auto","initial","none",ie]}],grow:[{grow:["",Me,le,ie]}],shrink:[{shrink:["",Me,le,ie]}],order:[{order:[Ja,"first","last","none",le,ie]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[s,"screen",...te()]}],"min-w":[{"min-w":[s,"screen","none",...te()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",n,Ss,Io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,aM,ZT]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dp,ie]}],"font-family":[{font:[tM,JT,t]}],"font-features":[{"font-features":[ie]}],"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:[a,le,ie]}],"line-clamp":[{"line-clamp":[Me,"none",le,Ex]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",le,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Me,"from-font","auto",le,Io]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Me,"auto",le,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,ie]}],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",le,ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:he()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ja,le,ie],radial:["",le,ie],conic:[Ja,le,ie]},rM,eM]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:Se()}],"border-w-x":[{"border-x":Se()}],"border-w-y":[{"border-y":Se()}],"border-w-s":[{"border-s":Se()}],"border-w-e":[{"border-e":Se()}],"border-w-bs":[{"border-bs":Se()}],"border-w-be":[{"border-be":Se()}],"border-w-t":[{"border-t":Se()}],"border-w-r":[{"border-r":Se()}],"border-w-b":[{"border-b":Se()}],"border-w-l":[{"border-l":Se()}],"divide-x":[{"divide-x":Se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Me,le,ie]}],"outline-w":[{outline:["",Me,Ss,Io]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",f,Mu,Tu]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",d,Mu,Tu]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:Se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Me,Io]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":Se()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",p,Mu,Tu]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Me,le,ie]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Me]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[le,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[Me]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_e()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:he()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,ie]}],filter:[{filter:["","none",le,ie]}],blur:[{blur:me()}],brightness:[{brightness:[Me,le,ie]}],contrast:[{contrast:[Me,le,ie]}],"drop-shadow":[{"drop-shadow":["","none",m,Mu,Tu]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Me,le,ie]}],"hue-rotate":[{"hue-rotate":[Me,le,ie]}],invert:[{invert:["",Me,le,ie]}],saturate:[{saturate:[Me,le,ie]}],sepia:[{sepia:["",Me,le,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",le,ie]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[Me,le,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Me,le,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Me,le,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Me,le,ie]}],"backdrop-invert":[{"backdrop-invert":["",Me,le,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Me,le,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Me,le,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Me,le,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Me,"initial",le,ie]}],ease:[{ease:["linear","initial",y,le,ie]}],delay:[{delay:[Me,le,ie]}],animate:[{animate:["none",h,le,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,le,ie]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:Te()}],"skew-x":[{"skew-x":Te()}],"skew-y":[{"skew-y":Te()}],transform:[{transform:[le,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"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",le,ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",le,ie]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Me,Ss,Io,Ex]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var qx=jT(iM);function Y(...e){return qx(Eu(e))}var Gx=K(Be(),1),cM=Nu("inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium tracking-wide",{variants:{variant:{default:"border-border bg-secondary text-secondary-foreground",success:"border-emerald-200 bg-emerald-50 text-emerald-700",warning:"border-amber-200 bg-amber-50 text-amber-700",danger:"border-rose-200 bg-rose-50 text-rose-700",info:"border-sky-200 bg-sky-50 text-sky-700",outline:"border-border bg-background/70 text-muted-foreground"}},defaultVariants:{variant:"default"}});function Nt({className:e,variant:t,...n}){return(0,Gx.jsx)("span",{className:Y(cM({variant:t}),e),...n})}var Yx=K(Be(),1),uM=Nu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium uppercase tracking-[0.16em] transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/92",outline:"border border-border bg-background/80 text-foreground hover:bg-accent hover:text-accent-foreground",ghost:"text-muted-foreground hover:bg-accent hover:text-accent-foreground",danger:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/92"},size:{default:"h-9 px-3.5",sm:"h-8 px-3 text-xs",lg:"h-10 px-4"}},defaultVariants:{variant:"default",size:"default"}});function ce({className:e,variant:t,size:n,type:r="button",...a}){return(0,Yx.jsx)("button",{className:Y(uM({variant:t,size:n}),e),type:r,...a})}var tl=K(Be(),1);function Xn({className:e,...t}){return(0,tl.jsx)("section",{className:Y("rounded-2xl border border-border/70 bg-card/92 shadow-sm backdrop-blur",e),...t})}function jo({className:e,...t}){return(0,tl.jsx)("div",{className:Y("flex flex-col gap-1.5 p-5 pb-0",e),...t})}function el({className:e,...t}){return(0,tl.jsx)("h2",{className:Y("text-sm font-semibold tracking-tight text-foreground",e),...t})}function ws({className:e,...t}){return(0,tl.jsx)("p",{className:Y("text-sm text-muted-foreground",e),...t})}function Zn({className:e,...t}){return(0,tl.jsx)("div",{className:Y("p-5",e),...t})}var Wx=K(xe(),1);var Qx=K(Be(),1),Kt=(0,Wx.forwardRef)(function({className:t,...n},r){return(0,Qx.jsx)("input",{ref:r,className:Y("flex h-9 w-full rounded-lg border border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40",t),...n})});var mr=K(xe(),1);var JL=!!(typeof window<"u"&&window.document&&window.document.createElement);function Pe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}var Zx=K(xe(),1);function Xx(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ip(...e){return t=>{let n=!1,r=e.map(a=>{let o=Xx(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a<r.length;a++){let o=r[a];typeof o=="function"?o():Xx(e[a],null)}}}}function Xe(...e){return Zx.useCallback(Ip(...e),e)}var ma=K(xe(),1),Jx=K(Be(),1);function Jn(e,t=[]){let n=[];function r(o,i){let s=ma.createContext(i),c=n.length;n=[...n,i];let u=d=>{let{scope:p,children:m,...b}=d,g=p?.[e]?.[c]||s,x=ma.useMemo(()=>b,Object.values(b));return(0,Jx.jsx)(g.Provider,{value:x,children:m})};u.displayName=o+"Provider";function f(d,p){let m=p?.[e]?.[c]||s,b=ma.useContext(m);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[u,f]}let a=()=>{let o=n.map(i=>ma.createContext(i));return function(s){let c=s?.[e]||o;return ma.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return a.scopeName=e,[r,dM(a,...t)]}function dM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){let i=r.reduce((s,{useScope:c,scopeName:u})=>{let d=c(o)[`__scope${u}`];return{...s,...d}},{});return ma.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var er=K(xe(),1);var eS=K(xe(),1),xt=globalThis?.document?eS.useLayoutEffect:()=>{};var _u=K(xe(),1);var fM=er[" useInsertionEffect ".trim().toString()]||xt;function pa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[a,o,i]=mM({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:a;{let f=er.useRef(e!==void 0);er.useEffect(()=>{let d=f.current;d!==s&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}let u=er.useCallback(f=>{if(s){let d=pM(f)?f(e):f;d!==e&&i.current?.(d)}else o(f)},[s,e,o,i]);return[c,u]}function mM({defaultProp:e,onChange:t}){let[n,r]=er.useState(e),a=er.useRef(n),o=er.useRef(t);return fM(()=>{o.current=t},[t]),er.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function pM(e){return typeof e=="function"}var ku=K(xe(),1);function Lu(e){let t=ku.useRef({value:e,previous:e});return ku.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tS=K(xe(),1);function Du(e){let[t,n]=tS.useState(void 0);return xt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;let o=a[0],i,s;if("borderBoxSize"in o){let c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,s=u.blockSize}else i=e.offsetWidth,s=e.offsetHeight;n({width:i,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var nS=K(xe(),1),rS=K(ho(),1);var jt=K(xe(),1);var zu=K(Be(),1);function Po(e){let t=gM(e),n=jt.forwardRef((r,a)=>{let{children:o,...i}=r,s=jt.Children.toArray(o),c=s.find(yM);if(c){let u=c.props.children,f=s.map(d=>d===c?jt.Children.count(u)>1?jt.Children.only(null):jt.isValidElement(u)?u.props.children:null:d);return(0,zu.jsx)(t,{...i,ref:a,children:jt.isValidElement(u)?jt.cloneElement(u,void 0,f):null})}return(0,zu.jsx)(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function gM(e){let t=jt.forwardRef((n,r)=>{let{children:a,...o}=n;if(jt.isValidElement(a)){let i=bM(a),s=vM(o,a.props);return a.type!==jt.Fragment&&(s.ref=r?Ip(r,i):i),jt.cloneElement(a,s)}return jt.Children.count(a)>1?jt.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hM=Symbol("radix.slottable");function yM(e){return jt.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hM}function vM(e,t){let n={...t};for(let r in t){let a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...s)=>{let c=o(...s);return a(...s),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function bM(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aS=K(Be(),1),xM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=xM.reduce((e,t)=>{let n=Po(`Primitive.${t}`),r=nS.forwardRef((a,o)=>{let{asChild:i,...s}=a,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,aS.jsx)(c,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function oS(e,t){e&&rS.flushSync(()=>e.dispatchEvent(t))}var Vo=K(Be(),1),Bu="Switch",[SM,xD]=Jn(Bu),[wM,AM]=SM(Bu),iS=mr.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:i,disabled:s,value:c="on",onCheckedChange:u,form:f,...d}=e,[p,m]=mr.useState(null),b=Xe(t,v=>m(v)),g=mr.useRef(!1),x=p?f||!!p.closest("form"):!0,[y,h]=pa({prop:a,defaultProp:o??!1,onChange:u,caller:Bu});return(0,Vo.jsxs)(wM,{scope:n,checked:y,disabled:s,children:[(0,Vo.jsx)(Oe.button,{type:"button",role:"switch","aria-checked":y,"aria-required":i,"data-state":uS(y),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:b,onClick:Pe(e.onClick,v=>{h(S=>!S),x&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})}),x&&(0,Vo.jsx)(cS,{control:p,bubbles:!g.current,name:r,value:c,checked:y,required:i,disabled:s,form:f,style:{transform:"translateX(-100%)"}})]})});iS.displayName=Bu;var lS="SwitchThumb",sS=mr.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,a=AM(lS,n);return(0,Vo.jsx)(Oe.span,{"data-state":uS(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});sS.displayName=lS;var CM="SwitchBubbleInput",cS=mr.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},o)=>{let i=mr.useRef(null),s=Xe(i,o),c=Lu(n),u=Du(t);return mr.useEffect(()=>{let f=i.current;if(!f)return;let d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==n&&m){let b=new Event("click",{bubbles:r});m.call(f,n),f.dispatchEvent(b)}},[c,n,r]),(0,Vo.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:s,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});cS.displayName=CM;function uS(e){return e?"checked":"unchecked"}var dS=iS,fS=sS;var Up=K(Be(),1);function mS({className:e,...t}){return(0,Up.jsx)(dS,{className:Y("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-muted transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-secondary",e),...t,children:(0,Up.jsx)(fS,{className:"pointer-events-none block size-4 rounded-full bg-background shadow-sm transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5"})})}var ha=K(xe(),1);var Ft=K(xe(),1);var to=K(xe(),1);var Iu=K(Be(),1),EM=K(xe(),1);var NM=K(Be(),1);function Uu(e){let t=e+"CollectionProvider",[n,r]=Jn(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{let{scope:x,children:y}=g,h=to.default.useRef(null),v=to.default.useRef(new Map).current;return(0,Iu.jsx)(a,{scope:x,itemMap:v,collectionRef:h,children:y})};i.displayName=t;let s=e+"CollectionSlot",c=Po(s),u=to.default.forwardRef((g,x)=>{let{scope:y,children:h}=g,v=o(s,y),S=Xe(x,v.collectionRef);return(0,Iu.jsx)(c,{ref:S,children:h})});u.displayName=s;let f=e+"CollectionItemSlot",d="data-radix-collection-item",p=Po(f),m=to.default.forwardRef((g,x)=>{let{scope:y,children:h,...v}=g,S=to.default.useRef(null),C=Xe(x,S),N=o(f,y);return to.default.useEffect(()=>(N.itemMap.set(S,{ref:S,...v}),()=>{N.itemMap.delete(S)})),(0,Iu.jsx)(p,{[d]:"",ref:C,children:h})});m.displayName=f;function b(g){let x=o(e+"CollectionConsumer",g);return to.default.useCallback(()=>{let h=x.collectionRef.current;if(!h)return[];let v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((N,w)=>v.indexOf(N.ref.current)-v.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:m},b,r]}var jp=K(xe(),1);var TM=jp[" useId ".trim().toString()]||(()=>{}),MM=0;function no(e){let[t,n]=jp.useState(TM());return xt(()=>{e||n(r=>r??String(MM++))},[e]),e||(t?`radix-${t}`:"")}var nl=K(xe(),1);function bn(e){let t=nl.useRef(e);return nl.useEffect(()=>{t.current=e}),nl.useMemo(()=>(...n)=>t.current?.(...n),[])}var ju=K(xe(),1),OM=K(Be(),1),_M=ju.createContext(void 0);function rl(e){let t=ju.useContext(_M);return e||t||"ltr"}var ro=K(Be(),1),Pp="rovingFocusGroup.onEntryFocus",kM={bubbles:!1,cancelable:!0},As="RovingFocusGroup",[Vp,pS,LM]=Uu(As),[DM,Hp]=Jn(As,[LM]),[zM,BM]=DM(As),gS=Ft.forwardRef((e,t)=>(0,ro.jsx)(Vp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,ro.jsx)(Vp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,ro.jsx)(IM,{...e,ref:t})})}));gS.displayName=As;var IM=Ft.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,p=Ft.useRef(null),m=Xe(t,p),b=rl(o),[g,x]=pa({prop:i,defaultProp:s??null,onChange:c,caller:As}),[y,h]=Ft.useState(!1),v=bn(u),S=pS(n),C=Ft.useRef(!1),[N,w]=Ft.useState(0);return Ft.useEffect(()=>{let R=p.current;if(R)return R.addEventListener(Pp,v),()=>R.removeEventListener(Pp,v)},[v]),(0,ro.jsx)(zM,{scope:n,orientation:r,dir:b,loop:a,currentTabStopId:g,onItemFocus:Ft.useCallback(R=>x(R),[x]),onItemShiftTab:Ft.useCallback(()=>h(!0),[]),onFocusableItemAdd:Ft.useCallback(()=>w(R=>R+1),[]),onFocusableItemRemove:Ft.useCallback(()=>w(R=>R-1),[]),children:(0,ro.jsx)(Oe.div,{tabIndex:y||N===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{C.current=!0}),onFocus:Pe(e.onFocus,R=>{let M=!C.current;if(R.target===R.currentTarget&&M&&!y){let k=new CustomEvent(Pp,kM);if(R.currentTarget.dispatchEvent(k),!k.defaultPrevented){let I=S().filter(z=>z.focusable),H=I.find(z=>z.active),Q=I.find(z=>z.id===g),X=[H,Q,...I].filter(Boolean).map(z=>z.ref.current);vS(X,f)}}C.current=!1}),onBlur:Pe(e.onBlur,()=>h(!1))})})}),hS="RovingFocusGroupItem",yS=Ft.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:o,children:i,...s}=e,c=no(),u=o||c,f=BM(hS,n),d=f.currentTabStopId===u,p=pS(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:g}=f;return Ft.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),(0,ro.jsx)(Vp.ItemSlot,{scope:n,id:u,focusable:r,active:a,children:(0,ro.jsx)(Oe.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:Pe(e.onMouseDown,x=>{r?f.onItemFocus(u):x.preventDefault()}),onFocus:Pe(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:Pe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;let y=PM(x,f.orientation,f.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let v=p().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")v.reverse();else if(y==="prev"||y==="next"){y==="prev"&&v.reverse();let S=v.indexOf(x.currentTarget);v=f.loop?VM(v,S+1):v.slice(S+1)}setTimeout(()=>vS(v))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:g!=null}):i})})});yS.displayName=hS;var UM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function PM(e,t,n){let r=jM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return UM[r]}function vS(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function VM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bS=gS,xS=yS;var xn=K(xe(),1);var SS=K(xe(),1);function qM(e,t){return SS.useReducer((n,r)=>t[n][r]??n,e)}var qp=e=>{let{present:t,children:n}=e,r=$M(t),a=typeof n=="function"?n({present:r.isPresent}):xn.Children.only(n),o=Xe(r.ref,KM(a));return typeof n=="function"||r.isPresent?xn.cloneElement(a,{ref:o}):null};qp.displayName="Presence";function $M(e){let[t,n]=xn.useState(),r=xn.useRef(null),a=xn.useRef(e),o=xn.useRef("none"),i=e?"mounted":"unmounted",[s,c]=qM(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return xn.useEffect(()=>{let u=Pu(r.current);o.current=s==="mounted"?u:"none"},[s]),xt(()=>{let u=r.current,f=a.current;if(f!==e){let p=o.current,m=Pu(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),xt(()=>{if(t){let u,f=t.ownerDocument.defaultView??window,d=m=>{let g=Pu(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(c("ANIMATION_END"),!a.current)){let x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=m=>{m.target===t&&(o.current=Pu(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:xn.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Pu(e){return e?.animationName||"none"}function KM(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ga=K(Be(),1),Vu="Tabs",[FM,t5]=Jn(Vu,[Hp]),wS=Hp(),[GM,$p]=FM(Vu),AS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:i="horizontal",dir:s,activationMode:c="automatic",...u}=e,f=rl(s),[d,p]=pa({prop:r,onChange:a,defaultProp:o??"",caller:Vu});return(0,ga.jsx)(GM,{scope:n,baseId:no(),value:d,onValueChange:p,orientation:i,dir:f,activationMode:c,children:(0,ga.jsx)(Oe.div,{dir:f,"data-orientation":i,...u,ref:t})})});AS.displayName=Vu;var CS="TabsList",RS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...a}=e,o=$p(CS,n),i=wS(n);return(0,ga.jsx)(bS,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:(0,ga.jsx)(Oe.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});RS.displayName=CS;var ES="TabsTrigger",NS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...o}=e,i=$p(ES,n),s=wS(n),c=OS(i.baseId,r),u=_S(i.baseId,r),f=r===i.value;return(0,ga.jsx)(xS,{asChild:!0,...s,focusable:!a,active:f,children:(0,ga.jsx)(Oe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...o,ref:t,onMouseDown:Pe(e.onMouseDown,d=>{!a&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:Pe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:Pe(e.onFocus,()=>{let d=i.activationMode!=="manual";!f&&!a&&d&&i.onValueChange(r)})})})});NS.displayName=ES;var TS="TabsContent",MS=ha.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:a,children:o,...i}=e,s=$p(TS,n),c=OS(s.baseId,r),u=_S(s.baseId,r),f=r===s.value,d=ha.useRef(f);return ha.useEffect(()=>{let p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),(0,ga.jsx)(qp,{present:a||f,children:({present:p})=>(0,ga.jsx)(Oe.div,{"data-state":f?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});MS.displayName=TS;function OS(e,t){return`${e}-trigger-${t}`}function _S(e,t){return`${e}-content-${t}`}var kS=AS,LS=RS,DS=NS,zS=MS;var Cs=K(Be(),1);function Hu(e){return(0,Cs.jsx)(kS,{...e})}function qu({className:e,...t}){return(0,Cs.jsx)(LS,{className:Y("inline-flex h-9 items-center gap-1 rounded-xl border border-border/70 bg-secondary/70 p-1",e),...t})}function Or({className:e,...t}){return(0,Cs.jsx)(DS,{className:Y("inline-flex h-7 items-center justify-center rounded-lg px-3 text-sm text-muted-foreground transition data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t})}function _r({className:e,...t}){return(0,Cs.jsx)(zS,{className:Y("mt-4 outline-none",e),...t})}var WM=K(Be(),1);var Ue=K(xe(),1);var J=K(xe(),1),Lg=K(ho(),1);function Kp(e,[t,n]){return Math.min(n,Math.max(t,e))}var St=K(xe(),1);var BS=K(xe(),1);function IS(e,t=globalThis?.document){let n=bn(e);BS.useEffect(()=>{let r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Gp=K(Be(),1),QM="DismissableLayer",Fp="dismissableLayer.update",XM="dismissableLayer.pointerDownOutside",ZM="dismissableLayer.focusOutside",US,PS=St.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yp=St.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:s,...c}=e,u=St.useContext(PS),[f,d]=St.useState(null),p=f?.ownerDocument??globalThis?.document,[,m]=St.useState({}),b=Xe(t,w=>d(w)),g=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(x),h=f?g.indexOf(f):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,S=h>=y,C=tO(w=>{let R=w.target,M=[...u.branches].some(k=>k.contains(R));!S||M||(a?.(w),i?.(w),w.defaultPrevented||s?.())},p),N=nO(w=>{let R=w.target;[...u.branches].some(k=>k.contains(R))||(o?.(w),i?.(w),w.defaultPrevented||s?.())},p);return IS(w=>{h===u.layers.size-1&&(r?.(w),!w.defaultPrevented&&s&&(w.preventDefault(),s()))},p),St.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(US=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),jS(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=US)}},[f,p,n,u]),St.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),jS())},[f,u]),St.useEffect(()=>{let w=()=>m({});return document.addEventListener(Fp,w),()=>document.removeEventListener(Fp,w)},[]),(0,Gp.jsx)(Oe.div,{...c,ref:b,style:{pointerEvents:v?S?"auto":"none":void 0,...e.style},onFocusCapture:Pe(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Pe(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Pe(e.onPointerDownCapture,C.onPointerDownCapture)})});Yp.displayName=QM;var JM="DismissableLayerBranch",eO=St.forwardRef((e,t)=>{let n=St.useContext(PS),r=St.useRef(null),a=Xe(t,r);return St.useEffect(()=>{let o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),(0,Gp.jsx)(Oe.div,{...e,ref:a})});eO.displayName=JM;function tO(e,t=globalThis?.document){let n=bn(e),r=St.useRef(!1),a=St.useRef(()=>{});return St.useEffect(()=>{let o=s=>{if(s.target&&!r.current){let u=function(){VS(XM,n,f,{discrete:!0})};var c=u;let f={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function nO(e,t=globalThis?.document){let n=bn(e),r=St.useRef(!1);return St.useEffect(()=>{let a=o=>{o.target&&!r.current&&VS(ZM,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function jS(){let e=new CustomEvent(Fp);document.dispatchEvent(e)}function VS(e,t,n,{discrete:r}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?oS(a,o):a.dispatchEvent(o)}var qS=K(xe(),1),Wp=0;function $S(){qS.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??HS()),document.body.insertAdjacentElement("beforeend",e[1]??HS()),Wp++,()=>{Wp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wp--}},[])}function HS(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var tr=K(xe(),1);var WS=K(Be(),1),Qp="focusScope.autoFocusOnMount",Xp="focusScope.autoFocusOnUnmount",KS={bubbles:!1,cancelable:!0},rO="FocusScope",Zp=tr.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[s,c]=tr.useState(null),u=bn(a),f=bn(o),d=tr.useRef(null),p=Xe(t,g=>c(g)),m=tr.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;tr.useEffect(()=>{if(r){let h=function(N){if(m.paused||!s)return;let w=N.target;s.contains(w)?d.current=w:ao(d.current,{select:!0})},v=function(N){if(m.paused||!s)return;let w=N.relatedTarget;w!==null&&(s.contains(w)||ao(d.current,{select:!0}))},S=function(N){if(document.activeElement===document.body)for(let R of N)R.removedNodes.length>0&&ao(s)};var g=h,x=v,y=S;document.addEventListener("focusin",h),document.addEventListener("focusout",v);let C=new MutationObserver(S);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),C.disconnect()}}},[r,s,m.paused]),tr.useEffect(()=>{if(s){GS.add(m);let g=document.activeElement;if(!s.contains(g)){let y=new CustomEvent(Qp,KS);s.addEventListener(Qp,u),s.dispatchEvent(y),y.defaultPrevented||(aO(cO(QS(s)),{select:!0}),document.activeElement===g&&ao(s))}return()=>{s.removeEventListener(Qp,u),setTimeout(()=>{let y=new CustomEvent(Xp,KS);s.addEventListener(Xp,f),s.dispatchEvent(y),y.defaultPrevented||ao(g??document.body,{select:!0}),s.removeEventListener(Xp,f),GS.remove(m)},0)}}},[s,u,f,m]);let b=tr.useCallback(g=>{if(!n&&!r||m.paused)return;let x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(x&&y){let h=g.currentTarget,[v,S]=oO(h);v&&S?!g.shiftKey&&y===S?(g.preventDefault(),n&&ao(v,{select:!0})):g.shiftKey&&y===v&&(g.preventDefault(),n&&ao(S,{select:!0})):y===h&&g.preventDefault()}},[n,r,m.paused]);return(0,WS.jsx)(Oe.div,{tabIndex:-1,...i,ref:p,onKeyDown:b})});Zp.displayName=rO;function aO(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ao(r,{select:t}),document.activeElement!==n)return}function oO(e){let t=QS(e),n=FS(t,e),r=FS(t.reverse(),e);return[n,r]}function QS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function FS(e,t){for(let n of e)if(!iO(n,{upTo:t}))return n}function iO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function lO(e){return e instanceof HTMLInputElement&&"select"in e}function ao(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&lO(e)&&t&&e.select()}}var GS=sO();function sO(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=YS(e,t),e.unshift(t)},remove(t){e=YS(e,t),e[0]?.resume()}}}function YS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function cO(e){return e.filter(t=>t.tagName!=="A")}var wn=K(xe(),1);var JS=["top","right","bottom","left"];var kr=Math.min,ln=Math.max,Es=Math.round,Ns=Math.floor,pr=e=>({x:e,y:e}),uO={left:"right",right:"left",bottom:"top",top:"bottom"};function Ku(e,t,n){return ln(e,kr(t,n))}function Lr(e,t){return typeof e=="function"?e(t):e}function Dr(e){return e.split("-")[0]}function Ho(e){return e.split("-")[1]}function Fu(e){return e==="x"?"y":"x"}function Gu(e){return e==="y"?"height":"width"}function gr(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Yu(e){return Fu(gr(e))}function ew(e,t,n){n===void 0&&(n=!1);let r=Ho(e),a=Yu(e),o=Gu(a),i=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Rs(i)),[i,Rs(i)]}function tw(e){let t=Rs(e);return[$u(e),t,$u(t)]}function $u(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var XS=["left","right"],ZS=["right","left"],dO=["top","bottom"],fO=["bottom","top"];function mO(e,t,n){switch(e){case"top":case"bottom":return n?t?ZS:XS:t?XS:ZS;case"left":case"right":return t?dO:fO;default:return[]}}function nw(e,t,n,r){let a=Ho(e),o=mO(Dr(e),n==="start",r);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map($u)))),o}function Rs(e){let t=Dr(e);return uO[t]+e.slice(t.length)}function pO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jp(e){return typeof e!="number"?pO(e):{top:e,right:e,bottom:e,left:e}}function qo(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function rw(e,t,n){let{reference:r,floating:a}=e,o=gr(t),i=Yu(t),s=Gu(i),c=Dr(t),u=o==="y",f=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,p=r[s]/2-a[s]/2,m;switch(c){case"top":m={x:f,y:r.y-a.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-a.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Ho(t)){case"start":m[i]-=p*(n&&u?-1:1);break;case"end":m[i]+=p*(n&&u?-1:1);break}return m}async function iw(e,t){var n;t===void 0&&(t={});let{x:r,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:m=0}=Lr(t,e),b=Jp(m),x=s[p?d==="floating"?"reference":"floating":d],y=qo(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:f,strategy:c})),h=d==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),S=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},C=qo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:h,offsetParent:v,strategy:c}):h);return{top:(y.top-C.top+b.top)/S.y,bottom:(C.bottom-y.bottom+b.bottom)/S.y,left:(y.left-C.left+b.left)/S.x,right:(C.right-y.right+b.right)/S.x}}var gO=50,lw=async(e,t,n)=>{let{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,s=i.detectOverflow?i:{...i,detectOverflow:iw},c=await(i.isRTL==null?void 0:i.isRTL(t)),u=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:d}=rw(u,r,c),p=r,m=0,b={};for(let g=0;g<o.length;g++){let x=o[g];if(!x)continue;let{name:y,fn:h}=x,{x:v,y:S,data:C,reset:N}=await h({x:f,y:d,initialPlacement:r,placement:p,strategy:a,middlewareData:b,rects:u,platform:s,elements:{reference:e,floating:t}});f=v??f,d=S??d,b[y]={...b[y],...C},N&&m<gO&&(m++,typeof N=="object"&&(N.placement&&(p=N.placement),N.rects&&(u=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):N.rects),{x:f,y:d}=rw(u,p,c)),g=-1)}return{x:f,y:d,placement:p,strategy:a,middlewareData:b}},sw=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:u,padding:f=0}=Lr(e,t)||{};if(u==null)return{};let d=Jp(f),p={x:n,y:r},m=Yu(a),b=Gu(m),g=await i.getDimensions(u),x=m==="y",y=x?"top":"left",h=x?"bottom":"right",v=x?"clientHeight":"clientWidth",S=o.reference[b]+o.reference[m]-p[m]-o.floating[b],C=p[m]-o.reference[m],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u)),w=N?N[v]:0;(!w||!await(i.isElement==null?void 0:i.isElement(N)))&&(w=s.floating[v]||o.floating[b]);let R=S/2-C/2,M=w/2-g[b]/2-1,k=kr(d[y],M),I=kr(d[h],M),H=k,Q=w-g[b]-I,ee=w/2-g[b]/2+R,X=Ku(H,ee,Q),z=!c.arrow&&Ho(a)!=null&&ee!==X&&o.reference[b]/2-(ee<H?k:I)-g[b]/2<0,te=z?ee<H?ee-H:ee-Q:0;return{[m]:p[m]+te,data:{[m]:X,centerOffset:ee-X-te,...z&&{alignmentOffset:te}},reset:z}}});var cw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;let{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...x}=Lr(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let y=Dr(a),h=gr(s),v=Dr(s)===s,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=p||(v||!g?[Rs(s)]:tw(s)),N=b!=="none";!p&&N&&C.push(...nw(s,g,b,S));let w=[s,...C],R=await c.detectOverflow(t,x),M=[],k=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&M.push(R[y]),d){let ee=ew(a,i,S);M.push(R[ee[0]],R[ee[1]])}if(k=[...k,{placement:a,overflows:M}],!M.every(ee=>ee<=0)){var I,H;let ee=(((I=o.flip)==null?void 0:I.index)||0)+1,X=w[ee];if(X&&(!(d==="alignment"?h!==gr(X):!1)||k.every(W=>gr(W.placement)===h?W.overflows[0]>0:!0)))return{data:{index:ee,overflows:k},reset:{placement:X}};let z=(H=k.filter(te=>te.overflows[0]<=0).sort((te,W)=>te.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(m){case"bestFit":{var Q;let te=(Q=k.filter(W=>{if(N){let q=gr(W.placement);return q===h||q==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(q=>q>0).reduce((q,V)=>q+V,0)]).sort((W,q)=>W[1]-q[1])[0])==null?void 0:Q[0];te&&(z=te);break}case"initialPlacement":z=s;break}if(a!==z)return{reset:{placement:z}}}return{}}}};function aw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ow(e){return JS.some(t=>e[t]>=0)}var uw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=Lr(e,t);switch(a){case"referenceHidden":{let i=await r.detectOverflow(t,{...o,elementContext:"reference"}),s=aw(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:ow(s)}}}case"escaped":{let i=await r.detectOverflow(t,{...o,altBoundary:!0}),s=aw(i,n.floating);return{data:{escapedOffsets:s,escaped:ow(s)}}}default:return{}}}}};var dw=new Set(["left","top"]);async function hO(e,t){let{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Dr(n),s=Ho(n),c=gr(n)==="y",u=dw.has(i)?-1:1,f=o&&c?-1:1,d=Lr(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof b=="number"&&(m=s==="end"?b*-1:b),c?{x:m*f,y:p*u}:{x:p*u,y:m*f}}var fw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:a,y:o,placement:i,middlewareData:s}=t,c=await hO(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},mw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:h,y:v}=y;return{x:h,y:v}}},...u}=Lr(e,t),f={x:n,y:r},d=await o.detectOverflow(t,u),p=gr(Dr(a)),m=Fu(p),b=f[m],g=f[p];if(i){let y=m==="y"?"top":"left",h=m==="y"?"bottom":"right",v=b+d[y],S=b-d[h];b=Ku(v,b,S)}if(s){let y=p==="y"?"top":"left",h=p==="y"?"bottom":"right",v=g+d[y],S=g-d[h];g=Ku(v,g,S)}let x=c.fn({...t,[m]:b,[p]:g});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[m]:i,[p]:s}}}}}},pw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:u=!0}=Lr(e,t),f={x:n,y:r},d=gr(a),p=Fu(d),m=f[p],b=f[d],g=Lr(s,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){let v=p==="y"?"height":"width",S=o.reference[p]-o.floating[v]+x.mainAxis,C=o.reference[p]+o.reference[v]-x.mainAxis;m<S?m=S:m>C&&(m=C)}if(u){var y,h;let v=p==="y"?"width":"height",S=dw.has(Dr(a)),C=o.reference[d]-o.floating[v]+(S&&((y=i.offset)==null?void 0:y[d])||0)+(S?0:x.crossAxis),N=o.reference[d]+o.reference[v]+(S?0:((h=i.offset)==null?void 0:h[d])||0)-(S?x.crossAxis:0);b<C?b=C:b>N&&(b=N)}return{[p]:m,[d]:b}}}},gw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;let{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...u}=Lr(e,t),f=await i.detectOverflow(t,u),d=Dr(a),p=Ho(a),m=gr(a)==="y",{width:b,height:g}=o.floating,x,y;d==="top"||d==="bottom"?(x=d,y=p===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,x=p==="end"?"top":"bottom");let h=g-f.top-f.bottom,v=b-f.left-f.right,S=kr(g-f[x],h),C=kr(b-f[y],v),N=!t.middlewareData.shift,w=S,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=h),N&&!p){let k=ln(f.left,0),I=ln(f.right,0),H=ln(f.top,0),Q=ln(f.bottom,0);m?R=b-2*(k!==0||I!==0?k+I:ln(f.left,f.right)):w=g-2*(H!==0||Q!==0?H+Q:ln(f.top,f.bottom))}await c({...t,availableWidth:R,availableHeight:w});let M=await i.getDimensions(s.floating);return b!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Wu(){return typeof window<"u"}function Fo(e){return yw(e)?(e.nodeName||"").toLowerCase():"#document"}function Sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hr(e){var t;return(t=(yw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yw(e){return Wu()?e instanceof Node||e instanceof Sn(e).Node:!1}function nr(e){return Wu()?e instanceof Element||e instanceof Sn(e).Element:!1}function zr(e){return Wu()?e instanceof HTMLElement||e instanceof Sn(e).HTMLElement:!1}function hw(e){return!Wu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function al(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=rr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function vw(e){return/^(table|td|th)$/.test(Fo(e))}function Ts(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var yO=/transform|translate|scale|rotate|perspective|filter/,vO=/paint|layout|strict|content/,$o=e=>!!e&&e!=="none",eg;function Qu(e){let t=nr(e)?rr(e):e;return $o(t.transform)||$o(t.translate)||$o(t.scale)||$o(t.rotate)||$o(t.perspective)||!Xu()&&($o(t.backdropFilter)||$o(t.filter))||yO.test(t.willChange||"")||vO.test(t.contain||"")}function bw(e){let t=ya(e);for(;zr(t)&&!Go(t);){if(Qu(t))return t;if(Ts(t))return null;t=ya(t)}return null}function Xu(){return eg==null&&(eg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),eg}function Go(e){return/^(html|body|#document)$/.test(Fo(e))}function rr(e){return Sn(e).getComputedStyle(e)}function Ms(e){return nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ya(e){if(Fo(e)==="html")return e;let t=e.assignedSlot||e.parentNode||hw(e)&&e.host||hr(e);return hw(t)?t.host:t}function xw(e){let t=ya(e);return Go(t)?e.ownerDocument?e.ownerDocument.body:e.body:zr(t)&&al(t)?t:xw(t)}function Ko(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let a=xw(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),i=Sn(a);if(o){let s=Zu(i);return t.concat(i,i.visualViewport||[],al(a)?a:[],s&&n?Ko(s):[])}else return t.concat(a,Ko(a,[],n))}function Zu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cw(e){let t=rr(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=zr(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,s=Es(n)!==o||Es(r)!==i;return s&&(n=o,r=i),{width:n,height:r,$:s}}function ng(e){return nr(e)?e:e.contextElement}function ol(e){let t=ng(e);if(!zr(t))return pr(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=Cw(t),i=(o?Es(n.width):n.width)/r,s=(o?Es(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var bO=pr(0);function Rw(e){let t=Sn(e);return!Xu()||!t.visualViewport?bO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sn(e)?!1:t}function Yo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=ng(e),i=pr(1);t&&(r?nr(r)&&(i=ol(r)):i=ol(e));let s=xO(o,n,r)?Rw(o):pr(0),c=(a.left+s.x)/i.x,u=(a.top+s.y)/i.y,f=a.width/i.x,d=a.height/i.y;if(o){let p=Sn(o),m=r&&nr(r)?Sn(r):r,b=p,g=Zu(b);for(;g&&r&&m!==b;){let x=ol(g),y=g.getBoundingClientRect(),h=rr(g),v=y.left+(g.clientLeft+parseFloat(h.paddingLeft))*x.x,S=y.top+(g.clientTop+parseFloat(h.paddingTop))*x.y;c*=x.x,u*=x.y,f*=x.x,d*=x.y,c+=v,u+=S,b=Sn(g),g=Zu(b)}}return qo({width:f,height:d,x:c,y:u})}function Ju(e,t){let n=Ms(e).scrollLeft;return t?t.left+n:Yo(hr(e)).left+n}function Ew(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ju(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function SO(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a==="fixed",i=hr(r),s=t?Ts(t.floating):!1;if(r===i||s&&o)return n;let c={scrollLeft:0,scrollTop:0},u=pr(1),f=pr(0),d=zr(r);if((d||!d&&!o)&&((Fo(r)!=="body"||al(i))&&(c=Ms(r)),d)){let m=Yo(r);u=ol(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}let p=i&&!d&&!o?Ew(i,c):pr(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+p.x,y:n.y*u.y-c.scrollTop*u.y+f.y+p.y}}function wO(e){return Array.from(e.getClientRects())}function AO(e){let t=hr(e),n=Ms(e),r=e.ownerDocument.body,a=ln(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ln(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),i=-n.scrollLeft+Ju(e),s=-n.scrollTop;return rr(r).direction==="rtl"&&(i+=ln(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:s}}var Sw=25;function CO(e,t){let n=Sn(e),r=hr(e),a=n.visualViewport,o=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;let f=Xu();(!f||f&&t==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}let u=Ju(r);if(u<=0){let f=r.ownerDocument,d=f.body,p=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(r.clientWidth-d.clientWidth-m);b<=Sw&&(o-=b)}else u<=Sw&&(o+=u);return{width:o,height:i,x:s,y:c}}function RO(e,t){let n=Yo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=zr(e)?ol(e):pr(1),i=e.clientWidth*o.x,s=e.clientHeight*o.y,c=a*o.x,u=r*o.y;return{width:i,height:s,x:c,y:u}}function ww(e,t,n){let r;if(t==="viewport")r=CO(e,n);else if(t==="document")r=AO(hr(e));else if(nr(t))r=RO(t,n);else{let a=Rw(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return qo(r)}function Nw(e,t){let n=ya(e);return n===t||!nr(n)||Go(n)?!1:rr(n).position==="fixed"||Nw(n,t)}function EO(e,t){let n=t.get(e);if(n)return n;let r=Ko(e,[],!1).filter(s=>nr(s)&&Fo(s)!=="body"),a=null,o=rr(e).position==="fixed",i=o?ya(e):e;for(;nr(i)&&!Go(i);){let s=rr(i),c=Qu(i);!c&&s.position==="fixed"&&(a=null),(o?!c&&!a:!c&&s.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||al(i)&&!c&&Nw(e,i))?r=r.filter(f=>f!==i):a=s,i=ya(i)}return t.set(e,r),r}function NO(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,i=[...n==="clippingAncestors"?Ts(t)?[]:EO(t,this._c):[].concat(n),r],s=ww(t,i[0],a),c=s.top,u=s.right,f=s.bottom,d=s.left;for(let p=1;p<i.length;p++){let m=ww(t,i[p],a);c=ln(m.top,c),u=kr(m.right,u),f=kr(m.bottom,f),d=ln(m.left,d)}return{width:u-d,height:f-c,x:d,y:c}}function TO(e){let{width:t,height:n}=Cw(e);return{width:t,height:n}}function MO(e,t,n){let r=zr(t),a=hr(t),o=n==="fixed",i=Yo(e,!0,o,t),s={scrollLeft:0,scrollTop:0},c=pr(0);function u(){c.x=Ju(a)}if(r||!r&&!o)if((Fo(t)!=="body"||al(a))&&(s=Ms(t)),r){let m=Yo(t,!0,o,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else a&&u();o&&!r&&a&&u();let f=a&&!r&&!o?Ew(a,s):pr(0),d=i.left+s.scrollLeft-c.x-f.x,p=i.top+s.scrollTop-c.y-f.y;return{x:d,y:p,width:i.width,height:i.height}}function tg(e){return rr(e).position==="static"}function Aw(e,t){if(!zr(e)||rr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return hr(e)===n&&(n=n.ownerDocument.body),n}function Tw(e,t){let n=Sn(e);if(Ts(e))return n;if(!zr(e)){let a=ya(e);for(;a&&!Go(a);){if(nr(a)&&!tg(a))return a;a=ya(a)}return n}let r=Aw(e,t);for(;r&&vw(r)&&tg(r);)r=Aw(r,t);return r&&Go(r)&&tg(r)&&!Qu(r)?n:r||bw(e)||n}var OO=async function(e){let t=this.getOffsetParent||Tw,n=this.getDimensions,r=await n(e.floating);return{reference:MO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _O(e){return rr(e).direction==="rtl"}var Mw={convertOffsetParentRelativeRectToViewportRelativeRect:SO,getDocumentElement:hr,getClippingRect:NO,getOffsetParent:Tw,getElementRects:OO,getClientRects:wO,getDimensions:TO,getScale:ol,isElement:nr,isRTL:_O};function Ow(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kO(e,t){let n=null,r,a=hr(e);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),o();let u=e.getBoundingClientRect(),{left:f,top:d,width:p,height:m}=u;if(s||t(),!p||!m)return;let b=Ns(d),g=Ns(a.clientWidth-(f+p)),x=Ns(a.clientHeight-(d+m)),y=Ns(f),v={rootMargin:-b+"px "+-g+"px "+-x+"px "+-y+"px",threshold:ln(0,kr(1,c))||1},S=!0;function C(N){let w=N[0].intersectionRatio;if(w!==c){if(!S)return i();w?i(!1,w):r=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!Ow(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...v,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return i(!0),o}function rg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ng(e),f=a||o?[...u?Ko(u):[],...t?Ko(t):[]]:[];f.forEach(y=>{a&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});let d=u&&s?kO(u,n):null,p=-1,m=null;i&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let b,g=c?Yo(e):null;c&&x();function x(){let y=Yo(e);g&&!Ow(g,y)&&n(),g=y,b=requestAnimationFrame(x)}return n(),()=>{var y;f.forEach(h=>{a&&h.removeEventListener("scroll",n),o&&h.removeEventListener("resize",n)}),d?.(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(b)}}var _w=fw;var kw=mw,Lw=cw,Dw=gw,zw=uw,ag=sw;var Bw=pw,og=(e,t,n)=>{let r=new Map,a={platform:Mw,...n},o={...a.platform,_c:r};return lw(e,t,{...a,platform:o})};var Dt=K(xe(),1),Uw=K(xe(),1),jw=K(ho(),1),LO=typeof document<"u",DO=function(){},ed=LO?Uw.useLayoutEffect:DO;function td(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,a;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(!td(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){let o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!td(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Pw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Iw(e,t){let n=Pw(e);return Math.round(t*n)/n}function ig(e){let t=Dt.useRef(e);return ed(()=>{t.current=e}),t}function Vw(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[f,d]=Dt.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=Dt.useState(r);td(p,r)||m(r);let[b,g]=Dt.useState(null),[x,y]=Dt.useState(null),h=Dt.useCallback(W=>{W!==N.current&&(N.current=W,g(W))},[]),v=Dt.useCallback(W=>{W!==w.current&&(w.current=W,y(W))},[]),S=o||b,C=i||x,N=Dt.useRef(null),w=Dt.useRef(null),R=Dt.useRef(f),M=c!=null,k=ig(c),I=ig(a),H=ig(u),Q=Dt.useCallback(()=>{if(!N.current||!w.current)return;let W={placement:t,strategy:n,middleware:p};I.current&&(W.platform=I.current),og(N.current,w.current,W).then(q=>{let V={...q,isPositioned:H.current!==!1};ee.current&&!td(R.current,V)&&(R.current=V,jw.flushSync(()=>{d(V)}))})},[p,t,n,I,H]);ed(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,d(W=>({...W,isPositioned:!1})))},[u]);let ee=Dt.useRef(!1);ed(()=>(ee.current=!0,()=>{ee.current=!1}),[]),ed(()=>{if(S&&(N.current=S),C&&(w.current=C),S&&C){if(k.current)return k.current(S,C,Q);Q()}},[S,C,Q,k,M]);let X=Dt.useMemo(()=>({reference:N,floating:w,setReference:h,setFloating:v}),[h,v]),z=Dt.useMemo(()=>({reference:S,floating:C}),[S,C]),te=Dt.useMemo(()=>{let W={position:n,left:0,top:0};if(!z.floating)return W;let q=Iw(z.floating,f.x),V=Iw(z.floating,f.y);return s?{...W,transform:"translate("+q+"px, "+V+"px)",...Pw(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:V}},[n,s,z.floating,f.x,f.y]);return Dt.useMemo(()=>({...f,update:Q,refs:X,elements:z,floatingStyles:te}),[f,Q,X,z,te])}var zO=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){let{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ag({element:r.current,padding:a}).fn(n):{}:r?ag({element:r,padding:a}).fn(n):{}}}},Hw=(e,t)=>{let n=_w(e);return{name:n.name,fn:n.fn,options:[e,t]}},qw=(e,t)=>{let n=kw(e);return{name:n.name,fn:n.fn,options:[e,t]}},$w=(e,t)=>({fn:Bw(e).fn,options:[e,t]}),Kw=(e,t)=>{let n=Lw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fw=(e,t)=>{let n=Dw(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Gw=(e,t)=>{let n=zw(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yw=(e,t)=>{let n=zO(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Ww=K(xe(),1);var lg=K(Be(),1),BO="Arrow",Qw=Ww.forwardRef((e,t)=>{let{children:n,width:r=10,height:a=5,...o}=e;return(0,lg.jsx)(Oe.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,lg.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Qw.displayName=BO;var Xw=Qw;var oo=K(Be(),1);var sg="Popper",[Zw,cg]=Jn(sg),[UO,Jw]=Zw(sg),eA=e=>{let{__scopePopper:t,children:n}=e,[r,a]=wn.useState(null);return(0,oo.jsx)(UO,{scope:t,anchor:r,onAnchorChange:a,children:n})};eA.displayName=sg;var tA="PopperAnchor",nA=wn.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=Jw(tA,n),i=wn.useRef(null),s=Xe(t,i),c=wn.useRef(null);return wn.useEffect(()=>{let u=c.current;c.current=r?.current||i.current,u!==c.current&&o.onAnchorChange(c.current)}),r?null:(0,oo.jsx)(Oe.div,{...a,ref:s})});nA.displayName=tA;var ug="PopperContent",[jO,PO]=Zw(ug),rA=wn.forwardRef((e,t)=>{let{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:b,...g}=e,x=Jw(ug,n),[y,h]=wn.useState(null),v=Xe(t,U=>h(U)),[S,C]=wn.useState(null),N=Du(S),w=N?.width??0,R=N?.height??0,M=r+(o!=="center"?"-"+o:""),k=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},I=Array.isArray(u)?u:[u],H=I.length>0,Q={padding:k,boundary:I.filter(HO),altBoundary:H},{refs:ee,floatingStyles:X,placement:z,isPositioned:te,middlewareData:W}=Vw({strategy:"fixed",placement:M,whileElementsMounted:(...U)=>rg(...U,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[Hw({mainAxis:a+R,alignmentAxis:i}),c&&qw({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?$w():void 0,...Q}),c&&Kw({...Q}),Fw({...Q,apply:({elements:U,rects:ne,availableWidth:ue,availableHeight:me})=>{let{width:re,height:oe}=ne.reference,Te=U.floating.style;Te.setProperty("--radix-popper-available-width",`${ue}px`),Te.setProperty("--radix-popper-available-height",`${me}px`),Te.setProperty("--radix-popper-anchor-width",`${re}px`),Te.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),S&&Yw({element:S,padding:s}),qO({arrowWidth:w,arrowHeight:R}),p&&Gw({strategy:"referenceHidden",...Q})]}),[q,V]=iA(z),_e=bn(b);xt(()=>{te&&_e?.()},[te,_e]);let F=W.arrow?.x,he=W.arrow?.y,Z=W.arrow?.centerOffset!==0,[ae,Se]=wn.useState();return xt(()=>{y&&Se(window.getComputedStyle(y).zIndex)},[y]),(0,oo.jsx)("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:te?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,oo.jsx)(jO,{scope:n,placedSide:q,onArrowChange:C,arrowX:F,arrowY:he,shouldHideArrow:Z,children:(0,oo.jsx)(Oe.div,{"data-side":q,"data-align":V,...g,ref:v,style:{...g.style,animation:te?void 0:"none"}})})})});rA.displayName=ug;var aA="PopperArrow",VO={top:"bottom",right:"left",bottom:"top",left:"right"},oA=wn.forwardRef(function(t,n){let{__scopePopper:r,...a}=t,o=PO(aA,r),i=VO[o.placedSide];return(0,oo.jsx)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:(0,oo.jsx)(Xw,{...a,ref:n,style:{...a.style,display:"block"}})})});oA.displayName=aA;function HO(e){return e!==null}var qO=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=iA(n),d={start:"0%",center:"50%",end:"100%"}[f],p=(a.arrow?.x??0)+s/2,m=(a.arrow?.y??0)+c/2,b="",g="";return u==="bottom"?(b=i?d:`${p}px`,g=`${-c}px`):u==="top"?(b=i?d:`${p}px`,g=`${r.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=i?d:`${m}px`):u==="left"&&(b=`${r.floating.width+c}px`,g=i?d:`${m}px`),{data:{x:b,y:g}}}});function iA(e){let[t,n="center"]=e.split("-");return[t,n]}var lA=eA,sA=nA,cA=rA,uA=oA;var nd=K(xe(),1),dA=K(ho(),1);var fA=K(Be(),1),KO="Portal",dg=nd.forwardRef((e,t)=>{let{container:n,...r}=e,[a,o]=nd.useState(!1);xt(()=>o(!0),[]);let i=n||a&&globalThis?.document?.body;return i?dA.default.createPortal((0,fA.jsx)(Oe.div,{...r,ref:t}),i):null});dg.displayName=KO;var mA=K(xe(),1);var pA=K(Be(),1),fg=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),FO="VisuallyHidden",GO=mA.forwardRef((e,t)=>(0,pA.jsx)(Oe.span,{...e,ref:t,style:{...fg,...e.style}}));GO.displayName=FO;var YO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},il=new WeakMap,rd=new WeakMap,ad={},mg=0,gA=function(e){return e&&(e.host||gA(e.parentNode))},WO=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=gA(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QO=function(e,t,n,r){var a=WO(t,Array.isArray(e)?e:[e]);ad[n]||(ad[n]=new WeakMap);var o=ad[n],i=[],s=new Set,c=new Set(a),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};a.forEach(u);var f=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(s.has(p))f(p);else try{var m=p.getAttribute(r),b=m!==null&&m!=="false",g=(il.get(p)||0)+1,x=(o.get(p)||0)+1;il.set(p,g),o.set(p,x),i.push(p),g===1&&b&&rd.set(p,!0),x===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return f(t),s.clear(),mg++,function(){i.forEach(function(d){var p=il.get(d)-1,m=o.get(d)-1;il.set(d,p),o.set(d,m),p||(rd.has(d)||d.removeAttribute(r),rd.delete(d)),m||d.removeAttribute(n)}),mg--,mg||(il=new WeakMap,il=new WeakMap,rd=new WeakMap,ad={})}},hA=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||YO(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),QO(r,a,n,"aria-hidden")):function(){return null}};var An=function(){return An=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},An.apply(this,arguments)};function od(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function yA(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var ud=K(xe());var nn=K(xe());var Wo="right-scroll-bar-position",Qo="width-before-scroll-bar",pg="with-scroll-bars-hidden",gg="--removed-body-scroll-bar-size";function id(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var vA=K(xe());function bA(e,t){var n=(0,vA.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var ld=K(xe());var XO=typeof window<"u"?ld.useLayoutEffect:ld.useEffect,xA=new WeakMap;function hg(e,t){var n=bA(t||null,function(r){return e.forEach(function(a){return id(a,r)})});return XO(function(){var r=xA.get(n);if(r){var a=new Set(r),o=new Set(e),i=n.current;a.forEach(function(s){o.has(s)||id(s,null)}),o.forEach(function(s){a.has(s)||id(s,i)})}xA.set(n,e)},[e]),n}function ZO(e){return e}function JO(e,t){t===void 0&&(t=ZO);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(s){return o(s)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(o),i=n}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return a}function yg(e){e===void 0&&(e={});var t=JO(null);return t.options=An({async:!0,ssr:!1},e),t}var SA=K(xe()),wA=function(e){var t=e.sideCar,n=od(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return SA.createElement(r,An({},n))};wA.isSideCarExport=!0;function vg(e,t){return e.useMedium(t),wA}var sd=yg();var bg=function(){},Os=nn.forwardRef(function(e,t){var n=nn.useRef(null),r=nn.useState({onScrollCapture:bg,onWheelCapture:bg,onTouchMoveCapture:bg}),a=r[0],o=r[1],i=e.forwardProps,s=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,p=e.sideCar,m=e.noRelative,b=e.noIsolation,g=e.inert,x=e.allowPinchZoom,y=e.as,h=y===void 0?"div":y,v=e.gapMode,S=od(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,N=hg([n,t]),w=An(An({},S),a);return nn.createElement(nn.Fragment,null,f&&nn.createElement(C,{sideCar:sd,removeScrollBar:u,shards:d,noRelative:m,noIsolation:b,inert:g,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:v}),i?nn.cloneElement(nn.Children.only(s),An(An({},w),{ref:N})):nn.createElement(h,An({},w,{className:c,ref:N}),s))});Os.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Os.classNames={fullWidth:Qo,zeroRight:Wo};var pt=K(xe());var sl=K(xe());var RA=K(xe());var AA;var CA=function(){if(AA)return AA;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function e_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=CA();return t&&e.setAttribute("nonce",t),e}function t_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function n_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=e_())&&(t_(t,n),n_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var Sg=function(){var e=xg();return function(t,n){RA.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};var _s=function(){var e=Sg(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t};var r_={left:0,top:0,right:0,gap:0},wg=function(e){return parseInt(e||"",10)||0},a_=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[wg(n),wg(r),wg(a)]},Ag=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return r_;var t=a_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}};var o_=_s(),ll="data-scroll-locked",i_=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),`
10
10
  .`.concat(pg,` {
11
11
  overflow: hidden `).concat(r,`;
12
12
  padding-right: `).concat(s,"px ").concat(r,`;
@@ -43,19 +43,19 @@ Error generating stack: `+r.message+`
43
43
  body[`).concat(ll,`] {
44
44
  `).concat(gg,": ").concat(s,`px;
45
45
  }
46
- `)},RA=function(){var e=parseInt(document.body.getAttribute(ll)||"0",10);return isFinite(e)?e:0},i_=function(){sl.useEffect(function(){return document.body.setAttribute(ll,(RA()+1).toString()),function(){var e=RA()-1;e<=0?document.body.removeAttribute(ll):document.body.setAttribute(ll,e.toString())}},[])},Cg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;i_();var o=sl.useMemo(function(){return Ag(a)},[a]);return sl.createElement(a_,{styles:o_(o,!t,a,n?"":"!important")})};var Rg=!1;if(typeof window<"u")try{_s=Object.defineProperty({},"passive",{get:function(){return Rg=!0,!0}}),window.addEventListener("test",_s,_s),window.removeEventListener("test",_s,_s)}catch{Rg=!1}var _s,Xo=Rg?{passive:!1}:!1;var l_=function(e){return e.tagName==="TEXTAREA"},EA=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!l_(e)&&n[t]==="visible")},s_=function(e){return EA(e,"overflowY")},c_=function(e){return EA(e,"overflowX")},Eg=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=TA(e,r);if(a){var o=NA(e,r),i=o[1],s=o[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},u_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},d_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},TA=function(e,t){return e==="v"?s_(t):c_(t)},NA=function(e,t){return e==="v"?u_(t):d_(t)},f_=function(e,t){return e==="h"&&t==="rtl"?-1:1},MA=function(e,t,n,r,a){var o=f_(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,c=t.contains(s),u=!1,f=i>0,d=0,p=0;do{if(!s)break;var m=NA(e,s),b=m[0],g=m[1],x=m[2],y=g-x-o*b;(b||y)&&TA(e,s)&&(d+=y,p+=b);var h=s.parentNode;s=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(f&&(a&&Math.abs(d)<1||!a&&i>d)||!f&&(a&&Math.abs(p)<1||!a&&-i>p))&&(u=!0),u};var sd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},OA=function(e){return[e.deltaX,e.deltaY]},_A=function(e){return e&&"current"in e?e.current:e},m_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},p_=function(e){return`
46
+ `)},EA=function(){var e=parseInt(document.body.getAttribute(ll)||"0",10);return isFinite(e)?e:0},l_=function(){sl.useEffect(function(){return document.body.setAttribute(ll,(EA()+1).toString()),function(){var e=EA()-1;e<=0?document.body.removeAttribute(ll):document.body.setAttribute(ll,e.toString())}},[])},Cg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;l_();var o=sl.useMemo(function(){return Ag(a)},[a]);return sl.createElement(o_,{styles:i_(o,!t,a,n?"":"!important")})};var Rg=!1;if(typeof window<"u")try{ks=Object.defineProperty({},"passive",{get:function(){return Rg=!0,!0}}),window.addEventListener("test",ks,ks),window.removeEventListener("test",ks,ks)}catch{Rg=!1}var ks,Xo=Rg?{passive:!1}:!1;var s_=function(e){return e.tagName==="TEXTAREA"},NA=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!s_(e)&&n[t]==="visible")},c_=function(e){return NA(e,"overflowY")},u_=function(e){return NA(e,"overflowX")},Eg=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=TA(e,r);if(a){var o=MA(e,r),i=o[1],s=o[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},d_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},f_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},TA=function(e,t){return e==="v"?c_(t):u_(t)},MA=function(e,t){return e==="v"?d_(t):f_(t)},m_=function(e,t){return e==="h"&&t==="rtl"?-1:1},OA=function(e,t,n,r,a){var o=m_(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,c=t.contains(s),u=!1,f=i>0,d=0,p=0;do{if(!s)break;var m=MA(e,s),b=m[0],g=m[1],x=m[2],y=g-x-o*b;(b||y)&&TA(e,s)&&(d+=y,p+=b);var h=s.parentNode;s=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(f&&(a&&Math.abs(d)<1||!a&&i>d)||!f&&(a&&Math.abs(p)<1||!a&&-i>p))&&(u=!0),u};var cd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_A=function(e){return[e.deltaX,e.deltaY]},kA=function(e){return e&&"current"in e?e.current:e},p_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},g_=function(e){return`
47
47
  .block-interactivity-`.concat(e,` {pointer-events: none;}
48
48
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
49
- `)},g_=0,cl=[];function kA(e){var t=pt.useRef([]),n=pt.useRef([0,0]),r=pt.useRef(),a=pt.useState(g_++)[0],o=pt.useState(Os)[0],i=pt.useRef(e);pt.useEffect(function(){i.current=e},[e]),pt.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=hA([e.lockRef.current],(e.shards||[]).map(_A),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=pt.useCallback(function(g,x){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var y=sd(g),h=n.current,v="deltaX"in g?g.deltaX:h[0]-y[0],S="deltaY"in g?g.deltaY:h[1]-y[1],C,T=g.target,w=Math.abs(v)>Math.abs(S)?"h":"v";if("touches"in g&&w==="h"&&T.type==="range")return!1;var R=window.getSelection(),M=R&&R.anchorNode,k=M?M===T||M.contains(T):!1;if(k)return!1;var I=Eg(w,T);if(!I)return!0;if(I?C=w:(C=w==="v"?"h":"v",I=Eg(w,T)),!I)return!1;if(!r.current&&"changedTouches"in g&&(v||S)&&(r.current=C),!C)return!0;var H=r.current||C;return MA(H,x,g,H==="h"?v:S,!0)},[]),c=pt.useCallback(function(g){var x=g;if(!(!cl.length||cl[cl.length-1]!==o)){var y="deltaY"in x?OA(x):sd(x),h=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&m_(C.delta,y)})[0];if(h&&h.should){x.cancelable&&x.preventDefault();return}if(!h){var v=(i.current.shards||[]).map(_A).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=v.length>0?s(x,v[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=pt.useCallback(function(g,x,y,h){var v={name:g,delta:x,target:y,should:h,shadowParent:h_(y)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(S){return S!==v})},1)},[]),f=pt.useCallback(function(g){n.current=sd(g),r.current=void 0},[]),d=pt.useCallback(function(g){u(g.type,OA(g),g.target,s(g,e.lockRef.current))},[]),p=pt.useCallback(function(g){u(g.type,sd(g),g.target,s(g,e.lockRef.current))},[]);pt.useEffect(function(){return cl.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Xo),document.addEventListener("touchmove",c,Xo),document.addEventListener("touchstart",f,Xo),function(){cl=cl.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,Xo),document.removeEventListener("touchmove",c,Xo),document.removeEventListener("touchstart",f,Xo)}},[]);var m=e.removeScrollBar,b=e.inert;return pt.createElement(pt.Fragment,null,b?pt.createElement(o,{styles:p_(a)}):null,m?pt.createElement(Cg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function h_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var LA=vg(ld,kA);var DA=cd.forwardRef(function(e,t){return cd.createElement(Ms,An({},e,{ref:t,sideCar:LA}))});DA.classNames=Ms.classNames;var Tg=DA;var pe=K(Be(),1),y_=[" ","Enter","ArrowUp","ArrowDown"],v_=[" ","Enter"],Zo="Select",[dd,fd,b_]=Iu(Zo),[ul,CB]=Jn(Zo,[b_,cg]),md=cg(),[x_,io]=ul(Zo),[S_,w_]=ul(Zo),zA=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:s,onValueChange:c,dir:u,name:f,autoComplete:d,disabled:p,required:m,form:b}=e,g=md(t),[x,y]=J.useState(null),[h,v]=J.useState(null),[S,C]=J.useState(!1),T=rl(u),[w,R]=pa({prop:r,defaultProp:a??!1,onChange:o,caller:Zo}),[M,k]=pa({prop:i,defaultProp:s,onChange:c,caller:Zo}),I=J.useRef(null),H=x?b||!!x.closest("form"):!0,[Q,ee]=J.useState(new Set),X=Array.from(Q).map(z=>z.props.value).join(";");return(0,pe.jsx)(iA,{...g,children:(0,pe.jsxs)(x_,{required:m,scope:t,trigger:x,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:no(),value:M,onValueChange:k,open:w,onOpenChange:R,dir:T,triggerPointerDownPosRef:I,disabled:p,children:[(0,pe.jsx)(dd.Provider,{scope:t,children:(0,pe.jsx)(S_,{scope:e.__scopeSelect,onNativeOptionAdd:J.useCallback(z=>{ee(te=>new Set(te).add(z))},[]),onNativeOptionRemove:J.useCallback(z=>{ee(te=>{let Y=new Set(te);return Y.delete(z),Y})},[]),children:n})}),H?(0,pe.jsxs)(r1,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:M,onChange:z=>k(z.target.value),disabled:p,form:b,children:[M===void 0?(0,pe.jsx)("option",{value:""}):null,Array.from(Q)]},X):null]})})};zA.displayName=Zo;var BA="SelectTrigger",IA=J.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=md(n),i=io(BA,n),s=i.disabled||r,c=Xe(t,i.onTriggerChange),u=fd(n),f=J.useRef("touch"),[d,p,m]=o1(g=>{let x=u().filter(v=>!v.disabled),y=x.find(v=>v.value===i.value),h=i1(x,g,y);h!==void 0&&i.onValueChange(h.value)}),b=g=>{s||(i.onOpenChange(!0),m()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return(0,pe.jsx)(lA,{asChild:!0,...o,children:(0,pe.jsx)(Oe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":a1(i.value)?"":void 0,...a,ref:c,onClick:Pe(a.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&b(g)}),onPointerDown:Pe(a.onPointerDown,g=>{f.current=g.pointerType;let x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(b(g),g.preventDefault())}),onKeyDown:Pe(a.onKeyDown,g=>{let x=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(x&&g.key===" ")&&y_.includes(g.key)&&(b(),g.preventDefault())})})})});IA.displayName=BA;var UA="SelectValue",jA=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...s}=e,c=io(UA,n),{onValueNodeHasChildrenChange:u}=c,f=o!==void 0,d=Xe(t,c.onValueNodeChange);return xt(()=>{u(f)},[u,f]),(0,pe.jsx)(Oe.span,{...s,ref:d,style:{pointerEvents:"none"},children:a1(c.value)?(0,pe.jsx)(pe.Fragment,{children:i}):o})});jA.displayName=UA;var A_="SelectIcon",PA=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...a}=e;return(0,pe.jsx)(Oe.span,{"aria-hidden":!0,...a,ref:t,children:r||"\u25BC"})});PA.displayName=A_;var C_="SelectPortal",VA=e=>(0,pe.jsx)(dg,{asChild:!0,...e});VA.displayName=C_;var Jo="SelectContent",HA=J.forwardRef((e,t)=>{let n=io(Jo,e.__scopeSelect),[r,a]=J.useState();if(xt(()=>{a(new DocumentFragment)},[]),!n.open){let o=r;return o?Lg.createPortal((0,pe.jsx)(qA,{scope:e.__scopeSelect,children:(0,pe.jsx)(dd.Slot,{scope:e.__scopeSelect,children:(0,pe.jsx)("div",{children:e.children})})}),o):null}return(0,pe.jsx)($A,{...e,ref:t})});HA.displayName=Jo;var yr=10,[qA,lo]=ul(Jo),R_="SelectContentImpl",E_=Po("SelectContent.RemoveScroll"),$A=J.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:s,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:b,hideWhenDetached:g,avoidCollisions:x,...y}=e,h=io(Jo,n),[v,S]=J.useState(null),[C,T]=J.useState(null),w=Xe(t,U=>S(U)),[R,M]=J.useState(null),[k,I]=J.useState(null),H=fd(n),[Q,ee]=J.useState(!1),X=J.useRef(!1);J.useEffect(()=>{if(v)return gA(v)},[v]),qS();let z=J.useCallback(U=>{let[ne,...ue]=H().map(oe=>oe.ref.current),[me]=ue.slice(-1),re=document.activeElement;for(let oe of U)if(oe===re||(oe?.scrollIntoView({block:"nearest"}),oe===ne&&C&&(C.scrollTop=0),oe===me&&C&&(C.scrollTop=C.scrollHeight),oe?.focus(),document.activeElement!==re))return},[H,C]),te=J.useCallback(()=>z([R,v]),[z,R,v]);J.useEffect(()=>{Q&&te()},[Q,te]);let{onOpenChange:Y,triggerPointerDownPosRef:q}=h;J.useEffect(()=>{if(v){let U={x:0,y:0},ne=me=>{U={x:Math.abs(Math.round(me.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(me.pageY)-(q.current?.y??0))}},ue=me=>{U.x<=10&&U.y<=10?me.preventDefault():v.contains(me.target)||Y(!1),document.removeEventListener("pointermove",ne),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",ue,{capture:!0})}}},[v,Y,q]),J.useEffect(()=>{let U=()=>Y(!1);return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[Y]);let[V,_e]=o1(U=>{let ne=H().filter(re=>!re.disabled),ue=ne.find(re=>re.ref.current===document.activeElement),me=i1(ne,U,ue);me&&setTimeout(()=>me.ref.current.focus())}),F=J.useCallback((U,ne,ue)=>{let me=!X.current&&!ue;(h.value!==void 0&&h.value===ne||me)&&(M(U),me&&(X.current=!0))},[h.value]),he=J.useCallback(()=>v?.focus(),[v]),Z=J.useCallback((U,ne,ue)=>{let me=!X.current&&!ue;(h.value!==void 0&&h.value===ne||me)&&I(U)},[h.value]),ae=r==="popper"?Ng:KA,Se=ae===Ng?{side:s,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:b,hideWhenDetached:g,avoidCollisions:x}:{};return(0,pe.jsx)(qA,{scope:n,content:v,viewport:C,onViewportChange:T,itemRefCallback:F,selectedItem:R,onItemLeave:he,itemTextRefCallback:Z,focusSelectedItem:te,selectedItemText:k,position:r,isPositioned:Q,searchRef:V,children:(0,pe.jsx)(Tg,{as:E_,allowPinchZoom:!0,children:(0,pe.jsx)(Zp,{asChild:!0,trapped:h.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:Pe(a,U=>{h.trigger?.focus({preventScroll:!0}),U.preventDefault()}),children:(0,pe.jsx)(Yp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:(0,pe.jsx)(ae,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:U=>U.preventDefault(),...y,...Se,onPlaced:()=>ee(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Pe(y.onKeyDown,U=>{let ne=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!ne&&U.key.length===1&&_e(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let me=H().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(U.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){let re=U.target,oe=me.indexOf(re);me=me.slice(oe+1)}setTimeout(()=>z(me)),U.preventDefault()}})})})})})})});$A.displayName=R_;var T_="SelectItemAlignedPosition",KA=J.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=io(Jo,n),i=lo(Jo,n),[s,c]=J.useState(null),[u,f]=J.useState(null),d=Xe(t,w=>f(w)),p=fd(n),m=J.useRef(!1),b=J.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:y,focusSelectedItem:h}=i,v=J.useCallback(()=>{if(o.trigger&&o.valueNode&&s&&u&&g&&x&&y){let w=o.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),M=o.valueNode.getBoundingClientRect(),k=y.getBoundingClientRect();if(o.dir!=="rtl"){let re=k.left-R.left,oe=M.left-re,Ne=w.left-oe,Re=w.width+Ne,Ze=Math.max(Re,R.width),gt=window.innerWidth-yr,Vt=Kp(oe,[yr,Math.max(yr,gt-Ze)]);s.style.minWidth=Re+"px",s.style.left=Vt+"px"}else{let re=R.right-k.right,oe=window.innerWidth-M.right-re,Ne=window.innerWidth-w.right-oe,Re=w.width+Ne,Ze=Math.max(Re,R.width),gt=window.innerWidth-yr,Vt=Kp(oe,[yr,Math.max(yr,gt-Ze)]);s.style.minWidth=Re+"px",s.style.right=Vt+"px"}let I=p(),H=window.innerHeight-yr*2,Q=g.scrollHeight,ee=window.getComputedStyle(u),X=parseInt(ee.borderTopWidth,10),z=parseInt(ee.paddingTop,10),te=parseInt(ee.borderBottomWidth,10),Y=parseInt(ee.paddingBottom,10),q=X+z+Q+Y+te,V=Math.min(x.offsetHeight*5,q),_e=window.getComputedStyle(g),F=parseInt(_e.paddingTop,10),he=parseInt(_e.paddingBottom,10),Z=w.top+w.height/2-yr,ae=H-Z,Se=x.offsetHeight/2,U=x.offsetTop+Se,ne=X+z+U,ue=q-ne;if(ne<=Z){let re=I.length>0&&x===I[I.length-1].ref.current;s.style.bottom="0px";let oe=u.clientHeight-g.offsetTop-g.offsetHeight,Ne=Math.max(ae,Se+(re?he:0)+oe+te),Re=ne+Ne;s.style.height=Re+"px"}else{let re=I.length>0&&x===I[0].ref.current;s.style.top="0px";let Ne=Math.max(Z,X+g.offsetTop+(re?F:0)+Se)+ue;s.style.height=Ne+"px",g.scrollTop=ne-Z+g.offsetTop}s.style.margin=`${yr}px 0`,s.style.minHeight=V+"px",s.style.maxHeight=H+"px",r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,s,u,g,x,y,o.dir,r]);xt(()=>v(),[v]);let[S,C]=J.useState();xt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);let T=J.useCallback(w=>{w&&b.current===!0&&(v(),h?.(),b.current=!1)},[v,h]);return(0,pe.jsx)(M_,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:(0,pe.jsx)("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,pe.jsx)(Oe.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});KA.displayName=T_;var N_="SelectPopperPosition",Ng=J.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:a=yr,...o}=e,i=md(n);return(0,pe.jsx)(sA,{...i,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ng.displayName=N_;var[M_,Dg]=ul(Jo,{}),Mg="SelectViewport",FA=J.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=lo(Mg,n),i=Dg(Mg,n),s=Xe(t,o.onViewportChange),c=J.useRef(0);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,pe.jsx)(dd.Slot,{scope:n,children:(0,pe.jsx)(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Pe(a.onScroll,u=>{let f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=i;if(p?.current&&d){let m=Math.abs(c.current-f.scrollTop);if(m>0){let b=window.innerHeight-yr*2,g=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),y=Math.max(g,x);if(y<b){let h=y+m,v=Math.min(b,h),S=h-v;d.style.height=v+"px",d.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});FA.displayName=Mg;var GA="SelectGroup",[O_,__]=ul(GA),YA=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=no();return(0,pe.jsx)(O_,{scope:n,id:a,children:(0,pe.jsx)(Oe.div,{role:"group","aria-labelledby":a,...r,ref:t})})});YA.displayName=GA;var WA="SelectLabel",QA=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=__(WA,n);return(0,pe.jsx)(Oe.div,{id:a.id,...r,ref:t})});QA.displayName=WA;var ud="SelectItem",[k_,XA]=ul(ud),ZA=J.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,s=io(ud,n),c=lo(ud,n),u=s.value===r,[f,d]=J.useState(o??""),[p,m]=J.useState(!1),b=Xe(t,h=>c.itemRefCallback?.(h,r,a)),g=no(),x=J.useRef("touch"),y=()=>{a||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,pe.jsx)(k_,{scope:n,value:r,disabled:a,textId:g,isSelected:u,onItemTextChange:J.useCallback(h=>{d(v=>v||(h?.textContent??"").trim())},[]),children:(0,pe.jsx)(dd.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,pe.jsx)(Oe.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:b,onFocus:Pe(i.onFocus,()=>m(!0)),onBlur:Pe(i.onBlur,()=>m(!1)),onClick:Pe(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:Pe(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:Pe(i.onPointerDown,h=>{x.current=h.pointerType}),onPointerMove:Pe(i.onPointerMove,h=>{x.current=h.pointerType,a?c.onItemLeave?.():x.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pe(i.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Pe(i.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(v_.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});ZA.displayName=ud;var ks="SelectItemText",JA=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,i=io(ks,n),s=lo(ks,n),c=XA(ks,n),u=w_(ks,n),[f,d]=J.useState(null),p=Xe(t,y=>d(y),c.onItemTextChange,y=>s.itemTextRefCallback?.(y,c.value,c.disabled)),m=f?.textContent,b=J.useMemo(()=>(0,pe.jsx)("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=u;return xt(()=>(g(b),()=>x(b)),[g,x,b]),(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(Oe.span,{id:c.textId,...o,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Lg.createPortal(o.children,i.valueNode):null]})});JA.displayName=ks;var e1="SelectItemIndicator",t1=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return XA(e1,n).isSelected?(0,pe.jsx)(Oe.span,{"aria-hidden":!0,...r,ref:t}):null});t1.displayName=e1;var Og="SelectScrollUpButton",L_=J.forwardRef((e,t)=>{let n=lo(Og,e.__scopeSelect),r=Dg(Og,e.__scopeSelect),[a,o]=J.useState(!1),i=Xe(t,r.onScrollButtonChange);return xt(()=>{if(n.viewport&&n.isPositioned){let c=function(){let f=u.scrollTop>0;o(f)};var s=c;let u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?(0,pe.jsx)(n1,{...e,ref:i,onAutoScroll:()=>{let{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});L_.displayName=Og;var _g="SelectScrollDownButton",D_=J.forwardRef((e,t)=>{let n=lo(_g,e.__scopeSelect),r=Dg(_g,e.__scopeSelect),[a,o]=J.useState(!1),i=Xe(t,r.onScrollButtonChange);return xt(()=>{if(n.viewport&&n.isPositioned){let c=function(){let f=u.scrollHeight-u.clientHeight,d=Math.ceil(u.scrollTop)<f;o(d)};var s=c;let u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?(0,pe.jsx)(n1,{...e,ref:i,onAutoScroll:()=>{let{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});D_.displayName=_g;var n1=J.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=lo("SelectScrollButton",n),i=J.useRef(null),s=fd(n),c=J.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return J.useEffect(()=>()=>c(),[c]),xt(()=>{s().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,pe.jsx)(Oe.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Pe(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Pe(a.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Pe(a.onPointerLeave,()=>{c()})})}),z_="SelectSeparator",B_=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,pe.jsx)(Oe.div,{"aria-hidden":!0,...r,ref:t})});B_.displayName=z_;var kg="SelectArrow",I_=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=md(n),o=io(kg,n),i=lo(kg,n);return o.open&&i.position==="popper"?(0,pe.jsx)(cA,{...a,...r,ref:t}):null});I_.displayName=kg;var U_="SelectBubbleInput",r1=J.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let a=J.useRef(null),o=Xe(r,a),i=ku(t);return J.useEffect(()=>{let s=a.current;if(!s)return;let c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){let d=new Event("change",{bubbles:!0});f.call(s,t),s.dispatchEvent(d)}},[i,t]),(0,pe.jsx)(Oe.select,{...n,style:{...fg,...n.style},ref:o,defaultValue:t})});r1.displayName=U_;function a1(e){return e===""||e===void 0}function o1(e){let t=bn(e),n=J.useRef(""),r=J.useRef(0),a=J.useCallback(i=>{let s=n.current+i;t(s),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(s)},[t]),o=J.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return J.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function i1(e,t,n){let a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1,i=j_(e,Math.max(o,0));a.length===1&&(i=i.filter(u=>u!==n));let c=i.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function j_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var l1=zA,s1=IA,c1=jA,u1=PA,d1=VA,f1=HA,m1=FA,p1=YA,g1=QA,h1=ZA,y1=JA,v1=t1;function b1(e){return String(e||"").trim().toLowerCase()}function pd(e){return b1(e).length>0}function x1({searchEnabled:e=!0}={}){return!!e}function zg(e){let t=String(e?.key||"");return!t||t.length!==1||e?.ctrlKey||e?.metaKey||e?.altKey?"":t.trim()?t:""}function S1(e={},t=""){let n=b1(t);return n?[e?.label,e?.value,e?.hint,e?.textValue,e?.searchText].map(a=>String(a||"").toLowerCase()).join(" ").includes(n):!0}var gd=K(xe(),1),V_=12;function Bg(e){return/auto|scroll|hidden|clip|overlay/.test(String(e||"").toLowerCase())}function H_(e,t){return{top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)}}function hd(e){if(typeof window>"u")return[];let t=[],n=e?.parentElement||null;for(;n&&n!==document.body&&n!==document.documentElement;){let r=window.getComputedStyle(n);(Bg(r.overflow)||Bg(r.overflowY)||Bg(r.overflowX))&&t.push(n),n=n.parentElement}return t}function q_(e,{viewportPadding:t=V_}={}){if(typeof window>"u")return null;let n={top:t,right:window.innerWidth-t,bottom:window.innerHeight-t,left:t};for(let r of hd(e))n=H_(n,r.getBoundingClientRect());return n}function $_({anchorRect:e,boundaryRect:t,preferredSide:n="bottom",offset:r=4,desiredHeight:a=288}={}){if(!e||!t)return{side:n==="top"?"top":"bottom",maxHeight:a};let o=Math.max(0,e.top-t.top-r),i=Math.max(0,t.bottom-e.bottom-r),c=o===i?n==="top"?"top":"bottom":o>i?"top":"bottom",u=Math.max(0,Math.min(a,c==="top"?o:i));return{side:c,maxHeight:u}}function yd({open:e=!1,anchorRef:t,preferredSide:n="bottom",offset:r=4,desiredHeight:a=288}={}){let[o,i]=(0,gd.useState)(()=>({side:n==="top"?"top":"bottom",maxHeight:a}));return(0,gd.useLayoutEffect)(()=>{if(!e||typeof window>"u")return;let s=t?.current||null;if(!s){i({side:n==="top"?"top":"bottom",maxHeight:a});return}let c=()=>{i($_({anchorRect:s.getBoundingClientRect(),boundaryRect:q_(s),preferredSide:n,offset:r,desiredHeight:a}))};c();let u=hd(s);window.addEventListener("resize",c);for(let d of u)d.addEventListener("scroll",c,{passive:!0});let f=null;if(typeof ResizeObserver=="function"){f=new ResizeObserver(c),f.observe(s);for(let d of u)f.observe(d)}return()=>{window.removeEventListener("resize",c);for(let d of u)d.removeEventListener("scroll",c);f?.disconnect?.()}},[e,t,n,r,a]),o}var Bt=K(Be(),1),bd=(0,Ue.createContext)(null),K_="Enter character to filter",F_=41,G_="data-llm-router-select-search-input";function vd(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(t=>vd(t)).filter(Boolean).join(" "):(0,Ue.isValidElement)(e)?vd(e.props?.children):""}function Ig(e,t="first"){let n=Array.from(e?.querySelectorAll?.("[role='option']")||[]).filter(o=>o.getAttribute("aria-disabled")!=="true");if(n.length===0)return;let r=n.find(o=>o.getAttribute("data-state")==="checked");(t==="last"?n[n.length-1]:r||n[0])?.focus?.()}function Y_(e={}){let t=String(e.textValue||vd(e.children)||"").trim();return{value:String(e.value||""),textValue:t,searchText:String(e.searchText||"")}}function w1(e,t=""){let n=0,r=0;return{children:Ue.Children.map(e,o=>{if(!(0,Ue.isValidElement)(o))return o;if(o.type?.__LLM_ROUTER_SELECT_ITEM===!0){n+=1;let s=S1(Y_(o.props),t);return s&&(r+=1),s?o:null}if(!o.props?.children)return o;let i=w1(o.props.children,t);return n+=i.totalItems,r+=i.matchedItems,o.type?.__LLM_ROUTER_SELECT_GROUP===!0&&i.matchedItems===0?null:(0,Ue.cloneElement)(o,void 0,i.children)}),totalItems:n,matchedItems:r}}function vr({open:e,defaultOpen:t=!1,onOpenChange:n,searchEnabled:r=!0,openSearchRequest:a=0,children:o,...i}){let[s,c]=(0,Ue.useState)(!!t),[u,f]=(0,Ue.useState)(""),[d,p]=(0,Ue.useState)(!1),m=(0,Ue.useRef)(null),b=(0,Ue.useRef)(0),g=e!==void 0?e:s;(0,Ue.useEffect)(()=>{g||(f(""),p(!1))},[g]);function x(h){e===void 0&&c(h),n?.(h),h||(f(""),p(!1))}(0,Ue.useEffect)(()=>{!a||a===b.current||(b.current=a,f(""),r&&p(!0),!g&&(e===void 0&&c(!0),n?.(!0)))},[a,r,g,e,n]);let y={open:g,searchEnabled:r,filterValue:u,setFilterValue:f,searchSessionActive:d,setSearchSessionActive:p,setOpen:x,triggerRef:m,openSearchRequest:a};return(0,Bt.jsx)(bd.Provider,{value:y,children:(0,Bt.jsx)(l1,{...i,open:g,onOpenChange:x,children:o})})}var br=(0,Ue.forwardRef)(function({className:t,children:n,onKeyDown:r,...a},o){let i=(0,Ue.useContext)(bd),s=i?.triggerRef||null,c=(0,Ue.useCallback)(f=>{if(s&&(s.current=f),typeof o=="function"){o(f);return}o&&(o.current=f)},[s,o]);function u(f){if(r?.(f),f.defaultPrevented||!i?.searchEnabled||a.disabled)return;let d=zg(f);d&&(f.preventDefault(),i.setSearchSessionActive?.(!0),i.setOpen(!0),i.setFilterValue(p=>`${p}${d}`))}return(0,Bt.jsxs)(s1,{ref:c,className:W("relative inline-flex h-9 w-full items-center gap-2 rounded-lg border border-input bg-background/80 pl-3 pr-9 text-sm text-foreground shadow-sm outline-none transition focus:border-ring focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",t),onKeyDown:u,...a,children:[(0,Bt.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",children:n}),(0,Bt.jsx)(u1,{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"\u25BE"})]})});function xr(e){return(0,Bt.jsx)(c1,{...e})}var Sr=(0,Ue.forwardRef)(function({className:t,children:n,position:r="popper",onKeyDownCapture:a,searchPlaceholder:o=K_,emptySearchMessage:i="No matching options.",...s},c){let u=(0,Ue.useContext)(bd),f=(0,Ue.useRef)(null),d=(0,Ue.useRef)(null),p=yd({open:!!u?.open,anchorRef:u?.triggerRef,preferredSide:"bottom",desiredHeight:288,offset:4}),m=x1({searchEnabled:u?.searchEnabled,filterValue:u?.filterValue,sessionActive:u?.searchSessionActive}),b=(0,Ue.useMemo)(()=>pd(u?.filterValue)?w1(n,u?.filterValue):{children:n,totalItems:0,matchedItems:0},[n,u?.filterValue]),g=pd(u?.filterValue)&&b.totalItems>0&&b.matchedItems===0,x=Math.max(0,Math.floor((p.maxHeight||288)-(m?F_:0)));(0,Ue.useEffect)(()=>{if(!u?.open||!m||typeof window>"u")return;let S=window.requestAnimationFrame(()=>{let C=d.current;if(!C)return;C.focus();let T=C.value.length;C.setSelectionRange(T,T)});return()=>window.cancelAnimationFrame(S)},[u?.open,m,u?.openSearchRequest]);let y=(0,Ue.useCallback)(S=>{if(f.current=S,typeof c=="function"){c(S);return}c&&(c.current=S)},[c]);function h(S){if(a?.(S),S.defaultPrevented||S.target===d.current||!u?.searchEnabled)return;let C=zg(S);C&&(S.preventDefault(),S.stopPropagation(),u.setSearchSessionActive?.(!0),u.setFilterValue(T=>`${T}${C}`))}function v(S){let C=S.target.value;u?.setSearchSessionActive?.(!0),u?.setFilterValue(C)}return(0,Bt.jsx)(d1,{children:(0,Bt.jsxs)(f1,{ref:y,position:r,side:r==="popper"?p.side:void 0,className:W("z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border/70 bg-popover text-popover-foreground shadow-lg",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",t),onKeyDownCapture:h,...s,children:[m?(0,Bt.jsx)("div",{className:"border-b border-border/70 p-1",children:(0,Bt.jsx)(Dt,{ref:d,"data-llm-router-select-search-input":"true",value:u?.filterValue||"",autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,placeholder:o,className:"h-8 border-border/70 bg-background/90",onChange:v,onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),onKeyDown:S=>{if(S.stopPropagation(),S.key==="ArrowDown"){S.preventDefault(),Ig(f.current,"first");return}if(S.key==="ArrowUp"){S.preventDefault(),Ig(f.current,"last");return}S.key==="Escape"&&(S.preventDefault(),u?.setSearchSessionActive?.(!1),u?.setFilterValue(""),typeof window<"u"&&window.requestAnimationFrame(()=>Ig(f.current)))}})}):null,(0,Bt.jsxs)(m1,{className:"px-1 pb-1",style:{maxHeight:`${x}px`},children:[pd(u?.filterValue)?b.children:n,g?(0,Bt.jsx)("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:i}):null]})]})})}),ar=(0,Ue.forwardRef)(function({className:t,children:n,searchText:r="",textValue:a,onPointerMove:o,...i},s){let c=(0,Ue.useContext)(bd),u=String(a||vd(n)||"").trim();function f(d){if(o?.(d),d.defaultPrevented||!c?.searchEnabled||typeof document>"u")return;let p=document.activeElement;p instanceof HTMLElement&&p.getAttribute(G_)==="true"&&d.preventDefault()}return(0,Bt.jsxs)(h1,{ref:s,className:W("relative flex w-full cursor-default select-none items-center rounded-lg py-2 pl-3 pr-8 text-sm text-foreground outline-none transition-colors hover:bg-accent/60 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),textValue:u,onPointerMove:f,...i,children:[(0,Bt.jsx)(y1,{children:n}),(0,Bt.jsx)("span",{className:"absolute right-2 inline-flex h-4 w-4 items-center justify-center text-xs text-muted-foreground",children:(0,Bt.jsx)(v1,{children:"\u2713"})})]})});ar.__LLM_ROUTER_SELECT_ITEM=!0;function Ug(e){return(0,Bt.jsx)(p1,{...e})}Ug.__LLM_ROUTER_SELECT_GROUP=!0;var A1=(0,Ue.forwardRef)(function({className:t,children:n,...r},a){return(0,Bt.jsx)(g1,{ref:a,className:W("-mt-1 sticky top-0 z-10 -mx-1 mb-1 block border-b border-border/55 bg-background/96 px-4 py-2 text-xs font-semibold uppercase tracking-[0.18em] text-foreground/80 backdrop-blur-sm",t),...r,children:n})});var or=K(xe(),1);var W_="flex h-9 w-full rounded-lg border border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40";function Q_({committedValue:e="",draftValue:t="",isFocused:n=!1,hasLocalDraft:r=!1,previousCommittedValue:a=""}={}){let o=String(e??""),i=String(t??""),s=String(a??"");return n?{draftValue:i,hasLocalDraft:r,previousCommittedValue:o}:!r||o===i?{draftValue:o,hasLocalDraft:!1,previousCommittedValue:o}:o!==s?{draftValue:o,hasLocalDraft:!1,previousCommittedValue:o}:{draftValue:i,hasLocalDraft:!0,previousCommittedValue:o}}function X_({committedValue:e="",draftValue:t="",isFocused:n=!1,hasLocalDraft:r=!1}={}){return String(n||r?t??"":e??"")}function Z_({commitOnBlur:e=!1,draftValue:t="",hasLocalDraft:n=!1}={}){return!e||!n?null:String(t??"")}var jg=(0,or.forwardRef)(function({className:t,commitOnBlur:n=!1,value:r,onValueCommit:a,onValueChange:o,onChange:i,onFocus:s,onBlur:c,...u},f){let d=String(r??""),[p,m]=(0,or.useState)(d),[b,g]=(0,or.useState)(!1),[x,y]=(0,or.useState)(!1),h=(0,or.useRef)(d);return(0,or.useEffect)(()=>{let v=Q_({committedValue:d,draftValue:p,isFocused:b,hasLocalDraft:x,previousCommittedValue:h.current});h.current=v.previousCommittedValue,m(v.draftValue),y(v.hasLocalDraft)},[d,p,x,b]),(0,or.createElement)("input",{...u,ref:f,className:W(W_,t),value:X_({committedValue:d,draftValue:p,isFocused:b,hasLocalDraft:x}),onFocus:v=>{g(!0),s?.(v)},onChange:v=>{let S=v.target.value;m(S),y(!0),o?.(S,v),i?.(v)},onBlur:v=>{g(!1);let S=Z_({commitOnBlur:n,draftValue:p,hasLocalDraft:x});S!==null&&a?.(S,v),c?.(v)}})});var Pg=Object.freeze(["gpt-5.3-codex","gpt-5.2-codex","gpt-5.1-codex-mini"]),Vg=Object.freeze(["claude-sonnet-4-6","claude-opus-4-6","claude-haiku-4-5"]),QB=Object.freeze({authorizeUrl:"https://auth.openai.com/oauth/authorize",tokenUrl:"https://auth.openai.com/oauth/token",deviceCodeUrl:"https://auth.openai.com/oauth/device/code",callbackPort:1455,callbackPath:"/auth/callback",scopes:"openid profile email offline_access",clientId:"app_EMoamEEZ73f0CkXaXp7hrann",authorizeParams:Object.freeze({id_token_add_organizations:"true",codex_cli_simplified_flow:"true",originator:"codex_cli_rs"}),tokenRefreshBufferMs:300*1e3}),XB=Object.freeze({authorizeUrl:"https://claude.ai/oauth/authorize",tokenUrl:"https://platform.claude.com/v1/oauth/token",callbackPort:1456,callbackPath:"/callback",manualRedirectUrl:"https://platform.claude.com/oauth/code/callback",scopes:"user:profile user:inference user:sessions:claude_code user:mcp_servers",clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",authorizeParams:Object.freeze({code:"true"}),oauthBeta:"oauth-2025-04-20",apiBaseUrl:"https://api.anthropic.com",messagesPath:"/v1/messages?beta=true",tokenRefreshBufferMs:300*1e3});var ek="127.0.0.1";var Ls=`http://${ek}:8376`,JB=`${Ls}/openai/v1`,e3=`${Ls}/anthropic`,t3=Object.freeze({enabled:!0});var at="default",tk="AICodeClient",nk="1.0.0",l3=ak();var s3=Object.freeze({CHATGPT_CODEX:"chatgpt-codex",CLAUDE_CODE:"claude-code"});function rk(){if(typeof process>"u"||!process)return{runtime:"runtime/unknown",platform:"unknown",arch:"unknown"};let e=process?.versions?.node?String(process.versions.node):"",t=e?`node/${e}`:"runtime/unknown",n=process?.platform?String(process.platform):"unknown",r=process?.arch?String(process.arch):"unknown";return{runtime:t,platform:n,arch:r}}function ak(){let{runtime:e,platform:t,arch:n}=rk();return`${tk}/${nk} (${t}; ${n}) ${e}`}var c3=Object.freeze(["brave","tavily","exa","searxng"]),u3=Object.freeze({brave:1e3,tavily:1e3,exa:1e3,searxng:0});var xd=Object.freeze([Object.freeze({id:"@anthropic-opus",description:"Anthropic Opus family used by AMP smart-like flows.",match:[{vendor:"anthropic",family:"opus",variantAbsent:!0}],defaultMatch:"claude-opus-{number}"}),Object.freeze({id:"@anthropic-sonnet",description:"Anthropic Sonnet family used by AMP librarian-like flows.",match:[{vendor:"anthropic",family:"sonnet",variantAbsent:!0}],defaultMatch:"claude-sonnet-{number}"}),Object.freeze({id:"@anthropic-haiku-shared",description:"Anthropic Haiku family shared by AMP rush/title-like flows.",match:[{vendor:"anthropic",family:"haiku",variantAbsent:!0}],defaultMatch:"claude-haiku-{number}"}),Object.freeze({id:"@openai-gpt-base",description:"Base GPT family currently observed for AMP Oracle-like flows.",match:[{vendor:"openai",family:"gpt",variantAbsent:!0}],defaultMatch:"gpt-{number}"}),Object.freeze({id:"@openai-gpt-codex",description:"OpenAI GPT Codex family used by AMP deep-like flows.",match:[{vendor:"openai",family:"gpt",variantPrefix:"codex"},"gpt-*-codex*"],defaultMatch:"gpt-*-codex*"}),Object.freeze({id:"@google-gemini-pro",description:"Google Gemini Pro family used by AMP review-like flows.",match:[{vendor:"google",family:"gemini",variant:"pro"},"gemini-*-pro*"],defaultMatch:"gemini-*-pro*"}),Object.freeze({id:"@google-gemini-pro-image",description:"Google Gemini image family used by AMP painter-like flows.",match:["gemini-3-pro-image","gemini-3-pro-image*","gemini-*-image*"],defaultMatch:"gemini-*-image*"}),Object.freeze({id:"@google-gemini-flash-shared",description:"Google Gemini Flash family shared by AMP search/look-at/handoff-like flows.",match:[{vendor:"google",family:"gemini",variantPrefix:"flash"},"gemini-*-flash*"],defaultMatch:"gemini-*-flash*"})]),Ds=Object.freeze([Object.freeze({id:"smart",type:"mode",description:"Unconstrained state-of-the-art model use",signatures:["@anthropic-opus"]}),Object.freeze({id:"rush",type:"mode",description:"Faster and cheaper, for small well-defined tasks",signatures:["@anthropic-haiku-shared"]}),Object.freeze({id:"deep",type:"mode",description:"Deep reasoning with extended thinking",signatures:["@openai-gpt-codex"]}),Object.freeze({id:"review",type:"feature",description:"Bug identification and code review assistance",signatures:["@google-gemini-pro"]}),Object.freeze({id:"search",type:"agent",description:"Fast, accurate codebase retrieval",signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"oracle",type:"agent",description:"Complex reasoning and planning on code",signatures:["@openai-gpt-base"]}),Object.freeze({id:"librarian",type:"agent",description:"Large-scale retrieval and research on external code",signatures:["@anthropic-sonnet"]}),Object.freeze({id:"look-at",type:"system",description:"Image, PDF, and media file analysis",aliases:["look at","lookat"],signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"painter",type:"system",description:"Image generation and editing",signatures:["@google-gemini-pro-image"]}),Object.freeze({id:"handoff",type:"system",description:"Fallback context analysis for task continuation",signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"title",type:"system",description:"Fast title generation for threads",aliases:["titling"],signatures:["@anthropic-haiku-shared"]})]),d3=Object.freeze([Object.freeze({id:"oracle",patterns:["/^gpt-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"librarian",patterns:["/^(?:claude-)?sonnet-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"title",patterns:["/^(?:claude-)?haiku-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"painter",patterns:["gemini-3-pro-image","gemini-3-pro-image*"]}),Object.freeze({id:"search",patterns:["gemini-2.5-flash","gemini-2.5-flash*","gemini-3-flash","gemini-3-flash*"]}),Object.freeze({id:"look-at",patterns:["gemini-2.5-flash","gemini-2.5-flash*","gemini-3-flash","gemini-3-flash*"]}),Object.freeze({id:"handoff",patterns:["gemini-3-flash","gemini-3-flash*"]})]);var Hg=["second","minute","hour","day","week","month"];function Br(e,t=0){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}function ei(e,t=""){let n=String(e||"").trim().toLowerCase();return Hg.includes(n)?n:t}function C1(e,t=1){let n=String(e||"").trim().toLowerCase().replace(/s$/,"");return n?Number(t)===1?n:`${n}s`:"windows"}function Ir(e=[]){let t=[],n=new Set;for(let r of Array.isArray(e)?e:[e]){let a=String(r||"").trim();if(a){if(a.toLowerCase()==="all")return["all"];n.has(a)||(n.add(a),t.push(a))}}return t}function zs({requests:e,windowValue:t,windowUnit:n}){let r=Br(e,0),a=Br(t,0),o=ei(n,"");return!r||!a||!o?"":`${r}-req-per-${a}-${C1(o,a)}`}function R1(e={}){let t=Br(e?.requests??e?.limit,0),n=Br(e?.window?.size??e?.window?.value??e?.windowValue,0),r=ei(e?.window?.unit??e?.windowUnit,"");return!t||!n||!r?"Unconfigured":`${t}/${n} ${C1(r,n)}`}function ti(e=[],{knownModelIds:t=[],requireAtLeastOne:n=!0}={}){let r=Array.isArray(e)?e:[];if(n&&r.length===0)return"Add at least one rate-limit entity.";let a=new Set((t||[]).map(i=>String(i||"").trim()).filter(Boolean)),o=new Set;for(let i of r){let s=Ir(i?.models||[]);if(a.size>0&&s.some(p=>p!=="all"&&!a.has(p)))return"Rate-limit model selectors must match the provider model ids.";let c=Br(i?.requests,0);if(!c)return"Rate-limit requests must be a positive integer.";let u=Br(i?.windowValue,0);if(!u)return"Rate-limit window size must be a positive integer.";let f=ei(i?.windowUnit,"");if(!f)return"Rate-limit window unit is invalid.";let d=zs({requests:c,windowValue:u,windowUnit:f});if(o.has(d))return"Duplicate rate-limit entities are not allowed.";o.add(d)}return""}function Bs(e=[],{existingBucketsBySourceId:t=new Map,fallbackRequests:n=60,fallbackWindowValue:r=1,fallbackWindowUnit:a="minute"}={}){return(Array.isArray(e)?e:[]).map((o,i)=>{let s=String(o?.sourceId||"").trim(),c=s&&t instanceof Map&&t.has(s)?structuredClone(t.get(s)):{},u=Br(o?.requests,Br(c?.requests??c?.limit,n)),f=Br(o?.windowValue,Br(c?.window?.size??c?.window?.value,r)),d=ei(o?.windowUnit,ei(c?.window?.unit,a)||a),p=Ir(o?.models||[]),m=p.length>0?p:["all"],b={...c,id:zs({requests:u,windowValue:f,windowUnit:d})||`rate-limit-${i+1}`,models:m,requests:u,window:{...c?.window&&typeof c.window=="object"&&!Array.isArray(c.window)?c.window:{},size:f,unit:d}};return delete b.name,delete b.limit,b.window&&typeof b.window=="object"&&delete b.window.value,b})}function Is(e){return JSON.parse(JSON.stringify(e??{}))}function Sd(e=[]){let t=new Set,n=[];for(let r of e){let a=String(r||"").trim();!a||t.has(a)||(t.add(a),n.push(a))}return n}function T1(e){let t=String(e||"").trim();return t?t.startsWith("alias:")?t.slice(6).trim():t:""}function ok(e={},t={}){let n=t?.[at];if(n&&typeof n=="object"&&!Array.isArray(n))return{...n,id:at,strategy:String(n.strategy||"ordered").trim()||"ordered",targets:Cn(n.targets||[],o=>o),fallbackTargets:Cn(n.fallbackTargets||[],o=>o)};let r=String(e?.defaultModel||"").trim();if(!r||r==="smart")return{id:at,strategy:"ordered",targets:[],fallbackTargets:[]};let a=T1(r);if(a&&t?.[a]){let o=t[a];return{...o,id:at,strategy:String(o.strategy||"ordered").trim()||"ordered",targets:Cn(o.targets||[],i=>i),fallbackTargets:Cn(o.fallbackTargets||[],i=>i)}}return{id:at,strategy:"ordered",targets:r?[{ref:r}]:[],fallbackTargets:[]}}function ik(e={}){return(!e.modelAliases||typeof e.modelAliases!="object"||Array.isArray(e.modelAliases))&&(e.modelAliases={}),e.modelAliases[at]=ok(e,e.modelAliases),e}function lk(e={}){let t=new Set;for(let n of Object.keys(e?.modelAliases||{})){let r=String(n||"").trim();r&&t.add(r)}for(let n of e?.providers||[]){let r=String(n?.id||"").trim();if(r)for(let a of n?.models||[]){let o=String(a?.id||"").trim();o&&t.add(`${r}/${o}`)}}return t}function sk(e={}){let t=Object.keys(e?.modelAliases||{}).map(n=>String(n||"").trim()).filter(Boolean);if(t.includes(at))return at;if(t.length>0)return t[0];for(let n of e?.providers||[]){let r=String(n?.id||"").trim();if(r)for(let a of n?.models||[]){let o=String(a?.id||"").trim();if(o)return`${r}/${o}`}}return""}function wd(e={}){ik(e);let t=lk(e);if(e.defaultModel=at,!e.amp||typeof e.amp!="object"||Array.isArray(e.amp))return e;let n=String(e.amp.defaultRoute||"").trim();if(!n||!t.has(T1(n))){let r=String(e.defaultModel||"").trim()||sk(e);r?e.amp.defaultRoute=r:delete e.amp.defaultRoute}return e}function dl(e,t,n,r){let a=String(e||"").trim();if(!a)return"";let o=`${t}/`;if(!a.startsWith(o))return a;let i=a.slice(o.length),s=n.get(i)||i;return r.has(s)?`${t}/${s}`:""}function fl(e,t,n=""){let r=String(e||"").trim();if(!r)return"";let a=`${t}/`;return r.startsWith(a)?n?`${n}/${r.slice(a.length)}`:"":r}function N1(e=[]){return Sd(Array.isArray(e)?e:[e])}function ck(e={},t={}){let n={...e};if(!Object.prototype.hasOwnProperty.call(t||{},"credentialInput"))return n;let a=String(t?.credentialInput||"").trim();return delete n.apiKey,delete n.apiKeyEnv,delete n.credential,a?/^[A-Z][A-Z0-9_]*$/.test(a)?(n.apiKeyEnv=a,n):(n.apiKey=a,n):n}function uk(e={},t=[]){let n={...e},r=N1(t),a=String(r[0]||"").trim(),o=n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?{...n.metadata}:null,i=r.length>1||!!(o&&Object.prototype.hasOwnProperty.call(o,"endpointCandidates"));if(!a)delete n.baseUrl,delete n.baseUrlByFormat,o&&Object.prototype.hasOwnProperty.call(o,"endpointCandidates")&&delete o.endpointCandidates;else{n.baseUrl=a;let s=n.baseUrlByFormat&&typeof n.baseUrlByFormat=="object"&&!Array.isArray(n.baseUrlByFormat)?n.baseUrlByFormat:null;s&&Object.keys(s).length>0&&(n.baseUrlByFormat=Object.fromEntries(Object.keys(s).map(c=>[c,a]))),i&&(o=o||{},o.endpointCandidates=r)}return o&&Object.keys(o).length>0?n.metadata=o:o&&delete n.metadata,n}function dk(e={}){return e?.rateLimitLimit!==void 0||e?.rateLimitWindowValue!==void 0||e?.rateLimitWindowUnit!==void 0?[{sourceId:String(e?.rateLimitSourceId||"").trim(),models:["all"],requests:e?.rateLimitLimit,windowValue:e?.rateLimitWindowValue,windowUnit:e?.rateLimitWindowUnit}]:[]}function fk(e={},t={},n=""){let r={...e},a=Array.isArray(r.rateLimits)?r.rateLimits.map(d=>d&&typeof d=="object"?Is(d):d).filter(Boolean):[],o=Array.isArray(t?.rateLimitRows)?t.rateLimitRows:dk(t),i=a[0]&&typeof a[0]=="object"?a[0]:null,s=Number(i?.requests??i?.limit)||60,c=Number(i?.window?.size??i?.window?.value)||1,u=String(i?.window?.unit||"minute").trim()||"minute",f=new Map(a.map(d=>[String(d?.id||"").trim(),d]).filter(([d])=>!!d));return r.rateLimits=Bs(o,{existingBucketsBySourceId:f,fallbackRequests:s,fallbackWindowValue:c,fallbackWindowUnit:u}),r}function Ur(e,t,n=""){let r=String(e||"").trim();return r?r===t?n:r===`alias:${t}`?n?`alias:${n}`:"":r:""}function Cn(e=[],t){let n=new Set,r=[];for(let a of Array.isArray(e)?e:[]){let o=String(a?.ref||"").trim();if(!o)continue;let i=String(t(o)||"").trim();!i||n.has(i)||(n.add(i),r.push({...a,ref:i}))}return r}function Us(e={},t){if(!e?.amp||typeof e.amp!="object"||Array.isArray(e.amp))return e;let n=e.amp,r={};for(let[a,o]of Object.entries(n.routes&&typeof n.routes=="object"&&!Array.isArray(n.routes)?n.routes:{})){let i=String(t(o)||"").trim();i&&(r[a]=i)}return n.routes=r,n.rawModelRoutes=(Array.isArray(n.rawModelRoutes)?n.rawModelRoutes:[]).map(a=>{if(!a||typeof a!="object")return null;if(!Object.prototype.hasOwnProperty.call(a,"to"))return{...a};let o=String(t(a.to)||"").trim();return o?{...a,to:o}:null}).filter(Boolean),e}function M1(e={}){let t=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{},n={};for(let[r,a]of Object.entries(t)){let o=Cn(a?.targets||[],s=>s),i=Cn(a?.fallbackTargets||[],s=>s);n[r]={...a,targets:o,fallbackTargets:i}}return e.modelAliases=n,Us(e,r=>r),wd(e)}function mk(e=[]){let t=new Set,n=[];for(let r of Array.isArray(e)?e:[]){let a=String(r?.id||"").trim(),o=String(r?.sourceId||r?.originalId||"").trim();if(!a||t.has(a))continue;t.add(a);let i=Number.parseInt(String(r?.contextWindow||"").trim(),10);n.push({id:a,sourceId:o,contextWindow:Number.isFinite(i)&&i>0?i:null})}return n}function E1(e=[]){let t=new Set,n=[];for(let r of Array.isArray(e)?e:[]){let a=String(r?.ref||"").trim(),o=String(r?.sourceRef||r?.originalRef||"").trim(),i=String(r?.weight??"").trim(),s=Math.floor(Number(i));!a||t.has(a)||(t.add(a),n.push({ref:a,sourceRef:o,...i?{weight:Number.isFinite(s)&&s>0?s:1}:{}}))}return n}function qg(e={},t,n=[]){let r=Is(e),a=Array.isArray(r.providers)?r.providers:[],o=a.findIndex(x=>x?.id===t);if(o===-1)return r;let i=a[o],s=Array.isArray(i?.models)?i.models:[],c=new Map(s.map(x=>[String(x?.id||"").trim(),x])),u=mk(n),f=new Set,d=new Map,p=[];for(let x of u){let y=x.sourceId&&c.has(x.sourceId)&&!f.has(x.sourceId)?x.sourceId:"",h=!y&&c.has(x.id)&&!f.has(x.id)?x.id:"",v=y||h;if(v){f.add(v),v!==x.id&&d.set(v,x.id),p.push({...c.get(v),id:x.id,...x.contextWindow?{contextWindow:x.contextWindow}:{}}),x.contextWindow||delete p[p.length-1].contextWindow;continue}p.push({id:x.id,...x.contextWindow?{contextWindow:x.contextWindow}:{}})}let m=new Set(p.map(x=>String(x?.id||"").trim()).filter(Boolean));i.models=p,i.rateLimits=(Array.isArray(i.rateLimits)?i.rateLimits:[]).map(x=>{let y=Array.isArray(x?.models)?x.models:[];return{...x,models:Sd(y.map(h=>{if(String(h||"").trim()==="all")return"all";let v=d.get(String(h||"").trim())||String(h||"").trim();return m.has(v)?v:""}))}}),r.providers=a.map((x,y)=>y===o?i:x).map(x=>({...x,models:(Array.isArray(x?.models)?x.models:[]).map(y=>Array.isArray(y?.fallbackModels)?{...y,fallbackModels:Sd(y.fallbackModels.map(h=>dl(h,t,d,m)))}:y)}));let b=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},g={};for(let[x,y]of Object.entries(b)){let h=Cn(y?.targets||[],S=>dl(S,t,d,m)),v=Cn(y?.fallbackTargets||[],S=>dl(S,t,d,m));g[x]={...y,targets:h,fallbackTargets:v}}return r.modelAliases=g,r.defaultModel=dl(r.defaultModel,t,d,m),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=dl(r.amp.defaultRoute,t,d,m)),Us(r,x=>dl(x,t,d,m)),wd(r)}function $g(e={},t="",n={}){let r=Is(e),a=Array.isArray(r.providers)?r.providers:[],o=a.findIndex(m=>m?.id===t);if(o===-1)return r;let i=a[o]||{},s=String(n?.id||t||"").trim(),c=String(n?.name??i?.name??"").trim(),u=N1(Array.isArray(n?.endpoints)?n.endpoints:[n?.endpoint]),f=i?.type==="subscription",d=s||t,p={...i,id:d,name:c||d};if(f||(p=ck(p,n),p=uk(p,u),p=fk(p,n,d)),a[o]=p,r.providers=a.map(m=>({...m,models:(Array.isArray(m?.models)?m.models:[]).map(b=>Array.isArray(b?.fallbackModels)?{...b,fallbackModels:Sd(b.fallbackModels.map(g=>fl(g,t,d)))}:b)})),d!==t){let m=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},b={};for(let[g,x]of Object.entries(m))b[g]={...x,targets:Cn(x?.targets||[],y=>fl(y,t,d)),fallbackTargets:Cn(x?.fallbackTargets||[],y=>fl(y,t,d))};r.modelAliases=b,r.defaultModel=fl(r.defaultModel,t,d),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=fl(r.amp.defaultRoute,t,d)),Us(r,g=>fl(g,t,d))}return wd(r)}function O1(e={},t="",n={}){let r=Is(e),a=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},o=t?a[t]:void 0,i=t===at?at:String(n?.id||t||"").trim();if(!i)return r;let s=new Map((o?.targets||[]).map(m=>[String(m?.ref||"").trim(),m])),c=new Map((o?.fallbackTargets||[]).map(m=>[String(m?.ref||"").trim(),m])),u=new Set,f=E1(n?.targets).map(m=>{let b=m.sourceRef&&s.has(m.sourceRef)&&!u.has(m.sourceRef)?m.sourceRef:s.has(m.ref)&&!u.has(m.ref)?m.ref:"";return b&&u.add(b),{...b?s.get(b):{},ref:m.ref,...m.weight!==void 0?{weight:m.weight}:{}}}),d=new Set,p=E1(n?.fallbackTargets).map(m=>{let b=m.sourceRef&&c.has(m.sourceRef)&&!d.has(m.sourceRef)?m.sourceRef:c.has(m.ref)&&!d.has(m.ref)?m.ref:"";return b&&d.add(b),{...b?c.get(b):{},ref:m.ref,...m.weight!==void 0?{weight:m.weight}:{}}});if(t&&t!==i&&delete a[t],a[i]={...o?.metadata?{metadata:o.metadata}:{},...n?.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?{metadata:n.metadata}:{},id:i,strategy:String(n?.strategy||o?.strategy||"ordered").trim()||"ordered",targets:f,fallbackTargets:p},r.modelAliases=a,t&&t!==i){for(let[m,b]of Object.entries(a))m!==i&&(b.targets=Cn(b?.targets||[],g=>Ur(g,t,i)),b.fallbackTargets=Cn(b?.fallbackTargets||[],g=>Ur(g,t,i)));r.defaultModel=Ur(r.defaultModel,t,i),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=Ur(r.amp.defaultRoute,t,i)),Us(r,m=>Ur(m,t,i))}return M1(r)}function _1(e={},t=""){let n=Is(e),r=String(t||"").trim();if(!r)return n;let a=n.modelAliases&&typeof n.modelAliases=="object"&&!Array.isArray(n.modelAliases)?n.modelAliases:{};if(!Object.prototype.hasOwnProperty.call(a,r))return n;if(r===at)return a[r]={...a[r],id:at,strategy:String(a[r]?.strategy||"ordered").trim()||"ordered",targets:[],fallbackTargets:[]},n.modelAliases=a,wd(n);delete a[r],n.modelAliases=a;for(let o of Object.values(a))o.targets=Cn(o?.targets||[],i=>Ur(i,r)),o.fallbackTargets=Cn(o?.fallbackTargets||[],i=>Ur(i,r));return n.defaultModel=Ur(n.defaultModel,r),n?.amp&&typeof n.amp=="object"&&!Array.isArray(n.amp)&&(n.amp.defaultRoute=Ur(n.amp.defaultRoute,r)),Us(n,o=>Ur(o,r)),M1(n)}function k1(e="",t={}){return{id:String(e||t?.id||"").trim(),strategy:String(t?.strategy||"ordered").trim()||"ordered",targets:(Array.isArray(t?.targets)?t.targets:[]).map((n,r)=>({key:`target-${e||"alias"}-${r}-${String(n?.ref||"").trim()||"empty"}`,ref:String(n?.ref||"").trim(),sourceRef:String(n?.ref||"").trim(),weight:String(Number.isFinite(Number(n?.weight))&&Number(n.weight)>0?Math.floor(Number(n.weight)):1)})),fallbackTargets:(Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map((n,r)=>({key:`fallback-${e||"alias"}-${r}-${String(n?.ref||"").trim()||"empty"}`,ref:String(n?.ref||"").trim(),sourceRef:String(n?.ref||"").trim(),weight:String(Number.isFinite(Number(n?.weight))&&Number(n.weight)>0?Math.floor(Number(n.weight)):1)}))}}function L1(e={}){return(Array.isArray(e?.models)?e.models:[]).map((t,n)=>({key:`model-${e?.id||"provider"}-${n}-${String(t?.id||"").trim()||"empty"}`,id:String(t?.id||"").trim(),sourceId:String(t?.id||"").trim(),contextWindow:Number.isFinite(t?.contextWindow)?String(Math.floor(Number(t.contextWindow))):""}))}var Kg="__codex_cli_inherit__",y3=Object.freeze(["minimal","low","medium","high","xhigh"]),pk=Object.freeze(["low","medium","high","max"]),v3=Object.freeze({low:4096,medium:12e3,high:24e3,max:31999});function Fg(e){return String(e||"").trim()===Kg}function gk(e){let t=String(e||"").trim().toLowerCase();return pk.includes(t)?t:""}var D1=gk;var hk=/^\d*$/;function z1(e){let t=String(e??""),n=hk.test(t);return{accepted:n,draftValue:n?t:"",shouldCommit:n&&t!=="",commitValue:n&&t!==""?t:""}}var l=K(Be(),1),Ct={"content-type":"application/json"},I1={info:"bg-sky-50 text-sky-700 ring-sky-100",success:"bg-emerald-50 text-emerald-700 ring-emerald-100",warn:"bg-amber-50 text-amber-700 ring-amber-100",error:"bg-rose-50 text-rose-700 ring-rose-100"},yk=[{value:"usage",label:"Request / response"},{value:"router",label:"LLM Router"},{value:"all",label:"All categories"}],Ad={usage:{label:"Request / response",badgeVariant:"info",emptyLabel:"request/response"},router:{label:"LLM Router",badgeVariant:"outline",emptyLabel:"LLM Router"}},vk="https://github.com/khanglvm/llm-router",bk="https://github.com/sponsors/khanglvm",ni="AICodeClient/1.0.0",xk=3e3,Gg=4e3,Sk=100,wk=6,Md=/^[a-z][a-z0-9-]*$/,Ak=/^[A-Za-z0-9][A-Za-z0-9._:-]*$/,dC=[{value:"api",label:"API Key",description:"Test endpoint + model candidates with an API key env before saving."},{value:"oauth-gpt",label:"OAuth \xB7 GPT",description:"Use ChatGPT subscription login with GPT models."}],Wg=[{value:"auto",label:"Auto"},{value:"ordered",label:"Ordered"},{value:"round-robin",label:"Round robin"},{value:"weighted-rr",label:"Weighted RR"},{value:"quota-aware-weighted-rr",label:"Quota-aware weighted RR"}],Qg=Object.fromEntries(Wg.map(e=>[e.value,e.label])),Ck=Object.freeze([{value:"minimal",label:"Minimal",hint:"Fastest supported reasoning"},{value:"low",label:"Low",hint:"Lighter reasoning"},{value:"medium",label:"Medium",hint:"Balanced depth"},{value:"high",label:"High",hint:"Deeper reasoning"},{value:"xhigh",label:"XHigh",hint:"Model-dependent extra depth"}]),Rk=Object.freeze([{value:"low",label:"Low",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=low"},{value:"medium",label:"Medium",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=medium"},{value:"high",label:"High",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=high"},{value:"max",label:"Max",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=max"}]),U1=Hg;var Cd=Object.freeze({api:Object.freeze({openai:Object.freeze(["gpt-4o-mini","gpt-4.1-mini"]),claude:Object.freeze(["claude-3-5-sonnet","claude-3-5-haiku"])}),"oauth-gpt":Pg,"oauth-claude":Vg}),ml=Object.freeze({api:Object.freeze({limit:60,windowValue:1,windowUnit:"minute"}),oauth:Object.freeze({limit:999999,windowValue:1,windowUnit:"month"})}),j1=Object.freeze({api:Object.freeze({providerName:"My Provider",providerId:"my-provider",subscriptionProfile:""}),"oauth-gpt":Object.freeze({providerName:"ChatGPT Subscription",providerId:"chatgpt-sub",subscriptionProfile:""}),"oauth-claude":Object.freeze({providerName:"Claude Subscription",providerId:"claude-sub",subscriptionProfile:""})}),Ek=Object.freeze([{value:"ordered",label:"Ordered"},{value:"quota-balance",label:"Quota balance"}]),oh=Object.freeze([Object.freeze({id:"brave",label:"Brave",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"brv_...",defaultLimit:1e3}),Object.freeze({id:"tavily",label:"Tavily",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"tvly-...",defaultLimit:1e3}),Object.freeze({id:"exa",label:"Exa",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"exa_...",defaultLimit:1e3}),Object.freeze({id:"searxng",label:"SearXNG",credentialField:"url",credentialLabel:"Base URL",credentialPlaceholder:"https://searx.example.com",defaultLimit:0})]),fo=Object.fromEntries(oh.map(e=>[e.id,e])),ri=5,Od=1,_d=20;function Xg(e){return Array.from(new Set(String(e||"").split(/[\s,]+/).map(t=>t.trim()).filter(Boolean)))}function $s(e){let t=String(e||"").trim();if(!t)return!1;try{let n=new URL(t);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}function Hr(e=[],t=""){return Array.from(new Set([...(Array.isArray(e)?e:[]).map(n=>String(n||"").trim()).filter(Boolean),...Xg(t)]))}function fC(e=[],t,n){if(!t||!n||t===n)return e;let r=[...e],a=r.findIndex(s=>s?.key===t),o=r.findIndex(s=>s?.key===n);if(a===-1||o===-1)return e;let[i]=r.splice(a,1);return r.splice(o,0,i),r}function ih(e=[],t,n=r=>r?.key){if(!t)return e;let r=e.findIndex(i=>n(i)===t);if(r<=0)return e;let a=[...e],[o]=a.splice(r,1);return a.splice(r-1,0,o),a}function mC(e=[],t,n=r=>r?.key){if(!t)return e;let r=e.findIndex(i=>n(i)===t);if(r===-1||r>=e.length-1)return e;let a=[...e],[o]=a.splice(r,1);return a.splice(r+1,0,o),a}function P1(e,t=[]){let n=e?.getBoundingClientRect?.();return{top:Number.isFinite(n?.top)?Number(n.top):Number.NaN,left:Number.isFinite(n?.left)?Number(n.left):Number.NaN,windowX:typeof window>"u"?0:Number(window.scrollX||window.pageXOffset||0),windowY:typeof window>"u"?0:Number(window.scrollY||window.pageYOffset||0),containers:t.map(r=>({top:Number(r?.scrollTop||0),left:Number(r?.scrollLeft||0)}))}}function Tk(e,t,n=.5){return!e||!t||!Number.isFinite(t.top)||!Number.isFinite(t.left)||Math.abs(t.top-e.top)>n||Math.abs(t.left-e.left)>n||Math.abs(t.windowX-e.windowX)>n||Math.abs(t.windowY-e.windowY)>n||(e.containers?.length||0)!==(t.containers?.length||0)?!1:t.containers.every((r,a)=>{let o=e.containers[a];return o?Math.abs(r.top-o.top)<=n&&Math.abs(r.left-o.left)<=n:!1})}function V1(e){let t=String(e?.category||"").trim().toLowerCase();if(t==="usage"||t==="router")return t;let n=String(e?.source||"").trim().toLowerCase(),r=String(e?.kind||"").trim().toLowerCase();return n==="runtime"||r.startsWith("request")||r.startsWith("fallback")?"usage":"router"}var H1=["border-primary/45","bg-primary/5"];function pl(e,t){if(e?.classList){if(t){e.classList.add(...H1);return}e.classList.remove(...H1)}}function lh(e){return typeof e?.closest=="function"?e.closest("[data-reorder-row='true']"):null}function sh(e=[]){let t=(0,E.useRef)(new Map),n=(0,E.useRef)(new Map),r=(0,E.useRef)(new Map),a=(0,E.useRef)(""),o=JSON.stringify(e);return(0,E.useLayoutEffect)(()=>{let i=new Map;for(let f of e){let d=t.current.get(f);d&&i.set(f,d.getBoundingClientRect())}let s=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(a.current!==""&&a.current!==o&&!s)for(let f of e){let d=r.current.get(f),p=i.get(f),m=t.current.get(f);if(!d||!p||!m)continue;let b=d.top-p.top;Math.abs(b)<1||typeof m.animate!="function"||m.animate([{transform:`translateY(${b}px)`},{transform:"translateY(0)"}],{duration:220,easing:"cubic-bezier(0.22, 1, 0.36, 1)"})}let u=new Set(e);for(let f of n.current.keys())u.has(f)||n.current.delete(f);r.current=i,a.current=o},[o]),(0,E.useMemo)(()=>i=>(n.current.has(i)||n.current.set(i,s=>{if(s){t.current.set(i,s);return}t.current.delete(i)}),n.current.get(i)),[])}function ch({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("circle",{cx:"5",cy:"4",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"4",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"5",cy:"8",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"8",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"5",cy:"12",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"12",r:"1.25",fill:"currentColor"})]})}function Nk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 12V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M4.75 7.25 8 4l3.25 3.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M4.75 8.75 8 12l3.25-3.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function pC({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 3.5v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Ok({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.28-.01-1.2-.02-2.18-3.2.69-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.71.08-.71 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.69 1.25 3.35.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.71 0-1.26.45-2.28 1.18-3.08-.12-.29-.51-1.46.11-3.05 0 0 .97-.31 3.17 1.18a10.9 10.9 0 0 1 5.77 0c2.2-1.49 3.17-1.18 3.17-1.18.62 1.59.23 2.76.11 3.05.74.8 1.18 1.82 1.18 3.08 0 4.44-2.69 5.41-5.26 5.69.41.35.78 1.05.78 2.11 0 1.52-.01 2.75-.01 3.12 0 .31.21.67.8.56A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function _k({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M12 21.3 10.9 20.3C5.4 15.3 2 12.3 2 8.5 2 5.4 4.4 3 7.5 3c1.8 0 3.5.8 4.5 2.1C13 3.8 14.7 3 16.5 3 19.6 3 22 5.4 22 8.5c0 3.8-3.4 6.8-8.9 11.8L12 21.3Z"})})}function kk({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M6.25 4.7a.75.75 0 0 1 1.14-.64l8.1 5.05a1.05 1.05 0 0 1 0 1.78l-8.1 5.05a.75.75 0 0 1-1.14-.64V4.7Z"})})}function Lk({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M6.25 4.5A1.25 1.25 0 0 1 7.5 3.25h.5a1.25 1.25 0 0 1 1.25 1.25v11A1.25 1.25 0 0 1 8 16.75h-.5a1.25 1.25 0 0 1-1.25-1.25v-11Zm4.5 0A1.25 1.25 0 0 1 12 3.25h.5a1.25 1.25 0 0 1 1.25 1.25v11A1.25 1.25 0 0 1 12.5 16.75H12a1.25 1.25 0 0 1-1.25-1.25v-11Z"})})}function Dk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M2.75 6.5A1.75 1.75 0 0 1 4.5 4.75h3L9.4 6.4h6.1a1.75 1.75 0 0 1 1.75 1.75v6.35a1.75 1.75 0 0 1-1.75 1.75h-11A1.75 1.75 0 0 1 2.75 14.5v-8Z"}),(0,l.jsx)("path",{d:"M2.75 8h14.5"})]})}function zk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M10 3.25v5"}),(0,l.jsx)("path",{d:"M6.1 5.15a6.25 6.25 0 1 0 7.8 0"})]})}function Ks({disabled:e=!1,label:t="Move up",onClick:n}){return(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 rounded-full p-0",onMouseDown:r=>r.preventDefault(),onClick:n,disabled:e,"aria-label":t,title:t,children:(0,l.jsx)(Nk,{className:"h-3.5 w-3.5"})})}function kd({disabled:e=!1,label:t="Move down",onClick:n}){return(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 rounded-full p-0",onMouseDown:r=>r.preventDefault(),onClick:n,disabled:e,"aria-label":t,title:t,children:(0,l.jsx)(Mk,{className:"h-3.5 w-3.5"})})}function q1({active:e=!1}){return e?(0,l.jsx)("span",{"aria-hidden":"true",className:"inline-flex h-2.5 w-2.5 rounded-full bg-emerald-500"}):null}var Ld="w-[5.5rem] justify-self-end";function uh(e){let t=String(e||"").trim().toLowerCase();return t==="automatic"||t==="smart"?"auto":t==="rr"?"round-robin":t==="weighted-round-robin"||t==="weighted_rr"?"weighted-rr":t==="quota-aware-weighted-round-robin"?"quota-aware-weighted-rr":Object.prototype.hasOwnProperty.call(Qg,t)?t:"ordered"}function gC(e){let t=uh(e);return Qg[t]||Qg.ordered}function ba(e=[]){return Array.from(new Set((e||[]).map(t=>String(t||"").trim()).filter(Boolean)))}function dh(e=[]){let t=new Set;for(let n of(e||[]).map(r=>String(r||"").trim()).filter(Boolean)){if(t.has(n))return!0;t.add(n)}return!1}function Bk(e=[],t="",n=-1){let r=String(t||"").trim().toLowerCase();return r?(e||[]).some((a,o)=>o!==n&&String(a?.name||"").trim().toLowerCase()===r):!1}function Ik(){return{id:"",strategy:"auto",targets:[{ref:""}],fallbackTargets:[]}}function Uk(e="",t={},{isNew:n=!1}={}){return JSON.stringify({aliasId:n?"":String(e||"").trim(),id:String(t?.id||(n?"":e)||"").trim(),strategy:String(t?.strategy||"ordered").trim()||"ordered",targets:(Array.isArray(t?.targets)?t.targets:[]).map(r=>String(r?.ref||"").trim()),fallbackTargets:(Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map(r=>String(r?.ref||"").trim())})}function Zg(){if(typeof globalThis<"u"&&globalThis.crypto?.getRandomValues){let t=new Uint8Array(18);return globalThis.crypto.getRandomValues(t),`gw_${Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}`}return`gw_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function Dd(e){return/^[A-Z][A-Z0-9_]*$/.test(String(e||"").trim())}function Vr(e){let t=String(e||"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return t?/^[a-z]/.test(t)?t:`provider-${t}`:""}function $1(e,t){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}function Rd(e={}){return ba((Array.isArray(e?.models)?e.models:[]).map(t=>t?.id))}function hC(e={},{keyPrefix:t="rate-limit",index:n=0,defaults:r=ml.api,useDefaults:a=!0}={}){let o=String(e?.sourceId||e?.id||"").trim(),i=e?.requests??e?.limit,s=e?.windowValue??e?.window?.size??e?.window?.value,c=e?.windowUnit??e?.window?.unit;return{key:String(e?.key||"").trim()||`${t}-${o||n+1}`,sourceId:o,models:Ir(Array.isArray(e?.models)?e.models:[]),modelsDraft:String(e?.modelsDraft||""),requests:i!==void 0?String(i):a?String(r.limit??""):"",windowValue:s!==void 0?String(s):a?String(r.windowValue??""):"",windowUnit:String(c!==void 0?c:a?r.windowUnit:"minute").trim()||"minute"}}function fh(e=[],{keyPrefix:t="rate-limit",defaults:n=ml.api,includeDefault:r=!0}={}){return(Array.isArray(e)&&e.length>0?e:r?[{models:["all"],requests:n.limit,window:{size:n.windowValue,unit:n.windowUnit}}]:[]).map((o,i)=>hC(o,{keyPrefix:t,index:i,defaults:n,useDefaults:!0}))}function Jg(e={}){return Ir(Hr(e?.models,e?.modelsDraft||"")).length===0&&!String(e?.requests??"").trim()&&!String(e?.windowValue??"").trim()}function xa(e=[]){return(Array.isArray(e)?e:[]).map((t,n)=>({key:String(t?.key||`rate-limit-${n+1}`).trim()||`rate-limit-${n+1}`,sourceId:String(t?.sourceId||"").trim(),models:Ir(Hr(t?.models,t?.modelsDraft||"")),requests:String(t?.requests??"").trim(),windowValue:String(t?.windowValue??"").trim(),windowUnit:ei(t?.windowUnit,"minute")})).filter((t,n)=>!Jg({...e?.[n]||{},...t}))}function K1(e=[]){return xa(e).map(t=>({sourceId:t.sourceId,models:t.models,requests:t.requests,windowValue:t.windowValue,windowUnit:t.windowUnit}))}function jk(e=[]){let t=Array.isArray(e)?e.filter(Boolean):[];return t.length===0?"":t.length===1?R1(t[0]):`${t.length} rate limits`}function gl(e){return JSON.parse(JSON.stringify(e??{}))}function F1(e,t={}){try{let n=JSON.parse(String(e||"{}"));return n&&typeof n=="object"&&!Array.isArray(n)?n:t}catch{return t}}function zd(e=ni){return[{name:"User-Agent",value:String(e||ni)}]}function mh(e=[]){return(Array.isArray(e)?e:[]).map(t=>({name:String(t?.name||""),value:t?.value===void 0||t?.value===null?"":String(t.value)}))}function Pk(e,t=ni){if(!e||typeof e!="object"||Array.isArray(e))return zd(t);let n=Object.entries(e).map(([r,a])=>({name:String(r||""),value:a==null?"":String(a)})).filter(r=>r.name.trim());return n.length>0?n:zd(t)}function ph(e=[]){let t={};for(let n of mh(e)){let r=String(n.name||"").trim();if(!r)continue;let a=r.toLowerCase()==="user-agent",o=String(n.value||"").trim();!o&&!a||(t[r]=o)}return t}function G1(e={}){return JSON.stringify({connectionType:String(e?.connectionType||""),endpoints:Array.isArray(e?.endpoints)?e.endpoints.map(t=>String(t||"").trim()).filter(Boolean):[],apiKeyEnv:String(e?.apiKeyEnv||"").trim(),headers:ph(e?.headerRows||[])})}function hl(e,t){return String(e||"").trim().startsWith(`${t}/`)}function gh(e){let t=Object.keys(e?.modelAliases||{});if(t.includes(at))return at;if(t.length>0)return t[0];let n=(e?.providers||[]).find(r=>(r?.models||[]).length>0);return n?.models?.[0]?.id?`${n.id}/${n.models[0].id}`:void 0}function Vk(e,t={}){try{let n=String(e||"").trim()?JSON.parse(e):{};return!n||typeof n!="object"||Array.isArray(n)?{value:t,parseError:"Config root must be a JSON object."}:{value:n,parseError:""}}catch(n){return{value:t,parseError:n instanceof Error?n.message:String(n)}}}function Y1(e){return String(e||"").split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function W1(e){let t=String(e||"").trim();if(!t)return"";let n=xd.find(o=>o?.id===t);if(n?.defaultMatch)return String(n.defaultMatch).trim();let r=Ds.find(o=>o?.id===t);if(!r)return"";let a=[...new Set((r.signatures||[]).map(o=>xd.find(i=>i?.id===o)?.defaultMatch).map(o=>String(o||"").trim()).filter(Boolean))];return a.length===1?a[0]:a.join(" | ")}function Hk(){return Ls}function qk(e){let t=String(e||"").trim();return t?t.length<=10?`${t.slice(0,2)}\u2026${t.slice(-2)}`:`${t.slice(0,4)}\u2026${t.slice(-4)}`:""}function zn(e={}){let t=gl(e&&typeof e=="object"&&!Array.isArray(e)?e:{});return(!t.amp||typeof t.amp!="object"||Array.isArray(t.amp))&&(t.amp={}),(!t.amp.routes||typeof t.amp.routes!="object"||Array.isArray(t.amp.routes))&&(t.amp.routes={}),Array.isArray(t.amp.rawModelRoutes)||(t.amp.rawModelRoutes=[]),(!t.amp.overrides||typeof t.amp.overrides!="object"||Array.isArray(t.amp.overrides))&&(t.amp.overrides={}),Array.isArray(t.amp.overrides.entities)||(t.amp.overrides.entities=[]),t.amp.restrictManagementToLocalhost===void 0&&(t.amp.restrictManagementToLocalhost=!0),String(t.amp.preset||"").trim()||(t.amp.preset="builtin"),String(t.amp.defaultRoute||"").trim()||(t.amp.defaultRoute=String(t.defaultModel||gh(t)||"").trim()),t}function va(e,t=0,{min:n=0,max:r=Number.MAX_SAFE_INTEGER}={}){let a=Number.parseInt(String(e??""),10);return Number.isFinite(a)?Math.min(r,Math.max(n,a)):t}function ai(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=t.amp?.webSearch&&typeof t.amp.webSearch=="object"&&!Array.isArray(t.amp.webSearch)?gl(t.amp.webSearch):null;(!t.webSearch||typeof t.webSearch!="object"||Array.isArray(t.webSearch))&&(t.webSearch=n||{}),t.amp&&typeof t.amp=="object"&&!Array.isArray(t.amp)&&Object.prototype.hasOwnProperty.call(t.amp,"webSearch")&&delete t.amp.webSearch;let r=String(t.webSearch.strategy||"").trim();return t.webSearch.strategy=r==="quota-balance"?"quota-balance":"ordered",t.webSearch.count!==void 0&&t.webSearch.count!==null&&String(t.webSearch.count).trim()!==""?t.webSearch.count=va(t.webSearch.count,ri,{min:Od,max:_d}):delete t.webSearch.count,Array.isArray(t.webSearch.providers)||(t.webSearch.providers=[]),t.webSearch}function yC(e=""){return String(e||"").trim().includes("/")}function en(e=""){let t=String(e||"").trim();return yC(t)?t:t.toLowerCase()}function yl(e="",t=""){let n=String(e||"").trim(),r=String(t||"").trim();return!n||!r?"":`${n}/${r}`}function $k(e={}){return[...new Set([e?.format,...Array.isArray(e?.formats)?e.formats:[]].map(t=>String(t||"").trim().toLowerCase()).filter(t=>t==="openai"||t==="claude"))]}function Kk(e={},t={}){let n=String(t?.id||"").trim(),r=n?String(e?.lastProbe?.modelPreferredFormat?.[n]||"").trim().toLowerCase():"";if(r==="openai"||r==="claude")return[r];let a=n?[...new Set((Array.isArray(e?.lastProbe?.modelSupport?.[n])?e.lastProbe.modelSupport[n]:[]).map(o=>String(o||"").trim().toLowerCase()).filter(o=>o==="openai"||o==="claude"))]:[];return a.length>0?a:[...new Set([t?.format,...Array.isArray(t?.formats)?t.formats:[]].map(o=>String(o||"").trim().toLowerCase()).filter(o=>o==="openai"||o==="claude"))]}function vC(e={}){let t=String(e?.subscriptionType||e?.subscription_type||"").trim().toLowerCase();return String(e?.type||"").trim().toLowerCase()==="subscription"?t==="chatgpt-codex":$k(e).includes("openai")?!!String(e?.baseUrlByFormat?.openai||e?.baseUrl||"").trim():!1}function Fk(e={}){return String(e?.type||"").trim().toLowerCase()==="subscription"?String(e?.subscriptionType||e?.subscription_type||"").trim().toLowerCase()==="chatgpt-codex":String(e?.apiKey||"").trim()||String(e?.apiKeyEnv||"").trim()||String(e?.auth?.type||"").trim().toLowerCase()==="none"?!0:Object.keys(e?.headers&&typeof e.headers=="object"?e.headers:{}).some(t=>{let n=String(t||"").trim().toLowerCase();return n==="authorization"||n==="x-api-key"})}function Gk(e={},t={}){if(!vC(e))return!1;let n=Kk(e,t);return n.length===0||n.includes("openai")}function Pr(e={},t=[]){return!e||typeof e!="object"||Array.isArray(e)?!1:t.some(n=>Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==void 0&&e[n]!==null&&String(e[n]).trim()!=="")}function Vs(e={},t=""){let n=String(t||e?.id||"").trim().toLowerCase(),r=fo[n];if(!r)return null;let a=r.credentialField,o=String(e?.[a]||"").trim(),i=Pr(e,["count","resultCount","result-count","resultsPerCall","results-per-call"]),s=Pr(e,["limit","monthlyLimit","monthly-limit","quota"]),c=Pr(e,["remaining","remainingQuota","remaining-quota","remainingQueries","remaining-queries"]),u=!!o||s||c,f=u&&Number(r.defaultLimit)||0,d=va(e?.count??e?.resultCount??e?.["result-count"]??e?.resultsPerCall??e?.["results-per-call"],ri,{min:Od,max:_d}),p=va(e?.limit,f,{min:0}),m=p>0?p:0,b=va(e?.remaining,m,{min:0});return{kind:"builtin",id:n,[a]:o,...i&&d!==ri?{count:d}:{},...s||u&&p>0?{limit:p}:{},...c||u&&(p>0||b>0)?{remaining:p>0?Math.min(b,p):b}:{}}}function Yk(e={},t=""){let n=String(t||e?.id||yl(e?.providerId??e?.provider,e?.model??e?.modelId)).trim();if(!yC(n))return null;let r=String(e?.providerId??e?.provider??n.slice(0,n.indexOf("/"))).trim(),a=String(e?.model??e?.modelId??n.slice(n.indexOf("/")+1)).trim(),o=yl(r,a);return!o||o!==n?null:{kind:"hosted",id:o,providerId:r,model:a}}function Wk(e={},t=""){return Yk(e,t)||Vs(e,t)}function Qk(e={},t=new Set){return(Array.isArray(e?.providers)?e.providers:[]).map(r=>{let a=String(r?.id||"").trim();if(!a||r?.enabled===!1||!vC(r)||!Fk(r))return null;let o=(Array.isArray(r?.models)?r.models:[]).map(i=>{let s=String(i?.id||"").trim(),c=yl(a,s);return!s||!c||t.has(c)||!Gk(r,i)||!s.toLowerCase().includes("gpt")?null:{value:s,label:s,routeId:c}}).filter(Boolean);return o.length===0?null:{providerId:a,providerLabel:String(r?.name||a).trim()||a,providerHint:String(r?.subscriptionType||"").trim().toLowerCase()==="chatgpt-codex"?"ChatGPT subscription":String(r?.baseUrlByFormat?.openai||r?.baseUrl||"").trim()||"OpenAI-compatible endpoint",models:o}}).filter(Boolean)}function Xk(e={},t=null){let n=zn(e),r=ai(n),a=Array.isArray(r.providers)?r.providers.map(d=>Wk(d,d?.id)).filter(Boolean):[],o=new Set(a.map(d=>en(d.id))),i=[...a,...oh.filter(d=>!o.has(d.id)).map(d=>Vs({id:d.id},d.id)).filter(Boolean)],s=Array.isArray(t?.providers)?t.providers:[],c=new Map(s.map(d=>[en(d?.id),d]).filter(([d])=>!!d)),u=new Map((Array.isArray(e?.providers)?e.providers:[]).map(d=>[String(d?.id||"").trim(),d]).filter(([d])=>!!d)),f=va(r?.count,ri,{min:Od,max:_d});return i.map(d=>{let p=en(d.id),m=c.get(p)||null,b=a.findIndex(T=>en(T.id)===p),g=i.findIndex(T=>en(T.id)===p),x=d.kind==="hosted"?m?.ready!==!1:!!d?.[fo[d.id]?.credentialField||"apiKey"];if(d.kind==="hosted"){let T=u.get(d.providerId)||null;return{id:d.id,key:d.id,kind:"hosted",label:String(T?.name||d.providerId).trim()||d.providerId,providerId:d.providerId,modelId:d.model,routeId:d.id,configured:!0,configuredIndex:b,configuredCount:a.length,displayIndex:g,displayCount:i.length,active:x,runtimeState:m}}let y=fo[d.id],h=y?.credentialField||"apiKey",v=String(d?.[h]||"").trim(),S=Pr(d,["count"]),C=va(d?.count,f,{min:Od,max:_d});return{id:d.id,key:d.id,kind:"builtin",label:y?.label||d.id,credentialField:h,credentialLabel:y?.credentialLabel||"Credential",credentialPlaceholder:y?.credentialPlaceholder||"",credentialValue:v,resultPerCall:C,resultPerCallInput:S?String(C):f!==ri?String(f):"",limit:va(d?.limit,y?.defaultLimit||0,{min:0}),remaining:va(d?.remaining,y?.defaultLimit||0,{min:0}),configured:!!v,configuredIndex:b,configuredCount:a.length,displayIndex:g,displayCount:i.length,active:x,runtimeState:m}})}function Zk(e={},t={}){let n=zn(e),r=ai(n);return t.strategy!==void 0&&(r.strategy=String(t.strategy||"").trim()==="quota-balance"?"quota-balance":"ordered"),t.count!==void 0&&(r.count=va(t.count,r.count,{min:1,max:20})),n}function Jk(e={},t,n={}){let r=String(t||"").trim().toLowerCase();if(!fo[r])return zn(e);let a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=i.findIndex(h=>en(h?.id)===r),c=s>=0?i[s]:null,u=Vs(c||{id:r},r)||Vs({id:r},r),d=fo[r].credentialField,p=Vs({...c&&typeof c=="object"&&!Array.isArray(c)?c:{},...u,...n,id:r,[d]:n[d]!==void 0?String(n[d]||"").trim():u?.[d]},r),m=!!String(p?.[d]||"").trim(),b=Pr(n,["count"])?!!String(n?.count||"").trim()&&Number(p?.count)!==ri:Pr(c,["count"])&&Number(p?.count)!==ri,g=m||Pr(n,["limit"])||Pr(c,["limit"]),x=m||Pr(n,["remaining"])||Pr(c,["remaining"]),y={id:r,...m?{[d]:String(p?.[d]||"").trim()}:{},...b?{count:Number(p.count)}:{},...g&&Number(p?.limit)>0?{limit:Number(p.limit)}:{},...x&&(Number(p?.limit)>0||Number(p?.remaining)>0)?{remaining:Number(p.remaining)}:{}};return s>=0?i[s]=y:i.push(y),o.providers=i,a}function e2(e={},t,n){let r=yl(t,n);if(!r)return zn(e);let a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=en(r);return i.some(c=>en(c?.id)===s)||(i.push({id:r,providerId:String(t||"").trim(),model:String(n||"").trim()}),o.providers=i),a}function t2(e={},t){let n=en(t),r=zn(e),a=ai(r),o=Array.isArray(a.providers)?a.providers.slice():[],i=o.filter(s=>en(s?.id)!==n);return i.length===o.length||(a.providers=i),r}function n2(e={},t,n="up"){let r=en(t),a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=new Map(i.map(g=>[en(g?.id),g]).filter(([g])=>!!g)),c=i.findIndex(g=>en(g?.id)===r);if(c!==-1){let g=n==="down"?c+1:c-1;if(g<0||g>=i.length)return a;let[x]=i.splice(c,1);return i.splice(g,0,x),o.providers=i,a}if(!fo[r])return a;let u=[...i.map(g=>en(g?.id)).filter(Boolean),...oh.map(g=>g.id).filter(g=>!s.has(g))],f=u.indexOf(r);if(f===-1)return a;let d=n==="down"?f+1:f-1;if(d<0||d>=u.length)return a;let p=u.slice(),[m]=p.splice(f,1);p.splice(d,0,m);let b=new Set(s.keys());b.add(r);for(let g of p.slice(0,d+1))fo[g]&&b.add(g);return o.providers=p.filter(g=>b.has(g)).map(g=>s.get(g)||{id:g}),a}function r2(e,t,n){let r=String(e||"").trim().toLowerCase(),a=fo[r];return!a||String(t||"").trim()!==a.credentialField?!1:!String(n||"").trim()}function Q1(e={}){let t=[],n=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{};for(let a of Object.keys(n))t.push({value:a,label:a,hint:`Alias \xB7 ${(n[a]?.targets||[]).length||0} target(s)`,kind:"alias",groupKey:"aliases",groupLabel:"Aliases"});for(let a of Array.isArray(e?.providers)?e.providers:[]){let o=String(a?.id||"").trim(),i=String(a?.name||o||"provider").trim()||"provider";for(let s of Array.isArray(a?.models)?a.models:[]){let c=String(s?.id||"").trim();if(!o||!c)continue;let u=Number.isFinite(s?.contextWindow)?Number(s.contextWindow):null;t.push({value:`${o}/${c}`,label:`${o}/${c}`,hint:u?`${i} \xB7 ${Hs(u)}`:i,kind:"model",providerId:o,groupKey:`provider:${o}`,groupLabel:i})}}let r=new Set;return t.filter(a=>!a?.value||r.has(a.value)?!1:(r.add(a.value),!0))}function a2(e=""){let t=String(e||"").trim();if(!t)return{};let n=t.startsWith("alias:")?t.slice(6).trim():t;if(!n.includes("/"))return{kind:"alias",groupKey:"aliases",groupLabel:"Aliases"};let r=n.indexOf("/"),a=n.slice(0,r).trim();return a?{kind:"model",providerId:a,groupKey:`provider:${a}`,groupLabel:a}:{}}function Hs(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)return"Unknown";if(t>=1e3){let n=t/1e3;return`${Number.isInteger(n)?String(n):n.toFixed(1).replace(/\.0$/,"")}K`}return String(t)}function o2(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)return"";let n=[{suffix:"M",divisor:1e3*1e3},{suffix:"K",divisor:1e3}];for(let r of n){if(t<r.divisor)continue;let a=t/r.divisor;return`${a>=10?String(Math.round(a)):a.toFixed(1).replace(/\.0$/,"")}${r.suffix}`}return String(t)}function Ed(e){let t=so(e),n=Number(t);return!Number.isFinite(n)||n<=0?String(e||""):new Intl.NumberFormat().format(n)}function i2(e={}){let t=new Map;for(let n of Array.isArray(e?.providers)?e.providers:[]){let r=String(n?.id||"").trim();if(r)for(let a of Array.isArray(n?.models)?n.models:[]){let o=String(a?.id||"").trim();o&&t.set(`${r}/${o}`,{ref:`${r}/${o}`,providerId:r,providerName:String(n?.name||r).trim()||r,modelId:o,contextWindow:Number.isFinite(a?.contextWindow)?Number(a.contextWindow):null})}}return t}function l2(e="",t={}){let n=t?.modelAliases&&typeof t.modelAliases=="object"&&!Array.isArray(t.modelAliases)?t.modelAliases:{},r=i2(t),a=new Set,o=new Set,i=[],s=[];function c(m){let b=String(m||"").trim();if(!b)return;if(r.has(b)){if(o.has(b))return;o.add(b),i.push(r.get(b));return}let g=b.startsWith("alias:")?b.slice(6).trim():b;if(!g||!Object.prototype.hasOwnProperty.call(n,g)){s.includes(b)||s.push(b);return}if(a.has(g))return;a.add(g);let x=n[g];for(let y of[...x?.targets||[],...x?.fallbackTargets||[]])c(y?.ref)}c(e);let u=i.filter(m=>Number.isFinite(m?.contextWindow)),f=[...new Set(u.map(m=>m.contextWindow))].sort((m,b)=>m-b),d=f[0]??null,p=f[f.length-1]??null;return{aliasId:e,models:i,unknownRefs:s,smallestContextWindow:d,largestContextWindow:p,hasMixedContextWindows:f.length>1}}function s2(e={}){let t=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{};return Object.keys(t).map(n=>l2(n,e)).filter(n=>n.hasMixedContextWindows).sort((n,r)=>String(n.aliasId||"").localeCompare(String(r.aliasId||"")))}function Fs(e=[],t=[]){let n=[...Array.isArray(e)?e:[]],r=new Set(n.map(a=>String(a?.value||"").trim()).filter(Boolean));for(let a of(Array.isArray(t)?t:[]).map(o=>String(o||"").trim()).filter(Boolean))r.has(a)||(r.add(a),n.push({value:a,label:a,hint:"Current config",...a2(a)}));return n}function c2(e=[]){let t=[],n=new Map,r=null;for(let a of(Array.isArray(e)?e:[]).filter(Boolean)){let o=String(a?.groupKey||a?.groupLabel||"").trim(),i=String(a?.groupLabel||"").trim();if(!o){r||(r={key:"__ungrouped__",label:"",options:[]},t.push(r)),r.options.push(a);continue}let s=n.get(o);s||(s={key:o,label:i||o,options:[]},n.set(o,s),t.push(s)),s.options.push(a)}return t}function u2(e={},{includeHint:t=!1}={}){let n=String(e?.label||e?.value||"").trim()||String(e?.value||"").trim(),r=String(e?.hint||"").trim();return t&&r?`${n} \xB7 ${r}`:n}function Bd(e=[],{keyPrefix:t="select-option",includeHint:n=!1}={}){return c2(e).map((r,a)=>{let o=r.options.map(i=>(0,l.jsx)(ar,{value:i.value,searchText:`${i.label||""} ${i.value||""} ${i.hint||""} ${r.label||""}`,children:u2(i,{includeHint:n})},`${t}-${i.value}`));return r.label?(0,l.jsxs)(Ug,{children:[(0,l.jsx)(A1,{children:r.label}),o]},`${t}-group-${r.key||a}`):o})}function d2({bindingValue:e="",thinkingLevel:t="",configFilePath:n="",endpointUrl:r=""}={}){let a=String(e||"").trim(),o=String(t||"").trim(),i=String(n||"").trim(),s=String(r||"").trim(),c=Fg(a),u=c?"Mode: Inherit Codex model":a?`Mode: Pinned to ${a}`:"Mode: Choose a route",f=c?{variant:"success",title:"Inherit mode keeps Codex-native model picks intact.",body:(0,l.jsxs)(l.Fragment,{children:["Codex CLI still chooses its own model name. Create a same-name alias in the ",(0,l.jsx)("span",{className:"font-medium",children:"Alias & Fallback"})," tab so LLM Router can resolve that name to the real upstream target you want."]})}:a?{variant:"info",title:"Pinned mode forces one router target.",body:(0,l.jsxs)(l.Fragment,{children:["LLM Router writes ",(0,l.jsxs)("code",{children:["model=",a]})," into Codex CLI config. That is the simplest setup when every Codex session should use one managed route or alias."]})}:{variant:"warning",title:"Choose your model strategy before you connect.",body:(0,l.jsxs)(l.Fragment,{children:["Pick ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," if Codex should keep using its built-in model names, or pick one managed route/alias if you want a single fixed target."]})};return{title:"Codex CLI guide",description:"Quick setup for routing Codex CLI through LLM Router while keeping model routing easy to inspect and change later.",badges:[{label:u,variant:c?"success":a?"info":"outline"},{label:o?`Thinking: ${o}`:"Thinking: Codex default",variant:"outline"},{label:i?"Config file detected":"User config: ~/.codex/config.toml",variant:"outline"}],callout:f,highlights:[{eyebrow:"1. Connect",title:"Point Codex CLI at LLM Router",body:s?(0,l.jsxs)(l.Fragment,{children:["When connected, Codex sends requests to ",(0,l.jsx)("code",{children:s}),". LLM Router then handles upstream auth, alias resolution, and failover."]}):(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Codex CLI so it talks to LLM Router instead of a provider directly."]})},{eyebrow:"2. Route",title:"Choose between inherit and pinned mode",body:c?(0,l.jsxs)(l.Fragment,{children:["Keep Codex model names such as ",(0,l.jsx)("code",{children:"gpt-5.4"}),", then create matching aliases in LLM Router, for example ",(0,l.jsx)("code",{children:"gpt-5.4"})," -> ",(0,l.jsx)("code",{children:"demo/gpt-4o-mini"}),"."]}):(0,l.jsxs)(l.Fragment,{children:["Select one managed route or alias in ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," when you want every Codex request to land on the same router target."]})},{eyebrow:"3. Tune",title:"Optional reasoning control",body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"font-medium",children:"Thinking level"})," writes Codex CLI ",(0,l.jsx)("code",{children:"model_reasoning_effort"})," with the official values ",(0,l.jsx)("code",{children:"minimal"}),", ",(0,l.jsx)("code",{children:"low"}),", ",(0,l.jsx)("code",{children:"medium"}),", ",(0,l.jsx)("code",{children:"high"}),", or ",(0,l.jsx)("code",{children:"xhigh"}),"."]})}],sections:[{title:"Quick start",items:[(0,l.jsxs)(l.Fragment,{children:["Set a ",(0,l.jsx)("code",{children:"masterKey"})," in LLM Router first. The ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," button stays disabled until gateway auth is ready."]}),(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch the Codex CLI config file and router base URL."]}),c?(0,l.jsxs)(l.Fragment,{children:["Leave ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," on ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"}),", then create aliases that match the Codex model names you actually use."]}):a?(0,l.jsxs)(l.Fragment,{children:["Your current default is pinned to ",(0,l.jsx)("code",{children:a}),". Change it only when you want Codex to use a different managed route or alias."]}):(0,l.jsxs)(l.Fragment,{children:["Choose either ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," or one managed route/alias in ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," before you start using Codex through the router."]}),(0,l.jsxs)(l.Fragment,{children:["Set ",(0,l.jsx)("span",{className:"font-medium",children:"Thinking level"})," only when you want LLM Router to write ",(0,l.jsx)("code",{children:"model_reasoning_effort"}),"; leave it unset to keep Codex CLI defaults."]})]},{title:"Choose the right model strategy",items:[(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," when you want Codex-native model names and model-specific UI/options to remain visible."]}),(0,l.jsx)(l.Fragment,{children:"Use a fixed route or alias when your team wants one centrally managed target regardless of what Codex would otherwise choose."}),(0,l.jsx)(l.Fragment,{children:"If Codex-specific options disappear after pinning a route, switch back to inherit mode and route those same model names through aliases instead."})]},{title:"Where these settings land",items:[i?(0,l.jsxs)(l.Fragment,{children:["This page is currently managing ",(0,l.jsx)("code",{children:i}),"."]}):(0,l.jsxs)(l.Fragment,{children:["Codex CLI usually stores user settings in ",(0,l.jsx)("code",{children:"~/.codex/config.toml"}),". Trusted projects can also add overrides in ",(0,l.jsx)("code",{children:".codex/config.toml"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["The router-managed bindings in this panel map to Codex CLI ",(0,l.jsx)("code",{children:"model"})," and ",(0,l.jsx)("code",{children:"model_reasoning_effort"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Open Codex CLI Config File"})," whenever you want to inspect the exact generated config."]})]},{title:"Quick verify",items:[(0,l.jsx)(l.Fragment,{children:"Open the config file from this page and confirm the values match the mode you intended."}),(0,l.jsx)(l.Fragment,{children:"Start Codex CLI and run a small prompt. If inherit mode is on, make sure the Codex model you selected has a same-name alias in LLM Router."}),(0,l.jsxs)(l.Fragment,{children:["If requests fail after switching models, check the ",(0,l.jsx)("span",{className:"font-medium",children:"Alias & Fallback"})," tab first because the alias behind that model name may be missing or pointed at the wrong target."]})]}]}}function f2({bindings:e={},settingsFilePath:t="",endpointUrl:n=""}={}){let r=String(e?.primaryModel||"").trim(),a=String(e?.defaultOpusModel||"").trim(),o=String(e?.defaultSonnetModel||"").trim(),i=String(e?.defaultHaikuModel||"").trim(),s=String(e?.subagentModel||"").trim(),c=D1(e?.thinkingLevel),u=String(t||"").trim(),f=String(n||"").trim(),d=[r,a,o,i,s,c].filter(Boolean).length,p=r?{variant:"info",title:"Primary model override is active.",body:(0,l.jsxs)(l.Fragment,{children:["LLM Router is currently writing ",(0,l.jsxs)("code",{children:["ANTHROPIC_MODEL=",r]}),". Leave that field blank if you want Claude Code to keep choosing its own primary model."]})}:d>0?{variant:"info",title:"Only filled fields are overridden.",body:(0,l.jsx)(l.Fragment,{children:"Claude Code continues to inherit its normal defaults for every blank field. This is useful when you only want to steer alias models, subagents, or effort level through LLM Router."})}:{variant:"success",title:"Blank fields are a valid setup.",body:(0,l.jsx)(l.Fragment,{children:"You do not need to fill every binding. Leave fields empty unless you want LLM Router to override that specific Claude Code setting."})};return{title:"Claude Code guide",description:"Quick setup for routing Claude Code through LLM Router while keeping only the model and effort level overrides you actually want.",badges:[{label:d>0?`${d} override${d===1?"":"s"} active`:"No router overrides",variant:d>0?"info":"outline"},{label:c?`Effort: ${c}`:"Effort: Claude adaptive default",variant:"outline"},{label:u?"Settings file detected":"Settings scope: local/project/user",variant:"outline"}],callout:p,highlights:[{eyebrow:"1. Connect",title:"Point Claude Code at the router",body:f?(0,l.jsxs)(l.Fragment,{children:["When connected, Claude Code sends requests to ",(0,l.jsx)("code",{children:f}),". LLM Router then handles upstream auth, route selection, and failover."]}):(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Claude Code so it uses the router Anthropic endpoint instead of a provider directly."]})},{eyebrow:"2. Override",title:"Set only the bindings you need",body:(0,l.jsxs)(l.Fragment,{children:["Leave fields blank to inherit Claude Code defaults. Fill ",(0,l.jsx)("code",{children:"ANTHROPIC_MODEL"}),", the Opus/Sonnet/Haiku defaults, or ",(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"})," only when you want LLM Router to manage those values."]})},{eyebrow:"3. Effort",title:"Set thinking effort level",body:(0,l.jsxs)(l.Fragment,{children:["The ",(0,l.jsx)("span",{className:"font-medium",children:"Effort level"})," dropdown writes ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," to your shell profile. If the shell profile cannot be updated, ",(0,l.jsx)("code",{children:"effortLevel"})," is set in ",(0,l.jsx)("code",{children:"settings.json"}),' as a fallback (only "high" is supported there).']})}],sections:[{title:"Quick start",items:[(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Claude Code toward the router and keep provider credentials centralized inside LLM Router."]}),(0,l.jsxs)(l.Fragment,{children:["Leave ",(0,l.jsx)("span",{className:"font-medium",children:"Current model override"})," empty unless you explicitly want to replace Claude Code's own main model selection."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Default Opus"}),", ",(0,l.jsx)("span",{className:"font-medium",children:"Default Sonnet"}),", and ",(0,l.jsx)("span",{className:"font-medium",children:"Default Haiku"})," when you want Claude Code's built-in alias names to resolve to managed routes or aliases."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Sub-agent model"})," when background workers or helper agents should run on a different route than the main session."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Effort level"})," to set ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," in your shell profile; leave it unset to keep Claude Code's adaptive default. The ",(0,l.jsx)("code",{children:"effortLevel"})," key in ",(0,l.jsx)("code",{children:"settings.json"}),' (only "high") acts as a fallback when the shell profile cannot be updated.']})]},{title:"What each binding controls",items:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"ANTHROPIC_MODEL"}),": overrides the main model for the active Claude Code session."]}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_OPUS_MODEL"}),", ",(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_SONNET_MODEL"}),", and ",(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_HAIKU_MODEL"}),": remap Claude Code's built-in alias names to managed routes or aliases."]}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"}),": routes subagents and background workers to a specific managed model."]}),c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"}),": currently set to ",(0,l.jsx)("span",{className:"font-medium",children:c})," in your shell profile."]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"}),": stays unset unless you choose an effort level."]})]},{title:"Settings scope and precedence",items:[(0,l.jsxs)(l.Fragment,{children:["Claude Code settings apply in this order: ",(0,l.jsx)("code",{children:"managed-settings.json"}),", CLI arguments, ",(0,l.jsx)("code",{children:".claude/settings.local.json"}),", ",(0,l.jsx)("code",{children:".claude/settings.json"}),", then ",(0,l.jsx)("code",{children:"~/.claude/settings.json"}),"."]}),u?(0,l.jsxs)(l.Fragment,{children:["This page is currently managing ",(0,l.jsx)("code",{children:u}),"."]}):(0,l.jsx)(l.Fragment,{children:"Claude Code can read from project-local, project-shared, or user settings files depending on what exists in your environment."}),(0,l.jsx)(l.Fragment,{children:"If a value seems ignored, check whether a higher-precedence file or command-line flag is overriding it."})]},{title:"Quick verify",items:[(0,l.jsxs)(l.Fragment,{children:["Open the settings file from this page and confirm the ",(0,l.jsx)("code",{children:"env"})," block contains only the overrides you meant to set."]}),(0,l.jsxs)(l.Fragment,{children:["Launch Claude Code and test both the main session and any subagents if you changed ",(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["If thinking behavior is not what you expected, remember this UI writes ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," to your shell profile; clearing the field returns control to Claude Code's own default behavior."]})]}]}}function m2(){return new Set([...Ds.map(e=>e.id),...xd.map(e=>e.id)].map(e=>String(e||"").trim()).filter(Boolean))}var p2=m2();function Gs(e){return p2.has(String(e||"").trim())}function Id(e){(!e.routes||typeof e.routes!="object"||Array.isArray(e.routes))&&(e.routes={}),Array.isArray(e.rawModelRoutes)||(e.rawModelRoutes=[])}function bC(e={}){return String(e?.sourceRouteKey||"").trim()}function xC(e={}){let n=zn(e).amp;Id(n);let r=new Map,a=[];for(let[s,c]of(n.rawModelRoutes||[]).entries()){let u=bC(c);if(u&&Gs(u)){r.set(u,{mapping:c,index:s});continue}a.push({id:`raw:${s}`,source:"raw",index:s,routeKey:"",inbound:String(c?.from||"").trim(),outbound:String(c?.to||"").trim(),label:"Custom mapping",description:`Wildcard/raw match: ${String(c?.from||"").trim()||"(empty)"}`,defaultMatch:"",isCustom:!0,removable:!0})}let o=Ds.map(s=>{let c=String(s.id||"").trim(),u=W1(c),f=r.get(c)?.mapping||null;return{id:`route:${c}`,source:"route",routeKey:c,inbound:String(f?.from||u||c).trim(),outbound:String(f?.to||n.routes?.[c]||"").trim(),label:Y1(c),description:s.description||"",defaultMatch:u,isCustom:!1,removable:!1}}),i=Object.entries(n.routes||{}).filter(([s])=>!Ds.some(c=>c.id===s)).map(([s,c])=>{let u=String(s||"").trim(),f=W1(u),d=Gs(u);return{id:`route:${u}`,source:"route",routeKey:u,inbound:u,outbound:String(c||"").trim(),label:d?f||u:Y1(u),description:d?`Route key: ${u}`:`Custom route key: ${u}`,defaultMatch:f,isCustom:!0,removable:!0}});return[...o,...i,...a]}function hh(e,t){return xC(e).find(n=>n.id===t)||null}function X1(e={},t,{inbound:n,outbound:r}={}){let a=zn(e),o=a.amp;Id(o);let i=hh(a,t);if(!i)return a;let s=String(n??i.inbound??"").trim(),c=String(r??i.outbound??"").trim(),u=i.source==="route"?String(i.routeKey||"").trim():"",f=u?String(i.defaultMatch||"").trim():"",d=u?o.rawModelRoutes.findIndex(b=>bC(b)===u):-1,p=u&&Gs(u),m=Gs(s)?s:u&&f&&s===f?u:"";if(i.source==="route"&&i.routeKey&&delete o.routes[i.routeKey],i.source==="raw"&&Number.isInteger(i.index)&&o.rawModelRoutes.splice(i.index,1),d>=0&&o.rawModelRoutes.splice(d,1),m)return c&&(o.routes[m]=c),a;if(p){let b=f||u;return c&&(o.routes[u]=c),s&&s!==b&&o.rawModelRoutes.push({from:s,sourceRouteKey:u}),a}return s&&c&&o.rawModelRoutes.push({from:s,to:c}),a}function g2(e={},{inbound:t,outbound:n}={}){let r=zn(e),a=r.amp;Id(a);let o=String(t||"").trim(),i=String(n||"").trim(),s=Gs(o)?o:"";return!o||!i?r:s?(a.routes[s]=i,r):(a.rawModelRoutes.push({from:o,to:i}),r)}function h2(e={},t){let n=zn(e),r=n.amp;Id(r);let a=hh(n,t);return a?.removable&&(a.source==="route"&&a.routeKey&&delete r.routes[a.routeKey],a.source==="raw"&&Number.isInteger(a.index)&&r.rawModelRoutes.splice(a.index,1)),n}function y2(e,t){let n=gl(e&&typeof e=="object"?e:{});n.providers=(Array.isArray(n.providers)?n.providers:[]).filter(i=>i?.id!==t);let r=new Set((n.providers||[]).flatMap(i=>(i.models||[]).map(s=>`${i.id}/${s.id}`))),a=n.modelAliases&&typeof n.modelAliases=="object"?n.modelAliases:{},o={};for(let[i,s]of Object.entries(a)){let c=Array.isArray(s?.targets)?s.targets.filter(f=>!hl(f?.ref,t)):[],u=Array.isArray(s?.fallbackTargets)?s.fallbackTargets.filter(f=>!hl(f?.ref,t)):[];o[i]={...s,...Array.isArray(s?.targets)?{targets:c}:{},...Array.isArray(s?.fallbackTargets)?{fallbackTargets:u}:{}}}return n.modelAliases=o,n.defaultModel&&!n.modelAliases?.[n.defaultModel]&&!r.has(n.defaultModel)&&(n.defaultModel=at),n?.amp?.defaultRoute&&!n.modelAliases?.[n.amp.defaultRoute]&&!r.has(n.amp.defaultRoute)&&(n.amp={...n.amp,defaultRoute:n.defaultModel||gh(n)}),n}function vl(e={}){let t=Array.isArray(e?.metadata?.endpointCandidates)?e.metadata.endpointCandidates:[],n=[e?.baseUrl,...Object.values(e?.baseUrlByFormat||{})];return Array.from(new Set((t.length>0?t:n).map(r=>String(r||"").trim()).filter(Boolean)))}function v2(e={}){let t=String(e?.apiKeyEnv||"").trim();if(t)return{apiKeyEnv:t};let n=String(e?.apiKey||e?.credential||"").trim();return n?{apiKey:n}:{}}function Z1(e={},t={}){if(e&&Object.prototype.hasOwnProperty.call(e,"credentialInput")){let n=String(e?.credentialInput||"").trim();return n?Dd(n)?{apiKeyEnv:n}:{apiKey:n}:{}}return v2(t)}function uo(e={}){return e?.type==="subscription"?e?.subscriptionType==="claude-code"?"oauth-claude":"oauth-gpt":"api"}function b2(e={}){let t=vl(e),n=uo(e),r=Ud(n);return{id:String(e?.id||"").trim(),name:String(e?.name||e?.id||"").trim(),credentialInput:n==="api"?String(e?.apiKeyEnv||e?.apiKey||e?.credential||"").trim():"",endpoints:n==="api"?t:[],endpointDraft:"",rateLimitRows:n==="api"?fh(e?.rateLimits,{keyPrefix:`provider-${e?.id||"new"}-rate-limit`,defaults:r,includeDefault:!0}):[]}}function x2(e){return dC.find(t=>t.value===e)?.label||"API Key"}function SC(e,t="openai"){return e==="api"?[...Cd.api[t]||Cd.api.openai]:[...Cd[e]||Cd["oauth-gpt"]]}function Ud(e){return e==="api"?ml.api:ml.oauth}function S2(e,t,n=[]){let r=new Set((n||[]).map(o=>o?.id).filter(Boolean));if(!r.has(e))return{providerId:e,providerName:t};let a=2;for(;r.has(`${e}-${a}`);)a++;return{providerId:`${e}-${a}`,providerName:`${t} ${a}`}}function Ps(e,t="openai"){let n=j1[e]||j1.api,r=Ud(e);return{providerName:n.providerName,providerId:n.providerId,endpoints:e==="api"?[]:[],apiKeyEnv:"",subscriptionProfile:e==="api"?"":n.subscriptionProfile,modelIds:e==="api"?[]:SC(e,t),rateLimitRows:e==="api"?fh([],{keyPrefix:`quick-start-${e}-rate-limit`,defaults:r,includeDefault:!0}):[]}}function w2(e={},t="",{aliasId:n=""}={}){if(!t)return null;let r=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{},a=n?[[n,r[n]]]:Object.entries(r);for(let[o,i]of a){if(!i||typeof i!="object")continue;let s=Array.isArray(i?.targets)?i.targets:[],c=Array.isArray(i?.fallbackTargets)?i.fallbackTargets:[];if([...s,...c].some(u=>hl(u?.ref,t)))return{aliasId:o,alias:i}}return null}function A2(e,t="",n=[]){let r=Array.from(new Set((n||[]).map(s=>String(s||"").trim()).filter(Boolean)));if(!t||!e?.alias)return r;let a=new Set(r),o=Array.isArray(e.alias?.targets)?e.alias.targets:[],i=[];for(let s of o){let c=String(s?.ref||"").trim();if(!hl(c,t))continue;let u=c.slice(t.length+1);!a.has(u)||i.includes(u)||i.push(u)}return i.length>0?i:r}function yh(e=[],t=[]){let n=Array.from(new Set((t||[]).map(o=>String(o||"").trim()).filter(Boolean))),r=new Set(n),a=[];for(let o of(e||[]).map(i=>String(i||"").trim()).filter(Boolean))r.has(o)&&(a.push(o),r.delete(o));return[...a,...n.filter(o=>r.has(o))]}function J1(e,{fromProviderId:t,toProviderId:n,allowedModelIds:r}){if(!e||typeof e!="object")return e;let a=String(e.ref||"").trim();if(!t||!hl(a,t))return e;let o=a.slice(t.length+1);return r.has(o)?{...e,ref:`${n}/${o}`}:null}function C2(e,t){if(!e||typeof e!="object")return e;let n={...e},r=Array.isArray(e.targets),a=Array.isArray(e.fallbackTargets);return r&&(n.targets=e.targets.map(o=>J1(o,t)).filter(Boolean)),a&&(n.fallbackTargets=e.fallbackTargets.map(o=>J1(o,t)).filter(Boolean)),n}function R2(e,{fromProviderId:t,toProviderId:n,allowedModelIds:r}){let a=String(e||"").trim();if(!a||!t||!hl(a,t))return a;let o=a.slice(t.length+1);return r.has(o)?`${n}/${o}`:""}function E2(e=[]){return new Set((e||[]).flatMap(t=>(t?.models||[]).map(n=>`${t.id}/${n.id}`)))}function T2(e={},{seedMode:t="blank",targetProviderId:n="",defaultProviderUserAgent:r=ni}={}){let a=Array.isArray(e?.providers)?e.providers:[],o=n&&a.find(h=>h?.id===n)||null,i=t==="existing"||!!o,s=i?o||a[0]||{}:{},c=i?uo(s):"api",u=s?.format==="claude"?"claude":"openai",f=Ps(c,u),d=Ud(c),p=Array.isArray(s?.models)?s.models.map(h=>h?.id).filter(Boolean):[],m=String(s?.id||f.providerId||Vr(s?.name||f.providerName||"my-provider")||"my-provider"),b=i?w2(e,m,{aliasId:at}):null,g=p.length>0?p:[...f.modelIds],x=Object.fromEntries((Array.isArray(s?.models)?s.models:[]).map(h=>{let v=String(h?.id||"").trim(),S=Number(h?.contextWindow);return!v||!Number.isFinite(S)||S<=0?null:[v,Math.floor(S)]}).filter(Boolean)),y=c==="api"?Pk(s?.headers,r):[];return{connectionType:c,providerName:String(s?.name||f.providerName),providerId:m,endpoints:vl(s).length>0?vl(s):f.endpoints,endpointDraft:"",apiKeyEnv:String(s?.apiKeyEnv||s?.apiKey||f.apiKeyEnv),subscriptionProfile:String(s?.subscriptionProfile||f.subscriptionProfile),modelIds:g,modelContextWindows:x,modelDraft:"",aliasModelIds:A2(b,m,g),headerRows:y,rateLimitRows:c==="api"?fh(s?.rateLimits,{keyPrefix:`quick-start-${m}-rate-limit`,defaults:d,includeDefault:!0}):[],enableAlias:!0,aliasId:at,sourceAliasId:b?.aliasId||"",useAliasAsDefault:i?!!b:!0}}function eC(e,t={},n={}){return(e||[]).map(r=>{let a=t[r],o=Number(n?.[r]);return{id:r,...a?{formats:[a]}:{},...Number.isFinite(o)&&o>0?{contextWindow:Math.floor(o)}:{}}})}function wC(e={}){let t=Vr(e?.providerId||e?.providerName||"")||"";return String(e?.subscriptionProfile||t||"default").trim()||t||"default"}function N2(e={},t,n=null,{targetProviderId:r=""}={}){let a=gl(e&&typeof e=="object"?e:{}),o=Vr(t?.providerId||t?.providerName||"my-provider")||"my-provider",i=String(t?.providerName||o).trim()||o,s=Array.isArray(t?.modelIds)?t.modelIds.map(H=>String(H||"").trim()).filter(Boolean):[],c=yh(t?.aliasModelIds,s),u=Ud(t?.connectionType),f=Array.isArray(t?.rateLimitRows)?t.rateLimitRows:[],d=f.length>0?f:[{models:["all"],requests:u.limit,windowValue:u.windowValue,windowUnit:u.windowUnit}],p=Array.isArray(e?.providers)&&e.providers.length>0,m=String(r||"").trim(),b=String(t?.sourceAliasId||"").trim(),g;if(t?.connectionType==="api"){let H=Array.isArray(t?.endpoints)?t.endpoints.map(he=>String(he||"").trim()).filter(Boolean):[],Q=Array.isArray(n?.workingFormats)?n.workingFormats.filter(Boolean):[],ee=n?.preferredFormat||Q[0]||"openai",X=n?.baseUrlByFormat&&typeof n.baseUrlByFormat=="object"?n.baseUrlByFormat:H[0]?{[ee]:H[0]}:void 0,z=ee&&X?.[ee]||X?.openai||X?.claude||H[0]||"",te=Array.isArray(n?.models)&&n.models.length>0?c.filter(he=>n.models.includes(he)):c,Y=te.length>0?te:c,q=H.length>1?{endpointCandidates:H}:void 0,V=String(t?.apiKeyEnv||"").trim(),_e=Dd(V)?{apiKeyEnv:V}:V?{apiKey:V}:{},F=ph(t?.headerRows||[]);g={id:o,name:i,baseUrl:z,baseUrlByFormat:X,..._e,...Object.keys(F).length>0?{headers:F}:{},format:ee,formats:Q.length>0?Q:[ee],models:eC(Y,n?.modelPreferredFormat||{},t?.modelContextWindows||{}),...q?{metadata:q}:{}}}else{let H=t?.connectionType==="oauth-claude"?"claude-code":"chatgpt-codex",Q=t?.connectionType==="oauth-claude"?"claude":"openai";g={id:o,name:i,type:"subscription",subscriptionType:H,subscriptionProfile:wC(t),format:Q,formats:[Q],models:eC(c,{},t?.modelContextWindows||{})}}g.rateLimits=t?.connectionType==="api"?Bs(d,{fallbackRequests:u.limit,fallbackWindowValue:u.windowValue,fallbackWindowUnit:u.windowUnit}):Bs([{models:["all"],requests:u.limit,windowValue:u.windowValue,windowUnit:u.windowUnit}],{fallbackRequests:u.limit,fallbackWindowValue:u.windowValue,fallbackWindowUnit:u.windowUnit}),String(a.masterKey||"").trim()||(a.masterKey=Zg()),a.version=typeof a.version=="number"?a.version:2;let x=Array.isArray(a.providers)?a.providers:[],y=m?x.findIndex(H=>H?.id===m):-1;y===-1&&(y=x.findIndex(H=>H?.id===o)),a.providers=y===-1?[...x,g]:x.map((H,Q)=>Q===y?g:H);let h=a.modelAliases&&typeof a.modelAliases=="object"&&!Array.isArray(a.modelAliases)?a.modelAliases:{},v=new Set((g.models||[]).map(H=>H.id)),S=!p||t?.useAliasAsDefault===!0,C={};for(let[H,Q]of Object.entries(h)){let ee=m?C2(Q,{fromProviderId:m,toProviderId:o,allowedModelIds:v}):Q;C[H]=ee}let T=g.models?.[0]?.id?`${o}/${g.models[0].id}`:"",w=(c.length>0?c:(g.models||[]).map(H=>H.id)).filter(H=>v.has(H)),R=at,M=C[R]&&typeof C[R]=="object"?C[R]:{id:R,strategy:"ordered",targets:[],fallbackTargets:[]};C[R]=S?{...M,id:R,strategy:"ordered",targets:w.map(H=>({ref:`${o}/${H}`})),fallbackTargets:[]}:{...M,id:R,strategy:String(M.strategy||"ordered").trim()||"ordered",targets:Array.isArray(M.targets)?M.targets:[],fallbackTargets:Array.isArray(M.fallbackTargets)?M.fallbackTargets:[]},a.modelAliases=C;let k=E2(a.providers);a.defaultModel=at,(!a.amp||typeof a.amp!="object"||Array.isArray(a.amp))&&(a.amp={restrictManagementToLocalhost:!0,overrides:{entities:[]}}),a.amp.restrictManagementToLocalhost===void 0&&(a.amp.restrictManagementToLocalhost=!0),(!a.amp.overrides||typeof a.amp.overrides!="object"||Array.isArray(a.amp.overrides))&&(a.amp.overrides={entities:[]}),Array.isArray(a.amp.overrides.entities)||(a.amp.overrides.entities=[]);let I=String(a.amp.defaultRoute||"").trim();return m&&(I=R2(I,{fromProviderId:m,toProviderId:o,allowedModelIds:v})),(S||!I||!a.modelAliases?.[I]&&!k.has(I))&&(I=at),I&&(a.amp.defaultRoute=I),(!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata))&&(a.metadata={}),a}function AC(e={}){return(Array.isArray(e?.providers)?e.providers:[]).some(n=>{if(n?.enabled===!1)return!1;let r=Array.isArray(n?.models)?n.models.filter(o=>String(o?.id||"").trim()):[],a=Array.isArray(n?.rateLimits)?n.rateLimits:[];return r.length>0&&a.length>0})}function M2(e,t,n={},{targetProviderId:r=""}={}){let a=Vr(t?.providerId||t?.providerName||""),o=Hr(t?.modelIds,t?.modelDraft),i=yh(t?.aliasModelIds,o),s=xa(t?.rateLimitRows),c=t?.connectionType==="api"?Hr(t?.endpoints,t?.endpointDraft):[],u=Array.isArray(n?.providers)?n.providers:[],f=n?.modelAliases&&typeof n.modelAliases=="object"&&!Array.isArray(n.modelAliases)?n.modelAliases:{};if(e===0){if(!String(t?.providerName||"").trim())return"Add a provider name to continue.";if(!a||!Md.test(a))return"Provider id must start with a letter and use lowercase letters, numbers, or hyphens.";if(u.some(d=>d?.id===a&&d?.id!==r))return"Provider id already exists. Choose another id or edit that provider instead.";if(t?.connectionType==="api"){if(c.length===0)return"Add at least one endpoint to continue.";if(!String(t?.apiKeyEnv||"").trim())return"API key or env is required before testing config."}}if(e===1){if(o.length===0)return"Add at least one model id.";if(t?.connectionType==="api"){let d=ti(s,{knownModelIds:o,requireAtLeastOne:!0});if(d)return d}}return e===2&&t?.useAliasAsDefault&&Object.prototype.hasOwnProperty.call(f,String(t?.aliasId||at).trim())===!1,""}function vh(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"\u2014"}function O2(e){return e?.parseError?"danger":(e?.validationErrors||[]).length>0?"warning":"success"}function eh(e=""){let t=String(e||"Select alias").trim()||"Select alias",n=Math.min(Math.max(Math.ceil(t.length*8.5+62),160),520);if(typeof document>"u")return n;let a=(eh.canvas||(eh.canvas=document.createElement("canvas"))).getContext("2d");return a?(a.font='500 14px "Inter", "SF Pro Display", ui-sans-serif, system-ui, sans-serif',Math.min(Math.max(Math.ceil(a.measureText(t).width+62),160),520)):n}async function js(e){let t=String(e||"");if(!t)return;if(typeof navigator<"u"&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(t);return}if(typeof document>"u")throw new Error("Clipboard is not available in this environment.");let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}async function Nt(e,t={}){let n=await fetch(e,t),r=await n.json().catch(()=>({}));if(!n.ok){let a=new Error(r?.error||`Request failed (${n.status})`);throw a.statusCode=n.status,a.payload=r,a}return r}async function CC(e,t={},{onMessage:n}={}){let r=await fetch(e,t);if(!r.ok){let u=await r.json().catch(()=>({})),f=new Error(u?.error||`Request failed (${r.status})`);throw f.statusCode=r.status,f.payload=u,f}let a=r.body?.getReader();if(!a)return null;let o=new TextDecoder,i="",s=null;for(;;){let{value:u,done:f}=await a.read();i+=o.decode(u||new Uint8Array,{stream:!f});let d=i.indexOf(`
49
+ `)},h_=0,cl=[];function LA(e){var t=pt.useRef([]),n=pt.useRef([0,0]),r=pt.useRef(),a=pt.useState(h_++)[0],o=pt.useState(_s)[0],i=pt.useRef(e);pt.useEffect(function(){i.current=e},[e]),pt.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=yA([e.lockRef.current],(e.shards||[]).map(kA),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=pt.useCallback(function(g,x){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var y=cd(g),h=n.current,v="deltaX"in g?g.deltaX:h[0]-y[0],S="deltaY"in g?g.deltaY:h[1]-y[1],C,N=g.target,w=Math.abs(v)>Math.abs(S)?"h":"v";if("touches"in g&&w==="h"&&N.type==="range")return!1;var R=window.getSelection(),M=R&&R.anchorNode,k=M?M===N||M.contains(N):!1;if(k)return!1;var I=Eg(w,N);if(!I)return!0;if(I?C=w:(C=w==="v"?"h":"v",I=Eg(w,N)),!I)return!1;if(!r.current&&"changedTouches"in g&&(v||S)&&(r.current=C),!C)return!0;var H=r.current||C;return OA(H,x,g,H==="h"?v:S,!0)},[]),c=pt.useCallback(function(g){var x=g;if(!(!cl.length||cl[cl.length-1]!==o)){var y="deltaY"in x?_A(x):cd(x),h=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&p_(C.delta,y)})[0];if(h&&h.should){x.cancelable&&x.preventDefault();return}if(!h){var v=(i.current.shards||[]).map(kA).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=v.length>0?s(x,v[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=pt.useCallback(function(g,x,y,h){var v={name:g,delta:x,target:y,should:h,shadowParent:y_(y)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(S){return S!==v})},1)},[]),f=pt.useCallback(function(g){n.current=cd(g),r.current=void 0},[]),d=pt.useCallback(function(g){u(g.type,_A(g),g.target,s(g,e.lockRef.current))},[]),p=pt.useCallback(function(g){u(g.type,cd(g),g.target,s(g,e.lockRef.current))},[]);pt.useEffect(function(){return cl.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Xo),document.addEventListener("touchmove",c,Xo),document.addEventListener("touchstart",f,Xo),function(){cl=cl.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,Xo),document.removeEventListener("touchmove",c,Xo),document.removeEventListener("touchstart",f,Xo)}},[]);var m=e.removeScrollBar,b=e.inert;return pt.createElement(pt.Fragment,null,b?pt.createElement(o,{styles:g_(a)}):null,m?pt.createElement(Cg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function y_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var DA=vg(sd,LA);var zA=ud.forwardRef(function(e,t){return ud.createElement(Os,An({},e,{ref:t,sideCar:DA}))});zA.classNames=Os.classNames;var Ng=zA;var pe=K(Be(),1),v_=[" ","Enter","ArrowUp","ArrowDown"],b_=[" ","Enter"],Zo="Select",[fd,md,x_]=Uu(Zo),[ul,N3]=Jn(Zo,[x_,cg]),pd=cg(),[S_,io]=ul(Zo),[w_,A_]=ul(Zo),BA=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:s,onValueChange:c,dir:u,name:f,autoComplete:d,disabled:p,required:m,form:b}=e,g=pd(t),[x,y]=J.useState(null),[h,v]=J.useState(null),[S,C]=J.useState(!1),N=rl(u),[w,R]=pa({prop:r,defaultProp:a??!1,onChange:o,caller:Zo}),[M,k]=pa({prop:i,defaultProp:s,onChange:c,caller:Zo}),I=J.useRef(null),H=x?b||!!x.closest("form"):!0,[Q,ee]=J.useState(new Set),X=Array.from(Q).map(z=>z.props.value).join(";");return(0,pe.jsx)(lA,{...g,children:(0,pe.jsxs)(S_,{required:m,scope:t,trigger:x,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:no(),value:M,onValueChange:k,open:w,onOpenChange:R,dir:N,triggerPointerDownPosRef:I,disabled:p,children:[(0,pe.jsx)(fd.Provider,{scope:t,children:(0,pe.jsx)(w_,{scope:e.__scopeSelect,onNativeOptionAdd:J.useCallback(z=>{ee(te=>new Set(te).add(z))},[]),onNativeOptionRemove:J.useCallback(z=>{ee(te=>{let W=new Set(te);return W.delete(z),W})},[]),children:n})}),H?(0,pe.jsxs)(a1,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:M,onChange:z=>k(z.target.value),disabled:p,form:b,children:[M===void 0?(0,pe.jsx)("option",{value:""}):null,Array.from(Q)]},X):null]})})};BA.displayName=Zo;var IA="SelectTrigger",UA=J.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=pd(n),i=io(IA,n),s=i.disabled||r,c=Xe(t,i.onTriggerChange),u=md(n),f=J.useRef("touch"),[d,p,m]=i1(g=>{let x=u().filter(v=>!v.disabled),y=x.find(v=>v.value===i.value),h=l1(x,g,y);h!==void 0&&i.onValueChange(h.value)}),b=g=>{s||(i.onOpenChange(!0),m()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return(0,pe.jsx)(sA,{asChild:!0,...o,children:(0,pe.jsx)(Oe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":o1(i.value)?"":void 0,...a,ref:c,onClick:Pe(a.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&b(g)}),onPointerDown:Pe(a.onPointerDown,g=>{f.current=g.pointerType;let x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(b(g),g.preventDefault())}),onKeyDown:Pe(a.onKeyDown,g=>{let x=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(x&&g.key===" ")&&v_.includes(g.key)&&(b(),g.preventDefault())})})})});UA.displayName=IA;var jA="SelectValue",PA=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...s}=e,c=io(jA,n),{onValueNodeHasChildrenChange:u}=c,f=o!==void 0,d=Xe(t,c.onValueNodeChange);return xt(()=>{u(f)},[u,f]),(0,pe.jsx)(Oe.span,{...s,ref:d,style:{pointerEvents:"none"},children:o1(c.value)?(0,pe.jsx)(pe.Fragment,{children:i}):o})});PA.displayName=jA;var C_="SelectIcon",VA=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...a}=e;return(0,pe.jsx)(Oe.span,{"aria-hidden":!0,...a,ref:t,children:r||"\u25BC"})});VA.displayName=C_;var R_="SelectPortal",HA=e=>(0,pe.jsx)(dg,{asChild:!0,...e});HA.displayName=R_;var Jo="SelectContent",qA=J.forwardRef((e,t)=>{let n=io(Jo,e.__scopeSelect),[r,a]=J.useState();if(xt(()=>{a(new DocumentFragment)},[]),!n.open){let o=r;return o?Lg.createPortal((0,pe.jsx)($A,{scope:e.__scopeSelect,children:(0,pe.jsx)(fd.Slot,{scope:e.__scopeSelect,children:(0,pe.jsx)("div",{children:e.children})})}),o):null}return(0,pe.jsx)(KA,{...e,ref:t})});qA.displayName=Jo;var yr=10,[$A,lo]=ul(Jo),E_="SelectContentImpl",N_=Po("SelectContent.RemoveScroll"),KA=J.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:s,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:b,hideWhenDetached:g,avoidCollisions:x,...y}=e,h=io(Jo,n),[v,S]=J.useState(null),[C,N]=J.useState(null),w=Xe(t,U=>S(U)),[R,M]=J.useState(null),[k,I]=J.useState(null),H=md(n),[Q,ee]=J.useState(!1),X=J.useRef(!1);J.useEffect(()=>{if(v)return hA(v)},[v]),$S();let z=J.useCallback(U=>{let[ne,...ue]=H().map(oe=>oe.ref.current),[me]=ue.slice(-1),re=document.activeElement;for(let oe of U)if(oe===re||(oe?.scrollIntoView({block:"nearest"}),oe===ne&&C&&(C.scrollTop=0),oe===me&&C&&(C.scrollTop=C.scrollHeight),oe?.focus(),document.activeElement!==re))return},[H,C]),te=J.useCallback(()=>z([R,v]),[z,R,v]);J.useEffect(()=>{Q&&te()},[Q,te]);let{onOpenChange:W,triggerPointerDownPosRef:q}=h;J.useEffect(()=>{if(v){let U={x:0,y:0},ne=me=>{U={x:Math.abs(Math.round(me.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(me.pageY)-(q.current?.y??0))}},ue=me=>{U.x<=10&&U.y<=10?me.preventDefault():v.contains(me.target)||W(!1),document.removeEventListener("pointermove",ne),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",ue,{capture:!0})}}},[v,W,q]),J.useEffect(()=>{let U=()=>W(!1);return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[W]);let[V,_e]=i1(U=>{let ne=H().filter(re=>!re.disabled),ue=ne.find(re=>re.ref.current===document.activeElement),me=l1(ne,U,ue);me&&setTimeout(()=>me.ref.current.focus())}),F=J.useCallback((U,ne,ue)=>{let me=!X.current&&!ue;(h.value!==void 0&&h.value===ne||me)&&(M(U),me&&(X.current=!0))},[h.value]),he=J.useCallback(()=>v?.focus(),[v]),Z=J.useCallback((U,ne,ue)=>{let me=!X.current&&!ue;(h.value!==void 0&&h.value===ne||me)&&I(U)},[h.value]),ae=r==="popper"?Tg:FA,Se=ae===Tg?{side:s,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:b,hideWhenDetached:g,avoidCollisions:x}:{};return(0,pe.jsx)($A,{scope:n,content:v,viewport:C,onViewportChange:N,itemRefCallback:F,selectedItem:R,onItemLeave:he,itemTextRefCallback:Z,focusSelectedItem:te,selectedItemText:k,position:r,isPositioned:Q,searchRef:V,children:(0,pe.jsx)(Ng,{as:N_,allowPinchZoom:!0,children:(0,pe.jsx)(Zp,{asChild:!0,trapped:h.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:Pe(a,U=>{h.trigger?.focus({preventScroll:!0}),U.preventDefault()}),children:(0,pe.jsx)(Yp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:(0,pe.jsx)(ae,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:U=>U.preventDefault(),...y,...Se,onPlaced:()=>ee(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Pe(y.onKeyDown,U=>{let ne=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!ne&&U.key.length===1&&_e(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let me=H().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(U.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){let re=U.target,oe=me.indexOf(re);me=me.slice(oe+1)}setTimeout(()=>z(me)),U.preventDefault()}})})})})})})});KA.displayName=E_;var T_="SelectItemAlignedPosition",FA=J.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=io(Jo,n),i=lo(Jo,n),[s,c]=J.useState(null),[u,f]=J.useState(null),d=Xe(t,w=>f(w)),p=md(n),m=J.useRef(!1),b=J.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:y,focusSelectedItem:h}=i,v=J.useCallback(()=>{if(o.trigger&&o.valueNode&&s&&u&&g&&x&&y){let w=o.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),M=o.valueNode.getBoundingClientRect(),k=y.getBoundingClientRect();if(o.dir!=="rtl"){let re=k.left-R.left,oe=M.left-re,Te=w.left-oe,Re=w.width+Te,Ze=Math.max(Re,R.width),gt=window.innerWidth-yr,Pt=Kp(oe,[yr,Math.max(yr,gt-Ze)]);s.style.minWidth=Re+"px",s.style.left=Pt+"px"}else{let re=R.right-k.right,oe=window.innerWidth-M.right-re,Te=window.innerWidth-w.right-oe,Re=w.width+Te,Ze=Math.max(Re,R.width),gt=window.innerWidth-yr,Pt=Kp(oe,[yr,Math.max(yr,gt-Ze)]);s.style.minWidth=Re+"px",s.style.right=Pt+"px"}let I=p(),H=window.innerHeight-yr*2,Q=g.scrollHeight,ee=window.getComputedStyle(u),X=parseInt(ee.borderTopWidth,10),z=parseInt(ee.paddingTop,10),te=parseInt(ee.borderBottomWidth,10),W=parseInt(ee.paddingBottom,10),q=X+z+Q+W+te,V=Math.min(x.offsetHeight*5,q),_e=window.getComputedStyle(g),F=parseInt(_e.paddingTop,10),he=parseInt(_e.paddingBottom,10),Z=w.top+w.height/2-yr,ae=H-Z,Se=x.offsetHeight/2,U=x.offsetTop+Se,ne=X+z+U,ue=q-ne;if(ne<=Z){let re=I.length>0&&x===I[I.length-1].ref.current;s.style.bottom="0px";let oe=u.clientHeight-g.offsetTop-g.offsetHeight,Te=Math.max(ae,Se+(re?he:0)+oe+te),Re=ne+Te;s.style.height=Re+"px"}else{let re=I.length>0&&x===I[0].ref.current;s.style.top="0px";let Te=Math.max(Z,X+g.offsetTop+(re?F:0)+Se)+ue;s.style.height=Te+"px",g.scrollTop=ne-Z+g.offsetTop}s.style.margin=`${yr}px 0`,s.style.minHeight=V+"px",s.style.maxHeight=H+"px",r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,s,u,g,x,y,o.dir,r]);xt(()=>v(),[v]);let[S,C]=J.useState();xt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);let N=J.useCallback(w=>{w&&b.current===!0&&(v(),h?.(),b.current=!1)},[v,h]);return(0,pe.jsx)(O_,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:N,children:(0,pe.jsx)("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,pe.jsx)(Oe.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});FA.displayName=T_;var M_="SelectPopperPosition",Tg=J.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:a=yr,...o}=e,i=pd(n);return(0,pe.jsx)(cA,{...i,...o,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Tg.displayName=M_;var[O_,Dg]=ul(Jo,{}),Mg="SelectViewport",GA=J.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=lo(Mg,n),i=Dg(Mg,n),s=Xe(t,o.onViewportChange),c=J.useRef(0);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,pe.jsx)(fd.Slot,{scope:n,children:(0,pe.jsx)(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Pe(a.onScroll,u=>{let f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=i;if(p?.current&&d){let m=Math.abs(c.current-f.scrollTop);if(m>0){let b=window.innerHeight-yr*2,g=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),y=Math.max(g,x);if(y<b){let h=y+m,v=Math.min(b,h),S=h-v;d.style.height=v+"px",d.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});GA.displayName=Mg;var YA="SelectGroup",[__,k_]=ul(YA),WA=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=no();return(0,pe.jsx)(__,{scope:n,id:a,children:(0,pe.jsx)(Oe.div,{role:"group","aria-labelledby":a,...r,ref:t})})});WA.displayName=YA;var QA="SelectLabel",XA=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=k_(QA,n);return(0,pe.jsx)(Oe.div,{id:a.id,...r,ref:t})});XA.displayName=QA;var dd="SelectItem",[L_,ZA]=ul(dd),JA=J.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,s=io(dd,n),c=lo(dd,n),u=s.value===r,[f,d]=J.useState(o??""),[p,m]=J.useState(!1),b=Xe(t,h=>c.itemRefCallback?.(h,r,a)),g=no(),x=J.useRef("touch"),y=()=>{a||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,pe.jsx)(L_,{scope:n,value:r,disabled:a,textId:g,isSelected:u,onItemTextChange:J.useCallback(h=>{d(v=>v||(h?.textContent??"").trim())},[]),children:(0,pe.jsx)(fd.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,pe.jsx)(Oe.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:b,onFocus:Pe(i.onFocus,()=>m(!0)),onBlur:Pe(i.onBlur,()=>m(!1)),onClick:Pe(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:Pe(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:Pe(i.onPointerDown,h=>{x.current=h.pointerType}),onPointerMove:Pe(i.onPointerMove,h=>{x.current=h.pointerType,a?c.onItemLeave?.():x.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pe(i.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Pe(i.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(b_.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});JA.displayName=dd;var Ls="SelectItemText",e1=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,i=io(Ls,n),s=lo(Ls,n),c=ZA(Ls,n),u=A_(Ls,n),[f,d]=J.useState(null),p=Xe(t,y=>d(y),c.onItemTextChange,y=>s.itemTextRefCallback?.(y,c.value,c.disabled)),m=f?.textContent,b=J.useMemo(()=>(0,pe.jsx)("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=u;return xt(()=>(g(b),()=>x(b)),[g,x,b]),(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(Oe.span,{id:c.textId,...o,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Lg.createPortal(o.children,i.valueNode):null]})});e1.displayName=Ls;var t1="SelectItemIndicator",n1=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ZA(t1,n).isSelected?(0,pe.jsx)(Oe.span,{"aria-hidden":!0,...r,ref:t}):null});n1.displayName=t1;var Og="SelectScrollUpButton",D_=J.forwardRef((e,t)=>{let n=lo(Og,e.__scopeSelect),r=Dg(Og,e.__scopeSelect),[a,o]=J.useState(!1),i=Xe(t,r.onScrollButtonChange);return xt(()=>{if(n.viewport&&n.isPositioned){let c=function(){let f=u.scrollTop>0;o(f)};var s=c;let u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?(0,pe.jsx)(r1,{...e,ref:i,onAutoScroll:()=>{let{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});D_.displayName=Og;var _g="SelectScrollDownButton",z_=J.forwardRef((e,t)=>{let n=lo(_g,e.__scopeSelect),r=Dg(_g,e.__scopeSelect),[a,o]=J.useState(!1),i=Xe(t,r.onScrollButtonChange);return xt(()=>{if(n.viewport&&n.isPositioned){let c=function(){let f=u.scrollHeight-u.clientHeight,d=Math.ceil(u.scrollTop)<f;o(d)};var s=c;let u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?(0,pe.jsx)(r1,{...e,ref:i,onAutoScroll:()=>{let{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});z_.displayName=_g;var r1=J.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=lo("SelectScrollButton",n),i=J.useRef(null),s=md(n),c=J.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return J.useEffect(()=>()=>c(),[c]),xt(()=>{s().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,pe.jsx)(Oe.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Pe(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Pe(a.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Pe(a.onPointerLeave,()=>{c()})})}),B_="SelectSeparator",I_=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,pe.jsx)(Oe.div,{"aria-hidden":!0,...r,ref:t})});I_.displayName=B_;var kg="SelectArrow",U_=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=pd(n),o=io(kg,n),i=lo(kg,n);return o.open&&i.position==="popper"?(0,pe.jsx)(uA,{...a,...r,ref:t}):null});U_.displayName=kg;var j_="SelectBubbleInput",a1=J.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let a=J.useRef(null),o=Xe(r,a),i=Lu(t);return J.useEffect(()=>{let s=a.current;if(!s)return;let c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){let d=new Event("change",{bubbles:!0});f.call(s,t),s.dispatchEvent(d)}},[i,t]),(0,pe.jsx)(Oe.select,{...n,style:{...fg,...n.style},ref:o,defaultValue:t})});a1.displayName=j_;function o1(e){return e===""||e===void 0}function i1(e){let t=bn(e),n=J.useRef(""),r=J.useRef(0),a=J.useCallback(i=>{let s=n.current+i;t(s),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(s)},[t]),o=J.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return J.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function l1(e,t,n){let a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1,i=P_(e,Math.max(o,0));a.length===1&&(i=i.filter(u=>u!==n));let c=i.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function P_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var s1=BA,c1=UA,u1=PA,d1=VA,f1=HA,m1=qA,p1=GA,g1=WA,h1=XA,y1=JA,v1=e1,b1=n1;function x1(e){return String(e||"").trim().toLowerCase()}function gd(e){return x1(e).length>0}function S1({searchEnabled:e=!0}={}){return!!e}function zg(e){let t=String(e?.key||"");return!t||t.length!==1||e?.ctrlKey||e?.metaKey||e?.altKey?"":t.trim()?t:""}function w1(e={},t=""){let n=x1(t);return n?[e?.label,e?.value,e?.hint,e?.textValue,e?.searchText].map(a=>String(a||"").toLowerCase()).join(" ").includes(n):!0}var hd=K(xe(),1),H_=12;function Bg(e){return/auto|scroll|hidden|clip|overlay/.test(String(e||"").toLowerCase())}function q_(e,t){return{top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)}}function yd(e){if(typeof window>"u")return[];let t=[],n=e?.parentElement||null;for(;n&&n!==document.body&&n!==document.documentElement;){let r=window.getComputedStyle(n);(Bg(r.overflow)||Bg(r.overflowY)||Bg(r.overflowX))&&t.push(n),n=n.parentElement}return t}function $_(e,{viewportPadding:t=H_}={}){if(typeof window>"u")return null;let n={top:t,right:window.innerWidth-t,bottom:window.innerHeight-t,left:t};for(let r of yd(e))n=q_(n,r.getBoundingClientRect());return n}function K_({anchorRect:e,boundaryRect:t,preferredSide:n="bottom",offset:r=4,desiredHeight:a=288}={}){if(!e||!t)return{side:n==="top"?"top":"bottom",maxHeight:a};let o=Math.max(0,e.top-t.top-r),i=Math.max(0,t.bottom-e.bottom-r),c=o===i?n==="top"?"top":"bottom":o>i?"top":"bottom",u=Math.max(0,Math.min(a,c==="top"?o:i));return{side:c,maxHeight:u}}function vd({open:e=!1,anchorRef:t,preferredSide:n="bottom",offset:r=4,desiredHeight:a=288}={}){let[o,i]=(0,hd.useState)(()=>({side:n==="top"?"top":"bottom",maxHeight:a}));return(0,hd.useLayoutEffect)(()=>{if(!e||typeof window>"u")return;let s=t?.current||null;if(!s){i({side:n==="top"?"top":"bottom",maxHeight:a});return}let c=()=>{i(K_({anchorRect:s.getBoundingClientRect(),boundaryRect:$_(s),preferredSide:n,offset:r,desiredHeight:a}))};c();let u=yd(s);window.addEventListener("resize",c);for(let d of u)d.addEventListener("scroll",c,{passive:!0});let f=null;if(typeof ResizeObserver=="function"){f=new ResizeObserver(c),f.observe(s);for(let d of u)f.observe(d)}return()=>{window.removeEventListener("resize",c);for(let d of u)d.removeEventListener("scroll",c);f?.disconnect?.()}},[e,t,n,r,a]),o}var zt=K(Be(),1),xd=(0,Ue.createContext)(null),F_="Enter character to filter",G_=41,Y_="data-llm-router-select-search-input";function bd(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(t=>bd(t)).filter(Boolean).join(" "):(0,Ue.isValidElement)(e)?bd(e.props?.children):""}function Ig(e,t="first"){let n=Array.from(e?.querySelectorAll?.("[role='option']")||[]).filter(o=>o.getAttribute("aria-disabled")!=="true");if(n.length===0)return;let r=n.find(o=>o.getAttribute("data-state")==="checked");(t==="last"?n[n.length-1]:r||n[0])?.focus?.()}function W_(e={}){let t=String(e.textValue||bd(e.children)||"").trim();return{value:String(e.value||""),textValue:t,searchText:String(e.searchText||"")}}function A1(e,t=""){let n=0,r=0;return{children:Ue.Children.map(e,o=>{if(!(0,Ue.isValidElement)(o))return o;if(o.type?.__LLM_ROUTER_SELECT_ITEM===!0){n+=1;let s=w1(W_(o.props),t);return s&&(r+=1),s?o:null}if(!o.props?.children)return o;let i=A1(o.props.children,t);return n+=i.totalItems,r+=i.matchedItems,o.type?.__LLM_ROUTER_SELECT_GROUP===!0&&i.matchedItems===0?null:(0,Ue.cloneElement)(o,void 0,i.children)}),totalItems:n,matchedItems:r}}function vr({open:e,defaultOpen:t=!1,onOpenChange:n,searchEnabled:r=!0,openSearchRequest:a=0,children:o,...i}){let[s,c]=(0,Ue.useState)(!!t),[u,f]=(0,Ue.useState)(""),[d,p]=(0,Ue.useState)(!1),m=(0,Ue.useRef)(null),b=(0,Ue.useRef)(0),g=e!==void 0?e:s;(0,Ue.useEffect)(()=>{g||(f(""),p(!1))},[g]);function x(h){e===void 0&&c(h),n?.(h),h||(f(""),p(!1))}(0,Ue.useEffect)(()=>{!a||a===b.current||(b.current=a,f(""),r&&p(!0),!g&&(e===void 0&&c(!0),n?.(!0)))},[a,r,g,e,n]);let y={open:g,searchEnabled:r,filterValue:u,setFilterValue:f,searchSessionActive:d,setSearchSessionActive:p,setOpen:x,triggerRef:m,openSearchRequest:a};return(0,zt.jsx)(xd.Provider,{value:y,children:(0,zt.jsx)(s1,{...i,open:g,onOpenChange:x,children:o})})}var br=(0,Ue.forwardRef)(function({className:t,children:n,onKeyDown:r,...a},o){let i=(0,Ue.useContext)(xd),s=i?.triggerRef||null,c=(0,Ue.useCallback)(f=>{if(s&&(s.current=f),typeof o=="function"){o(f);return}o&&(o.current=f)},[s,o]);function u(f){if(r?.(f),f.defaultPrevented||!i?.searchEnabled||a.disabled)return;let d=zg(f);d&&(f.preventDefault(),i.setSearchSessionActive?.(!0),i.setOpen(!0),i.setFilterValue(p=>`${p}${d}`))}return(0,zt.jsxs)(c1,{ref:c,className:Y("relative inline-flex h-9 w-full items-center gap-2 rounded-lg border border-input bg-background/80 pl-3 pr-9 text-sm text-foreground shadow-sm outline-none transition focus:border-ring focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",t),onKeyDown:u,...a,children:[(0,zt.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",children:n}),(0,zt.jsx)(d1,{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"\u25BE"})]})});function xr(e){return(0,zt.jsx)(u1,{...e})}var Sr=(0,Ue.forwardRef)(function({className:t,children:n,position:r="popper",onKeyDownCapture:a,searchPlaceholder:o=F_,emptySearchMessage:i="No matching options.",...s},c){let u=(0,Ue.useContext)(xd),f=(0,Ue.useRef)(null),d=(0,Ue.useRef)(null),p=vd({open:!!u?.open,anchorRef:u?.triggerRef,preferredSide:"bottom",desiredHeight:288,offset:4}),m=S1({searchEnabled:u?.searchEnabled,filterValue:u?.filterValue,sessionActive:u?.searchSessionActive}),b=(0,Ue.useMemo)(()=>gd(u?.filterValue)?A1(n,u?.filterValue):{children:n,totalItems:0,matchedItems:0},[n,u?.filterValue]),g=gd(u?.filterValue)&&b.totalItems>0&&b.matchedItems===0,x=Math.max(0,Math.floor((p.maxHeight||288)-(m?G_:0)));(0,Ue.useEffect)(()=>{if(!u?.open||!m||typeof window>"u")return;let S=window.requestAnimationFrame(()=>{let C=d.current;if(!C)return;C.focus();let N=C.value.length;C.setSelectionRange(N,N)});return()=>window.cancelAnimationFrame(S)},[u?.open,m,u?.openSearchRequest]);let y=(0,Ue.useCallback)(S=>{if(f.current=S,typeof c=="function"){c(S);return}c&&(c.current=S)},[c]);function h(S){if(a?.(S),S.defaultPrevented||S.target===d.current||!u?.searchEnabled)return;let C=zg(S);C&&(S.preventDefault(),S.stopPropagation(),u.setSearchSessionActive?.(!0),u.setFilterValue(N=>`${N}${C}`))}function v(S){let C=S.target.value;u?.setSearchSessionActive?.(!0),u?.setFilterValue(C)}return(0,zt.jsx)(f1,{children:(0,zt.jsxs)(m1,{ref:y,position:r,side:r==="popper"?p.side:void 0,className:Y("z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border/70 bg-popover text-popover-foreground shadow-lg",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",t),onKeyDownCapture:h,...s,children:[m?(0,zt.jsx)("div",{className:"border-b border-border/70 p-1",children:(0,zt.jsx)(Kt,{ref:d,"data-llm-router-select-search-input":"true",value:u?.filterValue||"",autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,placeholder:o,className:"h-8 border-border/70 bg-background/90",onChange:v,onPointerDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),onKeyDown:S=>{if(S.stopPropagation(),S.key==="ArrowDown"){S.preventDefault(),Ig(f.current,"first");return}if(S.key==="ArrowUp"){S.preventDefault(),Ig(f.current,"last");return}S.key==="Escape"&&(S.preventDefault(),u?.setSearchSessionActive?.(!1),u?.setFilterValue(""),typeof window<"u"&&window.requestAnimationFrame(()=>Ig(f.current)))}})}):null,(0,zt.jsxs)(p1,{className:"px-1 pb-1",style:{maxHeight:`${x}px`},children:[gd(u?.filterValue)?b.children:n,g?(0,zt.jsx)("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:i}):null]})]})})}),ar=(0,Ue.forwardRef)(function({className:t,children:n,searchText:r="",textValue:a,onPointerMove:o,...i},s){let c=(0,Ue.useContext)(xd),u=String(a||bd(n)||"").trim();function f(d){if(o?.(d),d.defaultPrevented||!c?.searchEnabled||typeof document>"u")return;let p=document.activeElement;p instanceof HTMLElement&&p.getAttribute(Y_)==="true"&&d.preventDefault()}return(0,zt.jsxs)(y1,{ref:s,className:Y("relative flex w-full cursor-default select-none items-center rounded-lg py-2 pl-3 pr-8 text-sm text-foreground outline-none transition-colors hover:bg-accent/60 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),textValue:u,onPointerMove:f,...i,children:[(0,zt.jsx)(v1,{children:n}),(0,zt.jsx)("span",{className:"absolute right-2 inline-flex h-4 w-4 items-center justify-center text-xs text-muted-foreground",children:(0,zt.jsx)(b1,{children:"\u2713"})})]})});ar.__LLM_ROUTER_SELECT_ITEM=!0;function Ug(e){return(0,zt.jsx)(g1,{...e})}Ug.__LLM_ROUTER_SELECT_GROUP=!0;var C1=(0,Ue.forwardRef)(function({className:t,children:n,...r},a){return(0,zt.jsx)(h1,{ref:a,className:Y("-mt-1 sticky top-0 z-10 -mx-1 mb-1 block border-b border-border/55 bg-background/96 px-4 py-2 text-xs font-semibold uppercase tracking-[0.18em] text-foreground/80 backdrop-blur-sm",t),...r,children:n})});var or=K(xe(),1);var Q_="flex h-9 w-full rounded-lg border border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40";function X_({committedValue:e="",draftValue:t="",isFocused:n=!1,hasLocalDraft:r=!1,previousCommittedValue:a=""}={}){let o=String(e??""),i=String(t??""),s=String(a??"");return n?{draftValue:i,hasLocalDraft:r,previousCommittedValue:o}:!r||o===i?{draftValue:o,hasLocalDraft:!1,previousCommittedValue:o}:o!==s?{draftValue:o,hasLocalDraft:!1,previousCommittedValue:o}:{draftValue:i,hasLocalDraft:!0,previousCommittedValue:o}}function Z_({committedValue:e="",draftValue:t="",isFocused:n=!1,hasLocalDraft:r=!1}={}){return String(n||r?t??"":e??"")}function J_({commitOnBlur:e=!1,draftValue:t="",hasLocalDraft:n=!1}={}){return!e||!n?null:String(t??"")}var jg=(0,or.forwardRef)(function({className:t,commitOnBlur:n=!1,value:r,onValueCommit:a,onValueChange:o,onChange:i,onFocus:s,onBlur:c,...u},f){let d=String(r??""),[p,m]=(0,or.useState)(d),[b,g]=(0,or.useState)(!1),[x,y]=(0,or.useState)(!1),h=(0,or.useRef)(d);return(0,or.useEffect)(()=>{let v=X_({committedValue:d,draftValue:p,isFocused:b,hasLocalDraft:x,previousCommittedValue:h.current});h.current=v.previousCommittedValue,m(v.draftValue),y(v.hasLocalDraft)},[d,p,x,b]),(0,or.createElement)("input",{...u,ref:f,className:Y(Q_,t),value:Z_({committedValue:d,draftValue:p,isFocused:b,hasLocalDraft:x}),onFocus:v=>{g(!0),s?.(v)},onChange:v=>{let S=v.target.value;m(S),y(!0),o?.(S,v),i?.(v)},onBlur:v=>{g(!1);let S=J_({commitOnBlur:n,draftValue:p,hasLocalDraft:x});S!==null&&a?.(S,v),c?.(v)}})});var Pg=Object.freeze(["gpt-5.3-codex","gpt-5.2-codex","gpt-5.1-codex-mini"]),Vg=Object.freeze(["claude-sonnet-4-6","claude-opus-4-6","claude-haiku-4-5"]),J3=Object.freeze({authorizeUrl:"https://auth.openai.com/oauth/authorize",tokenUrl:"https://auth.openai.com/oauth/token",deviceCodeUrl:"https://auth.openai.com/oauth/device/code",callbackPort:1455,callbackPath:"/auth/callback",scopes:"openid profile email offline_access",clientId:"app_EMoamEEZ73f0CkXaXp7hrann",authorizeParams:Object.freeze({id_token_add_organizations:"true",codex_cli_simplified_flow:"true",originator:"codex_cli_rs"}),tokenRefreshBufferMs:300*1e3}),eB=Object.freeze({authorizeUrl:"https://claude.ai/oauth/authorize",tokenUrl:"https://platform.claude.com/v1/oauth/token",callbackPort:1456,callbackPath:"/callback",manualRedirectUrl:"https://platform.claude.com/oauth/code/callback",scopes:"user:profile user:inference user:sessions:claude_code user:mcp_servers",clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",authorizeParams:Object.freeze({code:"true"}),oauthBeta:"oauth-2025-04-20",apiBaseUrl:"https://api.anthropic.com",messagesPath:"/v1/messages?beta=true",tokenRefreshBufferMs:300*1e3});var tk="127.0.0.1";var Ds=`http://${tk}:8376`,nB=`${Ds}/openai/v1`,rB=`${Ds}/anthropic`,aB=Object.freeze({enabled:!0});var at="default",nk="AICodeClient",rk="1.0.0",uB=ok();var dB=Object.freeze({CHATGPT_CODEX:"chatgpt-codex",CLAUDE_CODE:"claude-code"});function ak(){if(typeof process>"u"||!process)return{runtime:"runtime/unknown",platform:"unknown",arch:"unknown"};let e=process?.versions?.node?String(process.versions.node):"",t=e?`node/${e}`:"runtime/unknown",n=process?.platform?String(process.platform):"unknown",r=process?.arch?String(process.arch):"unknown";return{runtime:t,platform:n,arch:r}}function ok(){let{runtime:e,platform:t,arch:n}=ak();return`${nk}/${rk} (${t}; ${n}) ${e}`}var fB=Object.freeze(["brave","tavily","exa","searxng"]),mB=Object.freeze({brave:1e3,tavily:1e3,exa:1e3,searxng:0});var Sd=Object.freeze([Object.freeze({id:"@anthropic-opus",description:"Anthropic Opus family used by AMP smart-like flows.",match:[{vendor:"anthropic",family:"opus",variantAbsent:!0}],defaultMatch:"claude-opus-{number}"}),Object.freeze({id:"@anthropic-sonnet",description:"Anthropic Sonnet family used by AMP librarian-like flows.",match:[{vendor:"anthropic",family:"sonnet",variantAbsent:!0}],defaultMatch:"claude-sonnet-{number}"}),Object.freeze({id:"@anthropic-haiku-shared",description:"Anthropic Haiku family shared by AMP rush/title-like flows.",match:[{vendor:"anthropic",family:"haiku",variantAbsent:!0}],defaultMatch:"claude-haiku-{number}"}),Object.freeze({id:"@openai-gpt-base",description:"Base GPT family currently observed for AMP Oracle-like flows.",match:[{vendor:"openai",family:"gpt",variantAbsent:!0}],defaultMatch:"gpt-{number}"}),Object.freeze({id:"@openai-gpt-codex",description:"OpenAI GPT Codex family used by AMP deep-like flows.",match:[{vendor:"openai",family:"gpt",variantPrefix:"codex"},"gpt-*-codex*"],defaultMatch:"gpt-*-codex*"}),Object.freeze({id:"@google-gemini-pro",description:"Google Gemini Pro family used by AMP review-like flows.",match:[{vendor:"google",family:"gemini",variant:"pro"},"gemini-*-pro*"],defaultMatch:"gemini-*-pro*"}),Object.freeze({id:"@google-gemini-pro-image",description:"Google Gemini image family used by AMP painter-like flows.",match:["gemini-3-pro-image","gemini-3-pro-image*","gemini-*-image*"],defaultMatch:"gemini-*-image*"}),Object.freeze({id:"@google-gemini-flash-shared",description:"Google Gemini Flash family shared by AMP search/look-at/handoff-like flows.",match:[{vendor:"google",family:"gemini",variantPrefix:"flash"},"gemini-*-flash*"],defaultMatch:"gemini-*-flash*"})]),zs=Object.freeze([Object.freeze({id:"smart",type:"mode",description:"Unconstrained state-of-the-art model use",signatures:["@anthropic-opus"]}),Object.freeze({id:"rush",type:"mode",description:"Faster and cheaper, for small well-defined tasks",signatures:["@anthropic-haiku-shared"]}),Object.freeze({id:"deep",type:"mode",description:"Deep reasoning with extended thinking",signatures:["@openai-gpt-codex"]}),Object.freeze({id:"review",type:"feature",description:"Bug identification and code review assistance",signatures:["@google-gemini-pro"]}),Object.freeze({id:"search",type:"agent",description:"Fast, accurate codebase retrieval",signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"oracle",type:"agent",description:"Complex reasoning and planning on code",signatures:["@openai-gpt-base"]}),Object.freeze({id:"librarian",type:"agent",description:"Large-scale retrieval and research on external code",signatures:["@anthropic-sonnet"]}),Object.freeze({id:"look-at",type:"system",description:"Image, PDF, and media file analysis",aliases:["look at","lookat"],signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"painter",type:"system",description:"Image generation and editing",signatures:["@google-gemini-pro-image"]}),Object.freeze({id:"handoff",type:"system",description:"Fallback context analysis for task continuation",signatures:["@google-gemini-flash-shared"]}),Object.freeze({id:"title",type:"system",description:"Fast title generation for threads",aliases:["titling"],signatures:["@anthropic-haiku-shared"]})]),pB=Object.freeze([Object.freeze({id:"oracle",patterns:["/^gpt-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"librarian",patterns:["/^(?:claude-)?sonnet-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"title",patterns:["/^(?:claude-)?haiku-\\d+(?:\\.\\d+)?$/"]}),Object.freeze({id:"painter",patterns:["gemini-3-pro-image","gemini-3-pro-image*"]}),Object.freeze({id:"search",patterns:["gemini-2.5-flash","gemini-2.5-flash*","gemini-3-flash","gemini-3-flash*"]}),Object.freeze({id:"look-at",patterns:["gemini-2.5-flash","gemini-2.5-flash*","gemini-3-flash","gemini-3-flash*"]}),Object.freeze({id:"handoff",patterns:["gemini-3-flash","gemini-3-flash*"]})]);var Hg=["second","minute","hour","day","week","month"];function Br(e,t=0){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}function ei(e,t=""){let n=String(e||"").trim().toLowerCase();return Hg.includes(n)?n:t}function R1(e,t=1){let n=String(e||"").trim().toLowerCase().replace(/s$/,"");return n?Number(t)===1?n:`${n}s`:"windows"}function Ir(e=[]){let t=[],n=new Set;for(let r of Array.isArray(e)?e:[e]){let a=String(r||"").trim();if(a){if(a.toLowerCase()==="all")return["all"];n.has(a)||(n.add(a),t.push(a))}}return t}function Bs({requests:e,windowValue:t,windowUnit:n}){let r=Br(e,0),a=Br(t,0),o=ei(n,"");return!r||!a||!o?"":`${r}-req-per-${a}-${R1(o,a)}`}function E1(e={}){let t=Br(e?.requests??e?.limit,0),n=Br(e?.window?.size??e?.window?.value??e?.windowValue,0),r=ei(e?.window?.unit??e?.windowUnit,"");return!t||!n||!r?"Unconfigured":`${t}/${n} ${R1(r,n)}`}function ti(e=[],{knownModelIds:t=[],requireAtLeastOne:n=!0}={}){let r=Array.isArray(e)?e:[];if(n&&r.length===0)return"Add at least one rate-limit entity.";let a=new Set((t||[]).map(i=>String(i||"").trim()).filter(Boolean)),o=new Set;for(let i of r){let s=Ir(i?.models||[]);if(a.size>0&&s.some(p=>p!=="all"&&!a.has(p)))return"Rate-limit model selectors must match the provider model ids.";let c=Br(i?.requests,0);if(!c)return"Rate-limit requests must be a positive integer.";let u=Br(i?.windowValue,0);if(!u)return"Rate-limit window size must be a positive integer.";let f=ei(i?.windowUnit,"");if(!f)return"Rate-limit window unit is invalid.";let d=Bs({requests:c,windowValue:u,windowUnit:f});if(o.has(d))return"Duplicate rate-limit entities are not allowed.";o.add(d)}return""}function Is(e=[],{existingBucketsBySourceId:t=new Map,fallbackRequests:n=60,fallbackWindowValue:r=1,fallbackWindowUnit:a="minute"}={}){return(Array.isArray(e)?e:[]).map((o,i)=>{let s=String(o?.sourceId||"").trim(),c=s&&t instanceof Map&&t.has(s)?structuredClone(t.get(s)):{},u=Br(o?.requests,Br(c?.requests??c?.limit,n)),f=Br(o?.windowValue,Br(c?.window?.size??c?.window?.value,r)),d=ei(o?.windowUnit,ei(c?.window?.unit,a)||a),p=Ir(o?.models||[]),m=p.length>0?p:["all"],b={...c,id:Bs({requests:u,windowValue:f,windowUnit:d})||`rate-limit-${i+1}`,models:m,requests:u,window:{...c?.window&&typeof c.window=="object"&&!Array.isArray(c.window)?c.window:{},size:f,unit:d}};return delete b.name,delete b.limit,b.window&&typeof b.window=="object"&&delete b.window.value,b})}function Us(e){return JSON.parse(JSON.stringify(e??{}))}function wd(e=[]){let t=new Set,n=[];for(let r of e){let a=String(r||"").trim();!a||t.has(a)||(t.add(a),n.push(a))}return n}function T1(e){let t=String(e||"").trim();return t?t.startsWith("alias:")?t.slice(6).trim():t:""}function ik(e={},t={}){let n=t?.[at];if(n&&typeof n=="object"&&!Array.isArray(n))return{...n,id:at,strategy:String(n.strategy||"ordered").trim()||"ordered",targets:Cn(n.targets||[],o=>o),fallbackTargets:Cn(n.fallbackTargets||[],o=>o)};let r=String(e?.defaultModel||"").trim();if(!r||r==="smart")return{id:at,strategy:"ordered",targets:[],fallbackTargets:[]};let a=T1(r);if(a&&t?.[a]){let o=t[a];return{...o,id:at,strategy:String(o.strategy||"ordered").trim()||"ordered",targets:Cn(o.targets||[],i=>i),fallbackTargets:Cn(o.fallbackTargets||[],i=>i)}}return{id:at,strategy:"ordered",targets:r?[{ref:r}]:[],fallbackTargets:[]}}function lk(e={}){return(!e.modelAliases||typeof e.modelAliases!="object"||Array.isArray(e.modelAliases))&&(e.modelAliases={}),e.modelAliases[at]=ik(e,e.modelAliases),e}function sk(e={}){let t=new Set;for(let n of Object.keys(e?.modelAliases||{})){let r=String(n||"").trim();r&&t.add(r)}for(let n of e?.providers||[]){let r=String(n?.id||"").trim();if(r)for(let a of n?.models||[]){let o=String(a?.id||"").trim();o&&t.add(`${r}/${o}`)}}return t}function ck(e={}){let t=Object.keys(e?.modelAliases||{}).map(n=>String(n||"").trim()).filter(Boolean);if(t.includes(at))return at;if(t.length>0)return t[0];for(let n of e?.providers||[]){let r=String(n?.id||"").trim();if(r)for(let a of n?.models||[]){let o=String(a?.id||"").trim();if(o)return`${r}/${o}`}}return""}function Ad(e={}){lk(e);let t=sk(e);if(e.defaultModel=at,!e.amp||typeof e.amp!="object"||Array.isArray(e.amp))return e;let n=String(e.amp.defaultRoute||"").trim();if(!n||!t.has(T1(n))){let r=String(e.defaultModel||"").trim()||ck(e);r?e.amp.defaultRoute=r:delete e.amp.defaultRoute}return e}function dl(e,t,n,r){let a=String(e||"").trim();if(!a)return"";let o=`${t}/`;if(!a.startsWith(o))return a;let i=a.slice(o.length),s=n.get(i)||i;return r.has(s)?`${t}/${s}`:""}function fl(e,t,n=""){let r=String(e||"").trim();if(!r)return"";let a=`${t}/`;return r.startsWith(a)?n?`${n}/${r.slice(a.length)}`:"":r}function M1(e=[]){return wd(Array.isArray(e)?e:[e])}function uk(e={},t={}){let n={...e};if(!Object.prototype.hasOwnProperty.call(t||{},"credentialInput"))return n;let a=String(t?.credentialInput||"").trim();return delete n.apiKey,delete n.apiKeyEnv,delete n.credential,a?/^[A-Z][A-Z0-9_]*$/.test(a)?(n.apiKeyEnv=a,n):(n.apiKey=a,n):n}function dk(e={},t=[]){let n={...e},r=M1(t),a=String(r[0]||"").trim(),o=n.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?{...n.metadata}:null,i=r.length>1||!!(o&&Object.prototype.hasOwnProperty.call(o,"endpointCandidates"));if(!a)delete n.baseUrl,delete n.baseUrlByFormat,o&&Object.prototype.hasOwnProperty.call(o,"endpointCandidates")&&delete o.endpointCandidates;else{n.baseUrl=a;let s=n.baseUrlByFormat&&typeof n.baseUrlByFormat=="object"&&!Array.isArray(n.baseUrlByFormat)?n.baseUrlByFormat:null;s&&Object.keys(s).length>0&&(n.baseUrlByFormat=Object.fromEntries(Object.keys(s).map(c=>[c,a]))),i&&(o=o||{},o.endpointCandidates=r)}return o&&Object.keys(o).length>0?n.metadata=o:o&&delete n.metadata,n}function fk(e={}){return e?.rateLimitLimit!==void 0||e?.rateLimitWindowValue!==void 0||e?.rateLimitWindowUnit!==void 0?[{sourceId:String(e?.rateLimitSourceId||"").trim(),models:["all"],requests:e?.rateLimitLimit,windowValue:e?.rateLimitWindowValue,windowUnit:e?.rateLimitWindowUnit}]:[]}function mk(e={},t={},n=""){let r={...e},a=Array.isArray(r.rateLimits)?r.rateLimits.map(d=>d&&typeof d=="object"?Us(d):d).filter(Boolean):[],o=Array.isArray(t?.rateLimitRows)?t.rateLimitRows:fk(t),i=a[0]&&typeof a[0]=="object"?a[0]:null,s=Number(i?.requests??i?.limit)||60,c=Number(i?.window?.size??i?.window?.value)||1,u=String(i?.window?.unit||"minute").trim()||"minute",f=new Map(a.map(d=>[String(d?.id||"").trim(),d]).filter(([d])=>!!d));return r.rateLimits=Is(o,{existingBucketsBySourceId:f,fallbackRequests:s,fallbackWindowValue:c,fallbackWindowUnit:u}),r}function Ur(e,t,n=""){let r=String(e||"").trim();return r?r===t?n:r===`alias:${t}`?n?`alias:${n}`:"":r:""}function Cn(e=[],t){let n=new Set,r=[];for(let a of Array.isArray(e)?e:[]){let o=String(a?.ref||"").trim();if(!o)continue;let i=String(t(o)||"").trim();!i||n.has(i)||(n.add(i),r.push({...a,ref:i}))}return r}function js(e={},t){if(!e?.amp||typeof e.amp!="object"||Array.isArray(e.amp))return e;let n=e.amp,r={};for(let[a,o]of Object.entries(n.routes&&typeof n.routes=="object"&&!Array.isArray(n.routes)?n.routes:{})){let i=String(t(o)||"").trim();i&&(r[a]=i)}return n.routes=r,n.rawModelRoutes=(Array.isArray(n.rawModelRoutes)?n.rawModelRoutes:[]).map(a=>{if(!a||typeof a!="object")return null;if(!Object.prototype.hasOwnProperty.call(a,"to"))return{...a};let o=String(t(a.to)||"").trim();return o?{...a,to:o}:null}).filter(Boolean),e}function O1(e={}){let t=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{},n={};for(let[r,a]of Object.entries(t)){let o=Cn(a?.targets||[],s=>s),i=Cn(a?.fallbackTargets||[],s=>s);n[r]={...a,targets:o,fallbackTargets:i}}return e.modelAliases=n,js(e,r=>r),Ad(e)}function pk(e=[]){let t=new Set,n=[];for(let r of Array.isArray(e)?e:[]){let a=String(r?.id||"").trim(),o=String(r?.sourceId||r?.originalId||"").trim();if(!a||t.has(a))continue;t.add(a);let i=Number.parseInt(String(r?.contextWindow||"").trim(),10);n.push({id:a,sourceId:o,contextWindow:Number.isFinite(i)&&i>0?i:null})}return n}function N1(e=[]){let t=new Set,n=[];for(let r of Array.isArray(e)?e:[]){let a=String(r?.ref||"").trim(),o=String(r?.sourceRef||r?.originalRef||"").trim(),i=String(r?.weight??"").trim(),s=Math.floor(Number(i));!a||t.has(a)||(t.add(a),n.push({ref:a,sourceRef:o,...i?{weight:Number.isFinite(s)&&s>0?s:1}:{}}))}return n}function qg(e={},t,n=[]){let r=Us(e),a=Array.isArray(r.providers)?r.providers:[],o=a.findIndex(x=>x?.id===t);if(o===-1)return r;let i=a[o],s=Array.isArray(i?.models)?i.models:[],c=new Map(s.map(x=>[String(x?.id||"").trim(),x])),u=pk(n),f=new Set,d=new Map,p=[];for(let x of u){let y=x.sourceId&&c.has(x.sourceId)&&!f.has(x.sourceId)?x.sourceId:"",h=!y&&c.has(x.id)&&!f.has(x.id)?x.id:"",v=y||h;if(v){f.add(v),v!==x.id&&d.set(v,x.id),p.push({...c.get(v),id:x.id,...x.contextWindow?{contextWindow:x.contextWindow}:{}}),x.contextWindow||delete p[p.length-1].contextWindow;continue}p.push({id:x.id,...x.contextWindow?{contextWindow:x.contextWindow}:{}})}let m=new Set(p.map(x=>String(x?.id||"").trim()).filter(Boolean));i.models=p,i.rateLimits=(Array.isArray(i.rateLimits)?i.rateLimits:[]).map(x=>{let y=Array.isArray(x?.models)?x.models:[];return{...x,models:wd(y.map(h=>{if(String(h||"").trim()==="all")return"all";let v=d.get(String(h||"").trim())||String(h||"").trim();return m.has(v)?v:""}))}}),r.providers=a.map((x,y)=>y===o?i:x).map(x=>({...x,models:(Array.isArray(x?.models)?x.models:[]).map(y=>Array.isArray(y?.fallbackModels)?{...y,fallbackModels:wd(y.fallbackModels.map(h=>dl(h,t,d,m)))}:y)}));let b=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},g={};for(let[x,y]of Object.entries(b)){let h=Cn(y?.targets||[],S=>dl(S,t,d,m)),v=Cn(y?.fallbackTargets||[],S=>dl(S,t,d,m));g[x]={...y,targets:h,fallbackTargets:v}}return r.modelAliases=g,r.defaultModel=dl(r.defaultModel,t,d,m),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=dl(r.amp.defaultRoute,t,d,m)),js(r,x=>dl(x,t,d,m)),Ad(r)}function $g(e={},t="",n={}){let r=Us(e),a=Array.isArray(r.providers)?r.providers:[],o=a.findIndex(m=>m?.id===t);if(o===-1)return r;let i=a[o]||{},s=String(n?.id||t||"").trim(),c=String(n?.name??i?.name??"").trim(),u=M1(Array.isArray(n?.endpoints)?n.endpoints:[n?.endpoint]),f=i?.type==="subscription",d=s||t,p={...i,id:d,name:c||d};if(f||(p=uk(p,n),p=dk(p,u),p=mk(p,n,d)),a[o]=p,r.providers=a.map(m=>({...m,models:(Array.isArray(m?.models)?m.models:[]).map(b=>Array.isArray(b?.fallbackModels)?{...b,fallbackModels:wd(b.fallbackModels.map(g=>fl(g,t,d)))}:b)})),d!==t){let m=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},b={};for(let[g,x]of Object.entries(m))b[g]={...x,targets:Cn(x?.targets||[],y=>fl(y,t,d)),fallbackTargets:Cn(x?.fallbackTargets||[],y=>fl(y,t,d))};r.modelAliases=b,r.defaultModel=fl(r.defaultModel,t,d),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=fl(r.amp.defaultRoute,t,d)),js(r,g=>fl(g,t,d))}return Ad(r)}function _1(e={},t="",n={}){let r=Us(e),a=r.modelAliases&&typeof r.modelAliases=="object"&&!Array.isArray(r.modelAliases)?r.modelAliases:{},o=t?a[t]:void 0,i=t===at?at:String(n?.id||t||"").trim();if(!i)return r;let s=new Map((o?.targets||[]).map(m=>[String(m?.ref||"").trim(),m])),c=new Map((o?.fallbackTargets||[]).map(m=>[String(m?.ref||"").trim(),m])),u=new Set,f=N1(n?.targets).map(m=>{let b=m.sourceRef&&s.has(m.sourceRef)&&!u.has(m.sourceRef)?m.sourceRef:s.has(m.ref)&&!u.has(m.ref)?m.ref:"";return b&&u.add(b),{...b?s.get(b):{},ref:m.ref,...m.weight!==void 0?{weight:m.weight}:{}}}),d=new Set,p=N1(n?.fallbackTargets).map(m=>{let b=m.sourceRef&&c.has(m.sourceRef)&&!d.has(m.sourceRef)?m.sourceRef:c.has(m.ref)&&!d.has(m.ref)?m.ref:"";return b&&d.add(b),{...b?c.get(b):{},ref:m.ref,...m.weight!==void 0?{weight:m.weight}:{}}});if(t&&t!==i&&delete a[t],a[i]={...o?.metadata?{metadata:o.metadata}:{},...n?.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?{metadata:n.metadata}:{},id:i,strategy:String(n?.strategy||o?.strategy||"ordered").trim()||"ordered",targets:f,fallbackTargets:p},r.modelAliases=a,t&&t!==i){for(let[m,b]of Object.entries(a))m!==i&&(b.targets=Cn(b?.targets||[],g=>Ur(g,t,i)),b.fallbackTargets=Cn(b?.fallbackTargets||[],g=>Ur(g,t,i)));r.defaultModel=Ur(r.defaultModel,t,i),r?.amp&&typeof r.amp=="object"&&!Array.isArray(r.amp)&&(r.amp.defaultRoute=Ur(r.amp.defaultRoute,t,i)),js(r,m=>Ur(m,t,i))}return O1(r)}function k1(e={},t=""){let n=Us(e),r=String(t||"").trim();if(!r)return n;let a=n.modelAliases&&typeof n.modelAliases=="object"&&!Array.isArray(n.modelAliases)?n.modelAliases:{};if(!Object.prototype.hasOwnProperty.call(a,r))return n;if(r===at)return a[r]={...a[r],id:at,strategy:String(a[r]?.strategy||"ordered").trim()||"ordered",targets:[],fallbackTargets:[]},n.modelAliases=a,Ad(n);delete a[r],n.modelAliases=a;for(let o of Object.values(a))o.targets=Cn(o?.targets||[],i=>Ur(i,r)),o.fallbackTargets=Cn(o?.fallbackTargets||[],i=>Ur(i,r));return n.defaultModel=Ur(n.defaultModel,r),n?.amp&&typeof n.amp=="object"&&!Array.isArray(n.amp)&&(n.amp.defaultRoute=Ur(n.amp.defaultRoute,r)),js(n,o=>Ur(o,r)),O1(n)}function L1(e="",t={}){return{id:String(e||t?.id||"").trim(),strategy:String(t?.strategy||"ordered").trim()||"ordered",targets:(Array.isArray(t?.targets)?t.targets:[]).map((n,r)=>({key:`target-${e||"alias"}-${r}-${String(n?.ref||"").trim()||"empty"}`,ref:String(n?.ref||"").trim(),sourceRef:String(n?.ref||"").trim(),weight:String(Number.isFinite(Number(n?.weight))&&Number(n.weight)>0?Math.floor(Number(n.weight)):1)})),fallbackTargets:(Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map((n,r)=>({key:`fallback-${e||"alias"}-${r}-${String(n?.ref||"").trim()||"empty"}`,ref:String(n?.ref||"").trim(),sourceRef:String(n?.ref||"").trim(),weight:String(Number.isFinite(Number(n?.weight))&&Number(n.weight)>0?Math.floor(Number(n.weight)):1)}))}}function D1(e={}){return(Array.isArray(e?.models)?e.models:[]).map((t,n)=>({key:`model-${e?.id||"provider"}-${n}-${String(t?.id||"").trim()||"empty"}`,id:String(t?.id||"").trim(),sourceId:String(t?.id||"").trim(),contextWindow:Number.isFinite(t?.contextWindow)?String(Math.floor(Number(t.contextWindow))):""}))}var Kg="__codex_cli_inherit__",xB=Object.freeze(["minimal","low","medium","high","xhigh"]),gk=Object.freeze(["low","medium","high","max"]),SB=Object.freeze({low:4096,medium:12e3,high:24e3,max:31999});function Fg(e){return String(e||"").trim()===Kg}function hk(e){let t=String(e||"").trim().toLowerCase();return gk.includes(t)?t:""}var z1=hk;var yk=/^\d*$/;function B1(e){let t=String(e??""),n=yk.test(t);return{accepted:n,draftValue:n?t:"",shouldCommit:n&&t!=="",commitValue:n&&t!==""?t:""}}var l=K(Be(),1),Ct={"content-type":"application/json"},U1={info:"bg-sky-50 text-sky-700 ring-sky-100",success:"bg-emerald-50 text-emerald-700 ring-emerald-100",warn:"bg-amber-50 text-amber-700 ring-amber-100",error:"bg-rose-50 text-rose-700 ring-rose-100"},vk=[{value:"usage",label:"Request / response"},{value:"router",label:"LLM Router"},{value:"all",label:"All categories"}],Cd={usage:{label:"Request / response",badgeVariant:"info",emptyLabel:"request/response"},router:{label:"LLM Router",badgeVariant:"outline",emptyLabel:"LLM Router"}},bk="https://github.com/khanglvm/llm-router",xk="https://github.com/sponsors/khanglvm",ni="AICodeClient/1.0.0",Sk=3e3,Gg=4e3,wk=100,Ak=6,Od=/^[a-z][a-z0-9-]*$/,Ck=/^[A-Za-z0-9][A-Za-z0-9._:-]*$/,fC=[{value:"api",label:"API Key",description:"Test endpoint + model candidates with an API key env before saving."},{value:"oauth-gpt",label:"OAuth \xB7 GPT",description:"Use ChatGPT subscription login with GPT models."}],Wg=[{value:"auto",label:"Auto"},{value:"ordered",label:"Ordered"},{value:"round-robin",label:"Round robin"},{value:"weighted-rr",label:"Weighted RR"},{value:"quota-aware-weighted-rr",label:"Quota-aware weighted RR"}],Qg=Object.fromEntries(Wg.map(e=>[e.value,e.label])),Rk=Object.freeze([{value:"minimal",label:"Minimal",hint:"Fastest supported reasoning"},{value:"low",label:"Low",hint:"Lighter reasoning"},{value:"medium",label:"Medium",hint:"Balanced depth"},{value:"high",label:"High",hint:"Deeper reasoning"},{value:"xhigh",label:"XHigh",hint:"Model-dependent extra depth"}]),Ek=Object.freeze([{value:"low",label:"Low",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=low"},{value:"medium",label:"Medium",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=medium"},{value:"high",label:"High",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=high"},{value:"max",label:"Max",hint:"Sets CLAUDE_CODE_EFFORT_LEVEL=max"}]),j1=Hg;var Rd=Object.freeze({api:Object.freeze({openai:Object.freeze(["gpt-4o-mini","gpt-4.1-mini"]),claude:Object.freeze(["claude-3-5-sonnet","claude-3-5-haiku"])}),"oauth-gpt":Pg,"oauth-claude":Vg}),pl=Object.freeze({api:Object.freeze({limit:60,windowValue:1,windowUnit:"minute"}),oauth:Object.freeze({limit:999999,windowValue:1,windowUnit:"month"})}),P1=Object.freeze({api:Object.freeze({providerName:"My Provider",providerId:"my-provider",subscriptionProfile:""}),"oauth-gpt":Object.freeze({providerName:"ChatGPT Subscription",providerId:"chatgpt-sub",subscriptionProfile:""}),"oauth-claude":Object.freeze({providerName:"Claude Subscription",providerId:"claude-sub",subscriptionProfile:""})}),Nk=Object.freeze([{value:"ordered",label:"Ordered"},{value:"quota-balance",label:"Quota balance"}]),oh=Object.freeze([Object.freeze({id:"brave",label:"Brave",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"brv_...",defaultLimit:1e3}),Object.freeze({id:"tavily",label:"Tavily",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"tvly-...",defaultLimit:1e3}),Object.freeze({id:"exa",label:"Exa",credentialField:"apiKey",credentialLabel:"API key",credentialPlaceholder:"exa_...",defaultLimit:1e3}),Object.freeze({id:"searxng",label:"SearXNG",credentialField:"url",credentialLabel:"Base URL",credentialPlaceholder:"https://searx.example.com",defaultLimit:0})]),fo=Object.fromEntries(oh.map(e=>[e.id,e])),ri=5,_d=1,kd=20;function Xg(e){return Array.from(new Set(String(e||"").split(/[\s,]+/).map(t=>t.trim()).filter(Boolean)))}function Ks(e){let t=String(e||"").trim();if(!t)return!1;try{let n=new URL(t);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}function Hr(e=[],t=""){return Array.from(new Set([...(Array.isArray(e)?e:[]).map(n=>String(n||"").trim()).filter(Boolean),...Xg(t)]))}function mC(e=[],t,n){if(!t||!n||t===n)return e;let r=[...e],a=r.findIndex(s=>s?.key===t),o=r.findIndex(s=>s?.key===n);if(a===-1||o===-1)return e;let[i]=r.splice(a,1);return r.splice(o,0,i),r}function ih(e=[],t,n=r=>r?.key){if(!t)return e;let r=e.findIndex(i=>n(i)===t);if(r<=0)return e;let a=[...e],[o]=a.splice(r,1);return a.splice(r-1,0,o),a}function pC(e=[],t,n=r=>r?.key){if(!t)return e;let r=e.findIndex(i=>n(i)===t);if(r===-1||r>=e.length-1)return e;let a=[...e],[o]=a.splice(r,1);return a.splice(r+1,0,o),a}function V1(e,t=[]){let n=e?.getBoundingClientRect?.();return{top:Number.isFinite(n?.top)?Number(n.top):Number.NaN,left:Number.isFinite(n?.left)?Number(n.left):Number.NaN,windowX:typeof window>"u"?0:Number(window.scrollX||window.pageXOffset||0),windowY:typeof window>"u"?0:Number(window.scrollY||window.pageYOffset||0),containers:t.map(r=>({top:Number(r?.scrollTop||0),left:Number(r?.scrollLeft||0)}))}}function Tk(e,t,n=.5){return!e||!t||!Number.isFinite(t.top)||!Number.isFinite(t.left)||Math.abs(t.top-e.top)>n||Math.abs(t.left-e.left)>n||Math.abs(t.windowX-e.windowX)>n||Math.abs(t.windowY-e.windowY)>n||(e.containers?.length||0)!==(t.containers?.length||0)?!1:t.containers.every((r,a)=>{let o=e.containers[a];return o?Math.abs(r.top-o.top)<=n&&Math.abs(r.left-o.left)<=n:!1})}function H1(e){let t=String(e?.category||"").trim().toLowerCase();if(t==="usage"||t==="router")return t;let n=String(e?.source||"").trim().toLowerCase(),r=String(e?.kind||"").trim().toLowerCase();return n==="runtime"||r.startsWith("request")||r.startsWith("fallback")?"usage":"router"}var q1=["border-primary/45","bg-primary/5"];function gl(e,t){if(e?.classList){if(t){e.classList.add(...q1);return}e.classList.remove(...q1)}}function lh(e){return typeof e?.closest=="function"?e.closest("[data-reorder-row='true']"):null}function sh(e=[]){let t=(0,E.useRef)(new Map),n=(0,E.useRef)(new Map),r=(0,E.useRef)(new Map),a=(0,E.useRef)(""),o=JSON.stringify(e);return(0,E.useLayoutEffect)(()=>{let i=new Map;for(let f of e){let d=t.current.get(f);d&&i.set(f,d.getBoundingClientRect())}let s=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(a.current!==""&&a.current!==o&&!s)for(let f of e){let d=r.current.get(f),p=i.get(f),m=t.current.get(f);if(!d||!p||!m)continue;let b=d.top-p.top;Math.abs(b)<1||typeof m.animate!="function"||m.animate([{transform:`translateY(${b}px)`},{transform:"translateY(0)"}],{duration:220,easing:"cubic-bezier(0.22, 1, 0.36, 1)"})}let u=new Set(e);for(let f of n.current.keys())u.has(f)||n.current.delete(f);r.current=i,a.current=o},[o]),(0,E.useMemo)(()=>i=>(n.current.has(i)||n.current.set(i,s=>{if(s){t.current.set(i,s);return}t.current.delete(i)}),n.current.get(i)),[])}function ch({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("circle",{cx:"5",cy:"4",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"4",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"5",cy:"8",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"8",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"5",cy:"12",r:"1.25",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"11",cy:"12",r:"1.25",fill:"currentColor"})]})}function Mk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 12V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M4.75 7.25 8 4l3.25 3.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ok({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M4.75 8.75 8 12l3.25-3.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gC({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M8 3.5v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,l.jsx)("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function _k({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.28-.01-1.2-.02-2.18-3.2.69-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.71.08-.71 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.69 1.25 3.35.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.71 0-1.26.45-2.28 1.18-3.08-.12-.29-.51-1.46.11-3.05 0 0 .97-.31 3.17 1.18a10.9 10.9 0 0 1 5.77 0c2.2-1.49 3.17-1.18 3.17-1.18.62 1.59.23 2.76.11 3.05.74.8 1.18 1.82 1.18 3.08 0 4.44-2.69 5.41-5.26 5.69.41.35.78 1.05.78 2.11 0 1.52-.01 2.75-.01 3.12 0 .31.21.67.8.56A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function kk({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M12 21.3 10.9 20.3C5.4 15.3 2 12.3 2 8.5 2 5.4 4.4 3 7.5 3c1.8 0 3.5.8 4.5 2.1C13 3.8 14.7 3 16.5 3 19.6 3 22 5.4 22 8.5c0 3.8-3.4 6.8-8.9 11.8L12 21.3Z"})})}function Lk({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M6.25 4.7a.75.75 0 0 1 1.14-.64l8.1 5.05a1.05 1.05 0 0 1 0 1.78l-8.1 5.05a.75.75 0 0 1-1.14-.64V4.7Z"})})}function Dk({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:e,children:(0,l.jsx)("path",{d:"M6.25 4.5A1.25 1.25 0 0 1 7.5 3.25h.5a1.25 1.25 0 0 1 1.25 1.25v11A1.25 1.25 0 0 1 8 16.75h-.5a1.25 1.25 0 0 1-1.25-1.25v-11Zm4.5 0A1.25 1.25 0 0 1 12 3.25h.5a1.25 1.25 0 0 1 1.25 1.25v11A1.25 1.25 0 0 1 12.5 16.75H12a1.25 1.25 0 0 1-1.25-1.25v-11Z"})})}function zk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M2.75 6.5A1.75 1.75 0 0 1 4.5 4.75h3L9.4 6.4h6.1a1.75 1.75 0 0 1 1.75 1.75v6.35a1.75 1.75 0 0 1-1.75 1.75h-11A1.75 1.75 0 0 1 2.75 14.5v-8Z"}),(0,l.jsx)("path",{d:"M2.75 8h14.5"})]})}function Bk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M2.5 10s3-5.5 7.5-5.5S17.5 10 17.5 10s-3 5.5-7.5 5.5S2.5 10 2.5 10Z"}),(0,l.jsx)("circle",{cx:"10",cy:"10",r:"2.5"})]})}function Ik({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M8.15 4.85A8.5 8.5 0 0 1 10 4.5c4.5 0 7.5 5.5 7.5 5.5a12.4 12.4 0 0 1-1.67 2.28"}),(0,l.jsx)("path",{d:"M5.6 5.6A12.2 12.2 0 0 0 2.5 10s3 5.5 7.5 5.5a8.3 8.3 0 0 0 4.4-1.6"}),(0,l.jsx)("path",{d:"M8.23 8.23a2.5 2.5 0 0 0 3.54 3.54"}),(0,l.jsx)("path",{d:"M3 3l14 14"})]})}function uh({value:e,onChange:t,onValueChange:n,placeholder:r,disabled:a,isEnvVar:o,buffered:i,commitOnBlur:s,onValueCommit:c,className:u}){let[f,d]=(0,E.useState)(!1),p=!o&&!f,m=i?{value:e||"",onValueChange:n,onValueCommit:c,commitOnBlur:s,type:p?"password":"text",autoComplete:"off",placeholder:r,disabled:a,className:Y("flex h-9 w-full rounded-lg rounded-r-none border border-r-0 border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40",u)}:{value:e||"",onChange:t,type:p?"password":"text",autoComplete:"off",placeholder:r,disabled:a,className:Y("flex h-9 w-full rounded-lg rounded-r-none border border-r-0 border-input bg-background/80 px-3 py-2 text-sm text-foreground shadow-sm outline-none transition placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/40",u)};return(0,l.jsxs)("div",{className:"flex",children:[i?(0,l.jsx)(jg,{...m}):(0,l.jsx)("input",{...m}),(0,l.jsx)("button",{type:"button",tabIndex:-1,onClick:()=>d(b=>!b),disabled:a,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg rounded-l-none border border-l-0 border-input bg-background/80 text-muted-foreground transition hover:text-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50","aria-label":f?"Hide credential":"Show credential",children:f?(0,l.jsx)(Ik,{className:"h-4 w-4"}):(0,l.jsx)(Bk,{className:"h-4 w-4"})})]})}function Uk({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,l.jsx)("path",{d:"M10 3.25v5"}),(0,l.jsx)("path",{d:"M6.1 5.15a6.25 6.25 0 1 0 7.8 0"})]})}function Fs({disabled:e=!1,label:t="Move up",onClick:n}){return(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 rounded-full p-0",onMouseDown:r=>r.preventDefault(),onClick:n,disabled:e,"aria-label":t,title:t,children:(0,l.jsx)(Mk,{className:"h-3.5 w-3.5"})})}function Ld({disabled:e=!1,label:t="Move down",onClick:n}){return(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 rounded-full p-0",onMouseDown:r=>r.preventDefault(),onClick:n,disabled:e,"aria-label":t,title:t,children:(0,l.jsx)(Ok,{className:"h-3.5 w-3.5"})})}function $1({active:e=!1}){return e?(0,l.jsx)("span",{"aria-hidden":"true",className:"inline-flex h-2.5 w-2.5 rounded-full bg-emerald-500"}):null}var Dd="w-[5.5rem] justify-self-end";function dh(e){let t=String(e||"").trim().toLowerCase();return t==="automatic"||t==="smart"?"auto":t==="rr"?"round-robin":t==="weighted-round-robin"||t==="weighted_rr"?"weighted-rr":t==="quota-aware-weighted-round-robin"?"quota-aware-weighted-rr":Object.prototype.hasOwnProperty.call(Qg,t)?t:"ordered"}function hC(e){let t=dh(e);return Qg[t]||Qg.ordered}function ba(e=[]){return Array.from(new Set((e||[]).map(t=>String(t||"").trim()).filter(Boolean)))}function fh(e=[]){let t=new Set;for(let n of(e||[]).map(r=>String(r||"").trim()).filter(Boolean)){if(t.has(n))return!0;t.add(n)}return!1}function jk(e=[],t="",n=-1){let r=String(t||"").trim().toLowerCase();return r?(e||[]).some((a,o)=>o!==n&&String(a?.name||"").trim().toLowerCase()===r):!1}function Pk(){return{id:"",strategy:"auto",targets:[{ref:""}],fallbackTargets:[]}}function Vk(e="",t={},{isNew:n=!1}={}){return JSON.stringify({aliasId:n?"":String(e||"").trim(),id:String(t?.id||(n?"":e)||"").trim(),strategy:String(t?.strategy||"ordered").trim()||"ordered",targets:(Array.isArray(t?.targets)?t.targets:[]).map(r=>String(r?.ref||"").trim()),fallbackTargets:(Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map(r=>String(r?.ref||"").trim())})}function Zg(){if(typeof globalThis<"u"&&globalThis.crypto?.getRandomValues){let t=new Uint8Array(18);return globalThis.crypto.getRandomValues(t),`gw_${Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}`}return`gw_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function ml(e){return/^[A-Z][A-Z0-9_]*$/.test(String(e||"").trim())}function Vr(e){let t=String(e||"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return t?/^[a-z]/.test(t)?t:`provider-${t}`:""}function K1(e,t){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}function Ed(e={}){return ba((Array.isArray(e?.models)?e.models:[]).map(t=>t?.id))}function yC(e={},{keyPrefix:t="rate-limit",index:n=0,defaults:r=pl.api,useDefaults:a=!0}={}){let o=String(e?.sourceId||e?.id||"").trim(),i=e?.requests??e?.limit,s=e?.windowValue??e?.window?.size??e?.window?.value,c=e?.windowUnit??e?.window?.unit;return{key:String(e?.key||"").trim()||`${t}-${o||n+1}`,sourceId:o,models:Ir(Array.isArray(e?.models)?e.models:[]),modelsDraft:String(e?.modelsDraft||""),requests:i!==void 0?String(i):a?String(r.limit??""):"",windowValue:s!==void 0?String(s):a?String(r.windowValue??""):"",windowUnit:String(c!==void 0?c:a?r.windowUnit:"minute").trim()||"minute"}}function mh(e=[],{keyPrefix:t="rate-limit",defaults:n=pl.api,includeDefault:r=!0}={}){return(Array.isArray(e)&&e.length>0?e:r?[{models:["all"],requests:n.limit,window:{size:n.windowValue,unit:n.windowUnit}}]:[]).map((o,i)=>yC(o,{keyPrefix:t,index:i,defaults:n,useDefaults:!0}))}function Jg(e={}){return Ir(Hr(e?.models,e?.modelsDraft||"")).length===0&&!String(e?.requests??"").trim()&&!String(e?.windowValue??"").trim()}function xa(e=[]){return(Array.isArray(e)?e:[]).map((t,n)=>({key:String(t?.key||`rate-limit-${n+1}`).trim()||`rate-limit-${n+1}`,sourceId:String(t?.sourceId||"").trim(),models:Ir(Hr(t?.models,t?.modelsDraft||"")),requests:String(t?.requests??"").trim(),windowValue:String(t?.windowValue??"").trim(),windowUnit:ei(t?.windowUnit,"minute")})).filter((t,n)=>!Jg({...e?.[n]||{},...t}))}function F1(e=[]){return xa(e).map(t=>({sourceId:t.sourceId,models:t.models,requests:t.requests,windowValue:t.windowValue,windowUnit:t.windowUnit}))}function Hk(e=[]){let t=Array.isArray(e)?e.filter(Boolean):[];return t.length===0?"":t.length===1?E1(t[0]):`${t.length} rate limits`}function hl(e){return JSON.parse(JSON.stringify(e??{}))}function G1(e,t={}){try{let n=JSON.parse(String(e||"{}"));return n&&typeof n=="object"&&!Array.isArray(n)?n:t}catch{return t}}function zd(e=ni){return[{name:"User-Agent",value:String(e||ni)}]}function ph(e=[]){return(Array.isArray(e)?e:[]).map(t=>({name:String(t?.name||""),value:t?.value===void 0||t?.value===null?"":String(t.value)}))}function qk(e,t=ni){if(!e||typeof e!="object"||Array.isArray(e))return zd(t);let n=Object.entries(e).map(([r,a])=>({name:String(r||""),value:a==null?"":String(a)})).filter(r=>r.name.trim());return n.length>0?n:zd(t)}function gh(e=[]){let t={};for(let n of ph(e)){let r=String(n.name||"").trim();if(!r)continue;let a=r.toLowerCase()==="user-agent",o=String(n.value||"").trim();!o&&!a||(t[r]=o)}return t}function Y1(e={}){return JSON.stringify({connectionType:String(e?.connectionType||""),endpoints:Array.isArray(e?.endpoints)?e.endpoints.map(t=>String(t||"").trim()).filter(Boolean):[],apiKeyEnv:String(e?.apiKeyEnv||"").trim(),headers:gh(e?.headerRows||[])})}function yl(e,t){return String(e||"").trim().startsWith(`${t}/`)}function hh(e){let t=Object.keys(e?.modelAliases||{});if(t.includes(at))return at;if(t.length>0)return t[0];let n=(e?.providers||[]).find(r=>(r?.models||[]).length>0);return n?.models?.[0]?.id?`${n.id}/${n.models[0].id}`:void 0}function $k(e,t={}){try{let n=String(e||"").trim()?JSON.parse(e):{};return!n||typeof n!="object"||Array.isArray(n)?{value:t,parseError:"Config root must be a JSON object."}:{value:n,parseError:""}}catch(n){return{value:t,parseError:n instanceof Error?n.message:String(n)}}}function W1(e){return String(e||"").split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Q1(e){let t=String(e||"").trim();if(!t)return"";let n=Sd.find(o=>o?.id===t);if(n?.defaultMatch)return String(n.defaultMatch).trim();let r=zs.find(o=>o?.id===t);if(!r)return"";let a=[...new Set((r.signatures||[]).map(o=>Sd.find(i=>i?.id===o)?.defaultMatch).map(o=>String(o||"").trim()).filter(Boolean))];return a.length===1?a[0]:a.join(" | ")}function Kk(){return Ds}function Fk(e){let t=String(e||"").trim();return t?t.length<=10?`${t.slice(0,2)}\u2026${t.slice(-2)}`:`${t.slice(0,4)}\u2026${t.slice(-4)}`:""}function zn(e={}){let t=hl(e&&typeof e=="object"&&!Array.isArray(e)?e:{});return(!t.amp||typeof t.amp!="object"||Array.isArray(t.amp))&&(t.amp={}),(!t.amp.routes||typeof t.amp.routes!="object"||Array.isArray(t.amp.routes))&&(t.amp.routes={}),Array.isArray(t.amp.rawModelRoutes)||(t.amp.rawModelRoutes=[]),(!t.amp.overrides||typeof t.amp.overrides!="object"||Array.isArray(t.amp.overrides))&&(t.amp.overrides={}),Array.isArray(t.amp.overrides.entities)||(t.amp.overrides.entities=[]),t.amp.restrictManagementToLocalhost===void 0&&(t.amp.restrictManagementToLocalhost=!0),String(t.amp.preset||"").trim()||(t.amp.preset="builtin"),String(t.amp.defaultRoute||"").trim()||(t.amp.defaultRoute=String(t.defaultModel||hh(t)||"").trim()),t}function va(e,t=0,{min:n=0,max:r=Number.MAX_SAFE_INTEGER}={}){let a=Number.parseInt(String(e??""),10);return Number.isFinite(a)?Math.min(r,Math.max(n,a)):t}function ai(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=t.amp?.webSearch&&typeof t.amp.webSearch=="object"&&!Array.isArray(t.amp.webSearch)?hl(t.amp.webSearch):null;(!t.webSearch||typeof t.webSearch!="object"||Array.isArray(t.webSearch))&&(t.webSearch=n||{}),t.amp&&typeof t.amp=="object"&&!Array.isArray(t.amp)&&Object.prototype.hasOwnProperty.call(t.amp,"webSearch")&&delete t.amp.webSearch;let r=String(t.webSearch.strategy||"").trim();return t.webSearch.strategy=r==="quota-balance"?"quota-balance":"ordered",t.webSearch.count!==void 0&&t.webSearch.count!==null&&String(t.webSearch.count).trim()!==""?t.webSearch.count=va(t.webSearch.count,ri,{min:_d,max:kd}):delete t.webSearch.count,Array.isArray(t.webSearch.providers)||(t.webSearch.providers=[]),t.webSearch}function vC(e=""){return String(e||"").trim().includes("/")}function en(e=""){let t=String(e||"").trim();return vC(t)?t:t.toLowerCase()}function vl(e="",t=""){let n=String(e||"").trim(),r=String(t||"").trim();return!n||!r?"":`${n}/${r}`}function Gk(e={}){return[...new Set([e?.format,...Array.isArray(e?.formats)?e.formats:[]].map(t=>String(t||"").trim().toLowerCase()).filter(t=>t==="openai"||t==="claude"))]}function Yk(e={},t={}){let n=String(t?.id||"").trim(),r=n?String(e?.lastProbe?.modelPreferredFormat?.[n]||"").trim().toLowerCase():"";if(r==="openai"||r==="claude")return[r];let a=n?[...new Set((Array.isArray(e?.lastProbe?.modelSupport?.[n])?e.lastProbe.modelSupport[n]:[]).map(o=>String(o||"").trim().toLowerCase()).filter(o=>o==="openai"||o==="claude"))]:[];return a.length>0?a:[...new Set([t?.format,...Array.isArray(t?.formats)?t.formats:[]].map(o=>String(o||"").trim().toLowerCase()).filter(o=>o==="openai"||o==="claude"))]}function bC(e={}){let t=String(e?.subscriptionType||e?.subscription_type||"").trim().toLowerCase();return String(e?.type||"").trim().toLowerCase()==="subscription"?t==="chatgpt-codex":Gk(e).includes("openai")?!!String(e?.baseUrlByFormat?.openai||e?.baseUrl||"").trim():!1}function Wk(e={}){return String(e?.type||"").trim().toLowerCase()==="subscription"?String(e?.subscriptionType||e?.subscription_type||"").trim().toLowerCase()==="chatgpt-codex":String(e?.apiKey||"").trim()||String(e?.apiKeyEnv||"").trim()||String(e?.auth?.type||"").trim().toLowerCase()==="none"?!0:Object.keys(e?.headers&&typeof e.headers=="object"?e.headers:{}).some(t=>{let n=String(t||"").trim().toLowerCase();return n==="authorization"||n==="x-api-key"})}function Qk(e={},t={}){if(!bC(e))return!1;let n=Yk(e,t);return n.length===0||n.includes("openai")}function Pr(e={},t=[]){return!e||typeof e!="object"||Array.isArray(e)?!1:t.some(n=>Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==void 0&&e[n]!==null&&String(e[n]).trim()!=="")}function Hs(e={},t=""){let n=String(t||e?.id||"").trim().toLowerCase(),r=fo[n];if(!r)return null;let a=r.credentialField,o=String(e?.[a]||"").trim(),i=Pr(e,["count","resultCount","result-count","resultsPerCall","results-per-call"]),s=Pr(e,["limit","monthlyLimit","monthly-limit","quota"]),c=Pr(e,["remaining","remainingQuota","remaining-quota","remainingQueries","remaining-queries"]),u=!!o||s||c,f=u&&Number(r.defaultLimit)||0,d=va(e?.count??e?.resultCount??e?.["result-count"]??e?.resultsPerCall??e?.["results-per-call"],ri,{min:_d,max:kd}),p=va(e?.limit,f,{min:0}),m=p>0?p:0,b=va(e?.remaining,m,{min:0});return{kind:"builtin",id:n,[a]:o,...i&&d!==ri?{count:d}:{},...s||u&&p>0?{limit:p}:{},...c||u&&(p>0||b>0)?{remaining:p>0?Math.min(b,p):b}:{}}}function Xk(e={},t=""){let n=String(t||e?.id||vl(e?.providerId??e?.provider,e?.model??e?.modelId)).trim();if(!vC(n))return null;let r=String(e?.providerId??e?.provider??n.slice(0,n.indexOf("/"))).trim(),a=String(e?.model??e?.modelId??n.slice(n.indexOf("/")+1)).trim(),o=vl(r,a);return!o||o!==n?null:{kind:"hosted",id:o,providerId:r,model:a}}function Zk(e={},t=""){return Xk(e,t)||Hs(e,t)}function Jk(e={},t=new Set){return(Array.isArray(e?.providers)?e.providers:[]).map(r=>{let a=String(r?.id||"").trim();if(!a||r?.enabled===!1||!bC(r)||!Wk(r))return null;let o=(Array.isArray(r?.models)?r.models:[]).map(i=>{let s=String(i?.id||"").trim(),c=vl(a,s);return!s||!c||t.has(c)||!Qk(r,i)||!s.toLowerCase().includes("gpt")?null:{value:s,label:s,routeId:c}}).filter(Boolean);return o.length===0?null:{providerId:a,providerLabel:String(r?.name||a).trim()||a,providerHint:String(r?.subscriptionType||"").trim().toLowerCase()==="chatgpt-codex"?"ChatGPT subscription":String(r?.baseUrlByFormat?.openai||r?.baseUrl||"").trim()||"OpenAI-compatible endpoint",models:o}}).filter(Boolean)}function e2(e={},t=null){let n=zn(e),r=ai(n),a=Array.isArray(r.providers)?r.providers.map(d=>Zk(d,d?.id)).filter(Boolean):[],o=new Set(a.map(d=>en(d.id))),i=[...a,...oh.filter(d=>!o.has(d.id)).map(d=>Hs({id:d.id},d.id)).filter(Boolean)],s=Array.isArray(t?.providers)?t.providers:[],c=new Map(s.map(d=>[en(d?.id),d]).filter(([d])=>!!d)),u=new Map((Array.isArray(e?.providers)?e.providers:[]).map(d=>[String(d?.id||"").trim(),d]).filter(([d])=>!!d)),f=va(r?.count,ri,{min:_d,max:kd});return i.map(d=>{let p=en(d.id),m=c.get(p)||null,b=a.findIndex(N=>en(N.id)===p),g=i.findIndex(N=>en(N.id)===p),x=d.kind==="hosted"?m?.ready!==!1:!!d?.[fo[d.id]?.credentialField||"apiKey"];if(d.kind==="hosted"){let N=u.get(d.providerId)||null;return{id:d.id,key:d.id,kind:"hosted",label:String(N?.name||d.providerId).trim()||d.providerId,providerId:d.providerId,modelId:d.model,routeId:d.id,configured:!0,configuredIndex:b,configuredCount:a.length,displayIndex:g,displayCount:i.length,active:x,runtimeState:m}}let y=fo[d.id],h=y?.credentialField||"apiKey",v=String(d?.[h]||"").trim(),S=Pr(d,["count"]),C=va(d?.count,f,{min:_d,max:kd});return{id:d.id,key:d.id,kind:"builtin",label:y?.label||d.id,credentialField:h,credentialLabel:y?.credentialLabel||"Credential",credentialPlaceholder:y?.credentialPlaceholder||"",credentialValue:v,resultPerCall:C,resultPerCallInput:S?String(C):f!==ri?String(f):"",limit:va(d?.limit,y?.defaultLimit||0,{min:0}),remaining:va(d?.remaining,y?.defaultLimit||0,{min:0}),configured:!!v,configuredIndex:b,configuredCount:a.length,displayIndex:g,displayCount:i.length,active:x,runtimeState:m}})}function t2(e={},t={}){let n=zn(e),r=ai(n);return t.strategy!==void 0&&(r.strategy=String(t.strategy||"").trim()==="quota-balance"?"quota-balance":"ordered"),t.count!==void 0&&(r.count=va(t.count,r.count,{min:1,max:20})),n}function n2(e={},t,n={}){let r=String(t||"").trim().toLowerCase();if(!fo[r])return zn(e);let a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=i.findIndex(h=>en(h?.id)===r),c=s>=0?i[s]:null,u=Hs(c||{id:r},r)||Hs({id:r},r),d=fo[r].credentialField,p=Hs({...c&&typeof c=="object"&&!Array.isArray(c)?c:{},...u,...n,id:r,[d]:n[d]!==void 0?String(n[d]||"").trim():u?.[d]},r),m=!!String(p?.[d]||"").trim(),b=Pr(n,["count"])?!!String(n?.count||"").trim()&&Number(p?.count)!==ri:Pr(c,["count"])&&Number(p?.count)!==ri,g=m||Pr(n,["limit"])||Pr(c,["limit"]),x=m||Pr(n,["remaining"])||Pr(c,["remaining"]),y={id:r,...m?{[d]:String(p?.[d]||"").trim()}:{},...b?{count:Number(p.count)}:{},...g&&Number(p?.limit)>0?{limit:Number(p.limit)}:{},...x&&(Number(p?.limit)>0||Number(p?.remaining)>0)?{remaining:Number(p.remaining)}:{}};return s>=0?i[s]=y:i.push(y),o.providers=i,a}function r2(e={},t,n){let r=vl(t,n);if(!r)return zn(e);let a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=en(r);return i.some(c=>en(c?.id)===s)||(i.push({id:r,providerId:String(t||"").trim(),model:String(n||"").trim()}),o.providers=i),a}function a2(e={},t){let n=en(t),r=zn(e),a=ai(r),o=Array.isArray(a.providers)?a.providers.slice():[],i=o.filter(s=>en(s?.id)!==n);return i.length===o.length||(a.providers=i),r}function o2(e={},t,n="up"){let r=en(t),a=zn(e),o=ai(a),i=Array.isArray(o.providers)?o.providers.slice():[],s=new Map(i.map(g=>[en(g?.id),g]).filter(([g])=>!!g)),c=i.findIndex(g=>en(g?.id)===r);if(c!==-1){let g=n==="down"?c+1:c-1;if(g<0||g>=i.length)return a;let[x]=i.splice(c,1);return i.splice(g,0,x),o.providers=i,a}if(!fo[r])return a;let u=[...i.map(g=>en(g?.id)).filter(Boolean),...oh.map(g=>g.id).filter(g=>!s.has(g))],f=u.indexOf(r);if(f===-1)return a;let d=n==="down"?f+1:f-1;if(d<0||d>=u.length)return a;let p=u.slice(),[m]=p.splice(f,1);p.splice(d,0,m);let b=new Set(s.keys());b.add(r);for(let g of p.slice(0,d+1))fo[g]&&b.add(g);return o.providers=p.filter(g=>b.has(g)).map(g=>s.get(g)||{id:g}),a}function i2(e,t,n){let r=String(e||"").trim().toLowerCase(),a=fo[r];return!a||String(t||"").trim()!==a.credentialField?!1:!String(n||"").trim()}function X1(e={}){let t=[],n=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{};for(let a of Object.keys(n))t.push({value:a,label:a,hint:`Alias \xB7 ${(n[a]?.targets||[]).length||0} target(s)`,kind:"alias",groupKey:"aliases",groupLabel:"Aliases"});for(let a of Array.isArray(e?.providers)?e.providers:[]){let o=String(a?.id||"").trim(),i=String(a?.name||o||"provider").trim()||"provider";for(let s of Array.isArray(a?.models)?a.models:[]){let c=String(s?.id||"").trim();if(!o||!c)continue;let u=Number.isFinite(s?.contextWindow)?Number(s.contextWindow):null;t.push({value:`${o}/${c}`,label:`${o}/${c}`,hint:u?`${i} \xB7 ${qs(u)}`:i,kind:"model",providerId:o,groupKey:`provider:${o}`,groupLabel:i})}}let r=new Set;return t.filter(a=>!a?.value||r.has(a.value)?!1:(r.add(a.value),!0))}function l2(e=""){let t=String(e||"").trim();if(!t)return{};let n=t.startsWith("alias:")?t.slice(6).trim():t;if(!n.includes("/"))return{kind:"alias",groupKey:"aliases",groupLabel:"Aliases"};let r=n.indexOf("/"),a=n.slice(0,r).trim();return a?{kind:"model",providerId:a,groupKey:`provider:${a}`,groupLabel:a}:{}}function qs(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)return"Unknown";if(t>=1e3){let n=t/1e3;return`${Number.isInteger(n)?String(n):n.toFixed(1).replace(/\.0$/,"")}K`}return String(t)}function s2(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)return"";let n=[{suffix:"M",divisor:1e3*1e3},{suffix:"K",divisor:1e3}];for(let r of n){if(t<r.divisor)continue;let a=t/r.divisor;return`${a>=10?String(Math.round(a)):a.toFixed(1).replace(/\.0$/,"")}${r.suffix}`}return String(t)}function Nd(e){let t=so(e),n=Number(t);return!Number.isFinite(n)||n<=0?String(e||""):new Intl.NumberFormat().format(n)}function c2(e={}){let t=new Map;for(let n of Array.isArray(e?.providers)?e.providers:[]){let r=String(n?.id||"").trim();if(r)for(let a of Array.isArray(n?.models)?n.models:[]){let o=String(a?.id||"").trim();o&&t.set(`${r}/${o}`,{ref:`${r}/${o}`,providerId:r,providerName:String(n?.name||r).trim()||r,modelId:o,contextWindow:Number.isFinite(a?.contextWindow)?Number(a.contextWindow):null})}}return t}function u2(e="",t={}){let n=t?.modelAliases&&typeof t.modelAliases=="object"&&!Array.isArray(t.modelAliases)?t.modelAliases:{},r=c2(t),a=new Set,o=new Set,i=[],s=[];function c(m){let b=String(m||"").trim();if(!b)return;if(r.has(b)){if(o.has(b))return;o.add(b),i.push(r.get(b));return}let g=b.startsWith("alias:")?b.slice(6).trim():b;if(!g||!Object.prototype.hasOwnProperty.call(n,g)){s.includes(b)||s.push(b);return}if(a.has(g))return;a.add(g);let x=n[g];for(let y of[...x?.targets||[],...x?.fallbackTargets||[]])c(y?.ref)}c(e);let u=i.filter(m=>Number.isFinite(m?.contextWindow)),f=[...new Set(u.map(m=>m.contextWindow))].sort((m,b)=>m-b),d=f[0]??null,p=f[f.length-1]??null;return{aliasId:e,models:i,unknownRefs:s,smallestContextWindow:d,largestContextWindow:p,hasMixedContextWindows:f.length>1}}function d2(e={}){let t=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{};return Object.keys(t).map(n=>u2(n,e)).filter(n=>n.hasMixedContextWindows).sort((n,r)=>String(n.aliasId||"").localeCompare(String(r.aliasId||"")))}function Gs(e=[],t=[]){let n=[...Array.isArray(e)?e:[]],r=new Set(n.map(a=>String(a?.value||"").trim()).filter(Boolean));for(let a of(Array.isArray(t)?t:[]).map(o=>String(o||"").trim()).filter(Boolean))r.has(a)||(r.add(a),n.push({value:a,label:a,hint:"Current config",...l2(a)}));return n}function f2(e=[]){let t=[],n=new Map,r=null;for(let a of(Array.isArray(e)?e:[]).filter(Boolean)){let o=String(a?.groupKey||a?.groupLabel||"").trim(),i=String(a?.groupLabel||"").trim();if(!o){r||(r={key:"__ungrouped__",label:"",options:[]},t.push(r)),r.options.push(a);continue}let s=n.get(o);s||(s={key:o,label:i||o,options:[]},n.set(o,s),t.push(s)),s.options.push(a)}return t}function m2(e={},{includeHint:t=!1}={}){let n=String(e?.label||e?.value||"").trim()||String(e?.value||"").trim(),r=String(e?.hint||"").trim();return t&&r?`${n} \xB7 ${r}`:n}function Bd(e=[],{keyPrefix:t="select-option",includeHint:n=!1}={}){return f2(e).map((r,a)=>{let o=r.options.map(i=>(0,l.jsx)(ar,{value:i.value,searchText:`${i.label||""} ${i.value||""} ${i.hint||""} ${r.label||""}`,children:m2(i,{includeHint:n})},`${t}-${i.value}`));return r.label?(0,l.jsxs)(Ug,{children:[(0,l.jsx)(C1,{children:r.label}),o]},`${t}-group-${r.key||a}`):o})}function p2({bindingValue:e="",thinkingLevel:t="",configFilePath:n="",endpointUrl:r=""}={}){let a=String(e||"").trim(),o=String(t||"").trim(),i=String(n||"").trim(),s=String(r||"").trim(),c=Fg(a),u=c?"Mode: Inherit Codex model":a?`Mode: Pinned to ${a}`:"Mode: Choose a route",f=c?{variant:"success",title:"Inherit mode keeps Codex-native model picks intact.",body:(0,l.jsxs)(l.Fragment,{children:["Codex CLI still chooses its own model name. Create a same-name alias in the ",(0,l.jsx)("span",{className:"font-medium",children:"Alias & Fallback"})," tab so LLM Router can resolve that name to the real upstream target you want."]})}:a?{variant:"info",title:"Pinned mode forces one router target.",body:(0,l.jsxs)(l.Fragment,{children:["LLM Router writes ",(0,l.jsxs)("code",{children:["model=",a]})," into Codex CLI config. That is the simplest setup when every Codex session should use one managed route or alias."]})}:{variant:"warning",title:"Choose your model strategy before you connect.",body:(0,l.jsxs)(l.Fragment,{children:["Pick ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," if Codex should keep using its built-in model names, or pick one managed route/alias if you want a single fixed target."]})};return{title:"Codex CLI guide",description:"Quick setup for routing Codex CLI through LLM Router while keeping model routing easy to inspect and change later.",badges:[{label:u,variant:c?"success":a?"info":"outline"},{label:o?`Thinking: ${o}`:"Thinking: Codex default",variant:"outline"},{label:i?"Config file detected":"User config: ~/.codex/config.toml",variant:"outline"}],callout:f,highlights:[{eyebrow:"1. Connect",title:"Point Codex CLI at LLM Router",body:s?(0,l.jsxs)(l.Fragment,{children:["When connected, Codex sends requests to ",(0,l.jsx)("code",{children:s}),". LLM Router then handles upstream auth, alias resolution, and failover."]}):(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Codex CLI so it talks to LLM Router instead of a provider directly."]})},{eyebrow:"2. Route",title:"Choose between inherit and pinned mode",body:c?(0,l.jsxs)(l.Fragment,{children:["Keep Codex model names such as ",(0,l.jsx)("code",{children:"gpt-5.4"}),", then create matching aliases in LLM Router, for example ",(0,l.jsx)("code",{children:"gpt-5.4"})," -> ",(0,l.jsx)("code",{children:"demo/gpt-4o-mini"}),"."]}):(0,l.jsxs)(l.Fragment,{children:["Select one managed route or alias in ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," when you want every Codex request to land on the same router target."]})},{eyebrow:"3. Tune",title:"Optional reasoning control",body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"font-medium",children:"Thinking level"})," writes Codex CLI ",(0,l.jsx)("code",{children:"model_reasoning_effort"})," with the official values ",(0,l.jsx)("code",{children:"minimal"}),", ",(0,l.jsx)("code",{children:"low"}),", ",(0,l.jsx)("code",{children:"medium"}),", ",(0,l.jsx)("code",{children:"high"}),", or ",(0,l.jsx)("code",{children:"xhigh"}),"."]})}],sections:[{title:"Quick start",items:[(0,l.jsxs)(l.Fragment,{children:["Set a ",(0,l.jsx)("code",{children:"masterKey"})," in LLM Router first. The ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," button stays disabled until gateway auth is ready."]}),(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch the Codex CLI config file and router base URL."]}),c?(0,l.jsxs)(l.Fragment,{children:["Leave ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," on ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"}),", then create aliases that match the Codex model names you actually use."]}):a?(0,l.jsxs)(l.Fragment,{children:["Your current default is pinned to ",(0,l.jsx)("code",{children:a}),". Change it only when you want Codex to use a different managed route or alias."]}):(0,l.jsxs)(l.Fragment,{children:["Choose either ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," or one managed route/alias in ",(0,l.jsx)("span",{className:"font-medium",children:"Default model"})," before you start using Codex through the router."]}),(0,l.jsxs)(l.Fragment,{children:["Set ",(0,l.jsx)("span",{className:"font-medium",children:"Thinking level"})," only when you want LLM Router to write ",(0,l.jsx)("code",{children:"model_reasoning_effort"}),"; leave it unset to keep Codex CLI defaults."]})]},{title:"Choose the right model strategy",items:[(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Inherit Codex CLI model"})," when you want Codex-native model names and model-specific UI/options to remain visible."]}),(0,l.jsx)(l.Fragment,{children:"Use a fixed route or alias when your team wants one centrally managed target regardless of what Codex would otherwise choose."}),(0,l.jsx)(l.Fragment,{children:"If Codex-specific options disappear after pinning a route, switch back to inherit mode and route those same model names through aliases instead."})]},{title:"Where these settings land",items:[i?(0,l.jsxs)(l.Fragment,{children:["This page is currently managing ",(0,l.jsx)("code",{children:i}),"."]}):(0,l.jsxs)(l.Fragment,{children:["Codex CLI usually stores user settings in ",(0,l.jsx)("code",{children:"~/.codex/config.toml"}),". Trusted projects can also add overrides in ",(0,l.jsx)("code",{children:".codex/config.toml"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["The router-managed bindings in this panel map to Codex CLI ",(0,l.jsx)("code",{children:"model"})," and ",(0,l.jsx)("code",{children:"model_reasoning_effort"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Open Codex CLI Config File"})," whenever you want to inspect the exact generated config."]})]},{title:"Quick verify",items:[(0,l.jsx)(l.Fragment,{children:"Open the config file from this page and confirm the values match the mode you intended."}),(0,l.jsx)(l.Fragment,{children:"Start Codex CLI and run a small prompt. If inherit mode is on, make sure the Codex model you selected has a same-name alias in LLM Router."}),(0,l.jsxs)(l.Fragment,{children:["If requests fail after switching models, check the ",(0,l.jsx)("span",{className:"font-medium",children:"Alias & Fallback"})," tab first because the alias behind that model name may be missing or pointed at the wrong target."]})]}]}}function g2({bindings:e={},settingsFilePath:t="",endpointUrl:n=""}={}){let r=String(e?.primaryModel||"").trim(),a=String(e?.defaultOpusModel||"").trim(),o=String(e?.defaultSonnetModel||"").trim(),i=String(e?.defaultHaikuModel||"").trim(),s=String(e?.subagentModel||"").trim(),c=z1(e?.thinkingLevel),u=String(t||"").trim(),f=String(n||"").trim(),d=[r,a,o,i,s,c].filter(Boolean).length,p=r?{variant:"info",title:"Primary model override is active.",body:(0,l.jsxs)(l.Fragment,{children:["LLM Router is currently writing ",(0,l.jsxs)("code",{children:["ANTHROPIC_MODEL=",r]}),". Leave that field blank if you want Claude Code to keep choosing its own primary model."]})}:d>0?{variant:"info",title:"Only filled fields are overridden.",body:(0,l.jsx)(l.Fragment,{children:"Claude Code continues to inherit its normal defaults for every blank field. This is useful when you only want to steer alias models, subagents, or effort level through LLM Router."})}:{variant:"success",title:"Blank fields are a valid setup.",body:(0,l.jsx)(l.Fragment,{children:"You do not need to fill every binding. Leave fields empty unless you want LLM Router to override that specific Claude Code setting."})};return{title:"Claude Code guide",description:"Quick setup for routing Claude Code through LLM Router while keeping only the model and effort level overrides you actually want.",badges:[{label:d>0?`${d} override${d===1?"":"s"} active`:"No router overrides",variant:d>0?"info":"outline"},{label:c?`Effort: ${c}`:"Effort: Claude adaptive default",variant:"outline"},{label:u?"Settings file detected":"Settings scope: local/project/user",variant:"outline"}],callout:p,highlights:[{eyebrow:"1. Connect",title:"Point Claude Code at the router",body:f?(0,l.jsxs)(l.Fragment,{children:["When connected, Claude Code sends requests to ",(0,l.jsx)("code",{children:f}),". LLM Router then handles upstream auth, route selection, and failover."]}):(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Claude Code so it uses the router Anthropic endpoint instead of a provider directly."]})},{eyebrow:"2. Override",title:"Set only the bindings you need",body:(0,l.jsxs)(l.Fragment,{children:["Leave fields blank to inherit Claude Code defaults. Fill ",(0,l.jsx)("code",{children:"ANTHROPIC_MODEL"}),", the Opus/Sonnet/Haiku defaults, or ",(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"})," only when you want LLM Router to manage those values."]})},{eyebrow:"3. Effort",title:"Set thinking effort level",body:(0,l.jsxs)(l.Fragment,{children:["The ",(0,l.jsx)("span",{className:"font-medium",children:"Effort level"})," dropdown writes ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," to your shell profile. If the shell profile cannot be updated, ",(0,l.jsx)("code",{children:"effortLevel"})," is set in ",(0,l.jsx)("code",{children:"settings.json"}),' as a fallback (only "high" is supported there).']})}],sections:[{title:"Quick start",items:[(0,l.jsxs)(l.Fragment,{children:["Click ",(0,l.jsx)("span",{className:"font-medium",children:"Connect"})," to patch Claude Code toward the router and keep provider credentials centralized inside LLM Router."]}),(0,l.jsxs)(l.Fragment,{children:["Leave ",(0,l.jsx)("span",{className:"font-medium",children:"Current model override"})," empty unless you explicitly want to replace Claude Code's own main model selection."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Default Opus"}),", ",(0,l.jsx)("span",{className:"font-medium",children:"Default Sonnet"}),", and ",(0,l.jsx)("span",{className:"font-medium",children:"Default Haiku"})," when you want Claude Code's built-in alias names to resolve to managed routes or aliases."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Sub-agent model"})," when background workers or helper agents should run on a different route than the main session."]}),(0,l.jsxs)(l.Fragment,{children:["Use ",(0,l.jsx)("span",{className:"font-medium",children:"Effort level"})," to set ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," in your shell profile; leave it unset to keep Claude Code's adaptive default. The ",(0,l.jsx)("code",{children:"effortLevel"})," key in ",(0,l.jsx)("code",{children:"settings.json"}),' (only "high") acts as a fallback when the shell profile cannot be updated.']})]},{title:"What each binding controls",items:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"ANTHROPIC_MODEL"}),": overrides the main model for the active Claude Code session."]}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_OPUS_MODEL"}),", ",(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_SONNET_MODEL"}),", and ",(0,l.jsx)("code",{children:"ANTHROPIC_DEFAULT_HAIKU_MODEL"}),": remap Claude Code's built-in alias names to managed routes or aliases."]}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"}),": routes subagents and background workers to a specific managed model."]}),c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"}),": currently set to ",(0,l.jsx)("span",{className:"font-medium",children:c})," in your shell profile."]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"}),": stays unset unless you choose an effort level."]})]},{title:"Settings scope and precedence",items:[(0,l.jsxs)(l.Fragment,{children:["Claude Code settings apply in this order: ",(0,l.jsx)("code",{children:"managed-settings.json"}),", CLI arguments, ",(0,l.jsx)("code",{children:".claude/settings.local.json"}),", ",(0,l.jsx)("code",{children:".claude/settings.json"}),", then ",(0,l.jsx)("code",{children:"~/.claude/settings.json"}),"."]}),u?(0,l.jsxs)(l.Fragment,{children:["This page is currently managing ",(0,l.jsx)("code",{children:u}),"."]}):(0,l.jsx)(l.Fragment,{children:"Claude Code can read from project-local, project-shared, or user settings files depending on what exists in your environment."}),(0,l.jsx)(l.Fragment,{children:"If a value seems ignored, check whether a higher-precedence file or command-line flag is overriding it."})]},{title:"Quick verify",items:[(0,l.jsxs)(l.Fragment,{children:["Open the settings file from this page and confirm the ",(0,l.jsx)("code",{children:"env"})," block contains only the overrides you meant to set."]}),(0,l.jsxs)(l.Fragment,{children:["Launch Claude Code and test both the main session and any subagents if you changed ",(0,l.jsx)("code",{children:"CLAUDE_CODE_SUBAGENT_MODEL"}),"."]}),(0,l.jsxs)(l.Fragment,{children:["If thinking behavior is not what you expected, remember this UI writes ",(0,l.jsx)("code",{children:"CLAUDE_CODE_EFFORT_LEVEL"})," to your shell profile; clearing the field returns control to Claude Code's own default behavior."]})]}]}}function h2(){return new Set([...zs.map(e=>e.id),...Sd.map(e=>e.id)].map(e=>String(e||"").trim()).filter(Boolean))}var y2=h2();function Ys(e){return y2.has(String(e||"").trim())}function Id(e){(!e.routes||typeof e.routes!="object"||Array.isArray(e.routes))&&(e.routes={}),Array.isArray(e.rawModelRoutes)||(e.rawModelRoutes=[])}function xC(e={}){return String(e?.sourceRouteKey||"").trim()}function SC(e={}){let n=zn(e).amp;Id(n);let r=new Map,a=[];for(let[s,c]of(n.rawModelRoutes||[]).entries()){let u=xC(c);if(u&&Ys(u)){r.set(u,{mapping:c,index:s});continue}a.push({id:`raw:${s}`,source:"raw",index:s,routeKey:"",inbound:String(c?.from||"").trim(),outbound:String(c?.to||"").trim(),label:"Custom mapping",description:`Wildcard/raw match: ${String(c?.from||"").trim()||"(empty)"}`,defaultMatch:"",isCustom:!0,removable:!0})}let o=zs.map(s=>{let c=String(s.id||"").trim(),u=Q1(c),f=r.get(c)?.mapping||null;return{id:`route:${c}`,source:"route",routeKey:c,inbound:String(f?.from||u||c).trim(),outbound:String(f?.to||n.routes?.[c]||"").trim(),label:W1(c),description:s.description||"",defaultMatch:u,isCustom:!1,removable:!1}}),i=Object.entries(n.routes||{}).filter(([s])=>!zs.some(c=>c.id===s)).map(([s,c])=>{let u=String(s||"").trim(),f=Q1(u),d=Ys(u);return{id:`route:${u}`,source:"route",routeKey:u,inbound:u,outbound:String(c||"").trim(),label:d?f||u:W1(u),description:d?`Route key: ${u}`:`Custom route key: ${u}`,defaultMatch:f,isCustom:!0,removable:!0}});return[...o,...i,...a]}function yh(e,t){return SC(e).find(n=>n.id===t)||null}function Z1(e={},t,{inbound:n,outbound:r}={}){let a=zn(e),o=a.amp;Id(o);let i=yh(a,t);if(!i)return a;let s=String(n??i.inbound??"").trim(),c=String(r??i.outbound??"").trim(),u=i.source==="route"?String(i.routeKey||"").trim():"",f=u?String(i.defaultMatch||"").trim():"",d=u?o.rawModelRoutes.findIndex(b=>xC(b)===u):-1,p=u&&Ys(u),m=Ys(s)?s:u&&f&&s===f?u:"";if(i.source==="route"&&i.routeKey&&delete o.routes[i.routeKey],i.source==="raw"&&Number.isInteger(i.index)&&o.rawModelRoutes.splice(i.index,1),d>=0&&o.rawModelRoutes.splice(d,1),m)return c&&(o.routes[m]=c),a;if(p){let b=f||u;return c&&(o.routes[u]=c),s&&s!==b&&o.rawModelRoutes.push({from:s,sourceRouteKey:u}),a}return s&&c&&o.rawModelRoutes.push({from:s,to:c}),a}function v2(e={},{inbound:t,outbound:n}={}){let r=zn(e),a=r.amp;Id(a);let o=String(t||"").trim(),i=String(n||"").trim(),s=Ys(o)?o:"";return!o||!i?r:s?(a.routes[s]=i,r):(a.rawModelRoutes.push({from:o,to:i}),r)}function b2(e={},t){let n=zn(e),r=n.amp;Id(r);let a=yh(n,t);return a?.removable&&(a.source==="route"&&a.routeKey&&delete r.routes[a.routeKey],a.source==="raw"&&Number.isInteger(a.index)&&r.rawModelRoutes.splice(a.index,1)),n}function x2(e,t){let n=hl(e&&typeof e=="object"?e:{});n.providers=(Array.isArray(n.providers)?n.providers:[]).filter(i=>i?.id!==t);let r=new Set((n.providers||[]).flatMap(i=>(i.models||[]).map(s=>`${i.id}/${s.id}`))),a=n.modelAliases&&typeof n.modelAliases=="object"?n.modelAliases:{},o={};for(let[i,s]of Object.entries(a)){let c=Array.isArray(s?.targets)?s.targets.filter(f=>!yl(f?.ref,t)):[],u=Array.isArray(s?.fallbackTargets)?s.fallbackTargets.filter(f=>!yl(f?.ref,t)):[];o[i]={...s,...Array.isArray(s?.targets)?{targets:c}:{},...Array.isArray(s?.fallbackTargets)?{fallbackTargets:u}:{}}}return n.modelAliases=o,n.defaultModel&&!n.modelAliases?.[n.defaultModel]&&!r.has(n.defaultModel)&&(n.defaultModel=at),n?.amp?.defaultRoute&&!n.modelAliases?.[n.amp.defaultRoute]&&!r.has(n.amp.defaultRoute)&&(n.amp={...n.amp,defaultRoute:n.defaultModel||hh(n)}),n}function bl(e={}){let t=Array.isArray(e?.metadata?.endpointCandidates)?e.metadata.endpointCandidates:[],n=[e?.baseUrl,...Object.values(e?.baseUrlByFormat||{})];return Array.from(new Set((t.length>0?t:n).map(r=>String(r||"").trim()).filter(Boolean)))}function S2(e={}){let t=String(e?.apiKeyEnv||"").trim();if(t)return{apiKeyEnv:t};let n=String(e?.apiKey||e?.credential||"").trim();return n?{apiKey:n}:{}}function J1(e={},t={}){if(e&&Object.prototype.hasOwnProperty.call(e,"credentialInput")){let n=String(e?.credentialInput||"").trim();return n?ml(n)?{apiKeyEnv:n}:{apiKey:n}:{}}return S2(t)}function uo(e={}){return e?.type==="subscription"?e?.subscriptionType==="claude-code"?"oauth-claude":"oauth-gpt":"api"}function w2(e={}){let t=bl(e),n=uo(e),r=Ud(n);return{id:String(e?.id||"").trim(),name:String(e?.name||e?.id||"").trim(),credentialInput:n==="api"?String(e?.apiKeyEnv||e?.apiKey||e?.credential||"").trim():"",endpoints:n==="api"?t:[],endpointDraft:"",rateLimitRows:n==="api"?mh(e?.rateLimits,{keyPrefix:`provider-${e?.id||"new"}-rate-limit`,defaults:r,includeDefault:!0}):[]}}function A2(e){return fC.find(t=>t.value===e)?.label||"API Key"}function wC(e,t="openai"){return e==="api"?[...Rd.api[t]||Rd.api.openai]:[...Rd[e]||Rd["oauth-gpt"]]}function Ud(e){return e==="api"?pl.api:pl.oauth}function C2(e,t,n=[]){let r=new Set((n||[]).map(o=>o?.id).filter(Boolean));if(!r.has(e))return{providerId:e,providerName:t};let a=2;for(;r.has(`${e}-${a}`);)a++;return{providerId:`${e}-${a}`,providerName:`${t} ${a}`}}function Vs(e,t="openai"){let n=P1[e]||P1.api,r=Ud(e);return{providerName:n.providerName,providerId:n.providerId,endpoints:e==="api"?[]:[],apiKeyEnv:"",subscriptionProfile:e==="api"?"":n.subscriptionProfile,modelIds:e==="api"?[]:wC(e,t),rateLimitRows:e==="api"?mh([],{keyPrefix:`quick-start-${e}-rate-limit`,defaults:r,includeDefault:!0}):[]}}function R2(e={},t="",{aliasId:n=""}={}){if(!t)return null;let r=e?.modelAliases&&typeof e.modelAliases=="object"&&!Array.isArray(e.modelAliases)?e.modelAliases:{},a=n?[[n,r[n]]]:Object.entries(r);for(let[o,i]of a){if(!i||typeof i!="object")continue;let s=Array.isArray(i?.targets)?i.targets:[],c=Array.isArray(i?.fallbackTargets)?i.fallbackTargets:[];if([...s,...c].some(u=>yl(u?.ref,t)))return{aliasId:o,alias:i}}return null}function E2(e,t="",n=[]){let r=Array.from(new Set((n||[]).map(s=>String(s||"").trim()).filter(Boolean)));if(!t||!e?.alias)return r;let a=new Set(r),o=Array.isArray(e.alias?.targets)?e.alias.targets:[],i=[];for(let s of o){let c=String(s?.ref||"").trim();if(!yl(c,t))continue;let u=c.slice(t.length+1);!a.has(u)||i.includes(u)||i.push(u)}return i.length>0?i:r}function vh(e=[],t=[]){let n=Array.from(new Set((t||[]).map(o=>String(o||"").trim()).filter(Boolean))),r=new Set(n),a=[];for(let o of(e||[]).map(i=>String(i||"").trim()).filter(Boolean))r.has(o)&&(a.push(o),r.delete(o));return[...a,...n.filter(o=>r.has(o))]}function eC(e,{fromProviderId:t,toProviderId:n,allowedModelIds:r}){if(!e||typeof e!="object")return e;let a=String(e.ref||"").trim();if(!t||!yl(a,t))return e;let o=a.slice(t.length+1);return r.has(o)?{...e,ref:`${n}/${o}`}:null}function N2(e,t){if(!e||typeof e!="object")return e;let n={...e},r=Array.isArray(e.targets),a=Array.isArray(e.fallbackTargets);return r&&(n.targets=e.targets.map(o=>eC(o,t)).filter(Boolean)),a&&(n.fallbackTargets=e.fallbackTargets.map(o=>eC(o,t)).filter(Boolean)),n}function T2(e,{fromProviderId:t,toProviderId:n,allowedModelIds:r}){let a=String(e||"").trim();if(!a||!t||!yl(a,t))return a;let o=a.slice(t.length+1);return r.has(o)?`${n}/${o}`:""}function M2(e=[]){return new Set((e||[]).flatMap(t=>(t?.models||[]).map(n=>`${t.id}/${n.id}`)))}function O2(e={},{seedMode:t="blank",targetProviderId:n="",defaultProviderUserAgent:r=ni}={}){let a=Array.isArray(e?.providers)?e.providers:[],o=n&&a.find(h=>h?.id===n)||null,i=t==="existing"||!!o,s=i?o||a[0]||{}:{},c=i?uo(s):"api",u=s?.format==="claude"?"claude":"openai",f=Vs(c,u),d=Ud(c),p=Array.isArray(s?.models)?s.models.map(h=>h?.id).filter(Boolean):[],m=String(s?.id||f.providerId||Vr(s?.name||f.providerName||"my-provider")||"my-provider"),b=i?R2(e,m,{aliasId:at}):null,g=p.length>0?p:[...f.modelIds],x=Object.fromEntries((Array.isArray(s?.models)?s.models:[]).map(h=>{let v=String(h?.id||"").trim(),S=Number(h?.contextWindow);return!v||!Number.isFinite(S)||S<=0?null:[v,Math.floor(S)]}).filter(Boolean)),y=c==="api"?qk(s?.headers,r):[];return{connectionType:c,providerName:String(s?.name||f.providerName),providerId:m,endpoints:bl(s).length>0?bl(s):f.endpoints,endpointDraft:"",apiKeyEnv:String(s?.apiKeyEnv||s?.apiKey||f.apiKeyEnv),subscriptionProfile:String(s?.subscriptionProfile||f.subscriptionProfile),modelIds:g,modelContextWindows:x,modelDraft:"",aliasModelIds:E2(b,m,g),headerRows:y,rateLimitRows:c==="api"?mh(s?.rateLimits,{keyPrefix:`quick-start-${m}-rate-limit`,defaults:d,includeDefault:!0}):[],enableAlias:!0,aliasId:at,sourceAliasId:b?.aliasId||"",useAliasAsDefault:i?!!b:!0}}function tC(e,t={},n={}){return(e||[]).map(r=>{let a=t[r],o=Number(n?.[r]);return{id:r,...a?{formats:[a]}:{},...Number.isFinite(o)&&o>0?{contextWindow:Math.floor(o)}:{}}})}function AC(e={}){let t=Vr(e?.providerId||e?.providerName||"")||"";return String(e?.subscriptionProfile||t||"default").trim()||t||"default"}function _2(e={},t,n=null,{targetProviderId:r=""}={}){let a=hl(e&&typeof e=="object"?e:{}),o=Vr(t?.providerId||t?.providerName||"my-provider")||"my-provider",i=String(t?.providerName||o).trim()||o,s=Array.isArray(t?.modelIds)?t.modelIds.map(H=>String(H||"").trim()).filter(Boolean):[],c=vh(t?.aliasModelIds,s),u=Ud(t?.connectionType),f=Array.isArray(t?.rateLimitRows)?t.rateLimitRows:[],d=f.length>0?f:[{models:["all"],requests:u.limit,windowValue:u.windowValue,windowUnit:u.windowUnit}],p=Array.isArray(e?.providers)&&e.providers.length>0,m=String(r||"").trim(),b=String(t?.sourceAliasId||"").trim(),g;if(t?.connectionType==="api"){let H=Array.isArray(t?.endpoints)?t.endpoints.map(he=>String(he||"").trim()).filter(Boolean):[],Q=Array.isArray(n?.workingFormats)?n.workingFormats.filter(Boolean):[],ee=n?.preferredFormat||Q[0]||"openai",X=n?.baseUrlByFormat&&typeof n.baseUrlByFormat=="object"?n.baseUrlByFormat:H[0]?{[ee]:H[0]}:void 0,z=ee&&X?.[ee]||X?.openai||X?.claude||H[0]||"",te=Array.isArray(n?.models)&&n.models.length>0?c.filter(he=>n.models.includes(he)):c,W=te.length>0?te:c,q=H.length>1?{endpointCandidates:H}:void 0,V=String(t?.apiKeyEnv||"").trim(),_e=ml(V)?{apiKeyEnv:V}:V?{apiKey:V}:{},F=gh(t?.headerRows||[]);g={id:o,name:i,baseUrl:z,baseUrlByFormat:X,..._e,...Object.keys(F).length>0?{headers:F}:{},format:ee,formats:Q.length>0?Q:[ee],models:tC(W,n?.modelPreferredFormat||{},t?.modelContextWindows||{}),...q?{metadata:q}:{}}}else{let H=t?.connectionType==="oauth-claude"?"claude-code":"chatgpt-codex",Q=t?.connectionType==="oauth-claude"?"claude":"openai";g={id:o,name:i,type:"subscription",subscriptionType:H,subscriptionProfile:AC(t),format:Q,formats:[Q],models:tC(c,{},t?.modelContextWindows||{})}}g.rateLimits=t?.connectionType==="api"?Is(d,{fallbackRequests:u.limit,fallbackWindowValue:u.windowValue,fallbackWindowUnit:u.windowUnit}):Is([{models:["all"],requests:u.limit,windowValue:u.windowValue,windowUnit:u.windowUnit}],{fallbackRequests:u.limit,fallbackWindowValue:u.windowValue,fallbackWindowUnit:u.windowUnit}),String(a.masterKey||"").trim()||(a.masterKey=Zg()),a.version=typeof a.version=="number"?a.version:2;let x=Array.isArray(a.providers)?a.providers:[],y=m?x.findIndex(H=>H?.id===m):-1;y===-1&&(y=x.findIndex(H=>H?.id===o)),a.providers=y===-1?[...x,g]:x.map((H,Q)=>Q===y?g:H);let h=a.modelAliases&&typeof a.modelAliases=="object"&&!Array.isArray(a.modelAliases)?a.modelAliases:{},v=new Set((g.models||[]).map(H=>H.id)),S=!p||t?.useAliasAsDefault===!0,C={};for(let[H,Q]of Object.entries(h)){let ee=m?N2(Q,{fromProviderId:m,toProviderId:o,allowedModelIds:v}):Q;C[H]=ee}let N=g.models?.[0]?.id?`${o}/${g.models[0].id}`:"",w=(c.length>0?c:(g.models||[]).map(H=>H.id)).filter(H=>v.has(H)),R=at,M=C[R]&&typeof C[R]=="object"?C[R]:{id:R,strategy:"ordered",targets:[],fallbackTargets:[]};C[R]=S?{...M,id:R,strategy:"ordered",targets:w.map(H=>({ref:`${o}/${H}`})),fallbackTargets:[]}:{...M,id:R,strategy:String(M.strategy||"ordered").trim()||"ordered",targets:Array.isArray(M.targets)?M.targets:[],fallbackTargets:Array.isArray(M.fallbackTargets)?M.fallbackTargets:[]},a.modelAliases=C;let k=M2(a.providers);a.defaultModel=at,(!a.amp||typeof a.amp!="object"||Array.isArray(a.amp))&&(a.amp={restrictManagementToLocalhost:!0,overrides:{entities:[]}}),a.amp.restrictManagementToLocalhost===void 0&&(a.amp.restrictManagementToLocalhost=!0),(!a.amp.overrides||typeof a.amp.overrides!="object"||Array.isArray(a.amp.overrides))&&(a.amp.overrides={entities:[]}),Array.isArray(a.amp.overrides.entities)||(a.amp.overrides.entities=[]);let I=String(a.amp.defaultRoute||"").trim();return m&&(I=T2(I,{fromProviderId:m,toProviderId:o,allowedModelIds:v})),(S||!I||!a.modelAliases?.[I]&&!k.has(I))&&(I=at),I&&(a.amp.defaultRoute=I),(!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata))&&(a.metadata={}),a}function CC(e={}){return(Array.isArray(e?.providers)?e.providers:[]).some(n=>{if(n?.enabled===!1)return!1;let r=Array.isArray(n?.models)?n.models.filter(o=>String(o?.id||"").trim()):[],a=Array.isArray(n?.rateLimits)?n.rateLimits:[];return r.length>0&&a.length>0})}function k2(e,t,n={},{targetProviderId:r=""}={}){let a=Vr(t?.providerId||t?.providerName||""),o=Hr(t?.modelIds,t?.modelDraft),i=vh(t?.aliasModelIds,o),s=xa(t?.rateLimitRows),c=t?.connectionType==="api"?Hr(t?.endpoints,t?.endpointDraft):[],u=Array.isArray(n?.providers)?n.providers:[],f=n?.modelAliases&&typeof n.modelAliases=="object"&&!Array.isArray(n.modelAliases)?n.modelAliases:{};if(e===0){if(!String(t?.providerName||"").trim())return"Add a provider name to continue.";if(!a||!Od.test(a))return"Provider id must start with a letter and use lowercase letters, numbers, or hyphens.";if(u.some(d=>d?.id===a&&d?.id!==r))return"Provider id already exists. Choose another id or edit that provider instead.";if(t?.connectionType==="api"){if(c.length===0)return"Add at least one endpoint to continue.";if(!String(t?.apiKeyEnv||"").trim())return"API key or env is required before testing config."}}if(e===1){if(o.length===0)return"Add at least one model id.";if(t?.connectionType==="api"){let d=ti(s,{knownModelIds:o,requireAtLeastOne:!0});if(d)return d}}return e===2&&t?.useAliasAsDefault&&Object.prototype.hasOwnProperty.call(f,String(t?.aliasId||at).trim())===!1,""}function bh(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"\u2014"}function L2(e){return e?.parseError?"danger":(e?.validationErrors||[]).length>0?"warning":"success"}function eh(e=""){let t=String(e||"Select alias").trim()||"Select alias",n=Math.min(Math.max(Math.ceil(t.length*8.5+62),160),520);if(typeof document>"u")return n;let a=(eh.canvas||(eh.canvas=document.createElement("canvas"))).getContext("2d");return a?(a.font='500 14px "Inter", "SF Pro Display", ui-sans-serif, system-ui, sans-serif',Math.min(Math.max(Math.ceil(a.measureText(t).width+62),160),520)):n}async function Ps(e){let t=String(e||"");if(!t)return;if(typeof navigator<"u"&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(t);return}if(typeof document>"u")throw new Error("Clipboard is not available in this environment.");let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}async function Tt(e,t={}){let n=await fetch(e,t),r=await n.json().catch(()=>({}));if(!n.ok){let a=new Error(r?.error||`Request failed (${n.status})`);throw a.statusCode=n.status,a.payload=r,a}return r}async function RC(e,t={},{onMessage:n}={}){let r=await fetch(e,t);if(!r.ok){let u=await r.json().catch(()=>({})),f=new Error(u?.error||`Request failed (${r.status})`);throw f.statusCode=r.status,f.payload=u,f}let a=r.body?.getReader();if(!a)return null;let o=new TextDecoder,i="",s=null;for(;;){let{value:u,done:f}=await a.read();i+=o.decode(u||new Uint8Array,{stream:!f});let d=i.indexOf(`
50
50
  `);for(;d>=0;){let p=i.slice(0,d).trim();if(i=i.slice(d+1),p){let m=JSON.parse(p);if(n?.(m),m?.type==="result"&&(s=m.result),m?.type==="error"){let b=new Error(m.error||"Request failed.");throw b.statusCode=m.statusCode||500,b}}d=i.indexOf(`
51
- `)}if(f)break}let c=i.trim();if(c){let u=JSON.parse(c);if(n?.(u),u?.type==="result"&&(s=u.result),u?.type==="error"){let f=new Error(u.error||"Request failed.");throw f.statusCode=u.statusCode||500,f}}return s}function tC(e={}){return`${String(e?.model||"").trim()}::${String(e?.contextWindow||"").trim()}`}function _2(e){return String(e||"").trim().replace(/[.,\s_'`]/g,"")}function so(e){let t=_2(e);if(!t)return"";let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>0?String(n):t}async function th(e=[]){let t=[...new Set((Array.isArray(e)?e:[]).map(r=>String(r||"").trim()).filter(Boolean))];if(t.length===0)return[];let n=await Nt("/api/config/litellm-context-lookup",{method:"POST",headers:Ct,body:JSON.stringify({models:t,limit:wk})});return Array.isArray(n?.result)?n.result:[]}function nC(e={}){let t=String(e?.model||"").trim(),n=String(e?.provider||"").trim(),r=String(e?.mode||"").trim(),a=Number(e?.contextWindow);return!Number.isFinite(a)||a<=0?null:{model:t,provider:n,mode:r,contextWindow:Math.floor(a)}}function rC(e="",t=""){let n=String(e||"").trim(),r=String(t||"").trim();if(!n||!r)return n;let a=n.toLowerCase(),o=r.toLowerCase(),i=[`${o}/`,`${o}:`];for(let s of i){if(!a.startsWith(s))continue;return n.slice(s.length).trim()||n}return n}function qs(e={},{fallbackQuery:t=""}={}){let n=String(e?.query||t||"").trim(),r=nC(e?.exactMatch),a=(Array.isArray(e?.suggestions)?e.suggestions:[]).map(f=>nC(f)).filter(Boolean),o=Number(e?.medianContextWindow),i=Number.isFinite(o)&&o>0?Math.floor(o):r?.contextWindow||null,s=[],c=new Set;function u(f){!f?.key||c.has(f.key)||(c.add(f.key),s.push(f))}r&&u({key:`exact::${tC(r)}`,label:rC(r.model,r.provider)||"Exact match",detail:r.provider?`Exact \xB7 ${r.provider}`:"Exact",contextWindow:r.contextWindow});for(let f of a)u({key:tC(f),label:rC(f.model,f.provider)||"Suggestion",detail:f.provider||"Known model",contextWindow:f.contextWindow});return{query:n,exactMatch:r,suggestions:a,medianContextWindow:i,options:s,status:s.length>0?"ready":"miss"}}function nh(e={}){let t=qs(e);return t.exactMatch?.contextWindow?String(t.exactMatch.contextWindow):t.medianContextWindow?String(t.medianContextWindow):""}function k2(e=[]){let t=new Map;for(let n of Array.isArray(e)?e:[]){let r=qs(n);r.query&&t.set(r.query,r)}return t}function L2(e=[]){let t={};for(let n of Array.isArray(e)?e:[]){let r=String(n?.query||"").trim(),a=nh(n);!r||!a||(t[r]=Number(a))}return t}function st({label:e,hint:t,className:n,children:r,stacked:a=!1,headerClassName:o,hintClassName:i,headerAction:s=null}){return(0,l.jsxs)("div",{className:W("flex flex-col gap-2 text-sm",n),children:[(0,l.jsxs)("div",{className:W("text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",a?"flex min-h-10 items-start justify-between gap-3":"flex items-center justify-between gap-2",o),children:[(0,l.jsxs)("div",{className:W("min-w-0",a?"flex-1 space-y-1":"flex min-w-0 items-center gap-2"),children:[(0,l.jsx)("span",{children:e}),t?(0,l.jsx)("span",{className:W("block normal-case tracking-normal text-[11px] text-muted-foreground/80",a?"leading-4":null,i),children:t}):null]}),s?(0,l.jsx)("div",{className:"shrink-0",children:s}):null]}),r]})}function Yg({value:e,onValueChange:t,disabled:n=!1,allowEmptyCommit:r=!1,...a}){let o=String(e??""),[i,s]=(0,E.useState)(o);return(0,E.useEffect)(()=>{s(o)},[o]),(0,l.jsx)(Dt,{...a,value:i,inputMode:"numeric",disabled:n,onChange:c=>{let u=z1(c.target.value);u.accepted&&(s(u.draftValue),u.shouldCommit?t(u.commitValue):r&&u.draftValue===""&&t(""))},onBlur:()=>{s(c=>c!==""?c:r?(t(""),""):o)}})}function D2({label:e,hint:t,checked:n=!1,onCheckedChange:r,disabled:a=!1,className:o}){return(0,l.jsxs)("div",{className:W("flex items-center justify-between gap-4 rounded-2xl border border-border/70 bg-background/80 px-4 py-3",o),children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:e}),t?(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t}):null]}),(0,l.jsx)(fS,{checked:n,onCheckedChange:r,disabled:a,className:"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60"})]})}function Sa({open:e=!1,title:t="",description:n="",onClose:r=()=>{},children:a,variant:o="dialog",headerActions:i=null,showCloseButton:s=!0,closeDisabled:c=!1,closeOnEscape:u=!0,closeOnBackdrop:f=!0,footer:d=null,contentClassName:p="",bodyClassName:m="",footerClassName:b=""}){if((0,E.useEffect)(()=>{if(!e||typeof window>"u")return;function y(h){h.key==="Escape"&&u&&r()}return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[u,e,r]),!e)return null;let g=o==="page",x=(0,l.jsx)("div",{className:W("fixed inset-0 z-50 bg-slate-950/55 backdrop-blur-sm",g?"p-0":"flex items-center justify-center p-4"),onMouseDown:y=>{y.target===y.currentTarget&&f&&r()},children:(0,l.jsxs)("div",{className:W("overflow-hidden border border-border/70 bg-card/95 shadow-2xl",g?"flex h-full w-full flex-col rounded-none border-x-0 border-y-0 bg-background/98":"flex max-h-[85vh] w-full max-w-3xl flex-col rounded-3xl",p),children:[(0,l.jsxs)("div",{className:W("flex items-start justify-between gap-3 border-b border-border/70",g?"px-5 py-4 sm:px-6":"px-5 py-4"),children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-base font-semibold text-foreground",children:t}),n?(0,l.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:n}):null]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[i,s?(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",onClick:r,disabled:c,children:"Close"}):null]})]}),(0,l.jsx)("div",{className:W("overflow-y-auto",g?"min-h-0 flex-1 px-5 py-4 sm:px-6 sm:py-5":"min-h-0 flex-1 px-5 py-4",m),children:a}),d?(0,l.jsx)("div",{className:W("border-t border-border/70 bg-background/96",g?"px-5 py-4 sm:px-6":"px-5 py-4",b),children:d}):null]})});return typeof document>"u"||!document.body?x:(0,uC.createPortal)(x,document.body)}function RC({open:e=!1,anchorRef:t,preferredSide:n="bottom",desiredHeight:r=288,offset:a=4,className:o="",children:i,...s}){let c=yd({open:e,anchorRef:t,preferredSide:n,desiredHeight:r,offset:a});return e?(0,l.jsx)("div",{className:W("absolute left-0 right-0 z-30 overflow-y-auto rounded-xl border border-border/70 bg-popover shadow-lg",c.side==="top"?"bottom-full mb-1":"top-full mt-1",o),style:{maxHeight:`${Math.max(0,Math.floor(c.maxHeight||r))}px`},...s,children:i}):null}function z2({open:e=!1,onKeepEditing:t=()=>{},onDiscardAndClose:n=()=>{},onSaveAndClose:r=()=>{},saveDisabled:a=!1,dirtyLabels:o=[],details:i=""}){let s=o.length>1?`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`:o[0]||"this form";return(0,l.jsx)(Sa,{open:e,onClose:t,title:"Unsaved changes",description:`You have unsaved edits in ${s}.`,contentClassName:"max-w-lg rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,children:"Keep editing"}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:n,children:"Cancel + Close"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{r()},disabled:a,children:"Save + Close"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-sm leading-6 text-muted-foreground",children:[(0,l.jsx)("div",{children:"Choose whether to save these edits before closing the modal."}),i?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-amber-900",children:i}):null]})})}function B2({open:e=!1,failedModelIds:t=[],onKeepEditing:n=()=>{},onRemoveFailedAndClose:r=()=>{},removeDisabled:a=!1}){let o=t.length>1?`${t.length} failed models`:t[0]||"the failed model";return(0,l.jsx)(Sa,{open:e,onClose:n,title:"Failed model tests",description:`Some new models did not pass validation: ${o}.`,contentClassName:"max-w-lg rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:n,children:"Keep editing"}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:()=>{r()},disabled:a,children:"Remove failed + close"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-sm leading-6 text-muted-foreground",children:[(0,l.jsx)("div",{children:"Successful new models are still kept in the draft. You can continue editing, or remove only the failed rows and close the modal."}),t.length>0?(0,l.jsx)("div",{className:"rounded-xl border border-rose-200 bg-rose-50 px-3 py-2 text-rose-900",children:t.join(", ")}):null]})})}function Nd({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M12 20h9"}),(0,l.jsx)("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"})]})}function I2({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:(0,l.jsx)("path",{d:"m5 12 4.25 4.25L19 6.5"})})}function rh({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M3 6h18"}),(0,l.jsx)("path",{d:"M8 6V4.75A1.75 1.75 0 0 1 9.75 3h4.5A1.75 1.75 0 0 1 16 4.75V6"}),(0,l.jsx)("path",{d:"M18 6v12.25A1.75 1.75 0 0 1 16.25 20h-8.5A1.75 1.75 0 0 1 6 18.25V6"}),(0,l.jsx)("path",{d:"M10 10.5v5"}),(0,l.jsx)("path",{d:"M14 10.5v5"})]})}function U2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),(0,l.jsx)("path",{d:"M5 15V6a2 2 0 0 1 2-2h9"})]})}function j2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M7.25 5.75h-1.5A2.75 2.75 0 0 0 3 8.5v5.75A2.75 2.75 0 0 0 5.75 17h5.75a2.75 2.75 0 0 0 2.75-2.75v-1.5"}),(0,l.jsx)("path",{d:"M10.5 9.5 17 3"}),(0,l.jsx)("path",{d:"M12 3h5v5"})]})}function P2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("circle",{cx:"6.75",cy:"10",r:"3.25"}),(0,l.jsx)("path",{d:"M10 10h6.5"}),(0,l.jsx)("path",{d:"M13.5 10v2.25"}),(0,l.jsx)("path",{d:"M15.75 10v1.5"})]})}function V2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M16.25 10a6.25 6.25 0 1 1-1.83-4.42"}),(0,l.jsx)("path",{d:"M13.5 3.75h3v3"}),(0,l.jsx)("path",{d:"M16.5 3.75 12.75 7.5"})]})}function H2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M6 3.5h5.25L15 7.25V16A1.5 1.5 0 0 1 13.5 17.5h-7A1.5 1.5 0 0 1 5 16V5A1.5 1.5 0 0 1 6.5 3.5H6Z"}),(0,l.jsx)("path",{d:"M11 3.5V7.5H15"}),(0,l.jsx)("path",{d:"M7.75 11h4.5"}),(0,l.jsx)("path",{d:"M7.75 14h4.5"})]})}function EC({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M6 3.5h5.25L15 7.25V16A1.5 1.5 0 0 1 13.5 17.5h-7A1.5 1.5 0 0 1 5 16V5A1.5 1.5 0 0 1 6.5 3.5H6Z"}),(0,l.jsx)("path",{d:"M11 3.5V7.5H15"}),(0,l.jsx)("path",{d:"M7 12.25a3 3 0 1 1 2.85 2.99"}),(0,l.jsx)("path",{d:"M8.5 10.25h1.5v1.5"})]})}function q2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M10 2.75 4.75 5v4.12c0 3.42 2.1 6.58 5.25 7.88 3.15-1.3 5.25-4.46 5.25-7.88V5L10 2.75Z"}),(0,l.jsx)("circle",{cx:"10",cy:"9",r:"1.4"}),(0,l.jsx)("path",{d:"M10 10.4v2.1"})]})}function $2({label:e,value:t,icon:n,disabled:r=!1,onClick:a,actionLabel:o}){return(0,l.jsxs)("button",{type:"button",className:"inline-flex h-9 min-w-0 max-w-full items-center gap-2 rounded-full border border-border/70 bg-background/90 px-3 text-left transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70 sm:max-w-[18rem]",onClick:a,disabled:r,"aria-label":o,title:r?o:t,children:[(0,l.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:n}),(0,l.jsx)("span",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:e}),(0,l.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:t})]})}function K2({value:e,pending:t=!1,disabled:n=!1,rotateDisabled:r=!1,onCopy:a,onRotate:o}){return(0,l.jsxs)("div",{className:"flex h-9 min-w-0 max-w-full items-stretch overflow-hidden rounded-full border border-border/70 bg-background/90 sm:max-w-[18rem]",children:[(0,l.jsxs)("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-2 rounded-l-full px-3 text-left transition hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",onClick:a,disabled:n,"aria-label":t?"Gateway key is still generating":"Copy gateway key",title:t?"Gateway key is still generating":"Copy gateway key",children:[(0,l.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:(0,l.jsx)(P2,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("span",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Gateway key"}),(0,l.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:e})]}),(0,l.jsx)("button",{type:"button",className:"inline-flex w-9 shrink-0 items-center justify-center rounded-r-full border-l border-border/70 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70",onClick:o,disabled:r,"aria-label":"Rotate gateway key",title:"Rotate gateway key",children:(0,l.jsx)(V2,{className:"h-3.5 w-3.5"})})]})}function F2({endpointValue:e,endpointDisabled:t=!1,gatewayValue:n,gatewayPending:r=!1,gatewayDisabled:a=!1,rotateDisabled:o=!1,onCopyEndpoint:i,onCopyGatewayKey:s,onRotateKey:c}){return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,l.jsx)($2,{label:"Endpoint",value:e,icon:(0,l.jsx)(j2,{className:"h-3.5 w-3.5"}),disabled:t,onClick:i,actionLabel:t?"API endpoint not ready yet":"Copy API endpoint"}),(0,l.jsx)(K2,{value:n,pending:r,disabled:a,rotateDisabled:o,onCopy:s,onRotate:c})]})}function aC({label:e,value:t,icon:n,disabled:r=!1,onClick:a,actionLabel:o="",emptyLabel:i="Not resolved"}){let s=String(t||"").trim()||i;return(0,l.jsxs)("button",{type:"button",className:"inline-flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-border/70 bg-background/90 px-3 py-2 text-left transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",onClick:a,disabled:r,"aria-label":o,title:r?o:s,children:[(0,l.jsx)("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:n}),(0,l.jsxs)("span",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"block text-[9px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:e}),(0,l.jsx)("span",{className:"mt-1 block break-all text-[11px] font-medium leading-4 text-foreground",children:s})]})]})}function Td({connected:e=!1,className:t,srLabel:n="Connected",size:r="sm"}){if(!e)return null;let a=r==="md"?"h-3.5 w-3.5":"h-2.5 w-2.5",o=r==="md"?"h-2 w-2":"h-1.5 w-1.5";return(0,l.jsxs)("span",{className:W("relative inline-flex shrink-0 items-center justify-center",a,t),children:[(0,l.jsx)("span",{"aria-hidden":"true",className:"absolute inset-0 rounded-full bg-emerald-400/45 animate-ping motion-reduce:animate-none"}),(0,l.jsx)("span",{"aria-hidden":"true",className:W("relative rounded-full bg-emerald-500 ring-2 ring-emerald-500/15",o)}),(0,l.jsx)("span",{className:"sr-only",children:n})]})}function TC({primaryLabel:e="Config file",primaryValue:t="",primaryIcon:n=(0,l.jsx)(H2,{className:"h-3 w-3"}),onOpenPrimary:r,secondaryLabel:a="Backup file",secondaryValue:o="",secondaryIcon:i=(0,l.jsx)(EC,{className:"h-3 w-3"}),onOpenSecondary:s}){let c=String(t||"").trim(),u=String(o||"").trim();return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(aC,{label:e,value:c,icon:n,disabled:!c||typeof r!="function",onClick:r,actionLabel:c?`Open ${e.toLowerCase()}`:`${e} path is not resolved yet`}),(0,l.jsx)(aC,{label:a,value:u,icon:i,disabled:!u||typeof s!="function",onClick:s,actionLabel:u?`Open ${a.toLowerCase()}`:`${a} path is not resolved yet`})]})}function G2(e){return e==="error"?"Error":e==="success"?"Success":"Notice"}function Y2({notice:e,onDismiss:t}){let[n,r]=(0,E.useState)(Gg),[a,o]=(0,E.useState)(Gg),[i,s]=(0,E.useState)(!1),c=(0,E.useRef)(null),u=(0,E.useRef)(0);(0,E.useEffect)(()=>{if(n<=0){t();return}if(i){c.current&&(clearTimeout(c.current),c.current=null);return}return u.current=Date.now(),c.current=setTimeout(()=>{c.current=null,t()},n),()=>{c.current&&(clearTimeout(c.current),c.current=null)}},[t,i,n]),(0,E.useEffect)(()=>{if(i||n<=0){o(n);return}let h=()=>{let S=u.current?Date.now()-u.current:0;o(Math.max(0,n-S))};h();let v=setInterval(h,Sk);return()=>clearInterval(v)},[i,n]);function f(){if(i)return;c.current&&(clearTimeout(c.current),c.current=null);let h=u.current?Date.now()-u.current:0,v=Math.max(0,n-h);r(v),o(v),s(!0)}function d(){s(!1)}let p=e.tone==="error"?"border-rose-200 bg-rose-50 text-rose-800":e.tone==="success"?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-amber-200 bg-amber-50 text-amber-800",m=9,b=2*Math.PI*m,g=Math.max(0,Math.min(1,a/Gg)),x=b*(1-g),y=i?`Auto-dismiss paused with ${Math.max(0,a/1e3).toFixed(1)} seconds remaining`:`Auto-dismiss in ${Math.max(0,a/1e3).toFixed(1)} seconds`;return(0,l.jsx)("div",{className:W("pointer-events-auto rounded-2xl border px-4 py-3 text-sm shadow-lg backdrop-blur",p),onMouseEnter:f,onMouseLeave:d,onFocusCapture:f,onBlurCapture:h=>{h.currentTarget.contains(h.relatedTarget)||d()},role:e.tone==="error"?"alert":"status",children:(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] opacity-75",children:G2(e.tone)}),(0,l.jsxs)("div",{className:"relative mt-0.5 h-6 w-6 shrink-0 opacity-85","aria-label":y,title:y,children:[(0,l.jsxs)("svg",{viewBox:"0 0 24 24",className:W("h-6 w-6 -rotate-90",i?"opacity-70":"opacity-100"),"aria-hidden":"true",children:[(0,l.jsx)("circle",{cx:"12",cy:"12",r:m,fill:"none",stroke:"currentColor",strokeOpacity:"0.18",strokeWidth:"2"}),(0,l.jsx)("circle",{cx:"12",cy:"12",r:m,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:x,className:"transition-[stroke-dashoffset,opacity] duration-100 ease-linear"})]}),(0,l.jsx)("span",{className:W("pointer-events-none absolute inset-0 flex items-center justify-center",i?"gap-[2px]":""),"aria-hidden":"true",children:i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"h-2.5 w-[2px] rounded-full bg-current/75"}),(0,l.jsx)("span",{className:"h-2.5 w-[2px] rounded-full bg-current/75"})]}):(0,l.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current/75"})})]})]}),(0,l.jsx)("div",{className:"mt-1 leading-6",children:e.message}),(0,l.jsx)("div",{className:"mt-2 flex justify-end",children:(0,l.jsx)("button",{className:"rounded-full border border-current/15 px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em] opacity-85 transition hover:border-current/30 hover:opacity-100",onClick:t,type:"button",children:"Dismiss"})})]})})}function oC({notices:e,onDismiss:t}){return!Array.isArray(e)||e.length===0?null:(0,l.jsx)("div",{className:"pointer-events-none fixed inset-x-4 top-4 z-50 flex flex-col items-end gap-3","aria-live":"polite","aria-relevant":"additions text",children:e.map(n=>(0,l.jsx)("div",{className:"w-full max-w-md",children:(0,l.jsx)(Y2,{notice:n,onDismiss:()=>t(n.id)})},n.id))})}function W2({provider:e,disabled:t=!1,disabledReason:n="",busy:r=!1,onApply:a,framed:o=!0,focusRequest:i=0,onStateChange:s=null,testStateByModel:c={},savePhase:u="",saveMessage:f=""}){let d=(0,E.useMemo)(()=>L1(e),[e]),[p,m]=(0,E.useState)([]),[b,g]=(0,E.useState)(""),[x,y]=(0,E.useState)(!1),[h,v]=(0,E.useState)({}),[S,C]=(0,E.useState)({}),[T,w]=(0,E.useState)(null),[R,M]=(0,E.useState)(""),[k,I]=(0,E.useState)(""),[H,Q]=(0,E.useState)({}),ee=(0,E.useRef)(0),X=(0,E.useRef)([]),z=(0,E.useRef)(new Map),te=(0,E.useRef)(new Map),Y=(0,E.useRef)(""),q=(0,E.useRef)(""),V=(0,E.useRef)(null),_e=(0,E.useRef)(new Map),F=(0,E.useRef)(new Map);function he(A={}){return ee.current+=1,{key:`model-${e.id}-draft-${ee.current}`,id:"",sourceId:"",contextWindow:"",...A}}function Z(A){Y.current=A}function ae(A=[],{preserveFocus:D=!1}={}){let B=[],G=null;for(let $ of Array.isArray(A)?A:[]){let tt=String($?.id||""),He=$?.contextWindow===void 0||$?.contextWindow===null?"":String($.contextWindow);if(String(tt).trim()){B.push({...$,id:tt,contextWindow:He});continue}G||(G={...$,id:"",contextWindow:He})}return G||(G=he(),D&&Z(G.key)),[G,...B]}function Se(A){C(D=>{if(!D[A])return D;let B={...D};return delete B[A],B})}function U(A,D){v(B=>{if(D)return B[A]?B:{...B,[A]:!0};if(!B[A])return B;let G={...B};return delete G[A],G})}function ne(A,D={},{clearLookupState:B=!1,clearStatus:G=!0,closeLookupMenu:$=!1}={}){B&&Se(A),G&&w(null),$&&R===A&&M(""),m(tt=>ae(tt.map(He=>He.key===A?{...He,...D}:He),{preserveFocus:!1}))}(0,E.useEffect)(()=>{X.current=p},[p]),(0,E.useEffect)(()=>{let A=ae(d,{preserveFocus:!0});m(A),X.current=A,_e.current.clear(),F.current.clear(),v({}),C({}),w(null),M(""),I(""),Q({})},[d]),(0,E.useEffect)(()=>{let A=Y.current;if(!A)return;let D=z.current.get(A);if(!D)return;D.scrollIntoView?.({block:"nearest"}),D.focus();let B=D.value?.length||0;D.setSelectionRange?.(B,B),Y.current=""},[p]),(0,E.useEffect)(()=>{i&&m(A=>{let D=ae(A,{preserveFocus:!1}),B=D.find(G=>!String(G?.id||"").trim())||D[D.length-1];return B&&Z(B.key),D})},[i]),(0,E.useEffect)(()=>{R&&(p.some(A=>A.key===R)||M(""))},[p,R]),(0,E.useEffect)(()=>{k&&(p.some(A=>A.key===k)||I(""))},[p,k]),(0,E.useEffect)(()=>{Q(A=>{let D=new Set(p.map($=>$.key)),B=!1,G={};for(let[$,tt]of Object.entries(A)){if(!D.has($)){B=!0;continue}G[$]=tt}return B?G:A})},[p]),(0,E.useEffect)(()=>{if(!R||typeof document>"u")return;function A(D){te.current.get(R)?.contains(D.target)||M("")}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[R]);let ue=(0,E.useMemo)(()=>p.filter(A=>String(A?.id||"").trim()),[p]),me=(0,E.useMemo)(()=>d.map(A=>({id:String(A?.id||"").trim(),contextWindow:so(A?.contextWindow||"")})).filter(A=>A.id),[d]),re=(0,E.useMemo)(()=>ue.map(A=>({...A,id:String(A?.id||"").trim(),contextWindow:so(A?.contextWindow||"")})),[ue]),oe=re.map(A=>A.id),Ne=me.map(A=>A.id),Re=oe.filter(A=>!Ne.includes(A)),Ze=dh(oe),gt=oe.length>0,Vt=new Set(re.filter(A=>{let D=String(A?.contextWindow||"").trim();if(!D)return!1;let B=Number.parseInt(D,10);return!Number.isFinite(B)||B<=0||String(B)!==D}).map(A=>A.key)),sn=re.filter(A=>!String(A?.contextWindow||"").trim()),ot=JSON.stringify(me)!==JSON.stringify(re.map(A=>({id:A.id,contextWindow:A.contextWindow}))),Ge=t||r||(b!==""||u==="testing"||u==="saving")||x,qr=(0,E.useMemo)(()=>{let A=-1;return p.forEach((D,B)=>{String(D?.id||"").trim()&&(A=B)}),A},[p]),cn=t?n:gt?Ze?"Model ids must be unique for each provider.":Vt.size>0?"Context windows must be positive integers when set.":"":"Keep at least one model id on the provider.",$e=sh(p.map(A=>A.key));(0,E.useEffect)(()=>{s?.({isDirty:ot,issue:cn,locked:Ge,rows:re.map(A=>({...A,contextWindow:so(A.contextWindow)}))})},[s,ot,cn,Ge,re]);function Ee(A){Se(A),U(A,!1),w(null),R===A&&M(""),k===A&&I(""),Q(D=>{if(!Object.prototype.hasOwnProperty.call(D,A))return D;let B={...D};return delete B[A],B}),m(D=>ae(D.filter(B=>B.key!==A)))}function fe(A){m(D=>ae(ih(D,A,B=>B?.key)))}function ge(A){m(D=>ae(mC(D,A,B=>B?.key)))}function P(){q.current="",pl(V.current,!1),V.current=null}async function Ye(A,{force:D=!1}={}){let B=String(A||"").trim();if(!B)return qs({query:B});if(!D&&_e.current.has(B))return _e.current.get(B);if(!D&&F.current.has(B))return F.current.get(B);let G=(async()=>{let $=await th([B]),tt=(Array.isArray($)?$:[]).find(ke=>String(ke?.query||"").trim()===B)||{query:B},He=qs(tt,{fallbackQuery:B});return _e.current.set(B,He),He})();F.current.set(B,G);try{return await G}finally{F.current.delete(B)}}async function Ht(A,{openMenu:D=!1,prefill:B=!1,modelId:G=""}={}){let $=X.current.find(He=>He.key===A),tt=String(G||$?.id||"").trim();if(!tt)return null;D&&M(A),U(A,!0);try{let He=await Ye(tt);if(C(ke=>({...ke,[A]:He})),B){let ke=nh(He);ke&&m(ht=>ae(ht.map(yt=>{if(yt.key!==A)return yt;let Ve=String(yt?.id||"").trim(),de=String(yt?.contextWindow||"").trim();return!Ve||Ve!==tt||de?yt:{...yt,contextWindow:ke}}),{preserveFocus:!1}))}return He}catch(He){let ke=He instanceof Error?He.message:String(He),ht={query:tt,status:"error",error:ke,options:[]};return C(yt=>({...yt,[A]:ht})),ht}finally{U(A,!1)}}async function Gt(A=[]){let D=new Set(Array.isArray(A)?A:[]),B=re.filter(G=>!G.id||String(G?.contextWindow||"").trim()?!1:D.size===0?!0:D.has(G.key)).map(G=>({key:G.key,id:G.id}));if(B.length!==0){y(!0),w(null);try{let G=await th(B.map(Ve=>Ve.id)),$=k2(G),tt=new Map(B.map(Ve=>[Ve.key,Ve]));for(let Ve of $.values())Ve?.query&&_e.current.set(Ve.query,Ve);let He=Array.isArray(X.current)?X.current:[],ke=0,ht=0,yt=He.map(Ve=>{let de=tt.get(Ve.key);if(!de)return Ve;let qe=String(Ve?.id||"").trim(),un=String(Ve?.contextWindow||"").trim();if(!qe||qe!==de.id||un)return Ve;let po=$.get(qe)||qs({query:qe}),Bn=nh(po);return Bn?(ke+=1,{...Ve,contextWindow:Bn}):(ht+=1,Ve)});m(ae(yt,{preserveFocus:!1})),w({tone:ke>0?"success":"warning",message:ke>0?`Filled ${ke} context size${ke===1?"":"s"}${ht>0?`; ${ht} still need a manual value`:""}.`:`Could not fill ${ht} model${ht===1?"":"s"}.`})}catch(G){w({tone:"error",message:G instanceof Error?G.message:String(G)})}finally{y(!1)}}}async function Mt(){if(Ge||cn||!ot)return!1;let A=uo(e)==="api"&&Re.length>0;g(A?"testing":"saving");try{return await a(re.map(D=>({...D,contextWindow:so(D.contextWindow)})))}finally{g("")}}return(0,l.jsxs)("div",{className:W(o?"space-y-3 rounded-2xl border border-border/70 bg-background/60 p-4":"space-y-3"),children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-secondary/35 px-4 py-3 text-sm leading-6 text-muted-foreground",children:"Direct routes follow this top-to-bottom order. Focus a context field to load suggested sizes, or use Fill missing context size to fill each empty row with a median size."}),(0,l.jsx)("div",{className:"space-y-2",children:p.map((A,D)=>{let B=String(A?.id||"").trim(),G=String(A?.contextWindow||"").trim(),$=!!B,tt=$?ue.findIndex(de=>de.key===A.key):-1,He=S[A.key]||null,ke=!!h[A.key],ht=R===A.key&&!!B,yt=Vt.has(A.key),Ve=B&&c?.[B]||"default";return(0,l.jsxs)("div",{ref:$e(A.key),"data-reorder-row":"true",onDragOver:de=>{!Ge&&q.current&&q.current!==A.key&&(de.preventDefault(),de.dataTransfer.dropEffect="move")},onDrop:de=>{if(Ge)return;de.preventDefault();let qe=de.dataTransfer.getData("text/plain")||q.current;P(),m(un=>ae(fC(un,qe,A.key)))},className:W("space-y-2 rounded-xl border border-border/70 bg-card/90 p-3",$?null:"border-dashed bg-background/85",yt?"border-amber-200 bg-amber-50/70":null,!yt&&Ve==="success"?"border-emerald-200 bg-emerald-50/70":null,!yt&&Ve==="error"?"border-rose-200 bg-rose-50/70":null,!yt&&Ve==="pending"?"border-sky-200 bg-sky-50/70":null),children:[(0,l.jsxs)("div",{className:"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_minmax(12rem,14rem)_5.5rem] items-center gap-2",children:[(0,l.jsx)("span",{className:W("flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground",$&&!Ge?"cursor-grab":"opacity-45"),draggable:!Ge&&$,onDragStart:de=>{if(Ge||!$)return;let qe=lh(de.currentTarget);de.dataTransfer.effectAllowed="move",de.dataTransfer.setData("text/plain",A.key),qe&&typeof de.dataTransfer?.setDragImage=="function"&&de.dataTransfer.setDragImage(qe,20,20),P(),q.current=A.key,V.current=qe,pl(qe,!0)},onDragEnd:P,title:$?"Drag to reorder":"New model draft row",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Ks,{disabled:Ge||!$||tt<=0,label:!$||tt<=0?"Already first":`Move ${A.id||`model ${tt+1}`} up`,onClick:()=>fe(A.key)}),(0,l.jsx)(kd,{disabled:Ge||!$||D>=qr,label:!$||D>=qr?"Already last":`Move ${A.id||`model ${tt+1}`} down`,onClick:()=>ge(A.key)}),(0,l.jsx)(Dt,{ref:de=>{de?z.current.set(A.key,de):z.current.delete(A.key)},value:A.id,onChange:de=>ne(A.key,{id:de.target.value},{clearLookupState:!0,closeLookupMenu:!0}),placeholder:$?"Model id":"Add a new model id",disabled:Ge}),(0,l.jsxs)("div",{ref:de=>{de?te.current.set(A.key,de):te.current.delete(A.key)},className:"relative min-w-0",children:[(0,l.jsx)(Dt,{value:k===A.key?H[A.key]??Ed(A.contextWindow):o2(A.contextWindow),onChange:de=>{let qe=de.target.value,un=so(qe);Q(po=>({...po,[A.key]:Ed(un)})),ne(A.key,{contextWindow:un},{clearStatus:!1})},onBlur:de=>{I(qe=>qe===A.key?"":qe),Q(qe=>{if(!Object.prototype.hasOwnProperty.call(qe,A.key))return qe;let un={...qe};return delete un[A.key],un}),ne(A.key,{contextWindow:so(de.target.value)},{clearStatus:!1})},onFocus:()=>{B&&(I(A.key),Q(de=>({...de,[A.key]:Ed(A.contextWindow)})),Ht(A.key,{openMenu:!0}))},onClick:()=>{B&&Ht(A.key,{openMenu:!0})},onKeyDown:de=>{if(de.key==="ArrowDown"&&B){de.preventDefault(),Ht(A.key,{openMenu:!0});return}de.key==="Escape"&&(de.preventDefault(),M(""))},placeholder:"Context window",inputMode:"numeric",disabled:Ge||!B,className:"font-medium tabular-nums","aria-label":B?`Context window for ${B}`:"Context window"}),ht?(0,l.jsx)(RC,{open:ht,anchorRef:{current:te.current.get(A.key)||null},preferredSide:"top",desiredHeight:224,className:"z-20 rounded-lg bg-background/98 p-2",onMouseDown:de=>de.preventDefault(),children:ke?(0,l.jsxs)("div",{className:"inline-flex items-center gap-2 px-1 py-2 text-sm text-muted-foreground",children:[(0,l.jsx)(co,{}),"Fetching size options for ",(0,l.jsx)("code",{children:B}),"."]}):He?.status==="error"?(0,l.jsx)("div",{className:"rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-900",children:He.error||"Could not load suggested sizes."}):He?.options?.length>0?(0,l.jsx)("div",{className:"space-y-1",children:He.options.map(de=>(0,l.jsxs)("button",{type:"button",className:"flex w-full flex-col gap-2 rounded-lg border border-border/70 bg-background px-3 py-2 text-left text-sm text-foreground transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",disabled:Ge,onMouseDown:qe=>qe.preventDefault(),onClick:()=>{Q(qe=>({...qe,[A.key]:Ed(de.contextWindow)})),ne(A.key,{contextWindow:String(de.contextWindow)},{clearStatus:!1}),M("")},title:`Use ${de.label}`,children:[(0,l.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,l.jsx)("div",{className:"break-words font-medium leading-5",children:de.label}),(0,l.jsx)("div",{className:"break-words text-xs leading-4 text-muted-foreground",children:de.detail})]}),(0,l.jsxs)("div",{className:"w-full rounded-md border border-border/70 bg-secondary/70 px-3 py-2",children:[(0,l.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Context size"}),(0,l.jsx)("div",{className:"mt-1 text-lg font-semibold leading-none tabular-nums text-foreground",children:Hs(de.contextWindow)})]})]},de.key))}):(0,l.jsxs)("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/80 px-3 py-2 text-xs text-muted-foreground",children:["No suggested size was found for ",(0,l.jsx)("code",{children:He?.query||B}),"."]})}):null]}),$?(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Ld,onMouseDown:de=>de.preventDefault(),onClick:()=>Ee(A.key),disabled:Ge,children:"Remove"}):(0,l.jsx)(ce,{type:"button",variant:"ghost",className:W(Ld,"pointer-events-none invisible"),tabIndex:-1,disabled:!0,"aria-hidden":"true",children:"Remove"})]}),ke?(0,l.jsx)("div",{className:"flex justify-end text-xs",children:(0,l.jsxs)("div",{className:"inline-flex items-center gap-1.5 text-sky-700",children:[(0,l.jsx)(co,{}),"Looking up sizes"]})}):null,yt?(0,l.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:["Enter a positive integer like ",(0,l.jsx)("code",{children:"128000"}),", or leave the field blank."]}):Ve==="pending"?(0,l.jsx)("div",{className:"rounded-lg border border-sky-200 bg-sky-50 px-3 py-2 text-xs text-sky-900",children:"Testing this model against the provider endpoint now."}):Ve==="success"?(0,l.jsx)("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900",children:"Confirmed by the latest live provider test."}):Ve==="error"?(0,l.jsx)("div",{className:"rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-900",children:"This model failed the latest live provider test."}):null]},A.key)})}),cn?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:cn}):null,T?(0,l.jsx)("div",{className:W("rounded-xl px-3 py-2 text-sm",T.tone==="error"?"border border-rose-200 bg-rose-50 text-rose-900":T.tone==="warning"?"border border-amber-200 bg-amber-50 text-amber-900":"border border-emerald-200 bg-emerald-50 text-emerald-900"),children:T.message}):null,(0,l.jsx)("div",{className:W("sticky z-10 border-t border-border/70 bg-background/95 pt-3 backdrop-blur",o?"bottom-0":"bottom-0 -mx-5 rounded-b-[1rem] px-5 pb-4"),children:(0,l.jsxs)("div",{className:"flex min-h-9 items-center justify-between gap-3",children:[(0,l.jsx)("div",{className:W("text-xs",u==="testing"?"text-sky-700":u==="saving"?"text-foreground":"text-muted-foreground"),children:u==="testing"?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(co,{}),f||"Testing new models before save."]}):u==="saving"?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(co,{}),f||"Saving provider models."]}):Re.length>0&&uo(e)==="api"?`${Re.length} new model${Re.length===1?"":"s"} will be tested before save.`:"Existing models keep their current configuration metadata."}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[!t&&!Ge&&sn.length>0?(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:()=>{Gt()},children:x?"Filling\u2026":"Fill missing context size"}):null,!t&&!Ge&&ot?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>{v({}),C({}),w(null),M(""),_e.current.clear(),F.current.clear(),m(ae(d,{preserveFocus:!0}))},children:"Reset"}):null,!t&&ot&&!cn?(0,l.jsx)(ce,{type:"button",onClick:()=>{Mt()},disabled:Ge,children:u==="testing"||b==="testing"?"Testing\u2026":u==="saving"||b==="saving"||r?"Saving\u2026":"Save models"}):null]})]})})]})}function Q2({title:e,rows:t,onChange:n,options:r,disabled:a=!1,addLabel:o="Add target",emptyLabel:i="No targets configured.",helperText:s="Drag rows or use the arrow to change routing order.",helperAction:c=null,placeholder:u="provider/model or alias",draftPlaceholder:f="Add a new route",showDraftRow:d=!1,showDraftFocusButton:p=!1,showWeightInput:m=!1,filterOtherSelectedValues:b=!1,excludedValues:g=[]}){let x=(0,E.useRef)(0),y=(0,E.useRef)(""),h=(0,E.useRef)(null),v=(0,E.useRef)(new Map),S=(0,E.useRef)(0),C=(0,E.useRef)(0),[T,w]=(0,E.useState)(0),R=(0,E.useMemo)(()=>String(e||"targets").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"targets",[e]),M=`${R}-draft-row`,k=(0,E.useMemo)(()=>{let F=(t||[]).filter(he=>String(he?.ref||"").trim());return d?[{key:M,ref:"",sourceRef:""},...F]:F},[t,d,M]),I=sh(k.map(F=>F.key)),H=(0,E.useMemo)(()=>ba(g),[g]),Q=(0,E.useMemo)(()=>Fs(r,[...k.map(F=>F?.ref),...H]),[r,k,H]);(0,E.useEffect)(()=>()=>{typeof window<"u"&&S.current&&window.cancelAnimationFrame(S.current)},[]);function ee(F,he){if(d&&F===M){if(!String(he||"").trim())return;x.current+=1,n([{key:`${R}-draft-${x.current}`,ref:he,sourceRef:"",...m?{weight:"1"}:{}},...(t||[]).filter(Z=>String(Z?.ref||"").trim())]);return}n((t||[]).map(Z=>Z.key===F?{...Z,ref:he}:Z))}function X(F,he){n((t||[]).map(Z=>Z.key===F?{...Z,weight:he}:Z))}function z(F){n((t||[]).filter(he=>he.key!==F))}function te(F){n(ih(t||[],F,he=>he?.key))}function Y(F){n(mC(t||[],F,he=>he?.key))}function q(){y.current="",pl(h.current,!1),h.current=null}function V(){x.current+=1;let F=new Set([...(t||[]).map(Z=>String(Z?.ref||"").trim()).filter(Boolean),...H]),he=Q.find(Z=>!F.has(Z.value))?.value||"";n([...t||[],{key:`${R}-draft-${x.current}`,ref:he,sourceRef:""}])}function _e(){if(!d||a)return;let F=v.current.get(M);if(!F||typeof window>"u"){w(Ne=>Ne+1);return}C.current+=1;let he=C.current;S.current&&(window.cancelAnimationFrame(S.current),S.current=0),F.scrollIntoView({block:"start",behavior:"smooth"});let Z=hd(F),ae=P1(F,Z),Se=0,U=0,ne=90,ue=8,me=6,re=.5,oe=()=>{if(C.current!==he)return;let Ne=v.current.get(M)||F,Re=P1(Ne,Z);if(!Number.isFinite(Re.top)||!Number.isFinite(Re.left)){S.current=0,w(Ze=>Ze+1);return}if(Tk(ae,Re,re)?Se+=1:Se=0,ae=Re,U+=1,U>=ue&&Se>=me||U>=ne){S.current=0,w(Ze=>Ze+1);return}S.current=window.requestAnimationFrame(oe)};S.current=window.requestAnimationFrame(oe)}return(0,l.jsxs)("div",{className:"space-y-2 rounded-2xl border border-border/70 bg-background/55 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:e}),p&&d?(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 rounded-md p-0 text-muted-foreground hover:text-foreground",onMouseDown:F=>F.preventDefault(),onClick:_e,disabled:a,"aria-label":o,title:o,children:(0,l.jsx)(pC,{className:"h-3.5 w-3.5"})}):null]}),(0,l.jsxs)("div",{className:"ml-auto flex max-w-full flex-wrap items-start justify-end gap-x-3 gap-y-2",children:[s?(0,l.jsx)("div",{className:"max-w-[34rem] text-right text-[11px] leading-4 text-muted-foreground",children:s}):null,d?null:(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:V,disabled:a,children:o})]})]}),k.length>0?(0,l.jsx)("div",{className:"space-y-2",children:k.map((F,he)=>{let Z=d&&F.key===M,ae=Z?-1:(t||[]).findIndex(U=>U?.key===F.key),Se=b?Q.filter(U=>{let ne=String(U?.value||"").trim();return ne?ne===String(F?.ref||"").trim()?!0:H.includes(ne)?!1:!(k||[]).some(ue=>ue?.key!==F.key&&String(ue?.ref||"").trim()===ne):!1}):Q;return(0,l.jsxs)("div",{ref:U=>{if(I(F.key)(U),U){v.current.set(F.key,U);return}v.current.delete(F.key)},"data-reorder-row":"true",onDragOver:U=>{!a&&y.current&&y.current!==F.key&&(U.preventDefault(),U.dataTransfer.dropEffect="move")},onDrop:U=>{if(a)return;U.preventDefault();let ne=U.dataTransfer.getData("text/plain")||y.current;q(),n(fC(t||[],ne,F.key))},className:W(m?"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_10rem_5.5rem] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3":"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_5.5rem] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3",Z?"border-dashed bg-background/85":null),children:[(0,l.jsx)("span",{className:W("flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground",Z||a?"opacity-45":"cursor-grab"),draggable:!a&&!Z,onDragStart:U=>{if(a||Z)return;let ne=lh(U.currentTarget);U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",F.key),ne&&typeof U.dataTransfer?.setDragImage=="function"&&U.dataTransfer.setDragImage(ne,20,20),q(),y.current=F.key,h.current=ne,pl(ne,!0)},onDragEnd:q,title:Z?"New route draft row":"Drag to reorder",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Ks,{disabled:a||Z||ae<=0,label:Z||ae<=0?"Already first":`Move ${F.ref||`target ${ae+1}`} up`,onClick:()=>te(F.key)}),(0,l.jsx)(kd,{disabled:a||Z||ae===-1||ae>=(t||[]).length-1,label:Z||ae===-1||ae>=(t||[]).length-1?"Already last":`Move ${F.ref||`target ${ae+1}`} down`,onClick:()=>Y(F.key)}),(0,l.jsxs)("div",{className:"flex h-9 min-w-0 overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Model"}),(0,l.jsxs)(vr,{value:F.ref||void 0,onValueChange:U=>ee(F.key,U),disabled:a,openSearchRequest:Z?T:0,children:[(0,l.jsx)(br,{className:"h-full min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 shadow-none focus:border-transparent focus:ring-0",children:(0,l.jsx)(xr,{placeholder:Z?f:u})}),(0,l.jsx)(Sr,{children:Se.length>0?Bd(Se,{keyPrefix:`${e}-row-${F.key}`}):(0,l.jsx)(ar,{value:"__no-route-options",disabled:!0,children:"No routes available"})})]})]}),m?(0,l.jsxs)("div",{className:W("flex h-9 overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",Z?"opacity-45":null),children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Weight"}),(0,l.jsx)(Dt,{value:Z?"":String(F?.weight||"1"),onChange:U=>X(F.key,U.target.value),inputMode:"numeric",placeholder:"1",disabled:a||Z,className:"h-full min-w-0 rounded-none border-0 bg-transparent px-3 text-center shadow-none focus:border-transparent focus:ring-0","aria-label":Z?"Weight for new target":`Weight for ${F.ref||`target ${he+1}`}`})]}):null,Z?(0,l.jsx)(ce,{type:"button",variant:"ghost",className:W(Ld,"pointer-events-none invisible"),tabIndex:-1,disabled:!0,"aria-hidden":"true",children:"Remove"}):(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Ld,onMouseDown:U=>U.preventDefault(),onClick:()=>z(F.key),disabled:a,children:"Remove"})]},F.key)})}):(0,l.jsx)("div",{className:"rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:i}),c?(0,l.jsx)("div",{className:"flex min-h-8 items-center justify-end",children:c}):null]})}function X2(e,t){let n=Math.abs(Number(e)||0),r=Math.abs(Number(t)||0);for(;r!==0;){let a=n%r;n=r,r=a}return n||1}function Z2(e=[]){return!Array.isArray(e)||e.length===0?1:e.reduce((t,n)=>X2(t,n),0)||1}function J2(e,t){let n=String(e||"").trim();if(!n)return"Unconfigured route";let r=t.get(n);if(!r)return n;let a=String(r.label||n).trim()||n,o=String(r.hint||"").trim();return o&&o!==a?`${a} \xB7 ${o}`:a}function eL(e,t,n=[]){let r=new Map((n||[]).map(s=>[String(s?.value||"").trim(),s]).filter(([s])=>!!s)),a=new Map((Array.isArray(t?.targets)?t.targets:[]).map(s=>[String(s?.ref||"").trim(),s]).filter(([s])=>!!s)),o=new Map((Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map(s=>[String(s?.ref||"").trim(),s]).filter(([s])=>!!s));function i(s,c,u){return(s||[]).map((f,d)=>{let p=String(f?.ref||"").trim(),m=String(f?.sourceRef||f?.ref||"").trim(),b=u.get(m)||u.get(p)||{},g=Number(f?.weight??b?.weight),x=Number.isFinite(g)&&g>0?Math.floor(g):1;return{key:`${c}-${p||"empty"}-${d}`,ref:p,label:J2(p,r),bucket:c,weight:x}}).filter(f=>!!f.ref)}return[...i(e?.targets,"primary",a),...i(e?.fallbackTargets,"fallback",o)]}function tL(e=[],t=8){if(!Array.isArray(e)||e.length===0)return[];let n=e.map(s=>Math.max(1,Number(s?.weight)||1)),r=Z2(n),a=n.map(s=>Math.max(1,Math.floor(s/r))),o=a.reduce((s,c)=>s+c,0);if(o>24){let s=o/24;a=a.map(c=>Math.max(1,Math.round(c/s))),o=a.reduce((c,u)=>c+u,0)}let i=[];for(let s=0;s<e.length;s+=1)for(let c=0;c<a[s];c+=1)i.push(e[s]);return Array.from({length:Math.max(e.length,t)},(s,c)=>i[c%i.length])}function nL(e,t=[]){let n=uh(e),r=gC(n),a=Array.isArray(t)?t.filter(Boolean):[],i=a.some(s=>s.bucket==="fallback")?"Runtime builds the candidate pool as all primary targets first, then all fallback targets.":"Runtime builds the candidate pool from the primary target list only.";if(n==="round-robin"){let s=a.length>0?Array.from({length:Math.max(a.length,8)},(c,u)=>a[u%a.length]):[];return{strategyLabel:r,summary:"Each new request starts from the next candidate in the current pool, then wraps around.",poolNote:`${i} Round-robin rotates across that combined eligible list.`,sequenceLabel:"Example starting candidate by request",sequenceEntries:s,footnote:"If a candidate is unhealthy or quota-blocked, it is skipped and the next eligible candidate is chosen."}}if(n==="weighted-rr"||n==="quota-aware-weighted-rr"||n==="auto"){let s=n==="auto",c=tL(a,8);return{strategyLabel:r,summary:s?"`auto` normalizes to quota-aware weighted round-robin in the runtime balancer.":n==="quota-aware-weighted-rr"?"Candidates rotate like weighted round-robin, but low remaining quota or poor health lowers their share.":"Candidates repeat in proportion to their configured weights.",poolNote:`${i} This strategy ranks across the full eligible pool after it is built.`,sequenceLabel:"Example starting candidate by request",sequenceEntries:c,footnote:s||n==="quota-aware-weighted-rr"?"When all quotas and health scores are equal, the rotation looks like the weighted example below. Low remaining capacity or retryable failures push a target later.":"Weights come from the existing alias target metadata when present. Targets without a stored weight behave as weight 1."}}return{strategyLabel:r,summary:"Requests try candidates in the configured list order and only move to later candidates when earlier ones are unavailable or fail.",poolNote:`${i} Ordered keeps that exact sequence.`,sequenceLabel:"Attempt order",sequenceEntries:a,footnote:"This is the most predictable option when you want a strict preference order."}}function rL({open:e=!1,onClose:t=()=>{},onSave:n=()=>{},aliasLabel:r="",initialStrategy:a="auto",entries:o=[],disabled:i=!1}){let s=uh(a),[c,u]=(0,E.useState)(s),[f,d]=(0,E.useState)(!1);(0,E.useEffect)(()=>{e&&(u(s),d(!1))},[e,s,r]);async function p(){if(!(i||f)){d(!0);try{await n(c)!==!1&&t()}finally{d(!1)}}}return(0,l.jsx)(Sa,{open:e,onClose:t,title:r?`Choose strategy \xB7 ${r}`:"Choose strategy",description:"Review each routing strategy in its own tab. Save applies the currently selected tab to this alias.",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,disabled:f,children:"Cancel"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{p()},disabled:i||f,children:f?"Saving\u2026":"Save strategy"})]}),children:(0,l.jsxs)(Vu,{value:c,onValueChange:u,children:[(0,l.jsx)("div",{className:"overflow-x-auto pb-1",children:(0,l.jsx)(Hu,{className:"h-auto min-w-max flex-wrap justify-start gap-2 rounded-2xl bg-secondary/80 p-2",children:Wg.map(m=>(0,l.jsx)(Or,{value:m.value,className:"h-auto min-h-10 rounded-xl px-4 py-2",children:m.label},m.value))})}),Wg.map(m=>{let b=nL(m.value,o),g=(b.sequenceEntries||[]).filter(Boolean);return(0,l.jsx)(_r,{value:m.value,className:"mt-4",children:(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)]",children:[(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Tt,{variant:"outline",children:b.strategyLabel}),(0,l.jsxs)(Tt,{variant:"info",children:[o.length," candidate",o.length===1?"":"s"]})]}),(0,l.jsxs)("div",{className:"mt-4 space-y-3 text-sm leading-6 text-foreground",children:[(0,l.jsx)("p",{children:b.summary}),(0,l.jsx)("p",{className:"text-muted-foreground",children:b.poolNote})]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:b.sequenceLabel}),g.length>0?(0,l.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:g.map((x,y)=>(0,l.jsxs)("div",{className:"rounded-full border border-border/70 bg-card/90 px-3 py-1.5 text-sm text-foreground",children:[(0,l.jsx)("span",{className:"mr-2 text-xs text-muted-foreground",children:y+1}),(0,l.jsx)("span",{children:x.label})]},`${x.key}-sequence-${y}`))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"Add at least one target to preview how this strategy would route requests."}),(0,l.jsx)("div",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:b.footnote})]})]}),(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Current setup"}),r?(0,l.jsx)(Tt,{variant:"outline",children:r}):null]}),o.length>0?(0,l.jsx)("div",{className:"mt-4 space-y-2",children:o.map(x=>(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-border/70 bg-card/90 px-3 py-2 text-sm",children:[(0,l.jsx)(Tt,{variant:x.bucket==="primary"?"info":"outline",children:x.bucket}),(0,l.jsx)("span",{className:"font-medium text-foreground",children:x.label}),(0,l.jsxs)("span",{className:"text-xs text-muted-foreground",children:["weight ",x.weight]})]},x.key))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"This alias does not have any targets yet."})]})})]})},m.value)})]})})}function aL({open:e=!1,onClose:t=()=>{},config:n={}}){let r=(0,E.useMemo)(()=>s2(n),[n]);return(0,l.jsx)(Sa,{open:e,onClose:t,title:"Alias guide",description:"Aliases give clients one stable route while letting LLM Router swap, balance, and fail over across provider/model targets behind that route.",contentClassName:"max-h-[92vh] max-w-4xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Stable route"}),(0,l.jsxs)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:["Expose one alias like ",(0,l.jsx)("code",{children:"coding"})," or ",(0,l.jsx)("code",{children:"gpt-5.4"})," to clients, then retarget the alias later without touching client config."]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Selection strategy"}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:"The alias strategy controls how LLM Router picks from the configured targets. Ordered is strict preference; the other strategies distribute traffic when multiple targets are healthy."})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Fallback behavior"}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:"If one target is unavailable or rate limited, LLM Router can continue to later candidates in the same alias instead of failing the whole request immediately."})]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Tt,{variant:"warning",children:"Important"}),(0,l.jsx)("div",{className:"text-sm font-medium text-amber-950",children:"Mixed context windows inside one alias can change behavior."})]}),(0,l.jsxs)("div",{className:"mt-3 text-sm leading-6 text-amber-900",children:["If an alias mixes models with different context windows, requests that fit the larger model may still fail on the smaller model. For example, an alias that includes both a ",(0,l.jsx)("code",{children:"258K"})," model and a ",(0,l.jsx)("code",{children:"128K"})," model can still fail when routing lands on the smaller target. Keep aliases aligned by context size when you expect long histories or large prompts."]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Current config check"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Aliases below currently mix different configured model context windows."})]}),(0,l.jsx)(Tt,{variant:r.length>0?"warning":"success",children:r.length>0?`${r.length} alias${r.length===1?"":"es"} need review`:"No mixed context windows detected"})]}),r.length>0?(0,l.jsx)("div",{className:"mt-4 space-y-3",children:r.map(a=>(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50/70 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Tt,{variant:"outline",children:a.aliasId}),(0,l.jsxs)("div",{className:"text-sm font-medium text-amber-950",children:["Smallest target: ",Hs(a.smallestContextWindow),". Largest target: ",Hs(a.largestContextWindow),"."]})]}),(0,l.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.models.map(o=>(0,l.jsxs)("div",{className:"rounded-full border border-amber-200 bg-background/90 px-3 py-1.5 text-sm text-foreground",children:[o.ref," \xB7 ",Hs(o.contextWindow)]},o.ref)),a.unknownRefs.map(o=>(0,l.jsxs)("div",{className:"rounded-full border border-dashed border-amber-300 bg-background/70 px-3 py-1.5 text-sm text-muted-foreground",children:[o," \xB7 context unknown"]},o))]})]},a.aliasId))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"No alias currently mixes known context-window sizes across its configured targets."})]})]})})}function iC({aliasId:e,alias:t,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:i=!1,disabledReason:s="",busy:c=!1,onApply:u,onRemove:f,onCopyAliasId:d=()=>{},isNew:p=!1,alwaysShowAliasIdInput:m=!1,showIssueOnSubmitOnly:b=!1,onDiscard:g=()=>{},onOpenStrategyModal:x=()=>{},titleAccessory:y=null,aliasSwitcher:h=null,framed:v=!0}){let S=Uk(e,t,{isNew:p}),C=(0,E.useMemo)(()=>k1(p?"":e,t),[S]),[T,w]=(0,E.useState)(C),[R,M]=(0,E.useState)(p),[k,I]=(0,E.useState)(!1),H=(0,E.useRef)(null);(0,E.useEffect)(()=>{w(C),M(p),I(!1)},[C,p]);let Q=!p&&Array.isArray(h?.entries)&&h.entries.length>1,ee=m||R;(0,E.useEffect)(()=>{if(!ee)return;let P=typeof window<"u"?window.requestAnimationFrame(()=>{H.current?.focus(),H.current?.select?.()}):0;return()=>{typeof window<"u"&&window.cancelAnimationFrame(P)}},[ee]);let X=String(T?.id||"").trim(),z=e===at||X===at,te=(0,E.useMemo)(()=>Fs((r||[]).filter(P=>P.kind!=="alias"&&P.value!==X&&P.value!==`alias:${X}`),(T?.targets||[]).map(P=>P?.ref)),[r,X,T?.targets]),Y=(T?.targets||[]).map(P=>String(P?.ref||"").trim()),q=(T?.targets||[]).some(P=>!String(P?.ref||"").trim()),V=dh(Y),_e=(T?.targets||[]).some(P=>{if(!String(P?.ref||"").trim())return!1;let Ye=Math.floor(Number(P?.weight));return!Number.isFinite(Ye)||Ye<=0}),F=X&&n.some(P=>P!==e&&P===X),he=X&&Y.some(P=>P===X||P===`alias:${X}`),Z=Y.filter(Boolean).length>0,ae=JSON.stringify({id:C.id,strategy:C.strategy,targets:C.targets.map(P=>({ref:P.ref,weight:String(P?.weight||"1")}))}),Se=JSON.stringify({id:X,strategy:T?.strategy,targets:(T?.targets||[]).map(P=>({ref:String(P?.ref||"").trim(),weight:String(P?.weight||"1").trim()}))}),U=ae!==Se,ne=X?Ak.test(X)?F?"Alias id already exists. Choose another id.":q?"Fill or remove blank target rows before applying.":V?"Duplicate targets are not allowed anywhere in this alias.":_e?"Target weights must be positive integers.":he?"An alias cannot target itself.":"":"Alias id must start with a letter or number and use letters, numbers, dots, underscores, colons, or hyphens.":"Alias id is required.",ue=i?s:ne,me=i?s:b&&ne&&!k?"":ne,re=i||c,oe=String(X||e||"").trim(),Ne=oe||"Select alias",Re=re||z||p,Ze=z?"Default alias cannot be removed":`Remove alias ${oe||e}`,gt=(0,E.useMemo)(()=>eh(Ne),[Ne]),Vt=z||a===e||a===X,sn=o===e||o===X,ot=p?"Enter alias name. Example: claude-opus":void 0,mo=(0,E.useMemo)(()=>eL({...T,fallbackTargets:[]},{...t,fallbackTargets:[]},r),[T,t,r]);async function Ge(){if(I(!0),ue)return!1;let P=await u(e,{...T,fallbackTargets:[]});return P&&p&&g(e),P}async function qr(P){let Ye={...T,strategy:P};return await u(e,{...Ye,fallbackTargets:[]})?p?(g(e),!0):(w(Ye),!0):!1}async function cn(){if(I(!0),ue)return!1;let P=await u(e,{...T,fallbackTargets:[]});return P&&(M(!1),I(!1)),P}function $e(){if(m)return;if(!Q){M(!1);return}let P=String(e||"").trim(),Ye=String(T?.id||"").trim();if(!Ye||Ye===P){w(Ht=>({...Ht,id:P})),M(!1),I(!1);return}cn()}function Ee(P){if(P.key==="Escape"){P.preventDefault(),w(Ye=>({...Ye,id:C.id})),M(!1),I(!1);return}!m&&P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())}async function fe(){if(ee){let P=String(e||"").trim(),Ye=String(T?.id||"").trim();if(!Ye||Ye===P){w(Ht=>({...Ht,id:P})),M(!1),I(!1);return}await cn();return}M(!0)}let ge=(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:Q?(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[(0,l.jsxs)("div",{className:W("flex h-9 min-w-0 max-w-full overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",ee?"flex-1":"w-fit"),children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Select an alias"}),ee?(0,l.jsx)(Dt,{ref:H,value:T.id,placeholder:ot,onChange:P=>w(Ye=>({...Ye,id:P.target.value})),onBlur:$e,onKeyDown:Ee,disabled:re||z,className:"h-full min-w-[12rem] flex-1 rounded-none border-0 bg-transparent px-3 text-sm font-medium shadow-none focus:border-transparent focus:ring-0"}):(0,l.jsxs)(vr,{value:h.value||void 0,onValueChange:h.onValueChange,children:[(0,l.jsx)(br,{className:"h-full min-w-[10rem] flex-none rounded-none border-0 bg-transparent px-3 pr-[50px] text-left text-sm font-medium shadow-none focus:border-transparent focus:ring-0",style:{width:`${gt}px`,maxWidth:"100%"},children:(0,l.jsx)(xr,{placeholder:"Select alias"})}),(0,l.jsx)(Sr,{children:h.entries.map(([P,Ye])=>(0,l.jsx)(ar,{value:P,searchText:`${P} ${(Ye?.targets||[]).length} ${(Ye?.fallbackTargets||[]).length}`,children:P},P))})]}),ee?null:(0,l.jsx)("button",{type:"button",className:"flex h-full w-10 shrink-0 items-center justify-center border-l border-border/70 text-muted-foreground transition hover:bg-accent/60 hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>{d(oe)},disabled:re||!oe,"aria-label":`Copy alias id ${oe}`,title:oe?`Copy alias id ${oe}`:"Alias id is not ready yet",children:(0,l.jsx)(U2,{className:"h-4 w-4 shrink-0"})})]}),(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:bg-background/90 hover:text-foreground",onMouseDown:P=>{ee&&P.preventDefault()},onClick:()=>{fe()},disabled:re||z,"aria-label":ee?"Save alias id":z?"Default alias id cannot be edited":"Edit alias id",title:ee?"Save alias id":z?"Default alias id cannot be edited":"Edit alias id",children:ee?(0,l.jsx)(I2,{className:"h-4 w-4 shrink-0"}):(0,l.jsx)(Nd,{className:"h-4 w-4 shrink-0"})}),p?null:(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:border-destructive hover:bg-background/90 hover:text-destructive",onClick:()=>f(e),disabled:Re,"aria-label":Ze,title:Ze,children:(0,l.jsx)(rh,{className:"h-4 w-4 shrink-0"})})]}):(0,l.jsxs)(l.Fragment,{children:[ee?(0,l.jsx)(Dt,{ref:H,autoFocus:p,value:T.id,placeholder:ot,onChange:P=>w(Ye=>({...Ye,id:P.target.value})),onBlur:$e,onKeyDown:Ee,disabled:re||z&&!p,className:"max-w-[22rem] font-semibold"}):z&&!p?(0,l.jsx)("div",{className:"truncate text-base font-semibold text-foreground",children:e}):(0,l.jsxs)("button",{type:"button",className:"group inline-flex max-w-full items-center gap-2 rounded-lg text-left text-base font-semibold text-foreground transition hover:bg-primary/5 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background",onClick:()=>M(!0),disabled:re,"aria-label":"Edit alias id",title:"Edit alias id",children:[(0,l.jsx)("span",{className:"truncate",children:p?X||"New alias":X||e}),(0,l.jsx)(Nd,{className:"h-4 w-4 shrink-0"})]}),y?(0,l.jsx)("div",{className:"min-w-[11rem] max-w-full",children:y}):null]})}),z?null:(0,l.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[Vt?(0,l.jsx)(Tt,{variant:"success",children:"Default route"}):null,sn?(0,l.jsx)(Tt,{variant:"info",children:"AMP default"}):null]})]}),(0,l.jsxs)("div",{className:"flex items-start gap-2 self-start",children:[(0,l.jsxs)(ce,{type:"button",variant:"outline",size:"default",className:"group h-9 gap-0 overflow-hidden rounded-lg border-border/70 bg-background/70 px-0 text-sm font-medium normal-case tracking-normal shadow-none hover:bg-background/90",onClick:()=>x({aliasLabel:X||(p?"New alias":e),strategy:T?.strategy||"auto",entries:mo,disabled:re||!!ue,onSave:qr}),disabled:re,children:[(0,l.jsx)("span",{className:"flex h-full shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Routing stratergy"}),(0,l.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-2 px-3 text-left",children:[(0,l.jsx)("span",{className:"truncate",children:gC(T.strategy||"auto")}),(0,l.jsx)(Nd,{className:"h-4 w-4 shrink-0"})]})]}),!Q&&!p?(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:border-destructive hover:bg-background/90 hover:text-destructive",onClick:()=>f(e),disabled:Re,"aria-label":Ze,title:Ze,children:(0,l.jsx)(rh,{className:"h-4 w-4 shrink-0"})}):null]})]}),(0,l.jsx)(Q2,{title:"Manage model in alias",rows:T.targets,onChange:P=>w(Ye=>({...Ye,targets:P})),options:te,disabled:re,addLabel:"Add target",emptyLabel:"No targets yet. This alias can stay empty until you wire routes back in.",helperText:"Drag to reorder targets. Weights and metadata stay with the same ref.",draftPlaceholder:"Add a new target",showDraftRow:!0,showDraftFocusButton:!0,showWeightInput:!0,filterOtherSelectedValues:!0,excludedValues:[]}),me?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:me}):null,!me&&z&&!Z?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:["The fixed ",(0,l.jsx)("code",{children:"default"})," route is empty. Requests routed to ",(0,l.jsx)("code",{children:"default"})," or ",(0,l.jsx)("code",{children:"smart"})," will return 500 until you add a working target."]}):null,p||U?(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsx)("div",{children:p?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>g(e),disabled:re,children:"Discard"}):null}),(0,l.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[U?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>{w(C),I(!1)},disabled:re,children:"Reset"}):null,p||U&&!ue?(0,l.jsx)(ce,{type:"button",onClick:()=>{Ge()},disabled:re,children:c?"Saving\u2026":p?"Create alias":"Apply alias"}):null]})]}):null]});return v?(0,l.jsx)(Xn,{children:(0,l.jsx)(Zn,{className:"space-y-4 p-5",children:ge})}):ge}function oL({aliases:e,config:t,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabledReason:i="",busy:s=!1,onApplyAlias:c,onRemoveAlias:u,onCopyAliasId:f}){let d=Object.entries(e||{}),p=!!i,[m,b]=(0,E.useState)(""),[g,x]=(0,E.useState)(!1),[y,h]=(0,E.useState)(""),v=(0,E.useMemo)(()=>Ik(),[]),[S,C]=(0,E.useState)({open:!1,aliasLabel:"",strategy:"auto",entries:[],disabled:!1,onSave:null});function T(){p||s||b(`draft-${Date.now()}`)}function w(z){(!z||z===m)&&b("")}function R(){b("")}function M({aliasLabel:z="",strategy:te="auto",entries:Y=[],disabled:q=!1,onSave:V=null}){C({open:!0,aliasLabel:z,strategy:te,entries:Y,disabled:q,onSave:V})}function k(){C(z=>({...z,open:!1}))}async function I(z,te){let Y=await c(z,te);if(Y){let q=String(te?.id||z||"").trim()||z;h(q)}return Y}(0,E.useEffect)(()=>{let z=d.map(([te])=>te);if(z.length===0){y&&h("");return}(!y||!z.includes(y))&&h(z[0])},[d,y]);let H=d.find(([z])=>z===y)||d[0]||null,Q=H?.[0]||"",ee=H?.[1]||null,X=d.length>1?{value:Q,onValueChange:h,entries:d}:null;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Xn,{children:[(0,l.jsx)(jo,{children:(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"space-y-1",children:(0,l.jsx)(Ss,{children:"Model aliases give clients one stable route across multiple provider/models, so you can swap, balance, and fail over without changing client config."})}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",onClick:()=>x(!0),children:"Help"}),(0,l.jsx)(ce,{type:"button",size:"sm",onClick:T,disabled:p||s,children:s?"Saving\u2026":"Add alias"})]})]})}),(0,l.jsxs)(Zn,{className:"space-y-4",children:[p?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:i}):null,d.length>0?Q&&ee?(0,l.jsx)(iC,{aliasId:Q,alias:ee,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:p,disabledReason:i,busy:s,onApply:I,onRemove:u,onCopyAliasId:f,onOpenStrategyModal:M,aliasSwitcher:X,framed:!1},Q):null:(0,l.jsxs)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:["No model aliases yet. Add one to expose stable routes like ",(0,l.jsx)("code",{children:"coding"})," or ",(0,l.jsx)("code",{children:"chat.fast"})," in the Web UI."]})]})]}),(0,l.jsx)(Sa,{open:!!m,onClose:R,title:"Add alias",description:"Set a stable client-facing route, choose its strategy, and order the targets it should use.",showCloseButton:!1,contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:m?(0,l.jsx)(iC,{aliasId:m,alias:v,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:p,disabledReason:i,busy:s,onApply:I,onRemove:u,onCopyAliasId:f,isNew:!0,alwaysShowAliasIdInput:!0,showIssueOnSubmitOnly:!0,onDiscard:w,onOpenStrategyModal:M,framed:!1},m):null}),(0,l.jsx)(rL,{open:S.open,onClose:k,onSave:z=>S.onSave?.(z),aliasLabel:S.aliasLabel,initialStrategy:S.strategy,entries:S.entries,disabled:S.disabled}),(0,l.jsx)(aL,{open:g,onClose:()=>x(!1),config:t})]})}function iL({children:e,onClick:t,disabled:n=!1,title:r="",className:a=""}){return(0,l.jsx)("button",{type:"button",className:W("inline-flex items-center rounded-full border border-border bg-background/70 px-2.5 py-1 text-[11px] font-medium tracking-wide text-muted-foreground transition hover:border-primary/35 hover:bg-primary/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",a),onClick:t,disabled:n,title:r,"aria-label":r||void 0,children:e})}function lL({provider:e,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i="",busy:s=!1}){let c=(0,E.useMemo)(()=>b2(e),[e]),[u,f]=(0,E.useState)(c),[d,p]=(0,E.useState)(!1),[m,b]=(0,E.useState)(!1),[g,x]=(0,E.useState)(!1),[y,h]=(0,E.useState)("provider"),[v,S]=(0,E.useState)(""),[C,T]=(0,E.useState)(0),[w,R]=(0,E.useState)({isDirty:!1,issue:"",locked:!1,rows:[]}),[M,k]=(0,E.useState)({phase:"",modelStates:{},failedModelIds:[],message:""}),I=(0,E.useRef)(null),H=(0,E.useRef)(null),Q=(0,E.useRef)(null),ee=(0,E.useRef)(null);(0,E.useEffect)(()=>{f(c)},[c]);let z=uo(e)!=="api",te=(Array.isArray(e?.models)?e.models:[]).map(fe=>String(fe?.id||"").trim()).filter(Boolean),Y=vl(e),q=z?"":jk(e?.rateLimits),V=z?[]:Hr(u?.endpoints,u?.endpointDraft),_e=z?[]:xa(u?.rateLimitRows),F=JSON.stringify({id:String(u?.id||"").trim(),name:String(u?.name||"").trim(),credentialInput:String(u?.credentialInput||"").trim(),endpoints:V,endpointDraft:String(u?.endpointDraft||"").trim(),rateLimitRows:K1(u?.rateLimitRows)}),he=JSON.stringify({id:String(c?.id||"").trim(),name:String(c?.name||"").trim(),credentialInput:String(c?.credentialInput||"").trim(),endpoints:ba(c?.endpoints),endpointDraft:String(c?.endpointDraft||"").trim(),rateLimitRows:K1(c?.rateLimitRows)}),Z=F!==he,ae=!!i||s,Se=new Set((Array.isArray(w.rows)?w.rows:[]).map(fe=>String(fe?.id||"").trim()).filter(Boolean)),U=M.failedModelIds.filter(fe=>Se.has(fe)),ne=ae||M.phase==="testing"||M.phase==="saving",ue=z?"":ti(_e,{knownModelIds:te,requireAtLeastOne:!0}),me=i||(String(u?.id||"").trim()?Md.test(String(u?.id||"").trim())?String(u?.name||"").trim()?!z&&V.length===0?"Add at least one endpoint for API Key providers.":!z&&V.some(fe=>!$s(fe))?"All endpoints must start with http:// or https://.":ue:"Provider name is required.":"Provider id must start with a letter and use lowercase letters, digits, or dashes only.":"Provider id is required."),re=z?u:{...u,endpoints:V,endpointDraft:""},oe=!!w.isDirty,Ne=Z||oe,Re=[Z?"provider settings":"",oe?"model list":""].filter(Boolean),Ze=[Z&&me?`Provider: ${me}`:"",oe&&w.issue?`Models: ${w.issue}`:""].filter(Boolean).join(" "),gt=ae||M.phase==="testing"||M.phase==="saving"||Z&&!!me||oe&&(!!w.issue||w.locked)||typeof o!="function";async function Vt(){let fe=await r(e.id,re);return fe&&Ge(),fe}async function sn(fe){let ge=await a(e.id,fe,{providerDraft:Z?re:null,onModelTestStateChange:P=>{k({phase:String(P?.phase||""),modelStates:P?.modelStates&&typeof P.modelStates=="object"?P.modelStates:{},failedModelIds:Array.isArray(P?.failedModelIds)?P.failedModelIds:[],message:String(P?.message||"")})}});return ge&&Ge(),ge}function ot(){f(c)}let mo=(0,E.useCallback)(fe=>{R(fe)},[]);function Ge(){b(!1),x(!1),p(!1),h("provider"),S(""),f(c),R({isDirty:!1,issue:"",locked:!1,rows:[]}),k({phase:"",modelStates:{},failedModelIds:[],message:""})}async function qr(){let fe=(Array.isArray(w.rows)?w.rows:[]).filter(P=>!U.includes(String(P?.id||"").trim()));return fe.length===0&&!Z||await o(e.id,{providerDraft:Z?re:null,modelRows:oe?fe:null,onModelTestStateChange:P=>{k({phase:String(P?.phase||""),modelStates:P?.modelStates&&typeof P.modelStates=="object"?P.modelStates:{},failedModelIds:Array.isArray(P?.failedModelIds)?P.failedModelIds:[],message:String(P?.message||"")})}})?(Ge(),!0):(h("models"),!1)}(0,E.useEffect)(()=>{k({phase:"",modelStates:{},failedModelIds:[],message:""})},[c]),(0,E.useEffect)(()=>{U.length>0||!g||x(!1)},[U,g]),(0,E.useEffect)(()=>{if(!d||y!=="provider"||v!=="endpoint"&&v!=="rate-limit"||typeof window>"u")return;let fe=window.requestAnimationFrame(()=>{let ge=v==="endpoint"?I.current:Q.current,P=v==="endpoint"?H.current:ee.current;ge?.scrollIntoView?.({block:"nearest"}),P?.focus?.(),P?.select?.(),S("")});return()=>window.cancelAnimationFrame(fe)},[d,y,v]);function cn(fe="provider",ge=""){b(!1),x(!1),h(fe),S(ge),fe==="models"&&ge==="models"&&T(P=>P+1),p(!0)}function $e(){if(!ne){if(U.length>0){b(!1),x(!0);return}if(Ne){b(!0);return}Ge()}}async function Ee(){if(gt)return;if(!await o(e.id,{providerDraft:Z?re:null,modelRows:oe?w.rows:null,onModelTestStateChange:ge=>{k({phase:String(ge?.phase||""),modelStates:ge?.modelStates&&typeof ge.modelStates=="object"?ge.modelStates:{},failedModelIds:Array.isArray(ge?.failedModelIds)?ge.failedModelIds:[],message:String(ge?.message||"")})}})){oe&&(b(!1),h("models"));return}Ge()}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Xn,{children:(0,l.jsxs)(Zn,{className:"space-y-3 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1 px-0.5 py-0.5",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[(0,l.jsx)("span",{className:"text-base font-semibold text-foreground",children:e.name||e.id}),(0,l.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",e.id,")"]})]})}),(0,l.jsxs)("div",{className:"flex items-start gap-2 self-start",children:[(0,l.jsxs)(ce,{type:"button",variant:"outline",size:"sm",className:"gap-1.5 normal-case tracking-normal",onClick:()=>cn("provider"),disabled:ae,"aria-label":`Edit provider ${e.name||e.id}`,title:"Edit provider",children:[(0,l.jsx)(Nd,{className:"h-4 w-4 shrink-0"}),"Edit"]}),(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-8 w-8 shrink-0 p-0 text-muted-foreground hover:border-destructive/35 hover:bg-destructive/5 hover:text-destructive",onClick:()=>t(e.id),disabled:s,"aria-label":"Remove provider",title:"Remove provider",children:(0,l.jsx)(rh,{className:"h-4 w-4"})})]})]}),te.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2 pt-1",children:te.map(fe=>(0,l.jsx)(iL,{onClick:()=>n?.(fe),title:`Copy model id ${fe}`,className:"max-w-full",children:(0,l.jsx)("span",{className:"truncate",children:fe})},`${e.id}-${fe}`))}):null]})}),(0,l.jsx)(Sa,{open:d,onClose:$e,title:`Edit \xB7 ${e.id}`,description:M.phase==="testing"?M.message||"Testing new models before save.":M.phase==="saving"?M.message||"Saving provider changes.":"Switch between provider settings and model list. Each tab saves independently.",closeDisabled:ne,closeOnBackdrop:!ne,closeOnEscape:!ne,contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)] pb-0",children:(0,l.jsxs)(Vu,{value:y,onValueChange:h,children:[(0,l.jsxs)(Hu,{className:"w-full justify-start",children:[(0,l.jsx)(Or,{value:"provider",children:"Provider"}),(0,l.jsx)(Or,{value:"models",children:"Model list"})]}),(0,l.jsxs)(_r,{forceMount:!0,value:"provider",className:W("space-y-4 pb-4",y!=="provider"?"hidden":null),children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/60 p-4",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Update provider identity and connection settings here."})]}),(0,l.jsx)(Tt,{variant:"outline",children:z?"Subscription":"API Key"})]})}),(0,l.jsxs)("div",{className:W("grid gap-3",z?"md:grid-cols-2":"md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"),children:[(0,l.jsx)(st,{label:"Provider name",stacked:!0,children:(0,l.jsx)(Dt,{value:u.name,onChange:fe=>f(ge=>({...ge,name:fe.target.value})),disabled:ne})}),(0,l.jsx)(st,{label:"Provider id",hint:"Used in direct routes like provider/model",stacked:!0,children:(0,l.jsx)(Dt,{value:u.id,onChange:fe=>f(ge=>({...ge,id:Vr(fe.target.value)})),disabled:ne})})]}),z?null:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(st,{label:"API key or env",hint:"Use an env var like OPENAI_API_KEY or paste the direct key.",stacked:!0,children:(0,l.jsx)(Dt,{value:u.credentialInput||"",onChange:fe=>f(ge=>({...ge,credentialInput:fe.target.value})),disabled:ne,placeholder:"Example: OPENAI_API_KEY or sk-..."})}),(0,l.jsx)("div",{ref:I,children:(0,l.jsx)(st,{label:"Endpoints",hint:Y.length>1?"Comma, space, or newline turns into chips. The first endpoint stays active until you re-test this provider.":"Comma, space, or newline turns into chips.",stacked:!0,children:(0,l.jsx)(ah,{values:u.endpoints,onChange:fe=>f(ge=>({...ge,endpoints:fe})),draftValue:u.endpointDraft,onDraftValueChange:fe=>f(ge=>({...ge,endpointDraft:fe})),commitOnBlur:!0,disabled:ne,isValueValid:$s,inputRef:H,inputClassName:"placeholder:text-muted-foreground/55",placeholder:"Click here to type new endpoint",helperText:"Paste one or more endpoints"})})}),(0,l.jsx)("div",{ref:Q,className:"grid gap-3 md:grid-cols-2 xl:grid-cols-[minmax(0,1.35fr)_minmax(0,0.8fr)_minmax(0,0.8fr)_minmax(0,1fr)]",children:(0,l.jsx)("div",{className:"md:col-span-2 xl:col-span-4",children:(0,l.jsx)(st,{label:"Rate limit",stacked:!0,headerAction:(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:()=>f(fe=>({...fe,rateLimitRows:MC(fe.rateLimitRows)})),disabled:ne,children:"Add rate limit"}),children:(0,l.jsx)(OC,{rows:u.rateLimitRows,onChange:fe=>f(ge=>({...ge,rateLimitRows:fe})),availableModelIds:te,disabled:ne,inputRef:ee})})})})]}),me?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:me}):null,(0,l.jsxs)("div",{className:"flex min-h-9 items-center justify-end gap-2",children:[!ne&&Z?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:ot,children:"Reset"}):null,Z&&!me?(0,l.jsx)(ce,{type:"button",onClick:()=>{Vt()},disabled:ne,children:M.phase==="saving"||s?"Saving\u2026":"Save provider"}):null]})]}),(0,l.jsx)(_r,{forceMount:!0,value:"models",className:W(y!=="models"?"hidden":null),children:(0,l.jsx)(W2,{provider:e,disabled:!!i,disabledReason:i,busy:s,framed:!1,focusRequest:C,onStateChange:mo,onApply:sn,testStateByModel:M.modelStates,savePhase:M.phase,saveMessage:M.message})})]})}),(0,l.jsx)(z2,{open:m,onKeepEditing:()=>b(!1),onDiscardAndClose:Ge,onSaveAndClose:Ee,saveDisabled:gt,dirtyLabels:Re,details:Ze}),(0,l.jsx)(B2,{open:g,failedModelIds:U,onKeepEditing:()=>x(!1),onRemoveFailedAndClose:qr,removeDisabled:ne||typeof o!="function"})]})}function sL({providers:e,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i="",busy:s=!1}){return e.length?(0,l.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:e.map(c=>(0,l.jsx)(lL,{provider:c,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i,busy:s},c.id))}):(0,l.jsx)(Xn,{children:(0,l.jsx)(Zn,{className:"flex flex-col gap-4 p-5 text-sm text-muted-foreground",children:(0,l.jsx)("div",{children:"No enabled providers are configured yet. Use Add provider to create your first provider, model list, and rate limits."})})})}function cL({providers:e,onAddProvider:t,onRemove:n,onCopyModelId:r,onApplyProviderDetails:a,onApplyProviderModels:o,onSaveAndCloseEditor:i,disabledReason:s="",busy:c=!1}){return(0,l.jsxs)("section",{className:"rounded-2xl border border-border/70 bg-card p-4","aria-label":"Provider models",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider & Models"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Manage providers, direct model routes, endpoints, and rate limits in one place."})]}),(0,l.jsx)(ce,{onClick:t,children:"Add provider"})]}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(sL,{providers:e,onRemove:n,onCopyModelId:r,onApplyProviderDetails:a,onApplyProviderModels:o,onSaveAndCloseEditor:i,disabledReason:s,busy:c})})]})}function uL({rows:e,routeOptions:t,webSearchSnapshot:n,ampClientUrl:r,ampClientGlobal:a,routingBusy:o,onToggleGlobalRouting:i,onInboundChange:s,onOutboundChange:c,onCreateEntry:u,onRemoveEntry:f,onOpenWebSearchTab:d,onOpenConfigPath:p,onOpenSecretsPath:m,hasMasterKey:b,disabledReason:g,autosaveState:x}){let[y,h]=(0,E.useState)(!1),[v,S]=(0,E.useState)(""),[C,T]=(0,E.useState)(String(t[0]?.value||"").trim()),w=e.some(q=>String(q?.inbound||"").trim()===String(v||"").trim()&&String(v||"").trim()),R=String(v||"").trim()&&String(C||"").trim()&&!w,M=a?.routedViaRouter===!0,k=String(a?.error||"").trim(),I=!!(b&&r&&!g&&!k),H=Number(n?.configuredProviderCount)||0,Q=M&&H===0,ee=g?"warning":x.status==="error"?"danger":x.status==="pending"?"outline":x.status==="saving"?"info":x.savedAt?"success":"outline",X=g?"Needs review":x.status==="error"?"Save failed":x.status==="pending"?"Unsaved":x.status==="saving"?"saving...":x.savedAt?"Saved":"Ready",z=g||(x.status==="error"?x.message:x.status==="pending"?"Unsaved changes queued. Auto-save will run shortly.":x.status==="saving"?"Saving changes...":x.savedAt?`Last saved ${vh(x.savedAt)}.`:"AMP route changes auto-save after valid edits.");async function te(){!R||await u?.({inbound:v,outbound:C})===!1||(h(!1),S(""),T(String(t[0]?.value||"").trim()))}function Y(){h(!0),S(""),T(String(t[0]?.value||"").trim())}return(0,l.jsx)("div",{className:"grid gap-4",children:(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-3 p-4 pb-0 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(el,{className:"flex items-center gap-2",children:(0,l.jsx)("span",{children:"Use AMP via LLM Router"})}),(0,l.jsx)(TC,{primaryLabel:"Config file",primaryValue:a?.settingsFilePath||"",onOpenPrimary:p,secondaryLabel:"Secrets file",secondaryValue:a?.secretsFilePath||"",secondaryIcon:(0,l.jsx)(q2,{className:"h-3 w-3"}),onOpenSecondary:m})]}),(0,l.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:(0,l.jsx)(ce,{type:"button",size:"sm",variant:M?"outline":void 0,onClick:i,disabled:o!==""||!M&&!I,children:o==="enable"?"Connecting\u2026":o==="disable"?"Disconnecting\u2026":M?"Disconnect":"Connect"})})]}),(0,l.jsxs)(Zn,{className:"space-y-4 p-4",children:[k?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:k}):null,!M&&!b?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:["Set ",(0,l.jsx)("code",{children:"masterKey"})," first to connect AMP."]}):null,Q?(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:[(0,l.jsx)("div",{className:"max-w-3xl",children:"AMP is connected, but no alternative web search provider is configured. AMP web search is only available through the shared Web Search tab."}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:d,children:"Open Web Search"})]}):null,g?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:g}):(0,l.jsxs)("div",{className:"space-y-3 rounded-2xl border border-border/70 bg-background/60 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Route mapping editor"}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:"Map built-in AMP route keys and wildcard model matches to managed routes."})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Tt,{variant:ee,children:X}),(0,l.jsxs)(Tt,{variant:"outline",children:[e.length," routes"]}),(0,l.jsx)(ce,{type:"button",size:"sm",onClick:Y,children:"Add custom mapping"})]})]}),(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:z}),y?(0,l.jsx)("div",{className:"rounded-2xl border border-dashed border-border bg-background/80 p-3",children:(0,l.jsxs)("div",{className:"grid gap-3 xl:grid-cols-[160px_minmax(0,1fr)_minmax(0,1fr)] xl:items-start",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Add custom mapping"}),(0,l.jsx)(Tt,{variant:"info",children:"Custom"})]}),(0,l.jsxs)("div",{className:"text-xs leading-5 text-muted-foreground",children:["Match a built-in AMP route key like ",(0,l.jsx)("code",{children:"smart"})," or a wildcard such as ",(0,l.jsx)("code",{children:"gpt-*-codex*"}),", then send it to any managed route."]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)(ce,{type:"button",size:"sm",onClick:te,disabled:!R,children:"Create mapping"}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(!1),children:"Close"})]})]}),(0,l.jsx)(st,{label:"Inbound match",hint:"Built-in route key or AMP model pattern",children:(0,l.jsx)(Dt,{value:v,onChange:q=>S(q.target.value),placeholder:"smart or gpt-*-codex*"})}),(0,l.jsx)(st,{label:"Route target",hint:"Alias or provider/model route in LLM Router",children:(0,l.jsxs)(vr,{value:C||void 0,onValueChange:T,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Select local route"})}),(0,l.jsx)(Sr,{children:Bd(t,{keyPrefix:"amp-route-create",includeHint:!0})})]})})]})}):null,(0,l.jsx)("div",{className:"space-y-2",children:e.map(q=>(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-3",children:(0,l.jsxs)("div",{className:"grid gap-3 xl:grid-cols-[160px_minmax(0,1fr)_minmax(0,1fr)] xl:items-start",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:q.label}),q.isCustom?(0,l.jsx)(Tt,{variant:"info",children:"Custom"}):null]}),(0,l.jsx)("div",{className:"text-xs leading-5 text-muted-foreground",children:q.description}),q.removable?(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>f(q.id),children:"Remove"}):null]}),(0,l.jsx)(st,{label:"Inbound wildcard",hint:q.defaultMatch?`Default: ${q.defaultMatch}`:"AMP model pattern",children:(0,l.jsx)(jg,{commitOnBlur:!0,value:q.inbound,onValueCommit:V=>s(q.id,V),placeholder:q.defaultMatch||"gpt-*-codex*",onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),V.currentTarget.blur())}})}),(0,l.jsx)(st,{label:"Target route",hint:"Alias or provider/model route",children:(0,l.jsxs)(vr,{value:q.outbound||"__default__",onValueChange:V=>c(q.id,V),children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:q.removable?"Choose target route":"Use default route"})}),(0,l.jsxs)(Sr,{children:[q.removable?null:(0,l.jsx)(ar,{value:"__default__",children:"Use default route"}),Bd(t,{keyPrefix:`amp-route-${q.id}`,includeHint:!0})]})]})})]})},q.id))})]})]})]})})}function dL({open:e=!1,onClose:t=()=>{},candidates:n=[],onTestAndAdd:r=async()=>{},disabledReason:a=""}){let[o,i]=(0,E.useState)(""),[s,c]=(0,E.useState)(""),[u,f]=(0,E.useState)(!1),[d,p]=(0,E.useState)(""),m=Array.isArray(n)?n:[],b=m.find(v=>v.providerId===o)||m[0]||null,g=Array.isArray(b?.models)?b.models:[];(0,E.useEffect)(()=>{if(!e){f(!1),p("");return}let v=m[0]?.providerId||"";i(S=>m.some(T=>T.providerId===S)?S:v)},[e,m]),(0,E.useEffect)(()=>{let v=g[0]?.value||"";c(S=>g.some(T=>T.value===S)?S:v)},[g]);let x=yl(o,s),y=e&&!u&&!a&&o&&s;async function h(){if(y){f(!0),p("");try{await r({providerId:o,modelId:s}),t()}catch(v){p(v instanceof Error?v.message:String(v))}finally{f(!1)}}}return(0,l.jsx)(Sa,{open:e,onClose:()=>{u||t()},title:"Add ChatGPT Search Endpoint",description:"Choose a configured OpenAI-compatible GPT route. Test runs a live Responses API request with the native web search tool, then saves the route on success.",contentClassName:"max-h-[92vh] max-w-3xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,disabled:u,children:"Cancel"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{h()},disabled:!y,children:u?"Testing\u2026":"Test connection"})]}),children:(0,l.jsxs)("div",{className:"space-y-4",children:[a?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:a}):null,!a&&m.length===0?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:"No configured OpenAI-compatible GPT providers are available yet. Add a provider with a GPT model first."}):null,m.length>0?(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,l.jsx)(st,{label:"Provider",hint:"Configured provider or ChatGPT subscription",stacked:!0,children:(0,l.jsxs)(vr,{value:o||void 0,onValueChange:i,disabled:u||!!a,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose provider"})}),(0,l.jsx)(Sr,{children:m.map(v=>(0,l.jsx)(ar,{value:v.providerId,children:v.providerLabel},v.providerId))})]})}),(0,l.jsx)(st,{label:"GPT model",hint:"Only GPT models on OpenAI-compatible routes are listed",stacked:!0,children:(0,l.jsxs)(vr,{value:s||void 0,onValueChange:c,disabled:u||!!a||g.length===0,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose model"})}),(0,l.jsx)(Sr,{children:g.map(v=>(0,l.jsx)(ar,{value:v.value,children:v.label},v.routeId))})]})})]}):null,x?(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Saved route id"}),(0,l.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:x}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This route stores only the provider/model reference. No separate API key or quota is saved here."})]}):null,d?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:d}):null]})})}function fL({webSearchConfig:e,webSearchProviders:t,hostedSearchCandidates:n,onWebSearchStrategyChange:r,onWebSearchProviderChange:a,onWebSearchProviderMove:o,onRemoveWebSearchProvider:i,onAddHostedSearchEndpoint:s,disabledReason:c,autosaveState:u}){let[f,d]=(0,E.useState)(!1),p=String(e?.strategy||"ordered").trim()==="quota-balance"?"quota-balance":"ordered",m=Array.isArray(n)&&n.some(g=>Array.isArray(g?.models)&&g.models.length>0),b=c||(u.status==="error"?u.message:u.status==="pending"?"Unsaved changes queued. Auto-save will run shortly.":u.status==="saving"?"Saving changes...":u.savedAt?`Last saved ${vh(u.savedAt)}.`:"");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-4 p-4 pb-0 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)(el,{children:"Web Search"}),(0,l.jsx)(Ss,{className:"text-xs leading-5",children:"Shared web search routing for AMP and other router-managed tools."}),b?(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:b}):null]}),(0,l.jsxs)("div",{className:"flex w-full shrink-0 flex-wrap items-end justify-end gap-3 xl:w-auto",children:[(0,l.jsxs)("div",{className:"min-w-[12rem] space-y-1",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Routing strategy"}),(0,l.jsxs)(vr,{value:p,onValueChange:r,disabled:!!c,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose strategy"})}),(0,l.jsx)(Sr,{children:Ek.map(g=>(0,l.jsx)(ar,{value:g.value,children:g.label},g.value))})]})]}),(0,l.jsxs)(ce,{type:"button",variant:"outline",className:"gap-2",onClick:()=>d(!0),disabled:!!c||!m,children:[(0,l.jsx)(pC,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Endpoint"})]})]})]}),(0,l.jsx)(Zn,{className:"space-y-4 p-4",children:(0,l.jsx)("div",{className:"space-y-3",children:(t||[]).map(g=>{if(g.kind==="hosted"){let h=g.runtimeState&&g.runtimeState.ready===!1?"This provider/model route is no longer available or is not OpenAI-compatible.":"";return(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(q1,{active:g.active}),(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label}),(0,l.jsx)(Tt,{variant:"outline",children:"GPT Search"})]}),(0,l.jsx)("div",{className:"mt-1 text-xs break-all text-muted-foreground",children:g.routeId}),(0,l.jsx)("div",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:"Uses the provider's native OpenAI Responses web search tool. No local API key or quota is stored here."})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 self-start",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border/70 bg-background/70 p-1",children:[(0,l.jsx)(Ks,{disabled:!!c||g.displayIndex<=0,label:`Move ${g.routeId} up`,onClick:()=>o(g.id,"up")}),(0,l.jsx)(kd,{disabled:!!c||g.displayIndex>=g.displayCount-1,label:`Move ${g.routeId} down`,onClick:()=>o(g.id,"down")})]}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>i(g.id),disabled:!!c,children:"Remove"})]})]}),h?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:h}):null]})},g.key)}let x=g.credentialField,y=String(g?.credentialValue||"").trim();return(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsx)("div",{className:"min-w-0",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(q1,{active:g.active}),(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label})]})}),(0,l.jsxs)("div",{className:"flex items-center gap-2 self-start rounded-xl border border-border/70 bg-background/70 p-1",children:[(0,l.jsx)(Ks,{disabled:!!c||g.displayIndex<=0,label:`Move ${g.label} up`,onClick:()=>o(g.id,"up")}),(0,l.jsx)(kd,{disabled:!!c||g.displayIndex>=g.displayCount-1,label:`Move ${g.label} down`,onClick:()=>o(g.id,"down")})]})]}),(0,l.jsxs)("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.35fr)]",children:[(0,l.jsx)(st,{label:g.credentialLabel,hint:g.credentialField==="url"?"Required to enable this backend.":"Required to enable this backend. Stored in router config.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(jg,{type:g.credentialField==="url"?"text":"password",autoComplete:"off",value:y,placeholder:g.credentialPlaceholder,onValueChange:h=>a(g.id,x,h),disabled:!!c})}),(0,l.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,l.jsx)(st,{label:"Result per call",hint:"Empty keeps the default of 5.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:g.resultPerCallInput,placeholder:"Default: 5",allowEmptyCommit:!0,onValueChange:h=>a(g.id,"count",h),disabled:!!c})}),(0,l.jsx)(st,{label:"Monthly limit",hint:"0 keeps quotas self-managed.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:String(g.limit||0),onValueChange:h=>a(g.id,"limit",h),disabled:!!c})}),(0,l.jsx)(st,{label:"Synced remaining",hint:"Adjust after manual upstream sync.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:String(g.remaining||0),onValueChange:h=>a(g.id,"remaining",h),disabled:!!c})})]})]})]})},g.key)})})})]}),(0,l.jsx)(dL,{open:f,onClose:()=>d(!1),candidates:n,onTestAndAdd:s,disabledReason:c})]})}function lC({toolName:e,toolState:t,endpointUrl:n,routeOptions:r,connectionBusy:a,bindingBusy:o,onToggleRouting:i,onBindingChange:s,hasMasterKey:c,disabledReason:u,onOpenPrimaryPath:f,onOpenSecondaryPath:d,secondaryPathLabel:p="Backup file",secondaryPathIcon:m=(0,l.jsx)(EC,{className:"h-3 w-3"}),bindingFields:b=[],guideContent:g=null}){let x=t?.routedViaRouter===!0,y=String(t?.error||"").trim(),h=!!(c&&n&&!u&&!y),v=(0,E.useMemo)(()=>{let C=new Set(["__unset__"]);for(let T of b){for(let w of Array.isArray(T?.extraOptions)?T.extraOptions:[]){let R=String(w?.value||"").trim();R&&C.add(R)}for(let w of Array.isArray(T?.options)?T.options:[]){let R=String(w?.value||"").trim();R&&C.add(R)}}return b.filter(T=>T?.usesRouteOptions!==!1).map(T=>String(T?.value||"").trim()).filter(T=>T&&!C.has(T))},[b]),S=Fs(r,v);return(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-3 p-4 pb-0 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(el,{className:"flex items-center gap-2",children:(0,l.jsx)("span",{children:`Use ${e} via LLM Router`})}),(0,l.jsx)(TC,{primaryLabel:"Config file",primaryValue:t?.configFilePath||t?.settingsFilePath||"",onOpenPrimary:f,secondaryLabel:p,secondaryValue:t?.backupFilePath||"",secondaryIcon:m,onOpenSecondary:d})]}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[g?(0,l.jsx)(pL,{guideContent:g}):null,(0,l.jsx)(ce,{type:"button",size:"sm",variant:x?"outline":void 0,onClick:i,disabled:a!==""||!x&&!h,children:a==="enable"?"Connecting\u2026":a==="disable"?"Disconnecting\u2026":x?"Disconnect":"Connect"})]})]}),(0,l.jsxs)(Zn,{className:"space-y-4 p-4",children:[y?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:y}):null,!x&&!c?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:["Set ",(0,l.jsx)("code",{children:"masterKey"})," first to connect ",e,"."]}):null,u?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:u}):null,(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/60 p-4",children:[(0,l.jsx)("div",{children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Model bindings"}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:"Prefer LLM Router aliases here so you can retarget models later from the Alias & Fallback tab."})]})}),b.length===0?(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:"No tool bindings are available yet."}):(0,l.jsx)("div",{className:"mt-4 grid gap-3",children:b.map(C=>(0,l.jsxs)("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3",children:[(0,l.jsxs)("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:C.label}),(0,l.jsx)(Tt,{variant:"outline",children:C.envKey})]}),(0,l.jsx)("div",{className:"mb-3 text-xs leading-5 text-muted-foreground",children:C.description}),(0,l.jsx)(gL,{field:C,routeOptions:S,disabled:C.standaloneWhenDisconnected?o:!x||o,onValueChange:T=>s(C.id,T==="__unset__"?"":T)})]},C.id))})]})]})]})}function mL(e="outline"){switch(e){case"success":return"border-emerald-200 bg-emerald-50";case"warning":return"border-amber-200 bg-amber-50";case"danger":return"border-rose-200 bg-rose-50";case"info":return"border-sky-200 bg-sky-50";default:return"border-border/70 bg-background/70"}}function sC(e="outline"){switch(e){case"success":return"text-emerald-950";case"warning":return"text-amber-950";case"danger":return"text-rose-950";case"info":return"text-sky-950";default:return"text-foreground"}}function pL({guideContent:e}){let[t,n]=(0,E.useState)(!1),r=String(e?.title||"").trim()||"Guide",a=String(e?.description||"").trim(),o=Array.isArray(e?.badges)?e.badges.filter(Boolean):[],i=Array.isArray(e?.highlights)?e.highlights.filter(Boolean):[],s=Array.isArray(e?.sections)?e.sections.filter(Boolean):[],c=e?.callout&&e.callout.body?e.callout:null,u=c?.variant||"outline";return i.length===0&&s.length===0&&!c?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline","aria-label":r,onClick:()=>n(!0),children:"Guide"}),(0,l.jsx)(Sa,{open:t,onClose:()=>n(!1),title:r,description:a,contentClassName:"max-h-[92vh] max-w-4xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsxs)("div",{className:"space-y-4",children:[o.length>0?(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:o.map((f,d)=>(0,l.jsx)(Tt,{variant:f?.variant||"outline",children:f?.label},`${r}-badge-${d}`))}):null,c?(0,l.jsxs)("div",{className:W("rounded-2xl border p-4",mL(u)),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Tt,{variant:["success","warning","danger","info"].includes(u)?u:"outline",children:u==="success"?"Current best fit":u==="warning"?"Needs attention":u==="info"?"Current behavior":"Guide note"}),(0,l.jsx)("div",{className:W("text-sm font-medium",sC(u)),children:c.title})]}),(0,l.jsx)("div",{className:W("mt-3 text-sm leading-6",sC(u)),children:c.body})]}):null,i.length>0?(0,l.jsx)("div",{className:W("grid gap-4",i.length>2?"md:grid-cols-3":"md:grid-cols-2"),children:i.map((f,d)=>(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[f?.eyebrow?(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:f.eyebrow}):null,(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:f?.title}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f?.body})]},`${r}-highlight-${d}`))}):null,s.map((f,d)=>{let p=Array.isArray(f?.items)?f.items.filter(Boolean):[];return(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:f?.title}),f?.description?(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f.description}):null,p.length>0?(0,l.jsx)("div",{className:"mt-3 space-y-3",children:p.map((m,b)=>(0,l.jsxs)("div",{className:"flex gap-3 text-sm leading-6 text-foreground",children:[(0,l.jsx)("span",{className:"mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground/50"}),(0,l.jsx)("div",{className:"min-w-0",children:m})]},`${r}-section-${d}-item-${b}`))}):null]},`${r}-section-${d}`)})]})})]})}function gL({field:e,routeOptions:t,disabled:n=!1,onValueChange:r}){let a=String(e?.value||"").trim()||(e?.allowUnset?"__unset__":""),o=(0,E.useMemo)(()=>{let i=e?.usesRouteOptions===!1?[]:t,s=Array.isArray(e?.options)?e.options:[],c=Array.isArray(e?.extraOptions)?e.extraOptions:[];return e?.allowUnset?[{value:"__unset__",label:"Inherit tool default",hint:""},...c,...s,...i]:[...c,...s,...i]},[e?.allowUnset,e?.extraOptions,e?.options,e?.usesRouteOptions,t]);return(0,l.jsxs)(vr,{value:a,onValueChange:r,disabled:n||o.length===0,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:e.placeholder||"Select a route"})}),(0,l.jsx)(Sr,{children:o.length>0?Bd(o,{keyPrefix:e.id||"binding-option"}):(0,l.jsx)(ar,{value:"__no-route-options",disabled:!0,children:"No routes available"})})]})}function hL({logs:e,activityLogEnabled:t=!0,activityFilter:n="usage",busyAction:r="",onActivityFilterChange:a,onToggleEnabled:o,onClear:i}){let s=Array.isArray(e)?e:[],c=s.filter(f=>n==="all"?!0:V1(f)===n),u=Ad[n]||Ad.usage;return(0,l.jsxs)(Xn,{children:[(0,l.jsx)(jo,{children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)(el,{children:"Activity"}),(0,l.jsx)(Ss,{children:t?"Router actions, request fallbacks, and runtime issues stream here.":"Activity logging is paused. Re-enable it to capture router actions, request fallbacks, and runtime issues."})]}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"min-w-[13rem]",children:(0,l.jsxs)(vr,{value:n,onValueChange:a,searchEnabled:!1,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Filter category"})}),(0,l.jsx)(Sr,{children:yk.map(f=>(0,l.jsx)(ar,{value:f.value,children:f.label},f.value))})]})}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:r!==""||!e?.length,children:r==="clear"?"Clearing\u2026":"Clear log"}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:t?"outline":"default",onClick:o,disabled:r!=="",children:r==="toggle"?"Updating\u2026":t?"Disable log":"Enable log"})]})]})}),(0,l.jsx)(Zn,{children:(0,l.jsx)("div",{className:"max-h-[32rem] space-y-3 overflow-auto pr-1",children:c.length?c.map(f=>{let d=V1(f),p=Ad[d]||Ad.usage;return(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:W("inline-flex h-2.5 w-2.5 rounded-full ring-4",I1[f.level]||I1.info)}),(0,l.jsx)(Tt,{variant:p.badgeVariant,children:p.label}),(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:f.message})]}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:vh(f.time)})]}),f.detail?(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f.detail}):null]},f.id)}):s.length?(0,l.jsxs)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:["No ",u.emptyLabel," activity matches the current filter. Switch the dropdown to inspect the hidden categories."]}):(0,l.jsx)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:"Activity is quiet. Save config changes or start the router to populate this stream."})})})]})}function ah({values:e,onChange:t,placeholder:n,helperText:r,inputRef:a=null,inputClassName:o="",suggestedValues:i=[],valueStates:s={},draftValue:c="",onDraftValueChange:u=()=>{},commitOnBlur:f=!1,disabled:d=!1,isValueValid:p=m=>!!String(m||"").trim()}){let m=(0,E.useMemo)(()=>ba(e),[e]),[b,g]=(0,E.useState)(""),[x,y]=(0,E.useState)("");function h(w=c,{clearDraft:R=!0}={}){if(d)return!1;let M=Xg(w).filter(I=>p(I));if(M.length===0)return R&&u(""),!1;let k=Array.from(new Set([...m||[],...M]));return JSON.stringify(k)!==JSON.stringify(m||[])&&t(k),R&&u(""),!0}function v(w){d||(t(m.filter(R=>R!==w)),b===w&&(g(""),y("")))}function S(){d||i.length&&(t(Array.from(new Set([...m||[],...i]))),u(""))}function C(w){d||(g(w),y(w))}function T(w=x){if(d)return g(""),y(""),!1;if(!b)return!1;let R=Xg(w).filter(H=>p(H)),M=[],k=!1;for(let H of m||[]){if(H!==b){M.push(H);continue}k||(M.push(...R),k=!0)}let I=Array.from(new Set(M.map(H=>String(H||"").trim()).filter(Boolean)));return JSON.stringify(I)!==JSON.stringify(m||[])&&t(I),g(""),y(""),R.length>0}return(0,E.useEffect)(()=>{!d||!b||(g(""),y(""))},[d,b]),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:W("flex min-h-11 flex-wrap items-center gap-2 rounded-xl border border-input bg-background/80 px-3 py-2",d?"opacity-80":null),children:[m.map(w=>{let R=s?.[w]||"default",M=R==="success"?"border-emerald-200 bg-emerald-50 text-emerald-900":R==="error"?"border-rose-200 bg-rose-50 text-rose-900":R==="pending"?"border-sky-200 bg-sky-50 text-sky-900":"border-border bg-secondary text-foreground",k=!d&&b===w;return(0,l.jsxs)("span",{className:W("inline-flex max-w-full items-center gap-1 rounded-full border px-2.5 py-1 text-xs",M),children:[k?(0,l.jsx)("input",{autoFocus:!0,className:"min-w-[7rem] bg-transparent text-xs text-foreground outline-none",value:x,onChange:I=>y(I.target.value),onKeyDown:I=>{if(I.key==="Enter"||I.key==="Tab"){I.preventDefault(),T();return}I.key==="Escape"&&(I.preventDefault(),g(""),y(""))},onBlur:()=>{T()}}):(0,l.jsx)("button",{className:"max-w-[16rem] truncate text-left transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70",type:"button",onMouseDown:I=>I.preventDefault(),onClick:()=>C(w),disabled:d,title:"Click to edit",children:w}),(0,l.jsx)("button",{className:"text-muted-foreground transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",type:"button",onMouseDown:I=>I.preventDefault(),onClick:()=>v(w),disabled:d,children:"\xD7"})]},w)}),(0,l.jsx)("input",{ref:a,className:W("min-w-[10rem] flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-70",o),value:c,disabled:d,onChange:w=>{let R=w.target.value;if(/[\s,]/.test(R)){let M=R.split(/[\s,]+/),k=M.pop()||"";M.length>0&&h(M.join(","),{clearDraft:!1}),u(k);return}u(R)},onKeyDown:w=>{if((w.key===","||w.key===" "||w.key==="Enter"||w.key==="Tab")&&c.trim()){w.preventDefault(),h();return}w.key==="Backspace"&&!c&&m.length>0&&(w.preventDefault(),v(m[m.length-1]))},onPaste:w=>{let R=w.clipboardData?.getData("text")||"";if(/[\s,]/.test(R)){w.preventDefault();let M=R.split(/[\s,]+/).filter(Boolean).filter(k=>p(k));M.length>0&&(t(Array.from(new Set([...m||[],...M]))),u(""));return}w.preventDefault(),u(`${c}${R}`)},onBlur:()=>{if(f&&p(c)){h(c);return}u(c)},placeholder:n}),m.length>0||c?(0,l.jsx)("button",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",type:"button",onMouseDown:w=>w.preventDefault(),onClick:()=>{t([]),u("")},disabled:d,children:"Clear all"}):null]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r?(0,l.jsx)("span",{children:r}):null,m.length===0&&i.length>0?(0,l.jsx)("button",{className:"font-medium uppercase tracking-[0.16em] text-foreground transition hover:text-primary disabled:cursor-not-allowed disabled:opacity-60",type:"button",onClick:S,disabled:d,children:"Use suggested values"}):null]})]})}function NC(e="rate-limit-draft-row"){return hC({key:e,models:[],requests:"",windowValue:"",windowUnit:ml.api.windowUnit},{keyPrefix:"rate-limit-draft",defaults:ml.api,useDefaults:!1})}function MC(e=[],{keyPrefix:t="rate-limit-draft"}={}){let n=`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return[...Array.isArray(e)?e:[],NC(n)]}function yL({value:e=[],onChange:t,availableModelIds:n=[],disabled:r=!1}){let a=(0,E.useRef)(null),[o,i]=(0,E.useState)(!1),s=(0,E.useMemo)(()=>Ir(e),[e]),c=s.includes("all"),u=c?[]:s.filter(Boolean),f=c||u.length===0,d=(0,E.useMemo)(()=>ba(n),[n]);(0,E.useEffect)(()=>{if(!o||typeof document>"u")return;function y(h){a.current?.contains(h.target)||i(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]);function p(y){t(Ir(y))}function m(y){p(y?["all"]:[])}function b(y,h){let v=h?[...u,y]:u.filter(S=>S!==y);p(v)}function g(y){if(y==="all"){p([]);return}p(u.filter(h=>h!==y))}let x=c?[{key:"all",label:"All model",removable:!0}]:u.length>0?u.map(y=>({key:y,label:y,removable:!0})):[{key:"__implicit-all__",label:"All model",removable:!1,muted:!0}];return(0,l.jsxs)("div",{ref:a,className:"relative space-y-1.5",children:[(0,l.jsxs)("div",{role:"button",tabIndex:r?-1:0,className:W("flex min-h-9 w-full items-center justify-between gap-2 rounded-lg border border-input bg-background/80 px-3 py-1.5 text-left text-sm text-foreground shadow-sm outline-none transition focus:border-ring focus:ring-2 focus:ring-ring/40",r?"cursor-not-allowed opacity-50":"cursor-pointer",o?"border-ring ring-2 ring-ring/40":null),onClick:()=>{r||i(y=>!y)},"aria-expanded":o,"aria-haspopup":"menu",onKeyDown:y=>{if(!r){if(y.key==="Enter"||y.key===" "){y.preventDefault(),i(h=>!h);return}if(y.key==="ArrowDown"){y.preventDefault(),i(!0);return}y.key==="Escape"&&(y.preventDefault(),i(!1))}},children:[(0,l.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:x.map(y=>y.removable?(0,l.jsxs)("button",{type:"button",className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-background px-2 py-0.5 text-xs font-medium text-foreground transition hover:border-accent hover:bg-accent",onClick:h=>{h.preventDefault(),h.stopPropagation(),g(y.key)},disabled:r,title:`Remove ${y.label}`,children:[(0,l.jsx)("span",{className:"truncate",children:y.label}),(0,l.jsx)("span",{className:"text-muted-foreground",children:"x"})]},y.key):(0,l.jsx)("span",{className:W("inline-flex max-w-full items-center rounded-full border px-2 py-0.5 text-xs font-medium",y.muted?"border-border/70 bg-secondary/45 text-muted-foreground":"border-border/70 bg-background text-foreground"),children:(0,l.jsx)("span",{className:"truncate",children:y.label})},y.key))}),(0,l.jsx)("span",{className:"text-muted-foreground",children:"\u25BE"})]}),o?(0,l.jsxs)(RC,{open:o,anchorRef:a,preferredSide:"top",desiredHeight:192,className:"p-2",onMouseDown:y=>y.stopPropagation(),onClick:y=>y.stopPropagation(),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),i(!1))},children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-sm text-foreground transition hover:bg-secondary/60",children:[(0,l.jsx)("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",checked:c,onChange:y=>m(y.target.checked)}),(0,l.jsx)("span",{children:"All model"})]}),(0,l.jsx)("div",{className:"my-1 border-t border-border/70"}),d.length>0?(0,l.jsx)("div",{children:d.map(y=>(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-sm text-foreground transition hover:bg-secondary/60",children:[(0,l.jsx)("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",checked:u.includes(y),onChange:h=>b(y,h.target.checked)}),(0,l.jsx)("span",{className:"truncate",children:y})]},y))}):(0,l.jsx)("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"No models available yet."})]}):null]})}function OC({rows:e,onChange:t,availableModelIds:n=[],disabled:r=!1,inputRef:a=null,helperText:o="",onValidBlur:i=null}){let s=Array.isArray(e)?e:[],c=(0,E.useRef)(null),u=(0,E.useRef)(s),f=(0,E.useMemo)(()=>ba(n),[n]),d=(0,E.useMemo)(()=>{let h=new Set,v=new Set;for(let S of xa(s)){let C=zs(S);if(C){if(h.has(C)){v.add(C);continue}h.add(C)}}return v},[s]),p=(0,E.useMemo)(()=>s.map(h=>({...NC(h.key),...h,models:Ir(h?.models||[])})),[s]);(0,E.useEffect)(()=>{u.current=s},[s]);function m(h){let v=Array.isArray(h)?h:[];u.current=v,t(v)}function b(h,v){m(s.map(S=>S.key===h?{...S,...v}:S))}function g(h){m(s.filter(v=>v.key!==h))}function x(h){if(Jg(h))return"";let v=Ir(h?.models||[]);if(f.length>0&&v.some(C=>C!=="all"&&!f.includes(C)))return"Use exact provider model ids only.";if($1(h?.requests,0)<=0)return"Requests must be a positive integer.";if($1(h?.windowValue,0)<=0)return"Window size must be a positive integer.";if(!U1.includes(String(h?.windowUnit||"").trim()))return"Window unit is invalid.";let S=zs({requests:h?.requests,windowValue:h?.windowValue,windowUnit:h?.windowUnit});return S&&d.has(S)?"Another row already uses this cap.":""}function y(h){if(!(!i||r)&&!h.currentTarget.contains(h.relatedTarget)){if(typeof window>"u"){let v=xa(u.current);ti(v,{knownModelIds:f,requireAtLeastOne:!0})||i(v);return}window.setTimeout(()=>{if(!c.current||c.current.contains(document.activeElement))return;let v=xa(u.current);ti(v,{knownModelIds:f,requireAtLeastOne:!0})||i(v)},0)}}return(0,l.jsxs)("div",{ref:c,className:"space-y-2.5",onBlurCapture:y,children:[(0,l.jsx)("div",{className:"space-y-2.5",children:p.map((h,v)=>{let S=Jg(h),C=x(h);return(0,l.jsxs)("div",{className:W("rounded-2xl border border-border/70 bg-background/70 p-3",C?"border-amber-200 bg-amber-50/70":null,S?"border-dashed bg-background/80":null),children:[(0,l.jsxs)("div",{className:"grid gap-2.5 xl:grid-cols-[minmax(0,1.5fr)_minmax(0,0.72fr)_minmax(0,0.72fr)_minmax(0,0.86fr)_auto] xl:items-end",children:[(0,l.jsx)(st,{label:"Models",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(yL,{value:h.models,onChange:T=>b(h.key,{models:T}),availableModelIds:f,disabled:r})}),(0,l.jsx)(st,{label:"Request",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsx)(Dt,{ref:v===0?a:null,value:h.requests,onChange:T=>b(h.key,{requests:T.target.value}),disabled:r,inputMode:"numeric",placeholder:"60"})}),(0,l.jsx)(st,{label:"Window",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsx)(Dt,{value:h.windowValue,onChange:T=>b(h.key,{windowValue:T.target.value}),disabled:r,inputMode:"numeric",placeholder:"1"})}),(0,l.jsx)(st,{label:"Unit",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsxs)(vr,{value:String(h.windowUnit||"minute"),onValueChange:T=>b(h.key,{windowUnit:T}),disabled:r,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Window unit"})}),(0,l.jsx)(Sr,{children:U1.map(T=>(0,l.jsx)(ar,{value:T,children:T},`${h.key}-${T}`))})]})}),(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>g(h.key),disabled:r,className:"xl:self-end",children:"Remove"})]}),C?(0,l.jsx)("div",{className:"mt-2.5 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:C}):null]},h.key)})}),o?(0,l.jsx)("div",{className:"text-xs leading-5 text-muted-foreground",children:o}):null]})}function vL({rows:e,onChange:t}){let n=mh(e),r=n.length>0?n:[{name:"",value:""}];function a(s,c,u){c==="name"&&Bk(r,u,s)||t(r.map((f,d)=>d===s?{...f,[c]:u}:f))}function o(){t([...r,{name:"",value:""}])}function i(s){let c=r.filter((u,f)=>f!==s);t(c.length>0?c:[{name:"",value:""}])}return(0,l.jsxs)("div",{className:"space-y-2",children:[r.map((s,c)=>(0,l.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,0.9fr)_minmax(0,1.3fr)_auto]",children:[(0,l.jsx)(Dt,{value:s.name,onChange:u=>a(c,"name",u.target.value),placeholder:c===0?"User-Agent":"Header name"}),(0,l.jsx)(Dt,{value:s.value,onChange:u=>a(c,"value",u.target.value),placeholder:c===0?ni:"Header value"}),(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>i(c),children:"Remove"})]},`header-row-${c}`)),(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,l.jsx)("span",{children:"User-Agent is included by default. Add more only when a provider needs them."}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:o,children:"Add custom header"})]})]})}function co(){return(0,l.jsx)("span",{className:"mr-2 inline-flex h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-r-transparent align-[-0.125em]"})}function bL({providerId:e,values:t,onChange:n}){let r=(t||[]).map(d=>String(d||"").trim()).filter(Boolean),a=sh(r),o=(0,E.useRef)(""),i=(0,E.useRef)(null);function s(d){n((t||[]).filter(p=>p!==d))}function c(d,p){if(!d||!p||d===p)return;let m=[...t||[]],b=m.indexOf(d),g=m.indexOf(p);if(b===-1||g===-1)return;let[x]=m.splice(b,1);m.splice(g,0,x),n(m)}function u(d){n(ih(t||[],d,p=>String(p||"").trim()))}function f(){o.current="",pl(i.current,!1),i.current=null}return(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("div",{className:"space-y-2 rounded-xl border border-input bg-background/80 px-3 py-3",children:r.length>0?r.map((d,p)=>(0,l.jsxs)("div",{ref:a(d),"data-reorder-row":"true",onDragOver:m=>{o.current&&o.current!==d&&(m.preventDefault(),m.dataTransfer.dropEffect="move")},onDrop:m=>{m.preventDefault();let b=m.dataTransfer.getData("text/plain")||o.current;f(),c(b,d)},className:W("grid grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3"),children:[(0,l.jsx)("span",{className:"flex h-8 w-8 cursor-grab items-center justify-center rounded-full text-muted-foreground",draggable:!0,onDragStart:m=>{let b=lh(m.currentTarget);m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d),b&&typeof m.dataTransfer?.setDragImage=="function"&&m.dataTransfer.setDragImage(b,20,20),f(),o.current=d,i.current=b,pl(b,!0)},onDragEnd:f,title:"Drag to reorder",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Ks,{disabled:p===0,label:p===0?"Already first":`Move ${e}/${d} up`,onClick:()=>u(d)}),(0,l.jsxs)("span",{className:"truncate text-sm font-medium text-foreground",children:[e,"/",d]}),(0,l.jsx)("button",{className:"text-muted-foreground transition hover:text-foreground",type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>s(d),children:"\xD7"})]},d)):(0,l.jsxs)("span",{className:"block px-1 text-xs text-muted-foreground",children:["Leave it empty for now, or add models to back the fixed ",(0,l.jsx)("code",{children:"default"})," route. An empty default route returns 500 until you add a working model."]})}),(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:"Drag rows to change the preferred order, use the arrow to move a model earlier, or remove any models you do not want in this route."})]})}function cC({baseConfig:e,onApplyDraft:t,onValidateDraft:n,onSaveDraft:r,onSaveAndStart:a,seedMode:o="blank",mode:i="add",targetProviderId:s="",defaultProviderUserAgent:c=ni,framed:u=!0,showHeader:f=!0}){let[d,p]=(0,E.useState)(0),[m,b]=(0,E.useState)(""),[g,x]=(0,E.useState)(()=>T2(e,{seedMode:o,targetProviderId:s,defaultProviderUserAgent:c})),[y,h]=(0,E.useState)(null),[v,S]=(0,E.useState)(""),[C,T]=(0,E.useState)({}),[w,R]=(0,E.useState)(null),[M,k]=(0,E.useState)(""),[I,H]=(0,E.useState)(!1),[Q,ee]=(0,E.useState)(""),X=(0,E.useRef)(""),z=i==="edit",te=!z&&o==="blank"&&AC(e),Y=[{title:"Provider",detail:"Choose API Key or OAuth first, then enter the provider details needed for that connection type."},{title:"Models",detail:"Add model ids, then configure one or more rate limits for all models or selected models. API Key providers are tested before continue."},{title:"Default",detail:"Order the models behind the fixed `default` route before you finish."}],q=Hr(g.modelIds,g.modelDraft),V=yh(g.aliasModelIds,q),_e=g.connectionType==="api"?Hr(g.endpoints,g.endpointDraft):[],F=(0,E.useMemo)(()=>({...g,endpoints:_e,modelIds:q,aliasModelIds:V,rateLimitRows:xa(g.rateLimitRows)}),[g,_e,q,V]),he=(0,E.useMemo)(()=>ph(g.headerRows||[]),[g.headerRows]),Z=String(g.apiKeyEnv||"").trim(),ae=(0,E.useMemo)(()=>G1(F),[F]),Se=w?.signature===ae?w.result:null,U=Se?.models?.length>0?Se.models:SC(g.connectionType),ne=Vr(g.providerId||g.providerName||"my-provider")||"my-provider",ue=wC(g),me=JSON.stringify({connectionType:g.connectionType,subscriptionProfile:ue}),re=JSON.stringify({apiConnectionSignature:ae,modelIds:q}),oe=y?.signature===re?y.result:null,Ne=g.connectionType!=="api"||!!oe?.ok,Re=(0,E.useMemo)(()=>N2(e,F,oe,{targetProviderId:s}),[e,F,oe,s]),Ze=(0,E.useMemo)(()=>`${JSON.stringify(Re,null,2)}
52
- `,[Re]),gt=at,Vt=Y[d],sn=M2(d,F,e,{targetProviderId:s});(0,E.useEffect)(()=>{if(X.current!==re&&(X.current=re,Object.keys(C).length>0&&T({})),g.connectionType!=="api"){y!==null&&h(null),v&&S(""),Object.keys(C).length>0&&T({}),w!==null&&R(null),M&&k("");return}y?.signature&&y.signature!==re&&(h(null),S(""),T({})),w?.signature&&w.signature!==ae&&(R(null),k(""))},[g.connectionType,re,y,v,C,w,M,ae]);function ot(A,D){x(B=>({...B,[A]:D}))}function mo(A){x(D=>{let B=Vr(D.providerName||""),G=Vr(A||"")||"my-provider",$=!D.providerId||D.providerId===B;return{...D,providerName:A,providerId:$?G:D.providerId}})}function Ge(A){S(""),h(null),T({}),R(null),k(""),x(D=>{let B=Ps(D.connectionType),G=Ps(A),$=Array.isArray(e?.providers)?e.providers:[],tt=S2(G.providerId,G.providerName,$),He=D.connectionType==="api"?zd(c):[],ke=A==="api"?zd(c):[],ht=mh(D.headerRows||[]),yt=!D.providerId||D.providerId===B.providerId||D.providerId===Vr(D.providerName||""),Ve=!D.providerName||D.providerName===B.providerName,de=!D.apiKeyEnv||D.apiKeyEnv===B.apiKeyEnv,qe=!D.subscriptionProfile||D.subscriptionProfile===B.subscriptionProfile,un=(D.modelIds||[]).length===0||JSON.stringify(D.modelIds||[])===JSON.stringify(B.modelIds||[]),po=JSON.stringify(ht)===JSON.stringify(He);return{...D,connectionType:A,providerName:Ve?tt.providerName:D.providerName,providerId:yt?tt.providerId:D.providerId,endpoints:A==="api"?(D.endpoints||[]).length>0?D.endpoints:G.endpoints:[],endpointDraft:A==="api"?String(D.endpointDraft||""):"",apiKeyEnv:A==="api"?de?G.apiKeyEnv:D.apiKeyEnv:"",subscriptionProfile:A==="api"?"":qe?G.subscriptionProfile:D.subscriptionProfile,modelIds:un?G.modelIds:D.modelIds,modelContextWindows:un?{}:D.modelContextWindows||{},modelDraft:"",rateLimitRows:A==="api"?G.rateLimitRows:[],headerRows:A==="api"?ht.length===0||po?ke:ht:[]}})}async function qr({force:A=!1,silent:D=!1}={}){if(g.connectionType!=="api")return!1;if(_e.length===0||!Z)return D||k("Add endpoints and an API key or env before checking the model list API."),!1;if(!A&&w?.signature===ae)return!!(w?.result?.models||[]).length;H(!0),D||k("");try{let B=await Nt("/api/config/discover-provider-models",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:_e,...Dd(Z)?{apiKeyEnv:Z}:{apiKey:Z},...Object.keys(he).length>0?{headers:he}:{}})}),G=(B.result?.models||[]).map(ke=>String(ke||"").trim()).filter(Boolean),$={};if(G.length>0)try{let ke=await th(G);$=L2(ke)}catch{$={}}let tt={...B.result&&typeof B.result=="object"?B.result:{},modelContextWindows:$};if(R({signature:ae,result:tt}),G.length>0)return x(ke=>{if(G1(ke)!==ae||ke.connectionType!=="api")return ke;let ht=Array.isArray(ke.modelIds)?ke.modelIds:[],yt=A&&ht.length>0?Array.from(new Set([...ht,...G])):ht.length>0?ht:G,Ve={...ke.modelContextWindows&&typeof ke.modelContextWindows=="object"?ke.modelContextWindows:{},...$};return JSON.stringify(yt)===JSON.stringify(ht)&&JSON.stringify(Ve)===JSON.stringify(ke.modelContextWindows||{})?ke:{...ke,modelIds:yt,modelContextWindows:Ve}}),k(""),!0;let He=(B.result?.warnings||[]).join(" ")||"Model list API did not return any models. Add model ids manually if needed.";return k(He),!1}catch(B){let G=B instanceof Error?B.message:String(B);return k(G),!1}finally{H(!1)}}async function cn(){if(g.connectionType!=="api")return!0;b("test"),S(""),T(Object.fromEntries(q.map(A=>[A,"pending"])));try{let A=await CC("/api/config/test-provider-stream",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:_e,models:q,...Dd(Z)?{apiKeyEnv:Z}:{apiKey:Z},...Object.keys(he).length>0?{headers:he}:{}})},{onMessage:D=>{if(D?.type!=="progress")return;let B=D.event||{};B.phase==="model-done"&&T(G=>({...G,[B.model]:B.confirmed?"success":"error"}))}});return h({signature:re,result:A}),T(D=>{let B={...D},G=new Set(Array.isArray(A?.models)?A.models:[]);for(let $ of q)B[$]=G.has($)?"success":"error";return B}),A?.ok?!0:(S((A?.warnings||[]).join(" ")||"Provider test could not confirm a working endpoint/model combination."),!1)}catch(A){return T(D=>{let B={...D};for(let G of q)(!B[G]||B[G]==="pending")&&(B[G]="error");return B}),S(A instanceof Error?A.message:String(A)),!1}finally{b("")}}(0,E.useEffect)(()=>{d!==1||g.connectionType!=="api"||q.length>0||!Z||_e.length===0||I||w?.signature===ae||qr({silent:!0})},[d,g.connectionType,q.length,Z,_e.length,I,w,ae]);async function $e({force:A=!1}={}){if(g.connectionType==="api"||!A&&Q===me)return!0;b("oauth-login"),S("");try{return await Nt("/api/subscription/login",{method:"POST",headers:Ct,body:JSON.stringify({profileId:ue,providerId:ne,subscriptionType:g.connectionType==="oauth-claude"?"claude-code":"chatgpt-codex"})}),ee(me),!0}catch(D){return S(D instanceof Error?D.message:String(D)),!1}finally{b("")}}async function Ee(){d===0&&g.connectionType!=="api"&&!await $e()||d===1&&g.connectionType==="api"&&!Ne&&!await cn()||p(A=>Math.min(A+1,Y.length-1))}async function fe(A){if((A==="save"||A==="save-start")&&g.connectionType==="api"&&!Ne){S("Finish is available after the provider test succeeds.");return}b(A);try{if(A==="apply"){await t(Ze);return}if(A==="validate"){await n(Ze);return}if(A==="save"){await r(Ze);return}A==="save-start"&&await a(Ze)}finally{b("")}}let ge=v||sn||(d===0&&g.connectionType!=="api"&&Q!==me?"Continue opens the browser sign-in flow for this provider.":d===1&&g.connectionType==="api"&&!Ne?"Continue will test this provider against the entered endpoints and model ids using your API key or env.":Y[d].detail),P=g.connectionType==="oauth-claude"?"Examples: claude-opus-4-6 claude-sonnet-4-6 claude-haiku-4-5":g.connectionType==="oauth-gpt"?"Examples: gpt-5.3-codex gpt-5.2-codex gpt-5.1-codex-mini":(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Examples: gpt-4o-mini gpt-4.1-mini",Object.keys(Se?.modelContextWindows||{}).length>0?` \xB7 ${Object.keys(Se?.modelContextWindows||{}).length} context size${Object.keys(Se?.modelContextWindows||{}).length===1?"":"s"} ready`:""]}),(0,l.jsx)("span",{className:"ml-2 text-amber-700",children:"Auto-discovered model ids may be incomplete or inaccurate if the provider is misconfigured. Verify the list and add or remove model ids yourself."})]}),Ye=!te,Ht=z?"Edit provider":te?"Add provider":"Quick start wizard",Gt=z?"Update this provider in place. Change endpoints, model ids, rate limits, alias, or provider id, then save the refreshed config.":te?"Add another provider with endpoints, model ids, rate limits, and a stable alias. API Key providers are auto-tested before save.":"Add the first provider, models list, rate limits, stable alias, and then start the router. API Key providers are auto-tested before save.",Mt=(0,l.jsxs)("div",{className:"space-y-5",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-secondary/25 px-3 py-3",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[Ye?(0,l.jsxs)(Tt,{variant:"outline",className:"px-3 py-1 text-[10px] uppercase tracking-[0.16em]",children:["Step ",d+1," of ",Y.length]}):null,Y.map((A,D)=>(0,l.jsxs)("div",{className:W("inline-flex items-center gap-2 rounded-xl px-3 py-2 ring-1",D===d?"bg-background text-foreground shadow-sm ring-border":D<d?"bg-emerald-50 text-emerald-900 ring-emerald-200":"bg-background/70 text-muted-foreground ring-border/60"),children:[(0,l.jsx)("span",{className:W("inline-flex h-5 w-5 items-center justify-center rounded-full text-[11px] font-semibold",D===d?"bg-primary text-primary-foreground":D<d?"bg-emerald-100 text-emerald-700":"bg-secondary text-secondary-foreground"),children:D+1}),(0,l.jsx)("span",{className:"text-sm font-medium",children:A.title})]},A.title))]}),(0,l.jsxs)("div",{className:"mt-3 flex flex-col gap-1 border-t border-border/60 px-1 pt-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:Vt.title}),(0,l.jsx)("div",{className:"max-w-2xl text-xs leading-5 text-muted-foreground",children:Vt.detail})]})]}),d===0?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:dC.map(A=>(0,l.jsxs)("button",{type:"button",className:W("rounded-2xl border px-4 py-3 text-left transition",g.connectionType===A.value?"border-ring bg-background shadow-sm":"border-border/70 bg-background/70 hover:border-border"),onClick:()=>Ge(A.value),children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:A.label}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:A.description})]},A.value))}),(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,l.jsx)(st,{label:"Provider name",children:(0,l.jsx)(Dt,{value:g.providerName,onChange:A=>mo(A.target.value),placeholder:Ps(g.connectionType).providerName})}),(0,l.jsx)(st,{label:"Provider id",hint:"lowercase-hyphenated",children:(0,l.jsx)(Dt,{value:g.providerId,onChange:A=>ot("providerId",A.target.value),onBlur:()=>ot("providerId",Vr(g.providerId||g.providerName||"my-provider")||"my-provider"),placeholder:Ps(g.connectionType).providerId})})]}),g.connectionType==="api"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(st,{label:"Endpoints",hint:"comma, space, or newline turns into chips",children:(0,l.jsx)(ah,{values:g.endpoints,onChange:A=>ot("endpoints",A),draftValue:g.endpointDraft,onDraftValueChange:A=>ot("endpointDraft",A),commitOnBlur:!0,isValueValid:$s,placeholder:"Example: https://api.openai.com/v1",helperText:"Paste one or more endpoints"})}),(0,l.jsx)(st,{label:"API key or env",children:(0,l.jsx)(Dt,{value:g.apiKeyEnv,onChange:A=>ot("apiKeyEnv",A.target.value),placeholder:"Example: OPENAI_API_KEY or sk-..."})}),(0,l.jsx)(st,{label:"Custom headers",hint:"User-Agent included by default",children:(0,l.jsx)(vL,{rows:g.headerRows,onChange:A=>ot("headerRows",A)})})]}):(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-secondary/45 px-4 py-3 text-sm leading-6 text-muted-foreground",children:"Continue opens the ChatGPT sign-in page in your browser and stores the login for this provider automatically."}),(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-300/60 bg-amber-50/80 px-4 py-3 text-xs leading-5 text-amber-800 dark:border-amber-500/30 dark:bg-amber-950/40 dark:text-amber-300",children:[(0,l.jsx)("span",{className:"font-medium",children:"Heads up:"})," ChatGPT subscriptions (Plus / Pro / Team) are separate from the OpenAI API and are intended for use within OpenAI's own apps. Routing requests through your subscription here may violate OpenAI's terms of service and could result in account restrictions."]})]})]}):null,d===1?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(st,{label:"Models",hint:"comma, space, or newline turns into chips",children:(0,l.jsx)(ah,{values:g.modelIds,onChange:A=>ot("modelIds",A),draftValue:g.modelDraft,onDraftValueChange:A=>ot("modelDraft",A),commitOnBlur:!0,disabled:m==="test",valueStates:g.connectionType==="api"?C:{},placeholder:"Paste model ids",helperText:P,suggestedValues:U})}),g.connectionType==="api"&&I?(0,l.jsxs)("div",{className:"rounded-2xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-900",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(co,{}),"Loading provider models"]}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-sky-800/90",children:"LLM Router is checking the provider model list and matching context sizes for the discovered models."})]}):null,g.connectionType==="api"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(st,{label:"Rate limit",stacked:!0,headerAction:(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:()=>ot("rateLimitRows",MC(g.rateLimitRows)),disabled:m==="test",children:"Add rate limit"}),children:(0,l.jsx)(OC,{rows:g.rateLimitRows,onChange:A=>ot("rateLimitRows",A),availableModelIds:q,disabled:m==="test"})}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3 text-sm leading-6 text-muted-foreground",children:["The first model becomes the primary direct route. Add caps for ",(0,l.jsx)("code",{children:"all"})," models or target individual model ids when you need a narrower quota bucket."]})]}):null,g.connectionType==="api"?(0,l.jsxs)("div",{className:W("rounded-2xl border px-4 py-3 text-sm leading-6",oe?.ok?"border-emerald-200 bg-emerald-50 text-emerald-900":oe?"border-amber-200 bg-amber-50 text-amber-900":"border-border/70 bg-background/80 text-muted-foreground"),children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em]",children:"Provider test"}),(0,l.jsx)("div",{className:"mt-2",children:oe?.ok?`Confirmed ${(oe.models||[]).length} model(s) across ${(oe.workingFormats||[]).join(", ")||"detected formats"}.`:oe?(oe.warnings||[]).join(" ")||"Provider test still needs review.":"Run Provider test before continuing so the wizard can auto-detect the working endpoint format(s)."})]}):null]}):null,d===2?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:te||z?(0,l.jsx)(D2,{label:"Use this provider order for the default route",hint:"Updates the fixed `default` alias",checked:g.useAliasAsDefault,onCheckedChange:A=>ot("useAliasAsDefault",A)}):(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3 text-sm text-muted-foreground md:col-span-2",children:["The fixed ",(0,l.jsx)("code",{children:"default"})," route is created automatically. Arrange this provider's models in the order you want clients to try first."]})}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Model order"}),(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(bL,{providerId:ne,values:V,onChange:A=>ot("aliasModelIds",A)})})]}),(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:ne}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:g.providerName})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Connection"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:x2(g.connectionType)}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground break-all",children:g.connectionType==="api"?`${_e.length} endpoint candidate(s)`:"Browser sign-in flow"})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Models"}),(0,l.jsxs)("div",{className:"mt-2 text-sm font-medium text-foreground",children:[q.length," configured"]}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground break-all",children:q.join(", ")||"No models yet"})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Default route"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground break-all",children:gt}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:g.useAliasAsDefault?"Requests to `default` and `smart` use this ordered list.":"This provider keeps its direct routes only until you opt it into the fixed default route."})]})]}),g.connectionType==="api"?(0,l.jsxs)("div",{className:W("rounded-2xl border px-4 py-3 text-sm leading-6",Ne?"border-emerald-200 bg-emerald-50 text-emerald-900":"border-amber-200 bg-amber-50 text-amber-900"),children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em]",children:"Provider test"}),(0,l.jsx)("div",{className:"mt-2",children:Ne?`Using ${(oe?.workingFormats||[]).join(", ")||"detected formats"}. The saved provider keeps the tested endpoint selection and confirmed models.`:"Finish is available after the provider test succeeds."})]}):null]}):null,(0,l.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border/70 pt-4 md:flex-row md:items-start md:justify-between md:gap-4",children:[(0,l.jsx)("div",{className:W("min-w-0 flex-1 text-sm md:max-w-2xl",sn||v?"text-amber-700":"text-muted-foreground"),children:ge}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 md:justify-end",children:[d>0?(0,l.jsx)(ce,{variant:"ghost",onClick:()=>p(A=>Math.max(A-1,0)),children:"Back"}):null,d<Y.length-1?(0,l.jsx)(ce,{onClick:()=>{Ee()},disabled:!!sn||m!=="",children:m==="oauth-login"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Signing in\u2026"]}):m==="test"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Testing provider\u2026"]}):"Continue"}):(0,l.jsx)(ce,{onClick:()=>{fe("save-start")},disabled:!!sn||m!==""||g.connectionType==="api"&&!Ne,children:m==="save-start"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Finishing\u2026"]}):"Finish"})]})]})]});return u?(0,l.jsxs)(Xn,{className:"border-dashed",children:[f?(0,l.jsxs)(jo,{children:[(0,l.jsx)(el,{children:Ht}),(0,l.jsx)(Ss,{children:Gt})]}):null,(0,l.jsx)(Zn,{className:"space-y-5",children:Mt})]}):(0,l.jsxs)("div",{className:"space-y-5",children:[f?(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-base font-semibold text-foreground",children:Ht}),(0,l.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:Gt})]}):null,Mt]})}function _C(){let[e,t]=(0,E.useState)(null),[n,r]=(0,E.useState)(""),[a,o]=(0,E.useState)(""),[i,s]=(0,E.useState)(null),[c,u]=(0,E.useState)([]),[f,d]=(0,E.useState)(!0),[p,m]=(0,E.useState)(!1),[b,g]=(0,E.useState)(!1),[x,y]=(0,E.useState)(!1),[h,v]=(0,E.useState)(""),[S,C]=(0,E.useState)(""),[T,w]=(0,E.useState)("model-alias"),[R,M]=(0,E.useState)(!1),[k,I]=(0,E.useState)(!1),[H,Q]=(0,E.useState)(0),[ee,X]=(0,E.useState)(""),[z,te]=(0,E.useState)(""),[Y,q]=(0,E.useState)(""),[V,_e]=(0,E.useState)(!1),[F,he]=(0,E.useState)(!1),[Z,ae]=(0,E.useState)(""),[Se,U]=(0,E.useState)("usage"),[ne,ue]=(0,E.useState)(null),[me,re]=(0,E.useState)({status:"idle",message:"",savedAt:""}),oe=(0,E.useRef)(""),Ne=(0,E.useRef)(""),Re=(0,E.useRef)(null),Ze=(0,E.useRef)(null),gt=(0,E.useRef)(null),Vt=(0,E.useRef)(0),sn=(0,E.useRef)(""),ot=(0,E.useRef)(0);(0,E.useEffect)(()=>{oe.current=n},[n]),(0,E.useEffect)(()=>{Ne.current=a},[a]),(0,E.useEffect)(()=>()=>{gt.current&&(clearTimeout(gt.current),gt.current=null)},[]);let mo=n!==a,Ge=e?.config?.document,qr=i?.summary||e?.config||{},cn=i?.validationMessages||e?.config?.validationMessages||[],$e=(0,E.useMemo)(()=>F1(e?.config?.rawText||"{}",e?.config?.document||{}),[e?.config?.rawText,e?.config?.document]),Ee=(0,E.useMemo)(()=>Vk(n,$e),[n,$e]),fe=(0,E.useMemo)(()=>F1(n,$e),[n,$e]),ge=Ee.parseError?$e:Ee.value,P=(0,E.useMemo)(()=>Array.isArray(ge?.providers)?ge.providers:[],[ge]),Ye=(0,E.useMemo)(()=>ge?.modelAliases&&typeof ge.modelAliases=="object"&&!Array.isArray(ge.modelAliases)?ge.modelAliases:{},[ge]),Ht=(0,E.useMemo)(()=>Q1(ge),[ge]),Gt=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:"",Mt=ge,A=(0,E.useMemo)(()=>Hk(),[]),D=e?.ampClient?.global||{},B=e?.webSearch||e?.ampWebSearch||null,G=e?.codingTools?.codexCli||{},$=e?.codingTools?.claudeCode||{},tt=D?.routedViaRouter===!0,He=G?.routedViaRouter===!0,ke=$?.routedViaRouter===!0,yt=(e?.activityLog||{enabled:!0})?.enabled!==!1,Ve=(0,E.useMemo)(()=>Q1(Mt),[Mt]),de=(0,E.useMemo)(()=>xC(Mt),[Mt]),qe=(0,E.useMemo)(()=>ai(zn(Mt)),[Mt]),un=(0,E.useMemo)(()=>Xk(Mt,B),[Mt,B]),po=(0,E.useMemo)(()=>{let O=new Set((Array.isArray(qe?.providers)?qe.providers:[]).map(N=>en(N?.id)).filter(Boolean));return Qk(Mt,O)},[Mt,qe]),Bn=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:Ve.length===0?"Add at least one alias or provider/model route before configuring AMP.":"",ir=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:"",oi=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:Ht.length===0?"Add at least one alias or provider/model route before configuring coding-tool bindings.":"",zC=(0,E.useMemo)(()=>Fs(Ht,Fg(G?.bindings?.defaultModel)?[]:[G?.bindings?.defaultModel]),[Ht,G?.bindings?.defaultModel]),BC=(0,E.useMemo)(()=>Fs(Ht,[$?.bindings?.primaryModel,$?.bindings?.defaultOpusModel,$?.bindings?.defaultSonnetModel,$?.bindings?.defaultHaikuModel,$?.bindings?.subagentModel]),[Ht,$?.bindings?.primaryModel,$?.bindings?.defaultOpusModel,$?.bindings?.defaultSonnetModel,$?.bindings?.defaultHaikuModel,$?.bindings?.subagentModel]),jd=String(Mt?.amp?.defaultRoute||Mt?.defaultModel||gh(Mt)||"").trim(),dn=String(Mt?.masterKey||e?.config?.document?.masterKey||"").trim(),IC=(0,E.useMemo)(()=>qk(dn),[dn]),Pd=P.length>0,UC=Pd&&k,ii=e?.router?.running===!0,bh=e?.startup?.installed===!0,Vd=h==="start"?"Starting\u2026":h==="stop"?"Stopping\u2026":ii?"Stop server":"Start server",Hd=S==="enable"?"Enabling OS startup\u2026":S==="disable"?"Disabling OS startup\u2026":bh?"Disable OS startup":"Enable OS startup",xh=e?.router?.portBusy?e?.router?.portBusyReason||`Port ${8376} is occupied${e?.router?.listenerPids?.length>0?` by PID${e.router.listenerPids.length===1?"":"s"} ${e.router.listenerPids.join(", ")}`:""}.`:String(e?.router?.lastError||"").trim(),jC=!AC(ge),Sh=P.length>0?"existing":"blank",wh=P[0]?.id||"",Ah=e?.defaults?.providerUserAgent||ni;(0,E.useEffect)(()=>{if(f||p||Ee.parseError)return;if(dn){sn.current="";return}let O=String(e?.config?.rawText||a||"__empty__");sn.current!==O&&(sn.current=O,$C({showSuccessNotice:!1}))},[a,dn,f,Ee.parseError,p,e?.config?.rawText]),(0,E.useEffect)(()=>{if(gt.current&&(clearTimeout(gt.current),gt.current=null),!ne)return;let O=ne.immediate===!0?0:450;return gt.current=setTimeout(()=>{gt.current=null;let N=ne.sequence;re(_=>({..._,status:"saving",message:""})),(async()=>{try{let _=await Nt("/api/amp/apply",{method:"POST",headers:Ct,body:JSON.stringify({rawText:ne.rawText,source:"autosave"})});if(N!==Vt.current)return;wa(_),re({status:"saved",message:"",savedAt:new Date().toISOString()})}catch(_){if(N!==Vt.current)return;let se=_ instanceof Error?_.message:String(_);re({status:"error",message:se,savedAt:""}),j("error",se)}})()},O),()=>{gt.current&&(clearTimeout(gt.current),gt.current=null)}},[ne]);function PC(){I(!0),Q(O=>O+1)}function VC(){PC()}function qd(){I(!1)}(0,E.useEffect)(()=>{!Pd&&k&&I(!1)},[Pd,k]);function j(O,N){ot.current+=1,u(_=>[..._,{id:`notice-${ot.current}`,tone:O,message:N}])}function Ch(O){u(N=>N.filter(_=>_.id!==O))}function wa(O,{preserveDraft:N=!1}={}){t(O);let _=String(O?.config?.rawText||"");if(!N||oe.current===Ne.current){r(_),o(_),M(!1),s({rawText:_,summary:O?.config,validationMessages:O?.config?.validationMessages||[]});return}o(_),_!==Ne.current&&M(!0)}async function lr({preserveDraft:O=!1}={}){let N=await Nt("/api/state");wa(N,{preserveDraft:O})}(0,E.useEffect)(()=>{let O=!1;function N(){Re.current&&(Re.current.close(),Re.current=null)}function _(){Ze.current&&(clearTimeout(Ze.current),Ze.current=null)}function se(){O||Ze.current||(Ze.current=setTimeout(()=>{Ze.current=null,ye({isReconnect:!0})},xk))}function ye({isReconnect:Te=!1}={}){if(O)return;_(),N();let we=new EventSource("/api/events");Re.current=we,we.onopen=()=>{O||Re.current!==we||Te&&lr({preserveDraft:oe.current!==Ne.current}).catch(()=>{})},we.addEventListener("state",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);nt?.snapshot&&wa(nt.snapshot,{preserveDraft:!0})}catch(nt){j("error",nt instanceof Error?nt.message:String(nt))}}),we.addEventListener("log",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);t(be=>be&&{...be,logs:[nt,...be.logs||[]].slice(0,150)})}catch{}}),we.addEventListener("logs",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);t(be=>be&&{...be,...nt?.activityLog?{activityLog:nt.activityLog}:{},logs:Array.isArray(nt?.logs)?nt.logs:[]})}catch{}}),we.onerror=()=>{O||Re.current!==we||(N(),se())}}return(async()=>{try{await lr()}catch(Te){O||j("error",Te instanceof Error?Te.message:String(Te))}finally{O||(d(!1),ye())}})(),()=>{O=!0,_(),N()}},[]);async function Rh(O,{silent:N=!1}={}){g(!0);try{let _=await Nt("/api/config/validate",{method:"POST",headers:Ct,body:JSON.stringify({rawText:O})});return s({rawText:O,summary:_.summary,validationMessages:_.validationMessages||[]}),N||j(O2(_.summary)==="success"?"success":"warning",_.summary.validationSummary),_}catch(_){throw N||j("error",_ instanceof Error?_.message:String(_)),_}finally{g(!1)}}async function $d(O,{successMessage:N="Config saved.",showSuccessNotice:_=!0}={}){m(!0);try{let se=await Nt("/api/config/save",{method:"POST",headers:Ct,body:JSON.stringify({rawText:O})});return wa(se),_&&N&&j("success",N),se}catch(se){throw j("error",se instanceof Error?se.message:String(se)),se}finally{m(!1)}}function go(O,{immediate:N=!1}={}){let _=Vt.current+1;Vt.current=_,ue({sequence:_,rawText:O,immediate:N===!0}),re(se=>({status:"pending",message:"",savedAt:se.savedAt}))}function In(O){r(O),s(null)}async function $r(O,N,_={}){let se=`${JSON.stringify(O,null,2)}
53
- `;In(se),M(!1),await $d(se,{successMessage:N,..._})}async function Eh({providerId:O,endpoints:N,newModelIds:_,credentialPayload:se,headers:ye,onModelTestStateChange:Te}){if(!Array.isArray(_)||_.length===0)return Te?.({phase:"",modelStates:{},failedModelIds:[],message:""}),{ok:!0};let we=Object.fromEntries(_.map(be=>[be,"pending"])),it=({phase:be="testing",message:Yt="",failedModelIds:Le=[]}={})=>{Te?.({phase:be,modelStates:{...we},failedModelIds:Le,message:Yt})},nt=()=>`Testing ${_.filter(Yt=>we[Yt]==="success"||we[Yt]==="error").length}/${_.length} new model${_.length===1?"":"s"} for ${O}.`;it({phase:"testing",message:nt()});try{let be=await CC("/api/config/test-provider-stream",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:N,models:_,...se,...ye&&typeof ye=="object"&&!Array.isArray(ye)?{headers:ye}:{}})},{onMessage:ct=>{if(ct?.type!=="progress")return;let sr=ct.event||{};if(sr.phase!=="model-done")return;let Kr=String(sr.model||"").trim();!Kr||!Object.prototype.hasOwnProperty.call(we,Kr)||(we[Kr]=sr.confirmed?"success":"error",it({phase:"testing",message:nt()}))}}),Yt=new Set(Array.isArray(be?.models)?be.models:[]),Le=_.filter(ct=>!Yt.has(ct));for(let ct of _)we[ct]=Yt.has(ct)?"success":"error";if(!be?.ok||Le.length>0){let ct=Le.length>0?`New model test failed for ${O}: ${Le.join(", ")}.`:(be?.warnings||[]).join(" ")||`New model test failed for ${O}.`;return it({phase:"",failedModelIds:Le,message:ct}),j("warning",ct),{ok:!1,failedModelIds:Le,result:be}}return it({phase:"saving",message:`Saving ${_.length} confirmed new model${_.length===1?"":"s"} for ${O}.`}),{ok:!0,failedModelIds:[],result:be}}catch(be){for(let ct of _)we[ct]!=="success"&&(we[ct]="error");let Yt=be instanceof Error?be.message:String(be),Le=_.filter(ct=>we[ct]==="error");return it({phase:"",failedModelIds:Le,message:Yt}),j("error",Yt),{ok:!1,failedModelIds:Le}}}async function HC(O,N,{showSuccessNotice:_=!0}={}){if(Gt)return j("warning",Gt),!1;let se=String(N?.id||"").trim(),ye=String(N?.name||"").trim(),Te=Array.isArray(N?.endpoints)?ba(N.endpoints):Hr([],N?.endpoint||""),we=Array.isArray(N?.rateLimitRows)?xa(N.rateLimitRows):[],it=P.find(ct=>ct?.id===O),nt=uo(it)==="api",be=Rd(it);if(!se)return j("warning","Provider id is required."),!1;if(!Md.test(se))return j("warning","Provider id must start with a letter and use lowercase letters, digits, or dashes only."),!1;if(!ye)return j("warning","Provider name is required."),!1;if(se!==O&&P.some(ct=>ct?.id===se))return j("warning",`Provider id "${se}" already exists.`),!1;if(nt&&Te.length===0)return j("warning","API Key providers require at least one valid http(s) endpoint."),!1;if(nt&&Te.some(ct=>!$s(ct)))return j("warning","One or more endpoints are invalid. Use full http:// or https:// URLs."),!1;let Yt=nt?ti(we,{knownModelIds:be,requireAtLeastOne:!0}):"";if(Yt)return j("warning",Yt),!1;let Le=$g(Ee.value||$e,O,{...N,endpoints:Te,rateLimitRows:we});try{return await $r(Le,`Updated provider ${se}.`,{showSuccessNotice:_}),!0}catch{return!1}}async function qC(O,{providerDraft:N=null,modelRows:_=null,showSuccessNotice:se=!0,onModelTestStateChange:ye=null}={}){if(Gt)return j("warning",Gt),!1;let Te=P.find(Un=>Un?.id===O);if(!Te)return j("error",`Provider '${O}' was not found.`),!1;let we=!!(N&&typeof N=="object"),it=Array.isArray(_);if(!we&&!it)return!0;let nt=uo(Te)==="api",be=we?String(N?.id||"").trim():O,Yt=we?String(N?.name||"").trim():String(Te?.name||O).trim(),Le=we?Array.isArray(N?.endpoints)?ba(N.endpoints):Hr([],N?.endpoint||""):vl(Te),ct=we&&Array.isArray(N?.rateLimitRows)?xa(N.rateLimitRows):[],sr=it?_.map(Un=>({...Un,id:String(Un?.id||"").trim(),contextWindow:so(Un?.contextWindow||"")})).filter(Un=>Un.id):[];if(we){let Un=it?sr.map(jn=>jn.id):Rd(Te);if(!be)return j("warning","Provider id is required."),!1;if(!Md.test(be))return j("warning","Provider id must start with a letter and use lowercase letters, digits, or dashes only."),!1;if(!Yt)return j("warning","Provider name is required."),!1;if(be!==O&&P.some(jn=>jn?.id===be))return j("warning",`Provider id "${be}" already exists.`),!1;if(nt&&Le.length===0)return j("warning","API Key providers require at least one valid http(s) endpoint."),!1;if(nt&&Le.some(jn=>!$s(jn)))return j("warning","One or more endpoints are invalid. Use full http:// or https:// URLs."),!1;let Aa=nt?ti(ct,{knownModelIds:Un,requireAtLeastOne:!0}):"";if(Aa)return j("warning",Aa),!1}if(it){if(sr.length===0)return j("warning","Keep at least one model id on the provider."),!1;if(dh(sr.map(cr=>cr.id)))return j("warning","Model ids must be unique for each provider."),!1;if(sr.some(cr=>{let Ys=String(cr?.contextWindow||"").trim();if(!Ys)return!1;let Gd=Number.parseInt(Ys,10);return!Number.isFinite(Gd)||Gd<=0||String(Gd)!==Ys}))return j("warning","Context windows must be positive integers when set."),!1;let Aa=Rd(Te),jn=sr.map(cr=>cr.id).filter(cr=>!Aa.includes(cr));if(nt&&jn.length>0){if(Le.length===0)return j("warning",`Provider '${be}' needs at least one endpoint before testing new models.`),!1;let cr=Z1(N,Te);if(!cr.apiKey&&!cr.apiKeyEnv)return j("warning",`Provider '${be}' needs an API key or env before testing new models.`),!1;if(!(await Eh({providerId:be,endpoints:Le,newModelIds:jn,credentialPayload:cr,headers:Te?.headers,onModelTestStateChange:ye})).ok)return!1}}let Kr=Ee.value||$e;we&&(Kr=$g(Kr,O,{...N,endpoints:Le,rateLimitRows:ct})),it&&(Kr=qg(Kr,we?be:O,sr));let xR=we&&it?`Updated provider ${be} and saved its model list.`:we?`Updated provider ${be}.`:(()=>{let Un=Rd(Te),Aa=sr.map(jn=>jn.id).filter(jn=>!Un.includes(jn));return Aa.length>0?`Tested ${Aa.length} new model${Aa.length===1?"":"s"} and updated ${be}.`:`Updated models for ${be}.`})();try{return await $r(Kr,xR,{showSuccessNotice:se}),ye?.({phase:"",modelStates:{},failedModelIds:[],message:""}),!0}catch{return!1}}async function $C({showSuccessNotice:O=!1}={}){if(Ee.parseError||String((Ee.value||$e||{}).masterKey||"").trim())return!1;let N=gl(Ee.value||$e||{});N.masterKey=Zg();try{return await $r(N,"Gateway key ready.",{showSuccessNotice:O}),!0}catch{return!1}}async function KC(){if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}try{await js(dn),j("success","Gateway key copied to clipboard.")}catch(O){j("error",O instanceof Error?O.message:String(O))}}async function FC(){if(!A){j("warning","API endpoint is not ready yet.");return}try{await js(A),j("success","API endpoint copied to clipboard.")}catch(O){j("error",O instanceof Error?O.message:String(O))}}async function GC(O){let N=String(O||"").trim();if(!N){j("warning","Alias id is not ready yet.");return}try{await js(N),j("success",`Alias id ${N} copied to clipboard.`)}catch(_){j("error",_ instanceof Error?_.message:String(_))}}async function li(O,N,{ensureMode:_="none",successMessage:se=""}={}){let ye=String(O||"").trim();if(!ye){j("warning",`${N} is not resolved yet.`);return}try{await Nt("/api/file/open",{method:"POST",headers:Ct,body:JSON.stringify({editorId:"default",filePath:ye,ensureMode:_})}),j("success",se||`Opened ${N} in the default app.`)}catch(Te){j("error",Te instanceof Error?Te.message:String(Te))}}async function YC(O){let N=String(O||"").trim();if(!N){j("warning","Model id is not ready yet.");return}try{await js(N),j("success",`Model id ${N} copied to clipboard.`)}catch(_){j("error",_ instanceof Error?_.message:String(_))}}async function WC(){if(!(typeof window>"u"?!0:window.confirm("Rotate the gateway key? Existing clients using the old key will need the new one. Linked tools like AMP, Codex CLI, and Claude Code will auto-update to the new key.")))return;let N=gl(Ee.value||$e||{});N.masterKey=Zg();try{await $r(N,"Rotated gateway key. Linked tools like AMP, Codex CLI, and Claude Code refreshed automatically.")}catch{}}async function QC(O,N,{providerDraft:_=null,onModelTestStateChange:se=null}={}){if(Gt)return j("warning",Gt),!1;let ye=P.find(Le=>Le?.id===O);if(!ye)return j("error",`Provider '${O}' was not found.`),!1;let Te=(Array.isArray(N)?N:[]).map(Le=>({...Le,id:String(Le?.id||"").trim()})).filter(Le=>Le.id),we=_&&String(_?.id||"").trim()||O,it=_?Array.isArray(_?.endpoints)?ba(_.endpoints):Hr([],_?.endpoint||""):vl(ye),nt=(Array.isArray(ye?.models)?ye.models:[]).map(Le=>String(Le?.id||"").trim()).filter(Boolean),be=Te.map(Le=>Le.id).filter(Le=>!nt.includes(Le));if(uo(ye)==="api"&&be.length>0){if(it.length===0)return j("warning",`Provider '${we}' needs at least one endpoint before testing new models.`),!1;let Le=Z1(_,ye);if(!Le.apiKey&&!Le.apiKeyEnv)return j("warning",`Provider '${we}' needs an API key or env before testing new models.`),!1;if(!(await Eh({providerId:we,endpoints:it,newModelIds:be,credentialPayload:Le,headers:ye?.headers,onModelTestStateChange:se})).ok)return!1}let Yt=qg(Ee.value||$e,O,Te);try{let Le=be.length>0?`Tested ${be.length} new model${be.length===1?"":"s"} and updated ${O}.`:`Updated models for ${O}.`;return await $r(Yt,Le),se?.({phase:"",modelStates:{},failedModelIds:[],message:""}),!0}catch{return!1}}async function XC(O,N){if(Gt)return j("warning",Gt),!1;let _=O1(Ee.value||$e,O,N),se=String(N?.id||O||"").trim()||O;try{return await $r(_,`Updated alias ${se}.`),!0}catch{return!1}}async function ZC(O){if(Gt){j("warning",Gt);return}if(!(typeof window>"u"?!0:window.confirm(`Remove alias "${O}" from the config?`)))return;let _=_1(Ee.value||$e,O);try{await $r(_,`Removed alias ${O}.`)}catch{}}async function xL(O){try{await js(O?.url||""),j("success",`${O?.label||"Endpoint"} copied to clipboard.`)}catch(N){j("error",N instanceof Error?N.message:String(N))}}async function JC(){let N=!(D?.routedViaRouter===!0);if(N){if(Bn){j("warning",Bn);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}X(N?"enable":"disable");try{let _=!1,se;try{se=await Nt("/api/amp/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:N,rawText:N?n:void 0,endpointUrl:A})})}catch(Te){if(Te?.statusCode===404&&N)_=!0,se=await Nt("/api/amp/apply",{method:"POST",headers:Ct,body:JSON.stringify({rawText:n,source:"amp-global-route-compat",patchScope:"global",endpointUrl:A})});else throw Te?.statusCode===404?new Error("Restart the web console so the AMP routing endpoint is available."):Te}await lr({preserveDraft:!N});let ye=N?"AMP connected.":"AMP disconnected.";j("success",_?`${ye} Restart the web console if the AMP status does not refresh.`:ye)}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{X("")}}function eR(O,N){if(Bn){j("warning",Bn);return}let _=String(N||"").trim(),se=de.find(we=>we.id!==O&&String(we?.inbound||"").trim()===_);if(_&&se){j("warning",`AMP inbound match "${_}" already exists.`);return}let ye=X1(Ee.value||$e,O,{inbound:N}),Te=`${JSON.stringify(ye,null,2)}
54
- `;In(Te),go(Te)}function tR(O,N){if(Bn){j("warning",Bn);return}let _=X1(Ee.value||$e,O,{outbound:N==="__default__"?"":N}),se=`${JSON.stringify(_,null,2)}
55
- `;In(se),go(se)}function nR(O){if(ir){j("warning",ir);return}let N=Zk(Ee.value||$e,{strategy:O}),_=`${JSON.stringify(N,null,2)}
56
- `;In(_),go(_)}function rR(O,N,_){if(ir){j("warning",ir);return}let se=Jk(Ee.value||$e,O,{[N]:_}),ye=`${JSON.stringify(se,null,2)}
57
- `;In(ye),go(ye,{immediate:r2(O,N,_)})}function aR(O,N){if(ir){j("warning",ir);return}let _=n2(Ee.value||$e,O,N),se=`${JSON.stringify(_,null,2)}
58
- `;In(se),go(se)}function oR(O){if(ir){j("warning",ir);return}let N=t2(Ee.value||$e,O),_=`${JSON.stringify(N,null,2)}
59
- `;In(_),go(_,{immediate:!0})}async function iR({providerId:O,modelId:N}){if(ir)throw new Error(ir);let _=yl(O,N);if(!_)throw new Error("Choose a provider and GPT model before testing.");if(new Set((Array.isArray(qe?.providers)?qe.providers:[]).map(it=>en(it?.id)).filter(Boolean)).has(en(_)))throw new Error(`Web search route '${_}' is already configured.`);let ye=await Nt("/api/config/test-web-search-provider",{method:"POST",headers:Ct,body:JSON.stringify({providerId:O,modelId:N,rawText:n})}),Te=e2(Ee.value||$e,O,N),we=`${JSON.stringify(Te,null,2)}
60
- `;return In(we),go(we,{immediate:!0}),j("success",`Added ${_} to shared web search routing.`),ye?.result||null}async function lR({inbound:O,outbound:N}){if(Bn)return j("warning",Bn),!1;let _=String(O||"").trim();if(_&&de.some(ye=>String(ye?.inbound||"").trim()===_))return j("warning",`AMP inbound match "${_}" already exists.`),!1;let se=g2(Ee.value||$e,{inbound:O,outbound:N});try{return await $r(se,`Added AMP route ${String(O||"").trim()}.`),!0}catch{return!1}}async function sR(O){let N=hh(Ee.value||$e,O);if(!N?.removable)return;let _=N.source==="raw"?N.inbound||N.label:N.routeKey||N.label;if(!(typeof window>"u"?!0:window.confirm(`Remove AMP route mapping "${_}"?`)))return;let ye=h2(Ee.value||$e,O);try{await $r(ye,`Removed AMP route ${_}.`)}catch{}}function SL(){r(a),s({rawText:a,summary:e?.config,validationMessages:e?.config?.validationMessages||[]}),M(!1),j("success","Editor reset to the latest disk version.")}function Th(O){In(O),M(!1),j("success","Quick-start config loaded into the editor.")}async function Nh(O){In(O);try{await Rh(O)}catch{}}async function Kd(O){In(O);let N;try{N=await Rh(O,{silent:!0})}catch{return null}let _=N?.summary||{};if(!(!_.parseError&&(_.validationErrors||[]).length===0))return j("warning",_.validationSummary||"Quick-start config still needs review."),null;try{return await $d(O,{successMessage:"Quick-start config saved."})}catch{return null}}async function Mh(O){let N=await Kd(O);return N?(w("activity"),N.router?.running?(j("success","Quick-start config saved. Router is already running."),!0):(j("success","Quick-start config saved. Starting router\u2026"),setTimeout(()=>{Fd("start")},0),!0)):!1}async function cR(O){let N=await Kd(O);return N&&qd(),!!N}async function uR(O){let N=await Mh(O);return N&&qd(),N}async function dR(){y(!0);try{await Nt("/api/config/open",{method:"POST",headers:Ct,body:JSON.stringify({editorId:"default"})}),j("success","Opened config file in the default app.")}catch(O){j("error",O instanceof Error?O.message:String(O))}finally{y(!1)}}async function fR(){let N=!(G?.routedViaRouter===!0);if(N){if(oi){j("warning",oi);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}te(N?"enable":"disable");try{await Nt("/api/codex-cli/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:N,rawText:N?n:void 0,endpointUrl:A,bindings:N?{defaultModel:G?.bindings?.defaultModel||jd,thinkingLevel:G?.bindings?.thinkingLevel||""}:void 0})}),await lr({preserveDraft:!N}),j("success",N?"Codex CLI connected.":"Codex CLI disconnected.")}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{te("")}}async function mR(){let N=!($?.routedViaRouter===!0);if(N){if(oi){j("warning",oi);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}q(N?"enable":"disable");try{await Nt("/api/claude-code/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:N,rawText:N?n:void 0,endpointUrl:A,bindings:N?{primaryModel:$?.bindings?.primaryModel||"",defaultOpusModel:$?.bindings?.defaultOpusModel||"",defaultSonnetModel:$?.bindings?.defaultSonnetModel||"",defaultHaikuModel:$?.bindings?.defaultHaikuModel||"",subagentModel:$?.bindings?.subagentModel||"",thinkingLevel:$?.bindings?.thinkingLevel||""}:void 0})}),await lr({preserveDraft:!N}),j("success",N?"Claude Code connected.":"Claude Code disconnected.")}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{q("")}}async function pR(O,N){let _={defaultModel:G?.bindings?.defaultModel||jd,thinkingLevel:G?.bindings?.thinkingLevel||""};_[O]=N,_e(!0);try{await Nt("/api/codex-cli/model-bindings",{method:"POST",headers:Ct,body:JSON.stringify({bindings:_})}),await lr({preserveDraft:!0}),j("success","Codex CLI bindings updated.")}catch(se){j("error",se instanceof Error?se.message:String(se))}finally{_e(!1)}}async function gR(O,N){let _=$?.routedViaRouter===!0;if(O==="thinkingLevel"&&!_){he(!0);try{await Nt("/api/claude-code/effort-level",{method:"POST",headers:Ct,body:JSON.stringify({effortLevel:N})}),await lr({preserveDraft:!0}),j("success",N?`Effort level set to ${N}.`:"Effort level cleared.")}catch(ye){j("error",ye instanceof Error?ye.message:String(ye))}finally{he(!1)}return}let se={primaryModel:$?.bindings?.primaryModel||"",defaultOpusModel:$?.bindings?.defaultOpusModel||"",defaultSonnetModel:$?.bindings?.defaultSonnetModel||"",defaultHaikuModel:$?.bindings?.defaultHaikuModel||"",subagentModel:$?.bindings?.subagentModel||"",thinkingLevel:$?.bindings?.thinkingLevel||""};se[O]=N,he(!0);try{await Nt("/api/claude-code/model-bindings",{method:"POST",headers:Ct,body:JSON.stringify({bindings:se})}),await lr({preserveDraft:!0}),j("success","Claude Code model bindings updated.")}catch(ye){j("error",ye instanceof Error?ye.message:String(ye))}finally{he(!1)}}async function Fd(O){v(O);try{let N=await Nt(`/api/router/${O}`,{method:"POST",headers:Ct,body:"{}"});wa(N,{preserveDraft:!0}),j("success",N.message||`Router ${O}ed.`)}catch(N){await lr({preserveDraft:!0}).catch(()=>{}),j("error",N instanceof Error?N.message:String(N))}finally{v("")}}async function hR(O){C(O);try{let N=await Nt(`/api/startup/${O}`,{method:"POST",headers:Ct,body:"{}"});wa(N,{preserveDraft:!0}),j("success",N.message||`Startup ${O}d.`)}catch(N){await lr({preserveDraft:!0}).catch(()=>{}),j("error",N instanceof Error?N.message:String(N))}finally{C("")}}async function yR(){let O=!yt;ae("toggle");try{let N=await Nt("/api/activity-log/settings",{method:"POST",headers:Ct,body:JSON.stringify({enabled:O})});wa(N,{preserveDraft:!0}),j("success",N.message||`Activity log ${O?"enabled":"disabled"}.`)}catch(N){await lr({preserveDraft:!0}).catch(()=>{}),j("error",N instanceof Error?N.message:String(N))}finally{ae("")}}async function vR(){if(typeof window>"u"||window.confirm("Clear the shared activity log file? This also clears the Activity tab for connected web console sessions.")){ae("clear");try{let N=await Nt("/api/activity-log/clear",{method:"POST",headers:Ct,body:"{}"});wa(N,{preserveDraft:!0}),j("success",N.message||"Activity log cleared.")}catch(N){j("error",N instanceof Error?N.message:String(N))}finally{ae("")}}}async function bR(O){let N=P.find(Te=>Te.id===O);if(!(typeof window>"u"?!0:window.confirm(`Remove provider "${N?.name||O}" from the config?`)))return;let se=y2(e?.config?.document||fe||{},O),ye=`${JSON.stringify(se,null,2)}
61
- `;In(ye);try{await $d(ye,{successMessage:`Removed provider ${N?.name||O}.`})}catch{}}return f?(0,l.jsx)("div",{className:"console-shell flex min-h-screen items-center justify-center px-6 py-10",children:(0,l.jsx)(Xn,{className:"w-full max-w-lg",children:(0,l.jsxs)(Zn,{className:"space-y-3 p-6 text-center",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground",children:"LLM Router"}),(0,l.jsx)("div",{className:"text-xl font-semibold text-foreground",children:"Loading web console\u2026"}),(0,l.jsx)("div",{className:"text-sm text-muted-foreground",children:"Preparing config state, router controls, and live activity."})]})})}):jC?(0,l.jsx)("div",{className:"console-shell min-h-screen px-4 py-6 md:px-6",children:(0,l.jsxs)("div",{className:"mx-auto flex max-w-5xl flex-col gap-4",children:[(0,l.jsx)(oC,{notices:c,onDismiss:Ch}),(0,l.jsx)("div",{id:"quick-start-wizard",children:(0,l.jsx)(cC,{baseConfig:fe,seedMode:Sh,mode:"onboarding",targetProviderId:wh,defaultProviderUserAgent:Ah,onApplyDraft:Th,onValidateDraft:Nh,onSaveDraft:Kd,onSaveAndStart:Mh},`onboarding-wizard-${Sh}-${wh||"new"}`)})]})}):(0,l.jsx)("div",{className:"console-shell min-h-screen px-4 py-4 md:px-6 md:py-6",children:(0,l.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-col gap-4",children:[(0,l.jsx)(Xn,{className:"overflow-hidden",children:(0,l.jsx)(Zn,{className:"p-5",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsxs)("h1",{className:"inline-flex items-center gap-2 text-2xl font-semibold tracking-tight text-foreground",children:[(0,l.jsx)("span",{children:"LLM Router Web Console"}),(0,l.jsx)(Td,{connected:ii,size:"md",srLabel:"Router running"})]})}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[(0,l.jsxs)("a",{href:bk,target:"_blank",rel:"noreferrer noopener",className:"inline-flex h-8 items-center gap-2 rounded-lg border border-amber-300 bg-amber-50/90 px-3 text-xs font-medium uppercase tracking-[0.16em] text-amber-900 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background","aria-label":"Support LLM Router via GitHub Sponsors",title:"Support LLM Router",children:[(0,l.jsx)(_k,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Buy me a coffee"})]}),(0,l.jsxs)("a",{href:vk,target:"_blank",rel:"noreferrer noopener",className:"inline-flex h-8 items-center gap-2 rounded-lg border border-border bg-background/80 px-3 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background","aria-label":"Open the LLM Router GitHub repository",title:"Open GitHub repository",children:[(0,l.jsx)(Ok,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Repo"})]})]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(ce,{size:"sm",variant:ii?"outline":void 0,className:"px-2 sm:px-3",onClick:()=>Fd(ii?"stop":"start"),disabled:h!=="","aria-label":Vd,title:Vd,children:[ii?(0,l.jsx)(Lk,{className:"h-3.5 w-3.5"}):(0,l.jsx)(kk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:Vd})]}),(0,l.jsxs)(ce,{size:"sm",variant:"outline",className:"px-2 sm:px-3",onClick:dR,disabled:x,"aria-label":x?"Opening config file":"Open config file",title:x?"Opening config file":"Open config file",children:[(0,l.jsx)(Dk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:x?"Opening\u2026":"Open config file"})]}),(0,l.jsxs)(ce,{size:"sm",variant:"outline",className:"px-2 sm:px-3",onClick:()=>hR(bh?"disable":"enable"),disabled:S!=="","aria-label":Hd,title:Hd,children:[(0,l.jsx)(zk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:Hd})]})]}),(0,l.jsx)(F2,{endpointValue:A||Ls,endpointDisabled:!A,gatewayValue:dn?IC:"Generating\u2026",gatewayPending:!dn,gatewayDisabled:!dn||p,rotateDisabled:p,onCopyEndpoint:FC,onCopyGatewayKey:KC,onRotateKey:WC})]}),p||b?(0,l.jsx)("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:(0,l.jsx)("span",{className:"rounded-full bg-secondary px-2.5 py-1",children:p?"Saving changes\u2026":"Validating\u2026"})}):null,!ii&&e?.router?.portBusy&&!e?.router?.portBusySelf?(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,l.jsx)(ce,{size:"sm",variant:"outline",onClick:()=>Fd("reclaim"),disabled:h!=="",children:h==="reclaim"?"Reclaiming\u2026":`Reclaim port ${8376}`})}):null,xh?(0,l.jsx)("div",{className:W("rounded-xl border px-3 py-2 text-sm",e?.router?.portBusy?"border-amber-200 bg-amber-50 text-amber-900":"border-rose-200 bg-rose-50 text-rose-800"),children:xh}):null]})})}),(0,l.jsx)(oC,{notices:c,onDismiss:Ch}),(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsx)(cL,{providers:P,onAddProvider:VC,onRemove:bR,onCopyModelId:YC,onApplyProviderDetails:HC,onApplyProviderModels:QC,onSaveAndCloseEditor:qC,disabledReason:Gt,busy:p})}),(0,l.jsxs)(Vu,{value:T,onValueChange:w,className:"space-y-0",children:[(0,l.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:(0,l.jsxs)(Hu,{children:[(0,l.jsx)(Or,{value:"model-alias",children:"Alias & Fallback"}),(0,l.jsx)(Or,{value:"amp",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"AMP"}),(0,l.jsx)("span",{className:"rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:"Beta"}),(0,l.jsx)(Td,{connected:tt,srLabel:"AMP connected"})]})}),(0,l.jsx)(Or,{value:"codex-cli",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"Codex CLI"}),(0,l.jsx)(Td,{connected:He,srLabel:"Codex CLI connected"})]})}),(0,l.jsx)(Or,{value:"claude-code",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"Claude Code"}),(0,l.jsx)(Td,{connected:ke,srLabel:"Claude Code connected"})]})}),(0,l.jsx)(Or,{value:"web-search",children:"Web Search"}),(0,l.jsx)(Or,{value:"activity",children:"Activity"})]})}),(0,l.jsx)(_r,{value:"model-alias",className:"space-y-4",children:(0,l.jsx)(oL,{aliases:Ye,config:ge,aliasIds:Object.keys(Ye),routeOptions:Ht,defaultModel:String(ge?.defaultModel||"").trim(),ampDefaultRoute:jd,disabledReason:Gt,busy:p,onApplyAlias:XC,onRemoveAlias:ZC,onCopyAliasId:GC})}),(0,l.jsx)(_r,{value:"amp",className:"space-y-4",children:(0,l.jsx)(uL,{rows:de,routeOptions:Ve,webSearchSnapshot:B,ampClientUrl:A,ampClientGlobal:D,routingBusy:ee,onToggleGlobalRouting:JC,onInboundChange:eR,onOutboundChange:tR,onCreateEntry:lR,onRemoveEntry:sR,onOpenWebSearchTab:()=>w("web-search"),onOpenConfigPath:()=>li(D?.settingsFilePath,"AMP config file",{ensureMode:"jsonObject",successMessage:"Opened AMP config file in the default app."}),onOpenSecretsPath:()=>li(D?.secretsFilePath,"AMP secrets file",{ensureMode:"jsonObject",successMessage:"Opened AMP secrets file in the default app."}),hasMasterKey:!!String(Mt?.masterKey||"").trim(),disabledReason:Bn,autosaveState:me})}),(0,l.jsx)(_r,{value:"codex-cli",className:"space-y-4",children:(0,l.jsx)(lC,{toolName:"Codex CLI",toolState:G,endpointUrl:G?.configuredBaseUrl||`${A?`${A}/openai/v1`:""}`,routeOptions:zC,connectionBusy:z,bindingBusy:V,onToggleRouting:fR,onBindingChange:pR,hasMasterKey:!!dn,disabledReason:oi,onOpenPrimaryPath:()=>li(G?.configFilePath,"Codex CLI config file",{ensureMode:"text",successMessage:"Opened Codex CLI config file in the default app."}),onOpenSecondaryPath:()=>li(G?.backupFilePath,"Codex CLI backup file",{ensureMode:"jsonObject",successMessage:"Opened Codex CLI backup file in the default app."}),guideContent:d2({bindingValue:G?.bindings?.defaultModel,thinkingLevel:G?.bindings?.thinkingLevel,configFilePath:G?.configFilePath,endpointUrl:G?.configuredBaseUrl||`${A?`${A}/openai/v1`:""}`}),bindingFields:[{id:"defaultModel",label:"Default model",description:"Choose a managed route/alias to set Codex CLI `model`, or use Inherit Codex CLI model to keep Codex built-in model names and route them through same-name LLM Router aliases.",envKey:"model",value:G?.bindings?.defaultModel||"",allowUnset:!1,placeholder:"Select a default route",extraOptions:[{value:Kg,label:"Inherit Codex CLI model",hint:"Keep Codex built-in model names; route them via same-name aliases in LLM Router"}]},{id:"thinkingLevel",label:"Thinking level",description:"Maps to Codex CLI `model_reasoning_effort`. Official values are `minimal`, `low`, `medium`, `high`, and `xhigh` (`xhigh` is model-dependent).",envKey:"model_reasoning_effort",value:G?.bindings?.thinkingLevel||"",allowUnset:!0,usesRouteOptions:!1,placeholder:"Inherit Codex default",options:Ck}]})}),(0,l.jsx)(_r,{value:"claude-code",className:"space-y-4",children:(0,l.jsx)(lC,{toolName:"Claude Code",toolState:$,endpointUrl:$?.configuredBaseUrl||`${A?`${A}/anthropic`:""}`,routeOptions:BC,connectionBusy:Y,bindingBusy:F,onToggleRouting:mR,onBindingChange:gR,hasMasterKey:!!dn,disabledReason:oi,onOpenPrimaryPath:()=>li($?.settingsFilePath,"Claude Code config file",{ensureMode:"jsonObject",successMessage:"Opened Claude Code config file in the default app."}),onOpenSecondaryPath:()=>li($?.backupFilePath,"Claude Code backup file",{ensureMode:"jsonObject",successMessage:"Opened Claude Code backup file in the default app."}),guideContent:f2({bindings:$?.bindings,settingsFilePath:$?.settingsFilePath,endpointUrl:$?.configuredBaseUrl||`${A?`${A}/anthropic`:""}`}),bindingFields:[{id:"primaryModel",label:"Current model override",description:"Optional. Set `ANTHROPIC_MODEL` only when you want to override Claude Code\u2019s own `model` setting with a managed route or alias.",envKey:"ANTHROPIC_MODEL",value:$?.bindings?.primaryModel||"",allowUnset:!0,placeholder:"Inherit Claude Code default"},{id:"defaultOpusModel",label:"Default Opus",description:"Maps `ANTHROPIC_DEFAULT_OPUS_MODEL` so Claude Code\u2019s `opus` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",value:$?.bindings?.defaultOpusModel||"",allowUnset:!0,placeholder:"Select an Opus route"},{id:"defaultSonnetModel",label:"Default Sonnet",description:"Maps `ANTHROPIC_DEFAULT_SONNET_MODEL` so Claude Code\u2019s `sonnet` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",value:$?.bindings?.defaultSonnetModel||"",allowUnset:!0,placeholder:"Select a Sonnet route"},{id:"defaultHaikuModel",label:"Default Haiku",description:"Maps `ANTHROPIC_DEFAULT_HAIKU_MODEL` so Claude Code\u2019s `haiku` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",value:$?.bindings?.defaultHaikuModel||"",allowUnset:!0,placeholder:"Select a Haiku route"},{id:"subagentModel",label:"Sub-agent model",description:"Maps `CLAUDE_CODE_SUBAGENT_MODEL` for Claude Code sub-agents and background workers.",envKey:"CLAUDE_CODE_SUBAGENT_MODEL",value:$?.bindings?.subagentModel||"",allowUnset:!0,placeholder:"Select a sub-agent route"},{id:"thinkingLevel",label:"Effort level",description:'Sets `CLAUDE_CODE_EFFORT_LEVEL` in your shell profile (~/.zshrc or ~/.bashrc). Falls back to `effortLevel` in settings.json (only "high") if shell profile cannot be updated.',envKey:"CLAUDE_CODE_EFFORT_LEVEL",value:$?.bindings?.thinkingLevel||"",allowUnset:!0,usesRouteOptions:!1,standaloneWhenDisconnected:!0,placeholder:"Inherit Claude Code adaptive default",options:Rk}]})}),(0,l.jsx)(_r,{value:"web-search",className:"space-y-4",children:(0,l.jsx)(fL,{webSearchConfig:qe,webSearchProviders:un,hostedSearchCandidates:po,onWebSearchStrategyChange:nR,onWebSearchProviderChange:rR,onWebSearchProviderMove:aR,onRemoveWebSearchProvider:oR,onAddHostedSearchEndpoint:iR,disabledReason:ir,autosaveState:me})}),(0,l.jsx)(_r,{value:"activity",children:(0,l.jsx)(hL,{logs:e?.logs||[],activityLogEnabled:yt,activityFilter:Se,busyAction:Z,onActivityFilterChange:U,onToggleEnabled:yR,onClear:vR})})]}),(0,l.jsx)(Sa,{open:UC,onClose:qd,title:"Add provider",description:"Add another provider with endpoints, model ids, rate limits, and a stable alias. API Key providers are auto-tested before save.",contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsx)(cC,{baseConfig:fe,seedMode:"blank",mode:"add",targetProviderId:"",defaultProviderUserAgent:Ah,onApplyDraft:Th,onValidateDraft:Nh,onSaveDraft:cR,onSaveAndStart:uR,framed:!1,showHeader:!1},`provider-wizard-modal-${H}`)})]})})}var DC=K(Be(),1),kC=document.getElementById("app");kC&&(0,LC.createRoot)(kC).render((0,DC.jsx)(_C,{}));})();
51
+ `)}if(f)break}let c=i.trim();if(c){let u=JSON.parse(c);if(n?.(u),u?.type==="result"&&(s=u.result),u?.type==="error"){let f=new Error(u.error||"Request failed.");throw f.statusCode=u.statusCode||500,f}}return s}function nC(e={}){return`${String(e?.model||"").trim()}::${String(e?.contextWindow||"").trim()}`}function D2(e){return String(e||"").trim().replace(/[.,\s_'`]/g,"")}function so(e){let t=D2(e);if(!t)return"";let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>0?String(n):t}async function th(e=[]){let t=[...new Set((Array.isArray(e)?e:[]).map(r=>String(r||"").trim()).filter(Boolean))];if(t.length===0)return[];let n=await Tt("/api/config/litellm-context-lookup",{method:"POST",headers:Ct,body:JSON.stringify({models:t,limit:Ak})});return Array.isArray(n?.result)?n.result:[]}function rC(e={}){let t=String(e?.model||"").trim(),n=String(e?.provider||"").trim(),r=String(e?.mode||"").trim(),a=Number(e?.contextWindow);return!Number.isFinite(a)||a<=0?null:{model:t,provider:n,mode:r,contextWindow:Math.floor(a)}}function aC(e="",t=""){let n=String(e||"").trim(),r=String(t||"").trim();if(!n||!r)return n;let a=n.toLowerCase(),o=r.toLowerCase(),i=[`${o}/`,`${o}:`];for(let s of i){if(!a.startsWith(s))continue;return n.slice(s.length).trim()||n}return n}function $s(e={},{fallbackQuery:t=""}={}){let n=String(e?.query||t||"").trim(),r=rC(e?.exactMatch),a=(Array.isArray(e?.suggestions)?e.suggestions:[]).map(f=>rC(f)).filter(Boolean),o=Number(e?.medianContextWindow),i=Number.isFinite(o)&&o>0?Math.floor(o):r?.contextWindow||null,s=[],c=new Set;function u(f){!f?.key||c.has(f.key)||(c.add(f.key),s.push(f))}r&&u({key:`exact::${nC(r)}`,label:aC(r.model,r.provider)||"Exact match",detail:r.provider?`Exact \xB7 ${r.provider}`:"Exact",contextWindow:r.contextWindow});for(let f of a)u({key:nC(f),label:aC(f.model,f.provider)||"Suggestion",detail:f.provider||"Known model",contextWindow:f.contextWindow});return{query:n,exactMatch:r,suggestions:a,medianContextWindow:i,options:s,status:s.length>0?"ready":"miss"}}function nh(e={}){let t=$s(e);return t.exactMatch?.contextWindow?String(t.exactMatch.contextWindow):t.medianContextWindow?String(t.medianContextWindow):""}function z2(e=[]){let t=new Map;for(let n of Array.isArray(e)?e:[]){let r=$s(n);r.query&&t.set(r.query,r)}return t}function B2(e=[]){let t={};for(let n of Array.isArray(e)?e:[]){let r=String(n?.query||"").trim(),a=nh(n);!r||!a||(t[r]=Number(a))}return t}function st({label:e,hint:t,className:n,children:r,stacked:a=!1,headerClassName:o,hintClassName:i,headerAction:s=null}){return(0,l.jsxs)("div",{className:Y("flex flex-col gap-2 text-sm",n),children:[(0,l.jsxs)("div",{className:Y("text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",a?"flex min-h-10 items-start justify-between gap-3":"flex items-center justify-between gap-2",o),children:[(0,l.jsxs)("div",{className:Y("min-w-0",a?"flex-1 space-y-1":"flex min-w-0 items-center gap-2"),children:[(0,l.jsx)("span",{children:e}),t?(0,l.jsx)("span",{className:Y("block normal-case tracking-normal text-[11px] text-muted-foreground/80",a?"leading-4":null,i),children:t}):null]}),s?(0,l.jsx)("div",{className:"shrink-0",children:s}):null]}),r]})}function Yg({value:e,onValueChange:t,disabled:n=!1,allowEmptyCommit:r=!1,...a}){let o=String(e??""),[i,s]=(0,E.useState)(o);return(0,E.useEffect)(()=>{s(o)},[o]),(0,l.jsx)(Kt,{...a,value:i,inputMode:"numeric",disabled:n,onChange:c=>{let u=B1(c.target.value);u.accepted&&(s(u.draftValue),u.shouldCommit?t(u.commitValue):r&&u.draftValue===""&&t(""))},onBlur:()=>{s(c=>c!==""?c:r?(t(""),""):o)}})}function I2({label:e,hint:t,checked:n=!1,onCheckedChange:r,disabled:a=!1,className:o}){return(0,l.jsxs)("div",{className:Y("flex items-center justify-between gap-4 rounded-2xl border border-border/70 bg-background/80 px-4 py-3",o),children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:e}),t?(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:t}):null]}),(0,l.jsx)(mS,{checked:n,onCheckedChange:r,disabled:a,className:"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60"})]})}function Sa({open:e=!1,title:t="",description:n="",onClose:r=()=>{},children:a,variant:o="dialog",headerActions:i=null,showCloseButton:s=!0,closeDisabled:c=!1,closeOnEscape:u=!0,closeOnBackdrop:f=!0,footer:d=null,contentClassName:p="",bodyClassName:m="",footerClassName:b=""}){if((0,E.useEffect)(()=>{if(!e||typeof window>"u")return;function y(h){h.key==="Escape"&&u&&r()}return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[u,e,r]),!e)return null;let g=o==="page",x=(0,l.jsx)("div",{className:Y("fixed inset-0 z-50 bg-slate-950/55 backdrop-blur-sm",g?"p-0":"flex items-center justify-center p-4"),onMouseDown:y=>{y.target===y.currentTarget&&f&&r()},children:(0,l.jsxs)("div",{className:Y("overflow-hidden border border-border/70 bg-card/95 shadow-2xl",g?"flex h-full w-full flex-col rounded-none border-x-0 border-y-0 bg-background/98":"flex max-h-[85vh] w-full max-w-3xl flex-col rounded-3xl",p),children:[(0,l.jsxs)("div",{className:Y("flex items-start justify-between gap-3 border-b border-border/70",g?"px-5 py-4 sm:px-6":"px-5 py-4"),children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-base font-semibold text-foreground",children:t}),n?(0,l.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:n}):null]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[i,s?(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",onClick:r,disabled:c,children:"Close"}):null]})]}),(0,l.jsx)("div",{className:Y("overflow-y-auto",g?"min-h-0 flex-1 px-5 py-4 sm:px-6 sm:py-5":"min-h-0 flex-1 px-5 py-4",m),children:a}),d?(0,l.jsx)("div",{className:Y("border-t border-border/70 bg-background/96",g?"px-5 py-4 sm:px-6":"px-5 py-4",b),children:d}):null]})});return typeof document>"u"||!document.body?x:(0,dC.createPortal)(x,document.body)}function EC({open:e=!1,anchorRef:t,preferredSide:n="bottom",desiredHeight:r=288,offset:a=4,className:o="",children:i,...s}){let c=vd({open:e,anchorRef:t,preferredSide:n,desiredHeight:r,offset:a});return e?(0,l.jsx)("div",{className:Y("absolute left-0 right-0 z-30 overflow-y-auto rounded-xl border border-border/70 bg-popover shadow-lg",c.side==="top"?"bottom-full mb-1":"top-full mt-1",o),style:{maxHeight:`${Math.max(0,Math.floor(c.maxHeight||r))}px`},...s,children:i}):null}function U2({open:e=!1,onKeepEditing:t=()=>{},onDiscardAndClose:n=()=>{},onSaveAndClose:r=()=>{},saveDisabled:a=!1,dirtyLabels:o=[],details:i=""}){let s=o.length>1?`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`:o[0]||"this form";return(0,l.jsx)(Sa,{open:e,onClose:t,title:"Unsaved changes",description:`You have unsaved edits in ${s}.`,contentClassName:"max-w-lg rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,children:"Keep editing"}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:n,children:"Cancel + Close"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{r()},disabled:a,children:"Save + Close"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-sm leading-6 text-muted-foreground",children:[(0,l.jsx)("div",{children:"Choose whether to save these edits before closing the modal."}),i?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-amber-900",children:i}):null]})})}function j2({open:e=!1,failedModelIds:t=[],onKeepEditing:n=()=>{},onRemoveFailedAndClose:r=()=>{},removeDisabled:a=!1}){let o=t.length>1?`${t.length} failed models`:t[0]||"the failed model";return(0,l.jsx)(Sa,{open:e,onClose:n,title:"Failed model tests",description:`Some new models did not pass validation: ${o}.`,contentClassName:"max-w-lg rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:n,children:"Keep editing"}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:()=>{r()},disabled:a,children:"Remove failed + close"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-sm leading-6 text-muted-foreground",children:[(0,l.jsx)("div",{children:"Successful new models are still kept in the draft. You can continue editing, or remove only the failed rows and close the modal."}),t.length>0?(0,l.jsx)("div",{className:"rounded-xl border border-rose-200 bg-rose-50 px-3 py-2 text-rose-900",children:t.join(", ")}):null]})})}function Md({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M12 20h9"}),(0,l.jsx)("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"})]})}function P2({className:e=""}){return(0,l.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:(0,l.jsx)("path",{d:"m5 12 4.25 4.25L19 6.5"})})}function rh({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M3 6h18"}),(0,l.jsx)("path",{d:"M8 6V4.75A1.75 1.75 0 0 1 9.75 3h4.5A1.75 1.75 0 0 1 16 4.75V6"}),(0,l.jsx)("path",{d:"M18 6v12.25A1.75 1.75 0 0 1 16.25 20h-8.5A1.75 1.75 0 0 1 6 18.25V6"}),(0,l.jsx)("path",{d:"M10 10.5v5"}),(0,l.jsx)("path",{d:"M14 10.5v5"})]})}function V2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),(0,l.jsx)("path",{d:"M5 15V6a2 2 0 0 1 2-2h9"})]})}function H2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M7.25 5.75h-1.5A2.75 2.75 0 0 0 3 8.5v5.75A2.75 2.75 0 0 0 5.75 17h5.75a2.75 2.75 0 0 0 2.75-2.75v-1.5"}),(0,l.jsx)("path",{d:"M10.5 9.5 17 3"}),(0,l.jsx)("path",{d:"M12 3h5v5"})]})}function q2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("circle",{cx:"6.75",cy:"10",r:"3.25"}),(0,l.jsx)("path",{d:"M10 10h6.5"}),(0,l.jsx)("path",{d:"M13.5 10v2.25"}),(0,l.jsx)("path",{d:"M15.75 10v1.5"})]})}function $2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M16.25 10a6.25 6.25 0 1 1-1.83-4.42"}),(0,l.jsx)("path",{d:"M13.5 3.75h3v3"}),(0,l.jsx)("path",{d:"M16.5 3.75 12.75 7.5"})]})}function K2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M6 3.5h5.25L15 7.25V16A1.5 1.5 0 0 1 13.5 17.5h-7A1.5 1.5 0 0 1 5 16V5A1.5 1.5 0 0 1 6.5 3.5H6Z"}),(0,l.jsx)("path",{d:"M11 3.5V7.5H15"}),(0,l.jsx)("path",{d:"M7.75 11h4.5"}),(0,l.jsx)("path",{d:"M7.75 14h4.5"})]})}function NC({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M6 3.5h5.25L15 7.25V16A1.5 1.5 0 0 1 13.5 17.5h-7A1.5 1.5 0 0 1 5 16V5A1.5 1.5 0 0 1 6.5 3.5H6Z"}),(0,l.jsx)("path",{d:"M11 3.5V7.5H15"}),(0,l.jsx)("path",{d:"M7 12.25a3 3 0 1 1 2.85 2.99"}),(0,l.jsx)("path",{d:"M8.5 10.25h1.5v1.5"})]})}function F2({className:e=""}){return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,l.jsx)("path",{d:"M10 2.75 4.75 5v4.12c0 3.42 2.1 6.58 5.25 7.88 3.15-1.3 5.25-4.46 5.25-7.88V5L10 2.75Z"}),(0,l.jsx)("circle",{cx:"10",cy:"9",r:"1.4"}),(0,l.jsx)("path",{d:"M10 10.4v2.1"})]})}function G2({label:e,value:t,icon:n,disabled:r=!1,onClick:a,actionLabel:o}){return(0,l.jsxs)("button",{type:"button",className:"inline-flex h-9 min-w-0 max-w-full items-center gap-2 rounded-full border border-border/70 bg-background/90 px-3 text-left transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70 sm:max-w-[18rem]",onClick:a,disabled:r,"aria-label":o,title:r?o:t,children:[(0,l.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:n}),(0,l.jsx)("span",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:e}),(0,l.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:t})]})}function Y2({value:e,pending:t=!1,disabled:n=!1,rotateDisabled:r=!1,onCopy:a,onRotate:o}){return(0,l.jsxs)("div",{className:"flex h-9 min-w-0 max-w-full items-stretch overflow-hidden rounded-full border border-border/70 bg-background/90 sm:max-w-[18rem]",children:[(0,l.jsxs)("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-2 rounded-l-full px-3 text-left transition hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",onClick:a,disabled:n,"aria-label":t?"Gateway key is still generating":"Copy gateway key",title:t?"Gateway key is still generating":"Copy gateway key",children:[(0,l.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:(0,l.jsx)(q2,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("span",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Gateway key"}),(0,l.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:e})]}),(0,l.jsx)("button",{type:"button",className:"inline-flex w-9 shrink-0 items-center justify-center rounded-r-full border-l border-border/70 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70",onClick:o,disabled:r,"aria-label":"Rotate gateway key",title:"Rotate gateway key",children:(0,l.jsx)($2,{className:"h-3.5 w-3.5"})})]})}function W2({endpointValue:e,endpointDisabled:t=!1,gatewayValue:n,gatewayPending:r=!1,gatewayDisabled:a=!1,rotateDisabled:o=!1,onCopyEndpoint:i,onCopyGatewayKey:s,onRotateKey:c}){return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,l.jsx)(G2,{label:"Endpoint",value:e,icon:(0,l.jsx)(H2,{className:"h-3.5 w-3.5"}),disabled:t,onClick:i,actionLabel:t?"API endpoint not ready yet":"Copy API endpoint"}),(0,l.jsx)(Y2,{value:n,pending:r,disabled:a,rotateDisabled:o,onCopy:s,onRotate:c})]})}function oC({label:e,value:t,icon:n,disabled:r=!1,onClick:a,actionLabel:o="",emptyLabel:i="Not resolved"}){let s=String(t||"").trim()||i;return(0,l.jsxs)("button",{type:"button",className:"inline-flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-border/70 bg-background/90 px-3 py-2 text-left transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",onClick:a,disabled:r,"aria-label":o,title:r?o:s,children:[(0,l.jsx)("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:n}),(0,l.jsxs)("span",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"block text-[9px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:e}),(0,l.jsx)("span",{className:"mt-1 block break-all text-[11px] font-medium leading-4 text-foreground",children:s})]})]})}function Td({connected:e=!1,className:t,srLabel:n="Connected",size:r="sm"}){if(!e)return null;let a=r==="md"?"h-3.5 w-3.5":"h-2.5 w-2.5",o=r==="md"?"h-2 w-2":"h-1.5 w-1.5";return(0,l.jsxs)("span",{className:Y("relative inline-flex shrink-0 items-center justify-center",a,t),children:[(0,l.jsx)("span",{"aria-hidden":"true",className:"absolute inset-0 rounded-full bg-emerald-400/45 animate-ping motion-reduce:animate-none"}),(0,l.jsx)("span",{"aria-hidden":"true",className:Y("relative rounded-full bg-emerald-500 ring-2 ring-emerald-500/15",o)}),(0,l.jsx)("span",{className:"sr-only",children:n})]})}function TC({primaryLabel:e="Config file",primaryValue:t="",primaryIcon:n=(0,l.jsx)(K2,{className:"h-3 w-3"}),onOpenPrimary:r,secondaryLabel:a="Backup file",secondaryValue:o="",secondaryIcon:i=(0,l.jsx)(NC,{className:"h-3 w-3"}),onOpenSecondary:s}){let c=String(t||"").trim(),u=String(o||"").trim();return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(oC,{label:e,value:c,icon:n,disabled:!c||typeof r!="function",onClick:r,actionLabel:c?`Open ${e.toLowerCase()}`:`${e} path is not resolved yet`}),(0,l.jsx)(oC,{label:a,value:u,icon:i,disabled:!u||typeof s!="function",onClick:s,actionLabel:u?`Open ${a.toLowerCase()}`:`${a} path is not resolved yet`})]})}function Q2(e){return e==="error"?"Error":e==="success"?"Success":"Notice"}function X2({notice:e,onDismiss:t}){let[n,r]=(0,E.useState)(Gg),[a,o]=(0,E.useState)(Gg),[i,s]=(0,E.useState)(!1),c=(0,E.useRef)(null),u=(0,E.useRef)(0);(0,E.useEffect)(()=>{if(n<=0){t();return}if(i){c.current&&(clearTimeout(c.current),c.current=null);return}return u.current=Date.now(),c.current=setTimeout(()=>{c.current=null,t()},n),()=>{c.current&&(clearTimeout(c.current),c.current=null)}},[t,i,n]),(0,E.useEffect)(()=>{if(i||n<=0){o(n);return}let h=()=>{let S=u.current?Date.now()-u.current:0;o(Math.max(0,n-S))};h();let v=setInterval(h,wk);return()=>clearInterval(v)},[i,n]);function f(){if(i)return;c.current&&(clearTimeout(c.current),c.current=null);let h=u.current?Date.now()-u.current:0,v=Math.max(0,n-h);r(v),o(v),s(!0)}function d(){s(!1)}let p=e.tone==="error"?"border-rose-200 bg-rose-50 text-rose-800":e.tone==="success"?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-amber-200 bg-amber-50 text-amber-800",m=9,b=2*Math.PI*m,g=Math.max(0,Math.min(1,a/Gg)),x=b*(1-g),y=i?`Auto-dismiss paused with ${Math.max(0,a/1e3).toFixed(1)} seconds remaining`:`Auto-dismiss in ${Math.max(0,a/1e3).toFixed(1)} seconds`;return(0,l.jsx)("div",{className:Y("pointer-events-auto rounded-2xl border px-4 py-3 text-sm shadow-lg backdrop-blur",p),onMouseEnter:f,onMouseLeave:d,onFocusCapture:f,onBlurCapture:h=>{h.currentTarget.contains(h.relatedTarget)||d()},role:e.tone==="error"?"alert":"status",children:(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] opacity-75",children:Q2(e.tone)}),(0,l.jsxs)("div",{className:"relative mt-0.5 h-6 w-6 shrink-0 opacity-85","aria-label":y,title:y,children:[(0,l.jsxs)("svg",{viewBox:"0 0 24 24",className:Y("h-6 w-6 -rotate-90",i?"opacity-70":"opacity-100"),"aria-hidden":"true",children:[(0,l.jsx)("circle",{cx:"12",cy:"12",r:m,fill:"none",stroke:"currentColor",strokeOpacity:"0.18",strokeWidth:"2"}),(0,l.jsx)("circle",{cx:"12",cy:"12",r:m,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:x,className:"transition-[stroke-dashoffset,opacity] duration-100 ease-linear"})]}),(0,l.jsx)("span",{className:Y("pointer-events-none absolute inset-0 flex items-center justify-center",i?"gap-[2px]":""),"aria-hidden":"true",children:i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"h-2.5 w-[2px] rounded-full bg-current/75"}),(0,l.jsx)("span",{className:"h-2.5 w-[2px] rounded-full bg-current/75"})]}):(0,l.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current/75"})})]})]}),(0,l.jsx)("div",{className:"mt-1 leading-6",children:e.message}),(0,l.jsx)("div",{className:"mt-2 flex justify-end",children:(0,l.jsx)("button",{className:"rounded-full border border-current/15 px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em] opacity-85 transition hover:border-current/30 hover:opacity-100",onClick:t,type:"button",children:"Dismiss"})})]})})}function iC({notices:e,onDismiss:t}){return!Array.isArray(e)||e.length===0?null:(0,l.jsx)("div",{className:"pointer-events-none fixed inset-x-4 top-4 z-50 flex flex-col items-end gap-3","aria-live":"polite","aria-relevant":"additions text",children:e.map(n=>(0,l.jsx)("div",{className:"w-full max-w-md",children:(0,l.jsx)(X2,{notice:n,onDismiss:()=>t(n.id)})},n.id))})}function Z2({provider:e,disabled:t=!1,disabledReason:n="",busy:r=!1,onApply:a,framed:o=!0,focusRequest:i=0,onStateChange:s=null,testStateByModel:c={},savePhase:u="",saveMessage:f=""}){let d=(0,E.useMemo)(()=>D1(e),[e]),[p,m]=(0,E.useState)([]),[b,g]=(0,E.useState)(""),[x,y]=(0,E.useState)(!1),[h,v]=(0,E.useState)({}),[S,C]=(0,E.useState)({}),[N,w]=(0,E.useState)(null),[R,M]=(0,E.useState)(""),[k,I]=(0,E.useState)(""),[H,Q]=(0,E.useState)({}),ee=(0,E.useRef)(0),X=(0,E.useRef)([]),z=(0,E.useRef)(new Map),te=(0,E.useRef)(new Map),W=(0,E.useRef)(""),q=(0,E.useRef)(""),V=(0,E.useRef)(null),_e=(0,E.useRef)(new Map),F=(0,E.useRef)(new Map);function he(A={}){return ee.current+=1,{key:`model-${e.id}-draft-${ee.current}`,id:"",sourceId:"",contextWindow:"",...A}}function Z(A){W.current=A}function ae(A=[],{preserveFocus:D=!1}={}){let B=[],G=null;for(let $ of Array.isArray(A)?A:[]){let tt=String($?.id||""),He=$?.contextWindow===void 0||$?.contextWindow===null?"":String($.contextWindow);if(String(tt).trim()){B.push({...$,id:tt,contextWindow:He});continue}G||(G={...$,id:"",contextWindow:He})}return G||(G=he(),D&&Z(G.key)),[G,...B]}function Se(A){C(D=>{if(!D[A])return D;let B={...D};return delete B[A],B})}function U(A,D){v(B=>{if(D)return B[A]?B:{...B,[A]:!0};if(!B[A])return B;let G={...B};return delete G[A],G})}function ne(A,D={},{clearLookupState:B=!1,clearStatus:G=!0,closeLookupMenu:$=!1}={}){B&&Se(A),G&&w(null),$&&R===A&&M(""),m(tt=>ae(tt.map(He=>He.key===A?{...He,...D}:He),{preserveFocus:!1}))}(0,E.useEffect)(()=>{X.current=p},[p]),(0,E.useEffect)(()=>{let A=ae(d,{preserveFocus:!0});m(A),X.current=A,_e.current.clear(),F.current.clear(),v({}),C({}),w(null),M(""),I(""),Q({})},[d]),(0,E.useEffect)(()=>{let A=W.current;if(!A)return;let D=z.current.get(A);if(!D)return;D.scrollIntoView?.({block:"nearest"}),D.focus();let B=D.value?.length||0;D.setSelectionRange?.(B,B),W.current=""},[p]),(0,E.useEffect)(()=>{i&&m(A=>{let D=ae(A,{preserveFocus:!1}),B=D.find(G=>!String(G?.id||"").trim())||D[D.length-1];return B&&Z(B.key),D})},[i]),(0,E.useEffect)(()=>{R&&(p.some(A=>A.key===R)||M(""))},[p,R]),(0,E.useEffect)(()=>{k&&(p.some(A=>A.key===k)||I(""))},[p,k]),(0,E.useEffect)(()=>{Q(A=>{let D=new Set(p.map($=>$.key)),B=!1,G={};for(let[$,tt]of Object.entries(A)){if(!D.has($)){B=!0;continue}G[$]=tt}return B?G:A})},[p]),(0,E.useEffect)(()=>{if(!R||typeof document>"u")return;function A(D){te.current.get(R)?.contains(D.target)||M("")}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[R]);let ue=(0,E.useMemo)(()=>p.filter(A=>String(A?.id||"").trim()),[p]),me=(0,E.useMemo)(()=>d.map(A=>({id:String(A?.id||"").trim(),contextWindow:so(A?.contextWindow||"")})).filter(A=>A.id),[d]),re=(0,E.useMemo)(()=>ue.map(A=>({...A,id:String(A?.id||"").trim(),contextWindow:so(A?.contextWindow||"")})),[ue]),oe=re.map(A=>A.id),Te=me.map(A=>A.id),Re=oe.filter(A=>!Te.includes(A)),Ze=fh(oe),gt=oe.length>0,Pt=new Set(re.filter(A=>{let D=String(A?.contextWindow||"").trim();if(!D)return!1;let B=Number.parseInt(D,10);return!Number.isFinite(B)||B<=0||String(B)!==D}).map(A=>A.key)),sn=re.filter(A=>!String(A?.contextWindow||"").trim()),ot=JSON.stringify(me)!==JSON.stringify(re.map(A=>({id:A.id,contextWindow:A.contextWindow}))),Ge=t||r||(b!==""||u==="testing"||u==="saving")||x,qr=(0,E.useMemo)(()=>{let A=-1;return p.forEach((D,B)=>{String(D?.id||"").trim()&&(A=B)}),A},[p]),cn=t?n:gt?Ze?"Model ids must be unique for each provider.":Pt.size>0?"Context windows must be positive integers when set.":"":"Keep at least one model id on the provider.",$e=sh(p.map(A=>A.key));(0,E.useEffect)(()=>{s?.({isDirty:ot,issue:cn,locked:Ge,rows:re.map(A=>({...A,contextWindow:so(A.contextWindow)}))})},[s,ot,cn,Ge,re]);function Ee(A){Se(A),U(A,!1),w(null),R===A&&M(""),k===A&&I(""),Q(D=>{if(!Object.prototype.hasOwnProperty.call(D,A))return D;let B={...D};return delete B[A],B}),m(D=>ae(D.filter(B=>B.key!==A)))}function fe(A){m(D=>ae(ih(D,A,B=>B?.key)))}function ge(A){m(D=>ae(pC(D,A,B=>B?.key)))}function P(){q.current="",gl(V.current,!1),V.current=null}async function Ye(A,{force:D=!1}={}){let B=String(A||"").trim();if(!B)return $s({query:B});if(!D&&_e.current.has(B))return _e.current.get(B);if(!D&&F.current.has(B))return F.current.get(B);let G=(async()=>{let $=await th([B]),tt=(Array.isArray($)?$:[]).find(ke=>String(ke?.query||"").trim()===B)||{query:B},He=$s(tt,{fallbackQuery:B});return _e.current.set(B,He),He})();F.current.set(B,G);try{return await G}finally{F.current.delete(B)}}async function Vt(A,{openMenu:D=!1,prefill:B=!1,modelId:G=""}={}){let $=X.current.find(He=>He.key===A),tt=String(G||$?.id||"").trim();if(!tt)return null;D&&M(A),U(A,!0);try{let He=await Ye(tt);if(C(ke=>({...ke,[A]:He})),B){let ke=nh(He);ke&&m(ht=>ae(ht.map(yt=>{if(yt.key!==A)return yt;let Ve=String(yt?.id||"").trim(),de=String(yt?.contextWindow||"").trim();return!Ve||Ve!==tt||de?yt:{...yt,contextWindow:ke}}),{preserveFocus:!1}))}return He}catch(He){let ke=He instanceof Error?He.message:String(He),ht={query:tt,status:"error",error:ke,options:[]};return C(yt=>({...yt,[A]:ht})),ht}finally{U(A,!1)}}async function Gt(A=[]){let D=new Set(Array.isArray(A)?A:[]),B=re.filter(G=>!G.id||String(G?.contextWindow||"").trim()?!1:D.size===0?!0:D.has(G.key)).map(G=>({key:G.key,id:G.id}));if(B.length!==0){y(!0),w(null);try{let G=await th(B.map(Ve=>Ve.id)),$=z2(G),tt=new Map(B.map(Ve=>[Ve.key,Ve]));for(let Ve of $.values())Ve?.query&&_e.current.set(Ve.query,Ve);let He=Array.isArray(X.current)?X.current:[],ke=0,ht=0,yt=He.map(Ve=>{let de=tt.get(Ve.key);if(!de)return Ve;let qe=String(Ve?.id||"").trim(),un=String(Ve?.contextWindow||"").trim();if(!qe||qe!==de.id||un)return Ve;let po=$.get(qe)||$s({query:qe}),Bn=nh(po);return Bn?(ke+=1,{...Ve,contextWindow:Bn}):(ht+=1,Ve)});m(ae(yt,{preserveFocus:!1})),w({tone:ke>0?"success":"warning",message:ke>0?`Filled ${ke} context size${ke===1?"":"s"}${ht>0?`; ${ht} still need a manual value`:""}.`:`Could not fill ${ht} model${ht===1?"":"s"}.`})}catch(G){w({tone:"error",message:G instanceof Error?G.message:String(G)})}finally{y(!1)}}}async function Mt(){if(Ge||cn||!ot)return!1;let A=uo(e)==="api"&&Re.length>0;g(A?"testing":"saving");try{return await a(re.map(D=>({...D,contextWindow:so(D.contextWindow)})))}finally{g("")}}return(0,l.jsxs)("div",{className:Y(o?"space-y-3 rounded-2xl border border-border/70 bg-background/60 p-4":"space-y-3"),children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-secondary/35 px-4 py-3 text-sm leading-6 text-muted-foreground",children:"Direct routes follow this top-to-bottom order. Focus a context field to load suggested sizes, or use Fill missing context size to fill each empty row with a median size."}),(0,l.jsx)("div",{className:"space-y-2",children:p.map((A,D)=>{let B=String(A?.id||"").trim(),G=String(A?.contextWindow||"").trim(),$=!!B,tt=$?ue.findIndex(de=>de.key===A.key):-1,He=S[A.key]||null,ke=!!h[A.key],ht=R===A.key&&!!B,yt=Pt.has(A.key),Ve=B&&c?.[B]||"default";return(0,l.jsxs)("div",{ref:$e(A.key),"data-reorder-row":"true",onDragOver:de=>{!Ge&&q.current&&q.current!==A.key&&(de.preventDefault(),de.dataTransfer.dropEffect="move")},onDrop:de=>{if(Ge)return;de.preventDefault();let qe=de.dataTransfer.getData("text/plain")||q.current;P(),m(un=>ae(mC(un,qe,A.key)))},className:Y("space-y-2 rounded-xl border border-border/70 bg-card/90 p-3",$?null:"border-dashed bg-background/85",yt?"border-amber-200 bg-amber-50/70":null,!yt&&Ve==="success"?"border-emerald-200 bg-emerald-50/70":null,!yt&&Ve==="error"?"border-rose-200 bg-rose-50/70":null,!yt&&Ve==="pending"?"border-sky-200 bg-sky-50/70":null),children:[(0,l.jsxs)("div",{className:"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_minmax(12rem,14rem)_5.5rem] items-center gap-2",children:[(0,l.jsx)("span",{className:Y("flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground",$&&!Ge?"cursor-grab":"opacity-45"),draggable:!Ge&&$,onDragStart:de=>{if(Ge||!$)return;let qe=lh(de.currentTarget);de.dataTransfer.effectAllowed="move",de.dataTransfer.setData("text/plain",A.key),qe&&typeof de.dataTransfer?.setDragImage=="function"&&de.dataTransfer.setDragImage(qe,20,20),P(),q.current=A.key,V.current=qe,gl(qe,!0)},onDragEnd:P,title:$?"Drag to reorder":"New model draft row",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Fs,{disabled:Ge||!$||tt<=0,label:!$||tt<=0?"Already first":`Move ${A.id||`model ${tt+1}`} up`,onClick:()=>fe(A.key)}),(0,l.jsx)(Ld,{disabled:Ge||!$||D>=qr,label:!$||D>=qr?"Already last":`Move ${A.id||`model ${tt+1}`} down`,onClick:()=>ge(A.key)}),(0,l.jsx)(Kt,{ref:de=>{de?z.current.set(A.key,de):z.current.delete(A.key)},value:A.id,onChange:de=>ne(A.key,{id:de.target.value},{clearLookupState:!0,closeLookupMenu:!0}),placeholder:$?"Model id":"Add a new model id",disabled:Ge}),(0,l.jsxs)("div",{ref:de=>{de?te.current.set(A.key,de):te.current.delete(A.key)},className:"relative min-w-0",children:[(0,l.jsx)(Kt,{value:k===A.key?H[A.key]??Nd(A.contextWindow):s2(A.contextWindow),onChange:de=>{let qe=de.target.value,un=so(qe);Q(po=>({...po,[A.key]:Nd(un)})),ne(A.key,{contextWindow:un},{clearStatus:!1})},onBlur:de=>{I(qe=>qe===A.key?"":qe),Q(qe=>{if(!Object.prototype.hasOwnProperty.call(qe,A.key))return qe;let un={...qe};return delete un[A.key],un}),ne(A.key,{contextWindow:so(de.target.value)},{clearStatus:!1})},onFocus:()=>{B&&(I(A.key),Q(de=>({...de,[A.key]:Nd(A.contextWindow)})),Vt(A.key,{openMenu:!0}))},onClick:()=>{B&&Vt(A.key,{openMenu:!0})},onKeyDown:de=>{if(de.key==="ArrowDown"&&B){de.preventDefault(),Vt(A.key,{openMenu:!0});return}de.key==="Escape"&&(de.preventDefault(),M(""))},placeholder:"Context window",inputMode:"numeric",disabled:Ge||!B,className:"font-medium tabular-nums","aria-label":B?`Context window for ${B}`:"Context window"}),ht?(0,l.jsx)(EC,{open:ht,anchorRef:{current:te.current.get(A.key)||null},preferredSide:"top",desiredHeight:224,className:"z-20 rounded-lg bg-background/98 p-2",onMouseDown:de=>de.preventDefault(),children:ke?(0,l.jsxs)("div",{className:"inline-flex items-center gap-2 px-1 py-2 text-sm text-muted-foreground",children:[(0,l.jsx)(co,{}),"Fetching size options for ",(0,l.jsx)("code",{children:B}),"."]}):He?.status==="error"?(0,l.jsx)("div",{className:"rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-900",children:He.error||"Could not load suggested sizes."}):He?.options?.length>0?(0,l.jsx)("div",{className:"space-y-1",children:He.options.map(de=>(0,l.jsxs)("button",{type:"button",className:"flex w-full flex-col gap-2 rounded-lg border border-border/70 bg-background px-3 py-2 text-left text-sm text-foreground transition hover:border-accent hover:bg-accent disabled:cursor-not-allowed disabled:opacity-70",disabled:Ge,onMouseDown:qe=>qe.preventDefault(),onClick:()=>{Q(qe=>({...qe,[A.key]:Nd(de.contextWindow)})),ne(A.key,{contextWindow:String(de.contextWindow)},{clearStatus:!1}),M("")},title:`Use ${de.label}`,children:[(0,l.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,l.jsx)("div",{className:"break-words font-medium leading-5",children:de.label}),(0,l.jsx)("div",{className:"break-words text-xs leading-4 text-muted-foreground",children:de.detail})]}),(0,l.jsxs)("div",{className:"w-full rounded-md border border-border/70 bg-secondary/70 px-3 py-2",children:[(0,l.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Context size"}),(0,l.jsx)("div",{className:"mt-1 text-lg font-semibold leading-none tabular-nums text-foreground",children:qs(de.contextWindow)})]})]},de.key))}):(0,l.jsxs)("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/80 px-3 py-2 text-xs text-muted-foreground",children:["No suggested size was found for ",(0,l.jsx)("code",{children:He?.query||B}),"."]})}):null]}),$?(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Dd,onMouseDown:de=>de.preventDefault(),onClick:()=>Ee(A.key),disabled:Ge,children:"Remove"}):(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Y(Dd,"pointer-events-none invisible"),tabIndex:-1,disabled:!0,"aria-hidden":"true",children:"Remove"})]}),ke?(0,l.jsx)("div",{className:"flex justify-end text-xs",children:(0,l.jsxs)("div",{className:"inline-flex items-center gap-1.5 text-sky-700",children:[(0,l.jsx)(co,{}),"Looking up sizes"]})}):null,yt?(0,l.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:["Enter a positive integer like ",(0,l.jsx)("code",{children:"128000"}),", or leave the field blank."]}):Ve==="pending"?(0,l.jsx)("div",{className:"rounded-lg border border-sky-200 bg-sky-50 px-3 py-2 text-xs text-sky-900",children:"Testing this model against the provider endpoint now."}):Ve==="success"?(0,l.jsx)("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900",children:"Confirmed by the latest live provider test."}):Ve==="error"?(0,l.jsx)("div",{className:"rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-900",children:"This model failed the latest live provider test."}):null]},A.key)})}),cn?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:cn}):null,N?(0,l.jsx)("div",{className:Y("rounded-xl px-3 py-2 text-sm",N.tone==="error"?"border border-rose-200 bg-rose-50 text-rose-900":N.tone==="warning"?"border border-amber-200 bg-amber-50 text-amber-900":"border border-emerald-200 bg-emerald-50 text-emerald-900"),children:N.message}):null,(0,l.jsx)("div",{className:Y("sticky z-10 border-t border-border/70 bg-background/95 pt-3 backdrop-blur",o?"bottom-0":"bottom-0 -mx-5 rounded-b-[1rem] px-5 pb-4"),children:(0,l.jsxs)("div",{className:"flex min-h-9 items-center justify-between gap-3",children:[(0,l.jsx)("div",{className:Y("text-xs",u==="testing"?"text-sky-700":u==="saving"?"text-foreground":"text-muted-foreground"),children:u==="testing"?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(co,{}),f||"Testing new models before save."]}):u==="saving"?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(co,{}),f||"Saving provider models."]}):Re.length>0&&uo(e)==="api"?`${Re.length} new model${Re.length===1?"":"s"} will be tested before save.`:"Existing models keep their current configuration metadata."}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[!t&&!Ge&&sn.length>0?(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:()=>{Gt()},children:x?"Filling\u2026":"Fill missing context size"}):null,!t&&!Ge&&ot?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>{v({}),C({}),w(null),M(""),_e.current.clear(),F.current.clear(),m(ae(d,{preserveFocus:!0}))},children:"Reset"}):null,!t&&ot&&!cn?(0,l.jsx)(ce,{type:"button",onClick:()=>{Mt()},disabled:Ge,children:u==="testing"||b==="testing"?"Testing\u2026":u==="saving"||b==="saving"||r?"Saving\u2026":"Save models"}):null]})]})})]})}function J2({title:e,rows:t,onChange:n,options:r,disabled:a=!1,addLabel:o="Add target",emptyLabel:i="No targets configured.",helperText:s="Drag rows or use the arrow to change routing order.",helperAction:c=null,placeholder:u="provider/model or alias",draftPlaceholder:f="Add a new route",showDraftRow:d=!1,showDraftFocusButton:p=!1,showWeightInput:m=!1,filterOtherSelectedValues:b=!1,excludedValues:g=[]}){let x=(0,E.useRef)(0),y=(0,E.useRef)(""),h=(0,E.useRef)(null),v=(0,E.useRef)(new Map),S=(0,E.useRef)(0),C=(0,E.useRef)(0),[N,w]=(0,E.useState)(0),R=(0,E.useMemo)(()=>String(e||"targets").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"targets",[e]),M=`${R}-draft-row`,k=(0,E.useMemo)(()=>{let F=(t||[]).filter(he=>String(he?.ref||"").trim());return d?[{key:M,ref:"",sourceRef:""},...F]:F},[t,d,M]),I=sh(k.map(F=>F.key)),H=(0,E.useMemo)(()=>ba(g),[g]),Q=(0,E.useMemo)(()=>Gs(r,[...k.map(F=>F?.ref),...H]),[r,k,H]);(0,E.useEffect)(()=>()=>{typeof window<"u"&&S.current&&window.cancelAnimationFrame(S.current)},[]);function ee(F,he){if(d&&F===M){if(!String(he||"").trim())return;x.current+=1,n([{key:`${R}-draft-${x.current}`,ref:he,sourceRef:"",...m?{weight:"1"}:{}},...(t||[]).filter(Z=>String(Z?.ref||"").trim())]);return}n((t||[]).map(Z=>Z.key===F?{...Z,ref:he}:Z))}function X(F,he){n((t||[]).map(Z=>Z.key===F?{...Z,weight:he}:Z))}function z(F){n((t||[]).filter(he=>he.key!==F))}function te(F){n(ih(t||[],F,he=>he?.key))}function W(F){n(pC(t||[],F,he=>he?.key))}function q(){y.current="",gl(h.current,!1),h.current=null}function V(){x.current+=1;let F=new Set([...(t||[]).map(Z=>String(Z?.ref||"").trim()).filter(Boolean),...H]),he=Q.find(Z=>!F.has(Z.value))?.value||"";n([...t||[],{key:`${R}-draft-${x.current}`,ref:he,sourceRef:""}])}function _e(){if(!d||a)return;let F=v.current.get(M);if(!F||typeof window>"u"){w(Te=>Te+1);return}C.current+=1;let he=C.current;S.current&&(window.cancelAnimationFrame(S.current),S.current=0),F.scrollIntoView({block:"start",behavior:"smooth"});let Z=yd(F),ae=V1(F,Z),Se=0,U=0,ne=90,ue=8,me=6,re=.5,oe=()=>{if(C.current!==he)return;let Te=v.current.get(M)||F,Re=V1(Te,Z);if(!Number.isFinite(Re.top)||!Number.isFinite(Re.left)){S.current=0,w(Ze=>Ze+1);return}if(Tk(ae,Re,re)?Se+=1:Se=0,ae=Re,U+=1,U>=ue&&Se>=me||U>=ne){S.current=0,w(Ze=>Ze+1);return}S.current=window.requestAnimationFrame(oe)};S.current=window.requestAnimationFrame(oe)}return(0,l.jsxs)("div",{className:"space-y-2 rounded-2xl border border-border/70 bg-background/55 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:e}),p&&d?(0,l.jsx)(ce,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 rounded-md p-0 text-muted-foreground hover:text-foreground",onMouseDown:F=>F.preventDefault(),onClick:_e,disabled:a,"aria-label":o,title:o,children:(0,l.jsx)(gC,{className:"h-3.5 w-3.5"})}):null]}),(0,l.jsxs)("div",{className:"ml-auto flex max-w-full flex-wrap items-start justify-end gap-x-3 gap-y-2",children:[s?(0,l.jsx)("div",{className:"max-w-[34rem] text-right text-[11px] leading-4 text-muted-foreground",children:s}):null,d?null:(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:V,disabled:a,children:o})]})]}),k.length>0?(0,l.jsx)("div",{className:"space-y-2",children:k.map((F,he)=>{let Z=d&&F.key===M,ae=Z?-1:(t||[]).findIndex(U=>U?.key===F.key),Se=b?Q.filter(U=>{let ne=String(U?.value||"").trim();return ne?ne===String(F?.ref||"").trim()?!0:H.includes(ne)?!1:!(k||[]).some(ue=>ue?.key!==F.key&&String(ue?.ref||"").trim()===ne):!1}):Q;return(0,l.jsxs)("div",{ref:U=>{if(I(F.key)(U),U){v.current.set(F.key,U);return}v.current.delete(F.key)},"data-reorder-row":"true",onDragOver:U=>{!a&&y.current&&y.current!==F.key&&(U.preventDefault(),U.dataTransfer.dropEffect="move")},onDrop:U=>{if(a)return;U.preventDefault();let ne=U.dataTransfer.getData("text/plain")||y.current;q(),n(mC(t||[],ne,F.key))},className:Y(m?"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_10rem_5.5rem] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3":"grid grid-cols-[auto_auto_auto_minmax(0,1fr)_5.5rem] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3",Z?"border-dashed bg-background/85":null),children:[(0,l.jsx)("span",{className:Y("flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground",Z||a?"opacity-45":"cursor-grab"),draggable:!a&&!Z,onDragStart:U=>{if(a||Z)return;let ne=lh(U.currentTarget);U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",F.key),ne&&typeof U.dataTransfer?.setDragImage=="function"&&U.dataTransfer.setDragImage(ne,20,20),q(),y.current=F.key,h.current=ne,gl(ne,!0)},onDragEnd:q,title:Z?"New route draft row":"Drag to reorder",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Fs,{disabled:a||Z||ae<=0,label:Z||ae<=0?"Already first":`Move ${F.ref||`target ${ae+1}`} up`,onClick:()=>te(F.key)}),(0,l.jsx)(Ld,{disabled:a||Z||ae===-1||ae>=(t||[]).length-1,label:Z||ae===-1||ae>=(t||[]).length-1?"Already last":`Move ${F.ref||`target ${ae+1}`} down`,onClick:()=>W(F.key)}),(0,l.jsxs)("div",{className:"flex h-9 min-w-0 overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Model"}),(0,l.jsxs)(vr,{value:F.ref||void 0,onValueChange:U=>ee(F.key,U),disabled:a,openSearchRequest:Z?N:0,children:[(0,l.jsx)(br,{className:"h-full min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 shadow-none focus:border-transparent focus:ring-0",children:(0,l.jsx)(xr,{placeholder:Z?f:u})}),(0,l.jsx)(Sr,{children:Se.length>0?Bd(Se,{keyPrefix:`${e}-row-${F.key}`}):(0,l.jsx)(ar,{value:"__no-route-options",disabled:!0,children:"No routes available"})})]})]}),m?(0,l.jsxs)("div",{className:Y("flex h-9 overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",Z?"opacity-45":null),children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Weight"}),(0,l.jsx)(Kt,{value:Z?"":String(F?.weight||"1"),onChange:U=>X(F.key,U.target.value),inputMode:"numeric",placeholder:"1",disabled:a||Z,className:"h-full min-w-0 rounded-none border-0 bg-transparent px-3 text-center shadow-none focus:border-transparent focus:ring-0","aria-label":Z?"Weight for new target":`Weight for ${F.ref||`target ${he+1}`}`})]}):null,Z?(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Y(Dd,"pointer-events-none invisible"),tabIndex:-1,disabled:!0,"aria-hidden":"true",children:"Remove"}):(0,l.jsx)(ce,{type:"button",variant:"ghost",className:Dd,onMouseDown:U=>U.preventDefault(),onClick:()=>z(F.key),disabled:a,children:"Remove"})]},F.key)})}):(0,l.jsx)("div",{className:"rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:i}),c?(0,l.jsx)("div",{className:"flex min-h-8 items-center justify-end",children:c}):null]})}function eL(e,t){let n=Math.abs(Number(e)||0),r=Math.abs(Number(t)||0);for(;r!==0;){let a=n%r;n=r,r=a}return n||1}function tL(e=[]){return!Array.isArray(e)||e.length===0?1:e.reduce((t,n)=>eL(t,n),0)||1}function nL(e,t){let n=String(e||"").trim();if(!n)return"Unconfigured route";let r=t.get(n);if(!r)return n;let a=String(r.label||n).trim()||n,o=String(r.hint||"").trim();return o&&o!==a?`${a} \xB7 ${o}`:a}function rL(e,t,n=[]){let r=new Map((n||[]).map(s=>[String(s?.value||"").trim(),s]).filter(([s])=>!!s)),a=new Map((Array.isArray(t?.targets)?t.targets:[]).map(s=>[String(s?.ref||"").trim(),s]).filter(([s])=>!!s)),o=new Map((Array.isArray(t?.fallbackTargets)?t.fallbackTargets:[]).map(s=>[String(s?.ref||"").trim(),s]).filter(([s])=>!!s));function i(s,c,u){return(s||[]).map((f,d)=>{let p=String(f?.ref||"").trim(),m=String(f?.sourceRef||f?.ref||"").trim(),b=u.get(m)||u.get(p)||{},g=Number(f?.weight??b?.weight),x=Number.isFinite(g)&&g>0?Math.floor(g):1;return{key:`${c}-${p||"empty"}-${d}`,ref:p,label:nL(p,r),bucket:c,weight:x}}).filter(f=>!!f.ref)}return[...i(e?.targets,"primary",a),...i(e?.fallbackTargets,"fallback",o)]}function aL(e=[],t=8){if(!Array.isArray(e)||e.length===0)return[];let n=e.map(s=>Math.max(1,Number(s?.weight)||1)),r=tL(n),a=n.map(s=>Math.max(1,Math.floor(s/r))),o=a.reduce((s,c)=>s+c,0);if(o>24){let s=o/24;a=a.map(c=>Math.max(1,Math.round(c/s))),o=a.reduce((c,u)=>c+u,0)}let i=[];for(let s=0;s<e.length;s+=1)for(let c=0;c<a[s];c+=1)i.push(e[s]);return Array.from({length:Math.max(e.length,t)},(s,c)=>i[c%i.length])}function oL(e,t=[]){let n=dh(e),r=hC(n),a=Array.isArray(t)?t.filter(Boolean):[],i=a.some(s=>s.bucket==="fallback")?"Runtime builds the candidate pool as all primary targets first, then all fallback targets.":"Runtime builds the candidate pool from the primary target list only.";if(n==="round-robin"){let s=a.length>0?Array.from({length:Math.max(a.length,8)},(c,u)=>a[u%a.length]):[];return{strategyLabel:r,summary:"Each new request starts from the next candidate in the current pool, then wraps around.",poolNote:`${i} Round-robin rotates across that combined eligible list.`,sequenceLabel:"Example starting candidate by request",sequenceEntries:s,footnote:"If a candidate is unhealthy or quota-blocked, it is skipped and the next eligible candidate is chosen."}}if(n==="weighted-rr"||n==="quota-aware-weighted-rr"||n==="auto"){let s=n==="auto",c=aL(a,8);return{strategyLabel:r,summary:s?"`auto` normalizes to quota-aware weighted round-robin in the runtime balancer.":n==="quota-aware-weighted-rr"?"Candidates rotate like weighted round-robin, but low remaining quota or poor health lowers their share.":"Candidates repeat in proportion to their configured weights.",poolNote:`${i} This strategy ranks across the full eligible pool after it is built.`,sequenceLabel:"Example starting candidate by request",sequenceEntries:c,footnote:s||n==="quota-aware-weighted-rr"?"When all quotas and health scores are equal, the rotation looks like the weighted example below. Low remaining capacity or retryable failures push a target later.":"Weights come from the existing alias target metadata when present. Targets without a stored weight behave as weight 1."}}return{strategyLabel:r,summary:"Requests try candidates in the configured list order and only move to later candidates when earlier ones are unavailable or fail.",poolNote:`${i} Ordered keeps that exact sequence.`,sequenceLabel:"Attempt order",sequenceEntries:a,footnote:"This is the most predictable option when you want a strict preference order."}}function iL({open:e=!1,onClose:t=()=>{},onSave:n=()=>{},aliasLabel:r="",initialStrategy:a="auto",entries:o=[],disabled:i=!1}){let s=dh(a),[c,u]=(0,E.useState)(s),[f,d]=(0,E.useState)(!1);(0,E.useEffect)(()=>{e&&(u(s),d(!1))},[e,s,r]);async function p(){if(!(i||f)){d(!0);try{await n(c)!==!1&&t()}finally{d(!1)}}}return(0,l.jsx)(Sa,{open:e,onClose:t,title:r?`Choose strategy \xB7 ${r}`:"Choose strategy",description:"Review each routing strategy in its own tab. Save applies the currently selected tab to this alias.",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,disabled:f,children:"Cancel"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{p()},disabled:i||f,children:f?"Saving\u2026":"Save strategy"})]}),children:(0,l.jsxs)(Hu,{value:c,onValueChange:u,children:[(0,l.jsx)("div",{className:"overflow-x-auto pb-1",children:(0,l.jsx)(qu,{className:"h-auto min-w-max flex-wrap justify-start gap-2 rounded-2xl bg-secondary/80 p-2",children:Wg.map(m=>(0,l.jsx)(Or,{value:m.value,className:"h-auto min-h-10 rounded-xl px-4 py-2",children:m.label},m.value))})}),Wg.map(m=>{let b=oL(m.value,o),g=(b.sequenceEntries||[]).filter(Boolean);return(0,l.jsx)(_r,{value:m.value,className:"mt-4",children:(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)]",children:[(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Nt,{variant:"outline",children:b.strategyLabel}),(0,l.jsxs)(Nt,{variant:"info",children:[o.length," candidate",o.length===1?"":"s"]})]}),(0,l.jsxs)("div",{className:"mt-4 space-y-3 text-sm leading-6 text-foreground",children:[(0,l.jsx)("p",{children:b.summary}),(0,l.jsx)("p",{className:"text-muted-foreground",children:b.poolNote})]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:b.sequenceLabel}),g.length>0?(0,l.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:g.map((x,y)=>(0,l.jsxs)("div",{className:"rounded-full border border-border/70 bg-card/90 px-3 py-1.5 text-sm text-foreground",children:[(0,l.jsx)("span",{className:"mr-2 text-xs text-muted-foreground",children:y+1}),(0,l.jsx)("span",{children:x.label})]},`${x.key}-sequence-${y}`))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"Add at least one target to preview how this strategy would route requests."}),(0,l.jsx)("div",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:b.footnote})]})]}),(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Current setup"}),r?(0,l.jsx)(Nt,{variant:"outline",children:r}):null]}),o.length>0?(0,l.jsx)("div",{className:"mt-4 space-y-2",children:o.map(x=>(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-border/70 bg-card/90 px-3 py-2 text-sm",children:[(0,l.jsx)(Nt,{variant:x.bucket==="primary"?"info":"outline",children:x.bucket}),(0,l.jsx)("span",{className:"font-medium text-foreground",children:x.label}),(0,l.jsxs)("span",{className:"text-xs text-muted-foreground",children:["weight ",x.weight]})]},x.key))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"This alias does not have any targets yet."})]})})]})},m.value)})]})})}function lL({open:e=!1,onClose:t=()=>{},config:n={}}){let r=(0,E.useMemo)(()=>d2(n),[n]);return(0,l.jsx)(Sa,{open:e,onClose:t,title:"Alias guide",description:"Aliases give clients one stable route while letting LLM Router swap, balance, and fail over across provider/model targets behind that route.",contentClassName:"max-h-[92vh] max-w-4xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Stable route"}),(0,l.jsxs)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:["Expose one alias like ",(0,l.jsx)("code",{children:"coding"})," or ",(0,l.jsx)("code",{children:"gpt-5.4"})," to clients, then retarget the alias later without touching client config."]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Selection strategy"}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:"The alias strategy controls how LLM Router picks from the configured targets. Ordered is strict preference; the other strategies distribute traffic when multiple targets are healthy."})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Fallback behavior"}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-foreground",children:"If one target is unavailable or rate limited, LLM Router can continue to later candidates in the same alias instead of failing the whole request immediately."})]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Nt,{variant:"warning",children:"Important"}),(0,l.jsx)("div",{className:"text-sm font-medium text-amber-950",children:"Mixed context windows inside one alias can change behavior."})]}),(0,l.jsxs)("div",{className:"mt-3 text-sm leading-6 text-amber-900",children:["If an alias mixes models with different context windows, requests that fit the larger model may still fail on the smaller model. For example, an alias that includes both a ",(0,l.jsx)("code",{children:"258K"})," model and a ",(0,l.jsx)("code",{children:"128K"})," model can still fail when routing lands on the smaller target. Keep aliases aligned by context size when you expect long histories or large prompts."]})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Current config check"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Aliases below currently mix different configured model context windows."})]}),(0,l.jsx)(Nt,{variant:r.length>0?"warning":"success",children:r.length>0?`${r.length} alias${r.length===1?"":"es"} need review`:"No mixed context windows detected"})]}),r.length>0?(0,l.jsx)("div",{className:"mt-4 space-y-3",children:r.map(a=>(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50/70 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Nt,{variant:"outline",children:a.aliasId}),(0,l.jsxs)("div",{className:"text-sm font-medium text-amber-950",children:["Smallest target: ",qs(a.smallestContextWindow),". Largest target: ",qs(a.largestContextWindow),"."]})]}),(0,l.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.models.map(o=>(0,l.jsxs)("div",{className:"rounded-full border border-amber-200 bg-background/90 px-3 py-1.5 text-sm text-foreground",children:[o.ref," \xB7 ",qs(o.contextWindow)]},o.ref)),a.unknownRefs.map(o=>(0,l.jsxs)("div",{className:"rounded-full border border-dashed border-amber-300 bg-background/70 px-3 py-1.5 text-sm text-muted-foreground",children:[o," \xB7 context unknown"]},o))]})]},a.aliasId))}):(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"No alias currently mixes known context-window sizes across its configured targets."})]})]})})}function lC({aliasId:e,alias:t,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:i=!1,disabledReason:s="",busy:c=!1,onApply:u,onRemove:f,onCopyAliasId:d=()=>{},isNew:p=!1,alwaysShowAliasIdInput:m=!1,showIssueOnSubmitOnly:b=!1,onDiscard:g=()=>{},onOpenStrategyModal:x=()=>{},titleAccessory:y=null,aliasSwitcher:h=null,framed:v=!0}){let S=Vk(e,t,{isNew:p}),C=(0,E.useMemo)(()=>L1(p?"":e,t),[S]),[N,w]=(0,E.useState)(C),[R,M]=(0,E.useState)(p),[k,I]=(0,E.useState)(!1),H=(0,E.useRef)(null);(0,E.useEffect)(()=>{w(C),M(p),I(!1)},[C,p]);let Q=!p&&Array.isArray(h?.entries)&&h.entries.length>1,ee=m||R;(0,E.useEffect)(()=>{if(!ee)return;let P=typeof window<"u"?window.requestAnimationFrame(()=>{H.current?.focus(),H.current?.select?.()}):0;return()=>{typeof window<"u"&&window.cancelAnimationFrame(P)}},[ee]);let X=String(N?.id||"").trim(),z=e===at||X===at,te=(0,E.useMemo)(()=>Gs((r||[]).filter(P=>P.kind!=="alias"&&P.value!==X&&P.value!==`alias:${X}`),(N?.targets||[]).map(P=>P?.ref)),[r,X,N?.targets]),W=(N?.targets||[]).map(P=>String(P?.ref||"").trim()),q=(N?.targets||[]).some(P=>!String(P?.ref||"").trim()),V=fh(W),_e=(N?.targets||[]).some(P=>{if(!String(P?.ref||"").trim())return!1;let Ye=Math.floor(Number(P?.weight));return!Number.isFinite(Ye)||Ye<=0}),F=X&&n.some(P=>P!==e&&P===X),he=X&&W.some(P=>P===X||P===`alias:${X}`),Z=W.filter(Boolean).length>0,ae=JSON.stringify({id:C.id,strategy:C.strategy,targets:C.targets.map(P=>({ref:P.ref,weight:String(P?.weight||"1")}))}),Se=JSON.stringify({id:X,strategy:N?.strategy,targets:(N?.targets||[]).map(P=>({ref:String(P?.ref||"").trim(),weight:String(P?.weight||"1").trim()}))}),U=ae!==Se,ne=X?Ck.test(X)?F?"Alias id already exists. Choose another id.":q?"Fill or remove blank target rows before applying.":V?"Duplicate targets are not allowed anywhere in this alias.":_e?"Target weights must be positive integers.":he?"An alias cannot target itself.":"":"Alias id must start with a letter or number and use letters, numbers, dots, underscores, colons, or hyphens.":"Alias id is required.",ue=i?s:ne,me=i?s:b&&ne&&!k?"":ne,re=i||c,oe=String(X||e||"").trim(),Te=oe||"Select alias",Re=re||z||p,Ze=z?"Default alias cannot be removed":`Remove alias ${oe||e}`,gt=(0,E.useMemo)(()=>eh(Te),[Te]),Pt=z||a===e||a===X,sn=o===e||o===X,ot=p?"Enter alias name. Example: claude-opus":void 0,mo=(0,E.useMemo)(()=>rL({...N,fallbackTargets:[]},{...t,fallbackTargets:[]},r),[N,t,r]);async function Ge(){if(I(!0),ue)return!1;let P=await u(e,{...N,fallbackTargets:[]});return P&&p&&g(e),P}async function qr(P){let Ye={...N,strategy:P};return await u(e,{...Ye,fallbackTargets:[]})?p?(g(e),!0):(w(Ye),!0):!1}async function cn(){if(I(!0),ue)return!1;let P=await u(e,{...N,fallbackTargets:[]});return P&&(M(!1),I(!1)),P}function $e(){if(m)return;if(!Q){M(!1);return}let P=String(e||"").trim(),Ye=String(N?.id||"").trim();if(!Ye||Ye===P){w(Vt=>({...Vt,id:P})),M(!1),I(!1);return}cn()}function Ee(P){if(P.key==="Escape"){P.preventDefault(),w(Ye=>({...Ye,id:C.id})),M(!1),I(!1);return}!m&&P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())}async function fe(){if(ee){let P=String(e||"").trim(),Ye=String(N?.id||"").trim();if(!Ye||Ye===P){w(Vt=>({...Vt,id:P})),M(!1),I(!1);return}await cn();return}M(!0)}let ge=(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:Q?(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[(0,l.jsxs)("div",{className:Y("flex h-9 min-w-0 max-w-full overflow-hidden rounded-lg border border-input bg-background/80 shadow-sm transition focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/40",ee?"flex-1":"w-fit"),children:[(0,l.jsx)("div",{className:"flex shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Select an alias"}),ee?(0,l.jsx)(Kt,{ref:H,value:N.id,placeholder:ot,onChange:P=>w(Ye=>({...Ye,id:P.target.value})),onBlur:$e,onKeyDown:Ee,disabled:re||z,className:"h-full min-w-[12rem] flex-1 rounded-none border-0 bg-transparent px-3 text-sm font-medium shadow-none focus:border-transparent focus:ring-0"}):(0,l.jsxs)(vr,{value:h.value||void 0,onValueChange:h.onValueChange,children:[(0,l.jsx)(br,{className:"h-full min-w-[10rem] flex-none rounded-none border-0 bg-transparent px-3 pr-[50px] text-left text-sm font-medium shadow-none focus:border-transparent focus:ring-0",style:{width:`${gt}px`,maxWidth:"100%"},children:(0,l.jsx)(xr,{placeholder:"Select alias"})}),(0,l.jsx)(Sr,{children:h.entries.map(([P,Ye])=>(0,l.jsx)(ar,{value:P,searchText:`${P} ${(Ye?.targets||[]).length} ${(Ye?.fallbackTargets||[]).length}`,children:P},P))})]}),ee?null:(0,l.jsx)("button",{type:"button",className:"flex h-full w-10 shrink-0 items-center justify-center border-l border-border/70 text-muted-foreground transition hover:bg-accent/60 hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>{d(oe)},disabled:re||!oe,"aria-label":`Copy alias id ${oe}`,title:oe?`Copy alias id ${oe}`:"Alias id is not ready yet",children:(0,l.jsx)(V2,{className:"h-4 w-4 shrink-0"})})]}),(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:bg-background/90 hover:text-foreground",onMouseDown:P=>{ee&&P.preventDefault()},onClick:()=>{fe()},disabled:re||z,"aria-label":ee?"Save alias id":z?"Default alias id cannot be edited":"Edit alias id",title:ee?"Save alias id":z?"Default alias id cannot be edited":"Edit alias id",children:ee?(0,l.jsx)(P2,{className:"h-4 w-4 shrink-0"}):(0,l.jsx)(Md,{className:"h-4 w-4 shrink-0"})}),p?null:(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:border-destructive hover:bg-background/90 hover:text-destructive",onClick:()=>f(e),disabled:Re,"aria-label":Ze,title:Ze,children:(0,l.jsx)(rh,{className:"h-4 w-4 shrink-0"})})]}):(0,l.jsxs)(l.Fragment,{children:[ee?(0,l.jsx)(Kt,{ref:H,autoFocus:p,value:N.id,placeholder:ot,onChange:P=>w(Ye=>({...Ye,id:P.target.value})),onBlur:$e,onKeyDown:Ee,disabled:re||z&&!p,className:"max-w-[22rem] font-semibold"}):z&&!p?(0,l.jsx)("div",{className:"truncate text-base font-semibold text-foreground",children:e}):(0,l.jsxs)("button",{type:"button",className:"group inline-flex max-w-full items-center gap-2 rounded-lg text-left text-base font-semibold text-foreground transition hover:bg-primary/5 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background",onClick:()=>M(!0),disabled:re,"aria-label":"Edit alias id",title:"Edit alias id",children:[(0,l.jsx)("span",{className:"truncate",children:p?X||"New alias":X||e}),(0,l.jsx)(Md,{className:"h-4 w-4 shrink-0"})]}),y?(0,l.jsx)("div",{className:"min-w-[11rem] max-w-full",children:y}):null]})}),z?null:(0,l.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[Pt?(0,l.jsx)(Nt,{variant:"success",children:"Default route"}):null,sn?(0,l.jsx)(Nt,{variant:"info",children:"AMP default"}):null]})]}),(0,l.jsxs)("div",{className:"flex items-start gap-2 self-start",children:[(0,l.jsxs)(ce,{type:"button",variant:"outline",size:"default",className:"group h-9 gap-0 overflow-hidden rounded-lg border-border/70 bg-background/70 px-0 text-sm font-medium normal-case tracking-normal shadow-none hover:bg-background/90",onClick:()=>x({aliasLabel:X||(p?"New alias":e),strategy:N?.strategy||"auto",entries:mo,disabled:re||!!ue,onSave:qr}),disabled:re,children:[(0,l.jsx)("span",{className:"flex h-full shrink-0 items-center border-r border-border/70 bg-secondary/55 px-2.5 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Routing stratergy"}),(0,l.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-2 px-3 text-left",children:[(0,l.jsx)("span",{className:"truncate",children:hC(N.strategy||"auto")}),(0,l.jsx)(Md,{className:"h-4 w-4 shrink-0"})]})]}),!Q&&!p?(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-9 w-9 rounded-lg border-border/70 bg-background/70 p-0 text-muted-foreground shadow-none hover:border-destructive hover:bg-background/90 hover:text-destructive",onClick:()=>f(e),disabled:Re,"aria-label":Ze,title:Ze,children:(0,l.jsx)(rh,{className:"h-4 w-4 shrink-0"})}):null]})]}),(0,l.jsx)(J2,{title:"Manage model in alias",rows:N.targets,onChange:P=>w(Ye=>({...Ye,targets:P})),options:te,disabled:re,addLabel:"Add target",emptyLabel:"No targets yet. This alias can stay empty until you wire routes back in.",helperText:"Drag to reorder targets. Weights and metadata stay with the same ref.",draftPlaceholder:"Add a new target",showDraftRow:!0,showDraftFocusButton:!0,showWeightInput:!0,filterOtherSelectedValues:!0,excludedValues:[]}),me?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:me}):null,!me&&z&&!Z?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:["The fixed ",(0,l.jsx)("code",{children:"default"})," route is empty. Requests routed to ",(0,l.jsx)("code",{children:"default"})," or ",(0,l.jsx)("code",{children:"smart"})," will return 500 until you add a working target."]}):null,p||U?(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsx)("div",{children:p?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>g(e),disabled:re,children:"Discard"}):null}),(0,l.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[U?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>{w(C),I(!1)},disabled:re,children:"Reset"}):null,p||U&&!ue?(0,l.jsx)(ce,{type:"button",onClick:()=>{Ge()},disabled:re,children:c?"Saving\u2026":p?"Create alias":"Apply alias"}):null]})]}):null]});return v?(0,l.jsx)(Xn,{children:(0,l.jsx)(Zn,{className:"space-y-4 p-5",children:ge})}):ge}function sL({aliases:e,config:t,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabledReason:i="",busy:s=!1,onApplyAlias:c,onRemoveAlias:u,onCopyAliasId:f}){let d=Object.entries(e||{}),p=!!i,[m,b]=(0,E.useState)(""),[g,x]=(0,E.useState)(!1),[y,h]=(0,E.useState)(""),v=(0,E.useMemo)(()=>Pk(),[]),[S,C]=(0,E.useState)({open:!1,aliasLabel:"",strategy:"auto",entries:[],disabled:!1,onSave:null});function N(){p||s||b(`draft-${Date.now()}`)}function w(z){(!z||z===m)&&b("")}function R(){b("")}function M({aliasLabel:z="",strategy:te="auto",entries:W=[],disabled:q=!1,onSave:V=null}){C({open:!0,aliasLabel:z,strategy:te,entries:W,disabled:q,onSave:V})}function k(){C(z=>({...z,open:!1}))}async function I(z,te){let W=await c(z,te);if(W){let q=String(te?.id||z||"").trim()||z;h(q)}return W}(0,E.useEffect)(()=>{let z=d.map(([te])=>te);if(z.length===0){y&&h("");return}(!y||!z.includes(y))&&h(z[0])},[d,y]);let H=d.find(([z])=>z===y)||d[0]||null,Q=H?.[0]||"",ee=H?.[1]||null,X=d.length>1?{value:Q,onValueChange:h,entries:d}:null;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Xn,{children:[(0,l.jsx)(jo,{children:(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"space-y-1",children:(0,l.jsx)(ws,{children:"Model aliases give clients one stable route across multiple provider/models, so you can swap, balance, and fail over without changing client config."})}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",onClick:()=>x(!0),children:"Help"}),(0,l.jsx)(ce,{type:"button",size:"sm",onClick:N,disabled:p||s,children:s?"Saving\u2026":"Add alias"})]})]})}),(0,l.jsxs)(Zn,{className:"space-y-4",children:[p?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:i}):null,d.length>0?Q&&ee?(0,l.jsx)(lC,{aliasId:Q,alias:ee,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:p,disabledReason:i,busy:s,onApply:I,onRemove:u,onCopyAliasId:f,onOpenStrategyModal:M,aliasSwitcher:X,framed:!1},Q):null:(0,l.jsxs)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:["No model aliases yet. Add one to expose stable routes like ",(0,l.jsx)("code",{children:"coding"})," or ",(0,l.jsx)("code",{children:"chat.fast"})," in the Web UI."]})]})]}),(0,l.jsx)(Sa,{open:!!m,onClose:R,title:"Add alias",description:"Set a stable client-facing route, choose its strategy, and order the targets it should use.",showCloseButton:!1,contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:m?(0,l.jsx)(lC,{aliasId:m,alias:v,aliasIds:n,routeOptions:r,defaultModel:a,ampDefaultRoute:o,disabled:p,disabledReason:i,busy:s,onApply:I,onRemove:u,onCopyAliasId:f,isNew:!0,alwaysShowAliasIdInput:!0,showIssueOnSubmitOnly:!0,onDiscard:w,onOpenStrategyModal:M,framed:!1},m):null}),(0,l.jsx)(iL,{open:S.open,onClose:k,onSave:z=>S.onSave?.(z),aliasLabel:S.aliasLabel,initialStrategy:S.strategy,entries:S.entries,disabled:S.disabled}),(0,l.jsx)(lL,{open:g,onClose:()=>x(!1),config:t})]})}function cL({children:e,onClick:t,disabled:n=!1,title:r="",className:a=""}){return(0,l.jsx)("button",{type:"button",className:Y("inline-flex items-center rounded-full border border-border bg-background/70 px-2.5 py-1 text-[11px] font-medium tracking-wide text-muted-foreground transition hover:border-primary/35 hover:bg-primary/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",a),onClick:t,disabled:n,title:r,"aria-label":r||void 0,children:e})}function uL({provider:e,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i="",busy:s=!1}){let c=(0,E.useMemo)(()=>w2(e),[e]),[u,f]=(0,E.useState)(c),[d,p]=(0,E.useState)(!1),[m,b]=(0,E.useState)(!1),[g,x]=(0,E.useState)(!1),[y,h]=(0,E.useState)("provider"),[v,S]=(0,E.useState)(""),[C,N]=(0,E.useState)(0),[w,R]=(0,E.useState)({isDirty:!1,issue:"",locked:!1,rows:[]}),[M,k]=(0,E.useState)({phase:"",modelStates:{},failedModelIds:[],message:""}),I=(0,E.useRef)(null),H=(0,E.useRef)(null),Q=(0,E.useRef)(null),ee=(0,E.useRef)(null);(0,E.useEffect)(()=>{f(c)},[c]);let z=uo(e)!=="api",te=(Array.isArray(e?.models)?e.models:[]).map(fe=>String(fe?.id||"").trim()).filter(Boolean),W=bl(e),q=z?"":Hk(e?.rateLimits),V=z?[]:Hr(u?.endpoints,u?.endpointDraft),_e=z?[]:xa(u?.rateLimitRows),F=JSON.stringify({id:String(u?.id||"").trim(),name:String(u?.name||"").trim(),credentialInput:String(u?.credentialInput||"").trim(),endpoints:V,endpointDraft:String(u?.endpointDraft||"").trim(),rateLimitRows:F1(u?.rateLimitRows)}),he=JSON.stringify({id:String(c?.id||"").trim(),name:String(c?.name||"").trim(),credentialInput:String(c?.credentialInput||"").trim(),endpoints:ba(c?.endpoints),endpointDraft:String(c?.endpointDraft||"").trim(),rateLimitRows:F1(c?.rateLimitRows)}),Z=F!==he,ae=!!i||s,Se=new Set((Array.isArray(w.rows)?w.rows:[]).map(fe=>String(fe?.id||"").trim()).filter(Boolean)),U=M.failedModelIds.filter(fe=>Se.has(fe)),ne=ae||M.phase==="testing"||M.phase==="saving",ue=z?"":ti(_e,{knownModelIds:te,requireAtLeastOne:!0}),me=i||(String(u?.id||"").trim()?Od.test(String(u?.id||"").trim())?String(u?.name||"").trim()?!z&&V.length===0?"Add at least one endpoint for API Key providers.":!z&&V.some(fe=>!Ks(fe))?"All endpoints must start with http:// or https://.":ue:"Provider name is required.":"Provider id must start with a letter and use lowercase letters, digits, or dashes only.":"Provider id is required."),re=z?u:{...u,endpoints:V,endpointDraft:""},oe=!!w.isDirty,Te=Z||oe,Re=[Z?"provider settings":"",oe?"model list":""].filter(Boolean),Ze=[Z&&me?`Provider: ${me}`:"",oe&&w.issue?`Models: ${w.issue}`:""].filter(Boolean).join(" "),gt=ae||M.phase==="testing"||M.phase==="saving"||Z&&!!me||oe&&(!!w.issue||w.locked)||typeof o!="function";async function Pt(){let fe=await r(e.id,re);return fe&&Ge(),fe}async function sn(fe){let ge=await a(e.id,fe,{providerDraft:Z?re:null,onModelTestStateChange:P=>{k({phase:String(P?.phase||""),modelStates:P?.modelStates&&typeof P.modelStates=="object"?P.modelStates:{},failedModelIds:Array.isArray(P?.failedModelIds)?P.failedModelIds:[],message:String(P?.message||"")})}});return ge&&Ge(),ge}function ot(){f(c)}let mo=(0,E.useCallback)(fe=>{R(fe)},[]);function Ge(){b(!1),x(!1),p(!1),h("provider"),S(""),f(c),R({isDirty:!1,issue:"",locked:!1,rows:[]}),k({phase:"",modelStates:{},failedModelIds:[],message:""})}async function qr(){let fe=(Array.isArray(w.rows)?w.rows:[]).filter(P=>!U.includes(String(P?.id||"").trim()));return fe.length===0&&!Z||await o(e.id,{providerDraft:Z?re:null,modelRows:oe?fe:null,onModelTestStateChange:P=>{k({phase:String(P?.phase||""),modelStates:P?.modelStates&&typeof P.modelStates=="object"?P.modelStates:{},failedModelIds:Array.isArray(P?.failedModelIds)?P.failedModelIds:[],message:String(P?.message||"")})}})?(Ge(),!0):(h("models"),!1)}(0,E.useEffect)(()=>{k({phase:"",modelStates:{},failedModelIds:[],message:""})},[c]),(0,E.useEffect)(()=>{U.length>0||!g||x(!1)},[U,g]),(0,E.useEffect)(()=>{if(!d||y!=="provider"||v!=="endpoint"&&v!=="rate-limit"||typeof window>"u")return;let fe=window.requestAnimationFrame(()=>{let ge=v==="endpoint"?I.current:Q.current,P=v==="endpoint"?H.current:ee.current;ge?.scrollIntoView?.({block:"nearest"}),P?.focus?.(),P?.select?.(),S("")});return()=>window.cancelAnimationFrame(fe)},[d,y,v]);function cn(fe="provider",ge=""){b(!1),x(!1),h(fe),S(ge),fe==="models"&&ge==="models"&&N(P=>P+1),p(!0)}function $e(){if(!ne){if(U.length>0){b(!1),x(!0);return}if(Te){b(!0);return}Ge()}}async function Ee(){if(gt)return;if(!await o(e.id,{providerDraft:Z?re:null,modelRows:oe?w.rows:null,onModelTestStateChange:ge=>{k({phase:String(ge?.phase||""),modelStates:ge?.modelStates&&typeof ge.modelStates=="object"?ge.modelStates:{},failedModelIds:Array.isArray(ge?.failedModelIds)?ge.failedModelIds:[],message:String(ge?.message||"")})}})){oe&&(b(!1),h("models"));return}Ge()}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Xn,{children:(0,l.jsxs)(Zn,{className:"space-y-3 p-5",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1 px-0.5 py-0.5",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[(0,l.jsx)("span",{className:"text-base font-semibold text-foreground",children:e.name||e.id}),(0,l.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",e.id,")"]})]})}),(0,l.jsxs)("div",{className:"flex items-start gap-2 self-start",children:[(0,l.jsxs)(ce,{type:"button",variant:"outline",size:"sm",className:"gap-1.5 normal-case tracking-normal",onClick:()=>cn("provider"),disabled:ae,"aria-label":`Edit provider ${e.name||e.id}`,title:"Edit provider",children:[(0,l.jsx)(Md,{className:"h-4 w-4 shrink-0"}),"Edit"]}),(0,l.jsx)(ce,{type:"button",variant:"outline",size:"sm",className:"h-8 w-8 shrink-0 p-0 text-muted-foreground hover:border-destructive/35 hover:bg-destructive/5 hover:text-destructive",onClick:()=>t(e.id),disabled:s,"aria-label":"Remove provider",title:"Remove provider",children:(0,l.jsx)(rh,{className:"h-4 w-4"})})]})]}),te.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2 pt-1",children:te.map(fe=>(0,l.jsx)(cL,{onClick:()=>n?.(fe),title:`Copy model id ${fe}`,className:"max-w-full",children:(0,l.jsx)("span",{className:"truncate",children:fe})},`${e.id}-${fe}`))}):null]})}),(0,l.jsx)(Sa,{open:d,onClose:$e,title:`Edit \xB7 ${e.id}`,description:M.phase==="testing"?M.message||"Testing new models before save.":M.phase==="saving"?M.message||"Saving provider changes.":"Switch between provider settings and model list. Each tab saves independently.",closeDisabled:ne,closeOnBackdrop:!ne,closeOnEscape:!ne,contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)] pb-0",children:(0,l.jsxs)(Hu,{value:y,onValueChange:h,children:[(0,l.jsxs)(qu,{className:"w-full justify-start",children:[(0,l.jsx)(Or,{value:"provider",children:"Provider"}),(0,l.jsx)(Or,{value:"models",children:"Model list"})]}),(0,l.jsxs)(_r,{forceMount:!0,value:"provider",className:Y("space-y-4 pb-4",y!=="provider"?"hidden":null),children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/60 p-4",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Update provider identity and connection settings here."})]}),(0,l.jsx)(Nt,{variant:"outline",children:z?"Subscription":"API Key"})]})}),(0,l.jsxs)("div",{className:Y("grid gap-3",z?"md:grid-cols-2":"md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"),children:[(0,l.jsx)(st,{label:"Provider name",stacked:!0,children:(0,l.jsx)(Kt,{value:u.name,onChange:fe=>f(ge=>({...ge,name:fe.target.value})),disabled:ne})}),(0,l.jsx)(st,{label:"Provider id",hint:"Used in direct routes like provider/model",stacked:!0,children:(0,l.jsx)(Kt,{value:u.id,onChange:fe=>f(ge=>({...ge,id:Vr(fe.target.value)})),disabled:ne})})]}),z?null:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(st,{label:"API key or env",hint:"Use an env var like OPENAI_API_KEY or paste the direct key.",stacked:!0,children:(0,l.jsx)(uh,{value:u.credentialInput||"",onChange:fe=>f(ge=>({...ge,credentialInput:fe.target.value})),disabled:ne,placeholder:"Example: OPENAI_API_KEY or sk-...",isEnvVar:ml(u.credentialInput)})}),(0,l.jsx)("div",{ref:I,children:(0,l.jsx)(st,{label:"Endpoints",hint:W.length>1?"Comma, space, or newline turns into chips. The first endpoint stays active until you re-test this provider.":"Comma, space, or newline turns into chips.",stacked:!0,children:(0,l.jsx)(ah,{values:u.endpoints,onChange:fe=>f(ge=>({...ge,endpoints:fe})),draftValue:u.endpointDraft,onDraftValueChange:fe=>f(ge=>({...ge,endpointDraft:fe})),commitOnBlur:!0,disabled:ne,isValueValid:Ks,inputRef:H,inputClassName:"placeholder:text-muted-foreground/55",placeholder:"Click here to type new endpoint",helperText:"Paste one or more endpoints"})})}),(0,l.jsx)("div",{ref:Q,className:"grid gap-3 md:grid-cols-2 xl:grid-cols-[minmax(0,1.35fr)_minmax(0,0.8fr)_minmax(0,0.8fr)_minmax(0,1fr)]",children:(0,l.jsx)("div",{className:"md:col-span-2 xl:col-span-4",children:(0,l.jsx)(st,{label:"Rate limit",stacked:!0,headerAction:(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:()=>f(fe=>({...fe,rateLimitRows:OC(fe.rateLimitRows)})),disabled:ne,children:"Add rate limit"}),children:(0,l.jsx)(_C,{rows:u.rateLimitRows,onChange:fe=>f(ge=>({...ge,rateLimitRows:fe})),availableModelIds:te,disabled:ne,inputRef:ee})})})})]}),me?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:me}):null,(0,l.jsxs)("div",{className:"flex min-h-9 items-center justify-end gap-2",children:[!ne&&Z?(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:ot,children:"Reset"}):null,Z&&!me?(0,l.jsx)(ce,{type:"button",onClick:()=>{Pt()},disabled:ne,children:M.phase==="saving"||s?"Saving\u2026":"Save provider"}):null]})]}),(0,l.jsx)(_r,{forceMount:!0,value:"models",className:Y(y!=="models"?"hidden":null),children:(0,l.jsx)(Z2,{provider:e,disabled:!!i,disabledReason:i,busy:s,framed:!1,focusRequest:C,onStateChange:mo,onApply:sn,testStateByModel:M.modelStates,savePhase:M.phase,saveMessage:M.message})})]})}),(0,l.jsx)(U2,{open:m,onKeepEditing:()=>b(!1),onDiscardAndClose:Ge,onSaveAndClose:Ee,saveDisabled:gt,dirtyLabels:Re,details:Ze}),(0,l.jsx)(j2,{open:g,failedModelIds:U,onKeepEditing:()=>x(!1),onRemoveFailedAndClose:qr,removeDisabled:ne||typeof o!="function"})]})}function dL({providers:e,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i="",busy:s=!1}){return e.length?(0,l.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:e.map(c=>(0,l.jsx)(uL,{provider:c,onRemove:t,onCopyModelId:n,onApplyProviderDetails:r,onApplyProviderModels:a,onSaveAndCloseEditor:o,disabledReason:i,busy:s},c.id))}):(0,l.jsx)(Xn,{children:(0,l.jsx)(Zn,{className:"flex flex-col gap-4 p-5 text-sm text-muted-foreground",children:(0,l.jsx)("div",{children:"No enabled providers are configured yet. Use Add provider to create your first provider, model list, and rate limits."})})})}function fL({providers:e,onAddProvider:t,onRemove:n,onCopyModelId:r,onApplyProviderDetails:a,onApplyProviderModels:o,onSaveAndCloseEditor:i,disabledReason:s="",busy:c=!1}){return(0,l.jsxs)("section",{className:"rounded-2xl border border-border/70 bg-card p-4","aria-label":"Provider models",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider & Models"}),(0,l.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Manage providers, direct model routes, endpoints, and rate limits in one place."})]}),(0,l.jsx)(ce,{onClick:t,children:"Add provider"})]}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(dL,{providers:e,onRemove:n,onCopyModelId:r,onApplyProviderDetails:a,onApplyProviderModels:o,onSaveAndCloseEditor:i,disabledReason:s,busy:c})})]})}function mL({rows:e,routeOptions:t,webSearchSnapshot:n,ampClientUrl:r,ampClientGlobal:a,routingBusy:o,onToggleGlobalRouting:i,onInboundChange:s,onOutboundChange:c,onCreateEntry:u,onRemoveEntry:f,onOpenWebSearchTab:d,onOpenConfigPath:p,onOpenSecretsPath:m,hasMasterKey:b,disabledReason:g,autosaveState:x}){let[y,h]=(0,E.useState)(!1),[v,S]=(0,E.useState)(""),[C,N]=(0,E.useState)(String(t[0]?.value||"").trim()),w=e.some(q=>String(q?.inbound||"").trim()===String(v||"").trim()&&String(v||"").trim()),R=String(v||"").trim()&&String(C||"").trim()&&!w,M=a?.routedViaRouter===!0,k=String(a?.error||"").trim(),I=!!(b&&r&&!g&&!k),H=Number(n?.configuredProviderCount)||0,Q=M&&H===0,ee=g?"warning":x.status==="error"?"danger":x.status==="pending"?"outline":x.status==="saving"?"info":x.savedAt?"success":"outline",X=g?"Needs review":x.status==="error"?"Save failed":x.status==="pending"?"Unsaved":x.status==="saving"?"saving...":x.savedAt?"Saved":"Ready",z=g||(x.status==="error"?x.message:x.status==="pending"?"Unsaved changes queued. Auto-save will run shortly.":x.status==="saving"?"Saving changes...":x.savedAt?`Last saved ${bh(x.savedAt)}.`:"AMP route changes auto-save after valid edits.");async function te(){!R||await u?.({inbound:v,outbound:C})===!1||(h(!1),S(""),N(String(t[0]?.value||"").trim()))}function W(){h(!0),S(""),N(String(t[0]?.value||"").trim())}return(0,l.jsx)("div",{className:"grid gap-4",children:(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-3 p-4 pb-0 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(el,{className:"flex items-center gap-2",children:(0,l.jsx)("span",{children:"Use AMP via LLM Router"})}),(0,l.jsx)(TC,{primaryLabel:"Config file",primaryValue:a?.settingsFilePath||"",onOpenPrimary:p,secondaryLabel:"Secrets file",secondaryValue:a?.secretsFilePath||"",secondaryIcon:(0,l.jsx)(F2,{className:"h-3 w-3"}),onOpenSecondary:m})]}),(0,l.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:(0,l.jsx)(ce,{type:"button",size:"sm",variant:M?"outline":void 0,onClick:i,disabled:o!==""||!M&&!I,children:o==="enable"?"Connecting\u2026":o==="disable"?"Disconnecting\u2026":M?"Disconnect":"Connect"})})]}),(0,l.jsxs)(Zn,{className:"space-y-4 p-4",children:[k?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:k}):null,!M&&!b?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:["Set ",(0,l.jsx)("code",{children:"masterKey"})," first to connect AMP."]}):null,Q?(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:[(0,l.jsx)("div",{className:"max-w-3xl",children:"AMP is connected, but no alternative web search provider is configured. AMP web search is only available through the shared Web Search tab."}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:d,children:"Open Web Search"})]}):null,g?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:g}):(0,l.jsxs)("div",{className:"space-y-3 rounded-2xl border border-border/70 bg-background/60 p-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Route mapping editor"}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:"Map built-in AMP route keys and wildcard model matches to managed routes."})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Nt,{variant:ee,children:X}),(0,l.jsxs)(Nt,{variant:"outline",children:[e.length," routes"]}),(0,l.jsx)(ce,{type:"button",size:"sm",onClick:W,children:"Add custom mapping"})]})]}),(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:z}),y?(0,l.jsx)("div",{className:"rounded-2xl border border-dashed border-border bg-background/80 p-3",children:(0,l.jsxs)("div",{className:"grid gap-3 xl:grid-cols-[160px_minmax(0,1fr)_minmax(0,1fr)] xl:items-start",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Add custom mapping"}),(0,l.jsx)(Nt,{variant:"info",children:"Custom"})]}),(0,l.jsxs)("div",{className:"text-xs leading-5 text-muted-foreground",children:["Match a built-in AMP route key like ",(0,l.jsx)("code",{children:"smart"})," or a wildcard such as ",(0,l.jsx)("code",{children:"gpt-*-codex*"}),", then send it to any managed route."]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)(ce,{type:"button",size:"sm",onClick:te,disabled:!R,children:"Create mapping"}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(!1),children:"Close"})]})]}),(0,l.jsx)(st,{label:"Inbound match",hint:"Built-in route key or AMP model pattern",children:(0,l.jsx)(Kt,{value:v,onChange:q=>S(q.target.value),placeholder:"smart or gpt-*-codex*"})}),(0,l.jsx)(st,{label:"Route target",hint:"Alias or provider/model route in LLM Router",children:(0,l.jsxs)(vr,{value:C||void 0,onValueChange:N,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Select local route"})}),(0,l.jsx)(Sr,{children:Bd(t,{keyPrefix:"amp-route-create",includeHint:!0})})]})})]})}):null,(0,l.jsx)("div",{className:"space-y-2",children:e.map(q=>(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-3",children:(0,l.jsxs)("div",{className:"grid gap-3 xl:grid-cols-[160px_minmax(0,1fr)_minmax(0,1fr)] xl:items-start",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:q.label}),q.isCustom?(0,l.jsx)(Nt,{variant:"info",children:"Custom"}):null]}),(0,l.jsx)("div",{className:"text-xs leading-5 text-muted-foreground",children:q.description}),q.removable?(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>f(q.id),children:"Remove"}):null]}),(0,l.jsx)(st,{label:"Inbound wildcard",hint:q.defaultMatch?`Default: ${q.defaultMatch}`:"AMP model pattern",children:(0,l.jsx)(jg,{commitOnBlur:!0,value:q.inbound,onValueCommit:V=>s(q.id,V),placeholder:q.defaultMatch||"gpt-*-codex*",onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),V.currentTarget.blur())}})}),(0,l.jsx)(st,{label:"Target route",hint:"Alias or provider/model route",children:(0,l.jsxs)(vr,{value:q.outbound||"__default__",onValueChange:V=>c(q.id,V),children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:q.removable?"Choose target route":"Use default route"})}),(0,l.jsxs)(Sr,{children:[q.removable?null:(0,l.jsx)(ar,{value:"__default__",children:"Use default route"}),Bd(t,{keyPrefix:`amp-route-${q.id}`,includeHint:!0})]})]})})]})},q.id))})]})]})]})})}function pL({open:e=!1,onClose:t=()=>{},candidates:n=[],onTestAndAdd:r=async()=>{},disabledReason:a=""}){let[o,i]=(0,E.useState)(""),[s,c]=(0,E.useState)(""),[u,f]=(0,E.useState)(!1),[d,p]=(0,E.useState)(""),m=Array.isArray(n)?n:[],b=m.find(v=>v.providerId===o)||m[0]||null,g=Array.isArray(b?.models)?b.models:[];(0,E.useEffect)(()=>{if(!e){f(!1),p("");return}let v=m[0]?.providerId||"";i(S=>m.some(N=>N.providerId===S)?S:v)},[e,m]),(0,E.useEffect)(()=>{let v=g[0]?.value||"";c(S=>g.some(N=>N.value===S)?S:v)},[g]);let x=vl(o,s),y=e&&!u&&!a&&o&&s;async function h(){if(y){f(!0),p("");try{await r({providerId:o,modelId:s}),t()}catch(v){p(v instanceof Error?v.message:String(v))}finally{f(!1)}}}return(0,l.jsx)(Sa,{open:e,onClose:()=>{u||t()},title:"Add ChatGPT Search Endpoint",description:"Choose a configured OpenAI-compatible GPT route. Test runs a live Responses API request with the native web search tool, then saves the route on success.",contentClassName:"max-h-[92vh] max-w-3xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",showCloseButton:!1,footer:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:t,disabled:u,children:"Cancel"}),(0,l.jsx)(ce,{type:"button",onClick:()=>{h()},disabled:!y,children:u?"Testing\u2026":"Test connection"})]}),children:(0,l.jsxs)("div",{className:"space-y-4",children:[a?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:a}):null,!a&&m.length===0?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:"No configured OpenAI-compatible GPT providers are available yet. Add a provider with a GPT model first."}):null,m.length>0?(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,l.jsx)(st,{label:"Provider",hint:"Configured provider or ChatGPT subscription",stacked:!0,children:(0,l.jsxs)(vr,{value:o||void 0,onValueChange:i,disabled:u||!!a,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose provider"})}),(0,l.jsx)(Sr,{children:m.map(v=>(0,l.jsx)(ar,{value:v.providerId,children:v.providerLabel},v.providerId))})]})}),(0,l.jsx)(st,{label:"GPT model",hint:"Only GPT models on OpenAI-compatible routes are listed",stacked:!0,children:(0,l.jsxs)(vr,{value:s||void 0,onValueChange:c,disabled:u||!!a||g.length===0,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose model"})}),(0,l.jsx)(Sr,{children:g.map(v=>(0,l.jsx)(ar,{value:v.value,children:v.label},v.routeId))})]})})]}):null,x?(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Saved route id"}),(0,l.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:x}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This route stores only the provider/model reference. No separate API key or quota is saved here."})]}):null,d?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:d}):null]})})}function gL({webSearchConfig:e,webSearchProviders:t,hostedSearchCandidates:n,onWebSearchStrategyChange:r,onWebSearchProviderChange:a,onWebSearchProviderMove:o,onRemoveWebSearchProvider:i,onAddHostedSearchEndpoint:s,disabledReason:c,autosaveState:u}){let[f,d]=(0,E.useState)(!1),p=String(e?.strategy||"ordered").trim()==="quota-balance"?"quota-balance":"ordered",m=Array.isArray(n)&&n.some(g=>Array.isArray(g?.models)&&g.models.length>0),b=c||(u.status==="error"?u.message:u.status==="pending"?"Unsaved changes queued. Auto-save will run shortly.":u.status==="saving"?"Saving changes...":u.savedAt?`Last saved ${bh(u.savedAt)}.`:"");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-4 p-4 pb-0 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)(el,{children:"Web Search"}),(0,l.jsx)(ws,{className:"text-xs leading-5",children:"Shared web search routing for AMP and other router-managed tools."}),b?(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:b}):null]}),(0,l.jsxs)("div",{className:"flex w-full shrink-0 flex-wrap items-end justify-end gap-3 xl:w-auto",children:[(0,l.jsxs)("div",{className:"min-w-[12rem] space-y-1",children:[(0,l.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Routing strategy"}),(0,l.jsxs)(vr,{value:p,onValueChange:r,disabled:!!c,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Choose strategy"})}),(0,l.jsx)(Sr,{children:Nk.map(g=>(0,l.jsx)(ar,{value:g.value,children:g.label},g.value))})]})]}),(0,l.jsxs)(ce,{type:"button",variant:"outline",className:"gap-2",onClick:()=>d(!0),disabled:!!c||!m,children:[(0,l.jsx)(gC,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Endpoint"})]})]})]}),(0,l.jsx)(Zn,{className:"space-y-4 p-4",children:(0,l.jsx)("div",{className:"space-y-3",children:(t||[]).map(g=>{if(g.kind==="hosted"){let h=g.runtimeState&&g.runtimeState.ready===!1?"This provider/model route is no longer available or is not OpenAI-compatible.":"";return(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)($1,{active:g.active}),(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label}),(0,l.jsx)(Nt,{variant:"outline",children:"GPT Search"})]}),(0,l.jsx)("div",{className:"mt-1 text-xs break-all text-muted-foreground",children:g.routeId}),(0,l.jsx)("div",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:"Uses the provider's native OpenAI Responses web search tool. No local API key or quota is stored here."})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 self-start",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border/70 bg-background/70 p-1",children:[(0,l.jsx)(Fs,{disabled:!!c||g.displayIndex<=0,label:`Move ${g.routeId} up`,onClick:()=>o(g.id,"up")}),(0,l.jsx)(Ld,{disabled:!!c||g.displayIndex>=g.displayCount-1,label:`Move ${g.routeId} down`,onClick:()=>o(g.id,"down")})]}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>i(g.id),disabled:!!c,children:"Remove"})]})]}),h?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:h}):null]})},g.key)}let x=g.credentialField,y=String(g?.credentialValue||"").trim();return(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-background/80 p-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-start xl:justify-between",children:[(0,l.jsx)("div",{className:"min-w-0",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)($1,{active:g.active}),(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label})]})}),(0,l.jsxs)("div",{className:"flex items-center gap-2 self-start rounded-xl border border-border/70 bg-background/70 p-1",children:[(0,l.jsx)(Fs,{disabled:!!c||g.displayIndex<=0,label:`Move ${g.label} up`,onClick:()=>o(g.id,"up")}),(0,l.jsx)(Ld,{disabled:!!c||g.displayIndex>=g.displayCount-1,label:`Move ${g.label} down`,onClick:()=>o(g.id,"down")})]})]}),(0,l.jsxs)("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.35fr)]",children:[(0,l.jsx)(st,{label:g.credentialLabel,hint:g.credentialField==="url"?"Required to enable this backend.":"Required to enable this backend. Stored in router config.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(uh,{buffered:!0,value:y,placeholder:g.credentialPlaceholder,onValueChange:h=>a(g.id,x,h),disabled:!!c,isEnvVar:g.credentialField==="url"})}),(0,l.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,l.jsx)(st,{label:"Result per call",hint:"Empty keeps the default of 5.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:g.resultPerCallInput,placeholder:"Default: 5",allowEmptyCommit:!0,onValueChange:h=>a(g.id,"count",h),disabled:!!c})}),(0,l.jsx)(st,{label:"Monthly limit",hint:"0 keeps quotas self-managed.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:String(g.limit||0),onValueChange:h=>a(g.id,"limit",h),disabled:!!c})}),(0,l.jsx)(st,{label:"Synced remaining",hint:"Adjust after manual upstream sync.",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(Yg,{value:String(g.remaining||0),onValueChange:h=>a(g.id,"remaining",h),disabled:!!c})})]})]})]})},g.key)})})})]}),(0,l.jsx)(pL,{open:f,onClose:()=>d(!1),candidates:n,onTestAndAdd:s,disabledReason:c})]})}function sC({toolName:e,toolState:t,endpointUrl:n,routeOptions:r,connectionBusy:a,bindingBusy:o,onToggleRouting:i,onBindingChange:s,hasMasterKey:c,disabledReason:u,onOpenPrimaryPath:f,onOpenSecondaryPath:d,secondaryPathLabel:p="Backup file",secondaryPathIcon:m=(0,l.jsx)(NC,{className:"h-3 w-3"}),bindingFields:b=[],guideContent:g=null}){let x=t?.routedViaRouter===!0,y=String(t?.error||"").trim(),h=!!(c&&n&&!u&&!y),v=(0,E.useMemo)(()=>{let C=new Set(["__unset__"]);for(let N of b){for(let w of Array.isArray(N?.extraOptions)?N.extraOptions:[]){let R=String(w?.value||"").trim();R&&C.add(R)}for(let w of Array.isArray(N?.options)?N.options:[]){let R=String(w?.value||"").trim();R&&C.add(R)}}return b.filter(N=>N?.usesRouteOptions!==!1).map(N=>String(N?.value||"").trim()).filter(N=>N&&!C.has(N))},[b]),S=Gs(r,v);return(0,l.jsxs)(Xn,{children:[(0,l.jsxs)(jo,{className:"flex flex-col gap-3 p-4 pb-0 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(el,{className:"flex items-center gap-2",children:(0,l.jsx)("span",{children:`Use ${e} via LLM Router`})}),(0,l.jsx)(TC,{primaryLabel:"Config file",primaryValue:t?.configFilePath||t?.settingsFilePath||"",onOpenPrimary:f,secondaryLabel:p,secondaryValue:t?.backupFilePath||"",secondaryIcon:m,onOpenSecondary:d})]}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[g?(0,l.jsx)(yL,{guideContent:g}):null,(0,l.jsx)(ce,{type:"button",size:"sm",variant:x?"outline":void 0,onClick:i,disabled:a!==""||!x&&!h,children:a==="enable"?"Connecting\u2026":a==="disable"?"Disconnecting\u2026":x?"Disconnect":"Connect"})]})]}),(0,l.jsxs)(Zn,{className:"space-y-4 p-4",children:[y?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",children:y}):null,!x&&!c?(0,l.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:["Set ",(0,l.jsx)("code",{children:"masterKey"})," first to connect ",e,"."]}):null,u?(0,l.jsx)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:u}):null,(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/60 p-4",children:[(0,l.jsx)("div",{children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Model bindings"}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:"Prefer LLM Router aliases here so you can retarget models later from the Alias & Fallback tab."})]})}),b.length===0?(0,l.jsx)("div",{className:"mt-4 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:"No tool bindings are available yet."}):(0,l.jsx)("div",{className:"mt-4 grid gap-3",children:b.map(C=>(0,l.jsxs)("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3",children:[(0,l.jsxs)("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:C.label}),(0,l.jsx)(Nt,{variant:"outline",children:C.envKey})]}),(0,l.jsx)("div",{className:"mb-3 text-xs leading-5 text-muted-foreground",children:C.description}),(0,l.jsx)(vL,{field:C,routeOptions:S,disabled:C.standaloneWhenDisconnected?o:!x||o,onValueChange:N=>s(C.id,N==="__unset__"?"":N)})]},C.id))})]})]})]})}function hL(e="outline"){switch(e){case"success":return"border-emerald-200 bg-emerald-50";case"warning":return"border-amber-200 bg-amber-50";case"danger":return"border-rose-200 bg-rose-50";case"info":return"border-sky-200 bg-sky-50";default:return"border-border/70 bg-background/70"}}function cC(e="outline"){switch(e){case"success":return"text-emerald-950";case"warning":return"text-amber-950";case"danger":return"text-rose-950";case"info":return"text-sky-950";default:return"text-foreground"}}function yL({guideContent:e}){let[t,n]=(0,E.useState)(!1),r=String(e?.title||"").trim()||"Guide",a=String(e?.description||"").trim(),o=Array.isArray(e?.badges)?e.badges.filter(Boolean):[],i=Array.isArray(e?.highlights)?e.highlights.filter(Boolean):[],s=Array.isArray(e?.sections)?e.sections.filter(Boolean):[],c=e?.callout&&e.callout.body?e.callout:null,u=c?.variant||"outline";return i.length===0&&s.length===0&&!c?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline","aria-label":r,onClick:()=>n(!0),children:"Guide"}),(0,l.jsx)(Sa,{open:t,onClose:()=>n(!1),title:r,description:a,contentClassName:"max-h-[92vh] max-w-4xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsxs)("div",{className:"space-y-4",children:[o.length>0?(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:o.map((f,d)=>(0,l.jsx)(Nt,{variant:f?.variant||"outline",children:f?.label},`${r}-badge-${d}`))}):null,c?(0,l.jsxs)("div",{className:Y("rounded-2xl border p-4",hL(u)),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(Nt,{variant:["success","warning","danger","info"].includes(u)?u:"outline",children:u==="success"?"Current best fit":u==="warning"?"Needs attention":u==="info"?"Current behavior":"Guide note"}),(0,l.jsx)("div",{className:Y("text-sm font-medium",cC(u)),children:c.title})]}),(0,l.jsx)("div",{className:Y("mt-3 text-sm leading-6",cC(u)),children:c.body})]}):null,i.length>0?(0,l.jsx)("div",{className:Y("grid gap-4",i.length>2?"md:grid-cols-3":"md:grid-cols-2"),children:i.map((f,d)=>(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[f?.eyebrow?(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:f.eyebrow}):null,(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:f?.title}),(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f?.body})]},`${r}-highlight-${d}`))}):null,s.map((f,d)=>{let p=Array.isArray(f?.items)?f.items.filter(Boolean):[];return(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:f?.title}),f?.description?(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f.description}):null,p.length>0?(0,l.jsx)("div",{className:"mt-3 space-y-3",children:p.map((m,b)=>(0,l.jsxs)("div",{className:"flex gap-3 text-sm leading-6 text-foreground",children:[(0,l.jsx)("span",{className:"mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground/50"}),(0,l.jsx)("div",{className:"min-w-0",children:m})]},`${r}-section-${d}-item-${b}`))}):null]},`${r}-section-${d}`)})]})})]})}function vL({field:e,routeOptions:t,disabled:n=!1,onValueChange:r}){let a=String(e?.value||"").trim()||(e?.allowUnset?"__unset__":""),o=(0,E.useMemo)(()=>{let i=e?.usesRouteOptions===!1?[]:t,s=Array.isArray(e?.options)?e.options:[],c=Array.isArray(e?.extraOptions)?e.extraOptions:[];return e?.allowUnset?[{value:"__unset__",label:"Inherit tool default",hint:""},...c,...s,...i]:[...c,...s,...i]},[e?.allowUnset,e?.extraOptions,e?.options,e?.usesRouteOptions,t]);return(0,l.jsxs)(vr,{value:a,onValueChange:r,disabled:n||o.length===0,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:e.placeholder||"Select a route"})}),(0,l.jsx)(Sr,{children:o.length>0?Bd(o,{keyPrefix:e.id||"binding-option"}):(0,l.jsx)(ar,{value:"__no-route-options",disabled:!0,children:"No routes available"})})]})}function bL({logs:e,activityLogEnabled:t=!0,activityFilter:n="usage",busyAction:r="",onActivityFilterChange:a,onToggleEnabled:o,onClear:i}){let s=Array.isArray(e)?e:[],c=s.filter(f=>n==="all"?!0:H1(f)===n),u=Cd[n]||Cd.usage;return(0,l.jsxs)(Xn,{children:[(0,l.jsx)(jo,{children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)(el,{children:"Activity"}),(0,l.jsx)(ws,{children:t?"Router actions, request fallbacks, and runtime issues stream here.":"Activity logging is paused. Re-enable it to capture router actions, request fallbacks, and runtime issues."})]}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("div",{className:"min-w-[13rem]",children:(0,l.jsxs)(vr,{value:n,onValueChange:a,searchEnabled:!1,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Filter category"})}),(0,l.jsx)(Sr,{children:vk.map(f=>(0,l.jsx)(ar,{value:f.value,children:f.label},f.value))})]})}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:r!==""||!e?.length,children:r==="clear"?"Clearing\u2026":"Clear log"}),(0,l.jsx)(ce,{type:"button",size:"sm",variant:t?"outline":"default",onClick:o,disabled:r!=="",children:r==="toggle"?"Updating\u2026":t?"Disable log":"Enable log"})]})]})}),(0,l.jsx)(Zn,{children:(0,l.jsx)("div",{className:"max-h-[32rem] space-y-3 overflow-auto pr-1",children:c.length?c.map(f=>{let d=H1(f),p=Cd[d]||Cd.usage;return(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:Y("inline-flex h-2.5 w-2.5 rounded-full ring-4",U1[f.level]||U1.info)}),(0,l.jsx)(Nt,{variant:p.badgeVariant,children:p.label}),(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:f.message})]}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:bh(f.time)})]}),f.detail?(0,l.jsx)("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:f.detail}):null]},f.id)}):s.length?(0,l.jsxs)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:["No ",u.emptyLabel," activity matches the current filter. Switch the dropdown to inspect the hidden categories."]}):(0,l.jsx)("div",{className:"rounded-2xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground",children:"Activity is quiet. Save config changes or start the router to populate this stream."})})})]})}function ah({values:e,onChange:t,placeholder:n,helperText:r,inputRef:a=null,inputClassName:o="",suggestedValues:i=[],valueStates:s={},draftValue:c="",onDraftValueChange:u=()=>{},commitOnBlur:f=!1,disabled:d=!1,isValueValid:p=m=>!!String(m||"").trim()}){let m=(0,E.useMemo)(()=>ba(e),[e]),[b,g]=(0,E.useState)(""),[x,y]=(0,E.useState)("");function h(w=c,{clearDraft:R=!0}={}){if(d)return!1;let M=Xg(w).filter(I=>p(I));if(M.length===0)return R&&u(""),!1;let k=Array.from(new Set([...m||[],...M]));return JSON.stringify(k)!==JSON.stringify(m||[])&&t(k),R&&u(""),!0}function v(w){d||(t(m.filter(R=>R!==w)),b===w&&(g(""),y("")))}function S(){d||i.length&&(t(Array.from(new Set([...m||[],...i]))),u(""))}function C(w){d||(g(w),y(w))}function N(w=x){if(d)return g(""),y(""),!1;if(!b)return!1;let R=Xg(w).filter(H=>p(H)),M=[],k=!1;for(let H of m||[]){if(H!==b){M.push(H);continue}k||(M.push(...R),k=!0)}let I=Array.from(new Set(M.map(H=>String(H||"").trim()).filter(Boolean)));return JSON.stringify(I)!==JSON.stringify(m||[])&&t(I),g(""),y(""),R.length>0}return(0,E.useEffect)(()=>{!d||!b||(g(""),y(""))},[d,b]),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:Y("flex min-h-11 flex-wrap items-center gap-2 rounded-xl border border-input bg-background/80 px-3 py-2",d?"opacity-80":null),children:[m.map(w=>{let R=s?.[w]||"default",M=R==="success"?"border-emerald-200 bg-emerald-50 text-emerald-900":R==="error"?"border-rose-200 bg-rose-50 text-rose-900":R==="pending"?"border-sky-200 bg-sky-50 text-sky-900":"border-border bg-secondary text-foreground",k=!d&&b===w;return(0,l.jsxs)("span",{className:Y("inline-flex max-w-full items-center gap-1 rounded-full border px-2.5 py-1 text-xs",M),children:[k?(0,l.jsx)("input",{autoFocus:!0,className:"min-w-[7rem] bg-transparent text-xs text-foreground outline-none",value:x,onChange:I=>y(I.target.value),onKeyDown:I=>{if(I.key==="Enter"||I.key==="Tab"){I.preventDefault(),N();return}I.key==="Escape"&&(I.preventDefault(),g(""),y(""))},onBlur:()=>{N()}}):(0,l.jsx)("button",{className:"max-w-[16rem] truncate text-left transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70",type:"button",onMouseDown:I=>I.preventDefault(),onClick:()=>C(w),disabled:d,title:"Click to edit",children:w}),(0,l.jsx)("button",{className:"text-muted-foreground transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",type:"button",onMouseDown:I=>I.preventDefault(),onClick:()=>v(w),disabled:d,children:"\xD7"})]},w)}),(0,l.jsx)("input",{ref:a,className:Y("min-w-[10rem] flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-70",o),value:c,disabled:d,onChange:w=>{let R=w.target.value;if(/[\s,]/.test(R)){let M=R.split(/[\s,]+/),k=M.pop()||"";M.length>0&&h(M.join(","),{clearDraft:!1}),u(k);return}u(R)},onKeyDown:w=>{if((w.key===","||w.key===" "||w.key==="Enter"||w.key==="Tab")&&c.trim()){w.preventDefault(),h();return}w.key==="Backspace"&&!c&&m.length>0&&(w.preventDefault(),v(m[m.length-1]))},onPaste:w=>{let R=w.clipboardData?.getData("text")||"";if(/[\s,]/.test(R)){w.preventDefault();let M=R.split(/[\s,]+/).filter(Boolean).filter(k=>p(k));M.length>0&&(t(Array.from(new Set([...m||[],...M]))),u(""));return}w.preventDefault(),u(`${c}${R}`)},onBlur:()=>{if(f&&p(c)){h(c);return}u(c)},placeholder:n}),m.length>0||c?(0,l.jsx)("button",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground transition hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",type:"button",onMouseDown:w=>w.preventDefault(),onClick:()=>{t([]),u("")},disabled:d,children:"Clear all"}):null]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r?(0,l.jsx)("span",{children:r}):null,m.length===0&&i.length>0?(0,l.jsx)("button",{className:"font-medium uppercase tracking-[0.16em] text-foreground transition hover:text-primary disabled:cursor-not-allowed disabled:opacity-60",type:"button",onClick:S,disabled:d,children:"Use suggested values"}):null]})]})}function MC(e="rate-limit-draft-row"){return yC({key:e,models:[],requests:"",windowValue:"",windowUnit:pl.api.windowUnit},{keyPrefix:"rate-limit-draft",defaults:pl.api,useDefaults:!1})}function OC(e=[],{keyPrefix:t="rate-limit-draft"}={}){let n=`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return[...Array.isArray(e)?e:[],MC(n)]}function xL({value:e=[],onChange:t,availableModelIds:n=[],disabled:r=!1}){let a=(0,E.useRef)(null),[o,i]=(0,E.useState)(!1),s=(0,E.useMemo)(()=>Ir(e),[e]),c=s.includes("all"),u=c?[]:s.filter(Boolean),f=c||u.length===0,d=(0,E.useMemo)(()=>ba(n),[n]);(0,E.useEffect)(()=>{if(!o||typeof document>"u")return;function y(h){a.current?.contains(h.target)||i(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]);function p(y){t(Ir(y))}function m(y){p(y?["all"]:[])}function b(y,h){let v=h?[...u,y]:u.filter(S=>S!==y);p(v)}function g(y){if(y==="all"){p([]);return}p(u.filter(h=>h!==y))}let x=c?[{key:"all",label:"All model",removable:!0}]:u.length>0?u.map(y=>({key:y,label:y,removable:!0})):[{key:"__implicit-all__",label:"All model",removable:!1,muted:!0}];return(0,l.jsxs)("div",{ref:a,className:"relative space-y-1.5",children:[(0,l.jsxs)("div",{role:"button",tabIndex:r?-1:0,className:Y("flex min-h-9 w-full items-center justify-between gap-2 rounded-lg border border-input bg-background/80 px-3 py-1.5 text-left text-sm text-foreground shadow-sm outline-none transition focus:border-ring focus:ring-2 focus:ring-ring/40",r?"cursor-not-allowed opacity-50":"cursor-pointer",o?"border-ring ring-2 ring-ring/40":null),onClick:()=>{r||i(y=>!y)},"aria-expanded":o,"aria-haspopup":"menu",onKeyDown:y=>{if(!r){if(y.key==="Enter"||y.key===" "){y.preventDefault(),i(h=>!h);return}if(y.key==="ArrowDown"){y.preventDefault(),i(!0);return}y.key==="Escape"&&(y.preventDefault(),i(!1))}},children:[(0,l.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:x.map(y=>y.removable?(0,l.jsxs)("button",{type:"button",className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-background px-2 py-0.5 text-xs font-medium text-foreground transition hover:border-accent hover:bg-accent",onClick:h=>{h.preventDefault(),h.stopPropagation(),g(y.key)},disabled:r,title:`Remove ${y.label}`,children:[(0,l.jsx)("span",{className:"truncate",children:y.label}),(0,l.jsx)("span",{className:"text-muted-foreground",children:"x"})]},y.key):(0,l.jsx)("span",{className:Y("inline-flex max-w-full items-center rounded-full border px-2 py-0.5 text-xs font-medium",y.muted?"border-border/70 bg-secondary/45 text-muted-foreground":"border-border/70 bg-background text-foreground"),children:(0,l.jsx)("span",{className:"truncate",children:y.label})},y.key))}),(0,l.jsx)("span",{className:"text-muted-foreground",children:"\u25BE"})]}),o?(0,l.jsxs)(EC,{open:o,anchorRef:a,preferredSide:"top",desiredHeight:192,className:"p-2",onMouseDown:y=>y.stopPropagation(),onClick:y=>y.stopPropagation(),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),i(!1))},children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-sm text-foreground transition hover:bg-secondary/60",children:[(0,l.jsx)("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",checked:c,onChange:y=>m(y.target.checked)}),(0,l.jsx)("span",{children:"All model"})]}),(0,l.jsx)("div",{className:"my-1 border-t border-border/70"}),d.length>0?(0,l.jsx)("div",{children:d.map(y=>(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-sm text-foreground transition hover:bg-secondary/60",children:[(0,l.jsx)("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",checked:u.includes(y),onChange:h=>b(y,h.target.checked)}),(0,l.jsx)("span",{className:"truncate",children:y})]},y))}):(0,l.jsx)("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"No models available yet."})]}):null]})}function _C({rows:e,onChange:t,availableModelIds:n=[],disabled:r=!1,inputRef:a=null,helperText:o="",onValidBlur:i=null}){let s=Array.isArray(e)?e:[],c=(0,E.useRef)(null),u=(0,E.useRef)(s),f=(0,E.useMemo)(()=>ba(n),[n]),d=(0,E.useMemo)(()=>{let h=new Set,v=new Set;for(let S of xa(s)){let C=Bs(S);if(C){if(h.has(C)){v.add(C);continue}h.add(C)}}return v},[s]),p=(0,E.useMemo)(()=>s.map(h=>({...MC(h.key),...h,models:Ir(h?.models||[])})),[s]);(0,E.useEffect)(()=>{u.current=s},[s]);function m(h){let v=Array.isArray(h)?h:[];u.current=v,t(v)}function b(h,v){m(s.map(S=>S.key===h?{...S,...v}:S))}function g(h){m(s.filter(v=>v.key!==h))}function x(h){if(Jg(h))return"";let v=Ir(h?.models||[]);if(f.length>0&&v.some(C=>C!=="all"&&!f.includes(C)))return"Use exact provider model ids only.";if(K1(h?.requests,0)<=0)return"Requests must be a positive integer.";if(K1(h?.windowValue,0)<=0)return"Window size must be a positive integer.";if(!j1.includes(String(h?.windowUnit||"").trim()))return"Window unit is invalid.";let S=Bs({requests:h?.requests,windowValue:h?.windowValue,windowUnit:h?.windowUnit});return S&&d.has(S)?"Another row already uses this cap.":""}function y(h){if(!(!i||r)&&!h.currentTarget.contains(h.relatedTarget)){if(typeof window>"u"){let v=xa(u.current);ti(v,{knownModelIds:f,requireAtLeastOne:!0})||i(v);return}window.setTimeout(()=>{if(!c.current||c.current.contains(document.activeElement))return;let v=xa(u.current);ti(v,{knownModelIds:f,requireAtLeastOne:!0})||i(v)},0)}}return(0,l.jsxs)("div",{ref:c,className:"space-y-2.5",onBlurCapture:y,children:[(0,l.jsx)("div",{className:"space-y-2.5",children:p.map((h,v)=>{let S=Jg(h),C=x(h);return(0,l.jsxs)("div",{className:Y("rounded-2xl border border-border/70 bg-background/70 p-3",C?"border-amber-200 bg-amber-50/70":null,S?"border-dashed bg-background/80":null),children:[(0,l.jsxs)("div",{className:"grid gap-2.5 xl:grid-cols-[minmax(0,1.5fr)_minmax(0,0.72fr)_minmax(0,0.72fr)_minmax(0,0.86fr)_auto] xl:items-end",children:[(0,l.jsx)(st,{label:"Models",stacked:!0,className:"gap-1",headerClassName:"min-h-0",hintClassName:"leading-4",children:(0,l.jsx)(xL,{value:h.models,onChange:N=>b(h.key,{models:N}),availableModelIds:f,disabled:r})}),(0,l.jsx)(st,{label:"Request",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsx)(Kt,{ref:v===0?a:null,value:h.requests,onChange:N=>b(h.key,{requests:N.target.value}),disabled:r,inputMode:"numeric",placeholder:"60"})}),(0,l.jsx)(st,{label:"Window",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsx)(Kt,{value:h.windowValue,onChange:N=>b(h.key,{windowValue:N.target.value}),disabled:r,inputMode:"numeric",placeholder:"1"})}),(0,l.jsx)(st,{label:"Unit",stacked:!0,className:"gap-1",headerClassName:"min-h-0",children:(0,l.jsxs)(vr,{value:String(h.windowUnit||"minute"),onValueChange:N=>b(h.key,{windowUnit:N}),disabled:r,children:[(0,l.jsx)(br,{children:(0,l.jsx)(xr,{placeholder:"Window unit"})}),(0,l.jsx)(Sr,{children:j1.map(N=>(0,l.jsx)(ar,{value:N,children:N},`${h.key}-${N}`))})]})}),(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>g(h.key),disabled:r,className:"xl:self-end",children:"Remove"})]}),C?(0,l.jsx)("div",{className:"mt-2.5 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:C}):null]},h.key)})}),o?(0,l.jsx)("div",{className:"text-xs leading-5 text-muted-foreground",children:o}):null]})}function SL({rows:e,onChange:t}){let n=ph(e),r=n.length>0?n:[{name:"",value:""}];function a(s,c,u){c==="name"&&jk(r,u,s)||t(r.map((f,d)=>d===s?{...f,[c]:u}:f))}function o(){t([...r,{name:"",value:""}])}function i(s){let c=r.filter((u,f)=>f!==s);t(c.length>0?c:[{name:"",value:""}])}return(0,l.jsxs)("div",{className:"space-y-2",children:[r.map((s,c)=>(0,l.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,0.9fr)_minmax(0,1.3fr)_auto]",children:[(0,l.jsx)(Kt,{value:s.name,onChange:u=>a(c,"name",u.target.value),placeholder:c===0?"User-Agent":"Header name"}),(0,l.jsx)(Kt,{value:s.value,onChange:u=>a(c,"value",u.target.value),placeholder:c===0?ni:"Header value"}),(0,l.jsx)(ce,{type:"button",variant:"ghost",onClick:()=>i(c),children:"Remove"})]},`header-row-${c}`)),(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,l.jsx)("span",{children:"User-Agent is included by default. Add more only when a provider needs them."}),(0,l.jsx)(ce,{type:"button",variant:"outline",onClick:o,children:"Add custom header"})]})]})}function co(){return(0,l.jsx)("span",{className:"mr-2 inline-flex h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-r-transparent align-[-0.125em]"})}function wL({providerId:e,values:t,onChange:n}){let r=(t||[]).map(d=>String(d||"").trim()).filter(Boolean),a=sh(r),o=(0,E.useRef)(""),i=(0,E.useRef)(null);function s(d){n((t||[]).filter(p=>p!==d))}function c(d,p){if(!d||!p||d===p)return;let m=[...t||[]],b=m.indexOf(d),g=m.indexOf(p);if(b===-1||g===-1)return;let[x]=m.splice(b,1);m.splice(g,0,x),n(m)}function u(d){n(ih(t||[],d,p=>String(p||"").trim()))}function f(){o.current="",gl(i.current,!1),i.current=null}return(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("div",{className:"space-y-2 rounded-xl border border-input bg-background/80 px-3 py-3",children:r.length>0?r.map((d,p)=>(0,l.jsxs)("div",{ref:a(d),"data-reorder-row":"true",onDragOver:m=>{o.current&&o.current!==d&&(m.preventDefault(),m.dataTransfer.dropEffect="move")},onDrop:m=>{m.preventDefault();let b=m.dataTransfer.getData("text/plain")||o.current;f(),c(b,d)},className:Y("grid grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-2 rounded-xl border border-border/70 bg-card/90 p-3"),children:[(0,l.jsx)("span",{className:"flex h-8 w-8 cursor-grab items-center justify-center rounded-full text-muted-foreground",draggable:!0,onDragStart:m=>{let b=lh(m.currentTarget);m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d),b&&typeof m.dataTransfer?.setDragImage=="function"&&m.dataTransfer.setDragImage(b,20,20),f(),o.current=d,i.current=b,gl(b,!0)},onDragEnd:f,title:"Drag to reorder",children:(0,l.jsx)(ch,{className:"h-4 w-4"})}),(0,l.jsx)(Fs,{disabled:p===0,label:p===0?"Already first":`Move ${e}/${d} up`,onClick:()=>u(d)}),(0,l.jsxs)("span",{className:"truncate text-sm font-medium text-foreground",children:[e,"/",d]}),(0,l.jsx)("button",{className:"text-muted-foreground transition hover:text-foreground",type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>s(d),children:"\xD7"})]},d)):(0,l.jsxs)("span",{className:"block px-1 text-xs text-muted-foreground",children:["Leave it empty for now, or add models to back the fixed ",(0,l.jsx)("code",{children:"default"})," route. An empty default route returns 500 until you add a working model."]})}),(0,l.jsx)("div",{className:"text-xs text-muted-foreground",children:"Drag rows to change the preferred order, use the arrow to move a model earlier, or remove any models you do not want in this route."})]})}function uC({baseConfig:e,onApplyDraft:t,onValidateDraft:n,onSaveDraft:r,onSaveAndStart:a,seedMode:o="blank",mode:i="add",targetProviderId:s="",defaultProviderUserAgent:c=ni,framed:u=!0,showHeader:f=!0}){let[d,p]=(0,E.useState)(0),[m,b]=(0,E.useState)(""),[g,x]=(0,E.useState)(()=>O2(e,{seedMode:o,targetProviderId:s,defaultProviderUserAgent:c})),[y,h]=(0,E.useState)(null),[v,S]=(0,E.useState)(""),[C,N]=(0,E.useState)({}),[w,R]=(0,E.useState)(null),[M,k]=(0,E.useState)(""),[I,H]=(0,E.useState)(!1),[Q,ee]=(0,E.useState)(""),X=(0,E.useRef)(""),z=i==="edit",te=!z&&o==="blank"&&CC(e),W=[{title:"Provider",detail:"Choose API Key or OAuth first, then enter the provider details needed for that connection type."},{title:"Models",detail:"Add model ids, then configure one or more rate limits for all models or selected models. API Key providers are tested before continue."},{title:"Default",detail:"Order the models behind the fixed `default` route before you finish."}],q=Hr(g.modelIds,g.modelDraft),V=vh(g.aliasModelIds,q),_e=g.connectionType==="api"?Hr(g.endpoints,g.endpointDraft):[],F=(0,E.useMemo)(()=>({...g,endpoints:_e,modelIds:q,aliasModelIds:V,rateLimitRows:xa(g.rateLimitRows)}),[g,_e,q,V]),he=(0,E.useMemo)(()=>gh(g.headerRows||[]),[g.headerRows]),Z=String(g.apiKeyEnv||"").trim(),ae=(0,E.useMemo)(()=>Y1(F),[F]),Se=w?.signature===ae?w.result:null,U=Se?.models?.length>0?Se.models:wC(g.connectionType),ne=Vr(g.providerId||g.providerName||"my-provider")||"my-provider",ue=AC(g),me=JSON.stringify({connectionType:g.connectionType,subscriptionProfile:ue}),re=JSON.stringify({apiConnectionSignature:ae,modelIds:q}),oe=y?.signature===re?y.result:null,Te=g.connectionType!=="api"||!!oe?.ok,Re=(0,E.useMemo)(()=>_2(e,F,oe,{targetProviderId:s}),[e,F,oe,s]),Ze=(0,E.useMemo)(()=>`${JSON.stringify(Re,null,2)}
52
+ `,[Re]),gt=at,Pt=W[d],sn=k2(d,F,e,{targetProviderId:s});(0,E.useEffect)(()=>{if(X.current!==re&&(X.current=re,Object.keys(C).length>0&&N({})),g.connectionType!=="api"){y!==null&&h(null),v&&S(""),Object.keys(C).length>0&&N({}),w!==null&&R(null),M&&k("");return}y?.signature&&y.signature!==re&&(h(null),S(""),N({})),w?.signature&&w.signature!==ae&&(R(null),k(""))},[g.connectionType,re,y,v,C,w,M,ae]);function ot(A,D){x(B=>({...B,[A]:D}))}function mo(A){x(D=>{let B=Vr(D.providerName||""),G=Vr(A||"")||"my-provider",$=!D.providerId||D.providerId===B;return{...D,providerName:A,providerId:$?G:D.providerId}})}function Ge(A){S(""),h(null),N({}),R(null),k(""),x(D=>{let B=Vs(D.connectionType),G=Vs(A),$=Array.isArray(e?.providers)?e.providers:[],tt=C2(G.providerId,G.providerName,$),He=D.connectionType==="api"?zd(c):[],ke=A==="api"?zd(c):[],ht=ph(D.headerRows||[]),yt=!D.providerId||D.providerId===B.providerId||D.providerId===Vr(D.providerName||""),Ve=!D.providerName||D.providerName===B.providerName,de=!D.apiKeyEnv||D.apiKeyEnv===B.apiKeyEnv,qe=!D.subscriptionProfile||D.subscriptionProfile===B.subscriptionProfile,un=(D.modelIds||[]).length===0||JSON.stringify(D.modelIds||[])===JSON.stringify(B.modelIds||[]),po=JSON.stringify(ht)===JSON.stringify(He);return{...D,connectionType:A,providerName:Ve?tt.providerName:D.providerName,providerId:yt?tt.providerId:D.providerId,endpoints:A==="api"?(D.endpoints||[]).length>0?D.endpoints:G.endpoints:[],endpointDraft:A==="api"?String(D.endpointDraft||""):"",apiKeyEnv:A==="api"?de?G.apiKeyEnv:D.apiKeyEnv:"",subscriptionProfile:A==="api"?"":qe?G.subscriptionProfile:D.subscriptionProfile,modelIds:un?G.modelIds:D.modelIds,modelContextWindows:un?{}:D.modelContextWindows||{},modelDraft:"",rateLimitRows:A==="api"?G.rateLimitRows:[],headerRows:A==="api"?ht.length===0||po?ke:ht:[]}})}async function qr({force:A=!1,silent:D=!1}={}){if(g.connectionType!=="api")return!1;if(_e.length===0||!Z)return D||k("Add endpoints and an API key or env before checking the model list API."),!1;if(!A&&w?.signature===ae)return!!(w?.result?.models||[]).length;H(!0),D||k("");try{let B=await Tt("/api/config/discover-provider-models",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:_e,...ml(Z)?{apiKeyEnv:Z}:{apiKey:Z},...Object.keys(he).length>0?{headers:he}:{}})}),G=(B.result?.models||[]).map(ke=>String(ke||"").trim()).filter(Boolean),$={};if(G.length>0)try{let ke=await th(G);$=B2(ke)}catch{$={}}let tt={...B.result&&typeof B.result=="object"?B.result:{},modelContextWindows:$};if(R({signature:ae,result:tt}),G.length>0)return x(ke=>{if(Y1(ke)!==ae||ke.connectionType!=="api")return ke;let ht=Array.isArray(ke.modelIds)?ke.modelIds:[],yt=A&&ht.length>0?Array.from(new Set([...ht,...G])):ht.length>0?ht:G,Ve={...ke.modelContextWindows&&typeof ke.modelContextWindows=="object"?ke.modelContextWindows:{},...$};return JSON.stringify(yt)===JSON.stringify(ht)&&JSON.stringify(Ve)===JSON.stringify(ke.modelContextWindows||{})?ke:{...ke,modelIds:yt,modelContextWindows:Ve}}),k(""),!0;let He=(B.result?.warnings||[]).join(" ")||"Model list API did not return any models. Add model ids manually if needed.";return k(He),!1}catch(B){let G=B instanceof Error?B.message:String(B);return k(G),!1}finally{H(!1)}}async function cn(){if(g.connectionType!=="api")return!0;b("test"),S(""),N(Object.fromEntries(q.map(A=>[A,"pending"])));try{let A=await RC("/api/config/test-provider-stream",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:_e,models:q,...ml(Z)?{apiKeyEnv:Z}:{apiKey:Z},...Object.keys(he).length>0?{headers:he}:{}})},{onMessage:D=>{if(D?.type!=="progress")return;let B=D.event||{};B.phase==="model-done"&&N(G=>({...G,[B.model]:B.confirmed?"success":"error"}))}});return h({signature:re,result:A}),N(D=>{let B={...D},G=new Set(Array.isArray(A?.models)?A.models:[]);for(let $ of q)B[$]=G.has($)?"success":"error";return B}),A?.ok?!0:(S((A?.warnings||[]).join(" ")||"Provider test could not confirm a working endpoint/model combination."),!1)}catch(A){return N(D=>{let B={...D};for(let G of q)(!B[G]||B[G]==="pending")&&(B[G]="error");return B}),S(A instanceof Error?A.message:String(A)),!1}finally{b("")}}(0,E.useEffect)(()=>{d!==1||g.connectionType!=="api"||q.length>0||!Z||_e.length===0||I||w?.signature===ae||qr({silent:!0})},[d,g.connectionType,q.length,Z,_e.length,I,w,ae]);async function $e({force:A=!1}={}){if(g.connectionType==="api"||!A&&Q===me)return!0;b("oauth-login"),S("");try{return await Tt("/api/subscription/login",{method:"POST",headers:Ct,body:JSON.stringify({profileId:ue,providerId:ne,subscriptionType:g.connectionType==="oauth-claude"?"claude-code":"chatgpt-codex"})}),ee(me),!0}catch(D){return S(D instanceof Error?D.message:String(D)),!1}finally{b("")}}async function Ee(){d===0&&g.connectionType!=="api"&&!await $e()||d===1&&g.connectionType==="api"&&!Te&&!await cn()||p(A=>Math.min(A+1,W.length-1))}async function fe(A){if((A==="save"||A==="save-start")&&g.connectionType==="api"&&!Te){S("Finish is available after the provider test succeeds.");return}b(A);try{if(A==="apply"){await t(Ze);return}if(A==="validate"){await n(Ze);return}if(A==="save"){await r(Ze);return}A==="save-start"&&await a(Ze)}finally{b("")}}let ge=v||sn||(d===0&&g.connectionType!=="api"&&Q!==me?"Continue opens the browser sign-in flow for this provider.":d===1&&g.connectionType==="api"&&!Te?"Continue will test this provider against the entered endpoints and model ids using your API key or env.":W[d].detail),P=g.connectionType==="oauth-claude"?"Examples: claude-opus-4-6 claude-sonnet-4-6 claude-haiku-4-5":g.connectionType==="oauth-gpt"?"Examples: gpt-5.3-codex gpt-5.2-codex gpt-5.1-codex-mini":(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Examples: gpt-4o-mini gpt-4.1-mini",Object.keys(Se?.modelContextWindows||{}).length>0?` \xB7 ${Object.keys(Se?.modelContextWindows||{}).length} context size${Object.keys(Se?.modelContextWindows||{}).length===1?"":"s"} ready`:""]}),(0,l.jsx)("span",{className:"ml-2 text-amber-700",children:"Auto-discovered model ids may be incomplete or inaccurate if the provider is misconfigured. Verify the list and add or remove model ids yourself."})]}),Ye=!te,Vt=z?"Edit provider":te?"Add provider":"Quick start wizard",Gt=z?"Update this provider in place. Change endpoints, model ids, rate limits, alias, or provider id, then save the refreshed config.":te?"Add another provider with endpoints, model ids, rate limits, and a stable alias. API Key providers are auto-tested before save.":"Add the first provider, models list, rate limits, stable alias, and then start the router. API Key providers are auto-tested before save.",Mt=(0,l.jsxs)("div",{className:"space-y-5",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-secondary/25 px-3 py-3",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[Ye?(0,l.jsxs)(Nt,{variant:"outline",className:"px-3 py-1 text-[10px] uppercase tracking-[0.16em]",children:["Step ",d+1," of ",W.length]}):null,W.map((A,D)=>(0,l.jsxs)("div",{className:Y("inline-flex items-center gap-2 rounded-xl px-3 py-2 ring-1",D===d?"bg-background text-foreground shadow-sm ring-border":D<d?"bg-emerald-50 text-emerald-900 ring-emerald-200":"bg-background/70 text-muted-foreground ring-border/60"),children:[(0,l.jsx)("span",{className:Y("inline-flex h-5 w-5 items-center justify-center rounded-full text-[11px] font-semibold",D===d?"bg-primary text-primary-foreground":D<d?"bg-emerald-100 text-emerald-700":"bg-secondary text-secondary-foreground"),children:D+1}),(0,l.jsx)("span",{className:"text-sm font-medium",children:A.title})]},A.title))]}),(0,l.jsxs)("div",{className:"mt-3 flex flex-col gap-1 border-t border-border/60 px-1 pt-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:Pt.title}),(0,l.jsx)("div",{className:"max-w-2xl text-xs leading-5 text-muted-foreground",children:Pt.detail})]})]}),d===0?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:fC.map(A=>(0,l.jsxs)("button",{type:"button",className:Y("rounded-2xl border px-4 py-3 text-left transition",g.connectionType===A.value?"border-ring bg-background shadow-sm":"border-border/70 bg-background/70 hover:border-border"),onClick:()=>Ge(A.value),children:[(0,l.jsx)("div",{className:"text-sm font-medium text-foreground",children:A.label}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:A.description})]},A.value))}),(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,l.jsx)(st,{label:"Provider name",children:(0,l.jsx)(Kt,{value:g.providerName,onChange:A=>mo(A.target.value),placeholder:Vs(g.connectionType).providerName})}),(0,l.jsx)(st,{label:"Provider id",hint:"lowercase-hyphenated",children:(0,l.jsx)(Kt,{value:g.providerId,onChange:A=>ot("providerId",A.target.value),onBlur:()=>ot("providerId",Vr(g.providerId||g.providerName||"my-provider")||"my-provider"),placeholder:Vs(g.connectionType).providerId})})]}),g.connectionType==="api"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(st,{label:"Endpoints",hint:"comma, space, or newline turns into chips",children:(0,l.jsx)(ah,{values:g.endpoints,onChange:A=>ot("endpoints",A),draftValue:g.endpointDraft,onDraftValueChange:A=>ot("endpointDraft",A),commitOnBlur:!0,isValueValid:Ks,placeholder:"Example: https://api.openai.com/v1",helperText:"Paste one or more endpoints"})}),(0,l.jsx)(st,{label:"API key or env",children:(0,l.jsx)(uh,{value:g.apiKeyEnv,onChange:A=>ot("apiKeyEnv",A.target.value),placeholder:"Example: OPENAI_API_KEY or sk-...",isEnvVar:ml(g.apiKeyEnv)})}),(0,l.jsx)(st,{label:"Custom headers",hint:"User-Agent included by default",children:(0,l.jsx)(SL,{rows:g.headerRows,onChange:A=>ot("headerRows",A)})})]}):(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)("div",{className:"rounded-2xl border border-border/70 bg-secondary/45 px-4 py-3 text-sm leading-6 text-muted-foreground",children:"Continue opens the ChatGPT sign-in page in your browser and stores the login for this provider automatically."}),(0,l.jsxs)("div",{className:"rounded-2xl border border-amber-300/60 bg-amber-50/80 px-4 py-3 text-xs leading-5 text-amber-800 dark:border-amber-500/30 dark:bg-amber-950/40 dark:text-amber-300",children:[(0,l.jsx)("span",{className:"font-medium",children:"Heads up:"})," ChatGPT subscriptions (Plus / Pro / Team) are separate from the OpenAI API and are intended for use within OpenAI's own apps. Routing requests through your subscription here may violate OpenAI's terms of service and could result in account restrictions."]})]})]}):null,d===1?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(st,{label:"Models",hint:"comma, space, or newline turns into chips",children:(0,l.jsx)(ah,{values:g.modelIds,onChange:A=>ot("modelIds",A),draftValue:g.modelDraft,onDraftValueChange:A=>ot("modelDraft",A),commitOnBlur:!0,disabled:m==="test",valueStates:g.connectionType==="api"?C:{},placeholder:"Paste model ids",helperText:P,suggestedValues:U})}),g.connectionType==="api"&&I?(0,l.jsxs)("div",{className:"rounded-2xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-900",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(co,{}),"Loading provider models"]}),(0,l.jsx)("div",{className:"mt-1 text-xs leading-5 text-sky-800/90",children:"LLM Router is checking the provider model list and matching context sizes for the discovered models."})]}):null,g.connectionType==="api"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(st,{label:"Rate limit",stacked:!0,headerAction:(0,l.jsx)(ce,{type:"button",size:"sm",variant:"outline",onClick:()=>ot("rateLimitRows",OC(g.rateLimitRows)),disabled:m==="test",children:"Add rate limit"}),children:(0,l.jsx)(_C,{rows:g.rateLimitRows,onChange:A=>ot("rateLimitRows",A),availableModelIds:q,disabled:m==="test"})}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3 text-sm leading-6 text-muted-foreground",children:["The first model becomes the primary direct route. Add caps for ",(0,l.jsx)("code",{children:"all"})," models or target individual model ids when you need a narrower quota bucket."]})]}):null,g.connectionType==="api"?(0,l.jsxs)("div",{className:Y("rounded-2xl border px-4 py-3 text-sm leading-6",oe?.ok?"border-emerald-200 bg-emerald-50 text-emerald-900":oe?"border-amber-200 bg-amber-50 text-amber-900":"border-border/70 bg-background/80 text-muted-foreground"),children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em]",children:"Provider test"}),(0,l.jsx)("div",{className:"mt-2",children:oe?.ok?`Confirmed ${(oe.models||[]).length} model(s) across ${(oe.workingFormats||[]).join(", ")||"detected formats"}.`:oe?(oe.warnings||[]).join(" ")||"Provider test still needs review.":"Run Provider test before continuing so the wizard can auto-detect the working endpoint format(s)."})]}):null]}):null,d===2?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:te||z?(0,l.jsx)(I2,{label:"Use this provider order for the default route",hint:"Updates the fixed `default` alias",checked:g.useAliasAsDefault,onCheckedChange:A=>ot("useAliasAsDefault",A)}):(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3 text-sm text-muted-foreground md:col-span-2",children:["The fixed ",(0,l.jsx)("code",{children:"default"})," route is created automatically. Arrange this provider's models in the order you want clients to try first."]})}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Model order"}),(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(wL,{providerId:ne,values:V,onChange:A=>ot("aliasModelIds",A)})})]}),(0,l.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Provider"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:ne}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:g.providerName})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Connection"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground",children:A2(g.connectionType)}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground break-all",children:g.connectionType==="api"?`${_e.length} endpoint candidate(s)`:"Browser sign-in flow"})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Models"}),(0,l.jsxs)("div",{className:"mt-2 text-sm font-medium text-foreground",children:[q.length," configured"]}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground break-all",children:q.join(", ")||"No models yet"})]}),(0,l.jsxs)("div",{className:"rounded-2xl border border-border/70 bg-background/80 px-4 py-3",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:"Default route"}),(0,l.jsx)("div",{className:"mt-2 text-sm font-medium text-foreground break-all",children:gt}),(0,l.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:g.useAliasAsDefault?"Requests to `default` and `smart` use this ordered list.":"This provider keeps its direct routes only until you opt it into the fixed default route."})]})]}),g.connectionType==="api"?(0,l.jsxs)("div",{className:Y("rounded-2xl border px-4 py-3 text-sm leading-6",Te?"border-emerald-200 bg-emerald-50 text-emerald-900":"border-amber-200 bg-amber-50 text-amber-900"),children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.16em]",children:"Provider test"}),(0,l.jsx)("div",{className:"mt-2",children:Te?`Using ${(oe?.workingFormats||[]).join(", ")||"detected formats"}. The saved provider keeps the tested endpoint selection and confirmed models.`:"Finish is available after the provider test succeeds."})]}):null]}):null,(0,l.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border/70 pt-4 md:flex-row md:items-start md:justify-between md:gap-4",children:[(0,l.jsx)("div",{className:Y("min-w-0 flex-1 text-sm md:max-w-2xl",sn||v?"text-amber-700":"text-muted-foreground"),children:ge}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 md:justify-end",children:[d>0?(0,l.jsx)(ce,{variant:"ghost",onClick:()=>p(A=>Math.max(A-1,0)),children:"Back"}):null,d<W.length-1?(0,l.jsx)(ce,{onClick:()=>{Ee()},disabled:!!sn||m!=="",children:m==="oauth-login"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Signing in\u2026"]}):m==="test"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Testing provider\u2026"]}):"Continue"}):(0,l.jsx)(ce,{onClick:()=>{fe("save-start")},disabled:!!sn||m!==""||g.connectionType==="api"&&!Te,children:m==="save-start"?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(co,{}),"Finishing\u2026"]}):"Finish"})]})]})]});return u?(0,l.jsxs)(Xn,{className:"border-dashed",children:[f?(0,l.jsxs)(jo,{children:[(0,l.jsx)(el,{children:Vt}),(0,l.jsx)(ws,{children:Gt})]}):null,(0,l.jsx)(Zn,{className:"space-y-5",children:Mt})]}):(0,l.jsxs)("div",{className:"space-y-5",children:[f?(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-base font-semibold text-foreground",children:Vt}),(0,l.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:Gt})]}):null,Mt]})}function kC(){let[e,t]=(0,E.useState)(null),[n,r]=(0,E.useState)(""),[a,o]=(0,E.useState)(""),[i,s]=(0,E.useState)(null),[c,u]=(0,E.useState)([]),[f,d]=(0,E.useState)(!0),[p,m]=(0,E.useState)(!1),[b,g]=(0,E.useState)(!1),[x,y]=(0,E.useState)(!1),[h,v]=(0,E.useState)(""),[S,C]=(0,E.useState)(""),[N,w]=(0,E.useState)("model-alias"),[R,M]=(0,E.useState)(!1),[k,I]=(0,E.useState)(!1),[H,Q]=(0,E.useState)(0),[ee,X]=(0,E.useState)(""),[z,te]=(0,E.useState)(""),[W,q]=(0,E.useState)(""),[V,_e]=(0,E.useState)(!1),[F,he]=(0,E.useState)(!1),[Z,ae]=(0,E.useState)(""),[Se,U]=(0,E.useState)("usage"),[ne,ue]=(0,E.useState)(null),[me,re]=(0,E.useState)({status:"idle",message:"",savedAt:""}),oe=(0,E.useRef)(""),Te=(0,E.useRef)(""),Re=(0,E.useRef)(null),Ze=(0,E.useRef)(null),gt=(0,E.useRef)(null),Pt=(0,E.useRef)(0),sn=(0,E.useRef)(""),ot=(0,E.useRef)(0);(0,E.useEffect)(()=>{oe.current=n},[n]),(0,E.useEffect)(()=>{Te.current=a},[a]),(0,E.useEffect)(()=>()=>{gt.current&&(clearTimeout(gt.current),gt.current=null)},[]);let mo=n!==a,Ge=e?.config?.document,qr=i?.summary||e?.config||{},cn=i?.validationMessages||e?.config?.validationMessages||[],$e=(0,E.useMemo)(()=>G1(e?.config?.rawText||"{}",e?.config?.document||{}),[e?.config?.rawText,e?.config?.document]),Ee=(0,E.useMemo)(()=>$k(n,$e),[n,$e]),fe=(0,E.useMemo)(()=>G1(n,$e),[n,$e]),ge=Ee.parseError?$e:Ee.value,P=(0,E.useMemo)(()=>Array.isArray(ge?.providers)?ge.providers:[],[ge]),Ye=(0,E.useMemo)(()=>ge?.modelAliases&&typeof ge.modelAliases=="object"&&!Array.isArray(ge.modelAliases)?ge.modelAliases:{},[ge]),Vt=(0,E.useMemo)(()=>X1(ge),[ge]),Gt=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:"",Mt=ge,A=(0,E.useMemo)(()=>Kk(),[]),D=e?.ampClient?.global||{},B=e?.webSearch||e?.ampWebSearch||null,G=e?.codingTools?.codexCli||{},$=e?.codingTools?.claudeCode||{},tt=D?.routedViaRouter===!0,He=G?.routedViaRouter===!0,ke=$?.routedViaRouter===!0,yt=(e?.activityLog||{enabled:!0})?.enabled!==!1,Ve=(0,E.useMemo)(()=>X1(Mt),[Mt]),de=(0,E.useMemo)(()=>SC(Mt),[Mt]),qe=(0,E.useMemo)(()=>ai(zn(Mt)),[Mt]),un=(0,E.useMemo)(()=>e2(Mt,B),[Mt,B]),po=(0,E.useMemo)(()=>{let O=new Set((Array.isArray(qe?.providers)?qe.providers:[]).map(T=>en(T?.id)).filter(Boolean));return Jk(Mt,O)},[Mt,qe]),Bn=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:Ve.length===0?"Add at least one alias or provider/model route before configuring AMP.":"",ir=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:"",oi=Ee.parseError?`Fix the raw JSON parse error first: ${Ee.parseError}`:Vt.length===0?"Add at least one alias or provider/model route before configuring coding-tool bindings.":"",BC=(0,E.useMemo)(()=>Gs(Vt,Fg(G?.bindings?.defaultModel)?[]:[G?.bindings?.defaultModel]),[Vt,G?.bindings?.defaultModel]),IC=(0,E.useMemo)(()=>Gs(Vt,[$?.bindings?.primaryModel,$?.bindings?.defaultOpusModel,$?.bindings?.defaultSonnetModel,$?.bindings?.defaultHaikuModel,$?.bindings?.subagentModel]),[Vt,$?.bindings?.primaryModel,$?.bindings?.defaultOpusModel,$?.bindings?.defaultSonnetModel,$?.bindings?.defaultHaikuModel,$?.bindings?.subagentModel]),jd=String(Mt?.amp?.defaultRoute||Mt?.defaultModel||hh(Mt)||"").trim(),dn=String(Mt?.masterKey||e?.config?.document?.masterKey||"").trim(),UC=(0,E.useMemo)(()=>Fk(dn),[dn]),Pd=P.length>0,jC=Pd&&k,ii=e?.router?.running===!0,xh=e?.startup?.installed===!0,Vd=h==="start"?"Starting\u2026":h==="stop"?"Stopping\u2026":ii?"Stop server":"Start server",Hd=S==="enable"?"Enabling OS startup\u2026":S==="disable"?"Disabling OS startup\u2026":xh?"Disable OS startup":"Enable OS startup",Sh=e?.router?.portBusy?e?.router?.portBusyReason||`Port ${8376} is occupied${e?.router?.listenerPids?.length>0?` by PID${e.router.listenerPids.length===1?"":"s"} ${e.router.listenerPids.join(", ")}`:""}.`:String(e?.router?.lastError||"").trim(),PC=!CC(ge),wh=P.length>0?"existing":"blank",Ah=P[0]?.id||"",Ch=e?.defaults?.providerUserAgent||ni;(0,E.useEffect)(()=>{if(f||p||Ee.parseError)return;if(dn){sn.current="";return}let O=String(e?.config?.rawText||a||"__empty__");sn.current!==O&&(sn.current=O,KC({showSuccessNotice:!1}))},[a,dn,f,Ee.parseError,p,e?.config?.rawText]),(0,E.useEffect)(()=>{if(gt.current&&(clearTimeout(gt.current),gt.current=null),!ne)return;let O=ne.immediate===!0?0:450;return gt.current=setTimeout(()=>{gt.current=null;let T=ne.sequence;re(_=>({..._,status:"saving",message:""})),(async()=>{try{let _=await Tt("/api/amp/apply",{method:"POST",headers:Ct,body:JSON.stringify({rawText:ne.rawText,source:"autosave"})});if(T!==Pt.current)return;wa(_),re({status:"saved",message:"",savedAt:new Date().toISOString()})}catch(_){if(T!==Pt.current)return;let se=_ instanceof Error?_.message:String(_);re({status:"error",message:se,savedAt:""}),j("error",se)}})()},O),()=>{gt.current&&(clearTimeout(gt.current),gt.current=null)}},[ne]);function VC(){I(!0),Q(O=>O+1)}function HC(){VC()}function qd(){I(!1)}(0,E.useEffect)(()=>{!Pd&&k&&I(!1)},[Pd,k]);function j(O,T){ot.current+=1,u(_=>[..._,{id:`notice-${ot.current}`,tone:O,message:T}])}function Rh(O){u(T=>T.filter(_=>_.id!==O))}function wa(O,{preserveDraft:T=!1}={}){t(O);let _=String(O?.config?.rawText||"");if(!T||oe.current===Te.current){r(_),o(_),M(!1),s({rawText:_,summary:O?.config,validationMessages:O?.config?.validationMessages||[]});return}o(_),_!==Te.current&&M(!0)}async function lr({preserveDraft:O=!1}={}){let T=await Tt("/api/state");wa(T,{preserveDraft:O})}(0,E.useEffect)(()=>{let O=!1;function T(){Re.current&&(Re.current.close(),Re.current=null)}function _(){Ze.current&&(clearTimeout(Ze.current),Ze.current=null)}function se(){O||Ze.current||(Ze.current=setTimeout(()=>{Ze.current=null,ye({isReconnect:!0})},Sk))}function ye({isReconnect:Ne=!1}={}){if(O)return;_(),T();let we=new EventSource("/api/events");Re.current=we,we.onopen=()=>{O||Re.current!==we||Ne&&lr({preserveDraft:oe.current!==Te.current}).catch(()=>{})},we.addEventListener("state",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);nt?.snapshot&&wa(nt.snapshot,{preserveDraft:!0})}catch(nt){j("error",nt instanceof Error?nt.message:String(nt))}}),we.addEventListener("log",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);t(be=>be&&{...be,logs:[nt,...be.logs||[]].slice(0,150)})}catch{}}),we.addEventListener("logs",it=>{if(!(O||Re.current!==we))try{let nt=JSON.parse(it.data);t(be=>be&&{...be,...nt?.activityLog?{activityLog:nt.activityLog}:{},logs:Array.isArray(nt?.logs)?nt.logs:[]})}catch{}}),we.onerror=()=>{O||Re.current!==we||(T(),se())}}return(async()=>{try{await lr()}catch(Ne){O||j("error",Ne instanceof Error?Ne.message:String(Ne))}finally{O||(d(!1),ye())}})(),()=>{O=!0,_(),T()}},[]);async function Eh(O,{silent:T=!1}={}){g(!0);try{let _=await Tt("/api/config/validate",{method:"POST",headers:Ct,body:JSON.stringify({rawText:O})});return s({rawText:O,summary:_.summary,validationMessages:_.validationMessages||[]}),T||j(L2(_.summary)==="success"?"success":"warning",_.summary.validationSummary),_}catch(_){throw T||j("error",_ instanceof Error?_.message:String(_)),_}finally{g(!1)}}async function $d(O,{successMessage:T="Config saved.",showSuccessNotice:_=!0}={}){m(!0);try{let se=await Tt("/api/config/save",{method:"POST",headers:Ct,body:JSON.stringify({rawText:O})});return wa(se),_&&T&&j("success",T),se}catch(se){throw j("error",se instanceof Error?se.message:String(se)),se}finally{m(!1)}}function go(O,{immediate:T=!1}={}){let _=Pt.current+1;Pt.current=_,ue({sequence:_,rawText:O,immediate:T===!0}),re(se=>({status:"pending",message:"",savedAt:se.savedAt}))}function In(O){r(O),s(null)}async function $r(O,T,_={}){let se=`${JSON.stringify(O,null,2)}
53
+ `;In(se),M(!1),await $d(se,{successMessage:T,..._})}async function Nh({providerId:O,endpoints:T,newModelIds:_,credentialPayload:se,headers:ye,onModelTestStateChange:Ne}){if(!Array.isArray(_)||_.length===0)return Ne?.({phase:"",modelStates:{},failedModelIds:[],message:""}),{ok:!0};let we=Object.fromEntries(_.map(be=>[be,"pending"])),it=({phase:be="testing",message:Yt="",failedModelIds:Le=[]}={})=>{Ne?.({phase:be,modelStates:{...we},failedModelIds:Le,message:Yt})},nt=()=>`Testing ${_.filter(Yt=>we[Yt]==="success"||we[Yt]==="error").length}/${_.length} new model${_.length===1?"":"s"} for ${O}.`;it({phase:"testing",message:nt()});try{let be=await RC("/api/config/test-provider-stream",{method:"POST",headers:Ct,body:JSON.stringify({endpoints:T,models:_,...se,...ye&&typeof ye=="object"&&!Array.isArray(ye)?{headers:ye}:{}})},{onMessage:ct=>{if(ct?.type!=="progress")return;let sr=ct.event||{};if(sr.phase!=="model-done")return;let Kr=String(sr.model||"").trim();!Kr||!Object.prototype.hasOwnProperty.call(we,Kr)||(we[Kr]=sr.confirmed?"success":"error",it({phase:"testing",message:nt()}))}}),Yt=new Set(Array.isArray(be?.models)?be.models:[]),Le=_.filter(ct=>!Yt.has(ct));for(let ct of _)we[ct]=Yt.has(ct)?"success":"error";if(!be?.ok||Le.length>0){let ct=Le.length>0?`New model test failed for ${O}: ${Le.join(", ")}.`:(be?.warnings||[]).join(" ")||`New model test failed for ${O}.`;return it({phase:"",failedModelIds:Le,message:ct}),j("warning",ct),{ok:!1,failedModelIds:Le,result:be}}return it({phase:"saving",message:`Saving ${_.length} confirmed new model${_.length===1?"":"s"} for ${O}.`}),{ok:!0,failedModelIds:[],result:be}}catch(be){for(let ct of _)we[ct]!=="success"&&(we[ct]="error");let Yt=be instanceof Error?be.message:String(be),Le=_.filter(ct=>we[ct]==="error");return it({phase:"",failedModelIds:Le,message:Yt}),j("error",Yt),{ok:!1,failedModelIds:Le}}}async function qC(O,T,{showSuccessNotice:_=!0}={}){if(Gt)return j("warning",Gt),!1;let se=String(T?.id||"").trim(),ye=String(T?.name||"").trim(),Ne=Array.isArray(T?.endpoints)?ba(T.endpoints):Hr([],T?.endpoint||""),we=Array.isArray(T?.rateLimitRows)?xa(T.rateLimitRows):[],it=P.find(ct=>ct?.id===O),nt=uo(it)==="api",be=Ed(it);if(!se)return j("warning","Provider id is required."),!1;if(!Od.test(se))return j("warning","Provider id must start with a letter and use lowercase letters, digits, or dashes only."),!1;if(!ye)return j("warning","Provider name is required."),!1;if(se!==O&&P.some(ct=>ct?.id===se))return j("warning",`Provider id "${se}" already exists.`),!1;if(nt&&Ne.length===0)return j("warning","API Key providers require at least one valid http(s) endpoint."),!1;if(nt&&Ne.some(ct=>!Ks(ct)))return j("warning","One or more endpoints are invalid. Use full http:// or https:// URLs."),!1;let Yt=nt?ti(we,{knownModelIds:be,requireAtLeastOne:!0}):"";if(Yt)return j("warning",Yt),!1;let Le=$g(Ee.value||$e,O,{...T,endpoints:Ne,rateLimitRows:we});try{return await $r(Le,`Updated provider ${se}.`,{showSuccessNotice:_}),!0}catch{return!1}}async function $C(O,{providerDraft:T=null,modelRows:_=null,showSuccessNotice:se=!0,onModelTestStateChange:ye=null}={}){if(Gt)return j("warning",Gt),!1;let Ne=P.find(Un=>Un?.id===O);if(!Ne)return j("error",`Provider '${O}' was not found.`),!1;let we=!!(T&&typeof T=="object"),it=Array.isArray(_);if(!we&&!it)return!0;let nt=uo(Ne)==="api",be=we?String(T?.id||"").trim():O,Yt=we?String(T?.name||"").trim():String(Ne?.name||O).trim(),Le=we?Array.isArray(T?.endpoints)?ba(T.endpoints):Hr([],T?.endpoint||""):bl(Ne),ct=we&&Array.isArray(T?.rateLimitRows)?xa(T.rateLimitRows):[],sr=it?_.map(Un=>({...Un,id:String(Un?.id||"").trim(),contextWindow:so(Un?.contextWindow||"")})).filter(Un=>Un.id):[];if(we){let Un=it?sr.map(jn=>jn.id):Ed(Ne);if(!be)return j("warning","Provider id is required."),!1;if(!Od.test(be))return j("warning","Provider id must start with a letter and use lowercase letters, digits, or dashes only."),!1;if(!Yt)return j("warning","Provider name is required."),!1;if(be!==O&&P.some(jn=>jn?.id===be))return j("warning",`Provider id "${be}" already exists.`),!1;if(nt&&Le.length===0)return j("warning","API Key providers require at least one valid http(s) endpoint."),!1;if(nt&&Le.some(jn=>!Ks(jn)))return j("warning","One or more endpoints are invalid. Use full http:// or https:// URLs."),!1;let Aa=nt?ti(ct,{knownModelIds:Un,requireAtLeastOne:!0}):"";if(Aa)return j("warning",Aa),!1}if(it){if(sr.length===0)return j("warning","Keep at least one model id on the provider."),!1;if(fh(sr.map(cr=>cr.id)))return j("warning","Model ids must be unique for each provider."),!1;if(sr.some(cr=>{let Ws=String(cr?.contextWindow||"").trim();if(!Ws)return!1;let Gd=Number.parseInt(Ws,10);return!Number.isFinite(Gd)||Gd<=0||String(Gd)!==Ws}))return j("warning","Context windows must be positive integers when set."),!1;let Aa=Ed(Ne),jn=sr.map(cr=>cr.id).filter(cr=>!Aa.includes(cr));if(nt&&jn.length>0){if(Le.length===0)return j("warning",`Provider '${be}' needs at least one endpoint before testing new models.`),!1;let cr=J1(T,Ne);if(!cr.apiKey&&!cr.apiKeyEnv)return j("warning",`Provider '${be}' needs an API key or env before testing new models.`),!1;if(!(await Nh({providerId:be,endpoints:Le,newModelIds:jn,credentialPayload:cr,headers:Ne?.headers,onModelTestStateChange:ye})).ok)return!1}}let Kr=Ee.value||$e;we&&(Kr=$g(Kr,O,{...T,endpoints:Le,rateLimitRows:ct})),it&&(Kr=qg(Kr,we?be:O,sr));let SR=we&&it?`Updated provider ${be} and saved its model list.`:we?`Updated provider ${be}.`:(()=>{let Un=Ed(Ne),Aa=sr.map(jn=>jn.id).filter(jn=>!Un.includes(jn));return Aa.length>0?`Tested ${Aa.length} new model${Aa.length===1?"":"s"} and updated ${be}.`:`Updated models for ${be}.`})();try{return await $r(Kr,SR,{showSuccessNotice:se}),ye?.({phase:"",modelStates:{},failedModelIds:[],message:""}),!0}catch{return!1}}async function KC({showSuccessNotice:O=!1}={}){if(Ee.parseError||String((Ee.value||$e||{}).masterKey||"").trim())return!1;let T=hl(Ee.value||$e||{});T.masterKey=Zg();try{return await $r(T,"Gateway key ready.",{showSuccessNotice:O}),!0}catch{return!1}}async function FC(){if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}try{await Ps(dn),j("success","Gateway key copied to clipboard.")}catch(O){j("error",O instanceof Error?O.message:String(O))}}async function GC(){if(!A){j("warning","API endpoint is not ready yet.");return}try{await Ps(A),j("success","API endpoint copied to clipboard.")}catch(O){j("error",O instanceof Error?O.message:String(O))}}async function YC(O){let T=String(O||"").trim();if(!T){j("warning","Alias id is not ready yet.");return}try{await Ps(T),j("success",`Alias id ${T} copied to clipboard.`)}catch(_){j("error",_ instanceof Error?_.message:String(_))}}async function li(O,T,{ensureMode:_="none",successMessage:se=""}={}){let ye=String(O||"").trim();if(!ye){j("warning",`${T} is not resolved yet.`);return}try{await Tt("/api/file/open",{method:"POST",headers:Ct,body:JSON.stringify({editorId:"default",filePath:ye,ensureMode:_})}),j("success",se||`Opened ${T} in the default app.`)}catch(Ne){j("error",Ne instanceof Error?Ne.message:String(Ne))}}async function WC(O){let T=String(O||"").trim();if(!T){j("warning","Model id is not ready yet.");return}try{await Ps(T),j("success",`Model id ${T} copied to clipboard.`)}catch(_){j("error",_ instanceof Error?_.message:String(_))}}async function QC(){if(!(typeof window>"u"?!0:window.confirm("Rotate the gateway key? Existing clients using the old key will need the new one. Linked tools like AMP, Codex CLI, and Claude Code will auto-update to the new key.")))return;let T=hl(Ee.value||$e||{});T.masterKey=Zg();try{await $r(T,"Rotated gateway key. Linked tools like AMP, Codex CLI, and Claude Code refreshed automatically.")}catch{}}async function XC(O,T,{providerDraft:_=null,onModelTestStateChange:se=null}={}){if(Gt)return j("warning",Gt),!1;let ye=P.find(Le=>Le?.id===O);if(!ye)return j("error",`Provider '${O}' was not found.`),!1;let Ne=(Array.isArray(T)?T:[]).map(Le=>({...Le,id:String(Le?.id||"").trim()})).filter(Le=>Le.id),we=_&&String(_?.id||"").trim()||O,it=_?Array.isArray(_?.endpoints)?ba(_.endpoints):Hr([],_?.endpoint||""):bl(ye),nt=(Array.isArray(ye?.models)?ye.models:[]).map(Le=>String(Le?.id||"").trim()).filter(Boolean),be=Ne.map(Le=>Le.id).filter(Le=>!nt.includes(Le));if(uo(ye)==="api"&&be.length>0){if(it.length===0)return j("warning",`Provider '${we}' needs at least one endpoint before testing new models.`),!1;let Le=J1(_,ye);if(!Le.apiKey&&!Le.apiKeyEnv)return j("warning",`Provider '${we}' needs an API key or env before testing new models.`),!1;if(!(await Nh({providerId:we,endpoints:it,newModelIds:be,credentialPayload:Le,headers:ye?.headers,onModelTestStateChange:se})).ok)return!1}let Yt=qg(Ee.value||$e,O,Ne);try{let Le=be.length>0?`Tested ${be.length} new model${be.length===1?"":"s"} and updated ${O}.`:`Updated models for ${O}.`;return await $r(Yt,Le),se?.({phase:"",modelStates:{},failedModelIds:[],message:""}),!0}catch{return!1}}async function ZC(O,T){if(Gt)return j("warning",Gt),!1;let _=_1(Ee.value||$e,O,T),se=String(T?.id||O||"").trim()||O;try{return await $r(_,`Updated alias ${se}.`),!0}catch{return!1}}async function JC(O){if(Gt){j("warning",Gt);return}if(!(typeof window>"u"?!0:window.confirm(`Remove alias "${O}" from the config?`)))return;let _=k1(Ee.value||$e,O);try{await $r(_,`Removed alias ${O}.`)}catch{}}async function AL(O){try{await Ps(O?.url||""),j("success",`${O?.label||"Endpoint"} copied to clipboard.`)}catch(T){j("error",T instanceof Error?T.message:String(T))}}async function eR(){let T=!(D?.routedViaRouter===!0);if(T){if(Bn){j("warning",Bn);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}X(T?"enable":"disable");try{let _=!1,se;try{se=await Tt("/api/amp/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:T,rawText:T?n:void 0,endpointUrl:A})})}catch(Ne){if(Ne?.statusCode===404&&T)_=!0,se=await Tt("/api/amp/apply",{method:"POST",headers:Ct,body:JSON.stringify({rawText:n,source:"amp-global-route-compat",patchScope:"global",endpointUrl:A})});else throw Ne?.statusCode===404?new Error("Restart the web console so the AMP routing endpoint is available."):Ne}await lr({preserveDraft:!T});let ye=T?"AMP connected.":"AMP disconnected.";j("success",_?`${ye} Restart the web console if the AMP status does not refresh.`:ye)}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{X("")}}function tR(O,T){if(Bn){j("warning",Bn);return}let _=String(T||"").trim(),se=de.find(we=>we.id!==O&&String(we?.inbound||"").trim()===_);if(_&&se){j("warning",`AMP inbound match "${_}" already exists.`);return}let ye=Z1(Ee.value||$e,O,{inbound:T}),Ne=`${JSON.stringify(ye,null,2)}
54
+ `;In(Ne),go(Ne)}function nR(O,T){if(Bn){j("warning",Bn);return}let _=Z1(Ee.value||$e,O,{outbound:T==="__default__"?"":T}),se=`${JSON.stringify(_,null,2)}
55
+ `;In(se),go(se)}function rR(O){if(ir){j("warning",ir);return}let T=t2(Ee.value||$e,{strategy:O}),_=`${JSON.stringify(T,null,2)}
56
+ `;In(_),go(_)}function aR(O,T,_){if(ir){j("warning",ir);return}let se=n2(Ee.value||$e,O,{[T]:_}),ye=`${JSON.stringify(se,null,2)}
57
+ `;In(ye),go(ye,{immediate:i2(O,T,_)})}function oR(O,T){if(ir){j("warning",ir);return}let _=o2(Ee.value||$e,O,T),se=`${JSON.stringify(_,null,2)}
58
+ `;In(se),go(se)}function iR(O){if(ir){j("warning",ir);return}let T=a2(Ee.value||$e,O),_=`${JSON.stringify(T,null,2)}
59
+ `;In(_),go(_,{immediate:!0})}async function lR({providerId:O,modelId:T}){if(ir)throw new Error(ir);let _=vl(O,T);if(!_)throw new Error("Choose a provider and GPT model before testing.");if(new Set((Array.isArray(qe?.providers)?qe.providers:[]).map(it=>en(it?.id)).filter(Boolean)).has(en(_)))throw new Error(`Web search route '${_}' is already configured.`);let ye=await Tt("/api/config/test-web-search-provider",{method:"POST",headers:Ct,body:JSON.stringify({providerId:O,modelId:T,rawText:n})}),Ne=r2(Ee.value||$e,O,T),we=`${JSON.stringify(Ne,null,2)}
60
+ `;return In(we),go(we,{immediate:!0}),j("success",`Added ${_} to shared web search routing.`),ye?.result||null}async function sR({inbound:O,outbound:T}){if(Bn)return j("warning",Bn),!1;let _=String(O||"").trim();if(_&&de.some(ye=>String(ye?.inbound||"").trim()===_))return j("warning",`AMP inbound match "${_}" already exists.`),!1;let se=v2(Ee.value||$e,{inbound:O,outbound:T});try{return await $r(se,`Added AMP route ${String(O||"").trim()}.`),!0}catch{return!1}}async function cR(O){let T=yh(Ee.value||$e,O);if(!T?.removable)return;let _=T.source==="raw"?T.inbound||T.label:T.routeKey||T.label;if(!(typeof window>"u"?!0:window.confirm(`Remove AMP route mapping "${_}"?`)))return;let ye=b2(Ee.value||$e,O);try{await $r(ye,`Removed AMP route ${_}.`)}catch{}}function CL(){r(a),s({rawText:a,summary:e?.config,validationMessages:e?.config?.validationMessages||[]}),M(!1),j("success","Editor reset to the latest disk version.")}function Th(O){In(O),M(!1),j("success","Quick-start config loaded into the editor.")}async function Mh(O){In(O);try{await Eh(O)}catch{}}async function Kd(O){In(O);let T;try{T=await Eh(O,{silent:!0})}catch{return null}let _=T?.summary||{};if(!(!_.parseError&&(_.validationErrors||[]).length===0))return j("warning",_.validationSummary||"Quick-start config still needs review."),null;try{return await $d(O,{successMessage:"Quick-start config saved."})}catch{return null}}async function Oh(O){let T=await Kd(O);return T?(w("activity"),T.router?.running?(j("success","Quick-start config saved. Router is already running."),!0):(j("success","Quick-start config saved. Starting router\u2026"),setTimeout(()=>{Fd("start")},0),!0)):!1}async function uR(O){let T=await Kd(O);return T&&qd(),!!T}async function dR(O){let T=await Oh(O);return T&&qd(),T}async function fR(){y(!0);try{await Tt("/api/config/open",{method:"POST",headers:Ct,body:JSON.stringify({editorId:"default"})}),j("success","Opened config file in the default app.")}catch(O){j("error",O instanceof Error?O.message:String(O))}finally{y(!1)}}async function mR(){let T=!(G?.routedViaRouter===!0);if(T){if(oi){j("warning",oi);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}te(T?"enable":"disable");try{await Tt("/api/codex-cli/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:T,rawText:T?n:void 0,endpointUrl:A,bindings:T?{defaultModel:G?.bindings?.defaultModel||jd,thinkingLevel:G?.bindings?.thinkingLevel||""}:void 0})}),await lr({preserveDraft:!T}),j("success",T?"Codex CLI connected.":"Codex CLI disconnected.")}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{te("")}}async function pR(){let T=!($?.routedViaRouter===!0);if(T){if(oi){j("warning",oi);return}if(!dn){j("warning","Gateway key is still generating. Try again in a second.");return}if(!A){j("warning","API endpoint is not ready yet.");return}}q(T?"enable":"disable");try{await Tt("/api/claude-code/global-route",{method:"POST",headers:Ct,body:JSON.stringify({enabled:T,rawText:T?n:void 0,endpointUrl:A,bindings:T?{primaryModel:$?.bindings?.primaryModel||"",defaultOpusModel:$?.bindings?.defaultOpusModel||"",defaultSonnetModel:$?.bindings?.defaultSonnetModel||"",defaultHaikuModel:$?.bindings?.defaultHaikuModel||"",subagentModel:$?.bindings?.subagentModel||"",thinkingLevel:$?.bindings?.thinkingLevel||""}:void 0})}),await lr({preserveDraft:!T}),j("success",T?"Claude Code connected.":"Claude Code disconnected.")}catch(_){j("error",_ instanceof Error?_.message:String(_))}finally{q("")}}async function gR(O,T){let _={defaultModel:G?.bindings?.defaultModel||jd,thinkingLevel:G?.bindings?.thinkingLevel||""};_[O]=T,_e(!0);try{await Tt("/api/codex-cli/model-bindings",{method:"POST",headers:Ct,body:JSON.stringify({bindings:_})}),await lr({preserveDraft:!0}),j("success","Codex CLI bindings updated.")}catch(se){j("error",se instanceof Error?se.message:String(se))}finally{_e(!1)}}async function hR(O,T){let _=$?.routedViaRouter===!0;if(O==="thinkingLevel"&&!_){he(!0);try{await Tt("/api/claude-code/effort-level",{method:"POST",headers:Ct,body:JSON.stringify({effortLevel:T})}),await lr({preserveDraft:!0}),j("success",T?`Effort level set to ${T}.`:"Effort level cleared.")}catch(ye){j("error",ye instanceof Error?ye.message:String(ye))}finally{he(!1)}return}let se={primaryModel:$?.bindings?.primaryModel||"",defaultOpusModel:$?.bindings?.defaultOpusModel||"",defaultSonnetModel:$?.bindings?.defaultSonnetModel||"",defaultHaikuModel:$?.bindings?.defaultHaikuModel||"",subagentModel:$?.bindings?.subagentModel||"",thinkingLevel:$?.bindings?.thinkingLevel||""};se[O]=T,he(!0);try{await Tt("/api/claude-code/model-bindings",{method:"POST",headers:Ct,body:JSON.stringify({bindings:se})}),await lr({preserveDraft:!0}),j("success","Claude Code model bindings updated.")}catch(ye){j("error",ye instanceof Error?ye.message:String(ye))}finally{he(!1)}}async function Fd(O){v(O);try{let T=await Tt(`/api/router/${O}`,{method:"POST",headers:Ct,body:"{}"});wa(T,{preserveDraft:!0}),j("success",T.message||`Router ${O}ed.`)}catch(T){await lr({preserveDraft:!0}).catch(()=>{}),j("error",T instanceof Error?T.message:String(T))}finally{v("")}}async function yR(O){C(O);try{let T=await Tt(`/api/startup/${O}`,{method:"POST",headers:Ct,body:"{}"});wa(T,{preserveDraft:!0}),j("success",T.message||`Startup ${O}d.`)}catch(T){await lr({preserveDraft:!0}).catch(()=>{}),j("error",T instanceof Error?T.message:String(T))}finally{C("")}}async function vR(){let O=!yt;ae("toggle");try{let T=await Tt("/api/activity-log/settings",{method:"POST",headers:Ct,body:JSON.stringify({enabled:O})});wa(T,{preserveDraft:!0}),j("success",T.message||`Activity log ${O?"enabled":"disabled"}.`)}catch(T){await lr({preserveDraft:!0}).catch(()=>{}),j("error",T instanceof Error?T.message:String(T))}finally{ae("")}}async function bR(){if(typeof window>"u"||window.confirm("Clear the shared activity log file? This also clears the Activity tab for connected web console sessions.")){ae("clear");try{let T=await Tt("/api/activity-log/clear",{method:"POST",headers:Ct,body:"{}"});wa(T,{preserveDraft:!0}),j("success",T.message||"Activity log cleared.")}catch(T){j("error",T instanceof Error?T.message:String(T))}finally{ae("")}}}async function xR(O){let T=P.find(Ne=>Ne.id===O);if(!(typeof window>"u"?!0:window.confirm(`Remove provider "${T?.name||O}" from the config?`)))return;let se=x2(e?.config?.document||fe||{},O),ye=`${JSON.stringify(se,null,2)}
61
+ `;In(ye);try{await $d(ye,{successMessage:`Removed provider ${T?.name||O}.`})}catch{}}return f?(0,l.jsx)("div",{className:"console-shell flex min-h-screen items-center justify-center px-6 py-10",children:(0,l.jsx)(Xn,{className:"w-full max-w-lg",children:(0,l.jsxs)(Zn,{className:"space-y-3 p-6 text-center",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground",children:"LLM Router"}),(0,l.jsx)("div",{className:"text-xl font-semibold text-foreground",children:"Loading web console\u2026"}),(0,l.jsx)("div",{className:"text-sm text-muted-foreground",children:"Preparing config state, router controls, and live activity."})]})})}):PC?(0,l.jsx)("div",{className:"console-shell min-h-screen px-4 py-6 md:px-6",children:(0,l.jsxs)("div",{className:"mx-auto flex max-w-5xl flex-col gap-4",children:[(0,l.jsx)(iC,{notices:c,onDismiss:Rh}),(0,l.jsx)("div",{id:"quick-start-wizard",children:(0,l.jsx)(uC,{baseConfig:fe,seedMode:wh,mode:"onboarding",targetProviderId:Ah,defaultProviderUserAgent:Ch,onApplyDraft:Th,onValidateDraft:Mh,onSaveDraft:Kd,onSaveAndStart:Oh},`onboarding-wizard-${wh}-${Ah||"new"}`)})]})}):(0,l.jsx)("div",{className:"console-shell min-h-screen px-4 py-4 md:px-6 md:py-6",children:(0,l.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-col gap-4",children:[(0,l.jsx)(Xn,{className:"overflow-hidden",children:(0,l.jsx)(Zn,{className:"p-5",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsxs)("h1",{className:"inline-flex items-center gap-2 text-2xl font-semibold tracking-tight text-foreground",children:[(0,l.jsx)("span",{children:"LLM Router Web Console"}),(0,l.jsx)(Td,{connected:ii,size:"md",srLabel:"Router running"})]})}),(0,l.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[(0,l.jsxs)("a",{href:xk,target:"_blank",rel:"noreferrer noopener",className:"inline-flex h-8 items-center gap-2 rounded-lg border border-amber-300 bg-amber-50/90 px-3 text-xs font-medium uppercase tracking-[0.16em] text-amber-900 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background","aria-label":"Support LLM Router via GitHub Sponsors",title:"Support LLM Router",children:[(0,l.jsx)(kk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Buy me a coffee"})]}),(0,l.jsxs)("a",{href:bk,target:"_blank",rel:"noreferrer noopener",className:"inline-flex h-8 items-center gap-2 rounded-lg border border-border bg-background/80 px-3 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background","aria-label":"Open the LLM Router GitHub repository",title:"Open GitHub repository",children:[(0,l.jsx)(_k,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:"Repo"})]})]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(ce,{size:"sm",variant:ii?"outline":void 0,className:"px-2 sm:px-3",onClick:()=>Fd(ii?"stop":"start"),disabled:h!=="","aria-label":Vd,title:Vd,children:[ii?(0,l.jsx)(Dk,{className:"h-3.5 w-3.5"}):(0,l.jsx)(Lk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:Vd})]}),(0,l.jsxs)(ce,{size:"sm",variant:"outline",className:"px-2 sm:px-3",onClick:fR,disabled:x,"aria-label":x?"Opening config file":"Open config file",title:x?"Opening config file":"Open config file",children:[(0,l.jsx)(zk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:x?"Opening\u2026":"Open config file"})]}),(0,l.jsxs)(ce,{size:"sm",variant:"outline",className:"px-2 sm:px-3",onClick:()=>yR(xh?"disable":"enable"),disabled:S!=="","aria-label":Hd,title:Hd,children:[(0,l.jsx)(Uk,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:Hd})]})]}),(0,l.jsx)(W2,{endpointValue:A||Ds,endpointDisabled:!A,gatewayValue:dn?UC:"Generating\u2026",gatewayPending:!dn,gatewayDisabled:!dn||p,rotateDisabled:p,onCopyEndpoint:GC,onCopyGatewayKey:FC,onRotateKey:QC})]}),p||b?(0,l.jsx)("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:(0,l.jsx)("span",{className:"rounded-full bg-secondary px-2.5 py-1",children:p?"Saving changes\u2026":"Validating\u2026"})}):null,!ii&&e?.router?.portBusy&&!e?.router?.portBusySelf?(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,l.jsx)(ce,{size:"sm",variant:"outline",onClick:()=>Fd("reclaim"),disabled:h!=="",children:h==="reclaim"?"Reclaiming\u2026":`Reclaim port ${8376}`})}):null,Sh?(0,l.jsx)("div",{className:Y("rounded-xl border px-3 py-2 text-sm",e?.router?.portBusy?"border-amber-200 bg-amber-50 text-amber-900":"border-rose-200 bg-rose-50 text-rose-800"),children:Sh}):null]})})}),(0,l.jsx)(iC,{notices:c,onDismiss:Rh}),(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsx)(fL,{providers:P,onAddProvider:HC,onRemove:xR,onCopyModelId:WC,onApplyProviderDetails:qC,onApplyProviderModels:XC,onSaveAndCloseEditor:$C,disabledReason:Gt,busy:p})}),(0,l.jsxs)(Hu,{value:N,onValueChange:w,className:"space-y-0",children:[(0,l.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:(0,l.jsxs)(qu,{children:[(0,l.jsx)(Or,{value:"model-alias",children:"Alias & Fallback"}),(0,l.jsx)(Or,{value:"amp",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"AMP"}),(0,l.jsx)("span",{className:"rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:"Beta"}),(0,l.jsx)(Td,{connected:tt,srLabel:"AMP connected"})]})}),(0,l.jsx)(Or,{value:"codex-cli",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"Codex CLI"}),(0,l.jsx)(Td,{connected:He,srLabel:"Codex CLI connected"})]})}),(0,l.jsx)(Or,{value:"claude-code",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,l.jsx)("span",{children:"Claude Code"}),(0,l.jsx)(Td,{connected:ke,srLabel:"Claude Code connected"})]})}),(0,l.jsx)(Or,{value:"web-search",children:"Web Search"}),(0,l.jsx)(Or,{value:"activity",children:"Activity"})]})}),(0,l.jsx)(_r,{value:"model-alias",className:"space-y-4",children:(0,l.jsx)(sL,{aliases:Ye,config:ge,aliasIds:Object.keys(Ye),routeOptions:Vt,defaultModel:String(ge?.defaultModel||"").trim(),ampDefaultRoute:jd,disabledReason:Gt,busy:p,onApplyAlias:ZC,onRemoveAlias:JC,onCopyAliasId:YC})}),(0,l.jsx)(_r,{value:"amp",className:"space-y-4",children:(0,l.jsx)(mL,{rows:de,routeOptions:Ve,webSearchSnapshot:B,ampClientUrl:A,ampClientGlobal:D,routingBusy:ee,onToggleGlobalRouting:eR,onInboundChange:tR,onOutboundChange:nR,onCreateEntry:sR,onRemoveEntry:cR,onOpenWebSearchTab:()=>w("web-search"),onOpenConfigPath:()=>li(D?.settingsFilePath,"AMP config file",{ensureMode:"jsonObject",successMessage:"Opened AMP config file in the default app."}),onOpenSecretsPath:()=>li(D?.secretsFilePath,"AMP secrets file",{ensureMode:"jsonObject",successMessage:"Opened AMP secrets file in the default app."}),hasMasterKey:!!String(Mt?.masterKey||"").trim(),disabledReason:Bn,autosaveState:me})}),(0,l.jsx)(_r,{value:"codex-cli",className:"space-y-4",children:(0,l.jsx)(sC,{toolName:"Codex CLI",toolState:G,endpointUrl:G?.configuredBaseUrl||`${A?`${A}/openai/v1`:""}`,routeOptions:BC,connectionBusy:z,bindingBusy:V,onToggleRouting:mR,onBindingChange:gR,hasMasterKey:!!dn,disabledReason:oi,onOpenPrimaryPath:()=>li(G?.configFilePath,"Codex CLI config file",{ensureMode:"text",successMessage:"Opened Codex CLI config file in the default app."}),onOpenSecondaryPath:()=>li(G?.backupFilePath,"Codex CLI backup file",{ensureMode:"jsonObject",successMessage:"Opened Codex CLI backup file in the default app."}),guideContent:p2({bindingValue:G?.bindings?.defaultModel,thinkingLevel:G?.bindings?.thinkingLevel,configFilePath:G?.configFilePath,endpointUrl:G?.configuredBaseUrl||`${A?`${A}/openai/v1`:""}`}),bindingFields:[{id:"defaultModel",label:"Default model",description:"Choose a managed route/alias to set Codex CLI `model`, or use Inherit Codex CLI model to keep Codex built-in model names and route them through same-name LLM Router aliases.",envKey:"model",value:G?.bindings?.defaultModel||"",allowUnset:!1,placeholder:"Select a default route",extraOptions:[{value:Kg,label:"Inherit Codex CLI model",hint:"Keep Codex built-in model names; route them via same-name aliases in LLM Router"}]},{id:"thinkingLevel",label:"Thinking level",description:"Maps to Codex CLI `model_reasoning_effort`. Official values are `minimal`, `low`, `medium`, `high`, and `xhigh` (`xhigh` is model-dependent).",envKey:"model_reasoning_effort",value:G?.bindings?.thinkingLevel||"",allowUnset:!0,usesRouteOptions:!1,placeholder:"Inherit Codex default",options:Rk}]})}),(0,l.jsx)(_r,{value:"claude-code",className:"space-y-4",children:(0,l.jsx)(sC,{toolName:"Claude Code",toolState:$,endpointUrl:$?.configuredBaseUrl||`${A?`${A}/anthropic`:""}`,routeOptions:IC,connectionBusy:W,bindingBusy:F,onToggleRouting:pR,onBindingChange:hR,hasMasterKey:!!dn,disabledReason:oi,onOpenPrimaryPath:()=>li($?.settingsFilePath,"Claude Code config file",{ensureMode:"jsonObject",successMessage:"Opened Claude Code config file in the default app."}),onOpenSecondaryPath:()=>li($?.backupFilePath,"Claude Code backup file",{ensureMode:"jsonObject",successMessage:"Opened Claude Code backup file in the default app."}),guideContent:g2({bindings:$?.bindings,settingsFilePath:$?.settingsFilePath,endpointUrl:$?.configuredBaseUrl||`${A?`${A}/anthropic`:""}`}),bindingFields:[{id:"primaryModel",label:"Current model override",description:"Optional. Set `ANTHROPIC_MODEL` only when you want to override Claude Code\u2019s own `model` setting with a managed route or alias.",envKey:"ANTHROPIC_MODEL",value:$?.bindings?.primaryModel||"",allowUnset:!0,placeholder:"Inherit Claude Code default"},{id:"defaultOpusModel",label:"Default Opus",description:"Maps `ANTHROPIC_DEFAULT_OPUS_MODEL` so Claude Code\u2019s `opus` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",value:$?.bindings?.defaultOpusModel||"",allowUnset:!0,placeholder:"Select an Opus route"},{id:"defaultSonnetModel",label:"Default Sonnet",description:"Maps `ANTHROPIC_DEFAULT_SONNET_MODEL` so Claude Code\u2019s `sonnet` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",value:$?.bindings?.defaultSonnetModel||"",allowUnset:!0,placeholder:"Select a Sonnet route"},{id:"defaultHaikuModel",label:"Default Haiku",description:"Maps `ANTHROPIC_DEFAULT_HAIKU_MODEL` so Claude Code\u2019s `haiku` alias points to a managed route or alias.",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",value:$?.bindings?.defaultHaikuModel||"",allowUnset:!0,placeholder:"Select a Haiku route"},{id:"subagentModel",label:"Sub-agent model",description:"Maps `CLAUDE_CODE_SUBAGENT_MODEL` for Claude Code sub-agents and background workers.",envKey:"CLAUDE_CODE_SUBAGENT_MODEL",value:$?.bindings?.subagentModel||"",allowUnset:!0,placeholder:"Select a sub-agent route"},{id:"thinkingLevel",label:"Effort level",description:'Sets `CLAUDE_CODE_EFFORT_LEVEL` in your shell profile (~/.zshrc or ~/.bashrc). Falls back to `effortLevel` in settings.json (only "high") if shell profile cannot be updated.',envKey:"CLAUDE_CODE_EFFORT_LEVEL",value:$?.bindings?.thinkingLevel||"",allowUnset:!0,usesRouteOptions:!1,standaloneWhenDisconnected:!0,placeholder:"Inherit Claude Code adaptive default",options:Ek}]})}),(0,l.jsx)(_r,{value:"web-search",className:"space-y-4",children:(0,l.jsx)(gL,{webSearchConfig:qe,webSearchProviders:un,hostedSearchCandidates:po,onWebSearchStrategyChange:rR,onWebSearchProviderChange:aR,onWebSearchProviderMove:oR,onRemoveWebSearchProvider:iR,onAddHostedSearchEndpoint:lR,disabledReason:ir,autosaveState:me})}),(0,l.jsx)(_r,{value:"activity",children:(0,l.jsx)(bL,{logs:e?.logs||[],activityLogEnabled:yt,activityFilter:Se,busyAction:Z,onActivityFilterChange:U,onToggleEnabled:vR,onClear:bR})})]}),(0,l.jsx)(Sa,{open:jC,onClose:qd,title:"Add provider",description:"Add another provider with endpoints, model ids, rate limits, and a stable alias. API Key providers are auto-tested before save.",contentClassName:"max-h-[92vh] max-w-5xl rounded-2xl border border-border/70 bg-background/98 shadow-[0_32px_120px_rgba(15,23,42,0.48)]",bodyClassName:"max-h-[calc(92vh-5.5rem)]",children:(0,l.jsx)(uC,{baseConfig:fe,seedMode:"blank",mode:"add",targetProviderId:"",defaultProviderUserAgent:Ch,onApplyDraft:Th,onValidateDraft:Mh,onSaveDraft:uR,onSaveAndStart:dR,framed:!1,showHeader:!1},`provider-wizard-modal-${H}`)})]})})}var zC=K(Be(),1),LC=document.getElementById("app");LC&&(0,DC.createRoot)(LC).render((0,zC.jsx)(kC,{}));})();