@kaitranntt/ccs 6.6.1 → 6.6.2-dev.2

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.
Files changed (33) hide show
  1. package/dist/cliproxy/config-generator.d.ts +1 -1
  2. package/dist/cliproxy/config-generator.d.ts.map +1 -1
  3. package/dist/cliproxy/config-generator.js +5 -1
  4. package/dist/cliproxy/config-generator.js.map +1 -1
  5. package/dist/cliproxy/remote-proxy-client.d.ts +7 -2
  6. package/dist/cliproxy/remote-proxy-client.d.ts.map +1 -1
  7. package/dist/cliproxy/remote-proxy-client.js +36 -2
  8. package/dist/cliproxy/remote-proxy-client.js.map +1 -1
  9. package/dist/config/unified-config-loader.d.ts.map +1 -1
  10. package/dist/config/unified-config-loader.js +2 -1
  11. package/dist/config/unified-config-loader.js.map +1 -1
  12. package/dist/config/unified-config-types.d.ts +9 -2
  13. package/dist/config/unified-config-types.d.ts.map +1 -1
  14. package/dist/config/unified-config-types.js +2 -1
  15. package/dist/config/unified-config-types.js.map +1 -1
  16. package/dist/ui/assets/{accounts-DNYYJ7ul.js → accounts-BXfC8K1x.js} +1 -1
  17. package/dist/ui/assets/{analytics-Dhp2ikxe.js → analytics-CknzoRYp.js} +1 -1
  18. package/dist/ui/assets/{api-CZf-jQ-_.js → api-U2LP6WF0.js} +1 -1
  19. package/dist/ui/assets/{card--rU2tDlq.js → card-CpMqDjRa.js} +1 -1
  20. package/dist/ui/assets/{cliproxy-DZ_5oEVY.js → cliproxy-BEEaca31.js} +1 -1
  21. package/dist/ui/assets/{code-editor-CYOD5x0C.js → code-editor-DmM_bX-t.js} +1 -1
  22. package/dist/ui/assets/{copilot-Dd0yazW6.js → copilot-CQuiaJtb.js} +2 -2
  23. package/dist/ui/assets/{health-CyZQOQg7.js → health-BDkQz8vK.js} +1 -1
  24. package/dist/ui/assets/{index-Ced9Xuhx.js → index-eojxvUPJ.js} +3 -3
  25. package/dist/ui/assets/settings-C7wCYzo1.js +1 -0
  26. package/dist/ui/assets/{shared-BG9bijB0.js → shared-QDPeNpnv.js} +1 -1
  27. package/dist/ui/assets/{switch-fBCFt0Fe.js → switch-K-cpw7I2.js} +1 -1
  28. package/dist/ui/index.html +1 -1
  29. package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
  30. package/dist/web-server/routes/proxy-routes.js +7 -3
  31. package/dist/web-server/routes/proxy-routes.js.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/ui/assets/settings-COL3veEu.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-CYOD5x0C.js","assets/radix-ui-DFHQr9A5.js","assets/react-vendor-FspHSO0w.js","assets/code-highlight-BoHWVYut.js","assets/utils-CzKF5WmX.js","assets/icons-BOsxPbiD.js","assets/tanstack-C4gT2P7V.js","assets/notifications-B2Pz7lik.js","assets/form-utils-BuXDJb0w.js","assets/analytics-Dhp2ikxe.js","assets/card--rU2tDlq.js","assets/charts-B9Jh-s-X.js","assets/api-CZf-jQ-_.js","assets/cliproxy-DZ_5oEVY.js","assets/cliproxy-control-panel-DKMAi4_4.js","assets/copilot-Dd0yazW6.js","assets/switch-fBCFt0Fe.js","assets/accounts-DNYYJ7ul.js","assets/settings-COL3veEu.js","assets/health-CyZQOQg7.js","assets/shared-BG9bijB0.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-DmM_bX-t.js","assets/radix-ui-DFHQr9A5.js","assets/react-vendor-FspHSO0w.js","assets/code-highlight-BoHWVYut.js","assets/utils-CzKF5WmX.js","assets/icons-BOsxPbiD.js","assets/tanstack-C4gT2P7V.js","assets/notifications-B2Pz7lik.js","assets/form-utils-BuXDJb0w.js","assets/analytics-CknzoRYp.js","assets/card-CpMqDjRa.js","assets/charts-B9Jh-s-X.js","assets/api-U2LP6WF0.js","assets/cliproxy-BEEaca31.js","assets/cliproxy-control-panel-DKMAi4_4.js","assets/copilot-CQuiaJtb.js","assets/switch-K-cpw7I2.js","assets/accounts-BXfC8K1x.js","assets/settings-C7wCYzo1.js","assets/health-BDkQz8vK.js","assets/shared-QDPeNpnv.js"])))=>i.map(i=>d[i]);
2
2
  import{j as i,S as Qo,R as E0,a as _x,C as kx,b as Rx,T as Ux,D as Hx,P as Bx,O as qx,c as M0,d as z0,e as D0,f as O0,g as T0,A as A0,h as _0,i as k0,k as R0,l as Lx,V as U0,m as H0,n as Yx,o as B0,p as q0,q as L0,r as Y0,s as G0,t as K0,u as Q0,v as V0,w as X0,x as Z0,L as Gx,y as Kx,z as Qx,B as J0,E as Vx,I as W0,F as Xx,G as Zx,H as $0,J as Jx,K as F0,M as Wx,N as $x,Q as I0,U as P0,W as Fx,X as ey,Y as ty,Z as ny,_ as ay,$ as ly,a0 as sy,a1 as iy,a2 as oy,a3 as ry,a4 as Ix,a5 as cy,a6 as uy,a7 as dy}from"./radix-ui-DFHQr9A5.js";import{e as Px,f as fy,r as y,u as my,L as Du,O as hy,R as xy,h as gy,g as py,c as ie,B as vy,i as yy,j as En}from"./react-vendor-FspHSO0w.js";import{Q as by,u as Xt,a as Rt,b as rn,c as Sy}from"./tanstack-C4gT2P7V.js";import{t as Ue,T as Ny}from"./notifications-B2Pz7lik.js";import{t as jy,c as wy,a as Vo,e as si,f as ri,b as Cy,d as Ey,g as My,h as zy,i as Dy,j as Oy,k as Ty,l as Ay,m as _y,n as ky,o as Ry,p as Uy,q as Hy,r as By,s as qy,u as Ly,v as Yy,w as Gy,x as Ky,y as Qy,z as Vy,A as Xy,B as Zy,C as Jy,D as Wy,E as $y,F as Fy,G as Iy,H as Py,I as eb,J as tb}from"./utils-CzKF5WmX.js";import{X as rs,P as nb,H as ab,C as lb,K as eg,G as sb,Z as Xo,a as tg,F as ng,U as ag,A as hi,S as ib,b as Zo,c as ob,M as rb,E as Jo,d as Wo,B as cb,W as ub,e as Fh,f as lg,g as db,h as Ih,i as Ph,L as ma,j as xi,R as fb,k as ns,l as Bu,m as qu,n as mb,o as hb,T as Lu,p as xb,q as gb,r as sg,s as ig,t as pb,I as cs,u as vb,v as yb,w as bb,x as Yu,y as $o,z as Sb,D as Nb,J as Ou,N as og,O as rg,Q as cg,V as gi,Y as ug,_ as Lo,$ as Tu,a0 as jb,a1 as wb}from"./icons-BOsxPbiD.js";import{o as ex,s as tx,p as Cb,a as Eb,$ as Mb,b as dg,c as zb,d as ol,u as Db}from"./form-utils-BuXDJb0w.js";import"./code-highlight-BoHWVYut.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&c(m)}).observe(document,{childList:!0,subtree:!0});function u(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function c(d){if(d.ep)return;d.ep=!0;const h=u(d);fetch(d.href,h)}})();var gu={exports:{}},ii={},pu={exports:{}},vu={};var nx;function Ob(){return nx||(nx=1,(function(l){function s(D,$){var le=D.length;D.push($);e:for(;0<le;){var xe=le-1>>>1,Ne=D[xe];if(0<d(Ne,$))D[xe]=$,D[le]=Ne,le=xe;else break e}}function u(D){return D.length===0?null:D[0]}function c(D){if(D.length===0)return null;var $=D[0],le=D.pop();if(le!==$){D[0]=le;e:for(var xe=0,Ne=D.length,Oe=Ne>>>1;xe<Oe;){var Ee=2*(xe+1)-1,J=D[Ee],ee=Ee+1,se=D[ee];if(0>d(J,le))ee<Ne&&0>d(se,J)?(D[xe]=se,D[ee]=le,xe=ee):(D[xe]=J,D[Ee]=le,xe=Ee);else if(ee<Ne&&0>d(se,le))D[xe]=se,D[ee]=le,xe=ee;else break e}}return $}function d(D,$){var le=D.sortIndex-$.sortIndex;return le!==0?le:D.id-$.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;l.unstable_now=function(){return h.now()}}else{var m=Date,x=m.now();l.unstable_now=function(){return m.now()-x}}var p=[],j=[],M=1,v=null,S=3,_=!1,B=!1,K=!1,Z=!1,k=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function F(D){for(var $=u(j);$!==null;){if($.callback===null)c(j);else if($.startTime<=D)c(j),$.sortIndex=$.expirationTime,s(p,$);else break;$=u(j)}}function R(D){if(K=!1,F(D),!B)if(u(p)!==null)B=!0,E||(E=!0,ae());else{var $=u(j);$!==null&&de(R,$.startTime-D)}}var E=!1,U=-1,G=5,ne=-1;function re(){return Z?!0:!(l.unstable_now()-ne<G)}function ce(){if(Z=!1,E){var D=l.unstable_now();ne=D;var $=!0;try{e:{B=!1,K&&(K=!1,W(U),U=-1),_=!0;var le=S;try{t:{for(F(D),v=u(p);v!==null&&!(v.expirationTime>D&&re());){var xe=v.callback;if(typeof xe=="function"){v.callback=null,S=v.priorityLevel;var Ne=xe(v.expirationTime<=D);if(D=l.unstable_now(),typeof Ne=="function"){v.callback=Ne,F(D),$=!0;break t}v===u(p)&&c(p),F(D)}else c(p);v=u(p)}if(v!==null)$=!0;else{var Oe=u(j);Oe!==null&&de(R,Oe.startTime-D),$=!1}}break e}finally{v=null,S=le,_=!1}$=void 0}}finally{$?ae():E=!1}}}var ae;if(typeof V=="function")ae=function(){V(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,P=we.port2;we.port1.onmessage=ce,ae=function(){P.postMessage(null)}}else ae=function(){k(ce,0)};function de(D,$){U=k(function(){D(l.unstable_now())},$)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(D){D.callback=null},l.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<D?Math.floor(1e3/D):5},l.unstable_getCurrentPriorityLevel=function(){return S},l.unstable_next=function(D){switch(S){case 1:case 2:case 3:var $=3;break;default:$=S}var le=S;S=$;try{return D()}finally{S=le}},l.unstable_requestPaint=function(){Z=!0},l.unstable_runWithPriority=function(D,$){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var le=S;S=D;try{return $()}finally{S=le}},l.unstable_scheduleCallback=function(D,$,le){var xe=l.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?xe+le:xe):le=xe,D){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=le+Ne,D={id:M++,callback:$,priorityLevel:D,startTime:le,expirationTime:Ne,sortIndex:-1},le>xe?(D.sortIndex=le,s(j,D),u(p)===null&&D===u(j)&&(K?(W(U),U=-1):K=!0,de(R,le-xe))):(D.sortIndex=Ne,s(p,D),B||_||(B=!0,E||(E=!0,ae()))),D},l.unstable_shouldYield=re,l.unstable_wrapCallback=function(D){var $=S;return function(){var le=S;S=$;try{return D.apply(this,arguments)}finally{S=le}}}})(vu)),vu}var ax;function Tb(){return ax||(ax=1,pu.exports=Ob()),pu.exports}var lx;function Ab(){if(lx)return ii;lx=1;var l=Tb(),s=Px(),u=fy();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(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 p(e){if(h(e)!==e)throw Error(c(188))}function j(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,a=t;;){var o=n.return;if(o===null)break;var r=o.alternate;if(r===null){if(a=o.return,a!==null){n=a;continue}break}if(o.child===r.child){for(r=o.child;r;){if(r===n)return p(o),e;if(r===a)return p(o),t;r=r.sibling}throw Error(c(188))}if(n.return!==a.return)n=o,a=r;else{for(var f=!1,g=o.child;g;){if(g===n){f=!0,n=o,a=r;break}if(g===a){f=!0,a=o,n=r;break}g=g.sibling}if(!f){for(g=r.child;g;){if(g===n){f=!0,n=r,a=o;break}if(g===a){f=!0,a=r,n=o;break}g=g.sibling}if(!f)throw Error(c(189))}}if(n.alternate!==a)throw Error(c(190))}if(n.tag!==3)throw Error(c(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,S=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),V=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),re=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function ae(e){return e===null||typeof e!="object"?null:(e=ce&&e[ce]||e["@@iterator"],typeof e=="function"?e:null)}var we=Symbol.for("react.client.reference");function P(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===we?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case k:return"Profiler";case Z:return"StrictMode";case R:return"Suspense";case E:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case B:return"Portal";case V:return e.displayName||"Context";case W:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return t=e.displayName||null,t!==null?t:P(e.type)||"Memo";case G:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var de=Array.isArray,D=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},xe=[],Ne=-1;function Oe(e){return{current:e}}function Ee(e){0>Ne||(e.current=xe[Ne],xe[Ne]=null,Ne--)}function J(e,t){Ne++,xe[Ne]=e.current,e.current=t}var ee=Oe(null),se=Oe(null),te=Oe(null),N=Oe(null);function H(e,t){switch(J(te,t),J(se,e),J(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?bh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=bh(t),e=Sh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(ee),J(ee,e)}function X(){Ee(ee),Ee(se),Ee(te)}function fe(e){e.memoizedState!==null&&J(N,e);var t=ee.current,n=Sh(t,e.type);t!==n&&(J(se,e),J(ee,n))}function ye(e){se.current===e&&(Ee(ee),Ee(se)),N.current===e&&(Ee(N),ti._currentValue=le)}var ze,Ge;function We(e){if(ze===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ze=t&&t[1]||"",Ge=-1<n.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+ze+e+Ge}var gt=!1;function et(e,t){if(!e||gt)return"";gt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(A){var T=A}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(A){T=A}e.call(Q.prototype)}}else{try{throw Error()}catch(A){T=A}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(A){if(A&&T&&typeof A.stack=="string")return[A.stack,T.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),f=r[0],g=r[1];if(f&&g){var b=f.split(`
@@ -11,7 +11,7 @@ Error generating stack: `+a.message+`
11
11
  `);for(const c of u){const[d,...h]=c.split(":"),m=h.join(":").trim();switch(d?.trim()?.toLowerCase()){case"version":s.version=m;break;case"url":s.url=m;break;case"method":s.method=m;break;case"timestamp":s.timestamp=m;break}}}function ZS(l){const s={},u=l.split(`
12
12
  `);for(const c of u){const d=c.indexOf(":");if(d>0){const h=c.slice(0,d).trim(),m=c.slice(d+1).trim();h&&(s[h]=m)}}return s}function JS(l,s){const u=l.split(`
