@kaitranntt/ccs 7.0.0-dev.2 → 7.0.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-Bm8H1Oot.js","assets/radix-ui-CV3R9pD6.js","assets/react-vendor-FspHSO0w.js","assets/code-highlight-BoHWVYut.js","assets/utils-CzKF5WmX.js","assets/icons-DvvDkxaF.js","assets/tanstack-Df9bCj5R.js","assets/notifications-B2Pz7lik.js","assets/form-utils-DP6ILe7Z.js","assets/analytics-BR435WpH.js","assets/card-ByK9DlE_.js","assets/charts-B9Jh-s-X.js","assets/api-ALobfD8T.js","assets/confirm-dialog-DQeTgOVm.js","assets/cliproxy-BlkTmqj-.js","assets/cliproxy-control-panel-CvVI3tSn.js","assets/copilot-_EhQN_rN.js","assets/switch-CasTIVeB.js","assets/accounts-DQwh-CP_.js","assets/settings-ByVm4JFM.js","assets/health-CApaflOt.js","assets/shared-C9bG-pqJ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-DHCb2-64.js","assets/radix-ui-CV3R9pD6.js","assets/react-vendor-FspHSO0w.js","assets/code-highlight-BoHWVYut.js","assets/utils-CzKF5WmX.js","assets/icons-DvvDkxaF.js","assets/tanstack-Df9bCj5R.js","assets/notifications-B2Pz7lik.js","assets/form-utils-DP6ILe7Z.js","assets/analytics-X8fiN7Q-.js","assets/card-BE-HBKyn.js","assets/charts-B9Jh-s-X.js","assets/api-Bg7IAVNF.js","assets/confirm-dialog-OPDDJToq.js","assets/cliproxy-CIDIqQZI.js","assets/cliproxy-control-panel-CvVI3tSn.js","assets/copilot-B2RMTVzo.js","assets/switch-BzjyydVV.js","assets/accounts-w6nGMF0z.js","assets/settings-B0qqVb1L.js","assets/health-Dh0YQtYa.js","assets/shared-P_OBzaf4.js"])))=>i.map(i=>d[i]);
2
2
  import{j as c,S as Ao,R as bp,C as Sp,a as Np,T as jp,D as Mp,P as Cp,O as wp,b as pv,c as gv,d as yv,e as vv,f as xv,A as bv,g as Sv,h as Nv,i as jv,k as Ep,V as Mv,l as Cv,m as zp,n as wv,L as Dp,o as Op,p as Tp,q as Ev,r as zv,s as Ap,I as Dv,t as _p,u as kp,v as Ov,w as Rp,x as Tv,y as Up,z as Bp,B as Av,E as _v,F as Hp,G as kv,H as Rv,J as Uv,K as Bv,M as qp,N as Hv,Q as qv,U as Yv}from"./radix-ui-CV3R9pD6.js";import{e as Yp,f as Lv,r as S,u as Gv,L as yc,O as Kv,R as Qv,h as Xv,g as Vv,c as ee,B as Zv,i as Wv,j as xn}from"./react-vendor-FspHSO0w.js";import{Q as Jv,u as tn,a as Dt,b as jn,c as $v}from"./tanstack-Df9bCj5R.js";import{t as Ge,T as Fv}from"./notifications-B2Pz7lik.js";import{t as Iv,c as Pv,a as _o,e as Js,f as Is,b as ex,d as tx,g as nx,h as ax,i as lx,j as sx,k as ix,l as ox,m as rx,n as ux,o as cx,p as fx,q as dx,r as mx,s as hx,u as px,v as gx,w as yx,x as vx,y as xx,z as bx,A as Sx,B as Nx,C as jx,D as Mx,E as Cx,F as wx,G as Ex,H as zx,I as Dx,J as Ox}from"./utils-CzKF5WmX.js";import{X as ii,P as Tx,H as Ax,C as _x,K as Lp,G as kx,Z as Gp,a as Kp,F as Qp,U as Xp,A as ai,S as Rx,b as ko,c as Ux,M as Bx,E as Mc,d as Cc,B as Hx,W as qx,e as Rh,f as Yx,g as Lx,h as Uh,i as Bh,L as Ro,j as wc,k as Ec,l as zc,m as Dc,R as Gx,n as Kx,o as Qx,p as Vp,q as Xx,I as Uo,T as Vx,r as Zx,s as Wx,t as Jx,u as Oc,v as $x,w as Fx,x as Tc,y as Bo,z as Zp,D as Ix,J as Hh,N as Px,O as eb}from"./icons-DvvDkxaF.js";import{o as qh,s as Yh,p as tb,a as nb,$ as ab,b as Wp,c as lb,d as ll,u as sb,e as ib}from"./form-utils-DP6ILe7Z.js";import"./code-highlight-BoHWVYut.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function r(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(f){if(f.ep)return;f.ep=!0;const m=r(f);fetch(f.href,m)}})();var lc={exports:{}},$s={},sc={exports:{}},ic={};var Lh;function ob(){return Lh||(Lh=1,(function(l){function s(D,$){var te=D.length;D.push($);e:for(;0<te;){var ge=te-1>>>1,be=D[ge];if(0<f(be,$))D[ge]=$,D[te]=be,te=ge;else break e}}function r(D){return D.length===0?null:D[0]}function u(D){if(D.length===0)return null;var $=D[0],te=D.pop();if(te!==$){D[0]=te;e:for(var ge=0,be=D.length,De=be>>>1;ge<De;){var de=2*(ge+1)-1,Q=D[de],F=de+1,se=D[F];if(0>f(Q,te))F<be&&0>f(se,Q)?(D[ge]=se,D[F]=te,ge=F):(D[ge]=Q,D[de]=te,ge=de);else if(F<be&&0>f(se,te))D[ge]=se,D[F]=te,ge=F;else break e}}return $}function f(D,$){var te=D.sortIndex-$.sortIndex;return te!==0?te:D.id-$.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;l.unstable_now=function(){return m.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var y=[],N=[],C=1,v=null,x=3,R=!1,T=!1,B=!1,Y=!1,A=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function K(D){for(var $=r(N);$!==null;){if($.callback===null)u(N);else if($.startTime<=D)u(N),$.sortIndex=$.expirationTime,s(y,$);else break;$=r(N)}}function k(D){if(B=!1,K(D),!T)if(r(y)!==null)T=!0,w||(w=!0,le());else{var $=r(N);$!==null&&ie(k,$.startTime-D)}}var w=!1,H=-1,J=5,P=-1;function pe(){return Y?!0:!(l.unstable_now()-P<J)}function ue(){if(Y=!1,w){var D=l.unstable_now();P=D;var $=!0;try{e:{T=!1,B&&(B=!1,V(H),H=-1),R=!0;var te=x;try{t:{for(K(D),v=r(y);v!==null&&!(v.expirationTime>D&&pe());){var ge=v.callback;if(typeof ge=="function"){v.callback=null,x=v.priorityLevel;var be=ge(v.expirationTime<=D);if(D=l.unstable_now(),typeof be=="function"){v.callback=be,K(D),$=!0;break t}v===r(y)&&u(y),K(D)}else u(y);v=r(y)}if(v!==null)$=!0;else{var De=r(N);De!==null&&ie(k,De.startTime-D),$=!1}}break e}finally{v=null,x=te,R=!1}$=void 0}}finally{$?le():w=!1}}}var le;if(typeof G=="function")le=function(){G(ue)};else if(typeof MessageChannel<"u"){var Be=new MessageChannel,W=Be.port2;Be.port1.onmessage=ue,le=function(){W.postMessage(null)}}else le=function(){A(ue,0)};function ie(D,$){H=A(function(){D(l.unstable_now())},$)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(D){D.callback=null},l.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<D?Math.floor(1e3/D):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(D){switch(x){case 1:case 2:case 3:var $=3;break;default:$=x}var te=x;x=$;try{return D()}finally{x=te}},l.unstable_requestPaint=function(){Y=!0},l.unstable_runWithPriority=function(D,$){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var te=x;x=D;try{return $()}finally{x=te}},l.unstable_scheduleCallback=function(D,$,te){var ge=l.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?ge+te:ge):te=ge,D){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=te+be,D={id:C++,callback:$,priorityLevel:D,startTime:te,expirationTime:be,sortIndex:-1},te>ge?(D.sortIndex=te,s(N,D),r(y)===null&&D===r(N)&&(B?(V(H),H=-1):B=!0,ie(k,te-ge))):(D.sortIndex=be,s(y,D),T||R||(T=!0,w||(w=!0,le()))),D},l.unstable_shouldYield=pe,l.unstable_wrapCallback=function(D){var $=x;return function(){var te=x;x=$;try{return D.apply(this,arguments)}finally{x=te}}}})(ic)),ic}var Gh;function rb(){return Gh||(Gh=1,sc.exports=ob()),sc.exports}var Kh;function ub(){if(Kh)return $s;Kh=1;var l=rb(),s=Yp(),r=Lv();function u(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 f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(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 h(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 y(e){if(m(e)!==e)throw Error(u(188))}function N(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,a=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(a=i.return,a!==null){n=a;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return y(i),e;if(o===a)return y(i),t;o=o.sibling}throw Error(u(188))}if(n.return!==a.return)n=i,a=o;else{for(var d=!1,g=i.child;g;){if(g===n){d=!0,n=i,a=o;break}if(g===a){d=!0,a=i,n=o;break}g=g.sibling}if(!d){for(g=o.child;g;){if(g===n){d=!0,n=o,a=i;break}if(g===a){d=!0,a=o,n=i;break}g=g.sibling}if(!d)throw Error(u(189))}}if(n.alternate!==a)throw Error(u(190))}if(n.tag!==3)throw Error(u(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,x=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),G=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var Be=Symbol.for("react.client.reference");function W(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 B:return"Fragment";case A:return"Profiler";case Y:return"StrictMode";case k:return"Suspense";case w:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case G:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case K:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return t=e.displayName||null,t!==null?t:W(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return W(e(t))}catch{}}return null}var ie=Array.isArray,D=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ge=[],be=-1;function De(e){return{current:e}}function de(e){0>be||(e.current=ge[be],ge[be]=null,be--)}function Q(e,t){be++,ge[be]=e.current,e.current=t}var F=De(null),se=De(null),I=De(null),ae=De(null);function xe(e,t){switch(Q(I,t),Q(se,e),Q(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lh(t),e=sh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}de(F),Q(F,e)}function Oe(){de(F),de(se),de(I)}function Ye(e){e.memoizedState!==null&&Q(ae,e);var t=F.current,n=sh(t,e.type);t!==n&&(Q(se,e),Q(F,n))}function ht(e){se.current===e&&(de(F),de(se)),ae.current===e&&(de(ae),Xs._currentValue=te)}var pt,Ke;function Pe(e){if(pt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);pt=t&&t[1]||"",Ke=-1<n.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+pt+e+Ke}var Ot=!1;function Yt(e,t){if(!e||Ot)return"";Ot=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var L=function(){throw Error()};if(Object.defineProperty(L.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(L,[])}catch(_){var O=_}Reflect.construct(e,[],L)}else{try{L.call()}catch(_){O=_}e.call(L.prototype)}}else{try{throw Error()}catch(_){O=_}(L=e())&&typeof L.catch=="function"&&L.catch(function(){})}}catch(_){if(_&&O&&typeof _.stack=="string")return[_.stack,O.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=a.DetermineComponentFrameRoot(),d=o[0],g=o[1];if(d&&g){var b=d.split(`
@@ -11,7 +11,7 @@ Error generating stack: `+a.message+`
11
11
  `);for(const u of r){const[f,...m]=u.split(":"),h=m.join(":").trim();switch(f?.trim()?.toLowerCase()){case"version":s.version=h;break;case"url":s.url=h;break;case"method":s.method=h;break;case"timestamp":s.timestamp=h;break}}}function RS(l){const s={},r=l.split(`
12
12
  `);for(const u of r){const f=u.indexOf(":");if(f>0){const m=u.slice(0,f).trim(),h=u.slice(f+1).trim();m&&(s[m]=h)}}return s}function US(l,s){const r=l.split(`
13
13
  `);let u=!1;const f=[];for(const m of r){if(m.startsWith("Status:")){const p=m.replace("Status:","").trim().split(/\s+/);s.statusCode=parseInt(p[0],10)||0,s.statusText=p.slice(1).join(" ")||HS(s.statusCode);continue}if(m.trim()===""&&!u){u=!0;continue}if(u)f.push(m);else{const h=m.indexOf(":");if(h>0){const p=m.slice(0,h).trim(),y=m.slice(h+1).trim();p&&(s.responseHeaders[p]=y)}}}s.responseBody=f.join(`
