@kaitranntt/ccs 7.50.0-dev.4 → 7.50.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cliproxy/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/account-safety.js +4 -0
- package/dist/cliproxy/account-safety.js.map +1 -1
- package/dist/cliproxy/antigravity-responsibility.d.ts +36 -0
- package/dist/cliproxy/antigravity-responsibility.d.ts.map +1 -0
- package/dist/cliproxy/antigravity-responsibility.js +171 -0
- package/dist/cliproxy/antigravity-responsibility.js.map +1 -0
- package/dist/cliproxy/auth/auth-types.d.ts +2 -0
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +18 -0
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +30 -0
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +5 -0
- package/dist/commands/help-command.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +11 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +127 -59
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +14 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +8 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/ui/assets/{accounts-B3RlymZc.js → accounts-Cv9gdSl_.js} +1 -1
- package/dist/ui/assets/{alert-dialog-CuEMPUz1.js → alert-dialog-Cbz7hjbH.js} +1 -1
- package/dist/ui/assets/{api-B2ICvWzi.js → api-CtPIBYPJ.js} +1 -1
- package/dist/ui/assets/auth-section-DDB-gXA-.js +1 -0
- package/dist/ui/assets/{backups-section-D-sat7Ti.js → backups-section-f3TrZYc_.js} +1 -1
- package/dist/ui/assets/{checkbox-C-12mTDT.js → checkbox-DyM_OviW.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-3uthxEI-.js → cliproxy-control-panel-D-0qYG1v.js} +1 -1
- package/dist/ui/assets/cliproxy-nwnHc6Ex.js +3 -0
- package/dist/ui/assets/{confirm-dialog-BfiBvMqW.js → confirm-dialog-B1DNTIER.js} +1 -1
- package/dist/ui/assets/{copilot-Dz0B1ZUz.js → copilot-CsbHY1RT.js} +1 -1
- package/dist/ui/assets/{cursor-DdPXjHsr.js → cursor-Dae1NLqC.js} +1 -1
- package/dist/ui/assets/{droid-DE-zbt4u.js → droid-BQLHOVuB.js} +1 -1
- package/dist/ui/assets/{globalenv-section-BKbOddIv.js → globalenv-section-DryB5ety.js} +1 -1
- package/dist/ui/assets/{health-Bu6uaf__.js → health-DXE1K5e_.js} +1 -1
- package/dist/ui/assets/{icons-ErRLeJ3U.js → icons-D7XDTBCN.js} +1 -1
- package/dist/ui/assets/index-BDygjMjY.js +1 -0
- package/dist/ui/assets/{index-Dzby9K4O.js → index-BGM7ArZ-.js} +1 -1
- package/dist/ui/assets/{index-zgEA-GkK.js → index-BOyrh__4.js} +4 -4
- package/dist/ui/assets/index-C5CDmWs5.css +1 -0
- package/dist/ui/assets/{index-D1DFI7Lj.js → index-Dt0OpGYK.js} +1 -1
- package/dist/ui/assets/{index-Cl-418Sf.js → index-n1iv9ylt.js} +1 -1
- package/dist/ui/assets/proxy-status-widget-Bvi7eWkI.js +1 -0
- package/dist/ui/assets/{separator-sNDYgSUT.js → separator-DrB7U5vm.js} +1 -1
- package/dist/ui/assets/{shared-qWuCxx8B.js → shared-ByrShSly.js} +1 -1
- package/dist/ui/assets/{switch-BdRPtxoo.js → switch-JJlvFHut.js} +1 -1
- package/dist/ui/assets/{updates-BIpeiM6l.js → updates-BUBIr73T.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +58 -24
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +110 -12
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/auth-section-47vsG_g9.js +0 -1
- package/dist/ui/assets/cliproxy-CAR-zTil.js +0 -3
- package/dist/ui/assets/index-CjJDhkhP.css +0 -1
- package/dist/ui/assets/index-DNyQOJ27.js +0 -1
- package/dist/ui/assets/proxy-status-widget-BtL-jVdm.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as i,S as Fr,R as Dg,C as kg,a as Rg,T as Ug,D as Lg,P as Bg,O as Hg,b as k0,c as R0,d as U0,e as L0,f as B0,A as H0,g as q0,h as Y0,i as K0,k as G0,l as Q0,m as P0,n as V0,I as X0,o as qg,V as W0,p as I0,q as Yg,r as Z0,s as Kg,t as $0,u as Gg,v as Qg,w as F0,x as Pg,y as J0,L as Vg,z as Xg,B as eb,E as tb,F as Wg,G as nb,H as ab,J as lb,K as Ig,M as Zg,N as $g,Q as sb,U as ib,W as rb,X as Fg,Y as ob,Z as cb,_ as ub}from"./radix-ui-DIWAxjEp.js";import{e as Jg,f as db,r as x,u as nd,O as Pu,N as fb,h as ad,L as Vu,R as mb,g as hb,i as pb,c as ee,B as gb,j as yb,k as Dt}from"./react-vendor-CNOkPC89.js";import{Q as xb,u as _t,a as ct,b as mt,c as vb}from"./tanstack-Hn82hibe.js";import{t as le,T as bb}from"./notifications-B2HqRBj7.js";import{L as Mn,X as hs,P as Sb,H as Nb,C as jb,K as ey,G as wb,Z as ty,a as ny,F as ay,U as ly,S as Cb,A as bi,b as Eb,c as Jr,d as Mb,M as Ab,E as eo,e as to,B as Tb,R as Si,W as Ob,f as _b,g as zb,h as Db,i as kp,j as Rp,k as fs,l as ld,m as Wr,n as sy,o as kb,p as Rb,q as Ni,r as no,s as sd,t as Ub,u as Lb,v as ao,w as Bb,T as pa,x as Hb,y as qb,I as lo,z as Yb,D as Kb,J as Gb,N as Qb,O as Pb,Q as Vb,V as Xb,Y as so,_ as id,$ as rd,a0 as Up,a1 as Wb,a2 as od,a3 as Ib,a4 as Zb,a5 as $b,a6 as Fb,a7 as Lp,a8 as Jb,a9 as eS}from"./icons-ErRLeJ3U.js";import{t as tS,c as nS,a as io,e as di,f as hi,b as aS,d as lS,g as sS,h as iS,i as rS,j as oS,k as cS,l as uS,m as dS,n as fS,o as mS,p as hS,q as pS,r as gS,s as yS,u as xS,v as vS,w as bS,x as SS,y as NS,z as jS,A as wS,B as CS,C as ES,D as MS,E as AS,F as TS,G as OS,H as _S,I as zS,J as DS}from"./utils-CzKF5WmX.js";import{o as Bp,s as Hp,p as kS,a as RS,$ as US,b as iy,c as LS,_ as BS,d as hl,u as HS,e as qp}from"./form-utils-Cn_Uld6y.js";import{H as qS,t as Yp}from"./code-highlight-BRUf_pqB.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&c(m)}).observe(document,{childList:!0,subtree:!0});function r(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(d){if(d.ep)return;d.ep=!0;const f=r(d);fetch(d.href,f)}})();var Au={exports:{}},fi={},Tu={exports:{}},Ou={};var Kp;function YS(){return Kp||(Kp=1,(function(a){function l(k,W){var V=k.length;k.push(W);e:for(;0<V;){var oe=V-1>>>1,de=k[oe];if(0<d(de,W))k[oe]=W,k[V]=de,V=oe;else break e}}function r(k){return k.length===0?null:k[0]}function c(k){if(k.length===0)return null;var W=k[0],V=k.pop();if(V!==W){k[0]=V;e:for(var oe=0,de=k.length,Oe=de>>>1;oe<Oe;){var ze=2*(oe+1)-1,X=k[ze],$=ze+1,ne=k[$];if(0>d(X,V))$<de&&0>d(ne,X)?(k[oe]=ne,k[$]=V,oe=$):(k[oe]=X,k[ze]=V,oe=ze);else if($<de&&0>d(ne,V))k[oe]=ne,k[$]=V,oe=$;else break e}}return W}function d(k,W){var V=k.sortIndex-W.sortIndex;return V!==0?V:k.id-W.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,p=m.now();a.unstable_now=function(){return m.now()-p}}var g=[],b=[],C=1,v=null,S=3,M=!1,A=!1,R=!1,z=!1,_=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;function H(k){for(var W=r(b);W!==null;){if(W.callback===null)c(b);else if(W.startTime<=k)c(b),W.sortIndex=W.expirationTime,l(g,W);else break;W=r(b)}}function B(k){if(R=!1,H(k),!A)if(r(g)!==null)A=!0,N||(N=!0,re());else{var W=r(b);W!==null&&be(B,W.startTime-k)}}var N=!1,G=-1,I=5,J=-1;function ie(){return z?!0:!(a.unstable_now()-J<I)}function ve(){if(z=!1,N){var k=a.unstable_now();J=k;var W=!0;try{e:{A=!1,R&&(R=!1,L(G),G=-1),M=!0;var V=S;try{t:{for(H(k),v=r(g);v!==null&&!(v.expirationTime>k&&ie());){var oe=v.callback;if(typeof oe=="function"){v.callback=null,S=v.priorityLevel;var de=oe(v.expirationTime<=k);if(k=a.unstable_now(),typeof de=="function"){v.callback=de,H(k),W=!0;break t}v===r(g)&&c(g),H(k)}else c(g);v=r(g)}if(v!==null)W=!0;else{var Oe=r(b);Oe!==null&&be(B,Oe.startTime-k),W=!1}}break e}finally{v=null,S=V,M=!1}W=void 0}}finally{W?re():N=!1}}}var re;if(typeof K=="function")re=function(){K(ve)};else if(typeof MessageChannel<"u"){var Be=new MessageChannel,Se=Be.port2;Be.port1.onmessage=ve,re=function(){Se.postMessage(null)}}else re=function(){_(ve,0)};function be(k,W){G=_(function(){k(a.unstable_now())},W)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(k){k.callback=null},a.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<k?Math.floor(1e3/k):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(k){switch(S){case 1:case 2:case 3:var W=3;break;default:W=S}var V=S;S=W;try{return k()}finally{S=V}},a.unstable_requestPaint=function(){z=!0},a.unstable_runWithPriority=function(k,W){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var V=S;S=k;try{return W()}finally{S=V}},a.unstable_scheduleCallback=function(k,W,V){var oe=a.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?oe+V:oe):V=oe,k){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=V+de,k={id:C++,callback:W,priorityLevel:k,startTime:V,expirationTime:de,sortIndex:-1},V>oe?(k.sortIndex=V,l(b,k),r(g)===null&&k===r(b)&&(R?(L(G),G=-1):R=!0,be(B,V-oe))):(k.sortIndex=de,l(g,k),A||M||(A=!0,N||(N=!0,re()))),k},a.unstable_shouldYield=ie,a.unstable_wrapCallback=function(k){var W=S;return function(){var V=S;S=W;try{return k.apply(this,arguments)}finally{S=V}}}})(Ou)),Ou}var Gp;function KS(){return Gp||(Gp=1,Tu.exports=YS()),Tu.exports}var Qp;function GS(){if(Qp)return fi;Qp=1;var a=KS(),l=Jg(),r=db();function c(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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(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 m(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 p(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 g(e){if(f(e)!==e)throw Error(c(188))}function b(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,s=t;;){var o=n.return;if(o===null)break;var u=o.alternate;if(u===null){if(s=o.return,s!==null){n=s;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===n)return g(o),e;if(u===s)return g(o),t;u=u.sibling}throw Error(c(188))}if(n.return!==s.return)n=o,s=u;else{for(var h=!1,y=o.child;y;){if(y===n){h=!0,n=o,s=u;break}if(y===s){h=!0,s=o,n=u;break}y=y.sibling}if(!h){for(y=u.child;y;){if(y===n){h=!0,n=u,s=o;break}if(y===s){h=!0,s=u,n=o;break}y=y.sibling}if(!h)throw Error(c(189))}}if(n.alternate!==s)throw Error(c(190))}if(n.tag!==3)throw Error(c(188));return n.stateNode.current===n?e:t}function C(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=C(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),K=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ve=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ve&&e[ve]||e["@@iterator"],typeof e=="function"?e:null)}var Be=Symbol.for("react.client.reference");function Se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case _:return"Profiler";case z:return"StrictMode";case B:return"Suspense";case N:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case K:return e.displayName||"Context";case L:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:Se(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}var be=Array.isArray,k=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},oe=[],de=-1;function Oe(e){return{current:e}}function ze(e){0>de||(e.current=oe[de],oe[de]=null,de--)}function X(e,t){de++,oe[de]=e.current,e.current=t}var $=Oe(null),ne=Oe(null),F=Oe(null),te=Oe(null);function he(e,t){switch(X(F,t),X(ne,e),X($,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ap(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ap(t),e=lp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ze($),X($,e)}function _e(){ze($),ze(ne),ze(F)}function Ke(e){e.memoizedState!==null&&X(te,e);var t=$.current,n=lp(t,e.type);t!==n&&(X(ne,e),X($,n))}function vt(e){ne.current===e&&(ze($),ze(ne)),te.current===e&&(ze(te),ri._currentValue=V)}var bt,Qe;function tt(e){if(bt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);bt=t&&t[1]||"",Qe=-1<n.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGM7ArZ-.js","assets/radix-ui-DIWAxjEp.js","assets/react-vendor-CNOkPC89.js","assets/switch-JJlvFHut.js","assets/icons-D7XDTBCN.js","assets/tanstack-Hn82hibe.js","assets/notifications-B2HqRBj7.js","assets/utils-CzKF5WmX.js","assets/form-utils-Cn_Uld6y.js","assets/code-highlight-BRUf_pqB.js","assets/globalenv-section-DryB5ety.js","assets/index-Dt0OpGYK.js","assets/index-BDygjMjY.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-Bvi7eWkI.js","assets/alert-dialog-Cbz7hjbH.js","assets/auth-section-DDB-gXA-.js","assets/backups-section-f3TrZYc_.js","assets/index-n1iv9ylt.js","assets/charts-BBPXh0Ar.js","assets/api-CtPIBYPJ.js","assets/confirm-dialog-B1DNTIER.js","assets/separator-DrB7U5vm.js","assets/cliproxy-nwnHc6Ex.js","assets/checkbox-DyM_OviW.js","assets/cliproxy-control-panel-D-0qYG1v.js","assets/copilot-CsbHY1RT.js","assets/cursor-Dae1NLqC.js","assets/droid-BQLHOVuB.js","assets/accounts-Cv9gdSl_.js","assets/health-DXE1K5e_.js","assets/shared-ByrShSly.js","assets/updates-BUBIr73T.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as i,S as Fr,R as Dg,C as kg,a as Rg,T as Ug,D as Lg,P as Bg,O as Hg,b as k0,c as R0,d as U0,e as L0,f as B0,A as H0,g as q0,h as Y0,i as K0,k as G0,l as Q0,m as P0,n as V0,I as X0,o as qg,V as W0,p as I0,q as Yg,r as Z0,s as Kg,t as $0,u as Gg,v as Qg,w as F0,x as Pg,y as J0,L as Vg,z as Xg,B as eb,E as tb,F as Wg,G as nb,H as ab,J as lb,K as Ig,M as Zg,N as $g,Q as sb,U as ib,W as rb,X as Fg,Y as ob,Z as cb,_ as ub}from"./radix-ui-DIWAxjEp.js";import{e as Jg,f as db,r as x,u as nd,O as Pu,N as fb,h as ad,L as Vu,R as mb,g as hb,i as pb,c as ee,B as gb,j as yb,k as Dt}from"./react-vendor-CNOkPC89.js";import{Q as xb,u as _t,a as ct,b as mt,c as vb}from"./tanstack-Hn82hibe.js";import{t as le,T as bb}from"./notifications-B2HqRBj7.js";import{L as Mn,X as hs,P as Sb,H as Nb,C as jb,K as ey,G as wb,Z as ty,a as ny,F as ay,U as ly,S as Cb,A as bi,b as Eb,c as Jr,d as Mb,M as Ab,E as eo,e as to,B as Tb,R as Si,W as Ob,f as _b,g as zb,h as Db,i as kp,j as Rp,k as fs,l as ld,m as Wr,n as sy,o as kb,p as Rb,q as Ni,r as no,s as sd,t as Ub,u as Lb,v as ao,w as Bb,T as pa,x as Hb,y as qb,I as lo,z as Yb,D as Kb,J as Gb,N as Qb,O as Pb,Q as Vb,V as Xb,Y as so,_ as id,$ as rd,a0 as Up,a1 as Wb,a2 as od,a3 as Ib,a4 as Zb,a5 as $b,a6 as Fb,a7 as Lp,a8 as Jb,a9 as eS}from"./icons-D7XDTBCN.js";import{t as tS,c as nS,a as io,e as di,f as hi,b as aS,d as lS,g as sS,h as iS,i as rS,j as oS,k as cS,l as uS,m as dS,n as fS,o as mS,p as hS,q as pS,r as gS,s as yS,u as xS,v as vS,w as bS,x as SS,y as NS,z as jS,A as wS,B as CS,C as ES,D as MS,E as AS,F as TS,G as OS,H as _S,I as zS,J as DS}from"./utils-CzKF5WmX.js";import{o as Bp,s as Hp,p as kS,a as RS,$ as US,b as iy,c as LS,_ as BS,d as hl,u as HS,e as qp}from"./form-utils-Cn_Uld6y.js";import{H as qS,t as Yp}from"./code-highlight-BRUf_pqB.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&c(m)}).observe(document,{childList:!0,subtree:!0});function r(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(d){if(d.ep)return;d.ep=!0;const f=r(d);fetch(d.href,f)}})();var Au={exports:{}},fi={},Tu={exports:{}},Ou={};var Kp;function YS(){return Kp||(Kp=1,(function(a){function l(k,W){var V=k.length;k.push(W);e:for(;0<V;){var oe=V-1>>>1,de=k[oe];if(0<d(de,W))k[oe]=W,k[V]=de,V=oe;else break e}}function r(k){return k.length===0?null:k[0]}function c(k){if(k.length===0)return null;var W=k[0],V=k.pop();if(V!==W){k[0]=V;e:for(var oe=0,de=k.length,Oe=de>>>1;oe<Oe;){var ze=2*(oe+1)-1,X=k[ze],$=ze+1,ne=k[$];if(0>d(X,V))$<de&&0>d(ne,X)?(k[oe]=ne,k[$]=V,oe=$):(k[oe]=X,k[ze]=V,oe=ze);else if($<de&&0>d(ne,V))k[oe]=ne,k[$]=V,oe=$;else break e}}return W}function d(k,W){var V=k.sortIndex-W.sortIndex;return V!==0?V:k.id-W.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,p=m.now();a.unstable_now=function(){return m.now()-p}}var g=[],b=[],C=1,v=null,S=3,M=!1,A=!1,R=!1,z=!1,_=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;function H(k){for(var W=r(b);W!==null;){if(W.callback===null)c(b);else if(W.startTime<=k)c(b),W.sortIndex=W.expirationTime,l(g,W);else break;W=r(b)}}function B(k){if(R=!1,H(k),!A)if(r(g)!==null)A=!0,N||(N=!0,re());else{var W=r(b);W!==null&&be(B,W.startTime-k)}}var N=!1,G=-1,I=5,J=-1;function ie(){return z?!0:!(a.unstable_now()-J<I)}function ve(){if(z=!1,N){var k=a.unstable_now();J=k;var W=!0;try{e:{A=!1,R&&(R=!1,L(G),G=-1),M=!0;var V=S;try{t:{for(H(k),v=r(g);v!==null&&!(v.expirationTime>k&&ie());){var oe=v.callback;if(typeof oe=="function"){v.callback=null,S=v.priorityLevel;var de=oe(v.expirationTime<=k);if(k=a.unstable_now(),typeof de=="function"){v.callback=de,H(k),W=!0;break t}v===r(g)&&c(g),H(k)}else c(g);v=r(g)}if(v!==null)W=!0;else{var Oe=r(b);Oe!==null&&be(B,Oe.startTime-k),W=!1}}break e}finally{v=null,S=V,M=!1}W=void 0}}finally{W?re():N=!1}}}var re;if(typeof K=="function")re=function(){K(ve)};else if(typeof MessageChannel<"u"){var Be=new MessageChannel,Se=Be.port2;Be.port1.onmessage=ve,re=function(){Se.postMessage(null)}}else re=function(){_(ve,0)};function be(k,W){G=_(function(){k(a.unstable_now())},W)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(k){k.callback=null},a.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<k?Math.floor(1e3/k):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(k){switch(S){case 1:case 2:case 3:var W=3;break;default:W=S}var V=S;S=W;try{return k()}finally{S=V}},a.unstable_requestPaint=function(){z=!0},a.unstable_runWithPriority=function(k,W){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var V=S;S=k;try{return W()}finally{S=V}},a.unstable_scheduleCallback=function(k,W,V){var oe=a.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?oe+V:oe):V=oe,k){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=V+de,k={id:C++,callback:W,priorityLevel:k,startTime:V,expirationTime:de,sortIndex:-1},V>oe?(k.sortIndex=V,l(b,k),r(g)===null&&k===r(b)&&(R?(L(G),G=-1):R=!0,be(B,V-oe))):(k.sortIndex=de,l(g,k),A||M||(A=!0,N||(N=!0,re()))),k},a.unstable_shouldYield=ie,a.unstable_wrapCallback=function(k){var W=S;return function(){var V=S;S=W;try{return k.apply(this,arguments)}finally{S=V}}}})(Ou)),Ou}var Gp;function KS(){return Gp||(Gp=1,Tu.exports=YS()),Tu.exports}var Qp;function GS(){if(Qp)return fi;Qp=1;var a=KS(),l=Jg(),r=db();function c(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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(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 m(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 p(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 g(e){if(f(e)!==e)throw Error(c(188))}function b(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,s=t;;){var o=n.return;if(o===null)break;var u=o.alternate;if(u===null){if(s=o.return,s!==null){n=s;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===n)return g(o),e;if(u===s)return g(o),t;u=u.sibling}throw Error(c(188))}if(n.return!==s.return)n=o,s=u;else{for(var h=!1,y=o.child;y;){if(y===n){h=!0,n=o,s=u;break}if(y===s){h=!0,s=o,n=u;break}y=y.sibling}if(!h){for(y=u.child;y;){if(y===n){h=!0,n=u,s=o;break}if(y===s){h=!0,s=u,n=o;break}y=y.sibling}if(!h)throw Error(c(189))}}if(n.alternate!==s)throw Error(c(190))}if(n.tag!==3)throw Error(c(188));return n.stateNode.current===n?e:t}function C(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=C(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),K=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ve=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ve&&e[ve]||e["@@iterator"],typeof e=="function"?e:null)}var Be=Symbol.for("react.client.reference");function Se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case _:return"Profiler";case z:return"StrictMode";case B:return"Suspense";case N:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case K:return e.displayName||"Context";case L:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:Se(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}var be=Array.isArray,k=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},oe=[],de=-1;function Oe(e){return{current:e}}function ze(e){0>de||(e.current=oe[de],oe[de]=null,de--)}function X(e,t){de++,oe[de]=e.current,e.current=t}var $=Oe(null),ne=Oe(null),F=Oe(null),te=Oe(null);function he(e,t){switch(X(F,t),X(ne,e),X($,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ap(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ap(t),e=lp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ze($),X($,e)}function _e(){ze($),ze(ne),ze(F)}function Ke(e){e.memoizedState!==null&&X(te,e);var t=$.current,n=lp(t,e.type);t!==n&&(X(ne,e),X($,n))}function vt(e){ne.current===e&&(ze($),ze(ne)),te.current===e&&(ze(te),ri._currentValue=V)}var bt,Qe;function tt(e){if(bt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);bt=t&&t[1]||"",Qe=-1<n.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+bt+e+Qe}var Rt=!1;function Pt(e,t){if(!e||Rt)return"";Rt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(U){var D=U}Reflect.construct(e,[],P)}else{try{P.call()}catch(U){D=U}e.call(P.prototype)}}else{try{throw Error()}catch(U){D=U}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(U){if(U&&D&&typeof U.stack=="string")return[U.stack,D.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),h=u[0],y=u[1];if(h&&y){var j=h.split(`
|
|
5
5
|
`),O=y.split(`
|
|
@@ -11,7 +11,7 @@ Error generating stack: `+s.message+`
|
|
|
11
11
|
`);for(const c of r){const[d,...f]=c.split(":"),m=f.join(":").trim();switch(d?.trim()?.toLowerCase()){case"version":l.version=m;break;case"url":l.url=m;break;case"method":l.method=m;break;case"timestamp":l.timestamp=m;break}}}function bw(a){const l={},r=a.split(`
|
|
12
12
|
`);for(const c of r){const d=c.indexOf(":");if(d>0){const f=c.slice(0,d).trim(),m=c.slice(d+1).trim();f&&(l[f]=m)}}return l}function Sw(a,l){const r=a.split(`
|
|
13
13
|
`);let c=!1;const d=[];for(const f of r){if(f.startsWith("Status:")){const p=f.replace("Status:","").trim().split(/\s+/);l.statusCode=parseInt(p[0],10)||0,l.statusText=p.slice(1).join(" ")||Cw(l.statusCode);continue}if(f.trim()===""&&!c){c=!0;continue}if(c)d.push(f);else{const m=f.indexOf(":");if(m>0){const p=f.slice(0,m).trim(),g=f.slice(m+1).trim();p&&(l.responseHeaders[p]=g)}}}l.responseBody=d.join(`
|
|
14
|
-
`).trim()}function Nw(a){const l=a.url.match(/\/api\/provider\/([^/]+)/);l&&(a.provider=l[1]);const r=a.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);r&&(a.endpoint=r[1]),a.isClientError=a.statusCode>=400&&a.statusCode<500,a.isServerError=a.statusCode>=500,a.statusCode===429?a.errorType="rate_limit":a.statusCode===401||a.statusCode===403?a.errorType="auth":a.statusCode===404?a.errorType="not_found":a.statusCode>=500?a.errorType="server":(a.statusCode===408||a.statusCode===504)&&(a.errorType="timeout"),jw(a),a.statusCode===429&&ww(a)}function jw(a){if(a.requestBody)try{const l=JSON.parse(a.requestBody);typeof l.model=="string"&&(a.model=l.model)}catch{}}function ww(a){if(a.responseBody)try{const l=JSON.parse(a.responseBody),r=Zu(l);r!==null&&(a.quotaResetDelay=r);const c=$u(l);c&&(a.quotaResetTimestamp=c)}catch{}}function Zu(a){if(typeof a!="object"||a===null)return null;const l=a;if("quotaResetDelay"in l){const r=l.quotaResetDelay;if(typeof r=="number")return r;if(typeof r=="string"){const c=r.match(/^(\d+)s?$/);if(c)return parseInt(c[1],10)}}if("error"in l&&typeof l.error=="object"){const r=Zu(l.error);if(r!==null)return r}if("details"in l&&Array.isArray(l.details))for(const r of l.details){const c=Zu(r);if(c!==null)return c}return null}function $u(a){if(typeof a!="object"||a===null)return null;const l=a;for(const r of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(r in l&&typeof l[r]=="string")return l[r];if("error"in l&&typeof l.error=="object"){const r=$u(l.error);if(r)return r}if("details"in l&&Array.isArray(l.details))for(const r of l.details){const c=$u(r);if(c)return c}return null}function Cw(a){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[a]||""}function Ew(a){const l=Date.now(),r=a*1e3,c=l-r,d=Math.floor(c/1e3),f=Math.floor(d/60),m=Math.floor(f/60),p=Math.floor(m/24);return d<60?"just now":f<60?`${f}m ago`:m<24?`${m}h ago`:p<7?`${p}d ago`:new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Mw(a){return a>=500?"text-red-500":a===429?"text-orange-500":a>=400?"text-yellow-500":"text-gray-500"}function Aw(a){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[a]||"Error"}function Tw(a){if(a===null||a<=0)return null;if(a<60)return`${a}s`;if(a<3600)return`${Math.floor(a/60)}m`;const l=Math.floor(a/3600),r=Math.floor(a%3600/60);return r>0?`${l}h ${r}m`:`${l}h`}function Ow(a){if(!a)return null;try{const l=new Date(a),r=new Date,c=l.getTime()-r.getTime();if(c<=0)return"now";const d=Math.floor(c/1e3);if(d<60)return`${d}s`;if(d<3600)return`${Math.floor(d/60)}m`;const f=Math.floor(d/3600),m=Math.floor(d%3600/60);return m>0?`${f}h ${m}m`:`${f}h`}catch{return null}}function _w(a){return a?a===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":a>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":a>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function zw(a){return a||""}function Dw({name:a,size:l,modified:r,isSelected:c,onClick:d,statusCode:f,model:m}){const p=x.useMemo(()=>yw(a),[a]),g=x.useMemo(()=>zw(m),[m]);return i.jsxs("button",{onClick:d,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",c?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[i.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",_w(f)),children:f||"???"}),i.jsx(Cd,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[i.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),g&&i.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:g,children:g}),i.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[i.jsx(Ni,{className:"w-2.5 h-2.5"}),i.jsx("span",{children:Ew(r)})]})]})]})}function ug({value:a,className:l,variant:r="outline",size:c="icon",label:d="Copy to clipboard"}){const[f,m]=x.useState(!1),p=()=>{navigator.clipboard.writeText(a),m(!0),setTimeout(()=>m(!1),2e3)};return i.jsx(yl,{children:i.jsxs(Pa,{children:[i.jsx(Va,{asChild:!0,children:i.jsxs(ot,{size:c,variant:r,className:q("relative z-10 text-muted-foreground hover:text-foreground",l),onClick:g=>{g.stopPropagation(),p()},children:[f?i.jsx(fs,{className:"h-3.5 w-3.5 text-green-500"}):i.jsx(Wr,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:d})]})}),i.jsx(Xa,{children:i.jsx("p",{children:f?"Copied!":d})})]})})}function mi({active:a,onClick:l,children:r,icon:c}){return i.jsxs("button",{onClick:l,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",a?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[c&&i.jsx(c,{className:"w-3.5 h-3.5"}),r]})}function Hy({code:a}){const l=Mw(a);return i.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",l),children:a})}function kw({parsed:a}){const l=Tw(a.quotaResetDelay)||Ow(a.quotaResetTimestamp);return i.jsx(Sl,{className:"h-full",children:i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Hy,{code:a.statusCode}),i.jsx("span",{className:"text-sm font-medium",children:a.statusText}),i.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:Aw(a.errorType)})]}),a.model&&i.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[i.jsx(qb,{className:"w-4 h-4 text-violet-500 shrink-0"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Model: "}),i.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:a.model})]})]}),a.errorType==="rate_limit"&&l&&i.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[i.jsx(Ni,{className:"w-4 h-4 text-amber-500 shrink-0"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Quota resets in "}),i.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:l})]})]}),i.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),i.jsx("div",{className:"font-medium",children:a.method||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),i.jsx("div",{className:"font-medium",children:a.provider||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),i.jsx("div",{className:"font-medium",children:a.version||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),i.jsx("div",{className:"font-medium truncate",title:a.endpoint,children:a.endpoint||"N/A"})]})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),i.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:a.url||"N/A"})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),i.jsx("div",{className:"font-mono",children:a.timestamp||"N/A"})]}),a.errorType!=="unknown"&&i.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",a.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":a.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[a.errorType==="rate_limit"?i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):a.errorType==="auth"?i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):i.jsx(lo,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),i.jsxs("div",{className:q("leading-relaxed",a.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":a.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[a.errorType==="rate_limit"&&i.jsxs(i.Fragment,{children:[i.jsx("strong",{children:"Rate Limited."})," Switch to a different account or wait for quota reset.",a.model&&i.jsxs(i.Fragment,{children:[" ","Model ",i.jsx("code",{className:"font-mono text-[11px]",children:a.model})," has exhausted quota."]})]}),a.errorType==="auth"&&"Authentication failed. Re-authenticate via CLIProxy Settings or check API key.",a.errorType==="not_found"&&"Endpoint not found. This endpoint may not exist on this provider.",a.errorType==="server"&&"Server error from upstream. Retry later or check provider status page.",a.errorType==="timeout"&&"Request timed out. Check network connection or increase timeout settings."]})]})]})})}function Rw({headers:a}){const l=Object.entries(a);return l.length===0?i.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):i.jsx(Sl,{className:"h-full",children:i.jsx("div",{className:"p-4 space-y-1",children:l.map(([r,c])=>i.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[i.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),i.jsx("span",{className:"break-all",children:c})]},r))})})}function dg({content:a,label:l}){if(!a||a.trim()==="")return i.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",l.toLowerCase()," body"]});let r=a,c=!1;try{const d=JSON.parse(a);r=JSON.stringify(d,null,2),c=!0}catch{}return i.jsx(Sl,{className:"h-full",children:i.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function Uw({content:a}){return i.jsx(Sl,{className:"h-full",children:i.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:a})})}function Lw({name:a,absolutePath:l}){const[r,c]=x.useState("overview"),{data:d,isLoading:f,error:m}=pj(a),p=x.useMemo(()=>d?xw(d):null,[d]);return a?f?i.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[i.jsx(Ye,{className:"h-5 w-full"}),i.jsx(Ye,{className:"h-5 w-3/4"}),i.jsx(Ye,{className:"h-5 w-5/6"}),i.jsx(Ye,{className:"h-5 w-2/3"})]}):m||!d||!p?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[i.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx(Hy,{code:p.statusCode}),i.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),a&&i.jsx(ug,{value:l||a,label:"Copy absolute path",size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&i.jsx(ug,{value:d,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),i.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:p.method})]})]}),i.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[i.jsx(mi,{active:r==="overview",onClick:()=>c("overview"),icon:lo,children:"Overview"}),i.jsx(mi,{active:r==="headers",onClick:()=>c("headers"),icon:Kb,children:"Headers"}),i.jsx(mi,{active:r==="request",onClick:()=>c("request"),icon:Gb,children:"Request"}),i.jsx(mi,{active:r==="response",onClick:()=>c("response"),icon:Qb,children:"Response"}),i.jsx(mi,{active:r==="raw",onClick:()=>c("raw"),icon:Pb,children:"Raw"})]}),i.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&i.jsx(kw,{parsed:p}),r==="headers"&&i.jsx(Rw,{headers:p.requestHeaders}),r==="request"&&i.jsx(dg,{content:p.requestBody,label:"Request"}),r==="response"&&i.jsx(dg,{content:p.responseBody,label:"Response"}),r==="raw"&&i.jsx(Uw,{content:d})]})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx(Yb,{className:"w-10 h-10 mx-auto opacity-40"}),i.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function Bw(){const{data:a,isLoading:l}=uj(),{data:r,isLoading:c,error:d}=hj(a?.running??!1),[f,m]=x.useState(500),[p,g]=x.useState(!1),b=x.useRef(null),C=x.useRef(null),v=()=>{C.current&&(clearInterval(C.current),C.current=null)};x.useEffect(()=>{if(!p)return;const K=B=>{const N=b.current;if(!N)return;const I=N.getBoundingClientRect().top+window.scrollY,J=B.pageY-I;m(Math.max(300,J));const ve=window.innerHeight-B.clientY,re=15;v(),ve<50?C.current=setInterval(()=>{window.scrollBy(0,re)},16):B.clientY<50&&(C.current=setInterval(()=>{window.scrollBy(0,-re)},16))},H=()=>{g(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",H),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",H),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const S=K=>{K.preventDefault(),g(!0)},M=x.useMemo(()=>r?.[0]?.name??null,[r]),[A,R]=x.useState(null),z=A??M,_=x.useMemo(()=>!z||!r?void 0:r.find(H=>H.name===z)?.absolutePath,[z,r]);if(l||!a?.running)return null;if(c)return i.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[i.jsx(Ye,{className:"h-4 w-32"}),i.jsx(Ye,{className:"h-4 w-20"})]}),i.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(K=>i.jsx(Ye,{className:"h-12 w-full rounded-lg"},K))})]});if(!r||r.length===0)return null;const L=r.length;return i.jsxs("div",{ref:b,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:f},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(pa,{className:"w-4 h-4 text-amber-500"}),i.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),i.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[L," failed request",L!==1?"s":""]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Vb,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsxs(Td,{direction:"horizontal",children:[i.jsx(ji,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:i.jsxs(Sl,{className:"h-full",children:[i.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(K=>i.jsx(Dw,{name:K.name,size:K.size,modified:K.modified,isSelected:z===K.name,onClick:()=>R(K.name),statusCode:K.statusCode,model:K.model},K.name))}),r.length>50&&i.jsxs("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:["Showing 50 of ",r.length," logs"]})]})}),i.jsxs(Od,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[i.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),i.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:i.jsx(ao,{className:"h-4 w-4 text-muted-foreground"})})]}),i.jsx(ji,{className:"flex flex-col min-w-0 bg-background/50",children:i.jsx(Lw,{name:z,absolutePath:_})})]})}),d?i.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):i.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:S,children:i.jsx(Xb,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const Hw=io("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),_d=x.forwardRef(({className:a,variant:l,...r},c)=>i.jsx("div",{ref:c,role:"alert",className:q(Hw({variant:l}),a),...r}));_d.displayName="Alert";const qy=x.forwardRef(({className:a,...l},r)=>i.jsx("h5",{ref:r,className:q("mb-1 font-medium leading-none tracking-tight",a),...l}));qy.displayName="AlertTitle";const zd=x.forwardRef(({className:a,...l},r)=>i.jsx("div",{ref:r,className:q("text-sm [&_p]:leading-relaxed",a),...l}));zd.displayName="AlertDescription";function qw(){return _t({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function Yw(){return _t({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function kM(a){return _t({queryKey:["shared",a],queryFn:async()=>(await fetch(`/api/shared/${a}`)).json()})}const Kw={ok:"success",warning:"warning",error:"error"},Gw={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function Gr({title:a,value:l,icon:r,variant:c="default",onClick:d}){const f=Gw[c];return i.jsxs("button",{onClick:d,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[i.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",f.iconBg),children:i.jsx(r,{className:q("w-4 h-4",f.iconColor)})}),i.jsxs("div",{className:"text-left",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:a}),i.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",f.iconColor),children:l})]})]})}function Qw(){const a=ad(),{data:l,isLoading:r}=qw(),{data:c,isLoading:d}=Yw();if(r||d)return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Ye,{className:"h-12 w-12 rounded-lg"}),i.jsxs("div",{children:[i.jsx(Ye,{className:"h-7 w-[180px] mb-2"}),i.jsx(Ye,{className:"h-4 w-[220px]"})]})]}),i.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>i.jsx(Ye,{className:"h-14 w-28 rounded-lg"},m))})]}),i.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[i.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[i.jsx(Ye,{className:"h-4 w-32"}),i.jsx(Ye,{className:"h-4 w-20"})]}),i.jsx("div",{className:"px-4 py-3 border-b",children:i.jsx(Ye,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>i.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[i.jsx(Ye,{className:"w-2.5 h-2.5 rounded-full"}),i.jsx(Ye,{className:"h-4 flex-1"}),i.jsx(Ye,{className:"h-1.5 w-24 rounded-full"}),i.jsx(Ye,{className:"h-4 w-16"})]},m))]})]});const f=l?.health?Kw[l.health.status]:void 0;return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[i.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:i.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),i.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[i.jsx(ZN,{version:l?.version}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx(Gr,{title:"Profiles",value:l?.profiles??0,icon:ey,variant:"accent",onClick:()=>a("/providers")}),i.jsx(Gr,{title:"CLIProxy",value:l?.cliproxy??0,icon:ty,variant:"accent",onClick:()=>a("/cliproxy")}),i.jsx(Gr,{title:"Accounts",value:l?.accounts??0,icon:ly,variant:"default",onClick:()=>a("/accounts")}),i.jsx(Gr,{title:"Health",value:l?.health?`${l.health.passed}/${l.health.total}`:"-",icon:bi,variant:f,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&i.jsxs(_d,{variant:"warning",children:[i.jsx(pa,{className:"h-4 w-4"}),i.jsx(qy,{children:"Configuration Required"}),i.jsx(zd,{children:c.symlinkStatus.message})]}),i.jsx(Kj,{}),i.jsx(Bw,{})]})}const Pw=nb,RM=lb,Vw=ab,Yy=x.forwardRef(({className:a,children:l,...r},c)=>i.jsxs(Kg,{ref:c,className:q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,i.jsx($0,{asChild:!0,children:i.jsx(so,{className:"h-4 w-4 opacity-50"})})]}));Yy.displayName=Kg.displayName;const Ky=x.forwardRef(({className:a,...l},r)=>i.jsx(Gg,{ref:r,className:q("flex cursor-default items-center justify-center py-1",a),...l,children:i.jsx(id,{className:"h-4 w-4"})}));Ky.displayName=Gg.displayName;const Gy=x.forwardRef(({className:a,...l},r)=>i.jsx(Qg,{ref:r,className:q("flex cursor-default items-center justify-center py-1",a),...l,children:i.jsx(so,{className:"h-4 w-4"})}));Gy.displayName=Qg.displayName;const Qy=x.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>i.jsx(F0,{children:i.jsxs(Pg,{ref:d,className:q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[i.jsx(Ky,{}),i.jsx(J0,{className:q("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),i.jsx(Gy,{})]})}));Qy.displayName=Pg.displayName;const Xw=x.forwardRef(({className:a,...l},r)=>i.jsx(Vg,{ref:r,className:q("px-2 py-1.5 text-sm font-semibold",a),...l}));Xw.displayName=Vg.displayName;const Fu=x.forwardRef(({className:a,children:l,...r},c)=>i.jsxs(Xg,{ref:c,className:q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(eb,{children:i.jsx(fs,{className:"h-4 w-4"})})}),i.jsx(tb,{children:l})]}));Fu.displayName=Xg.displayName;const Ww=x.forwardRef(({className:a,...l},r)=>i.jsx(Wg,{ref:r,className:q("-mx-1 my-1 h-px bg-muted",a),...l}));Ww.displayName=Wg.displayName;const Py=sb,Dd=x.forwardRef(({className:a,...l},r)=>i.jsx(Ig,{ref:r,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...l}));Dd.displayName=Ig.displayName;const $r=x.forwardRef(({className:a,...l},r)=>i.jsx(Zg,{ref:r,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...l}));$r.displayName=Zg.displayName;const Ju=x.forwardRef(({className:a,...l},r)=>i.jsx($g,{ref:r,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...l}));Ju.displayName=$g.displayName;function an({className:a,...l}){return i.jsx(ib,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...l})}const kd="ccs:openrouter-models",Iw=1440*60*1e3,Vy="1";function ed(a){const l=parseFloat(a);return isNaN(l)||l===0?0:l*1e6}function fg(a){const l=ed(a);return l===0?"Free":l<.01?"<$0.01":l<1?`$${l.toFixed(2)}`:`$${l.toFixed(l<10?2:0)}`}function Zw(a){const l=fg(a.prompt),r=fg(a.completion);return l==="Free"&&r==="Free"?"Free":`${l}/${r}`}function $w(a){const l=a.id.toLowerCase();return l.startsWith("anthropic/")?"anthropic":l.startsWith("openai/")?"openai":l.startsWith("google/")?"google":l.startsWith("meta-llama/")||l.startsWith("meta/")?"meta":l.startsWith("mistralai/")?"mistral":l.includes(":free")||l.includes("qwen")||l.includes("deepseek")?"opensource":"other"}function Fw(a){return{...a,category:$w(a),pricePerMillionPrompt:ed(a.pricing.prompt),pricePerMillionCompletion:ed(a.pricing.completion),isFree:a.pricing.prompt==="0"&&a.pricing.completion==="0",isExacto:a.id.includes(":exacto")}}function Jw(a,l,r){const c=l.toLowerCase().trim();return a.filter(d=>r?.category&&d.category!==r.category||r?.freeOnly&&!d.isFree||r?.minContext&&d.context_length<r.minContext?!1:c?d.id.toLowerCase().includes(c)||d.name.toLowerCase().includes(c)||d.description?.toLowerCase().includes(c):!0)}function UM(a){return[...a].sort((l,r)=>{if(l.isFree&&!r.isFree)return-1;if(!l.isFree&&r.isFree)return 1;if(!l.isFree&&!r.isFree){if(l.isExacto&&!r.isExacto)return-1;if(!l.isExacto&&r.isExacto)return 1}return l.name.localeCompare(r.name)})}function eC(){try{const a=localStorage.getItem(kd);if(!a)return null;const l=JSON.parse(a);return l.version!==Vy||Date.now()-l.fetchedAt>Iw?null:l.models}catch{return null}}function tC(a){try{localStorage.setItem(kd,JSON.stringify({models:a,fetchedAt:Date.now(),version:Vy}))}catch{}}function nC(){localStorage.removeItem(kd)}function LM(a,l){const[r]=a.split("/");if(!r)return{};const c=l.filter(m=>m.id.startsWith(`${r}/`));if(c.length===0)return{};const d=[...c].sort((m,p)=>p.pricePerMillionPrompt-m.pricePerMillionPrompt),f=Math.ceil(d.length/3);return{opus:d[0]?.id,sonnet:d[Math.min(f,d.length-1)]?.id,haiku:d[d.length-1]?.id}}function aC(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${Math.round(a/1e3)}K`:String(a)}const BM={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},lC={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function sC(a,l=2){const r=[],c=["anthropic","openai","google","meta","mistral","opensource"];for(const d of c){const f=lC[d];if(f.length===0)continue;const p=[...a.filter(g=>f.some(b=>g.id.toLowerCase().startsWith(b)))].sort((g,b)=>(b.created??0)-(g.created??0));r.push(...p.slice(0,l))}return r.sort((d,f)=>(f.created??0)-(d.created??0))}function iC(a){const r=Date.now()/1e3-a;return r<86400?"Today":r<172800?"Yesterday":r<604800?`${Math.floor(r/86400)}d ago`:r<2592e3?`${Math.floor(r/604800)}w ago`:r<31536e3?`${Math.floor(r/2592e3)}mo ago`:`${Math.floor(r/31536e3)}y ago`}const rC="https://openrouter.ai/api/v1/models",Xy=["openrouter-models"],mg=1440*60*1e3;async function oC(){const a=await fetch(rC);if(!a.ok)throw new Error(`Failed to fetch OpenRouter models: ${a.status}`);const r=(await a.json()).data;return tC(r),r}function Wy(){return _t({queryKey:Xy,queryFn:oC,staleTime:mg,gcTime:mg,initialData:()=>eC()??void 0,refetchOnWindowFocus:!1})}function cC(){const a=Wy(),l=(a.data??[]).map(Fw);return{...a,models:l}}function HM(){const a=ct();return()=>(nC(),a.invalidateQueries({queryKey:Xy}))}function qM(){const{data:a,isLoading:l,isError:r}=Wy();return{isReady:!!a&&a.length>0,isLoading:l,isError:r,modelCount:a?.length??0}}function Rd({profileEnv:a={}}){const[l,r]=x.useState(null),[c,d]=x.useState(!0),[f,m]=x.useState(!1);x.useEffect(()=>{p()},[]);const p=async()=>{try{d(!0);const S=await fetch("/api/global-env");if(!S.ok)throw new Error("Failed to load");const M=await S.json();r(M)}catch{r(null)}finally{d(!1)}};if(c||!l?.enabled)return null;const g=l.env||{},b=Object.keys(g);if(b.length===0)return null;const C=b.filter(S=>!(S in a)),v=b.filter(S=>S in a);return i.jsxs("div",{className:"border-t bg-muted/20",children:[i.jsxs("button",{onClick:()=>m(!f),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[i.jsx(lo,{className:"w-4 h-4 text-blue-500"}),i.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[i.jsx("span",{className:"font-medium text-foreground",children:C.length})," global env var",C.length!==1?"s":""," will be injected at runtime",v.length>0&&i.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),f?i.jsx(id,{className:"w-4 h-4 text-muted-foreground"}):i.jsx(so,{className:"w-4 h-4 text-muted-foreground"})]}),f&&i.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&i.jsx("div",{className:"space-y-1",children:C.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-green-500",children:"+"}),i.jsxs("span",{className:"truncate",children:[S,"=",g[S]]})]},S))}),v.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-amber-500",children:"~"}),i.jsx("span",{className:"truncate",children:S})]},S))]}),i.jsx("div",{className:"pt-2 border-t border-border/50",children:i.jsx(ot,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:i.jsxs(Vu,{to:"/settings?tab=globalenv",children:[i.jsx(rd,{className:"w-3.5 h-3.5"}),"Configure in Settings",i.jsx(sy,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const uC=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function YM({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,settings:c,onChange:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(uC,{value:a,onChange:d,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:c?.env})})})]})})}function hg(a,l){try{var r=a()}catch(c){return l(c)}return r&&r.then?r.then(void 0,l):r}function dC(a,l){for(var r={};a.length;){var c=a[0],d=c.code,f=c.message,m=c.path.join(".");if(!r[m])if("unionErrors"in c){var p=c.unionErrors[0].errors[0];r[m]={message:p.message,type:p.code}}else r[m]={message:f,type:d};if("unionErrors"in c&&c.unionErrors.forEach(function(C){return C.errors.forEach(function(v){return a.push(v)})}),l){var g=r[m].types,b=g&&g[c.code];r[m]=iy(m,l,r,d,b?[].concat(b,c.message):c.message)}a.shift()}return r}function fC(a,l){for(var r={};a.length;){var c=a[0],d=c.code,f=c.message,m=c.path.join(".");if(!r[m])if(c.code==="invalid_union"&&c.errors.length>0){var p=c.errors[0][0];r[m]={message:p.message,type:p.code}}else r[m]={message:f,type:d};if(c.code==="invalid_union"&&c.errors.forEach(function(C){return C.forEach(function(v){return a.push(v)})}),l){var g=r[m].types,b=g&&g[c.code];r[m]=iy(m,l,r,d,b?[].concat(b,c.message):c.message)}a.shift()}return r}function mC(a,l,r){if(r===void 0&&(r={}),(function(c){return"_def"in c&&typeof c._def=="object"&&"typeName"in c._def})(a))return function(c,d,f){try{return Promise.resolve(hg(function(){return Promise.resolve(a[r.mode==="sync"?"parse":"parseAsync"](c,l)).then(function(m){return f.shouldUseNativeValidation&&Bp({},f),{errors:{},values:r.raw?Object.assign({},c):m}})},function(m){if((function(p){return Array.isArray(p?.issues)})(m))return{values:{},errors:Hp(dC(m.errors,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw m}))}catch(m){return Promise.reject(m)}};if((function(c){return"_zod"in c&&typeof c._zod=="object"})(a))return function(c,d,f){try{return Promise.resolve(hg(function(){return Promise.resolve((r.mode==="sync"?kS:RS)(a,c,l)).then(function(m){return f.shouldUseNativeValidation&&Bp({},f),{errors:{},values:r.raw?Object.assign({},c):m}})},function(m){if((function(p){return p instanceof US})(m))return{values:{},errors:Hp(fC(m.issues,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw m}))}catch(m){return Promise.reject(m)}};throw new Error("Invalid input: not a Zod schema")}function KM(){return _t({queryKey:["profiles"],queryFn:()=>Xe.profiles.list()})}function hC(){const a=ct();return mt({mutationFn:l=>Xe.profiles.create(l),onSuccess:()=>{a.invalidateQueries({queryKey:["profiles"]}),le.success("Profile created successfully")},onError:l=>{le.error(l.message)}})}function GM(){const a=ct();return mt({mutationFn:l=>Xe.profiles.delete(l),onSuccess:()=>{a.invalidateQueries({queryKey:["profiles"]}),le.success("Profile deleted successfully")},onError:l=>{le.error(l.message)}})}const pC="https://openrouter.ai/api",Iy=Object.freeze({kimi:"km"}),Zy=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:pC,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"glm",name:"GLM",description:"Claude via Z.AI",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative",requiresApiKey:!0,extraEnv:{ANTHROPIC_TEMPERATURE:"0.2",ANTHROPIC_MAX_TOKENS:"65536",MAX_THINKING_TOKENS:"32768",ENABLE_STREAMING:"true",ANTHROPIC_SAFE_MODE:"false",API_TIMEOUT_MS:"3000000"},alwaysThinkingEnabled:!0,badge:"Thinking",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"}];function $y(a){return{...a,extraEnv:a.extraEnv?{...a.extraEnv}:void 0}}function gC(a){const l=$y(a);return l.extraEnv&&Object.freeze(l.extraEnv),Object.freeze(l)}function yC(a,l){const r=new Set;for(const d of a){const f=d.id.trim().toLowerCase();if(d.id!==f)throw new Error(`Preset ID must be normalized: "${d.id}"`);if(r.has(d.id))throw new Error(`Duplicate preset ID detected: "${d.id}"`);r.add(d.id)}const c=new Set;for(const[d,f]of Object.entries(l)){const m=d.trim().toLowerCase();if(!m)throw new Error("Preset alias keys cannot be empty");if(d!==m)throw new Error(`Preset alias must be normalized: "${d}"`);if(c.has(m))throw new Error(`Duplicate normalized preset alias detected: "${d}"`);if(c.add(m),!r.has(f))throw new Error(`Preset alias "${d}" points to unknown target "${f}"`);if(r.has(m))throw new Error(`Preset alias "${d}" collides with canonical preset ID "${m}"`)}}yC(Zy,Iy);const xC=Object.freeze(Zy.map(gC));function vC(){return xC.map($y)}function bC(a){const l=a.trim().toLowerCase();return Iy[l]||l}const SC=Object.freeze({ollama:{apiKeyPlaceholder:""}});function NC(a){const l=SC[a.id];return l?{...a,...l}:{...a}}const jC=vC(),Ud=Object.freeze(jC.map(NC));function wC(a){return Ud.filter(l=>l.category===a)}function Bu(a){const l=bC(a);return Ud.find(r=>r.id===l)}const CC=LS({name:hl().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:hl().url("Invalid URL format"),apiKey:hl(),model:hl().optional(),opusModel:hl().optional(),sonnetModel:hl().optional(),haikuModel:hl().optional(),target:BS(["claude","droid"])}),EC=["/chat/completions","/v1/messages","/messages","/completions"],ua="custom",Hu="openrouter",qu={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},MC=wC("recommended"),Fy=Ud.filter(a=>a.category!=="recommended"),AC=new Set(Fy.map(a=>a.id));function QM({open:a,onOpenChange:l,onSuccess:r,initialMode:c="openrouter"}){const d=hC(),[f,m]=x.useState("basic"),[p,g]=x.useState(null),[b,C]=x.useState(!1),[v,S]=x.useState(Hu),[M,A]=x.useState(""),{models:R}=cC(),{register:z,handleSubmit:_,formState:{errors:L},control:K,reset:H,setValue:B}=HS({resolver:mC(CC),defaultValues:qu}),N=qp({control:K,name:"baseUrl"}),G=qp({control:K,name:"target"}),I=x.useCallback(V=>{if(!V){H(qu);return}H({...qu,name:V.defaultProfileName,baseUrl:V.baseUrl,model:V.defaultModel,opusModel:V.defaultModel,sonnetModel:V.defaultModel,haikuModel:V.defaultModel})},[H]),J=x.useMemo(()=>v===ua?null:Bu(v)??null,[v]),ie=x.useMemo(()=>M.trim()?[...Jw(R,M)].sort((oe,de)=>(de.created??0)-(oe.created??0)).slice(0,20):sC(R,2),[R,M]);x.useEffect(()=>{if(a)if(m("basic"),g(null),C(!1),A(""),c==="normal")S(ua),I(null);else{const V=Bu(Hu);if(V){S(V.id),I(V);return}S(ua),I(null)}},[a,c,I]);const ve=V=>{const oe=Bu(V);if(oe){S(oe.id),I(oe);return}S(ua),I(null)},re=V=>{B("model",V.id),B("opusModel",V.id),B("sonnetModel",V.id),B("haikuModel",V.id),A(V.name),le.success(`Applied "${V.name}" to all model tiers`,{duration:2e3})};x.useEffect(()=>{if(N&&v===ua){const oe=N.toLowerCase();for(const de of EC)if(oe.endsWith(de)){const Oe=N.replace(new RegExp(de+"$","i"),"");g(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${Oe}`);return}}g(null)},[N,v]);const Be=async V=>{if(J?.requiresApiKey!==!1&&!V.apiKey){le.error("API key is required");return}const oe={...V,apiKey:V.apiKey||""};try{await d.mutateAsync(oe),le.success(`Profile "${oe.name}" created`),r(oe.name),l(!1)}catch(de){le.error(de.message||"Failed to create profile")}},Se=!!L.name||!!L.baseUrl||!!L.apiKey,be=!!L.model||!!L.opusModel||!!L.sonnetModel||!!L.haikuModel,k=v!==ua&&AC.has(v),W=J?.id===Hu;return i.jsx(gd,{open:a,onOpenChange:l,children:i.jsxs(yd,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] flex flex-col",children:[i.jsxs(xd,{className:"p-6 pb-4 border-b",children:[i.jsxs(vd,{className:"flex items-center gap-2",children:[i.jsx(Up,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),i.jsx(bd,{children:"Choose a provider or configure a custom API endpoint."})]}),i.jsxs("form",{onSubmit:_(Be),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[i.jsxs("div",{children:[i.jsx(an,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Provider"}),i.jsxs("div",{className:"flex gap-2",children:[MC.map(V=>i.jsx(pg,{preset:V,isSelected:v===V.id,onClick:()=>ve(V.id)},V.id)),i.jsxs("button",{type:"button",onClick:()=>ve(ua),className:q("flex items-center gap-2 px-4 py-2 rounded-md border-2 transition-all text-sm font-medium",v===ua||k?"border-primary bg-primary/10 text-primary dark:bg-primary/20":"border-dashed border-muted-foreground/40 hover:border-primary/50 hover:bg-muted/50 text-muted-foreground hover:text-foreground"),children:[i.jsx(rd,{className:"w-4 h-4"}),i.jsx("span",{children:"Custom"})]})]})]}),(v===ua||k)&&i.jsxs("div",{className:"pt-3 mt-2 border-t border-dashed border-muted-foreground/30",children:[i.jsx(an,{className:"text-xs font-medium text-foreground/70 mb-2 block",children:"Quick Templates"}),i.jsx("div",{className:"flex gap-2 flex-wrap",children:Fy.map(V=>i.jsx(pg,{preset:V,isSelected:v===V.id,onClick:()=>ve(V.id)},V.id))})]})]}),i.jsxs(Py,{value:f,onValueChange:m,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[i.jsx("div",{className:"px-6 pt-4",children:i.jsxs(Dd,{className:"grid w-full grid-cols-2",children:[i.jsxs($r,{value:"basic",className:"relative",children:["Basic Information",Se&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),i.jsxs($r,{value:"models",className:"relative",children:["Model Configuration",be&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),i.jsxs(Sl,{className:"flex-1 min-h-0",children:[i.jsxs(Ju,{value:"basic",className:"p-6 space-y-4 mt-0",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"name",children:["Profile Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Rn,{id:"name",...z("name"),placeholder:"my-api",className:"font-mono"}),L.name?i.jsx("p",{className:"text-xs text-destructive",children:L.name.message}):i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"baseUrl",children:["API Base URL ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Rn,{id:"baseUrl",...z("baseUrl"),placeholder:"https://api.example.com/v1"}),L.baseUrl?i.jsx("p",{className:"text-xs text-destructive",children:L.baseUrl.message}):p?i.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[i.jsx(pa,{className:"w-4 h-4 shrink-0 mt-0.5"}),i.jsx("span",{children:p})]}):J?i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pre-filled from ",J.name,". You can customize if needed."]}):i.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"apiKey",children:["API Key"," ",J?.requiresApiKey!==!1&&i.jsx("span",{className:"text-destructive",children:"*"}),J?.requiresApiKey===!1&&i.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Rn,{id:"apiKey",type:b?"text":"password",...z("apiKey"),placeholder:J?.requiresApiKey===!1?"Optional - only if auth is enabled":J?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),i.jsx(ot,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>C(!b),tabIndex:-1,children:b?i.jsx(eo,{className:"h-4 w-4"}):i.jsx(to,{className:"h-4 w-4"})})]}),L.apiKey?i.jsx("p",{className:"text-xs text-destructive",children:L.apiKey.message}):J?.requiresApiKey===!1?i.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if you have configured Ollama authentication"}):J?.apiKeyHint&&i.jsx("p",{className:"text-xs text-muted-foreground",children:J.apiKeyHint})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(an,{htmlFor:"target",children:"Default Target CLI"}),i.jsxs(Pw,{value:G,onValueChange:V=>B("target",V),children:[i.jsx(Yy,{id:"target",children:i.jsx(Vw,{})}),i.jsxs(Qy,{children:[i.jsx(Fu,{value:"claude",children:"Claude Code (default)"}),i.jsx(Fu,{value:"droid",children:"Factory Droid"})]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run with"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:G==="droid"?"ccsd":"ccs"})," ","by default. You can still override each run with"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),i.jsxs(Ju,{value:"models",className:"p-6 mt-0 space-y-4",children:[i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[i.jsx(lo,{className:"w-5 h-5 shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),i.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),W&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{children:"Search Models"}),i.jsx(Rn,{value:M,onChange:V=>A(V.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:V=>{V.key==="Enter"&&ie.length>0&&(V.preventDefault(),re(ie[0]))}}),i.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ie.length===0?i.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:M?`No models found for "${M}"`:"Loading models..."}):i.jsxs("div",{className:"p-1",children:[!M&&i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[i.jsx(Wb,{className:"w-3 h-3 text-accent"}),i.jsx("span",{children:"Newest Models"})]}),ie.map(V=>i.jsx(TC,{model:V,onClick:()=>re(V),showAge:!M},V.id))]})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"model",children:["Default Model",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),i.jsx(Rn,{id:"model",...z("model"),placeholder:J?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),i.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),i.jsx(Rn,{id:"sonnetModel",...z("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),i.jsx(Rn,{id:"opusModel",...z("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),i.jsx(Rn,{id:"haikuModel",...z("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),i.jsxs(NN,{className:"p-6 pt-4 border-t bg-muted/10",children:[i.jsx(ot,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),i.jsx(ot,{type:"submit",disabled:d.isPending,className:q(d.isPending&&"opacity-80"),children:d.isPending?i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Up,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function pg({preset:a,isSelected:l,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,className:q("flex items-center gap-2 px-3 py-2 rounded-md border transition-all text-sm",l?a.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/10 dark:bg-primary/20 font-medium":"border-muted-foreground/20 hover:border-muted-foreground/40 hover:bg-muted/50"),children:[a.icon?i.jsx("img",{src:a.icon,alt:"",className:"w-4 h-4"}):i.jsx("div",{className:"w-4 h-4 rounded-full bg-muted-foreground/20 flex items-center justify-center text-[9px] font-bold text-foreground/70",children:a.name.charAt(0)}),i.jsx("span",{className:"font-medium",children:a.name}),a.badge&&i.jsx(Qa,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5 bg-muted-foreground/10 text-muted-foreground",children:a.badge})]})}function TC({model:a,onClick:l,showAge:r}){return i.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[i.jsx("span",{className:"flex-1 truncate",children:a.name}),i.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[r&&a.created&&i.jsx(Qa,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:iC(a.created)}),a.isFree?i.jsx(Qa,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):i.jsx("span",{children:Zw(a.pricing)}),i.jsx("span",{children:aC(a.context_length)})]})]})}function OC({className:a,...l}){return i.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...l})}function _C({className:a,...l}){return i.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...l})}function zC({className:a,...l}){return i.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",a),...l})}function DC({className:a,...l}){return i.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",a),...l})}function kC({className:a,...l}){return i.jsx("div",{"data-slot":"card-content",className:q("px-6",a),...l})}const RC=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],PM=RC.map(a=>({id:a,name:wd(a),description:zN(a)})),UC=["provider","auth","variant","success"];function VM(a){return a==="account"?1:UC.indexOf(a)}const LC=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function XM({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,onRawJsonChange:c,profileEnv:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(LC,{value:a,onChange:c,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:d})})})]})})}const BC=x.forwardRef(({className:a,value:l=0,max:r=100,indicatorClassName:c,...d},f)=>{const m=Math.min(Math.max(l/r*100,0),100);return i.jsx("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":l,className:q("relative h-2 w-full overflow-hidden rounded-full bg-secondary",a),...d,children:i.jsx("div",{className:q("h-full transition-all",c||"bg-primary"),style:{width:`${m}%`}})})});BC.displayName="Progress";var Gt={},gg;function HC(){if(gg)return Gt;gg=1;var a=Gt&&Gt.__assign||function(){return a=Object.assign||function(B){for(var N,G=1,I=arguments.length;G<I;G++){N=arguments[G];for(var J in N)Object.prototype.hasOwnProperty.call(N,J)&&(B[J]=N[J])}return B},a.apply(this,arguments)},l=Gt&&Gt.__createBinding||(Object.create?(function(B,N,G,I){I===void 0&&(I=G);var J=Object.getOwnPropertyDescriptor(N,G);(!J||("get"in J?!N.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return N[G]}}),Object.defineProperty(B,I,J)}):(function(B,N,G,I){I===void 0&&(I=G),B[I]=N[G]})),r=Gt&&Gt.__setModuleDefault||(Object.create?(function(B,N){Object.defineProperty(B,"default",{enumerable:!0,value:N})}):function(B,N){B.default=N}),c=Gt&&Gt.__importStar||function(B){if(B&&B.__esModule)return B;var N={};if(B!=null)for(var G in B)G!=="default"&&Object.prototype.hasOwnProperty.call(B,G)&&l(N,B,G);return r(N,B),N},d=Gt&&Gt.__rest||function(B,N){var G={};for(var I in B)Object.prototype.hasOwnProperty.call(B,I)&&N.indexOf(I)<0&&(G[I]=B[I]);if(B!=null&&typeof Object.getOwnPropertySymbols=="function")for(var J=0,I=Object.getOwnPropertySymbols(B);J<I.length;J++)N.indexOf(I[J])<0&&Object.prototype.propertyIsEnumerable.call(B,I[J])&&(G[I[J]]=B[I[J]]);return G};Object.defineProperty(Gt,"__esModule",{value:!0});var f=c(Jg()),m=89,p=90,g=77,b=57,C=219,v=222,S=192,M=100,A=3e3,R=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),z=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),_="npm__react-simple-code-editor__textarea",L=`
|
|
14
|
+
`).trim()}function Nw(a){const l=a.url.match(/\/api\/provider\/([^/]+)/);l&&(a.provider=l[1]);const r=a.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);r&&(a.endpoint=r[1]),a.isClientError=a.statusCode>=400&&a.statusCode<500,a.isServerError=a.statusCode>=500,a.statusCode===429?a.errorType="rate_limit":a.statusCode===401||a.statusCode===403?a.errorType="auth":a.statusCode===404?a.errorType="not_found":a.statusCode>=500?a.errorType="server":(a.statusCode===408||a.statusCode===504)&&(a.errorType="timeout"),jw(a),a.statusCode===429&&ww(a)}function jw(a){if(a.requestBody)try{const l=JSON.parse(a.requestBody);typeof l.model=="string"&&(a.model=l.model)}catch{}}function ww(a){if(a.responseBody)try{const l=JSON.parse(a.responseBody),r=Zu(l);r!==null&&(a.quotaResetDelay=r);const c=$u(l);c&&(a.quotaResetTimestamp=c)}catch{}}function Zu(a){if(typeof a!="object"||a===null)return null;const l=a;if("quotaResetDelay"in l){const r=l.quotaResetDelay;if(typeof r=="number")return r;if(typeof r=="string"){const c=r.match(/^(\d+)s?$/);if(c)return parseInt(c[1],10)}}if("error"in l&&typeof l.error=="object"){const r=Zu(l.error);if(r!==null)return r}if("details"in l&&Array.isArray(l.details))for(const r of l.details){const c=Zu(r);if(c!==null)return c}return null}function $u(a){if(typeof a!="object"||a===null)return null;const l=a;for(const r of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(r in l&&typeof l[r]=="string")return l[r];if("error"in l&&typeof l.error=="object"){const r=$u(l.error);if(r)return r}if("details"in l&&Array.isArray(l.details))for(const r of l.details){const c=$u(r);if(c)return c}return null}function Cw(a){return{400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",408:"Request Timeout",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[a]||""}function Ew(a){const l=Date.now(),r=a*1e3,c=l-r,d=Math.floor(c/1e3),f=Math.floor(d/60),m=Math.floor(f/60),p=Math.floor(m/24);return d<60?"just now":f<60?`${f}m ago`:m<24?`${m}h ago`:p<7?`${p}d ago`:new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Mw(a){return a>=500?"text-red-500":a===429?"text-orange-500":a>=400?"text-yellow-500":"text-gray-500"}function Aw(a){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[a]||"Error"}function Tw(a){if(a===null||a<=0)return null;if(a<60)return`${a}s`;if(a<3600)return`${Math.floor(a/60)}m`;const l=Math.floor(a/3600),r=Math.floor(a%3600/60);return r>0?`${l}h ${r}m`:`${l}h`}function Ow(a){if(!a)return null;try{const l=new Date(a),r=new Date,c=l.getTime()-r.getTime();if(c<=0)return"now";const d=Math.floor(c/1e3);if(d<60)return`${d}s`;if(d<3600)return`${Math.floor(d/60)}m`;const f=Math.floor(d/3600),m=Math.floor(d%3600/60);return m>0?`${f}h ${m}m`:`${f}h`}catch{return null}}function _w(a){return a?a===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":a>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":a>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function zw(a){return a||""}function Dw({name:a,size:l,modified:r,isSelected:c,onClick:d,statusCode:f,model:m}){const p=x.useMemo(()=>yw(a),[a]),g=x.useMemo(()=>zw(m),[m]);return i.jsxs("button",{onClick:d,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",c?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[i.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",_w(f)),children:f||"???"}),i.jsx(Cd,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[i.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),g&&i.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:g,children:g}),i.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[i.jsx(Ni,{className:"w-2.5 h-2.5"}),i.jsx("span",{children:Ew(r)})]})]})]})}function ug({value:a,className:l,variant:r="outline",size:c="icon",label:d="Copy to clipboard"}){const[f,m]=x.useState(!1),p=()=>{navigator.clipboard.writeText(a),m(!0),setTimeout(()=>m(!1),2e3)};return i.jsx(yl,{children:i.jsxs(Pa,{children:[i.jsx(Va,{asChild:!0,children:i.jsxs(ot,{size:c,variant:r,className:q("relative z-10 text-muted-foreground hover:text-foreground",l),onClick:g=>{g.stopPropagation(),p()},children:[f?i.jsx(fs,{className:"h-3.5 w-3.5 text-green-500"}):i.jsx(Wr,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:d})]})}),i.jsx(Xa,{children:i.jsx("p",{children:f?"Copied!":d})})]})})}function mi({active:a,onClick:l,children:r,icon:c}){return i.jsxs("button",{onClick:l,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",a?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[c&&i.jsx(c,{className:"w-3.5 h-3.5"}),r]})}function Hy({code:a}){const l=Mw(a);return i.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",l),children:a})}function kw({parsed:a}){const l=Tw(a.quotaResetDelay)||Ow(a.quotaResetTimestamp);return i.jsx(Sl,{className:"h-full",children:i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Hy,{code:a.statusCode}),i.jsx("span",{className:"text-sm font-medium",children:a.statusText}),i.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:Aw(a.errorType)})]}),a.model&&i.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[i.jsx(qb,{className:"w-4 h-4 text-violet-500 shrink-0"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Model: "}),i.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:a.model})]})]}),a.errorType==="rate_limit"&&l&&i.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[i.jsx(Ni,{className:"w-4 h-4 text-amber-500 shrink-0"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Quota resets in "}),i.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:l})]})]}),i.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),i.jsx("div",{className:"font-medium",children:a.method||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),i.jsx("div",{className:"font-medium",children:a.provider||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),i.jsx("div",{className:"font-medium",children:a.version||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),i.jsx("div",{className:"font-medium truncate",title:a.endpoint,children:a.endpoint||"N/A"})]})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),i.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:a.url||"N/A"})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),i.jsx("div",{className:"font-mono",children:a.timestamp||"N/A"})]}),a.errorType!=="unknown"&&i.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",a.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":a.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[a.errorType==="rate_limit"?i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):a.errorType==="auth"?i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):i.jsx(lo,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),i.jsxs("div",{className:q("leading-relaxed",a.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":a.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[a.errorType==="rate_limit"&&i.jsxs(i.Fragment,{children:[i.jsx("strong",{children:"Rate Limited."})," Switch to a different account or wait for quota reset.",a.model&&i.jsxs(i.Fragment,{children:[" ","Model ",i.jsx("code",{className:"font-mono text-[11px]",children:a.model})," has exhausted quota."]})]}),a.errorType==="auth"&&"Authentication failed. Re-authenticate via CLIProxy Settings or check API key.",a.errorType==="not_found"&&"Endpoint not found. This endpoint may not exist on this provider.",a.errorType==="server"&&"Server error from upstream. Retry later or check provider status page.",a.errorType==="timeout"&&"Request timed out. Check network connection or increase timeout settings."]})]})]})})}function Rw({headers:a}){const l=Object.entries(a);return l.length===0?i.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):i.jsx(Sl,{className:"h-full",children:i.jsx("div",{className:"p-4 space-y-1",children:l.map(([r,c])=>i.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[i.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),i.jsx("span",{className:"break-all",children:c})]},r))})})}function dg({content:a,label:l}){if(!a||a.trim()==="")return i.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",l.toLowerCase()," body"]});let r=a,c=!1;try{const d=JSON.parse(a);r=JSON.stringify(d,null,2),c=!0}catch{}return i.jsx(Sl,{className:"h-full",children:i.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function Uw({content:a}){return i.jsx(Sl,{className:"h-full",children:i.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:a})})}function Lw({name:a,absolutePath:l}){const[r,c]=x.useState("overview"),{data:d,isLoading:f,error:m}=pj(a),p=x.useMemo(()=>d?xw(d):null,[d]);return a?f?i.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[i.jsx(Ye,{className:"h-5 w-full"}),i.jsx(Ye,{className:"h-5 w-3/4"}),i.jsx(Ye,{className:"h-5 w-5/6"}),i.jsx(Ye,{className:"h-5 w-2/3"})]}):m||!d||!p?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[i.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx(Hy,{code:p.statusCode}),i.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),a&&i.jsx(ug,{value:l||a,label:"Copy absolute path",size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&i.jsx(ug,{value:d,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),i.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:p.method})]})]}),i.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[i.jsx(mi,{active:r==="overview",onClick:()=>c("overview"),icon:lo,children:"Overview"}),i.jsx(mi,{active:r==="headers",onClick:()=>c("headers"),icon:Kb,children:"Headers"}),i.jsx(mi,{active:r==="request",onClick:()=>c("request"),icon:Gb,children:"Request"}),i.jsx(mi,{active:r==="response",onClick:()=>c("response"),icon:Qb,children:"Response"}),i.jsx(mi,{active:r==="raw",onClick:()=>c("raw"),icon:Pb,children:"Raw"})]}),i.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&i.jsx(kw,{parsed:p}),r==="headers"&&i.jsx(Rw,{headers:p.requestHeaders}),r==="request"&&i.jsx(dg,{content:p.requestBody,label:"Request"}),r==="response"&&i.jsx(dg,{content:p.responseBody,label:"Response"}),r==="raw"&&i.jsx(Uw,{content:d})]})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx(Yb,{className:"w-10 h-10 mx-auto opacity-40"}),i.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function Bw(){const{data:a,isLoading:l}=uj(),{data:r,isLoading:c,error:d}=hj(a?.running??!1),[f,m]=x.useState(500),[p,g]=x.useState(!1),b=x.useRef(null),C=x.useRef(null),v=()=>{C.current&&(clearInterval(C.current),C.current=null)};x.useEffect(()=>{if(!p)return;const K=B=>{const N=b.current;if(!N)return;const I=N.getBoundingClientRect().top+window.scrollY,J=B.pageY-I;m(Math.max(300,J));const ve=window.innerHeight-B.clientY,re=15;v(),ve<50?C.current=setInterval(()=>{window.scrollBy(0,re)},16):B.clientY<50&&(C.current=setInterval(()=>{window.scrollBy(0,-re)},16))},H=()=>{g(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",H),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",H),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const S=K=>{K.preventDefault(),g(!0)},M=x.useMemo(()=>r?.[0]?.name??null,[r]),[A,R]=x.useState(null),z=A??M,_=x.useMemo(()=>!z||!r?void 0:r.find(H=>H.name===z)?.absolutePath,[z,r]);if(l||!a?.running)return null;if(c)return i.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[i.jsx(Ye,{className:"h-4 w-32"}),i.jsx(Ye,{className:"h-4 w-20"})]}),i.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(K=>i.jsx(Ye,{className:"h-12 w-full rounded-lg"},K))})]});if(!r||r.length===0)return null;const L=r.length;return i.jsxs("div",{ref:b,className:"rounded-xl border border-border overflow-hidden font-mono text-sm text-foreground bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm flex flex-col shadow-sm transition-[height] duration-0 ease-linear relative group/container",style:{height:f},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(pa,{className:"w-4 h-4 text-amber-500"}),i.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),i.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[L," failed request",L!==1?"s":""]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(Vb,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsxs(Td,{direction:"horizontal",children:[i.jsx(ji,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:i.jsxs(Sl,{className:"h-full",children:[i.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(K=>i.jsx(Dw,{name:K.name,size:K.size,modified:K.modified,isSelected:z===K.name,onClick:()=>R(K.name),statusCode:K.statusCode,model:K.model},K.name))}),r.length>50&&i.jsxs("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:["Showing 50 of ",r.length," logs"]})]})}),i.jsxs(Od,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[i.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),i.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:i.jsx(ao,{className:"h-4 w-4 text-muted-foreground"})})]}),i.jsx(ji,{className:"flex flex-col min-w-0 bg-background/50",children:i.jsx(Lw,{name:z,absolutePath:_})})]})}),d?i.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):i.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:S,children:i.jsx(Xb,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const Hw=io("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",warning:"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-900/50 dark:bg-yellow-900/20 dark:text-yellow-200 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-200 [&>svg]:text-green-600 dark:[&>svg]:text-green-500"}},defaultVariants:{variant:"default"}}),_d=x.forwardRef(({className:a,variant:l,...r},c)=>i.jsx("div",{ref:c,role:"alert",className:q(Hw({variant:l}),a),...r}));_d.displayName="Alert";const qy=x.forwardRef(({className:a,...l},r)=>i.jsx("h5",{ref:r,className:q("mb-1 font-medium leading-none tracking-tight",a),...l}));qy.displayName="AlertTitle";const zd=x.forwardRef(({className:a,...l},r)=>i.jsx("div",{ref:r,className:q("text-sm [&_p]:leading-relaxed",a),...l}));zd.displayName="AlertDescription";function qw(){return _t({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function Yw(){return _t({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function kM(a){return _t({queryKey:["shared",a],queryFn:async()=>(await fetch(`/api/shared/${a}`)).json()})}const Kw={ok:"success",warning:"warning",error:"error"},Gw={default:{iconBg:"bg-muted",iconColor:"text-muted-foreground"},success:{iconBg:"bg-green-600/15",iconColor:"text-green-700 dark:text-green-500"},warning:{iconBg:"bg-amber-500/15",iconColor:"text-amber-700 dark:text-amber-400"},error:{iconBg:"bg-red-600/15",iconColor:"text-red-700 dark:text-red-500"},accent:{iconBg:"bg-accent/15",iconColor:"text-accent"}};function Gr({title:a,value:l,icon:r,variant:c="default",onClick:d}){const f=Gw[c];return i.jsxs("button",{onClick:d,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[i.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",f.iconBg),children:i.jsx(r,{className:q("w-4 h-4",f.iconColor)})}),i.jsxs("div",{className:"text-left",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:a}),i.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",f.iconColor),children:l})]})]})}function Qw(){const a=ad(),{data:l,isLoading:r}=qw(),{data:c,isLoading:d}=Yw();if(r||d)return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Ye,{className:"h-12 w-12 rounded-lg"}),i.jsxs("div",{children:[i.jsx(Ye,{className:"h-7 w-[180px] mb-2"}),i.jsx(Ye,{className:"h-4 w-[220px]"})]})]}),i.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>i.jsx(Ye,{className:"h-14 w-28 rounded-lg"},m))})]}),i.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[i.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[i.jsx(Ye,{className:"h-4 w-32"}),i.jsx(Ye,{className:"h-4 w-20"})]}),i.jsx("div",{className:"px-4 py-3 border-b",children:i.jsx(Ye,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>i.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[i.jsx(Ye,{className:"w-2.5 h-2.5 rounded-full"}),i.jsx(Ye,{className:"h-4 flex-1"}),i.jsx(Ye,{className:"h-1.5 w-24 rounded-full"}),i.jsx(Ye,{className:"h-4 w-16"})]},m))]})]});const f=l?.health?Kw[l.health.status]:void 0;return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[i.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:i.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),i.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[i.jsx(ZN,{version:l?.version}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx(Gr,{title:"Profiles",value:l?.profiles??0,icon:ey,variant:"accent",onClick:()=>a("/providers")}),i.jsx(Gr,{title:"CLIProxy",value:l?.cliproxy??0,icon:ty,variant:"accent",onClick:()=>a("/cliproxy")}),i.jsx(Gr,{title:"Accounts",value:l?.accounts??0,icon:ly,variant:"default",onClick:()=>a("/accounts")}),i.jsx(Gr,{title:"Health",value:l?.health?`${l.health.passed}/${l.health.total}`:"-",icon:bi,variant:f,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&i.jsxs(_d,{variant:"warning",children:[i.jsx(pa,{className:"h-4 w-4"}),i.jsx(qy,{children:"Configuration Required"}),i.jsx(zd,{children:c.symlinkStatus.message})]}),i.jsx(Kj,{}),i.jsx(Bw,{})]})}const Pw=nb,RM=lb,Vw=ab,Yy=x.forwardRef(({className:a,children:l,...r},c)=>i.jsxs(Kg,{ref:c,className:q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,i.jsx($0,{asChild:!0,children:i.jsx(so,{className:"h-4 w-4 opacity-50"})})]}));Yy.displayName=Kg.displayName;const Ky=x.forwardRef(({className:a,...l},r)=>i.jsx(Gg,{ref:r,className:q("flex cursor-default items-center justify-center py-1",a),...l,children:i.jsx(id,{className:"h-4 w-4"})}));Ky.displayName=Gg.displayName;const Gy=x.forwardRef(({className:a,...l},r)=>i.jsx(Qg,{ref:r,className:q("flex cursor-default items-center justify-center py-1",a),...l,children:i.jsx(so,{className:"h-4 w-4"})}));Gy.displayName=Qg.displayName;const Qy=x.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>i.jsx(F0,{children:i.jsxs(Pg,{ref:d,className:q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[i.jsx(Ky,{}),i.jsx(J0,{className:q("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),i.jsx(Gy,{})]})}));Qy.displayName=Pg.displayName;const Xw=x.forwardRef(({className:a,...l},r)=>i.jsx(Vg,{ref:r,className:q("px-2 py-1.5 text-sm font-semibold",a),...l}));Xw.displayName=Vg.displayName;const Fu=x.forwardRef(({className:a,children:l,...r},c)=>i.jsxs(Xg,{ref:c,className:q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(eb,{children:i.jsx(fs,{className:"h-4 w-4"})})}),i.jsx(tb,{children:l})]}));Fu.displayName=Xg.displayName;const Ww=x.forwardRef(({className:a,...l},r)=>i.jsx(Wg,{ref:r,className:q("-mx-1 my-1 h-px bg-muted",a),...l}));Ww.displayName=Wg.displayName;const Py=sb,Dd=x.forwardRef(({className:a,...l},r)=>i.jsx(Ig,{ref:r,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...l}));Dd.displayName=Ig.displayName;const $r=x.forwardRef(({className:a,...l},r)=>i.jsx(Zg,{ref:r,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...l}));$r.displayName=Zg.displayName;const Ju=x.forwardRef(({className:a,...l},r)=>i.jsx($g,{ref:r,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...l}));Ju.displayName=$g.displayName;function an({className:a,...l}){return i.jsx(ib,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...l})}const kd="ccs:openrouter-models",Iw=1440*60*1e3,Vy="1";function ed(a){const l=parseFloat(a);return isNaN(l)||l===0?0:l*1e6}function fg(a){const l=ed(a);return l===0?"Free":l<.01?"<$0.01":l<1?`$${l.toFixed(2)}`:`$${l.toFixed(l<10?2:0)}`}function Zw(a){const l=fg(a.prompt),r=fg(a.completion);return l==="Free"&&r==="Free"?"Free":`${l}/${r}`}function $w(a){const l=a.id.toLowerCase();return l.startsWith("anthropic/")?"anthropic":l.startsWith("openai/")?"openai":l.startsWith("google/")?"google":l.startsWith("meta-llama/")||l.startsWith("meta/")?"meta":l.startsWith("mistralai/")?"mistral":l.includes(":free")||l.includes("qwen")||l.includes("deepseek")?"opensource":"other"}function Fw(a){return{...a,category:$w(a),pricePerMillionPrompt:ed(a.pricing.prompt),pricePerMillionCompletion:ed(a.pricing.completion),isFree:a.pricing.prompt==="0"&&a.pricing.completion==="0",isExacto:a.id.includes(":exacto")}}function Jw(a,l,r){const c=l.toLowerCase().trim();return a.filter(d=>r?.category&&d.category!==r.category||r?.freeOnly&&!d.isFree||r?.minContext&&d.context_length<r.minContext?!1:c?d.id.toLowerCase().includes(c)||d.name.toLowerCase().includes(c)||d.description?.toLowerCase().includes(c):!0)}function UM(a){return[...a].sort((l,r)=>{if(l.isFree&&!r.isFree)return-1;if(!l.isFree&&r.isFree)return 1;if(!l.isFree&&!r.isFree){if(l.isExacto&&!r.isExacto)return-1;if(!l.isExacto&&r.isExacto)return 1}return l.name.localeCompare(r.name)})}function eC(){try{const a=localStorage.getItem(kd);if(!a)return null;const l=JSON.parse(a);return l.version!==Vy||Date.now()-l.fetchedAt>Iw?null:l.models}catch{return null}}function tC(a){try{localStorage.setItem(kd,JSON.stringify({models:a,fetchedAt:Date.now(),version:Vy}))}catch{}}function nC(){localStorage.removeItem(kd)}function LM(a,l){const[r]=a.split("/");if(!r)return{};const c=l.filter(m=>m.id.startsWith(`${r}/`));if(c.length===0)return{};const d=[...c].sort((m,p)=>p.pricePerMillionPrompt-m.pricePerMillionPrompt),f=Math.ceil(d.length/3);return{opus:d[0]?.id,sonnet:d[Math.min(f,d.length-1)]?.id,haiku:d[d.length-1]?.id}}function aC(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${Math.round(a/1e3)}K`:String(a)}const BM={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},lC={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function sC(a,l=2){const r=[],c=["anthropic","openai","google","meta","mistral","opensource"];for(const d of c){const f=lC[d];if(f.length===0)continue;const p=[...a.filter(g=>f.some(b=>g.id.toLowerCase().startsWith(b)))].sort((g,b)=>(b.created??0)-(g.created??0));r.push(...p.slice(0,l))}return r.sort((d,f)=>(f.created??0)-(d.created??0))}function iC(a){const r=Date.now()/1e3-a;return r<86400?"Today":r<172800?"Yesterday":r<604800?`${Math.floor(r/86400)}d ago`:r<2592e3?`${Math.floor(r/604800)}w ago`:r<31536e3?`${Math.floor(r/2592e3)}mo ago`:`${Math.floor(r/31536e3)}y ago`}const rC="https://openrouter.ai/api/v1/models",Xy=["openrouter-models"],mg=1440*60*1e3;async function oC(){const a=await fetch(rC);if(!a.ok)throw new Error(`Failed to fetch OpenRouter models: ${a.status}`);const r=(await a.json()).data;return tC(r),r}function Wy(){return _t({queryKey:Xy,queryFn:oC,staleTime:mg,gcTime:mg,initialData:()=>eC()??void 0,refetchOnWindowFocus:!1})}function cC(){const a=Wy(),l=(a.data??[]).map(Fw);return{...a,models:l}}function HM(){const a=ct();return()=>(nC(),a.invalidateQueries({queryKey:Xy}))}function qM(){const{data:a,isLoading:l,isError:r}=Wy();return{isReady:!!a&&a.length>0,isLoading:l,isError:r,modelCount:a?.length??0}}function Rd({profileEnv:a={}}){const[l,r]=x.useState(null),[c,d]=x.useState(!0),[f,m]=x.useState(!1);x.useEffect(()=>{p()},[]);const p=async()=>{try{d(!0);const S=await fetch("/api/global-env");if(!S.ok)throw new Error("Failed to load");const M=await S.json();r(M)}catch{r(null)}finally{d(!1)}};if(c||!l?.enabled)return null;const g=l.env||{},b=Object.keys(g);if(b.length===0)return null;const C=b.filter(S=>!(S in a)),v=b.filter(S=>S in a);return i.jsxs("div",{className:"border-t bg-muted/20",children:[i.jsxs("button",{onClick:()=>m(!f),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[i.jsx(lo,{className:"w-4 h-4 text-blue-500"}),i.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[i.jsx("span",{className:"font-medium text-foreground",children:C.length})," global env var",C.length!==1?"s":""," will be injected at runtime",v.length>0&&i.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),f?i.jsx(id,{className:"w-4 h-4 text-muted-foreground"}):i.jsx(so,{className:"w-4 h-4 text-muted-foreground"})]}),f&&i.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&i.jsx("div",{className:"space-y-1",children:C.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-green-500",children:"+"}),i.jsxs("span",{className:"truncate",children:[S,"=",g[S]]})]},S))}),v.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-amber-500",children:"~"}),i.jsx("span",{className:"truncate",children:S})]},S))]}),i.jsx("div",{className:"pt-2 border-t border-border/50",children:i.jsx(ot,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:i.jsxs(Vu,{to:"/settings?tab=globalenv",children:[i.jsx(rd,{className:"w-3.5 h-3.5"}),"Configure in Settings",i.jsx(sy,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const uC=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function YM({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,settings:c,onChange:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(uC,{value:a,onChange:d,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:c?.env})})})]})})}function hg(a,l){try{var r=a()}catch(c){return l(c)}return r&&r.then?r.then(void 0,l):r}function dC(a,l){for(var r={};a.length;){var c=a[0],d=c.code,f=c.message,m=c.path.join(".");if(!r[m])if("unionErrors"in c){var p=c.unionErrors[0].errors[0];r[m]={message:p.message,type:p.code}}else r[m]={message:f,type:d};if("unionErrors"in c&&c.unionErrors.forEach(function(C){return C.errors.forEach(function(v){return a.push(v)})}),l){var g=r[m].types,b=g&&g[c.code];r[m]=iy(m,l,r,d,b?[].concat(b,c.message):c.message)}a.shift()}return r}function fC(a,l){for(var r={};a.length;){var c=a[0],d=c.code,f=c.message,m=c.path.join(".");if(!r[m])if(c.code==="invalid_union"&&c.errors.length>0){var p=c.errors[0][0];r[m]={message:p.message,type:p.code}}else r[m]={message:f,type:d};if(c.code==="invalid_union"&&c.errors.forEach(function(C){return C.forEach(function(v){return a.push(v)})}),l){var g=r[m].types,b=g&&g[c.code];r[m]=iy(m,l,r,d,b?[].concat(b,c.message):c.message)}a.shift()}return r}function mC(a,l,r){if(r===void 0&&(r={}),(function(c){return"_def"in c&&typeof c._def=="object"&&"typeName"in c._def})(a))return function(c,d,f){try{return Promise.resolve(hg(function(){return Promise.resolve(a[r.mode==="sync"?"parse":"parseAsync"](c,l)).then(function(m){return f.shouldUseNativeValidation&&Bp({},f),{errors:{},values:r.raw?Object.assign({},c):m}})},function(m){if((function(p){return Array.isArray(p?.issues)})(m))return{values:{},errors:Hp(dC(m.errors,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw m}))}catch(m){return Promise.reject(m)}};if((function(c){return"_zod"in c&&typeof c._zod=="object"})(a))return function(c,d,f){try{return Promise.resolve(hg(function(){return Promise.resolve((r.mode==="sync"?kS:RS)(a,c,l)).then(function(m){return f.shouldUseNativeValidation&&Bp({},f),{errors:{},values:r.raw?Object.assign({},c):m}})},function(m){if((function(p){return p instanceof US})(m))return{values:{},errors:Hp(fC(m.issues,!f.shouldUseNativeValidation&&f.criteriaMode==="all"),f)};throw m}))}catch(m){return Promise.reject(m)}};throw new Error("Invalid input: not a Zod schema")}function KM(){return _t({queryKey:["profiles"],queryFn:()=>Xe.profiles.list()})}function hC(){const a=ct();return mt({mutationFn:l=>Xe.profiles.create(l),onSuccess:()=>{a.invalidateQueries({queryKey:["profiles"]}),le.success("Profile created successfully")},onError:l=>{le.error(l.message)}})}function GM(){const a=ct();return mt({mutationFn:l=>Xe.profiles.delete(l),onSuccess:()=>{a.invalidateQueries({queryKey:["profiles"]}),le.success("Profile deleted successfully")},onError:l=>{le.error(l.message)}})}const pC="https://openrouter.ai/api",Iy=Object.freeze({kimi:"km"}),Zy=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:pC,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"glm",name:"GLM",description:"Claude via Z.AI",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative",requiresApiKey:!0,extraEnv:{ANTHROPIC_TEMPERATURE:"0.2",ANTHROPIC_MAX_TOKENS:"65536",MAX_THINKING_TOKENS:"32768",ENABLE_STREAMING:"true",ANTHROPIC_SAFE_MODE:"false",API_TIMEOUT_MS:"3000000"},alwaysThinkingEnabled:!0,badge:"Thinking",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"}];function $y(a){return{...a,extraEnv:a.extraEnv?{...a.extraEnv}:void 0}}function gC(a){const l=$y(a);return l.extraEnv&&Object.freeze(l.extraEnv),Object.freeze(l)}function yC(a,l){const r=new Set;for(const d of a){const f=d.id.trim().toLowerCase();if(d.id!==f)throw new Error(`Preset ID must be normalized: "${d.id}"`);if(r.has(d.id))throw new Error(`Duplicate preset ID detected: "${d.id}"`);r.add(d.id)}const c=new Set;for(const[d,f]of Object.entries(l)){const m=d.trim().toLowerCase();if(!m)throw new Error("Preset alias keys cannot be empty");if(d!==m)throw new Error(`Preset alias must be normalized: "${d}"`);if(c.has(m))throw new Error(`Duplicate normalized preset alias detected: "${d}"`);if(c.add(m),!r.has(f))throw new Error(`Preset alias "${d}" points to unknown target "${f}"`);if(r.has(m))throw new Error(`Preset alias "${d}" collides with canonical preset ID "${m}"`)}}yC(Zy,Iy);const xC=Object.freeze(Zy.map(gC));function vC(){return xC.map($y)}function bC(a){const l=a.trim().toLowerCase();return Iy[l]||l}const SC=Object.freeze({ollama:{apiKeyPlaceholder:""}});function NC(a){const l=SC[a.id];return l?{...a,...l}:{...a}}const jC=vC(),Ud=Object.freeze(jC.map(NC));function wC(a){return Ud.filter(l=>l.category===a)}function Bu(a){const l=bC(a);return Ud.find(r=>r.id===l)}const CC=LS({name:hl().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:hl().url("Invalid URL format"),apiKey:hl(),model:hl().optional(),opusModel:hl().optional(),sonnetModel:hl().optional(),haikuModel:hl().optional(),target:BS(["claude","droid"])}),EC=["/chat/completions","/v1/messages","/messages","/completions"],ua="custom",Hu="openrouter",qu={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},MC=wC("recommended"),Fy=Ud.filter(a=>a.category!=="recommended"),AC=new Set(Fy.map(a=>a.id));function QM({open:a,onOpenChange:l,onSuccess:r,initialMode:c="openrouter"}){const d=hC(),[f,m]=x.useState("basic"),[p,g]=x.useState(null),[b,C]=x.useState(!1),[v,S]=x.useState(Hu),[M,A]=x.useState(""),{models:R}=cC(),{register:z,handleSubmit:_,formState:{errors:L},control:K,reset:H,setValue:B}=HS({resolver:mC(CC),defaultValues:qu}),N=qp({control:K,name:"baseUrl"}),G=qp({control:K,name:"target"}),I=x.useCallback(V=>{if(!V){H(qu);return}H({...qu,name:V.defaultProfileName,baseUrl:V.baseUrl,model:V.defaultModel,opusModel:V.defaultModel,sonnetModel:V.defaultModel,haikuModel:V.defaultModel})},[H]),J=x.useMemo(()=>v===ua?null:Bu(v)??null,[v]),ie=x.useMemo(()=>M.trim()?[...Jw(R,M)].sort((oe,de)=>(de.created??0)-(oe.created??0)).slice(0,20):sC(R,2),[R,M]);x.useEffect(()=>{if(a)if(m("basic"),g(null),C(!1),A(""),c==="normal")S(ua),I(null);else{const V=Bu(Hu);if(V){S(V.id),I(V);return}S(ua),I(null)}},[a,c,I]);const ve=V=>{const oe=Bu(V);if(oe){S(oe.id),I(oe);return}S(ua),I(null)},re=V=>{B("model",V.id),B("opusModel",V.id),B("sonnetModel",V.id),B("haikuModel",V.id),A(V.name),le.success(`Applied "${V.name}" to all model tiers`,{duration:2e3})};x.useEffect(()=>{if(N&&v===ua){const oe=N.toLowerCase();for(const de of EC)if(oe.endsWith(de)){const Oe=N.replace(new RegExp(de+"$","i"),"");g(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${Oe}`);return}}g(null)},[N,v]);const Be=async V=>{if(J?.requiresApiKey!==!1&&!V.apiKey){le.error("API key is required");return}const oe={...V,apiKey:V.apiKey||""};try{await d.mutateAsync(oe),le.success(`Profile "${oe.name}" created`),r(oe.name),l(!1)}catch(de){le.error(de.message||"Failed to create profile")}},Se=!!L.name||!!L.baseUrl||!!L.apiKey,be=!!L.model||!!L.opusModel||!!L.sonnetModel||!!L.haikuModel,k=v!==ua&&AC.has(v),W=J?.id===Hu;return i.jsx(gd,{open:a,onOpenChange:l,children:i.jsxs(yd,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] flex flex-col",children:[i.jsxs(xd,{className:"p-6 pb-4 border-b",children:[i.jsxs(vd,{className:"flex items-center gap-2",children:[i.jsx(Up,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),i.jsx(bd,{children:"Choose a provider or configure a custom API endpoint."})]}),i.jsxs("form",{onSubmit:_(Be),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[i.jsxs("div",{children:[i.jsx(an,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Provider"}),i.jsxs("div",{className:"flex gap-2",children:[MC.map(V=>i.jsx(pg,{preset:V,isSelected:v===V.id,onClick:()=>ve(V.id)},V.id)),i.jsxs("button",{type:"button",onClick:()=>ve(ua),className:q("flex items-center gap-2 px-4 py-2 rounded-md border-2 transition-all text-sm font-medium",v===ua||k?"border-primary bg-primary/10 text-primary dark:bg-primary/20":"border-dashed border-muted-foreground/40 hover:border-primary/50 hover:bg-muted/50 text-muted-foreground hover:text-foreground"),children:[i.jsx(rd,{className:"w-4 h-4"}),i.jsx("span",{children:"Custom"})]})]})]}),(v===ua||k)&&i.jsxs("div",{className:"pt-3 mt-2 border-t border-dashed border-muted-foreground/30",children:[i.jsx(an,{className:"text-xs font-medium text-foreground/70 mb-2 block",children:"Quick Templates"}),i.jsx("div",{className:"flex gap-2 flex-wrap",children:Fy.map(V=>i.jsx(pg,{preset:V,isSelected:v===V.id,onClick:()=>ve(V.id)},V.id))})]})]}),i.jsxs(Py,{value:f,onValueChange:m,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[i.jsx("div",{className:"px-6 pt-4",children:i.jsxs(Dd,{className:"grid w-full grid-cols-2",children:[i.jsxs($r,{value:"basic",className:"relative",children:["Basic Information",Se&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),i.jsxs($r,{value:"models",className:"relative",children:["Model Configuration",be&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),i.jsxs(Sl,{className:"flex-1 min-h-0",children:[i.jsxs(Ju,{value:"basic",className:"p-6 space-y-4 mt-0",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"name",children:["Profile Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Rn,{id:"name",...z("name"),placeholder:"my-api",className:"font-mono"}),L.name?i.jsx("p",{className:"text-xs text-destructive",children:L.name.message}):i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"baseUrl",children:["API Base URL ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(Rn,{id:"baseUrl",...z("baseUrl"),placeholder:"https://api.example.com/v1"}),L.baseUrl?i.jsx("p",{className:"text-xs text-destructive",children:L.baseUrl.message}):p?i.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[i.jsx(pa,{className:"w-4 h-4 shrink-0 mt-0.5"}),i.jsx("span",{children:p})]}):J?i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pre-filled from ",J.name,". You can customize if needed."]}):i.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"apiKey",children:["API Key"," ",J?.requiresApiKey!==!1&&i.jsx("span",{className:"text-destructive",children:"*"}),J?.requiresApiKey===!1&&i.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Rn,{id:"apiKey",type:b?"text":"password",...z("apiKey"),placeholder:J?.requiresApiKey===!1?"Optional - only if auth is enabled":J?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),i.jsx(ot,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>C(!b),tabIndex:-1,children:b?i.jsx(eo,{className:"h-4 w-4"}):i.jsx(to,{className:"h-4 w-4"})})]}),L.apiKey?i.jsx("p",{className:"text-xs text-destructive",children:L.apiKey.message}):J?.requiresApiKey===!1?i.jsx("p",{className:"text-xs text-muted-foreground",children:"Only needed if you have configured Ollama authentication"}):J?.apiKeyHint&&i.jsx("p",{className:"text-xs text-muted-foreground",children:J.apiKeyHint})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(an,{htmlFor:"target",children:"Default Target CLI"}),i.jsxs(Pw,{value:G,onValueChange:V=>B("target",V),children:[i.jsx(Yy,{id:"target",children:i.jsx(Vw,{})}),i.jsxs(Qy,{children:[i.jsx(Fu,{value:"claude",children:"Claude Code (default)"}),i.jsx(Fu,{value:"droid",children:"Factory Droid"})]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run with"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:G==="droid"?"ccsd":"ccs"})," ","by default. You can still override each run with"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),i.jsxs(Ju,{value:"models",className:"p-6 mt-0 space-y-4",children:[i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[i.jsx(lo,{className:"w-5 h-5 shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),i.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),W&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{children:"Search Models"}),i.jsx(Rn,{value:M,onChange:V=>A(V.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:V=>{V.key==="Enter"&&ie.length>0&&(V.preventDefault(),re(ie[0]))}}),i.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ie.length===0?i.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:M?`No models found for "${M}"`:"Loading models..."}):i.jsxs("div",{className:"p-1",children:[!M&&i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[i.jsx(Wb,{className:"w-3 h-3 text-accent"}),i.jsx("span",{children:"Newest Models"})]}),ie.map(V=>i.jsx(TC,{model:V,onClick:()=>re(V),showAge:!M},V.id))]})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"model",children:["Default Model",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),i.jsx(Rn,{id:"model",...z("model"),placeholder:J?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),i.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),i.jsx(Rn,{id:"sonnetModel",...z("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),i.jsx(Rn,{id:"opusModel",...z("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(an,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",i.jsx(Qa,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),i.jsx(Rn,{id:"haikuModel",...z("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),i.jsxs(NN,{className:"p-6 pt-4 border-t bg-muted/10",children:[i.jsx(ot,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),i.jsx(ot,{type:"submit",disabled:d.isPending,className:q(d.isPending&&"opacity-80"),children:d.isPending?i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Up,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function pg({preset:a,isSelected:l,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,className:q("flex items-center gap-2 px-3 py-2 rounded-md border transition-all text-sm",l?a.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/10 dark:bg-primary/20 font-medium":"border-muted-foreground/20 hover:border-muted-foreground/40 hover:bg-muted/50"),children:[a.icon?i.jsx("img",{src:a.icon,alt:"",className:"w-4 h-4"}):i.jsx("div",{className:"w-4 h-4 rounded-full bg-muted-foreground/20 flex items-center justify-center text-[9px] font-bold text-foreground/70",children:a.name.charAt(0)}),i.jsx("span",{className:"font-medium",children:a.name}),a.badge&&i.jsx(Qa,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5 bg-muted-foreground/10 text-muted-foreground",children:a.badge})]})}function TC({model:a,onClick:l,showAge:r}){return i.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[i.jsx("span",{className:"flex-1 truncate",children:a.name}),i.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[r&&a.created&&i.jsx(Qa,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:iC(a.created)}),a.isFree?i.jsx(Qa,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):i.jsx("span",{children:Zw(a.pricing)}),i.jsx("span",{children:aC(a.context_length)})]})]})}function OC({className:a,...l}){return i.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...l})}function _C({className:a,...l}){return i.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...l})}function zC({className:a,...l}){return i.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",a),...l})}function DC({className:a,...l}){return i.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",a),...l})}function kC({className:a,...l}){return i.jsx("div",{"data-slot":"card-content",className:q("px-6",a),...l})}const RC=["agy","claude","gemini","codex","qwen","kimi","iflow","kiro","ghcp"],PM=RC.map(a=>({id:a,name:wd(a),description:zN(a)})),UC=["provider","auth","variant","success"];function VM(a){return a==="account"?1:UC.indexOf(a)}const LC=x.forwardRef(({className:a,value:l=0,max:r=100,indicatorClassName:c,...d},f)=>{const m=Math.min(Math.max(l/r*100,0),100);return i.jsx("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":l,className:q("relative h-2 w-full overflow-hidden rounded-full bg-secondary",a),...d,children:i.jsx("div",{className:q("h-full transition-all",c||"bg-primary"),style:{width:`${m}%`}})})});LC.displayName="Progress";const BC=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function XM({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,onRawJsonChange:c,profileEnv:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(BC,{value:a,onChange:c,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:d})})})]})})}var Gt={},gg;function HC(){if(gg)return Gt;gg=1;var a=Gt&&Gt.__assign||function(){return a=Object.assign||function(B){for(var N,G=1,I=arguments.length;G<I;G++){N=arguments[G];for(var J in N)Object.prototype.hasOwnProperty.call(N,J)&&(B[J]=N[J])}return B},a.apply(this,arguments)},l=Gt&&Gt.__createBinding||(Object.create?(function(B,N,G,I){I===void 0&&(I=G);var J=Object.getOwnPropertyDescriptor(N,G);(!J||("get"in J?!N.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return N[G]}}),Object.defineProperty(B,I,J)}):(function(B,N,G,I){I===void 0&&(I=G),B[I]=N[G]})),r=Gt&&Gt.__setModuleDefault||(Object.create?(function(B,N){Object.defineProperty(B,"default",{enumerable:!0,value:N})}):function(B,N){B.default=N}),c=Gt&&Gt.__importStar||function(B){if(B&&B.__esModule)return B;var N={};if(B!=null)for(var G in B)G!=="default"&&Object.prototype.hasOwnProperty.call(B,G)&&l(N,B,G);return r(N,B),N},d=Gt&&Gt.__rest||function(B,N){var G={};for(var I in B)Object.prototype.hasOwnProperty.call(B,I)&&N.indexOf(I)<0&&(G[I]=B[I]);if(B!=null&&typeof Object.getOwnPropertySymbols=="function")for(var J=0,I=Object.getOwnPropertySymbols(B);J<I.length;J++)N.indexOf(I[J])<0&&Object.prototype.propertyIsEnumerable.call(B,I[J])&&(G[I[J]]=B[I[J]]);return G};Object.defineProperty(Gt,"__esModule",{value:!0});var f=c(Jg()),m=89,p=90,g=77,b=57,C=219,v=222,S=192,M=100,A=3e3,R=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),z=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),_="npm__react-simple-code-editor__textarea",L=`
|
|
15
15
|
/**
|
|
16
16
|
* Reset the text fill color so that placeholder is visible
|
|
17
17
|
*/
|
|
@@ -44,4 +44,4 @@ Error generating stack: `+s.message+`
|
|
|
44
44
|
`).map(function(bs,Ss){return Ss>=zt&&Ss<=Qn?ce+bs:bs}).join(`
|
|
45
45
|
`),selectionStart:xe&&/\S/.test(xe)?Me+ce.length:Me,selectionEnd:nt+ce.length*(Qn-zt+1)})}else{var Nt=Me+ce.length;On({value:pe.substring(0,Me)+ce+pe.substring(nt),selectionStart:Nt,selectionEnd:Nt})}else if(Z.key==="Backspace"){var It=Me!==nt,bn=pe.substring(0,Me);if(bn.endsWith(ce)&&!It){Z.preventDefault();var Nt=Me-ce.length;On({value:pe.substring(0,Me-ce.length)+pe.substring(nt),selectionStart:Nt,selectionEnd:Nt})}}else if(Z.key==="Enter"){if(Me===nt){var xs=Wt(pe,Me).pop(),Za=xs?.match(/^\s+/);if(Za?.[0]){Z.preventDefault();var vs=`
|
|
46
46
|
`+Za[0],Nt=Me+vs.length;On({value:pe.substring(0,Me)+vs+pe.substring(nt),selectionStart:Nt,selectionEnd:Nt})}}}else if(Z.keyCode===b||Z.keyCode===C||Z.keyCode===v||Z.keyCode===S){var on=void 0;Z.keyCode===b&&Z.shiftKey?on=["(",")"]:Z.keyCode===C?Z.shiftKey?on=["{","}"]:on=["[","]"]:Z.keyCode===v?Z.shiftKey?on=['"','"']:on=["'","'"]:Z.keyCode===S&&!Z.shiftKey&&(on=["`","`"]),Me!==nt&&on&&(Z.preventDefault(),On({value:pe.substring(0,Me)+on[0]+pe.substring(Me,nt)+on[1]+pe.substring(nt),selectionStart:Me,selectionEnd:nt+2}))}else(z?Z.metaKey&&Z.keyCode===p:Z.ctrlKey&&Z.keyCode===p)&&!Z.shiftKey&&!Z.altKey?(Z.preventDefault(),Nl()):(z?Z.metaKey&&Z.keyCode===p&&Z.shiftKey:R?Z.ctrlKey&&Z.keyCode===m:Z.ctrlKey&&Z.keyCode===p&&Z.shiftKey)&&!Z.altKey?(Z.preventDefault(),gs()):Z.keyCode===g&&Z.ctrlKey&&(!z||Z.shiftKey)&&(Z.preventDefault(),ya(function(Pn){return!Pn}))}},Gn=function(Z){var Ee=Z.currentTarget,pe=Ee.value,Me=Ee.selectionStart,nt=Ee.selectionEnd;Kn({value:pe,selectionStart:Me,selectionEnd:nt},!0),$(pe)};return f.useEffect(function(){Ia()},[Ia]),f.useImperativeHandle(G,function(){return{get session(){return{history:je.current}},set session(Z){je.current=Z.history}}},[]),f.createElement("div",a({},qn,{style:a(a({},H.container),vt)}),f.createElement("pre",a({className:he,"aria-hidden":"true",style:a(a(a({},H.editor),H.highlight),Yn)},typeof ut=="string"?{dangerouslySetInnerHTML:{__html:ut+"<br />"}}:{children:ut})),f.createElement("textarea",{ref:function(Z){return Vt.current=Z},style:a(a(a({},H.editor),H.textarea),Yn),className:_+(tt?" ".concat(tt):""),id:Rt,value:Pt,onChange:Gn,onKeyDown:ys,onClick:de,onKeyUp:X,onFocus:Oe,onBlur:oe,disabled:J,form:ie,maxLength:k,minLength:W,name:V,placeholder:te,readOnly:_e,required:Ke,autoFocus:I,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),f.createElement("style",{dangerouslySetInnerHTML:{__html:L}}))}),H={container:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden"},textarea:{position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",WebkitTextFillColor:"transparent"},highlight:{position:"relative",pointerEvents:"none"},editor:{margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"}};return Gt.default=K,Gt}var qC=HC();const YC=hb(qC),KC=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function GC(a){return KC.some(l=>l.test(a))}function QC(a){if(!a.trim())return{valid:!0};try{return JSON.parse(a),{valid:!0}}catch(l){const c=l.message,d=c.match(/position (\d+)/);if(d){const f=parseInt(d[1],10),m=a.substring(0,f).split(`
|
|
47
|
-
`);return{valid:!1,error:c,line:m.length}}return{valid:!1,error:c}}}function Jy({value:a,onChange:l,language:r="json",readonly:c=!1,className:d,minHeight:f="300px"}){const{isDark:m}=py(),[p,g]=x.useState(!1),[b,C]=x.useState(!0),v=x.useMemo(()=>r==="json"?QC(a):{valid:!0},[a,r]),S=x.useCallback(M=>i.jsx(qS,{theme:m?Yp.nightOwl:Yp.github,code:M,language:r,children:({tokens:A,getLineProps:R,getTokenProps:z})=>{let _=!1;return i.jsx(i.Fragment,{children:A.map((L,K)=>i.jsx("div",{...R({line:L}),className:q(v.line===K+1&&"bg-destructive/20"),children:L.map((H,B)=>{let N=!1;if(H.types.includes("property")){const I=H.content.replace(/['"]/g,"");GC(I)?_=!0:_=!1}else(H.types.includes("string")||H.types.includes("number")||H.types.includes("boolean"))&&_?(N=!0,_=!1):H.types.includes("punctuation")&&H.content!==":"&&H.content!=="["&&H.content!=="{"&&(_=!1);const G=z({token:H});return N&&b&&(G.className=q(G.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),i.jsx("span",{...G},B)})},K))})}}),[m,r,v.line,b]);return i.jsxs("div",{className:q("flex flex-col",d),children:[i.jsxs("div",{className:q("relative rounded-md border overflow-hidden","bg-muted/30",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",c&&"opacity-70 cursor-not-allowed",!v.valid&&"border-destructive"),style:{minHeight:f},children:[i.jsx(YC,{value:a,onValueChange:c?()=>{}:l,highlight:S,padding:12,disabled:c,onFocus:()=>g(!0),onBlur:()=>g(!1),textareaClassName:q("focus:outline-none font-mono text-sm",c&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:f}},m?"dark-editor":"light-editor"),i.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:i.jsx(ot,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>C(!b),title:b?"Reveal sensitive values":"Mask sensitive values",children:b?i.jsx(to,{className:"h-3 w-3"}):i.jsx(eo,{className:"h-3 w-3"})})})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[v.valid?i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[i.jsx(no,{className:"w-3 h-3 text-green-500"}),"Valid ",r.toUpperCase()]}):i.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[i.jsx(od,{className:"w-3 h-3"}),v.error,v.line&&` (line ${v.line})`]}),c&&i.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const Ld=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Jy},Symbol.toStringTag,{value:"Module"})),PC={webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function VC(a,l){switch(l.type){case"SET_WEBSEARCH_CONFIG":return{...a,webSearchConfig:l.payload};case"SET_WEBSEARCH_STATUS":return{...a,webSearchStatus:l.payload};case"SET_WEBSEARCH_LOADING":return{...a,webSearchLoading:l.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...a,webSearchStatusLoading:l.payload};case"SET_WEBSEARCH_SAVING":return{...a,webSearchSaving:l.payload};case"SET_WEBSEARCH_ERROR":return{...a,webSearchError:l.payload};case"SET_WEBSEARCH_SUCCESS":return{...a,webSearchSuccess:l.payload};case"SET_GLOBALENV_CONFIG":return{...a,globalEnvConfig:l.payload};case"SET_GLOBALENV_LOADING":return{...a,globalEnvLoading:l.payload};case"SET_GLOBALENV_SAVING":return{...a,globalEnvSaving:l.payload};case"SET_GLOBALENV_ERROR":return{...a,globalEnvError:l.payload};case"SET_GLOBALENV_SUCCESS":return{...a,globalEnvSuccess:l.payload};case"SET_PROXY_CONFIG":return{...a,proxyConfig:l.payload};case"SET_PROXY_LOADING":return{...a,proxyLoading:l.payload};case"SET_PROXY_SAVING":return{...a,proxySaving:l.payload};case"SET_PROXY_ERROR":return{...a,proxyError:l.payload};case"SET_PROXY_SUCCESS":return{...a,proxySuccess:l.payload};case"SET_PROXY_TEST_RESULT":return{...a,proxyTestResult:l.payload};case"SET_PROXY_TESTING":return{...a,proxyTesting:l.payload};case"SET_RAW_CONFIG":return{...a,rawConfig:l.payload};case"SET_RAW_CONFIG_LOADING":return{...a,rawConfigLoading:l.payload};default:return a}}const ex=x.createContext(null);function XC({children:a}){const[l,r]=x.useReducer(VC,PC);return i.jsx(ex.Provider,{value:{state:l,dispatch:r},children:a})}function tx(){const a=x.useContext(ex);if(!a)throw new Error("useSettingsContext must be used within a SettingsProvider");return a}function WC(){const{dispatch:a}=tx(),l=x.useCallback(N=>a({type:"SET_WEBSEARCH_CONFIG",payload:N}),[a]),r=x.useCallback(N=>a({type:"SET_WEBSEARCH_STATUS",payload:N}),[a]),c=x.useCallback(N=>a({type:"SET_WEBSEARCH_LOADING",payload:N}),[a]),d=x.useCallback(N=>a({type:"SET_WEBSEARCH_STATUS_LOADING",payload:N}),[a]),f=x.useCallback(N=>a({type:"SET_WEBSEARCH_SAVING",payload:N}),[a]),m=x.useCallback(N=>a({type:"SET_WEBSEARCH_ERROR",payload:N}),[a]),p=x.useCallback(N=>a({type:"SET_WEBSEARCH_SUCCESS",payload:N}),[a]),g=x.useCallback(N=>a({type:"SET_GLOBALENV_CONFIG",payload:N}),[a]),b=x.useCallback(N=>a({type:"SET_GLOBALENV_LOADING",payload:N}),[a]),C=x.useCallback(N=>a({type:"SET_GLOBALENV_SAVING",payload:N}),[a]),v=x.useCallback(N=>a({type:"SET_GLOBALENV_ERROR",payload:N}),[a]),S=x.useCallback(N=>a({type:"SET_GLOBALENV_SUCCESS",payload:N}),[a]),M=x.useCallback(N=>a({type:"SET_PROXY_CONFIG",payload:N}),[a]),A=x.useCallback(N=>a({type:"SET_PROXY_LOADING",payload:N}),[a]),R=x.useCallback(N=>a({type:"SET_PROXY_SAVING",payload:N}),[a]),z=x.useCallback(N=>a({type:"SET_PROXY_ERROR",payload:N}),[a]),_=x.useCallback(N=>a({type:"SET_PROXY_SUCCESS",payload:N}),[a]),L=x.useCallback(N=>a({type:"SET_PROXY_TEST_RESULT",payload:N}),[a]),K=x.useCallback(N=>a({type:"SET_PROXY_TESTING",payload:N}),[a]),H=x.useCallback(N=>a({type:"SET_RAW_CONFIG",payload:N}),[a]),B=x.useCallback(N=>a({type:"SET_RAW_CONFIG_LOADING",payload:N}),[a]);return x.useMemo(()=>({setWebSearchConfig:l,setWebSearchStatus:r,setWebSearchLoading:c,setWebSearchStatusLoading:d,setWebSearchSaving:f,setWebSearchError:m,setWebSearchSuccess:p,setGlobalEnvConfig:g,setGlobalEnvLoading:b,setGlobalEnvSaving:C,setGlobalEnvError:v,setGlobalEnvSuccess:S,setProxyConfig:M,setProxyLoading:A,setProxySaving:R,setProxyError:z,setProxySuccess:_,setProxyTestResult:L,setProxyTesting:K,setRawConfig:H,setRawConfigLoading:B}),[l,r,c,d,f,m,p,g,b,C,v,S,M,A,R,z,_,L,K,H,B])}function IC(){const[a,l]=pb(),r=a.get("tab")?.toLowerCase(),c=r==="globalenv"?"globalenv":r==="proxy"?"proxy":r==="auth"?"auth":r==="thinking"?"thinking":r==="backups"?"backups":"websearch",d=x.useCallback(f=>{l({tab:f},{replace:!0})},[l]);return{activeTab:c,setActiveTab:d}}function ZC(){const{state:a}=tx(),l=WC(),[r,c]=x.useState(!1),d=x.useCallback(async()=>{try{l.setRawConfigLoading(!0);const m=await fetch("/api/config/raw");if(!m.ok){l.setRawConfig(null);return}const p=await m.text();l.setRawConfig(p)}catch{l.setRawConfig(null)}finally{l.setRawConfigLoading(!1)}},[l]),f=x.useCallback(async()=>{if(a.rawConfig)try{await navigator.clipboard.writeText(a.rawConfig),c(!0),setTimeout(()=>c(!1),2e3)}catch{}},[a.rawConfig]);return{rawConfig:a.rawConfig,loading:a.rawConfigLoading,copied:r,fetchRawConfig:d,copyToClipboard:f}}const $C=[{value:"websearch",label:"Web",icon:Ib},{value:"globalenv",label:"Env",icon:rd},{value:"thinking",label:"Think",icon:Zb},{value:"proxy",label:"Proxy",icon:$b},{value:"auth",label:"Auth",icon:ld},{value:"backups",label:"Backup",icon:Fb}];function yg({activeTab:a,onTabChange:l}){return i.jsx(Py,{value:a,onValueChange:r=>l(r),children:i.jsx(Dd,{className:"grid w-full grid-cols-6",children:$C.map(({value:r,label:c,icon:d})=>i.jsxs($r,{value:r,className:"gap-1.5 px-1 text-xs",children:[i.jsx(d,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c})]},r))})})}function xg(){return i.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[i.jsx(Ye,{className:"h-4 w-2/3"}),i.jsx("div",{className:"p-4 rounded-lg border",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ye,{className:"h-5 w-32"}),i.jsx(Ye,{className:"h-4 w-48"})]}),i.jsx(Ye,{className:"h-6 w-10 rounded-full"})]})}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(Ye,{className:"h-5 w-24"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ye,{className:"h-20 w-full rounded-lg"}),i.jsx(Ye,{className:"h-20 w-full rounded-lg"}),i.jsx(Ye,{className:"h-20 w-full rounded-lg"})]})]})]})}function nx(a,l=3,r=1e3){return a().catch(c=>{if(l<=0)throw c;return new Promise(d=>setTimeout(d,r)).then(()=>nx(a,l-1,r*2))})}function ps(a){return x.lazy(()=>nx(a))}const vg=ps(()=>ht(()=>import("./index-Dzby9K4O.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),bg=ps(()=>ht(()=>import("./globalenv-section-BKbOddIv.js"),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),Sg=ps(()=>ht(()=>import("./index-D1DFI7Lj.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8,9]))),Ng=ps(()=>ht(()=>import("./index-DNyQOJ27.js"),__vite__mapDeps([12,1,2,3,13,4,14,15,5,6,7,8,9]))),jg=ps(()=>ht(()=>import("./auth-section-47vsG_g9.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,9]))),wg=ps(()=>ht(()=>import("./backups-section-D-sat7Ti.js"),__vite__mapDeps([17,1,2,15,4,5,6,7,8,9])));class Cg extends x.Component{constructor(l){super(l),this.state={hasError:!1,error:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}render(){return this.state.hasError?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center p-6 max-w-md",children:[i.jsx(od,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),i.jsx("p",{className:"font-medium text-foreground mb-2",children:"Failed to load section"}),i.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||"Unknown error occurred"}),i.jsxs(ot,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[i.jsx(Si,{className:"w-4 h-4"}),"Reload page"]})]})}):this.props.children}}function FC(){const{activeTab:a,setActiveTab:l}=IC(),{rawConfig:r,loading:c,copied:d,fetchRawConfig:f,copyToClipboard:m}=ZC();x.useEffect(()=>{f()},[f]);const p=g=>{x.startTransition(()=>{l(g)})};return i.jsxs("div",{className:"h-[calc(100vh-100px)]",children:[i.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[i.jsx("div",{className:"border-b bg-background p-4",children:i.jsx(yg,{activeTab:a,onTabChange:p})}),i.jsx(Cg,{children:i.jsxs(x.Suspense,{fallback:i.jsx(xg,{}),children:[a==="websearch"&&i.jsx(vg,{}),a==="globalenv"&&i.jsx(bg,{}),a==="thinking"&&i.jsx(Sg,{}),a==="proxy"&&i.jsx(Ng,{}),a==="auth"&&i.jsx(jg,{}),a==="backups"&&i.jsx(wg,{})]})})]}),i.jsxs(Td,{direction:"horizontal",className:"h-full hidden md:flex",children:[i.jsx(ji,{defaultSize:40,minSize:30,maxSize:55,children:i.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[i.jsx("div",{className:"p-5 border-b bg-background",children:i.jsx(yg,{activeTab:a,onTabChange:p})}),i.jsx(Cg,{children:i.jsxs(x.Suspense,{fallback:i.jsx(xg,{}),children:[a==="websearch"&&i.jsx(vg,{}),a==="globalenv"&&i.jsx(bg,{}),a==="thinking"&&i.jsx(Sg,{}),a==="proxy"&&i.jsx(Ng,{}),a==="auth"&&i.jsx(jg,{}),a==="backups"&&i.jsx(wg,{})]})})]})}),i.jsx(Od,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:i.jsx(ao,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),i.jsx(ji,{defaultSize:60,minSize:35,children:i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Lp,{className:"w-5 h-5 text-primary"}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold",children:"config.yaml"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ot,{variant:"outline",size:"sm",onClick:m,disabled:!r,children:d?i.jsxs(i.Fragment,{children:[i.jsx(fs,{className:"w-4 h-4 mr-1"}),"Copied"]}):i.jsxs(i.Fragment,{children:[i.jsx(Wr,{className:"w-4 h-4 mr-1"}),"Copy"]})}),i.jsx(ot,{variant:"outline",size:"sm",onClick:f,disabled:c,children:i.jsx(Si,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto",children:c?i.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[i.jsx(Si,{className:"w-5 h-5 animate-spin mr-2"}),"Loading..."]}):r?i.jsx(Jy,{value:r,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):i.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:i.jsxs("div",{className:"text-center",children:[i.jsx(Lp,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{children:"Config file not found"}),i.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function JC(){return i.jsx(XC,{children:i.jsx(FC,{})})}const e2=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:JC},Symbol.toStringTag,{value:"Module"})),WM=ob,IM=ub,ZM=cb,t2=x.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>i.jsx(rb,{children:i.jsx(Fg,{ref:d,align:l,sideOffset:r,className:q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...c})}));t2.displayName=Fg.displayName;function n2(a,l,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:a,timeZoneName:r}).format(l).split(/\s/g).slice(2).join(" ")}const a2={},xi={};function gl(a,l){try{const c=(a2[a]||=new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"longOffset"}).format)(l).split("GMT")[1];return c in xi?xi[c]:Eg(c,c.split(":"))}catch{if(a in xi)return xi[a];const r=a?.match(l2);return r?Eg(a,r.slice(1)):NaN}}const l2=/([+-]\d\d):?(\d\d)?/;function Eg(a,l){const r=+(l[0]||0),c=+(l[1]||0),d=+(l[2]||0)/60;return xi[a]=r*60+c>0?r*60+c+d:r*60-c-d}class Ln extends Date{constructor(...l){super(),l.length>1&&typeof l[l.length-1]=="string"&&(this.timeZone=l.pop()),this.internal=new Date,isNaN(gl(this.timeZone,this))?this.setTime(NaN):l.length?typeof l[0]=="number"&&(l.length===1||l.length===2&&typeof l[1]!="number")?this.setTime(l[0]):typeof l[0]=="string"?this.setTime(+new Date(l[0])):l[0]instanceof Date?this.setTime(+l[0]):(this.setTime(+new Date(...l)),ax(this),td(this)):this.setTime(Date.now())}static tz(l,...r){return r.length?new Ln(...r,l):new Ln(Date.now(),l)}withTimeZone(l){return new Ln(+this,l)}getTimezoneOffset(){const l=-gl(this.timeZone,this);return l>0?Math.floor(l):Math.ceil(l)}setTime(l){return Date.prototype.setTime.apply(this,arguments),td(this),+this}[Symbol.for("constructDateFrom")](l){return new Ln(+new Date(l),this.timeZone)}}const Mg=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(a=>{if(!Mg.test(a))return;const l=a.replace(Mg,"$1UTC");Ln.prototype[l]&&(a.startsWith("get")?Ln.prototype[a]=function(){return this.internal[l]()}:(Ln.prototype[a]=function(){return Date.prototype[l].apply(this.internal,arguments),s2(this),+this},Ln.prototype[l]=function(){return Date.prototype[l].apply(this,arguments),td(this),+this}))});function td(a){a.internal.setTime(+a),a.internal.setUTCSeconds(a.internal.getUTCSeconds()-Math.round(-gl(a.timeZone,a)*60))}function s2(a){Date.prototype.setFullYear.call(a,a.internal.getUTCFullYear(),a.internal.getUTCMonth(),a.internal.getUTCDate()),Date.prototype.setHours.call(a,a.internal.getUTCHours(),a.internal.getUTCMinutes(),a.internal.getUTCSeconds(),a.internal.getUTCMilliseconds()),ax(a)}function ax(a){const l=gl(a.timeZone,a),r=l>0?Math.floor(l):Math.ceil(l),c=new Date(+a);c.setUTCHours(c.getUTCHours()-1);const d=-new Date(+a).getTimezoneOffset(),f=-new Date(+c).getTimezoneOffset(),m=d-f,p=Date.prototype.getHours.apply(a)!==a.internal.getUTCHours();m&&p&&a.internal.setUTCMinutes(a.internal.getUTCMinutes()+m);const g=d-r;g&&Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+g);const b=new Date(+a);b.setUTCSeconds(0);const C=d>0?b.getSeconds():(b.getSeconds()-60)%60,v=Math.round(-(gl(a.timeZone,a)*60))%60;(v||C)&&(a.internal.setUTCSeconds(a.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(a,Date.prototype.getUTCSeconds.call(a)+v+C));const S=gl(a.timeZone,a),M=S>0?Math.floor(S):Math.ceil(S),R=-new Date(+a).getTimezoneOffset()-M,z=M!==r,_=R-g;if(z&&_){Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+_);const L=gl(a.timeZone,a),K=L>0?Math.floor(L):Math.ceil(L),H=M-K;H&&(a.internal.setUTCMinutes(a.internal.getUTCMinutes()+H),Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+H))}}class fa extends Ln{static tz(l,...r){return r.length?new fa(...r,l):new fa(Date.now(),l)}toISOString(){const[l,r,c]=this.tzComponents(),d=`${l}${r}:${c}`;return this.internal.toISOString().slice(0,-1)+d}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[l,r,c,d]=this.internal.toUTCString().split(" ");return`${l?.slice(0,-1)} ${c} ${r} ${d}`}toTimeString(){const l=this.internal.toUTCString().split(" ")[4],[r,c,d]=this.tzComponents();return`${l} GMT${r}${c}${d} (${n2(this.timeZone,this)})`}toLocaleString(l,r){return Date.prototype.toLocaleString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleDateString(l,r){return Date.prototype.toLocaleDateString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleTimeString(l,r){return Date.prototype.toLocaleTimeString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}tzComponents(){const l=this.getTimezoneOffset(),r=l>0?"-":"+",c=String(Math.floor(Math.abs(l)/60)).padStart(2,"0"),d=String(Math.abs(l)%60).padStart(2,"0");return[r,c,d]}withTimeZone(l){return new fa(+this,l)}[Symbol.for("constructDateFrom")](l){return new fa(+new Date(l),this.timeZone)}}const Ag=5,i2=4;function r2(a,l){const r=l.startOfMonth(a),c=r.getDay()>0?r.getDay():7,d=l.addDays(a,-c+1),f=l.addDays(d,Ag*7-1);return l.getMonth(a)===l.getMonth(f)?Ag:i2}function lx(a,l){const r=l.startOfMonth(a),c=r.getDay();return c===1?r:c===0?l.addDays(r,-6):l.addDays(r,-1*(c-1))}function o2(a,l){const r=lx(a,l),c=r2(a,l);return l.addDays(r,c*7-1)}const sx={...di,labels:{labelDayButton:(a,l,r,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,p)=>hi(m,p,{locale:di,...r});let f=d(a,"PPPP");return l.today&&(f=`Today, ${f}`),l.selected&&(f=`${f}, selected`),f},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:a=>`Week ${a}`,labelYearDropdown:"Choose the Year",labelGrid:(a,l,r)=>{let c;return r&&typeof r.format=="function"?c=r.format.bind(r):c=(d,f)=>hi(d,f,{locale:di,...l}),c(a,"LLLL yyyy")},labelGridcell:(a,l,r,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,p)=>hi(m,p,{locale:di,...r});let f=d(a,"PPPP");return l?.today&&(f=`Today, ${f}`),f},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(a,l,r)=>{let c;return r&&typeof r.format=="function"?c=r.format.bind(r):c=(d,f)=>hi(d,f,{locale:di,...l}),c(a,"cccc")}}};class rn{constructor(l,r){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?fa.tz(this.options.timeZone):new this.Date,this.newDate=(c,d,f)=>this.overrides?.newDate?this.overrides.newDate(c,d,f):this.options.timeZone?new fa(c,d,f,this.options.timeZone):new Date(c,d,f),this.addDays=(c,d)=>this.overrides?.addDays?this.overrides.addDays(c,d):aS(c,d),this.addMonths=(c,d)=>this.overrides?.addMonths?this.overrides.addMonths(c,d):lS(c,d),this.addWeeks=(c,d)=>this.overrides?.addWeeks?this.overrides.addWeeks(c,d):sS(c,d),this.addYears=(c,d)=>this.overrides?.addYears?this.overrides.addYears(c,d):iS(c,d),this.differenceInCalendarDays=(c,d)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(c,d):rS(c,d),this.differenceInCalendarMonths=(c,d)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(c,d):oS(c,d),this.eachMonthOfInterval=c=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(c):cS(c),this.eachYearOfInterval=c=>{const d=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(c):uS(c),f=new Set(d.map(p=>this.getYear(p)));if(f.size===d.length)return d;const m=[];return f.forEach(p=>{m.push(new Date(p,0,1))}),m},this.endOfBroadcastWeek=c=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(c):o2(c,this),this.endOfISOWeek=c=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(c):dS(c),this.endOfMonth=c=>this.overrides?.endOfMonth?this.overrides.endOfMonth(c):fS(c),this.endOfWeek=(c,d)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(c,d):mS(c,this.options),this.endOfYear=c=>this.overrides?.endOfYear?this.overrides.endOfYear(c):hS(c),this.format=(c,d,f)=>{const m=this.overrides?.format?this.overrides.format(c,d,this.options):hi(c,d,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(m):m},this.getISOWeek=c=>this.overrides?.getISOWeek?this.overrides.getISOWeek(c):pS(c),this.getMonth=(c,d)=>this.overrides?.getMonth?this.overrides.getMonth(c,this.options):gS(c,this.options),this.getYear=(c,d)=>this.overrides?.getYear?this.overrides.getYear(c,this.options):yS(c,this.options),this.getWeek=(c,d)=>this.overrides?.getWeek?this.overrides.getWeek(c,this.options):xS(c,this.options),this.isAfter=(c,d)=>this.overrides?.isAfter?this.overrides.isAfter(c,d):vS(c,d),this.isBefore=(c,d)=>this.overrides?.isBefore?this.overrides.isBefore(c,d):bS(c,d),this.isDate=c=>this.overrides?.isDate?this.overrides.isDate(c):SS(c),this.isSameDay=(c,d)=>this.overrides?.isSameDay?this.overrides.isSameDay(c,d):NS(c,d),this.isSameMonth=(c,d)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(c,d):jS(c,d),this.isSameYear=(c,d)=>this.overrides?.isSameYear?this.overrides.isSameYear(c,d):wS(c,d),this.max=c=>this.overrides?.max?this.overrides.max(c):CS(c),this.min=c=>this.overrides?.min?this.overrides.min(c):ES(c),this.setMonth=(c,d)=>this.overrides?.setMonth?this.overrides.setMonth(c,d):MS(c,d),this.setYear=(c,d)=>this.overrides?.setYear?this.overrides.setYear(c,d):AS(c,d),this.startOfBroadcastWeek=(c,d)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(c,this):lx(c,this),this.startOfDay=c=>this.overrides?.startOfDay?this.overrides.startOfDay(c):TS(c),this.startOfISOWeek=c=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(c):OS(c),this.startOfMonth=c=>this.overrides?.startOfMonth?this.overrides.startOfMonth(c):_S(c),this.startOfWeek=(c,d)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(c,this.options):zS(c,this.options),this.startOfYear=c=>this.overrides?.startOfYear?this.overrides.startOfYear(c):DS(c),this.options={locale:sx,...l},this.overrides=r}getDigitMap(){const{numerals:l="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:l}),c={};for(let d=0;d<10;d++)c[d.toString()]=r.format(d);return c}replaceDigits(l){const r=this.getDigitMap();return l.replace(/\d/g,c=>r[c]||c)}formatNumber(l){return this.replaceDigits(l.toString())}getMonthYearOrder(){const l=this.options.locale?.code;return l&&rn.yearFirstLocales.has(l)?"year-first":"month-first"}formatMonthYear(l){const{locale:r,timeZone:c,numerals:d}=this.options,f=r?.code;if(f&&rn.yearFirstLocales.has(f))try{return new Intl.DateTimeFormat(f,{month:"long",year:"numeric",timeZone:c,numberingSystem:d}).format(l)}catch{}const m=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(l,m)}}rn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Hn=new rn;class ix{constructor(l,r,c=Hn){this.date=l,this.displayMonth=r,this.outside=!!(r&&!c.isSameMonth(l,r)),this.dateLib=c,this.isoDate=c.format(l,"yyyy-MM-dd"),this.displayMonthId=c.format(r,"yyyy-MM"),this.dateMonthId=c.format(l,"yyyy-MM")}isEqualTo(l){return this.dateLib.isSameDay(l.date,this.date)&&this.dateLib.isSameMonth(l.displayMonth,this.displayMonth)}}class c2{constructor(l,r){this.date=l,this.weeks=r}}class u2{constructor(l,r){this.days=r,this.weekNumber=l}}function d2(a){return ee.createElement("button",{...a})}function f2(a){return ee.createElement("span",{...a})}function m2(a){const{size:l=24,orientation:r="left",className:c}=a;return ee.createElement("svg",{className:c,width:l,height:l,viewBox:"0 0 24 24"},r==="up"&&ee.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&ee.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&ee.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&ee.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function h2(a){const{day:l,modifiers:r,...c}=a;return ee.createElement("td",{...c})}function p2(a){const{day:l,modifiers:r,...c}=a,d=ee.useRef(null);return ee.useEffect(()=>{r.focused&&d.current?.focus()},[r.focused]),ee.createElement("button",{ref:d,...c})}var ue;(function(a){a.Root="root",a.Chevron="chevron",a.Day="day",a.DayButton="day_button",a.CaptionLabel="caption_label",a.Dropdowns="dropdowns",a.Dropdown="dropdown",a.DropdownRoot="dropdown_root",a.Footer="footer",a.MonthGrid="month_grid",a.MonthCaption="month_caption",a.MonthsDropdown="months_dropdown",a.Month="month",a.Months="months",a.Nav="nav",a.NextMonthButton="button_next",a.PreviousMonthButton="button_previous",a.Week="week",a.Weeks="weeks",a.Weekday="weekday",a.Weekdays="weekdays",a.WeekNumber="week_number",a.WeekNumberHeader="week_number_header",a.YearsDropdown="years_dropdown"})(ue||(ue={}));var lt;(function(a){a.disabled="disabled",a.hidden="hidden",a.outside="outside",a.focused="focused",a.today="today"})(lt||(lt={}));var Cn;(function(a){a.range_end="range_end",a.range_middle="range_middle",a.range_start="range_start",a.selected="selected"})(Cn||(Cn={}));var sn;(function(a){a.weeks_before_enter="weeks_before_enter",a.weeks_before_exit="weeks_before_exit",a.weeks_after_enter="weeks_after_enter",a.weeks_after_exit="weeks_after_exit",a.caption_after_enter="caption_after_enter",a.caption_after_exit="caption_after_exit",a.caption_before_enter="caption_before_enter",a.caption_before_exit="caption_before_exit"})(sn||(sn={}));function g2(a){const{options:l,className:r,components:c,classNames:d,...f}=a,m=[d[ue.Dropdown],r].join(" "),p=l?.find(({value:g})=>g===f.value);return ee.createElement("span",{"data-disabled":f.disabled,className:d[ue.DropdownRoot]},ee.createElement(c.Select,{className:m,...f},l?.map(({value:g,label:b,disabled:C})=>ee.createElement(c.Option,{key:g,value:g,disabled:C},b))),ee.createElement("span",{className:d[ue.CaptionLabel],"aria-hidden":!0},p?.label,ee.createElement(c.Chevron,{orientation:"down",size:18,className:d[ue.Chevron]})))}function y2(a){return ee.createElement("div",{...a})}function x2(a){return ee.createElement("div",{...a})}function v2(a){const{calendarMonth:l,displayIndex:r,...c}=a;return ee.createElement("div",{...c},a.children)}function b2(a){const{calendarMonth:l,displayIndex:r,...c}=a;return ee.createElement("div",{...c})}function S2(a){return ee.createElement("table",{...a})}function N2(a){return ee.createElement("div",{...a})}const rx=x.createContext(void 0);function Ei(){const a=x.useContext(rx);if(a===void 0)throw new Error("useDayPicker() must be used within a custom component.");return a}function j2(a){const{components:l}=Ei();return ee.createElement(l.Dropdown,{...a})}function w2(a){const{onPreviousClick:l,onNextClick:r,previousMonth:c,nextMonth:d,...f}=a,{components:m,classNames:p,labels:{labelPrevious:g,labelNext:b}}=Ei(),C=x.useCallback(S=>{d&&r?.(S)},[d,r]),v=x.useCallback(S=>{c&&l?.(S)},[c,l]);return ee.createElement("nav",{...f},ee.createElement(m.PreviousMonthButton,{type:"button",className:p[ue.PreviousMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":g(c),onClick:v},ee.createElement(m.Chevron,{disabled:c?void 0:!0,className:p[ue.Chevron],orientation:"left"})),ee.createElement(m.NextMonthButton,{type:"button",className:p[ue.NextMonthButton],tabIndex:d?void 0:-1,"aria-disabled":d?void 0:!0,"aria-label":b(d),onClick:C},ee.createElement(m.Chevron,{disabled:d?void 0:!0,orientation:"right",className:p[ue.Chevron]})))}function C2(a){const{components:l}=Ei();return ee.createElement(l.Button,{...a})}function E2(a){return ee.createElement("option",{...a})}function M2(a){const{components:l}=Ei();return ee.createElement(l.Button,{...a})}function A2(a){const{rootRef:l,...r}=a;return ee.createElement("div",{...r,ref:l})}function T2(a){return ee.createElement("select",{...a})}function O2(a){const{week:l,...r}=a;return ee.createElement("tr",{...r})}function _2(a){return ee.createElement("th",{...a})}function z2(a){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...a}))}function D2(a){const{week:l,...r}=a;return ee.createElement("th",{...r})}function k2(a){return ee.createElement("th",{...a})}function R2(a){return ee.createElement("tbody",{...a})}function U2(a){const{components:l}=Ei();return ee.createElement(l.Dropdown,{...a})}const L2=Object.freeze(Object.defineProperty({__proto__:null,Button:d2,CaptionLabel:f2,Chevron:m2,Day:h2,DayButton:p2,Dropdown:g2,DropdownNav:y2,Footer:x2,Month:v2,MonthCaption:b2,MonthGrid:S2,Months:N2,MonthsDropdown:j2,Nav:w2,NextMonthButton:C2,Option:E2,PreviousMonthButton:M2,Root:A2,Select:T2,Week:O2,WeekNumber:D2,WeekNumberHeader:k2,Weekday:_2,Weekdays:z2,Weeks:R2,YearsDropdown:U2},Symbol.toStringTag,{value:"Module"}));function ma(a,l,r=!1,c=Hn){let{from:d,to:f}=a;const{differenceInCalendarDays:m,isSameDay:p}=c;return d&&f?(m(f,d)<0&&([d,f]=[f,d]),m(l,d)>=(r?1:0)&&m(f,l)>=(r?1:0)):!r&&f?p(f,l):!r&&d?p(d,l):!1}function Bd(a){return!!(a&&typeof a=="object"&&"before"in a&&"after"in a)}function yo(a){return!!(a&&typeof a=="object"&&"from"in a)}function Hd(a){return!!(a&&typeof a=="object"&&"after"in a)}function qd(a){return!!(a&&typeof a=="object"&&"before"in a)}function ox(a){return!!(a&&typeof a=="object"&&"dayOfWeek"in a)}function cx(a,l){return Array.isArray(a)&&a.every(l.isDate)}function ha(a,l,r=Hn){const c=Array.isArray(l)?l:[l],{isSameDay:d,differenceInCalendarDays:f,isAfter:m}=r;return c.some(p=>{if(typeof p=="boolean")return p;if(r.isDate(p))return d(a,p);if(cx(p,r))return p.some(g=>d(a,g));if(yo(p))return ma(p,a,!1,r);if(ox(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(a.getDay()):p.dayOfWeek===a.getDay();if(Bd(p)){const g=f(p.before,a),b=f(p.after,a),C=g>0,v=b<0;return m(p.before,p.after)?v&&C:C||v}return Hd(p)?f(a,p.after)>0:qd(p)?f(p.before,a)>0:typeof p=="function"?p(a):!1})}function B2(a,l,r,c,d){const{disabled:f,hidden:m,modifiers:p,showOutsideDays:g,broadcastCalendar:b,today:C=d.today()}=l,{isSameDay:v,isSameMonth:S,startOfMonth:M,isBefore:A,endOfMonth:R,isAfter:z}=d,_=r&&M(r),L=c&&R(c),K={[lt.focused]:[],[lt.outside]:[],[lt.disabled]:[],[lt.hidden]:[],[lt.today]:[]},H={};for(const B of a){const{date:N,displayMonth:G}=B,I=!!(G&&!S(N,G)),J=!!(_&&A(N,_)),ie=!!(L&&z(N,L)),ve=!!(f&&ha(N,f,d)),re=!!(m&&ha(N,m,d))||J||ie||!b&&!g&&I||b&&g===!1&&I,Be=v(N,C);I&&K.outside.push(B),ve&&K.disabled.push(B),re&&K.hidden.push(B),Be&&K.today.push(B),p&&Object.keys(p).forEach(Se=>{const be=p?.[Se];be&&ha(N,be,d)&&(H[Se]?H[Se].push(B):H[Se]=[B])})}return B=>{const N={[lt.focused]:!1,[lt.disabled]:!1,[lt.hidden]:!1,[lt.outside]:!1,[lt.today]:!1},G={};for(const I in K){const J=K[I];N[I]=J.some(ie=>ie===B)}for(const I in H)G[I]=H[I].some(J=>J===B);return{...N,...G}}}function H2(a,l,r={}){return Object.entries(a).filter(([,d])=>d===!0).reduce((d,[f])=>(r[f]?d.push(r[f]):l[lt[f]]?d.push(l[lt[f]]):l[Cn[f]]&&d.push(l[Cn[f]]),d),[l[ue.Day]])}function q2(a){return{...L2,...a}}function Y2(a){const l={"data-mode":a.mode??void 0,"data-required":"required"in a?a.required:void 0,"data-multiple-months":a.numberOfMonths&&a.numberOfMonths>1||void 0,"data-week-numbers":a.showWeekNumber||void 0,"data-broadcast-calendar":a.broadcastCalendar||void 0,"data-nav-layout":a.navLayout||void 0};return Object.entries(a).forEach(([r,c])=>{r.startsWith("data-")&&(l[r]=c)}),l}function K2(){const a={};for(const l in ue)a[ue[l]]=`rdp-${ue[l]}`;for(const l in lt)a[lt[l]]=`rdp-${lt[l]}`;for(const l in Cn)a[Cn[l]]=`rdp-${Cn[l]}`;for(const l in sn)a[sn[l]]=`rdp-${sn[l]}`;return a}function ux(a,l,r){return(r??new rn(l)).formatMonthYear(a)}const G2=ux;function Q2(a,l,r){return(r??new rn(l)).format(a,"d")}function P2(a,l=Hn){return l.format(a,"LLLL")}function V2(a,l,r){return(r??new rn(l)).format(a,"cccccc")}function X2(a,l=Hn){return a<10?l.formatNumber(`0${a.toLocaleString()}`):l.formatNumber(`${a.toLocaleString()}`)}function W2(){return""}function dx(a,l=Hn){return l.format(a,"yyyy")}const I2=dx,Z2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ux,formatDay:Q2,formatMonthCaption:G2,formatMonthDropdown:P2,formatWeekNumber:X2,formatWeekNumberHeader:W2,formatWeekdayName:V2,formatYearCaption:I2,formatYearDropdown:dx},Symbol.toStringTag,{value:"Module"}));function $2(a){return a?.formatMonthCaption&&!a.formatCaption&&(a.formatCaption=a.formatMonthCaption),a?.formatYearCaption&&!a.formatYearDropdown&&(a.formatYearDropdown=a.formatYearCaption),{...Z2,...a}}function Yd(a,l,r,c){let d=(c??new rn(r)).format(a,"PPPP");return l.today&&(d=`Today, ${d}`),l.selected&&(d=`${d}, selected`),d}const F2=Yd;function Kd(a,l,r){return(r??new rn(l)).formatMonthYear(a)}const J2=Kd;function fx(a,l,r,c){let d=(c??new rn(r)).format(a,"PPPP");return l?.today&&(d=`Today, ${d}`),d}function mx(a){return"Choose the Month"}function hx(){return""}const eE="Go to the Next Month";function px(a,l){return eE}function gx(a){return"Go to the Previous Month"}function yx(a,l,r){return(r??new rn(l)).format(a,"cccc")}function xx(a,l){return`Week ${a}`}function vx(a){return"Week Number"}function bx(a){return"Choose the Year"}const tE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:J2,labelDay:F2,labelDayButton:Yd,labelGrid:Kd,labelGridcell:fx,labelMonthDropdown:mx,labelNav:hx,labelNext:px,labelPrevious:gx,labelWeekNumber:xx,labelWeekNumberHeader:vx,labelWeekday:yx,labelYearDropdown:bx},Symbol.toStringTag,{value:"Module"})),wn=(a,l,r)=>l||(r?typeof r=="function"?r:(...c)=>r:a);function nE(a,l){const r=l.locale?.labels??{};return{...tE,...a??{},labelDayButton:wn(Yd,a?.labelDayButton,r.labelDayButton),labelMonthDropdown:wn(mx,a?.labelMonthDropdown,r.labelMonthDropdown),labelNext:wn(px,a?.labelNext,r.labelNext),labelPrevious:wn(gx,a?.labelPrevious,r.labelPrevious),labelWeekNumber:wn(xx,a?.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:wn(bx,a?.labelYearDropdown,r.labelYearDropdown),labelGrid:wn(Kd,a?.labelGrid,r.labelGrid),labelGridcell:wn(fx,a?.labelGridcell,r.labelGridcell),labelNav:wn(hx,a?.labelNav,r.labelNav),labelWeekNumberHeader:wn(vx,a?.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:wn(yx,a?.labelWeekday,r.labelWeekday)}}function aE(a,l,r,c,d){const{startOfMonth:f,startOfYear:m,endOfYear:p,eachMonthOfInterval:g,getMonth:b}=d;return g({start:m(a),end:p(a)}).map(S=>{const M=c.formatMonthDropdown(S,d),A=b(S),R=l&&S<f(l)||r&&S>f(r)||!1;return{value:A,label:M,disabled:R}})}function lE(a,l={},r={}){let c={...l?.[ue.Day]};return Object.entries(a).filter(([,d])=>d===!0).forEach(([d])=>{c={...c,...r?.[d]}}),c}function sE(a,l,r,c){const d=c??a.today(),f=r?a.startOfBroadcastWeek(d,a):l?a.startOfISOWeek(d):a.startOfWeek(d),m=[];for(let p=0;p<7;p++){const g=a.addDays(f,p);m.push(g)}return m}function iE(a,l,r,c,d=!1){if(!a||!l)return;const{startOfYear:f,endOfYear:m,eachYearOfInterval:p,getYear:g}=c,b=f(a),C=m(l),v=p({start:b,end:C});return d&&v.reverse(),v.map(S=>{const M=r.formatYearDropdown(S,c);return{value:g(S),label:M,disabled:!1}})}const Mi=a=>a instanceof HTMLElement?a:null,Yu=a=>[...a.querySelectorAll("[data-animated-month]")??[]],rE=a=>Mi(a.querySelector("[data-animated-month]")),Ku=a=>Mi(a.querySelector("[data-animated-caption]")),Gu=a=>Mi(a.querySelector("[data-animated-weeks]")),oE=a=>Mi(a.querySelector("[data-animated-nav]")),cE=a=>Mi(a.querySelector("[data-animated-weekdays]"));function uE(a,l,{classNames:r,months:c,focused:d,dateLib:f}){const m=x.useRef(null),p=x.useRef(c),g=x.useRef(!1);x.useLayoutEffect(()=>{const b=p.current;if(p.current=c,!l||!a.current||!(a.current instanceof HTMLElement)||c.length===0||b.length===0||c.length!==b.length)return;const C=f.isSameMonth(c[0].date,b[0].date),v=f.isAfter(c[0].date,b[0].date),S=v?r[sn.caption_after_enter]:r[sn.caption_before_enter],M=v?r[sn.weeks_after_enter]:r[sn.weeks_before_enter],A=m.current,R=a.current.cloneNode(!0);if(R instanceof HTMLElement?(Yu(R).forEach(K=>{if(!(K instanceof HTMLElement))return;const H=rE(K);H&&K.contains(H)&&K.removeChild(H);const B=Ku(K);B&&B.classList.remove(S);const N=Gu(K);N&&N.classList.remove(M)}),m.current=R):m.current=null,g.current||C||d)return;const z=A instanceof HTMLElement?Yu(A):[],_=Yu(a.current);if(_?.every(L=>L instanceof HTMLElement)&&z&&z.every(L=>L instanceof HTMLElement)){g.current=!0,a.current.style.isolation="isolate";const L=oE(a.current);L&&(L.style.zIndex="1"),_.forEach((K,H)=>{const B=z[H];if(!B)return;K.style.position="relative",K.style.overflow="hidden";const N=Ku(K);N&&N.classList.add(S);const G=Gu(K);G&&G.classList.add(M);const I=()=>{g.current=!1,a.current&&(a.current.style.isolation=""),L&&(L.style.zIndex=""),N&&N.classList.remove(S),G&&G.classList.remove(M),K.style.position="",K.style.overflow="",K.contains(B)&&K.removeChild(B)};B.style.pointerEvents="none",B.style.position="absolute",B.style.overflow="hidden",B.setAttribute("aria-hidden","true");const J=cE(B);J&&(J.style.opacity="0");const ie=Ku(B);ie&&(ie.classList.add(v?r[sn.caption_before_exit]:r[sn.caption_after_exit]),ie.addEventListener("animationend",I));const ve=Gu(B);ve&&ve.classList.add(v?r[sn.weeks_before_exit]:r[sn.weeks_after_exit]),K.insertBefore(B,K.firstChild)})}})}function dE(a,l,r,c){const d=a[0],f=a[a.length-1],{ISOWeek:m,fixedWeeks:p,broadcastCalendar:g}=r??{},{addDays:b,differenceInCalendarDays:C,differenceInCalendarMonths:v,endOfBroadcastWeek:S,endOfISOWeek:M,endOfMonth:A,endOfWeek:R,isAfter:z,startOfBroadcastWeek:_,startOfISOWeek:L,startOfWeek:K}=c,H=g?_(d,c):m?L(d):K(d),B=g?S(f):m?M(A(f)):R(A(f)),N=l&&(g?S(l):m?M(l):R(l)),G=N&&z(B,N)?N:B,I=C(G,H),J=v(f,d)+1,ie=[];for(let Be=0;Be<=I;Be++){const Se=b(H,Be);ie.push(Se)}const re=(g?35:42)*J;if(p&&ie.length<re){const Be=re-ie.length;for(let Se=0;Se<Be;Se++){const be=b(ie[ie.length-1],1);ie.push(be)}}return ie}function fE(a){const l=[];return a.reduce((r,c)=>{const d=c.weeks.reduce((f,m)=>f.concat(m.days.slice()),l.slice());return r.concat(d.slice())},l.slice())}function mE(a,l,r,c){const{numberOfMonths:d=1}=r,f=[];for(let m=0;m<d;m++){const p=c.addMonths(a,m);if(l&&p>l)break;f.push(p)}return f}function Tg(a,l,r,c){const{month:d,defaultMonth:f,today:m=c.today(),numberOfMonths:p=1}=a;let g=d||f||m;const{differenceInCalendarMonths:b,addMonths:C,startOfMonth:v}=c;if(r&&b(r,g)<p-1){const S=-1*(p-1);g=C(r,S)}return l&&b(g,l)<0&&(g=l),v(g)}function hE(a,l,r,c){const{addDays:d,endOfBroadcastWeek:f,endOfISOWeek:m,endOfMonth:p,endOfWeek:g,getISOWeek:b,getWeek:C,startOfBroadcastWeek:v,startOfISOWeek:S,startOfWeek:M}=c,A=a.reduce((R,z)=>{const _=r.broadcastCalendar?v(z,c):r.ISOWeek?S(z):M(z),L=r.broadcastCalendar?f(z):r.ISOWeek?m(p(z)):g(p(z)),K=l.filter(G=>G>=_&&G<=L),H=r.broadcastCalendar?35:42;if(r.fixedWeeks&&K.length<H){const G=l.filter(I=>{const J=H-K.length;return I>L&&I<=d(L,J)});K.push(...G)}const B=K.reduce((G,I)=>{const J=r.ISOWeek?b(I):C(I),ie=G.find(re=>re.weekNumber===J),ve=new ix(I,z,c);return ie?ie.days.push(ve):G.push(new u2(J,[ve])),G},[]),N=new c2(z,B);return R.push(N),R},[]);return r.reverseMonths?A.reverse():A}function pE(a,l){let{startMonth:r,endMonth:c}=a;const{startOfYear:d,startOfDay:f,startOfMonth:m,endOfMonth:p,addYears:g,endOfYear:b,newDate:C,today:v}=l,{fromYear:S,toYear:M,fromMonth:A,toMonth:R}=a;!r&&A&&(r=A),!r&&S&&(r=l.newDate(S,0,1)),!c&&R&&(c=R),!c&&M&&(c=C(M,11,31));const z=a.captionLayout==="dropdown"||a.captionLayout==="dropdown-years";return r?r=m(r):S?r=C(S,0,1):!r&&z&&(r=d(g(a.today??v(),-100))),c?c=p(c):M?c=C(M,11,31):!c&&z&&(c=b(a.today??v())),[r&&f(r),c&&f(c)]}function gE(a,l,r,c){if(r.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:f=1}=r,{startOfMonth:m,addMonths:p,differenceInCalendarMonths:g}=c,b=d?f:1,C=m(a);if(!l)return p(C,b);if(!(g(l,a)<f))return p(C,b)}function yE(a,l,r,c){if(r.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:f}=r,{startOfMonth:m,addMonths:p,differenceInCalendarMonths:g}=c,b=d?f??1:1,C=m(a);if(!l)return p(C,-b);if(!(g(C,l)<=0))return p(C,-b)}function xE(a){const l=[];return a.reduce((r,c)=>r.concat(c.weeks.slice()),l.slice())}function xo(a,l){const[r,c]=x.useState(a);return[l===void 0?r:l,c]}function vE(a,l){const[r,c]=pE(a,l),{startOfMonth:d,endOfMonth:f}=l,m=Tg(a,r,c,l),[p,g]=xo(m,a.month?m:void 0);x.useEffect(()=>{const H=Tg(a,r,c,l);g(H)},[a.timeZone]);const{months:b,weeks:C,days:v,previousMonth:S,nextMonth:M}=x.useMemo(()=>{const H=mE(p,c,{numberOfMonths:a.numberOfMonths},l),B=dE(H,a.endMonth?f(a.endMonth):void 0,{ISOWeek:a.ISOWeek,fixedWeeks:a.fixedWeeks,broadcastCalendar:a.broadcastCalendar},l),N=hE(H,B,{broadcastCalendar:a.broadcastCalendar,fixedWeeks:a.fixedWeeks,ISOWeek:a.ISOWeek,reverseMonths:a.reverseMonths},l),G=xE(N),I=fE(N),J=yE(p,r,a,l),ie=gE(p,c,a,l);return{months:N,weeks:G,days:I,previousMonth:J,nextMonth:ie}},[l,p.getTime(),c?.getTime(),r?.getTime(),a.disableNavigation,a.broadcastCalendar,a.endMonth?.getTime(),a.fixedWeeks,a.ISOWeek,a.numberOfMonths,a.pagedNavigation,a.reverseMonths]),{disableNavigation:A,onMonthChange:R}=a,z=H=>C.some(B=>B.days.some(N=>N.isEqualTo(H))),_=H=>{if(A)return;let B=d(H);r&&B<d(r)&&(B=d(r)),c&&B>d(c)&&(B=d(c)),g(B),R?.(B)};return{months:b,weeks:C,days:v,navStart:r,navEnd:c,previousMonth:S,nextMonth:M,goToMonth:_,goToDay:H=>{z(H)||_(H.date)}}}var Un;(function(a){a[a.Today=0]="Today",a[a.Selected=1]="Selected",a[a.LastFocused=2]="LastFocused",a[a.FocusedModifier=3]="FocusedModifier"})(Un||(Un={}));function Og(a){return!a[lt.disabled]&&!a[lt.hidden]&&!a[lt.outside]}function bE(a,l,r,c){let d,f=-1;for(const m of a){const p=l(m);Og(p)&&(p[lt.focused]&&f<Un.FocusedModifier?(d=m,f=Un.FocusedModifier):c?.isEqualTo(m)&&f<Un.LastFocused?(d=m,f=Un.LastFocused):r(m.date)&&f<Un.Selected?(d=m,f=Un.Selected):p[lt.today]&&f<Un.Today&&(d=m,f=Un.Today))}return d||(d=a.find(m=>Og(l(m)))),d}function SE(a,l,r,c,d,f,m){const{ISOWeek:p,broadcastCalendar:g}=f,{addDays:b,addMonths:C,addWeeks:v,addYears:S,endOfBroadcastWeek:M,endOfISOWeek:A,endOfWeek:R,max:z,min:_,startOfBroadcastWeek:L,startOfISOWeek:K,startOfWeek:H}=m;let N={day:b,week:v,month:C,year:S,startOfWeek:G=>g?L(G,m):p?K(G):H(G),endOfWeek:G=>g?M(G):p?A(G):R(G)}[a](r,l==="after"?1:-1);return l==="before"&&c?N=z([c,N]):l==="after"&&d&&(N=_([d,N])),N}function Sx(a,l,r,c,d,f,m,p=0){if(p>365)return;const g=SE(a,l,r.date,c,d,f,m),b=!!(f.disabled&&ha(g,f.disabled,m)),C=!!(f.hidden&&ha(g,f.hidden,m)),v=g,S=new ix(g,v,m);return!b&&!C?S:Sx(a,l,S,c,d,f,m,p+1)}function NE(a,l,r,c,d){const{autoFocus:f}=a,[m,p]=x.useState(),g=bE(l.days,r,c||(()=>!1),m),[b,C]=x.useState(f?g:void 0);return{isFocusTarget:R=>!!g?.isEqualTo(R),setFocused:C,focused:b,blur:()=>{p(b),C(void 0)},moveFocus:(R,z)=>{if(!b)return;const _=Sx(R,z,b,l.navStart,l.navEnd,a,d);_&&(a.disableNavigation&&!l.days.some(K=>K.isEqualTo(_))||(l.goToDay(_),C(_)))}}}function jE(a,l){const{selected:r,required:c,onSelect:d}=a,[f,m]=xo(r,d?r:void 0),p=d?r:f,{isSameDay:g}=l,b=M=>p?.some(A=>g(A,M))??!1,{min:C,max:v}=a;return{selected:p,select:(M,A,R)=>{let z=[...p??[]];if(b(M)){if(p?.length===C||c&&p?.length===1)return;z=p?.filter(_=>!g(_,M))}else p?.length===v?z=[M]:z=[...z,M];return d||m(z),d?.(z,M,A,R),z},isSelected:b}}function wE(a,l,r=0,c=0,d=!1,f=Hn){const{from:m,to:p}=l||{},{isSameDay:g,isAfter:b,isBefore:C}=f;let v;if(!m&&!p)v={from:a,to:r>0?void 0:a};else if(m&&!p)g(m,a)?r===0?v={from:m,to:a}:d?v={from:m,to:void 0}:v=void 0:C(a,m)?v={from:a,to:m}:v={from:m,to:a};else if(m&&p)if(g(m,a)&&g(p,a))d?v={from:m,to:p}:v=void 0;else if(g(m,a))v={from:m,to:r>0?void 0:a};else if(g(p,a))v={from:a,to:r>0?void 0:a};else if(C(a,m))v={from:a,to:p};else if(b(a,m))v={from:m,to:a};else if(b(a,p))v={from:m,to:a};else throw new Error("Invalid range");if(v?.from&&v?.to){const S=f.differenceInCalendarDays(v.to,v.from);c>0&&S>c?v={from:a,to:void 0}:r>1&&S<r&&(v={from:a,to:void 0})}return v}function CE(a,l,r=Hn){const c=Array.isArray(l)?l:[l];let d=a.from;const f=r.differenceInCalendarDays(a.to,a.from),m=Math.min(f,6);for(let p=0;p<=m;p++){if(c.includes(d.getDay()))return!0;d=r.addDays(d,1)}return!1}function _g(a,l,r=Hn){return ma(a,l.from,!1,r)||ma(a,l.to,!1,r)||ma(l,a.from,!1,r)||ma(l,a.to,!1,r)}function EE(a,l,r=Hn){const c=Array.isArray(l)?l:[l];if(c.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:r.isDate(p)?ma(a,p,!1,r):cx(p,r)?p.some(g=>ma(a,g,!1,r)):yo(p)?p.from&&p.to?_g(a,{from:p.from,to:p.to},r):!1:ox(p)?CE(a,p.dayOfWeek,r):Bd(p)?r.isAfter(p.before,p.after)?_g(a,{from:r.addDays(p.after,1),to:r.addDays(p.before,-1)},r):ha(a.from,p,r)||ha(a.to,p,r):Hd(p)||qd(p)?ha(a.from,p,r)||ha(a.to,p,r):!1))return!0;const m=c.filter(p=>typeof p=="function");if(m.length){let p=a.from;const g=r.differenceInCalendarDays(a.to,a.from);for(let b=0;b<=g;b++){if(m.some(C=>C(p)))return!0;p=r.addDays(p,1)}}return!1}function ME(a,l){const{disabled:r,excludeDisabled:c,selected:d,required:f,onSelect:m}=a,[p,g]=xo(d,m?d:void 0),b=m?d:p;return{selected:b,select:(S,M,A)=>{const{min:R,max:z}=a,_=S?wE(S,b,R,z,f,l):void 0;return c&&r&&_?.from&&_.to&&EE({from:_.from,to:_.to},r,l)&&(_.from=S,_.to=void 0),m||g(_),m?.(_,S,M,A),_},isSelected:S=>b&&ma(b,S,!1,l)}}function AE(a,l){const{selected:r,required:c,onSelect:d}=a,[f,m]=xo(r,d?r:void 0),p=d?r:f,{isSameDay:g}=l;return{selected:p,select:(v,S,M)=>{let A=v;return!c&&p&&p&&g(v,p)&&(A=void 0),d||m(A),d?.(A,v,S,M),A},isSelected:v=>p?g(p,v):!1}}function TE(a,l){const r=AE(a,l),c=jE(a,l),d=ME(a,l);switch(a.mode){case"single":return r;case"multiple":return c;case"range":return d;default:return}}function Ot(a,l){return a instanceof fa&&a.timeZone===l?a:new fa(a,l)}function zg(a,l){return typeof a=="boolean"||typeof a=="function"?a:a instanceof Date?Ot(a,l):Array.isArray(a)?a.map(r=>r instanceof Date?Ot(r,l):r):yo(a)?{...a,from:a.from?Ot(a.from,l):a.from,to:a.to?Ot(a.to,l):a.to}:Bd(a)?{before:Ot(a.before,l),after:Ot(a.after,l)}:Hd(a)?{after:Ot(a.after,l)}:qd(a)?{before:Ot(a.before,l)}:a}function Qu(a,l){return a&&(Array.isArray(a)?a.map(r=>zg(r,l)):zg(a,l))}function OE(a){let l=a;const r=l.timeZone;if(r&&(l={...a,timeZone:r},l.today&&(l.today=Ot(l.today,r)),l.month&&(l.month=Ot(l.month,r)),l.defaultMonth&&(l.defaultMonth=Ot(l.defaultMonth,r)),l.startMonth&&(l.startMonth=Ot(l.startMonth,r)),l.endMonth&&(l.endMonth=Ot(l.endMonth,r)),l.mode==="single"&&l.selected?l.selected=Ot(l.selected,r):l.mode==="multiple"&&l.selected?l.selected=l.selected?.map(ce=>Ot(ce,r)):l.mode==="range"&&l.selected&&(l.selected={from:l.selected.from?Ot(l.selected.from,r):l.selected.from,to:l.selected.to?Ot(l.selected.to,r):l.selected.to}),l.disabled!==void 0&&(l.disabled=Qu(l.disabled,r)),l.hidden!==void 0&&(l.hidden=Qu(l.hidden,r)),l.modifiers)){const ce={};Object.keys(l.modifiers).forEach(Ne=>{ce[Ne]=Qu(l.modifiers?.[Ne],r)}),l.modifiers=ce}const{components:c,formatters:d,labels:f,dateLib:m,locale:p,classNames:g}=x.useMemo(()=>{const ce={...sx,...l.locale},Ne=new rn({locale:ce,weekStartsOn:l.broadcastCalendar?1:l.weekStartsOn,firstWeekContainsDate:l.firstWeekContainsDate,useAdditionalWeekYearTokens:l.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:l.useAdditionalDayOfYearTokens,timeZone:l.timeZone,numerals:l.numerals},l.dateLib);return{dateLib:Ne,components:q2(l.components),formatters:$2(l.formatters),labels:nE(l.labels,Ne.options),locale:ce,classNames:{...K2(),...l.classNames}}},[l.locale,l.broadcastCalendar,l.weekStartsOn,l.firstWeekContainsDate,l.useAdditionalWeekYearTokens,l.useAdditionalDayOfYearTokens,l.timeZone,l.numerals,l.dateLib,l.components,l.formatters,l.labels,l.classNames]);l.today||(l={...l,today:m.today()});const{captionLayout:b,mode:C,navLayout:v,numberOfMonths:S=1,onDayBlur:M,onDayClick:A,onDayFocus:R,onDayKeyDown:z,onDayMouseEnter:_,onDayMouseLeave:L,onNextClick:K,onPrevClick:H,showWeekNumber:B,styles:N}=l,{formatCaption:G,formatDay:I,formatMonthDropdown:J,formatWeekNumber:ie,formatWeekNumberHeader:ve,formatWeekdayName:re,formatYearDropdown:Be}=d,Se=vE(l,m),{days:be,months:k,navStart:W,navEnd:V,previousMonth:oe,nextMonth:de,goToMonth:Oe}=Se,ze=B2(be,l,W,V,m),{isSelected:X,select:$,selected:ne}=TE(l,m)??{},{blur:F,focused:te,isFocusTarget:he,moveFocus:_e,setFocused:Ke}=NE(l,Se,ze,X??(()=>!1),m),{labelDayButton:vt,labelGridcell:bt,labelGrid:Qe,labelMonthDropdown:tt,labelNav:Rt,labelPrevious:Pt,labelNext:qn,labelWeekday:je,labelWeekNumber:Vt,labelWeekNumberHeader:An,labelYearDropdown:Xt}=f,ya=x.useMemo(()=>sE(m,l.ISOWeek,l.broadcastCalendar,l.today),[m,l.ISOWeek,l.broadcastCalendar,l.today]),Yn=C!==void 0||A!==void 0,ut=x.useCallback(()=>{oe&&(Oe(oe),H?.(oe))},[oe,Oe,H]),Wt=x.useCallback(()=>{de&&(Oe(de),K?.(de))},[Oe,de,K]),Kn=x.useCallback((ce,Ne)=>ge=>{ge.preventDefault(),ge.stopPropagation(),Ke(ce),!Ne.disabled&&($?.(ce.date,Ne,ge),A?.(ce.date,Ne,ge))},[$,A,Ke]),Ia=x.useCallback((ce,Ne)=>ge=>{Ke(ce),R?.(ce.date,Ne,ge)},[R,Ke]),Tn=x.useCallback((ce,Ne)=>ge=>{F(),M?.(ce.date,Ne,ge)},[F,M]),On=x.useCallback((ce,Ne)=>ge=>{const Ae={ArrowLeft:[ge.shiftKey?"month":"day",l.dir==="rtl"?"after":"before"],ArrowRight:[ge.shiftKey?"month":"day",l.dir==="rtl"?"before":"after"],ArrowDown:[ge.shiftKey?"year":"week","after"],ArrowUp:[ge.shiftKey?"year":"week","before"],PageUp:[ge.shiftKey?"year":"month","before"],PageDown:[ge.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ge.key]){ge.preventDefault(),ge.stopPropagation();const[Fe,xe]=Ae[ge.key];_e(Fe,xe)}z?.(ce.date,Ne,ge)},[_e,z,l.dir]),Nl=x.useCallback((ce,Ne)=>ge=>{_?.(ce.date,Ne,ge)},[_]),gs=x.useCallback((ce,Ne)=>ge=>{L?.(ce.date,Ne,ge)},[L]),ys=x.useCallback(ce=>Ne=>{const ge=Number(Ne.target.value),Ae=m.setMonth(m.startOfMonth(ce),ge);Oe(Ae)},[m,Oe]),Gn=x.useCallback(ce=>Ne=>{const ge=Number(Ne.target.value),Ae=m.setYear(m.startOfMonth(ce),ge);Oe(Ae)},[m,Oe]),{className:Z,style:Ee}=x.useMemo(()=>({className:[g[ue.Root],l.className].filter(Boolean).join(" "),style:{...N?.[ue.Root],...l.style}}),[g,l.className,l.style,N]),pe=Y2(l),Me=x.useRef(null);uE(Me,!!l.animate,{classNames:g,months:k,focused:te,dateLib:m});const nt={dayPickerProps:l,selected:ne,select:$,isSelected:X,months:k,nextMonth:de,previousMonth:oe,goToMonth:Oe,getModifiers:ze,components:c,classNames:g,styles:N,labels:f,formatters:d};return ee.createElement(rx.Provider,{value:nt},ee.createElement(c.Root,{rootRef:l.animate?Me:void 0,className:Z,style:Ee,dir:l.dir,id:l.id,lang:l.lang,nonce:l.nonce,title:l.title,role:l.role,"aria-label":l["aria-label"],"aria-labelledby":l["aria-labelledby"],...pe},ee.createElement(c.Months,{className:g[ue.Months],style:N?.[ue.Months]},!l.hideNavigation&&!v&&ee.createElement(c.Nav,{"data-animated-nav":l.animate?"true":void 0,className:g[ue.Nav],style:N?.[ue.Nav],"aria-label":Rt(),onPreviousClick:ut,onNextClick:Wt,previousMonth:oe,nextMonth:de}),k.map((ce,Ne)=>ee.createElement(c.Month,{"data-animated-month":l.animate?"true":void 0,className:g[ue.Month],style:N?.[ue.Month],key:Ne,displayIndex:Ne,calendarMonth:ce},v==="around"&&!l.hideNavigation&&Ne===0&&ee.createElement(c.PreviousMonthButton,{type:"button",className:g[ue.PreviousMonthButton],tabIndex:oe?void 0:-1,"aria-disabled":oe?void 0:!0,"aria-label":Pt(oe),onClick:ut,"data-animated-button":l.animate?"true":void 0},ee.createElement(c.Chevron,{disabled:oe?void 0:!0,className:g[ue.Chevron],orientation:l.dir==="rtl"?"right":"left"})),ee.createElement(c.MonthCaption,{"data-animated-caption":l.animate?"true":void 0,className:g[ue.MonthCaption],style:N?.[ue.MonthCaption],calendarMonth:ce,displayIndex:Ne},b?.startsWith("dropdown")?ee.createElement(c.DropdownNav,{className:g[ue.Dropdowns],style:N?.[ue.Dropdowns]},(()=>{const ge=b==="dropdown"||b==="dropdown-months"?ee.createElement(c.MonthsDropdown,{key:"month",className:g[ue.MonthsDropdown],"aria-label":tt(),classNames:g,components:c,disabled:!!l.disableNavigation,onChange:ys(ce.date),options:aE(ce.date,W,V,d,m),style:N?.[ue.Dropdown],value:m.getMonth(ce.date)}):ee.createElement("span",{key:"month"},J(ce.date,m)),Ae=b==="dropdown"||b==="dropdown-years"?ee.createElement(c.YearsDropdown,{key:"year",className:g[ue.YearsDropdown],"aria-label":Xt(m.options),classNames:g,components:c,disabled:!!l.disableNavigation,onChange:Gn(ce.date),options:iE(W,V,d,m,!!l.reverseYears),style:N?.[ue.Dropdown],value:m.getYear(ce.date)}):ee.createElement("span",{key:"year"},Be(ce.date,m));return m.getMonthYearOrder()==="year-first"?[Ae,ge]:[ge,Ae]})(),ee.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},G(ce.date,m.options,m))):ee.createElement(c.CaptionLabel,{className:g[ue.CaptionLabel],role:"status","aria-live":"polite"},G(ce.date,m.options,m))),v==="around"&&!l.hideNavigation&&Ne===S-1&&ee.createElement(c.NextMonthButton,{type:"button",className:g[ue.NextMonthButton],tabIndex:de?void 0:-1,"aria-disabled":de?void 0:!0,"aria-label":qn(de),onClick:Wt,"data-animated-button":l.animate?"true":void 0},ee.createElement(c.Chevron,{disabled:de?void 0:!0,className:g[ue.Chevron],orientation:l.dir==="rtl"?"left":"right"})),Ne===S-1&&v==="after"&&!l.hideNavigation&&ee.createElement(c.Nav,{"data-animated-nav":l.animate?"true":void 0,className:g[ue.Nav],style:N?.[ue.Nav],"aria-label":Rt(),onPreviousClick:ut,onNextClick:Wt,previousMonth:oe,nextMonth:de}),ee.createElement(c.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Qe(ce.date,m.options,m)||void 0,className:g[ue.MonthGrid],style:N?.[ue.MonthGrid]},!l.hideWeekdays&&ee.createElement(c.Weekdays,{"data-animated-weekdays":l.animate?"true":void 0,className:g[ue.Weekdays],style:N?.[ue.Weekdays]},B&&ee.createElement(c.WeekNumberHeader,{"aria-label":An(m.options),className:g[ue.WeekNumberHeader],style:N?.[ue.WeekNumberHeader],scope:"col"},ve()),ya.map(ge=>ee.createElement(c.Weekday,{"aria-label":je(ge,m.options,m),className:g[ue.Weekday],key:String(ge),style:N?.[ue.Weekday],scope:"col"},re(ge,m.options,m)))),ee.createElement(c.Weeks,{"data-animated-weeks":l.animate?"true":void 0,className:g[ue.Weeks],style:N?.[ue.Weeks]},ce.weeks.map(ge=>ee.createElement(c.Week,{className:g[ue.Week],key:ge.weekNumber,style:N?.[ue.Week],week:ge},B&&ee.createElement(c.WeekNumber,{week:ge,style:N?.[ue.WeekNumber],"aria-label":Vt(ge.weekNumber,{locale:p}),className:g[ue.WeekNumber],scope:"row",role:"rowheader"},ie(ge.weekNumber,m)),ge.days.map(Ae=>{const{date:Fe}=Ae,xe=ze(Ae);if(xe[lt.focused]=!xe.hidden&&!!te?.isEqualTo(Ae),xe[Cn.selected]=X?.(Fe)||xe.selected,yo(ne)){const{from:It,to:bn}=ne;xe[Cn.range_start]=!!(It&&bn&&m.isSameDay(Fe,It)),xe[Cn.range_end]=!!(It&&bn&&m.isSameDay(Fe,bn)),xe[Cn.range_middle]=ma(ne,Fe,!0,m)}const zt=lE(xe,N,l.modifiersStyles),Qn=H2(xe,g,l.modifiersClassNames),Nt=!Yn&&!xe.hidden?bt(Fe,xe,m.options,m):void 0;return ee.createElement(c.Day,{key:`${Ae.isoDate}_${Ae.displayMonthId}`,day:Ae,modifiers:xe,className:Qn.join(" "),style:zt,role:"gridcell","aria-selected":xe.selected||void 0,"aria-label":Nt,"data-day":Ae.isoDate,"data-month":Ae.outside?Ae.dateMonthId:void 0,"data-selected":xe.selected||void 0,"data-disabled":xe.disabled||void 0,"data-hidden":xe.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":xe.focused||void 0,"data-today":xe.today||void 0},!xe.hidden&&Yn?ee.createElement(c.DayButton,{className:g[ue.DayButton],style:N?.[ue.DayButton],type:"button",day:Ae,modifiers:xe,disabled:!xe.focused&&xe.disabled||void 0,"aria-disabled":xe.focused&&xe.disabled||void 0,tabIndex:he(Ae)?0:-1,"aria-label":vt(Fe,xe,m.options,m),onClick:Kn(Ae,xe),onBlur:Tn(Ae,xe),onFocus:Ia(Ae,xe),onKeyDown:On(Ae,xe),onMouseEnter:Nl(Ae,xe),onMouseLeave:gs(Ae,xe)},I(Fe,m.options,m)):!xe.hidden&&I(Ae.date,m.options,m))})))))))),l.footer&&ee.createElement(c.Footer,{className:g[ue.Footer],style:N?.[ue.Footer],role:"status","aria-live":"polite"},l.footer)))}function _E({className:a,classNames:l,showOutsideDays:r=!0,...c}){return i.jsx(OE,{showOutsideDays:r,className:q("p-2",a),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Qr({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Qr({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Qr({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...l},components:{Chevron:({orientation:d,className:f,...m})=>{const p=d==="left"?Jb:d==="right"?Jr:d==="up"?id:so;return i.jsx(p,{className:q("h-4 w-4",f),...m})}},...c})}_E.displayName="Calendar";const zE=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function $M({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,rawSettingsEnv:c,onChange:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(zE,{value:a,onChange:d,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:c})})})]})})}const FM={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},JM=[{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccsd alias or --target droid for one-off target overrides."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccsd-command",label:"Run once with Droid alias",description:"Use ccsd to force Droid target with your current profile.",type:"command",command:"ccsd glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccsd glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates inbox is available for rollout tasks",summary:"A focused updates inbox exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open updates inbox when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Inbox",path:"/updates"}],commands:["ccs config"]}],DE=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccsd glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccsd alias for automatic Droid target selection."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and target.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs codex","ccs cliproxy create mycodex --provider codex"]},{id:"gemini-cliproxy",name:"Gemini via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Gemini provider with multi-account management.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs gemini","ccs cliproxy create mygem --provider gemini"]},{id:"agy-cliproxy",name:"Antigravity via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Antigravity provider with variant target controls.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs agy","ccs cliproxy create myagy --provider agy --target droid"]},{id:"custom-api-profiles",name:"Custom API Profiles",scope:"api-profiles",status:"stable",summary:"Any Anthropic-compatible endpoint with per-profile target and model mapping.",pillars:{baseUrl:"User-defined endpoint",auth:"User-defined token/key",model:"User-defined model identifier"},routes:[{label:"API Profiles",path:"/providers"}],commands:["ccs api create myprofile",'ccs myprofile "your prompt"']},{id:"opencode-websearch",name:"OpenCode WebSearch",scope:"websearch",status:"stable",summary:"WebSearch provider surfaced in Settings for third-party profile workflows.",pillars:{baseUrl:"Managed by OpenCode CLI integration",auth:"Provider-specific (managed externally)",model:"Configurable in WebSearch settings"},routes:[{label:"Settings",path:"/settings"}],commands:["ccs config",'ccs codex "your prompt"'],notes:"Enable OpenCode in Settings > WebSearch to activate fallback search."}],kE=new Map(DE.map(a=>[a.id,a]));function eA(a){return a.entryIds.map(l=>kE.get(l)).filter(l=>!!l)}function tA(a){const l=new Date(`${a}T00:00:00Z`);return Number.isNaN(l.getTime())?a:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(l)}function RE(){const[a,l]=x.useState(""),[r,c]=x.useState(""),[d,f]=x.useState(null),[m,p]=x.useState(!1),{login:g,authRequired:b,isAuthenticated:C}=dd(),v=ad(),M=nd().state?.from?.pathname||"/";if(x.useEffect(()=>{(C||!b)&&v(M,{replace:!0})},[C,b,v,M]),C||!b)return null;const A=async R=>{R.preventDefault(),f(null),p(!0);try{await g(a,r),v(M,{replace:!0})}catch(z){f(z instanceof Error?z.message:"Login failed")}finally{p(!1)}};return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs(OC,{className:"w-full max-w-sm",children:[i.jsxs(_C,{className:"space-y-1 text-center",children:[i.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:i.jsx(eS,{className:"h-6 w-6 text-primary"})}),i.jsx(zC,{className:"text-2xl",children:"CCS Dashboard"}),i.jsx(DC,{children:"Enter your credentials to access the dashboard"})]}),i.jsx(kC,{children:i.jsxs("form",{onSubmit:A,className:"space-y-4",children:[d&&i.jsxs(_d,{variant:"destructive",children:[i.jsx(od,{className:"h-4 w-4"}),i.jsx(zd,{children:d})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{htmlFor:"username",children:"Username"}),i.jsx(Rn,{id:"username",type:"text",value:a,onChange:R=>l(R.target.value),placeholder:"Enter username",autoComplete:"username",disabled:m,required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{htmlFor:"password",children:"Password"}),i.jsx(Rn,{id:"password",type:"password",value:r,onChange:R=>c(R.target.value),placeholder:"Enter password",autoComplete:"current-password",disabled:m,required:!0})]}),i.jsx(ot,{type:"submit",className:"w-full",disabled:m,children:m?i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"})]})})]})})}const UE=x.lazy(()=>ht(()=>import("./index-Cl-418Sf.js"),__vite__mapDeps([18,1,2,4,5,7,19,6,8,9])).then(a=>({default:a.AnalyticsPage}))),LE=x.lazy(()=>ht(()=>import("./api-B2ICvWzi.js"),__vite__mapDeps([20,1,2,5,21,15,6,4,22,7,8,9])).then(a=>({default:a.ApiPage}))),BE=x.lazy(()=>ht(()=>import("./cliproxy-CAR-zTil.js"),__vite__mapDeps([23,1,2,5,13,6,4,24,21,15,22,3,14,7,8,9])).then(a=>({default:a.CliproxyPage}))),HE=x.lazy(()=>ht(()=>import("./cliproxy-control-panel-3uthxEI-.js"),__vite__mapDeps([25,1,2,5,13,4,6,7,8,9])).then(a=>({default:a.CliproxyControlPanelPage}))),qE=x.lazy(()=>ht(()=>import("./copilot-Dz0B1ZUz.js"),__vite__mapDeps([26,1,2,5,21,15,4,22,3,6,7,8,9])).then(a=>({default:a.CopilotPage}))),YE=x.lazy(()=>ht(()=>import("./cursor-DdPXjHsr.js"),__vite__mapDeps([27,1,2,6,5,13,3,22,4,7,8,9])).then(a=>({default:a.CursorPage}))),KE=x.lazy(()=>ht(()=>import("./droid-DE-zbt4u.js"),__vite__mapDeps([28,1,2,6,5,4,22,7,8,9])).then(a=>({default:a.DroidPage}))),GE=x.lazy(()=>ht(()=>import("./accounts-B3RlymZc.js"),__vite__mapDeps([29,1,2,5,15,6,4,24,7,8,9])).then(a=>({default:a.AccountsPage}))),QE=x.lazy(()=>ht(()=>Promise.resolve().then(()=>e2),void 0).then(a=>({default:a.SettingsPage}))),PE=x.lazy(()=>ht(()=>import("./health-Bu6uaf__.js"),__vite__mapDeps([30,1,2,5,6,4,7,8,9])).then(a=>({default:a.HealthPage}))),VE=x.lazy(()=>ht(()=>import("./shared-qWuCxx8B.js"),__vite__mapDeps([31,1,2,4,5,6,7,8,9])).then(a=>({default:a.SharedPage}))),XE=x.lazy(()=>ht(()=>import("./updates-BIpeiM6l.js"),__vite__mapDeps([32,1,2,4,5,6,7,8,9])).then(a=>({default:a.UpdatesPage})));function vn(){return i.jsx("div",{className:"flex h-64 items-center justify-center",children:i.jsx(Mn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function WE(){return i.jsx(vb,{client:WS,children:i.jsx(ZS,{defaultTheme:"system",storageKey:"vite-ui-theme",children:i.jsx($S,{children:i.jsx(n1,{children:i.jsxs(gb,{children:[i.jsxs(yb,{children:[i.jsx(Dt,{path:"/login",element:i.jsx(RE,{})}),i.jsx(Dt,{element:i.jsx(a1,{}),children:i.jsxs(Dt,{element:i.jsx(WN,{}),children:[i.jsx(Dt,{path:"/",element:i.jsx(Qw,{})}),i.jsx(Dt,{path:"/analytics",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(UE,{})})}),i.jsx(Dt,{path:"/updates",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(XE,{})})}),i.jsx(Dt,{path:"/providers",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(LE,{})})}),i.jsx(Dt,{path:"/cliproxy",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(BE,{})})}),i.jsx(Dt,{path:"/cliproxy/control-panel",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(HE,{})})}),i.jsx(Dt,{path:"/copilot",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(qE,{})})}),i.jsx(Dt,{path:"/cursor",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(YE,{})})}),i.jsx(Dt,{path:"/droid",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(KE,{})})}),i.jsx(Dt,{path:"/accounts",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(GE,{})})}),i.jsx(Dt,{path:"/settings",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(QE,{})})}),i.jsx(Dt,{path:"/health",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(PE,{})})}),i.jsx(Dt,{path:"/shared",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(VE,{})})})]})})]}),i.jsx(bb,{position:"top-right"})]})})})})})}const Nx=document.getElementById("root");if(!Nx)throw new Error("Root element not found. Failed to mount React application.");PS.createRoot(Nx).render(i.jsx(x.StrictMode,{children:i.jsx(WE,{})}));export{Wy as $,sC as A,Qa as B,OC as C,UM as D,BM as E,Zw as F,aC as G,iC as H,Rn as I,LM as J,nN as K,an as L,aN as M,lN as N,Py as O,cy as P,Dd as Q,$r as R,Ye as S,Pa as T,Ju as U,YM as V,Xe as W,qM as X,DC as Y,KM as Z,GM as _,kC as a,Od as a$,QM as a0,F1 as a1,rM as a2,hM as a3,pM as a4,gd as a5,yd as a6,xd as a7,vd as a8,bd as a9,KN as aA,BC as aB,fy as aC,Cj as aD,xy as aE,yM as aF,xM as aG,vM as aH,bM as aI,XM as aJ,iM as aK,tN as aL,cM as aM,uM as aN,J1 as aO,eN as aP,dM as aQ,fM as aR,mM as aS,oM as aT,pi as aU,lM as aV,sM as aW,$M as aX,Jy as aY,Td as aZ,ji as a_,PM as aa,UC as ab,VM as ac,Wa as ad,OM as ae,zM as af,gM as ag,_M as ah,DM as ai,$p as aj,RM as ak,Xw as al,NN as am,AM as an,ON as ao,TM as ap,Nj as aq,b1 as ar,S1 as as,co as at,oo as au,uo as av,yl as aw,HN as ax,qN as ay,YN as az,ot as b,Yw as b0,kM as b1,_d as b2,qy as b3,zd as b4,tA as b5,FM as b6,JM as b7,eA as b8,tx as b9,WC as ba,ZC as bb,wM as bc,SM as bd,CM as be,NM as bf,jM as bg,MM as bh,EM as bi,Qr as bj,q as c,WM as d,IM as e,t2 as f,_E as g,aM as h,_C as i,zC as j,uj as k,dj as l,Sl as m,ZM as n,Va as o,Xa as p,Pw as q,Yy as r,Vw as s,Qy as t,cd as u,Fu as v,ug as w,cC as x,HM as y,Jw as z};
|
|
47
|
+
`);return{valid:!1,error:c,line:m.length}}return{valid:!1,error:c}}}function Jy({value:a,onChange:l,language:r="json",readonly:c=!1,className:d,minHeight:f="300px"}){const{isDark:m}=py(),[p,g]=x.useState(!1),[b,C]=x.useState(!0),v=x.useMemo(()=>r==="json"?QC(a):{valid:!0},[a,r]),S=x.useCallback(M=>i.jsx(qS,{theme:m?Yp.nightOwl:Yp.github,code:M,language:r,children:({tokens:A,getLineProps:R,getTokenProps:z})=>{let _=!1;return i.jsx(i.Fragment,{children:A.map((L,K)=>i.jsx("div",{...R({line:L}),className:q(v.line===K+1&&"bg-destructive/20"),children:L.map((H,B)=>{let N=!1;if(H.types.includes("property")){const I=H.content.replace(/['"]/g,"");GC(I)?_=!0:_=!1}else(H.types.includes("string")||H.types.includes("number")||H.types.includes("boolean"))&&_?(N=!0,_=!1):H.types.includes("punctuation")&&H.content!==":"&&H.content!=="["&&H.content!=="{"&&(_=!1);const G=z({token:H});return N&&b&&(G.className=q(G.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),i.jsx("span",{...G},B)})},K))})}}),[m,r,v.line,b]);return i.jsxs("div",{className:q("flex flex-col",d),children:[i.jsxs("div",{className:q("relative rounded-md border overflow-hidden","bg-muted/30",p&&"ring-2 ring-ring ring-offset-2 ring-offset-background",c&&"opacity-70 cursor-not-allowed",!v.valid&&"border-destructive"),style:{minHeight:f},children:[i.jsx(YC,{value:a,onValueChange:c?()=>{}:l,highlight:S,padding:12,disabled:c,onFocus:()=>g(!0),onBlur:()=>g(!1),textareaClassName:q("focus:outline-none font-mono text-sm",c&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:f}},m?"dark-editor":"light-editor"),i.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:i.jsx(ot,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>C(!b),title:b?"Reveal sensitive values":"Mask sensitive values",children:b?i.jsx(to,{className:"h-3 w-3"}):i.jsx(eo,{className:"h-3 w-3"})})})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[v.valid?i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[i.jsx(no,{className:"w-3 h-3 text-green-500"}),"Valid ",r.toUpperCase()]}):i.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[i.jsx(od,{className:"w-3 h-3"}),v.error,v.line&&` (line ${v.line})`]}),c&&i.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}const Ld=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Jy},Symbol.toStringTag,{value:"Module"})),PC={webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function VC(a,l){switch(l.type){case"SET_WEBSEARCH_CONFIG":return{...a,webSearchConfig:l.payload};case"SET_WEBSEARCH_STATUS":return{...a,webSearchStatus:l.payload};case"SET_WEBSEARCH_LOADING":return{...a,webSearchLoading:l.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...a,webSearchStatusLoading:l.payload};case"SET_WEBSEARCH_SAVING":return{...a,webSearchSaving:l.payload};case"SET_WEBSEARCH_ERROR":return{...a,webSearchError:l.payload};case"SET_WEBSEARCH_SUCCESS":return{...a,webSearchSuccess:l.payload};case"SET_GLOBALENV_CONFIG":return{...a,globalEnvConfig:l.payload};case"SET_GLOBALENV_LOADING":return{...a,globalEnvLoading:l.payload};case"SET_GLOBALENV_SAVING":return{...a,globalEnvSaving:l.payload};case"SET_GLOBALENV_ERROR":return{...a,globalEnvError:l.payload};case"SET_GLOBALENV_SUCCESS":return{...a,globalEnvSuccess:l.payload};case"SET_PROXY_CONFIG":return{...a,proxyConfig:l.payload};case"SET_PROXY_LOADING":return{...a,proxyLoading:l.payload};case"SET_PROXY_SAVING":return{...a,proxySaving:l.payload};case"SET_PROXY_ERROR":return{...a,proxyError:l.payload};case"SET_PROXY_SUCCESS":return{...a,proxySuccess:l.payload};case"SET_PROXY_TEST_RESULT":return{...a,proxyTestResult:l.payload};case"SET_PROXY_TESTING":return{...a,proxyTesting:l.payload};case"SET_RAW_CONFIG":return{...a,rawConfig:l.payload};case"SET_RAW_CONFIG_LOADING":return{...a,rawConfigLoading:l.payload};default:return a}}const ex=x.createContext(null);function XC({children:a}){const[l,r]=x.useReducer(VC,PC);return i.jsx(ex.Provider,{value:{state:l,dispatch:r},children:a})}function tx(){const a=x.useContext(ex);if(!a)throw new Error("useSettingsContext must be used within a SettingsProvider");return a}function WC(){const{dispatch:a}=tx(),l=x.useCallback(N=>a({type:"SET_WEBSEARCH_CONFIG",payload:N}),[a]),r=x.useCallback(N=>a({type:"SET_WEBSEARCH_STATUS",payload:N}),[a]),c=x.useCallback(N=>a({type:"SET_WEBSEARCH_LOADING",payload:N}),[a]),d=x.useCallback(N=>a({type:"SET_WEBSEARCH_STATUS_LOADING",payload:N}),[a]),f=x.useCallback(N=>a({type:"SET_WEBSEARCH_SAVING",payload:N}),[a]),m=x.useCallback(N=>a({type:"SET_WEBSEARCH_ERROR",payload:N}),[a]),p=x.useCallback(N=>a({type:"SET_WEBSEARCH_SUCCESS",payload:N}),[a]),g=x.useCallback(N=>a({type:"SET_GLOBALENV_CONFIG",payload:N}),[a]),b=x.useCallback(N=>a({type:"SET_GLOBALENV_LOADING",payload:N}),[a]),C=x.useCallback(N=>a({type:"SET_GLOBALENV_SAVING",payload:N}),[a]),v=x.useCallback(N=>a({type:"SET_GLOBALENV_ERROR",payload:N}),[a]),S=x.useCallback(N=>a({type:"SET_GLOBALENV_SUCCESS",payload:N}),[a]),M=x.useCallback(N=>a({type:"SET_PROXY_CONFIG",payload:N}),[a]),A=x.useCallback(N=>a({type:"SET_PROXY_LOADING",payload:N}),[a]),R=x.useCallback(N=>a({type:"SET_PROXY_SAVING",payload:N}),[a]),z=x.useCallback(N=>a({type:"SET_PROXY_ERROR",payload:N}),[a]),_=x.useCallback(N=>a({type:"SET_PROXY_SUCCESS",payload:N}),[a]),L=x.useCallback(N=>a({type:"SET_PROXY_TEST_RESULT",payload:N}),[a]),K=x.useCallback(N=>a({type:"SET_PROXY_TESTING",payload:N}),[a]),H=x.useCallback(N=>a({type:"SET_RAW_CONFIG",payload:N}),[a]),B=x.useCallback(N=>a({type:"SET_RAW_CONFIG_LOADING",payload:N}),[a]);return x.useMemo(()=>({setWebSearchConfig:l,setWebSearchStatus:r,setWebSearchLoading:c,setWebSearchStatusLoading:d,setWebSearchSaving:f,setWebSearchError:m,setWebSearchSuccess:p,setGlobalEnvConfig:g,setGlobalEnvLoading:b,setGlobalEnvSaving:C,setGlobalEnvError:v,setGlobalEnvSuccess:S,setProxyConfig:M,setProxyLoading:A,setProxySaving:R,setProxyError:z,setProxySuccess:_,setProxyTestResult:L,setProxyTesting:K,setRawConfig:H,setRawConfigLoading:B}),[l,r,c,d,f,m,p,g,b,C,v,S,M,A,R,z,_,L,K,H,B])}function IC(){const[a,l]=pb(),r=a.get("tab")?.toLowerCase(),c=r==="globalenv"?"globalenv":r==="proxy"?"proxy":r==="auth"?"auth":r==="thinking"?"thinking":r==="backups"?"backups":"websearch",d=x.useCallback(f=>{l({tab:f},{replace:!0})},[l]);return{activeTab:c,setActiveTab:d}}function ZC(){const{state:a}=tx(),l=WC(),[r,c]=x.useState(!1),d=x.useCallback(async()=>{try{l.setRawConfigLoading(!0);const m=await fetch("/api/config/raw");if(!m.ok){l.setRawConfig(null);return}const p=await m.text();l.setRawConfig(p)}catch{l.setRawConfig(null)}finally{l.setRawConfigLoading(!1)}},[l]),f=x.useCallback(async()=>{if(a.rawConfig)try{await navigator.clipboard.writeText(a.rawConfig),c(!0),setTimeout(()=>c(!1),2e3)}catch{}},[a.rawConfig]);return{rawConfig:a.rawConfig,loading:a.rawConfigLoading,copied:r,fetchRawConfig:d,copyToClipboard:f}}const $C=[{value:"websearch",label:"Web",icon:Ib},{value:"globalenv",label:"Env",icon:rd},{value:"thinking",label:"Think",icon:Zb},{value:"proxy",label:"Proxy",icon:$b},{value:"auth",label:"Auth",icon:ld},{value:"backups",label:"Backup",icon:Fb}];function yg({activeTab:a,onTabChange:l}){return i.jsx(Py,{value:a,onValueChange:r=>l(r),children:i.jsx(Dd,{className:"grid w-full grid-cols-6",children:$C.map(({value:r,label:c,icon:d})=>i.jsxs($r,{value:r,className:"gap-1.5 px-1 text-xs",children:[i.jsx(d,{className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"truncate",children:c})]},r))})})}function xg(){return i.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[i.jsx(Ye,{className:"h-4 w-2/3"}),i.jsx("div",{className:"p-4 rounded-lg border",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ye,{className:"h-5 w-32"}),i.jsx(Ye,{className:"h-4 w-48"})]}),i.jsx(Ye,{className:"h-6 w-10 rounded-full"})]})}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(Ye,{className:"h-5 w-24"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ye,{className:"h-20 w-full rounded-lg"}),i.jsx(Ye,{className:"h-20 w-full rounded-lg"}),i.jsx(Ye,{className:"h-20 w-full rounded-lg"})]})]})]})}function nx(a,l=3,r=1e3){return a().catch(c=>{if(l<=0)throw c;return new Promise(d=>setTimeout(d,r)).then(()=>nx(a,l-1,r*2))})}function ps(a){return x.lazy(()=>nx(a))}const vg=ps(()=>ht(()=>import("./index-BGM7ArZ-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),bg=ps(()=>ht(()=>import("./globalenv-section-DryB5ety.js"),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),Sg=ps(()=>ht(()=>import("./index-Dt0OpGYK.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8,9]))),Ng=ps(()=>ht(()=>import("./index-BDygjMjY.js"),__vite__mapDeps([12,1,2,3,13,4,14,15,5,6,7,8,9]))),jg=ps(()=>ht(()=>import("./auth-section-DDB-gXA-.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,9]))),wg=ps(()=>ht(()=>import("./backups-section-f3TrZYc_.js"),__vite__mapDeps([17,1,2,15,4,5,6,7,8,9])));class Cg extends x.Component{constructor(l){super(l),this.state={hasError:!1,error:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}render(){return this.state.hasError?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center p-6 max-w-md",children:[i.jsx(od,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),i.jsx("p",{className:"font-medium text-foreground mb-2",children:"Failed to load section"}),i.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||"Unknown error occurred"}),i.jsxs(ot,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[i.jsx(Si,{className:"w-4 h-4"}),"Reload page"]})]})}):this.props.children}}function FC(){const{activeTab:a,setActiveTab:l}=IC(),{rawConfig:r,loading:c,copied:d,fetchRawConfig:f,copyToClipboard:m}=ZC();x.useEffect(()=>{f()},[f]);const p=g=>{x.startTransition(()=>{l(g)})};return i.jsxs("div",{className:"h-[calc(100vh-100px)]",children:[i.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[i.jsx("div",{className:"border-b bg-background p-4",children:i.jsx(yg,{activeTab:a,onTabChange:p})}),i.jsx(Cg,{children:i.jsxs(x.Suspense,{fallback:i.jsx(xg,{}),children:[a==="websearch"&&i.jsx(vg,{}),a==="globalenv"&&i.jsx(bg,{}),a==="thinking"&&i.jsx(Sg,{}),a==="proxy"&&i.jsx(Ng,{}),a==="auth"&&i.jsx(jg,{}),a==="backups"&&i.jsx(wg,{})]})})]}),i.jsxs(Td,{direction:"horizontal",className:"h-full hidden md:flex",children:[i.jsx(ji,{defaultSize:40,minSize:30,maxSize:55,children:i.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[i.jsx("div",{className:"p-5 border-b bg-background",children:i.jsx(yg,{activeTab:a,onTabChange:p})}),i.jsx(Cg,{children:i.jsxs(x.Suspense,{fallback:i.jsx(xg,{}),children:[a==="websearch"&&i.jsx(vg,{}),a==="globalenv"&&i.jsx(bg,{}),a==="thinking"&&i.jsx(Sg,{}),a==="proxy"&&i.jsx(Ng,{}),a==="auth"&&i.jsx(jg,{}),a==="backups"&&i.jsx(wg,{})]})})]})}),i.jsx(Od,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:i.jsx(ao,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),i.jsx(ji,{defaultSize:60,minSize:35,children:i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Lp,{className:"w-5 h-5 text-primary"}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold",children:"config.yaml"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ot,{variant:"outline",size:"sm",onClick:m,disabled:!r,children:d?i.jsxs(i.Fragment,{children:[i.jsx(fs,{className:"w-4 h-4 mr-1"}),"Copied"]}):i.jsxs(i.Fragment,{children:[i.jsx(Wr,{className:"w-4 h-4 mr-1"}),"Copy"]})}),i.jsx(ot,{variant:"outline",size:"sm",onClick:f,disabled:c,children:i.jsx(Si,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]})]}),i.jsx("div",{className:"flex-1 overflow-auto",children:c?i.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[i.jsx(Si,{className:"w-5 h-5 animate-spin mr-2"}),"Loading..."]}):r?i.jsx(Jy,{value:r,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):i.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:i.jsxs("div",{className:"text-center",children:[i.jsx(Lp,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{children:"Config file not found"}),i.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function JC(){return i.jsx(XC,{children:i.jsx(FC,{})})}const e2=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:JC},Symbol.toStringTag,{value:"Module"})),WM=ob,IM=ub,ZM=cb,t2=x.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>i.jsx(rb,{children:i.jsx(Fg,{ref:d,align:l,sideOffset:r,className:q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...c})}));t2.displayName=Fg.displayName;function n2(a,l,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:a,timeZoneName:r}).format(l).split(/\s/g).slice(2).join(" ")}const a2={},xi={};function gl(a,l){try{const c=(a2[a]||=new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"longOffset"}).format)(l).split("GMT")[1];return c in xi?xi[c]:Eg(c,c.split(":"))}catch{if(a in xi)return xi[a];const r=a?.match(l2);return r?Eg(a,r.slice(1)):NaN}}const l2=/([+-]\d\d):?(\d\d)?/;function Eg(a,l){const r=+(l[0]||0),c=+(l[1]||0),d=+(l[2]||0)/60;return xi[a]=r*60+c>0?r*60+c+d:r*60-c-d}class Ln extends Date{constructor(...l){super(),l.length>1&&typeof l[l.length-1]=="string"&&(this.timeZone=l.pop()),this.internal=new Date,isNaN(gl(this.timeZone,this))?this.setTime(NaN):l.length?typeof l[0]=="number"&&(l.length===1||l.length===2&&typeof l[1]!="number")?this.setTime(l[0]):typeof l[0]=="string"?this.setTime(+new Date(l[0])):l[0]instanceof Date?this.setTime(+l[0]):(this.setTime(+new Date(...l)),ax(this),td(this)):this.setTime(Date.now())}static tz(l,...r){return r.length?new Ln(...r,l):new Ln(Date.now(),l)}withTimeZone(l){return new Ln(+this,l)}getTimezoneOffset(){const l=-gl(this.timeZone,this);return l>0?Math.floor(l):Math.ceil(l)}setTime(l){return Date.prototype.setTime.apply(this,arguments),td(this),+this}[Symbol.for("constructDateFrom")](l){return new Ln(+new Date(l),this.timeZone)}}const Mg=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(a=>{if(!Mg.test(a))return;const l=a.replace(Mg,"$1UTC");Ln.prototype[l]&&(a.startsWith("get")?Ln.prototype[a]=function(){return this.internal[l]()}:(Ln.prototype[a]=function(){return Date.prototype[l].apply(this.internal,arguments),s2(this),+this},Ln.prototype[l]=function(){return Date.prototype[l].apply(this,arguments),td(this),+this}))});function td(a){a.internal.setTime(+a),a.internal.setUTCSeconds(a.internal.getUTCSeconds()-Math.round(-gl(a.timeZone,a)*60))}function s2(a){Date.prototype.setFullYear.call(a,a.internal.getUTCFullYear(),a.internal.getUTCMonth(),a.internal.getUTCDate()),Date.prototype.setHours.call(a,a.internal.getUTCHours(),a.internal.getUTCMinutes(),a.internal.getUTCSeconds(),a.internal.getUTCMilliseconds()),ax(a)}function ax(a){const l=gl(a.timeZone,a),r=l>0?Math.floor(l):Math.ceil(l),c=new Date(+a);c.setUTCHours(c.getUTCHours()-1);const d=-new Date(+a).getTimezoneOffset(),f=-new Date(+c).getTimezoneOffset(),m=d-f,p=Date.prototype.getHours.apply(a)!==a.internal.getUTCHours();m&&p&&a.internal.setUTCMinutes(a.internal.getUTCMinutes()+m);const g=d-r;g&&Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+g);const b=new Date(+a);b.setUTCSeconds(0);const C=d>0?b.getSeconds():(b.getSeconds()-60)%60,v=Math.round(-(gl(a.timeZone,a)*60))%60;(v||C)&&(a.internal.setUTCSeconds(a.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(a,Date.prototype.getUTCSeconds.call(a)+v+C));const S=gl(a.timeZone,a),M=S>0?Math.floor(S):Math.ceil(S),R=-new Date(+a).getTimezoneOffset()-M,z=M!==r,_=R-g;if(z&&_){Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+_);const L=gl(a.timeZone,a),K=L>0?Math.floor(L):Math.ceil(L),H=M-K;H&&(a.internal.setUTCMinutes(a.internal.getUTCMinutes()+H),Date.prototype.setUTCMinutes.call(a,Date.prototype.getUTCMinutes.call(a)+H))}}class fa extends Ln{static tz(l,...r){return r.length?new fa(...r,l):new fa(Date.now(),l)}toISOString(){const[l,r,c]=this.tzComponents(),d=`${l}${r}:${c}`;return this.internal.toISOString().slice(0,-1)+d}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[l,r,c,d]=this.internal.toUTCString().split(" ");return`${l?.slice(0,-1)} ${c} ${r} ${d}`}toTimeString(){const l=this.internal.toUTCString().split(" ")[4],[r,c,d]=this.tzComponents();return`${l} GMT${r}${c}${d} (${n2(this.timeZone,this)})`}toLocaleString(l,r){return Date.prototype.toLocaleString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleDateString(l,r){return Date.prototype.toLocaleDateString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleTimeString(l,r){return Date.prototype.toLocaleTimeString.call(this,l,{...r,timeZone:r?.timeZone||this.timeZone})}tzComponents(){const l=this.getTimezoneOffset(),r=l>0?"-":"+",c=String(Math.floor(Math.abs(l)/60)).padStart(2,"0"),d=String(Math.abs(l)%60).padStart(2,"0");return[r,c,d]}withTimeZone(l){return new fa(+this,l)}[Symbol.for("constructDateFrom")](l){return new fa(+new Date(l),this.timeZone)}}const Ag=5,i2=4;function r2(a,l){const r=l.startOfMonth(a),c=r.getDay()>0?r.getDay():7,d=l.addDays(a,-c+1),f=l.addDays(d,Ag*7-1);return l.getMonth(a)===l.getMonth(f)?Ag:i2}function lx(a,l){const r=l.startOfMonth(a),c=r.getDay();return c===1?r:c===0?l.addDays(r,-6):l.addDays(r,-1*(c-1))}function o2(a,l){const r=lx(a,l),c=r2(a,l);return l.addDays(r,c*7-1)}const sx={...di,labels:{labelDayButton:(a,l,r,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,p)=>hi(m,p,{locale:di,...r});let f=d(a,"PPPP");return l.today&&(f=`Today, ${f}`),l.selected&&(f=`${f}, selected`),f},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:a=>`Week ${a}`,labelYearDropdown:"Choose the Year",labelGrid:(a,l,r)=>{let c;return r&&typeof r.format=="function"?c=r.format.bind(r):c=(d,f)=>hi(d,f,{locale:di,...l}),c(a,"LLLL yyyy")},labelGridcell:(a,l,r,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,p)=>hi(m,p,{locale:di,...r});let f=d(a,"PPPP");return l?.today&&(f=`Today, ${f}`),f},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(a,l,r)=>{let c;return r&&typeof r.format=="function"?c=r.format.bind(r):c=(d,f)=>hi(d,f,{locale:di,...l}),c(a,"cccc")}}};class rn{constructor(l,r){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?fa.tz(this.options.timeZone):new this.Date,this.newDate=(c,d,f)=>this.overrides?.newDate?this.overrides.newDate(c,d,f):this.options.timeZone?new fa(c,d,f,this.options.timeZone):new Date(c,d,f),this.addDays=(c,d)=>this.overrides?.addDays?this.overrides.addDays(c,d):aS(c,d),this.addMonths=(c,d)=>this.overrides?.addMonths?this.overrides.addMonths(c,d):lS(c,d),this.addWeeks=(c,d)=>this.overrides?.addWeeks?this.overrides.addWeeks(c,d):sS(c,d),this.addYears=(c,d)=>this.overrides?.addYears?this.overrides.addYears(c,d):iS(c,d),this.differenceInCalendarDays=(c,d)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(c,d):rS(c,d),this.differenceInCalendarMonths=(c,d)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(c,d):oS(c,d),this.eachMonthOfInterval=c=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(c):cS(c),this.eachYearOfInterval=c=>{const d=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(c):uS(c),f=new Set(d.map(p=>this.getYear(p)));if(f.size===d.length)return d;const m=[];return f.forEach(p=>{m.push(new Date(p,0,1))}),m},this.endOfBroadcastWeek=c=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(c):o2(c,this),this.endOfISOWeek=c=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(c):dS(c),this.endOfMonth=c=>this.overrides?.endOfMonth?this.overrides.endOfMonth(c):fS(c),this.endOfWeek=(c,d)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(c,d):mS(c,this.options),this.endOfYear=c=>this.overrides?.endOfYear?this.overrides.endOfYear(c):hS(c),this.format=(c,d,f)=>{const m=this.overrides?.format?this.overrides.format(c,d,this.options):hi(c,d,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(m):m},this.getISOWeek=c=>this.overrides?.getISOWeek?this.overrides.getISOWeek(c):pS(c),this.getMonth=(c,d)=>this.overrides?.getMonth?this.overrides.getMonth(c,this.options):gS(c,this.options),this.getYear=(c,d)=>this.overrides?.getYear?this.overrides.getYear(c,this.options):yS(c,this.options),this.getWeek=(c,d)=>this.overrides?.getWeek?this.overrides.getWeek(c,this.options):xS(c,this.options),this.isAfter=(c,d)=>this.overrides?.isAfter?this.overrides.isAfter(c,d):vS(c,d),this.isBefore=(c,d)=>this.overrides?.isBefore?this.overrides.isBefore(c,d):bS(c,d),this.isDate=c=>this.overrides?.isDate?this.overrides.isDate(c):SS(c),this.isSameDay=(c,d)=>this.overrides?.isSameDay?this.overrides.isSameDay(c,d):NS(c,d),this.isSameMonth=(c,d)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(c,d):jS(c,d),this.isSameYear=(c,d)=>this.overrides?.isSameYear?this.overrides.isSameYear(c,d):wS(c,d),this.max=c=>this.overrides?.max?this.overrides.max(c):CS(c),this.min=c=>this.overrides?.min?this.overrides.min(c):ES(c),this.setMonth=(c,d)=>this.overrides?.setMonth?this.overrides.setMonth(c,d):MS(c,d),this.setYear=(c,d)=>this.overrides?.setYear?this.overrides.setYear(c,d):AS(c,d),this.startOfBroadcastWeek=(c,d)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(c,this):lx(c,this),this.startOfDay=c=>this.overrides?.startOfDay?this.overrides.startOfDay(c):TS(c),this.startOfISOWeek=c=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(c):OS(c),this.startOfMonth=c=>this.overrides?.startOfMonth?this.overrides.startOfMonth(c):_S(c),this.startOfWeek=(c,d)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(c,this.options):zS(c,this.options),this.startOfYear=c=>this.overrides?.startOfYear?this.overrides.startOfYear(c):DS(c),this.options={locale:sx,...l},this.overrides=r}getDigitMap(){const{numerals:l="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:l}),c={};for(let d=0;d<10;d++)c[d.toString()]=r.format(d);return c}replaceDigits(l){const r=this.getDigitMap();return l.replace(/\d/g,c=>r[c]||c)}formatNumber(l){return this.replaceDigits(l.toString())}getMonthYearOrder(){const l=this.options.locale?.code;return l&&rn.yearFirstLocales.has(l)?"year-first":"month-first"}formatMonthYear(l){const{locale:r,timeZone:c,numerals:d}=this.options,f=r?.code;if(f&&rn.yearFirstLocales.has(f))try{return new Intl.DateTimeFormat(f,{month:"long",year:"numeric",timeZone:c,numberingSystem:d}).format(l)}catch{}const m=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(l,m)}}rn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Hn=new rn;class ix{constructor(l,r,c=Hn){this.date=l,this.displayMonth=r,this.outside=!!(r&&!c.isSameMonth(l,r)),this.dateLib=c,this.isoDate=c.format(l,"yyyy-MM-dd"),this.displayMonthId=c.format(r,"yyyy-MM"),this.dateMonthId=c.format(l,"yyyy-MM")}isEqualTo(l){return this.dateLib.isSameDay(l.date,this.date)&&this.dateLib.isSameMonth(l.displayMonth,this.displayMonth)}}class c2{constructor(l,r){this.date=l,this.weeks=r}}class u2{constructor(l,r){this.days=r,this.weekNumber=l}}function d2(a){return ee.createElement("button",{...a})}function f2(a){return ee.createElement("span",{...a})}function m2(a){const{size:l=24,orientation:r="left",className:c}=a;return ee.createElement("svg",{className:c,width:l,height:l,viewBox:"0 0 24 24"},r==="up"&&ee.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&ee.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&ee.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&ee.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function h2(a){const{day:l,modifiers:r,...c}=a;return ee.createElement("td",{...c})}function p2(a){const{day:l,modifiers:r,...c}=a,d=ee.useRef(null);return ee.useEffect(()=>{r.focused&&d.current?.focus()},[r.focused]),ee.createElement("button",{ref:d,...c})}var ue;(function(a){a.Root="root",a.Chevron="chevron",a.Day="day",a.DayButton="day_button",a.CaptionLabel="caption_label",a.Dropdowns="dropdowns",a.Dropdown="dropdown",a.DropdownRoot="dropdown_root",a.Footer="footer",a.MonthGrid="month_grid",a.MonthCaption="month_caption",a.MonthsDropdown="months_dropdown",a.Month="month",a.Months="months",a.Nav="nav",a.NextMonthButton="button_next",a.PreviousMonthButton="button_previous",a.Week="week",a.Weeks="weeks",a.Weekday="weekday",a.Weekdays="weekdays",a.WeekNumber="week_number",a.WeekNumberHeader="week_number_header",a.YearsDropdown="years_dropdown"})(ue||(ue={}));var lt;(function(a){a.disabled="disabled",a.hidden="hidden",a.outside="outside",a.focused="focused",a.today="today"})(lt||(lt={}));var Cn;(function(a){a.range_end="range_end",a.range_middle="range_middle",a.range_start="range_start",a.selected="selected"})(Cn||(Cn={}));var sn;(function(a){a.weeks_before_enter="weeks_before_enter",a.weeks_before_exit="weeks_before_exit",a.weeks_after_enter="weeks_after_enter",a.weeks_after_exit="weeks_after_exit",a.caption_after_enter="caption_after_enter",a.caption_after_exit="caption_after_exit",a.caption_before_enter="caption_before_enter",a.caption_before_exit="caption_before_exit"})(sn||(sn={}));function g2(a){const{options:l,className:r,components:c,classNames:d,...f}=a,m=[d[ue.Dropdown],r].join(" "),p=l?.find(({value:g})=>g===f.value);return ee.createElement("span",{"data-disabled":f.disabled,className:d[ue.DropdownRoot]},ee.createElement(c.Select,{className:m,...f},l?.map(({value:g,label:b,disabled:C})=>ee.createElement(c.Option,{key:g,value:g,disabled:C},b))),ee.createElement("span",{className:d[ue.CaptionLabel],"aria-hidden":!0},p?.label,ee.createElement(c.Chevron,{orientation:"down",size:18,className:d[ue.Chevron]})))}function y2(a){return ee.createElement("div",{...a})}function x2(a){return ee.createElement("div",{...a})}function v2(a){const{calendarMonth:l,displayIndex:r,...c}=a;return ee.createElement("div",{...c},a.children)}function b2(a){const{calendarMonth:l,displayIndex:r,...c}=a;return ee.createElement("div",{...c})}function S2(a){return ee.createElement("table",{...a})}function N2(a){return ee.createElement("div",{...a})}const rx=x.createContext(void 0);function Ei(){const a=x.useContext(rx);if(a===void 0)throw new Error("useDayPicker() must be used within a custom component.");return a}function j2(a){const{components:l}=Ei();return ee.createElement(l.Dropdown,{...a})}function w2(a){const{onPreviousClick:l,onNextClick:r,previousMonth:c,nextMonth:d,...f}=a,{components:m,classNames:p,labels:{labelPrevious:g,labelNext:b}}=Ei(),C=x.useCallback(S=>{d&&r?.(S)},[d,r]),v=x.useCallback(S=>{c&&l?.(S)},[c,l]);return ee.createElement("nav",{...f},ee.createElement(m.PreviousMonthButton,{type:"button",className:p[ue.PreviousMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":g(c),onClick:v},ee.createElement(m.Chevron,{disabled:c?void 0:!0,className:p[ue.Chevron],orientation:"left"})),ee.createElement(m.NextMonthButton,{type:"button",className:p[ue.NextMonthButton],tabIndex:d?void 0:-1,"aria-disabled":d?void 0:!0,"aria-label":b(d),onClick:C},ee.createElement(m.Chevron,{disabled:d?void 0:!0,orientation:"right",className:p[ue.Chevron]})))}function C2(a){const{components:l}=Ei();return ee.createElement(l.Button,{...a})}function E2(a){return ee.createElement("option",{...a})}function M2(a){const{components:l}=Ei();return ee.createElement(l.Button,{...a})}function A2(a){const{rootRef:l,...r}=a;return ee.createElement("div",{...r,ref:l})}function T2(a){return ee.createElement("select",{...a})}function O2(a){const{week:l,...r}=a;return ee.createElement("tr",{...r})}function _2(a){return ee.createElement("th",{...a})}function z2(a){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...a}))}function D2(a){const{week:l,...r}=a;return ee.createElement("th",{...r})}function k2(a){return ee.createElement("th",{...a})}function R2(a){return ee.createElement("tbody",{...a})}function U2(a){const{components:l}=Ei();return ee.createElement(l.Dropdown,{...a})}const L2=Object.freeze(Object.defineProperty({__proto__:null,Button:d2,CaptionLabel:f2,Chevron:m2,Day:h2,DayButton:p2,Dropdown:g2,DropdownNav:y2,Footer:x2,Month:v2,MonthCaption:b2,MonthGrid:S2,Months:N2,MonthsDropdown:j2,Nav:w2,NextMonthButton:C2,Option:E2,PreviousMonthButton:M2,Root:A2,Select:T2,Week:O2,WeekNumber:D2,WeekNumberHeader:k2,Weekday:_2,Weekdays:z2,Weeks:R2,YearsDropdown:U2},Symbol.toStringTag,{value:"Module"}));function ma(a,l,r=!1,c=Hn){let{from:d,to:f}=a;const{differenceInCalendarDays:m,isSameDay:p}=c;return d&&f?(m(f,d)<0&&([d,f]=[f,d]),m(l,d)>=(r?1:0)&&m(f,l)>=(r?1:0)):!r&&f?p(f,l):!r&&d?p(d,l):!1}function Bd(a){return!!(a&&typeof a=="object"&&"before"in a&&"after"in a)}function yo(a){return!!(a&&typeof a=="object"&&"from"in a)}function Hd(a){return!!(a&&typeof a=="object"&&"after"in a)}function qd(a){return!!(a&&typeof a=="object"&&"before"in a)}function ox(a){return!!(a&&typeof a=="object"&&"dayOfWeek"in a)}function cx(a,l){return Array.isArray(a)&&a.every(l.isDate)}function ha(a,l,r=Hn){const c=Array.isArray(l)?l:[l],{isSameDay:d,differenceInCalendarDays:f,isAfter:m}=r;return c.some(p=>{if(typeof p=="boolean")return p;if(r.isDate(p))return d(a,p);if(cx(p,r))return p.some(g=>d(a,g));if(yo(p))return ma(p,a,!1,r);if(ox(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(a.getDay()):p.dayOfWeek===a.getDay();if(Bd(p)){const g=f(p.before,a),b=f(p.after,a),C=g>0,v=b<0;return m(p.before,p.after)?v&&C:C||v}return Hd(p)?f(a,p.after)>0:qd(p)?f(p.before,a)>0:typeof p=="function"?p(a):!1})}function B2(a,l,r,c,d){const{disabled:f,hidden:m,modifiers:p,showOutsideDays:g,broadcastCalendar:b,today:C=d.today()}=l,{isSameDay:v,isSameMonth:S,startOfMonth:M,isBefore:A,endOfMonth:R,isAfter:z}=d,_=r&&M(r),L=c&&R(c),K={[lt.focused]:[],[lt.outside]:[],[lt.disabled]:[],[lt.hidden]:[],[lt.today]:[]},H={};for(const B of a){const{date:N,displayMonth:G}=B,I=!!(G&&!S(N,G)),J=!!(_&&A(N,_)),ie=!!(L&&z(N,L)),ve=!!(f&&ha(N,f,d)),re=!!(m&&ha(N,m,d))||J||ie||!b&&!g&&I||b&&g===!1&&I,Be=v(N,C);I&&K.outside.push(B),ve&&K.disabled.push(B),re&&K.hidden.push(B),Be&&K.today.push(B),p&&Object.keys(p).forEach(Se=>{const be=p?.[Se];be&&ha(N,be,d)&&(H[Se]?H[Se].push(B):H[Se]=[B])})}return B=>{const N={[lt.focused]:!1,[lt.disabled]:!1,[lt.hidden]:!1,[lt.outside]:!1,[lt.today]:!1},G={};for(const I in K){const J=K[I];N[I]=J.some(ie=>ie===B)}for(const I in H)G[I]=H[I].some(J=>J===B);return{...N,...G}}}function H2(a,l,r={}){return Object.entries(a).filter(([,d])=>d===!0).reduce((d,[f])=>(r[f]?d.push(r[f]):l[lt[f]]?d.push(l[lt[f]]):l[Cn[f]]&&d.push(l[Cn[f]]),d),[l[ue.Day]])}function q2(a){return{...L2,...a}}function Y2(a){const l={"data-mode":a.mode??void 0,"data-required":"required"in a?a.required:void 0,"data-multiple-months":a.numberOfMonths&&a.numberOfMonths>1||void 0,"data-week-numbers":a.showWeekNumber||void 0,"data-broadcast-calendar":a.broadcastCalendar||void 0,"data-nav-layout":a.navLayout||void 0};return Object.entries(a).forEach(([r,c])=>{r.startsWith("data-")&&(l[r]=c)}),l}function K2(){const a={};for(const l in ue)a[ue[l]]=`rdp-${ue[l]}`;for(const l in lt)a[lt[l]]=`rdp-${lt[l]}`;for(const l in Cn)a[Cn[l]]=`rdp-${Cn[l]}`;for(const l in sn)a[sn[l]]=`rdp-${sn[l]}`;return a}function ux(a,l,r){return(r??new rn(l)).formatMonthYear(a)}const G2=ux;function Q2(a,l,r){return(r??new rn(l)).format(a,"d")}function P2(a,l=Hn){return l.format(a,"LLLL")}function V2(a,l,r){return(r??new rn(l)).format(a,"cccccc")}function X2(a,l=Hn){return a<10?l.formatNumber(`0${a.toLocaleString()}`):l.formatNumber(`${a.toLocaleString()}`)}function W2(){return""}function dx(a,l=Hn){return l.format(a,"yyyy")}const I2=dx,Z2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ux,formatDay:Q2,formatMonthCaption:G2,formatMonthDropdown:P2,formatWeekNumber:X2,formatWeekNumberHeader:W2,formatWeekdayName:V2,formatYearCaption:I2,formatYearDropdown:dx},Symbol.toStringTag,{value:"Module"}));function $2(a){return a?.formatMonthCaption&&!a.formatCaption&&(a.formatCaption=a.formatMonthCaption),a?.formatYearCaption&&!a.formatYearDropdown&&(a.formatYearDropdown=a.formatYearCaption),{...Z2,...a}}function Yd(a,l,r,c){let d=(c??new rn(r)).format(a,"PPPP");return l.today&&(d=`Today, ${d}`),l.selected&&(d=`${d}, selected`),d}const F2=Yd;function Kd(a,l,r){return(r??new rn(l)).formatMonthYear(a)}const J2=Kd;function fx(a,l,r,c){let d=(c??new rn(r)).format(a,"PPPP");return l?.today&&(d=`Today, ${d}`),d}function mx(a){return"Choose the Month"}function hx(){return""}const eE="Go to the Next Month";function px(a,l){return eE}function gx(a){return"Go to the Previous Month"}function yx(a,l,r){return(r??new rn(l)).format(a,"cccc")}function xx(a,l){return`Week ${a}`}function vx(a){return"Week Number"}function bx(a){return"Choose the Year"}const tE=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:J2,labelDay:F2,labelDayButton:Yd,labelGrid:Kd,labelGridcell:fx,labelMonthDropdown:mx,labelNav:hx,labelNext:px,labelPrevious:gx,labelWeekNumber:xx,labelWeekNumberHeader:vx,labelWeekday:yx,labelYearDropdown:bx},Symbol.toStringTag,{value:"Module"})),wn=(a,l,r)=>l||(r?typeof r=="function"?r:(...c)=>r:a);function nE(a,l){const r=l.locale?.labels??{};return{...tE,...a??{},labelDayButton:wn(Yd,a?.labelDayButton,r.labelDayButton),labelMonthDropdown:wn(mx,a?.labelMonthDropdown,r.labelMonthDropdown),labelNext:wn(px,a?.labelNext,r.labelNext),labelPrevious:wn(gx,a?.labelPrevious,r.labelPrevious),labelWeekNumber:wn(xx,a?.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:wn(bx,a?.labelYearDropdown,r.labelYearDropdown),labelGrid:wn(Kd,a?.labelGrid,r.labelGrid),labelGridcell:wn(fx,a?.labelGridcell,r.labelGridcell),labelNav:wn(hx,a?.labelNav,r.labelNav),labelWeekNumberHeader:wn(vx,a?.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:wn(yx,a?.labelWeekday,r.labelWeekday)}}function aE(a,l,r,c,d){const{startOfMonth:f,startOfYear:m,endOfYear:p,eachMonthOfInterval:g,getMonth:b}=d;return g({start:m(a),end:p(a)}).map(S=>{const M=c.formatMonthDropdown(S,d),A=b(S),R=l&&S<f(l)||r&&S>f(r)||!1;return{value:A,label:M,disabled:R}})}function lE(a,l={},r={}){let c={...l?.[ue.Day]};return Object.entries(a).filter(([,d])=>d===!0).forEach(([d])=>{c={...c,...r?.[d]}}),c}function sE(a,l,r,c){const d=c??a.today(),f=r?a.startOfBroadcastWeek(d,a):l?a.startOfISOWeek(d):a.startOfWeek(d),m=[];for(let p=0;p<7;p++){const g=a.addDays(f,p);m.push(g)}return m}function iE(a,l,r,c,d=!1){if(!a||!l)return;const{startOfYear:f,endOfYear:m,eachYearOfInterval:p,getYear:g}=c,b=f(a),C=m(l),v=p({start:b,end:C});return d&&v.reverse(),v.map(S=>{const M=r.formatYearDropdown(S,c);return{value:g(S),label:M,disabled:!1}})}const Mi=a=>a instanceof HTMLElement?a:null,Yu=a=>[...a.querySelectorAll("[data-animated-month]")??[]],rE=a=>Mi(a.querySelector("[data-animated-month]")),Ku=a=>Mi(a.querySelector("[data-animated-caption]")),Gu=a=>Mi(a.querySelector("[data-animated-weeks]")),oE=a=>Mi(a.querySelector("[data-animated-nav]")),cE=a=>Mi(a.querySelector("[data-animated-weekdays]"));function uE(a,l,{classNames:r,months:c,focused:d,dateLib:f}){const m=x.useRef(null),p=x.useRef(c),g=x.useRef(!1);x.useLayoutEffect(()=>{const b=p.current;if(p.current=c,!l||!a.current||!(a.current instanceof HTMLElement)||c.length===0||b.length===0||c.length!==b.length)return;const C=f.isSameMonth(c[0].date,b[0].date),v=f.isAfter(c[0].date,b[0].date),S=v?r[sn.caption_after_enter]:r[sn.caption_before_enter],M=v?r[sn.weeks_after_enter]:r[sn.weeks_before_enter],A=m.current,R=a.current.cloneNode(!0);if(R instanceof HTMLElement?(Yu(R).forEach(K=>{if(!(K instanceof HTMLElement))return;const H=rE(K);H&&K.contains(H)&&K.removeChild(H);const B=Ku(K);B&&B.classList.remove(S);const N=Gu(K);N&&N.classList.remove(M)}),m.current=R):m.current=null,g.current||C||d)return;const z=A instanceof HTMLElement?Yu(A):[],_=Yu(a.current);if(_?.every(L=>L instanceof HTMLElement)&&z&&z.every(L=>L instanceof HTMLElement)){g.current=!0,a.current.style.isolation="isolate";const L=oE(a.current);L&&(L.style.zIndex="1"),_.forEach((K,H)=>{const B=z[H];if(!B)return;K.style.position="relative",K.style.overflow="hidden";const N=Ku(K);N&&N.classList.add(S);const G=Gu(K);G&&G.classList.add(M);const I=()=>{g.current=!1,a.current&&(a.current.style.isolation=""),L&&(L.style.zIndex=""),N&&N.classList.remove(S),G&&G.classList.remove(M),K.style.position="",K.style.overflow="",K.contains(B)&&K.removeChild(B)};B.style.pointerEvents="none",B.style.position="absolute",B.style.overflow="hidden",B.setAttribute("aria-hidden","true");const J=cE(B);J&&(J.style.opacity="0");const ie=Ku(B);ie&&(ie.classList.add(v?r[sn.caption_before_exit]:r[sn.caption_after_exit]),ie.addEventListener("animationend",I));const ve=Gu(B);ve&&ve.classList.add(v?r[sn.weeks_before_exit]:r[sn.weeks_after_exit]),K.insertBefore(B,K.firstChild)})}})}function dE(a,l,r,c){const d=a[0],f=a[a.length-1],{ISOWeek:m,fixedWeeks:p,broadcastCalendar:g}=r??{},{addDays:b,differenceInCalendarDays:C,differenceInCalendarMonths:v,endOfBroadcastWeek:S,endOfISOWeek:M,endOfMonth:A,endOfWeek:R,isAfter:z,startOfBroadcastWeek:_,startOfISOWeek:L,startOfWeek:K}=c,H=g?_(d,c):m?L(d):K(d),B=g?S(f):m?M(A(f)):R(A(f)),N=l&&(g?S(l):m?M(l):R(l)),G=N&&z(B,N)?N:B,I=C(G,H),J=v(f,d)+1,ie=[];for(let Be=0;Be<=I;Be++){const Se=b(H,Be);ie.push(Se)}const re=(g?35:42)*J;if(p&&ie.length<re){const Be=re-ie.length;for(let Se=0;Se<Be;Se++){const be=b(ie[ie.length-1],1);ie.push(be)}}return ie}function fE(a){const l=[];return a.reduce((r,c)=>{const d=c.weeks.reduce((f,m)=>f.concat(m.days.slice()),l.slice());return r.concat(d.slice())},l.slice())}function mE(a,l,r,c){const{numberOfMonths:d=1}=r,f=[];for(let m=0;m<d;m++){const p=c.addMonths(a,m);if(l&&p>l)break;f.push(p)}return f}function Tg(a,l,r,c){const{month:d,defaultMonth:f,today:m=c.today(),numberOfMonths:p=1}=a;let g=d||f||m;const{differenceInCalendarMonths:b,addMonths:C,startOfMonth:v}=c;if(r&&b(r,g)<p-1){const S=-1*(p-1);g=C(r,S)}return l&&b(g,l)<0&&(g=l),v(g)}function hE(a,l,r,c){const{addDays:d,endOfBroadcastWeek:f,endOfISOWeek:m,endOfMonth:p,endOfWeek:g,getISOWeek:b,getWeek:C,startOfBroadcastWeek:v,startOfISOWeek:S,startOfWeek:M}=c,A=a.reduce((R,z)=>{const _=r.broadcastCalendar?v(z,c):r.ISOWeek?S(z):M(z),L=r.broadcastCalendar?f(z):r.ISOWeek?m(p(z)):g(p(z)),K=l.filter(G=>G>=_&&G<=L),H=r.broadcastCalendar?35:42;if(r.fixedWeeks&&K.length<H){const G=l.filter(I=>{const J=H-K.length;return I>L&&I<=d(L,J)});K.push(...G)}const B=K.reduce((G,I)=>{const J=r.ISOWeek?b(I):C(I),ie=G.find(re=>re.weekNumber===J),ve=new ix(I,z,c);return ie?ie.days.push(ve):G.push(new u2(J,[ve])),G},[]),N=new c2(z,B);return R.push(N),R},[]);return r.reverseMonths?A.reverse():A}function pE(a,l){let{startMonth:r,endMonth:c}=a;const{startOfYear:d,startOfDay:f,startOfMonth:m,endOfMonth:p,addYears:g,endOfYear:b,newDate:C,today:v}=l,{fromYear:S,toYear:M,fromMonth:A,toMonth:R}=a;!r&&A&&(r=A),!r&&S&&(r=l.newDate(S,0,1)),!c&&R&&(c=R),!c&&M&&(c=C(M,11,31));const z=a.captionLayout==="dropdown"||a.captionLayout==="dropdown-years";return r?r=m(r):S?r=C(S,0,1):!r&&z&&(r=d(g(a.today??v(),-100))),c?c=p(c):M?c=C(M,11,31):!c&&z&&(c=b(a.today??v())),[r&&f(r),c&&f(c)]}function gE(a,l,r,c){if(r.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:f=1}=r,{startOfMonth:m,addMonths:p,differenceInCalendarMonths:g}=c,b=d?f:1,C=m(a);if(!l)return p(C,b);if(!(g(l,a)<f))return p(C,b)}function yE(a,l,r,c){if(r.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:f}=r,{startOfMonth:m,addMonths:p,differenceInCalendarMonths:g}=c,b=d?f??1:1,C=m(a);if(!l)return p(C,-b);if(!(g(C,l)<=0))return p(C,-b)}function xE(a){const l=[];return a.reduce((r,c)=>r.concat(c.weeks.slice()),l.slice())}function xo(a,l){const[r,c]=x.useState(a);return[l===void 0?r:l,c]}function vE(a,l){const[r,c]=pE(a,l),{startOfMonth:d,endOfMonth:f}=l,m=Tg(a,r,c,l),[p,g]=xo(m,a.month?m:void 0);x.useEffect(()=>{const H=Tg(a,r,c,l);g(H)},[a.timeZone]);const{months:b,weeks:C,days:v,previousMonth:S,nextMonth:M}=x.useMemo(()=>{const H=mE(p,c,{numberOfMonths:a.numberOfMonths},l),B=dE(H,a.endMonth?f(a.endMonth):void 0,{ISOWeek:a.ISOWeek,fixedWeeks:a.fixedWeeks,broadcastCalendar:a.broadcastCalendar},l),N=hE(H,B,{broadcastCalendar:a.broadcastCalendar,fixedWeeks:a.fixedWeeks,ISOWeek:a.ISOWeek,reverseMonths:a.reverseMonths},l),G=xE(N),I=fE(N),J=yE(p,r,a,l),ie=gE(p,c,a,l);return{months:N,weeks:G,days:I,previousMonth:J,nextMonth:ie}},[l,p.getTime(),c?.getTime(),r?.getTime(),a.disableNavigation,a.broadcastCalendar,a.endMonth?.getTime(),a.fixedWeeks,a.ISOWeek,a.numberOfMonths,a.pagedNavigation,a.reverseMonths]),{disableNavigation:A,onMonthChange:R}=a,z=H=>C.some(B=>B.days.some(N=>N.isEqualTo(H))),_=H=>{if(A)return;let B=d(H);r&&B<d(r)&&(B=d(r)),c&&B>d(c)&&(B=d(c)),g(B),R?.(B)};return{months:b,weeks:C,days:v,navStart:r,navEnd:c,previousMonth:S,nextMonth:M,goToMonth:_,goToDay:H=>{z(H)||_(H.date)}}}var Un;(function(a){a[a.Today=0]="Today",a[a.Selected=1]="Selected",a[a.LastFocused=2]="LastFocused",a[a.FocusedModifier=3]="FocusedModifier"})(Un||(Un={}));function Og(a){return!a[lt.disabled]&&!a[lt.hidden]&&!a[lt.outside]}function bE(a,l,r,c){let d,f=-1;for(const m of a){const p=l(m);Og(p)&&(p[lt.focused]&&f<Un.FocusedModifier?(d=m,f=Un.FocusedModifier):c?.isEqualTo(m)&&f<Un.LastFocused?(d=m,f=Un.LastFocused):r(m.date)&&f<Un.Selected?(d=m,f=Un.Selected):p[lt.today]&&f<Un.Today&&(d=m,f=Un.Today))}return d||(d=a.find(m=>Og(l(m)))),d}function SE(a,l,r,c,d,f,m){const{ISOWeek:p,broadcastCalendar:g}=f,{addDays:b,addMonths:C,addWeeks:v,addYears:S,endOfBroadcastWeek:M,endOfISOWeek:A,endOfWeek:R,max:z,min:_,startOfBroadcastWeek:L,startOfISOWeek:K,startOfWeek:H}=m;let N={day:b,week:v,month:C,year:S,startOfWeek:G=>g?L(G,m):p?K(G):H(G),endOfWeek:G=>g?M(G):p?A(G):R(G)}[a](r,l==="after"?1:-1);return l==="before"&&c?N=z([c,N]):l==="after"&&d&&(N=_([d,N])),N}function Sx(a,l,r,c,d,f,m,p=0){if(p>365)return;const g=SE(a,l,r.date,c,d,f,m),b=!!(f.disabled&&ha(g,f.disabled,m)),C=!!(f.hidden&&ha(g,f.hidden,m)),v=g,S=new ix(g,v,m);return!b&&!C?S:Sx(a,l,S,c,d,f,m,p+1)}function NE(a,l,r,c,d){const{autoFocus:f}=a,[m,p]=x.useState(),g=bE(l.days,r,c||(()=>!1),m),[b,C]=x.useState(f?g:void 0);return{isFocusTarget:R=>!!g?.isEqualTo(R),setFocused:C,focused:b,blur:()=>{p(b),C(void 0)},moveFocus:(R,z)=>{if(!b)return;const _=Sx(R,z,b,l.navStart,l.navEnd,a,d);_&&(a.disableNavigation&&!l.days.some(K=>K.isEqualTo(_))||(l.goToDay(_),C(_)))}}}function jE(a,l){const{selected:r,required:c,onSelect:d}=a,[f,m]=xo(r,d?r:void 0),p=d?r:f,{isSameDay:g}=l,b=M=>p?.some(A=>g(A,M))??!1,{min:C,max:v}=a;return{selected:p,select:(M,A,R)=>{let z=[...p??[]];if(b(M)){if(p?.length===C||c&&p?.length===1)return;z=p?.filter(_=>!g(_,M))}else p?.length===v?z=[M]:z=[...z,M];return d||m(z),d?.(z,M,A,R),z},isSelected:b}}function wE(a,l,r=0,c=0,d=!1,f=Hn){const{from:m,to:p}=l||{},{isSameDay:g,isAfter:b,isBefore:C}=f;let v;if(!m&&!p)v={from:a,to:r>0?void 0:a};else if(m&&!p)g(m,a)?r===0?v={from:m,to:a}:d?v={from:m,to:void 0}:v=void 0:C(a,m)?v={from:a,to:m}:v={from:m,to:a};else if(m&&p)if(g(m,a)&&g(p,a))d?v={from:m,to:p}:v=void 0;else if(g(m,a))v={from:m,to:r>0?void 0:a};else if(g(p,a))v={from:a,to:r>0?void 0:a};else if(C(a,m))v={from:a,to:p};else if(b(a,m))v={from:m,to:a};else if(b(a,p))v={from:m,to:a};else throw new Error("Invalid range");if(v?.from&&v?.to){const S=f.differenceInCalendarDays(v.to,v.from);c>0&&S>c?v={from:a,to:void 0}:r>1&&S<r&&(v={from:a,to:void 0})}return v}function CE(a,l,r=Hn){const c=Array.isArray(l)?l:[l];let d=a.from;const f=r.differenceInCalendarDays(a.to,a.from),m=Math.min(f,6);for(let p=0;p<=m;p++){if(c.includes(d.getDay()))return!0;d=r.addDays(d,1)}return!1}function _g(a,l,r=Hn){return ma(a,l.from,!1,r)||ma(a,l.to,!1,r)||ma(l,a.from,!1,r)||ma(l,a.to,!1,r)}function EE(a,l,r=Hn){const c=Array.isArray(l)?l:[l];if(c.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:r.isDate(p)?ma(a,p,!1,r):cx(p,r)?p.some(g=>ma(a,g,!1,r)):yo(p)?p.from&&p.to?_g(a,{from:p.from,to:p.to},r):!1:ox(p)?CE(a,p.dayOfWeek,r):Bd(p)?r.isAfter(p.before,p.after)?_g(a,{from:r.addDays(p.after,1),to:r.addDays(p.before,-1)},r):ha(a.from,p,r)||ha(a.to,p,r):Hd(p)||qd(p)?ha(a.from,p,r)||ha(a.to,p,r):!1))return!0;const m=c.filter(p=>typeof p=="function");if(m.length){let p=a.from;const g=r.differenceInCalendarDays(a.to,a.from);for(let b=0;b<=g;b++){if(m.some(C=>C(p)))return!0;p=r.addDays(p,1)}}return!1}function ME(a,l){const{disabled:r,excludeDisabled:c,selected:d,required:f,onSelect:m}=a,[p,g]=xo(d,m?d:void 0),b=m?d:p;return{selected:b,select:(S,M,A)=>{const{min:R,max:z}=a,_=S?wE(S,b,R,z,f,l):void 0;return c&&r&&_?.from&&_.to&&EE({from:_.from,to:_.to},r,l)&&(_.from=S,_.to=void 0),m||g(_),m?.(_,S,M,A),_},isSelected:S=>b&&ma(b,S,!1,l)}}function AE(a,l){const{selected:r,required:c,onSelect:d}=a,[f,m]=xo(r,d?r:void 0),p=d?r:f,{isSameDay:g}=l;return{selected:p,select:(v,S,M)=>{let A=v;return!c&&p&&p&&g(v,p)&&(A=void 0),d||m(A),d?.(A,v,S,M),A},isSelected:v=>p?g(p,v):!1}}function TE(a,l){const r=AE(a,l),c=jE(a,l),d=ME(a,l);switch(a.mode){case"single":return r;case"multiple":return c;case"range":return d;default:return}}function Ot(a,l){return a instanceof fa&&a.timeZone===l?a:new fa(a,l)}function zg(a,l){return typeof a=="boolean"||typeof a=="function"?a:a instanceof Date?Ot(a,l):Array.isArray(a)?a.map(r=>r instanceof Date?Ot(r,l):r):yo(a)?{...a,from:a.from?Ot(a.from,l):a.from,to:a.to?Ot(a.to,l):a.to}:Bd(a)?{before:Ot(a.before,l),after:Ot(a.after,l)}:Hd(a)?{after:Ot(a.after,l)}:qd(a)?{before:Ot(a.before,l)}:a}function Qu(a,l){return a&&(Array.isArray(a)?a.map(r=>zg(r,l)):zg(a,l))}function OE(a){let l=a;const r=l.timeZone;if(r&&(l={...a,timeZone:r},l.today&&(l.today=Ot(l.today,r)),l.month&&(l.month=Ot(l.month,r)),l.defaultMonth&&(l.defaultMonth=Ot(l.defaultMonth,r)),l.startMonth&&(l.startMonth=Ot(l.startMonth,r)),l.endMonth&&(l.endMonth=Ot(l.endMonth,r)),l.mode==="single"&&l.selected?l.selected=Ot(l.selected,r):l.mode==="multiple"&&l.selected?l.selected=l.selected?.map(ce=>Ot(ce,r)):l.mode==="range"&&l.selected&&(l.selected={from:l.selected.from?Ot(l.selected.from,r):l.selected.from,to:l.selected.to?Ot(l.selected.to,r):l.selected.to}),l.disabled!==void 0&&(l.disabled=Qu(l.disabled,r)),l.hidden!==void 0&&(l.hidden=Qu(l.hidden,r)),l.modifiers)){const ce={};Object.keys(l.modifiers).forEach(Ne=>{ce[Ne]=Qu(l.modifiers?.[Ne],r)}),l.modifiers=ce}const{components:c,formatters:d,labels:f,dateLib:m,locale:p,classNames:g}=x.useMemo(()=>{const ce={...sx,...l.locale},Ne=new rn({locale:ce,weekStartsOn:l.broadcastCalendar?1:l.weekStartsOn,firstWeekContainsDate:l.firstWeekContainsDate,useAdditionalWeekYearTokens:l.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:l.useAdditionalDayOfYearTokens,timeZone:l.timeZone,numerals:l.numerals},l.dateLib);return{dateLib:Ne,components:q2(l.components),formatters:$2(l.formatters),labels:nE(l.labels,Ne.options),locale:ce,classNames:{...K2(),...l.classNames}}},[l.locale,l.broadcastCalendar,l.weekStartsOn,l.firstWeekContainsDate,l.useAdditionalWeekYearTokens,l.useAdditionalDayOfYearTokens,l.timeZone,l.numerals,l.dateLib,l.components,l.formatters,l.labels,l.classNames]);l.today||(l={...l,today:m.today()});const{captionLayout:b,mode:C,navLayout:v,numberOfMonths:S=1,onDayBlur:M,onDayClick:A,onDayFocus:R,onDayKeyDown:z,onDayMouseEnter:_,onDayMouseLeave:L,onNextClick:K,onPrevClick:H,showWeekNumber:B,styles:N}=l,{formatCaption:G,formatDay:I,formatMonthDropdown:J,formatWeekNumber:ie,formatWeekNumberHeader:ve,formatWeekdayName:re,formatYearDropdown:Be}=d,Se=vE(l,m),{days:be,months:k,navStart:W,navEnd:V,previousMonth:oe,nextMonth:de,goToMonth:Oe}=Se,ze=B2(be,l,W,V,m),{isSelected:X,select:$,selected:ne}=TE(l,m)??{},{blur:F,focused:te,isFocusTarget:he,moveFocus:_e,setFocused:Ke}=NE(l,Se,ze,X??(()=>!1),m),{labelDayButton:vt,labelGridcell:bt,labelGrid:Qe,labelMonthDropdown:tt,labelNav:Rt,labelPrevious:Pt,labelNext:qn,labelWeekday:je,labelWeekNumber:Vt,labelWeekNumberHeader:An,labelYearDropdown:Xt}=f,ya=x.useMemo(()=>sE(m,l.ISOWeek,l.broadcastCalendar,l.today),[m,l.ISOWeek,l.broadcastCalendar,l.today]),Yn=C!==void 0||A!==void 0,ut=x.useCallback(()=>{oe&&(Oe(oe),H?.(oe))},[oe,Oe,H]),Wt=x.useCallback(()=>{de&&(Oe(de),K?.(de))},[Oe,de,K]),Kn=x.useCallback((ce,Ne)=>ge=>{ge.preventDefault(),ge.stopPropagation(),Ke(ce),!Ne.disabled&&($?.(ce.date,Ne,ge),A?.(ce.date,Ne,ge))},[$,A,Ke]),Ia=x.useCallback((ce,Ne)=>ge=>{Ke(ce),R?.(ce.date,Ne,ge)},[R,Ke]),Tn=x.useCallback((ce,Ne)=>ge=>{F(),M?.(ce.date,Ne,ge)},[F,M]),On=x.useCallback((ce,Ne)=>ge=>{const Ae={ArrowLeft:[ge.shiftKey?"month":"day",l.dir==="rtl"?"after":"before"],ArrowRight:[ge.shiftKey?"month":"day",l.dir==="rtl"?"before":"after"],ArrowDown:[ge.shiftKey?"year":"week","after"],ArrowUp:[ge.shiftKey?"year":"week","before"],PageUp:[ge.shiftKey?"year":"month","before"],PageDown:[ge.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ge.key]){ge.preventDefault(),ge.stopPropagation();const[Fe,xe]=Ae[ge.key];_e(Fe,xe)}z?.(ce.date,Ne,ge)},[_e,z,l.dir]),Nl=x.useCallback((ce,Ne)=>ge=>{_?.(ce.date,Ne,ge)},[_]),gs=x.useCallback((ce,Ne)=>ge=>{L?.(ce.date,Ne,ge)},[L]),ys=x.useCallback(ce=>Ne=>{const ge=Number(Ne.target.value),Ae=m.setMonth(m.startOfMonth(ce),ge);Oe(Ae)},[m,Oe]),Gn=x.useCallback(ce=>Ne=>{const ge=Number(Ne.target.value),Ae=m.setYear(m.startOfMonth(ce),ge);Oe(Ae)},[m,Oe]),{className:Z,style:Ee}=x.useMemo(()=>({className:[g[ue.Root],l.className].filter(Boolean).join(" "),style:{...N?.[ue.Root],...l.style}}),[g,l.className,l.style,N]),pe=Y2(l),Me=x.useRef(null);uE(Me,!!l.animate,{classNames:g,months:k,focused:te,dateLib:m});const nt={dayPickerProps:l,selected:ne,select:$,isSelected:X,months:k,nextMonth:de,previousMonth:oe,goToMonth:Oe,getModifiers:ze,components:c,classNames:g,styles:N,labels:f,formatters:d};return ee.createElement(rx.Provider,{value:nt},ee.createElement(c.Root,{rootRef:l.animate?Me:void 0,className:Z,style:Ee,dir:l.dir,id:l.id,lang:l.lang,nonce:l.nonce,title:l.title,role:l.role,"aria-label":l["aria-label"],"aria-labelledby":l["aria-labelledby"],...pe},ee.createElement(c.Months,{className:g[ue.Months],style:N?.[ue.Months]},!l.hideNavigation&&!v&&ee.createElement(c.Nav,{"data-animated-nav":l.animate?"true":void 0,className:g[ue.Nav],style:N?.[ue.Nav],"aria-label":Rt(),onPreviousClick:ut,onNextClick:Wt,previousMonth:oe,nextMonth:de}),k.map((ce,Ne)=>ee.createElement(c.Month,{"data-animated-month":l.animate?"true":void 0,className:g[ue.Month],style:N?.[ue.Month],key:Ne,displayIndex:Ne,calendarMonth:ce},v==="around"&&!l.hideNavigation&&Ne===0&&ee.createElement(c.PreviousMonthButton,{type:"button",className:g[ue.PreviousMonthButton],tabIndex:oe?void 0:-1,"aria-disabled":oe?void 0:!0,"aria-label":Pt(oe),onClick:ut,"data-animated-button":l.animate?"true":void 0},ee.createElement(c.Chevron,{disabled:oe?void 0:!0,className:g[ue.Chevron],orientation:l.dir==="rtl"?"right":"left"})),ee.createElement(c.MonthCaption,{"data-animated-caption":l.animate?"true":void 0,className:g[ue.MonthCaption],style:N?.[ue.MonthCaption],calendarMonth:ce,displayIndex:Ne},b?.startsWith("dropdown")?ee.createElement(c.DropdownNav,{className:g[ue.Dropdowns],style:N?.[ue.Dropdowns]},(()=>{const ge=b==="dropdown"||b==="dropdown-months"?ee.createElement(c.MonthsDropdown,{key:"month",className:g[ue.MonthsDropdown],"aria-label":tt(),classNames:g,components:c,disabled:!!l.disableNavigation,onChange:ys(ce.date),options:aE(ce.date,W,V,d,m),style:N?.[ue.Dropdown],value:m.getMonth(ce.date)}):ee.createElement("span",{key:"month"},J(ce.date,m)),Ae=b==="dropdown"||b==="dropdown-years"?ee.createElement(c.YearsDropdown,{key:"year",className:g[ue.YearsDropdown],"aria-label":Xt(m.options),classNames:g,components:c,disabled:!!l.disableNavigation,onChange:Gn(ce.date),options:iE(W,V,d,m,!!l.reverseYears),style:N?.[ue.Dropdown],value:m.getYear(ce.date)}):ee.createElement("span",{key:"year"},Be(ce.date,m));return m.getMonthYearOrder()==="year-first"?[Ae,ge]:[ge,Ae]})(),ee.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},G(ce.date,m.options,m))):ee.createElement(c.CaptionLabel,{className:g[ue.CaptionLabel],role:"status","aria-live":"polite"},G(ce.date,m.options,m))),v==="around"&&!l.hideNavigation&&Ne===S-1&&ee.createElement(c.NextMonthButton,{type:"button",className:g[ue.NextMonthButton],tabIndex:de?void 0:-1,"aria-disabled":de?void 0:!0,"aria-label":qn(de),onClick:Wt,"data-animated-button":l.animate?"true":void 0},ee.createElement(c.Chevron,{disabled:de?void 0:!0,className:g[ue.Chevron],orientation:l.dir==="rtl"?"left":"right"})),Ne===S-1&&v==="after"&&!l.hideNavigation&&ee.createElement(c.Nav,{"data-animated-nav":l.animate?"true":void 0,className:g[ue.Nav],style:N?.[ue.Nav],"aria-label":Rt(),onPreviousClick:ut,onNextClick:Wt,previousMonth:oe,nextMonth:de}),ee.createElement(c.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Qe(ce.date,m.options,m)||void 0,className:g[ue.MonthGrid],style:N?.[ue.MonthGrid]},!l.hideWeekdays&&ee.createElement(c.Weekdays,{"data-animated-weekdays":l.animate?"true":void 0,className:g[ue.Weekdays],style:N?.[ue.Weekdays]},B&&ee.createElement(c.WeekNumberHeader,{"aria-label":An(m.options),className:g[ue.WeekNumberHeader],style:N?.[ue.WeekNumberHeader],scope:"col"},ve()),ya.map(ge=>ee.createElement(c.Weekday,{"aria-label":je(ge,m.options,m),className:g[ue.Weekday],key:String(ge),style:N?.[ue.Weekday],scope:"col"},re(ge,m.options,m)))),ee.createElement(c.Weeks,{"data-animated-weeks":l.animate?"true":void 0,className:g[ue.Weeks],style:N?.[ue.Weeks]},ce.weeks.map(ge=>ee.createElement(c.Week,{className:g[ue.Week],key:ge.weekNumber,style:N?.[ue.Week],week:ge},B&&ee.createElement(c.WeekNumber,{week:ge,style:N?.[ue.WeekNumber],"aria-label":Vt(ge.weekNumber,{locale:p}),className:g[ue.WeekNumber],scope:"row",role:"rowheader"},ie(ge.weekNumber,m)),ge.days.map(Ae=>{const{date:Fe}=Ae,xe=ze(Ae);if(xe[lt.focused]=!xe.hidden&&!!te?.isEqualTo(Ae),xe[Cn.selected]=X?.(Fe)||xe.selected,yo(ne)){const{from:It,to:bn}=ne;xe[Cn.range_start]=!!(It&&bn&&m.isSameDay(Fe,It)),xe[Cn.range_end]=!!(It&&bn&&m.isSameDay(Fe,bn)),xe[Cn.range_middle]=ma(ne,Fe,!0,m)}const zt=lE(xe,N,l.modifiersStyles),Qn=H2(xe,g,l.modifiersClassNames),Nt=!Yn&&!xe.hidden?bt(Fe,xe,m.options,m):void 0;return ee.createElement(c.Day,{key:`${Ae.isoDate}_${Ae.displayMonthId}`,day:Ae,modifiers:xe,className:Qn.join(" "),style:zt,role:"gridcell","aria-selected":xe.selected||void 0,"aria-label":Nt,"data-day":Ae.isoDate,"data-month":Ae.outside?Ae.dateMonthId:void 0,"data-selected":xe.selected||void 0,"data-disabled":xe.disabled||void 0,"data-hidden":xe.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":xe.focused||void 0,"data-today":xe.today||void 0},!xe.hidden&&Yn?ee.createElement(c.DayButton,{className:g[ue.DayButton],style:N?.[ue.DayButton],type:"button",day:Ae,modifiers:xe,disabled:!xe.focused&&xe.disabled||void 0,"aria-disabled":xe.focused&&xe.disabled||void 0,tabIndex:he(Ae)?0:-1,"aria-label":vt(Fe,xe,m.options,m),onClick:Kn(Ae,xe),onBlur:Tn(Ae,xe),onFocus:Ia(Ae,xe),onKeyDown:On(Ae,xe),onMouseEnter:Nl(Ae,xe),onMouseLeave:gs(Ae,xe)},I(Fe,m.options,m)):!xe.hidden&&I(Ae.date,m.options,m))})))))))),l.footer&&ee.createElement(c.Footer,{className:g[ue.Footer],style:N?.[ue.Footer],role:"status","aria-live":"polite"},l.footer)))}function _E({className:a,classNames:l,showOutsideDays:r=!0,...c}){return i.jsx(OE,{showOutsideDays:r,className:q("p-2",a),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Qr({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Qr({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Qr({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...l},components:{Chevron:({orientation:d,className:f,...m})=>{const p=d==="left"?Jb:d==="right"?Jr:d==="up"?id:so;return i.jsx(p,{className:q("h-4 w-4",f),...m})}},...c})}_E.displayName="Calendar";const zE=x.lazy(()=>ht(()=>Promise.resolve().then(()=>Ld),void 0).then(a=>({default:a.CodeEditor})));function $M({rawJsonContent:a,isRawJsonValid:l,rawJsonEdits:r,rawSettingsEnv:c,onChange:d,missingRequiredFields:f=[]}){const m=f.length>0;return i.jsx(x.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(Mn,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!l&&r!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(hs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),l&&m&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[i.jsx(pa,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",i.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:f.join(", ")}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(zE,{value:a,onChange:d,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Rd,{profileEnv:c})})})]})})}const FM={target:"Target CLI",cliproxy:"CLIProxy Provider","api-profiles":"API Profile",websearch:"WebSearch"},JM=[{id:"droid-target-support",title:"Factory Droid support is live",summary:"API Profiles and CLIProxy variants now support Droid as a first-class execution target.",primaryAction:"Set Droid as your default execution target for non-Claude workflows.",publishedAt:"2026-02-25",status:"new",scopes:["target","api-profiles","cliproxy"],entryIds:["droid-target","custom-api-profiles","codex-cliproxy","agy-cliproxy"],highlights:["Set default target to Droid when creating or editing API Profiles.","Set default target to Droid for CLIProxy variants, including Codex and Antigravity flows.","Use ccsd alias or --target droid for one-off target overrides."],actions:[{id:"open-api-profiles",label:"Set default target in API Profiles",description:"Open API Profiles and set Default Target to Droid for profiles you run often.",type:"route",path:"/providers"},{id:"open-cliproxy",label:"Set default target in CLIProxy variants",description:"Open CLIProxy variants and set target to Droid for Codex/Antigravity or custom variants.",type:"route",path:"/cliproxy"},{id:"copy-ccsd-command",label:"Run once with Droid alias",description:"Use ccsd to force Droid target with your current profile.",type:"command",command:"ccsd glm"},{id:"copy-target-override",label:"Run once with --target override",description:"Keep your default profile but force Droid for a single command.",type:"command",command:'ccs codex --target droid "your prompt"'}],routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccsd glm",'ccs codex --target droid "your prompt"',"ccs cliproxy create mycodex --provider codex --target droid"]},{id:"updates-center-launch",title:"Updates inbox is available for rollout tasks",summary:"A focused updates inbox exists for setup tasks and rollout guidance when you need it.",primaryAction:"Use this page only when needed for rollout tasks, then return to your normal workflow.",publishedAt:"2026-02-25",status:"new",scopes:["target","cliproxy","api-profiles","websearch"],entryIds:["droid-target","codex-cliproxy","custom-api-profiles","opencode-websearch"],highlights:["Single data source powers update content and integration mapping.","Notices can be tracked as new, seen, done, or dismissed.","Catalog covers target CLI, CLIProxy providers, and WebSearch integrations."],actions:[{id:"open-updates-page",label:"Open updates inbox when needed",description:"Review rollout tasks only when you want guided setup changes.",type:"route",path:"/updates"},{id:"copy-open-dashboard",label:"Open dashboard from terminal",description:"Re-open config dashboard anytime from CLI.",type:"command",command:"ccs config"}],routes:[{label:"Updates Inbox",path:"/updates"}],commands:["ccs config"]}],DE=[{id:"claude-target",name:"Claude Code",scope:"target",status:"stable",summary:"Default runtime target for all CCS profile types.",pillars:{baseUrl:"From profile settings (ANTHROPIC_BASE_URL)",auth:"From profile settings (ANTHROPIC_AUTH_TOKEN)",model:"From profile settings (ANTHROPIC_MODEL)"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccs",'ccs glm "your prompt"']},{id:"droid-target",name:"Factory Droid",scope:"target",status:"new",summary:"First-class target for API Profiles and CLIProxy variants.",pillars:{baseUrl:"From profile or variant settings",auth:"From profile or variant settings",model:"From profile or variant settings"},routes:[{label:"API Profiles",path:"/providers"},{label:"CLIProxy",path:"/cliproxy"}],commands:["ccsd glm","ccs km --target droid","ccs codex --target droid"],notes:"Use ccsd alias for automatic Droid target selection."},{id:"codex-cliproxy",name:"Codex via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed provider with configurable variant model and target.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs codex","ccs cliproxy create mycodex --provider codex"]},{id:"gemini-cliproxy",name:"Gemini via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Gemini provider with multi-account management.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs gemini","ccs cliproxy create mygem --provider gemini"]},{id:"agy-cliproxy",name:"Antigravity via CLIProxy",scope:"cliproxy",status:"stable",summary:"OAuth-backed Antigravity provider with variant target controls.",pillars:{baseUrl:"Managed by CLIProxy backend",auth:"OAuth account via CLIProxy auth flow",model:"Selectable per provider or variant"},routes:[{label:"CLIProxy",path:"/cliproxy"},{label:"Control Panel",path:"/cliproxy/control-panel"}],commands:["ccs agy","ccs cliproxy create myagy --provider agy --target droid"]},{id:"custom-api-profiles",name:"Custom API Profiles",scope:"api-profiles",status:"stable",summary:"Any Anthropic-compatible endpoint with per-profile target and model mapping.",pillars:{baseUrl:"User-defined endpoint",auth:"User-defined token/key",model:"User-defined model identifier"},routes:[{label:"API Profiles",path:"/providers"}],commands:["ccs api create myprofile",'ccs myprofile "your prompt"']},{id:"opencode-websearch",name:"OpenCode WebSearch",scope:"websearch",status:"stable",summary:"WebSearch provider surfaced in Settings for third-party profile workflows.",pillars:{baseUrl:"Managed by OpenCode CLI integration",auth:"Provider-specific (managed externally)",model:"Configurable in WebSearch settings"},routes:[{label:"Settings",path:"/settings"}],commands:["ccs config",'ccs codex "your prompt"'],notes:"Enable OpenCode in Settings > WebSearch to activate fallback search."}],kE=new Map(DE.map(a=>[a.id,a]));function eA(a){return a.entryIds.map(l=>kE.get(l)).filter(l=>!!l)}function tA(a){const l=new Date(`${a}T00:00:00Z`);return Number.isNaN(l.getTime())?a:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(l)}function RE(){const[a,l]=x.useState(""),[r,c]=x.useState(""),[d,f]=x.useState(null),[m,p]=x.useState(!1),{login:g,authRequired:b,isAuthenticated:C}=dd(),v=ad(),M=nd().state?.from?.pathname||"/";if(x.useEffect(()=>{(C||!b)&&v(M,{replace:!0})},[C,b,v,M]),C||!b)return null;const A=async R=>{R.preventDefault(),f(null),p(!0);try{await g(a,r),v(M,{replace:!0})}catch(z){f(z instanceof Error?z.message:"Login failed")}finally{p(!1)}};return i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:i.jsxs(OC,{className:"w-full max-w-sm",children:[i.jsxs(_C,{className:"space-y-1 text-center",children:[i.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:i.jsx(eS,{className:"h-6 w-6 text-primary"})}),i.jsx(zC,{className:"text-2xl",children:"CCS Dashboard"}),i.jsx(DC,{children:"Enter your credentials to access the dashboard"})]}),i.jsx(kC,{children:i.jsxs("form",{onSubmit:A,className:"space-y-4",children:[d&&i.jsxs(_d,{variant:"destructive",children:[i.jsx(od,{className:"h-4 w-4"}),i.jsx(zd,{children:d})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{htmlFor:"username",children:"Username"}),i.jsx(Rn,{id:"username",type:"text",value:a,onChange:R=>l(R.target.value),placeholder:"Enter username",autoComplete:"username",disabled:m,required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(an,{htmlFor:"password",children:"Password"}),i.jsx(Rn,{id:"password",type:"password",value:r,onChange:R=>c(R.target.value),placeholder:"Enter password",autoComplete:"current-password",disabled:m,required:!0})]}),i.jsx(ot,{type:"submit",className:"w-full",disabled:m,children:m?i.jsxs(i.Fragment,{children:[i.jsx(Mn,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"})]})})]})})}const UE=x.lazy(()=>ht(()=>import("./index-n1iv9ylt.js"),__vite__mapDeps([18,1,2,4,5,7,19,6,8,9])).then(a=>({default:a.AnalyticsPage}))),LE=x.lazy(()=>ht(()=>import("./api-CtPIBYPJ.js"),__vite__mapDeps([20,1,2,5,21,15,6,4,22,7,8,9])).then(a=>({default:a.ApiPage}))),BE=x.lazy(()=>ht(()=>import("./cliproxy-nwnHc6Ex.js"),__vite__mapDeps([23,1,2,5,13,6,4,14,15,24,21,22,3,7,8,9])).then(a=>({default:a.CliproxyPage}))),HE=x.lazy(()=>ht(()=>import("./cliproxy-control-panel-D-0qYG1v.js"),__vite__mapDeps([25,1,2,5,13,4,6,7,8,9])).then(a=>({default:a.CliproxyControlPanelPage}))),qE=x.lazy(()=>ht(()=>import("./copilot-CsbHY1RT.js"),__vite__mapDeps([26,1,2,5,21,15,4,22,3,6,7,8,9])).then(a=>({default:a.CopilotPage}))),YE=x.lazy(()=>ht(()=>import("./cursor-Dae1NLqC.js"),__vite__mapDeps([27,1,2,6,5,13,3,22,4,7,8,9])).then(a=>({default:a.CursorPage}))),KE=x.lazy(()=>ht(()=>import("./droid-BQLHOVuB.js"),__vite__mapDeps([28,1,2,6,5,4,22,7,8,9])).then(a=>({default:a.DroidPage}))),GE=x.lazy(()=>ht(()=>import("./accounts-Cv9gdSl_.js"),__vite__mapDeps([29,1,2,5,15,6,4,24,7,8,9])).then(a=>({default:a.AccountsPage}))),QE=x.lazy(()=>ht(()=>Promise.resolve().then(()=>e2),void 0).then(a=>({default:a.SettingsPage}))),PE=x.lazy(()=>ht(()=>import("./health-DXE1K5e_.js"),__vite__mapDeps([30,1,2,5,6,4,7,8,9])).then(a=>({default:a.HealthPage}))),VE=x.lazy(()=>ht(()=>import("./shared-ByrShSly.js"),__vite__mapDeps([31,1,2,4,5,6,7,8,9])).then(a=>({default:a.SharedPage}))),XE=x.lazy(()=>ht(()=>import("./updates-BUBIr73T.js"),__vite__mapDeps([32,1,2,4,5,6,7,8,9])).then(a=>({default:a.UpdatesPage})));function vn(){return i.jsx("div",{className:"flex h-64 items-center justify-center",children:i.jsx(Mn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function WE(){return i.jsx(vb,{client:WS,children:i.jsx(ZS,{defaultTheme:"system",storageKey:"vite-ui-theme",children:i.jsx($S,{children:i.jsx(n1,{children:i.jsxs(gb,{children:[i.jsxs(yb,{children:[i.jsx(Dt,{path:"/login",element:i.jsx(RE,{})}),i.jsx(Dt,{element:i.jsx(a1,{}),children:i.jsxs(Dt,{element:i.jsx(WN,{}),children:[i.jsx(Dt,{path:"/",element:i.jsx(Qw,{})}),i.jsx(Dt,{path:"/analytics",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(UE,{})})}),i.jsx(Dt,{path:"/updates",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(XE,{})})}),i.jsx(Dt,{path:"/providers",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(LE,{})})}),i.jsx(Dt,{path:"/cliproxy",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(BE,{})})}),i.jsx(Dt,{path:"/cliproxy/control-panel",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(HE,{})})}),i.jsx(Dt,{path:"/copilot",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(qE,{})})}),i.jsx(Dt,{path:"/cursor",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(YE,{})})}),i.jsx(Dt,{path:"/droid",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(KE,{})})}),i.jsx(Dt,{path:"/accounts",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(GE,{})})}),i.jsx(Dt,{path:"/settings",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(QE,{})})}),i.jsx(Dt,{path:"/health",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(PE,{})})}),i.jsx(Dt,{path:"/shared",element:i.jsx(x.Suspense,{fallback:i.jsx(vn,{}),children:i.jsx(VE,{})})})]})})]}),i.jsx(bb,{position:"top-right"})]})})})})})}const Nx=document.getElementById("root");if(!Nx)throw new Error("Root element not found. Failed to mount React application.");PS.createRoot(Nx).render(i.jsx(x.StrictMode,{children:i.jsx(WE,{})}));export{Wy as $,sC as A,Qa as B,OC as C,UM as D,BM as E,Zw as F,aC as G,iC as H,Rn as I,LM as J,nN as K,an as L,aN as M,lN as N,Py as O,cy as P,Dd as Q,$r as R,Ye as S,Pa as T,Ju as U,YM as V,Xe as W,qM as X,DC as Y,KM as Z,GM as _,kC as a,Od as a$,QM as a0,F1 as a1,rM as a2,hM as a3,pM as a4,gd as a5,yd as a6,xd as a7,vd as a8,bd as a9,YN as aA,KN as aB,fy as aC,Cj as aD,xy as aE,yM as aF,xM as aG,vM as aH,bM as aI,XM as aJ,iM as aK,tN as aL,cM as aM,uM as aN,J1 as aO,eN as aP,dM as aQ,fM as aR,mM as aS,oM as aT,pi as aU,lM as aV,sM as aW,$M as aX,Jy as aY,Td as aZ,ji as a_,PM as aa,UC as ab,VM as ac,Wa as ad,OM as ae,LC as af,zM as ag,gM as ah,_M as ai,DM as aj,$p as ak,RM as al,Xw as am,NN as an,AM as ao,ON as ap,TM as aq,Nj as ar,b1 as as,S1 as at,co as au,oo as av,uo as aw,yl as ax,HN as ay,qN as az,ot as b,Yw as b0,kM as b1,_d as b2,qy as b3,zd as b4,tA as b5,FM as b6,JM as b7,eA as b8,tx as b9,WC as ba,ZC as bb,wM as bc,SM as bd,CM as be,NM as bf,jM as bg,MM as bh,EM as bi,Qr as bj,q as c,WM as d,IM as e,t2 as f,_E as g,aM as h,_C as i,zC as j,uj as k,dj as l,Sl as m,ZM as n,Va as o,Xa as p,Pw as q,Yy as r,Vw as s,Qy as t,cd as u,Fu as v,ug as w,cC as x,HM as y,Jw as z};
|