13
13
  `);let c=!1;const d=[];for(const h of u){if(h.startsWith("Status:")){const x=h.replace("Status:","").trim().split(/\s+/);s.statusCode=parseInt(x[0],10)||0,s.statusText=x.slice(1).join(" ")||$S(s.statusCode);continue}if(h.trim()===""&&!c){c=!0;continue}if(c)d.push(h);else{const m=h.indexOf(":");if(m>0){const x=h.slice(0,m).trim(),p=h.slice(m+1).trim();x&&(s.responseHeaders[x]=p)}}}s.responseBody=d.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 $S(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 FS(l){const s=Date.now(),u=l*1e3,c=s-u,d=Math.floor(c/1e3),h=Math.floor(d/60),m=Math.floor(h/60),x=Math.floor(m/24);return d<60?"just now":h<60?`${h}m ago`:m<24?`${m}h ago`:x<7?`${x}d ago`:new Date(u).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function IS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function PS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function eN(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function oi({active:l,onClick:s,children:u,icon:c}){return i.jsxs("button",{onClick:s,className:L("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:[c&&i.jsx(c,{className:"w-3.5 h-3.5"}),u]})}function qg({code:l}){const s=PS(l);return i.jsx("span",{className:L("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 tN({parsed:l}){return i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(qg,{code:l.statusCode}),i.jsx("span",{className:"text-sm font-medium",children:l.statusText}),i.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:eN(l.errorType)})]}),i.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),i.jsx("div",{className:"font-medium",children:l.method||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),i.jsx("div",{className:"font-medium",children:l.provider||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),i.jsx("div",{className:"font-medium",children:l.version||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),i.jsx("div",{className:"font-medium truncate",title:l.endpoint,children:l.endpoint||"N/A"})]})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),i.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:l.url||"N/A"})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),i.jsx("div",{className:"font-mono",children:l.timestamp||"N/A"})]}),l.errorType!=="unknown"&&i.jsxs("div",{className:"flex items-start gap-3 p-3 rounded bg-blue-500/10 border border-blue-500/20 text-xs",children:[i.jsx(cs,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),i.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 nN({headers:l}){const s=Object.entries(l);return s.length===0?i.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):i.jsx(ha,{className:"h-full",children:i.jsx("div",{className:"p-4 space-y-1",children:s.map(([u,c])=>i.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[i.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[u,":"]}),i.jsx("span",{className:"break-all",children:c})]},u))})})}function Sx({content:l,label:s}){if(!l||l.trim()==="")return i.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",s.toLowerCase()," body"]});let u=l,c=!1;try{const d=JSON.parse(l);u=JSON.stringify(d,null,2),c=!0}catch{}return i.jsx(ha,{className:"h-full",children:i.jsx("pre",{className:L("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:u})})}function aN({content:l}){return i.jsx(ha,{className:"h-full",children:i.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:l})})}function lN({name:l,absolutePath:s}){const[u,c]=y.useState("overview"),{data:d,isLoading:h,error:m}=tS(l),x=y.useMemo(()=>d?VS(d):null,[d]);return l?h?i.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[i.jsx(ot,{className:"h-5 w-full"}),i.jsx(ot,{className:"h-5 w-3/4"}),i.jsx(ot,{className:"h-5 w-5/6"}),i.jsx(ot,{className:"h-5 w-2/3"})]}):m||!d||!x?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[i.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx(qg,{code:x.statusCode}),i.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[x.provider,"/",x.endpoint||"unknown"]}),l&&i.jsx(dl,{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"})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&i.jsx(dl,{value:d,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),i.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:x.method})]})]}),i.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[i.jsx(oi,{active:u==="overview",onClick:()=>c("overview"),icon:cs,children:"Overview"}),i.jsx(oi,{active:u==="headers",onClick:()=>c("headers"),icon:vb,children:"Headers"}),i.jsx(oi,{active:u==="request",onClick:()=>c("request"),icon:yb,children:"Request"}),i.jsx(oi,{active:u==="response",onClick:()=>c("response"),icon:bb,children:"Response"}),i.jsx(oi,{active:u==="raw",onClick:()=>c("raw"),icon:ig,children:"Raw"})]}),i.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[u==="overview"&&i.jsx(tN,{parsed:x}),u==="headers"&&i.jsx(nN,{headers:x.requestHeaders}),u==="request"&&i.jsx(Sx,{content:x.requestBody,label:"Request"}),u==="response"&&i.jsx(Sx,{content:x.responseBody,label:"Response"}),u==="raw"&&i.jsx(aN,{content:d})]})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx(pb,{className:"w-10 h-10 mx-auto opacity-40"}),i.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function sN({name:l,size:s,modified:u,isSelected:c,onClick:d}){const h=y.useMemo(()=>QS(l),[l]);return i.jsxs("button",{onClick:d,className:L("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",c?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[i.jsx($u,{provider:h.provider,size:24,withBackground:!0,className:"shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:h.provider}),i.jsx("span",{className:L("text-[9px] px-1 rounded border",c?"bg-amber-500/10 text-amber-600 border-amber-500/20":"bg-muted border-border text-muted-foreground"),children:"LOG"})]}),i.jsx("span",{className:"text-[11px] text-muted-foreground truncate font-medium",title:h.endpoint,children:h.endpoint})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/80 mt-1",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(sg,{className:"w-3 h-3"}),FS(u)]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(ig,{className:"w-3 h-3"}),IS(s)]})]})]})]})}function iN(){const{data:l,isLoading:s}=$1(),{data:u,isLoading:c,error:d}=eS(l?.running??!1),[h,m]=y.useState(500),[x,p]=y.useState(!1),j=y.useRef(null),M=y.useRef(null),v=()=>{M.current&&(clearInterval(M.current),M.current=null)};y.useEffect(()=>{if(!x)return;const V=R=>{const E=j.current;if(!E)return;const G=E.getBoundingClientRect().top+window.scrollY,ne=R.pageY-G;m(Math.max(300,ne));const ce=window.innerHeight-R.clientY,ae=15;v(),ce<50?M.current=setInterval(()=>{window.scrollBy(0,ae)},16):R.clientY<50&&(M.current=setInterval(()=>{window.scrollBy(0,-ae)},16))},F=()=>{p(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",F),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",F),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[x]);const S=V=>{V.preventDefault(),p(!0)},_=y.useMemo(()=>u?.[0]?.name??null,[u]),[B,K]=y.useState(null),Z=B??_,k=y.useMemo(()=>!Z||!u?void 0:u.find(F=>F.name===Z)?.absolutePath,[Z,u]);if(s||!l?.running)return null;if(c)return i.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[i.jsx(ot,{className:"h-4 w-32"}),i.jsx(ot,{className:"h-4 w-20"})]}),i.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(V=>i.jsx(ot,{className:"h-12 w-full rounded-lg"},V))})]});if(!u||u.length===0)return null;const W=u.length;return i.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:h},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Lu,{className:"w-4 h-4 text-amber-500"}),i.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),i.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[W," failed request",W!==1?"s":""]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(xb,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsxs(Ug,{direction:"horizontal",children:[i.jsx(_u,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:i.jsxs(ha,{className:"h-full",children:[i.jsx("div",{className:"divide-y divide-border/50",children:u.slice(0,50).map(V=>i.jsx(sN,{name:V.name,size:V.size,modified:V.modified,isSelected:Z===V.name,onClick:()=>K(V.name)},V.name))}),u.length>50&&i.jsxs("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:["Showing 50 of ",u.length," logs"]})]})}),i.jsxs(Hg,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[i.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),i.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:i.jsx(ns,{className:"h-4 w-4 text-muted-foreground"})})]}),i.jsx(_u,{className:"flex flex-col min-w-0 bg-background/50",children:i.jsx(lN,{name:Z,absolutePath:k})})]})}),d?i.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):i.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:S,children:i.jsx(gb,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const oN=Vo("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"}}),Lg=y.forwardRef(({className:l,variant:s,...u},c)=>i.jsx("div",{ref:c,role:"alert",className:L(oN({variant:s}),l),...u}));Lg.displayName="Alert";const Yg=y.forwardRef(({className:l,...s},u)=>i.jsx("h5",{ref:u,className:L("mb-1 font-medium leading-none tracking-tight",l),...s}));Yg.displayName="AlertTitle";const Gg=y.forwardRef(({className:l,...s},u)=>i.jsx("div",{ref:u,className:L("text-sm [&_p]:leading-relaxed",l),...s}));Gg.displayName="AlertDescription";function rN(){return Rt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function cN(){return Rt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function P2(l){return Rt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const uN={ok:"success",warning:"warning",error:"error"},dN={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 Ho({title:l,value:s,icon:u,variant:c="default",onClick:d}){const h=dN[c];return i.jsxs("button",{onClick:d,className:L("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[i.jsx("div",{className:L("flex items-center justify-center w-9 h-9 rounded-md",h.iconBg),children:i.jsx(u,{className:L("w-4 h-4",h.iconColor)})}),i.jsxs("div",{className:"text-left",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:l}),i.jsx("p",{className:L("text-lg font-bold font-mono leading-tight",h.iconColor),children:s})]})]})}function fN(){const l=gy(),{data:s,isLoading:u}=rN(),{data:c,isLoading:d}=cN();if(u||d)return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(ot,{className:"h-12 w-12 rounded-lg"}),i.jsxs("div",{children:[i.jsx(ot,{className:"h-7 w-[180px] mb-2"}),i.jsx(ot,{className:"h-4 w-[220px]"})]})]}),i.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>i.jsx(ot,{className:"h-14 w-28 rounded-lg"},m))})]}),i.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[i.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[i.jsx(ot,{className:"h-4 w-32"}),i.jsx(ot,{className:"h-4 w-20"})]}),i.jsx("div",{className:"px-4 py-3 border-b",children:i.jsx(ot,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>i.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[i.jsx(ot,{className:"w-2.5 h-2.5 rounded-full"}),i.jsx(ot,{className:"h-4 flex-1"}),i.jsx(ot,{className:"h-1.5 w-24 rounded-full"}),i.jsx(ot,{className:"h-4 w-16"})]},m))]})]});const h=s?.health?uN[s.health.status]:void 0;return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[i.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:i.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),i.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[i.jsx(G1,{version:s?.version}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx(Ho,{title:"Profiles",value:s?.profiles??0,icon:eg,variant:"accent",onClick:()=>l("/api")}),i.jsx(Ho,{title:"CLIProxy",value:s?.cliproxy??0,icon:Xo,variant:"accent",onClick:()=>l("/cliproxy")}),i.jsx(Ho,{title:"Accounts",value:s?.accounts??0,icon:ag,variant:"default",onClick:()=>l("/accounts")}),i.jsx(Ho,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:hi,variant:h,onClick:()=>l("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&i.jsxs(Lg,{variant:"warning",children:[i.jsx(Lu,{className:"h-4 w-4"}),i.jsx(Yg,{children:"Configuration Required"}),i.jsx(Gg,{children:c.symlinkStatus.message})]}),i.jsx(xS,{}),i.jsx(iN,{})]})}function Sn({className:l,...s}){return i.jsx(q0,{"data-slot":"label",className:L("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 mN({label:l,...s}){const[u,c]=y.useState(!1);return i.jsxs("div",{className:"space-y-1",children:[l&&i.jsx("label",{className:"text-sm font-medium",children:l}),i.jsxs("div",{className:"relative",children:[i.jsx(zn,{type:u?"text":"password",className:"pr-10 font-mono",...s}),i.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>c(!u),tabIndex:-1,children:u?i.jsx(Jo,{className:"w-4 h-4"}):i.jsx(Wo,{className:"w-4 h-4"})})]})]})}function hN({...l}){return i.jsx(L0,{"data-slot":"alert-dialog",...l})}function xN({...l}){return i.jsx(X0,{"data-slot":"alert-dialog-portal",...l})}function gN({className:l,...s}){return i.jsx(Z0,{"data-slot":"alert-dialog-overlay",className:L("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",l),...s})}function pN({className:l,...s}){return i.jsxs(xN,{children:[i.jsx(gN,{}),i.jsx(Y0,{"data-slot":"alert-dialog-content",className:L("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",l),...s})]})}function vN({className:l,...s}){return i.jsx("div",{"data-slot":"alert-dialog-header",className:L("flex flex-col gap-2 text-center sm:text-left",l),...s})}function yN({className:l,...s}){return i.jsx("div",{"data-slot":"alert-dialog-footer",className:L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",l),...s})}function bN({className:l,...s}){return i.jsx(G0,{"data-slot":"alert-dialog-title",className:L("text-lg font-semibold",l),...s})}function SN({className:l,...s}){return i.jsx(K0,{"data-slot":"alert-dialog-description",className:L("text-muted-foreground text-sm",l),...s})}function NN({className:l,...s}){return i.jsx(V0,{className:L(is(),l),...s})}function jN({className:l,...s}){return i.jsx(Q0,{className:L(is({variant:"outline"}),l),...s})}function Kg({open:l,onConfirm:s,onCancel:u,title:c,description:d,confirmText:h="Confirm",variant:m="default"}){return i.jsx(hN,{open:l,onOpenChange:x=>!x&&u(),children:i.jsxs(pN,{children:[i.jsxs(vN,{children:[i.jsx(bN,{children:c}),i.jsx(SN,{children:d})]}),i.jsxs(yN,{children:[i.jsx(jN,{onClick:u,children:"Cancel"}),i.jsx(NN,{onClick:s,className:m==="destructive"?"bg-red-600 hover:bg-red-700":"",children:h})]})]})})}const ed=J0,lr=y.forwardRef(({className:l,...s},u)=>i.jsx(Gx,{ref:u,className:L("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));lr.displayName=Gx.displayName;const ml=y.forwardRef(({className:l,...s},u)=>i.jsx(Kx,{ref:u,className:L("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}));ml.displayName=Kx.displayName;const hl=y.forwardRef(({className:l,...s},u)=>i.jsx(Qx,{ref:u,className:L("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));hl.displayName=Qx.displayName;function Qg({profileEnv:l={}}){const[s,u]=y.useState(null),[c,d]=y.useState(!0),[h,m]=y.useState(!1);y.useEffect(()=>{x()},[]);const x=async()=>{try{d(!0);const S=await fetch("/api/global-env");if(!S.ok)throw new Error("Failed to load");const _=await S.json();u(_)}catch{u(null)}finally{d(!1)}};if(c||!s?.enabled)return null;const p=s.env||{},j=Object.keys(p);if(j.length===0)return null;const M=j.filter(S=>!(S in l)),v=j.filter(S=>S in l);return i.jsxs("div",{className:"border-t bg-muted/20",children:[i.jsxs("button",{onClick:()=>m(!h),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[i.jsx(cs,{className:"w-4 h-4 text-blue-500"}),i.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[i.jsx("span",{className:"font-medium text-foreground",children:M.length})," global env var",M.length!==1?"s":""," will be injected at runtime",v.length>0&&i.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),h?i.jsx(Yu,{className:"w-4 h-4 text-muted-foreground"}):i.jsx($o,{className:"w-4 h-4 text-muted-foreground"})]}),h&&i.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[M.length>0&&i.jsx("div",{className:"space-y-1",children:M.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-green-500",children:"+"}),i.jsxs("span",{className:"truncate",children:[S,"=",p[S]]})]},S))}),v.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-amber-500",children:"~"}),i.jsx("span",{className:"truncate",children:S})]},S))]}),i.jsx("div",{className:"pt-2 border-t border-border/50",children:i.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:i.jsxs(Du,{to:"/settings?tab=globalenv",children:[i.jsx(Sb,{className:"w-3.5 h-3.5"}),"Configure in Settings",i.jsx(Nb,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const wN=y.lazy(()=>Tn(()=>import("./code-editor-CYOD5x0C.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function ew({profileName:l,onDelete:s}){const[u,c]=y.useState({}),[d,h]=y.useState(!1),[m,x]=y.useState(null),[p,j]=y.useState(""),M=Xt(),{data:v,isLoading:S,isError:_,refetch:B}=Rt({queryKey:["settings",l],queryFn:async()=>{const P=await fetch(`/api/settings/${l}/raw`);if(!P.ok)throw new Error(`Failed to load settings: ${P.status}`);return P.json()}}),K=v?.settings,Z=y.useMemo(()=>m!==null?m:K?JSON.stringify(K,null,2):"",[m,K]),k=y.useCallback(P=>{x(P)},[]),W=y.useMemo(()=>{if(m!==null)try{return JSON.parse(m)}catch{}if(K)return{...K,env:{...K.env,...u}}},[K,u,m]),V=(P,de)=>{const D={...W?.env||{},[P]:de};c(le=>({...le,[P]:de}));const $={...W,env:D};x(JSON.stringify($,null,2))},F=()=>{if(!p.trim())return;const P=p.trim(),de={...W?.env||{},[P]:""};c($=>({...$,[P]:""}));const D={...W,env:de};x(JSON.stringify(D,null,2)),j("")},R=y.useMemo(()=>{try{return JSON.parse(Z),!0}catch{return!1}},[Z]),E=y.useMemo(()=>m!==null?m!==JSON.stringify(K,null,2):Object.keys(u).length>0,[m,u,K]),U=rn({mutationFn:async()=>{let P;try{P=JSON.parse(Z)}catch{P={...v?.settings,env:{...v?.settings?.env,...u}}}const de=await fetch(`/api/settings/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:P,expectedMtime:v?.mtime})});if(de.status===409)throw new Error("CONFLICT");if(!de.ok)throw new Error("Failed to save");return de.json()},onSuccess:()=>{M.invalidateQueries({queryKey:["settings",l]}),M.invalidateQueries({queryKey:["profiles"]}),c({}),x(null),Ue.success("Settings saved")},onError:P=>{P.message==="CONFLICT"?h(!0):Ue.error(P.message)}}),G=()=>{U.mutate()},ne=async P=>{h(!1),P?(await B(),U.mutate()):(c({}),x(null))},re=P=>[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(D=>D.test(P)),ce=l,ae=()=>i.jsx("div",{className:"h-full flex flex-col",children:i.jsxs(ed,{defaultValue:"env",className:"h-full flex flex-col",children:[i.jsx("div",{className:"px-4 pt-4 shrink-0",children:i.jsxs(lr,{className:"w-full",children:[i.jsx(ml,{value:"env",className:"flex-1",children:"Environment Variables"}),i.jsx(ml,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),i.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[i.jsxs(hl,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:[i.jsx(ha,{className:"flex-1",children:i.jsx("div",{className:"p-4 space-y-4",children:W?.env&&Object.keys(W.env).length>0?i.jsx(i.Fragment,{children:Object.entries(W.env).map(([P,de])=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[P,re(P)&&i.jsx(sn,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),re(P)?i.jsx(mN,{value:de,onChange:D=>V(P,D.target.value),className:"font-mono text-sm h-8"}):i.jsx(zn,{value:de,onChange:D=>V(P,D.target.value),className:"font-mono text-sm h-8"})]},P))}):i.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[i.jsx("p",{children:"No environment variables configured."}),i.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),i.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[i.jsx(Sn,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),i.jsxs("div",{className:"flex gap-2 mt-2",children:[i.jsx(zn,{placeholder:"VARIABLE_NAME",value:p,onChange:P=>j(P.target.value.toUpperCase()),className:"font-mono text-sm h-8",onKeyDown:P=>P.key==="Enter"&&F()}),i.jsx(Je,{variant:"outline",size:"sm",className:"h-8",onClick:F,disabled:!p.trim(),children:i.jsx(gi,{className:"w-4 h-4"})})]})]})]}),i.jsx(hl,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:i.jsx(ha,{className:"h-full",children:i.jsxs("div",{className:"p-4 space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[i.jsx(cs,{className:"w-4 h-4"}),"Profile Information"]}),i.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:v&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Profile Name"}),i.jsx("span",{className:"font-mono",children:v.profile})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:v.path}),i.jsx(dl,{value:v.path,size:"icon",className:"h-5 w-5"})]})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),i.jsx("span",{className:"text-xs",children:new Date(v.mtime).toLocaleString()})]})]})})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),i.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[i.jsxs("div",{children:[i.jsx(Sn,{className:"text-xs text-muted-foreground",children:"Run with profile"}),i.jsxs("div",{className:"mt-1 flex gap-2",children:[i.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",l,' "prompt"']}),i.jsx(dl,{value:`ccs ${l} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),i.jsxs("div",{children:[i.jsx(Sn,{className:"text-xs text-muted-foreground",children:"Set as default"}),i.jsxs("div",{className:"mt-1 flex gap-2",children:[i.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",l]}),i.jsx(dl,{value:`ccs default ${l}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})})]})]})}),we=()=>i.jsx(y.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(ma,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!R&&m!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(rs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(wN,{value:Z,onChange:k,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Qg,{profileEnv:K?.env})})})]})});return i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:l}),v?.path&&i.jsx(sn,{variant:"outline",className:"text-xs",children:v.path.replace(/^.*\//,"")})]}),v&&i.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(v.mtime).toLocaleString()]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>B(),disabled:S,children:i.jsx(Ou,{className:`w-4 h-4 ${S?"animate-spin":""}`})}),s&&i.jsx(Je,{variant:"ghost",size:"sm",onClick:s,children:i.jsx(og,{className:"w-4 h-4 text-destructive"})}),i.jsx(Je,{size:"sm",onClick:G,disabled:U.isPending||!E||!R,children:U.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ma,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rg,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),S?i.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i.jsx(ma,{className:"w-8 h-8 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):_?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings for this profile."}),i.jsxs(Je,{variant:"outline",size:"sm",onClick:()=>B(),children:[i.jsx(Ou,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):i.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[i.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:ae()}),i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[i.jsx(cg,{className:"w-4 h-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),we()]})]}),i.jsx(Kg,{open:d,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ne(!0),onCancel:()=>ne(!1)})]},ce)}function Nx(l,s){try{var u=l()}catch(c){return s(c)}return u&&u.then?u.then(void 0,s):u}function CN(l,s){for(var u={};l.length;){var c=l[0],d=c.code,h=c.message,m=c.path.join(".");if(!u[m])if("unionErrors"in c){var x=c.unionErrors[0].errors[0];u[m]={message:x.message,type:x.code}}else u[m]={message:h,type:d};if("unionErrors"in c&&c.unionErrors.forEach(function(M){return M.errors.forEach(function(v){return l.push(v)})}),s){var p=u[m].types,j=p&&p[c.code];u[m]=dg(m,s,u,d,j?[].concat(j,c.message):c.message)}l.shift()}return u}function EN(l,s){for(var u={};l.length;){var c=l[0],d=c.code,h=c.message,m=c.path.join(".");if(!u[m])if(c.code==="invalid_union"&&c.errors.length>0){var x=c.errors[0][0];u[m]={message:x.message,type:x.code}}else u[m]={message:h,type:d};if(c.code==="invalid_union"&&c.errors.forEach(function(M){return M.forEach(function(v){return l.push(v)})}),s){var p=u[m].types,j=p&&p[c.code];u[m]=dg(m,s,u,d,j?[].concat(j,c.message):c.message)}l.shift()}return u}function MN(l,s,u){if(u===void 0&&(u={}),(function(c){return"_def"in c&&typeof c._def=="object"&&"typeName"in c._def})(l))return function(c,d,h){try{return Promise.resolve(Nx(function(){return Promise.resolve(l[u.mode==="sync"?"parse":"parseAsync"](c,s)).then(function(m){return h.shouldUseNativeValidation&&ex({},h),{errors:{},values:u.raw?Object.assign({},c):m}})},function(m){if((function(x){return Array.isArray(x?.issues)})(m))return{values:{},errors:tx(CN(m.errors,!h.shouldUseNativeValidation&&h.criteriaMode==="all"),h)};throw m}))}catch(m){return Promise.reject(m)}};if((function(c){return"_zod"in c&&typeof c._zod=="object"})(l))return function(c,d,h){try{return Promise.resolve(Nx(function(){return Promise.resolve((u.mode==="sync"?Cb:Eb)(l,c,s)).then(function(m){return h.shouldUseNativeValidation&&ex({},h),{errors:{},values:u.raw?Object.assign({},c):m}})},function(m){if((function(x){return x instanceof Mb})(m))return{values:{},errors:tx(EN(m.issues,!h.shouldUseNativeValidation&&h.criteriaMode==="all"),h)};throw m}))}catch(m){return Promise.reject(m)}};throw new Error("Invalid input: not a Zod schema")}function tw(){return Rt({queryKey:["profiles"],queryFn:()=>Et.profiles.list()})}function zN(){const l=Xt();return rn({mutationFn:s=>Et.profiles.create(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ue.success("Profile created successfully")},onError:s=>{Ue.error(s.message)}})}function nw(){const l=Xt();return rn({mutationFn:s=>Et.profiles.delete(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ue.success("Profile deleted successfully")},onError:s=>{Ue.error(s.message)}})}const DN="claude-sonnet-4-5-20250929",ON=zb({name:ol().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:ol().url("Invalid URL format"),apiKey:ol().min(1,"API key is required"),model:ol().optional(),opusModel:ol().optional(),sonnetModel:ol().optional(),haikuModel:ol().optional()}),TN=["/chat/completions","/v1/messages","/messages","/completions"];function aw({open:l,onOpenChange:s,onSuccess:u}){const c=zN(),[d,h]=y.useState("basic"),[m,x]=y.useState(null),[p,j]=y.useState(!1),{register:M,handleSubmit:v,formState:{errors:S},watch:_,reset:B}=Db({resolver:MN(ON),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),K=_("baseUrl");y.useEffect(()=>{l&&(B(),h("basic"),x(null),j(!1))},[l,B]),y.useEffect(()=>{if(K){const V=K.toLowerCase();for(const F of TN)if(V.endsWith(F)){const R=K.replace(new RegExp(F+"$","i"),"");x(`URL ends with "${F}" - Claude appends this automatically. You likely want: ${R}`);return}}x(null)},[K]);const Z=async V=>{try{await c.mutateAsync(V),Ue.success(`Profile "${V.name}" created`),u(V.name),s(!1)}catch(F){Ue.error(F.message||"Failed to create profile")}},k=!!S.name||!!S.baseUrl||!!S.apiKey,W=!!S.model||!!S.opusModel||!!S.sonnetModel||!!S.haikuModel;return i.jsx(Xu,{open:l,onOpenChange:s,children:i.jsxs(Zu,{className:"sm:max-w-[600px] p-0 gap-0 overflow-hidden",children:[i.jsxs(Ju,{className:"p-6 pb-4 border-b",children:[i.jsxs(Wu,{className:"flex items-center gap-2",children:[i.jsx(gi,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),i.jsx(pg,{children:"Configure a custom API endpoint for Claude Code."})]}),i.jsx("form",{onSubmit:v(Z),children:i.jsxs(ed,{value:d,onValueChange:h,className:"flex flex-col",children:[i.jsx("div",{className:"px-6 pt-4",children:i.jsxs(lr,{className:"grid w-full grid-cols-2",children:[i.jsxs(ml,{value:"basic",className:"relative",children:["Basic Information",k&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),i.jsxs(ml,{value:"models",className:"relative",children:["Model Configuration",W&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[60vh]",children:[i.jsx(hl,{value:"basic",className:"p-6 space-y-6 mt-0",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"name",children:["Profile Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(zn,{id:"name",...M("name"),placeholder:"my-api",className:"font-mono"}),S.name?i.jsx("p",{className:"text-xs text-destructive",children:S.name.message}):i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"baseUrl",children:["API Base URL ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(zn,{id:"baseUrl",...M("baseUrl"),placeholder:"https://api.example.com/v1"}),S.baseUrl?i.jsx("p",{className:"text-xs text-destructive",children:S.baseUrl.message}):m?i.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[i.jsx(Lu,{className:"w-4 h-4 shrink-0 mt-0.5"}),i.jsx("span",{children:m})]}):i.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"apiKey",children:["API Key ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(zn,{id:"apiKey",type:p?"text":"password",...M("apiKey"),placeholder:"sk-...",className:"pr-10"}),i.jsxs(Je,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>j(!p),tabIndex:-1,children:[p?i.jsx(Jo,{className:"h-4 w-4"}):i.jsx(Wo,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Toggle API key visibility"})]})]}),S.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]})]})}),i.jsxs(hl,{value:"models",className:"p-6 mt-0 space-y-6",children:[i.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:[i.jsx(cs,{className:"w-5 h-5 shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),i.jsx("p",{className:"text-xs opacity-90",children:"Claude Code requests specific model tiers (Opus/Sonnet/Haiku). Map these tiers to the specific models supported by your API provider."})]})]}),i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"model",children:["Default Model",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),i.jsx(zn,{id:"model",...M("model"),placeholder:DN,className:"font-mono text-sm"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Fallback model if no specific tier is requested"})]}),i.jsxs("div",{className:"grid gap-4 pt-2 border-t",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping (Primary)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),i.jsx(zn,{id:"sonnetModel",...M("sonnetModel"),placeholder:"e.g. gpt-4o, claude-3-5-sonnet",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping (Complex Tasks)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),i.jsx(zn,{id:"opusModel",...M("opusModel"),placeholder:"e.g. o1-preview, claude-3-opus",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping (Fast Tasks)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),i.jsx(zn,{id:"haikuModel",...M("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),i.jsxs(gg,{className:"p-6 pt-2 border-t bg-muted/10",children:[i.jsx(Je,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),i.jsx(Je,{type:"submit",disabled:c.isPending,className:L(c.isPending&&"opacity-80"),children:c.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ma,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(gi,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})})]})})}const AN=ey,jx=ny,_N=ty,Vg=y.forwardRef(({className:l,children:s,...u},c)=>i.jsxs(Vx,{ref:c,className:L("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,i.jsx(W0,{asChild:!0,children:i.jsx($o,{className:"h-4 w-4 opacity-50"})})]}));Vg.displayName=Vx.displayName;const Xg=y.forwardRef(({className:l,...s},u)=>i.jsx(Xx,{ref:u,className:L("flex cursor-default items-center justify-center py-1",l),...s,children:i.jsx(Yu,{className:"h-4 w-4"})}));Xg.displayName=Xx.displayName;const Zg=y.forwardRef(({className:l,...s},u)=>i.jsx(Zx,{ref:u,className:L("flex cursor-default items-center justify-center py-1",l),...s,children:i.jsx($o,{className:"h-4 w-4"})}));Zg.displayName=Zx.displayName;const Jg=y.forwardRef(({className:l,children:s,position:u="popper",...c},d)=>i.jsx($0,{children:i.jsxs(Jx,{ref:d,className:L("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,...c,children:[i.jsx(Xg,{}),i.jsx(F0,{className:L("p-1",u==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),i.jsx(Zg,{})]})}));Jg.displayName=Jx.displayName;const Ru=y.forwardRef(({className:l,...s},u)=>i.jsx(Wx,{ref:u,className:L("px-2 py-1.5 text-sm font-semibold",l),...s}));Ru.displayName=Wx.displayName;const Uu=y.forwardRef(({className:l,children:s,...u},c)=>i.jsxs($x,{ref:c,className:L("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:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(I0,{children:i.jsx(xi,{className:"h-4 w-4"})})}),i.jsx(P0,{children:s})]}));Uu.displayName=$x.displayName;const kN=y.forwardRef(({className:l,...s},u)=>i.jsx(Fx,{ref:u,className:L("-mx-1 my-1 h-px bg-muted",l),...s}));kN.displayName=Fx.displayName;function RN({...l}){return i.jsx(ay,{"data-slot":"dropdown-menu",...l})}function UN({...l}){return i.jsx(ly,{"data-slot":"dropdown-menu-trigger",...l})}function HN({className:l,sideOffset:s=4,...u}){return i.jsx(sy,{children:i.jsx(iy,{"data-slot":"dropdown-menu-content",sideOffset:s,className:L("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md bg-white dark:bg-zinc-950",l),...u})})}function wx({className:l,inset:s,variant:u="default",...c}){return i.jsx(oy,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":u,className:L("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground focus:[&_svg:not([class*='text-'])]:text-current relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",l),...c})}const BN={gemini:"/assets/providers/gemini-color.svg",codex:"/assets/providers/openai.svg",agy:"/assets/providers/agy.png",qwen:"/assets/providers/qwen-color.svg",iflow:"/assets/providers/iflow.png"},qN={gemini:{text:"text-blue-600",letter:"G"},claude:{text:"text-orange-600",letter:"C"},codex:{text:"text-emerald-600",letter:"X"},agy:{text:"text-violet-600",letter:"A"},qwen:{text:"text-cyan-600",letter:"Q"},iflow:{text:"text-indigo-600",letter:"i"}},LN={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function YN({provider:l,className:s,size:u="md"}){const c=l.toLowerCase(),d=qN[c]||{text:"text-gray-600",letter:l[0]?.toUpperCase()||"?"},h=LN[u],m=BN[c];return i.jsx("div",{className:L("flex items-center justify-center rounded-md",m&&"bg-white p-1",h.container,s),children:m?i.jsx("img",{src:m,alt:`${l} logo`,className:L(h.icon,"object-contain")}):i.jsx("span",{className:L("font-semibold",d.text,h.text),children:d.letter})})}function Ya({label:l,description:s,value:u,onChange:c,catalog:d,allModels:h,disabled:m}){const x=new Set(d?.models.map(p=>p.id)||[]);return i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-medium",children:l}),s&&i.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),i.jsxs(AN,{value:u||"",onValueChange:c,disabled:m,children:[i.jsx(Vg,{className:"h-9",children:i.jsx(_N,{placeholder:"Select model",children:u&&i.jsx("span",{className:"truncate font-mono text-xs",children:u})})}),i.jsxs(Jg,{className:"max-h-[300px]",children:[d&&d.models.length>0&&i.jsxs(jx,{children:[i.jsx(Ru,{className:"text-xs text-primary",children:"Recommended"}),d.models.map(p=>i.jsx(Uu,{value:p.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs",children:p.id}),p.tier==="paid"&&i.jsx(sn,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),u===p.id&&i.jsx(xi,{className:"w-3 h-3 text-primary ml-auto"})]})},p.id))]}),h.length>0&&i.jsxs(jx,{children:[i.jsxs(Ru,{className:"text-xs text-muted-foreground",children:["All Models (",h.length,")"]}),h.filter(p=>!x.has(p.id)).map(p=>i.jsx(Uu,{value:p.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs",children:p.id}),u===p.id&&i.jsx(xi,{className:"w-3 h-3 text-primary ml-auto"})]})},p.id))]}),(!d||d.models.length===0)&&h.length===0&&i.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}const GN=y.lazy(()=>Tn(()=>import("./code-editor-CYOD5x0C.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function lw({provider:l,displayName:s,authStatus:u,catalog:c,logoProvider:d,onAddAccount:h,onSetDefault:m,onRemoveAccount:x,isRemovingAccount:p}){const[j,M]=y.useState(null),[v,S]=y.useState(!1),[_,B]=y.useState(!1),K=Xt(),{privacyMode:Z}=Fo(),{data:k}=Q1(),{data:W}=V1(l),V=X1(),F=Z1(),R=W?.presets||[],E=y.useMemo(()=>{if(!k?.models)return[];const H={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"]}[l.toLowerCase()]||[l.toLowerCase()];return k.models.filter(X=>H.some(fe=>X.owned_by.toLowerCase().includes(fe)))},[k,l]),{data:U,isLoading:G,refetch:ne}=Rt({queryKey:["settings",l],queryFn:async()=>{const N=await fetch(`/api/settings/${l}/raw`);return N.ok?N.json():{profile:l,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${l}/settings.json`}}}),re=U?.settings,ce=y.useMemo(()=>j!==null?j:re?JSON.stringify(re,null,2):`{
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 $S(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 FS(l){const s=Date.now(),u=l*1e3,c=s-u,d=Math.floor(c/1e3),h=Math.floor(d/60),m=Math.floor(h/60),x=Math.floor(m/24);return d<60?"just now":h<60?`${h}m ago`:m<24?`${m}h ago`:x<7?`${x}d ago`:new Date(u).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function IS(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}function PS(l){return l>=500?"text-red-500":l===429?"text-orange-500":l>=400?"text-yellow-500":"text-gray-500"}function eN(l){return{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[l]||"Error"}function oi({active:l,onClick:s,children:u,icon:c}){return i.jsxs("button",{onClick:s,className:L("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:[c&&i.jsx(c,{className:"w-3.5 h-3.5"}),u]})}function qg({code:l}){const s=PS(l);return i.jsx("span",{className:L("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 tN({parsed:l}){return i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(qg,{code:l.statusCode}),i.jsx("span",{className:"text-sm font-medium",children:l.statusText}),i.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:eN(l.errorType)})]}),i.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Method"}),i.jsx("div",{className:"font-medium",children:l.method||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Provider"}),i.jsx("div",{className:"font-medium",children:l.provider||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Version"}),i.jsx("div",{className:"font-medium",children:l.version||"N/A"})]}),i.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[i.jsx("div",{className:"text-muted-foreground mb-1",children:"Endpoint"}),i.jsx("div",{className:"font-medium truncate",title:l.endpoint,children:l.endpoint||"N/A"})]})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"URL"}),i.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:l.url||"N/A"})]}),i.jsxs("div",{className:"text-xs",children:[i.jsx("div",{className:"text-muted-foreground mb-1.5",children:"Timestamp"}),i.jsx("div",{className:"font-mono",children:l.timestamp||"N/A"})]}),l.errorType!=="unknown"&&i.jsxs("div",{className:"flex items-start gap-3 p-3 rounded bg-blue-500/10 border border-blue-500/20 text-xs",children:[i.jsx(cs,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),i.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 nN({headers:l}){const s=Object.entries(l);return s.length===0?i.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No headers available"}):i.jsx(ha,{className:"h-full",children:i.jsx("div",{className:"p-4 space-y-1",children:s.map(([u,c])=>i.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[i.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[u,":"]}),i.jsx("span",{className:"break-all",children:c})]},u))})})}function Sx({content:l,label:s}){if(!l||l.trim()==="")return i.jsxs("div",{className:"p-4 text-xs text-muted-foreground",children:["No ",s.toLowerCase()," body"]});let u=l,c=!1;try{const d=JSON.parse(l);u=JSON.stringify(d,null,2),c=!0}catch{}return i.jsx(ha,{className:"h-full",children:i.jsx("pre",{className:L("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:u})})}function aN({content:l}){return i.jsx(ha,{className:"h-full",children:i.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:l})})}function lN({name:l,absolutePath:s}){const[u,c]=y.useState("overview"),{data:d,isLoading:h,error:m}=tS(l),x=y.useMemo(()=>d?VS(d):null,[d]);return l?h?i.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[i.jsx(ot,{className:"h-5 w-full"}),i.jsx(ot,{className:"h-5 w-3/4"}),i.jsx(ot,{className:"h-5 w-5/6"}),i.jsx(ot,{className:"h-5 w-2/3"})]}):m||!d||!x?i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsx("p",{className:"text-sm",children:"Failed to load log content"})}):i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[i.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx(qg,{code:x.statusCode}),i.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[x.provider,"/",x.endpoint||"unknown"]}),l&&i.jsx(dl,{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"})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&i.jsx(dl,{value:d,label:"Copy raw log content",variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),i.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:x.method})]})]}),i.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-1 bg-muted/10 shrink-0 overflow-x-auto",children:[i.jsx(oi,{active:u==="overview",onClick:()=>c("overview"),icon:cs,children:"Overview"}),i.jsx(oi,{active:u==="headers",onClick:()=>c("headers"),icon:vb,children:"Headers"}),i.jsx(oi,{active:u==="request",onClick:()=>c("request"),icon:yb,children:"Request"}),i.jsx(oi,{active:u==="response",onClick:()=>c("response"),icon:bb,children:"Response"}),i.jsx(oi,{active:u==="raw",onClick:()=>c("raw"),icon:ig,children:"Raw"})]}),i.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[u==="overview"&&i.jsx(tN,{parsed:x}),u==="headers"&&i.jsx(nN,{headers:x.requestHeaders}),u==="request"&&i.jsx(Sx,{content:x.requestBody,label:"Request"}),u==="response"&&i.jsx(Sx,{content:x.responseBody,label:"Response"}),u==="raw"&&i.jsx(aN,{content:d})]})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx(pb,{className:"w-10 h-10 mx-auto opacity-40"}),i.jsx("p",{className:"text-sm",children:"Select a log to view details"})]})})}function sN({name:l,size:s,modified:u,isSelected:c,onClick:d}){const h=y.useMemo(()=>QS(l),[l]);return i.jsxs("button",{onClick:d,className:L("w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",c?"bg-muted/50 border-l-amber-500":"border-l-transparent"),children:[i.jsx($u,{provider:h.provider,size:24,withBackground:!0,className:"shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:h.provider}),i.jsx("span",{className:L("text-[9px] px-1 rounded border",c?"bg-amber-500/10 text-amber-600 border-amber-500/20":"bg-muted border-border text-muted-foreground"),children:"LOG"})]}),i.jsx("span",{className:"text-[11px] text-muted-foreground truncate font-medium",title:h.endpoint,children:h.endpoint})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/80 mt-1",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(sg,{className:"w-3 h-3"}),FS(u)]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(ig,{className:"w-3 h-3"}),IS(s)]})]})]})]})}function iN(){const{data:l,isLoading:s}=$1(),{data:u,isLoading:c,error:d}=eS(l?.running??!1),[h,m]=y.useState(500),[x,p]=y.useState(!1),j=y.useRef(null),M=y.useRef(null),v=()=>{M.current&&(clearInterval(M.current),M.current=null)};y.useEffect(()=>{if(!x)return;const V=R=>{const E=j.current;if(!E)return;const G=E.getBoundingClientRect().top+window.scrollY,ne=R.pageY-G;m(Math.max(300,ne));const ce=window.innerHeight-R.clientY,ae=15;v(),ce<50?M.current=setInterval(()=>{window.scrollBy(0,ae)},16):R.clientY<50&&(M.current=setInterval(()=>{window.scrollBy(0,-ae)},16))},F=()=>{p(!1),v(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",F),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",F),document.body.style.cursor="default",document.body.style.userSelect="auto",v()}},[x]);const S=V=>{V.preventDefault(),p(!0)},_=y.useMemo(()=>u?.[0]?.name??null,[u]),[B,K]=y.useState(null),Z=B??_,k=y.useMemo(()=>!Z||!u?void 0:u.find(F=>F.name===Z)?.absolutePath,[Z,u]);if(s||!l?.running)return null;if(c)return i.jsxs("div",{className:"rounded-xl border border-border overflow-hidden font-mono text-sm bg-card/50 dark:bg-zinc-900/60 backdrop-blur-sm h-[500px]",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[i.jsx(ot,{className:"h-4 w-32"}),i.jsx(ot,{className:"h-4 w-20"})]}),i.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(V=>i.jsx(ot,{className:"h-12 w-full rounded-lg"},V))})]});if(!u||u.length===0)return null;const W=u.length;return i.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:h},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-amber-500/10 via-transparent to-transparent dark:from-amber-500/15 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Lu,{className:"w-4 h-4 text-amber-500"}),i.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Error Logs"}),i.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:[W," failed request",W!==1?"s":""]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(xb,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"CLIProxy Diagnostics"})]})]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsxs(Ug,{direction:"horizontal",children:[i.jsx(_u,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:i.jsxs(ha,{className:"h-full",children:[i.jsx("div",{className:"divide-y divide-border/50",children:u.slice(0,50).map(V=>i.jsx(sN,{name:V.name,size:V.size,modified:V.modified,isSelected:Z===V.name,onClick:()=>K(V.name)},V.name))}),u.length>50&&i.jsxs("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:["Showing 50 of ",u.length," logs"]})]})}),i.jsxs(Hg,{className:"w-[1px] bg-border hover:bg-primary/50 transition-colors flex items-center justify-center group relative z-10 w-2 -ml-1 flex items-center justify-center outline-none",children:[i.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),i.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-4 h-8 rounded-sm flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-muted border border-border",children:i.jsx(ns,{className:"h-4 w-4 text-muted-foreground"})})]}),i.jsx(_u,{className:"flex flex-col min-w-0 bg-background/50",children:i.jsx(lN,{name:Z,absolutePath:k})})]})}),d?i.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):i.jsx("div",{className:"h-2 bg-border/10 border-t border-border/30 hover:bg-primary/10 transition-colors cursor-row-resize flex items-center justify-center group/handle shrink-0",onMouseDown:S,children:i.jsx(gb,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const oN=Vo("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"}}),Lg=y.forwardRef(({className:l,variant:s,...u},c)=>i.jsx("div",{ref:c,role:"alert",className:L(oN({variant:s}),l),...u}));Lg.displayName="Alert";const Yg=y.forwardRef(({className:l,...s},u)=>i.jsx("h5",{ref:u,className:L("mb-1 font-medium leading-none tracking-tight",l),...s}));Yg.displayName="AlertTitle";const Gg=y.forwardRef(({className:l,...s},u)=>i.jsx("div",{ref:u,className:L("text-sm [&_p]:leading-relaxed",l),...s}));Gg.displayName="AlertDescription";function rN(){return Rt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function cN(){return Rt({queryKey:["shared","summary"],queryFn:async()=>(await fetch("/api/shared/summary")).json()})}function P2(l){return Rt({queryKey:["shared",l],queryFn:async()=>(await fetch(`/api/shared/${l}`)).json()})}const uN={ok:"success",warning:"warning",error:"error"},dN={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 Ho({title:l,value:s,icon:u,variant:c="default",onClick:d}){const h=dN[c];return i.jsxs("button",{onClick:d,className:L("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[i.jsx("div",{className:L("flex items-center justify-center w-9 h-9 rounded-md",h.iconBg),children:i.jsx(u,{className:L("w-4 h-4",h.iconColor)})}),i.jsxs("div",{className:"text-left",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:l}),i.jsx("p",{className:L("text-lg font-bold font-mono leading-tight",h.iconColor),children:s})]})]})}function fN(){const l=gy(),{data:s,isLoading:u}=rN(),{data:c,isLoading:d}=cN();if(u||d)return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(ot,{className:"h-12 w-12 rounded-lg"}),i.jsxs("div",{children:[i.jsx(ot,{className:"h-7 w-[180px] mb-2"}),i.jsx(ot,{className:"h-4 w-[220px]"})]})]}),i.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(m=>i.jsx(ot,{className:"h-14 w-28 rounded-lg"},m))})]}),i.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[i.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[i.jsx(ot,{className:"h-4 w-32"}),i.jsx(ot,{className:"h-4 w-20"})]}),i.jsx("div",{className:"px-4 py-3 border-b",children:i.jsx(ot,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(m=>i.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[i.jsx(ot,{className:"w-2.5 h-2.5 rounded-full"}),i.jsx(ot,{className:"h-4 flex-1"}),i.jsx(ot,{className:"h-1.5 w-24 rounded-full"}),i.jsx(ot,{className:"h-4 w-16"})]},m))]})]});const h=s?.health?uN[s.health.status]:void 0;return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[i.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:i.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),i.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[i.jsx(G1,{version:s?.version}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx(Ho,{title:"Profiles",value:s?.profiles??0,icon:eg,variant:"accent",onClick:()=>l("/api")}),i.jsx(Ho,{title:"CLIProxy",value:s?.cliproxy??0,icon:Xo,variant:"accent",onClick:()=>l("/cliproxy")}),i.jsx(Ho,{title:"Accounts",value:s?.accounts??0,icon:ag,variant:"default",onClick:()=>l("/accounts")}),i.jsx(Ho,{title:"Health",value:s?.health?`${s.health.passed}/${s.health.total}`:"-",icon:hi,variant:h,onClick:()=>l("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&i.jsxs(Lg,{variant:"warning",children:[i.jsx(Lu,{className:"h-4 w-4"}),i.jsx(Yg,{children:"Configuration Required"}),i.jsx(Gg,{children:c.symlinkStatus.message})]}),i.jsx(xS,{}),i.jsx(iN,{})]})}function Sn({className:l,...s}){return i.jsx(q0,{"data-slot":"label",className:L("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 mN({label:l,...s}){const[u,c]=y.useState(!1);return i.jsxs("div",{className:"space-y-1",children:[l&&i.jsx("label",{className:"text-sm font-medium",children:l}),i.jsxs("div",{className:"relative",children:[i.jsx(zn,{type:u?"text":"password",className:"pr-10 font-mono",...s}),i.jsx(Je,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>c(!u),tabIndex:-1,children:u?i.jsx(Jo,{className:"w-4 h-4"}):i.jsx(Wo,{className:"w-4 h-4"})})]})]})}function hN({...l}){return i.jsx(L0,{"data-slot":"alert-dialog",...l})}function xN({...l}){return i.jsx(X0,{"data-slot":"alert-dialog-portal",...l})}function gN({className:l,...s}){return i.jsx(Z0,{"data-slot":"alert-dialog-overlay",className:L("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",l),...s})}function pN({className:l,...s}){return i.jsxs(xN,{children:[i.jsx(gN,{}),i.jsx(Y0,{"data-slot":"alert-dialog-content",className:L("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",l),...s})]})}function vN({className:l,...s}){return i.jsx("div",{"data-slot":"alert-dialog-header",className:L("flex flex-col gap-2 text-center sm:text-left",l),...s})}function yN({className:l,...s}){return i.jsx("div",{"data-slot":"alert-dialog-footer",className:L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",l),...s})}function bN({className:l,...s}){return i.jsx(G0,{"data-slot":"alert-dialog-title",className:L("text-lg font-semibold",l),...s})}function SN({className:l,...s}){return i.jsx(K0,{"data-slot":"alert-dialog-description",className:L("text-muted-foreground text-sm",l),...s})}function NN({className:l,...s}){return i.jsx(V0,{className:L(is(),l),...s})}function jN({className:l,...s}){return i.jsx(Q0,{className:L(is({variant:"outline"}),l),...s})}function Kg({open:l,onConfirm:s,onCancel:u,title:c,description:d,confirmText:h="Confirm",variant:m="default"}){return i.jsx(hN,{open:l,onOpenChange:x=>!x&&u(),children:i.jsxs(pN,{children:[i.jsxs(vN,{children:[i.jsx(bN,{children:c}),i.jsx(SN,{children:d})]}),i.jsxs(yN,{children:[i.jsx(jN,{onClick:u,children:"Cancel"}),i.jsx(NN,{onClick:s,className:m==="destructive"?"bg-red-600 hover:bg-red-700":"",children:h})]})]})})}const ed=J0,lr=y.forwardRef(({className:l,...s},u)=>i.jsx(Gx,{ref:u,className:L("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",l),...s}));lr.displayName=Gx.displayName;const ml=y.forwardRef(({className:l,...s},u)=>i.jsx(Kx,{ref:u,className:L("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}));ml.displayName=Kx.displayName;const hl=y.forwardRef(({className:l,...s},u)=>i.jsx(Qx,{ref:u,className:L("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l),...s}));hl.displayName=Qx.displayName;function Qg({profileEnv:l={}}){const[s,u]=y.useState(null),[c,d]=y.useState(!0),[h,m]=y.useState(!1);y.useEffect(()=>{x()},[]);const x=async()=>{try{d(!0);const S=await fetch("/api/global-env");if(!S.ok)throw new Error("Failed to load");const _=await S.json();u(_)}catch{u(null)}finally{d(!1)}};if(c||!s?.enabled)return null;const p=s.env||{},j=Object.keys(p);if(j.length===0)return null;const M=j.filter(S=>!(S in l)),v=j.filter(S=>S in l);return i.jsxs("div",{className:"border-t bg-muted/20",children:[i.jsxs("button",{onClick:()=>m(!h),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[i.jsx(cs,{className:"w-4 h-4 text-blue-500"}),i.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[i.jsx("span",{className:"font-medium text-foreground",children:M.length})," global env var",M.length!==1?"s":""," will be injected at runtime",v.length>0&&i.jsxs("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:["(",v.length," overridden by profile)"]})]}),h?i.jsx(Yu,{className:"w-4 h-4 text-muted-foreground"}):i.jsx($o,{className:"w-4 h-4 text-muted-foreground"})]}),h&&i.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[M.length>0&&i.jsx("div",{className:"space-y-1",children:M.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-green-500/10 text-green-700 dark:text-green-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-green-500",children:"+"}),i.jsxs("span",{className:"truncate",children:[S,"=",p[S]]})]},S))}),v.length>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Skipped (profile already defines):"}),v.map(S=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono bg-amber-500/10 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[i.jsx("span",{className:"text-amber-500",children:"~"}),i.jsx("span",{className:"truncate",children:S})]},S))]}),i.jsx("div",{className:"pt-2 border-t border-border/50",children:i.jsx(Je,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:i.jsxs(Du,{to:"/settings?tab=globalenv",children:[i.jsx(Sb,{className:"w-3.5 h-3.5"}),"Configure in Settings",i.jsx(Nb,{className:"w-3 h-3 opacity-50"})]})})})]})]})}const wN=y.lazy(()=>Tn(()=>import("./code-editor-DmM_bX-t.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function ew({profileName:l,onDelete:s}){const[u,c]=y.useState({}),[d,h]=y.useState(!1),[m,x]=y.useState(null),[p,j]=y.useState(""),M=Xt(),{data:v,isLoading:S,isError:_,refetch:B}=Rt({queryKey:["settings",l],queryFn:async()=>{const P=await fetch(`/api/settings/${l}/raw`);if(!P.ok)throw new Error(`Failed to load settings: ${P.status}`);return P.json()}}),K=v?.settings,Z=y.useMemo(()=>m!==null?m:K?JSON.stringify(K,null,2):"",[m,K]),k=y.useCallback(P=>{x(P)},[]),W=y.useMemo(()=>{if(m!==null)try{return JSON.parse(m)}catch{}if(K)return{...K,env:{...K.env,...u}}},[K,u,m]),V=(P,de)=>{const D={...W?.env||{},[P]:de};c(le=>({...le,[P]:de}));const $={...W,env:D};x(JSON.stringify($,null,2))},F=()=>{if(!p.trim())return;const P=p.trim(),de={...W?.env||{},[P]:""};c($=>({...$,[P]:""}));const D={...W,env:de};x(JSON.stringify(D,null,2)),j("")},R=y.useMemo(()=>{try{return JSON.parse(Z),!0}catch{return!1}},[Z]),E=y.useMemo(()=>m!==null?m!==JSON.stringify(K,null,2):Object.keys(u).length>0,[m,u,K]),U=rn({mutationFn:async()=>{let P;try{P=JSON.parse(Z)}catch{P={...v?.settings,env:{...v?.settings?.env,...u}}}const de=await fetch(`/api/settings/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:P,expectedMtime:v?.mtime})});if(de.status===409)throw new Error("CONFLICT");if(!de.ok)throw new Error("Failed to save");return de.json()},onSuccess:()=>{M.invalidateQueries({queryKey:["settings",l]}),M.invalidateQueries({queryKey:["profiles"]}),c({}),x(null),Ue.success("Settings saved")},onError:P=>{P.message==="CONFLICT"?h(!0):Ue.error(P.message)}}),G=()=>{U.mutate()},ne=async P=>{h(!1),P?(await B(),U.mutate()):(c({}),x(null))},re=P=>[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(D=>D.test(P)),ce=l,ae=()=>i.jsx("div",{className:"h-full flex flex-col",children:i.jsxs(ed,{defaultValue:"env",className:"h-full flex flex-col",children:[i.jsx("div",{className:"px-4 pt-4 shrink-0",children:i.jsxs(lr,{className:"w-full",children:[i.jsx(ml,{value:"env",className:"flex-1",children:"Environment Variables"}),i.jsx(ml,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),i.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[i.jsxs(hl,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:[i.jsx(ha,{className:"flex-1",children:i.jsx("div",{className:"p-4 space-y-4",children:W?.env&&Object.keys(W.env).length>0?i.jsx(i.Fragment,{children:Object.entries(W.env).map(([P,de])=>i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[P,re(P)&&i.jsx(sn,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),re(P)?i.jsx(mN,{value:de,onChange:D=>V(P,D.target.value),className:"font-mono text-sm h-8"}):i.jsx(zn,{value:de,onChange:D=>V(P,D.target.value),className:"font-mono text-sm h-8"})]},P))}):i.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[i.jsx("p",{children:"No environment variables configured."}),i.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),i.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[i.jsx(Sn,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),i.jsxs("div",{className:"flex gap-2 mt-2",children:[i.jsx(zn,{placeholder:"VARIABLE_NAME",value:p,onChange:P=>j(P.target.value.toUpperCase()),className:"font-mono text-sm h-8",onKeyDown:P=>P.key==="Enter"&&F()}),i.jsx(Je,{variant:"outline",size:"sm",className:"h-8",onClick:F,disabled:!p.trim(),children:i.jsx(gi,{className:"w-4 h-4"})})]})]})]}),i.jsx(hl,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:i.jsx(ha,{className:"h-full",children:i.jsxs("div",{className:"p-4 space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[i.jsx(cs,{className:"w-4 h-4"}),"Profile Information"]}),i.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:v&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Profile Name"}),i.jsx("span",{className:"font-mono",children:v.profile})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:v.path}),i.jsx(dl,{value:v.path,size:"icon",className:"h-5 w-5"})]})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),i.jsx("span",{className:"text-xs",children:new Date(v.mtime).toLocaleString()})]})]})})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),i.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[i.jsxs("div",{children:[i.jsx(Sn,{className:"text-xs text-muted-foreground",children:"Run with profile"}),i.jsxs("div",{className:"mt-1 flex gap-2",children:[i.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",l,' "prompt"']}),i.jsx(dl,{value:`ccs ${l} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),i.jsxs("div",{children:[i.jsx(Sn,{className:"text-xs text-muted-foreground",children:"Set as default"}),i.jsxs("div",{className:"mt-1 flex gap-2",children:[i.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",l]}),i.jsx(dl,{value:`ccs default ${l}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})})]})]})}),we=()=>i.jsx(y.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(ma,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!R&&m!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(rs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(wN,{value:Z,onChange:k,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Qg,{profileEnv:K?.env})})})]})});return i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:l}),v?.path&&i.jsx(sn,{variant:"outline",className:"text-xs",children:v.path.replace(/^.*\//,"")})]}),v&&i.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(v.mtime).toLocaleString()]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>B(),disabled:S,children:i.jsx(Ou,{className:`w-4 h-4 ${S?"animate-spin":""}`})}),s&&i.jsx(Je,{variant:"ghost",size:"sm",onClick:s,children:i.jsx(og,{className:"w-4 h-4 text-destructive"})}),i.jsx(Je,{size:"sm",onClick:G,disabled:U.isPending||!E||!R,children:U.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ma,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rg,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),S?i.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i.jsx(ma,{className:"w-8 h-8 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):_?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings for this profile."}),i.jsxs(Je,{variant:"outline",size:"sm",onClick:()=>B(),children:[i.jsx(Ou,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):i.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[i.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:ae()}),i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[i.jsx(cg,{className:"w-4 h-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),we()]})]}),i.jsx(Kg,{open:d,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ne(!0),onCancel:()=>ne(!1)})]},ce)}function Nx(l,s){try{var u=l()}catch(c){return s(c)}return u&&u.then?u.then(void 0,s):u}function CN(l,s){for(var u={};l.length;){var c=l[0],d=c.code,h=c.message,m=c.path.join(".");if(!u[m])if("unionErrors"in c){var x=c.unionErrors[0].errors[0];u[m]={message:x.message,type:x.code}}else u[m]={message:h,type:d};if("unionErrors"in c&&c.unionErrors.forEach(function(M){return M.errors.forEach(function(v){return l.push(v)})}),s){var p=u[m].types,j=p&&p[c.code];u[m]=dg(m,s,u,d,j?[].concat(j,c.message):c.message)}l.shift()}return u}function EN(l,s){for(var u={};l.length;){var c=l[0],d=c.code,h=c.message,m=c.path.join(".");if(!u[m])if(c.code==="invalid_union"&&c.errors.length>0){var x=c.errors[0][0];u[m]={message:x.message,type:x.code}}else u[m]={message:h,type:d};if(c.code==="invalid_union"&&c.errors.forEach(function(M){return M.forEach(function(v){return l.push(v)})}),s){var p=u[m].types,j=p&&p[c.code];u[m]=dg(m,s,u,d,j?[].concat(j,c.message):c.message)}l.shift()}return u}function MN(l,s,u){if(u===void 0&&(u={}),(function(c){return"_def"in c&&typeof c._def=="object"&&"typeName"in c._def})(l))return function(c,d,h){try{return Promise.resolve(Nx(function(){return Promise.resolve(l[u.mode==="sync"?"parse":"parseAsync"](c,s)).then(function(m){return h.shouldUseNativeValidation&&ex({},h),{errors:{},values:u.raw?Object.assign({},c):m}})},function(m){if((function(x){return Array.isArray(x?.issues)})(m))return{values:{},errors:tx(CN(m.errors,!h.shouldUseNativeValidation&&h.criteriaMode==="all"),h)};throw m}))}catch(m){return Promise.reject(m)}};if((function(c){return"_zod"in c&&typeof c._zod=="object"})(l))return function(c,d,h){try{return Promise.resolve(Nx(function(){return Promise.resolve((u.mode==="sync"?Cb:Eb)(l,c,s)).then(function(m){return h.shouldUseNativeValidation&&ex({},h),{errors:{},values:u.raw?Object.assign({},c):m}})},function(m){if((function(x){return x instanceof Mb})(m))return{values:{},errors:tx(EN(m.issues,!h.shouldUseNativeValidation&&h.criteriaMode==="all"),h)};throw m}))}catch(m){return Promise.reject(m)}};throw new Error("Invalid input: not a Zod schema")}function tw(){return Rt({queryKey:["profiles"],queryFn:()=>Et.profiles.list()})}function zN(){const l=Xt();return rn({mutationFn:s=>Et.profiles.create(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ue.success("Profile created successfully")},onError:s=>{Ue.error(s.message)}})}function nw(){const l=Xt();return rn({mutationFn:s=>Et.profiles.delete(s),onSuccess:()=>{l.invalidateQueries({queryKey:["profiles"]}),Ue.success("Profile deleted successfully")},onError:s=>{Ue.error(s.message)}})}const DN="claude-sonnet-4-5-20250929",ON=zb({name:ol().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:ol().url("Invalid URL format"),apiKey:ol().min(1,"API key is required"),model:ol().optional(),opusModel:ol().optional(),sonnetModel:ol().optional(),haikuModel:ol().optional()}),TN=["/chat/completions","/v1/messages","/messages","/completions"];function aw({open:l,onOpenChange:s,onSuccess:u}){const c=zN(),[d,h]=y.useState("basic"),[m,x]=y.useState(null),[p,j]=y.useState(!1),{register:M,handleSubmit:v,formState:{errors:S},watch:_,reset:B}=Db({resolver:MN(ON),defaultValues:{name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:""}}),K=_("baseUrl");y.useEffect(()=>{l&&(B(),h("basic"),x(null),j(!1))},[l,B]),y.useEffect(()=>{if(K){const V=K.toLowerCase();for(const F of TN)if(V.endsWith(F)){const R=K.replace(new RegExp(F+"$","i"),"");x(`URL ends with "${F}" - Claude appends this automatically. You likely want: ${R}`);return}}x(null)},[K]);const Z=async V=>{try{await c.mutateAsync(V),Ue.success(`Profile "${V.name}" created`),u(V.name),s(!1)}catch(F){Ue.error(F.message||"Failed to create profile")}},k=!!S.name||!!S.baseUrl||!!S.apiKey,W=!!S.model||!!S.opusModel||!!S.sonnetModel||!!S.haikuModel;return i.jsx(Xu,{open:l,onOpenChange:s,children:i.jsxs(Zu,{className:"sm:max-w-[600px] p-0 gap-0 overflow-hidden",children:[i.jsxs(Ju,{className:"p-6 pb-4 border-b",children:[i.jsxs(Wu,{className:"flex items-center gap-2",children:[i.jsx(gi,{className:"w-5 h-5 text-primary"}),"Create API Profile"]}),i.jsx(pg,{children:"Configure a custom API endpoint for Claude Code."})]}),i.jsx("form",{onSubmit:v(Z),children:i.jsxs(ed,{value:d,onValueChange:h,className:"flex flex-col",children:[i.jsx("div",{className:"px-6 pt-4",children:i.jsxs(lr,{className:"grid w-full grid-cols-2",children:[i.jsxs(ml,{value:"basic",className:"relative",children:["Basic Information",k&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),i.jsxs(ml,{value:"models",className:"relative",children:["Model Configuration",W&&i.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[60vh]",children:[i.jsx(hl,{value:"basic",className:"p-6 space-y-6 mt-0",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"name",children:["Profile Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(zn,{id:"name",...M("name"),placeholder:"my-api",className:"font-mono"}),S.name?i.jsx("p",{className:"text-xs text-destructive",children:S.name.message}):i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in CLI:"," ",i.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"baseUrl",children:["API Base URL ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx(zn,{id:"baseUrl",...M("baseUrl"),placeholder:"https://api.example.com/v1"}),S.baseUrl?i.jsx("p",{className:"text-xs text-destructive",children:S.baseUrl.message}):m?i.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-600 bg-yellow-50 dark:bg-yellow-900/20 p-2 rounded",children:[i.jsx(Lu,{className:"w-4 h-4 shrink-0 mt-0.5"}),i.jsx("span",{children:m})]}):i.jsx("p",{className:"text-xs text-muted-foreground",children:"The endpoint that accepts OpenAI-compatible and Anthropic requests"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"apiKey",children:["API Key ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(zn,{id:"apiKey",type:p?"text":"password",...M("apiKey"),placeholder:"sk-...",className:"pr-10"}),i.jsxs(Je,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>j(!p),tabIndex:-1,children:[p?i.jsx(Jo,{className:"h-4 w-4"}):i.jsx(Wo,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Toggle API key visibility"})]})]}),S.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]})]})}),i.jsxs(hl,{value:"models",className:"p-6 mt-0 space-y-6",children:[i.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:[i.jsx(cs,{className:"w-5 h-5 shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium mb-1",children:"Model Mapping"}),i.jsx("p",{className:"text-xs opacity-90",children:"Claude Code requests specific model tiers (Opus/Sonnet/Haiku). Map these tiers to the specific models supported by your API provider."})]})]}),i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"model",children:["Default Model",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),i.jsx(zn,{id:"model",...M("model"),placeholder:DN,className:"font-mono text-sm"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Fallback model if no specific tier is requested"})]}),i.jsxs("div",{className:"grid gap-4 pt-2 border-t",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"sonnetModel",className:"text-sm",children:["Sonnet Mapping (Primary)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),i.jsx(zn,{id:"sonnetModel",...M("sonnetModel"),placeholder:"e.g. gpt-4o, claude-3-5-sonnet",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"opusModel",className:"text-sm",children:["Opus Mapping (Complex Tasks)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),i.jsx(zn,{id:"opusModel",...M("opusModel"),placeholder:"e.g. o1-preview, claude-3-opus",className:"font-mono text-sm h-9"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Sn,{htmlFor:"haikuModel",className:"text-sm",children:["Haiku Mapping (Fast Tasks)",i.jsx(sn,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),i.jsx(zn,{id:"haikuModel",...M("haikuModel"),placeholder:"e.g. gpt-4o-mini, claude-3-haiku",className:"font-mono text-sm h-9"})]})]})]})]})]}),i.jsxs(gg,{className:"p-6 pt-2 border-t bg-muted/10",children:[i.jsx(Je,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),i.jsx(Je,{type:"submit",disabled:c.isPending,className:L(c.isPending&&"opacity-80"),children:c.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ma,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(gi,{className:"w-4 h-4 mr-2"}),"Create Profile"]})})]})]})})]})})}const AN=ey,jx=ny,_N=ty,Vg=y.forwardRef(({className:l,children:s,...u},c)=>i.jsxs(Vx,{ref:c,className:L("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,i.jsx(W0,{asChild:!0,children:i.jsx($o,{className:"h-4 w-4 opacity-50"})})]}));Vg.displayName=Vx.displayName;const Xg=y.forwardRef(({className:l,...s},u)=>i.jsx(Xx,{ref:u,className:L("flex cursor-default items-center justify-center py-1",l),...s,children:i.jsx(Yu,{className:"h-4 w-4"})}));Xg.displayName=Xx.displayName;const Zg=y.forwardRef(({className:l,...s},u)=>i.jsx(Zx,{ref:u,className:L("flex cursor-default items-center justify-center py-1",l),...s,children:i.jsx($o,{className:"h-4 w-4"})}));Zg.displayName=Zx.displayName;const Jg=y.forwardRef(({className:l,children:s,position:u="popper",...c},d)=>i.jsx($0,{children:i.jsxs(Jx,{ref:d,className:L("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,...c,children:[i.jsx(Xg,{}),i.jsx(F0,{className:L("p-1",u==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),i.jsx(Zg,{})]})}));Jg.displayName=Jx.displayName;const Ru=y.forwardRef(({className:l,...s},u)=>i.jsx(Wx,{ref:u,className:L("px-2 py-1.5 text-sm font-semibold",l),...s}));Ru.displayName=Wx.displayName;const Uu=y.forwardRef(({className:l,children:s,...u},c)=>i.jsxs($x,{ref:c,className:L("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:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(I0,{children:i.jsx(xi,{className:"h-4 w-4"})})}),i.jsx(P0,{children:s})]}));Uu.displayName=$x.displayName;const kN=y.forwardRef(({className:l,...s},u)=>i.jsx(Fx,{ref:u,className:L("-mx-1 my-1 h-px bg-muted",l),...s}));kN.displayName=Fx.displayName;function RN({...l}){return i.jsx(ay,{"data-slot":"dropdown-menu",...l})}function UN({...l}){return i.jsx(ly,{"data-slot":"dropdown-menu-trigger",...l})}function HN({className:l,sideOffset:s=4,...u}){return i.jsx(sy,{children:i.jsx(iy,{"data-slot":"dropdown-menu-content",sideOffset:s,className:L("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md bg-white dark:bg-zinc-950",l),...u})})}function wx({className:l,inset:s,variant:u="default",...c}){return i.jsx(oy,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":u,className:L("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground focus:[&_svg:not([class*='text-'])]:text-current relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",l),...c})}const BN={gemini:"/assets/providers/gemini-color.svg",codex:"/assets/providers/openai.svg",agy:"/assets/providers/agy.png",qwen:"/assets/providers/qwen-color.svg",iflow:"/assets/providers/iflow.png"},qN={gemini:{text:"text-blue-600",letter:"G"},claude:{text:"text-orange-600",letter:"C"},codex:{text:"text-emerald-600",letter:"X"},agy:{text:"text-violet-600",letter:"A"},qwen:{text:"text-cyan-600",letter:"Q"},iflow:{text:"text-indigo-600",letter:"i"}},LN={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function YN({provider:l,className:s,size:u="md"}){const c=l.toLowerCase(),d=qN[c]||{text:"text-gray-600",letter:l[0]?.toUpperCase()||"?"},h=LN[u],m=BN[c];return i.jsx("div",{className:L("flex items-center justify-center rounded-md",m&&"bg-white p-1",h.container,s),children:m?i.jsx("img",{src:m,alt:`${l} logo`,className:L(h.icon,"object-contain")}):i.jsx("span",{className:L("font-semibold",d.text,h.text),children:d.letter})})}function Ya({label:l,description:s,value:u,onChange:c,catalog:d,allModels:h,disabled:m}){const x=new Set(d?.models.map(p=>p.id)||[]);return i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-medium",children:l}),s&&i.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),i.jsxs(AN,{value:u||"",onValueChange:c,disabled:m,children:[i.jsx(Vg,{className:"h-9",children:i.jsx(_N,{placeholder:"Select model",children:u&&i.jsx("span",{className:"truncate font-mono text-xs",children:u})})}),i.jsxs(Jg,{className:"max-h-[300px]",children:[d&&d.models.length>0&&i.jsxs(jx,{children:[i.jsx(Ru,{className:"text-xs text-primary",children:"Recommended"}),d.models.map(p=>i.jsx(Uu,{value:p.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs",children:p.id}),p.tier==="paid"&&i.jsx(sn,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),u===p.id&&i.jsx(xi,{className:"w-3 h-3 text-primary ml-auto"})]})},p.id))]}),h.length>0&&i.jsxs(jx,{children:[i.jsxs(Ru,{className:"text-xs text-muted-foreground",children:["All Models (",h.length,")"]}),h.filter(p=>!x.has(p.id)).map(p=>i.jsx(Uu,{value:p.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs",children:p.id}),u===p.id&&i.jsx(xi,{className:"w-3 h-3 text-primary ml-auto"})]})},p.id))]}),(!d||d.models.length===0)&&h.length===0&&i.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}const GN=y.lazy(()=>Tn(()=>import("./code-editor-DmM_bX-t.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(l=>({default:l.CodeEditor})));function lw({provider:l,displayName:s,authStatus:u,catalog:c,logoProvider:d,onAddAccount:h,onSetDefault:m,onRemoveAccount:x,isRemovingAccount:p}){const[j,M]=y.useState(null),[v,S]=y.useState(!1),[_,B]=y.useState(!1),K=Xt(),{privacyMode:Z}=Fo(),{data:k}=Q1(),{data:W}=V1(l),V=X1(),F=Z1(),R=W?.presets||[],E=y.useMemo(()=>{if(!k?.models)return[];const H={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"]}[l.toLowerCase()]||[l.toLowerCase()];return k.models.filter(X=>H.some(fe=>X.owned_by.toLowerCase().includes(fe)))},[k,l]),{data:U,isLoading:G,refetch:ne}=Rt({queryKey:["settings",l],queryFn:async()=>{const N=await fetch(`/api/settings/${l}/raw`);return N.ok?N.json():{profile:l,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${l}/settings.json`}}}),re=U?.settings,ce=y.useMemo(()=>j!==null?j:re?JSON.stringify(re,null,2):`{
15
15
  "env": {}
16
16
  }`,[j,re]),ae=y.useCallback(N=>{M(N)},[]),we=y.useMemo(()=>{try{return JSON.parse(ce)}catch{return re||{env:{}}}},[ce,re]),P=we?.env?.ANTHROPIC_MODEL,de=we?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,D=we?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,$=we?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,le=(N,H)=>{const X={...we?.env||{},[N]:H},fe={...we,env:X};M(JSON.stringify(fe,null,2))},xe=N=>{const H={...we?.env||{},...N},X={...we,env:H};M(JSON.stringify(X,null,2))},Ne=y.useMemo(()=>{try{return JSON.parse(ce),!0}catch{return!1}},[ce]),Oe=y.useMemo(()=>j===null?!1:j!==JSON.stringify(re,null,2),[j,re]),Ee=rn({mutationFn:async()=>{const N=JSON.parse(ce),H=await fetch(`/api/settings/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:N,expectedMtime:U?.mtime})});if(H.status===409)throw new Error("CONFLICT");if(!H.ok)throw new Error("Failed to save");return H.json()},onSuccess:()=>{K.invalidateQueries({queryKey:["settings",l]}),M(null),Ue.success("Settings saved")},onError:N=>{N.message==="CONFLICT"?S(!0):Ue.error(N.message)}}),J=async N=>{S(!1),N?(await ne(),Ee.mutate()):M(null)},ee=u.accounts||[],se=()=>i.jsx("div",{className:"h-full flex flex-col",children:i.jsxs(ed,{defaultValue:"config",className:"h-full flex flex-col",children:[i.jsx("div",{className:"px-4 pt-4 shrink-0",children:i.jsxs(lr,{className:"w-full",children:[i.jsx(ml,{value:"config",className:"flex-1",children:"Model Config"}),i.jsx(ml,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),i.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[i.jsx(hl,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:i.jsx(ha,{className:"flex-1",children:i.jsxs("div",{className:"p-4 space-y-6",children:[c&&c.models.length>0||R.length>0?i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[i.jsx(ug,{className:"w-4 h-4"}),"Presets"]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[c?.models.slice(0,3).map(N=>i.jsxs(Je,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const H=N.presetMapping||{default:N.id,opus:N.id,sonnet:N.id,haiku:N.id};xe({ANTHROPIC_MODEL:H.default,ANTHROPIC_DEFAULT_OPUS_MODEL:H.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:H.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:H.haiku}),Ue.success(`Applied "${N.name}" preset`)},children:[i.jsx(Xo,{className:"w-3 h-3"}),N.name]},N.id)),R.map(N=>i.jsxs("div",{className:"group relative",children:[i.jsxs(Je,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{xe({ANTHROPIC_MODEL:N.default,ANTHROPIC_DEFAULT_OPUS_MODEL:N.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:N.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:N.haiku}),Ue.success(`Applied "${N.name}" preset`)},children:[i.jsx(Lo,{className:"w-3 h-3 fill-current"}),N.name]}),i.jsx(Je,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:H=>{H.stopPropagation(),F.mutate({profile:l,name:N.name})},disabled:F.isPending,children:i.jsx(rs,{className:"w-3 h-3"})})]},N.name)),i.jsxs(Je,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:()=>B(!0),children:[i.jsx(gi,{className:"w-3 h-3"}),"Custom"]})]})]}):null,i.jsx(Au,{}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(Ya,{label:"Default Model",description:"Used when no specific tier is requested",value:P,onChange:N=>le("ANTHROPIC_MODEL",N),catalog:c,allModels:E}),i.jsx(Ya,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:de,onChange:N=>le("ANTHROPIC_DEFAULT_OPUS_MODEL",N),catalog:c,allModels:E}),i.jsx(Ya,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:D,onChange:N=>le("ANTHROPIC_DEFAULT_SONNET_MODEL",N),catalog:c,allModels:E}),i.jsx(Ya,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:$,onChange:N=>le("ANTHROPIC_DEFAULT_HAIKU_MODEL",N),catalog:c,allModels:E})]})]}),i.jsx(Au,{}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[i.jsx(Tu,{className:"w-4 h-4"}),"Accounts",ee.length>0&&i.jsx(sn,{variant:"secondary",className:"text-xs",children:ee.length})]}),i.jsxs(Je,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:h,children:[i.jsx(gi,{className:"w-3 h-3"}),"Add"]})]}),ee.length>0?i.jsx("div",{className:"space-y-2",children:ee.map(N=>i.jsx(KN,{account:N,onSetDefault:()=>m(N.id),onRemove:()=>x(N.id),isRemoving:p,privacyMode:Z},N.id))}):i.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[i.jsx(Tu,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i.jsx("p",{className:"text-sm",children:"No accounts connected"}),i.jsx("p",{className:"text-xs opacity-70",children:"Add an account to get started"})]})]})]})})}),i.jsx(hl,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:i.jsx(ha,{className:"h-full",children:i.jsxs("div",{className:"p-4 space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[i.jsx(cs,{className:"w-4 h-4"}),"Provider Information"]}),i.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),i.jsx("span",{className:"font-mono",children:s})]}),U&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:U.path}),i.jsx(dl,{value:U.path,size:"icon",className:"h-5 w-5"})]})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),i.jsx("span",{className:"text-xs",children:new Date(U.mtime).toLocaleString()})]})]}),i.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),u.authenticated?i.jsxs(sn,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[i.jsx(lg,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):i.jsx(sn,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),i.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[i.jsx(Bo,{label:"Run with prompt",command:`ccs ${l} "your prompt"`}),i.jsx(Bo,{label:"Change model",command:`ccs ${l} --config`}),i.jsx(Bo,{label:"Add account",command:`ccs ${l} --add`}),i.jsx(Bo,{label:"List accounts",command:`ccs ${l} --accounts`})]})]})]})})})]})]})}),te=()=>i.jsx(y.Suspense,{fallback:i.jsxs("div",{className:"flex items-center justify-center h-full",children:[i.jsx(ma,{className:"w-6 h-6 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:i.jsxs("div",{className:"h-full flex flex-col",children:[!Ne&&j!==null&&i.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[i.jsx(rs,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),i.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:i.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:i.jsx(GN,{value:ce,onChange:ae,language:"json",minHeight:"100%"})})}),i.jsx("div",{className:"mx-6 mb-4",children:i.jsx("div",{className:"border rounded-md overflow-hidden",children:i.jsx(Qg,{profileEnv:re?.env})})})]})});return i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(YN,{provider:d||l,size:"lg"}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:s}),U?.path&&i.jsx(sn,{variant:"outline",className:"text-xs",children:U.path.replace(/^.*\//,"")})]}),U&&i.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(U.mtime).toLocaleString()]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Je,{variant:"ghost",size:"sm",onClick:()=>ne(),disabled:G,children:i.jsx(Ou,{className:`w-4 h-4 ${G?"animate-spin":""}`})}),i.jsx(Je,{size:"sm",onClick:()=>Ee.mutate(),disabled:Ee.isPending||!Oe||!Ne,children:Ee.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ma,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rg,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),G?i.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[i.jsx(ma,{className:"w-8 h-8 animate-spin text-muted-foreground"}),i.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):i.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[i.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:se()}),i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[i.jsx(cg,{className:"w-4 h-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),te()]})]}),i.jsx(Kg,{open:v,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>J(!0),onCancel:()=>J(!1)}),i.jsx(QN,{open:_,onClose:()=>B(!1),currentValues:{default:P||"",opus:de||"",sonnet:D||"",haiku:$||""},onApply:(N,H)=>{xe({ANTHROPIC_MODEL:N.default,ANTHROPIC_DEFAULT_OPUS_MODEL:N.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:N.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:N.haiku}),Ue.success(`Applied ${H?`"${H}"`:"custom"} preset`),B(!1)},onSave:(N,H)=>{if(!H){Ue.error("Please enter a preset name to save");return}V.mutate({profile:l,data:{name:H,default:N.default,opus:N.opus,sonnet:N.sonnet,haiku:N.haiku}}),B(!1)},isSaving:V.isPending,catalog:c,allModels:E})]})}function KN({account:l,onSetDefault:s,onRemove:u,isRemoving:c,privacyMode:d}){return i.jsxs("div",{className:L("flex items-center justify-between p-3 rounded-lg border transition-colors",l.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30"),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:L("flex items-center justify-center w-8 h-8 rounded-full",l.isDefault?"bg-primary/10":"bg-muted"),children:i.jsx(Tu,{className:"w-4 h-4"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:L("font-medium text-sm",d&&ls),children:l.email||l.id}),l.isDefault&&i.jsxs(sn,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[i.jsx(Lo,{className:"w-2.5 h-2.5 fill-current"}),"Default"]})]}),l.lastUsedAt&&i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[i.jsx(sg,{className:"w-3 h-3"}),"Last used: ",new Date(l.lastUsedAt).toLocaleDateString()]})]})]}),i.jsxs(RN,{children:[i.jsx(UN,{asChild:!0,children:i.jsx(Je,{variant:"ghost",size:"icon",className:"h-7 w-7",children:i.jsx(jb,{className:"w-4 h-4"})})}),i.jsxs(HN,{align:"end",children:[!l.isDefault&&i.jsxs(wx,{onClick:s,children:[i.jsx(Lo,{className:"w-4 h-4 mr-2"}),"Set as default"]}),i.jsxs(wx,{className:"text-destructive focus:text-destructive",onClick:u,disabled:c,children:[i.jsx(og,{className:"w-4 h-4 mr-2"}),c?"Removing...":"Remove account"]})]})]})]})}function Bo({label:l,command:s}){return i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground",children:l}),i.jsxs("div",{className:"mt-1 flex gap-2",children:[i.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:s}),i.jsx(dl,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function QN({open:l,onClose:s,currentValues:u,onApply:c,onSave:d,isSaving:h,catalog:m,allModels:x}){const[p,j]=y.useState(u),[M,v]=y.useState(""),S=_=>{_?(j(u),v("")):s()};return i.jsx(Xu,{open:l,onOpenChange:S,children:i.jsxs(Zu,{className:"sm:max-w-md",children:[i.jsx(Ju,{children:i.jsxs(Wu,{className:"flex items-center gap-2",children:[i.jsx(ug,{className:"w-4 h-4"}),"Custom Preset"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Sn,{htmlFor:"preset-name",children:"Preset Name (optional)"}),i.jsx(zn,{id:"preset-name",value:M,onChange:_=>v(_.target.value),placeholder:"e.g., My Custom Config",className:"text-sm"})]}),i.jsx(Au,{}),i.jsx(Ya,{label:"Default Model",description:"Used when no specific tier is requested",value:p.default,onChange:_=>j({...p,default:_}),catalog:m,allModels:x}),i.jsx(Ya,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:p.opus,onChange:_=>j({...p,opus:_}),catalog:m,allModels:x}),i.jsx(Ya,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:p.sonnet,onChange:_=>j({...p,sonnet:_}),catalog:m,allModels:x}),i.jsx(Ya,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:p.haiku,onChange:_=>j({...p,haiku:_}),catalog:m,allModels:x})]}),i.jsxs(gg,{className:"gap-2 sm:gap-0",children:[i.jsx(Je,{variant:"outline",onClick:s,children:"Cancel"}),d&&i.jsxs(Je,{variant:"secondary",onClick:()=>d(p,M||void 0),disabled:h||!M.trim(),children:[h?i.jsx(ma,{className:"w-4 h-4 mr-1 animate-spin"}):i.jsx(Lo,{className:"w-4 h-4 mr-1"}),"Save Preset"]}),i.jsxs(Je,{onClick:()=>c(p,M||void 0),children:[i.jsx(Xo,{className:"w-4 h-4 mr-1"}),"Apply Preset"]})]})]})})}var Qt={},Cx;function VN(){if(Cx)return Qt;Cx=1;var l=Qt&&Qt.__assign||function(){return l=Object.assign||function(R){for(var E,U=1,G=arguments.length;U<G;U++){E=arguments[U];for(var ne in E)Object.prototype.hasOwnProperty.call(E,ne)&&(R[ne]=E[ne])}return R},l.apply(this,arguments)},s=Qt&&Qt.__createBinding||(Object.create?(function(R,E,U,G){G===void 0&&(G=U);var ne=Object.getOwnPropertyDescriptor(E,U);(!ne||("get"in ne?!E.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return E[U]}}),Object.defineProperty(R,G,ne)}):(function(R,E,U,G){G===void 0&&(G=U),R[G]=E[U]})),u=Qt&&Qt.__setModuleDefault||(Object.create?(function(R,E){Object.defineProperty(R,"default",{enumerable:!0,value:E})}):function(R,E){R.default=E}),c=Qt&&Qt.__importStar||function(R){if(R&&R.__esModule)return R;var E={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&s(E,R,U);return u(E,R),E},d=Qt&&Qt.__rest||function(R,E){var U={};for(var G in R)Object.prototype.hasOwnProperty.call(R,G)&&E.indexOf(G)<0&&(U[G]=R[G]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var ne=0,G=Object.getOwnPropertySymbols(R);ne<G.length;ne++)E.indexOf(G[ne])<0&&Object.prototype.propertyIsEnumerable.call(R,G[ne])&&(U[G[ne]]=R[G[ne]]);return U};Object.defineProperty(Qt,"__esModule",{value:!0});var h=c(Px()),m=89,x=90,p=77,j=57,M=219,v=222,S=192,_=100,B=3e3,K=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),Z=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),k="npm__react-simple-code-editor__textarea",W=`
17
17
  /**
@@ -45,4 +45,4 @@ Error generating stack: `+a.message+`
45
45
  `);if(pe!==nt){var je=Ce[ve];_n({value:nt,selectionStart:je?.startsWith(me)?Ae-me.length:Ae,selectionEnd:st-(pe.length-nt.length)})}}else if(Ae!==st){var Ce=Mt(pe,Ae),kt=Ce.length-1,Kn=Mt(pe,st).length-1,je=Ce[kt];_n({value:pe.split(`
46
46
  `).map(function(hs,xs){return xs>=kt&&xs<=Kn?me+hs:hs}).join(`
47
47
  `),selectionStart:je&&/\S/.test(je)?Ae+me.length:Ae,selectionEnd:st+me.length*(Kn-kt+1)})}else{var jt=Ae+me.length;_n({value:pe.substring(0,Ae)+me+pe.substring(st),selectionStart:jt,selectionEnd:jt})}else if(I.key==="Backspace"){var Wt=Ae!==st,Nn=pe.substring(0,Ae);if(Nn.endsWith(me)&&!Wt){I.preventDefault();var jt=Ae-me.length;_n({value:pe.substring(0,Ae-me.length)+pe.substring(st),selectionStart:jt,selectionEnd:jt})}}else if(I.key==="Enter"){if(Ae===st){var fs=Mt(pe,Ae).pop(),Ka=fs?.match(/^\s+/);if(Ka?.[0]){I.preventDefault();var ms=`
48
- `+Ka[0],jt=Ae+ms.length;_n({value:pe.substring(0,Ae)+ms+pe.substring(st),selectionStart:jt,selectionEnd:jt})}}}else if(I.keyCode===j||I.keyCode===M||I.keyCode===v||I.keyCode===S){var un=void 0;I.keyCode===j&&I.shiftKey?un=["(",")"]:I.keyCode===M?I.shiftKey?un=["{","}"]:un=["[","]"]:I.keyCode===v?I.shiftKey?un=['"','"']:un=["'","'"]:I.keyCode===S&&!I.shiftKey&&(un=["`","`"]),Ae!==st&&un&&(I.preventDefault(),_n({value:pe.substring(0,Ae)+un[0]+pe.substring(Ae,st)+un[1]+pe.substring(st),selectionStart:Ae,selectionEnd:st+2}))}else(Z?I.metaKey&&I.keyCode===x:I.ctrlKey&&I.keyCode===x)&&!I.shiftKey&&!I.altKey?(I.preventDefault(),xl()):(Z?I.metaKey&&I.keyCode===x&&I.shiftKey:K?I.ctrlKey&&I.keyCode===m:I.ctrlKey&&I.keyCode===x&&I.shiftKey)&&!I.altKey?(I.preventDefault(),us()):I.keyCode===p&&I.ctrlKey&&(!Z||I.shiftKey)&&(I.preventDefault(),cn(function(Qn){return!Qn}))}},Gn=function(I){var Te=I.currentTarget,pe=Te.value,Ae=Te.selectionStart,st=Te.selectionEnd;Yn({value:pe,selectionStart:Ae,selectionEnd:st},!0),ee(pe)};return h.useEffect(function(){Ga()},[Ga]),h.useImperativeHandle(U,function(){return{get session(){return{history:be.current}},set session(I){be.current=I.history}}},[]),h.createElement("div",l({},Zt,{style:l(l({},F.container),ye)}),h.createElement("pre",l({className:H,"aria-hidden":"true",style:l(l(l({},F.editor),F.highlight),Jt)},typeof tt=="string"?{dangerouslySetInnerHTML:{__html:tt+"<br />"}}:{children:tt})),h.createElement("textarea",{ref:function(I){return rt.current=I},style:l(l(l({},F.editor),F.textarea),Jt),className:k+(We?" ".concat(We):""),id:gt,value:et,onChange:Gn,onKeyDown:ds,onClick:Ne,onKeyUp:J,onFocus:Oe,onBlur:xe,disabled:ne,form:re,maxLength:D,minLength:$,name:le,placeholder:N,readOnly:X,required:fe,autoFocus:G,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),h.createElement("style",{dangerouslySetInnerHTML:{__html:W}}))}),F={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 Qt.default=V,Qt}var XN=VN();const sw=py(XN),iw=cy,ow=dy,rw=uy,ZN=y.forwardRef(({className:l,align:s="center",sideOffset:u=4,...c},d)=>i.jsx(ry,{children:i.jsx(Ix,{ref:d,align:s,sideOffset:u,className:L("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),...c})}));ZN.displayName=Ix.displayName;function JN(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 WN={},mi={};function cl(l,s){try{const c=(WN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return c in mi?mi[c]:Ex(c,c.split(":"))}catch{if(l in mi)return mi[l];const u=l?.match($N);return u?Ex(l,u.slice(1)):NaN}}const $N=/([+-]\d\d):?(\d\d)?/;function Ex(l,s){const u=+(s[0]||0),c=+(s[1]||0),d=+(s[2]||0)/60;return mi[l]=u*60+c>0?u*60+c+d:u*60-c-d}class qn extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(cl(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)),Wg(this),Hu(this)):this.setTime(Date.now())}static tz(s,...u){return u.length?new qn(...u,s):new qn(Date.now(),s)}withTimeZone(s){return new qn(+this,s)}getTimezoneOffset(){const s=-cl(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),Hu(this),+this}[Symbol.for("constructDateFrom")](s){return new qn(+new Date(s),this.timeZone)}}const Mx=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!Mx.test(l))return;const s=l.replace(Mx,"$1UTC");qn.prototype[s]&&(l.startsWith("get")?qn.prototype[l]=function(){return this.internal[s]()}:(qn.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),FN(this),+this},qn.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),Hu(this),+this}))});function Hu(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-cl(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()),Wg(l)}function Wg(l){const s=cl(l.timeZone,l),u=s>0?Math.floor(s):Math.ceil(s),c=new Date(+l);c.setUTCHours(c.getUTCHours()-1);const d=-new Date(+l).getTimezoneOffset(),h=-new Date(+c).getTimezoneOffset(),m=d-h,x=Date.prototype.getHours.apply(l)!==l.internal.getUTCHours();m&&x&&l.internal.setUTCMinutes(l.internal.getUTCMinutes()+m);const p=d-u;p&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+p);const j=new Date(+l);j.setUTCSeconds(0);const M=d>0?j.getSeconds():(j.getSeconds()-60)%60,v=Math.round(-(cl(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 S=cl(l.timeZone,l),_=S>0?Math.floor(S):Math.ceil(S),K=-new Date(+l).getTimezoneOffset()-_,Z=_!==u,k=K-p;if(Z&&k){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+k);const W=cl(l.timeZone,l),V=W>0?Math.floor(W):Math.ceil(W),F=_-V;F&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+F),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+F))}}class ua extends qn{static tz(s,...u){return u.length?new ua(...u,s):new ua(Date.now(),s)}toISOString(){const[s,u,c]=this.tzComponents(),d=`${s}${u}:${c}`;return this.internal.toISOString().slice(0,-1)+d}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,u,c,d]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${c} ${u} ${d}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[u,c,d]=this.tzComponents();return`${s} GMT${u}${c}${d} (${JN(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?"-":"+",c=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),d=String(Math.abs(s)%60).padStart(2,"0");return[u,c,d]}withTimeZone(s){return new ua(+this,s)}[Symbol.for("constructDateFrom")](s){return new ua(+new Date(s),this.timeZone)}}const zx=5,IN=4;function PN(l,s){const u=s.startOfMonth(l),c=u.getDay()>0?u.getDay():7,d=s.addDays(l,-c+1),h=s.addDays(d,zx*7-1);return s.getMonth(l)===s.getMonth(h)?zx:IN}function $g(l,s){const u=s.startOfMonth(l),c=u.getDay();return c===1?u:c===0?s.addDays(u,-6):s.addDays(u,-1*(c-1))}function ej(l,s){const u=$g(l,s),c=PN(l,s);return s.addDays(u,c*7-1)}const Fg={...si,labels:{labelDayButton:(l,s,u,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,x)=>ri(m,x,{locale:si,...u});let h=d(l,"PPPP");return s.today&&(h=`Today, ${h}`),s.selected&&(h=`${h}, selected`),h},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 c;return u&&typeof u.format=="function"?c=u.format.bind(u):c=(d,h)=>ri(d,h,{locale:si,...s}),c(l,"LLLL yyyy")},labelGridcell:(l,s,u,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,x)=>ri(m,x,{locale:si,...u});let h=d(l,"PPPP");return s?.today&&(h=`Today, ${h}`),h},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,u)=>{let c;return u&&typeof u.format=="function"?c=u.format.bind(u):c=(d,h)=>ri(d,h,{locale:si,...s}),c(l,"cccc")}}};class on{constructor(s,u){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ua.tz(this.options.timeZone):new this.Date,this.newDate=(c,d,h)=>this.overrides?.newDate?this.overrides.newDate(c,d,h):this.options.timeZone?new ua(c,d,h,this.options.timeZone):new Date(c,d,h),this.addDays=(c,d)=>this.overrides?.addDays?this.overrides.addDays(c,d):Cy(c,d),this.addMonths=(c,d)=>this.overrides?.addMonths?this.overrides.addMonths(c,d):Ey(c,d),this.addWeeks=(c,d)=>this.overrides?.addWeeks?this.overrides.addWeeks(c,d):My(c,d),this.addYears=(c,d)=>this.overrides?.addYears?this.overrides.addYears(c,d):zy(c,d),this.differenceInCalendarDays=(c,d)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(c,d):Dy(c,d),this.differenceInCalendarMonths=(c,d)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(c,d):Oy(c,d),this.eachMonthOfInterval=c=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(c):Ty(c),this.eachYearOfInterval=c=>{const d=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(c):Ay(c),h=new Set(d.map(x=>this.getYear(x)));if(h.size===d.length)return d;const m=[];return h.forEach(x=>{m.push(new Date(x,0,1))}),m},this.endOfBroadcastWeek=c=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(c):ej(c,this),this.endOfISOWeek=c=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(c):_y(c),this.endOfMonth=c=>this.overrides?.endOfMonth?this.overrides.endOfMonth(c):ky(c),this.endOfWeek=(c,d)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(c,d):Ry(c,this.options),this.endOfYear=c=>this.overrides?.endOfYear?this.overrides.endOfYear(c):Uy(c),this.format=(c,d,h)=>{const m=this.overrides?.format?this.overrides.format(c,d,this.options):ri(c,d,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(m):m},this.getISOWeek=c=>this.overrides?.getISOWeek?this.overrides.getISOWeek(c):Hy(c),this.getMonth=(c,d)=>this.overrides?.getMonth?this.overrides.getMonth(c,this.options):By(c,this.options),this.getYear=(c,d)=>this.overrides?.getYear?this.overrides.getYear(c,this.options):qy(c,this.options),this.getWeek=(c,d)=>this.overrides?.getWeek?this.overrides.getWeek(c,this.options):Ly(c,this.options),this.isAfter=(c,d)=>this.overrides?.isAfter?this.overrides.isAfter(c,d):Yy(c,d),this.isBefore=(c,d)=>this.overrides?.isBefore?this.overrides.isBefore(c,d):Gy(c,d),this.isDate=c=>this.overrides?.isDate?this.overrides.isDate(c):Ky(c),this.isSameDay=(c,d)=>this.overrides?.isSameDay?this.overrides.isSameDay(c,d):Qy(c,d),this.isSameMonth=(c,d)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(c,d):Vy(c,d),this.isSameYear=(c,d)=>this.overrides?.isSameYear?this.overrides.isSameYear(c,d):Xy(c,d),this.max=c=>this.overrides?.max?this.overrides.max(c):Zy(c),this.min=c=>this.overrides?.min?this.overrides.min(c):Jy(c),this.setMonth=(c,d)=>this.overrides?.setMonth?this.overrides.setMonth(c,d):Wy(c,d),this.setYear=(c,d)=>this.overrides?.setYear?this.overrides.setYear(c,d):$y(c,d),this.startOfBroadcastWeek=(c,d)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(c,this):$g(c,this),this.startOfDay=c=>this.overrides?.startOfDay?this.overrides.startOfDay(c):Fy(c),this.startOfISOWeek=c=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(c):Iy(c),this.startOfMonth=c=>this.overrides?.startOfMonth?this.overrides.startOfMonth(c):Py(c),this.startOfWeek=(c,d)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(c,this.options):eb(c,this.options),this.startOfYear=c=>this.overrides?.startOfYear?this.overrides.startOfYear(c):tb(c),this.options={locale:Fg,...s},this.overrides=u}getDigitMap(){const{numerals:s="latn"}=this.options,u=new Intl.NumberFormat("en-US",{numberingSystem:s}),c={};for(let d=0;d<10;d++)c[d.toString()]=u.format(d);return c}replaceDigits(s){const u=this.getDigitMap();return s.replace(/\d/g,c=>u[c]||c)}formatNumber(s){return this.replaceDigits(s.toString())}getMonthYearOrder(){const s=this.options.locale?.code;return s&&on.yearFirstLocales.has(s)?"year-first":"month-first"}formatMonthYear(s){const{locale:u,timeZone:c,numerals:d}=this.options,h=u?.code;if(h&&on.yearFirstLocales.has(h))try{return new Intl.DateTimeFormat(h,{month:"long",year:"numeric",timeZone:c,numberingSystem:d}).format(s)}catch{}const m=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(s,m)}}on.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 Ln=new on;class Ig{constructor(s,u,c=Ln){this.date=s,this.displayMonth=u,this.outside=!!(u&&!c.isSameMonth(s,u)),this.dateLib=c,this.isoDate=c.format(s,"yyyy-MM-dd"),this.displayMonthId=c.format(u,"yyyy-MM"),this.dateMonthId=c.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class tj{constructor(s,u){this.date=s,this.weeks=u}}class nj{constructor(s,u){this.days=u,this.weekNumber=s}}function aj(l){return ie.createElement("button",{...l})}function lj(l){return ie.createElement("span",{...l})}function sj(l){const{size:s=24,orientation:u="left",className:c}=l;return ie.createElement("svg",{className:c,width:s,height:s,viewBox:"0 0 24 24"},u==="up"&&ie.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),u==="down"&&ie.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),u==="left"&&ie.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),u==="right"&&ie.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function ij(l){const{day:s,modifiers:u,...c}=l;return ie.createElement("td",{...c})}function oj(l){const{day:s,modifiers:u,...c}=l,d=ie.useRef(null);return ie.useEffect(()=>{u.focused&&d.current?.focus()},[u.focused]),ie.createElement("button",{ref:d,...c})}var he;(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"})(he||(he={}));var ut;(function(l){l.disabled="disabled",l.hidden="hidden",l.outside="outside",l.focused="focused",l.today="today"})(ut||(ut={}));var Dn;(function(l){l.range_end="range_end",l.range_middle="range_middle",l.range_start="range_start",l.selected="selected"})(Dn||(Dn={}));var ln;(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"})(ln||(ln={}));function rj(l){const{options:s,className:u,components:c,classNames:d,...h}=l,m=[d[he.Dropdown],u].join(" "),x=s?.find(({value:p})=>p===h.value);return ie.createElement("span",{"data-disabled":h.disabled,className:d[he.DropdownRoot]},ie.createElement(c.Select,{className:m,...h},s?.map(({value:p,label:j,disabled:M})=>ie.createElement(c.Option,{key:p,value:p,disabled:M},j))),ie.createElement("span",{className:d[he.CaptionLabel],"aria-hidden":!0},x?.label,ie.createElement(c.Chevron,{orientation:"down",size:18,className:d[he.Chevron]})))}function cj(l){return ie.createElement("div",{...l})}function uj(l){return ie.createElement("div",{...l})}function dj(l){const{calendarMonth:s,displayIndex:u,...c}=l;return ie.createElement("div",{...c},l.children)}function fj(l){const{calendarMonth:s,displayIndex:u,...c}=l;return ie.createElement("div",{...c})}function mj(l){return ie.createElement("table",{...l})}function hj(l){return ie.createElement("div",{...l})}const Pg=y.createContext(void 0);function yi(){const l=y.useContext(Pg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function xj(l){const{components:s}=yi();return ie.createElement(s.Dropdown,{...l})}function gj(l){const{onPreviousClick:s,onNextClick:u,previousMonth:c,nextMonth:d,...h}=l,{components:m,classNames:x,labels:{labelPrevious:p,labelNext:j}}=yi(),M=y.useCallback(S=>{d&&u?.(S)},[d,u]),v=y.useCallback(S=>{c&&s?.(S)},[c,s]);return ie.createElement("nav",{...h},ie.createElement(m.PreviousMonthButton,{type:"button",className:x[he.PreviousMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":p(c),onClick:v},ie.createElement(m.Chevron,{disabled:c?void 0:!0,className:x[he.Chevron],orientation:"left"})),ie.createElement(m.NextMonthButton,{type:"button",className:x[he.NextMonthButton],tabIndex:d?void 0:-1,"aria-disabled":d?void 0:!0,"aria-label":j(d),onClick:M},ie.createElement(m.Chevron,{disabled:d?void 0:!0,orientation:"right",className:x[he.Chevron]})))}function pj(l){const{components:s}=yi();return ie.createElement(s.Button,{...l})}function vj(l){return ie.createElement("option",{...l})}function yj(l){const{components:s}=yi();return ie.createElement(s.Button,{...l})}function bj(l){const{rootRef:s,...u}=l;return ie.createElement("div",{...u,ref:s})}function Sj(l){return ie.createElement("select",{...l})}function Nj(l){const{week:s,...u}=l;return ie.createElement("tr",{...u})}function jj(l){return ie.createElement("th",{...l})}function wj(l){return ie.createElement("thead",{"aria-hidden":!0},ie.createElement("tr",{...l}))}function Cj(l){const{week:s,...u}=l;return ie.createElement("th",{...u})}function Ej(l){return ie.createElement("th",{...l})}function Mj(l){return ie.createElement("tbody",{...l})}function zj(l){const{components:s}=yi();return ie.createElement(s.Dropdown,{...l})}const Dj=Object.freeze(Object.defineProperty({__proto__:null,Button:aj,CaptionLabel:lj,Chevron:sj,Day:ij,DayButton:oj,Dropdown:rj,DropdownNav:cj,Footer:uj,Month:dj,MonthCaption:fj,MonthGrid:mj,Months:hj,MonthsDropdown:xj,Nav:gj,NextMonthButton:pj,Option:vj,PreviousMonthButton:yj,Root:bj,Select:Sj,Week:Nj,WeekNumber:Cj,WeekNumberHeader:Ej,Weekday:jj,Weekdays:wj,Weeks:Mj,YearsDropdown:zj},Symbol.toStringTag,{value:"Module"}));function da(l,s,u=!1,c=Ln){let{from:d,to:h}=l;const{differenceInCalendarDays:m,isSameDay:x}=c;return d&&h?(m(h,d)<0&&([d,h]=[h,d]),m(s,d)>=(u?1:0)&&m(h,s)>=(u?1:0)):!u&&h?x(h,s):!u&&d?x(d,s):!1}function td(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function sr(l){return!!(l&&typeof l=="object"&&"from"in l)}function nd(l){return!!(l&&typeof l=="object"&&"after"in l)}function ad(l){return!!(l&&typeof l=="object"&&"before"in l)}function ep(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function tp(l,s){return Array.isArray(l)&&l.every(s.isDate)}function fa(l,s,u=Ln){const c=Array.isArray(s)?s:[s],{isSameDay:d,differenceInCalendarDays:h,isAfter:m}=u;return c.some(x=>{if(typeof x=="boolean")return x;if(u.isDate(x))return d(l,x);if(tp(x,u))return x.some(p=>d(l,p));if(sr(x))return da(x,l,!1,u);if(ep(x))return Array.isArray(x.dayOfWeek)?x.dayOfWeek.includes(l.getDay()):x.dayOfWeek===l.getDay();if(td(x)){const p=h(x.before,l),j=h(x.after,l),M=p>0,v=j<0;return m(x.before,x.after)?v&&M:M||v}return nd(x)?h(l,x.after)>0:ad(x)?h(x.before,l)>0:typeof x=="function"?x(l):!1})}function Oj(l,s,u,c,d){const{disabled:h,hidden:m,modifiers:x,showOutsideDays:p,broadcastCalendar:j,today:M=d.today()}=s,{isSameDay:v,isSameMonth:S,startOfMonth:_,isBefore:B,endOfMonth:K,isAfter:Z}=d,k=u&&_(u),W=c&&K(c),V={[ut.focused]:[],[ut.outside]:[],[ut.disabled]:[],[ut.hidden]:[],[ut.today]:[]},F={};for(const R of l){const{date:E,displayMonth:U}=R,G=!!(U&&!S(E,U)),ne=!!(k&&B(E,k)),re=!!(W&&Z(E,W)),ce=!!(h&&fa(E,h,d)),ae=!!(m&&fa(E,m,d))||ne||re||!j&&!p&&G||j&&p===!1&&G,we=v(E,M);G&&V.outside.push(R),ce&&V.disabled.push(R),ae&&V.hidden.push(R),we&&V.today.push(R),x&&Object.keys(x).forEach(P=>{const de=x?.[P];de&&fa(E,de,d)&&(F[P]?F[P].push(R):F[P]=[R])})}return R=>{const E={[ut.focused]:!1,[ut.disabled]:!1,[ut.hidden]:!1,[ut.outside]:!1,[ut.today]:!1},U={};for(const G in V){const ne=V[G];E[G]=ne.some(re=>re===R)}for(const G in F)U[G]=F[G].some(ne=>ne===R);return{...E,...U}}}function Tj(l,s,u={}){return Object.entries(l).filter(([,d])=>d===!0).reduce((d,[h])=>(u[h]?d.push(u[h]):s[ut[h]]?d.push(s[ut[h]]):s[Dn[h]]&&d.push(s[Dn[h]]),d),[s[he.Day]])}function Aj(l){return{...Dj,...l}}function _j(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,c])=>{u.startsWith("data-")&&(s[u]=c)}),s}function kj(){const l={};for(const s in he)l[he[s]]=`rdp-${he[s]}`;for(const s in ut)l[ut[s]]=`rdp-${ut[s]}`;for(const s in Dn)l[Dn[s]]=`rdp-${Dn[s]}`;for(const s in ln)l[ln[s]]=`rdp-${ln[s]}`;return l}function np(l,s,u){return(u??new on(s)).formatMonthYear(l)}const Rj=np;function Uj(l,s,u){return(u??new on(s)).format(l,"d")}function Hj(l,s=Ln){return s.format(l,"LLLL")}function Bj(l,s,u){return(u??new on(s)).format(l,"cccccc")}function qj(l,s=Ln){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function Lj(){return""}function ap(l,s=Ln){return s.format(l,"yyyy")}const Yj=ap,Gj=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:np,formatDay:Uj,formatMonthCaption:Rj,formatMonthDropdown:Hj,formatWeekNumber:qj,formatWeekNumberHeader:Lj,formatWeekdayName:Bj,formatYearCaption:Yj,formatYearDropdown:ap},Symbol.toStringTag,{value:"Module"}));function Kj(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...Gj,...l}}function ld(l,s,u,c){let d=(c??new on(u)).format(l,"PPPP");return s.today&&(d=`Today, ${d}`),s.selected&&(d=`${d}, selected`),d}const Qj=ld;function sd(l,s,u){return(u??new on(s)).formatMonthYear(l)}const Vj=sd;function lp(l,s,u,c){let d=(c??new on(u)).format(l,"PPPP");return s?.today&&(d=`Today, ${d}`),d}function sp(l){return"Choose the Month"}function ip(){return""}const Xj="Go to the Next Month";function op(l,s){return Xj}function rp(l){return"Go to the Previous Month"}function cp(l,s,u){return(u??new on(s)).format(l,"cccc")}function up(l,s){return`Week ${l}`}function dp(l){return"Week Number"}function fp(l){return"Choose the Year"}const Zj=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Vj,labelDay:Qj,labelDayButton:ld,labelGrid:sd,labelGridcell:lp,labelMonthDropdown:sp,labelNav:ip,labelNext:op,labelPrevious:rp,labelWeekNumber:up,labelWeekNumberHeader:dp,labelWeekday:cp,labelYearDropdown:fp},Symbol.toStringTag,{value:"Module"})),Mn=(l,s,u)=>s||(u?typeof u=="function"?u:(...c)=>u:l);function Jj(l,s){const u=s.locale?.labels??{};return{...Zj,...l??{},labelDayButton:Mn(ld,l?.labelDayButton,u.labelDayButton),labelMonthDropdown:Mn(sp,l?.labelMonthDropdown,u.labelMonthDropdown),labelNext:Mn(op,l?.labelNext,u.labelNext),labelPrevious:Mn(rp,l?.labelPrevious,u.labelPrevious),labelWeekNumber:Mn(up,l?.labelWeekNumber,u.labelWeekNumber),labelYearDropdown:Mn(fp,l?.labelYearDropdown,u.labelYearDropdown),labelGrid:Mn(sd,l?.labelGrid,u.labelGrid),labelGridcell:Mn(lp,l?.labelGridcell,u.labelGridcell),labelNav:Mn(ip,l?.labelNav,u.labelNav),labelWeekNumberHeader:Mn(dp,l?.labelWeekNumberHeader,u.labelWeekNumberHeader),labelWeekday:Mn(cp,l?.labelWeekday,u.labelWeekday)}}function Wj(l,s,u,c,d){const{startOfMonth:h,startOfYear:m,endOfYear:x,eachMonthOfInterval:p,getMonth:j}=d;return p({start:m(l),end:x(l)}).map(S=>{const _=c.formatMonthDropdown(S,d),B=j(S),K=s&&S<h(s)||u&&S>h(u)||!1;return{value:B,label:_,disabled:K}})}function $j(l,s={},u={}){let c={...s?.[he.Day]};return Object.entries(l).filter(([,d])=>d===!0).forEach(([d])=>{c={...c,...u?.[d]}}),c}function Fj(l,s,u,c){const d=c??l.today(),h=u?l.startOfBroadcastWeek(d,l):s?l.startOfISOWeek(d):l.startOfWeek(d),m=[];for(let x=0;x<7;x++){const p=l.addDays(h,x);m.push(p)}return m}function Ij(l,s,u,c,d=!1){if(!l||!s)return;const{startOfYear:h,endOfYear:m,eachYearOfInterval:x,getYear:p}=c,j=h(l),M=m(s),v=x({start:j,end:M});return d&&v.reverse(),v.map(S=>{const _=u.formatYearDropdown(S,c);return{value:p(S),label:_,disabled:!1}})}const bi=l=>l instanceof HTMLElement?l:null,Cu=l=>[...l.querySelectorAll("[data-animated-month]")??[]],Pj=l=>bi(l.querySelector("[data-animated-month]")),Eu=l=>bi(l.querySelector("[data-animated-caption]")),Mu=l=>bi(l.querySelector("[data-animated-weeks]")),e2=l=>bi(l.querySelector("[data-animated-nav]")),t2=l=>bi(l.querySelector("[data-animated-weekdays]"));function n2(l,s,{classNames:u,months:c,focused:d,dateLib:h}){const m=y.useRef(null),x=y.useRef(c),p=y.useRef(!1);y.useLayoutEffect(()=>{const j=x.current;if(x.current=c,!s||!l.current||!(l.current instanceof HTMLElement)||c.length===0||j.length===0||c.length!==j.length)return;const M=h.isSameMonth(c[0].date,j[0].date),v=h.isAfter(c[0].date,j[0].date),S=v?u[ln.caption_after_enter]:u[ln.caption_before_enter],_=v?u[ln.weeks_after_enter]:u[ln.weeks_before_enter],B=m.current,K=l.current.cloneNode(!0);if(K instanceof HTMLElement?(Cu(K).forEach(V=>{if(!(V instanceof HTMLElement))return;const F=Pj(V);F&&V.contains(F)&&V.removeChild(F);const R=Eu(V);R&&R.classList.remove(S);const E=Mu(V);E&&E.classList.remove(_)}),m.current=K):m.current=null,p.current||M||d)return;const Z=B instanceof HTMLElement?Cu(B):[],k=Cu(l.current);if(k?.every(W=>W instanceof HTMLElement)&&Z&&Z.every(W=>W instanceof HTMLElement)){p.current=!0,l.current.style.isolation="isolate";const W=e2(l.current);W&&(W.style.zIndex="1"),k.forEach((V,F)=>{const R=Z[F];if(!R)return;V.style.position="relative",V.style.overflow="hidden";const E=Eu(V);E&&E.classList.add(S);const U=Mu(V);U&&U.classList.add(_);const G=()=>{p.current=!1,l.current&&(l.current.style.isolation=""),W&&(W.style.zIndex=""),E&&E.classList.remove(S),U&&U.classList.remove(_),V.style.position="",V.style.overflow="",V.contains(R)&&V.removeChild(R)};R.style.pointerEvents="none",R.style.position="absolute",R.style.overflow="hidden",R.setAttribute("aria-hidden","true");const ne=t2(R);ne&&(ne.style.opacity="0");const re=Eu(R);re&&(re.classList.add(v?u[ln.caption_before_exit]:u[ln.caption_after_exit]),re.addEventListener("animationend",G));const ce=Mu(R);ce&&ce.classList.add(v?u[ln.weeks_before_exit]:u[ln.weeks_after_exit]),V.insertBefore(R,V.firstChild)})}})}function a2(l,s,u,c){const d=l[0],h=l[l.length-1],{ISOWeek:m,fixedWeeks:x,broadcastCalendar:p}=u??{},{addDays:j,differenceInCalendarDays:M,differenceInCalendarMonths:v,endOfBroadcastWeek:S,endOfISOWeek:_,endOfMonth:B,endOfWeek:K,isAfter:Z,startOfBroadcastWeek:k,startOfISOWeek:W,startOfWeek:V}=c,F=p?k(d,c):m?W(d):V(d),R=p?S(h):m?_(B(h)):K(B(h)),E=s&&(p?S(s):m?_(s):K(s)),U=E&&Z(R,E)?E:R,G=M(U,F),ne=v(h,d)+1,re=[];for(let we=0;we<=G;we++){const P=j(F,we);re.push(P)}const ae=(p?35:42)*ne;if(x&&re.length<ae){const we=ae-re.length;for(let P=0;P<we;P++){const de=j(re[re.length-1],1);re.push(de)}}return re}function l2(l){const s=[];return l.reduce((u,c)=>{const d=c.weeks.reduce((h,m)=>h.concat(m.days.slice()),s.slice());return u.concat(d.slice())},s.slice())}function s2(l,s,u,c){const{numberOfMonths:d=1}=u,h=[];for(let m=0;m<d;m++){const x=c.addMonths(l,m);if(s&&x>s)break;h.push(x)}return h}function Dx(l,s,u,c){const{month:d,defaultMonth:h,today:m=c.today(),numberOfMonths:x=1}=l;let p=d||h||m;const{differenceInCalendarMonths:j,addMonths:M,startOfMonth:v}=c;if(u&&j(u,p)<x-1){const S=-1*(x-1);p=M(u,S)}return s&&j(p,s)<0&&(p=s),v(p)}function i2(l,s,u,c){const{addDays:d,endOfBroadcastWeek:h,endOfISOWeek:m,endOfMonth:x,endOfWeek:p,getISOWeek:j,getWeek:M,startOfBroadcastWeek:v,startOfISOWeek:S,startOfWeek:_}=c,B=l.reduce((K,Z)=>{const k=u.broadcastCalendar?v(Z,c):u.ISOWeek?S(Z):_(Z),W=u.broadcastCalendar?h(Z):u.ISOWeek?m(x(Z)):p(x(Z)),V=s.filter(U=>U>=k&&U<=W),F=u.broadcastCalendar?35:42;if(u.fixedWeeks&&V.length<F){const U=s.filter(G=>{const ne=F-V.length;return G>W&&G<=d(W,ne)});V.push(...U)}const R=V.reduce((U,G)=>{const ne=u.ISOWeek?j(G):M(G),re=U.find(ae=>ae.weekNumber===ne),ce=new Ig(G,Z,c);return re?re.days.push(ce):U.push(new nj(ne,[ce])),U},[]),E=new tj(Z,R);return K.push(E),K},[]);return u.reverseMonths?B.reverse():B}function o2(l,s){let{startMonth:u,endMonth:c}=l;const{startOfYear:d,startOfDay:h,startOfMonth:m,endOfMonth:x,addYears:p,endOfYear:j,newDate:M,today:v}=s,{fromYear:S,toYear:_,fromMonth:B,toMonth:K}=l;!u&&B&&(u=B),!u&&S&&(u=s.newDate(S,0,1)),!c&&K&&(c=K),!c&&_&&(c=M(_,11,31));const Z=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return u?u=m(u):S?u=M(S,0,1):!u&&Z&&(u=d(p(l.today??v(),-100))),c?c=x(c):_?c=M(_,11,31):!c&&Z&&(c=j(l.today??v())),[u&&h(u),c&&h(c)]}function r2(l,s,u,c){if(u.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:h=1}=u,{startOfMonth:m,addMonths:x,differenceInCalendarMonths:p}=c,j=d?h:1,M=m(l);if(!s)return x(M,j);if(!(p(s,l)<h))return x(M,j)}function c2(l,s,u,c){if(u.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:h}=u,{startOfMonth:m,addMonths:x,differenceInCalendarMonths:p}=c,j=d?h??1:1,M=m(l);if(!s)return x(M,-j);if(!(p(M,s)<=0))return x(M,-j)}function u2(l){const s=[];return l.reduce((u,c)=>u.concat(c.weeks.slice()),s.slice())}function ir(l,s){const[u,c]=y.useState(l);return[s===void 0?u:s,c]}function d2(l,s){const[u,c]=o2(l,s),{startOfMonth:d,endOfMonth:h}=s,m=Dx(l,u,c,s),[x,p]=ir(m,l.month?m:void 0);y.useEffect(()=>{const F=Dx(l,u,c,s);p(F)},[l.timeZone]);const{months:j,weeks:M,days:v,previousMonth:S,nextMonth:_}=y.useMemo(()=>{const F=s2(x,c,{numberOfMonths:l.numberOfMonths},s),R=a2(F,l.endMonth?h(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),E=i2(F,R,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),U=u2(E),G=l2(E),ne=c2(x,u,l,s),re=r2(x,c,l,s);return{months:E,weeks:U,days:G,previousMonth:ne,nextMonth:re}},[s,x.getTime(),c?.getTime(),u?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:B,onMonthChange:K}=l,Z=F=>M.some(R=>R.days.some(E=>E.isEqualTo(F))),k=F=>{if(B)return;let R=d(F);u&&R<d(u)&&(R=d(u)),c&&R>d(c)&&(R=d(c)),p(R),K?.(R)};return{months:j,weeks:M,days:v,navStart:u,navEnd:c,previousMonth:S,nextMonth:_,goToMonth:k,goToDay:F=>{Z(F)||k(F.date)}}}var Bn;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(Bn||(Bn={}));function Ox(l){return!l[ut.disabled]&&!l[ut.hidden]&&!l[ut.outside]}function f2(l,s,u,c){let d,h=-1;for(const m of l){const x=s(m);Ox(x)&&(x[ut.focused]&&h<Bn.FocusedModifier?(d=m,h=Bn.FocusedModifier):c?.isEqualTo(m)&&h<Bn.LastFocused?(d=m,h=Bn.LastFocused):u(m.date)&&h<Bn.Selected?(d=m,h=Bn.Selected):x[ut.today]&&h<Bn.Today&&(d=m,h=Bn.Today))}return d||(d=l.find(m=>Ox(s(m)))),d}function m2(l,s,u,c,d,h,m){const{ISOWeek:x,broadcastCalendar:p}=h,{addDays:j,addMonths:M,addWeeks:v,addYears:S,endOfBroadcastWeek:_,endOfISOWeek:B,endOfWeek:K,max:Z,min:k,startOfBroadcastWeek:W,startOfISOWeek:V,startOfWeek:F}=m;let E={day:j,week:v,month:M,year:S,startOfWeek:U=>p?W(U,m):x?V(U):F(U),endOfWeek:U=>p?_(U):x?B(U):K(U)}[l](u,s==="after"?1:-1);return s==="before"&&c?E=Z([c,E]):s==="after"&&d&&(E=k([d,E])),E}function mp(l,s,u,c,d,h,m,x=0){if(x>365)return;const p=m2(l,s,u.date,c,d,h,m),j=!!(h.disabled&&fa(p,h.disabled,m)),M=!!(h.hidden&&fa(p,h.hidden,m)),v=p,S=new Ig(p,v,m);return!j&&!M?S:mp(l,s,S,c,d,h,m,x+1)}function h2(l,s,u,c,d){const{autoFocus:h}=l,[m,x]=y.useState(),p=f2(s.days,u,c||(()=>!1),m),[j,M]=y.useState(h?p:void 0);return{isFocusTarget:K=>!!p?.isEqualTo(K),setFocused:M,focused:j,blur:()=>{x(j),M(void 0)},moveFocus:(K,Z)=>{if(!j)return;const k=mp(K,Z,j,s.navStart,s.navEnd,l,d);k&&(l.disableNavigation&&!s.days.some(V=>V.isEqualTo(k))||(s.goToDay(k),M(k)))}}}function x2(l,s){const{selected:u,required:c,onSelect:d}=l,[h,m]=ir(u,d?u:void 0),x=d?u:h,{isSameDay:p}=s,j=_=>x?.some(B=>p(B,_))??!1,{min:M,max:v}=l;return{selected:x,select:(_,B,K)=>{let Z=[...x??[]];if(j(_)){if(x?.length===M||c&&x?.length===1)return;Z=x?.filter(k=>!p(k,_))}else x?.length===v?Z=[_]:Z=[...Z,_];return d||m(Z),d?.(Z,_,B,K),Z},isSelected:j}}function g2(l,s,u=0,c=0,d=!1,h=Ln){const{from:m,to:x}=s||{},{isSameDay:p,isAfter:j,isBefore:M}=h;let v;if(!m&&!x)v={from:l,to:u>0?void 0:l};else if(m&&!x)p(m,l)?u===0?v={from:m,to:l}:d?v={from:m,to:void 0}:v=void 0:M(l,m)?v={from:l,to:m}:v={from:m,to:l};else if(m&&x)if(p(m,l)&&p(x,l))d?v={from:m,to:x}:v=void 0;else if(p(m,l))v={from:m,to:u>0?void 0:l};else if(p(x,l))v={from:l,to:u>0?void 0:l};else if(M(l,m))v={from:l,to:x};else if(j(l,m))v={from:m,to:l};else if(j(l,x))v={from:m,to:l};else throw new Error("Invalid range");if(v?.from&&v?.to){const S=h.differenceInCalendarDays(v.to,v.from);c>0&&S>c?v={from:l,to:void 0}:u>1&&S<u&&(v={from:l,to:void 0})}return v}function p2(l,s,u=Ln){const c=Array.isArray(s)?s:[s];let d=l.from;const h=u.differenceInCalendarDays(l.to,l.from),m=Math.min(h,6);for(let x=0;x<=m;x++){if(c.includes(d.getDay()))return!0;d=u.addDays(d,1)}return!1}function Tx(l,s,u=Ln){return da(l,s.from,!1,u)||da(l,s.to,!1,u)||da(s,l.from,!1,u)||da(s,l.to,!1,u)}function v2(l,s,u=Ln){const c=Array.isArray(s)?s:[s];if(c.filter(x=>typeof x!="function").some(x=>typeof x=="boolean"?x:u.isDate(x)?da(l,x,!1,u):tp(x,u)?x.some(p=>da(l,p,!1,u)):sr(x)?x.from&&x.to?Tx(l,{from:x.from,to:x.to},u):!1:ep(x)?p2(l,x.dayOfWeek,u):td(x)?u.isAfter(x.before,x.after)?Tx(l,{from:u.addDays(x.after,1),to:u.addDays(x.before,-1)},u):fa(l.from,x,u)||fa(l.to,x,u):nd(x)||ad(x)?fa(l.from,x,u)||fa(l.to,x,u):!1))return!0;const m=c.filter(x=>typeof x=="function");if(m.length){let x=l.from;const p=u.differenceInCalendarDays(l.to,l.from);for(let j=0;j<=p;j++){if(m.some(M=>M(x)))return!0;x=u.addDays(x,1)}}return!1}function y2(l,s){const{disabled:u,excludeDisabled:c,selected:d,required:h,onSelect:m}=l,[x,p]=ir(d,m?d:void 0),j=m?d:x;return{selected:j,select:(S,_,B)=>{const{min:K,max:Z}=l,k=S?g2(S,j,K,Z,h,s):void 0;return c&&u&&k?.from&&k.to&&v2({from:k.from,to:k.to},u,s)&&(k.from=S,k.to=void 0),m||p(k),m?.(k,S,_,B),k},isSelected:S=>j&&da(j,S,!1,s)}}function b2(l,s){const{selected:u,required:c,onSelect:d}=l,[h,m]=ir(u,d?u:void 0),x=d?u:h,{isSameDay:p}=s;return{selected:x,select:(v,S,_)=>{let B=v;return!c&&x&&x&&p(v,x)&&(B=void 0),d||m(B),d?.(B,v,S,_),B},isSelected:v=>x?p(x,v):!1}}function S2(l,s){const u=b2(l,s),c=x2(l,s),d=y2(l,s);switch(l.mode){case"single":return u;case"multiple":return c;case"range":return d;default:return}}function _t(l,s){return l instanceof ua&&l.timeZone===s?l:new ua(l,s)}function Ax(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?_t(l,s):Array.isArray(l)?l.map(u=>u instanceof Date?_t(u,s):u):sr(l)?{...l,from:l.from?_t(l.from,s):l.from,to:l.to?_t(l.to,s):l.to}:td(l)?{before:_t(l.before,s),after:_t(l.after,s)}:nd(l)?{after:_t(l.after,s)}:ad(l)?{before:_t(l.before,s)}:l}function zu(l,s){return l&&(Array.isArray(l)?l.map(u=>Ax(u,s)):Ax(l,s))}function N2(l){let s=l;const u=s.timeZone;if(u&&(s={...l,timeZone:u},s.today&&(s.today=_t(s.today,u)),s.month&&(s.month=_t(s.month,u)),s.defaultMonth&&(s.defaultMonth=_t(s.defaultMonth,u)),s.startMonth&&(s.startMonth=_t(s.startMonth,u)),s.endMonth&&(s.endMonth=_t(s.endMonth,u)),s.mode==="single"&&s.selected?s.selected=_t(s.selected,u):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(me=>_t(me,u)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?_t(s.selected.from,u):s.selected.from,to:s.selected.to?_t(s.selected.to,u):s.selected.to}),s.disabled!==void 0&&(s.disabled=zu(s.disabled,u)),s.hidden!==void 0&&(s.hidden=zu(s.hidden,u)),s.modifiers)){const me={};Object.keys(s.modifiers).forEach(Ce=>{me[Ce]=zu(s.modifiers?.[Ce],u)}),s.modifiers=me}const{components:c,formatters:d,labels:h,dateLib:m,locale:x,classNames:p}=y.useMemo(()=>{const me={...Fg,...s.locale},Ce=new on({locale:me,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:Ce,components:Aj(s.components),formatters:Kj(s.formatters),labels:Jj(s.labels,Ce.options),locale:me,classNames:{...kj(),...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:m.today()});const{captionLayout:j,mode:M,navLayout:v,numberOfMonths:S=1,onDayBlur:_,onDayClick:B,onDayFocus:K,onDayKeyDown:Z,onDayMouseEnter:k,onDayMouseLeave:W,onNextClick:V,onPrevClick:F,showWeekNumber:R,styles:E}=s,{formatCaption:U,formatDay:G,formatMonthDropdown:ne,formatWeekNumber:re,formatWeekNumberHeader:ce,formatWeekdayName:ae,formatYearDropdown:we}=d,P=d2(s,m),{days:de,months:D,navStart:$,navEnd:le,previousMonth:xe,nextMonth:Ne,goToMonth:Oe}=P,Ee=Oj(de,s,$,le,m),{isSelected:J,select:ee,selected:se}=S2(s,m)??{},{blur:te,focused:N,isFocusTarget:H,moveFocus:X,setFocused:fe}=h2(s,P,Ee,J??(()=>!1),m),{labelDayButton:ye,labelGridcell:ze,labelGrid:Ge,labelMonthDropdown:We,labelNav:gt,labelPrevious:et,labelNext:Zt,labelWeekday:be,labelWeekNumber:rt,labelWeekNumberHeader:pt,labelYearDropdown:ct}=h,cn=y.useMemo(()=>Fj(m,s.ISOWeek,s.broadcastCalendar,s.today),[m,s.ISOWeek,s.broadcastCalendar,s.today]),Jt=M!==void 0||B!==void 0,tt=y.useCallback(()=>{xe&&(Oe(xe),F?.(xe))},[xe,Oe,F]),Mt=y.useCallback(()=>{Ne&&(Oe(Ne),V?.(Ne))},[Oe,Ne,V]),Yn=y.useCallback((me,Ce)=>ve=>{ve.preventDefault(),ve.stopPropagation(),fe(me),!Ce.disabled&&(ee?.(me.date,Ce,ve),B?.(me.date,Ce,ve))},[ee,B,fe]),Ga=y.useCallback((me,Ce)=>ve=>{fe(me),K?.(me.date,Ce,ve)},[K,fe]),An=y.useCallback((me,Ce)=>ve=>{te(),_?.(me.date,Ce,ve)},[te,_]),_n=y.useCallback((me,Ce)=>ve=>{const _e={ArrowLeft:[ve.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[ve.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[ve.shiftKey?"year":"week","after"],ArrowUp:[ve.shiftKey?"year":"week","before"],PageUp:[ve.shiftKey?"year":"month","before"],PageDown:[ve.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(_e[ve.key]){ve.preventDefault(),ve.stopPropagation();const[nt,je]=_e[ve.key];X(nt,je)}Z?.(me.date,Ce,ve)},[X,Z,s.dir]),xl=y.useCallback((me,Ce)=>ve=>{k?.(me.date,Ce,ve)},[k]),us=y.useCallback((me,Ce)=>ve=>{W?.(me.date,Ce,ve)},[W]),ds=y.useCallback(me=>Ce=>{const ve=Number(Ce.target.value),_e=m.setMonth(m.startOfMonth(me),ve);Oe(_e)},[m,Oe]),Gn=y.useCallback(me=>Ce=>{const ve=Number(Ce.target.value),_e=m.setYear(m.startOfMonth(me),ve);Oe(_e)},[m,Oe]),{className:I,style:Te}=y.useMemo(()=>({className:[p[he.Root],s.className].filter(Boolean).join(" "),style:{...E?.[he.Root],...s.style}}),[p,s.className,s.style,E]),pe=_j(s),Ae=y.useRef(null);n2(Ae,!!s.animate,{classNames:p,months:D,focused:N,dateLib:m});const st={dayPickerProps:s,selected:se,select:ee,isSelected:J,months:D,nextMonth:Ne,previousMonth:xe,goToMonth:Oe,getModifiers:Ee,components:c,classNames:p,styles:E,labels:h,formatters:d};return ie.createElement(Pg.Provider,{value:st},ie.createElement(c.Root,{rootRef:s.animate?Ae:void 0,className:I,style:Te,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"],...pe},ie.createElement(c.Months,{className:p[he.Months],style:E?.[he.Months]},!s.hideNavigation&&!v&&ie.createElement(c.Nav,{"data-animated-nav":s.animate?"true":void 0,className:p[he.Nav],style:E?.[he.Nav],"aria-label":gt(),onPreviousClick:tt,onNextClick:Mt,previousMonth:xe,nextMonth:Ne}),D.map((me,Ce)=>ie.createElement(c.Month,{"data-animated-month":s.animate?"true":void 0,className:p[he.Month],style:E?.[he.Month],key:Ce,displayIndex:Ce,calendarMonth:me},v==="around"&&!s.hideNavigation&&Ce===0&&ie.createElement(c.PreviousMonthButton,{type:"button",className:p[he.PreviousMonthButton],tabIndex:xe?void 0:-1,"aria-disabled":xe?void 0:!0,"aria-label":et(xe),onClick:tt,"data-animated-button":s.animate?"true":void 0},ie.createElement(c.Chevron,{disabled:xe?void 0:!0,className:p[he.Chevron],orientation:s.dir==="rtl"?"right":"left"})),ie.createElement(c.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:p[he.MonthCaption],style:E?.[he.MonthCaption],calendarMonth:me,displayIndex:Ce},j?.startsWith("dropdown")?ie.createElement(c.DropdownNav,{className:p[he.Dropdowns],style:E?.[he.Dropdowns]},(()=>{const ve=j==="dropdown"||j==="dropdown-months"?ie.createElement(c.MonthsDropdown,{key:"month",className:p[he.MonthsDropdown],"aria-label":We(),classNames:p,components:c,disabled:!!s.disableNavigation,onChange:ds(me.date),options:Wj(me.date,$,le,d,m),style:E?.[he.Dropdown],value:m.getMonth(me.date)}):ie.createElement("span",{key:"month"},ne(me.date,m)),_e=j==="dropdown"||j==="dropdown-years"?ie.createElement(c.YearsDropdown,{key:"year",className:p[he.YearsDropdown],"aria-label":ct(m.options),classNames:p,components:c,disabled:!!s.disableNavigation,onChange:Gn(me.date),options:Ij($,le,d,m,!!s.reverseYears),style:E?.[he.Dropdown],value:m.getYear(me.date)}):ie.createElement("span",{key:"year"},we(me.date,m));return m.getMonthYearOrder()==="year-first"?[_e,ve]:[ve,_e]})(),ie.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"}},U(me.date,m.options,m))):ie.createElement(c.CaptionLabel,{className:p[he.CaptionLabel],role:"status","aria-live":"polite"},U(me.date,m.options,m))),v==="around"&&!s.hideNavigation&&Ce===S-1&&ie.createElement(c.NextMonthButton,{type:"button",className:p[he.NextMonthButton],tabIndex:Ne?void 0:-1,"aria-disabled":Ne?void 0:!0,"aria-label":Zt(Ne),onClick:Mt,"data-animated-button":s.animate?"true":void 0},ie.createElement(c.Chevron,{disabled:Ne?void 0:!0,className:p[he.Chevron],orientation:s.dir==="rtl"?"left":"right"})),Ce===S-1&&v==="after"&&!s.hideNavigation&&ie.createElement(c.Nav,{"data-animated-nav":s.animate?"true":void 0,className:p[he.Nav],style:E?.[he.Nav],"aria-label":gt(),onPreviousClick:tt,onNextClick:Mt,previousMonth:xe,nextMonth:Ne}),ie.createElement(c.MonthGrid,{role:"grid","aria-multiselectable":M==="multiple"||M==="range","aria-label":Ge(me.date,m.options,m)||void 0,className:p[he.MonthGrid],style:E?.[he.MonthGrid]},!s.hideWeekdays&&ie.createElement(c.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:p[he.Weekdays],style:E?.[he.Weekdays]},R&&ie.createElement(c.WeekNumberHeader,{"aria-label":pt(m.options),className:p[he.WeekNumberHeader],style:E?.[he.WeekNumberHeader],scope:"col"},ce()),cn.map(ve=>ie.createElement(c.Weekday,{"aria-label":be(ve,m.options,m),className:p[he.Weekday],key:String(ve),style:E?.[he.Weekday],scope:"col"},ae(ve,m.options,m)))),ie.createElement(c.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:p[he.Weeks],style:E?.[he.Weeks]},me.weeks.map(ve=>ie.createElement(c.Week,{className:p[he.Week],key:ve.weekNumber,style:E?.[he.Week],week:ve},R&&ie.createElement(c.WeekNumber,{week:ve,style:E?.[he.WeekNumber],"aria-label":rt(ve.weekNumber,{locale:x}),className:p[he.WeekNumber],scope:"row",role:"rowheader"},re(ve.weekNumber,m)),ve.days.map(_e=>{const{date:nt}=_e,je=Ee(_e);if(je[ut.focused]=!je.hidden&&!!N?.isEqualTo(_e),je[Dn.selected]=J?.(nt)||je.selected,sr(se)){const{from:Wt,to:Nn}=se;je[Dn.range_start]=!!(Wt&&Nn&&m.isSameDay(nt,Wt)),je[Dn.range_end]=!!(Wt&&Nn&&m.isSameDay(nt,Nn)),je[Dn.range_middle]=da(se,nt,!0,m)}const kt=$j(je,E,s.modifiersStyles),Kn=Tj(je,p,s.modifiersClassNames),jt=!Jt&&!je.hidden?ze(nt,je,m.options,m):void 0;return ie.createElement(c.Day,{key:`${_e.isoDate}_${_e.displayMonthId}`,day:_e,modifiers:je,className:Kn.join(" "),style:kt,role:"gridcell","aria-selected":je.selected||void 0,"aria-label":jt,"data-day":_e.isoDate,"data-month":_e.outside?_e.dateMonthId:void 0,"data-selected":je.selected||void 0,"data-disabled":je.disabled||void 0,"data-hidden":je.hidden||void 0,"data-outside":_e.outside||void 0,"data-focused":je.focused||void 0,"data-today":je.today||void 0},!je.hidden&&Jt?ie.createElement(c.DayButton,{className:p[he.DayButton],style:E?.[he.DayButton],type:"button",day:_e,modifiers:je,disabled:!je.focused&&je.disabled||void 0,"aria-disabled":je.focused&&je.disabled||void 0,tabIndex:H(_e)?0:-1,"aria-label":ye(nt,je,m.options,m),onClick:Yn(_e,je),onBlur:An(_e,je),onFocus:Ga(_e,je),onKeyDown:_n(_e,je),onMouseEnter:xl(_e,je),onMouseLeave:us(_e,je)},G(nt,m.options,m)):!je.hidden&&G(_e.date,m.options,m))})))))))),s.footer&&ie.createElement(c.Footer,{className:p[he.Footer],style:E?.[he.Footer],role:"status","aria-live":"polite"},s.footer)))}function j2({className:l,classNames:s,showOutsideDays:u=!0,...c}){return i.jsx(N2,{showOutsideDays:u,className:L("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:L(is({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:L(is({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:L("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:L(is({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:L("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:L("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:L("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:L("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:d,className:h,...m})=>{const x=d==="left"?wb:d==="right"?Zo:d==="up"?Yu:$o;return i.jsx(x,{className:L("h-4 w-4",h),...m})}},...c})}j2.displayName="Calendar";const w2=y.lazy(()=>Tn(()=>import("./analytics-Dhp2ikxe.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),C2=y.lazy(()=>Tn(()=>import("./api-CZf-jQ-_.js"),__vite__mapDeps([12,1,2,5,6,7,4,8,3])).then(l=>({default:l.ApiPage}))),E2=y.lazy(()=>Tn(()=>import("./cliproxy-DZ_5oEVY.js"),__vite__mapDeps([13,1,2,6,10,5,7,4,8,3])).then(l=>({default:l.CliproxyPage}))),M2=y.lazy(()=>Tn(()=>import("./cliproxy-control-panel-DKMAi4_4.js"),__vite__mapDeps([14,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),z2=y.lazy(()=>Tn(()=>import("./copilot-Dd0yazW6.js"),__vite__mapDeps([15,1,2,6,16,7,5,4,8,3])).then(l=>({default:l.CopilotPage}))),D2=y.lazy(()=>Tn(()=>import("./accounts-DNYYJ7ul.js"),__vite__mapDeps([17,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),O2=y.lazy(()=>Tn(()=>import("./settings-COL3veEu.js"),__vite__mapDeps([18,1,2,16,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),T2=y.lazy(()=>Tn(()=>import("./health-CyZQOQg7.js"),__vite__mapDeps([19,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),A2=y.lazy(()=>Tn(()=>import("./shared-BG9bijB0.js"),__vite__mapDeps([20,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function _2(){return i.jsx(Sy,{client:Hb,children:i.jsx(qb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:i.jsx(Lb,{children:i.jsxs(vy,{children:[i.jsx(yy,{children:i.jsxs(En,{element:i.jsx(L1,{}),children:[i.jsx(En,{path:"/",element:i.jsx(fN,{})}),i.jsx(En,{path:"/analytics",element:i.jsx(w2,{})}),i.jsx(En,{path:"/api",element:i.jsx(C2,{})}),i.jsx(En,{path:"/cliproxy",element:i.jsx(E2,{})}),i.jsx(En,{path:"/cliproxy/control-panel",element:i.jsx(M2,{})}),i.jsx(En,{path:"/copilot",element:i.jsx(z2,{})}),i.jsx(En,{path:"/accounts",element:i.jsx(D2,{})}),i.jsx(En,{path:"/settings",element:i.jsx(O2,{})}),i.jsx(En,{path:"/health",element:i.jsx(T2,{})}),i.jsx(En,{path:"/shared",element:i.jsx(A2,{})})]})}),i.jsx(Ny,{position:"top-right"})]})})})})}const hp=document.getElementById("root");if(!hp)throw new Error("Root element not found. Failed to mount React application.");kb.createRoot(hp).render(i.jsx(y.StrictMode,{children:i.jsx(_2,{})}));export{Ru as $,Vg as A,Je as B,j2 as C,Xu as D,_N as E,Jg as F,Uu as G,W2 as H,zn as I,I2 as J,$2 as K,Sn as L,F2 as M,K2 as N,X2 as O,iw as P,Z2 as Q,V2 as R,ot as S,lw as T,YN as U,ed as V,lr as W,ml as X,hl as Y,Qg as Z,jx as _,ow as a,Tn as a0,Et as a1,Ug as a2,_u as a3,Hg as a4,Lg as a5,Gg as a6,g1 as a7,p1 as a8,v1 as a9,cN as aa,P2 as ab,Yg as ac,S1 as ad,sw as ae,ZN as b,L as c,ls as d,sn as e,$1 as f,G2 as g,F1 as h,ha as i,rw as j,tw as k,nw as l,ew as m,aw as n,Kg as o,dl as p,Au as q,K1 as r,Q2 as s,J2 as t,Fo as u,Zu as v,Ju as w,Wu as x,pg as y,AN as z};
48
+ `+Ka[0],jt=Ae+ms.length;_n({value:pe.substring(0,Ae)+ms+pe.substring(st),selectionStart:jt,selectionEnd:jt})}}}else if(I.keyCode===j||I.keyCode===M||I.keyCode===v||I.keyCode===S){var un=void 0;I.keyCode===j&&I.shiftKey?un=["(",")"]:I.keyCode===M?I.shiftKey?un=["{","}"]:un=["[","]"]:I.keyCode===v?I.shiftKey?un=['"','"']:un=["'","'"]:I.keyCode===S&&!I.shiftKey&&(un=["`","`"]),Ae!==st&&un&&(I.preventDefault(),_n({value:pe.substring(0,Ae)+un[0]+pe.substring(Ae,st)+un[1]+pe.substring(st),selectionStart:Ae,selectionEnd:st+2}))}else(Z?I.metaKey&&I.keyCode===x:I.ctrlKey&&I.keyCode===x)&&!I.shiftKey&&!I.altKey?(I.preventDefault(),xl()):(Z?I.metaKey&&I.keyCode===x&&I.shiftKey:K?I.ctrlKey&&I.keyCode===m:I.ctrlKey&&I.keyCode===x&&I.shiftKey)&&!I.altKey?(I.preventDefault(),us()):I.keyCode===p&&I.ctrlKey&&(!Z||I.shiftKey)&&(I.preventDefault(),cn(function(Qn){return!Qn}))}},Gn=function(I){var Te=I.currentTarget,pe=Te.value,Ae=Te.selectionStart,st=Te.selectionEnd;Yn({value:pe,selectionStart:Ae,selectionEnd:st},!0),ee(pe)};return h.useEffect(function(){Ga()},[Ga]),h.useImperativeHandle(U,function(){return{get session(){return{history:be.current}},set session(I){be.current=I.history}}},[]),h.createElement("div",l({},Zt,{style:l(l({},F.container),ye)}),h.createElement("pre",l({className:H,"aria-hidden":"true",style:l(l(l({},F.editor),F.highlight),Jt)},typeof tt=="string"?{dangerouslySetInnerHTML:{__html:tt+"<br />"}}:{children:tt})),h.createElement("textarea",{ref:function(I){return rt.current=I},style:l(l(l({},F.editor),F.textarea),Jt),className:k+(We?" ".concat(We):""),id:gt,value:et,onChange:Gn,onKeyDown:ds,onClick:Ne,onKeyUp:J,onFocus:Oe,onBlur:xe,disabled:ne,form:re,maxLength:D,minLength:$,name:le,placeholder:N,readOnly:X,required:fe,autoFocus:G,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),h.createElement("style",{dangerouslySetInnerHTML:{__html:W}}))}),F={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 Qt.default=V,Qt}var XN=VN();const sw=py(XN),iw=cy,ow=dy,rw=uy,ZN=y.forwardRef(({className:l,align:s="center",sideOffset:u=4,...c},d)=>i.jsx(ry,{children:i.jsx(Ix,{ref:d,align:s,sideOffset:u,className:L("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),...c})}));ZN.displayName=Ix.displayName;function JN(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 WN={},mi={};function cl(l,s){try{const c=(WN[l]||=new Intl.DateTimeFormat("en-US",{timeZone:l,timeZoneName:"longOffset"}).format)(s).split("GMT")[1];return c in mi?mi[c]:Ex(c,c.split(":"))}catch{if(l in mi)return mi[l];const u=l?.match($N);return u?Ex(l,u.slice(1)):NaN}}const $N=/([+-]\d\d):?(\d\d)?/;function Ex(l,s){const u=+(s[0]||0),c=+(s[1]||0),d=+(s[2]||0)/60;return mi[l]=u*60+c>0?u*60+c+d:u*60-c-d}class qn extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(cl(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)),Wg(this),Hu(this)):this.setTime(Date.now())}static tz(s,...u){return u.length?new qn(...u,s):new qn(Date.now(),s)}withTimeZone(s){return new qn(+this,s)}getTimezoneOffset(){const s=-cl(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),Hu(this),+this}[Symbol.for("constructDateFrom")](s){return new qn(+new Date(s),this.timeZone)}}const Mx=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(l=>{if(!Mx.test(l))return;const s=l.replace(Mx,"$1UTC");qn.prototype[s]&&(l.startsWith("get")?qn.prototype[l]=function(){return this.internal[s]()}:(qn.prototype[l]=function(){return Date.prototype[s].apply(this.internal,arguments),FN(this),+this},qn.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),Hu(this),+this}))});function Hu(l){l.internal.setTime(+l),l.internal.setUTCSeconds(l.internal.getUTCSeconds()-Math.round(-cl(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()),Wg(l)}function Wg(l){const s=cl(l.timeZone,l),u=s>0?Math.floor(s):Math.ceil(s),c=new Date(+l);c.setUTCHours(c.getUTCHours()-1);const d=-new Date(+l).getTimezoneOffset(),h=-new Date(+c).getTimezoneOffset(),m=d-h,x=Date.prototype.getHours.apply(l)!==l.internal.getUTCHours();m&&x&&l.internal.setUTCMinutes(l.internal.getUTCMinutes()+m);const p=d-u;p&&Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+p);const j=new Date(+l);j.setUTCSeconds(0);const M=d>0?j.getSeconds():(j.getSeconds()-60)%60,v=Math.round(-(cl(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 S=cl(l.timeZone,l),_=S>0?Math.floor(S):Math.ceil(S),K=-new Date(+l).getTimezoneOffset()-_,Z=_!==u,k=K-p;if(Z&&k){Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+k);const W=cl(l.timeZone,l),V=W>0?Math.floor(W):Math.ceil(W),F=_-V;F&&(l.internal.setUTCMinutes(l.internal.getUTCMinutes()+F),Date.prototype.setUTCMinutes.call(l,Date.prototype.getUTCMinutes.call(l)+F))}}class ua extends qn{static tz(s,...u){return u.length?new ua(...u,s):new ua(Date.now(),s)}toISOString(){const[s,u,c]=this.tzComponents(),d=`${s}${u}:${c}`;return this.internal.toISOString().slice(0,-1)+d}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,u,c,d]=this.internal.toUTCString().split(" ");return`${s?.slice(0,-1)} ${c} ${u} ${d}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[u,c,d]=this.tzComponents();return`${s} GMT${u}${c}${d} (${JN(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?"-":"+",c=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),d=String(Math.abs(s)%60).padStart(2,"0");return[u,c,d]}withTimeZone(s){return new ua(+this,s)}[Symbol.for("constructDateFrom")](s){return new ua(+new Date(s),this.timeZone)}}const zx=5,IN=4;function PN(l,s){const u=s.startOfMonth(l),c=u.getDay()>0?u.getDay():7,d=s.addDays(l,-c+1),h=s.addDays(d,zx*7-1);return s.getMonth(l)===s.getMonth(h)?zx:IN}function $g(l,s){const u=s.startOfMonth(l),c=u.getDay();return c===1?u:c===0?s.addDays(u,-6):s.addDays(u,-1*(c-1))}function ej(l,s){const u=$g(l,s),c=PN(l,s);return s.addDays(u,c*7-1)}const Fg={...si,labels:{labelDayButton:(l,s,u,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,x)=>ri(m,x,{locale:si,...u});let h=d(l,"PPPP");return s.today&&(h=`Today, ${h}`),s.selected&&(h=`${h}, selected`),h},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 c;return u&&typeof u.format=="function"?c=u.format.bind(u):c=(d,h)=>ri(d,h,{locale:si,...s}),c(l,"LLLL yyyy")},labelGridcell:(l,s,u,c)=>{let d;c&&typeof c.format=="function"?d=c.format.bind(c):d=(m,x)=>ri(m,x,{locale:si,...u});let h=d(l,"PPPP");return s?.today&&(h=`Today, ${h}`),h},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(l,s,u)=>{let c;return u&&typeof u.format=="function"?c=u.format.bind(u):c=(d,h)=>ri(d,h,{locale:si,...s}),c(l,"cccc")}}};class on{constructor(s,u){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ua.tz(this.options.timeZone):new this.Date,this.newDate=(c,d,h)=>this.overrides?.newDate?this.overrides.newDate(c,d,h):this.options.timeZone?new ua(c,d,h,this.options.timeZone):new Date(c,d,h),this.addDays=(c,d)=>this.overrides?.addDays?this.overrides.addDays(c,d):Cy(c,d),this.addMonths=(c,d)=>this.overrides?.addMonths?this.overrides.addMonths(c,d):Ey(c,d),this.addWeeks=(c,d)=>this.overrides?.addWeeks?this.overrides.addWeeks(c,d):My(c,d),this.addYears=(c,d)=>this.overrides?.addYears?this.overrides.addYears(c,d):zy(c,d),this.differenceInCalendarDays=(c,d)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(c,d):Dy(c,d),this.differenceInCalendarMonths=(c,d)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(c,d):Oy(c,d),this.eachMonthOfInterval=c=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(c):Ty(c),this.eachYearOfInterval=c=>{const d=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(c):Ay(c),h=new Set(d.map(x=>this.getYear(x)));if(h.size===d.length)return d;const m=[];return h.forEach(x=>{m.push(new Date(x,0,1))}),m},this.endOfBroadcastWeek=c=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(c):ej(c,this),this.endOfISOWeek=c=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(c):_y(c),this.endOfMonth=c=>this.overrides?.endOfMonth?this.overrides.endOfMonth(c):ky(c),this.endOfWeek=(c,d)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(c,d):Ry(c,this.options),this.endOfYear=c=>this.overrides?.endOfYear?this.overrides.endOfYear(c):Uy(c),this.format=(c,d,h)=>{const m=this.overrides?.format?this.overrides.format(c,d,this.options):ri(c,d,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(m):m},this.getISOWeek=c=>this.overrides?.getISOWeek?this.overrides.getISOWeek(c):Hy(c),this.getMonth=(c,d)=>this.overrides?.getMonth?this.overrides.getMonth(c,this.options):By(c,this.options),this.getYear=(c,d)=>this.overrides?.getYear?this.overrides.getYear(c,this.options):qy(c,this.options),this.getWeek=(c,d)=>this.overrides?.getWeek?this.overrides.getWeek(c,this.options):Ly(c,this.options),this.isAfter=(c,d)=>this.overrides?.isAfter?this.overrides.isAfter(c,d):Yy(c,d),this.isBefore=(c,d)=>this.overrides?.isBefore?this.overrides.isBefore(c,d):Gy(c,d),this.isDate=c=>this.overrides?.isDate?this.overrides.isDate(c):Ky(c),this.isSameDay=(c,d)=>this.overrides?.isSameDay?this.overrides.isSameDay(c,d):Qy(c,d),this.isSameMonth=(c,d)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(c,d):Vy(c,d),this.isSameYear=(c,d)=>this.overrides?.isSameYear?this.overrides.isSameYear(c,d):Xy(c,d),this.max=c=>this.overrides?.max?this.overrides.max(c):Zy(c),this.min=c=>this.overrides?.min?this.overrides.min(c):Jy(c),this.setMonth=(c,d)=>this.overrides?.setMonth?this.overrides.setMonth(c,d):Wy(c,d),this.setYear=(c,d)=>this.overrides?.setYear?this.overrides.setYear(c,d):$y(c,d),this.startOfBroadcastWeek=(c,d)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(c,this):$g(c,this),this.startOfDay=c=>this.overrides?.startOfDay?this.overrides.startOfDay(c):Fy(c),this.startOfISOWeek=c=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(c):Iy(c),this.startOfMonth=c=>this.overrides?.startOfMonth?this.overrides.startOfMonth(c):Py(c),this.startOfWeek=(c,d)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(c,this.options):eb(c,this.options),this.startOfYear=c=>this.overrides?.startOfYear?this.overrides.startOfYear(c):tb(c),this.options={locale:Fg,...s},this.overrides=u}getDigitMap(){const{numerals:s="latn"}=this.options,u=new Intl.NumberFormat("en-US",{numberingSystem:s}),c={};for(let d=0;d<10;d++)c[d.toString()]=u.format(d);return c}replaceDigits(s){const u=this.getDigitMap();return s.replace(/\d/g,c=>u[c]||c)}formatNumber(s){return this.replaceDigits(s.toString())}getMonthYearOrder(){const s=this.options.locale?.code;return s&&on.yearFirstLocales.has(s)?"year-first":"month-first"}formatMonthYear(s){const{locale:u,timeZone:c,numerals:d}=this.options,h=u?.code;if(h&&on.yearFirstLocales.has(h))try{return new Intl.DateTimeFormat(h,{month:"long",year:"numeric",timeZone:c,numberingSystem:d}).format(s)}catch{}const m=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(s,m)}}on.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 Ln=new on;class Ig{constructor(s,u,c=Ln){this.date=s,this.displayMonth=u,this.outside=!!(u&&!c.isSameMonth(s,u)),this.dateLib=c,this.isoDate=c.format(s,"yyyy-MM-dd"),this.displayMonthId=c.format(u,"yyyy-MM"),this.dateMonthId=c.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class tj{constructor(s,u){this.date=s,this.weeks=u}}class nj{constructor(s,u){this.days=u,this.weekNumber=s}}function aj(l){return ie.createElement("button",{...l})}function lj(l){return ie.createElement("span",{...l})}function sj(l){const{size:s=24,orientation:u="left",className:c}=l;return ie.createElement("svg",{className:c,width:s,height:s,viewBox:"0 0 24 24"},u==="up"&&ie.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),u==="down"&&ie.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),u==="left"&&ie.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),u==="right"&&ie.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function ij(l){const{day:s,modifiers:u,...c}=l;return ie.createElement("td",{...c})}function oj(l){const{day:s,modifiers:u,...c}=l,d=ie.useRef(null);return ie.useEffect(()=>{u.focused&&d.current?.focus()},[u.focused]),ie.createElement("button",{ref:d,...c})}var he;(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"})(he||(he={}));var ut;(function(l){l.disabled="disabled",l.hidden="hidden",l.outside="outside",l.focused="focused",l.today="today"})(ut||(ut={}));var Dn;(function(l){l.range_end="range_end",l.range_middle="range_middle",l.range_start="range_start",l.selected="selected"})(Dn||(Dn={}));var ln;(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"})(ln||(ln={}));function rj(l){const{options:s,className:u,components:c,classNames:d,...h}=l,m=[d[he.Dropdown],u].join(" "),x=s?.find(({value:p})=>p===h.value);return ie.createElement("span",{"data-disabled":h.disabled,className:d[he.DropdownRoot]},ie.createElement(c.Select,{className:m,...h},s?.map(({value:p,label:j,disabled:M})=>ie.createElement(c.Option,{key:p,value:p,disabled:M},j))),ie.createElement("span",{className:d[he.CaptionLabel],"aria-hidden":!0},x?.label,ie.createElement(c.Chevron,{orientation:"down",size:18,className:d[he.Chevron]})))}function cj(l){return ie.createElement("div",{...l})}function uj(l){return ie.createElement("div",{...l})}function dj(l){const{calendarMonth:s,displayIndex:u,...c}=l;return ie.createElement("div",{...c},l.children)}function fj(l){const{calendarMonth:s,displayIndex:u,...c}=l;return ie.createElement("div",{...c})}function mj(l){return ie.createElement("table",{...l})}function hj(l){return ie.createElement("div",{...l})}const Pg=y.createContext(void 0);function yi(){const l=y.useContext(Pg);if(l===void 0)throw new Error("useDayPicker() must be used within a custom component.");return l}function xj(l){const{components:s}=yi();return ie.createElement(s.Dropdown,{...l})}function gj(l){const{onPreviousClick:s,onNextClick:u,previousMonth:c,nextMonth:d,...h}=l,{components:m,classNames:x,labels:{labelPrevious:p,labelNext:j}}=yi(),M=y.useCallback(S=>{d&&u?.(S)},[d,u]),v=y.useCallback(S=>{c&&s?.(S)},[c,s]);return ie.createElement("nav",{...h},ie.createElement(m.PreviousMonthButton,{type:"button",className:x[he.PreviousMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":p(c),onClick:v},ie.createElement(m.Chevron,{disabled:c?void 0:!0,className:x[he.Chevron],orientation:"left"})),ie.createElement(m.NextMonthButton,{type:"button",className:x[he.NextMonthButton],tabIndex:d?void 0:-1,"aria-disabled":d?void 0:!0,"aria-label":j(d),onClick:M},ie.createElement(m.Chevron,{disabled:d?void 0:!0,orientation:"right",className:x[he.Chevron]})))}function pj(l){const{components:s}=yi();return ie.createElement(s.Button,{...l})}function vj(l){return ie.createElement("option",{...l})}function yj(l){const{components:s}=yi();return ie.createElement(s.Button,{...l})}function bj(l){const{rootRef:s,...u}=l;return ie.createElement("div",{...u,ref:s})}function Sj(l){return ie.createElement("select",{...l})}function Nj(l){const{week:s,...u}=l;return ie.createElement("tr",{...u})}function jj(l){return ie.createElement("th",{...l})}function wj(l){return ie.createElement("thead",{"aria-hidden":!0},ie.createElement("tr",{...l}))}function Cj(l){const{week:s,...u}=l;return ie.createElement("th",{...u})}function Ej(l){return ie.createElement("th",{...l})}function Mj(l){return ie.createElement("tbody",{...l})}function zj(l){const{components:s}=yi();return ie.createElement(s.Dropdown,{...l})}const Dj=Object.freeze(Object.defineProperty({__proto__:null,Button:aj,CaptionLabel:lj,Chevron:sj,Day:ij,DayButton:oj,Dropdown:rj,DropdownNav:cj,Footer:uj,Month:dj,MonthCaption:fj,MonthGrid:mj,Months:hj,MonthsDropdown:xj,Nav:gj,NextMonthButton:pj,Option:vj,PreviousMonthButton:yj,Root:bj,Select:Sj,Week:Nj,WeekNumber:Cj,WeekNumberHeader:Ej,Weekday:jj,Weekdays:wj,Weeks:Mj,YearsDropdown:zj},Symbol.toStringTag,{value:"Module"}));function da(l,s,u=!1,c=Ln){let{from:d,to:h}=l;const{differenceInCalendarDays:m,isSameDay:x}=c;return d&&h?(m(h,d)<0&&([d,h]=[h,d]),m(s,d)>=(u?1:0)&&m(h,s)>=(u?1:0)):!u&&h?x(h,s):!u&&d?x(d,s):!1}function td(l){return!!(l&&typeof l=="object"&&"before"in l&&"after"in l)}function sr(l){return!!(l&&typeof l=="object"&&"from"in l)}function nd(l){return!!(l&&typeof l=="object"&&"after"in l)}function ad(l){return!!(l&&typeof l=="object"&&"before"in l)}function ep(l){return!!(l&&typeof l=="object"&&"dayOfWeek"in l)}function tp(l,s){return Array.isArray(l)&&l.every(s.isDate)}function fa(l,s,u=Ln){const c=Array.isArray(s)?s:[s],{isSameDay:d,differenceInCalendarDays:h,isAfter:m}=u;return c.some(x=>{if(typeof x=="boolean")return x;if(u.isDate(x))return d(l,x);if(tp(x,u))return x.some(p=>d(l,p));if(sr(x))return da(x,l,!1,u);if(ep(x))return Array.isArray(x.dayOfWeek)?x.dayOfWeek.includes(l.getDay()):x.dayOfWeek===l.getDay();if(td(x)){const p=h(x.before,l),j=h(x.after,l),M=p>0,v=j<0;return m(x.before,x.after)?v&&M:M||v}return nd(x)?h(l,x.after)>0:ad(x)?h(x.before,l)>0:typeof x=="function"?x(l):!1})}function Oj(l,s,u,c,d){const{disabled:h,hidden:m,modifiers:x,showOutsideDays:p,broadcastCalendar:j,today:M=d.today()}=s,{isSameDay:v,isSameMonth:S,startOfMonth:_,isBefore:B,endOfMonth:K,isAfter:Z}=d,k=u&&_(u),W=c&&K(c),V={[ut.focused]:[],[ut.outside]:[],[ut.disabled]:[],[ut.hidden]:[],[ut.today]:[]},F={};for(const R of l){const{date:E,displayMonth:U}=R,G=!!(U&&!S(E,U)),ne=!!(k&&B(E,k)),re=!!(W&&Z(E,W)),ce=!!(h&&fa(E,h,d)),ae=!!(m&&fa(E,m,d))||ne||re||!j&&!p&&G||j&&p===!1&&G,we=v(E,M);G&&V.outside.push(R),ce&&V.disabled.push(R),ae&&V.hidden.push(R),we&&V.today.push(R),x&&Object.keys(x).forEach(P=>{const de=x?.[P];de&&fa(E,de,d)&&(F[P]?F[P].push(R):F[P]=[R])})}return R=>{const E={[ut.focused]:!1,[ut.disabled]:!1,[ut.hidden]:!1,[ut.outside]:!1,[ut.today]:!1},U={};for(const G in V){const ne=V[G];E[G]=ne.some(re=>re===R)}for(const G in F)U[G]=F[G].some(ne=>ne===R);return{...E,...U}}}function Tj(l,s,u={}){return Object.entries(l).filter(([,d])=>d===!0).reduce((d,[h])=>(u[h]?d.push(u[h]):s[ut[h]]?d.push(s[ut[h]]):s[Dn[h]]&&d.push(s[Dn[h]]),d),[s[he.Day]])}function Aj(l){return{...Dj,...l}}function _j(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,c])=>{u.startsWith("data-")&&(s[u]=c)}),s}function kj(){const l={};for(const s in he)l[he[s]]=`rdp-${he[s]}`;for(const s in ut)l[ut[s]]=`rdp-${ut[s]}`;for(const s in Dn)l[Dn[s]]=`rdp-${Dn[s]}`;for(const s in ln)l[ln[s]]=`rdp-${ln[s]}`;return l}function np(l,s,u){return(u??new on(s)).formatMonthYear(l)}const Rj=np;function Uj(l,s,u){return(u??new on(s)).format(l,"d")}function Hj(l,s=Ln){return s.format(l,"LLLL")}function Bj(l,s,u){return(u??new on(s)).format(l,"cccccc")}function qj(l,s=Ln){return l<10?s.formatNumber(`0${l.toLocaleString()}`):s.formatNumber(`${l.toLocaleString()}`)}function Lj(){return""}function ap(l,s=Ln){return s.format(l,"yyyy")}const Yj=ap,Gj=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:np,formatDay:Uj,formatMonthCaption:Rj,formatMonthDropdown:Hj,formatWeekNumber:qj,formatWeekNumberHeader:Lj,formatWeekdayName:Bj,formatYearCaption:Yj,formatYearDropdown:ap},Symbol.toStringTag,{value:"Module"}));function Kj(l){return l?.formatMonthCaption&&!l.formatCaption&&(l.formatCaption=l.formatMonthCaption),l?.formatYearCaption&&!l.formatYearDropdown&&(l.formatYearDropdown=l.formatYearCaption),{...Gj,...l}}function ld(l,s,u,c){let d=(c??new on(u)).format(l,"PPPP");return s.today&&(d=`Today, ${d}`),s.selected&&(d=`${d}, selected`),d}const Qj=ld;function sd(l,s,u){return(u??new on(s)).formatMonthYear(l)}const Vj=sd;function lp(l,s,u,c){let d=(c??new on(u)).format(l,"PPPP");return s?.today&&(d=`Today, ${d}`),d}function sp(l){return"Choose the Month"}function ip(){return""}const Xj="Go to the Next Month";function op(l,s){return Xj}function rp(l){return"Go to the Previous Month"}function cp(l,s,u){return(u??new on(s)).format(l,"cccc")}function up(l,s){return`Week ${l}`}function dp(l){return"Week Number"}function fp(l){return"Choose the Year"}const Zj=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Vj,labelDay:Qj,labelDayButton:ld,labelGrid:sd,labelGridcell:lp,labelMonthDropdown:sp,labelNav:ip,labelNext:op,labelPrevious:rp,labelWeekNumber:up,labelWeekNumberHeader:dp,labelWeekday:cp,labelYearDropdown:fp},Symbol.toStringTag,{value:"Module"})),Mn=(l,s,u)=>s||(u?typeof u=="function"?u:(...c)=>u:l);function Jj(l,s){const u=s.locale?.labels??{};return{...Zj,...l??{},labelDayButton:Mn(ld,l?.labelDayButton,u.labelDayButton),labelMonthDropdown:Mn(sp,l?.labelMonthDropdown,u.labelMonthDropdown),labelNext:Mn(op,l?.labelNext,u.labelNext),labelPrevious:Mn(rp,l?.labelPrevious,u.labelPrevious),labelWeekNumber:Mn(up,l?.labelWeekNumber,u.labelWeekNumber),labelYearDropdown:Mn(fp,l?.labelYearDropdown,u.labelYearDropdown),labelGrid:Mn(sd,l?.labelGrid,u.labelGrid),labelGridcell:Mn(lp,l?.labelGridcell,u.labelGridcell),labelNav:Mn(ip,l?.labelNav,u.labelNav),labelWeekNumberHeader:Mn(dp,l?.labelWeekNumberHeader,u.labelWeekNumberHeader),labelWeekday:Mn(cp,l?.labelWeekday,u.labelWeekday)}}function Wj(l,s,u,c,d){const{startOfMonth:h,startOfYear:m,endOfYear:x,eachMonthOfInterval:p,getMonth:j}=d;return p({start:m(l),end:x(l)}).map(S=>{const _=c.formatMonthDropdown(S,d),B=j(S),K=s&&S<h(s)||u&&S>h(u)||!1;return{value:B,label:_,disabled:K}})}function $j(l,s={},u={}){let c={...s?.[he.Day]};return Object.entries(l).filter(([,d])=>d===!0).forEach(([d])=>{c={...c,...u?.[d]}}),c}function Fj(l,s,u,c){const d=c??l.today(),h=u?l.startOfBroadcastWeek(d,l):s?l.startOfISOWeek(d):l.startOfWeek(d),m=[];for(let x=0;x<7;x++){const p=l.addDays(h,x);m.push(p)}return m}function Ij(l,s,u,c,d=!1){if(!l||!s)return;const{startOfYear:h,endOfYear:m,eachYearOfInterval:x,getYear:p}=c,j=h(l),M=m(s),v=x({start:j,end:M});return d&&v.reverse(),v.map(S=>{const _=u.formatYearDropdown(S,c);return{value:p(S),label:_,disabled:!1}})}const bi=l=>l instanceof HTMLElement?l:null,Cu=l=>[...l.querySelectorAll("[data-animated-month]")??[]],Pj=l=>bi(l.querySelector("[data-animated-month]")),Eu=l=>bi(l.querySelector("[data-animated-caption]")),Mu=l=>bi(l.querySelector("[data-animated-weeks]")),e2=l=>bi(l.querySelector("[data-animated-nav]")),t2=l=>bi(l.querySelector("[data-animated-weekdays]"));function n2(l,s,{classNames:u,months:c,focused:d,dateLib:h}){const m=y.useRef(null),x=y.useRef(c),p=y.useRef(!1);y.useLayoutEffect(()=>{const j=x.current;if(x.current=c,!s||!l.current||!(l.current instanceof HTMLElement)||c.length===0||j.length===0||c.length!==j.length)return;const M=h.isSameMonth(c[0].date,j[0].date),v=h.isAfter(c[0].date,j[0].date),S=v?u[ln.caption_after_enter]:u[ln.caption_before_enter],_=v?u[ln.weeks_after_enter]:u[ln.weeks_before_enter],B=m.current,K=l.current.cloneNode(!0);if(K instanceof HTMLElement?(Cu(K).forEach(V=>{if(!(V instanceof HTMLElement))return;const F=Pj(V);F&&V.contains(F)&&V.removeChild(F);const R=Eu(V);R&&R.classList.remove(S);const E=Mu(V);E&&E.classList.remove(_)}),m.current=K):m.current=null,p.current||M||d)return;const Z=B instanceof HTMLElement?Cu(B):[],k=Cu(l.current);if(k?.every(W=>W instanceof HTMLElement)&&Z&&Z.every(W=>W instanceof HTMLElement)){p.current=!0,l.current.style.isolation="isolate";const W=e2(l.current);W&&(W.style.zIndex="1"),k.forEach((V,F)=>{const R=Z[F];if(!R)return;V.style.position="relative",V.style.overflow="hidden";const E=Eu(V);E&&E.classList.add(S);const U=Mu(V);U&&U.classList.add(_);const G=()=>{p.current=!1,l.current&&(l.current.style.isolation=""),W&&(W.style.zIndex=""),E&&E.classList.remove(S),U&&U.classList.remove(_),V.style.position="",V.style.overflow="",V.contains(R)&&V.removeChild(R)};R.style.pointerEvents="none",R.style.position="absolute",R.style.overflow="hidden",R.setAttribute("aria-hidden","true");const ne=t2(R);ne&&(ne.style.opacity="0");const re=Eu(R);re&&(re.classList.add(v?u[ln.caption_before_exit]:u[ln.caption_after_exit]),re.addEventListener("animationend",G));const ce=Mu(R);ce&&ce.classList.add(v?u[ln.weeks_before_exit]:u[ln.weeks_after_exit]),V.insertBefore(R,V.firstChild)})}})}function a2(l,s,u,c){const d=l[0],h=l[l.length-1],{ISOWeek:m,fixedWeeks:x,broadcastCalendar:p}=u??{},{addDays:j,differenceInCalendarDays:M,differenceInCalendarMonths:v,endOfBroadcastWeek:S,endOfISOWeek:_,endOfMonth:B,endOfWeek:K,isAfter:Z,startOfBroadcastWeek:k,startOfISOWeek:W,startOfWeek:V}=c,F=p?k(d,c):m?W(d):V(d),R=p?S(h):m?_(B(h)):K(B(h)),E=s&&(p?S(s):m?_(s):K(s)),U=E&&Z(R,E)?E:R,G=M(U,F),ne=v(h,d)+1,re=[];for(let we=0;we<=G;we++){const P=j(F,we);re.push(P)}const ae=(p?35:42)*ne;if(x&&re.length<ae){const we=ae-re.length;for(let P=0;P<we;P++){const de=j(re[re.length-1],1);re.push(de)}}return re}function l2(l){const s=[];return l.reduce((u,c)=>{const d=c.weeks.reduce((h,m)=>h.concat(m.days.slice()),s.slice());return u.concat(d.slice())},s.slice())}function s2(l,s,u,c){const{numberOfMonths:d=1}=u,h=[];for(let m=0;m<d;m++){const x=c.addMonths(l,m);if(s&&x>s)break;h.push(x)}return h}function Dx(l,s,u,c){const{month:d,defaultMonth:h,today:m=c.today(),numberOfMonths:x=1}=l;let p=d||h||m;const{differenceInCalendarMonths:j,addMonths:M,startOfMonth:v}=c;if(u&&j(u,p)<x-1){const S=-1*(x-1);p=M(u,S)}return s&&j(p,s)<0&&(p=s),v(p)}function i2(l,s,u,c){const{addDays:d,endOfBroadcastWeek:h,endOfISOWeek:m,endOfMonth:x,endOfWeek:p,getISOWeek:j,getWeek:M,startOfBroadcastWeek:v,startOfISOWeek:S,startOfWeek:_}=c,B=l.reduce((K,Z)=>{const k=u.broadcastCalendar?v(Z,c):u.ISOWeek?S(Z):_(Z),W=u.broadcastCalendar?h(Z):u.ISOWeek?m(x(Z)):p(x(Z)),V=s.filter(U=>U>=k&&U<=W),F=u.broadcastCalendar?35:42;if(u.fixedWeeks&&V.length<F){const U=s.filter(G=>{const ne=F-V.length;return G>W&&G<=d(W,ne)});V.push(...U)}const R=V.reduce((U,G)=>{const ne=u.ISOWeek?j(G):M(G),re=U.find(ae=>ae.weekNumber===ne),ce=new Ig(G,Z,c);return re?re.days.push(ce):U.push(new nj(ne,[ce])),U},[]),E=new tj(Z,R);return K.push(E),K},[]);return u.reverseMonths?B.reverse():B}function o2(l,s){let{startMonth:u,endMonth:c}=l;const{startOfYear:d,startOfDay:h,startOfMonth:m,endOfMonth:x,addYears:p,endOfYear:j,newDate:M,today:v}=s,{fromYear:S,toYear:_,fromMonth:B,toMonth:K}=l;!u&&B&&(u=B),!u&&S&&(u=s.newDate(S,0,1)),!c&&K&&(c=K),!c&&_&&(c=M(_,11,31));const Z=l.captionLayout==="dropdown"||l.captionLayout==="dropdown-years";return u?u=m(u):S?u=M(S,0,1):!u&&Z&&(u=d(p(l.today??v(),-100))),c?c=x(c):_?c=M(_,11,31):!c&&Z&&(c=j(l.today??v())),[u&&h(u),c&&h(c)]}function r2(l,s,u,c){if(u.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:h=1}=u,{startOfMonth:m,addMonths:x,differenceInCalendarMonths:p}=c,j=d?h:1,M=m(l);if(!s)return x(M,j);if(!(p(s,l)<h))return x(M,j)}function c2(l,s,u,c){if(u.disableNavigation)return;const{pagedNavigation:d,numberOfMonths:h}=u,{startOfMonth:m,addMonths:x,differenceInCalendarMonths:p}=c,j=d?h??1:1,M=m(l);if(!s)return x(M,-j);if(!(p(M,s)<=0))return x(M,-j)}function u2(l){const s=[];return l.reduce((u,c)=>u.concat(c.weeks.slice()),s.slice())}function ir(l,s){const[u,c]=y.useState(l);return[s===void 0?u:s,c]}function d2(l,s){const[u,c]=o2(l,s),{startOfMonth:d,endOfMonth:h}=s,m=Dx(l,u,c,s),[x,p]=ir(m,l.month?m:void 0);y.useEffect(()=>{const F=Dx(l,u,c,s);p(F)},[l.timeZone]);const{months:j,weeks:M,days:v,previousMonth:S,nextMonth:_}=y.useMemo(()=>{const F=s2(x,c,{numberOfMonths:l.numberOfMonths},s),R=a2(F,l.endMonth?h(l.endMonth):void 0,{ISOWeek:l.ISOWeek,fixedWeeks:l.fixedWeeks,broadcastCalendar:l.broadcastCalendar},s),E=i2(F,R,{broadcastCalendar:l.broadcastCalendar,fixedWeeks:l.fixedWeeks,ISOWeek:l.ISOWeek,reverseMonths:l.reverseMonths},s),U=u2(E),G=l2(E),ne=c2(x,u,l,s),re=r2(x,c,l,s);return{months:E,weeks:U,days:G,previousMonth:ne,nextMonth:re}},[s,x.getTime(),c?.getTime(),u?.getTime(),l.disableNavigation,l.broadcastCalendar,l.endMonth?.getTime(),l.fixedWeeks,l.ISOWeek,l.numberOfMonths,l.pagedNavigation,l.reverseMonths]),{disableNavigation:B,onMonthChange:K}=l,Z=F=>M.some(R=>R.days.some(E=>E.isEqualTo(F))),k=F=>{if(B)return;let R=d(F);u&&R<d(u)&&(R=d(u)),c&&R>d(c)&&(R=d(c)),p(R),K?.(R)};return{months:j,weeks:M,days:v,navStart:u,navEnd:c,previousMonth:S,nextMonth:_,goToMonth:k,goToDay:F=>{Z(F)||k(F.date)}}}var Bn;(function(l){l[l.Today=0]="Today",l[l.Selected=1]="Selected",l[l.LastFocused=2]="LastFocused",l[l.FocusedModifier=3]="FocusedModifier"})(Bn||(Bn={}));function Ox(l){return!l[ut.disabled]&&!l[ut.hidden]&&!l[ut.outside]}function f2(l,s,u,c){let d,h=-1;for(const m of l){const x=s(m);Ox(x)&&(x[ut.focused]&&h<Bn.FocusedModifier?(d=m,h=Bn.FocusedModifier):c?.isEqualTo(m)&&h<Bn.LastFocused?(d=m,h=Bn.LastFocused):u(m.date)&&h<Bn.Selected?(d=m,h=Bn.Selected):x[ut.today]&&h<Bn.Today&&(d=m,h=Bn.Today))}return d||(d=l.find(m=>Ox(s(m)))),d}function m2(l,s,u,c,d,h,m){const{ISOWeek:x,broadcastCalendar:p}=h,{addDays:j,addMonths:M,addWeeks:v,addYears:S,endOfBroadcastWeek:_,endOfISOWeek:B,endOfWeek:K,max:Z,min:k,startOfBroadcastWeek:W,startOfISOWeek:V,startOfWeek:F}=m;let E={day:j,week:v,month:M,year:S,startOfWeek:U=>p?W(U,m):x?V(U):F(U),endOfWeek:U=>p?_(U):x?B(U):K(U)}[l](u,s==="after"?1:-1);return s==="before"&&c?E=Z([c,E]):s==="after"&&d&&(E=k([d,E])),E}function mp(l,s,u,c,d,h,m,x=0){if(x>365)return;const p=m2(l,s,u.date,c,d,h,m),j=!!(h.disabled&&fa(p,h.disabled,m)),M=!!(h.hidden&&fa(p,h.hidden,m)),v=p,S=new Ig(p,v,m);return!j&&!M?S:mp(l,s,S,c,d,h,m,x+1)}function h2(l,s,u,c,d){const{autoFocus:h}=l,[m,x]=y.useState(),p=f2(s.days,u,c||(()=>!1),m),[j,M]=y.useState(h?p:void 0);return{isFocusTarget:K=>!!p?.isEqualTo(K),setFocused:M,focused:j,blur:()=>{x(j),M(void 0)},moveFocus:(K,Z)=>{if(!j)return;const k=mp(K,Z,j,s.navStart,s.navEnd,l,d);k&&(l.disableNavigation&&!s.days.some(V=>V.isEqualTo(k))||(s.goToDay(k),M(k)))}}}function x2(l,s){const{selected:u,required:c,onSelect:d}=l,[h,m]=ir(u,d?u:void 0),x=d?u:h,{isSameDay:p}=s,j=_=>x?.some(B=>p(B,_))??!1,{min:M,max:v}=l;return{selected:x,select:(_,B,K)=>{let Z=[...x??[]];if(j(_)){if(x?.length===M||c&&x?.length===1)return;Z=x?.filter(k=>!p(k,_))}else x?.length===v?Z=[_]:Z=[...Z,_];return d||m(Z),d?.(Z,_,B,K),Z},isSelected:j}}function g2(l,s,u=0,c=0,d=!1,h=Ln){const{from:m,to:x}=s||{},{isSameDay:p,isAfter:j,isBefore:M}=h;let v;if(!m&&!x)v={from:l,to:u>0?void 0:l};else if(m&&!x)p(m,l)?u===0?v={from:m,to:l}:d?v={from:m,to:void 0}:v=void 0:M(l,m)?v={from:l,to:m}:v={from:m,to:l};else if(m&&x)if(p(m,l)&&p(x,l))d?v={from:m,to:x}:v=void 0;else if(p(m,l))v={from:m,to:u>0?void 0:l};else if(p(x,l))v={from:l,to:u>0?void 0:l};else if(M(l,m))v={from:l,to:x};else if(j(l,m))v={from:m,to:l};else if(j(l,x))v={from:m,to:l};else throw new Error("Invalid range");if(v?.from&&v?.to){const S=h.differenceInCalendarDays(v.to,v.from);c>0&&S>c?v={from:l,to:void 0}:u>1&&S<u&&(v={from:l,to:void 0})}return v}function p2(l,s,u=Ln){const c=Array.isArray(s)?s:[s];let d=l.from;const h=u.differenceInCalendarDays(l.to,l.from),m=Math.min(h,6);for(let x=0;x<=m;x++){if(c.includes(d.getDay()))return!0;d=u.addDays(d,1)}return!1}function Tx(l,s,u=Ln){return da(l,s.from,!1,u)||da(l,s.to,!1,u)||da(s,l.from,!1,u)||da(s,l.to,!1,u)}function v2(l,s,u=Ln){const c=Array.isArray(s)?s:[s];if(c.filter(x=>typeof x!="function").some(x=>typeof x=="boolean"?x:u.isDate(x)?da(l,x,!1,u):tp(x,u)?x.some(p=>da(l,p,!1,u)):sr(x)?x.from&&x.to?Tx(l,{from:x.from,to:x.to},u):!1:ep(x)?p2(l,x.dayOfWeek,u):td(x)?u.isAfter(x.before,x.after)?Tx(l,{from:u.addDays(x.after,1),to:u.addDays(x.before,-1)},u):fa(l.from,x,u)||fa(l.to,x,u):nd(x)||ad(x)?fa(l.from,x,u)||fa(l.to,x,u):!1))return!0;const m=c.filter(x=>typeof x=="function");if(m.length){let x=l.from;const p=u.differenceInCalendarDays(l.to,l.from);for(let j=0;j<=p;j++){if(m.some(M=>M(x)))return!0;x=u.addDays(x,1)}}return!1}function y2(l,s){const{disabled:u,excludeDisabled:c,selected:d,required:h,onSelect:m}=l,[x,p]=ir(d,m?d:void 0),j=m?d:x;return{selected:j,select:(S,_,B)=>{const{min:K,max:Z}=l,k=S?g2(S,j,K,Z,h,s):void 0;return c&&u&&k?.from&&k.to&&v2({from:k.from,to:k.to},u,s)&&(k.from=S,k.to=void 0),m||p(k),m?.(k,S,_,B),k},isSelected:S=>j&&da(j,S,!1,s)}}function b2(l,s){const{selected:u,required:c,onSelect:d}=l,[h,m]=ir(u,d?u:void 0),x=d?u:h,{isSameDay:p}=s;return{selected:x,select:(v,S,_)=>{let B=v;return!c&&x&&x&&p(v,x)&&(B=void 0),d||m(B),d?.(B,v,S,_),B},isSelected:v=>x?p(x,v):!1}}function S2(l,s){const u=b2(l,s),c=x2(l,s),d=y2(l,s);switch(l.mode){case"single":return u;case"multiple":return c;case"range":return d;default:return}}function _t(l,s){return l instanceof ua&&l.timeZone===s?l:new ua(l,s)}function Ax(l,s){return typeof l=="boolean"||typeof l=="function"?l:l instanceof Date?_t(l,s):Array.isArray(l)?l.map(u=>u instanceof Date?_t(u,s):u):sr(l)?{...l,from:l.from?_t(l.from,s):l.from,to:l.to?_t(l.to,s):l.to}:td(l)?{before:_t(l.before,s),after:_t(l.after,s)}:nd(l)?{after:_t(l.after,s)}:ad(l)?{before:_t(l.before,s)}:l}function zu(l,s){return l&&(Array.isArray(l)?l.map(u=>Ax(u,s)):Ax(l,s))}function N2(l){let s=l;const u=s.timeZone;if(u&&(s={...l,timeZone:u},s.today&&(s.today=_t(s.today,u)),s.month&&(s.month=_t(s.month,u)),s.defaultMonth&&(s.defaultMonth=_t(s.defaultMonth,u)),s.startMonth&&(s.startMonth=_t(s.startMonth,u)),s.endMonth&&(s.endMonth=_t(s.endMonth,u)),s.mode==="single"&&s.selected?s.selected=_t(s.selected,u):s.mode==="multiple"&&s.selected?s.selected=s.selected?.map(me=>_t(me,u)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?_t(s.selected.from,u):s.selected.from,to:s.selected.to?_t(s.selected.to,u):s.selected.to}),s.disabled!==void 0&&(s.disabled=zu(s.disabled,u)),s.hidden!==void 0&&(s.hidden=zu(s.hidden,u)),s.modifiers)){const me={};Object.keys(s.modifiers).forEach(Ce=>{me[Ce]=zu(s.modifiers?.[Ce],u)}),s.modifiers=me}const{components:c,formatters:d,labels:h,dateLib:m,locale:x,classNames:p}=y.useMemo(()=>{const me={...Fg,...s.locale},Ce=new on({locale:me,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:Ce,components:Aj(s.components),formatters:Kj(s.formatters),labels:Jj(s.labels,Ce.options),locale:me,classNames:{...kj(),...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:m.today()});const{captionLayout:j,mode:M,navLayout:v,numberOfMonths:S=1,onDayBlur:_,onDayClick:B,onDayFocus:K,onDayKeyDown:Z,onDayMouseEnter:k,onDayMouseLeave:W,onNextClick:V,onPrevClick:F,showWeekNumber:R,styles:E}=s,{formatCaption:U,formatDay:G,formatMonthDropdown:ne,formatWeekNumber:re,formatWeekNumberHeader:ce,formatWeekdayName:ae,formatYearDropdown:we}=d,P=d2(s,m),{days:de,months:D,navStart:$,navEnd:le,previousMonth:xe,nextMonth:Ne,goToMonth:Oe}=P,Ee=Oj(de,s,$,le,m),{isSelected:J,select:ee,selected:se}=S2(s,m)??{},{blur:te,focused:N,isFocusTarget:H,moveFocus:X,setFocused:fe}=h2(s,P,Ee,J??(()=>!1),m),{labelDayButton:ye,labelGridcell:ze,labelGrid:Ge,labelMonthDropdown:We,labelNav:gt,labelPrevious:et,labelNext:Zt,labelWeekday:be,labelWeekNumber:rt,labelWeekNumberHeader:pt,labelYearDropdown:ct}=h,cn=y.useMemo(()=>Fj(m,s.ISOWeek,s.broadcastCalendar,s.today),[m,s.ISOWeek,s.broadcastCalendar,s.today]),Jt=M!==void 0||B!==void 0,tt=y.useCallback(()=>{xe&&(Oe(xe),F?.(xe))},[xe,Oe,F]),Mt=y.useCallback(()=>{Ne&&(Oe(Ne),V?.(Ne))},[Oe,Ne,V]),Yn=y.useCallback((me,Ce)=>ve=>{ve.preventDefault(),ve.stopPropagation(),fe(me),!Ce.disabled&&(ee?.(me.date,Ce,ve),B?.(me.date,Ce,ve))},[ee,B,fe]),Ga=y.useCallback((me,Ce)=>ve=>{fe(me),K?.(me.date,Ce,ve)},[K,fe]),An=y.useCallback((me,Ce)=>ve=>{te(),_?.(me.date,Ce,ve)},[te,_]),_n=y.useCallback((me,Ce)=>ve=>{const _e={ArrowLeft:[ve.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[ve.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[ve.shiftKey?"year":"week","after"],ArrowUp:[ve.shiftKey?"year":"week","before"],PageUp:[ve.shiftKey?"year":"month","before"],PageDown:[ve.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(_e[ve.key]){ve.preventDefault(),ve.stopPropagation();const[nt,je]=_e[ve.key];X(nt,je)}Z?.(me.date,Ce,ve)},[X,Z,s.dir]),xl=y.useCallback((me,Ce)=>ve=>{k?.(me.date,Ce,ve)},[k]),us=y.useCallback((me,Ce)=>ve=>{W?.(me.date,Ce,ve)},[W]),ds=y.useCallback(me=>Ce=>{const ve=Number(Ce.target.value),_e=m.setMonth(m.startOfMonth(me),ve);Oe(_e)},[m,Oe]),Gn=y.useCallback(me=>Ce=>{const ve=Number(Ce.target.value),_e=m.setYear(m.startOfMonth(me),ve);Oe(_e)},[m,Oe]),{className:I,style:Te}=y.useMemo(()=>({className:[p[he.Root],s.className].filter(Boolean).join(" "),style:{...E?.[he.Root],...s.style}}),[p,s.className,s.style,E]),pe=_j(s),Ae=y.useRef(null);n2(Ae,!!s.animate,{classNames:p,months:D,focused:N,dateLib:m});const st={dayPickerProps:s,selected:se,select:ee,isSelected:J,months:D,nextMonth:Ne,previousMonth:xe,goToMonth:Oe,getModifiers:Ee,components:c,classNames:p,styles:E,labels:h,formatters:d};return ie.createElement(Pg.Provider,{value:st},ie.createElement(c.Root,{rootRef:s.animate?Ae:void 0,className:I,style:Te,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"],...pe},ie.createElement(c.Months,{className:p[he.Months],style:E?.[he.Months]},!s.hideNavigation&&!v&&ie.createElement(c.Nav,{"data-animated-nav":s.animate?"true":void 0,className:p[he.Nav],style:E?.[he.Nav],"aria-label":gt(),onPreviousClick:tt,onNextClick:Mt,previousMonth:xe,nextMonth:Ne}),D.map((me,Ce)=>ie.createElement(c.Month,{"data-animated-month":s.animate?"true":void 0,className:p[he.Month],style:E?.[he.Month],key:Ce,displayIndex:Ce,calendarMonth:me},v==="around"&&!s.hideNavigation&&Ce===0&&ie.createElement(c.PreviousMonthButton,{type:"button",className:p[he.PreviousMonthButton],tabIndex:xe?void 0:-1,"aria-disabled":xe?void 0:!0,"aria-label":et(xe),onClick:tt,"data-animated-button":s.animate?"true":void 0},ie.createElement(c.Chevron,{disabled:xe?void 0:!0,className:p[he.Chevron],orientation:s.dir==="rtl"?"right":"left"})),ie.createElement(c.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:p[he.MonthCaption],style:E?.[he.MonthCaption],calendarMonth:me,displayIndex:Ce},j?.startsWith("dropdown")?ie.createElement(c.DropdownNav,{className:p[he.Dropdowns],style:E?.[he.Dropdowns]},(()=>{const ve=j==="dropdown"||j==="dropdown-months"?ie.createElement(c.MonthsDropdown,{key:"month",className:p[he.MonthsDropdown],"aria-label":We(),classNames:p,components:c,disabled:!!s.disableNavigation,onChange:ds(me.date),options:Wj(me.date,$,le,d,m),style:E?.[he.Dropdown],value:m.getMonth(me.date)}):ie.createElement("span",{key:"month"},ne(me.date,m)),_e=j==="dropdown"||j==="dropdown-years"?ie.createElement(c.YearsDropdown,{key:"year",className:p[he.YearsDropdown],"aria-label":ct(m.options),classNames:p,components:c,disabled:!!s.disableNavigation,onChange:Gn(me.date),options:Ij($,le,d,m,!!s.reverseYears),style:E?.[he.Dropdown],value:m.getYear(me.date)}):ie.createElement("span",{key:"year"},we(me.date,m));return m.getMonthYearOrder()==="year-first"?[_e,ve]:[ve,_e]})(),ie.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"}},U(me.date,m.options,m))):ie.createElement(c.CaptionLabel,{className:p[he.CaptionLabel],role:"status","aria-live":"polite"},U(me.date,m.options,m))),v==="around"&&!s.hideNavigation&&Ce===S-1&&ie.createElement(c.NextMonthButton,{type:"button",className:p[he.NextMonthButton],tabIndex:Ne?void 0:-1,"aria-disabled":Ne?void 0:!0,"aria-label":Zt(Ne),onClick:Mt,"data-animated-button":s.animate?"true":void 0},ie.createElement(c.Chevron,{disabled:Ne?void 0:!0,className:p[he.Chevron],orientation:s.dir==="rtl"?"left":"right"})),Ce===S-1&&v==="after"&&!s.hideNavigation&&ie.createElement(c.Nav,{"data-animated-nav":s.animate?"true":void 0,className:p[he.Nav],style:E?.[he.Nav],"aria-label":gt(),onPreviousClick:tt,onNextClick:Mt,previousMonth:xe,nextMonth:Ne}),ie.createElement(c.MonthGrid,{role:"grid","aria-multiselectable":M==="multiple"||M==="range","aria-label":Ge(me.date,m.options,m)||void 0,className:p[he.MonthGrid],style:E?.[he.MonthGrid]},!s.hideWeekdays&&ie.createElement(c.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:p[he.Weekdays],style:E?.[he.Weekdays]},R&&ie.createElement(c.WeekNumberHeader,{"aria-label":pt(m.options),className:p[he.WeekNumberHeader],style:E?.[he.WeekNumberHeader],scope:"col"},ce()),cn.map(ve=>ie.createElement(c.Weekday,{"aria-label":be(ve,m.options,m),className:p[he.Weekday],key:String(ve),style:E?.[he.Weekday],scope:"col"},ae(ve,m.options,m)))),ie.createElement(c.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:p[he.Weeks],style:E?.[he.Weeks]},me.weeks.map(ve=>ie.createElement(c.Week,{className:p[he.Week],key:ve.weekNumber,style:E?.[he.Week],week:ve},R&&ie.createElement(c.WeekNumber,{week:ve,style:E?.[he.WeekNumber],"aria-label":rt(ve.weekNumber,{locale:x}),className:p[he.WeekNumber],scope:"row",role:"rowheader"},re(ve.weekNumber,m)),ve.days.map(_e=>{const{date:nt}=_e,je=Ee(_e);if(je[ut.focused]=!je.hidden&&!!N?.isEqualTo(_e),je[Dn.selected]=J?.(nt)||je.selected,sr(se)){const{from:Wt,to:Nn}=se;je[Dn.range_start]=!!(Wt&&Nn&&m.isSameDay(nt,Wt)),je[Dn.range_end]=!!(Wt&&Nn&&m.isSameDay(nt,Nn)),je[Dn.range_middle]=da(se,nt,!0,m)}const kt=$j(je,E,s.modifiersStyles),Kn=Tj(je,p,s.modifiersClassNames),jt=!Jt&&!je.hidden?ze(nt,je,m.options,m):void 0;return ie.createElement(c.Day,{key:`${_e.isoDate}_${_e.displayMonthId}`,day:_e,modifiers:je,className:Kn.join(" "),style:kt,role:"gridcell","aria-selected":je.selected||void 0,"aria-label":jt,"data-day":_e.isoDate,"data-month":_e.outside?_e.dateMonthId:void 0,"data-selected":je.selected||void 0,"data-disabled":je.disabled||void 0,"data-hidden":je.hidden||void 0,"data-outside":_e.outside||void 0,"data-focused":je.focused||void 0,"data-today":je.today||void 0},!je.hidden&&Jt?ie.createElement(c.DayButton,{className:p[he.DayButton],style:E?.[he.DayButton],type:"button",day:_e,modifiers:je,disabled:!je.focused&&je.disabled||void 0,"aria-disabled":je.focused&&je.disabled||void 0,tabIndex:H(_e)?0:-1,"aria-label":ye(nt,je,m.options,m),onClick:Yn(_e,je),onBlur:An(_e,je),onFocus:Ga(_e,je),onKeyDown:_n(_e,je),onMouseEnter:xl(_e,je),onMouseLeave:us(_e,je)},G(nt,m.options,m)):!je.hidden&&G(_e.date,m.options,m))})))))))),s.footer&&ie.createElement(c.Footer,{className:p[he.Footer],style:E?.[he.Footer],role:"status","aria-live":"polite"},s.footer)))}function j2({className:l,classNames:s,showOutsideDays:u=!0,...c}){return i.jsx(N2,{showOutsideDays:u,className:L("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:L(is({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:L(is({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:L("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:L(is({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:L("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:L("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:L("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:L("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:d,className:h,...m})=>{const x=d==="left"?wb:d==="right"?Zo:d==="up"?Yu:$o;return i.jsx(x,{className:L("h-4 w-4",h),...m})}},...c})}j2.displayName="Calendar";const w2=y.lazy(()=>Tn(()=>import("./analytics-CknzoRYp.js"),__vite__mapDeps([9,1,2,10,4,5,11,6,7,8,3])).then(l=>({default:l.AnalyticsPage}))),C2=y.lazy(()=>Tn(()=>import("./api-U2LP6WF0.js"),__vite__mapDeps([12,1,2,5,6,7,4,8,3])).then(l=>({default:l.ApiPage}))),E2=y.lazy(()=>Tn(()=>import("./cliproxy-BEEaca31.js"),__vite__mapDeps([13,1,2,6,10,5,7,4,8,3])).then(l=>({default:l.CliproxyPage}))),M2=y.lazy(()=>Tn(()=>import("./cliproxy-control-panel-DKMAi4_4.js"),__vite__mapDeps([14,1,2,5])).then(l=>({default:l.CliproxyControlPanelPage}))),z2=y.lazy(()=>Tn(()=>import("./copilot-CQuiaJtb.js"),__vite__mapDeps([15,1,2,6,16,7,5,4,8,3])).then(l=>({default:l.CopilotPage}))),D2=y.lazy(()=>Tn(()=>import("./accounts-BXfC8K1x.js"),__vite__mapDeps([17,1,2,6,7,5,4,8,3])).then(l=>({default:l.AccountsPage}))),O2=y.lazy(()=>Tn(()=>import("./settings-C7wCYzo1.js"),__vite__mapDeps([18,1,2,16,0,3,4,5,6,7,8])).then(l=>({default:l.SettingsPage}))),T2=y.lazy(()=>Tn(()=>import("./health-BDkQz8vK.js"),__vite__mapDeps([19,1,2,6,7,5,4,8,3])).then(l=>({default:l.HealthPage}))),A2=y.lazy(()=>Tn(()=>import("./shared-QDPeNpnv.js"),__vite__mapDeps([20,1,2,10,5,6,7,4,8,3])).then(l=>({default:l.SharedPage})));function _2(){return i.jsx(Sy,{client:Hb,children:i.jsx(qb,{defaultTheme:"system",storageKey:"vite-ui-theme",children:i.jsx(Lb,{children:i.jsxs(vy,{children:[i.jsx(yy,{children:i.jsxs(En,{element:i.jsx(L1,{}),children:[i.jsx(En,{path:"/",element:i.jsx(fN,{})}),i.jsx(En,{path:"/analytics",element:i.jsx(w2,{})}),i.jsx(En,{path:"/api",element:i.jsx(C2,{})}),i.jsx(En,{path:"/cliproxy",element:i.jsx(E2,{})}),i.jsx(En,{path:"/cliproxy/control-panel",element:i.jsx(M2,{})}),i.jsx(En,{path:"/copilot",element:i.jsx(z2,{})}),i.jsx(En,{path:"/accounts",element:i.jsx(D2,{})}),i.jsx(En,{path:"/settings",element:i.jsx(O2,{})}),i.jsx(En,{path:"/health",element:i.jsx(T2,{})}),i.jsx(En,{path:"/shared",element:i.jsx(A2,{})})]})}),i.jsx(Ny,{position:"top-right"})]})})})})}const hp=document.getElementById("root");if(!hp)throw new Error("Root element not found. Failed to mount React application.");kb.createRoot(hp).render(i.jsx(y.StrictMode,{children:i.jsx(_2,{})}));export{Ru as $,Vg as A,Je as B,j2 as C,Xu as D,_N as E,Jg as F,Uu as G,W2 as H,zn as I,I2 as J,$2 as K,Sn as L,F2 as M,K2 as N,X2 as O,iw as P,Z2 as Q,V2 as R,ot as S,lw as T,YN as U,ed as V,lr as W,ml as X,hl as Y,Qg as Z,jx as _,ow as a,Tn as a0,Et as a1,Ug as a2,_u as a3,Hg as a4,Lg as a5,Gg as a6,g1 as a7,p1 as a8,v1 as a9,cN as aa,P2 as ab,Yg as ac,S1 as ad,sw as ae,ZN as b,L as c,ls as d,sn as e,$1 as f,G2 as g,F1 as h,ha as i,rw as j,tw as k,nw as l,ew as m,aw as n,Kg as o,dl as p,Au as q,K1 as r,Q2 as s,J2 as t,Fo as u,Zu as v,Ju as w,Wu as x,pg as y,AN as z};