14
- `).trim()}function BS(l){const s=l.url.match(/\/api\/provider\/([^/]+)/);s&&(l.provider=s[1]);const r=l.url.match(/\/api\/provider\/[^/]+\/api\/(.+)/);r&&(l.endpoint=r[1]),l.isClientError=l.statusCode>=400&&l.statusCode<500,l.isServerError=l.statusCode>=500,l.statusCode===429?l.errorType="rate_limit":l.statusCode===401||l.statusCode===403?l.errorType="auth":l.statusCode===404?l.errorType="not_found":l.statusCode>=500?l.errorType="server":(l.statusCode===408||l.statusCode===504)&&(l.errorType="timeout")}function HS(l){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"}[l]||""}function qS(l){const s=Date.now(),r=l*1e3,u=s-r,f=Math.floor(u/1e3),m=Math.floor(f/60),h=Math.floor(m/60),p=Math.floor(h/24);return f<60?"just now":m<60?`${m}m ago`:h<24?`${h}h ago`:p<7?`${p}d ago`:new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function YS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function LS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function GS(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function KS({name:l,size:s,modified:r,isSelected:u,onClick:f}){const m=S.useMemo(()=>AS(l),[l]);return c.jsxs("button",{onClick:f,className:X("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",u?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[c.jsx(kc,{provider:m.provider,size:24,withBackground:!0,className:"shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:m.provider}),c.jsx("span",{className:X("text-[9px] px-1 rounded border",u?"bg-amber-500/10 text-amber-600 border-amber-500/20":"bg-muted border-border text-muted-foreground"),children:"LOG"})]}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate font-medium",title:m.endpoint,children:m.endpoint})]}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/80 mt-1",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Qx,{className:"w-3 h-3"}),qS(r)]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Vp,{className:"w-3 h-3"}),YS(s)]})]})]})]})}function ip({value:l,className:s,variant:r="outline",size:u="icon",label:f="Copy to clipboard"}){const[m,h]=S.useState(!1),p=()=>{navigator.clipboard.writeText(l),h(!0),setTimeout(()=>h(!1),2e3)};return c.jsx(_c,{children:c.jsxs(qo,{children:[c.jsx(Yo,{asChild:!0,children:c.jsxs(hn,{size:u,variant:r,className:X("relative z-10 text-muted-foreground hover:text-foreground",s),onClick:y=>{y.stopPropagation(),p()},children:[m?c.jsx(wc,{className:"h-3.5 w-3.5 text-green-500"}):c.jsx(Xx,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"sr-only",children:f})]})}),c.jsx(Lo,{children:c.jsx("p",{children:m?"Copied!":f})})]})})}function Fs({active:l,onClick:s,children:r,icon:u}){return c.jsxs("button",{onClick:s,className:X("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",l?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[u&&c.jsx(u,{className:"w-3.5 h-3.5"}),r]})}function Eg({code:l}){const s=LS(l);return c.jsx("span",{className:X("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",s),children:l})}function QS({parsed:l}){return c.jsxs("div",{className:"p-4 space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Eg,{code:l.statusCode}),c.jsx("span",{className:"text-sm font-medium",children:l.statusText}),c.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:GS(l.errorType)})]}),c.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),c.jsx("div",{className:"font-medium",children:l.method||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),c.jsx("div",{className:"font-medium",children:l.provider||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),c.jsx("div",{className:"font-medium",children:l.version||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),c.jsx("div",{className:"font-medium truncate",title:l.endpoint,children:l.endpoint||"N/A"})]})]}),c.jsxs("div",{className:"text-xs",children:[c.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),c.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:l.url||"N/A"})]}),c.jsxs("div",{className:"text-xs",children:[c.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),c.jsx("div",{className:"font-mono",children:l.timestamp||"N/A"})]}),l.errorType!=="unknown"&&c.jsxs("div",{className:"flex items-start gap-3 p-3 rounded bg-blue-500/10 border border-blue-500/20 text-xs",children:[c.jsx(Uo,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),c.jsxs("div",{className:"text-blue-500/90 leading-relaxed",children:[l.errorType==="rate_limit"&&"Rate limited. Consider using multiple accounts or reducing request frequency.",l.errorType==="auth"&&"Authentication failed. Check credentials or re-authenticate with the provider.",l.errorType==="not_found"&&"Endpoint not found. This endpoint may not exist on this provider.",l.errorType==="server"&&"Server error from upstream. Retry or check provider status.",l.errorType==="timeout"&&"Request timed out. Check network or increase timeout settings."]})]})]})}function XS({headers:l}){const s=Object.entries(l);return s.length===0?c.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):c.jsx(Pl,{className:"h-full",children:c.jsx("div",{className:"p-4 space-y-1",children:s.map(([r,u])=>c.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[c.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),c.jsx("span",{className:"break-all",children:u})]},r))})})}function op({content:l,label:s}){if(!l||l.trim()==="")return c.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",s.toLowerCase()," body"]});let r=l,u=!1;try{const f=JSON.parse(l);r=JSON.stringify(f,null,2),u=!0}catch{}return c.jsx(Pl,{className:"h-full",children:c.jsx("pre",{className:X("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",u?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function VS({content:l}){return c.jsx(Pl,{className:"h-full",children:c.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:l})})}function ZS({name:l,absolutePath:s}){const[r,u]=S.useState("overview"),{data:f,isLoading:m,error:h}=D1(l),p=S.useMemo(()=>f?_S(f):null,[f]);return l?m?c.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[c.jsx(nt,{className:"h-5 w-full"}),c.jsx(nt,{className:"h-5 w-3/4"}),c.jsx(nt,{className:"h-5 w-5/6"}),c.jsx(nt,{className:"h-5 w-2/3"})]}):h||!f||!p?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:c.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):c.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[c.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[c.jsx(Eg,{code:p.statusCode}),c.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),l&&c.jsx(ip,{value:s||l,label:"Copy absolute path",size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f&&c.jsx(ip,{value:f,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),c.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})]})]}),c.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:[c.jsx(Fs,{active:r==="overview",onClick:()=>u("overview"),icon:Uo,children:"Overview"}),c.jsx(Fs,{active:r==="headers",onClick:()=>u("headers"),icon:Zx,children:"Headers"}),c.jsx(Fs,{active:r==="request",onClick:()=>u("request"),icon:Wx,children:"Request"}),c.jsx(Fs,{active:r==="response",onClick:()=>u("response"),icon:Jx,children:"Response"}),c.jsx(Fs,{active:r==="raw",onClick:()=>u("raw"),icon:Vp,children:"Raw"})]}),c.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&c.jsx(QS,{parsed:p}),r==="headers"&&c.jsx(XS,{headers:p.requestHeaders}),r==="request"&&c.jsx(op,{content:p.requestBody,label:"Request"}),r==="response"&&c.jsx(op,{content:p.responseBody,label:"Response"}),r==="raw"&&c.jsx(VS,{content:f})]})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:c.jsxs("div",{className:"text-center space-y-3",children:[c.jsx(Vx,{className:"w-10 h-10 mx-auto opacity-40"}),c.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function WS(){const{data:l,isLoading:s}=M1(),{data:r,isLoading:u,error:f}=z1(l?.running??!1),[m,h]=S.useState(500),[p,y]=S.useState(!1),N=S.useRef(null),C=S.useRef(null),v=()=>{C.current&&(clearInterval(C.current),C.current=null)};S.useEffect(()=>{if(!p)return;const G=k=>{const w=N.current;if(!w)return;const J=w.getBoundingClientRect().top+window.scrollY,P=k.pageY-J;h(Math.max(300,P));const ue=window.innerHeight-k.clientY,le=15;v(),ue<50?C.current=setInterval(()=>{window.scrollBy(0,le)},16):k.clientY<50&&(C.current=setInterval(()=>{window.scrollBy(0,-le)},16))},K=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",K),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",K),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const x=G=>{G.preventDefault(),y(!0)},R=S.useMemo(()=>r?.[0]?.name??null,[r]),[T,B]=S.useState(null),Y=T??R,A=S.useMemo(()=>!Y||!r?void 0:r.find(K=>K.name===Y)?.absolutePath,[Y,r]);if(s||!l?.running)return null;if(u)return c.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:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[c.jsx(nt,{className:"h-4 w-32"}),c.jsx(nt,{className:"h-4 w-20"})]}),c.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(G=>c.jsx(nt,{className:"h-12 w-full rounded-lg"},G))})]});if(!r||r.length===0)return null;const V=r.length;return c.jsxs("div",{ref:N,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:m},children:[c.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:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(Oc,{className:"w-4 h-4 text-amber-500"}),c.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[V," failed request",V!==1?"s":""]})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx($x,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsxs(Mg,{direction:"horizontal",children:[c.jsx(vc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:c.jsxs(Pl,{className:"h-full",children:[c.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(G=>c.jsx(KS,{name:G.name,size:G.size,modified:G.modified,isSelected:Y===G.name,onClick:()=>B(G.name)},G.name))}),r.length>50&&c.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"]})]})}),c.jsxs(Cg,{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:[c.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),c.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:c.jsx(Dc,{className:"h-4 w-4 text-muted-foreground"})})]}),c.jsx(vc,{className:"flex flex-col min-w-0 bg-background/50",children:c.jsx(ZS,{name:Y,absolutePath:A})})]})}),f?c.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:f.message}):c.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:x,children:c.jsx(Fx,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const JS=_o("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"}}),zg=S.forwardRef(({className:l,variant:s,...r},u)=>c.jsx("div",{ref:u,role:"alert",className:X(JS({variant:s}),l),...r}));zg.displayName="Alert";const Dg=S.forwardRef(({className:l,...s},r)=>c.jsx("h5",{ref:r,className:X("mb-1 font-medium leading-none tracking-tight",l),...s}));Dg.displayName="AlertTitle";const Og=S.forwardRef(({className:l,...s},r)=>c.jsx("div",{ref:r,className:X("text-sm [&_p]:leading-relaxed",l),...s}));Og.displayName="AlertDescription";function $S(){return Dt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function FS(){return Dt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function Qj(l){return Dt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const IS={ok:"success",warning:"warning",error:"error"},PS={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 Mo({title:l,value:s,icon:r,variant:u="default",onClick:f}){const m=PS[u];return c.jsxs("button",{onClick:f,className:X("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:[c.jsx("div",{className:X("flex items-center justify-center w-9 h-9 rounded-md",m.iconBg),children:c.jsx(r,{className:X("w-4 h-4",m.iconColor)})}),c.jsxs("div",{className:"text-left",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:l}),c.jsx("p",{className:X("text-lg font-bold font-mono leading-tight",m.iconColor),children:s})]})]})}function eN(){const l=Xv(),{data:s,isLoading:r}=$S(),{data:u,isLoading:f}=FS();if(r||f)return c.jsxs("div",{className:"p-6 space-y-6",children:[c.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(nt,{className:"h-12 w-12 rounded-lg"}),c.jsxs("div",{children:[c.jsx(nt,{className:"h-7 w-[180px] mb-2"}),c.jsx(nt,{className:"h-4 w-[220px]"})]})]}),c.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(h=>c.jsx(nt,{className:"h-14 w-28 rounded-lg"},h))})]}),c.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[c.jsx(nt,{className:"h-4 w-32"}),c.jsx(nt,{className:"h-4 w-20"})]}),c.jsx("div",{className:"px-4 py-3 border-b",children:c.jsx(nt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(h=>c.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[c.jsx(nt,{className:"w-2.5 h-2.5 rounded-full"}),c.jsx(nt,{className:"h-4 flex-1"}),c.jsx(nt,{className:"h-1.5 w-24 rounded-full"}),c.jsx(nt,{className:"h-4 w-16"})]},h))]})]});const m=s?.health?IS[s.health.status]:void 0;return c.jsxs("div",{className:"p-6 space-y-6",children:[c.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[c.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:c.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),c.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[c.jsx(b1,{version:s?.version}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(Mo,{title:"Profiles",value:s?.profiles??0,icon:Lp,variant:"accent",onClick:()=>l("/providers")}),c.jsx(Mo,{title:"CLIProxy",value:s?.cliproxy??0,icon:Gp,variant:"accent",onClick:()=>l("/cliproxy")}),c.jsx(Mo,{title:"Accounts",value:s?.accounts??0,icon:Xp,variant:"default",onClick:()=>l("/accounts")}),c.jsx(Mo,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:ai,variant:m,onClick:()=>l("/health")})]})]})]}),u?.symlinkStatus&&!u.symlinkStatus.valid&&c.jsxs(zg,{variant:"warning",children:[c.jsx(Oc,{className:"h-4 w-4"}),c.jsx(Dg,{children:"Configuration Required"}),c.jsx(Og,{children:u.symlinkStatus.message})]}),c.jsx(aS,{}),c.jsx(WS,{})]})}const tN=Ev,Tg=S.forwardRef(({className:l,...s},r)=>c.jsx(Dp,{ref:r,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));Tg.displayName=Dp.displayName;const bc=S.forwardRef(({className:l,...s},r)=>c.jsx(Op,{ref:r,className:X("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",l),...s}));bc.displayName=Op.displayName;const Sc=S.forwardRef(({className:l,...s},r)=>c.jsx(Tp,{ref:r,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));Sc.displayName=Tp.displayName;function An({className:l,...s}){return c.jsx(zv,{"data-slot":"label",className:X("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",l),...s})}const Hc="ccs:openrouter-models",nN=1440*60*1e3,Ag="1";function Nc(l){const s=parseFloat(l);return isNaN(s)||s===0?0:s*1e6}function rp(l){const s=Nc(l);return s===0?"Free":s<.01?"<$0.01":s<1?`$${s.toFixed(2)}`:`$${s.toFixed(s<10?2:0)}`}function aN(l){const s=rp(l.prompt),r=rp(l.completion);return s==="Free"&&r==="Free"?"Free":`${s}/${r}`}function lN(l){const s=l.id.toLowerCase();return s.startsWith("anthropic/")?"anthropic":s.startsWith("openai/")?"openai":s.startsWith("google/")?"google":s.startsWith("meta-llama/")||s.startsWith("meta/")?"meta":s.startsWith("mistralai/")?"mistral":s.includes(":free")||s.includes("qwen")||s.includes("deepseek")?"opensource":"other"}function sN(l){return{...l,category:lN(l),pricePerMillionPrompt:Nc(l.pricing.prompt),pricePerMillionCompletion:Nc(l.pricing.completion),isFree:l.pricing.prompt==="0"&&l.pricing.completion==="0",isExacto:l.id.includes(":exacto")}}function iN(l,s,r){const u=s.toLowerCase().trim();return l.filter(f=>r?.category&&f.category!==r.category||r?.freeOnly&&!f.isFree||r?.minContext&&f.context_length<r.minContext?!1:u?f.id.toLowerCase().includes(u)||f.name.toLowerCase().includes(u)||f.description?.toLowerCase().includes(u):!0)}function Xj(l){return[...l].sort((s,r)=>{if(s.isFree&&!r.isFree)return-1;if(!s.isFree&&r.isFree)return 1;if(!s.isFree&&!r.isFree){if(s.isExacto&&!r.isExacto)return-1;if(!s.isExacto&&r.isExacto)return 1}return s.name.localeCompare(r.name)})}function oN(){try{const l=localStorage.getItem(Hc);if(!l)return null;const s=JSON.parse(l);return s.version!==Ag||Date.now()-s.fetchedAt>nN?null:s.models}catch{return null}}function rN(l){try{localStorage.setItem(Hc,JSON.stringify({models:l,fetchedAt:Date.now(),version:Ag}))}catch{}}function uN(){localStorage.removeItem(Hc)}function Vj(l,s){const[r]=l.split("/");if(!r)return{};const u=s.filter(h=>h.id.startsWith(`${r}/`));if(u.length===0)return{};const f=[...u].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),m=Math.ceil(f.length/3);return{opus:f[0]?.id,sonnet:f[Math.min(m,f.length-1)]?.id,haiku:f[f.length-1]?.id}}function cN(l){return l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${Math.round(l/1e3)}K`:String(l)}const Zj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},fN={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function dN(l,s=2){const r=[],u=["anthropic","openai","google","meta","mistral","opensource"];for(const f of u){const m=fN[f];if(m.length===0)continue;const p=[...l.filter(y=>m.some(N=>y.id.toLowerCase().startsWith(N)))].sort((y,N)=>(N.created??0)-(y.created??0));r.push(...p.slice(0,s))}return r.sort((f,m)=>(m.created??0)-(f.created??0))}function mN(l){const r=Date.now()/1e3-l;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 hN="https://openrouter.ai/api/v1/models",_g=["openrouter-models"],up=1440*60*1e3;async function pN(){const l=await fetch(hN);if(!l.ok)throw new Error(`Failed to fetch OpenRouter models: ${l.status}`);const r=(await l.json()).data;return rN(r),r}function kg(){return Dt({queryKey:_g,queryFn:pN,staleTime:up,gcTime:up,initialData:()=>oN()??void 0,refetchOnWindowFocus:!1})}function gN(){const l=kg(),s=(l.data??[]).map(sN);return{...l,models:s}}function Wj(){const l=tn();return()=>(uN(),l.invalidateQueries({queryKey:_g}))}function Jj(){const{data:l,isLoading:s,isError:r}=kg();return{isReady:!!l&&l.length>0,isLoading:s,isError:r,modelCount:l?.length??0}}function Rg({profileEnv:l={}}){const[s,r]=S.useState(null),[u,f]=S.useState(!0),[m,h]=S.useState(!1);S.useEffect(()=>{p()},[]);const p=async()=>{try{f(!0);const x=await fetch("/api/global-env");if(!x.ok)throw new Error("Failed to load");const R=await x.json();r(R)}catch{r(null)}finally{f(!1)}};if(u||!s?.enabled)return null;const y=s.env||{},N=Object.keys(y);if(N.length===0)return null;const C=N.filter(x=>!(x in l)),v=N.filter(x=>x in l);return c.jsxs("div",{className:"border-t bg-muted/20",children:[c.jsxs("button",{onClick:()=>h(!m),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[c.jsx(Uo,{className:"w-4 h-4 text-blue-500"}),c.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[c.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&&c.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),m?c.jsx(Tc,{className:"w-4 h-4 text-muted-foreground"}):c.jsx(Bo,{className:"w-4 h-4 text-muted-foreground"})]}),m&&c.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&c.jsx("div",{className:"space-y-1",children:C.map(x=>c.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:[c.jsx("span",{className:"text-green-500",children:"+"}),c.jsxs("span",{className:"truncate",children:[x,"=",y[x]]})]},x))}),v.length>0&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(x=>c.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:[c.jsx("span",{className:"text-amber-500",children:"~"}),c.jsx("span",{className:"truncate",children:x})]},x))]}),c.jsx("div",{className:"pt-2 border-t border-border/50",children:c.jsx(hn,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:c.jsxs(yc,{to:"/settings?tab=globalenv",children:[c.jsx(Zp,{className:"w-3.5 h-3.5"}),"Configure in Settings",c.jsx(Ix,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const yN=S.lazy(()=>Mn(()=>import("./code-editor-Bm8H1Oot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function $j({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:r,settings:u,onChange:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(Ro,{className:"w-6 h-6 animate-spin text-muted-foreground"}),c.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:c.jsxs("div",{className:"h-full flex flex-col",children:[!s&&r!==null&&c.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:[c.jsx(ii,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),c.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:c.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:c.jsx(yN,{value:l,onChange:f,language:"json",minHeight:"100%"})})}),c.jsx("div",{className:"mx-6 mb-4",children:c.jsx("div",{className:"border rounded-md overflow-hidden",children:c.jsx(Rg,{profileEnv:u?.env})})})]})})}function cp(l,s){try{var r=l()}catch(u){return s(u)}return r&&r.then?r.then(void 0,s):r}function vN(l,s){for(var r={};l.length;){var u=l[0],f=u.code,m=u.message,h=u.path.join(".");if(!r[h])if("unionErrors"in u){var p=u.unionErrors[0].errors[0];r[h]={message:p.message,type:p.code}}else r[h]={message:m,type:f};if("unionErrors"in u&&u.unionErrors.forEach(function(C){return C.errors.forEach(function(v){return l.push(v)})}),s){var y=r[h].types,N=y&&y[u.code];r[h]=Wp(h,s,r,f,N?[].concat(N,u.message):u.message)}l.shift()}return r}function xN(l,s){for(var r={};l.length;){var u=l[0],f=u.code,m=u.message,h=u.path.join(".");if(!r[h])if(u.code==="invalid_union"&&u.errors.length>0){var p=u.errors[0][0];r[h]={message:p.message,type:p.code}}else r[h]={message:m,type:f};if(u.code==="invalid_union"&&u.errors.forEach(function(C){return C.forEach(function(v){return l.push(v)})}),s){var y=r[h].types,N=y&&y[u.code];r[h]=Wp(h,s,r,f,N?[].concat(N,u.message):u.message)}l.shift()}return r}function bN(l,s,r){if(r===void 0&&(r={}),(function(u){return"_def"in u&&typeof u._def=="object"&&"typeName"in u._def})(l))return function(u,f,m){try{return Promise.resolve(cp(function(){return Promise.resolve(l[r.mode==="sync"?"parse":"parseAsync"](u,s)).then(function(h){return m.shouldUseNativeValidation&&qh({},m),{errors:{},values:r.raw?Object.assign({},u):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Yh(vN(h.errors,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};if((function(u){return"_zod"in u&&typeof u._zod=="object"})(l))return function(u,f,m){try{return Promise.resolve(cp(function(){return Promise.resolve((r.mode==="sync"?tb:nb)(l,u,s)).then(function(h){return m.shouldUseNativeValidation&&qh({},m),{errors:{},values:r.raw?Object.assign({},u):h}})},function(h){if((function(p){return p instanceof ab})(h))return{values:{},errors:Yh(xN(h.issues,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}function Fj(){return Dt({queryKey:["profiles"],queryFn:()=>bt.profiles.list()})}function SN(){const l=tn();return jn({mutationFn:s=>bt.profiles.create(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ge.success("Profile created successfully")},onError:s=>{Ge.error(s.message)}})}function Ij(){const l=tn();return jn({mutationFn:s=>bt.profiles.delete(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ge.success("Profile deleted successfully")},onError:s=>{Ge.error(s.message)}})}const NN="https://openrouter.ai/api",zo=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:NN,defaultProfileName:"openrouter",badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg",defaultModel:"anthropic/claude-sonnet-4",requiresApiKey:!0,apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended"},{id:"glm",name:"GLM",description:"Claude via Z.AI (GitHub Copilot)",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",badge:"Z.AI",defaultModel:"glm-4.6",requiresApiKey:!0,apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative"},{id:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",badge:"Thinking",defaultModel:"glm-4.6",requiresApiKey:!0,apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative"},{id:"kimi",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"kimi",badge:"Reasoning",defaultModel:"kimi-k2-thinking-turbo",requiresApiKey:!0,apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative"}];function Co(l){return zo.filter(s=>s.category===l)}const jN=lb({name:ll().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:ll().url("Invalid URL format"),apiKey:ll().min(1,"API key is required"),model:ll().optional(),opusModel:ll().optional(),sonnetModel:ll().optional(),haikuModel:ll().optional()}),MN=["/chat/completions","/v1/messages","/messages","/completions"];function Pj({open:l,onOpenChange:s,onSuccess:r}){const u=SN(),[f,m]=S.useState("basic"),[h,p]=S.useState(null),[y,N]=S.useState(!1),[C,v]=S.useState("openrouter"),[x,R]=S.useState(""),{models:T}=gN(),{register:B,handleSubmit:Y,formState:{errors:A},control:V,reset:G,setValue:K}=sb({resolver:bN(jN),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),k=ib({control:V,name:"baseUrl"}),w=S.useMemo(()=>!C||C==="custom"?null:zo.find(W=>W.id===C),[C]),H=S.useMemo(()=>x.trim()?[...iN(T,x)].sort((ie,D)=>(D.created??0)-(ie.created??0)).slice(0,20):dN(T,2),[T,x]);S.useEffect(()=>{if(l){G(),m("basic"),p(null),N(!1),v("openrouter"),R("");const W=zo.find(ie=>ie.id==="openrouter");W&&setTimeout(()=>{K("name",W.defaultProfileName),K("baseUrl",W.baseUrl)},0)}},[l,G,K]);const J=W=>{v(W);const ie=zo.find(D=>D.id===W);ie?(K("name",ie.defaultProfileName),K("baseUrl",ie.baseUrl),ie.defaultModel&&(K("model",ie.defaultModel),K("opusModel",ie.defaultModel),K("sonnetModel",ie.defaultModel),K("haikuModel",ie.defaultModel))):(K("name",""),K("baseUrl",""),K("model",""))},P=W=>{K("model",W.id),K("opusModel",W.id),K("sonnetModel",W.id),K("haikuModel",W.id),R(W.name),Ge.success(`Applied "${W.name}" to all model tiers`,{duration:2e3})};S.useEffect(()=>{if(k&&C==="custom"){const ie=k.toLowerCase();for(const D of MN)if(ie.endsWith(D)){const $=k.replace(new RegExp(D+"$","i"),"");p(`URL ends with "${D}" - Claude appends this automatically. You likely want: ${$}`);return}}p(null)},[k,C]);const pe=async W=>{const ie={...W};try{await u.mutateAsync(ie),Ge.success(`Profile "${ie.name}" created`),r(ie.name),s(!1)}catch(D){Ge.error(D.message||"Failed to create profile")}},ue=!!A.name||!!A.baseUrl||!!A.apiKey,le=!!A.model||!!A.opusModel||!!A.sonnetModel||!!A.haikuModel,Be=C==="openrouter";return c.jsx(eg,{open:l,onOpenChange:s,children:c.jsxs(tg,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh]",children:[c.jsxs(ng,{className:"p-6 pb-4 border-b",children:[c.jsxs(ag,{className:"flex items-center gap-2",children:[c.jsx(Hh,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),c.jsx(lg,{children:"Choose a provider or configure a custom API endpoint."})]}),c.jsxs("form",{onSubmit:Y(pe),className:"flex flex-col overflow-hidden",children:[c.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[c.jsxs("div",{children:[c.jsx(An,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Provider"}),c.jsxs("div",{className:"flex gap-2",children:[Co("recommended").map(W=>c.jsx(fp,{preset:W,isSelected:C===W.id,onClick:()=>J(W.id)},W.id)),c.jsxs("button",{type:"button",onClick:()=>J("custom"),className:X("flex items-center gap-1.5 px-3 py-1.5 rounded-md border transition-all text-sm",C==="custom"||Co("alternative").some(W=>W.id===C)?"border-primary bg-primary/5 font-medium":"border-muted hover:border-muted-foreground/30"),children:[c.jsx(Zp,{className:"w-3.5 h-3.5 text-muted-foreground"}),c.jsx("span",{children:"Custom"})]})]})]}),(C==="custom"||Co("alternative").some(W=>W.id===C))&&c.jsxs("div",{className:"pt-2 border-t border-dashed",children:[c.jsx(An,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Quick Templates"}),c.jsx("div",{className:"flex gap-2 flex-wrap",children:Co("alternative").map(W=>c.jsx(fp,{preset:W,isSelected:C===W.id,onClick:()=>J(W.id)},W.id))})]})]}),c.jsxs(tN,{value:f,onValueChange:m,className:"flex flex-col flex-1 overflow-hidden",children:[c.jsx("div",{className:"px-6 pt-4",children:c.jsxs(Tg,{className:"grid w-full grid-cols-2",children:[c.jsxs(bc,{value:"basic",className:"relative",children:["Basic Information",ue&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),c.jsxs(bc,{value:"models",className:"relative",children:["Model Configuration",le&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),c.jsxs(Pl,{className:"flex-1",children:[c.jsxs(Sc,{value:"basic",className:"p-6 space-y-4 mt-0",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"name",children:["Profile Name ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(Ra,{id:"name",...B("name"),placeholder:"my-api",className:"font-mono"}),A.name?c.jsx("p",{className:"text-xs text-destructive",children:A.name.message}):c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",c.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"baseUrl",children:["API Base URL ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(Ra,{id:"baseUrl",...B("baseUrl"),placeholder:"https://api.example.com/v1"}),A.baseUrl?c.jsx("p",{className:"text-xs text-destructive",children:A.baseUrl.message}):h?c.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:[c.jsx(Oc,{className:"w-4 h-4 shrink-0 mt-0.5"}),c.jsx("span",{children:h})]}):w?c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pre-filled from ",w.name,". You can customize if needed."]}):c.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"apiKey",children:["API Key ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Ra,{id:"apiKey",type:y?"text":"password",...B("apiKey"),placeholder:w?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),c.jsx(hn,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>N(!y),tabIndex:-1,children:y?c.jsx(Mc,{className:"h-4 w-4"}):c.jsx(Cc,{className:"h-4 w-4"})})]}),A.apiKey?c.jsx("p",{className:"text-xs text-destructive",children:A.apiKey.message}):w?.apiKeyHint&&c.jsx("p",{className:"text-xs text-muted-foreground",children:w.apiKeyHint})]})]}),c.jsxs(Sc,{value:"models",className:"p-6 mt-0 space-y-4",children:[c.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:[c.jsx(Uo,{className:"w-5 h-5 shrink-0 mt-0.5"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),c.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),Be&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(An,{children:"Search Models"}),c.jsx(Ra,{value:x,onChange:W=>R(W.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:W=>{W.key==="Enter"&&H.length>0&&(W.preventDefault(),P(H[0]))}}),c.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:H.length===0?c.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:x?`No models found for "${x}"`:"Loading models..."}):c.jsxs("div",{className:"p-1",children:[!x&&c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[c.jsx(Px,{className:"w-3 h-3 text-accent"}),c.jsx("span",{children:"Newest Models"})]}),H.map(W=>c.jsx(CN,{model:W,onClick:()=>P(W),showAge:!x},W.id))]})})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"model",children:["Default Model",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),c.jsx(Ra,{id:"model",...B("model"),placeholder:w?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),c.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),c.jsx(Ra,{id:"sonnetModel",...B("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),c.jsx(Ra,{id:"opusModel",...B("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),c.jsx(Ra,{id:"haikuModel",...B("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),c.jsxs(h1,{className:"p-6 pt-4 border-t bg-muted/10",children:[c.jsx(hn,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsx(hn,{type:"submit",disabled:u.isPending,className:X(u.isPending&&"opacity-80"),children:u.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Ro,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Hh,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function fp({preset:l,isSelected:s,onClick:r}){return c.jsxs("button",{type:"button",onClick:r,className:X("flex items-center gap-1.5 px-3 py-1.5 rounded-md border transition-all text-sm",s?l.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/5 font-medium":"border-muted hover:border-muted-foreground/30"),children:[l.icon?c.jsx("img",{src:l.icon,alt:"",className:"w-3.5 h-3.5"}):c.jsx("div",{className:"w-3.5 h-3.5 rounded-full bg-muted flex items-center justify-center text-[8px] font-bold",children:l.name.charAt(0)}),c.jsx("span",{children:l.name}),l.badge&&c.jsx(Ha,{variant:"secondary",className:"text-[9px] px-1 py-0 ml-0.5",children:l.badge})]})}function CN({model:l,onClick:s,showAge:r}){return c.jsxs("button",{type:"button",onClick:s,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:[c.jsx("span",{className:"flex-1 truncate",children:l.name}),c.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[r&&l.created&&c.jsx(Ha,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:mN(l.created)}),l.isFree?c.jsx(Ha,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):c.jsx("span",{children:aN(l.pricing)}),c.jsx("span",{children:cN(l.context_length)})]})]})}const eM=kv,tM=Uv,nM=Rv,wN=S.forwardRef(({className:l,children:s,...r},u)=>c.jsxs(Ap,{ref:u,className:X("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",l),...r,children:[s,c.jsx(Dv,{asChild:!0,children:c.jsx(Bo,{className:"h-4 w-4 opacity-50"})})]}));wN.displayName=Ap.displayName;const Ug=S.forwardRef(({className:l,...s},r)=>c.jsx(_p,{ref:r,className:X("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Tc,{className:"h-4 w-4"})}));Ug.displayName=_p.displayName;const Bg=S.forwardRef(({className:l,...s},r)=>c.jsx(kp,{ref:r,className:X("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Bo,{className:"h-4 w-4"})}));Bg.displayName=kp.displayName;const EN=S.forwardRef(({className:l,children:s,position:r="popper",...u},f)=>c.jsx(Ov,{children:c.jsxs(Rp,{ref:f,className:X("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",l),position:r,...u,children:[c.jsx(Ug,{}),c.jsx(Tv,{className:X("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),c.jsx(Bg,{})]})}));EN.displayName=Rp.displayName;const zN=S.forwardRef(({className:l,...s},r)=>c.jsx(Up,{ref:r,className:X("px-2 py-1.5 text-sm font-semibold",l),...s}));zN.displayName=Up.displayName;const DN=S.forwardRef(({className:l,children:s,...r},u)=>c.jsxs(Bp,{ref:u,className:X("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",l),...r,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Av,{children:c.jsx(wc,{className:"h-4 w-4"})})}),c.jsx(_v,{children:s})]}));DN.displayName=Bp.displayName;const ON=S.forwardRef(({className:l,...s},r)=>c.jsx(Hp,{ref:r,className:X("-mx-1 my-1 h-px bg-muted",l),...s}));ON.displayName=Hp.displayName;const TN=S.lazy(()=>Mn(()=>import("./code-editor-Bm8H1Oot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function aM({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:r,onRawJsonChange:u,profileEnv:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(Ro,{className:"w-6 h-6 animate-spin text-muted-foreground"}),c.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:c.jsxs("div",{className:"h-full flex flex-col",children:[!s&&r!==null&&c.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:[c.jsx(ii,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),c.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:c.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:c.jsx(TN,{value:l,onChange:u,language:"json",minHeight:"100%"})})}),c.jsx("div",{className:"mx-6 mb-4",children:c.jsx("div",{className:"border rounded-md overflow-hidden",children:c.jsx(Rg,{profileEnv:f})})})]})})}var Ht={},dp;function AN(){if(dp)return Ht;dp=1;var l=Ht&&Ht.__assign||function(){return l=Object.assign||function(k){for(var w,H=1,J=arguments.length;H<J;H++){w=arguments[H];for(var P in w)Object.prototype.hasOwnProperty.call(w,P)&&(k[P]=w[P])}return k},l.apply(this,arguments)},s=Ht&&Ht.__createBinding||(Object.create?(function(k,w,H,J){J===void 0&&(J=H);var P=Object.getOwnPropertyDescriptor(w,H);(!P||("get"in P?!w.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return w[H]}}),Object.defineProperty(k,J,P)}):(function(k,w,H,J){J===void 0&&(J=H),k[J]=w[H]})),r=Ht&&Ht.__setModuleDefault||(Object.create?(function(k,w){Object.defineProperty(k,"default",{enumerable:!0,value:w})}):function(k,w){k.default=w}),u=Ht&&Ht.__importStar||function(k){if(k&&k.__esModule)return k;var w={};if(k!=null)for(var H in k)H!=="default"&&Object.prototype.hasOwnProperty.call(k,H)&&s(w,k,H);return r(w,k),w},f=Ht&&Ht.__rest||function(k,w){var H={};for(var J in k)Object.prototype.hasOwnProperty.call(k,J)&&w.indexOf(J)<0&&(H[J]=k[J]);if(k!=null&&typeof Object.getOwnPropertySymbols=="function")for(var P=0,J=Object.getOwnPropertySymbols(k);P<J.length;P++)w.indexOf(J[P])<0&&Object.prototype.propertyIsEnumerable.call(k,J[P])&&(H[J[P]]=k[J[P]]);return H};Object.defineProperty(Ht,"__esModule",{value:!0});var m=u(Yp()),h=89,p=90,y=77,N=57,C=219,v=222,x=192,R=100,T=3e3,B=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),Y=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),A="npm__react-simple-code-editor__textarea",V=`
14
+ `).trim()}function BS(l){const s=l.url.match(/\/api\/provider\/([^/]+)/);s&&(l.provider=s[1]);const r=l.url.match(/\/api\/provider\/[^/]+\/api\/(.+)/);r&&(l.endpoint=r[1]),l.isClientError=l.statusCode>=400&&l.statusCode<500,l.isServerError=l.statusCode>=500,l.statusCode===429?l.errorType="rate_limit":l.statusCode===401||l.statusCode===403?l.errorType="auth":l.statusCode===404?l.errorType="not_found":l.statusCode>=500?l.errorType="server":(l.statusCode===408||l.statusCode===504)&&(l.errorType="timeout")}function HS(l){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"}[l]||""}function qS(l){const s=Date.now(),r=l*1e3,u=s-r,f=Math.floor(u/1e3),m=Math.floor(f/60),h=Math.floor(m/60),p=Math.floor(h/24);return f<60?"just now":m<60?`${m}m ago`:h<24?`${h}h ago`:p<7?`${p}d ago`:new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function YS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function LS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function GS(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function KS({name:l,size:s,modified:r,isSelected:u,onClick:f}){const m=S.useMemo(()=>AS(l),[l]);return c.jsxs("button",{onClick:f,className:X("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",u?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[c.jsx(kc,{provider:m.provider,size:24,withBackground:!0,className:"shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:m.provider}),c.jsx("span",{className:X("text-[9px] px-1 rounded border",u?"bg-amber-500/10 text-amber-600 border-amber-500/20":"bg-muted border-border text-muted-foreground"),children:"LOG"})]}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate font-medium",title:m.endpoint,children:m.endpoint})]}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/80 mt-1",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Qx,{className:"w-3 h-3"}),qS(r)]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Vp,{className:"w-3 h-3"}),YS(s)]})]})]})]})}function ip({value:l,className:s,variant:r="outline",size:u="icon",label:f="Copy to clipboard"}){const[m,h]=S.useState(!1),p=()=>{navigator.clipboard.writeText(l),h(!0),setTimeout(()=>h(!1),2e3)};return c.jsx(_c,{children:c.jsxs(qo,{children:[c.jsx(Yo,{asChild:!0,children:c.jsxs(hn,{size:u,variant:r,className:X("relative z-10 text-muted-foreground hover:text-foreground",s),onClick:y=>{y.stopPropagation(),p()},children:[m?c.jsx(wc,{className:"h-3.5 w-3.5 text-green-500"}):c.jsx(Xx,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"sr-only",children:f})]})}),c.jsx(Lo,{children:c.jsx("p",{children:m?"Copied!":f})})]})})}function Fs({active:l,onClick:s,children:r,icon:u}){return c.jsxs("button",{onClick:s,className:X("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",l?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[u&&c.jsx(u,{className:"w-3.5 h-3.5"}),r]})}function Eg({code:l}){const s=LS(l);return c.jsx("span",{className:X("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",s),children:l})}function QS({parsed:l}){return c.jsxs("div",{className:"p-4 space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Eg,{code:l.statusCode}),c.jsx("span",{className:"text-sm font-medium",children:l.statusText}),c.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:GS(l.errorType)})]}),c.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),c.jsx("div",{className:"font-medium",children:l.method||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),c.jsx("div",{className:"font-medium",children:l.provider||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),c.jsx("div",{className:"font-medium",children:l.version||"N/A"})]}),c.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),c.jsx("div",{className:"font-medium truncate",title:l.endpoint,children:l.endpoint||"N/A"})]})]}),c.jsxs("div",{className:"text-xs",children:[c.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),c.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:l.url||"N/A"})]}),c.jsxs("div",{className:"text-xs",children:[c.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),c.jsx("div",{className:"font-mono",children:l.timestamp||"N/A"})]}),l.errorType!=="unknown"&&c.jsxs("div",{className:"flex items-start gap-3 p-3 rounded bg-blue-500/10 border border-blue-500/20 text-xs",children:[c.jsx(Uo,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),c.jsxs("div",{className:"text-blue-500/90 leading-relaxed",children:[l.errorType==="rate_limit"&&"Rate limited. Consider using multiple accounts or reducing request frequency.",l.errorType==="auth"&&"Authentication failed. Check credentials or re-authenticate with the provider.",l.errorType==="not_found"&&"Endpoint not found. This endpoint may not exist on this provider.",l.errorType==="server"&&"Server error from upstream. Retry or check provider status.",l.errorType==="timeout"&&"Request timed out. Check network or increase timeout settings."]})]})]})}function XS({headers:l}){const s=Object.entries(l);return s.length===0?c.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):c.jsx(Pl,{className:"h-full",children:c.jsx("div",{className:"p-4 space-y-1",children:s.map(([r,u])=>c.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[c.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),c.jsx("span",{className:"break-all",children:u})]},r))})})}function op({content:l,label:s}){if(!l||l.trim()==="")return c.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",s.toLowerCase()," body"]});let r=l,u=!1;try{const f=JSON.parse(l);r=JSON.stringify(f,null,2),u=!0}catch{}return c.jsx(Pl,{className:"h-full",children:c.jsx("pre",{className:X("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",u?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function VS({content:l}){return c.jsx(Pl,{className:"h-full",children:c.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:l})})}function ZS({name:l,absolutePath:s}){const[r,u]=S.useState("overview"),{data:f,isLoading:m,error:h}=D1(l),p=S.useMemo(()=>f?_S(f):null,[f]);return l?m?c.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[c.jsx(nt,{className:"h-5 w-full"}),c.jsx(nt,{className:"h-5 w-3/4"}),c.jsx(nt,{className:"h-5 w-5/6"}),c.jsx(nt,{className:"h-5 w-2/3"})]}):h||!f||!p?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:c.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):c.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[c.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[c.jsx(Eg,{code:p.statusCode}),c.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),l&&c.jsx(ip,{value:s||l,label:"Copy absolute path",size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f&&c.jsx(ip,{value:f,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),c.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})]})]}),c.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:[c.jsx(Fs,{active:r==="overview",onClick:()=>u("overview"),icon:Uo,children:"Overview"}),c.jsx(Fs,{active:r==="headers",onClick:()=>u("headers"),icon:Zx,children:"Headers"}),c.jsx(Fs,{active:r==="request",onClick:()=>u("request"),icon:Wx,children:"Request"}),c.jsx(Fs,{active:r==="response",onClick:()=>u("response"),icon:Jx,children:"Response"}),c.jsx(Fs,{active:r==="raw",onClick:()=>u("raw"),icon:Vp,children:"Raw"})]}),c.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&c.jsx(QS,{parsed:p}),r==="headers"&&c.jsx(XS,{headers:p.requestHeaders}),r==="request"&&c.jsx(op,{content:p.requestBody,label:"Request"}),r==="response"&&c.jsx(op,{content:p.responseBody,label:"Response"}),r==="raw"&&c.jsx(VS,{content:f})]})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:c.jsxs("div",{className:"text-center space-y-3",children:[c.jsx(Vx,{className:"w-10 h-10 mx-auto opacity-40"}),c.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function WS(){const{data:l,isLoading:s}=M1(),{data:r,isLoading:u,error:f}=z1(l?.running??!1),[m,h]=S.useState(500),[p,y]=S.useState(!1),N=S.useRef(null),C=S.useRef(null),v=()=>{C.current&&(clearInterval(C.current),C.current=null)};S.useEffect(()=>{if(!p)return;const G=k=>{const w=N.current;if(!w)return;const J=w.getBoundingClientRect().top+window.scrollY,P=k.pageY-J;h(Math.max(300,P));const ue=window.innerHeight-k.clientY,le=15;v(),ue<50?C.current=setInterval(()=>{window.scrollBy(0,le)},16):k.clientY<50&&(C.current=setInterval(()=>{window.scrollBy(0,-le)},16))},K=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",K),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",K),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const x=G=>{G.preventDefault(),y(!0)},R=S.useMemo(()=>r?.[0]?.name??null,[r]),[T,B]=S.useState(null),Y=T??R,A=S.useMemo(()=>!Y||!r?void 0:r.find(K=>K.name===Y)?.absolutePath,[Y,r]);if(s||!l?.running)return null;if(u)return c.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:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[c.jsx(nt,{className:"h-4 w-32"}),c.jsx(nt,{className:"h-4 w-20"})]}),c.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(G=>c.jsx(nt,{className:"h-12 w-full rounded-lg"},G))})]});if(!r||r.length===0)return null;const V=r.length;return c.jsxs("div",{ref:N,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:m},children:[c.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:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(Oc,{className:"w-4 h-4 text-amber-500"}),c.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[V," failed request",V!==1?"s":""]})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx($x,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsxs(Mg,{direction:"horizontal",children:[c.jsx(vc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:c.jsxs(Pl,{className:"h-full",children:[c.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(G=>c.jsx(KS,{name:G.name,size:G.size,modified:G.modified,isSelected:Y===G.name,onClick:()=>B(G.name)},G.name))}),r.length>50&&c.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"]})]})}),c.jsxs(Cg,{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:[c.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),c.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:c.jsx(Dc,{className:"h-4 w-4 text-muted-foreground"})})]}),c.jsx(vc,{className:"flex flex-col min-w-0 bg-background/50",children:c.jsx(ZS,{name:Y,absolutePath:A})})]})}),f?c.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:f.message}):c.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:x,children:c.jsx(Fx,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const JS=_o("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"}}),zg=S.forwardRef(({className:l,variant:s,...r},u)=>c.jsx("div",{ref:u,role:"alert",className:X(JS({variant:s}),l),...r}));zg.displayName="Alert";const Dg=S.forwardRef(({className:l,...s},r)=>c.jsx("h5",{ref:r,className:X("mb-1 font-medium leading-none tracking-tight",l),...s}));Dg.displayName="AlertTitle";const Og=S.forwardRef(({className:l,...s},r)=>c.jsx("div",{ref:r,className:X("text-sm [&_p]:leading-relaxed",l),...s}));Og.displayName="AlertDescription";function $S(){return Dt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function FS(){return Dt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function Qj(l){return Dt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const IS={ok:"success",warning:"warning",error:"error"},PS={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 Mo({title:l,value:s,icon:r,variant:u="default",onClick:f}){const m=PS[u];return c.jsxs("button",{onClick:f,className:X("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:[c.jsx("div",{className:X("flex items-center justify-center w-9 h-9 rounded-md",m.iconBg),children:c.jsx(r,{className:X("w-4 h-4",m.iconColor)})}),c.jsxs("div",{className:"text-left",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:l}),c.jsx("p",{className:X("text-lg font-bold font-mono leading-tight",m.iconColor),children:s})]})]})}function eN(){const l=Xv(),{data:s,isLoading:r}=$S(),{data:u,isLoading:f}=FS();if(r||f)return c.jsxs("div",{className:"p-6 space-y-6",children:[c.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(nt,{className:"h-12 w-12 rounded-lg"}),c.jsxs("div",{children:[c.jsx(nt,{className:"h-7 w-[180px] mb-2"}),c.jsx(nt,{className:"h-4 w-[220px]"})]})]}),c.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(h=>c.jsx(nt,{className:"h-14 w-28 rounded-lg"},h))})]}),c.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[c.jsx(nt,{className:"h-4 w-32"}),c.jsx(nt,{className:"h-4 w-20"})]}),c.jsx("div",{className:"px-4 py-3 border-b",children:c.jsx(nt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(h=>c.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[c.jsx(nt,{className:"w-2.5 h-2.5 rounded-full"}),c.jsx(nt,{className:"h-4 flex-1"}),c.jsx(nt,{className:"h-1.5 w-24 rounded-full"}),c.jsx(nt,{className:"h-4 w-16"})]},h))]})]});const m=s?.health?IS[s.health.status]:void 0;return c.jsxs("div",{className:"p-6 space-y-6",children:[c.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[c.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:c.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),c.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[c.jsx(b1,{version:s?.version}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(Mo,{title:"Profiles",value:s?.profiles??0,icon:Lp,variant:"accent",onClick:()=>l("/providers")}),c.jsx(Mo,{title:"CLIProxy",value:s?.cliproxy??0,icon:Gp,variant:"accent",onClick:()=>l("/cliproxy")}),c.jsx(Mo,{title:"Accounts",value:s?.accounts??0,icon:Xp,variant:"default",onClick:()=>l("/accounts")}),c.jsx(Mo,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:ai,variant:m,onClick:()=>l("/health")})]})]})]}),u?.symlinkStatus&&!u.symlinkStatus.valid&&c.jsxs(zg,{variant:"warning",children:[c.jsx(Oc,{className:"h-4 w-4"}),c.jsx(Dg,{children:"Configuration Required"}),c.jsx(Og,{children:u.symlinkStatus.message})]}),c.jsx(aS,{}),c.jsx(WS,{})]})}const tN=Ev,Tg=S.forwardRef(({className:l,...s},r)=>c.jsx(Dp,{ref:r,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));Tg.displayName=Dp.displayName;const bc=S.forwardRef(({className:l,...s},r)=>c.jsx(Op,{ref:r,className:X("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",l),...s}));bc.displayName=Op.displayName;const Sc=S.forwardRef(({className:l,...s},r)=>c.jsx(Tp,{ref:r,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));Sc.displayName=Tp.displayName;function An({className:l,...s}){return c.jsx(zv,{"data-slot":"label",className:X("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",l),...s})}const Hc="ccs:openrouter-models",nN=1440*60*1e3,Ag="1";function Nc(l){const s=parseFloat(l);return isNaN(s)||s===0?0:s*1e6}function rp(l){const s=Nc(l);return s===0?"Free":s<.01?"<$0.01":s<1?`$${s.toFixed(2)}`:`$${s.toFixed(s<10?2:0)}`}function aN(l){const s=rp(l.prompt),r=rp(l.completion);return s==="Free"&&r==="Free"?"Free":`${s}/${r}`}function lN(l){const s=l.id.toLowerCase();return s.startsWith("anthropic/")?"anthropic":s.startsWith("openai/")?"openai":s.startsWith("google/")?"google":s.startsWith("meta-llama/")||s.startsWith("meta/")?"meta":s.startsWith("mistralai/")?"mistral":s.includes(":free")||s.includes("qwen")||s.includes("deepseek")?"opensource":"other"}function sN(l){return{...l,category:lN(l),pricePerMillionPrompt:Nc(l.pricing.prompt),pricePerMillionCompletion:Nc(l.pricing.completion),isFree:l.pricing.prompt==="0"&&l.pricing.completion==="0",isExacto:l.id.includes(":exacto")}}function iN(l,s,r){const u=s.toLowerCase().trim();return l.filter(f=>r?.category&&f.category!==r.category||r?.freeOnly&&!f.isFree||r?.minContext&&f.context_length<r.minContext?!1:u?f.id.toLowerCase().includes(u)||f.name.toLowerCase().includes(u)||f.description?.toLowerCase().includes(u):!0)}function Xj(l){return[...l].sort((s,r)=>{if(s.isFree&&!r.isFree)return-1;if(!s.isFree&&r.isFree)return 1;if(!s.isFree&&!r.isFree){if(s.isExacto&&!r.isExacto)return-1;if(!s.isExacto&&r.isExacto)return 1}return s.name.localeCompare(r.name)})}function oN(){try{const l=localStorage.getItem(Hc);if(!l)return null;const s=JSON.parse(l);return s.version!==Ag||Date.now()-s.fetchedAt>nN?null:s.models}catch{return null}}function rN(l){try{localStorage.setItem(Hc,JSON.stringify({models:l,fetchedAt:Date.now(),version:Ag}))}catch{}}function uN(){localStorage.removeItem(Hc)}function Vj(l,s){const[r]=l.split("/");if(!r)return{};const u=s.filter(h=>h.id.startsWith(`${r}/`));if(u.length===0)return{};const f=[...u].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),m=Math.ceil(f.length/3);return{opus:f[0]?.id,sonnet:f[Math.min(m,f.length-1)]?.id,haiku:f[f.length-1]?.id}}function cN(l){return l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${Math.round(l/1e3)}K`:String(l)}const Zj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},fN={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function dN(l,s=2){const r=[],u=["anthropic","openai","google","meta","mistral","opensource"];for(const f of u){const m=fN[f];if(m.length===0)continue;const p=[...l.filter(y=>m.some(N=>y.id.toLowerCase().startsWith(N)))].sort((y,N)=>(N.created??0)-(y.created??0));r.push(...p.slice(0,s))}return r.sort((f,m)=>(m.created??0)-(f.created??0))}function mN(l){const r=Date.now()/1e3-l;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 hN="https://openrouter.ai/api/v1/models",_g=["openrouter-models"],up=1440*60*1e3;async function pN(){const l=await fetch(hN);if(!l.ok)throw new Error(`Failed to fetch OpenRouter models: ${l.status}`);const r=(await l.json()).data;return rN(r),r}function kg(){return Dt({queryKey:_g,queryFn:pN,staleTime:up,gcTime:up,initialData:()=>oN()??void 0,refetchOnWindowFocus:!1})}function gN(){const l=kg(),s=(l.data??[]).map(sN);return{...l,models:s}}function Wj(){const l=tn();return()=>(uN(),l.invalidateQueries({queryKey:_g}))}function Jj(){const{data:l,isLoading:s,isError:r}=kg();return{isReady:!!l&&l.length>0,isLoading:s,isError:r,modelCount:l?.length??0}}function Rg({profileEnv:l={}}){const[s,r]=S.useState(null),[u,f]=S.useState(!0),[m,h]=S.useState(!1);S.useEffect(()=>{p()},[]);const p=async()=>{try{f(!0);const x=await fetch("/api/global-env");if(!x.ok)throw new Error("Failed to load");const R=await x.json();r(R)}catch{r(null)}finally{f(!1)}};if(u||!s?.enabled)return null;const y=s.env||{},N=Object.keys(y);if(N.length===0)return null;const C=N.filter(x=>!(x in l)),v=N.filter(x=>x in l);return c.jsxs("div",{className:"border-t bg-muted/20",children:[c.jsxs("button",{onClick:()=>h(!m),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[c.jsx(Uo,{className:"w-4 h-4 text-blue-500"}),c.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[c.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&&c.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),m?c.jsx(Tc,{className:"w-4 h-4 text-muted-foreground"}):c.jsx(Bo,{className:"w-4 h-4 text-muted-foreground"})]}),m&&c.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[C.length>0&&c.jsx("div",{className:"space-y-1",children:C.map(x=>c.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:[c.jsx("span",{className:"text-green-500",children:"+"}),c.jsxs("span",{className:"truncate",children:[x,"=",y[x]]})]},x))}),v.length>0&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(x=>c.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:[c.jsx("span",{className:"text-amber-500",children:"~"}),c.jsx("span",{className:"truncate",children:x})]},x))]}),c.jsx("div",{className:"pt-2 border-t border-border/50",children:c.jsx(hn,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:c.jsxs(yc,{to:"/settings?tab=globalenv",children:[c.jsx(Zp,{className:"w-3.5 h-3.5"}),"Configure in Settings",c.jsx(Ix,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const yN=S.lazy(()=>Mn(()=>import("./code-editor-DHCb2-64.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function $j({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:r,settings:u,onChange:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(Ro,{className:"w-6 h-6 animate-spin text-muted-foreground"}),c.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:c.jsxs("div",{className:"h-full flex flex-col",children:[!s&&r!==null&&c.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:[c.jsx(ii,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),c.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:c.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:c.jsx(yN,{value:l,onChange:f,language:"json",minHeight:"100%"})})}),c.jsx("div",{className:"mx-6 mb-4",children:c.jsx("div",{className:"border rounded-md overflow-hidden",children:c.jsx(Rg,{profileEnv:u?.env})})})]})})}function cp(l,s){try{var r=l()}catch(u){return s(u)}return r&&r.then?r.then(void 0,s):r}function vN(l,s){for(var r={};l.length;){var u=l[0],f=u.code,m=u.message,h=u.path.join(".");if(!r[h])if("unionErrors"in u){var p=u.unionErrors[0].errors[0];r[h]={message:p.message,type:p.code}}else r[h]={message:m,type:f};if("unionErrors"in u&&u.unionErrors.forEach(function(C){return C.errors.forEach(function(v){return l.push(v)})}),s){var y=r[h].types,N=y&&y[u.code];r[h]=Wp(h,s,r,f,N?[].concat(N,u.message):u.message)}l.shift()}return r}function xN(l,s){for(var r={};l.length;){var u=l[0],f=u.code,m=u.message,h=u.path.join(".");if(!r[h])if(u.code==="invalid_union"&&u.errors.length>0){var p=u.errors[0][0];r[h]={message:p.message,type:p.code}}else r[h]={message:m,type:f};if(u.code==="invalid_union"&&u.errors.forEach(function(C){return C.forEach(function(v){return l.push(v)})}),s){var y=r[h].types,N=y&&y[u.code];r[h]=Wp(h,s,r,f,N?[].concat(N,u.message):u.message)}l.shift()}return r}function bN(l,s,r){if(r===void 0&&(r={}),(function(u){return"_def"in u&&typeof u._def=="object"&&"typeName"in u._def})(l))return function(u,f,m){try{return Promise.resolve(cp(function(){return Promise.resolve(l[r.mode==="sync"?"parse":"parseAsync"](u,s)).then(function(h){return m.shouldUseNativeValidation&&qh({},m),{errors:{},values:r.raw?Object.assign({},u):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Yh(vN(h.errors,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};if((function(u){return"_zod"in u&&typeof u._zod=="object"})(l))return function(u,f,m){try{return Promise.resolve(cp(function(){return Promise.resolve((r.mode==="sync"?tb:nb)(l,u,s)).then(function(h){return m.shouldUseNativeValidation&&qh({},m),{errors:{},values:r.raw?Object.assign({},u):h}})},function(h){if((function(p){return p instanceof ab})(h))return{values:{},errors:Yh(xN(h.issues,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}function Fj(){return Dt({queryKey:["profiles"],queryFn:()=>bt.profiles.list()})}function SN(){const l=tn();return jn({mutationFn:s=>bt.profiles.create(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ge.success("Profile created successfully")},onError:s=>{Ge.error(s.message)}})}function Ij(){const l=tn();return jn({mutationFn:s=>bt.profiles.delete(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ge.success("Profile deleted successfully")},onError:s=>{Ge.error(s.message)}})}const NN="https://openrouter.ai/api",zo=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:NN,defaultProfileName:"openrouter",badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg",defaultModel:"anthropic/claude-opus-4.5",requiresApiKey:!0,apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended"},{id:"glm",name:"GLM",description:"Claude via Z.AI (GitHub Copilot)",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",badge:"Z.AI",defaultModel:"glm-4.6",requiresApiKey:!0,apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative"},{id:"glmt",name:"GLMT",description:"GLM with Thinking mode support",baseUrl:"https://api.z.ai/api/coding/paas/v4/chat/completions",defaultProfileName:"glmt",badge:"Thinking",defaultModel:"glm-4.6",requiresApiKey:!0,apiKeyPlaceholder:"ghp_...",apiKeyHint:"Same API key as GLM",category:"alternative"},{id:"kimi",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"kimi",badge:"Reasoning",defaultModel:"kimi-k2-thinking-turbo",requiresApiKey:!0,apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative"}];function Co(l){return zo.filter(s=>s.category===l)}const jN=lb({name:ll().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:ll().url("Invalid URL format"),apiKey:ll().min(1,"API key is required"),model:ll().optional(),opusModel:ll().optional(),sonnetModel:ll().optional(),haikuModel:ll().optional()}),MN=["/chat/completions","/v1/messages","/messages","/completions"];function Pj({open:l,onOpenChange:s,onSuccess:r}){const u=SN(),[f,m]=S.useState("basic"),[h,p]=S.useState(null),[y,N]=S.useState(!1),[C,v]=S.useState("openrouter"),[x,R]=S.useState(""),{models:T}=gN(),{register:B,handleSubmit:Y,formState:{errors:A},control:V,reset:G,setValue:K}=sb({resolver:bN(jN),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),k=ib({control:V,name:"baseUrl"}),w=S.useMemo(()=>!C||C==="custom"?null:zo.find(W=>W.id===C),[C]),H=S.useMemo(()=>x.trim()?[...iN(T,x)].sort((ie,D)=>(D.created??0)-(ie.created??0)).slice(0,20):dN(T,2),[T,x]);S.useEffect(()=>{if(l){G(),m("basic"),p(null),N(!1),v("openrouter"),R("");const W=zo.find(ie=>ie.id==="openrouter");W&&setTimeout(()=>{K("name",W.defaultProfileName),K("baseUrl",W.baseUrl)},0)}},[l,G,K]);const J=W=>{v(W);const ie=zo.find(D=>D.id===W);ie?(K("name",ie.defaultProfileName),K("baseUrl",ie.baseUrl),ie.defaultModel&&(K("model",ie.defaultModel),K("opusModel",ie.defaultModel),K("sonnetModel",ie.defaultModel),K("haikuModel",ie.defaultModel))):(K("name",""),K("baseUrl",""),K("model",""))},P=W=>{K("model",W.id),K("opusModel",W.id),K("sonnetModel",W.id),K("haikuModel",W.id),R(W.name),Ge.success(`Applied "${W.name}" to all model tiers`,{duration:2e3})};S.useEffect(()=>{if(k&&C==="custom"){const ie=k.toLowerCase();for(const D of MN)if(ie.endsWith(D)){const $=k.replace(new RegExp(D+"$","i"),"");p(`URL ends with "${D}" - Claude appends this automatically. You likely want: ${$}`);return}}p(null)},[k,C]);const pe=async W=>{const ie={...W};try{await u.mutateAsync(ie),Ge.success(`Profile "${ie.name}" created`),r(ie.name),s(!1)}catch(D){Ge.error(D.message||"Failed to create profile")}},ue=!!A.name||!!A.baseUrl||!!A.apiKey,le=!!A.model||!!A.opusModel||!!A.sonnetModel||!!A.haikuModel,Be=C==="openrouter";return c.jsx(eg,{open:l,onOpenChange:s,children:c.jsxs(tg,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh]",children:[c.jsxs(ng,{className:"p-6 pb-4 border-b",children:[c.jsxs(ag,{className:"flex items-center gap-2",children:[c.jsx(Hh,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),c.jsx(lg,{children:"Choose a provider or configure a custom API endpoint."})]}),c.jsxs("form",{onSubmit:Y(pe),className:"flex flex-col overflow-hidden",children:[c.jsxs("div",{className:"px-6 py-3 border-b bg-muted/30 space-y-2",children:[c.jsxs("div",{children:[c.jsx(An,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Provider"}),c.jsxs("div",{className:"flex gap-2",children:[Co("recommended").map(W=>c.jsx(fp,{preset:W,isSelected:C===W.id,onClick:()=>J(W.id)},W.id)),c.jsxs("button",{type:"button",onClick:()=>J("custom"),className:X("flex items-center gap-1.5 px-3 py-1.5 rounded-md border transition-all text-sm",C==="custom"||Co("alternative").some(W=>W.id===C)?"border-primary bg-primary/5 font-medium":"border-muted hover:border-muted-foreground/30"),children:[c.jsx(Zp,{className:"w-3.5 h-3.5 text-muted-foreground"}),c.jsx("span",{children:"Custom"})]})]})]}),(C==="custom"||Co("alternative").some(W=>W.id===C))&&c.jsxs("div",{className:"pt-2 border-t border-dashed",children:[c.jsx(An,{className:"text-xs text-muted-foreground mb-1.5 block",children:"Quick Templates"}),c.jsx("div",{className:"flex gap-2 flex-wrap",children:Co("alternative").map(W=>c.jsx(fp,{preset:W,isSelected:C===W.id,onClick:()=>J(W.id)},W.id))})]})]}),c.jsxs(tN,{value:f,onValueChange:m,className:"flex flex-col flex-1 overflow-hidden",children:[c.jsx("div",{className:"px-6 pt-4",children:c.jsxs(Tg,{className:"grid w-full grid-cols-2",children:[c.jsxs(bc,{value:"basic",className:"relative",children:["Basic Information",ue&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),c.jsxs(bc,{value:"models",className:"relative",children:["Model Configuration",le&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),c.jsxs(Pl,{className:"flex-1",children:[c.jsxs(Sc,{value:"basic",className:"p-6 space-y-4 mt-0",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"name",children:["Profile Name ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(Ra,{id:"name",...B("name"),placeholder:"my-api",className:"font-mono"}),A.name?c.jsx("p",{className:"text-xs text-destructive",children:A.name.message}):c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",c.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"baseUrl",children:["API Base URL ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(Ra,{id:"baseUrl",...B("baseUrl"),placeholder:"https://api.example.com/v1"}),A.baseUrl?c.jsx("p",{className:"text-xs text-destructive",children:A.baseUrl.message}):h?c.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:[c.jsx(Oc,{className:"w-4 h-4 shrink-0 mt-0.5"}),c.jsx("span",{children:h})]}):w?c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pre-filled from ",w.name,". You can customize if needed."]}):c.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"apiKey",children:["API Key ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Ra,{id:"apiKey",type:y?"text":"password",...B("apiKey"),placeholder:w?.apiKeyPlaceholder??"sk-...",className:"pr-10"}),c.jsx(hn,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>N(!y),tabIndex:-1,children:y?c.jsx(Mc,{className:"h-4 w-4"}):c.jsx(Cc,{className:"h-4 w-4"})})]}),A.apiKey?c.jsx("p",{className:"text-xs text-destructive",children:A.apiKey.message}):w?.apiKeyHint&&c.jsx("p",{className:"text-xs text-muted-foreground",children:w.apiKeyHint})]})]}),c.jsxs(Sc,{value:"models",className:"p-6 mt-0 space-y-4",children:[c.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:[c.jsx(Uo,{className:"w-5 h-5 shrink-0 mt-0.5"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),c.jsx("p",{className:"text-xs opacity-90",children:"Map Claude Code tiers (Opus/Sonnet/Haiku) to models supported by your provider."})]})]}),Be&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(An,{children:"Search Models"}),c.jsx(Ra,{value:x,onChange:W=>R(W.target.value),placeholder:"Type to search (e.g., opus, sonnet, gpt-4o)...",onKeyDown:W=>{W.key==="Enter"&&H.length>0&&(W.preventDefault(),P(H[0]))}}),c.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:H.length===0?c.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:x?`No models found for "${x}"`:"Loading models..."}):c.jsxs("div",{className:"p-1",children:[!x&&c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[c.jsx(Px,{className:"w-3 h-3 text-accent"}),c.jsx("span",{children:"Newest Models"})]}),H.map(W=>c.jsx(CN,{model:W,onClick:()=>P(W),showAge:!x},W.id))]})})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"model",children:["Default Model",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),c.jsx(Ra,{id:"model",...B("model"),placeholder:w?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),c.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),c.jsx(Ra,{id:"sonnetModel",...B("sonnetModel"),placeholder:"e.g. gpt-4o, claude-sonnet-4",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),c.jsx(Ra,{id:"opusModel",...B("opusModel"),placeholder:"e.g. o1, claude-opus-4.5",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(An,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping",c.jsx(Ha,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),c.jsx(Ra,{id:"haikuModel",...B("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3.5-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),c.jsxs(h1,{className:"p-6 pt-4 border-t bg-muted/10",children:[c.jsx(hn,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsx(hn,{type:"submit",disabled:u.isPending,className:X(u.isPending&&"opacity-80"),children:u.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Ro,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Hh,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})]})]})})}function fp({preset:l,isSelected:s,onClick:r}){return c.jsxs("button",{type:"button",onClick:r,className:X("flex items-center gap-1.5 px-3 py-1.5 rounded-md border transition-all text-sm",s?l.featured?"border-accent bg-accent/10 dark:bg-accent/20 font-medium":"border-primary bg-primary/5 font-medium":"border-muted hover:border-muted-foreground/30"),children:[l.icon?c.jsx("img",{src:l.icon,alt:"",className:"w-3.5 h-3.5"}):c.jsx("div",{className:"w-3.5 h-3.5 rounded-full bg-muted flex items-center justify-center text-[8px] font-bold",children:l.name.charAt(0)}),c.jsx("span",{children:l.name}),l.badge&&c.jsx(Ha,{variant:"secondary",className:"text-[9px] px-1 py-0 ml-0.5",children:l.badge})]})}function CN({model:l,onClick:s,showAge:r}){return c.jsxs("button",{type:"button",onClick:s,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:[c.jsx("span",{className:"flex-1 truncate",children:l.name}),c.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[r&&l.created&&c.jsx(Ha,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:mN(l.created)}),l.isFree?c.jsx(Ha,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:"Free"}):c.jsx("span",{children:aN(l.pricing)}),c.jsx("span",{children:cN(l.context_length)})]})]})}const eM=kv,tM=Uv,nM=Rv,wN=S.forwardRef(({className:l,children:s,...r},u)=>c.jsxs(Ap,{ref:u,className:X("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",l),...r,children:[s,c.jsx(Dv,{asChild:!0,children:c.jsx(Bo,{className:"h-4 w-4 opacity-50"})})]}));wN.displayName=Ap.displayName;const Ug=S.forwardRef(({className:l,...s},r)=>c.jsx(_p,{ref:r,className:X("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Tc,{className:"h-4 w-4"})}));Ug.displayName=_p.displayName;const Bg=S.forwardRef(({className:l,...s},r)=>c.jsx(kp,{ref:r,className:X("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Bo,{className:"h-4 w-4"})}));Bg.displayName=kp.displayName;const EN=S.forwardRef(({className:l,children:s,position:r="popper",...u},f)=>c.jsx(Ov,{children:c.jsxs(Rp,{ref:f,className:X("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",l),position:r,...u,children:[c.jsx(Ug,{}),c.jsx(Tv,{className:X("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),c.jsx(Bg,{})]})}));EN.displayName=Rp.displayName;const zN=S.forwardRef(({className:l,...s},r)=>c.jsx(Up,{ref:r,className:X("px-2 py-1.5 text-sm font-semibold",l),...s}));zN.displayName=Up.displayName;const DN=S.forwardRef(({className:l,children:s,...r},u)=>c.jsxs(Bp,{ref:u,className:X("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",l),...r,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Av,{children:c.jsx(wc,{className:"h-4 w-4"})})}),c.jsx(_v,{children:s})]}));DN.displayName=Bp.displayName;const ON=S.forwardRef(({className:l,...s},r)=>c.jsx(Hp,{ref:r,className:X("-mx-1 my-1 h-px bg-muted",l),...s}));ON.displayName=Hp.displayName;const TN=S.lazy(()=>Mn(()=>import("./code-editor-DHCb2-64.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function aM({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:r,onRawJsonChange:u,profileEnv:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(Ro,{className:"w-6 h-6 animate-spin text-muted-foreground"}),c.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:c.jsxs("div",{className:"h-full flex flex-col",children:[!s&&r!==null&&c.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:[c.jsx(ii,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),c.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:c.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:c.jsx(TN,{value:l,onChange:u,language:"json",minHeight:"100%"})})}),c.jsx("div",{className:"mx-6 mb-4",children:c.jsx("div",{className:"border rounded-md overflow-hidden",children:c.jsx(Rg,{profileEnv:f})})})]})})}var Ht={},dp;function AN(){if(dp)return Ht;dp=1;var l=Ht&&Ht.__assign||function(){return l=Object.assign||function(k){for(var w,H=1,J=arguments.length;H<J;H++){w=arguments[H];for(var P in w)Object.prototype.hasOwnProperty.call(w,P)&&(k[P]=w[P])}return k},l.apply(this,arguments)},s=Ht&&Ht.__createBinding||(Object.create?(function(k,w,H,J){J===void 0&&(J=H);var P=Object.getOwnPropertyDescriptor(w,H);(!P||("get"in P?!w.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return w[H]}}),Object.defineProperty(k,J,P)}):(function(k,w,H,J){J===void 0&&(J=H),k[J]=w[H]})),r=Ht&&Ht.__setModuleDefault||(Object.create?(function(k,w){Object.defineProperty(k,"default",{enumerable:!0,value:w})}):function(k,w){k.default=w}),u=Ht&&Ht.__importStar||function(k){if(k&&k.__esModule)return k;var w={};if(k!=null)for(var H in k)H!=="default"&&Object.prototype.hasOwnProperty.call(k,H)&&s(w,k,H);return r(w,k),w},f=Ht&&Ht.__rest||function(k,w){var H={};for(var J in k)Object.prototype.hasOwnProperty.call(k,J)&&w.indexOf(J)<0&&(H[J]=k[J]);if(k!=null&&typeof Object.getOwnPropertySymbols=="function")for(var P=0,J=Object.getOwnPropertySymbols(k);P<J.length;P++)w.indexOf(J[P])<0&&Object.prototype.propertyIsEnumerable.call(k,J[P])&&(H[J[P]]=k[J[P]]);return H};Object.defineProperty(Ht,"__esModule",{value:!0});var m=u(Yp()),h=89,p=90,y=77,N=57,C=219,v=222,x=192,R=100,T=3e3,B=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),Y=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),A="npm__react-simple-code-editor__textarea",V=`
15
15
  /**
16
16
  * Reset the text fill color so that placeholder is visible
17
17
  */
@@ -43,4 +43,4 @@ Error generating stack: `+a.message+`
43
43
  `);if(me!==$e){var ve=Se[he];En({value:$e,selectionStart:ve?.startsWith(re)?we-re.length:we,selectionEnd:et-(me.length-$e.length)})}}else if(we!==et){var Se=Kt(me,we),Et=Se.length-1,Yn=Kt(me,et).length-1,ve=Se[Et];En({value:me.split(`
44
44
  `).map(function(ls,ss){return ss>=Et&&ss<=Yn?re+ls:ls}).join(`
45
45
  `),selectionStart:ve&&/\S/.test(ve)?we+re.length:we,selectionEnd:et+re.length*(Yn-Et+1)})}else{var yt=we+re.length;En({value:me.substring(0,we)+re+me.substring(et),selectionStart:yt,selectionEnd:yt})}else if(Z.key==="Backspace"){var Qt=we!==et,pn=me.substring(0,we);if(pn.endsWith(re)&&!Qt){Z.preventDefault();var yt=we-re.length;En({value:me.substring(0,we-re.length)+me.substring(et),selectionStart:yt,selectionEnd:yt})}}else if(Z.key==="Enter"){if(we===et){var ns=Kt(me,we).pop(),Ya=ns?.match(/^\s+/);if(Ya?.[0]){Z.preventDefault();var as=`
46
- `+Ya[0],yt=we+as.length;En({value:me.substring(0,we)+as+me.substring(et),selectionStart:yt,selectionEnd:yt})}}}else if(Z.keyCode===N||Z.keyCode===C||Z.keyCode===v||Z.keyCode===x){var nn=void 0;Z.keyCode===N&&Z.shiftKey?nn=["(",")"]:Z.keyCode===C?Z.shiftKey?nn=["{","}"]:nn=["[","]"]:Z.keyCode===v?Z.shiftKey?nn=['"','"']:nn=["'","'"]:Z.keyCode===x&&!Z.shiftKey&&(nn=["`","`"]),we!==et&&nn&&(Z.preventDefault(),En({value:me.substring(0,we)+nn[0]+me.substring(we,et)+nn[1]+me.substring(et),selectionStart:we,selectionEnd:et+2}))}else(Y?Z.metaKey&&Z.keyCode===p:Z.ctrlKey&&Z.keyCode===p)&&!Z.shiftKey&&!Z.altKey?(Z.preventDefault(),ul()):(Y?Z.metaKey&&Z.keyCode===p&&Z.shiftKey:B?Z.ctrlKey&&Z.keyCode===h:Z.ctrlKey&&Z.keyCode===p&&Z.shiftKey)&&!Z.altKey?(Z.preventDefault(),es()):Z.keyCode===y&&Z.ctrlKey&&(!Y||Z.shiftKey)&&(Z.preventDefault(),ca(function(Ln){return!Ln}))}},qn=function(Z){var Ce=Z.currentTarget,me=Ce.value,we=Ce.selectionStart,et=Ce.selectionEnd;Hn({value:me,selectionStart:we,selectionEnd:et},!0),F(me)};return m.useEffect(function(){qa()},[qa]),m.useImperativeHandle(H,function(){return{get session(){return{history:Ne.current}},set session(Z){Ne.current=Z.history}}},[]),m.createElement("div",l({},Un,{style:l(l({},K.container),ht)}),m.createElement("pre",l({className:xe,"aria-hidden":"true",style:l(l(l({},K.editor),K.highlight),Bn)},typeof ot=="string"?{dangerouslySetInnerHTML:{__html:ot+"<br />"}}:{children:ot})),m.createElement("textarea",{ref:function(Z){return Lt.current=Z},style:l(l(l({},K.editor),K.textarea),Bn),className:A+(Pe?" ".concat(Pe):""),id:Ot,value:Yt,onChange:qn,onKeyDown:ts,onClick:be,onKeyUp:Q,onFocus:De,onBlur:ge,disabled:P,form:pe,maxLength:D,minLength:$,name:te,placeholder:ae,readOnly:Oe,required:Ye,autoFocus:J,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),m.createElement("style",{dangerouslySetInnerHTML:{__html:V}}))}),K={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 Ht.default=G,Ht}var _N=AN();const lM=Vv(_N),sM=Hv,iM=Yv,oM=qv,kN=S.forwardRef(({className:l,align:s="center",sideOffset:r=4,...u},f)=>c.jsx(Bv,{children:c.jsx(qp,{ref:f,align:s,sideOffset:r,className:X("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",l),...u})}));kN.displayName=qp.displayName;function RN(l,s,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:l,timeZoneName:r}).format(s).split(/\s/g).slice(2).join(" ")}const UN={},ni={};function il(l,s){try{const u=(UN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return u in ni?ni[u]:mp(u,u.split(":"))}catch{if(l in ni)return ni[l];const r=l?.match(BN);return r?mp(l,r.slice(1)):NaN}}const BN=/([+-]\d\d):?(\d\d)?/;function mp(l,s){const r=+(s[0]||0),u=+(s[1]||0),f=+(s[2]||0)/60;return ni[l]=r*60+u>0?r*60+u+f:r*60-u-f}class kn extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(il(this.timeZone,this))?this.setTime(NaN):s.length?typeof s[0]=="number"&&(s.length===1||s.length===2&&typeof s[1]!="number")?this.setTime(s[0]):typeof s[0]=="string"?this.setTime(+new Date(s[0])):s[0]instanceof Date?this.setTime(+s[0]):(this.setTime(+new Date(...s)),Hg(this),jc(this)):this.setTime(Date.now())}static tz(s,...r){return r.length?new kn(...r,s):new kn(Date.now(),s)}withTimeZone(s){return new kn(+this,s)}getTimezoneOffset(){const s=-il(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),jc(this),+this}[Symbol.for("constructDateFrom")](s){return new kn(+new Date(s),this.timeZone)}}const hp=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!hp.test(l))return;const s=l.replace(hp,"$1UTC");kn.prototype[s]&&(l.startsWith("get")?kn.prototype[l]=function(){return this.internal[s]()}:(kn.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),HN(this),+this},kn.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),jc(this),+this}))});function jc(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-il(l.timeZone,l)*60))}function HN(l){Date.prototype.setFullYear.call(l,l.internal.getUTCFullYear(),l.internal.getUTCMonth(),l.internal.getUTCDate()),Date.prototype.setHours.call(l,l.internal.getUTCHours(),l.internal.getUTCMinutes(),l.internal.getUTCSeconds(),l.internal.getUTCMilliseconds()),Hg(l)}function Hg(l){const s=il(l.timeZone,l),r=s>0?Math.floor(s):Math.ceil(s),u=new Date(+l);u.setUTCHours(u.getUTCHours()-1);const f=-new Date(+l).getTimezoneOffset(),m=-new Date(+u).getTimezoneOffset(),h=f-m,p=Date.prototype.getHours.apply(l)!==l.internal.getUTCHours();h&&p&&l.internal.setUTCMinutes(l.internal.getUTCMinutes()+h);const y=f-r;y&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+y);const N=new Date(+l);N.setUTCSeconds(0);const C=f>0?N.getSeconds():(N.getSeconds()-60)%60,v=Math.round(-(il(l.timeZone,l)*60))%60;(v||C)&&(l.internal.setUTCSeconds(l.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(l,Date.prototype.getUTCSeconds.call(l)+v+C));const x=il(l.timeZone,l),R=x>0?Math.floor(x):Math.ceil(x),B=-new Date(+l).getTimezoneOffset()-R,Y=R!==r,A=B-y;if(Y&&A){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+A);const V=il(l.timeZone,l),G=V>0?Math.floor(V):Math.ceil(V),K=R-G;K&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+K),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+K))}}class oa extends kn{static tz(s,...r){return r.length?new oa(...r,s):new oa(Date.now(),s)}toISOString(){const[s,r,u]=this.tzComponents(),f=`${s}${r}:${u}`;return this.internal.toISOString().slice(0,-1)+f}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,r,u,f]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${u} ${r} ${f}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[r,u,f]=this.tzComponents();return`${s} GMT${r}${u}${f} (${RN(this.timeZone,this)})`}toLocaleString(s,r){return Date.prototype.toLocaleString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleDateString(s,r){return Date.prototype.toLocaleDateString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleTimeString(s,r){return Date.prototype.toLocaleTimeString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}tzComponents(){const s=this.getTimezoneOffset(),r=s>0?"-":"+",u=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),f=String(Math.abs(s)%60).padStart(2,"0");return[r,u,f]}withTimeZone(s){return new oa(+this,s)}[Symbol.for("constructDateFrom")](s){return new oa(+new Date(s),this.timeZone)}}const pp=5,qN=4;function YN(l,s){const r=s.startOfMonth(l),u=r.getDay()>0?r.getDay():7,f=s.addDays(l,-u+1),m=s.addDays(f,pp*7-1);return s.getMonth(l)===s.getMonth(m)?pp:qN}function qg(l,s){const r=s.startOfMonth(l),u=r.getDay();return u===1?r:u===0?s.addDays(r,-6):s.addDays(r,-1*(u-1))}function LN(l,s){const r=qg(l,s),u=YN(l,s);return s.addDays(r,u*7-1)}const Yg={...Js,labels:{labelDayButton:(l,s,r,u)=>{let f;u&&typeof u.format=="function"?f=u.format.bind(u):f=(h,p)=>Is(h,p,{locale:Js,...r});let m=f(l,"PPPP");return s.today&&(m=`Today, ${m}`),s.selected&&(m=`${m}, selected`),m},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:l=>`Week ${l}`,labelYearDropdown:"Choose the Year",labelGrid:(l,s,r)=>{let u;return r&&typeof r.format=="function"?u=r.format.bind(r):u=(f,m)=>Is(f,m,{locale:Js,...s}),u(l,"LLLL yyyy")},labelGridcell:(l,s,r,u)=>{let f;u&&typeof u.format=="function"?f=u.format.bind(u):f=(h,p)=>Is(h,p,{locale:Js,...r});let m=f(l,"PPPP");return s?.today&&(m=`Today, ${m}`),m},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,r)=>{let u;return r&&typeof r.format=="function"?u=r.format.bind(r):u=(f,m)=>Is(f,m,{locale:Js,...s}),u(l,"cccc")}}};class en{constructor(s,r){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?oa.tz(this.options.timeZone):new this.Date,this.newDate=(u,f,m)=>this.overrides?.newDate?this.overrides.newDate(u,f,m):this.options.timeZone?new oa(u,f,m,this.options.timeZone):new Date(u,f,m),this.addDays=(u,f)=>this.overrides?.addDays?this.overrides.addDays(u,f):ex(u,f),this.addMonths=(u,f)=>this.overrides?.addMonths?this.overrides.addMonths(u,f):tx(u,f),this.addWeeks=(u,f)=>this.overrides?.addWeeks?this.overrides.addWeeks(u,f):nx(u,f),this.addYears=(u,f)=>this.overrides?.addYears?this.overrides.addYears(u,f):ax(u,f),this.differenceInCalendarDays=(u,f)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(u,f):lx(u,f),this.differenceInCalendarMonths=(u,f)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(u,f):sx(u,f),this.eachMonthOfInterval=u=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(u):ix(u),this.eachYearOfInterval=u=>{const f=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(u):ox(u),m=new Set(f.map(p=>this.getYear(p)));if(m.size===f.length)return f;const h=[];return m.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=u=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(u):LN(u,this),this.endOfISOWeek=u=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(u):rx(u),this.endOfMonth=u=>this.overrides?.endOfMonth?this.overrides.endOfMonth(u):ux(u),this.endOfWeek=(u,f)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(u,f):cx(u,this.options),this.endOfYear=u=>this.overrides?.endOfYear?this.overrides.endOfYear(u):fx(u),this.format=(u,f,m)=>{const h=this.overrides?.format?this.overrides.format(u,f,this.options):Is(u,f,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=u=>this.overrides?.getISOWeek?this.overrides.getISOWeek(u):dx(u),this.getMonth=(u,f)=>this.overrides?.getMonth?this.overrides.getMonth(u,this.options):mx(u,this.options),this.getYear=(u,f)=>this.overrides?.getYear?this.overrides.getYear(u,this.options):hx(u,this.options),this.getWeek=(u,f)=>this.overrides?.getWeek?this.overrides.getWeek(u,this.options):px(u,this.options),this.isAfter=(u,f)=>this.overrides?.isAfter?this.overrides.isAfter(u,f):gx(u,f),this.isBefore=(u,f)=>this.overrides?.isBefore?this.overrides.isBefore(u,f):yx(u,f),this.isDate=u=>this.overrides?.isDate?this.overrides.isDate(u):vx(u),this.isSameDay=(u,f)=>this.overrides?.isSameDay?this.overrides.isSameDay(u,f):xx(u,f),this.isSameMonth=(u,f)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(u,f):bx(u,f),this.isSameYear=(u,f)=>this.overrides?.isSameYear?this.overrides.isSameYear(u,f):Sx(u,f),this.max=u=>this.overrides?.max?this.overrides.max(u):Nx(u),this.min=u=>this.overrides?.min?this.overrides.min(u):jx(u),this.setMonth=(u,f)=>this.overrides?.setMonth?this.overrides.setMonth(u,f):Mx(u,f),this.setYear=(u,f)=>this.overrides?.setYear?this.overrides.setYear(u,f):Cx(u,f),this.startOfBroadcastWeek=(u,f)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(u,this):qg(u,this),this.startOfDay=u=>this.overrides?.startOfDay?this.overrides.startOfDay(u):wx(u),this.startOfISOWeek=u=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(u):Ex(u),this.startOfMonth=u=>this.overrides?.startOfMonth?this.overrides.startOfMonth(u):zx(u),this.startOfWeek=(u,f)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(u,this.options):Dx(u,this.options),this.startOfYear=u=>this.overrides?.startOfYear?this.overrides.startOfYear(u):Ox(u),this.options={locale:Yg,...s},this.overrides=r}getDigitMap(){const{numerals:s="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:s}),u={};for(let f=0;f<10;f++)u[f.toString()]=r.format(f);return u}replaceDigits(s){const r=this.getDigitMap();return s.replace(/\d/g,u=>r[u]||u)}formatNumber(s){return this.replaceDigits(s.toString())}getMonthYearOrder(){const s=this.options.locale?.code;return s&&en.yearFirstLocales.has(s)?"year-first":"month-first"}formatMonthYear(s){const{locale:r,timeZone:u,numerals:f}=this.options,m=r?.code;if(m&&en.yearFirstLocales.has(m))try{return new Intl.DateTimeFormat(m,{month:"long",year:"numeric",timeZone:u,numberingSystem:f}).format(s)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(s,h)}}en.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 Rn=new en;class Lg{constructor(s,r,u=Rn){this.date=s,this.displayMonth=r,this.outside=!!(r&&!u.isSameMonth(s,r)),this.dateLib=u,this.isoDate=u.format(s,"yyyy-MM-dd"),this.displayMonthId=u.format(r,"yyyy-MM"),this.dateMonthId=u.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class GN{constructor(s,r){this.date=s,this.weeks=r}}class KN{constructor(s,r){this.days=r,this.weekNumber=s}}function QN(l){return ee.createElement("button",{...l})}function XN(l){return ee.createElement("span",{...l})}function VN(l){const{size:s=24,orientation:r="left",className:u}=l;return ee.createElement("svg",{className:u,width:s,height:s,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 ZN(l){const{day:s,modifiers:r,...u}=l;return ee.createElement("td",{...u})}function WN(l){const{day:s,modifiers:r,...u}=l,f=ee.useRef(null);return ee.useEffect(()=>{r.focused&&f.current?.focus()},[r.focused]),ee.createElement("button",{ref:f,...u})}var ce;(function(l){l.Root="root",l.Chevron="chevron",l.Day="day",l.DayButton="day_button",l.CaptionLabel="caption_label",l.Dropdowns="dropdowns",l.Dropdown="dropdown",l.DropdownRoot="dropdown_root",l.Footer="footer",l.MonthGrid="month_grid",l.MonthCaption="month_caption",l.MonthsDropdown="months_dropdown",l.Month="month",l.Months="months",l.Nav="nav",l.NextMonthButton="button_next",l.PreviousMonthButton="button_previous",l.Week="week",l.Weeks="weeks",l.Weekday="weekday",l.Weekdays="weekdays",l.WeekNumber="week_number",l.WeekNumberHeader="week_number_header",l.YearsDropdown="years_dropdown"})(ce||(ce={}));var at;(function(l){l.disabled="disabled",l.hidden="hidden",l.outside="outside",l.focused="focused",l.today="today"})(at||(at={}));var Sn;(function(l){l.range_end="range_end",l.range_middle="range_middle",l.range_start="range_start",l.selected="selected"})(Sn||(Sn={}));var Pt;(function(l){l.weeks_before_enter="weeks_before_enter",l.weeks_before_exit="weeks_before_exit",l.weeks_after_enter="weeks_after_enter",l.weeks_after_exit="weeks_after_exit",l.caption_after_enter="caption_after_enter",l.caption_after_exit="caption_after_exit",l.caption_before_enter="caption_before_enter",l.caption_before_exit="caption_before_exit"})(Pt||(Pt={}));function JN(l){const{options:s,className:r,components:u,classNames:f,...m}=l,h=[f[ce.Dropdown],r].join(" "),p=s?.find(({value:y})=>y===m.value);return ee.createElement("span",{"data-disabled":m.disabled,className:f[ce.DropdownRoot]},ee.createElement(u.Select,{className:h,...m},s?.map(({value:y,label:N,disabled:C})=>ee.createElement(u.Option,{key:y,value:y,disabled:C},N))),ee.createElement("span",{className:f[ce.CaptionLabel],"aria-hidden":!0},p?.label,ee.createElement(u.Chevron,{orientation:"down",size:18,className:f[ce.Chevron]})))}function $N(l){return ee.createElement("div",{...l})}function FN(l){return ee.createElement("div",{...l})}function IN(l){const{calendarMonth:s,displayIndex:r,...u}=l;return ee.createElement("div",{...u},l.children)}function PN(l){const{calendarMonth:s,displayIndex:r,...u}=l;return ee.createElement("div",{...u})}function e2(l){return ee.createElement("table",{...l})}function t2(l){return ee.createElement("div",{...l})}const Gg=S.createContext(void 0);function oi(){const l=S.useContext(Gg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function n2(l){const{components:s}=oi();return ee.createElement(s.Dropdown,{...l})}function a2(l){const{onPreviousClick:s,onNextClick:r,previousMonth:u,nextMonth:f,...m}=l,{components:h,classNames:p,labels:{labelPrevious:y,labelNext:N}}=oi(),C=S.useCallback(x=>{f&&r?.(x)},[f,r]),v=S.useCallback(x=>{u&&s?.(x)},[u,s]);return ee.createElement("nav",{...m},ee.createElement(h.PreviousMonthButton,{type:"button",className:p[ce.PreviousMonthButton],tabIndex:u?void 0:-1,"aria-disabled":u?void 0:!0,"aria-label":y(u),onClick:v},ee.createElement(h.Chevron,{disabled:u?void 0:!0,className:p[ce.Chevron],orientation:"left"})),ee.createElement(h.NextMonthButton,{type:"button",className:p[ce.NextMonthButton],tabIndex:f?void 0:-1,"aria-disabled":f?void 0:!0,"aria-label":N(f),onClick:C},ee.createElement(h.Chevron,{disabled:f?void 0:!0,orientation:"right",className:p[ce.Chevron]})))}function l2(l){const{components:s}=oi();return ee.createElement(s.Button,{...l})}function s2(l){return ee.createElement("option",{...l})}function i2(l){const{components:s}=oi();return ee.createElement(s.Button,{...l})}function o2(l){const{rootRef:s,...r}=l;return ee.createElement("div",{...r,ref:s})}function r2(l){return ee.createElement("select",{...l})}function u2(l){const{week:s,...r}=l;return ee.createElement("tr",{...r})}function c2(l){return ee.createElement("th",{...l})}function f2(l){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...l}))}function d2(l){const{week:s,...r}=l;return ee.createElement("th",{...r})}function m2(l){return ee.createElement("th",{...l})}function h2(l){return ee.createElement("tbody",{...l})}function p2(l){const{components:s}=oi();return ee.createElement(s.Dropdown,{...l})}const g2=Object.freeze(Object.defineProperty({__proto__:null,Button:QN,CaptionLabel:XN,Chevron:VN,Day:ZN,DayButton:WN,Dropdown:JN,DropdownNav:$N,Footer:FN,Month:IN,MonthCaption:PN,MonthGrid:e2,Months:t2,MonthsDropdown:n2,Nav:a2,NextMonthButton:l2,Option:s2,PreviousMonthButton:i2,Root:o2,Select:r2,Week:u2,WeekNumber:d2,WeekNumberHeader:m2,Weekday:c2,Weekdays:f2,Weeks:h2,YearsDropdown:p2},Symbol.toStringTag,{value:"Module"}));function ra(l,s,r=!1,u=Rn){let{from:f,to:m}=l;const{differenceInCalendarDays:h,isSameDay:p}=u;return f&&m?(h(m,f)<0&&([f,m]=[m,f]),h(s,f)>=(r?1:0)&&h(m,s)>=(r?1:0)):!r&&m?p(m,s):!r&&f?p(f,s):!1}function qc(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function Zo(l){return!!(l&&typeof l=="object"&&"from"in l)}function Yc(l){return!!(l&&typeof l=="object"&&"after"in l)}function Lc(l){return!!(l&&typeof l=="object"&&"before"in l)}function Kg(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function Qg(l,s){return Array.isArray(l)&&l.every(s.isDate)}function ua(l,s,r=Rn){const u=Array.isArray(s)?s:[s],{isSameDay:f,differenceInCalendarDays:m,isAfter:h}=r;return u.some(p=>{if(typeof p=="boolean")return p;if(r.isDate(p))return f(l,p);if(Qg(p,r))return p.some(y=>f(l,y));if(Zo(p))return ra(p,l,!1,r);if(Kg(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(l.getDay()):p.dayOfWeek===l.getDay();if(qc(p)){const y=m(p.before,l),N=m(p.after,l),C=y>0,v=N<0;return h(p.before,p.after)?v&&C:C||v}return Yc(p)?m(l,p.after)>0:Lc(p)?m(p.before,l)>0:typeof p=="function"?p(l):!1})}function y2(l,s,r,u,f){const{disabled:m,hidden:h,modifiers:p,showOutsideDays:y,broadcastCalendar:N,today:C=f.today()}=s,{isSameDay:v,isSameMonth:x,startOfMonth:R,isBefore:T,endOfMonth:B,isAfter:Y}=f,A=r&&R(r),V=u&&B(u),G={[at.focused]:[],[at.outside]:[],[at.disabled]:[],[at.hidden]:[],[at.today]:[]},K={};for(const k of l){const{date:w,displayMonth:H}=k,J=!!(H&&!x(w,H)),P=!!(A&&T(w,A)),pe=!!(V&&Y(w,V)),ue=!!(m&&ua(w,m,f)),le=!!(h&&ua(w,h,f))||P||pe||!N&&!y&&J||N&&y===!1&&J,Be=v(w,C);J&&G.outside.push(k),ue&&G.disabled.push(k),le&&G.hidden.push(k),Be&&G.today.push(k),p&&Object.keys(p).forEach(W=>{const ie=p?.[W];ie&&ua(w,ie,f)&&(K[W]?K[W].push(k):K[W]=[k])})}return k=>{const w={[at.focused]:!1,[at.disabled]:!1,[at.hidden]:!1,[at.outside]:!1,[at.today]:!1},H={};for(const J in G){const P=G[J];w[J]=P.some(pe=>pe===k)}for(const J in K)H[J]=K[J].some(P=>P===k);return{...w,...H}}}function v2(l,s,r={}){return Object.entries(l).filter(([,f])=>f===!0).reduce((f,[m])=>(r[m]?f.push(r[m]):s[at[m]]?f.push(s[at[m]]):s[Sn[m]]&&f.push(s[Sn[m]]),f),[s[ce.Day]])}function x2(l){return{...g2,...l}}function b2(l){const s={"data-mode":l.mode??void 0,"data-required":"required"in l?l.required:void 0,"data-multiple-months":l.numberOfMonths&&l.numberOfMonths>1||void 0,"data-week-numbers":l.showWeekNumber||void 0,"data-broadcast-calendar":l.broadcastCalendar||void 0,"data-nav-layout":l.navLayout||void 0};return Object.entries(l).forEach(([r,u])=>{r.startsWith("data-")&&(s[r]=u)}),s}function S2(){const l={};for(const s in ce)l[ce[s]]=`rdp-${ce[s]}`;for(const s in at)l[at[s]]=`rdp-${at[s]}`;for(const s in Sn)l[Sn[s]]=`rdp-${Sn[s]}`;for(const s in Pt)l[Pt[s]]=`rdp-${Pt[s]}`;return l}function Xg(l,s,r){return(r??new en(s)).formatMonthYear(l)}const N2=Xg;function j2(l,s,r){return(r??new en(s)).format(l,"d")}function M2(l,s=Rn){return s.format(l,"LLLL")}function C2(l,s,r){return(r??new en(s)).format(l,"cccccc")}function w2(l,s=Rn){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function E2(){return""}function Vg(l,s=Rn){return s.format(l,"yyyy")}const z2=Vg,D2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Xg,formatDay:j2,formatMonthCaption:N2,formatMonthDropdown:M2,formatWeekNumber:w2,formatWeekNumberHeader:E2,formatWeekdayName:C2,formatYearCaption:z2,formatYearDropdown:Vg},Symbol.toStringTag,{value:"Module"}));function O2(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...D2,...l}}function Gc(l,s,r,u){let f=(u??new en(r)).format(l,"PPPP");return s.today&&(f=`Today, ${f}`),s.selected&&(f=`${f}, selected`),f}const T2=Gc;function Kc(l,s,r){return(r??new en(s)).formatMonthYear(l)}const A2=Kc;function Zg(l,s,r,u){let f=(u??new en(r)).format(l,"PPPP");return s?.today&&(f=`Today, ${f}`),f}function Wg(l){return"Choose the Month"}function Jg(){return""}const _2="Go to the Next Month";function $g(l,s){return _2}function Fg(l){return"Go to the Previous Month"}function Ig(l,s,r){return(r??new en(s)).format(l,"cccc")}function Pg(l,s){return`Week ${l}`}function e0(l){return"Week Number"}function t0(l){return"Choose the Year"}const k2=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:A2,labelDay:T2,labelDayButton:Gc,labelGrid:Kc,labelGridcell:Zg,labelMonthDropdown:Wg,labelNav:Jg,labelNext:$g,labelPrevious:Fg,labelWeekNumber:Pg,labelWeekNumberHeader:e0,labelWeekday:Ig,labelYearDropdown:t0},Symbol.toStringTag,{value:"Module"})),bn=(l,s,r)=>s||(r?typeof r=="function"?r:(...u)=>r:l);function R2(l,s){const r=s.locale?.labels??{};return{...k2,...l??{},labelDayButton:bn(Gc,l?.labelDayButton,r.labelDayButton),labelMonthDropdown:bn(Wg,l?.labelMonthDropdown,r.labelMonthDropdown),labelNext:bn($g,l?.labelNext,r.labelNext),labelPrevious:bn(Fg,l?.labelPrevious,r.labelPrevious),labelWeekNumber:bn(Pg,l?.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:bn(t0,l?.labelYearDropdown,r.labelYearDropdown),labelGrid:bn(Kc,l?.labelGrid,r.labelGrid),labelGridcell:bn(Zg,l?.labelGridcell,r.labelGridcell),labelNav:bn(Jg,l?.labelNav,r.labelNav),labelWeekNumberHeader:bn(e0,l?.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:bn(Ig,l?.labelWeekday,r.labelWeekday)}}function U2(l,s,r,u,f){const{startOfMonth:m,startOfYear:h,endOfYear:p,eachMonthOfInterval:y,getMonth:N}=f;return y({start:h(l),end:p(l)}).map(x=>{const R=u.formatMonthDropdown(x,f),T=N(x),B=s&&x<m(s)||r&&x>m(r)||!1;return{value:T,label:R,disabled:B}})}function B2(l,s={},r={}){let u={...s?.[ce.Day]};return Object.entries(l).filter(([,f])=>f===!0).forEach(([f])=>{u={...u,...r?.[f]}}),u}function H2(l,s,r,u){const f=u??l.today(),m=r?l.startOfBroadcastWeek(f,l):s?l.startOfISOWeek(f):l.startOfWeek(f),h=[];for(let p=0;p<7;p++){const y=l.addDays(m,p);h.push(y)}return h}function q2(l,s,r,u,f=!1){if(!l||!s)return;const{startOfYear:m,endOfYear:h,eachYearOfInterval:p,getYear:y}=u,N=m(l),C=h(s),v=p({start:N,end:C});return f&&v.reverse(),v.map(x=>{const R=r.formatYearDropdown(x,u);return{value:y(x),label:R,disabled:!1}})}const ri=l=>l instanceof HTMLElement?l:null,mc=l=>[...l.querySelectorAll("[data-animated-month]")??[]],Y2=l=>ri(l.querySelector("[data-animated-month]")),hc=l=>ri(l.querySelector("[data-animated-caption]")),pc=l=>ri(l.querySelector("[data-animated-weeks]")),L2=l=>ri(l.querySelector("[data-animated-nav]")),G2=l=>ri(l.querySelector("[data-animated-weekdays]"));function K2(l,s,{classNames:r,months:u,focused:f,dateLib:m}){const h=S.useRef(null),p=S.useRef(u),y=S.useRef(!1);S.useLayoutEffect(()=>{const N=p.current;if(p.current=u,!s||!l.current||!(l.current instanceof HTMLElement)||u.length===0||N.length===0||u.length!==N.length)return;const C=m.isSameMonth(u[0].date,N[0].date),v=m.isAfter(u[0].date,N[0].date),x=v?r[Pt.caption_after_enter]:r[Pt.caption_before_enter],R=v?r[Pt.weeks_after_enter]:r[Pt.weeks_before_enter],T=h.current,B=l.current.cloneNode(!0);if(B instanceof HTMLElement?(mc(B).forEach(G=>{if(!(G instanceof HTMLElement))return;const K=Y2(G);K&&G.contains(K)&&G.removeChild(K);const k=hc(G);k&&k.classList.remove(x);const w=pc(G);w&&w.classList.remove(R)}),h.current=B):h.current=null,y.current||C||f)return;const Y=T instanceof HTMLElement?mc(T):[],A=mc(l.current);if(A?.every(V=>V instanceof HTMLElement)&&Y&&Y.every(V=>V instanceof HTMLElement)){y.current=!0,l.current.style.isolation="isolate";const V=L2(l.current);V&&(V.style.zIndex="1"),A.forEach((G,K)=>{const k=Y[K];if(!k)return;G.style.position="relative",G.style.overflow="hidden";const w=hc(G);w&&w.classList.add(x);const H=pc(G);H&&H.classList.add(R);const J=()=>{y.current=!1,l.current&&(l.current.style.isolation=""),V&&(V.style.zIndex=""),w&&w.classList.remove(x),H&&H.classList.remove(R),G.style.position="",G.style.overflow="",G.contains(k)&&G.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const P=G2(k);P&&(P.style.opacity="0");const pe=hc(k);pe&&(pe.classList.add(v?r[Pt.caption_before_exit]:r[Pt.caption_after_exit]),pe.addEventListener("animationend",J));const ue=pc(k);ue&&ue.classList.add(v?r[Pt.weeks_before_exit]:r[Pt.weeks_after_exit]),G.insertBefore(k,G.firstChild)})}})}function Q2(l,s,r,u){const f=l[0],m=l[l.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:y}=r??{},{addDays:N,differenceInCalendarDays:C,differenceInCalendarMonths:v,endOfBroadcastWeek:x,endOfISOWeek:R,endOfMonth:T,endOfWeek:B,isAfter:Y,startOfBroadcastWeek:A,startOfISOWeek:V,startOfWeek:G}=u,K=y?A(f,u):h?V(f):G(f),k=y?x(m):h?R(T(m)):B(T(m)),w=s&&(y?x(s):h?R(s):B(s)),H=w&&Y(k,w)?w:k,J=C(H,K),P=v(m,f)+1,pe=[];for(let Be=0;Be<=J;Be++){const W=N(K,Be);pe.push(W)}const le=(y?35:42)*P;if(p&&pe.length<le){const Be=le-pe.length;for(let W=0;W<Be;W++){const ie=N(pe[pe.length-1],1);pe.push(ie)}}return pe}function X2(l){const s=[];return l.reduce((r,u)=>{const f=u.weeks.reduce((m,h)=>m.concat(h.days.slice()),s.slice());return r.concat(f.slice())},s.slice())}function V2(l,s,r,u){const{numberOfMonths:f=1}=r,m=[];for(let h=0;h<f;h++){const p=u.addMonths(l,h);if(s&&p>s)break;m.push(p)}return m}function gp(l,s,r,u){const{month:f,defaultMonth:m,today:h=u.today(),numberOfMonths:p=1}=l;let y=f||m||h;const{differenceInCalendarMonths:N,addMonths:C,startOfMonth:v}=u;if(r&&N(r,y)<p-1){const x=-1*(p-1);y=C(r,x)}return s&&N(y,s)<0&&(y=s),v(y)}function Z2(l,s,r,u){const{addDays:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:p,endOfWeek:y,getISOWeek:N,getWeek:C,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:R}=u,T=l.reduce((B,Y)=>{const A=r.broadcastCalendar?v(Y,u):r.ISOWeek?x(Y):R(Y),V=r.broadcastCalendar?m(Y):r.ISOWeek?h(p(Y)):y(p(Y)),G=s.filter(H=>H>=A&&H<=V),K=r.broadcastCalendar?35:42;if(r.fixedWeeks&&G.length<K){const H=s.filter(J=>{const P=K-G.length;return J>V&&J<=f(V,P)});G.push(...H)}const k=G.reduce((H,J)=>{const P=r.ISOWeek?N(J):C(J),pe=H.find(le=>le.weekNumber===P),ue=new Lg(J,Y,u);return pe?pe.days.push(ue):H.push(new KN(P,[ue])),H},[]),w=new GN(Y,k);return B.push(w),B},[]);return r.reverseMonths?T.reverse():T}function W2(l,s){let{startMonth:r,endMonth:u}=l;const{startOfYear:f,startOfDay:m,startOfMonth:h,endOfMonth:p,addYears:y,endOfYear:N,newDate:C,today:v}=s,{fromYear:x,toYear:R,fromMonth:T,toMonth:B}=l;!r&&T&&(r=T),!r&&x&&(r=s.newDate(x,0,1)),!u&&B&&(u=B),!u&&R&&(u=C(R,11,31));const Y=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return r?r=h(r):x?r=C(x,0,1):!r&&Y&&(r=f(y(l.today??v(),-100))),u?u=p(u):R?u=C(R,11,31):!u&&Y&&(u=N(l.today??v())),[r&&m(r),u&&m(u)]}function J2(l,s,r,u){if(r.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m=1}=r,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=u,N=f?m:1,C=h(l);if(!s)return p(C,N);if(!(y(s,l)<m))return p(C,N)}function $2(l,s,r,u){if(r.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m}=r,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=u,N=f?m??1:1,C=h(l);if(!s)return p(C,-N);if(!(y(C,s)<=0))return p(C,-N)}function F2(l){const s=[];return l.reduce((r,u)=>r.concat(u.weeks.slice()),s.slice())}function Wo(l,s){const[r,u]=S.useState(l);return[s===void 0?r:s,u]}function I2(l,s){const[r,u]=W2(l,s),{startOfMonth:f,endOfMonth:m}=s,h=gp(l,r,u,s),[p,y]=Wo(h,l.month?h:void 0);S.useEffect(()=>{const K=gp(l,r,u,s);y(K)},[l.timeZone]);const{months:N,weeks:C,days:v,previousMonth:x,nextMonth:R}=S.useMemo(()=>{const K=V2(p,u,{numberOfMonths:l.numberOfMonths},s),k=Q2(K,l.endMonth?m(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),w=Z2(K,k,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),H=F2(w),J=X2(w),P=$2(p,r,l,s),pe=J2(p,u,l,s);return{months:w,weeks:H,days:J,previousMonth:P,nextMonth:pe}},[s,p.getTime(),u?.getTime(),r?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:T,onMonthChange:B}=l,Y=K=>C.some(k=>k.days.some(w=>w.isEqualTo(K))),A=K=>{if(T)return;let k=f(K);r&&k<f(r)&&(k=f(r)),u&&k>f(u)&&(k=f(u)),y(k),B?.(k)};return{months:N,weeks:C,days:v,navStart:r,navEnd:u,previousMonth:x,nextMonth:R,goToMonth:A,goToDay:K=>{Y(K)||A(K.date)}}}var _n;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(_n||(_n={}));function yp(l){return!l[at.disabled]&&!l[at.hidden]&&!l[at.outside]}function P2(l,s,r,u){let f,m=-1;for(const h of l){const p=s(h);yp(p)&&(p[at.focused]&&m<_n.FocusedModifier?(f=h,m=_n.FocusedModifier):u?.isEqualTo(h)&&m<_n.LastFocused?(f=h,m=_n.LastFocused):r(h.date)&&m<_n.Selected?(f=h,m=_n.Selected):p[at.today]&&m<_n.Today&&(f=h,m=_n.Today))}return f||(f=l.find(h=>yp(s(h)))),f}function ej(l,s,r,u,f,m,h){const{ISOWeek:p,broadcastCalendar:y}=m,{addDays:N,addMonths:C,addWeeks:v,addYears:x,endOfBroadcastWeek:R,endOfISOWeek:T,endOfWeek:B,max:Y,min:A,startOfBroadcastWeek:V,startOfISOWeek:G,startOfWeek:K}=h;let w={day:N,week:v,month:C,year:x,startOfWeek:H=>y?V(H,h):p?G(H):K(H),endOfWeek:H=>y?R(H):p?T(H):B(H)}[l](r,s==="after"?1:-1);return s==="before"&&u?w=Y([u,w]):s==="after"&&f&&(w=A([f,w])),w}function n0(l,s,r,u,f,m,h,p=0){if(p>365)return;const y=ej(l,s,r.date,u,f,m,h),N=!!(m.disabled&&ua(y,m.disabled,h)),C=!!(m.hidden&&ua(y,m.hidden,h)),v=y,x=new Lg(y,v,h);return!N&&!C?x:n0(l,s,x,u,f,m,h,p+1)}function tj(l,s,r,u,f){const{autoFocus:m}=l,[h,p]=S.useState(),y=P2(s.days,r,u||(()=>!1),h),[N,C]=S.useState(m?y:void 0);return{isFocusTarget:B=>!!y?.isEqualTo(B),setFocused:C,focused:N,blur:()=>{p(N),C(void 0)},moveFocus:(B,Y)=>{if(!N)return;const A=n0(B,Y,N,s.navStart,s.navEnd,l,f);A&&(l.disableNavigation&&!s.days.some(G=>G.isEqualTo(A))||(s.goToDay(A),C(A)))}}}function nj(l,s){const{selected:r,required:u,onSelect:f}=l,[m,h]=Wo(r,f?r:void 0),p=f?r:m,{isSameDay:y}=s,N=R=>p?.some(T=>y(T,R))??!1,{min:C,max:v}=l;return{selected:p,select:(R,T,B)=>{let Y=[...p??[]];if(N(R)){if(p?.length===C||u&&p?.length===1)return;Y=p?.filter(A=>!y(A,R))}else p?.length===v?Y=[R]:Y=[...Y,R];return f||h(Y),f?.(Y,R,T,B),Y},isSelected:N}}function aj(l,s,r=0,u=0,f=!1,m=Rn){const{from:h,to:p}=s||{},{isSameDay:y,isAfter:N,isBefore:C}=m;let v;if(!h&&!p)v={from:l,to:r>0?void 0:l};else if(h&&!p)y(h,l)?r===0?v={from:h,to:l}:f?v={from:h,to:void 0}:v=void 0:C(l,h)?v={from:l,to:h}:v={from:h,to:l};else if(h&&p)if(y(h,l)&&y(p,l))f?v={from:h,to:p}:v=void 0;else if(y(h,l))v={from:h,to:r>0?void 0:l};else if(y(p,l))v={from:l,to:r>0?void 0:l};else if(C(l,h))v={from:l,to:p};else if(N(l,h))v={from:h,to:l};else if(N(l,p))v={from:h,to:l};else throw new Error("Invalid range");if(v?.from&&v?.to){const x=m.differenceInCalendarDays(v.to,v.from);u>0&&x>u?v={from:l,to:void 0}:r>1&&x<r&&(v={from:l,to:void 0})}return v}function lj(l,s,r=Rn){const u=Array.isArray(s)?s:[s];let f=l.from;const m=r.differenceInCalendarDays(l.to,l.from),h=Math.min(m,6);for(let p=0;p<=h;p++){if(u.includes(f.getDay()))return!0;f=r.addDays(f,1)}return!1}function vp(l,s,r=Rn){return ra(l,s.from,!1,r)||ra(l,s.to,!1,r)||ra(s,l.from,!1,r)||ra(s,l.to,!1,r)}function sj(l,s,r=Rn){const u=Array.isArray(s)?s:[s];if(u.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:r.isDate(p)?ra(l,p,!1,r):Qg(p,r)?p.some(y=>ra(l,y,!1,r)):Zo(p)?p.from&&p.to?vp(l,{from:p.from,to:p.to},r):!1:Kg(p)?lj(l,p.dayOfWeek,r):qc(p)?r.isAfter(p.before,p.after)?vp(l,{from:r.addDays(p.after,1),to:r.addDays(p.before,-1)},r):ua(l.from,p,r)||ua(l.to,p,r):Yc(p)||Lc(p)?ua(l.from,p,r)||ua(l.to,p,r):!1))return!0;const h=u.filter(p=>typeof p=="function");if(h.length){let p=l.from;const y=r.differenceInCalendarDays(l.to,l.from);for(let N=0;N<=y;N++){if(h.some(C=>C(p)))return!0;p=r.addDays(p,1)}}return!1}function ij(l,s){const{disabled:r,excludeDisabled:u,selected:f,required:m,onSelect:h}=l,[p,y]=Wo(f,h?f:void 0),N=h?f:p;return{selected:N,select:(x,R,T)=>{const{min:B,max:Y}=l,A=x?aj(x,N,B,Y,m,s):void 0;return u&&r&&A?.from&&A.to&&sj({from:A.from,to:A.to},r,s)&&(A.from=x,A.to=void 0),h||y(A),h?.(A,x,R,T),A},isSelected:x=>N&&ra(N,x,!1,s)}}function oj(l,s){const{selected:r,required:u,onSelect:f}=l,[m,h]=Wo(r,f?r:void 0),p=f?r:m,{isSameDay:y}=s;return{selected:p,select:(v,x,R)=>{let T=v;return!u&&p&&p&&y(v,p)&&(T=void 0),f||h(T),f?.(T,v,x,R),T},isSelected:v=>p?y(p,v):!1}}function rj(l,s){const r=oj(l,s),u=nj(l,s),f=ij(l,s);switch(l.mode){case"single":return r;case"multiple":return u;case"range":return f;default:return}}function wt(l,s){return l instanceof oa&&l.timeZone===s?l:new oa(l,s)}function xp(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?wt(l,s):Array.isArray(l)?l.map(r=>r instanceof Date?wt(r,s):r):Zo(l)?{...l,from:l.from?wt(l.from,s):l.from,to:l.to?wt(l.to,s):l.to}:qc(l)?{before:wt(l.before,s),after:wt(l.after,s)}:Yc(l)?{after:wt(l.after,s)}:Lc(l)?{before:wt(l.before,s)}:l}function gc(l,s){return l&&(Array.isArray(l)?l.map(r=>xp(r,s)):xp(l,s))}function uj(l){let s=l;const r=s.timeZone;if(r&&(s={...l,timeZone:r},s.today&&(s.today=wt(s.today,r)),s.month&&(s.month=wt(s.month,r)),s.defaultMonth&&(s.defaultMonth=wt(s.defaultMonth,r)),s.startMonth&&(s.startMonth=wt(s.startMonth,r)),s.endMonth&&(s.endMonth=wt(s.endMonth,r)),s.mode==="single"&&s.selected?s.selected=wt(s.selected,r):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(re=>wt(re,r)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?wt(s.selected.from,r):s.selected.from,to:s.selected.to?wt(s.selected.to,r):s.selected.to}),s.disabled!==void 0&&(s.disabled=gc(s.disabled,r)),s.hidden!==void 0&&(s.hidden=gc(s.hidden,r)),s.modifiers)){const re={};Object.keys(s.modifiers).forEach(Se=>{re[Se]=gc(s.modifiers?.[Se],r)}),s.modifiers=re}const{components:u,formatters:f,labels:m,dateLib:h,locale:p,classNames:y}=S.useMemo(()=>{const re={...Yg,...s.locale},Se=new en({locale:re,weekStartsOn:s.broadcastCalendar?1:s.weekStartsOn,firstWeekContainsDate:s.firstWeekContainsDate,useAdditionalWeekYearTokens:s.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:s.useAdditionalDayOfYearTokens,timeZone:s.timeZone,numerals:s.numerals},s.dateLib);return{dateLib:Se,components:x2(s.components),formatters:O2(s.formatters),labels:R2(s.labels,Se.options),locale:re,classNames:{...S2(),...s.classNames}}},[s.locale,s.broadcastCalendar,s.weekStartsOn,s.firstWeekContainsDate,s.useAdditionalWeekYearTokens,s.useAdditionalDayOfYearTokens,s.timeZone,s.numerals,s.dateLib,s.components,s.formatters,s.labels,s.classNames]);s.today||(s={...s,today:h.today()});const{captionLayout:N,mode:C,navLayout:v,numberOfMonths:x=1,onDayBlur:R,onDayClick:T,onDayFocus:B,onDayKeyDown:Y,onDayMouseEnter:A,onDayMouseLeave:V,onNextClick:G,onPrevClick:K,showWeekNumber:k,styles:w}=s,{formatCaption:H,formatDay:J,formatMonthDropdown:P,formatWeekNumber:pe,formatWeekNumberHeader:ue,formatWeekdayName:le,formatYearDropdown:Be}=f,W=I2(s,h),{days:ie,months:D,navStart:$,navEnd:te,previousMonth:ge,nextMonth:be,goToMonth:De}=W,de=y2(ie,s,$,te,h),{isSelected:Q,select:F,selected:se}=rj(s,h)??{},{blur:I,focused:ae,isFocusTarget:xe,moveFocus:Oe,setFocused:Ye}=tj(s,W,de,Q??(()=>!1),h),{labelDayButton:ht,labelGridcell:pt,labelGrid:Ke,labelMonthDropdown:Pe,labelNav:Ot,labelPrevious:Yt,labelNext:Un,labelWeekday:Ne,labelWeekNumber:Lt,labelWeekNumberHeader:Cn,labelYearDropdown:Gt}=m,ca=S.useMemo(()=>H2(h,s.ISOWeek,s.broadcastCalendar,s.today),[h,s.ISOWeek,s.broadcastCalendar,s.today]),Bn=C!==void 0||T!==void 0,ot=S.useCallback(()=>{ge&&(De(ge),K?.(ge))},[ge,De,K]),Kt=S.useCallback(()=>{be&&(De(be),G?.(be))},[De,be,G]),Hn=S.useCallback((re,Se)=>he=>{he.preventDefault(),he.stopPropagation(),Ye(re),!Se.disabled&&(F?.(re.date,Se,he),T?.(re.date,Se,he))},[F,T,Ye]),qa=S.useCallback((re,Se)=>he=>{Ye(re),B?.(re.date,Se,he)},[B,Ye]),wn=S.useCallback((re,Se)=>he=>{I(),R?.(re.date,Se,he)},[I,R]),En=S.useCallback((re,Se)=>he=>{const Ee={ArrowLeft:[he.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[he.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[he.shiftKey?"year":"week","after"],ArrowUp:[he.shiftKey?"year":"week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ee[he.key]){he.preventDefault(),he.stopPropagation();const[$e,ve]=Ee[he.key];Oe($e,ve)}Y?.(re.date,Se,he)},[Oe,Y,s.dir]),ul=S.useCallback((re,Se)=>he=>{A?.(re.date,Se,he)},[A]),es=S.useCallback((re,Se)=>he=>{V?.(re.date,Se,he)},[V]),ts=S.useCallback(re=>Se=>{const he=Number(Se.target.value),Ee=h.setMonth(h.startOfMonth(re),he);De(Ee)},[h,De]),qn=S.useCallback(re=>Se=>{const he=Number(Se.target.value),Ee=h.setYear(h.startOfMonth(re),he);De(Ee)},[h,De]),{className:Z,style:Ce}=S.useMemo(()=>({className:[y[ce.Root],s.className].filter(Boolean).join(" "),style:{...w?.[ce.Root],...s.style}}),[y,s.className,s.style,w]),me=b2(s),we=S.useRef(null);K2(we,!!s.animate,{classNames:y,months:D,focused:ae,dateLib:h});const et={dayPickerProps:s,selected:se,select:F,isSelected:Q,months:D,nextMonth:be,previousMonth:ge,goToMonth:De,getModifiers:de,components:u,classNames:y,styles:w,labels:m,formatters:f};return ee.createElement(Gg.Provider,{value:et},ee.createElement(u.Root,{rootRef:s.animate?we:void 0,className:Z,style:Ce,dir:s.dir,id:s.id,lang:s.lang,nonce:s.nonce,title:s.title,role:s.role,"aria-label":s["aria-label"],"aria-labelledby":s["aria-labelledby"],...me},ee.createElement(u.Months,{className:y[ce.Months],style:w?.[ce.Months]},!s.hideNavigation&&!v&&ee.createElement(u.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[ce.Nav],style:w?.[ce.Nav],"aria-label":Ot(),onPreviousClick:ot,onNextClick:Kt,previousMonth:ge,nextMonth:be}),D.map((re,Se)=>ee.createElement(u.Month,{"data-animated-month":s.animate?"true":void 0,className:y[ce.Month],style:w?.[ce.Month],key:Se,displayIndex:Se,calendarMonth:re},v==="around"&&!s.hideNavigation&&Se===0&&ee.createElement(u.PreviousMonthButton,{type:"button",className:y[ce.PreviousMonthButton],tabIndex:ge?void 0:-1,"aria-disabled":ge?void 0:!0,"aria-label":Yt(ge),onClick:ot,"data-animated-button":s.animate?"true":void 0},ee.createElement(u.Chevron,{disabled:ge?void 0:!0,className:y[ce.Chevron],orientation:s.dir==="rtl"?"right":"left"})),ee.createElement(u.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:y[ce.MonthCaption],style:w?.[ce.MonthCaption],calendarMonth:re,displayIndex:Se},N?.startsWith("dropdown")?ee.createElement(u.DropdownNav,{className:y[ce.Dropdowns],style:w?.[ce.Dropdowns]},(()=>{const he=N==="dropdown"||N==="dropdown-months"?ee.createElement(u.MonthsDropdown,{key:"month",className:y[ce.MonthsDropdown],"aria-label":Pe(),classNames:y,components:u,disabled:!!s.disableNavigation,onChange:ts(re.date),options:U2(re.date,$,te,f,h),style:w?.[ce.Dropdown],value:h.getMonth(re.date)}):ee.createElement("span",{key:"month"},P(re.date,h)),Ee=N==="dropdown"||N==="dropdown-years"?ee.createElement(u.YearsDropdown,{key:"year",className:y[ce.YearsDropdown],"aria-label":Gt(h.options),classNames:y,components:u,disabled:!!s.disableNavigation,onChange:qn(re.date),options:q2($,te,f,h,!!s.reverseYears),style:w?.[ce.Dropdown],value:h.getYear(re.date)}):ee.createElement("span",{key:"year"},Be(re.date,h));return h.getMonthYearOrder()==="year-first"?[Ee,he]:[he,Ee]})(),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"}},H(re.date,h.options,h))):ee.createElement(u.CaptionLabel,{className:y[ce.CaptionLabel],role:"status","aria-live":"polite"},H(re.date,h.options,h))),v==="around"&&!s.hideNavigation&&Se===x-1&&ee.createElement(u.NextMonthButton,{type:"button",className:y[ce.NextMonthButton],tabIndex:be?void 0:-1,"aria-disabled":be?void 0:!0,"aria-label":Un(be),onClick:Kt,"data-animated-button":s.animate?"true":void 0},ee.createElement(u.Chevron,{disabled:be?void 0:!0,className:y[ce.Chevron],orientation:s.dir==="rtl"?"left":"right"})),Se===x-1&&v==="after"&&!s.hideNavigation&&ee.createElement(u.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[ce.Nav],style:w?.[ce.Nav],"aria-label":Ot(),onPreviousClick:ot,onNextClick:Kt,previousMonth:ge,nextMonth:be}),ee.createElement(u.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Ke(re.date,h.options,h)||void 0,className:y[ce.MonthGrid],style:w?.[ce.MonthGrid]},!s.hideWeekdays&&ee.createElement(u.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:y[ce.Weekdays],style:w?.[ce.Weekdays]},k&&ee.createElement(u.WeekNumberHeader,{"aria-label":Cn(h.options),className:y[ce.WeekNumberHeader],style:w?.[ce.WeekNumberHeader],scope:"col"},ue()),ca.map(he=>ee.createElement(u.Weekday,{"aria-label":Ne(he,h.options,h),className:y[ce.Weekday],key:String(he),style:w?.[ce.Weekday],scope:"col"},le(he,h.options,h)))),ee.createElement(u.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:y[ce.Weeks],style:w?.[ce.Weeks]},re.weeks.map(he=>ee.createElement(u.Week,{className:y[ce.Week],key:he.weekNumber,style:w?.[ce.Week],week:he},k&&ee.createElement(u.WeekNumber,{week:he,style:w?.[ce.WeekNumber],"aria-label":Lt(he.weekNumber,{locale:p}),className:y[ce.WeekNumber],scope:"row",role:"rowheader"},pe(he.weekNumber,h)),he.days.map(Ee=>{const{date:$e}=Ee,ve=de(Ee);if(ve[at.focused]=!ve.hidden&&!!ae?.isEqualTo(Ee),ve[Sn.selected]=Q?.($e)||ve.selected,Zo(se)){const{from:Qt,to:pn}=se;ve[Sn.range_start]=!!(Qt&&pn&&h.isSameDay($e,Qt)),ve[Sn.range_end]=!!(Qt&&pn&&h.isSameDay($e,pn)),ve[Sn.range_middle]=ra(se,$e,!0,h)}const Et=B2(ve,w,s.modifiersStyles),Yn=v2(ve,y,s.modifiersClassNames),yt=!Bn&&!ve.hidden?pt($e,ve,h.options,h):void 0;return ee.createElement(u.Day,{key:`${Ee.isoDate}_${Ee.displayMonthId}`,day:Ee,modifiers:ve,className:Yn.join(" "),style:Et,role:"gridcell","aria-selected":ve.selected||void 0,"aria-label":yt,"data-day":Ee.isoDate,"data-month":Ee.outside?Ee.dateMonthId:void 0,"data-selected":ve.selected||void 0,"data-disabled":ve.disabled||void 0,"data-hidden":ve.hidden||void 0,"data-outside":Ee.outside||void 0,"data-focused":ve.focused||void 0,"data-today":ve.today||void 0},!ve.hidden&&Bn?ee.createElement(u.DayButton,{className:y[ce.DayButton],style:w?.[ce.DayButton],type:"button",day:Ee,modifiers:ve,disabled:!ve.focused&&ve.disabled||void 0,"aria-disabled":ve.focused&&ve.disabled||void 0,tabIndex:xe(Ee)?0:-1,"aria-label":ht($e,ve,h.options,h),onClick:Hn(Ee,ve),onBlur:wn(Ee,ve),onFocus:qa(Ee,ve),onKeyDown:En(Ee,ve),onMouseEnter:ul(Ee,ve),onMouseLeave:es(Ee,ve)},J($e,h.options,h)):!ve.hidden&&J(Ee.date,h.options,h))})))))))),s.footer&&ee.createElement(u.Footer,{className:y[ce.Footer],style:w?.[ce.Footer],role:"status","aria-live":"polite"},s.footer)))}function cj({className:l,classNames:s,showOutsideDays:r=!0,...u}){return c.jsx(uj,{showOutsideDays:r,className:X("p-2",l),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:X(wo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:X(wo({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:X("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:X(wo({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:X("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:X("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:X("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:X("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",...s},components:{Chevron:({orientation:f,className:m,...h})=>{const p=f==="left"?eb:f==="right"?ko:f==="up"?Tc:Bo;return c.jsx(p,{className:X("h-4 w-4",m),...h})}},...u})}cj.displayName="Calendar";const fj=S.lazy(()=>Mn(()=>import("./analytics-BR435WpH.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),dj=S.lazy(()=>Mn(()=>import("./api-ALobfD8T.js"),__vite__mapDeps([12,1,2,6,13,7,5,10,4,8,3])).then(l=>({default:l.ApiPage}))),mj=S.lazy(()=>Mn(()=>import("./cliproxy-BlkTmqj-.js"),__vite__mapDeps([14,1,2,6,7,5,10,13,4,8,3])).then(l=>({default:l.CliproxyPage}))),hj=S.lazy(()=>Mn(()=>import("./cliproxy-control-panel-CvVI3tSn.js"),__vite__mapDeps([15,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),pj=S.lazy(()=>Mn(()=>import("./copilot-_EhQN_rN.js"),__vite__mapDeps([16,1,2,6,13,5,17,7,4,8,3])).then(l=>({default:l.CopilotPage}))),gj=S.lazy(()=>Mn(()=>import("./accounts-DQwh-CP_.js"),__vite__mapDeps([18,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),yj=S.lazy(()=>Mn(()=>import("./settings-ByVm4JFM.js"),__vite__mapDeps([19,1,2,17,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),vj=S.lazy(()=>Mn(()=>import("./health-CApaflOt.js"),__vite__mapDeps([20,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),xj=S.lazy(()=>Mn(()=>import("./shared-C9bG-pqJ.js"),__vite__mapDeps([21,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function bj(){return c.jsx($v,{client:hb,children:c.jsx(gb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:c.jsx(yb,{children:c.jsxs(Zv,{children:[c.jsx(Wv,{children:c.jsxs(xn,{element:c.jsx(v1,{}),children:[c.jsx(xn,{path:"/",element:c.jsx(eN,{})}),c.jsx(xn,{path:"/analytics",element:c.jsx(fj,{})}),c.jsx(xn,{path:"/providers",element:c.jsx(dj,{})}),c.jsx(xn,{path:"/cliproxy",element:c.jsx(mj,{})}),c.jsx(xn,{path:"/cliproxy/control-panel",element:c.jsx(hj,{})}),c.jsx(xn,{path:"/copilot",element:c.jsx(pj,{})}),c.jsx(xn,{path:"/accounts",element:c.jsx(gj,{})}),c.jsx(xn,{path:"/settings",element:c.jsx(yj,{})}),c.jsx(xn,{path:"/health",element:c.jsx(vj,{})}),c.jsx(xn,{path:"/shared",element:c.jsx(xj,{})})]})}),c.jsx(Fv,{position:"top-right"})]})})})})}const a0=document.getElementById("root");if(!a0)throw new Error("Root element not found. Failed to mount React application.");fb.createRoot(a0).render(c.jsx(S.StrictMode,{children:c.jsx(bj,{})}));export{tg as $,Jb as A,hn as B,cj as C,tN as D,Tg as E,bc as F,Sc as G,Jj as H,Ra as I,Fj as J,Ij as K,An as L,kg as M,Pj as N,eM as O,sM as P,wN as Q,$j as R,nt as S,qo as T,nM as U,EN as V,DN as W,S1 as X,Tj as Y,Rj as Z,eg as _,iM as a,ng as a0,ag as a1,lg as a2,tM as a3,zN as a4,h1 as a5,Uj as a6,Bj as a7,Hj as a8,qj as a9,aM as aa,Yj as ab,Kj as ac,Lj as ad,Gj as ae,Oj as af,_j as ag,kj as ah,Aj as ai,Rg as aj,Mn as ak,wo as al,bt as am,Mg as an,vc as ao,Cg as ap,zg as aq,Og as ar,FS as as,Qj as at,Dg as au,Ib as av,lM as aw,kN as b,X as c,Fp as d,Ha as e,M1 as f,Dj as g,C1 as h,Pl as i,oM as j,Yo as k,Lo as l,ip as m,gN as n,Wj as o,dN as p,Xj as q,Zj as r,iN as s,aN as t,Ac as u,cN as v,mN as w,Vj as x,Zb as y,Wb as z};
46
+ `+Ya[0],yt=we+as.length;En({value:me.substring(0,we)+as+me.substring(et),selectionStart:yt,selectionEnd:yt})}}}else if(Z.keyCode===N||Z.keyCode===C||Z.keyCode===v||Z.keyCode===x){var nn=void 0;Z.keyCode===N&&Z.shiftKey?nn=["(",")"]:Z.keyCode===C?Z.shiftKey?nn=["{","}"]:nn=["[","]"]:Z.keyCode===v?Z.shiftKey?nn=['"','"']:nn=["'","'"]:Z.keyCode===x&&!Z.shiftKey&&(nn=["`","`"]),we!==et&&nn&&(Z.preventDefault(),En({value:me.substring(0,we)+nn[0]+me.substring(we,et)+nn[1]+me.substring(et),selectionStart:we,selectionEnd:et+2}))}else(Y?Z.metaKey&&Z.keyCode===p:Z.ctrlKey&&Z.keyCode===p)&&!Z.shiftKey&&!Z.altKey?(Z.preventDefault(),ul()):(Y?Z.metaKey&&Z.keyCode===p&&Z.shiftKey:B?Z.ctrlKey&&Z.keyCode===h:Z.ctrlKey&&Z.keyCode===p&&Z.shiftKey)&&!Z.altKey?(Z.preventDefault(),es()):Z.keyCode===y&&Z.ctrlKey&&(!Y||Z.shiftKey)&&(Z.preventDefault(),ca(function(Ln){return!Ln}))}},qn=function(Z){var Ce=Z.currentTarget,me=Ce.value,we=Ce.selectionStart,et=Ce.selectionEnd;Hn({value:me,selectionStart:we,selectionEnd:et},!0),F(me)};return m.useEffect(function(){qa()},[qa]),m.useImperativeHandle(H,function(){return{get session(){return{history:Ne.current}},set session(Z){Ne.current=Z.history}}},[]),m.createElement("div",l({},Un,{style:l(l({},K.container),ht)}),m.createElement("pre",l({className:xe,"aria-hidden":"true",style:l(l(l({},K.editor),K.highlight),Bn)},typeof ot=="string"?{dangerouslySetInnerHTML:{__html:ot+"<br />"}}:{children:ot})),m.createElement("textarea",{ref:function(Z){return Lt.current=Z},style:l(l(l({},K.editor),K.textarea),Bn),className:A+(Pe?" ".concat(Pe):""),id:Ot,value:Yt,onChange:qn,onKeyDown:ts,onClick:be,onKeyUp:Q,onFocus:De,onBlur:ge,disabled:P,form:pe,maxLength:D,minLength:$,name:te,placeholder:ae,readOnly:Oe,required:Ye,autoFocus:J,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),m.createElement("style",{dangerouslySetInnerHTML:{__html:V}}))}),K={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 Ht.default=G,Ht}var _N=AN();const lM=Vv(_N),sM=Hv,iM=Yv,oM=qv,kN=S.forwardRef(({className:l,align:s="center",sideOffset:r=4,...u},f)=>c.jsx(Bv,{children:c.jsx(qp,{ref:f,align:s,sideOffset:r,className:X("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",l),...u})}));kN.displayName=qp.displayName;function RN(l,s,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:l,timeZoneName:r}).format(s).split(/\s/g).slice(2).join(" ")}const UN={},ni={};function il(l,s){try{const u=(UN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return u in ni?ni[u]:mp(u,u.split(":"))}catch{if(l in ni)return ni[l];const r=l?.match(BN);return r?mp(l,r.slice(1)):NaN}}const BN=/([+-]\d\d):?(\d\d)?/;function mp(l,s){const r=+(s[0]||0),u=+(s[1]||0),f=+(s[2]||0)/60;return ni[l]=r*60+u>0?r*60+u+f:r*60-u-f}class kn extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(il(this.timeZone,this))?this.setTime(NaN):s.length?typeof s[0]=="number"&&(s.length===1||s.length===2&&typeof s[1]!="number")?this.setTime(s[0]):typeof s[0]=="string"?this.setTime(+new Date(s[0])):s[0]instanceof Date?this.setTime(+s[0]):(this.setTime(+new Date(...s)),Hg(this),jc(this)):this.setTime(Date.now())}static tz(s,...r){return r.length?new kn(...r,s):new kn(Date.now(),s)}withTimeZone(s){return new kn(+this,s)}getTimezoneOffset(){const s=-il(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),jc(this),+this}[Symbol.for("constructDateFrom")](s){return new kn(+new Date(s),this.timeZone)}}const hp=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!hp.test(l))return;const s=l.replace(hp,"$1UTC");kn.prototype[s]&&(l.startsWith("get")?kn.prototype[l]=function(){return this.internal[s]()}:(kn.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),HN(this),+this},kn.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),jc(this),+this}))});function jc(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-il(l.timeZone,l)*60))}function HN(l){Date.prototype.setFullYear.call(l,l.internal.getUTCFullYear(),l.internal.getUTCMonth(),l.internal.getUTCDate()),Date.prototype.setHours.call(l,l.internal.getUTCHours(),l.internal.getUTCMinutes(),l.internal.getUTCSeconds(),l.internal.getUTCMilliseconds()),Hg(l)}function Hg(l){const s=il(l.timeZone,l),r=s>0?Math.floor(s):Math.ceil(s),u=new Date(+l);u.setUTCHours(u.getUTCHours()-1);const f=-new Date(+l).getTimezoneOffset(),m=-new Date(+u).getTimezoneOffset(),h=f-m,p=Date.prototype.getHours.apply(l)!==l.internal.getUTCHours();h&&p&&l.internal.setUTCMinutes(l.internal.getUTCMinutes()+h);const y=f-r;y&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+y);const N=new Date(+l);N.setUTCSeconds(0);const C=f>0?N.getSeconds():(N.getSeconds()-60)%60,v=Math.round(-(il(l.timeZone,l)*60))%60;(v||C)&&(l.internal.setUTCSeconds(l.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(l,Date.prototype.getUTCSeconds.call(l)+v+C));const x=il(l.timeZone,l),R=x>0?Math.floor(x):Math.ceil(x),B=-new Date(+l).getTimezoneOffset()-R,Y=R!==r,A=B-y;if(Y&&A){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+A);const V=il(l.timeZone,l),G=V>0?Math.floor(V):Math.ceil(V),K=R-G;K&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+K),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+K))}}class oa extends kn{static tz(s,...r){return r.length?new oa(...r,s):new oa(Date.now(),s)}toISOString(){const[s,r,u]=this.tzComponents(),f=`${s}${r}:${u}`;return this.internal.toISOString().slice(0,-1)+f}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,r,u,f]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${u} ${r} ${f}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[r,u,f]=this.tzComponents();return`${s} GMT${r}${u}${f} (${RN(this.timeZone,this)})`}toLocaleString(s,r){return Date.prototype.toLocaleString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleDateString(s,r){return Date.prototype.toLocaleDateString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}toLocaleTimeString(s,r){return Date.prototype.toLocaleTimeString.call(this,s,{...r,timeZone:r?.timeZone||this.timeZone})}tzComponents(){const s=this.getTimezoneOffset(),r=s>0?"-":"+",u=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),f=String(Math.abs(s)%60).padStart(2,"0");return[r,u,f]}withTimeZone(s){return new oa(+this,s)}[Symbol.for("constructDateFrom")](s){return new oa(+new Date(s),this.timeZone)}}const pp=5,qN=4;function YN(l,s){const r=s.startOfMonth(l),u=r.getDay()>0?r.getDay():7,f=s.addDays(l,-u+1),m=s.addDays(f,pp*7-1);return s.getMonth(l)===s.getMonth(m)?pp:qN}function qg(l,s){const r=s.startOfMonth(l),u=r.getDay();return u===1?r:u===0?s.addDays(r,-6):s.addDays(r,-1*(u-1))}function LN(l,s){const r=qg(l,s),u=YN(l,s);return s.addDays(r,u*7-1)}const Yg={...Js,labels:{labelDayButton:(l,s,r,u)=>{let f;u&&typeof u.format=="function"?f=u.format.bind(u):f=(h,p)=>Is(h,p,{locale:Js,...r});let m=f(l,"PPPP");return s.today&&(m=`Today, ${m}`),s.selected&&(m=`${m}, selected`),m},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:l=>`Week ${l}`,labelYearDropdown:"Choose the Year",labelGrid:(l,s,r)=>{let u;return r&&typeof r.format=="function"?u=r.format.bind(r):u=(f,m)=>Is(f,m,{locale:Js,...s}),u(l,"LLLL yyyy")},labelGridcell:(l,s,r,u)=>{let f;u&&typeof u.format=="function"?f=u.format.bind(u):f=(h,p)=>Is(h,p,{locale:Js,...r});let m=f(l,"PPPP");return s?.today&&(m=`Today, ${m}`),m},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,r)=>{let u;return r&&typeof r.format=="function"?u=r.format.bind(r):u=(f,m)=>Is(f,m,{locale:Js,...s}),u(l,"cccc")}}};class en{constructor(s,r){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?oa.tz(this.options.timeZone):new this.Date,this.newDate=(u,f,m)=>this.overrides?.newDate?this.overrides.newDate(u,f,m):this.options.timeZone?new oa(u,f,m,this.options.timeZone):new Date(u,f,m),this.addDays=(u,f)=>this.overrides?.addDays?this.overrides.addDays(u,f):ex(u,f),this.addMonths=(u,f)=>this.overrides?.addMonths?this.overrides.addMonths(u,f):tx(u,f),this.addWeeks=(u,f)=>this.overrides?.addWeeks?this.overrides.addWeeks(u,f):nx(u,f),this.addYears=(u,f)=>this.overrides?.addYears?this.overrides.addYears(u,f):ax(u,f),this.differenceInCalendarDays=(u,f)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(u,f):lx(u,f),this.differenceInCalendarMonths=(u,f)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(u,f):sx(u,f),this.eachMonthOfInterval=u=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(u):ix(u),this.eachYearOfInterval=u=>{const f=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(u):ox(u),m=new Set(f.map(p=>this.getYear(p)));if(m.size===f.length)return f;const h=[];return m.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=u=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(u):LN(u,this),this.endOfISOWeek=u=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(u):rx(u),this.endOfMonth=u=>this.overrides?.endOfMonth?this.overrides.endOfMonth(u):ux(u),this.endOfWeek=(u,f)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(u,f):cx(u,this.options),this.endOfYear=u=>this.overrides?.endOfYear?this.overrides.endOfYear(u):fx(u),this.format=(u,f,m)=>{const h=this.overrides?.format?this.overrides.format(u,f,this.options):Is(u,f,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=u=>this.overrides?.getISOWeek?this.overrides.getISOWeek(u):dx(u),this.getMonth=(u,f)=>this.overrides?.getMonth?this.overrides.getMonth(u,this.options):mx(u,this.options),this.getYear=(u,f)=>this.overrides?.getYear?this.overrides.getYear(u,this.options):hx(u,this.options),this.getWeek=(u,f)=>this.overrides?.getWeek?this.overrides.getWeek(u,this.options):px(u,this.options),this.isAfter=(u,f)=>this.overrides?.isAfter?this.overrides.isAfter(u,f):gx(u,f),this.isBefore=(u,f)=>this.overrides?.isBefore?this.overrides.isBefore(u,f):yx(u,f),this.isDate=u=>this.overrides?.isDate?this.overrides.isDate(u):vx(u),this.isSameDay=(u,f)=>this.overrides?.isSameDay?this.overrides.isSameDay(u,f):xx(u,f),this.isSameMonth=(u,f)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(u,f):bx(u,f),this.isSameYear=(u,f)=>this.overrides?.isSameYear?this.overrides.isSameYear(u,f):Sx(u,f),this.max=u=>this.overrides?.max?this.overrides.max(u):Nx(u),this.min=u=>this.overrides?.min?this.overrides.min(u):jx(u),this.setMonth=(u,f)=>this.overrides?.setMonth?this.overrides.setMonth(u,f):Mx(u,f),this.setYear=(u,f)=>this.overrides?.setYear?this.overrides.setYear(u,f):Cx(u,f),this.startOfBroadcastWeek=(u,f)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(u,this):qg(u,this),this.startOfDay=u=>this.overrides?.startOfDay?this.overrides.startOfDay(u):wx(u),this.startOfISOWeek=u=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(u):Ex(u),this.startOfMonth=u=>this.overrides?.startOfMonth?this.overrides.startOfMonth(u):zx(u),this.startOfWeek=(u,f)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(u,this.options):Dx(u,this.options),this.startOfYear=u=>this.overrides?.startOfYear?this.overrides.startOfYear(u):Ox(u),this.options={locale:Yg,...s},this.overrides=r}getDigitMap(){const{numerals:s="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:s}),u={};for(let f=0;f<10;f++)u[f.toString()]=r.format(f);return u}replaceDigits(s){const r=this.getDigitMap();return s.replace(/\d/g,u=>r[u]||u)}formatNumber(s){return this.replaceDigits(s.toString())}getMonthYearOrder(){const s=this.options.locale?.code;return s&&en.yearFirstLocales.has(s)?"year-first":"month-first"}formatMonthYear(s){const{locale:r,timeZone:u,numerals:f}=this.options,m=r?.code;if(m&&en.yearFirstLocales.has(m))try{return new Intl.DateTimeFormat(m,{month:"long",year:"numeric",timeZone:u,numberingSystem:f}).format(s)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(s,h)}}en.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 Rn=new en;class Lg{constructor(s,r,u=Rn){this.date=s,this.displayMonth=r,this.outside=!!(r&&!u.isSameMonth(s,r)),this.dateLib=u,this.isoDate=u.format(s,"yyyy-MM-dd"),this.displayMonthId=u.format(r,"yyyy-MM"),this.dateMonthId=u.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class GN{constructor(s,r){this.date=s,this.weeks=r}}class KN{constructor(s,r){this.days=r,this.weekNumber=s}}function QN(l){return ee.createElement("button",{...l})}function XN(l){return ee.createElement("span",{...l})}function VN(l){const{size:s=24,orientation:r="left",className:u}=l;return ee.createElement("svg",{className:u,width:s,height:s,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 ZN(l){const{day:s,modifiers:r,...u}=l;return ee.createElement("td",{...u})}function WN(l){const{day:s,modifiers:r,...u}=l,f=ee.useRef(null);return ee.useEffect(()=>{r.focused&&f.current?.focus()},[r.focused]),ee.createElement("button",{ref:f,...u})}var ce;(function(l){l.Root="root",l.Chevron="chevron",l.Day="day",l.DayButton="day_button",l.CaptionLabel="caption_label",l.Dropdowns="dropdowns",l.Dropdown="dropdown",l.DropdownRoot="dropdown_root",l.Footer="footer",l.MonthGrid="month_grid",l.MonthCaption="month_caption",l.MonthsDropdown="months_dropdown",l.Month="month",l.Months="months",l.Nav="nav",l.NextMonthButton="button_next",l.PreviousMonthButton="button_previous",l.Week="week",l.Weeks="weeks",l.Weekday="weekday",l.Weekdays="weekdays",l.WeekNumber="week_number",l.WeekNumberHeader="week_number_header",l.YearsDropdown="years_dropdown"})(ce||(ce={}));var at;(function(l){l.disabled="disabled",l.hidden="hidden",l.outside="outside",l.focused="focused",l.today="today"})(at||(at={}));var Sn;(function(l){l.range_end="range_end",l.range_middle="range_middle",l.range_start="range_start",l.selected="selected"})(Sn||(Sn={}));var Pt;(function(l){l.weeks_before_enter="weeks_before_enter",l.weeks_before_exit="weeks_before_exit",l.weeks_after_enter="weeks_after_enter",l.weeks_after_exit="weeks_after_exit",l.caption_after_enter="caption_after_enter",l.caption_after_exit="caption_after_exit",l.caption_before_enter="caption_before_enter",l.caption_before_exit="caption_before_exit"})(Pt||(Pt={}));function JN(l){const{options:s,className:r,components:u,classNames:f,...m}=l,h=[f[ce.Dropdown],r].join(" "),p=s?.find(({value:y})=>y===m.value);return ee.createElement("span",{"data-disabled":m.disabled,className:f[ce.DropdownRoot]},ee.createElement(u.Select,{className:h,...m},s?.map(({value:y,label:N,disabled:C})=>ee.createElement(u.Option,{key:y,value:y,disabled:C},N))),ee.createElement("span",{className:f[ce.CaptionLabel],"aria-hidden":!0},p?.label,ee.createElement(u.Chevron,{orientation:"down",size:18,className:f[ce.Chevron]})))}function $N(l){return ee.createElement("div",{...l})}function FN(l){return ee.createElement("div",{...l})}function IN(l){const{calendarMonth:s,displayIndex:r,...u}=l;return ee.createElement("div",{...u},l.children)}function PN(l){const{calendarMonth:s,displayIndex:r,...u}=l;return ee.createElement("div",{...u})}function e2(l){return ee.createElement("table",{...l})}function t2(l){return ee.createElement("div",{...l})}const Gg=S.createContext(void 0);function oi(){const l=S.useContext(Gg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function n2(l){const{components:s}=oi();return ee.createElement(s.Dropdown,{...l})}function a2(l){const{onPreviousClick:s,onNextClick:r,previousMonth:u,nextMonth:f,...m}=l,{components:h,classNames:p,labels:{labelPrevious:y,labelNext:N}}=oi(),C=S.useCallback(x=>{f&&r?.(x)},[f,r]),v=S.useCallback(x=>{u&&s?.(x)},[u,s]);return ee.createElement("nav",{...m},ee.createElement(h.PreviousMonthButton,{type:"button",className:p[ce.PreviousMonthButton],tabIndex:u?void 0:-1,"aria-disabled":u?void 0:!0,"aria-label":y(u),onClick:v},ee.createElement(h.Chevron,{disabled:u?void 0:!0,className:p[ce.Chevron],orientation:"left"})),ee.createElement(h.NextMonthButton,{type:"button",className:p[ce.NextMonthButton],tabIndex:f?void 0:-1,"aria-disabled":f?void 0:!0,"aria-label":N(f),onClick:C},ee.createElement(h.Chevron,{disabled:f?void 0:!0,orientation:"right",className:p[ce.Chevron]})))}function l2(l){const{components:s}=oi();return ee.createElement(s.Button,{...l})}function s2(l){return ee.createElement("option",{...l})}function i2(l){const{components:s}=oi();return ee.createElement(s.Button,{...l})}function o2(l){const{rootRef:s,...r}=l;return ee.createElement("div",{...r,ref:s})}function r2(l){return ee.createElement("select",{...l})}function u2(l){const{week:s,...r}=l;return ee.createElement("tr",{...r})}function c2(l){return ee.createElement("th",{...l})}function f2(l){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...l}))}function d2(l){const{week:s,...r}=l;return ee.createElement("th",{...r})}function m2(l){return ee.createElement("th",{...l})}function h2(l){return ee.createElement("tbody",{...l})}function p2(l){const{components:s}=oi();return ee.createElement(s.Dropdown,{...l})}const g2=Object.freeze(Object.defineProperty({__proto__:null,Button:QN,CaptionLabel:XN,Chevron:VN,Day:ZN,DayButton:WN,Dropdown:JN,DropdownNav:$N,Footer:FN,Month:IN,MonthCaption:PN,MonthGrid:e2,Months:t2,MonthsDropdown:n2,Nav:a2,NextMonthButton:l2,Option:s2,PreviousMonthButton:i2,Root:o2,Select:r2,Week:u2,WeekNumber:d2,WeekNumberHeader:m2,Weekday:c2,Weekdays:f2,Weeks:h2,YearsDropdown:p2},Symbol.toStringTag,{value:"Module"}));function ra(l,s,r=!1,u=Rn){let{from:f,to:m}=l;const{differenceInCalendarDays:h,isSameDay:p}=u;return f&&m?(h(m,f)<0&&([f,m]=[m,f]),h(s,f)>=(r?1:0)&&h(m,s)>=(r?1:0)):!r&&m?p(m,s):!r&&f?p(f,s):!1}function qc(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function Zo(l){return!!(l&&typeof l=="object"&&"from"in l)}function Yc(l){return!!(l&&typeof l=="object"&&"after"in l)}function Lc(l){return!!(l&&typeof l=="object"&&"before"in l)}function Kg(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function Qg(l,s){return Array.isArray(l)&&l.every(s.isDate)}function ua(l,s,r=Rn){const u=Array.isArray(s)?s:[s],{isSameDay:f,differenceInCalendarDays:m,isAfter:h}=r;return u.some(p=>{if(typeof p=="boolean")return p;if(r.isDate(p))return f(l,p);if(Qg(p,r))return p.some(y=>f(l,y));if(Zo(p))return ra(p,l,!1,r);if(Kg(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(l.getDay()):p.dayOfWeek===l.getDay();if(qc(p)){const y=m(p.before,l),N=m(p.after,l),C=y>0,v=N<0;return h(p.before,p.after)?v&&C:C||v}return Yc(p)?m(l,p.after)>0:Lc(p)?m(p.before,l)>0:typeof p=="function"?p(l):!1})}function y2(l,s,r,u,f){const{disabled:m,hidden:h,modifiers:p,showOutsideDays:y,broadcastCalendar:N,today:C=f.today()}=s,{isSameDay:v,isSameMonth:x,startOfMonth:R,isBefore:T,endOfMonth:B,isAfter:Y}=f,A=r&&R(r),V=u&&B(u),G={[at.focused]:[],[at.outside]:[],[at.disabled]:[],[at.hidden]:[],[at.today]:[]},K={};for(const k of l){const{date:w,displayMonth:H}=k,J=!!(H&&!x(w,H)),P=!!(A&&T(w,A)),pe=!!(V&&Y(w,V)),ue=!!(m&&ua(w,m,f)),le=!!(h&&ua(w,h,f))||P||pe||!N&&!y&&J||N&&y===!1&&J,Be=v(w,C);J&&G.outside.push(k),ue&&G.disabled.push(k),le&&G.hidden.push(k),Be&&G.today.push(k),p&&Object.keys(p).forEach(W=>{const ie=p?.[W];ie&&ua(w,ie,f)&&(K[W]?K[W].push(k):K[W]=[k])})}return k=>{const w={[at.focused]:!1,[at.disabled]:!1,[at.hidden]:!1,[at.outside]:!1,[at.today]:!1},H={};for(const J in G){const P=G[J];w[J]=P.some(pe=>pe===k)}for(const J in K)H[J]=K[J].some(P=>P===k);return{...w,...H}}}function v2(l,s,r={}){return Object.entries(l).filter(([,f])=>f===!0).reduce((f,[m])=>(r[m]?f.push(r[m]):s[at[m]]?f.push(s[at[m]]):s[Sn[m]]&&f.push(s[Sn[m]]),f),[s[ce.Day]])}function x2(l){return{...g2,...l}}function b2(l){const s={"data-mode":l.mode??void 0,"data-required":"required"in l?l.required:void 0,"data-multiple-months":l.numberOfMonths&&l.numberOfMonths>1||void 0,"data-week-numbers":l.showWeekNumber||void 0,"data-broadcast-calendar":l.broadcastCalendar||void 0,"data-nav-layout":l.navLayout||void 0};return Object.entries(l).forEach(([r,u])=>{r.startsWith("data-")&&(s[r]=u)}),s}function S2(){const l={};for(const s in ce)l[ce[s]]=`rdp-${ce[s]}`;for(const s in at)l[at[s]]=`rdp-${at[s]}`;for(const s in Sn)l[Sn[s]]=`rdp-${Sn[s]}`;for(const s in Pt)l[Pt[s]]=`rdp-${Pt[s]}`;return l}function Xg(l,s,r){return(r??new en(s)).formatMonthYear(l)}const N2=Xg;function j2(l,s,r){return(r??new en(s)).format(l,"d")}function M2(l,s=Rn){return s.format(l,"LLLL")}function C2(l,s,r){return(r??new en(s)).format(l,"cccccc")}function w2(l,s=Rn){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function E2(){return""}function Vg(l,s=Rn){return s.format(l,"yyyy")}const z2=Vg,D2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Xg,formatDay:j2,formatMonthCaption:N2,formatMonthDropdown:M2,formatWeekNumber:w2,formatWeekNumberHeader:E2,formatWeekdayName:C2,formatYearCaption:z2,formatYearDropdown:Vg},Symbol.toStringTag,{value:"Module"}));function O2(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...D2,...l}}function Gc(l,s,r,u){let f=(u??new en(r)).format(l,"PPPP");return s.today&&(f=`Today, ${f}`),s.selected&&(f=`${f}, selected`),f}const T2=Gc;function Kc(l,s,r){return(r??new en(s)).formatMonthYear(l)}const A2=Kc;function Zg(l,s,r,u){let f=(u??new en(r)).format(l,"PPPP");return s?.today&&(f=`Today, ${f}`),f}function Wg(l){return"Choose the Month"}function Jg(){return""}const _2="Go to the Next Month";function $g(l,s){return _2}function Fg(l){return"Go to the Previous Month"}function Ig(l,s,r){return(r??new en(s)).format(l,"cccc")}function Pg(l,s){return`Week ${l}`}function e0(l){return"Week Number"}function t0(l){return"Choose the Year"}const k2=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:A2,labelDay:T2,labelDayButton:Gc,labelGrid:Kc,labelGridcell:Zg,labelMonthDropdown:Wg,labelNav:Jg,labelNext:$g,labelPrevious:Fg,labelWeekNumber:Pg,labelWeekNumberHeader:e0,labelWeekday:Ig,labelYearDropdown:t0},Symbol.toStringTag,{value:"Module"})),bn=(l,s,r)=>s||(r?typeof r=="function"?r:(...u)=>r:l);function R2(l,s){const r=s.locale?.labels??{};return{...k2,...l??{},labelDayButton:bn(Gc,l?.labelDayButton,r.labelDayButton),labelMonthDropdown:bn(Wg,l?.labelMonthDropdown,r.labelMonthDropdown),labelNext:bn($g,l?.labelNext,r.labelNext),labelPrevious:bn(Fg,l?.labelPrevious,r.labelPrevious),labelWeekNumber:bn(Pg,l?.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:bn(t0,l?.labelYearDropdown,r.labelYearDropdown),labelGrid:bn(Kc,l?.labelGrid,r.labelGrid),labelGridcell:bn(Zg,l?.labelGridcell,r.labelGridcell),labelNav:bn(Jg,l?.labelNav,r.labelNav),labelWeekNumberHeader:bn(e0,l?.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:bn(Ig,l?.labelWeekday,r.labelWeekday)}}function U2(l,s,r,u,f){const{startOfMonth:m,startOfYear:h,endOfYear:p,eachMonthOfInterval:y,getMonth:N}=f;return y({start:h(l),end:p(l)}).map(x=>{const R=u.formatMonthDropdown(x,f),T=N(x),B=s&&x<m(s)||r&&x>m(r)||!1;return{value:T,label:R,disabled:B}})}function B2(l,s={},r={}){let u={...s?.[ce.Day]};return Object.entries(l).filter(([,f])=>f===!0).forEach(([f])=>{u={...u,...r?.[f]}}),u}function H2(l,s,r,u){const f=u??l.today(),m=r?l.startOfBroadcastWeek(f,l):s?l.startOfISOWeek(f):l.startOfWeek(f),h=[];for(let p=0;p<7;p++){const y=l.addDays(m,p);h.push(y)}return h}function q2(l,s,r,u,f=!1){if(!l||!s)return;const{startOfYear:m,endOfYear:h,eachYearOfInterval:p,getYear:y}=u,N=m(l),C=h(s),v=p({start:N,end:C});return f&&v.reverse(),v.map(x=>{const R=r.formatYearDropdown(x,u);return{value:y(x),label:R,disabled:!1}})}const ri=l=>l instanceof HTMLElement?l:null,mc=l=>[...l.querySelectorAll("[data-animated-month]")??[]],Y2=l=>ri(l.querySelector("[data-animated-month]")),hc=l=>ri(l.querySelector("[data-animated-caption]")),pc=l=>ri(l.querySelector("[data-animated-weeks]")),L2=l=>ri(l.querySelector("[data-animated-nav]")),G2=l=>ri(l.querySelector("[data-animated-weekdays]"));function K2(l,s,{classNames:r,months:u,focused:f,dateLib:m}){const h=S.useRef(null),p=S.useRef(u),y=S.useRef(!1);S.useLayoutEffect(()=>{const N=p.current;if(p.current=u,!s||!l.current||!(l.current instanceof HTMLElement)||u.length===0||N.length===0||u.length!==N.length)return;const C=m.isSameMonth(u[0].date,N[0].date),v=m.isAfter(u[0].date,N[0].date),x=v?r[Pt.caption_after_enter]:r[Pt.caption_before_enter],R=v?r[Pt.weeks_after_enter]:r[Pt.weeks_before_enter],T=h.current,B=l.current.cloneNode(!0);if(B instanceof HTMLElement?(mc(B).forEach(G=>{if(!(G instanceof HTMLElement))return;const K=Y2(G);K&&G.contains(K)&&G.removeChild(K);const k=hc(G);k&&k.classList.remove(x);const w=pc(G);w&&w.classList.remove(R)}),h.current=B):h.current=null,y.current||C||f)return;const Y=T instanceof HTMLElement?mc(T):[],A=mc(l.current);if(A?.every(V=>V instanceof HTMLElement)&&Y&&Y.every(V=>V instanceof HTMLElement)){y.current=!0,l.current.style.isolation="isolate";const V=L2(l.current);V&&(V.style.zIndex="1"),A.forEach((G,K)=>{const k=Y[K];if(!k)return;G.style.position="relative",G.style.overflow="hidden";const w=hc(G);w&&w.classList.add(x);const H=pc(G);H&&H.classList.add(R);const J=()=>{y.current=!1,l.current&&(l.current.style.isolation=""),V&&(V.style.zIndex=""),w&&w.classList.remove(x),H&&H.classList.remove(R),G.style.position="",G.style.overflow="",G.contains(k)&&G.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const P=G2(k);P&&(P.style.opacity="0");const pe=hc(k);pe&&(pe.classList.add(v?r[Pt.caption_before_exit]:r[Pt.caption_after_exit]),pe.addEventListener("animationend",J));const ue=pc(k);ue&&ue.classList.add(v?r[Pt.weeks_before_exit]:r[Pt.weeks_after_exit]),G.insertBefore(k,G.firstChild)})}})}function Q2(l,s,r,u){const f=l[0],m=l[l.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:y}=r??{},{addDays:N,differenceInCalendarDays:C,differenceInCalendarMonths:v,endOfBroadcastWeek:x,endOfISOWeek:R,endOfMonth:T,endOfWeek:B,isAfter:Y,startOfBroadcastWeek:A,startOfISOWeek:V,startOfWeek:G}=u,K=y?A(f,u):h?V(f):G(f),k=y?x(m):h?R(T(m)):B(T(m)),w=s&&(y?x(s):h?R(s):B(s)),H=w&&Y(k,w)?w:k,J=C(H,K),P=v(m,f)+1,pe=[];for(let Be=0;Be<=J;Be++){const W=N(K,Be);pe.push(W)}const le=(y?35:42)*P;if(p&&pe.length<le){const Be=le-pe.length;for(let W=0;W<Be;W++){const ie=N(pe[pe.length-1],1);pe.push(ie)}}return pe}function X2(l){const s=[];return l.reduce((r,u)=>{const f=u.weeks.reduce((m,h)=>m.concat(h.days.slice()),s.slice());return r.concat(f.slice())},s.slice())}function V2(l,s,r,u){const{numberOfMonths:f=1}=r,m=[];for(let h=0;h<f;h++){const p=u.addMonths(l,h);if(s&&p>s)break;m.push(p)}return m}function gp(l,s,r,u){const{month:f,defaultMonth:m,today:h=u.today(),numberOfMonths:p=1}=l;let y=f||m||h;const{differenceInCalendarMonths:N,addMonths:C,startOfMonth:v}=u;if(r&&N(r,y)<p-1){const x=-1*(p-1);y=C(r,x)}return s&&N(y,s)<0&&(y=s),v(y)}function Z2(l,s,r,u){const{addDays:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:p,endOfWeek:y,getISOWeek:N,getWeek:C,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:R}=u,T=l.reduce((B,Y)=>{const A=r.broadcastCalendar?v(Y,u):r.ISOWeek?x(Y):R(Y),V=r.broadcastCalendar?m(Y):r.ISOWeek?h(p(Y)):y(p(Y)),G=s.filter(H=>H>=A&&H<=V),K=r.broadcastCalendar?35:42;if(r.fixedWeeks&&G.length<K){const H=s.filter(J=>{const P=K-G.length;return J>V&&J<=f(V,P)});G.push(...H)}const k=G.reduce((H,J)=>{const P=r.ISOWeek?N(J):C(J),pe=H.find(le=>le.weekNumber===P),ue=new Lg(J,Y,u);return pe?pe.days.push(ue):H.push(new KN(P,[ue])),H},[]),w=new GN(Y,k);return B.push(w),B},[]);return r.reverseMonths?T.reverse():T}function W2(l,s){let{startMonth:r,endMonth:u}=l;const{startOfYear:f,startOfDay:m,startOfMonth:h,endOfMonth:p,addYears:y,endOfYear:N,newDate:C,today:v}=s,{fromYear:x,toYear:R,fromMonth:T,toMonth:B}=l;!r&&T&&(r=T),!r&&x&&(r=s.newDate(x,0,1)),!u&&B&&(u=B),!u&&R&&(u=C(R,11,31));const Y=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return r?r=h(r):x?r=C(x,0,1):!r&&Y&&(r=f(y(l.today??v(),-100))),u?u=p(u):R?u=C(R,11,31):!u&&Y&&(u=N(l.today??v())),[r&&m(r),u&&m(u)]}function J2(l,s,r,u){if(r.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m=1}=r,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=u,N=f?m:1,C=h(l);if(!s)return p(C,N);if(!(y(s,l)<m))return p(C,N)}function $2(l,s,r,u){if(r.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m}=r,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=u,N=f?m??1:1,C=h(l);if(!s)return p(C,-N);if(!(y(C,s)<=0))return p(C,-N)}function F2(l){const s=[];return l.reduce((r,u)=>r.concat(u.weeks.slice()),s.slice())}function Wo(l,s){const[r,u]=S.useState(l);return[s===void 0?r:s,u]}function I2(l,s){const[r,u]=W2(l,s),{startOfMonth:f,endOfMonth:m}=s,h=gp(l,r,u,s),[p,y]=Wo(h,l.month?h:void 0);S.useEffect(()=>{const K=gp(l,r,u,s);y(K)},[l.timeZone]);const{months:N,weeks:C,days:v,previousMonth:x,nextMonth:R}=S.useMemo(()=>{const K=V2(p,u,{numberOfMonths:l.numberOfMonths},s),k=Q2(K,l.endMonth?m(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),w=Z2(K,k,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),H=F2(w),J=X2(w),P=$2(p,r,l,s),pe=J2(p,u,l,s);return{months:w,weeks:H,days:J,previousMonth:P,nextMonth:pe}},[s,p.getTime(),u?.getTime(),r?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:T,onMonthChange:B}=l,Y=K=>C.some(k=>k.days.some(w=>w.isEqualTo(K))),A=K=>{if(T)return;let k=f(K);r&&k<f(r)&&(k=f(r)),u&&k>f(u)&&(k=f(u)),y(k),B?.(k)};return{months:N,weeks:C,days:v,navStart:r,navEnd:u,previousMonth:x,nextMonth:R,goToMonth:A,goToDay:K=>{Y(K)||A(K.date)}}}var _n;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(_n||(_n={}));function yp(l){return!l[at.disabled]&&!l[at.hidden]&&!l[at.outside]}function P2(l,s,r,u){let f,m=-1;for(const h of l){const p=s(h);yp(p)&&(p[at.focused]&&m<_n.FocusedModifier?(f=h,m=_n.FocusedModifier):u?.isEqualTo(h)&&m<_n.LastFocused?(f=h,m=_n.LastFocused):r(h.date)&&m<_n.Selected?(f=h,m=_n.Selected):p[at.today]&&m<_n.Today&&(f=h,m=_n.Today))}return f||(f=l.find(h=>yp(s(h)))),f}function ej(l,s,r,u,f,m,h){const{ISOWeek:p,broadcastCalendar:y}=m,{addDays:N,addMonths:C,addWeeks:v,addYears:x,endOfBroadcastWeek:R,endOfISOWeek:T,endOfWeek:B,max:Y,min:A,startOfBroadcastWeek:V,startOfISOWeek:G,startOfWeek:K}=h;let w={day:N,week:v,month:C,year:x,startOfWeek:H=>y?V(H,h):p?G(H):K(H),endOfWeek:H=>y?R(H):p?T(H):B(H)}[l](r,s==="after"?1:-1);return s==="before"&&u?w=Y([u,w]):s==="after"&&f&&(w=A([f,w])),w}function n0(l,s,r,u,f,m,h,p=0){if(p>365)return;const y=ej(l,s,r.date,u,f,m,h),N=!!(m.disabled&&ua(y,m.disabled,h)),C=!!(m.hidden&&ua(y,m.hidden,h)),v=y,x=new Lg(y,v,h);return!N&&!C?x:n0(l,s,x,u,f,m,h,p+1)}function tj(l,s,r,u,f){const{autoFocus:m}=l,[h,p]=S.useState(),y=P2(s.days,r,u||(()=>!1),h),[N,C]=S.useState(m?y:void 0);return{isFocusTarget:B=>!!y?.isEqualTo(B),setFocused:C,focused:N,blur:()=>{p(N),C(void 0)},moveFocus:(B,Y)=>{if(!N)return;const A=n0(B,Y,N,s.navStart,s.navEnd,l,f);A&&(l.disableNavigation&&!s.days.some(G=>G.isEqualTo(A))||(s.goToDay(A),C(A)))}}}function nj(l,s){const{selected:r,required:u,onSelect:f}=l,[m,h]=Wo(r,f?r:void 0),p=f?r:m,{isSameDay:y}=s,N=R=>p?.some(T=>y(T,R))??!1,{min:C,max:v}=l;return{selected:p,select:(R,T,B)=>{let Y=[...p??[]];if(N(R)){if(p?.length===C||u&&p?.length===1)return;Y=p?.filter(A=>!y(A,R))}else p?.length===v?Y=[R]:Y=[...Y,R];return f||h(Y),f?.(Y,R,T,B),Y},isSelected:N}}function aj(l,s,r=0,u=0,f=!1,m=Rn){const{from:h,to:p}=s||{},{isSameDay:y,isAfter:N,isBefore:C}=m;let v;if(!h&&!p)v={from:l,to:r>0?void 0:l};else if(h&&!p)y(h,l)?r===0?v={from:h,to:l}:f?v={from:h,to:void 0}:v=void 0:C(l,h)?v={from:l,to:h}:v={from:h,to:l};else if(h&&p)if(y(h,l)&&y(p,l))f?v={from:h,to:p}:v=void 0;else if(y(h,l))v={from:h,to:r>0?void 0:l};else if(y(p,l))v={from:l,to:r>0?void 0:l};else if(C(l,h))v={from:l,to:p};else if(N(l,h))v={from:h,to:l};else if(N(l,p))v={from:h,to:l};else throw new Error("Invalid range");if(v?.from&&v?.to){const x=m.differenceInCalendarDays(v.to,v.from);u>0&&x>u?v={from:l,to:void 0}:r>1&&x<r&&(v={from:l,to:void 0})}return v}function lj(l,s,r=Rn){const u=Array.isArray(s)?s:[s];let f=l.from;const m=r.differenceInCalendarDays(l.to,l.from),h=Math.min(m,6);for(let p=0;p<=h;p++){if(u.includes(f.getDay()))return!0;f=r.addDays(f,1)}return!1}function vp(l,s,r=Rn){return ra(l,s.from,!1,r)||ra(l,s.to,!1,r)||ra(s,l.from,!1,r)||ra(s,l.to,!1,r)}function sj(l,s,r=Rn){const u=Array.isArray(s)?s:[s];if(u.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:r.isDate(p)?ra(l,p,!1,r):Qg(p,r)?p.some(y=>ra(l,y,!1,r)):Zo(p)?p.from&&p.to?vp(l,{from:p.from,to:p.to},r):!1:Kg(p)?lj(l,p.dayOfWeek,r):qc(p)?r.isAfter(p.before,p.after)?vp(l,{from:r.addDays(p.after,1),to:r.addDays(p.before,-1)},r):ua(l.from,p,r)||ua(l.to,p,r):Yc(p)||Lc(p)?ua(l.from,p,r)||ua(l.to,p,r):!1))return!0;const h=u.filter(p=>typeof p=="function");if(h.length){let p=l.from;const y=r.differenceInCalendarDays(l.to,l.from);for(let N=0;N<=y;N++){if(h.some(C=>C(p)))return!0;p=r.addDays(p,1)}}return!1}function ij(l,s){const{disabled:r,excludeDisabled:u,selected:f,required:m,onSelect:h}=l,[p,y]=Wo(f,h?f:void 0),N=h?f:p;return{selected:N,select:(x,R,T)=>{const{min:B,max:Y}=l,A=x?aj(x,N,B,Y,m,s):void 0;return u&&r&&A?.from&&A.to&&sj({from:A.from,to:A.to},r,s)&&(A.from=x,A.to=void 0),h||y(A),h?.(A,x,R,T),A},isSelected:x=>N&&ra(N,x,!1,s)}}function oj(l,s){const{selected:r,required:u,onSelect:f}=l,[m,h]=Wo(r,f?r:void 0),p=f?r:m,{isSameDay:y}=s;return{selected:p,select:(v,x,R)=>{let T=v;return!u&&p&&p&&y(v,p)&&(T=void 0),f||h(T),f?.(T,v,x,R),T},isSelected:v=>p?y(p,v):!1}}function rj(l,s){const r=oj(l,s),u=nj(l,s),f=ij(l,s);switch(l.mode){case"single":return r;case"multiple":return u;case"range":return f;default:return}}function wt(l,s){return l instanceof oa&&l.timeZone===s?l:new oa(l,s)}function xp(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?wt(l,s):Array.isArray(l)?l.map(r=>r instanceof Date?wt(r,s):r):Zo(l)?{...l,from:l.from?wt(l.from,s):l.from,to:l.to?wt(l.to,s):l.to}:qc(l)?{before:wt(l.before,s),after:wt(l.after,s)}:Yc(l)?{after:wt(l.after,s)}:Lc(l)?{before:wt(l.before,s)}:l}function gc(l,s){return l&&(Array.isArray(l)?l.map(r=>xp(r,s)):xp(l,s))}function uj(l){let s=l;const r=s.timeZone;if(r&&(s={...l,timeZone:r},s.today&&(s.today=wt(s.today,r)),s.month&&(s.month=wt(s.month,r)),s.defaultMonth&&(s.defaultMonth=wt(s.defaultMonth,r)),s.startMonth&&(s.startMonth=wt(s.startMonth,r)),s.endMonth&&(s.endMonth=wt(s.endMonth,r)),s.mode==="single"&&s.selected?s.selected=wt(s.selected,r):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(re=>wt(re,r)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?wt(s.selected.from,r):s.selected.from,to:s.selected.to?wt(s.selected.to,r):s.selected.to}),s.disabled!==void 0&&(s.disabled=gc(s.disabled,r)),s.hidden!==void 0&&(s.hidden=gc(s.hidden,r)),s.modifiers)){const re={};Object.keys(s.modifiers).forEach(Se=>{re[Se]=gc(s.modifiers?.[Se],r)}),s.modifiers=re}const{components:u,formatters:f,labels:m,dateLib:h,locale:p,classNames:y}=S.useMemo(()=>{const re={...Yg,...s.locale},Se=new en({locale:re,weekStartsOn:s.broadcastCalendar?1:s.weekStartsOn,firstWeekContainsDate:s.firstWeekContainsDate,useAdditionalWeekYearTokens:s.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:s.useAdditionalDayOfYearTokens,timeZone:s.timeZone,numerals:s.numerals},s.dateLib);return{dateLib:Se,components:x2(s.components),formatters:O2(s.formatters),labels:R2(s.labels,Se.options),locale:re,classNames:{...S2(),...s.classNames}}},[s.locale,s.broadcastCalendar,s.weekStartsOn,s.firstWeekContainsDate,s.useAdditionalWeekYearTokens,s.useAdditionalDayOfYearTokens,s.timeZone,s.numerals,s.dateLib,s.components,s.formatters,s.labels,s.classNames]);s.today||(s={...s,today:h.today()});const{captionLayout:N,mode:C,navLayout:v,numberOfMonths:x=1,onDayBlur:R,onDayClick:T,onDayFocus:B,onDayKeyDown:Y,onDayMouseEnter:A,onDayMouseLeave:V,onNextClick:G,onPrevClick:K,showWeekNumber:k,styles:w}=s,{formatCaption:H,formatDay:J,formatMonthDropdown:P,formatWeekNumber:pe,formatWeekNumberHeader:ue,formatWeekdayName:le,formatYearDropdown:Be}=f,W=I2(s,h),{days:ie,months:D,navStart:$,navEnd:te,previousMonth:ge,nextMonth:be,goToMonth:De}=W,de=y2(ie,s,$,te,h),{isSelected:Q,select:F,selected:se}=rj(s,h)??{},{blur:I,focused:ae,isFocusTarget:xe,moveFocus:Oe,setFocused:Ye}=tj(s,W,de,Q??(()=>!1),h),{labelDayButton:ht,labelGridcell:pt,labelGrid:Ke,labelMonthDropdown:Pe,labelNav:Ot,labelPrevious:Yt,labelNext:Un,labelWeekday:Ne,labelWeekNumber:Lt,labelWeekNumberHeader:Cn,labelYearDropdown:Gt}=m,ca=S.useMemo(()=>H2(h,s.ISOWeek,s.broadcastCalendar,s.today),[h,s.ISOWeek,s.broadcastCalendar,s.today]),Bn=C!==void 0||T!==void 0,ot=S.useCallback(()=>{ge&&(De(ge),K?.(ge))},[ge,De,K]),Kt=S.useCallback(()=>{be&&(De(be),G?.(be))},[De,be,G]),Hn=S.useCallback((re,Se)=>he=>{he.preventDefault(),he.stopPropagation(),Ye(re),!Se.disabled&&(F?.(re.date,Se,he),T?.(re.date,Se,he))},[F,T,Ye]),qa=S.useCallback((re,Se)=>he=>{Ye(re),B?.(re.date,Se,he)},[B,Ye]),wn=S.useCallback((re,Se)=>he=>{I(),R?.(re.date,Se,he)},[I,R]),En=S.useCallback((re,Se)=>he=>{const Ee={ArrowLeft:[he.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[he.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[he.shiftKey?"year":"week","after"],ArrowUp:[he.shiftKey?"year":"week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ee[he.key]){he.preventDefault(),he.stopPropagation();const[$e,ve]=Ee[he.key];Oe($e,ve)}Y?.(re.date,Se,he)},[Oe,Y,s.dir]),ul=S.useCallback((re,Se)=>he=>{A?.(re.date,Se,he)},[A]),es=S.useCallback((re,Se)=>he=>{V?.(re.date,Se,he)},[V]),ts=S.useCallback(re=>Se=>{const he=Number(Se.target.value),Ee=h.setMonth(h.startOfMonth(re),he);De(Ee)},[h,De]),qn=S.useCallback(re=>Se=>{const he=Number(Se.target.value),Ee=h.setYear(h.startOfMonth(re),he);De(Ee)},[h,De]),{className:Z,style:Ce}=S.useMemo(()=>({className:[y[ce.Root],s.className].filter(Boolean).join(" "),style:{...w?.[ce.Root],...s.style}}),[y,s.className,s.style,w]),me=b2(s),we=S.useRef(null);K2(we,!!s.animate,{classNames:y,months:D,focused:ae,dateLib:h});const et={dayPickerProps:s,selected:se,select:F,isSelected:Q,months:D,nextMonth:be,previousMonth:ge,goToMonth:De,getModifiers:de,components:u,classNames:y,styles:w,labels:m,formatters:f};return ee.createElement(Gg.Provider,{value:et},ee.createElement(u.Root,{rootRef:s.animate?we:void 0,className:Z,style:Ce,dir:s.dir,id:s.id,lang:s.lang,nonce:s.nonce,title:s.title,role:s.role,"aria-label":s["aria-label"],"aria-labelledby":s["aria-labelledby"],...me},ee.createElement(u.Months,{className:y[ce.Months],style:w?.[ce.Months]},!s.hideNavigation&&!v&&ee.createElement(u.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[ce.Nav],style:w?.[ce.Nav],"aria-label":Ot(),onPreviousClick:ot,onNextClick:Kt,previousMonth:ge,nextMonth:be}),D.map((re,Se)=>ee.createElement(u.Month,{"data-animated-month":s.animate?"true":void 0,className:y[ce.Month],style:w?.[ce.Month],key:Se,displayIndex:Se,calendarMonth:re},v==="around"&&!s.hideNavigation&&Se===0&&ee.createElement(u.PreviousMonthButton,{type:"button",className:y[ce.PreviousMonthButton],tabIndex:ge?void 0:-1,"aria-disabled":ge?void 0:!0,"aria-label":Yt(ge),onClick:ot,"data-animated-button":s.animate?"true":void 0},ee.createElement(u.Chevron,{disabled:ge?void 0:!0,className:y[ce.Chevron],orientation:s.dir==="rtl"?"right":"left"})),ee.createElement(u.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:y[ce.MonthCaption],style:w?.[ce.MonthCaption],calendarMonth:re,displayIndex:Se},N?.startsWith("dropdown")?ee.createElement(u.DropdownNav,{className:y[ce.Dropdowns],style:w?.[ce.Dropdowns]},(()=>{const he=N==="dropdown"||N==="dropdown-months"?ee.createElement(u.MonthsDropdown,{key:"month",className:y[ce.MonthsDropdown],"aria-label":Pe(),classNames:y,components:u,disabled:!!s.disableNavigation,onChange:ts(re.date),options:U2(re.date,$,te,f,h),style:w?.[ce.Dropdown],value:h.getMonth(re.date)}):ee.createElement("span",{key:"month"},P(re.date,h)),Ee=N==="dropdown"||N==="dropdown-years"?ee.createElement(u.YearsDropdown,{key:"year",className:y[ce.YearsDropdown],"aria-label":Gt(h.options),classNames:y,components:u,disabled:!!s.disableNavigation,onChange:qn(re.date),options:q2($,te,f,h,!!s.reverseYears),style:w?.[ce.Dropdown],value:h.getYear(re.date)}):ee.createElement("span",{key:"year"},Be(re.date,h));return h.getMonthYearOrder()==="year-first"?[Ee,he]:[he,Ee]})(),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"}},H(re.date,h.options,h))):ee.createElement(u.CaptionLabel,{className:y[ce.CaptionLabel],role:"status","aria-live":"polite"},H(re.date,h.options,h))),v==="around"&&!s.hideNavigation&&Se===x-1&&ee.createElement(u.NextMonthButton,{type:"button",className:y[ce.NextMonthButton],tabIndex:be?void 0:-1,"aria-disabled":be?void 0:!0,"aria-label":Un(be),onClick:Kt,"data-animated-button":s.animate?"true":void 0},ee.createElement(u.Chevron,{disabled:be?void 0:!0,className:y[ce.Chevron],orientation:s.dir==="rtl"?"left":"right"})),Se===x-1&&v==="after"&&!s.hideNavigation&&ee.createElement(u.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[ce.Nav],style:w?.[ce.Nav],"aria-label":Ot(),onPreviousClick:ot,onNextClick:Kt,previousMonth:ge,nextMonth:be}),ee.createElement(u.MonthGrid,{role:"grid","aria-multiselectable":C==="multiple"||C==="range","aria-label":Ke(re.date,h.options,h)||void 0,className:y[ce.MonthGrid],style:w?.[ce.MonthGrid]},!s.hideWeekdays&&ee.createElement(u.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:y[ce.Weekdays],style:w?.[ce.Weekdays]},k&&ee.createElement(u.WeekNumberHeader,{"aria-label":Cn(h.options),className:y[ce.WeekNumberHeader],style:w?.[ce.WeekNumberHeader],scope:"col"},ue()),ca.map(he=>ee.createElement(u.Weekday,{"aria-label":Ne(he,h.options,h),className:y[ce.Weekday],key:String(he),style:w?.[ce.Weekday],scope:"col"},le(he,h.options,h)))),ee.createElement(u.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:y[ce.Weeks],style:w?.[ce.Weeks]},re.weeks.map(he=>ee.createElement(u.Week,{className:y[ce.Week],key:he.weekNumber,style:w?.[ce.Week],week:he},k&&ee.createElement(u.WeekNumber,{week:he,style:w?.[ce.WeekNumber],"aria-label":Lt(he.weekNumber,{locale:p}),className:y[ce.WeekNumber],scope:"row",role:"rowheader"},pe(he.weekNumber,h)),he.days.map(Ee=>{const{date:$e}=Ee,ve=de(Ee);if(ve[at.focused]=!ve.hidden&&!!ae?.isEqualTo(Ee),ve[Sn.selected]=Q?.($e)||ve.selected,Zo(se)){const{from:Qt,to:pn}=se;ve[Sn.range_start]=!!(Qt&&pn&&h.isSameDay($e,Qt)),ve[Sn.range_end]=!!(Qt&&pn&&h.isSameDay($e,pn)),ve[Sn.range_middle]=ra(se,$e,!0,h)}const Et=B2(ve,w,s.modifiersStyles),Yn=v2(ve,y,s.modifiersClassNames),yt=!Bn&&!ve.hidden?pt($e,ve,h.options,h):void 0;return ee.createElement(u.Day,{key:`${Ee.isoDate}_${Ee.displayMonthId}`,day:Ee,modifiers:ve,className:Yn.join(" "),style:Et,role:"gridcell","aria-selected":ve.selected||void 0,"aria-label":yt,"data-day":Ee.isoDate,"data-month":Ee.outside?Ee.dateMonthId:void 0,"data-selected":ve.selected||void 0,"data-disabled":ve.disabled||void 0,"data-hidden":ve.hidden||void 0,"data-outside":Ee.outside||void 0,"data-focused":ve.focused||void 0,"data-today":ve.today||void 0},!ve.hidden&&Bn?ee.createElement(u.DayButton,{className:y[ce.DayButton],style:w?.[ce.DayButton],type:"button",day:Ee,modifiers:ve,disabled:!ve.focused&&ve.disabled||void 0,"aria-disabled":ve.focused&&ve.disabled||void 0,tabIndex:xe(Ee)?0:-1,"aria-label":ht($e,ve,h.options,h),onClick:Hn(Ee,ve),onBlur:wn(Ee,ve),onFocus:qa(Ee,ve),onKeyDown:En(Ee,ve),onMouseEnter:ul(Ee,ve),onMouseLeave:es(Ee,ve)},J($e,h.options,h)):!ve.hidden&&J(Ee.date,h.options,h))})))))))),s.footer&&ee.createElement(u.Footer,{className:y[ce.Footer],style:w?.[ce.Footer],role:"status","aria-live":"polite"},s.footer)))}function cj({className:l,classNames:s,showOutsideDays:r=!0,...u}){return c.jsx(uj,{showOutsideDays:r,className:X("p-2",l),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:X(wo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:X(wo({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:X("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:X(wo({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:X("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:X("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:X("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:X("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",...s},components:{Chevron:({orientation:f,className:m,...h})=>{const p=f==="left"?eb:f==="right"?ko:f==="up"?Tc:Bo;return c.jsx(p,{className:X("h-4 w-4",m),...h})}},...u})}cj.displayName="Calendar";const fj=S.lazy(()=>Mn(()=>import("./analytics-X8fiN7Q-.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),dj=S.lazy(()=>Mn(()=>import("./api-Bg7IAVNF.js"),__vite__mapDeps([12,1,2,6,13,7,5,10,4,8,3])).then(l=>({default:l.ApiPage}))),mj=S.lazy(()=>Mn(()=>import("./cliproxy-CIDIqQZI.js"),__vite__mapDeps([14,1,2,6,7,5,10,13,4,8,3])).then(l=>({default:l.CliproxyPage}))),hj=S.lazy(()=>Mn(()=>import("./cliproxy-control-panel-CvVI3tSn.js"),__vite__mapDeps([15,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),pj=S.lazy(()=>Mn(()=>import("./copilot-B2RMTVzo.js"),__vite__mapDeps([16,1,2,6,13,5,17,7,4,8,3])).then(l=>({default:l.CopilotPage}))),gj=S.lazy(()=>Mn(()=>import("./accounts-w6nGMF0z.js"),__vite__mapDeps([18,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),yj=S.lazy(()=>Mn(()=>import("./settings-B0qqVb1L.js"),__vite__mapDeps([19,1,2,17,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),vj=S.lazy(()=>Mn(()=>import("./health-Dh0YQtYa.js"),__vite__mapDeps([20,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),xj=S.lazy(()=>Mn(()=>import("./shared-P_OBzaf4.js"),__vite__mapDeps([21,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function bj(){return c.jsx($v,{client:hb,children:c.jsx(gb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:c.jsx(yb,{children:c.jsxs(Zv,{children:[c.jsx(Wv,{children:c.jsxs(xn,{element:c.jsx(v1,{}),children:[c.jsx(xn,{path:"/",element:c.jsx(eN,{})}),c.jsx(xn,{path:"/analytics",element:c.jsx(fj,{})}),c.jsx(xn,{path:"/providers",element:c.jsx(dj,{})}),c.jsx(xn,{path:"/cliproxy",element:c.jsx(mj,{})}),c.jsx(xn,{path:"/cliproxy/control-panel",element:c.jsx(hj,{})}),c.jsx(xn,{path:"/copilot",element:c.jsx(pj,{})}),c.jsx(xn,{path:"/accounts",element:c.jsx(gj,{})}),c.jsx(xn,{path:"/settings",element:c.jsx(yj,{})}),c.jsx(xn,{path:"/health",element:c.jsx(vj,{})}),c.jsx(xn,{path:"/shared",element:c.jsx(xj,{})})]})}),c.jsx(Fv,{position:"top-right"})]})})})})}const a0=document.getElementById("root");if(!a0)throw new Error("Root element not found. Failed to mount React application.");fb.createRoot(a0).render(c.jsx(S.StrictMode,{children:c.jsx(bj,{})}));export{tg as $,Jb as A,hn as B,cj as C,tN as D,Tg as E,bc as F,Sc as G,Jj as H,Ra as I,Fj as J,Ij as K,An as L,kg as M,Pj as N,eM as O,sM as P,wN as Q,$j as R,nt as S,qo as T,nM as U,EN as V,DN as W,S1 as X,Tj as Y,Rj as Z,eg as _,iM as a,ng as a0,ag as a1,lg as a2,tM as a3,zN as a4,h1 as a5,Uj as a6,Bj as a7,Hj as a8,qj as a9,aM as aa,Yj as ab,Kj as ac,Lj as ad,Gj as ae,Oj as af,_j as ag,kj as ah,Aj as ai,Rg as aj,Mn as ak,wo as al,bt as am,Mg as an,vc as ao,Cg as ap,zg as aq,Og as ar,FS as as,Qj as at,Dg as au,Ib as av,lM as aw,kN as b,X as c,Fp as d,Ha as e,M1 as f,Dj as g,C1 as h,Pl as i,oM as j,Yo as k,Lo as l,ip as m,gN as n,Wj as o,dN as p,Xj as q,Zj as r,iN as s,aN as t,Ac as u,cN as v,mN as w,Vj as x,Zb as y,Wb as z};