@kaitranntt/ccs 6.7.1-dev.2 → 6.7.1-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.
- package/dist/cliproxy/remote-proxy-client.d.ts +1 -1
- package/dist/cliproxy/remote-proxy-client.d.ts.map +1 -1
- package/dist/cliproxy/remote-proxy-client.js +33 -4
- package/dist/cliproxy/remote-proxy-client.js.map +1 -1
- package/dist/ui/assets/{accounts--0JKEYYO.js → accounts-CveDKAVc.js} +1 -1
- package/dist/ui/assets/{analytics-CX5PurM9.js → analytics-D-bqA31W.js} +1 -1
- package/dist/ui/assets/{api-D80tfZOx.js → api-A3IeN2JZ.js} +1 -1
- package/dist/ui/assets/{card-B-DPlvgo.js → card-Dh2Mk43l.js} +1 -1
- package/dist/ui/assets/{cliproxy-D4AoDTZB.js → cliproxy-BY70Tlxq.js} +1 -1
- package/dist/ui/assets/{code-editor-DIj6qdUG.js → code-editor-x2Bhd_zz.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DZkzZLrs.js → confirm-dialog-BCZXbxwW.js} +1 -1
- package/dist/ui/assets/{copilot-Q9tyCgYD.js → copilot-BRJK1ZW-.js} +2 -2
- package/dist/ui/assets/{health-Cw76uZRy.js → health-626qMQvS.js} +1 -1
- package/dist/ui/assets/{index-C1W0iP_Z.js → index-BJVyJi5-.js} +3 -3
- package/dist/ui/assets/settings-BTIPjkGQ.js +1 -0
- package/dist/ui/assets/{shared--pI8rTbP.js → shared-BlJYKD4s.js} +1 -1
- package/dist/ui/assets/{switch-BP6SzLyZ.js → switch-BR9MWG-V.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/settings-CDdHW_gU.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-x2Bhd_zz.js","assets/radix-ui-CV3R9pD6.js","assets/react-vendor-FspHSO0w.js","assets/code-highlight-BoHWVYut.js","assets/utils-CzKF5WmX.js","assets/icons-ZmwVoUeR.js","assets/tanstack-Df9bCj5R.js","assets/notifications-B2Pz7lik.js","assets/form-utils-DP6ILe7Z.js","assets/analytics-D-bqA31W.js","assets/card-Dh2Mk43l.js","assets/charts-B9Jh-s-X.js","assets/api-A3IeN2JZ.js","assets/confirm-dialog-BCZXbxwW.js","assets/cliproxy-BY70Tlxq.js","assets/cliproxy-control-panel-CJ2CfYod.js","assets/copilot-BRJK1ZW-.js","assets/switch-BR9MWG-V.js","assets/accounts-CveDKAVc.js","assets/settings-BTIPjkGQ.js","assets/health-626qMQvS.js","assets/shared-BlJYKD4s.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{j as c,S as Oo,R as mp,C as hp,a as pp,T as gp,D as yp,P as vp,O as xp,b as lv,c as sv,d as iv,e as ov,f as rv,A as uv,g as cv,h as fv,i as dv,k as bp,V as mv,l as hv,m as Sp,n as pv,L as Np,o as jp,p as Cp,q as gv,r as yv,s as Mp,I as vv,t as wp,u as zp,v as xv,w as Ep,x as bv,y as Dp,z as Op,B as Sv,E as Nv,F as Tp,G as jv,H as Cv,J as Mv,K as wv,M as Ap,N as zv,Q as Ev,U as Dv}from"./radix-ui-CV3R9pD6.js";import{e as _p,f as Ov,r as S,u as Tv,L as dc,O as Av,R as _v,h as kv,g as Rv,c as I,B as Uv,i as Bv,j as xn}from"./react-vendor-FspHSO0w.js";import{Q as Hv,u as hn,a as qt,b as jn,c as qv}from"./tanstack-Df9bCj5R.js";import{t as Ge,T as Yv}from"./notifications-B2Pz7lik.js";import{t as Lv,c as Gv,a as To,e as Zs,f as $s,b as Kv,d as Qv,g as Xv,h as Vv,i as Zv,j as Wv,k as Jv,l as $v,m as Fv,n as Iv,o as Pv,p as ex,q as tx,r as nx,s as ax,u as lx,v as sx,w as ix,x as ox,y as rx,z as ux,A as cx,B as fx,C as dx,D as mx,E as hx,F as px,G as gx,H as yx,I as vx,J as xx}from"./utils-CzKF5WmX.js";import{X as si,P as bx,H as Sx,C as Nx,K as kp,G as jx,Z as Rp,a as Up,F as Bp,U as Hp,A as ni,S as Cx,b as Ao,c as Mx,M as wx,E as vc,d as xc,B as zx,W as Ex,e as Th,f as Dx,g as Ox,h as Ah,i as _h,L as _o,j as bc,k as Sc,l as Nc,m as jc,R as Tx,n as Ax,o as _x,p as qp,q as kx,I as ko,T as Rx,r as Ux,s as Bx,t as Hx,u as Cc,v as qx,w as Yx,x as Mc,y as Ro,z as Lx,D as Gx,J as kh,N as Kx}from"./icons-ZmwVoUeR.js";import{o as Rh,s as Uh,p as Qx,a as Xx,$ as Vx,b as Yp,c as Zx,d as tl,u as Wx,e as Jx}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"]'))r(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"&&r(h)}).observe(document,{childList:!0,subtree:!0});function u(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 r(f){if(f.ep)return;f.ep=!0;const m=u(f);fetch(f.href,m)}})();var Pu={exports:{}},Ws={},ec={exports:{}},tc={};var Bh;function $x(){return Bh||(Bh=1,(function(l){function s(T,W){var ee=T.length;T.push(W);e:for(;0<ee;){var me=ee-1>>>1,xe=T[me];if(0<f(xe,W))T[me]=W,T[ee]=xe,ee=me;else break e}}function u(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var W=T[0],ee=T.pop();if(ee!==W){T[0]=ee;e:for(var me=0,xe=T.length,De=xe>>>1;me<De;){var ce=2*(me+1)-1,K=T[ce],$=ce+1,ae=T[$];if(0>f(K,ee))$<xe&&0>f(ae,K)?(T[me]=ae,T[$]=ee,me=$):(T[me]=K,T[ce]=ee,me=ce);else if($<xe&&0>f(ae,ee))T[me]=ae,T[$]=ee,me=$;else break e}}return W}function f(T,W){var ee=T.sortIndex-W.sortIndex;return ee!==0?ee:T.id-W.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=[],j=[],M=1,v=null,x=3,R=!1,O=!1,B=!1,q=!1,_=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function Z(T){for(var W=u(j);W!==null;){if(W.callback===null)r(j);else if(W.startTime<=T)r(j),W.sortIndex=W.expirationTime,s(y,W);else break;W=u(j)}}function k(T){if(B=!1,Z(T),!O)if(u(y)!==null)O=!0,w||(w=!0,se());else{var W=u(j);W!==null&&Se(k,W.startTime-T)}}var w=!1,Y=-1,J=5,P=-1;function pe(){return q?!0:!(l.unstable_now()-P<J)}function ue(){if(q=!1,w){var T=l.unstable_now();P=T;var W=!0;try{e:{O=!1,B&&(B=!1,X(Y),Y=-1),R=!0;var ee=x;try{t:{for(Z(T),v=u(y);v!==null&&!(v.expirationTime>T&&pe());){var me=v.callback;if(typeof me=="function"){v.callback=null,x=v.priorityLevel;var xe=me(v.expirationTime<=T);if(T=l.unstable_now(),typeof xe=="function"){v.callback=xe,Z(T),W=!0;break t}v===u(y)&&r(y),Z(T)}else r(y);v=u(y)}if(v!==null)W=!0;else{var De=u(j);De!==null&&Se(k,De.startTime-T),W=!1}}break e}finally{v=null,x=ee,R=!1}W=void 0}}finally{W?se():w=!1}}}var se;if(typeof G=="function")se=function(){G(ue)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,ye=qe.port2;qe.port1.onmessage=ue,se=function(){ye.postMessage(null)}}else se=function(){_(ue,0)};function Se(T,W){Y=_(function(){T(l.unstable_now())},W)}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(T){T.callback=null},l.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<T?Math.floor(1e3/T):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(T){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var ee=x;x=W;try{return T()}finally{x=ee}},l.unstable_requestPaint=function(){q=!0},l.unstable_runWithPriority=function(T,W){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var ee=x;x=T;try{return W()}finally{x=ee}},l.unstable_scheduleCallback=function(T,W,ee){var me=l.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?me+ee:me):ee=me,T){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=ee+xe,T={id:M++,callback:W,priorityLevel:T,startTime:ee,expirationTime:xe,sortIndex:-1},ee>me?(T.sortIndex=ee,s(j,T),u(y)===null&&T===u(j)&&(B?(X(Y),Y=-1):B=!0,Se(k,ee-me))):(T.sortIndex=xe,s(y,T),O||R||(O=!0,w||(w=!0,se()))),T},l.unstable_shouldYield=pe,l.unstable_wrapCallback=function(T){var W=x;return function(){var ee=x;x=W;try{return T.apply(this,arguments)}finally{x=ee}}}})(tc)),tc}var Hh;function Fx(){return Hh||(Hh=1,ec.exports=$x()),ec.exports}var qh;function Ix(){if(qh)return Ws;qh=1;var l=Fx(),s=_p(),u=Ov();function r(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(r(188))}function j(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(r(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(r(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(r(189))}}if(n.alternate!==a)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function M(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=M(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"),O=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),G=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),Y=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 se(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function ye(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case _:return"Profiler";case q:return"StrictMode";case k:return"Suspense";case w:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case G:return e.displayName||"Context";case X:return(e._context.displayName||"Context")+".Consumer";case Z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return t=e.displayName||null,t!==null?t:ye(e.type)||"Memo";case J:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var Se=Array.isArray,T=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},me=[],xe=-1;function De(e){return{current:e}}function ce(e){0>xe||(e.current=me[xe],me[xe]=null,xe--)}function K(e,t){xe++,me[xe]=e.current,e.current=t}var $=De(null),ae=De(null),F=De(null),ne=De(null);function ve(e,t){switch(K(F,t),K(ae,e),K($,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?eh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=eh(t),e=th(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ce($),K($,e)}function Oe(){ce($),ce(ae),ce(F)}function Ye(e){e.memoizedState!==null&&K(ne,e);var t=$.current,n=th(t,e.type);t!==n&&(K(ae,e),K($,n))}function ht(e){ae.current===e&&(ce($),ce(ae)),ne.current===e&&(ce(ne),Ks._currentValue=ee)}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 Dt=!1;function Yt(e,t){if(!e||Dt)return"";Dt=!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(A){var D=A}Reflect.construct(e,[],L)}else{try{L.call()}catch(A){D=A}e.call(L.prototype)}}else{try{throw Error()}catch(A){D=A}(L=e())&&typeof L.catch=="function"&&L.catch(function(){})}}catch(A){if(A&&D&&typeof A.stack=="string")return[A.stack,D.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 r of u){const[f,...m]=r.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 CS(l){const s={},u=l.split(`
|
|
12
12
|
`);for(const r of u){const f=r.indexOf(":");if(f>0){const m=r.slice(0,f).trim(),h=r.slice(f+1).trim();m&&(s[m]=h)}}return s}function MS(l,s){const u=l.split(`
|
|
13
13
|
`);let r=!1;const f=[];for(const m of u){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(" ")||zS(s.statusCode);continue}if(m.trim()===""&&!r){r=!0;continue}if(r)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 wS(l){const s=l.url.match(/\/api\/provider\/([^/]+)/);s&&(l.provider=s[1]);const u=l.url.match(/\/api\/provider\/[^/]+\/api\/(.+)/);u&&(l.endpoint=u[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 zS(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 ES(l){const s=Date.now(),u=l*1e3,r=s-u,f=Math.floor(r/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(u).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function DS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function OS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function TS(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function AS({name:l,size:s,modified:u,isSelected:r,onClick:f}){const m=S.useMemo(()=>SS(l),[l]);return c.jsxs("button",{onClick:f,className:Q("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[c.jsx(Tc,{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:Q("text-[9px] px-1 rounded border",r?"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(_x,{className:"w-3 h-3"}),ES(u)]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(qp,{className:"w-3 h-3"}),DS(s)]})]})]})]})}function np({value:l,className:s,variant:u="outline",size:r="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(zc,{children:c.jsxs(Ec,{children:[c.jsx(Dc,{asChild:!0,children:c.jsxs(mn,{size:r,variant:u,className:Q("relative z-10 text-muted-foreground hover:text-foreground",s),onClick:y=>{y.stopPropagation(),p()},children:[m?c.jsx(bc,{className:"h-3.5 w-3.5 text-green-500"}):c.jsx(kx,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"sr-only",children:f})]})}),c.jsx(Oc,{children:c.jsx("p",{children:m?"Copied!":f})})]})})}function Js({active:l,onClick:s,children:u,icon:r}){return c.jsxs("button",{onClick:s,className:Q("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:[r&&c.jsx(r,{className:"w-3.5 h-3.5"}),u]})}function xg({code:l}){const s=OS(l);return c.jsx("span",{className:Q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",s),children:l})}function _S({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(xg,{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:TS(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(ko,{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 kS({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(ii,{className:"h-full",children:c.jsx("div",{className:"p-4 space-y-1",children:s.map(([u,r])=>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:[u,":"]}),c.jsx("span",{className:"break-all",children:r})]},u))})})}function ap({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 u=l,r=!1;try{const f=JSON.parse(l);u=JSON.stringify(f,null,2),r=!0}catch{}return c.jsx(ii,{className:"h-full",children:c.jsx("pre",{className:Q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",r?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:u})})}function RS({content:l}){return c.jsx(ii,{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 US({name:l,absolutePath:s}){const[u,r]=S.useState("overview"),{data:f,isLoading:m,error:h}=v1(l),p=S.useMemo(()=>f?NS(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(xg,{code:p.statusCode}),c.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),l&&c.jsx(np,{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(np,{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(Js,{active:u==="overview",onClick:()=>r("overview"),icon:ko,children:"Overview"}),c.jsx(Js,{active:u==="headers",onClick:()=>r("headers"),icon:Ux,children:"Headers"}),c.jsx(Js,{active:u==="request",onClick:()=>r("request"),icon:Bx,children:"Request"}),c.jsx(Js,{active:u==="response",onClick:()=>r("response"),icon:Hx,children:"Response"}),c.jsx(Js,{active:u==="raw",onClick:()=>r("raw"),icon:qp,children:"Raw"})]}),c.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[u==="overview"&&c.jsx(_S,{parsed:p}),u==="headers"&&c.jsx(kS,{headers:p.requestHeaders}),u==="request"&&c.jsx(ap,{content:p.requestBody,label:"Request"}),u==="response"&&c.jsx(ap,{content:p.responseBody,label:"Response"}),u==="raw"&&c.jsx(RS,{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(Rx,{className:"w-10 h-10 mx-auto opacity-40"}),c.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function BS(){const{data:l,isLoading:s}=m1(),{data:u,isLoading:r,error:f}=y1(l?.running??!1),[m,h]=S.useState(500),[p,y]=S.useState(!1),j=S.useRef(null),M=S.useRef(null),v=()=>{M.current&&(clearInterval(M.current),M.current=null)};S.useEffect(()=>{if(!p)return;const G=k=>{const w=j.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,se=15;v(),ue<50?M.current=setInterval(()=>{window.scrollBy(0,se)},16):k.clientY<50&&(M.current=setInterval(()=>{window.scrollBy(0,-se)},16))},Z=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Z),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Z),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const x=G=>{G.preventDefault(),y(!0)},R=S.useMemo(()=>u?.[0]?.name??null,[u]),[O,B]=S.useState(null),q=O??R,_=S.useMemo(()=>!q||!u?void 0:u.find(Z=>Z.name===q)?.absolutePath,[q,u]);if(s||!l?.running)return null;if(r)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(!u||u.length===0)return null;const X=u.length;return c.jsxs("div",{ref:j,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(Cc,{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:[X," failed request",X!==1?"s":""]})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(qx,{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(gg,{direction:"horizontal",children:[c.jsx(mc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:c.jsxs(ii,{className:"h-full",children:[c.jsx("div",{className:"divide-y divide-border/50",children:u.slice(0,50).map(G=>c.jsx(AS,{name:G.name,size:G.size,modified:G.modified,isSelected:q===G.name,onClick:()=>B(G.name)},G.name))}),u.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 ",u.length," logs"]})]})}),c.jsxs(yg,{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(jc,{className:"h-4 w-4 text-muted-foreground"})})]}),c.jsx(mc,{className:"flex flex-col min-w-0 bg-background/50",children:c.jsx(US,{name:q,absolutePath:_})})]})}),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(Yx,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const HS=To("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"}}),bg=S.forwardRef(({className:l,variant:s,...u},r)=>c.jsx("div",{ref:r,role:"alert",className:Q(HS({variant:s}),l),...u}));bg.displayName="Alert";const Sg=S.forwardRef(({className:l,...s},u)=>c.jsx("h5",{ref:u,className:Q("mb-1 font-medium leading-none tracking-tight",l),...s}));Sg.displayName="AlertTitle";const Ng=S.forwardRef(({className:l,...s},u)=>c.jsx("div",{ref:u,className:Q("text-sm [&_p]:leading-relaxed",l),...s}));Ng.displayName="AlertDescription";function qS(){return qt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function YS(){return qt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function yj(l){return qt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const LS={ok:"success",warning:"warning",error:"error"},GS={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 Co({title:l,value:s,icon:u,variant:r="default",onClick:f}){const m=GS[r];return c.jsxs("button",{onClick:f,className:Q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[c.jsx("div",{className:Q("flex items-center justify-center w-9 h-9 rounded-md",m.iconBg),children:c.jsx(u,{className:Q("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:Q("text-lg font-bold font-mono leading-tight",m.iconColor),children:s})]})]})}function KS(){const l=kv(),{data:s,isLoading:u}=qS(),{data:r,isLoading:f}=YS();if(u||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?LS[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(u1,{version:s?.version}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(Co,{title:"Profiles",value:s?.profiles??0,icon:kp,variant:"accent",onClick:()=>l("/providers")}),c.jsx(Co,{title:"CLIProxy",value:s?.cliproxy??0,icon:Rp,variant:"accent",onClick:()=>l("/cliproxy")}),c.jsx(Co,{title:"Accounts",value:s?.accounts??0,icon:Hp,variant:"default",onClick:()=>l("/accounts")}),c.jsx(Co,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:ni,variant:m,onClick:()=>l("/health")})]})]})]}),r?.symlinkStatus&&!r.symlinkStatus.valid&&c.jsxs(bg,{variant:"warning",children:[c.jsx(Cc,{className:"h-4 w-4"}),c.jsx(Sg,{children:"Configuration Required"}),c.jsx(Ng,{children:r.symlinkStatus.message})]}),c.jsx(V1,{}),c.jsx(BS,{})]})}const QS=gv,jg=S.forwardRef(({className:l,...s},u)=>c.jsx(Np,{ref:u,className:Q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));jg.displayName=Np.displayName;const pc=S.forwardRef(({className:l,...s},u)=>c.jsx(jp,{ref:u,className:Q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",l),...s}));pc.displayName=jp.displayName;const gc=S.forwardRef(({className:l,...s},u)=>c.jsx(Cp,{ref:u,className:Q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));gc.displayName=Cp.displayName;function ll({className:l,...s}){return c.jsx(yv,{"data-slot":"label",className:Q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",l),...s})}function Cg({profileEnv:l={}}){const[s,u]=S.useState(null),[r,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();u(R)}catch{u(null)}finally{f(!1)}};if(r||!s?.enabled)return null;const y=s.env||{},j=Object.keys(y);if(j.length===0)return null;const M=j.filter(x=>!(x in l)),v=j.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(ko,{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:M.length})," global env var",M.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(Mc,{className:"w-4 h-4 text-muted-foreground"}):c.jsx(Ro,{className:"w-4 h-4 text-muted-foreground"})]}),m&&c.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[M.length>0&&c.jsx("div",{className:"space-y-1",children:M.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(mn,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:c.jsxs(dc,{to:"/settings?tab=globalenv",children:[c.jsx(Lx,{className:"w-3.5 h-3.5"}),"Configure in Settings",c.jsx(Gx,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const XS=S.lazy(()=>Cn(()=>import("./code-editor-DIj6qdUG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function vj({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:u,settings:r,onChange:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(_o,{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&&u!==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(si,{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(XS,{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(Cg,{profileEnv:r?.env})})})]})})}function lp(l,s){try{var u=l()}catch(r){return s(r)}return u&&u.then?u.then(void 0,s):u}function VS(l,s){for(var u={};l.length;){var r=l[0],f=r.code,m=r.message,h=r.path.join(".");if(!u[h])if("unionErrors"in r){var p=r.unionErrors[0].errors[0];u[h]={message:p.message,type:p.code}}else u[h]={message:m,type:f};if("unionErrors"in r&&r.unionErrors.forEach(function(M){return M.errors.forEach(function(v){return l.push(v)})}),s){var y=u[h].types,j=y&&y[r.code];u[h]=Yp(h,s,u,f,j?[].concat(j,r.message):r.message)}l.shift()}return u}function ZS(l,s){for(var u={};l.length;){var r=l[0],f=r.code,m=r.message,h=r.path.join(".");if(!u[h])if(r.code==="invalid_union"&&r.errors.length>0){var p=r.errors[0][0];u[h]={message:p.message,type:p.code}}else u[h]={message:m,type:f};if(r.code==="invalid_union"&&r.errors.forEach(function(M){return M.forEach(function(v){return l.push(v)})}),s){var y=u[h].types,j=y&&y[r.code];u[h]=Yp(h,s,u,f,j?[].concat(j,r.message):r.message)}l.shift()}return u}function WS(l,s,u){if(u===void 0&&(u={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(l))return function(r,f,m){try{return Promise.resolve(lp(function(){return Promise.resolve(l[u.mode==="sync"?"parse":"parseAsync"](r,s)).then(function(h){return m.shouldUseNativeValidation&&Rh({},m),{errors:{},values:u.raw?Object.assign({},r):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Uh(VS(h.errors,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(l))return function(r,f,m){try{return Promise.resolve(lp(function(){return Promise.resolve((u.mode==="sync"?Qx:Xx)(l,r,s)).then(function(h){return m.shouldUseNativeValidation&&Rh({},m),{errors:{},values:u.raw?Object.assign({},r):h}})},function(h){if((function(p){return p instanceof Vx})(h))return{values:{},errors:Uh(ZS(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 xj(){return qt({queryKey:["profiles"],queryFn:()=>bt.profiles.list()})}function JS(){const l=hn();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 bj(){const l=hn();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 $S="claude-sonnet-4-5-20250929",FS=Zx({name:tl().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:tl().url("Invalid URL format"),apiKey:tl().min(1,"API key is required"),model:tl().optional(),opusModel:tl().optional(),sonnetModel:tl().optional(),haikuModel:tl().optional()}),IS=["/chat/completions","/v1/messages","/messages","/completions"];function Sj({open:l,onOpenChange:s,onSuccess:u}){const r=JS(),[f,m]=S.useState("basic"),[h,p]=S.useState(null),[y,j]=S.useState(!1),{register:M,handleSubmit:v,formState:{errors:x},control:R,reset:O}=Wx({resolver:WS(FS),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),B=Jx({control:R,name:"baseUrl"});S.useEffect(()=>{l&&(O(),m("basic"),p(null),j(!1))},[l,O]),S.useEffect(()=>{if(B){const G=B.toLowerCase();for(const Z of IS)if(G.endsWith(Z)){const k=B.replace(new RegExp(Z+"$","i"),"");p(`URL ends with "${Z}" - Claude appends this automatically. You likely want: ${k}`);return}}p(null)},[B]);const q=async G=>{try{await r.mutateAsync(G),Ge.success(`Profile "${G.name}" created`),u(G.name),s(!1)}catch(Z){Ge.error(Z.message||"Failed to create profile")}},_=!!x.name||!!x.baseUrl||!!x.apiKey,X=!!x.model||!!x.opusModel||!!x.sonnetModel||!!x.haikuModel;return c.jsx(Vp,{open:l,onOpenChange:s,children:c.jsxs(Zp,{className:"sm:max-w-[600px] p-0 gap-0 overflow-hidden",children:[c.jsxs(Wp,{className:"p-6 pb-4 border-b",children:[c.jsxs(Jp,{className:"flex items-center gap-2",children:[c.jsx(kh,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),c.jsx($p,{children:"Configure a custom API endpoint for Claude Code."})]}),c.jsx("form",{onSubmit:v(q),children:c.jsxs(QS,{value:f,onValueChange:m,className:"flex flex-col",children:[c.jsx("div",{className:"px-6 pt-4",children:c.jsxs(jg,{className:"grid w-full grid-cols-2",children:[c.jsxs(pc,{value:"basic",className:"relative",children:["Basic Information",_&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),c.jsxs(pc,{value:"models",className:"relative",children:["Model Configuration",X&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[60vh]",children:[c.jsx(gc,{value:"basic",className:"p-6 space-y-6 mt-0",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"name",children:["Profile Name ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(nl,{id:"name",...M("name"),placeholder:"my-api",className:"font-mono"}),x.name?c.jsx("p",{className:"text-xs text-destructive",children:x.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(ll,{htmlFor:"baseUrl",children:["API Base URL ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(nl,{id:"baseUrl",...M("baseUrl"),placeholder:"https://api.example.com/v1"}),x.baseUrl?c.jsx("p",{className:"text-xs text-destructive",children:x.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(Cc,{className:"w-4 h-4 shrink-0 mt-0.5"}),c.jsx("span",{children:h})]}):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(ll,{htmlFor:"apiKey",children:["API Key ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(nl,{id:"apiKey",type:y?"text":"password",...M("apiKey"),placeholder:"sk-...",className:"pr-10"}),c.jsxs(mn,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>j(!y),tabIndex:-1,children:[y?c.jsx(vc,{className:"h-4 w-4"}):c.jsx(xc,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Toggle API key visibility"})]})]}),x.apiKey&&c.jsx("p",{className:"text-xs text-destructive",children:x.apiKey.message})]})]})}),c.jsxs(gc,{value:"models",className:"p-6 mt-0 space-y-6",children:[c.jsxs("div",{className:"flex items-start gap-3 p-4 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(ko,{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:"Claude Code requests specific model tiers (Opus/Sonnet/Haiku). Map these tiers to the specific models supported by your API provider."})]})]}),c.jsxs("div",{className:"space-y-5",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"model",children:["Default Model",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),c.jsx(nl,{id:"model",...M("model"),placeholder:$S,className:"font-mono text-sm"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Fallback model if no specific tier is requested"})]}),c.jsxs("div",{className:"grid gap-4 pt-2 border-t",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping (Primary)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),c.jsx(nl,{id:"sonnetModel",...M("sonnetModel"),placeholder:"e.g. gpt-4o, claude-3-5-sonnet",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping (Complex Tasks)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),c.jsx(nl,{id:"opusModel",...M("opusModel"),placeholder:"e.g. o1-preview, claude-3-opus",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping (Fast Tasks)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),c.jsx(nl,{id:"haikuModel",...M("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),c.jsxs(a1,{className:"p-6 pt-2 border-t bg-muted/10",children:[c.jsx(mn,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsx(mn,{type:"submit",disabled:r.isPending,className:Q(r.isPending&&"opacity-80"),children:r.isPending?c.jsxs(c.Fragment,{children:[c.jsx(_o,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(kh,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})})]})})}const Nj=jv,jj=Mv,Cj=Cv,PS=S.forwardRef(({className:l,children:s,...u},r)=>c.jsxs(Mp,{ref:r,className:Q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...u,children:[s,c.jsx(vv,{asChild:!0,children:c.jsx(Ro,{className:"h-4 w-4 opacity-50"})})]}));PS.displayName=Mp.displayName;const Mg=S.forwardRef(({className:l,...s},u)=>c.jsx(wp,{ref:u,className:Q("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Mc,{className:"h-4 w-4"})}));Mg.displayName=wp.displayName;const wg=S.forwardRef(({className:l,...s},u)=>c.jsx(zp,{ref:u,className:Q("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Ro,{className:"h-4 w-4"})}));wg.displayName=zp.displayName;const eN=S.forwardRef(({className:l,children:s,position:u="popper",...r},f)=>c.jsx(xv,{children:c.jsxs(Ep,{ref:f,className:Q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",u==="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:u,...r,children:[c.jsx(Mg,{}),c.jsx(bv,{className:Q("p-1",u==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),c.jsx(wg,{})]})}));eN.displayName=Ep.displayName;const tN=S.forwardRef(({className:l,...s},u)=>c.jsx(Dp,{ref:u,className:Q("px-2 py-1.5 text-sm font-semibold",l),...s}));tN.displayName=Dp.displayName;const nN=S.forwardRef(({className:l,children:s,...u},r)=>c.jsxs(Op,{ref:r,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...u,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Sv,{children:c.jsx(bc,{className:"h-4 w-4"})})}),c.jsx(Nv,{children:s})]}));nN.displayName=Op.displayName;const aN=S.forwardRef(({className:l,...s},u)=>c.jsx(Tp,{ref:u,className:Q("-mx-1 my-1 h-px bg-muted",l),...s}));aN.displayName=Tp.displayName;const lN=S.lazy(()=>Cn(()=>import("./code-editor-DIj6qdUG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function Mj({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:u,onRawJsonChange:r,profileEnv:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(_o,{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&&u!==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(si,{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(lN,{value:l,onChange:r,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(Cg,{profileEnv:f})})})]})})}var Bt={},sp;function sN(){if(sp)return Bt;sp=1;var l=Bt&&Bt.__assign||function(){return l=Object.assign||function(k){for(var w,Y=1,J=arguments.length;Y<J;Y++){w=arguments[Y];for(var P in w)Object.prototype.hasOwnProperty.call(w,P)&&(k[P]=w[P])}return k},l.apply(this,arguments)},s=Bt&&Bt.__createBinding||(Object.create?(function(k,w,Y,J){J===void 0&&(J=Y);var P=Object.getOwnPropertyDescriptor(w,Y);(!P||("get"in P?!w.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return w[Y]}}),Object.defineProperty(k,J,P)}):(function(k,w,Y,J){J===void 0&&(J=Y),k[J]=w[Y]})),u=Bt&&Bt.__setModuleDefault||(Object.create?(function(k,w){Object.defineProperty(k,"default",{enumerable:!0,value:w})}):function(k,w){k.default=w}),r=Bt&&Bt.__importStar||function(k){if(k&&k.__esModule)return k;var w={};if(k!=null)for(var Y in k)Y!=="default"&&Object.prototype.hasOwnProperty.call(k,Y)&&s(w,k,Y);return u(w,k),w},f=Bt&&Bt.__rest||function(k,w){var Y={};for(var J in k)Object.prototype.hasOwnProperty.call(k,J)&&w.indexOf(J)<0&&(Y[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])&&(Y[J[P]]=k[J[P]]);return Y};Object.defineProperty(Bt,"__esModule",{value:!0});var m=r(_p()),h=89,p=90,y=77,j=57,M=219,v=222,x=192,R=100,O=3e3,B=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),q=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),_="npm__react-simple-code-editor__textarea",X=`
|
|
14
|
+
`).trim()}function wS(l){const s=l.url.match(/\/api\/provider\/([^/]+)/);s&&(l.provider=s[1]);const u=l.url.match(/\/api\/provider\/[^/]+\/api\/(.+)/);u&&(l.endpoint=u[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 zS(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 ES(l){const s=Date.now(),u=l*1e3,r=s-u,f=Math.floor(r/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(u).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function DS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function OS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function TS(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function AS({name:l,size:s,modified:u,isSelected:r,onClick:f}){const m=S.useMemo(()=>SS(l),[l]);return c.jsxs("button",{onClick:f,className:Q("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[c.jsx(Tc,{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:Q("text-[9px] px-1 rounded border",r?"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(_x,{className:"w-3 h-3"}),ES(u)]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(qp,{className:"w-3 h-3"}),DS(s)]})]})]})]})}function np({value:l,className:s,variant:u="outline",size:r="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(zc,{children:c.jsxs(Ec,{children:[c.jsx(Dc,{asChild:!0,children:c.jsxs(mn,{size:r,variant:u,className:Q("relative z-10 text-muted-foreground hover:text-foreground",s),onClick:y=>{y.stopPropagation(),p()},children:[m?c.jsx(bc,{className:"h-3.5 w-3.5 text-green-500"}):c.jsx(kx,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"sr-only",children:f})]})}),c.jsx(Oc,{children:c.jsx("p",{children:m?"Copied!":f})})]})})}function Js({active:l,onClick:s,children:u,icon:r}){return c.jsxs("button",{onClick:s,className:Q("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:[r&&c.jsx(r,{className:"w-3.5 h-3.5"}),u]})}function xg({code:l}){const s=OS(l);return c.jsx("span",{className:Q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",s),children:l})}function _S({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(xg,{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:TS(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(ko,{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 kS({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(ii,{className:"h-full",children:c.jsx("div",{className:"p-4 space-y-1",children:s.map(([u,r])=>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:[u,":"]}),c.jsx("span",{className:"break-all",children:r})]},u))})})}function ap({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 u=l,r=!1;try{const f=JSON.parse(l);u=JSON.stringify(f,null,2),r=!0}catch{}return c.jsx(ii,{className:"h-full",children:c.jsx("pre",{className:Q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",r?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:u})})}function RS({content:l}){return c.jsx(ii,{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 US({name:l,absolutePath:s}){const[u,r]=S.useState("overview"),{data:f,isLoading:m,error:h}=v1(l),p=S.useMemo(()=>f?NS(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(xg,{code:p.statusCode}),c.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[p.provider,"/",p.endpoint||"unknown"]}),l&&c.jsx(np,{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(np,{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(Js,{active:u==="overview",onClick:()=>r("overview"),icon:ko,children:"Overview"}),c.jsx(Js,{active:u==="headers",onClick:()=>r("headers"),icon:Ux,children:"Headers"}),c.jsx(Js,{active:u==="request",onClick:()=>r("request"),icon:Bx,children:"Request"}),c.jsx(Js,{active:u==="response",onClick:()=>r("response"),icon:Hx,children:"Response"}),c.jsx(Js,{active:u==="raw",onClick:()=>r("raw"),icon:qp,children:"Raw"})]}),c.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[u==="overview"&&c.jsx(_S,{parsed:p}),u==="headers"&&c.jsx(kS,{headers:p.requestHeaders}),u==="request"&&c.jsx(ap,{content:p.requestBody,label:"Request"}),u==="response"&&c.jsx(ap,{content:p.responseBody,label:"Response"}),u==="raw"&&c.jsx(RS,{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(Rx,{className:"w-10 h-10 mx-auto opacity-40"}),c.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function BS(){const{data:l,isLoading:s}=m1(),{data:u,isLoading:r,error:f}=y1(l?.running??!1),[m,h]=S.useState(500),[p,y]=S.useState(!1),j=S.useRef(null),M=S.useRef(null),v=()=>{M.current&&(clearInterval(M.current),M.current=null)};S.useEffect(()=>{if(!p)return;const G=k=>{const w=j.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,se=15;v(),ue<50?M.current=setInterval(()=>{window.scrollBy(0,se)},16):k.clientY<50&&(M.current=setInterval(()=>{window.scrollBy(0,-se)},16))},Z=()=>{y(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Z),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Z),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[p]);const x=G=>{G.preventDefault(),y(!0)},R=S.useMemo(()=>u?.[0]?.name??null,[u]),[O,B]=S.useState(null),q=O??R,_=S.useMemo(()=>!q||!u?void 0:u.find(Z=>Z.name===q)?.absolutePath,[q,u]);if(s||!l?.running)return null;if(r)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(!u||u.length===0)return null;const X=u.length;return c.jsxs("div",{ref:j,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(Cc,{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:[X," failed request",X!==1?"s":""]})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(qx,{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(gg,{direction:"horizontal",children:[c.jsx(mc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:c.jsxs(ii,{className:"h-full",children:[c.jsx("div",{className:"divide-y divide-border/50",children:u.slice(0,50).map(G=>c.jsx(AS,{name:G.name,size:G.size,modified:G.modified,isSelected:q===G.name,onClick:()=>B(G.name)},G.name))}),u.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 ",u.length," logs"]})]})}),c.jsxs(yg,{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(jc,{className:"h-4 w-4 text-muted-foreground"})})]}),c.jsx(mc,{className:"flex flex-col min-w-0 bg-background/50",children:c.jsx(US,{name:q,absolutePath:_})})]})}),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(Yx,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const HS=To("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"}}),bg=S.forwardRef(({className:l,variant:s,...u},r)=>c.jsx("div",{ref:r,role:"alert",className:Q(HS({variant:s}),l),...u}));bg.displayName="Alert";const Sg=S.forwardRef(({className:l,...s},u)=>c.jsx("h5",{ref:u,className:Q("mb-1 font-medium leading-none tracking-tight",l),...s}));Sg.displayName="AlertTitle";const Ng=S.forwardRef(({className:l,...s},u)=>c.jsx("div",{ref:u,className:Q("text-sm [&_p]:leading-relaxed",l),...s}));Ng.displayName="AlertDescription";function qS(){return qt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function YS(){return qt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function yj(l){return qt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const LS={ok:"success",warning:"warning",error:"error"},GS={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 Co({title:l,value:s,icon:u,variant:r="default",onClick:f}){const m=GS[r];return c.jsxs("button",{onClick:f,className:Q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[c.jsx("div",{className:Q("flex items-center justify-center w-9 h-9 rounded-md",m.iconBg),children:c.jsx(u,{className:Q("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:Q("text-lg font-bold font-mono leading-tight",m.iconColor),children:s})]})]})}function KS(){const l=kv(),{data:s,isLoading:u}=qS(),{data:r,isLoading:f}=YS();if(u||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?LS[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(u1,{version:s?.version}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(Co,{title:"Profiles",value:s?.profiles??0,icon:kp,variant:"accent",onClick:()=>l("/providers")}),c.jsx(Co,{title:"CLIProxy",value:s?.cliproxy??0,icon:Rp,variant:"accent",onClick:()=>l("/cliproxy")}),c.jsx(Co,{title:"Accounts",value:s?.accounts??0,icon:Hp,variant:"default",onClick:()=>l("/accounts")}),c.jsx(Co,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:ni,variant:m,onClick:()=>l("/health")})]})]})]}),r?.symlinkStatus&&!r.symlinkStatus.valid&&c.jsxs(bg,{variant:"warning",children:[c.jsx(Cc,{className:"h-4 w-4"}),c.jsx(Sg,{children:"Configuration Required"}),c.jsx(Ng,{children:r.symlinkStatus.message})]}),c.jsx(V1,{}),c.jsx(BS,{})]})}const QS=gv,jg=S.forwardRef(({className:l,...s},u)=>c.jsx(Np,{ref:u,className:Q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));jg.displayName=Np.displayName;const pc=S.forwardRef(({className:l,...s},u)=>c.jsx(jp,{ref:u,className:Q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",l),...s}));pc.displayName=jp.displayName;const gc=S.forwardRef(({className:l,...s},u)=>c.jsx(Cp,{ref:u,className:Q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));gc.displayName=Cp.displayName;function ll({className:l,...s}){return c.jsx(yv,{"data-slot":"label",className:Q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",l),...s})}function Cg({profileEnv:l={}}){const[s,u]=S.useState(null),[r,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();u(R)}catch{u(null)}finally{f(!1)}};if(r||!s?.enabled)return null;const y=s.env||{},j=Object.keys(y);if(j.length===0)return null;const M=j.filter(x=>!(x in l)),v=j.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(ko,{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:M.length})," global env var",M.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(Mc,{className:"w-4 h-4 text-muted-foreground"}):c.jsx(Ro,{className:"w-4 h-4 text-muted-foreground"})]}),m&&c.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[M.length>0&&c.jsx("div",{className:"space-y-1",children:M.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(mn,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:c.jsxs(dc,{to:"/settings?tab=globalenv",children:[c.jsx(Lx,{className:"w-3.5 h-3.5"}),"Configure in Settings",c.jsx(Gx,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const XS=S.lazy(()=>Cn(()=>import("./code-editor-x2Bhd_zz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function vj({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:u,settings:r,onChange:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(_o,{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&&u!==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(si,{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(XS,{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(Cg,{profileEnv:r?.env})})})]})})}function lp(l,s){try{var u=l()}catch(r){return s(r)}return u&&u.then?u.then(void 0,s):u}function VS(l,s){for(var u={};l.length;){var r=l[0],f=r.code,m=r.message,h=r.path.join(".");if(!u[h])if("unionErrors"in r){var p=r.unionErrors[0].errors[0];u[h]={message:p.message,type:p.code}}else u[h]={message:m,type:f};if("unionErrors"in r&&r.unionErrors.forEach(function(M){return M.errors.forEach(function(v){return l.push(v)})}),s){var y=u[h].types,j=y&&y[r.code];u[h]=Yp(h,s,u,f,j?[].concat(j,r.message):r.message)}l.shift()}return u}function ZS(l,s){for(var u={};l.length;){var r=l[0],f=r.code,m=r.message,h=r.path.join(".");if(!u[h])if(r.code==="invalid_union"&&r.errors.length>0){var p=r.errors[0][0];u[h]={message:p.message,type:p.code}}else u[h]={message:m,type:f};if(r.code==="invalid_union"&&r.errors.forEach(function(M){return M.forEach(function(v){return l.push(v)})}),s){var y=u[h].types,j=y&&y[r.code];u[h]=Yp(h,s,u,f,j?[].concat(j,r.message):r.message)}l.shift()}return u}function WS(l,s,u){if(u===void 0&&(u={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(l))return function(r,f,m){try{return Promise.resolve(lp(function(){return Promise.resolve(l[u.mode==="sync"?"parse":"parseAsync"](r,s)).then(function(h){return m.shouldUseNativeValidation&&Rh({},m),{errors:{},values:u.raw?Object.assign({},r):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Uh(VS(h.errors,!m.shouldUseNativeValidation&&m.criteriaMode==="all"),m)};throw h}))}catch(h){return Promise.reject(h)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(l))return function(r,f,m){try{return Promise.resolve(lp(function(){return Promise.resolve((u.mode==="sync"?Qx:Xx)(l,r,s)).then(function(h){return m.shouldUseNativeValidation&&Rh({},m),{errors:{},values:u.raw?Object.assign({},r):h}})},function(h){if((function(p){return p instanceof Vx})(h))return{values:{},errors:Uh(ZS(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 xj(){return qt({queryKey:["profiles"],queryFn:()=>bt.profiles.list()})}function JS(){const l=hn();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 bj(){const l=hn();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 $S="claude-sonnet-4-5-20250929",FS=Zx({name:tl().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:tl().url("Invalid URL format"),apiKey:tl().min(1,"API key is required"),model:tl().optional(),opusModel:tl().optional(),sonnetModel:tl().optional(),haikuModel:tl().optional()}),IS=["/chat/completions","/v1/messages","/messages","/completions"];function Sj({open:l,onOpenChange:s,onSuccess:u}){const r=JS(),[f,m]=S.useState("basic"),[h,p]=S.useState(null),[y,j]=S.useState(!1),{register:M,handleSubmit:v,formState:{errors:x},control:R,reset:O}=Wx({resolver:WS(FS),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),B=Jx({control:R,name:"baseUrl"});S.useEffect(()=>{l&&(O(),m("basic"),p(null),j(!1))},[l,O]),S.useEffect(()=>{if(B){const G=B.toLowerCase();for(const Z of IS)if(G.endsWith(Z)){const k=B.replace(new RegExp(Z+"$","i"),"");p(`URL ends with "${Z}" - Claude appends this automatically. You likely want: ${k}`);return}}p(null)},[B]);const q=async G=>{try{await r.mutateAsync(G),Ge.success(`Profile "${G.name}" created`),u(G.name),s(!1)}catch(Z){Ge.error(Z.message||"Failed to create profile")}},_=!!x.name||!!x.baseUrl||!!x.apiKey,X=!!x.model||!!x.opusModel||!!x.sonnetModel||!!x.haikuModel;return c.jsx(Vp,{open:l,onOpenChange:s,children:c.jsxs(Zp,{className:"sm:max-w-[600px] p-0 gap-0 overflow-hidden",children:[c.jsxs(Wp,{className:"p-6 pb-4 border-b",children:[c.jsxs(Jp,{className:"flex items-center gap-2",children:[c.jsx(kh,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),c.jsx($p,{children:"Configure a custom API endpoint for Claude Code."})]}),c.jsx("form",{onSubmit:v(q),children:c.jsxs(QS,{value:f,onValueChange:m,className:"flex flex-col",children:[c.jsx("div",{className:"px-6 pt-4",children:c.jsxs(jg,{className:"grid w-full grid-cols-2",children:[c.jsxs(pc,{value:"basic",className:"relative",children:["Basic Information",_&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),c.jsxs(pc,{value:"models",className:"relative",children:["Model Configuration",X&&c.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[60vh]",children:[c.jsx(gc,{value:"basic",className:"p-6 space-y-6 mt-0",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"name",children:["Profile Name ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(nl,{id:"name",...M("name"),placeholder:"my-api",className:"font-mono"}),x.name?c.jsx("p",{className:"text-xs text-destructive",children:x.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(ll,{htmlFor:"baseUrl",children:["API Base URL ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx(nl,{id:"baseUrl",...M("baseUrl"),placeholder:"https://api.example.com/v1"}),x.baseUrl?c.jsx("p",{className:"text-xs text-destructive",children:x.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(Cc,{className:"w-4 h-4 shrink-0 mt-0.5"}),c.jsx("span",{children:h})]}):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(ll,{htmlFor:"apiKey",children:["API Key ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(nl,{id:"apiKey",type:y?"text":"password",...M("apiKey"),placeholder:"sk-...",className:"pr-10"}),c.jsxs(mn,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>j(!y),tabIndex:-1,children:[y?c.jsx(vc,{className:"h-4 w-4"}):c.jsx(xc,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Toggle API key visibility"})]})]}),x.apiKey&&c.jsx("p",{className:"text-xs text-destructive",children:x.apiKey.message})]})]})}),c.jsxs(gc,{value:"models",className:"p-6 mt-0 space-y-6",children:[c.jsxs("div",{className:"flex items-start gap-3 p-4 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(ko,{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:"Claude Code requests specific model tiers (Opus/Sonnet/Haiku). Map these tiers to the specific models supported by your API provider."})]})]}),c.jsxs("div",{className:"space-y-5",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"model",children:["Default Model",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),c.jsx(nl,{id:"model",...M("model"),placeholder:$S,className:"font-mono text-sm"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Fallback model if no specific tier is requested"})]}),c.jsxs("div",{className:"grid gap-4 pt-2 border-t",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping (Primary)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),c.jsx(nl,{id:"sonnetModel",...M("sonnetModel"),placeholder:"e.g. gpt-4o, claude-3-5-sonnet",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping (Complex Tasks)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),c.jsx(nl,{id:"opusModel",...M("opusModel"),placeholder:"e.g. o1-preview, claude-3-opus",className:"font-mono text-sm h-9"})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs(ll,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping (Fast Tasks)",c.jsx(Fs,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),c.jsx(nl,{id:"haikuModel",...M("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),c.jsxs(a1,{className:"p-6 pt-2 border-t bg-muted/10",children:[c.jsx(mn,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsx(mn,{type:"submit",disabled:r.isPending,className:Q(r.isPending&&"opacity-80"),children:r.isPending?c.jsxs(c.Fragment,{children:[c.jsx(_o,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(kh,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})})]})})}const Nj=jv,jj=Mv,Cj=Cv,PS=S.forwardRef(({className:l,children:s,...u},r)=>c.jsxs(Mp,{ref:r,className:Q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...u,children:[s,c.jsx(vv,{asChild:!0,children:c.jsx(Ro,{className:"h-4 w-4 opacity-50"})})]}));PS.displayName=Mp.displayName;const Mg=S.forwardRef(({className:l,...s},u)=>c.jsx(wp,{ref:u,className:Q("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Mc,{className:"h-4 w-4"})}));Mg.displayName=wp.displayName;const wg=S.forwardRef(({className:l,...s},u)=>c.jsx(zp,{ref:u,className:Q("flex cursor-default items-center justify-center py-1",l),...s,children:c.jsx(Ro,{className:"h-4 w-4"})}));wg.displayName=zp.displayName;const eN=S.forwardRef(({className:l,children:s,position:u="popper",...r},f)=>c.jsx(xv,{children:c.jsxs(Ep,{ref:f,className:Q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",u==="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:u,...r,children:[c.jsx(Mg,{}),c.jsx(bv,{className:Q("p-1",u==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),c.jsx(wg,{})]})}));eN.displayName=Ep.displayName;const tN=S.forwardRef(({className:l,...s},u)=>c.jsx(Dp,{ref:u,className:Q("px-2 py-1.5 text-sm font-semibold",l),...s}));tN.displayName=Dp.displayName;const nN=S.forwardRef(({className:l,children:s,...u},r)=>c.jsxs(Op,{ref:r,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...u,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Sv,{children:c.jsx(bc,{className:"h-4 w-4"})})}),c.jsx(Nv,{children:s})]}));nN.displayName=Op.displayName;const aN=S.forwardRef(({className:l,...s},u)=>c.jsx(Tp,{ref:u,className:Q("-mx-1 my-1 h-px bg-muted",l),...s}));aN.displayName=Tp.displayName;const lN=S.lazy(()=>Cn(()=>import("./code-editor-x2Bhd_zz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function Mj({rawJsonContent:l,isRawJsonValid:s,rawJsonEdits:u,onRawJsonChange:r,profileEnv:f}){return c.jsx(S.Suspense,{fallback:c.jsxs("div",{className:"flex items-center justify-center h-full",children:[c.jsx(_o,{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&&u!==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(si,{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(lN,{value:l,onChange:r,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(Cg,{profileEnv:f})})})]})})}var Bt={},sp;function sN(){if(sp)return Bt;sp=1;var l=Bt&&Bt.__assign||function(){return l=Object.assign||function(k){for(var w,Y=1,J=arguments.length;Y<J;Y++){w=arguments[Y];for(var P in w)Object.prototype.hasOwnProperty.call(w,P)&&(k[P]=w[P])}return k},l.apply(this,arguments)},s=Bt&&Bt.__createBinding||(Object.create?(function(k,w,Y,J){J===void 0&&(J=Y);var P=Object.getOwnPropertyDescriptor(w,Y);(!P||("get"in P?!w.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return w[Y]}}),Object.defineProperty(k,J,P)}):(function(k,w,Y,J){J===void 0&&(J=Y),k[J]=w[Y]})),u=Bt&&Bt.__setModuleDefault||(Object.create?(function(k,w){Object.defineProperty(k,"default",{enumerable:!0,value:w})}):function(k,w){k.default=w}),r=Bt&&Bt.__importStar||function(k){if(k&&k.__esModule)return k;var w={};if(k!=null)for(var Y in k)Y!=="default"&&Object.prototype.hasOwnProperty.call(k,Y)&&s(w,k,Y);return u(w,k),w},f=Bt&&Bt.__rest||function(k,w){var Y={};for(var J in k)Object.prototype.hasOwnProperty.call(k,J)&&w.indexOf(J)<0&&(Y[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])&&(Y[J[P]]=k[J[P]]);return Y};Object.defineProperty(Bt,"__esModule",{value:!0});var m=r(_p()),h=89,p=90,y=77,j=57,M=219,v=222,x=192,R=100,O=3e3,B=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),q=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),_="npm__react-simple-code-editor__textarea",X=`
|
|
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(fe!==$e){var ge=be[de];zn({value:$e,selectionStart:ge?.startsWith(ie)?we-ie.length:we,selectionEnd:et-(fe.length-$e.length)})}}else if(we!==et){var be=Kt(fe,we),zt=be.length-1,qn=Kt(fe,et).length-1,ge=be[zt];zn({value:fe.split(`
|
|
44
44
|
`).map(function(ns,as){return as>=zt&&as<=qn?ie+ns:ns}).join(`
|
|
45
45
|
`),selectionStart:ge&&/\S/.test(ge)?we+ie.length:we,selectionEnd:et+ie.length*(qn-zt+1)})}else{var yt=we+ie.length;zn({value:fe.substring(0,we)+ie+fe.substring(et),selectionStart:yt,selectionEnd:yt})}else if(V.key==="Backspace"){var Qt=we!==et,pn=fe.substring(0,we);if(pn.endsWith(ie)&&!Qt){V.preventDefault();var yt=we-ie.length;zn({value:fe.substring(0,we-ie.length)+fe.substring(et),selectionStart:yt,selectionEnd:yt})}}else if(V.key==="Enter"){if(we===et){var es=Kt(fe,we).pop(),Ba=es?.match(/^\s+/);if(Ba?.[0]){V.preventDefault();var ts=`
|
|
46
|
-
`+Ba[0],yt=we+ts.length;zn({value:fe.substring(0,we)+ts+fe.substring(et),selectionStart:yt,selectionEnd:yt})}}}else if(V.keyCode===j||V.keyCode===M||V.keyCode===v||V.keyCode===x){var tn=void 0;V.keyCode===j&&V.shiftKey?tn=["(",")"]:V.keyCode===M?V.shiftKey?tn=["{","}"]:tn=["[","]"]:V.keyCode===v?V.shiftKey?tn=['"','"']:tn=["'","'"]:V.keyCode===x&&!V.shiftKey&&(tn=["`","`"]),we!==et&&tn&&(V.preventDefault(),zn({value:fe.substring(0,we)+tn[0]+fe.substring(we,et)+tn[1]+fe.substring(et),selectionStart:we,selectionEnd:et+2}))}else(q?V.metaKey&&V.keyCode===p:V.ctrlKey&&V.keyCode===p)&&!V.shiftKey&&!V.altKey?(V.preventDefault(),rl()):(q?V.metaKey&&V.keyCode===p&&V.shiftKey:B?V.ctrlKey&&V.keyCode===h:V.ctrlKey&&V.keyCode===p&&V.shiftKey)&&!V.altKey?(V.preventDefault(),Il()):V.keyCode===y&&V.ctrlKey&&(!q||V.shiftKey)&&(V.preventDefault(),ua(function(Yn){return!Yn}))}},Hn=function(V){var Me=V.currentTarget,fe=Me.value,we=Me.selectionStart,et=Me.selectionEnd;Bn({value:fe,selectionStart:we,selectionEnd:et},!0),$(fe)};return m.useEffect(function(){Ua()},[Ua]),m.useImperativeHandle(Y,function(){return{get session(){return{history:Ne.current}},set session(V){Ne.current=V.history}}},[]),m.createElement("div",l({},Rn,{style:l(l({},Z.container),ht)}),m.createElement("pre",l({className:ve,"aria-hidden":"true",style:l(l(l({},Z.editor),Z.highlight),Un)},typeof ot=="string"?{dangerouslySetInnerHTML:{__html:ot+"<br />"}}:{children:ot})),m.createElement("textarea",{ref:function(V){return Lt.current=V},style:l(l(l({},Z.editor),Z.textarea),Un),className:_+(Pe?" ".concat(Pe):""),id:Dt,value:Yt,onChange:Hn,onKeyDown:Pl,onClick:xe,onKeyUp:K,onFocus:De,onBlur:me,disabled:P,form:pe,maxLength:T,minLength:W,name:ee,placeholder:ne,readOnly:Oe,required:Ye,autoFocus:J,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),m.createElement("style",{dangerouslySetInnerHTML:{__html:X}}))}),Z={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 Bt.default=G,Bt}var iN=sN();const wj=Rv(iN),zj=zv,Ej=Dv,Dj=Ev,oN=S.forwardRef(({className:l,align:s="center",sideOffset:u=4,...r},f)=>c.jsx(wv,{children:c.jsx(Ap,{ref:f,align:s,sideOffset:u,className:Q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...r})}));oN.displayName=Ap.displayName;function rN(l,s,u="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:l,timeZoneName:u}).format(s).split(/\s/g).slice(2).join(" ")}const uN={},ti={};function sl(l,s){try{const r=(uN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return r in ti?ti[r]:ip(r,r.split(":"))}catch{if(l in ti)return ti[l];const u=l?.match(cN);return u?ip(l,u.slice(1)):NaN}}const cN=/([+-]\d\d):?(\d\d)?/;function ip(l,s){const u=+(s[0]||0),r=+(s[1]||0),f=+(s[2]||0)/60;return ti[l]=u*60+r>0?u*60+r+f:u*60-r-f}class _n extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(sl(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)),zg(this),yc(this)):this.setTime(Date.now())}static tz(s,...u){return u.length?new _n(...u,s):new _n(Date.now(),s)}withTimeZone(s){return new _n(+this,s)}getTimezoneOffset(){const s=-sl(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),yc(this),+this}[Symbol.for("constructDateFrom")](s){return new _n(+new Date(s),this.timeZone)}}const op=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!op.test(l))return;const s=l.replace(op,"$1UTC");_n.prototype[s]&&(l.startsWith("get")?_n.prototype[l]=function(){return this.internal[s]()}:(_n.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),fN(this),+this},_n.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),yc(this),+this}))});function yc(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-sl(l.timeZone,l)*60))}function fN(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()),zg(l)}function zg(l){const s=sl(l.timeZone,l),u=s>0?Math.floor(s):Math.ceil(s),r=new Date(+l);r.setUTCHours(r.getUTCHours()-1);const f=-new Date(+l).getTimezoneOffset(),m=-new Date(+r).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-u;y&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+y);const j=new Date(+l);j.setUTCSeconds(0);const M=f>0?j.getSeconds():(j.getSeconds()-60)%60,v=Math.round(-(sl(l.timeZone,l)*60))%60;(v||M)&&(l.internal.setUTCSeconds(l.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(l,Date.prototype.getUTCSeconds.call(l)+v+M));const x=sl(l.timeZone,l),R=x>0?Math.floor(x):Math.ceil(x),B=-new Date(+l).getTimezoneOffset()-R,q=R!==u,_=B-y;if(q&&_){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+_);const X=sl(l.timeZone,l),G=X>0?Math.floor(X):Math.ceil(X),Z=R-G;Z&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+Z),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+Z))}}class ia extends _n{static tz(s,...u){return u.length?new ia(...u,s):new ia(Date.now(),s)}toISOString(){const[s,u,r]=this.tzComponents(),f=`${s}${u}:${r}`;return this.internal.toISOString().slice(0,-1)+f}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,u,r,f]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${r} ${u} ${f}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[u,r,f]=this.tzComponents();return`${s} GMT${u}${r}${f} (${rN(this.timeZone,this)})`}toLocaleString(s,u){return Date.prototype.toLocaleString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}toLocaleDateString(s,u){return Date.prototype.toLocaleDateString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}toLocaleTimeString(s,u){return Date.prototype.toLocaleTimeString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}tzComponents(){const s=this.getTimezoneOffset(),u=s>0?"-":"+",r=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),f=String(Math.abs(s)%60).padStart(2,"0");return[u,r,f]}withTimeZone(s){return new ia(+this,s)}[Symbol.for("constructDateFrom")](s){return new ia(+new Date(s),this.timeZone)}}const rp=5,dN=4;function mN(l,s){const u=s.startOfMonth(l),r=u.getDay()>0?u.getDay():7,f=s.addDays(l,-r+1),m=s.addDays(f,rp*7-1);return s.getMonth(l)===s.getMonth(m)?rp:dN}function Eg(l,s){const u=s.startOfMonth(l),r=u.getDay();return r===1?u:r===0?s.addDays(u,-6):s.addDays(u,-1*(r-1))}function hN(l,s){const u=Eg(l,s),r=mN(l,s);return s.addDays(u,r*7-1)}const Dg={...Zs,labels:{labelDayButton:(l,s,u,r)=>{let f;r&&typeof r.format=="function"?f=r.format.bind(r):f=(h,p)=>$s(h,p,{locale:Zs,...u});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,u)=>{let r;return u&&typeof u.format=="function"?r=u.format.bind(u):r=(f,m)=>$s(f,m,{locale:Zs,...s}),r(l,"LLLL yyyy")},labelGridcell:(l,s,u,r)=>{let f;r&&typeof r.format=="function"?f=r.format.bind(r):f=(h,p)=>$s(h,p,{locale:Zs,...u});let m=f(l,"PPPP");return s?.today&&(m=`Today, ${m}`),m},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,u)=>{let r;return u&&typeof u.format=="function"?r=u.format.bind(u):r=(f,m)=>$s(f,m,{locale:Zs,...s}),r(l,"cccc")}}};class en{constructor(s,u){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ia.tz(this.options.timeZone):new this.Date,this.newDate=(r,f,m)=>this.overrides?.newDate?this.overrides.newDate(r,f,m):this.options.timeZone?new ia(r,f,m,this.options.timeZone):new Date(r,f,m),this.addDays=(r,f)=>this.overrides?.addDays?this.overrides.addDays(r,f):Kv(r,f),this.addMonths=(r,f)=>this.overrides?.addMonths?this.overrides.addMonths(r,f):Qv(r,f),this.addWeeks=(r,f)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,f):Xv(r,f),this.addYears=(r,f)=>this.overrides?.addYears?this.overrides.addYears(r,f):Vv(r,f),this.differenceInCalendarDays=(r,f)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,f):Zv(r,f),this.differenceInCalendarMonths=(r,f)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,f):Wv(r,f),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Jv(r),this.eachYearOfInterval=r=>{const f=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):$v(r),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=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hN(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Fv(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Iv(r),this.endOfWeek=(r,f)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,f):Pv(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):ex(r),this.format=(r,f,m)=>{const h=this.overrides?.format?this.overrides.format(r,f,this.options):$s(r,f,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):tx(r),this.getMonth=(r,f)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):nx(r,this.options),this.getYear=(r,f)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):ax(r,this.options),this.getWeek=(r,f)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):lx(r,this.options),this.isAfter=(r,f)=>this.overrides?.isAfter?this.overrides.isAfter(r,f):sx(r,f),this.isBefore=(r,f)=>this.overrides?.isBefore?this.overrides.isBefore(r,f):ix(r,f),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):ox(r),this.isSameDay=(r,f)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,f):rx(r,f),this.isSameMonth=(r,f)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,f):ux(r,f),this.isSameYear=(r,f)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,f):cx(r,f),this.max=r=>this.overrides?.max?this.overrides.max(r):fx(r),this.min=r=>this.overrides?.min?this.overrides.min(r):dx(r),this.setMonth=(r,f)=>this.overrides?.setMonth?this.overrides.setMonth(r,f):mx(r,f),this.setYear=(r,f)=>this.overrides?.setYear?this.overrides.setYear(r,f):hx(r,f),this.startOfBroadcastWeek=(r,f)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Eg(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):px(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):gx(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):yx(r),this.startOfWeek=(r,f)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):vx(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):xx(r),this.options={locale:Dg,...s},this.overrides=u}getDigitMap(){const{numerals:s="latn"}=this.options,u=new Intl.NumberFormat("en-US",{numberingSystem:s}),r={};for(let f=0;f<10;f++)r[f.toString()]=u.format(f);return r}replaceDigits(s){const u=this.getDigitMap();return s.replace(/\d/g,r=>u[r]||r)}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:u,timeZone:r,numerals:f}=this.options,m=u?.code;if(m&&en.yearFirstLocales.has(m))try{return new Intl.DateTimeFormat(m,{month:"long",year:"numeric",timeZone:r,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 kn=new en;class Og{constructor(s,u,r=kn){this.date=s,this.displayMonth=u,this.outside=!!(u&&!r.isSameMonth(s,u)),this.dateLib=r,this.isoDate=r.format(s,"yyyy-MM-dd"),this.displayMonthId=r.format(u,"yyyy-MM"),this.dateMonthId=r.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class pN{constructor(s,u){this.date=s,this.weeks=u}}class gN{constructor(s,u){this.days=u,this.weekNumber=s}}function yN(l){return I.createElement("button",{...l})}function vN(l){return I.createElement("span",{...l})}function xN(l){const{size:s=24,orientation:u="left",className:r}=l;return I.createElement("svg",{className:r,width:s,height:s,viewBox:"0 0 24 24"},u==="up"&&I.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),u==="down"&&I.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),u==="left"&&I.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),u==="right"&&I.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function bN(l){const{day:s,modifiers:u,...r}=l;return I.createElement("td",{...r})}function SN(l){const{day:s,modifiers:u,...r}=l,f=I.useRef(null);return I.useEffect(()=>{u.focused&&f.current?.focus()},[u.focused]),I.createElement("button",{ref:f,...r})}var oe;(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"})(oe||(oe={}));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 NN(l){const{options:s,className:u,components:r,classNames:f,...m}=l,h=[f[oe.Dropdown],u].join(" "),p=s?.find(({value:y})=>y===m.value);return I.createElement("span",{"data-disabled":m.disabled,className:f[oe.DropdownRoot]},I.createElement(r.Select,{className:h,...m},s?.map(({value:y,label:j,disabled:M})=>I.createElement(r.Option,{key:y,value:y,disabled:M},j))),I.createElement("span",{className:f[oe.CaptionLabel],"aria-hidden":!0},p?.label,I.createElement(r.Chevron,{orientation:"down",size:18,className:f[oe.Chevron]})))}function jN(l){return I.createElement("div",{...l})}function CN(l){return I.createElement("div",{...l})}function MN(l){const{calendarMonth:s,displayIndex:u,...r}=l;return I.createElement("div",{...r},l.children)}function wN(l){const{calendarMonth:s,displayIndex:u,...r}=l;return I.createElement("div",{...r})}function zN(l){return I.createElement("table",{...l})}function EN(l){return I.createElement("div",{...l})}const Tg=S.createContext(void 0);function oi(){const l=S.useContext(Tg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function DN(l){const{components:s}=oi();return I.createElement(s.Dropdown,{...l})}function ON(l){const{onPreviousClick:s,onNextClick:u,previousMonth:r,nextMonth:f,...m}=l,{components:h,classNames:p,labels:{labelPrevious:y,labelNext:j}}=oi(),M=S.useCallback(x=>{f&&u?.(x)},[f,u]),v=S.useCallback(x=>{r&&s?.(x)},[r,s]);return I.createElement("nav",{...m},I.createElement(h.PreviousMonthButton,{type:"button",className:p[oe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":y(r),onClick:v},I.createElement(h.Chevron,{disabled:r?void 0:!0,className:p[oe.Chevron],orientation:"left"})),I.createElement(h.NextMonthButton,{type:"button",className:p[oe.NextMonthButton],tabIndex:f?void 0:-1,"aria-disabled":f?void 0:!0,"aria-label":j(f),onClick:M},I.createElement(h.Chevron,{disabled:f?void 0:!0,orientation:"right",className:p[oe.Chevron]})))}function TN(l){const{components:s}=oi();return I.createElement(s.Button,{...l})}function AN(l){return I.createElement("option",{...l})}function _N(l){const{components:s}=oi();return I.createElement(s.Button,{...l})}function kN(l){const{rootRef:s,...u}=l;return I.createElement("div",{...u,ref:s})}function RN(l){return I.createElement("select",{...l})}function UN(l){const{week:s,...u}=l;return I.createElement("tr",{...u})}function BN(l){return I.createElement("th",{...l})}function HN(l){return I.createElement("thead",{"aria-hidden":!0},I.createElement("tr",{...l}))}function qN(l){const{week:s,...u}=l;return I.createElement("th",{...u})}function YN(l){return I.createElement("th",{...l})}function LN(l){return I.createElement("tbody",{...l})}function GN(l){const{components:s}=oi();return I.createElement(s.Dropdown,{...l})}const KN=Object.freeze(Object.defineProperty({__proto__:null,Button:yN,CaptionLabel:vN,Chevron:xN,Day:bN,DayButton:SN,Dropdown:NN,DropdownNav:jN,Footer:CN,Month:MN,MonthCaption:wN,MonthGrid:zN,Months:EN,MonthsDropdown:DN,Nav:ON,NextMonthButton:TN,Option:AN,PreviousMonthButton:_N,Root:kN,Select:RN,Week:UN,WeekNumber:qN,WeekNumberHeader:YN,Weekday:BN,Weekdays:HN,Weeks:LN,YearsDropdown:GN},Symbol.toStringTag,{value:"Module"}));function oa(l,s,u=!1,r=kn){let{from:f,to:m}=l;const{differenceInCalendarDays:h,isSameDay:p}=r;return f&&m?(h(m,f)<0&&([f,m]=[m,f]),h(s,f)>=(u?1:0)&&h(m,s)>=(u?1:0)):!u&&m?p(m,s):!u&&f?p(f,s):!1}function Rc(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function Go(l){return!!(l&&typeof l=="object"&&"from"in l)}function Uc(l){return!!(l&&typeof l=="object"&&"after"in l)}function Bc(l){return!!(l&&typeof l=="object"&&"before"in l)}function Ag(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function _g(l,s){return Array.isArray(l)&&l.every(s.isDate)}function ra(l,s,u=kn){const r=Array.isArray(s)?s:[s],{isSameDay:f,differenceInCalendarDays:m,isAfter:h}=u;return r.some(p=>{if(typeof p=="boolean")return p;if(u.isDate(p))return f(l,p);if(_g(p,u))return p.some(y=>f(l,y));if(Go(p))return oa(p,l,!1,u);if(Ag(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(l.getDay()):p.dayOfWeek===l.getDay();if(Rc(p)){const y=m(p.before,l),j=m(p.after,l),M=y>0,v=j<0;return h(p.before,p.after)?v&&M:M||v}return Uc(p)?m(l,p.after)>0:Bc(p)?m(p.before,l)>0:typeof p=="function"?p(l):!1})}function QN(l,s,u,r,f){const{disabled:m,hidden:h,modifiers:p,showOutsideDays:y,broadcastCalendar:j,today:M=f.today()}=s,{isSameDay:v,isSameMonth:x,startOfMonth:R,isBefore:O,endOfMonth:B,isAfter:q}=f,_=u&&R(u),X=r&&B(r),G={[at.focused]:[],[at.outside]:[],[at.disabled]:[],[at.hidden]:[],[at.today]:[]},Z={};for(const k of l){const{date:w,displayMonth:Y}=k,J=!!(Y&&!x(w,Y)),P=!!(_&&O(w,_)),pe=!!(X&&q(w,X)),ue=!!(m&&ra(w,m,f)),se=!!(h&&ra(w,h,f))||P||pe||!j&&!y&&J||j&&y===!1&&J,qe=v(w,M);J&&G.outside.push(k),ue&&G.disabled.push(k),se&&G.hidden.push(k),qe&&G.today.push(k),p&&Object.keys(p).forEach(ye=>{const Se=p?.[ye];Se&&ra(w,Se,f)&&(Z[ye]?Z[ye].push(k):Z[ye]=[k])})}return k=>{const w={[at.focused]:!1,[at.disabled]:!1,[at.hidden]:!1,[at.outside]:!1,[at.today]:!1},Y={};for(const J in G){const P=G[J];w[J]=P.some(pe=>pe===k)}for(const J in Z)Y[J]=Z[J].some(P=>P===k);return{...w,...Y}}}function XN(l,s,u={}){return Object.entries(l).filter(([,f])=>f===!0).reduce((f,[m])=>(u[m]?f.push(u[m]):s[at[m]]?f.push(s[at[m]]):s[Sn[m]]&&f.push(s[Sn[m]]),f),[s[oe.Day]])}function VN(l){return{...KN,...l}}function ZN(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(([u,r])=>{u.startsWith("data-")&&(s[u]=r)}),s}function WN(){const l={};for(const s in oe)l[oe[s]]=`rdp-${oe[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 kg(l,s,u){return(u??new en(s)).formatMonthYear(l)}const JN=kg;function $N(l,s,u){return(u??new en(s)).format(l,"d")}function FN(l,s=kn){return s.format(l,"LLLL")}function IN(l,s,u){return(u??new en(s)).format(l,"cccccc")}function PN(l,s=kn){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function e2(){return""}function Rg(l,s=kn){return s.format(l,"yyyy")}const t2=Rg,n2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:kg,formatDay:$N,formatMonthCaption:JN,formatMonthDropdown:FN,formatWeekNumber:PN,formatWeekNumberHeader:e2,formatWeekdayName:IN,formatYearCaption:t2,formatYearDropdown:Rg},Symbol.toStringTag,{value:"Module"}));function a2(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...n2,...l}}function Hc(l,s,u,r){let f=(r??new en(u)).format(l,"PPPP");return s.today&&(f=`Today, ${f}`),s.selected&&(f=`${f}, selected`),f}const l2=Hc;function qc(l,s,u){return(u??new en(s)).formatMonthYear(l)}const s2=qc;function Ug(l,s,u,r){let f=(r??new en(u)).format(l,"PPPP");return s?.today&&(f=`Today, ${f}`),f}function Bg(l){return"Choose the Month"}function Hg(){return""}const i2="Go to the Next Month";function qg(l,s){return i2}function Yg(l){return"Go to the Previous Month"}function Lg(l,s,u){return(u??new en(s)).format(l,"cccc")}function Gg(l,s){return`Week ${l}`}function Kg(l){return"Week Number"}function Qg(l){return"Choose the Year"}const o2=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:s2,labelDay:l2,labelDayButton:Hc,labelGrid:qc,labelGridcell:Ug,labelMonthDropdown:Bg,labelNav:Hg,labelNext:qg,labelPrevious:Yg,labelWeekNumber:Gg,labelWeekNumberHeader:Kg,labelWeekday:Lg,labelYearDropdown:Qg},Symbol.toStringTag,{value:"Module"})),bn=(l,s,u)=>s||(u?typeof u=="function"?u:(...r)=>u:l);function r2(l,s){const u=s.locale?.labels??{};return{...o2,...l??{},labelDayButton:bn(Hc,l?.labelDayButton,u.labelDayButton),labelMonthDropdown:bn(Bg,l?.labelMonthDropdown,u.labelMonthDropdown),labelNext:bn(qg,l?.labelNext,u.labelNext),labelPrevious:bn(Yg,l?.labelPrevious,u.labelPrevious),labelWeekNumber:bn(Gg,l?.labelWeekNumber,u.labelWeekNumber),labelYearDropdown:bn(Qg,l?.labelYearDropdown,u.labelYearDropdown),labelGrid:bn(qc,l?.labelGrid,u.labelGrid),labelGridcell:bn(Ug,l?.labelGridcell,u.labelGridcell),labelNav:bn(Hg,l?.labelNav,u.labelNav),labelWeekNumberHeader:bn(Kg,l?.labelWeekNumberHeader,u.labelWeekNumberHeader),labelWeekday:bn(Lg,l?.labelWeekday,u.labelWeekday)}}function u2(l,s,u,r,f){const{startOfMonth:m,startOfYear:h,endOfYear:p,eachMonthOfInterval:y,getMonth:j}=f;return y({start:h(l),end:p(l)}).map(x=>{const R=r.formatMonthDropdown(x,f),O=j(x),B=s&&x<m(s)||u&&x>m(u)||!1;return{value:O,label:R,disabled:B}})}function c2(l,s={},u={}){let r={...s?.[oe.Day]};return Object.entries(l).filter(([,f])=>f===!0).forEach(([f])=>{r={...r,...u?.[f]}}),r}function f2(l,s,u,r){const f=r??l.today(),m=u?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 d2(l,s,u,r,f=!1){if(!l||!s)return;const{startOfYear:m,endOfYear:h,eachYearOfInterval:p,getYear:y}=r,j=m(l),M=h(s),v=p({start:j,end:M});return f&&v.reverse(),v.map(x=>{const R=u.formatYearDropdown(x,r);return{value:y(x),label:R,disabled:!1}})}const ri=l=>l instanceof HTMLElement?l:null,rc=l=>[...l.querySelectorAll("[data-animated-month]")??[]],m2=l=>ri(l.querySelector("[data-animated-month]")),uc=l=>ri(l.querySelector("[data-animated-caption]")),cc=l=>ri(l.querySelector("[data-animated-weeks]")),h2=l=>ri(l.querySelector("[data-animated-nav]")),p2=l=>ri(l.querySelector("[data-animated-weekdays]"));function g2(l,s,{classNames:u,months:r,focused:f,dateLib:m}){const h=S.useRef(null),p=S.useRef(r),y=S.useRef(!1);S.useLayoutEffect(()=>{const j=p.current;if(p.current=r,!s||!l.current||!(l.current instanceof HTMLElement)||r.length===0||j.length===0||r.length!==j.length)return;const M=m.isSameMonth(r[0].date,j[0].date),v=m.isAfter(r[0].date,j[0].date),x=v?u[Pt.caption_after_enter]:u[Pt.caption_before_enter],R=v?u[Pt.weeks_after_enter]:u[Pt.weeks_before_enter],O=h.current,B=l.current.cloneNode(!0);if(B instanceof HTMLElement?(rc(B).forEach(G=>{if(!(G instanceof HTMLElement))return;const Z=m2(G);Z&&G.contains(Z)&&G.removeChild(Z);const k=uc(G);k&&k.classList.remove(x);const w=cc(G);w&&w.classList.remove(R)}),h.current=B):h.current=null,y.current||M||f)return;const q=O instanceof HTMLElement?rc(O):[],_=rc(l.current);if(_?.every(X=>X instanceof HTMLElement)&&q&&q.every(X=>X instanceof HTMLElement)){y.current=!0,l.current.style.isolation="isolate";const X=h2(l.current);X&&(X.style.zIndex="1"),_.forEach((G,Z)=>{const k=q[Z];if(!k)return;G.style.position="relative",G.style.overflow="hidden";const w=uc(G);w&&w.classList.add(x);const Y=cc(G);Y&&Y.classList.add(R);const J=()=>{y.current=!1,l.current&&(l.current.style.isolation=""),X&&(X.style.zIndex=""),w&&w.classList.remove(x),Y&&Y.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=p2(k);P&&(P.style.opacity="0");const pe=uc(k);pe&&(pe.classList.add(v?u[Pt.caption_before_exit]:u[Pt.caption_after_exit]),pe.addEventListener("animationend",J));const ue=cc(k);ue&&ue.classList.add(v?u[Pt.weeks_before_exit]:u[Pt.weeks_after_exit]),G.insertBefore(k,G.firstChild)})}})}function y2(l,s,u,r){const f=l[0],m=l[l.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:y}=u??{},{addDays:j,differenceInCalendarDays:M,differenceInCalendarMonths:v,endOfBroadcastWeek:x,endOfISOWeek:R,endOfMonth:O,endOfWeek:B,isAfter:q,startOfBroadcastWeek:_,startOfISOWeek:X,startOfWeek:G}=r,Z=y?_(f,r):h?X(f):G(f),k=y?x(m):h?R(O(m)):B(O(m)),w=s&&(y?x(s):h?R(s):B(s)),Y=w&&q(k,w)?w:k,J=M(Y,Z),P=v(m,f)+1,pe=[];for(let qe=0;qe<=J;qe++){const ye=j(Z,qe);pe.push(ye)}const se=(y?35:42)*P;if(p&&pe.length<se){const qe=se-pe.length;for(let ye=0;ye<qe;ye++){const Se=j(pe[pe.length-1],1);pe.push(Se)}}return pe}function v2(l){const s=[];return l.reduce((u,r)=>{const f=r.weeks.reduce((m,h)=>m.concat(h.days.slice()),s.slice());return u.concat(f.slice())},s.slice())}function x2(l,s,u,r){const{numberOfMonths:f=1}=u,m=[];for(let h=0;h<f;h++){const p=r.addMonths(l,h);if(s&&p>s)break;m.push(p)}return m}function up(l,s,u,r){const{month:f,defaultMonth:m,today:h=r.today(),numberOfMonths:p=1}=l;let y=f||m||h;const{differenceInCalendarMonths:j,addMonths:M,startOfMonth:v}=r;if(u&&j(u,y)<p-1){const x=-1*(p-1);y=M(u,x)}return s&&j(y,s)<0&&(y=s),v(y)}function b2(l,s,u,r){const{addDays:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:p,endOfWeek:y,getISOWeek:j,getWeek:M,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:R}=r,O=l.reduce((B,q)=>{const _=u.broadcastCalendar?v(q,r):u.ISOWeek?x(q):R(q),X=u.broadcastCalendar?m(q):u.ISOWeek?h(p(q)):y(p(q)),G=s.filter(Y=>Y>=_&&Y<=X),Z=u.broadcastCalendar?35:42;if(u.fixedWeeks&&G.length<Z){const Y=s.filter(J=>{const P=Z-G.length;return J>X&&J<=f(X,P)});G.push(...Y)}const k=G.reduce((Y,J)=>{const P=u.ISOWeek?j(J):M(J),pe=Y.find(se=>se.weekNumber===P),ue=new Og(J,q,r);return pe?pe.days.push(ue):Y.push(new gN(P,[ue])),Y},[]),w=new pN(q,k);return B.push(w),B},[]);return u.reverseMonths?O.reverse():O}function S2(l,s){let{startMonth:u,endMonth:r}=l;const{startOfYear:f,startOfDay:m,startOfMonth:h,endOfMonth:p,addYears:y,endOfYear:j,newDate:M,today:v}=s,{fromYear:x,toYear:R,fromMonth:O,toMonth:B}=l;!u&&O&&(u=O),!u&&x&&(u=s.newDate(x,0,1)),!r&&B&&(r=B),!r&&R&&(r=M(R,11,31));const q=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return u?u=h(u):x?u=M(x,0,1):!u&&q&&(u=f(y(l.today??v(),-100))),r?r=p(r):R?r=M(R,11,31):!r&&q&&(r=j(l.today??v())),[u&&m(u),r&&m(r)]}function N2(l,s,u,r){if(u.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m=1}=u,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=r,j=f?m:1,M=h(l);if(!s)return p(M,j);if(!(y(s,l)<m))return p(M,j)}function j2(l,s,u,r){if(u.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m}=u,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=r,j=f?m??1:1,M=h(l);if(!s)return p(M,-j);if(!(y(M,s)<=0))return p(M,-j)}function C2(l){const s=[];return l.reduce((u,r)=>u.concat(r.weeks.slice()),s.slice())}function Ko(l,s){const[u,r]=S.useState(l);return[s===void 0?u:s,r]}function M2(l,s){const[u,r]=S2(l,s),{startOfMonth:f,endOfMonth:m}=s,h=up(l,u,r,s),[p,y]=Ko(h,l.month?h:void 0);S.useEffect(()=>{const Z=up(l,u,r,s);y(Z)},[l.timeZone]);const{months:j,weeks:M,days:v,previousMonth:x,nextMonth:R}=S.useMemo(()=>{const Z=x2(p,r,{numberOfMonths:l.numberOfMonths},s),k=y2(Z,l.endMonth?m(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),w=b2(Z,k,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),Y=C2(w),J=v2(w),P=j2(p,u,l,s),pe=N2(p,r,l,s);return{months:w,weeks:Y,days:J,previousMonth:P,nextMonth:pe}},[s,p.getTime(),r?.getTime(),u?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:O,onMonthChange:B}=l,q=Z=>M.some(k=>k.days.some(w=>w.isEqualTo(Z))),_=Z=>{if(O)return;let k=f(Z);u&&k<f(u)&&(k=f(u)),r&&k>f(r)&&(k=f(r)),y(k),B?.(k)};return{months:j,weeks:M,days:v,navStart:u,navEnd:r,previousMonth:x,nextMonth:R,goToMonth:_,goToDay:Z=>{q(Z)||_(Z.date)}}}var An;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(An||(An={}));function cp(l){return!l[at.disabled]&&!l[at.hidden]&&!l[at.outside]}function w2(l,s,u,r){let f,m=-1;for(const h of l){const p=s(h);cp(p)&&(p[at.focused]&&m<An.FocusedModifier?(f=h,m=An.FocusedModifier):r?.isEqualTo(h)&&m<An.LastFocused?(f=h,m=An.LastFocused):u(h.date)&&m<An.Selected?(f=h,m=An.Selected):p[at.today]&&m<An.Today&&(f=h,m=An.Today))}return f||(f=l.find(h=>cp(s(h)))),f}function z2(l,s,u,r,f,m,h){const{ISOWeek:p,broadcastCalendar:y}=m,{addDays:j,addMonths:M,addWeeks:v,addYears:x,endOfBroadcastWeek:R,endOfISOWeek:O,endOfWeek:B,max:q,min:_,startOfBroadcastWeek:X,startOfISOWeek:G,startOfWeek:Z}=h;let w={day:j,week:v,month:M,year:x,startOfWeek:Y=>y?X(Y,h):p?G(Y):Z(Y),endOfWeek:Y=>y?R(Y):p?O(Y):B(Y)}[l](u,s==="after"?1:-1);return s==="before"&&r?w=q([r,w]):s==="after"&&f&&(w=_([f,w])),w}function Xg(l,s,u,r,f,m,h,p=0){if(p>365)return;const y=z2(l,s,u.date,r,f,m,h),j=!!(m.disabled&&ra(y,m.disabled,h)),M=!!(m.hidden&&ra(y,m.hidden,h)),v=y,x=new Og(y,v,h);return!j&&!M?x:Xg(l,s,x,r,f,m,h,p+1)}function E2(l,s,u,r,f){const{autoFocus:m}=l,[h,p]=S.useState(),y=w2(s.days,u,r||(()=>!1),h),[j,M]=S.useState(m?y:void 0);return{isFocusTarget:B=>!!y?.isEqualTo(B),setFocused:M,focused:j,blur:()=>{p(j),M(void 0)},moveFocus:(B,q)=>{if(!j)return;const _=Xg(B,q,j,s.navStart,s.navEnd,l,f);_&&(l.disableNavigation&&!s.days.some(G=>G.isEqualTo(_))||(s.goToDay(_),M(_)))}}}function D2(l,s){const{selected:u,required:r,onSelect:f}=l,[m,h]=Ko(u,f?u:void 0),p=f?u:m,{isSameDay:y}=s,j=R=>p?.some(O=>y(O,R))??!1,{min:M,max:v}=l;return{selected:p,select:(R,O,B)=>{let q=[...p??[]];if(j(R)){if(p?.length===M||r&&p?.length===1)return;q=p?.filter(_=>!y(_,R))}else p?.length===v?q=[R]:q=[...q,R];return f||h(q),f?.(q,R,O,B),q},isSelected:j}}function O2(l,s,u=0,r=0,f=!1,m=kn){const{from:h,to:p}=s||{},{isSameDay:y,isAfter:j,isBefore:M}=m;let v;if(!h&&!p)v={from:l,to:u>0?void 0:l};else if(h&&!p)y(h,l)?u===0?v={from:h,to:l}:f?v={from:h,to:void 0}:v=void 0:M(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:u>0?void 0:l};else if(y(p,l))v={from:l,to:u>0?void 0:l};else if(M(l,h))v={from:l,to:p};else if(j(l,h))v={from:h,to:l};else if(j(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);r>0&&x>r?v={from:l,to:void 0}:u>1&&x<u&&(v={from:l,to:void 0})}return v}function T2(l,s,u=kn){const r=Array.isArray(s)?s:[s];let f=l.from;const m=u.differenceInCalendarDays(l.to,l.from),h=Math.min(m,6);for(let p=0;p<=h;p++){if(r.includes(f.getDay()))return!0;f=u.addDays(f,1)}return!1}function fp(l,s,u=kn){return oa(l,s.from,!1,u)||oa(l,s.to,!1,u)||oa(s,l.from,!1,u)||oa(s,l.to,!1,u)}function A2(l,s,u=kn){const r=Array.isArray(s)?s:[s];if(r.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:u.isDate(p)?oa(l,p,!1,u):_g(p,u)?p.some(y=>oa(l,y,!1,u)):Go(p)?p.from&&p.to?fp(l,{from:p.from,to:p.to},u):!1:Ag(p)?T2(l,p.dayOfWeek,u):Rc(p)?u.isAfter(p.before,p.after)?fp(l,{from:u.addDays(p.after,1),to:u.addDays(p.before,-1)},u):ra(l.from,p,u)||ra(l.to,p,u):Uc(p)||Bc(p)?ra(l.from,p,u)||ra(l.to,p,u):!1))return!0;const h=r.filter(p=>typeof p=="function");if(h.length){let p=l.from;const y=u.differenceInCalendarDays(l.to,l.from);for(let j=0;j<=y;j++){if(h.some(M=>M(p)))return!0;p=u.addDays(p,1)}}return!1}function _2(l,s){const{disabled:u,excludeDisabled:r,selected:f,required:m,onSelect:h}=l,[p,y]=Ko(f,h?f:void 0),j=h?f:p;return{selected:j,select:(x,R,O)=>{const{min:B,max:q}=l,_=x?O2(x,j,B,q,m,s):void 0;return r&&u&&_?.from&&_.to&&A2({from:_.from,to:_.to},u,s)&&(_.from=x,_.to=void 0),h||y(_),h?.(_,x,R,O),_},isSelected:x=>j&&oa(j,x,!1,s)}}function k2(l,s){const{selected:u,required:r,onSelect:f}=l,[m,h]=Ko(u,f?u:void 0),p=f?u:m,{isSameDay:y}=s;return{selected:p,select:(v,x,R)=>{let O=v;return!r&&p&&p&&y(v,p)&&(O=void 0),f||h(O),f?.(O,v,x,R),O},isSelected:v=>p?y(p,v):!1}}function R2(l,s){const u=k2(l,s),r=D2(l,s),f=_2(l,s);switch(l.mode){case"single":return u;case"multiple":return r;case"range":return f;default:return}}function wt(l,s){return l instanceof ia&&l.timeZone===s?l:new ia(l,s)}function dp(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?wt(l,s):Array.isArray(l)?l.map(u=>u instanceof Date?wt(u,s):u):Go(l)?{...l,from:l.from?wt(l.from,s):l.from,to:l.to?wt(l.to,s):l.to}:Rc(l)?{before:wt(l.before,s),after:wt(l.after,s)}:Uc(l)?{after:wt(l.after,s)}:Bc(l)?{before:wt(l.before,s)}:l}function fc(l,s){return l&&(Array.isArray(l)?l.map(u=>dp(u,s)):dp(l,s))}function U2(l){let s=l;const u=s.timeZone;if(u&&(s={...l,timeZone:u},s.today&&(s.today=wt(s.today,u)),s.month&&(s.month=wt(s.month,u)),s.defaultMonth&&(s.defaultMonth=wt(s.defaultMonth,u)),s.startMonth&&(s.startMonth=wt(s.startMonth,u)),s.endMonth&&(s.endMonth=wt(s.endMonth,u)),s.mode==="single"&&s.selected?s.selected=wt(s.selected,u):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(ie=>wt(ie,u)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?wt(s.selected.from,u):s.selected.from,to:s.selected.to?wt(s.selected.to,u):s.selected.to}),s.disabled!==void 0&&(s.disabled=fc(s.disabled,u)),s.hidden!==void 0&&(s.hidden=fc(s.hidden,u)),s.modifiers)){const ie={};Object.keys(s.modifiers).forEach(be=>{ie[be]=fc(s.modifiers?.[be],u)}),s.modifiers=ie}const{components:r,formatters:f,labels:m,dateLib:h,locale:p,classNames:y}=S.useMemo(()=>{const ie={...Dg,...s.locale},be=new en({locale:ie,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:be,components:VN(s.components),formatters:a2(s.formatters),labels:r2(s.labels,be.options),locale:ie,classNames:{...WN(),...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:j,mode:M,navLayout:v,numberOfMonths:x=1,onDayBlur:R,onDayClick:O,onDayFocus:B,onDayKeyDown:q,onDayMouseEnter:_,onDayMouseLeave:X,onNextClick:G,onPrevClick:Z,showWeekNumber:k,styles:w}=s,{formatCaption:Y,formatDay:J,formatMonthDropdown:P,formatWeekNumber:pe,formatWeekNumberHeader:ue,formatWeekdayName:se,formatYearDropdown:qe}=f,ye=M2(s,h),{days:Se,months:T,navStart:W,navEnd:ee,previousMonth:me,nextMonth:xe,goToMonth:De}=ye,ce=QN(Se,s,W,ee,h),{isSelected:K,select:$,selected:ae}=R2(s,h)??{},{blur:F,focused:ne,isFocusTarget:ve,moveFocus:Oe,setFocused:Ye}=E2(s,ye,ce,K??(()=>!1),h),{labelDayButton:ht,labelGridcell:pt,labelGrid:Ke,labelMonthDropdown:Pe,labelNav:Dt,labelPrevious:Yt,labelNext:Rn,labelWeekday:Ne,labelWeekNumber:Lt,labelWeekNumberHeader:Mn,labelYearDropdown:Gt}=m,ua=S.useMemo(()=>f2(h,s.ISOWeek,s.broadcastCalendar,s.today),[h,s.ISOWeek,s.broadcastCalendar,s.today]),Un=M!==void 0||O!==void 0,ot=S.useCallback(()=>{me&&(De(me),Z?.(me))},[me,De,Z]),Kt=S.useCallback(()=>{xe&&(De(xe),G?.(xe))},[De,xe,G]),Bn=S.useCallback((ie,be)=>de=>{de.preventDefault(),de.stopPropagation(),Ye(ie),!be.disabled&&($?.(ie.date,be,de),O?.(ie.date,be,de))},[$,O,Ye]),Ua=S.useCallback((ie,be)=>de=>{Ye(ie),B?.(ie.date,be,de)},[B,Ye]),wn=S.useCallback((ie,be)=>de=>{F(),R?.(ie.date,be,de)},[F,R]),zn=S.useCallback((ie,be)=>de=>{const ze={ArrowLeft:[de.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[de.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[de.shiftKey?"year":"week","after"],ArrowUp:[de.shiftKey?"year":"week","before"],PageUp:[de.shiftKey?"year":"month","before"],PageDown:[de.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ze[de.key]){de.preventDefault(),de.stopPropagation();const[$e,ge]=ze[de.key];Oe($e,ge)}q?.(ie.date,be,de)},[Oe,q,s.dir]),rl=S.useCallback((ie,be)=>de=>{_?.(ie.date,be,de)},[_]),Il=S.useCallback((ie,be)=>de=>{X?.(ie.date,be,de)},[X]),Pl=S.useCallback(ie=>be=>{const de=Number(be.target.value),ze=h.setMonth(h.startOfMonth(ie),de);De(ze)},[h,De]),Hn=S.useCallback(ie=>be=>{const de=Number(be.target.value),ze=h.setYear(h.startOfMonth(ie),de);De(ze)},[h,De]),{className:V,style:Me}=S.useMemo(()=>({className:[y[oe.Root],s.className].filter(Boolean).join(" "),style:{...w?.[oe.Root],...s.style}}),[y,s.className,s.style,w]),fe=ZN(s),we=S.useRef(null);g2(we,!!s.animate,{classNames:y,months:T,focused:ne,dateLib:h});const et={dayPickerProps:s,selected:ae,select:$,isSelected:K,months:T,nextMonth:xe,previousMonth:me,goToMonth:De,getModifiers:ce,components:r,classNames:y,styles:w,labels:m,formatters:f};return I.createElement(Tg.Provider,{value:et},I.createElement(r.Root,{rootRef:s.animate?we:void 0,className:V,style:Me,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"],...fe},I.createElement(r.Months,{className:y[oe.Months],style:w?.[oe.Months]},!s.hideNavigation&&!v&&I.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[oe.Nav],style:w?.[oe.Nav],"aria-label":Dt(),onPreviousClick:ot,onNextClick:Kt,previousMonth:me,nextMonth:xe}),T.map((ie,be)=>I.createElement(r.Month,{"data-animated-month":s.animate?"true":void 0,className:y[oe.Month],style:w?.[oe.Month],key:be,displayIndex:be,calendarMonth:ie},v==="around"&&!s.hideNavigation&&be===0&&I.createElement(r.PreviousMonthButton,{type:"button",className:y[oe.PreviousMonthButton],tabIndex:me?void 0:-1,"aria-disabled":me?void 0:!0,"aria-label":Yt(me),onClick:ot,"data-animated-button":s.animate?"true":void 0},I.createElement(r.Chevron,{disabled:me?void 0:!0,className:y[oe.Chevron],orientation:s.dir==="rtl"?"right":"left"})),I.createElement(r.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:y[oe.MonthCaption],style:w?.[oe.MonthCaption],calendarMonth:ie,displayIndex:be},j?.startsWith("dropdown")?I.createElement(r.DropdownNav,{className:y[oe.Dropdowns],style:w?.[oe.Dropdowns]},(()=>{const de=j==="dropdown"||j==="dropdown-months"?I.createElement(r.MonthsDropdown,{key:"month",className:y[oe.MonthsDropdown],"aria-label":Pe(),classNames:y,components:r,disabled:!!s.disableNavigation,onChange:Pl(ie.date),options:u2(ie.date,W,ee,f,h),style:w?.[oe.Dropdown],value:h.getMonth(ie.date)}):I.createElement("span",{key:"month"},P(ie.date,h)),ze=j==="dropdown"||j==="dropdown-years"?I.createElement(r.YearsDropdown,{key:"year",className:y[oe.YearsDropdown],"aria-label":Gt(h.options),classNames:y,components:r,disabled:!!s.disableNavigation,onChange:Hn(ie.date),options:d2(W,ee,f,h,!!s.reverseYears),style:w?.[oe.Dropdown],value:h.getYear(ie.date)}):I.createElement("span",{key:"year"},qe(ie.date,h));return h.getMonthYearOrder()==="year-first"?[ze,de]:[de,ze]})(),I.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"}},Y(ie.date,h.options,h))):I.createElement(r.CaptionLabel,{className:y[oe.CaptionLabel],role:"status","aria-live":"polite"},Y(ie.date,h.options,h))),v==="around"&&!s.hideNavigation&&be===x-1&&I.createElement(r.NextMonthButton,{type:"button",className:y[oe.NextMonthButton],tabIndex:xe?void 0:-1,"aria-disabled":xe?void 0:!0,"aria-label":Rn(xe),onClick:Kt,"data-animated-button":s.animate?"true":void 0},I.createElement(r.Chevron,{disabled:xe?void 0:!0,className:y[oe.Chevron],orientation:s.dir==="rtl"?"left":"right"})),be===x-1&&v==="after"&&!s.hideNavigation&&I.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[oe.Nav],style:w?.[oe.Nav],"aria-label":Dt(),onPreviousClick:ot,onNextClick:Kt,previousMonth:me,nextMonth:xe}),I.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":M==="multiple"||M==="range","aria-label":Ke(ie.date,h.options,h)||void 0,className:y[oe.MonthGrid],style:w?.[oe.MonthGrid]},!s.hideWeekdays&&I.createElement(r.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:y[oe.Weekdays],style:w?.[oe.Weekdays]},k&&I.createElement(r.WeekNumberHeader,{"aria-label":Mn(h.options),className:y[oe.WeekNumberHeader],style:w?.[oe.WeekNumberHeader],scope:"col"},ue()),ua.map(de=>I.createElement(r.Weekday,{"aria-label":Ne(de,h.options,h),className:y[oe.Weekday],key:String(de),style:w?.[oe.Weekday],scope:"col"},se(de,h.options,h)))),I.createElement(r.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:y[oe.Weeks],style:w?.[oe.Weeks]},ie.weeks.map(de=>I.createElement(r.Week,{className:y[oe.Week],key:de.weekNumber,style:w?.[oe.Week],week:de},k&&I.createElement(r.WeekNumber,{week:de,style:w?.[oe.WeekNumber],"aria-label":Lt(de.weekNumber,{locale:p}),className:y[oe.WeekNumber],scope:"row",role:"rowheader"},pe(de.weekNumber,h)),de.days.map(ze=>{const{date:$e}=ze,ge=ce(ze);if(ge[at.focused]=!ge.hidden&&!!ne?.isEqualTo(ze),ge[Sn.selected]=K?.($e)||ge.selected,Go(ae)){const{from:Qt,to:pn}=ae;ge[Sn.range_start]=!!(Qt&&pn&&h.isSameDay($e,Qt)),ge[Sn.range_end]=!!(Qt&&pn&&h.isSameDay($e,pn)),ge[Sn.range_middle]=oa(ae,$e,!0,h)}const zt=c2(ge,w,s.modifiersStyles),qn=XN(ge,y,s.modifiersClassNames),yt=!Un&&!ge.hidden?pt($e,ge,h.options,h):void 0;return I.createElement(r.Day,{key:`${ze.isoDate}_${ze.displayMonthId}`,day:ze,modifiers:ge,className:qn.join(" "),style:zt,role:"gridcell","aria-selected":ge.selected||void 0,"aria-label":yt,"data-day":ze.isoDate,"data-month":ze.outside?ze.dateMonthId:void 0,"data-selected":ge.selected||void 0,"data-disabled":ge.disabled||void 0,"data-hidden":ge.hidden||void 0,"data-outside":ze.outside||void 0,"data-focused":ge.focused||void 0,"data-today":ge.today||void 0},!ge.hidden&&Un?I.createElement(r.DayButton,{className:y[oe.DayButton],style:w?.[oe.DayButton],type:"button",day:ze,modifiers:ge,disabled:!ge.focused&&ge.disabled||void 0,"aria-disabled":ge.focused&&ge.disabled||void 0,tabIndex:ve(ze)?0:-1,"aria-label":ht($e,ge,h.options,h),onClick:Bn(ze,ge),onBlur:wn(ze,ge),onFocus:Ua(ze,ge),onKeyDown:zn(ze,ge),onMouseEnter:rl(ze,ge),onMouseLeave:Il(ze,ge)},J($e,h.options,h)):!ge.hidden&&J(ze.date,h.options,h))})))))))),s.footer&&I.createElement(r.Footer,{className:y[oe.Footer],style:w?.[oe.Footer],role:"status","aria-live":"polite"},s.footer)))}function B2({className:l,classNames:s,showOutsideDays:u=!0,...r}){return c.jsx(U2,{showOutsideDays:u,className:Q("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:Q(Mo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:Q(Mo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:Q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:Q(Mo({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:Q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:Q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:Q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:Q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...s},components:{Chevron:({orientation:f,className:m,...h})=>{const p=f==="left"?Kx:f==="right"?Ao:f==="up"?Mc:Ro;return c.jsx(p,{className:Q("h-4 w-4",m),...h})}},...r})}B2.displayName="Calendar";const H2=S.lazy(()=>Cn(()=>import("./analytics-CX5PurM9.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),q2=S.lazy(()=>Cn(()=>import("./api-D80tfZOx.js"),__vite__mapDeps([12,1,2,13,6,7,5,4,8,3])).then(l=>({default:l.ApiPage}))),Y2=S.lazy(()=>Cn(()=>import("./cliproxy-D4AoDTZB.js"),__vite__mapDeps([14,1,2,6,7,5,10,13,4,8,3])).then(l=>({default:l.CliproxyPage}))),L2=S.lazy(()=>Cn(()=>import("./cliproxy-control-panel-CJ2CfYod.js"),__vite__mapDeps([15,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),G2=S.lazy(()=>Cn(()=>import("./copilot-Q9tyCgYD.js"),__vite__mapDeps([16,1,2,6,13,5,17,7,4,8,3])).then(l=>({default:l.CopilotPage}))),K2=S.lazy(()=>Cn(()=>import("./accounts--0JKEYYO.js"),__vite__mapDeps([18,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),Q2=S.lazy(()=>Cn(()=>import("./settings-CDdHW_gU.js"),__vite__mapDeps([19,1,2,17,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),X2=S.lazy(()=>Cn(()=>import("./health-Cw76uZRy.js"),__vite__mapDeps([20,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),V2=S.lazy(()=>Cn(()=>import("./shared--pI8rTbP.js"),__vite__mapDeps([21,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function Z2(){return c.jsx(qv,{client:ab,children:c.jsx(sb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:c.jsx(ib,{children:c.jsxs(Uv,{children:[c.jsx(Bv,{children:c.jsxs(xn,{element:c.jsx(o1,{}),children:[c.jsx(xn,{path:"/",element:c.jsx(KS,{})}),c.jsx(xn,{path:"/analytics",element:c.jsx(H2,{})}),c.jsx(xn,{path:"/providers",element:c.jsx(q2,{})}),c.jsx(xn,{path:"/cliproxy",element:c.jsx(Y2,{})}),c.jsx(xn,{path:"/cliproxy/control-panel",element:c.jsx(L2,{})}),c.jsx(xn,{path:"/copilot",element:c.jsx(G2,{})}),c.jsx(xn,{path:"/accounts",element:c.jsx(K2,{})}),c.jsx(xn,{path:"/settings",element:c.jsx(Q2,{})}),c.jsx(xn,{path:"/health",element:c.jsx(X2,{})}),c.jsx(xn,{path:"/shared",element:c.jsx(V2,{})})]})}),c.jsx(Yv,{position:"top-right"})]})})})})}const Vg=document.getElementById("root");if(!Vg)throw new Error("Root element not found. Failed to mount React application.");eb.createRoot(Vg).render(c.jsx(S.StrictMode,{children:c.jsx(Z2,{})}));export{oj as $,Zp as A,mn as B,B2 as C,Vp as D,Wp as E,Jp as F,$p as G,jj as H,nl as I,tN as J,a1 as K,ll as L,uj as M,cj as N,fj as O,zj as P,dj as Q,vj as R,nt as S,QS as T,Mj as U,mj as V,gj as W,hj as X,pj as Y,aj as Z,ij as _,Ej as a,sj as a0,Cg as a1,Cn as a2,Mo as a3,bt as a4,gg as a5,mc as a6,yg as a7,bg as a8,Ng as a9,Ub as aa,Bb as ab,Hb as ac,YS as ad,yj as ae,Sg as af,Lb as ag,wj as ah,oN as b,Q as c,Kp as d,Fs as e,m1 as f,nj as g,h1 as h,ii as i,Dj as j,np as k,jg as l,pc as m,gc as n,xj as o,bj as p,Sj as q,Nj as r,PS as s,Cj as t,wc as u,eN as v,nN as w,c1 as x,lj as y,rj as z};
|
|
46
|
+
`+Ba[0],yt=we+ts.length;zn({value:fe.substring(0,we)+ts+fe.substring(et),selectionStart:yt,selectionEnd:yt})}}}else if(V.keyCode===j||V.keyCode===M||V.keyCode===v||V.keyCode===x){var tn=void 0;V.keyCode===j&&V.shiftKey?tn=["(",")"]:V.keyCode===M?V.shiftKey?tn=["{","}"]:tn=["[","]"]:V.keyCode===v?V.shiftKey?tn=['"','"']:tn=["'","'"]:V.keyCode===x&&!V.shiftKey&&(tn=["`","`"]),we!==et&&tn&&(V.preventDefault(),zn({value:fe.substring(0,we)+tn[0]+fe.substring(we,et)+tn[1]+fe.substring(et),selectionStart:we,selectionEnd:et+2}))}else(q?V.metaKey&&V.keyCode===p:V.ctrlKey&&V.keyCode===p)&&!V.shiftKey&&!V.altKey?(V.preventDefault(),rl()):(q?V.metaKey&&V.keyCode===p&&V.shiftKey:B?V.ctrlKey&&V.keyCode===h:V.ctrlKey&&V.keyCode===p&&V.shiftKey)&&!V.altKey?(V.preventDefault(),Il()):V.keyCode===y&&V.ctrlKey&&(!q||V.shiftKey)&&(V.preventDefault(),ua(function(Yn){return!Yn}))}},Hn=function(V){var Me=V.currentTarget,fe=Me.value,we=Me.selectionStart,et=Me.selectionEnd;Bn({value:fe,selectionStart:we,selectionEnd:et},!0),$(fe)};return m.useEffect(function(){Ua()},[Ua]),m.useImperativeHandle(Y,function(){return{get session(){return{history:Ne.current}},set session(V){Ne.current=V.history}}},[]),m.createElement("div",l({},Rn,{style:l(l({},Z.container),ht)}),m.createElement("pre",l({className:ve,"aria-hidden":"true",style:l(l(l({},Z.editor),Z.highlight),Un)},typeof ot=="string"?{dangerouslySetInnerHTML:{__html:ot+"<br />"}}:{children:ot})),m.createElement("textarea",{ref:function(V){return Lt.current=V},style:l(l(l({},Z.editor),Z.textarea),Un),className:_+(Pe?" ".concat(Pe):""),id:Dt,value:Yt,onChange:Hn,onKeyDown:Pl,onClick:xe,onKeyUp:K,onFocus:De,onBlur:me,disabled:P,form:pe,maxLength:T,minLength:W,name:ee,placeholder:ne,readOnly:Oe,required:Ye,autoFocus:J,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),m.createElement("style",{dangerouslySetInnerHTML:{__html:X}}))}),Z={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 Bt.default=G,Bt}var iN=sN();const wj=Rv(iN),zj=zv,Ej=Dv,Dj=Ev,oN=S.forwardRef(({className:l,align:s="center",sideOffset:u=4,...r},f)=>c.jsx(wv,{children:c.jsx(Ap,{ref:f,align:s,sideOffset:u,className:Q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...r})}));oN.displayName=Ap.displayName;function rN(l,s,u="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:l,timeZoneName:u}).format(s).split(/\s/g).slice(2).join(" ")}const uN={},ti={};function sl(l,s){try{const r=(uN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return r in ti?ti[r]:ip(r,r.split(":"))}catch{if(l in ti)return ti[l];const u=l?.match(cN);return u?ip(l,u.slice(1)):NaN}}const cN=/([+-]\d\d):?(\d\d)?/;function ip(l,s){const u=+(s[0]||0),r=+(s[1]||0),f=+(s[2]||0)/60;return ti[l]=u*60+r>0?u*60+r+f:u*60-r-f}class _n extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(sl(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)),zg(this),yc(this)):this.setTime(Date.now())}static tz(s,...u){return u.length?new _n(...u,s):new _n(Date.now(),s)}withTimeZone(s){return new _n(+this,s)}getTimezoneOffset(){const s=-sl(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),yc(this),+this}[Symbol.for("constructDateFrom")](s){return new _n(+new Date(s),this.timeZone)}}const op=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!op.test(l))return;const s=l.replace(op,"$1UTC");_n.prototype[s]&&(l.startsWith("get")?_n.prototype[l]=function(){return this.internal[s]()}:(_n.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),fN(this),+this},_n.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),yc(this),+this}))});function yc(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-sl(l.timeZone,l)*60))}function fN(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()),zg(l)}function zg(l){const s=sl(l.timeZone,l),u=s>0?Math.floor(s):Math.ceil(s),r=new Date(+l);r.setUTCHours(r.getUTCHours()-1);const f=-new Date(+l).getTimezoneOffset(),m=-new Date(+r).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-u;y&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+y);const j=new Date(+l);j.setUTCSeconds(0);const M=f>0?j.getSeconds():(j.getSeconds()-60)%60,v=Math.round(-(sl(l.timeZone,l)*60))%60;(v||M)&&(l.internal.setUTCSeconds(l.internal.getUTCSeconds()+v),Date.prototype.setUTCSeconds.call(l,Date.prototype.getUTCSeconds.call(l)+v+M));const x=sl(l.timeZone,l),R=x>0?Math.floor(x):Math.ceil(x),B=-new Date(+l).getTimezoneOffset()-R,q=R!==u,_=B-y;if(q&&_){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+_);const X=sl(l.timeZone,l),G=X>0?Math.floor(X):Math.ceil(X),Z=R-G;Z&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+Z),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+Z))}}class ia extends _n{static tz(s,...u){return u.length?new ia(...u,s):new ia(Date.now(),s)}toISOString(){const[s,u,r]=this.tzComponents(),f=`${s}${u}:${r}`;return this.internal.toISOString().slice(0,-1)+f}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,u,r,f]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${r} ${u} ${f}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[u,r,f]=this.tzComponents();return`${s} GMT${u}${r}${f} (${rN(this.timeZone,this)})`}toLocaleString(s,u){return Date.prototype.toLocaleString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}toLocaleDateString(s,u){return Date.prototype.toLocaleDateString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}toLocaleTimeString(s,u){return Date.prototype.toLocaleTimeString.call(this,s,{...u,timeZone:u?.timeZone||this.timeZone})}tzComponents(){const s=this.getTimezoneOffset(),u=s>0?"-":"+",r=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),f=String(Math.abs(s)%60).padStart(2,"0");return[u,r,f]}withTimeZone(s){return new ia(+this,s)}[Symbol.for("constructDateFrom")](s){return new ia(+new Date(s),this.timeZone)}}const rp=5,dN=4;function mN(l,s){const u=s.startOfMonth(l),r=u.getDay()>0?u.getDay():7,f=s.addDays(l,-r+1),m=s.addDays(f,rp*7-1);return s.getMonth(l)===s.getMonth(m)?rp:dN}function Eg(l,s){const u=s.startOfMonth(l),r=u.getDay();return r===1?u:r===0?s.addDays(u,-6):s.addDays(u,-1*(r-1))}function hN(l,s){const u=Eg(l,s),r=mN(l,s);return s.addDays(u,r*7-1)}const Dg={...Zs,labels:{labelDayButton:(l,s,u,r)=>{let f;r&&typeof r.format=="function"?f=r.format.bind(r):f=(h,p)=>$s(h,p,{locale:Zs,...u});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,u)=>{let r;return u&&typeof u.format=="function"?r=u.format.bind(u):r=(f,m)=>$s(f,m,{locale:Zs,...s}),r(l,"LLLL yyyy")},labelGridcell:(l,s,u,r)=>{let f;r&&typeof r.format=="function"?f=r.format.bind(r):f=(h,p)=>$s(h,p,{locale:Zs,...u});let m=f(l,"PPPP");return s?.today&&(m=`Today, ${m}`),m},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,u)=>{let r;return u&&typeof u.format=="function"?r=u.format.bind(u):r=(f,m)=>$s(f,m,{locale:Zs,...s}),r(l,"cccc")}}};class en{constructor(s,u){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ia.tz(this.options.timeZone):new this.Date,this.newDate=(r,f,m)=>this.overrides?.newDate?this.overrides.newDate(r,f,m):this.options.timeZone?new ia(r,f,m,this.options.timeZone):new Date(r,f,m),this.addDays=(r,f)=>this.overrides?.addDays?this.overrides.addDays(r,f):Kv(r,f),this.addMonths=(r,f)=>this.overrides?.addMonths?this.overrides.addMonths(r,f):Qv(r,f),this.addWeeks=(r,f)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,f):Xv(r,f),this.addYears=(r,f)=>this.overrides?.addYears?this.overrides.addYears(r,f):Vv(r,f),this.differenceInCalendarDays=(r,f)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,f):Zv(r,f),this.differenceInCalendarMonths=(r,f)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,f):Wv(r,f),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Jv(r),this.eachYearOfInterval=r=>{const f=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):$v(r),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=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hN(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Fv(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Iv(r),this.endOfWeek=(r,f)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,f):Pv(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):ex(r),this.format=(r,f,m)=>{const h=this.overrides?.format?this.overrides.format(r,f,this.options):$s(r,f,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):tx(r),this.getMonth=(r,f)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):nx(r,this.options),this.getYear=(r,f)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):ax(r,this.options),this.getWeek=(r,f)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):lx(r,this.options),this.isAfter=(r,f)=>this.overrides?.isAfter?this.overrides.isAfter(r,f):sx(r,f),this.isBefore=(r,f)=>this.overrides?.isBefore?this.overrides.isBefore(r,f):ix(r,f),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):ox(r),this.isSameDay=(r,f)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,f):rx(r,f),this.isSameMonth=(r,f)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,f):ux(r,f),this.isSameYear=(r,f)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,f):cx(r,f),this.max=r=>this.overrides?.max?this.overrides.max(r):fx(r),this.min=r=>this.overrides?.min?this.overrides.min(r):dx(r),this.setMonth=(r,f)=>this.overrides?.setMonth?this.overrides.setMonth(r,f):mx(r,f),this.setYear=(r,f)=>this.overrides?.setYear?this.overrides.setYear(r,f):hx(r,f),this.startOfBroadcastWeek=(r,f)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Eg(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):px(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):gx(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):yx(r),this.startOfWeek=(r,f)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):vx(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):xx(r),this.options={locale:Dg,...s},this.overrides=u}getDigitMap(){const{numerals:s="latn"}=this.options,u=new Intl.NumberFormat("en-US",{numberingSystem:s}),r={};for(let f=0;f<10;f++)r[f.toString()]=u.format(f);return r}replaceDigits(s){const u=this.getDigitMap();return s.replace(/\d/g,r=>u[r]||r)}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:u,timeZone:r,numerals:f}=this.options,m=u?.code;if(m&&en.yearFirstLocales.has(m))try{return new Intl.DateTimeFormat(m,{month:"long",year:"numeric",timeZone:r,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 kn=new en;class Og{constructor(s,u,r=kn){this.date=s,this.displayMonth=u,this.outside=!!(u&&!r.isSameMonth(s,u)),this.dateLib=r,this.isoDate=r.format(s,"yyyy-MM-dd"),this.displayMonthId=r.format(u,"yyyy-MM"),this.dateMonthId=r.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class pN{constructor(s,u){this.date=s,this.weeks=u}}class gN{constructor(s,u){this.days=u,this.weekNumber=s}}function yN(l){return I.createElement("button",{...l})}function vN(l){return I.createElement("span",{...l})}function xN(l){const{size:s=24,orientation:u="left",className:r}=l;return I.createElement("svg",{className:r,width:s,height:s,viewBox:"0 0 24 24"},u==="up"&&I.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),u==="down"&&I.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),u==="left"&&I.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),u==="right"&&I.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function bN(l){const{day:s,modifiers:u,...r}=l;return I.createElement("td",{...r})}function SN(l){const{day:s,modifiers:u,...r}=l,f=I.useRef(null);return I.useEffect(()=>{u.focused&&f.current?.focus()},[u.focused]),I.createElement("button",{ref:f,...r})}var oe;(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"})(oe||(oe={}));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 NN(l){const{options:s,className:u,components:r,classNames:f,...m}=l,h=[f[oe.Dropdown],u].join(" "),p=s?.find(({value:y})=>y===m.value);return I.createElement("span",{"data-disabled":m.disabled,className:f[oe.DropdownRoot]},I.createElement(r.Select,{className:h,...m},s?.map(({value:y,label:j,disabled:M})=>I.createElement(r.Option,{key:y,value:y,disabled:M},j))),I.createElement("span",{className:f[oe.CaptionLabel],"aria-hidden":!0},p?.label,I.createElement(r.Chevron,{orientation:"down",size:18,className:f[oe.Chevron]})))}function jN(l){return I.createElement("div",{...l})}function CN(l){return I.createElement("div",{...l})}function MN(l){const{calendarMonth:s,displayIndex:u,...r}=l;return I.createElement("div",{...r},l.children)}function wN(l){const{calendarMonth:s,displayIndex:u,...r}=l;return I.createElement("div",{...r})}function zN(l){return I.createElement("table",{...l})}function EN(l){return I.createElement("div",{...l})}const Tg=S.createContext(void 0);function oi(){const l=S.useContext(Tg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function DN(l){const{components:s}=oi();return I.createElement(s.Dropdown,{...l})}function ON(l){const{onPreviousClick:s,onNextClick:u,previousMonth:r,nextMonth:f,...m}=l,{components:h,classNames:p,labels:{labelPrevious:y,labelNext:j}}=oi(),M=S.useCallback(x=>{f&&u?.(x)},[f,u]),v=S.useCallback(x=>{r&&s?.(x)},[r,s]);return I.createElement("nav",{...m},I.createElement(h.PreviousMonthButton,{type:"button",className:p[oe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":y(r),onClick:v},I.createElement(h.Chevron,{disabled:r?void 0:!0,className:p[oe.Chevron],orientation:"left"})),I.createElement(h.NextMonthButton,{type:"button",className:p[oe.NextMonthButton],tabIndex:f?void 0:-1,"aria-disabled":f?void 0:!0,"aria-label":j(f),onClick:M},I.createElement(h.Chevron,{disabled:f?void 0:!0,orientation:"right",className:p[oe.Chevron]})))}function TN(l){const{components:s}=oi();return I.createElement(s.Button,{...l})}function AN(l){return I.createElement("option",{...l})}function _N(l){const{components:s}=oi();return I.createElement(s.Button,{...l})}function kN(l){const{rootRef:s,...u}=l;return I.createElement("div",{...u,ref:s})}function RN(l){return I.createElement("select",{...l})}function UN(l){const{week:s,...u}=l;return I.createElement("tr",{...u})}function BN(l){return I.createElement("th",{...l})}function HN(l){return I.createElement("thead",{"aria-hidden":!0},I.createElement("tr",{...l}))}function qN(l){const{week:s,...u}=l;return I.createElement("th",{...u})}function YN(l){return I.createElement("th",{...l})}function LN(l){return I.createElement("tbody",{...l})}function GN(l){const{components:s}=oi();return I.createElement(s.Dropdown,{...l})}const KN=Object.freeze(Object.defineProperty({__proto__:null,Button:yN,CaptionLabel:vN,Chevron:xN,Day:bN,DayButton:SN,Dropdown:NN,DropdownNav:jN,Footer:CN,Month:MN,MonthCaption:wN,MonthGrid:zN,Months:EN,MonthsDropdown:DN,Nav:ON,NextMonthButton:TN,Option:AN,PreviousMonthButton:_N,Root:kN,Select:RN,Week:UN,WeekNumber:qN,WeekNumberHeader:YN,Weekday:BN,Weekdays:HN,Weeks:LN,YearsDropdown:GN},Symbol.toStringTag,{value:"Module"}));function oa(l,s,u=!1,r=kn){let{from:f,to:m}=l;const{differenceInCalendarDays:h,isSameDay:p}=r;return f&&m?(h(m,f)<0&&([f,m]=[m,f]),h(s,f)>=(u?1:0)&&h(m,s)>=(u?1:0)):!u&&m?p(m,s):!u&&f?p(f,s):!1}function Rc(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function Go(l){return!!(l&&typeof l=="object"&&"from"in l)}function Uc(l){return!!(l&&typeof l=="object"&&"after"in l)}function Bc(l){return!!(l&&typeof l=="object"&&"before"in l)}function Ag(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function _g(l,s){return Array.isArray(l)&&l.every(s.isDate)}function ra(l,s,u=kn){const r=Array.isArray(s)?s:[s],{isSameDay:f,differenceInCalendarDays:m,isAfter:h}=u;return r.some(p=>{if(typeof p=="boolean")return p;if(u.isDate(p))return f(l,p);if(_g(p,u))return p.some(y=>f(l,y));if(Go(p))return oa(p,l,!1,u);if(Ag(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(l.getDay()):p.dayOfWeek===l.getDay();if(Rc(p)){const y=m(p.before,l),j=m(p.after,l),M=y>0,v=j<0;return h(p.before,p.after)?v&&M:M||v}return Uc(p)?m(l,p.after)>0:Bc(p)?m(p.before,l)>0:typeof p=="function"?p(l):!1})}function QN(l,s,u,r,f){const{disabled:m,hidden:h,modifiers:p,showOutsideDays:y,broadcastCalendar:j,today:M=f.today()}=s,{isSameDay:v,isSameMonth:x,startOfMonth:R,isBefore:O,endOfMonth:B,isAfter:q}=f,_=u&&R(u),X=r&&B(r),G={[at.focused]:[],[at.outside]:[],[at.disabled]:[],[at.hidden]:[],[at.today]:[]},Z={};for(const k of l){const{date:w,displayMonth:Y}=k,J=!!(Y&&!x(w,Y)),P=!!(_&&O(w,_)),pe=!!(X&&q(w,X)),ue=!!(m&&ra(w,m,f)),se=!!(h&&ra(w,h,f))||P||pe||!j&&!y&&J||j&&y===!1&&J,qe=v(w,M);J&&G.outside.push(k),ue&&G.disabled.push(k),se&&G.hidden.push(k),qe&&G.today.push(k),p&&Object.keys(p).forEach(ye=>{const Se=p?.[ye];Se&&ra(w,Se,f)&&(Z[ye]?Z[ye].push(k):Z[ye]=[k])})}return k=>{const w={[at.focused]:!1,[at.disabled]:!1,[at.hidden]:!1,[at.outside]:!1,[at.today]:!1},Y={};for(const J in G){const P=G[J];w[J]=P.some(pe=>pe===k)}for(const J in Z)Y[J]=Z[J].some(P=>P===k);return{...w,...Y}}}function XN(l,s,u={}){return Object.entries(l).filter(([,f])=>f===!0).reduce((f,[m])=>(u[m]?f.push(u[m]):s[at[m]]?f.push(s[at[m]]):s[Sn[m]]&&f.push(s[Sn[m]]),f),[s[oe.Day]])}function VN(l){return{...KN,...l}}function ZN(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(([u,r])=>{u.startsWith("data-")&&(s[u]=r)}),s}function WN(){const l={};for(const s in oe)l[oe[s]]=`rdp-${oe[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 kg(l,s,u){return(u??new en(s)).formatMonthYear(l)}const JN=kg;function $N(l,s,u){return(u??new en(s)).format(l,"d")}function FN(l,s=kn){return s.format(l,"LLLL")}function IN(l,s,u){return(u??new en(s)).format(l,"cccccc")}function PN(l,s=kn){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function e2(){return""}function Rg(l,s=kn){return s.format(l,"yyyy")}const t2=Rg,n2=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:kg,formatDay:$N,formatMonthCaption:JN,formatMonthDropdown:FN,formatWeekNumber:PN,formatWeekNumberHeader:e2,formatWeekdayName:IN,formatYearCaption:t2,formatYearDropdown:Rg},Symbol.toStringTag,{value:"Module"}));function a2(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...n2,...l}}function Hc(l,s,u,r){let f=(r??new en(u)).format(l,"PPPP");return s.today&&(f=`Today, ${f}`),s.selected&&(f=`${f}, selected`),f}const l2=Hc;function qc(l,s,u){return(u??new en(s)).formatMonthYear(l)}const s2=qc;function Ug(l,s,u,r){let f=(r??new en(u)).format(l,"PPPP");return s?.today&&(f=`Today, ${f}`),f}function Bg(l){return"Choose the Month"}function Hg(){return""}const i2="Go to the Next Month";function qg(l,s){return i2}function Yg(l){return"Go to the Previous Month"}function Lg(l,s,u){return(u??new en(s)).format(l,"cccc")}function Gg(l,s){return`Week ${l}`}function Kg(l){return"Week Number"}function Qg(l){return"Choose the Year"}const o2=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:s2,labelDay:l2,labelDayButton:Hc,labelGrid:qc,labelGridcell:Ug,labelMonthDropdown:Bg,labelNav:Hg,labelNext:qg,labelPrevious:Yg,labelWeekNumber:Gg,labelWeekNumberHeader:Kg,labelWeekday:Lg,labelYearDropdown:Qg},Symbol.toStringTag,{value:"Module"})),bn=(l,s,u)=>s||(u?typeof u=="function"?u:(...r)=>u:l);function r2(l,s){const u=s.locale?.labels??{};return{...o2,...l??{},labelDayButton:bn(Hc,l?.labelDayButton,u.labelDayButton),labelMonthDropdown:bn(Bg,l?.labelMonthDropdown,u.labelMonthDropdown),labelNext:bn(qg,l?.labelNext,u.labelNext),labelPrevious:bn(Yg,l?.labelPrevious,u.labelPrevious),labelWeekNumber:bn(Gg,l?.labelWeekNumber,u.labelWeekNumber),labelYearDropdown:bn(Qg,l?.labelYearDropdown,u.labelYearDropdown),labelGrid:bn(qc,l?.labelGrid,u.labelGrid),labelGridcell:bn(Ug,l?.labelGridcell,u.labelGridcell),labelNav:bn(Hg,l?.labelNav,u.labelNav),labelWeekNumberHeader:bn(Kg,l?.labelWeekNumberHeader,u.labelWeekNumberHeader),labelWeekday:bn(Lg,l?.labelWeekday,u.labelWeekday)}}function u2(l,s,u,r,f){const{startOfMonth:m,startOfYear:h,endOfYear:p,eachMonthOfInterval:y,getMonth:j}=f;return y({start:h(l),end:p(l)}).map(x=>{const R=r.formatMonthDropdown(x,f),O=j(x),B=s&&x<m(s)||u&&x>m(u)||!1;return{value:O,label:R,disabled:B}})}function c2(l,s={},u={}){let r={...s?.[oe.Day]};return Object.entries(l).filter(([,f])=>f===!0).forEach(([f])=>{r={...r,...u?.[f]}}),r}function f2(l,s,u,r){const f=r??l.today(),m=u?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 d2(l,s,u,r,f=!1){if(!l||!s)return;const{startOfYear:m,endOfYear:h,eachYearOfInterval:p,getYear:y}=r,j=m(l),M=h(s),v=p({start:j,end:M});return f&&v.reverse(),v.map(x=>{const R=u.formatYearDropdown(x,r);return{value:y(x),label:R,disabled:!1}})}const ri=l=>l instanceof HTMLElement?l:null,rc=l=>[...l.querySelectorAll("[data-animated-month]")??[]],m2=l=>ri(l.querySelector("[data-animated-month]")),uc=l=>ri(l.querySelector("[data-animated-caption]")),cc=l=>ri(l.querySelector("[data-animated-weeks]")),h2=l=>ri(l.querySelector("[data-animated-nav]")),p2=l=>ri(l.querySelector("[data-animated-weekdays]"));function g2(l,s,{classNames:u,months:r,focused:f,dateLib:m}){const h=S.useRef(null),p=S.useRef(r),y=S.useRef(!1);S.useLayoutEffect(()=>{const j=p.current;if(p.current=r,!s||!l.current||!(l.current instanceof HTMLElement)||r.length===0||j.length===0||r.length!==j.length)return;const M=m.isSameMonth(r[0].date,j[0].date),v=m.isAfter(r[0].date,j[0].date),x=v?u[Pt.caption_after_enter]:u[Pt.caption_before_enter],R=v?u[Pt.weeks_after_enter]:u[Pt.weeks_before_enter],O=h.current,B=l.current.cloneNode(!0);if(B instanceof HTMLElement?(rc(B).forEach(G=>{if(!(G instanceof HTMLElement))return;const Z=m2(G);Z&&G.contains(Z)&&G.removeChild(Z);const k=uc(G);k&&k.classList.remove(x);const w=cc(G);w&&w.classList.remove(R)}),h.current=B):h.current=null,y.current||M||f)return;const q=O instanceof HTMLElement?rc(O):[],_=rc(l.current);if(_?.every(X=>X instanceof HTMLElement)&&q&&q.every(X=>X instanceof HTMLElement)){y.current=!0,l.current.style.isolation="isolate";const X=h2(l.current);X&&(X.style.zIndex="1"),_.forEach((G,Z)=>{const k=q[Z];if(!k)return;G.style.position="relative",G.style.overflow="hidden";const w=uc(G);w&&w.classList.add(x);const Y=cc(G);Y&&Y.classList.add(R);const J=()=>{y.current=!1,l.current&&(l.current.style.isolation=""),X&&(X.style.zIndex=""),w&&w.classList.remove(x),Y&&Y.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=p2(k);P&&(P.style.opacity="0");const pe=uc(k);pe&&(pe.classList.add(v?u[Pt.caption_before_exit]:u[Pt.caption_after_exit]),pe.addEventListener("animationend",J));const ue=cc(k);ue&&ue.classList.add(v?u[Pt.weeks_before_exit]:u[Pt.weeks_after_exit]),G.insertBefore(k,G.firstChild)})}})}function y2(l,s,u,r){const f=l[0],m=l[l.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:y}=u??{},{addDays:j,differenceInCalendarDays:M,differenceInCalendarMonths:v,endOfBroadcastWeek:x,endOfISOWeek:R,endOfMonth:O,endOfWeek:B,isAfter:q,startOfBroadcastWeek:_,startOfISOWeek:X,startOfWeek:G}=r,Z=y?_(f,r):h?X(f):G(f),k=y?x(m):h?R(O(m)):B(O(m)),w=s&&(y?x(s):h?R(s):B(s)),Y=w&&q(k,w)?w:k,J=M(Y,Z),P=v(m,f)+1,pe=[];for(let qe=0;qe<=J;qe++){const ye=j(Z,qe);pe.push(ye)}const se=(y?35:42)*P;if(p&&pe.length<se){const qe=se-pe.length;for(let ye=0;ye<qe;ye++){const Se=j(pe[pe.length-1],1);pe.push(Se)}}return pe}function v2(l){const s=[];return l.reduce((u,r)=>{const f=r.weeks.reduce((m,h)=>m.concat(h.days.slice()),s.slice());return u.concat(f.slice())},s.slice())}function x2(l,s,u,r){const{numberOfMonths:f=1}=u,m=[];for(let h=0;h<f;h++){const p=r.addMonths(l,h);if(s&&p>s)break;m.push(p)}return m}function up(l,s,u,r){const{month:f,defaultMonth:m,today:h=r.today(),numberOfMonths:p=1}=l;let y=f||m||h;const{differenceInCalendarMonths:j,addMonths:M,startOfMonth:v}=r;if(u&&j(u,y)<p-1){const x=-1*(p-1);y=M(u,x)}return s&&j(y,s)<0&&(y=s),v(y)}function b2(l,s,u,r){const{addDays:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:p,endOfWeek:y,getISOWeek:j,getWeek:M,startOfBroadcastWeek:v,startOfISOWeek:x,startOfWeek:R}=r,O=l.reduce((B,q)=>{const _=u.broadcastCalendar?v(q,r):u.ISOWeek?x(q):R(q),X=u.broadcastCalendar?m(q):u.ISOWeek?h(p(q)):y(p(q)),G=s.filter(Y=>Y>=_&&Y<=X),Z=u.broadcastCalendar?35:42;if(u.fixedWeeks&&G.length<Z){const Y=s.filter(J=>{const P=Z-G.length;return J>X&&J<=f(X,P)});G.push(...Y)}const k=G.reduce((Y,J)=>{const P=u.ISOWeek?j(J):M(J),pe=Y.find(se=>se.weekNumber===P),ue=new Og(J,q,r);return pe?pe.days.push(ue):Y.push(new gN(P,[ue])),Y},[]),w=new pN(q,k);return B.push(w),B},[]);return u.reverseMonths?O.reverse():O}function S2(l,s){let{startMonth:u,endMonth:r}=l;const{startOfYear:f,startOfDay:m,startOfMonth:h,endOfMonth:p,addYears:y,endOfYear:j,newDate:M,today:v}=s,{fromYear:x,toYear:R,fromMonth:O,toMonth:B}=l;!u&&O&&(u=O),!u&&x&&(u=s.newDate(x,0,1)),!r&&B&&(r=B),!r&&R&&(r=M(R,11,31));const q=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return u?u=h(u):x?u=M(x,0,1):!u&&q&&(u=f(y(l.today??v(),-100))),r?r=p(r):R?r=M(R,11,31):!r&&q&&(r=j(l.today??v())),[u&&m(u),r&&m(r)]}function N2(l,s,u,r){if(u.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m=1}=u,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=r,j=f?m:1,M=h(l);if(!s)return p(M,j);if(!(y(s,l)<m))return p(M,j)}function j2(l,s,u,r){if(u.disableNavigation)return;const{pagedNavigation:f,numberOfMonths:m}=u,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:y}=r,j=f?m??1:1,M=h(l);if(!s)return p(M,-j);if(!(y(M,s)<=0))return p(M,-j)}function C2(l){const s=[];return l.reduce((u,r)=>u.concat(r.weeks.slice()),s.slice())}function Ko(l,s){const[u,r]=S.useState(l);return[s===void 0?u:s,r]}function M2(l,s){const[u,r]=S2(l,s),{startOfMonth:f,endOfMonth:m}=s,h=up(l,u,r,s),[p,y]=Ko(h,l.month?h:void 0);S.useEffect(()=>{const Z=up(l,u,r,s);y(Z)},[l.timeZone]);const{months:j,weeks:M,days:v,previousMonth:x,nextMonth:R}=S.useMemo(()=>{const Z=x2(p,r,{numberOfMonths:l.numberOfMonths},s),k=y2(Z,l.endMonth?m(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),w=b2(Z,k,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),Y=C2(w),J=v2(w),P=j2(p,u,l,s),pe=N2(p,r,l,s);return{months:w,weeks:Y,days:J,previousMonth:P,nextMonth:pe}},[s,p.getTime(),r?.getTime(),u?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:O,onMonthChange:B}=l,q=Z=>M.some(k=>k.days.some(w=>w.isEqualTo(Z))),_=Z=>{if(O)return;let k=f(Z);u&&k<f(u)&&(k=f(u)),r&&k>f(r)&&(k=f(r)),y(k),B?.(k)};return{months:j,weeks:M,days:v,navStart:u,navEnd:r,previousMonth:x,nextMonth:R,goToMonth:_,goToDay:Z=>{q(Z)||_(Z.date)}}}var An;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(An||(An={}));function cp(l){return!l[at.disabled]&&!l[at.hidden]&&!l[at.outside]}function w2(l,s,u,r){let f,m=-1;for(const h of l){const p=s(h);cp(p)&&(p[at.focused]&&m<An.FocusedModifier?(f=h,m=An.FocusedModifier):r?.isEqualTo(h)&&m<An.LastFocused?(f=h,m=An.LastFocused):u(h.date)&&m<An.Selected?(f=h,m=An.Selected):p[at.today]&&m<An.Today&&(f=h,m=An.Today))}return f||(f=l.find(h=>cp(s(h)))),f}function z2(l,s,u,r,f,m,h){const{ISOWeek:p,broadcastCalendar:y}=m,{addDays:j,addMonths:M,addWeeks:v,addYears:x,endOfBroadcastWeek:R,endOfISOWeek:O,endOfWeek:B,max:q,min:_,startOfBroadcastWeek:X,startOfISOWeek:G,startOfWeek:Z}=h;let w={day:j,week:v,month:M,year:x,startOfWeek:Y=>y?X(Y,h):p?G(Y):Z(Y),endOfWeek:Y=>y?R(Y):p?O(Y):B(Y)}[l](u,s==="after"?1:-1);return s==="before"&&r?w=q([r,w]):s==="after"&&f&&(w=_([f,w])),w}function Xg(l,s,u,r,f,m,h,p=0){if(p>365)return;const y=z2(l,s,u.date,r,f,m,h),j=!!(m.disabled&&ra(y,m.disabled,h)),M=!!(m.hidden&&ra(y,m.hidden,h)),v=y,x=new Og(y,v,h);return!j&&!M?x:Xg(l,s,x,r,f,m,h,p+1)}function E2(l,s,u,r,f){const{autoFocus:m}=l,[h,p]=S.useState(),y=w2(s.days,u,r||(()=>!1),h),[j,M]=S.useState(m?y:void 0);return{isFocusTarget:B=>!!y?.isEqualTo(B),setFocused:M,focused:j,blur:()=>{p(j),M(void 0)},moveFocus:(B,q)=>{if(!j)return;const _=Xg(B,q,j,s.navStart,s.navEnd,l,f);_&&(l.disableNavigation&&!s.days.some(G=>G.isEqualTo(_))||(s.goToDay(_),M(_)))}}}function D2(l,s){const{selected:u,required:r,onSelect:f}=l,[m,h]=Ko(u,f?u:void 0),p=f?u:m,{isSameDay:y}=s,j=R=>p?.some(O=>y(O,R))??!1,{min:M,max:v}=l;return{selected:p,select:(R,O,B)=>{let q=[...p??[]];if(j(R)){if(p?.length===M||r&&p?.length===1)return;q=p?.filter(_=>!y(_,R))}else p?.length===v?q=[R]:q=[...q,R];return f||h(q),f?.(q,R,O,B),q},isSelected:j}}function O2(l,s,u=0,r=0,f=!1,m=kn){const{from:h,to:p}=s||{},{isSameDay:y,isAfter:j,isBefore:M}=m;let v;if(!h&&!p)v={from:l,to:u>0?void 0:l};else if(h&&!p)y(h,l)?u===0?v={from:h,to:l}:f?v={from:h,to:void 0}:v=void 0:M(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:u>0?void 0:l};else if(y(p,l))v={from:l,to:u>0?void 0:l};else if(M(l,h))v={from:l,to:p};else if(j(l,h))v={from:h,to:l};else if(j(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);r>0&&x>r?v={from:l,to:void 0}:u>1&&x<u&&(v={from:l,to:void 0})}return v}function T2(l,s,u=kn){const r=Array.isArray(s)?s:[s];let f=l.from;const m=u.differenceInCalendarDays(l.to,l.from),h=Math.min(m,6);for(let p=0;p<=h;p++){if(r.includes(f.getDay()))return!0;f=u.addDays(f,1)}return!1}function fp(l,s,u=kn){return oa(l,s.from,!1,u)||oa(l,s.to,!1,u)||oa(s,l.from,!1,u)||oa(s,l.to,!1,u)}function A2(l,s,u=kn){const r=Array.isArray(s)?s:[s];if(r.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:u.isDate(p)?oa(l,p,!1,u):_g(p,u)?p.some(y=>oa(l,y,!1,u)):Go(p)?p.from&&p.to?fp(l,{from:p.from,to:p.to},u):!1:Ag(p)?T2(l,p.dayOfWeek,u):Rc(p)?u.isAfter(p.before,p.after)?fp(l,{from:u.addDays(p.after,1),to:u.addDays(p.before,-1)},u):ra(l.from,p,u)||ra(l.to,p,u):Uc(p)||Bc(p)?ra(l.from,p,u)||ra(l.to,p,u):!1))return!0;const h=r.filter(p=>typeof p=="function");if(h.length){let p=l.from;const y=u.differenceInCalendarDays(l.to,l.from);for(let j=0;j<=y;j++){if(h.some(M=>M(p)))return!0;p=u.addDays(p,1)}}return!1}function _2(l,s){const{disabled:u,excludeDisabled:r,selected:f,required:m,onSelect:h}=l,[p,y]=Ko(f,h?f:void 0),j=h?f:p;return{selected:j,select:(x,R,O)=>{const{min:B,max:q}=l,_=x?O2(x,j,B,q,m,s):void 0;return r&&u&&_?.from&&_.to&&A2({from:_.from,to:_.to},u,s)&&(_.from=x,_.to=void 0),h||y(_),h?.(_,x,R,O),_},isSelected:x=>j&&oa(j,x,!1,s)}}function k2(l,s){const{selected:u,required:r,onSelect:f}=l,[m,h]=Ko(u,f?u:void 0),p=f?u:m,{isSameDay:y}=s;return{selected:p,select:(v,x,R)=>{let O=v;return!r&&p&&p&&y(v,p)&&(O=void 0),f||h(O),f?.(O,v,x,R),O},isSelected:v=>p?y(p,v):!1}}function R2(l,s){const u=k2(l,s),r=D2(l,s),f=_2(l,s);switch(l.mode){case"single":return u;case"multiple":return r;case"range":return f;default:return}}function wt(l,s){return l instanceof ia&&l.timeZone===s?l:new ia(l,s)}function dp(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?wt(l,s):Array.isArray(l)?l.map(u=>u instanceof Date?wt(u,s):u):Go(l)?{...l,from:l.from?wt(l.from,s):l.from,to:l.to?wt(l.to,s):l.to}:Rc(l)?{before:wt(l.before,s),after:wt(l.after,s)}:Uc(l)?{after:wt(l.after,s)}:Bc(l)?{before:wt(l.before,s)}:l}function fc(l,s){return l&&(Array.isArray(l)?l.map(u=>dp(u,s)):dp(l,s))}function U2(l){let s=l;const u=s.timeZone;if(u&&(s={...l,timeZone:u},s.today&&(s.today=wt(s.today,u)),s.month&&(s.month=wt(s.month,u)),s.defaultMonth&&(s.defaultMonth=wt(s.defaultMonth,u)),s.startMonth&&(s.startMonth=wt(s.startMonth,u)),s.endMonth&&(s.endMonth=wt(s.endMonth,u)),s.mode==="single"&&s.selected?s.selected=wt(s.selected,u):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(ie=>wt(ie,u)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?wt(s.selected.from,u):s.selected.from,to:s.selected.to?wt(s.selected.to,u):s.selected.to}),s.disabled!==void 0&&(s.disabled=fc(s.disabled,u)),s.hidden!==void 0&&(s.hidden=fc(s.hidden,u)),s.modifiers)){const ie={};Object.keys(s.modifiers).forEach(be=>{ie[be]=fc(s.modifiers?.[be],u)}),s.modifiers=ie}const{components:r,formatters:f,labels:m,dateLib:h,locale:p,classNames:y}=S.useMemo(()=>{const ie={...Dg,...s.locale},be=new en({locale:ie,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:be,components:VN(s.components),formatters:a2(s.formatters),labels:r2(s.labels,be.options),locale:ie,classNames:{...WN(),...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:j,mode:M,navLayout:v,numberOfMonths:x=1,onDayBlur:R,onDayClick:O,onDayFocus:B,onDayKeyDown:q,onDayMouseEnter:_,onDayMouseLeave:X,onNextClick:G,onPrevClick:Z,showWeekNumber:k,styles:w}=s,{formatCaption:Y,formatDay:J,formatMonthDropdown:P,formatWeekNumber:pe,formatWeekNumberHeader:ue,formatWeekdayName:se,formatYearDropdown:qe}=f,ye=M2(s,h),{days:Se,months:T,navStart:W,navEnd:ee,previousMonth:me,nextMonth:xe,goToMonth:De}=ye,ce=QN(Se,s,W,ee,h),{isSelected:K,select:$,selected:ae}=R2(s,h)??{},{blur:F,focused:ne,isFocusTarget:ve,moveFocus:Oe,setFocused:Ye}=E2(s,ye,ce,K??(()=>!1),h),{labelDayButton:ht,labelGridcell:pt,labelGrid:Ke,labelMonthDropdown:Pe,labelNav:Dt,labelPrevious:Yt,labelNext:Rn,labelWeekday:Ne,labelWeekNumber:Lt,labelWeekNumberHeader:Mn,labelYearDropdown:Gt}=m,ua=S.useMemo(()=>f2(h,s.ISOWeek,s.broadcastCalendar,s.today),[h,s.ISOWeek,s.broadcastCalendar,s.today]),Un=M!==void 0||O!==void 0,ot=S.useCallback(()=>{me&&(De(me),Z?.(me))},[me,De,Z]),Kt=S.useCallback(()=>{xe&&(De(xe),G?.(xe))},[De,xe,G]),Bn=S.useCallback((ie,be)=>de=>{de.preventDefault(),de.stopPropagation(),Ye(ie),!be.disabled&&($?.(ie.date,be,de),O?.(ie.date,be,de))},[$,O,Ye]),Ua=S.useCallback((ie,be)=>de=>{Ye(ie),B?.(ie.date,be,de)},[B,Ye]),wn=S.useCallback((ie,be)=>de=>{F(),R?.(ie.date,be,de)},[F,R]),zn=S.useCallback((ie,be)=>de=>{const ze={ArrowLeft:[de.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[de.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[de.shiftKey?"year":"week","after"],ArrowUp:[de.shiftKey?"year":"week","before"],PageUp:[de.shiftKey?"year":"month","before"],PageDown:[de.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ze[de.key]){de.preventDefault(),de.stopPropagation();const[$e,ge]=ze[de.key];Oe($e,ge)}q?.(ie.date,be,de)},[Oe,q,s.dir]),rl=S.useCallback((ie,be)=>de=>{_?.(ie.date,be,de)},[_]),Il=S.useCallback((ie,be)=>de=>{X?.(ie.date,be,de)},[X]),Pl=S.useCallback(ie=>be=>{const de=Number(be.target.value),ze=h.setMonth(h.startOfMonth(ie),de);De(ze)},[h,De]),Hn=S.useCallback(ie=>be=>{const de=Number(be.target.value),ze=h.setYear(h.startOfMonth(ie),de);De(ze)},[h,De]),{className:V,style:Me}=S.useMemo(()=>({className:[y[oe.Root],s.className].filter(Boolean).join(" "),style:{...w?.[oe.Root],...s.style}}),[y,s.className,s.style,w]),fe=ZN(s),we=S.useRef(null);g2(we,!!s.animate,{classNames:y,months:T,focused:ne,dateLib:h});const et={dayPickerProps:s,selected:ae,select:$,isSelected:K,months:T,nextMonth:xe,previousMonth:me,goToMonth:De,getModifiers:ce,components:r,classNames:y,styles:w,labels:m,formatters:f};return I.createElement(Tg.Provider,{value:et},I.createElement(r.Root,{rootRef:s.animate?we:void 0,className:V,style:Me,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"],...fe},I.createElement(r.Months,{className:y[oe.Months],style:w?.[oe.Months]},!s.hideNavigation&&!v&&I.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[oe.Nav],style:w?.[oe.Nav],"aria-label":Dt(),onPreviousClick:ot,onNextClick:Kt,previousMonth:me,nextMonth:xe}),T.map((ie,be)=>I.createElement(r.Month,{"data-animated-month":s.animate?"true":void 0,className:y[oe.Month],style:w?.[oe.Month],key:be,displayIndex:be,calendarMonth:ie},v==="around"&&!s.hideNavigation&&be===0&&I.createElement(r.PreviousMonthButton,{type:"button",className:y[oe.PreviousMonthButton],tabIndex:me?void 0:-1,"aria-disabled":me?void 0:!0,"aria-label":Yt(me),onClick:ot,"data-animated-button":s.animate?"true":void 0},I.createElement(r.Chevron,{disabled:me?void 0:!0,className:y[oe.Chevron],orientation:s.dir==="rtl"?"right":"left"})),I.createElement(r.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:y[oe.MonthCaption],style:w?.[oe.MonthCaption],calendarMonth:ie,displayIndex:be},j?.startsWith("dropdown")?I.createElement(r.DropdownNav,{className:y[oe.Dropdowns],style:w?.[oe.Dropdowns]},(()=>{const de=j==="dropdown"||j==="dropdown-months"?I.createElement(r.MonthsDropdown,{key:"month",className:y[oe.MonthsDropdown],"aria-label":Pe(),classNames:y,components:r,disabled:!!s.disableNavigation,onChange:Pl(ie.date),options:u2(ie.date,W,ee,f,h),style:w?.[oe.Dropdown],value:h.getMonth(ie.date)}):I.createElement("span",{key:"month"},P(ie.date,h)),ze=j==="dropdown"||j==="dropdown-years"?I.createElement(r.YearsDropdown,{key:"year",className:y[oe.YearsDropdown],"aria-label":Gt(h.options),classNames:y,components:r,disabled:!!s.disableNavigation,onChange:Hn(ie.date),options:d2(W,ee,f,h,!!s.reverseYears),style:w?.[oe.Dropdown],value:h.getYear(ie.date)}):I.createElement("span",{key:"year"},qe(ie.date,h));return h.getMonthYearOrder()==="year-first"?[ze,de]:[de,ze]})(),I.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"}},Y(ie.date,h.options,h))):I.createElement(r.CaptionLabel,{className:y[oe.CaptionLabel],role:"status","aria-live":"polite"},Y(ie.date,h.options,h))),v==="around"&&!s.hideNavigation&&be===x-1&&I.createElement(r.NextMonthButton,{type:"button",className:y[oe.NextMonthButton],tabIndex:xe?void 0:-1,"aria-disabled":xe?void 0:!0,"aria-label":Rn(xe),onClick:Kt,"data-animated-button":s.animate?"true":void 0},I.createElement(r.Chevron,{disabled:xe?void 0:!0,className:y[oe.Chevron],orientation:s.dir==="rtl"?"left":"right"})),be===x-1&&v==="after"&&!s.hideNavigation&&I.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:y[oe.Nav],style:w?.[oe.Nav],"aria-label":Dt(),onPreviousClick:ot,onNextClick:Kt,previousMonth:me,nextMonth:xe}),I.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":M==="multiple"||M==="range","aria-label":Ke(ie.date,h.options,h)||void 0,className:y[oe.MonthGrid],style:w?.[oe.MonthGrid]},!s.hideWeekdays&&I.createElement(r.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:y[oe.Weekdays],style:w?.[oe.Weekdays]},k&&I.createElement(r.WeekNumberHeader,{"aria-label":Mn(h.options),className:y[oe.WeekNumberHeader],style:w?.[oe.WeekNumberHeader],scope:"col"},ue()),ua.map(de=>I.createElement(r.Weekday,{"aria-label":Ne(de,h.options,h),className:y[oe.Weekday],key:String(de),style:w?.[oe.Weekday],scope:"col"},se(de,h.options,h)))),I.createElement(r.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:y[oe.Weeks],style:w?.[oe.Weeks]},ie.weeks.map(de=>I.createElement(r.Week,{className:y[oe.Week],key:de.weekNumber,style:w?.[oe.Week],week:de},k&&I.createElement(r.WeekNumber,{week:de,style:w?.[oe.WeekNumber],"aria-label":Lt(de.weekNumber,{locale:p}),className:y[oe.WeekNumber],scope:"row",role:"rowheader"},pe(de.weekNumber,h)),de.days.map(ze=>{const{date:$e}=ze,ge=ce(ze);if(ge[at.focused]=!ge.hidden&&!!ne?.isEqualTo(ze),ge[Sn.selected]=K?.($e)||ge.selected,Go(ae)){const{from:Qt,to:pn}=ae;ge[Sn.range_start]=!!(Qt&&pn&&h.isSameDay($e,Qt)),ge[Sn.range_end]=!!(Qt&&pn&&h.isSameDay($e,pn)),ge[Sn.range_middle]=oa(ae,$e,!0,h)}const zt=c2(ge,w,s.modifiersStyles),qn=XN(ge,y,s.modifiersClassNames),yt=!Un&&!ge.hidden?pt($e,ge,h.options,h):void 0;return I.createElement(r.Day,{key:`${ze.isoDate}_${ze.displayMonthId}`,day:ze,modifiers:ge,className:qn.join(" "),style:zt,role:"gridcell","aria-selected":ge.selected||void 0,"aria-label":yt,"data-day":ze.isoDate,"data-month":ze.outside?ze.dateMonthId:void 0,"data-selected":ge.selected||void 0,"data-disabled":ge.disabled||void 0,"data-hidden":ge.hidden||void 0,"data-outside":ze.outside||void 0,"data-focused":ge.focused||void 0,"data-today":ge.today||void 0},!ge.hidden&&Un?I.createElement(r.DayButton,{className:y[oe.DayButton],style:w?.[oe.DayButton],type:"button",day:ze,modifiers:ge,disabled:!ge.focused&&ge.disabled||void 0,"aria-disabled":ge.focused&&ge.disabled||void 0,tabIndex:ve(ze)?0:-1,"aria-label":ht($e,ge,h.options,h),onClick:Bn(ze,ge),onBlur:wn(ze,ge),onFocus:Ua(ze,ge),onKeyDown:zn(ze,ge),onMouseEnter:rl(ze,ge),onMouseLeave:Il(ze,ge)},J($e,h.options,h)):!ge.hidden&&J(ze.date,h.options,h))})))))))),s.footer&&I.createElement(r.Footer,{className:y[oe.Footer],style:w?.[oe.Footer],role:"status","aria-live":"polite"},s.footer)))}function B2({className:l,classNames:s,showOutsideDays:u=!0,...r}){return c.jsx(U2,{showOutsideDays:u,className:Q("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:Q(Mo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:Q(Mo({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:Q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:Q(Mo({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:Q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:Q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:Q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:Q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...s},components:{Chevron:({orientation:f,className:m,...h})=>{const p=f==="left"?Kx:f==="right"?Ao:f==="up"?Mc:Ro;return c.jsx(p,{className:Q("h-4 w-4",m),...h})}},...r})}B2.displayName="Calendar";const H2=S.lazy(()=>Cn(()=>import("./analytics-D-bqA31W.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),q2=S.lazy(()=>Cn(()=>import("./api-A3IeN2JZ.js"),__vite__mapDeps([12,1,2,13,6,7,5,4,8,3])).then(l=>({default:l.ApiPage}))),Y2=S.lazy(()=>Cn(()=>import("./cliproxy-BY70Tlxq.js"),__vite__mapDeps([14,1,2,6,7,5,10,13,4,8,3])).then(l=>({default:l.CliproxyPage}))),L2=S.lazy(()=>Cn(()=>import("./cliproxy-control-panel-CJ2CfYod.js"),__vite__mapDeps([15,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),G2=S.lazy(()=>Cn(()=>import("./copilot-BRJK1ZW-.js"),__vite__mapDeps([16,1,2,6,13,5,17,7,4,8,3])).then(l=>({default:l.CopilotPage}))),K2=S.lazy(()=>Cn(()=>import("./accounts-CveDKAVc.js"),__vite__mapDeps([18,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),Q2=S.lazy(()=>Cn(()=>import("./settings-BTIPjkGQ.js"),__vite__mapDeps([19,1,2,17,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),X2=S.lazy(()=>Cn(()=>import("./health-626qMQvS.js"),__vite__mapDeps([20,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),V2=S.lazy(()=>Cn(()=>import("./shared-BlJYKD4s.js"),__vite__mapDeps([21,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function Z2(){return c.jsx(qv,{client:ab,children:c.jsx(sb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:c.jsx(ib,{children:c.jsxs(Uv,{children:[c.jsx(Bv,{children:c.jsxs(xn,{element:c.jsx(o1,{}),children:[c.jsx(xn,{path:"/",element:c.jsx(KS,{})}),c.jsx(xn,{path:"/analytics",element:c.jsx(H2,{})}),c.jsx(xn,{path:"/providers",element:c.jsx(q2,{})}),c.jsx(xn,{path:"/cliproxy",element:c.jsx(Y2,{})}),c.jsx(xn,{path:"/cliproxy/control-panel",element:c.jsx(L2,{})}),c.jsx(xn,{path:"/copilot",element:c.jsx(G2,{})}),c.jsx(xn,{path:"/accounts",element:c.jsx(K2,{})}),c.jsx(xn,{path:"/settings",element:c.jsx(Q2,{})}),c.jsx(xn,{path:"/health",element:c.jsx(X2,{})}),c.jsx(xn,{path:"/shared",element:c.jsx(V2,{})})]})}),c.jsx(Yv,{position:"top-right"})]})})})})}const Vg=document.getElementById("root");if(!Vg)throw new Error("Root element not found. Failed to mount React application.");eb.createRoot(Vg).render(c.jsx(S.StrictMode,{children:c.jsx(Z2,{})}));export{oj as $,Zp as A,mn as B,B2 as C,Vp as D,Wp as E,Jp as F,$p as G,jj as H,nl as I,tN as J,a1 as K,ll as L,uj as M,cj as N,fj as O,zj as P,dj as Q,vj as R,nt as S,QS as T,Mj as U,mj as V,gj as W,hj as X,pj as Y,aj as Z,ij as _,Ej as a,sj as a0,Cg as a1,Cn as a2,Mo as a3,bt as a4,gg as a5,mc as a6,yg as a7,bg as a8,Ng as a9,Ub as aa,Bb as ab,Hb as ac,YS as ad,yj as ae,Sg as af,Lb as ag,wj as ah,oN as b,Q as c,Kp as d,Fs as e,m1 as f,nj as g,h1 as h,ii as i,Dj as j,np as k,jg as l,pc as m,gc as n,xj as o,bj as p,Sj as q,Nj as r,PS as s,Cj as t,wc as u,eN as v,nN as w,c1 as x,lj as y,rj as z};
|